Skip to content

Commit 47e30e8

Browse files
committed
[ZH] Add ui messages for more debug commands (#1258)
1 parent 904a74f commit 47e30e8

File tree

1 file changed

+60
-2
lines changed

1 file changed

+60
-2
lines changed

GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,6 +3304,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
33043304
AsciiString scriptName;
33053305
scriptName.format("KEY_F%d", script);
33063306
TheScriptEngine->runScript(scriptName);
3307+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugRunScript", L"Run script %d", script) );
33073308
}
33083309
disp = DESTROY_MESSAGE;
33093310
}
@@ -3391,6 +3392,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
33913392
// Doesn't make a valid network message
33923393
Player *localPlayer = ThePlayerList->getLocalPlayer();
33933394
localPlayer->toggleInstantBuild();
3395+
3396+
if (localPlayer->buildsInstantly())
3397+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugInstantBuildOn", L"Instant Build is ON") );
3398+
else
3399+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugInstantBuildOff", L"Instant Build is OFF") );
3400+
33943401
disp = DESTROY_MESSAGE;
33953402
}
33963403
break;
@@ -3402,6 +3409,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
34023409
Player *localPlayer = ThePlayerList->getLocalPlayer();
34033410
Money *money = localPlayer->getMoney();
34043411
money->deposit( 10000 );
3412+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugAddCash", L"Add Cash") );
34053413
}
34063414
break;
34073415
}
@@ -3944,6 +3952,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
39443952
case GameMessage::MSG_META_DEMO_LOD_DECREASE:
39453953
{
39463954
TheGameClient->adjustLOD(-1);
3955+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugDecreaseLOD", L"Decrease LOD") );
39473956
disp = DESTROY_MESSAGE;
39483957
break;
39493958
}
@@ -3953,6 +3962,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
39533962
case GameMessage::MSG_META_DEMO_LOD_INCREASE:
39543963
{
39553964
TheGameClient->adjustLOD(1);
3965+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugIncreaseLOD", L"Increase LOD") );
39563966
disp = DESTROY_MESSAGE;
39573967
break;
39583968
}
@@ -4200,6 +4210,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
42004210
{
42014211
TheWritableGlobalData->m_useShadowVolumes = !TheGlobalData->m_useShadowVolumes;
42024212
TheWritableGlobalData->m_useShadowDecals = !TheGlobalData->m_useShadowDecals;
4213+
4214+
if (TheWritableGlobalData->m_useShadowVolumes)
4215+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugShadowVolumesOn", L"Shadow Volumes is ON") );
4216+
else
4217+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugShadowVolumesOff", L"Shadow Volumes is OFF") );
4218+
42034219
disp = DESTROY_MESSAGE;
42044220
break;
42054221
}
@@ -4209,6 +4225,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
42094225
case GameMessage::MSG_META_DEMO_TOGGLE_FOGOFWAR:
42104226
{
42114227
TheWritableGlobalData->m_fogOfWarOn = !TheGlobalData->m_fogOfWarOn;
4228+
4229+
if (TheWritableGlobalData->m_fogOfWarOn)
4230+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugFogOfWarOn", L"Fog of War is ON") );
4231+
else
4232+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugFogOfWarOff", L"Fog of War is OFF") );
4233+
42124234
disp = DESTROY_MESSAGE;
42134235
break;
42144236
}
@@ -4428,10 +4450,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
44284450
TheDisplay->stopMovie();
44294451
TheInGameUI->stopMovie();
44304452
TheAudio->setOn(false, AudioAffect_All);
4453+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugSoundOff", L"Sound is OFF") );
44314454
}
44324455
else
44334456
{
44344457
TheAudio->setOn(true, AudioAffect_All);
4458+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugSoundOn", L"Sound is ON") );
44354459
}
44364460
disp = DESTROY_MESSAGE;
44374461
break;
@@ -4442,6 +4466,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
44424466
case GameMessage::MSG_META_DEMO_TOGGLE_TRACKMARKS:
44434467
{
44444468
TheWritableGlobalData->m_makeTrackMarks = !TheGlobalData->m_makeTrackMarks;
4469+
4470+
if (TheGlobalData->m_makeTrackMarks)
4471+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugTrackMarksOn", L"Track Marks is ON") );
4472+
else
4473+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugTrackMarksOff", L"Track Marks is OFF") );
4474+
44454475
disp = DESTROY_MESSAGE;
44464476
break;
44474477
}
@@ -4451,6 +4481,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
44514481
case GameMessage::MSG_META_DEMO_TOGGLE_WATERPLANE:
44524482
{
44534483
TheWritableGlobalData->m_useWaterPlane = !TheGlobalData->m_useWaterPlane;
4484+
4485+
if (TheGlobalData->m_useWaterPlane)
4486+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugWaterPlaneOn", L"Water Plane is ON") );
4487+
else
4488+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugWaterPlaneOff", L"Water Plane is OFF") );
4489+
44544490
disp = DESTROY_MESSAGE;
44554491
break;
44564492
}
@@ -4460,7 +4496,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
44604496
case GameMessage::MSG_META_DEMO_TIME_OF_DAY:
44614497
{
44624498
TimeOfDay tod = TimeOfDay((Int) TheGlobalData->m_timeOfDay + 1);
4463-
if (tod >= TIME_OF_DAY_COUNT)
4499+
if (tod < TIME_OF_DAY_FIRST || tod >= TIME_OF_DAY_COUNT)
44644500
tod = TIME_OF_DAY_FIRST;
44654501
if (TheWritableGlobalData->setTimeOfDay(tod))
44664502
{
@@ -4477,7 +4513,8 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
44774513
d->clearAndSetModelConditionFlags(empty, empty);
44784514
}
44794515
}
4480-
}
4516+
}
4517+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugTimeOfDay", L"Time of Day set to %hs", TimeOfDayNames[tod]) );
44814518
}
44824519
disp = DESTROY_MESSAGE;
44834520
break;
@@ -4490,6 +4527,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
44904527
// Doesn't make a valid network message
44914528
Player *localPlayer = ThePlayerList->getLocalPlayer();
44924529
localPlayer->toggleIgnorePrereqs();
4530+
4531+
if (localPlayer->ignoresPrereqs())
4532+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugIgnorePrereqOn", L"Ignore Prerequisites is ON") );
4533+
else
4534+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugIgnorePrereqOff", L"Ignore Prerequisites is OFF") );
4535+
44934536
disp = DESTROY_MESSAGE;
44944537
break;
44954538
}
@@ -4501,6 +4544,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
45014544
// Doesn't make a valid network message
45024545
Player *localPlayer = ThePlayerList->getLocalPlayer();
45034546
localPlayer->toggleInstantBuild();
4547+
4548+
if (localPlayer->buildsInstantly())
4549+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugInstantBuildOn", L"Instant Build is ON") );
4550+
else
4551+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugInstantBuildOff", L"Instant Build is OFF") );
4552+
45044553
disp = DESTROY_MESSAGE;
45054554
break;
45064555
}
@@ -4512,6 +4561,12 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
45124561
// Doesn't make a valid network message
45134562
Player *localPlayer = ThePlayerList->getLocalPlayer();
45144563
localPlayer->toggleFreeBuild();
4564+
4565+
if (localPlayer->buildsForFree())
4566+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugFreeBuildOn", L"Free Build is ON") );
4567+
else
4568+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugFreeBuildOff", L"Free Build is OFF") );
4569+
45154570
disp = DESTROY_MESSAGE;
45164571
break;
45174572
}
@@ -4533,6 +4588,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
45334588
Player *localPlayer = ThePlayerList->getLocalPlayer();
45344589
Money *money = localPlayer->getMoney();
45354590
money->deposit( 10000 );
4591+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE("GUI:DebugAddCash", L"Add Cash") );
45364592
}
45374593
break;
45384594
}
@@ -4555,6 +4611,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
45554611
AsciiString scriptName;
45564612
scriptName.format("KEY_F%d", script);
45574613
TheScriptEngine->runScript(scriptName);
4614+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugRunScript", L"Run script %d", script) );
45584615
}
45594616
disp = DESTROY_MESSAGE;
45604617
break;
@@ -4600,6 +4657,7 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
46004657
AsciiString name;
46014658
name.format("DemoObjective%02d", m_objective);
46024659
TheInGameUI->playMovie(name);
4660+
TheInGameUI->messageNoFormat( TheGameText->FETCH_OR_SUBSTITUTE_FORMAT("GUI:DebugObjectiveMove", L"Objective Movie %d", m_objective) );
46034661
}
46044662
disp = DESTROY_MESSAGE;
46054663
break;

0 commit comments

Comments
 (0)