From 6b1d6a44d707ad83699fbfdffc40f074cd63a9b1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Aug 2020 20:14:00 +0200 Subject: [PATCH] - exported the item pickup messages to the string table and use the global 'nomonsters' flag. --- source/core/gamecontrol.cpp | 2 +- source/exhumed/src/2d.cpp | 7 +- source/exhumed/src/exhumed.cpp | 119 --------------------------------- source/exhumed/src/exhumed.h | 3 - source/exhumed/src/init.cpp | 26 +++---- source/exhumed/src/menu.cpp | 8 +-- source/exhumed/src/player.cpp | 34 +++++++--- wadsrc/static/language.csv | 33 ++++++++- 8 files changed, 72 insertions(+), 160 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index e61c2f551..5a9ed9eba 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -352,7 +352,7 @@ void UserConfig::ProcessOptions() Args->CollectFiles("-name", names, ".---"); // this shouldn't collect any file names at all so use a nonsense extension CommandName = Args->CheckValue("-name"); - static const char* nomos[] = { "-nomonsters", "-nodudes", nullptr }; + static const char* nomos[] = { "-nomonsters", "-nodudes", "-nocreatures", nullptr }; Args->CollectFiles("-nomonsters", nomos, ".---"); // this shouldn't collect any file names at all so use a nonsense extension nomonsters = Args->CheckParm("-nomonsters"); diff --git a/source/exhumed/src/2d.cpp b/source/exhumed/src/2d.cpp index 9ae1ab7bc..1a70ca0e0 100644 --- a/source/exhumed/src/2d.cpp +++ b/source/exhumed/src/2d.cpp @@ -418,7 +418,6 @@ static const short skullDurations[] = { 6, 25, 43, 50, 68, 78, 101, 111, 134, 15 class DMainTitle : public DScreenJob { - int String_Copyright; const char* a; const char* b; int state = 0; @@ -432,9 +431,8 @@ class DMainTitle : public DScreenJob public: DMainTitle() : DScreenJob(fadein) { - String_Copyright = FindGString("COPYRIGHT"); - a = gString[String_Copyright]; - b = gString[String_Copyright + 1]; + a = GStrings("TXT_EX_COPYRIGHT1"); + b = GStrings("TXT_EX_COPYRIGHT2"); var_18 = skullDurations[0]; } @@ -1287,7 +1285,6 @@ private: // temporary. void RunCinemaScene(int num) { - num = -1; JobDesc job = { num == -1? (DScreenJob*)Create() : Create(num) }; RunScreenJob(&job, 1, [](bool) { gamestate = GS_LEVEL; }); SyncScreenJob(); diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index 2c62b52f9..9c1265385 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -64,41 +64,6 @@ bool EndLevel = false; /* these are XORed in the original game executable then XORed back to normal when the game first starts. Here they are normally */ const char *gString[] = { - "ITEMS", - "LIFE BLOOD", - "LIFE", - "VENOM", - "YOU'RE LOSING YOUR GRIP", - "FULL LIFE", - "INVINCIBILITY", - "INVISIBILITY", - "TORCH", - "SOBEK MASK", - "INCREASED WEAPON POWER!", - "THE MAP!", - "AN EXTRA LIFE!", - ".357 MAGNUM!", - "GRENADE", - "M-60", - "FLAME THROWER!", - "COBRA STAFF!", - "THE EYE OF RAH GAUNTLET!", - "SPEED LOADER", - "AMMO", - "FUEL", - "COBRA!", - "RAW ENERGY", - "POWER KEY", - "TIME KEY", - "WAR KEY", - "EARTH KEY", - "MAGIC", - "LOCATION PRESERVED", - "COPYRIGHT", - "LOBOTOMY SOFTWARE, INC.", - "3D ENGINE BY 3D REALMS", - "", - "", "PASSWORDS", "HOLLY", "KIMBERLY", @@ -322,7 +287,6 @@ short nBodyTotal = 0; short lastfps; short nMapMode = 0; -short bNoCreatures = false; short nTotalPlayers = 1; // TODO: Rename this (or make it static) so it doesn't conflict with library function @@ -340,7 +304,6 @@ short bSlipMode = false; short bDoFlashes = true; short bHolly = false; -short nItemTextIndex; short besttarget; short scan_char = 0; @@ -831,10 +794,6 @@ void FinishLevel() } -void SetHiRes() -{ -} - void DoClockBeep() { for (int i = headspritestat[407]; i != -1; i = nextspritestat[i]) { @@ -1046,14 +1005,6 @@ static void GameMove(void) moveframes--; } -#if defined(_WIN32) && defined(DEBUGGINGAIDS) -// See FILENAME_CASE_CHECK in cache1d.c -static int32_t check_filename_casing(void) -{ - return 1; -} -#endif - int32_t r_maxfpsoffset = 0; void PatchDemoStrings() @@ -1088,75 +1039,6 @@ void ExitGame() static int32_t nonsharedtimer; -void CheckCommandLine(int argc, char const* const* argv, int &doTitle) -{ - // Check for any command line arguments - for (int i = 1; i < argc; i++) - { - const char* pChar = argv[i]; - - if (*pChar == '/') - { - pChar++; - //strlwr(pChar); - - if (Bstrcasecmp(pChar, "nocreatures") == 0) { - bNoCreatures = true; - } - else if (Bstrcasecmp(pChar, "network") == 0) - { - nNetPlayerCount = -1; - forcelevel = levelnew; - bModemPlay = false; - - doTitle = false; - } - else - { - char c = tolower(*pChar); - - switch (c) - { - case 'h': - SetHiRes(); - break; -#if 0 - case 's': - socket = atoi(pChar + 1); - break; -#endif - case 't': - nNetTime = atoi(pChar + 1); - if (nNetTime < 0) { - nNetTime = 0; - } - else { - nNetTime = nNetTime * 1800; - } - break; - case 'c': - { - break; - } - default: - { - if (isdigit(c)) - { - levelnew = atoi(pChar); - forcelevel = levelnew; - - doTitle = false; - - Printf("Jumping to level %d...\n", levelnew); - } - break; - } - } - } - } - } -} - static const char* actions[] = { "Move_Forward", @@ -1266,7 +1148,6 @@ int GameInterface::app_main() PatchDemoStrings(); // loc_115F5: - nItemTextIndex = FindGString("ITEMS"); nFirstPassword = FindGString("PASSWORDS"); nFirstPassInfo = FindGString("PASSINFO"); diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index fd7201459..f36c6b922 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -214,8 +214,6 @@ extern short lastfps; extern int flash; -extern short bNoCreatures; - extern short nLocalSpr; extern short levelnew; @@ -231,7 +229,6 @@ extern int lCountDown; extern short bSlipMode; -extern short nItemTextIndex; extern const char* gString[]; extern const char* gPSDemoString[]; extern const char* gEXDemoString[]; diff --git a/source/exhumed/src/init.cpp b/source/exhumed/src/init.cpp index 9905a1757..a579a99b1 100644 --- a/source/exhumed/src/init.cpp +++ b/source/exhumed/src/init.cpp @@ -431,7 +431,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) int v6 = nLotag % 1000; - if (!bNoCreatures || v6 < 100 || v6 > 118) + if (!userConfig.nomonsters || v6 < 100 || v6 > 118) { if (v6 > 999) { mydeletesprite(nSprite); @@ -452,7 +452,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 118: // Anubis with drum { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -462,7 +462,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 117: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -492,7 +492,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 111: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -502,7 +502,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 108: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -512,7 +512,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 107: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -522,7 +522,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 106: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -532,7 +532,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 105: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -542,7 +542,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 104: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -552,7 +552,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 103: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -562,7 +562,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 102: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -572,7 +572,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 101: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } @@ -582,7 +582,7 @@ void ProcessSpriteTag(short nSprite, short nLotag, short nHitag) } case 100: { - if (bNoCreatures) { + if (userConfig.nomonsters) { mydeletesprite(nSprite); return; } diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index 2087239e7..9b6a467bd 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -353,7 +353,7 @@ short nBeforeScene[] = { 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 void CheckBeforeScene(int nLevel) { - if (1)//nLevel == kMap20) + if (nLevel == kMap20) { RunCinemaScene(-1); return; @@ -439,12 +439,6 @@ int FindGString(const char *str) return -1; } -uint8_t CheckForEscape() -{ - return inputState.CheckAllInput(); -} - - static SavegameHelper sgh("menu", SA(nCinemaSeen), SA(energytile), diff --git a/source/exhumed/src/player.cpp b/source/exhumed/src/player.cpp index 3ec38e856..7d12c791e 100644 --- a/source/exhumed/src/player.cpp +++ b/source/exhumed/src/player.cpp @@ -30,6 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menu.h" #include "sound.h" #include "buildtiles.h" +#include "gstrings.h" #include #include #include @@ -908,6 +909,17 @@ void DoKenTest() } } +static void pickupMessage(int no) +{ + no = nItemText[no]; + if (no != -1) + { + FStringf label("TXT_EX_PICKUP%d", no + 1); + auto str = GStrings[label]; + if (str) Printf(PRINT_NOTIFY, "%s\n", str); + } +} + void FuncPlayer(int a, int nDamage, int nRun) { int var_48 = 0; @@ -1740,7 +1752,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -1805,7 +1817,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -1896,7 +1908,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -1970,7 +1982,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2044,7 +2056,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2215,7 +2227,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2277,7 +2289,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2339,7 +2351,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2401,7 +2413,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2463,7 +2475,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); @@ -2525,7 +2537,7 @@ do_default_b: { if (nItemText[var_70] > -1 && nTotalPlayers == 1) { - StatusMessage(400, gString[nItemTextIndex + nItemText[var_70]]); + pickupMessage(var_70); } TintPalette(var_44*4, var_8C*4, 0); diff --git a/wadsrc/static/language.csv b/wadsrc/static/language.csv index b635fe6d1..59064619f 100644 --- a/wadsrc/static/language.csv +++ b/wadsrc/static/language.csv @@ -2286,4 +2286,35 @@ from destruction. Your bravery and heroism are legendary. -",TXT_EX_CINEMA8,,,,,,,,,,,,,,,,,,,,,, \ No newline at end of file +",TXT_EX_CINEMA8,,,,,,,,,,,,,,,,,,,,,, +"LOBOTOMY SOFTWARE, INC.,",TXT_EX_COPYRIGHT1,,,,,,,,,,,,,,,,,,,,,, +"3D ENGINE BY 3D REALMS,",TXT_EX_COPYRIGHT2,,,,,,,,,,,,,,,,,,,,,, +Life Blood,TXT_EX_PICKUP1,,,,,,,,,,,,,,,,,,,,,, +Life,TXT_EX_PICKUP2,,,,,,,,,,,,,,,,,,,,,, +Venom,TXT_EX_PICKUP3,,,,,,,,,,,,,,,,,,,,,, +You're Losing Your Grip,TXT_EX_PICKUP4,,,,,,,,,,,,,,,,,,,,,, +Full Life,TXT_EX_PICKUP5,,,,,,,,,,,,,,,,,,,,,, +Invincibility,TXT_EX_PICKUP6,,,,,,,,,,,,,,,,,,,,,, +Invisibility,TXT_EX_PICKUP7,,,,,,,,,,,,,,,,,,,,,, +Torch,TXT_EX_PICKUP8,,,,,,,,,,,,,,,,,,,,,, +Sobek Mask,TXT_EX_PICKUP9,,,,,,,,,,,,,,,,,,,,,, +Increased Weapon Power!,TXT_EX_PICKUP10,,,,,,,,,,,,,,,,,,,,,, +The Map!,TXT_EX_PICKUP11,,,,,,,,,,,,,,,,,,,,,, +An Extra Life!,TXT_EX_PICKUP12,,,,,,,,,,,,,,,,,,,,,, +.357 Magnum!,TXT_EX_PICKUP13,,,,,,,,,,,,,,,,,,,,,, +Grenade,TXT_EX_PICKUP14,,,,,,,,,,,,,,,,,,,,,, +M-60,TXT_EX_PICKUP15,,,,,,,,,,,,,,,,,,,,,, +Flame Thrower!,TXT_EX_PICKUP16,,,,,,,,,,,,,,,,,,,,,, +Cobra Staff!,TXT_EX_PICKUP17,,,,,,,,,,,,,,,,,,,,,, +The Eye Of Rah Gauntlet!,TXT_EX_PICKUP18,,,,,,,,,,,,,,,,,,,,,, +Speed Loader,TXT_EX_PICKUP19,,,,,,,,,,,,,,,,,,,,,, +Ammo,TXT_EX_PICKUP20,,,,,,,,,,,,,,,,,,,,,, +Fuel,TXT_EX_PICKUP21,,,,,,,,,,,,,,,,,,,,,, +Cobra!,TXT_EX_PICKUP22,,,,,,,,,,,,,,,,,,,,,, +Raw Energy,TXT_EX_PICKUP23,,,,,,,,,,,,,,,,,,,,,, +Power Key,TXT_EX_PICKUP24,,,,,,,,,,,,,,,,,,,,,, +Time Key,TXT_EX_PICKUP25,,,,,,,,,,,,,,,,,,,,,, +War Key,TXT_EX_PICKUP26,,,,,,,,,,,,,,,,,,,,,, +Earth Key,TXT_EX_PICKUP27,,,,,,,,,,,,,,,,,,,,,, +Magic,TXT_EX_PICKUP28,,,,,,,,,,,,,,,,,,,,,, +Location Preserved,TXT_EX_PICKUP29,,,,,,,,,,,,,,,,,,,,,, \ No newline at end of file