From fa9272d6f7263915fd2d058b870826956f178588 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 12 Nov 2022 11:09:15 +1000 Subject: [PATCH] Don't call functions that simply return a literal value --- src/game/bondgun.c | 12 +------- src/game/challenge.c | 2 +- src/game/chraction.c | 7 ----- src/game/filelist.c | 5 ---- src/game/filemgr.c | 59 +--------------------------------------- src/game/mplayer/setup.c | 5 ---- src/game/pdmode.c | 5 ---- src/game/propobj.c | 12 -------- 8 files changed, 3 insertions(+), 104 deletions(-) diff --git a/src/game/bondgun.c b/src/game/bondgun.c index 5441fc890..a32d24c64 100644 --- a/src/game/bondgun.c +++ b/src/game/bondgun.c @@ -2823,16 +2823,6 @@ s32 bgunTickIncChangeGun(struct handweaponinfo *info, s32 handnum, struct hand * return 0; } -/** - * This function may have implemented an early beta feature where the gun could - * be held at the side of the screen, pointed upwards. The feature was shown in - * a demo video but doesn't exist in any public version of the game. - */ -s32 bgunTickIncState2(struct handweaponinfo *info, s32 handnum, struct hand *hand, s32 lvupdate) -{ - return 0; -} - s32 bgunTickInc(struct handweaponinfo *info, s32 handnum, s32 lvupdate) { s32 result = 0; @@ -2861,7 +2851,7 @@ s32 bgunTickInc(struct handweaponinfo *info, s32 handnum, s32 lvupdate) result = bgunTickIncAttack(info, handnum, hand, lvupdate); break; case HANDSTATE_2: - result = bgunTickIncState2(info, handnum, hand, lvupdate); + result = 0; break; case HANDSTATE_CHANGEGUN: result = bgunTickIncChangeGun(info, handnum, hand, lvupdate); diff --git a/src/game/challenge.c b/src/game/challenge.c index 72f04ecbc..dc190ba12 100644 --- a/src/game/challenge.c +++ b/src/game/challenge.c @@ -447,7 +447,7 @@ s32 challengeForceUnlockSetupFeatures(struct mpsetup *setup, u8 *array, s32 len) } // Force unlock the stage - for (i = 0; i < mpGetNumStages(); i++) { + for (i = 0; i < 17; i++) { if (g_MpArenas[i].stagenum == setup->stagenum) { s32 featurenum = g_MpArenas[i].requirefeature; diff --git a/src/game/chraction.c b/src/game/chraction.c index 0a949ab0a..08ea31ebf 100644 --- a/src/game/chraction.c +++ b/src/game/chraction.c @@ -1329,8 +1329,6 @@ f32 chrGetRangedSpeed(struct chrdata *chr, f32 min, f32 max) { f32 speedrating = chr->speedrating; - speedrating = pdmodeGetEnemyReactionSpeed() * (100.0f - speedrating) + speedrating; - return (max - min) * speedrating * 0.01f + min; } @@ -1349,9 +1347,6 @@ f32 chrGetRangedSpeed(struct chrdata *chr, f32 min, f32 max) s32 chrGetPercentageOfSlowness(struct chrdata *chr, s32 percentage) { s32 speedrating = chr->speedrating; - s32 extra = pdmodeGetEnemyReactionSpeed() * (100 - speedrating); - - speedrating = extra + speedrating; return (100 - speedrating) * percentage / 100; } @@ -1360,8 +1355,6 @@ f32 chrGetRangedArghSpeed(struct chrdata *chr, f32 min, f32 max) { f32 arghrating = chr->arghrating; - arghrating = pdmodeGetEnemyReactionSpeed() * (100.0f - arghrating) + arghrating; - return (max - min) * arghrating * 0.01f + min; } diff --git a/src/game/filelist.c b/src/game/filelist.c index 1a2189ef3..c82bf0989 100644 --- a/src/game/filelist.c +++ b/src/game/filelist.c @@ -246,8 +246,3 @@ void filelistUpdate(struct filelist *list) } } } - -struct textureconfig *pheadGetTexture(s32 playernum, s32 fileid, u16 deviceserial) -{ - return NULL; -} diff --git a/src/game/filemgr.c b/src/game/filemgr.c index ab9aaebd3..911eed5d8 100644 --- a/src/game/filemgr.c +++ b/src/game/filemgr.c @@ -1525,61 +1525,6 @@ char *filemgrMenuTextFileInUseDescription(struct menuitem *item) return langGet(L_MPWEAPONS_160); // "Cannot delete file as it is being used." } -/** - * This is a dirty decomp hack where we intentionally declare - * an incorrect function signature in order to get a match. - * pheadGetTexture uses u16 as its last argument - * but filemgrRenderPerfectHeadThumbnail will only match if - * it's an s32 with a 0xffff mask. - */ -struct textureconfig *pheadGetTexture(s32 playernum, s32 fileid, s32 deviceserial); - -Gfx *filemgrRenderPerfectHeadThumbnail(Gfx *gdl, struct menuitemrenderdata *renderdata, s32 fileid, s32 deviceserial) -{ - struct textureconfig *texture = pheadGetTexture(g_MpPlayerNum, fileid, deviceserial & 0xffff); - - if (texture) { - gSPDisplayList(gdl++, &var800613a0); - gSPDisplayList(gdl++, &var80061360); - - gDPPipeSync(gdl++); - gDPSetTexturePersp(gdl++, G_TP_NONE); - gDPSetAlphaCompare(gdl++, G_AC_NONE); - gDPSetTextureLOD(gdl++, G_TL_TILE); - gDPSetTextureConvert(gdl++, G_TC_FILT); - - texSelect(&gdl, texture, 1, 0, 2, 1, NULL); - - gDPSetCycleType(gdl++, G_CYC_1CYCLE); - gDPSetTextureFilter(gdl++, G_TF_POINT); - gDPSetEnvColor(gdl++, 0xff, 0xff, 0xff, renderdata->colour); - - gDPSetCombineLERP(gdl++, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0, - TEXEL0, 0, ENVIRONMENT, 0, TEXEL0, 0, ENVIRONMENT, 0); - - gDPLoadSync(gdl++); - gDPTileSync(gdl++); - - gSPTextureRectangle(gdl++, - ((renderdata->x + 4) << 2) * g_ScaleX, - (renderdata->y + 2) << 2, - ((renderdata->x + 20) << 2) * g_ScaleX, - (renderdata->y + 18) << 2, - G_TX_RENDERTILE, 0, 512, 1024 / g_ScaleX, -1024); - - gDPLoadSync(gdl++); - gDPTileSync(gdl++); - gDPPipeSync(gdl++); - - if (deviceserial) { - // empty - } - } - - return gdl; -} - bool filemgrIsFileInUse(struct filelistfile *file) { s32 i; @@ -1645,9 +1590,7 @@ s32 filemgrFileToCopyOrDeleteListMenuHandler(s32 operation, struct menuitem *ite struct menuitemrenderdata *renderdata = data->type19.renderdata2; struct filelistfile *file = &list->files[data->list.unk04]; - if (g_Menus[g_MpPlayerNum].fm.filetypeplusone == 4) { - gdl = filemgrRenderPerfectHeadThumbnail(gdl, renderdata, file->fileid, file->deviceserial); - } else { + if (g_Menus[g_MpPlayerNum].fm.filetypeplusone != 4) { u32 colour = renderdata->colour; char text[32]; diff --git a/src/game/mplayer/setup.c b/src/game/mplayer/setup.c index a339fd4e2..c777cde21 100644 --- a/src/game/mplayer/setup.c +++ b/src/game/mplayer/setup.c @@ -115,11 +115,6 @@ struct mparena g_MpArenas[] = { { 1, 0, L_MPMENU_136 }, // "Random" }; -s32 mpGetNumStages(void) -{ - return 17; -} - s16 mpChooseRandomStage(void) { s32 i; diff --git a/src/game/pdmode.c b/src/game/pdmode.c index 93ad30885..52da8ab22 100644 --- a/src/game/pdmode.c +++ b/src/game/pdmode.c @@ -10,11 +10,6 @@ #include "data.h" #include "types.h" -f32 pdmodeGetEnemyReactionSpeed(void) -{ - return 0; -} - f32 pdmodeGetEnemyHealth(void) { if (g_MissionConfig.pdmode) { diff --git a/src/game/propobj.c b/src/game/propobj.c index 0d18d6993..e4b237c7c 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -10018,11 +10018,6 @@ void objInitMatrices(struct prop *prop) } } -bool propCanRegen(struct prop *prop) -{ - return true; -} - u32 objTick(struct prop *prop) { struct defaultobj *obj = prop->obj; @@ -10042,13 +10037,6 @@ u32 objTick(struct prop *prop) prop->timetoregen -= g_Vars.lvupdate60; - // If ready to start fading in but propCanRegen returns false, wait - // another second and try again. In practice propCanRegen will always - // return true so this condition will never pass. - if (prop->timetoregen < TICKS(60) && !regenning && !propCanRegen(prop)) { - prop->timetoregen += TICKS(60); - } - if (prop->timetoregen <= 0) { // Prop has finished fading in prop->timetoregen = 0;