@@ -876,6 +876,21 @@ const FieldParse InGameUI::s_fieldParseTable[] =
876
876
{ " ClearMinesRadiusCursor" , RadiusDecalTemplate::parseRadiusDecalTemplate, NULL , offsetof ( InGameUI, m_radiusCursors[ RADIUSCURSOR_CLEARMINES] ) },
877
877
{ " AmbulanceRadiusCursor" , RadiusDecalTemplate::parseRadiusDecalTemplate, NULL , offsetof ( InGameUI, m_radiusCursors[ RADIUSCURSOR_AMBULANCE] ) },
878
878
879
+ // TheSuperHackers @info ui enhancement configuration
880
+ { " SystemTimeFont" , INI::parseAsciiString, NULL , offsetof ( InGameUI, m_systemTimeFont ) },
881
+ { " SystemTimePointSize" , INI::parseInt, NULL , offsetof ( InGameUI, m_systemTimePointSize ) },
882
+ { " SystemTimeBold" , INI::parseBool, NULL , offsetof ( InGameUI, m_systemTimeBold ) },
883
+ { " SystemTimePosition" , INI::parseCoord2D, NULL , offsetof ( InGameUI, m_systemTimePosition ) },
884
+ { " SystemTimeColor" , INI::parseColorInt, NULL , offsetof ( InGameUI, m_systemTimeColor ) },
885
+ { " SystemTimeDropColor" , INI::parseColorInt, NULL , offsetof ( InGameUI, m_systemTimeDropColor ) },
886
+
887
+ { " SimulationTimerFont" , INI::parseAsciiString, NULL , offsetof ( InGameUI, m_simulationTimerFont ) },
888
+ { " SimulationTimerPointSize" , INI::parseInt, NULL , offsetof ( InGameUI, m_simulationTimerPointSize ) },
889
+ { " SimulationTimerBold" , INI::parseBool, NULL , offsetof ( InGameUI, m_simulationTimerBold ) },
890
+ { " SimulationTimerPosition" , INI::parseCoord2D, NULL , offsetof ( InGameUI, m_simulationTimerPosition ) },
891
+ { " SimulationTimerColor" , INI::parseColorInt, NULL , offsetof ( InGameUI, m_simulationTimerColor ) },
892
+ { " SimulationTimerDropColor" , INI::parseColorInt, NULL , offsetof ( InGameUI, m_simulationTimerDropColor ) },
893
+
879
894
{ NULL , NULL , NULL , 0 } // keep this last
880
895
};
881
896
@@ -1001,6 +1016,24 @@ InGameUI::InGameUI()
1001
1016
m_replayWindow = NULL ;
1002
1017
m_messagesOn = TRUE ;
1003
1018
1019
+ m_systemTimeString = NULL ;
1020
+ m_systemTimeFont = " Tahoma" ;
1021
+ m_systemTimePointSize = 8 ;
1022
+ m_systemTimeBold = FALSE ;
1023
+ m_systemTimePosition.x = 5 ; // TheSuperHackers @info relative to the left of the screen
1024
+ m_systemTimePosition.y = 0 ;
1025
+ m_systemTimeColor = GameMakeColor ( 255 , 255 , 255 , 255 );
1026
+ m_systemTimeDropColor = GameMakeColor ( 0 , 0 , 0 , 255 );
1027
+
1028
+ m_simulationTimerString = NULL ;
1029
+ m_simulationTimerFont = " Tahoma" ;
1030
+ m_simulationTimerPointSize = 8 ;
1031
+ m_simulationTimerBold = FALSE ;
1032
+ m_simulationTimerPosition.x = 5 ; // TheSuperHackers @info relative to the right of the screen
1033
+ m_simulationTimerPosition.y = 0 ;
1034
+ m_simulationTimerColor = GameMakeColor ( 255 , 255 , 255 , 255 );
1035
+ m_simulationTimerDropColor = GameMakeColor ( 0 , 0 , 0 , 255 );
1036
+
1004
1037
m_superweaponPosition.x = 0 .7f ;
1005
1038
m_superweaponPosition.y = 0 .7f ;
1006
1039
m_superweaponFlashDuration = 1 .0f ;
@@ -1082,6 +1115,9 @@ InGameUI::~InGameUI()
1082
1115
// delete the message resources
1083
1116
freeMessageResources ();
1084
1117
1118
+ // free custom ui strings
1119
+ freeCustomUiResources ();
1120
+
1085
1121
// delete the array for the drawbles
1086
1122
delete [] m_placeIcon;
1087
1123
m_placeIcon = NULL ;
@@ -1924,6 +1960,9 @@ void InGameUI::reset( void )
1924
1960
// free any message resources allocated
1925
1961
freeMessageResources ();
1926
1962
1963
+ // free custom ui strings
1964
+ freeCustomUiResources ();
1965
+
1927
1966
Int i;
1928
1967
for (i=0 ; i<MAX_PLAYER_COUNT; ++i)
1929
1968
{
@@ -2007,8 +2046,25 @@ void InGameUI::freeMessageResources( void )
2007
2046
2008
2047
} // end for i
2009
2048
2049
+ // release system time and simulation timer strings then set them to empty
2050
+ TheDisplayStringManager->freeDisplayString (m_systemTimeString);
2051
+ m_systemTimeString = NULL ;
2052
+ TheDisplayStringManager->freeDisplayString (m_simulationTimerString);
2053
+ m_simulationTimerString = NULL ;
2054
+
2010
2055
} // end freeMessageResources
2011
2056
2057
+ void InGameUI::freeCustomUiResources ( void )
2058
+ {
2059
+
2060
+ // release system time and simulation timer strings then set them to empty
2061
+ TheDisplayStringManager->freeDisplayString (m_systemTimeString);
2062
+ m_systemTimeString = NULL ;
2063
+ TheDisplayStringManager->freeDisplayString (m_simulationTimerString);
2064
+ m_simulationTimerString = NULL ;
2065
+
2066
+ } // end freeCustomUiResources
2067
+
2012
2068
// -------------------------------------------------------------------------------------------------
2013
2069
/* * Same as the unicode message method, but this takes an ascii string which is assumed
2014
2070
* to me a string manager label */
@@ -3465,6 +3521,53 @@ void InGameUI::disregardDrawable( Drawable *draw )
3465
3521
void InGameUI::postDraw ( void )
3466
3522
{
3467
3523
3524
+ // TheSuperHackers @info render the system time and simulation timer first, this way other text will render over them if they overlap
3525
+ // draw the current system time
3526
+ if (TheGlobalData->m_showSystemTime && !TheGameLogic->isInShellGame ())
3527
+ {
3528
+ if (!m_systemTimeString) {
3529
+ m_systemTimeString = TheDisplayStringManager->newDisplayString ();
3530
+ }
3531
+
3532
+ // current system time
3533
+ SYSTEMTIME systemTime;
3534
+ GetLocalTime ( &systemTime );
3535
+
3536
+ UnicodeString TimeString;
3537
+ TimeString.format (L" %2.2d:%2.2d:%2.2d" , systemTime.wHour , systemTime.wMinute , systemTime.wSecond );
3538
+ m_systemTimeString->setFont (TheWindowManager->winFindFont ( m_systemTimeFont,
3539
+ TheGlobalLanguageData->adjustFontSize (m_systemTimePointSize), m_systemTimeBold ));
3540
+ m_systemTimeString->setText (TimeString);
3541
+
3542
+ m_systemTimeString->draw (m_systemTimePosition.x , m_systemTimePosition.y , m_systemTimeColor, m_systemTimeDropColor);
3543
+ }
3544
+
3545
+ // draw the simulation timer
3546
+ if (TheGlobalData->m_showSimulationTimer && !TheGameLogic->isInShellGame ())
3547
+ {
3548
+ if (!m_simulationTimerString) {
3549
+ m_simulationTimerString = TheDisplayStringManager->newDisplayString ();
3550
+ }
3551
+
3552
+ Int currentFrame = TheGameLogic->getFrame ();
3553
+ Int currentSimulationTime = (Int) (SECONDS_PER_LOGICFRAME_REAL * currentFrame );
3554
+ Int hours = currentSimulationTime / 3600 ;
3555
+ Int minutes = (currentSimulationTime / 60 ) - (hours * 60 );
3556
+ Int seconds = currentSimulationTime - (minutes * 60 ) - (hours * 3600 );
3557
+ Int frame = currentFrame % 30 ;
3558
+
3559
+ UnicodeString simulationTimeString;
3560
+ simulationTimeString.format (L" %2.2d:%2.2d:%2.2d.%2.2d" , hours, minutes, seconds, frame);
3561
+ m_simulationTimerString->setFont (TheWindowManager->winFindFont ( m_simulationTimerFont,
3562
+ TheGlobalLanguageData->adjustFontSize (m_simulationTimerPointSize), m_simulationTimerBold ));
3563
+ m_simulationTimerString->setText (simulationTimeString);
3564
+
3565
+ // TheSuperHackers @info this implicitly offsets the simulation timer from the right instead of left of the screen
3566
+ int horizontalOffset = TheDisplay->getWidth () - (Int)m_simulationTimerPosition.x - m_simulationTimerString->getWidth ();
3567
+
3568
+ m_simulationTimerString->draw (horizontalOffset, m_simulationTimerPosition.y , m_simulationTimerColor, m_simulationTimerDropColor);
3569
+ }
3570
+
3468
3571
// render our display strings for the messages if on
3469
3572
if ( m_messagesOn )
3470
3573
{
0 commit comments