Decompile currentPlayerCalculateEquipCurItem

This commit is contained in:
Ryan Dwyer 2020-02-08 12:45:01 +10:00
parent b0affcd2a7
commit 4f1d93b33d
6 changed files with 28 additions and 55 deletions

View File

@ -11982,7 +11982,7 @@ glabel func0f0a1528
/* f0a1810: 26520004 */ addiu $s2,$s2,0x4
/* f0a1814: 1621ffd3 */ bne $s1,$at,.L0f0a1764
/* f0a1818: 267307a4 */ addiu $s3,$s3,0x7a4
/* f0a181c: 0fc44bdc */ jal func0f112f70
/* f0a181c: 0fc44bdc */ jal currentPlayerCalculateEquipCurItem
/* f0a1820: 00000000 */ sll $zero,$zero,0x0
/* f0a1824: 82820000 */ lb $v0,0x0($s4)
/* f0a1828: 240effff */ addiu $t6,$zero,-1
@ -20307,7 +20307,7 @@ glabel func0f0a8d34
/* f0a8ebc: 02002025 */ or $a0,$s0,$zero
/* f0a8ec0: 14400009 */ bnez $v0,.L0f0a8ee8
/* f0a8ec4: 00000000 */ sll $zero,$zero,0x0
/* f0a8ec8: 0fc44bdc */ jal func0f112f70
/* f0a8ec8: 0fc44bdc */ jal currentPlayerCalculateEquipCurItem
/* f0a8ecc: 00000000 */ sll $zero,$zero,0x0
/* f0a8ed0: 3c0f800a */ lui $t7,0x800a
/* f0a8ed4: 8defa244 */ lw $t7,-0x5dbc($t7)

View File

@ -15531,7 +15531,7 @@ glabel func0f0fdf14
.L0f0fe034:
/* f0fe034: 5220008e */ beqzl $s1,.L0f0fe270
/* f0fe038: 8fbf001c */ lw $ra,0x1c($sp)
/* f0fe03c: 0fc44bd8 */ jal func0f112f60
/* f0fe03c: 0fc44bd8 */ jal currentPlayerSetEquipCurItem
/* f0fe040: 8fa40040 */ lw $a0,0x40($sp)
/* f0fe044: 02002025 */ or $a0,$s0,$zero
/* f0fe048: 0fc4473e */ jal func0f111cf8

View File

@ -4107,7 +4107,7 @@ glabel menuhandler00106178
/* f106240: 8fac0028 */ lw $t4,0x28($sp)
/* f106244: 51600016 */ beqzl $t3,.L0f1062a0
/* f106248: 8fad0028 */ lw $t5,0x28($sp)
/* f10624c: 0fc44bd8 */ jal func0f112f60
/* f10624c: 0fc44bd8 */ jal currentPlayerSetEquipCurItem
/* f106250: 8d840000 */ lw $a0,0x0($t4)
/* f106254: 8fa4001c */ lw $a0,0x1c($sp)
/* f106258: 0fc4473e */ jal func0f111cf8

View File

