Don't call functions that simply return a literal value

This commit is contained in:
Ryan Dwyer
2022-11-12 11:09:15 +10:00
parent d8c278364a
commit fa9272d6f7
8 changed files with 3 additions and 104 deletions
+1 -11
View File
@@ -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);
+1 -1
View File
@@ -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;
-7
View File
@@ -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;
}
-5
View File
@@ -246,8 +246,3 @@ void filelistUpdate(struct filelist *list)
}
}
}
struct textureconfig *pheadGetTexture(s32 playernum, s32 fileid, u16 deviceserial)
{
return NULL;
}
+1 -58
View File
@@ -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];
-5
View File
@@ -115,11 +115,6 @@ struct mparena g_MpArenas[] = {
{ 1, 0, L_MPMENU_136 }, // "Random"
};
s32 mpGetNumStages(void)
{
return 17;
}
s16 mpChooseRandomStage(void)
{
s32 i;
-5
View File
@@ -10,11 +10,6 @@
#include "data.h"
#include "types.h"
f32 pdmodeGetEnemyReactionSpeed(void)
{
return 0;
}
f32 pdmodeGetEnemyHealth(void)
{
if (g_MissionConfig.pdmode) {
-12
View File
@@ -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;