Decompile currentPlayerGetWeaponNumByInvIndex

This commit is contained in:
Ryan Dwyer 2020-02-08 12:02:02 +10:00
parent b92ee31e40
commit 31d8d3882a
5 changed files with 39 additions and 67 deletions

View File

@ -20272,7 +20272,7 @@ glabel func0f0a8d34
/* f0a8e34: 18400031 */ blez $v0,.L0f0a8efc
/* f0a8e38: 00000000 */ sll $zero,$zero,0x0
.L0f0a8e3c:
/* f0a8e3c: 0fc44b11 */ jal func0f112c44
/* f0a8e3c: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0a8e40: 02202025 */ or $a0,$s1,$zero
/* f0a8e44: 244dffe6 */ addiu $t5,$v0,-26
/* f0a8e48: 2da10026 */ sltiu $at,$t5,0x26
@ -20311,7 +20311,7 @@ glabel func0f0a8d34
/* f0a8ecc: 00000000 */ sll $zero,$zero,0x0
/* f0a8ed0: 3c0f800a */ lui $t7,0x800a
/* f0a8ed4: 8defa244 */ lw $t7,-0x5dbc($t7)
/* f0a8ed8: 0fc44b11 */ jal func0f112c44
/* f0a8ed8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0a8edc: 8de41874 */ lw $a0,0x1874($t7)
/* f0a8ee0: 0fc2865b */ jal currentPlayerEquipWeaponInCutscene
/* f0a8ee4: 00402025 */ or $a0,$v0,$zero

View File

@ -15489,7 +15489,7 @@ glabel func0f0fdf14
/* f0fdf94: 0082082a */ slt $at,$a0,$v0
/* f0fdf98: 502000b5 */ beqzl $at,.L0f0fe270
/* f0fdf9c: 8fbf001c */ lw $ra,0x1c($sp)
/* f0fdfa0: 0fc44b11 */ jal func0f112c44
/* f0fdfa0: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0fdfa4: 00000000 */ sll $zero,$zero,0x0
/* f0fdfa8: 00408025 */ or $s0,$v0,$zero
/* f0fdfac: 10400010 */ beqz $v0,.L0f0fdff0
@ -15771,7 +15771,7 @@ glabel func0f0fe280
/* f0fe39c: 1000004b */ beqz $zero,.L0f0fe4cc
/* f0fe3a0: 8fa70030 */ lw $a3,0x30($sp)
.L0f0fe3a4:
/* f0fe3a4: 0fc44b11 */ jal func0f112c44
/* f0fe3a4: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0fe3a8: afa70030 */ sw $a3,0x30($sp)
/* f0fe3ac: 24010031 */ addiu $at,$zero,0x31
/* f0fe3b0: 14410037 */ bne $v0,$at,.L0f0fe490
@ -15862,7 +15862,7 @@ glabel func0f0fe280
/* f0fe4e4: 000948c0 */ sll $t1,$t1,0x3
/* f0fe4e8: 01275021 */ addu $t2,$t1,$a3
/* f0fe4ec: 008a2021 */ addu $a0,$a0,$t2
/* f0fe4f0: 0fc44b11 */ jal func0f112c44
/* f0fe4f0: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0fe4f4: 908420f0 */ lbu $a0,0x20f0($a0)
/* f0fe4f8: 0fc2c62f */ jal currentPlayerHasWeaponEquipped
/* f0fe4fc: 00402025 */ or $a0,$v0,$zero
@ -15882,7 +15882,7 @@ glabel func0f0fe280
/* f0fe530: 000f78c0 */ sll $t7,$t7,0x3
/* f0fe534: 01e7c021 */ addu $t8,$t7,$a3
/* f0fe538: 00982021 */ addu $a0,$a0,$t8
/* f0fe53c: 0fc44b11 */ jal func0f112c44
/* f0fe53c: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0fe540: 908420f0 */ lbu $a0,0x20f0($a0)
/* f0fe544: 0fc28745 */ jal func0f0a1d14
/* f0fe548: 00402025 */ or $a0,$v0,$zero
@ -16412,7 +16412,7 @@ glabel func0f0fecd4
/* f0fed60: 241200ff */ addiu $s2,$zero,0xff
/* f0fed64: 24100008 */ addiu $s0,$zero,0x8
.L0f0fed68:
/* f0fed68: 0fc44b11 */ jal func0f112c44
/* f0fed68: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0fed6c: 02202025 */ or $a0,$s1,$zero
/* f0fed70: 304400ff */ andi $a0,$v0,0xff
/* f0fed74: 18800003 */ blez $a0,.L0f0fed84
@ -16482,7 +16482,7 @@ glabel func0f0fecd4
/* f0fee4c: 24420001 */ addiu $v0,$v0,0x1
/* f0fee50: 5480003a */ bnezl $a0,.L0f0fef3c
/* f0fee54: 26310001 */ addiu $s1,$s1,0x1
/* f0fee58: 0fc44b11 */ jal func0f112c44
/* f0fee58: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f0fee5c: 02202025 */ or $a0,$s1,$zero
/* f0fee60: 304600ff */ andi $a2,$v0,0xff
/* f0fee64: 18c00004 */ blez $a2,.L0f0fee78