@ -141,7 +141,7 @@ void currentPlayerInsertInvItem(struct invitem *item)
g_Vars.currentplayer->weapons = item;
currentPlayerSortInvItem(item);
func0f112f70();
currentPlayerCalculateEquipCurItem();
}
void currentPlayerRemoveInvItem(struct invitem *item)
@ -161,7 +161,7 @@ void currentPlayerRemoveInvItem(struct invitem *item)
prev->next = next;
item->type = -1;
func0f112f70();
currentPlayerCalculateEquipCurItem();
}
struct invitem *currentPlayerGetUnusedInvItem(void)
@ -182,7 +182,7 @@ void currentPlayerSetAllGuns(bool enable)
s32 weaponnum;
g_Vars.currentplayer->equipallguns = enable;
func0f112f70();
currentPlayerCalculateEquipCurItem();
weaponnum = currentPlayerGetWeaponNumByInvIndex(g_Vars.currentplayer->equipcuritem);
currentPlayerEquipWeaponInCutscene(weaponnum);
}
@ -1483,52 +1483,25 @@ u32 currentPlayerGetEquipCurItem(void)
return g_Vars.currentplayer->equipcuritem;
}
GLOBAL_ASM(
glabel func0f112f60
/* f112f60: 3c0e800a */ lui $t6,0x800a
/* f112f64: 8dcea244 */ lw $t6,-0x5dbc($t6)
/* f112f68: 03e00008 */ jr $ra
/* f112f6c: adc41874 */ sw $a0,0x1874($t6)
);
void currentPlayerSetEquipCurItem(u32 item)
{
g_Vars.currentplayer->equipcuritem = item;
}
GLOBAL_ASM(
glabel func0f112f70
/* f112f70: 27bdffe0 */ addiu $sp,$sp,-32
/* f112f74: afbf001c */ sw $ra,0x1c($sp)
/* f112f78: afb10018 */ sw $s1,0x18($sp)
/* f112f7c: afb00014 */ sw $s0,0x14($sp)
/* f112f80: 0fc2866a */ jal getCurrentPlayerWeaponId
/* f112f84: 00002025 */ or $a0,$zero,$zero
/* f112f88: 3c0e800a */ lui $t6,0x800a
/* f112f8c: 8dcea244 */ lw $t6,-0x5dbc($t6)
/* f112f90: 00408825 */ or $s1,$v0,$zero
/* f112f94: 00008025 */ or $s0,$zero,$zero
/* f112f98: 0fc44a54 */ jal currentPlayerGetNumInvItems
/* f112f9c: adc01874 */ sw $zero,0x1874($t6)
/* f112fa0: 5840000e */ blezl $v0,.L0f112fdc
/* f112fa4: 8fbf001c */ lw $ra,0x1c($sp)
.L0f112fa8:
/* f112fa8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f112fac: 02002025 */ or $a0,$s0,$zero
/* f112fb0: 14510004 */ bne $v0,$s1,.L0f112fc4
/* f112fb4: 3c0f800a */ lui $t7,0x800a
/* f112fb8: 8defa244 */ lw $t7,-0x5dbc($t7)
/* f112fbc: 10000006 */ beqz $zero,.L0f112fd8
/* f112fc0: adf01874 */ sw $s0,0x1874($t7)
.L0f112fc4:
/* f112fc4: 0fc44a54 */ jal currentPlayerGetNumInvItems
/* f112fc8: 26100001 */ addiu $s0,$s0,0x1
/* f112fcc: 0202082a */ slt $at,$s0,$v0
/* f112fd0: 1420fff5 */ bnez $at,.L0f112fa8
/* f112fd4: 00000000 */ sll $zero,$zero,0x0
.L0f112fd8:
/* f112fd8: 8fbf001c */ lw $ra,0x1c($sp)
.L0f112fdc:
/* f112fdc: 8fb00014 */ lw $s0,0x14($sp)
/* f112fe0: 8fb10018 */ lw $s1,0x18($sp)
/* f112fe4: 03e00008 */ jr $ra
/* f112fe8: 27bd0020 */ addiu $sp,$sp,0x20
);
void currentPlayerCalculateEquipCurItem(void)
{
s32 curweaponnum = getCurrentPlayerWeaponId(0);
s32 i;
g_Vars.currentplayer->equipcuritem = 0;
for (i = 0; i < currentPlayerGetNumInvItems(); i++) {
if (currentPlayerGetWeaponNumByInvIndex(i) == curweaponnum) {
g_Vars.currentplayer->equipcuritem = i;
break;
}
}
}
GLOBAL_ASM(
glabel func0f112fec

View File

@ -177,7 +177,7 @@ glabel menuhandler001a3340
/* f1a33bc: 0fc44762 */ jal currentPlayerGiveWeapon
/* f1a33c0: 01c02025 */ or $a0,$t6,$zero
.L0f1a33c4:
/* f1a33c4: 0fc44bd8 */ jal func0f112f60
/* f1a33c4: 0fc44bd8 */ jal currentPlayerSetEquipCurItem
/* f1a33c8: 24040001 */ addiu $a0,$zero,0x1
/* f1a33cc: 0fc2866a */ jal getCurrentPlayerWeaponId
/* f1a33d0: 00002025 */ or $a0,$zero,$zero

View File

@ -41,8 +41,8 @@ char *currentPlayerGetInvNameByIndex(s32 index);
u32 func0f112e24(void);
void textoverrideInsert(struct textoverride *override);
u32 currentPlayerGetEquipCurItem(void);
u32 func0f112f60(void);
void func0f112f70(void);
void currentPlayerSetEquipCurItem(u32 item);
void currentPlayerCalculateEquipCurItem(void);
u32 func0f112fec(void);
u32 func0f113034(void);
u32 func0f11307c(void);