From 73bfbded3d4d0746889184001bafb7228dfec551 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Fri, 11 Nov 2022 17:18:12 +1000 Subject: [PATCH] Remove unreachable g_Jpn code --- ld/gamefiles.ntsc-final.inc | 2 - src/game/game_1531a0.c | 46 ++------------- src/game/lang.c | 25 -------- src/game/langinit.c | 37 ------------ src/game/langtick.c | 19 ------- src/game/lv.c | 21 ------- src/game/propobj.c | 110 +++++++++++------------------------- src/game/setup.c | 7 +-- src/game/title.c | 18 ++---- src/lib/args.c | 6 -- src/lib/main.c | 1 - src/lib/vi.c | 1 + 12 files changed, 43 insertions(+), 250 deletions(-) delete mode 100644 src/game/langinit.c delete mode 100644 src/game/langtick.c diff --git a/ld/gamefiles.ntsc-final.inc b/ld/gamefiles.ntsc-final.inc index 7f7291278..dbcdc3cde 100644 --- a/ld/gamefiles.ntsc-final.inc +++ b/ld/gamefiles.ntsc-final.inc @@ -1,5 +1,4 @@ #define GAMEFILES(section) \ - build/ROMID/game/langinit.o (section); \ build/ROMID/game/titleinit.o (section); \ build/ROMID/game/raceinit.o (section); \ build/ROMID/game/bodyinit.o (section); \ @@ -77,7 +76,6 @@ build/ROMID/game/menustop.o (section); \ build/ROMID/game/menutick.o (section); \ build/ROMID/game/weathertick.o (section); \ - build/ROMID/game/langtick.o (section); \ build/ROMID/game/roomtick.o (section); \ build/ROMID/game/skytick.o (section); \ build/ROMID/game/casingtick.o (section); \ diff --git a/src/game/game_1531a0.c b/src/game/game_1531a0.c index 728dc2a9a..a7fce07ce 100644 --- a/src/game/game_1531a0.c +++ b/src/game/game_1531a0.c @@ -1264,21 +1264,6 @@ void textMapCodeUnitToChar(char **text, struct fontchar **arg1, struct fontchar u8 c; u8 index; - if (g_Jpn) { - if (**text < 0x80) { - *arg1 = &chars[**text - 0x21]; - *arg2 = &chars[*prevchar - 0x21]; - - *prevchar = **text; - *text += 1; - return; - } - - *arg1 = &chars[*prevchar - 0x21]; - *arg2 = &chars[*prevchar - 0x21]; - return; - } - index = 0; c = **text; @@ -1796,10 +1781,6 @@ Gfx *text0f1552d4(Gfx *gdl, f32 x, f32 y, f32 widthscale, f32 heightscale, lineheight = 13; #else lineheight = chars['['].height + chars['['].baseline; - - if (g_Jpn && lineheight < 14) { - lineheight = 14; - } #endif textMeasure(&textheight, &textwidth, text, chars, font, 0); @@ -2241,10 +2222,6 @@ Gfx *textRenderProjected(Gfx *gdl, s32 *x, s32 *y, char *text, struct fontchar * if (lineheight == 0) { lineheight = chars['['].height + chars['['].baseline; } - - if (g_Jpn && lineheight < 14) { - lineheight = 14; - } #endif gDPPipeSync(gdl++); @@ -2500,10 +2477,6 @@ Gfx *textRender(Gfx *gdl, s32 *x, s32 *y, char *text, if (lineheight == 0) { lineheight = chars['['].height + chars['['].baseline; } - - if (g_Jpn && lineheight < 14) { - lineheight = 14; - } #endif gDPPipeSync(gdl++); @@ -2802,10 +2775,6 @@ void textMeasure(s32 *textheight, s32 *textwidth, char *text, struct fontchar *f if (lineheight == 0) { lineheight = font1['['].baseline + font1['['].height; } - - if (g_Jpn && lineheight < 14) { - lineheight = 14; - } #endif if (text) { @@ -3473,16 +3442,11 @@ void textWrap(s32 wrapwidth, char *src, char *dst, struct fontchar *chars, struc src++; wordlen++; -#if VERSION >= VERSION_PAL_FINAL - if (g_Jpn) -#endif - { - if (curword[wordlen - 1] >= 0x80) { - curword[wordlen] = *src; - v1 += chars[*src - 0x21].width; - src++; - wordlen++; - } + if (curword[wordlen - 1] >= 0x80) { + curword[wordlen] = *src; + v1 += chars[*src - 0x21].width; + src++; + wordlen++; } } diff --git a/src/game/lang.c b/src/game/lang.c index fc2e9c884..d7b631db1 100644 --- a/src/game/lang.c +++ b/src/game/lang.c @@ -47,21 +47,9 @@ * relevant offsets within that buffer. */ -#if VERSION >= VERSION_PAL_BETA -bool g_Jpn = VERSION == VERSION_JPN_FINAL ? true : false; -u8 *g_LangBuffer = NULL; -u8 *g_LangBufferPos = NULL; -s32 g_LangBufferSize = 0; u32 *g_LangBanks[69]; struct var800aabb4 *var800aabb4; struct var800aabb8 *var800aabb8; -s32 g_LanguageId = LANGUAGE_NTSC_EN; -#else -u32 *g_LangBanks[69]; -struct var800aabb4 *var800aabb4; -struct var800aabb8 *var800aabb8; -bool g_Jpn = false; -#endif u16 g_LangFiles[] = { /* 0*/ 0, @@ -539,10 +527,6 @@ s32 langGetFileNumOffset(void) #else s32 offset = 0; - if (g_Jpn) { - offset = 1; - } - return offset; #endif } @@ -665,12 +649,3 @@ void langSetEuropean(u32 arg0) } } #endif - -#if VERSION == VERSION_JPN_FINAL -void langSetJpnEnabled(bool enable) -{ - g_Jpn = enable ? true : false; - - langReload(); -} -#endif diff --git a/src/game/langinit.c b/src/game/langinit.c deleted file mode 100644 index dc9af31e0..000000000 --- a/src/game/langinit.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include "constants.h" -#include "bss.h" -#include "lib/memp.h" -#include "data.h" -#include "types.h" - -u16 *g_FrameBuffers[2]; - -extern s32 var8009d140jf; - -void langInit(void) -{ - s32 i; - -#if VERSION >= VERSION_JPN_FINAL - var8009d140jf = IS4MB() ? 124 : 174; - - var800aabb4 = mempAlloc(var8009d140jf * sizeof(struct var800aabb4), MEMPOOL_PERMANENT); - var800aabb8 = mempAlloc(ALIGN16(var8009d140jf * sizeof(struct var800aabb8)), MEMPOOL_PERMANENT); - - for (i = 0; i < var8009d140jf; i++) { - var800aabb8[i].unk00_00 = 0; - var800aabb8[i].unk00_02 = 0x3fff; - } -#else - if (g_Jpn) { - var800aabb4 = mempAlloc(124 * sizeof(struct var800aabb4), MEMPOOL_PERMANENT); - var800aabb8 = mempAlloc(ALIGN16(124 * sizeof(struct var800aabb8)), MEMPOOL_PERMANENT); - - for (i = 0; i < 124; i++) { - var800aabb8[i].unk00_00 = 0; - var800aabb8[i].unk00_02 = 0x3fff; - } - } -#endif -} diff --git a/src/game/langtick.c b/src/game/langtick.c deleted file mode 100644 index 6c1dcb3f1..000000000 --- a/src/game/langtick.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include "constants.h" -#include "game/room.h" -#include "bss.h" -#include "data.h" -#include "types.h" - -void langTick(void) -{ - s32 i; - - if (g_Jpn) { - for (i = 0; i != 124; i++) { - if (var800aabb8[i].unk00_00) { - var800aabb8[i].unk00_00--; - } - } - } -} diff --git a/src/game/lv.c b/src/game/lv.c index cd1aa6f7d..a581aef13 100644 --- a/src/game/lv.c +++ b/src/game/lv.c @@ -1761,11 +1761,7 @@ void lvUpdateSoloHandicaps(void) g_PlayerDamageRxScale = 1; g_PlayerDamageTxScale = 1; g_ExplosionDamageTxScale = 1; -#if VERSION >= VERSION_JPN_FINAL g_AutoAimScale = 0.75f; -#else - g_AutoAimScale = g_Jpn ? 1.1f : 0.75f; -#endif g_AmmoQuantityScale = 1.5f; g_AttackWalkDurationScale = 0.5f; } else { @@ -1776,11 +1772,7 @@ void lvUpdateSoloHandicaps(void) g_PlayerDamageRxScale = 1.5f; g_PlayerDamageTxScale = 1; g_ExplosionDamageTxScale = 1.5f; -#if VERSION >= VERSION_JPN_FINAL g_AutoAimScale = 0.2f; -#else - g_AutoAimScale = g_Jpn ? 0.75f : 0.2f; -#endif g_AmmoQuantityScale = 1; g_AttackWalkDurationScale = 1; } @@ -1817,11 +1809,7 @@ void lvUpdateSoloHandicaps(void) g_PlayerDamageRxScale = 0.6f; g_PlayerDamageTxScale = 1; g_ExplosionDamageTxScale = 0.75f; -#if VERSION >= VERSION_JPN_FINAL g_AutoAimScale = 0.75f; -#else - g_AutoAimScale = g_Jpn ? 1.1f : 0.75f; -#endif g_AmmoQuantityScale = 1.5f; g_AttackWalkDurationScale = 0.5f; } else if (g_Difficulty == DIFF_PA) { @@ -1832,11 +1820,7 @@ void lvUpdateSoloHandicaps(void) g_PlayerDamageRxScale = 1; g_PlayerDamageTxScale = 1; g_ExplosionDamageTxScale = 1; -#if VERSION >= VERSION_JPN_FINAL g_AutoAimScale = 0.2f; -#else - g_AutoAimScale = g_Jpn ? 0.75f : 0.2f; -#endif g_AmmoQuantityScale = 1; g_AttackWalkDurationScale = 1; } else if (g_Difficulty == DIFF_PD) { @@ -2167,7 +2151,6 @@ void lvTick(void) if (g_Vars.stagenum == STAGE_TITLE) { titleTick(); - langTick(); musicTick(); } else if (g_Vars.stagenum == STAGE_BOOTPAKMENU) { setCurrentPlayerNum(0); @@ -2176,16 +2159,13 @@ void lvTick(void) #endif menuTick(); musicTick(); - langTick(); pakExecuteDebugOperations(); } else if (g_Vars.stagenum == STAGE_4MBMENU) { menuTick(); musicTick(); - langTick(); pakExecuteDebugOperations(); } else if (g_Vars.stagenum == STAGE_CREDITS) { musicTick(); - langTick(); } else { lvUpdateCutsceneTime(); PROFILE(PROFILEMARKER_LVT_VTXSTORE, vtxstoreTick()); @@ -2227,7 +2207,6 @@ void lvTick(void) profileEnd(PROFILEMARKER_LVT_PROPS); PROFILE(PROFILEMARKER_LVT_MUSIC, musicTick()); - langTick(); PROFILE(PROFILEMARKER_LVT_PADEFFECTS, propsTickPadEffects()); if (mainGetStageNum() == STAGE_CITRAINING) { diff --git a/src/game/propobj.c b/src/game/propobj.c index ebf3ea64e..e6760dc29 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -16679,12 +16679,6 @@ void func0f0878c8pf(char *dst, s32 id, bool plural, bool full, bool dual, struct languageid = LANGUAGE_PAL_EN; } -#if VERSION == VERSION_JPN_FINAL - if (g_Jpn) { - languageid = LANGUAGE_NTSC_EN; - } -#endif - *dst = '\0'; info = func0f087888pf(id, table); @@ -17090,41 +17084,13 @@ void ammotypeGetPickupMessage(char *dst, s32 ammotype, s32 qty) *dst = '\0'; -#if VERSION >= VERSION_JPN_FINAL - if (ammotype == AMMOTYPE_PISTOL || ammotype == AMMOTYPE_SMG || ammotype == AMMOTYPE_RIFLE) { - ammotype = 999; + if (full) { + ammotypeGetPickedUpText(dst); // "Picked up" } - func0f0878c8pf(dst, ammotype, qty > 1, !full, 0, var8006a944pf); -#elif VERSION >= VERSION_PAL_BETA - if (g_Jpn) { - strcat(dst, "\n"); - } else { - if (ammotype == AMMOTYPE_PISTOL || ammotype == AMMOTYPE_SMG || ammotype == AMMOTYPE_RIFLE) { - ammotype = 999; - } - - func0f0878c8pf(dst, ammotype, qty > 1, !full, 0, var8006a944pf); - } -#else - if (g_Jpn) { - ammotypeGetPickupName(dst, ammotype, qty); - - if (full) { - ammotypeGetPickedUpText(dst); - } - - strcat(dst, "\n"); - } else { - if (full) { - ammotypeGetPickedUpText(dst); // "Picked up" - } - - ammotypeGetDeterminer(dst, ammotype, qty); // "a", "an", "some" or "the" - ammotypeGetPickupName(dst, ammotype, qty); // name of ammo type - strcat(dst, ".\n"); - } -#endif + ammotypeGetDeterminer(dst, ammotype, qty); // "a", "an", "some" or "the" + ammotypeGetPickupName(dst, ammotype, qty); // name of ammo type + strcat(dst, ".\n"); } void currentPlayerQueuePickupAmmoHudmsg(s32 ammotype, s32 pickupqty) @@ -17296,38 +17262,36 @@ void weaponGetPickupText(char *buffer, s32 weaponnum, bool dual) if (dual) { strcat(buffer, langGet(L_PROPOBJ_001)); // "Double" } else { - if (!g_Jpn) { - if (full) { - strcat(buffer, langGet(L_PROPOBJ_000)); // "Picked up" + if (full) { + strcat(buffer, langGet(L_PROPOBJ_000)); // "Picked up" - if (weaponnum == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { - textid = L_PROPOBJ_050; // "your" - } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_F_SOME)) { - textid = L_PROPOBJ_002; // "some" - } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_F_AN)) { - textid = L_PROPOBJ_006; // "an" - } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_F_THE)) { - textid = L_PROPOBJ_008; // "the" - } else { - textid = L_PROPOBJ_004; // "a" - } - - strcat(buffer, langGet(textid)); + if (weaponnum == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { + textid = L_PROPOBJ_050; // "your" + } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_F_SOME)) { + textid = L_PROPOBJ_002; // "some" + } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_F_AN)) { + textid = L_PROPOBJ_006; // "an" + } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_F_THE)) { + textid = L_PROPOBJ_008; // "the" } else { - if (weaponnum == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { - textid = L_PROPOBJ_051; // "Your" - } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_S_SOME)) { - textid = L_PROPOBJ_003; // "Some" - } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_S_AN)) { - textid = L_PROPOBJ_007; // "An" - } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_S_THE)) { - textid = L_PROPOBJ_009; // "The" - } else { - textid = L_PROPOBJ_005; // "A" - } - - strcat(buffer, langGet(textid)); + textid = L_PROPOBJ_004; // "a" } + + strcat(buffer, langGet(textid)); + } else { + if (weaponnum == WEAPON_EYESPY && g_Vars.currentplayer->eyespy) { + textid = L_PROPOBJ_051; // "Your" + } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_S_SOME)) { + textid = L_PROPOBJ_003; // "Some" + } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_S_AN)) { + textid = L_PROPOBJ_007; // "An" + } else if (weaponHasFlag(weaponnum, WEAPONFLAG_DETERMINER_S_THE)) { + textid = L_PROPOBJ_009; // "The" + } else { + textid = L_PROPOBJ_005; // "A" + } + + strcat(buffer, langGet(textid)); } } @@ -17351,16 +17315,6 @@ void weaponGetPickupText(char *buffer, s32 weaponnum, bool dual) strcat(buffer, "s"); } - // For JPN, their translation of "picked up" comes after the weapon name - if (g_Jpn && full) { - if (buffer[strlen(buffer) - 1] == '\n') { - buffer[strlen(buffer) - 1] = '\0'; - } - - strcat(buffer, langGet(L_PROPOBJ_000)); // "Picked up" - strcat(buffer, "\n"); // This just gets removed immediately below - } - if (buffer[strlen(buffer) - 1] == '\n') { buffer[strlen(buffer) - 1] = '\0'; } diff --git a/src/game/setup.c b/src/game/setup.c index aee8beefc..31cf73abf 100644 --- a/src/game/setup.c +++ b/src/game/setup.c @@ -1471,12 +1471,7 @@ void setupCreateProps(s32 stagenum) break; case OBJTYPE_SHIELD: if (withobjs) { -#if VERSION >= VERSION_JPN_FINAL - if ((obj->flags2 & diffflag) == 0) -#else - if ((obj->flags2 & diffflag) == 0 || g_Jpn) -#endif - { + if ((obj->flags2 & diffflag) == 0) { struct shieldobj *shield = (struct shieldobj *)obj; shield->initialamount = *(s32 *)&shield->initialamount / 65536.0f; shield->amount = shield->initialamount; diff --git a/src/game/title.c b/src/game/title.c index 744a16ad6..e21794f7d 100644 --- a/src/game/title.c +++ b/src/game/title.c @@ -8098,13 +8098,8 @@ Gfx *titleRenderNoController(Gfx *gdl) x = 288 - (textwidth >> 1); y = (g_TitleViewHeight / 2) - (textheight >> 1) - 12; - if (g_Jpn) { - width = viGetWidth(); - gdl = textRender(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, 0x008000ff, width, viGetHeight(), 0, 0); - } else { - width = viGetWidth(); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, viGetHeight(), 0, 0); - } + width = viGetWidth(); + gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, viGetHeight(), 0, 0); // Line 2 text = langGet(L_OPTIONS_072); // "please power off and attach a controller" @@ -8113,13 +8108,8 @@ Gfx *titleRenderNoController(Gfx *gdl) x = 288 - (textwidth >> 1); y = (g_TitleViewHeight / 2) - (textheight >> 1) + 12; - if (g_Jpn) { - width = viGetWidth(); - gdl = textRender(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, 0x008000ff, width, viGetHeight(), 0, 0); - } else { - width = viGetWidth(); - gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, viGetHeight(), 0, 0); - } + width = viGetWidth(); + gdl = textRenderProjected(gdl, &x, &y, text, g_CharsHandelGothicLg, g_FontHandelGothicLg, 0xffffffff, width, viGetHeight(), 0, 0); #endif gdl = text0f153780(gdl); diff --git a/src/lib/args.c b/src/lib/args.c index bf4a48001..fb758f8b5 100644 --- a/src/lib/args.c +++ b/src/lib/args.c @@ -92,12 +92,6 @@ bool argsParseDebugArgs(void) g_SndDisabled = true; } -#if VERSION < VERSION_JPN_FINAL - if (argFindByPrefix(1, "-j")) { - g_Jpn = true; - } -#endif - return ret; } diff --git a/src/lib/main.c b/src/lib/main.c index 40069337f..24cfc74e2 100644 --- a/src/lib/main.c +++ b/src/lib/main.c @@ -406,7 +406,6 @@ void mainInit(void) utilsInit(); func000034d0(); texInit(); - langInit(); lvInit(); cheatsInit(); func0000e9c0(); diff --git a/src/lib/vi.c b/src/lib/vi.c index 7fdc87a99..9d66ff968 100644 --- a/src/lib/vi.c +++ b/src/lib/vi.c @@ -26,6 +26,7 @@ Mtx *var80092870; u16 g_ViPerspScale; u8 g_ViFrontIndex; u8 g_ViBackIndex; +u16 *g_FrameBuffers[2]; struct rend_vidat g_ViDataArray[] = { {