View File

@ -4075,7 +4075,7 @@ glabel menuhandler00106178
/* f1061cc: 1000006e */ beqz $zero,.L0f106388
/* f1061d0: 8fbf0014 */ lw $ra,0x14($sp)
/* f1061d4: 8fb90028 */ lw $t9,0x28($sp)
/* f1061d8: 0fc44b11 */ jal func0f112c44
/* f1061d8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f1061dc: 8f240000 */ lw $a0,0x0($t9)
/* f1061e0: 24080001 */ addiu $t0,$zero,0x1
/* f1061e4: afa2001c */ sw $v0,0x1c($sp)
@ -4140,7 +4140,7 @@ glabel menuhandler00106178
/* f1062bc: 10000030 */ beqz $zero,.L0f106380
/* f1062c0: ade20000 */ sw $v0,0x0($t7)
/* f1062c4: 8fb80028 */ lw $t8,0x28($sp)
/* f1062c8: 0fc44b11 */ jal func0f112c44
/* f1062c8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f1062cc: 8f040000 */ lw $a0,0x0($t8)
/* f1062d0: 1040002b */ beqz $v0,.L0f106380
/* f1062d4: 00402025 */ or $a0,$v0,$zero
@ -4152,7 +4152,7 @@ glabel menuhandler00106178
/* f1062ec: 10000024 */ beqz $zero,.L0f106380
/* f1062f0: af220004 */ sw $v0,0x4($t9)
/* f1062f4: 8fa80028 */ lw $t0,0x28($sp)
/* f1062f8: 0fc44b11 */ jal func0f112c44
/* f1062f8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f1062fc: 8d040000 */ lw $a0,0x0($t0)
/* f106300: 3c03800a */ lui $v1,%hi(var800a21c0)
/* f106304: 246321c0 */ addiu $v1,$v1,%lo(var800a21c0)

View File

@ -183,7 +183,7 @@ void currentPlayerSetAllGuns(bool enable)
g_Vars.currentplayer->equipallguns = enable;
func0f112f70();
weaponnum = func0f112c44(g_Vars.currentplayer->equipcuritem);
weaponnum = currentPlayerGetWeaponNumByInvIndex(g_Vars.currentplayer->equipcuritem);
currentPlayerEquipWeaponInCutscene(weaponnum);
}
@ -1326,58 +1326,30 @@ struct textoverride *weaponGetTextOverride(s32 weaponnum)
return NULL;
}
GLOBAL_ASM(
glabel func0f112c44
/* f112c44: 27bdffe8 */ addiu $sp,$sp,-24
/* f112c48: afbf0014 */ sw $ra,0x14($sp)
/* f112c4c: 0fc44a96 */ jal currentPlayerGetInvItemByIndex
/* f112c50: afa40018 */ sw $a0,0x18($sp)
/* f112c54: 8fa40018 */ lw $a0,0x18($sp)
/* f112c58: 10400011 */ beqz $v0,.L0f112ca0
/* f112c5c: 00401825 */ or $v1,$v0,$zero
/* f112c60: 8c440000 */ lw $a0,0x0($v0)
/* f112c64: 24010002 */ addiu $at,$zero,0x2
/* f112c68: 54810009 */ bnel $a0,$at,.L0f112c90
/* f112c6c: 24010001 */ addiu $at,$zero,0x1
/* f112c70: 8c420004 */ lw $v0,0x4($v0)
/* f112c74: 0fc44af0 */ jal objGetTextOverride
/* f112c78: 8c440004 */ lw $a0,0x4($v0)
/* f112c7c: 5040001a */ beqzl $v0,.L0f112ce8
/* f112c80: 00001025 */ or $v0,$zero,$zero
/* f112c84: 10000018 */ beqz $zero,.L0f112ce8
/* f112c88: 8c420008 */ lw $v0,0x8($v0)
/* f112c8c: 24010001 */ addiu $at,$zero,0x1
.L0f112c90:
/* f112c90: 54810015 */ bnel $a0,$at,.L0f112ce8
/* f112c94: 00001025 */ or $v0,$zero,$zero
/* f112c98: 10000013 */ beqz $zero,.L0f112ce8
/* f112c9c: 84620004 */ lh $v0,0x4($v1)
.L0f112ca0:
/* f112ca0: 3c0e800a */ lui $t6,0x800a
/* f112ca4: 8dcea244 */ lw $t6,-0x5dbc($t6)
/* f112ca8: 8dcf1870 */ lw $t7,0x1870($t6)
/* f112cac: 51e0000e */ beqzl $t7,.L0f112ce8
/* f112cb0: 00001025 */ or $v0,$zero,$zero
/* f112cb4: 0fc446fa */ jal currentStageForbidsSlayer
/* f112cb8: afa40018 */ sw $a0,0x18($sp)
/* f112cbc: 8fa40018 */ lw $a0,0x18($sp)
/* f112cc0: 2418002c */ addiu $t8,$zero,0x2c
/* f112cc4: 0302c823 */ subu $t9,$t8,$v0
/* f112cc8: 0099082a */ slt $at,$a0,$t9
/* f112ccc: 50200006 */ beqzl $at,.L0f112ce8
/* f112cd0: 00001025 */ or $v0,$zero,$zero
/* f112cd4: 0fc446e2 */ jal func0f111b88
/* f112cd8: 24840001 */ addiu $a0,$a0,0x1
/* f112cdc: 10000003 */ beqz $zero,.L0f112cec
/* f112ce0: 8fbf0014 */ lw $ra,0x14($sp)
/* f112ce4: 00001025 */ or $v0,$zero,$zero
.L0f112ce8:
/* f112ce8: 8fbf0014 */ lw $ra,0x14($sp)
.L0f112cec:
/* f112cec: 27bd0018 */ addiu $sp,$sp,0x18
/* f112cf0: 03e00008 */ jr $ra
/* f112cf4: 00000000 */ sll $zero,$zero,0x0
);
s32 currentPlayerGetWeaponNumByInvIndex(s32 index)
{
struct invitem *item = currentPlayerGetInvItemByIndex(index);
if (item) {
if (item->type == INVITEMTYPE_PROP) {
struct prop *prop = item->type_prop.prop;
struct textoverride *override = objGetTextOverride(prop->obj);
if (override) {
return override->weapon;
}
} else if (item->type == INVITEMTYPE_1) {
return item->type1.weapon1;
}
} else if (g_Vars.currentplayer->equipallguns) {
if (index < WEAPON_PSYCHOSISGUN - currentStageForbidsSlayer()) {
index++;
return func0f111b88(index);
}
}
return 0;
}
GLOBAL_ASM(
glabel func0f112cf8
@ -1589,7 +1561,7 @@ glabel func0f112f70
/* f112fa0: 5840000e */ blezl $v0,.L0f112fdc
/* f112fa4: 8fbf001c */ lw $ra,0x1c($sp)
.L0f112fa8:
/* f112fa8: 0fc44b11 */ jal func0f112c44
/* f112fa8: 0fc44b11 */ jal currentPlayerGetWeaponNumByInvIndex
/* f112fac: 02002025 */ or $a0,$s0,$zero
/* f112fb0: 14510004 */ bne $v0,$s1,.L0f112fc4
/* f112fb4: 3c0f800a */ lui $t7,0x800a

View File

@ -14,7 +14,7 @@ bool currentPlayerHasWeapon(s32 weaponnum);
struct invitem *func0f111a4c(s32 weapon1, s32 weapon2);
bool func0f111ab0(s32 weapon1, s32 weapon2);
bool func0f111ad4(s32 weaponnum);
u32 func0f111b88(void);
s32 func0f111b88(s32 arg0);
s32 currentStageForbidsSlayer(void);
bool currentPlayerCanHaveAllGunsWeapon(s32 weaponnum);
bool currentPlayerCanHaveWeapon(s32 weaponnum);
@ -35,7 +35,7 @@ s32 currentPlayerGetNumInvItems(void);
struct invitem *currentPlayerGetInvItemByIndex(s32 index);
struct textoverride *objGetTextOverride(struct defaultobj *obj);
struct textoverride *weaponGetTextOverride(s32 weaponnum);
s32 func0f112c44(s32 equipcuritem);
s32 currentPlayerGetWeaponNumByInvIndex(s32 index);
u32 func0f112cf8(void);
u32 func0f112dfc(void);
u32 func0f112e24(void);