diff --git a/src/game/game_015470.c b/src/game/game_015470.c index 6cfa8ac4c..a9d7918d6 100644 --- a/src/game/game_015470.c +++ b/src/game/game_015470.c @@ -6725,7 +6725,7 @@ glabel func0f01b160 .L0f01b2a0: /* f01b2a0: 1500000f */ bnez $t0,.L0f01b2e0 /* f01b2a4: 00000000 */ sll $zero,$zero,0x0 -/* f01b2a8: 0fc44a54 */ jal func0f112950 +/* f01b2a8: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f01b2ac: 00000000 */ sll $zero,$zero,0x0 /* f01b2b0: 3c09800a */ lui $t1,0x800a /* f01b2b4: 8d2921b8 */ lw $t1,0x21b8($t1) diff --git a/src/game/game_097a50.c b/src/game/game_097a50.c index 85b76f97f..9328f6e4e 100644 --- a/src/game/game_097a50.c +++ b/src/game/game_097a50.c @@ -20224,7 +20224,7 @@ glabel func0f0a8d34 /* f0a8d80: 00000000 */ sll $zero,$zero,0x0 /* f0a8d84: 8c4b00bc */ lw $t3,0xbc($v0) /* f0a8d88: 8d700004 */ lw $s0,0x4($t3) -/* f0a8d8c: 0fc44a54 */ jal func0f112950 +/* f0a8d8c: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f0a8d90: afa00070 */ sw $zero,0x70($sp) /* f0a8d94: 28410002 */ slti $at,$v0,0x2 /* f0a8d98: 14200005 */ bnez $at,.L0f0a8db0 @@ -20267,7 +20267,7 @@ glabel func0f0a8d34 /* f0a8e24: a20a02e1 */ sb $t2,0x2e1($s0) /* f0a8e28: ae0c0014 */ sw $t4,0x14($s0) .L0f0a8e2c: -/* f0a8e2c: 0fc44a54 */ jal func0f112950 +/* f0a8e2c: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f0a8e30: 00008825 */ or $s1,$zero,$zero /* f0a8e34: 18400031 */ blez $v0,.L0f0a8efc /* f0a8e38: 00000000 */ sll $zero,$zero,0x0 @@ -20316,7 +20316,7 @@ glabel func0f0a8d34 /* f0a8ee0: 0fc2865b */ jal currentPlayerEquipWeaponInCutscene /* f0a8ee4: 00402025 */ or $a0,$v0,$zero .L0f0a8ee8: -/* f0a8ee8: 0fc44a54 */ jal func0f112950 +/* f0a8ee8: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f0a8eec: 26310001 */ addiu $s1,$s1,0x1 /* f0a8ef0: 0222082a */ slt $at,$s1,$v0 /* f0a8ef4: 1420ffd1 */ bnez $at,.L0f0a8e3c diff --git a/src/game/game_0f09f0.c b/src/game/game_0f09f0.c index 1b0d33270..caedfd623 100644 --- a/src/game/game_0f09f0.c +++ b/src/game/game_0f09f0.c @@ -15483,7 +15483,7 @@ glabel func0f0fdf14 /* f0fdf7c: 010fc021 */ addu $t8,$t0,$t7 /* f0fdf80: 0306c821 */ addu $t9,$t8,$a2 /* f0fdf84: 93290020 */ lbu $t1,0x20($t9) -/* f0fdf88: 0fc44a54 */ jal func0f112950 +/* f0fdf88: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f0fdf8c: afa90040 */ sw $t1,0x40($sp) /* f0fdf90: 8fa40040 */ lw $a0,0x40($sp) /* f0fdf94: 0082082a */ slt $at,$a0,$v0 @@ -15748,7 +15748,7 @@ glabel func0f0fe280 /* f0fe344: 358d0002 */ ori $t5,$t4,0x2 /* f0fe348: ad6d0000 */ sw $t5,0x0($t3) .L0f0fe34c: -/* f0fe34c: 0fc44a54 */ jal func0f112950 +/* f0fe34c: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f0fe350: afa70030 */ sw $a3,0x30($sp) /* f0fe354: 3c0e800a */ lui $t6,0x800a /* f0fe358: 8dce21b8 */ lw $t6,0x21b8($t6) @@ -16380,7 +16380,7 @@ glabel func0f0fecd4 /* f0fece4: afb30020 */ sw $s3,0x20($sp) /* f0fece8: afb2001c */ sw $s2,0x1c($sp) /* f0fecec: afb10018 */ sw $s1,0x18($sp) -/* f0fecf0: 0fc44a54 */ jal func0f112950 +/* f0fecf0: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f0fecf4: afb00014 */ sw $s0,0x14($sp) /* f0fecf8: 3c04800a */ lui $a0,0x800a /* f0fecfc: 8c8421b8 */ lw $a0,0x21b8($a0) diff --git a/src/game/game_102240.c b/src/game/game_102240.c index a47b15191..2fc4f147b 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -4064,7 +4064,7 @@ glabel menuhandler00106178 /* f1061a0: 8c2e2e48 */ lw $t6,%lo(var7f1b2e48)($at) /* f1061a4: 01c00008 */ jr $t6 /* f1061a8: 00000000 */ sll $zero,$zero,0x0 -/* f1061ac: 0fc44a54 */ jal func0f112950 +/* f1061ac: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f1061b0: 00000000 */ sll $zero,$zero,0x0 /* f1061b4: 8faf0028 */ lw $t7,0x28($sp) /* f1061b8: 10000071 */ beqz $zero,.L0f106380 diff --git a/src/game/game_111600.c b/src/game/game_111600.c index 8a1c178e8..e601ab3d9 100644 --- a/src/game/game_111600.c +++ b/src/game/game_111600.c @@ -1190,82 +1190,52 @@ bool currentPlayerHasProp(struct prop *prop) return false; } -GLOBAL_ASM( -glabel func0f112950 -/* f112950: 3c08800a */ lui $t0,0x800a -/* f112954: 8d08a244 */ lw $t0,-0x5dbc($t0) -/* f112958: 27bdffe8 */ addiu $sp,$sp,-24 -/* f11295c: afbf0014 */ sw $ra,0x14($sp) -/* f112960: 8d0e1870 */ lw $t6,0x1870($t0) -/* f112964: 00003025 */ or $a2,$zero,$zero -/* f112968: 51c00008 */ beqzl $t6,.L0f11298c -/* f11296c: 8d091864 */ lw $t1,0x1864($t0) -/* f112970: 0fc446fa */ jal currentStageForbidsSlayer -/* f112974: 00000000 */ sll $zero,$zero,0x0 -/* f112978: 240f002c */ addiu $t7,$zero,0x2c -/* f11297c: 3c08800a */ lui $t0,0x800a -/* f112980: 8d08a244 */ lw $t0,-0x5dbc($t0) -/* f112984: 01e23023 */ subu $a2,$t7,$v0 -/* f112988: 8d091864 */ lw $t1,0x1864($t0) -.L0f11298c: -/* f11298c: 8fbf0014 */ lw $ra,0x14($sp) -/* f112990: 27bd0018 */ addiu $sp,$sp,0x18 -/* f112994: 1120002e */ beqz $t1,.L0f112a50 -/* f112998: 01202825 */ or $a1,$t1,$zero -/* f11299c: 3c0c0004 */ lui $t4,0x4 -/* f1129a0: 240b0004 */ addiu $t3,$zero,0x4 -/* f1129a4: 240a0002 */ addiu $t2,$zero,0x2 -/* f1129a8: 24070001 */ addiu $a3,$zero,0x1 -/* f1129ac: 8ca20000 */ lw $v0,0x0($a1) -.L0f1129b0: -/* f1129b0: 15420018 */ bne $t2,$v0,.L0f112a14 -/* f1129b4: 00000000 */ sll $zero,$zero,0x0 -/* f1129b8: 8ca20004 */ lw $v0,0x4($a1) -/* f1129bc: 50400020 */ beqzl $v0,.L0f112a40 -/* f1129c0: 8ca5000c */ lw $a1,0xc($a1) -/* f1129c4: 8c430004 */ lw $v1,0x4($v0) -/* f1129c8: 5060001d */ beqzl $v1,.L0f112a40 -/* f1129cc: 8ca5000c */ lw $a1,0xc($a1) -/* f1129d0: 90440000 */ lbu $a0,0x0($v0) -/* f1129d4: 15640007 */ bne $t3,$a0,.L0f1129f4 -/* f1129d8: 00000000 */ sll $zero,$zero,0x0 -/* f1129dc: 8c780040 */ lw $t8,0x40($v1) -/* f1129e0: 33190400 */ andi $t9,$t8,0x400 -/* f1129e4: 53200016 */ beqzl $t9,.L0f112a40 -/* f1129e8: 8ca5000c */ lw $a1,0xc($a1) -/* f1129ec: 10000013 */ beqz $zero,.L0f112a3c -/* f1129f0: 24c60001 */ addiu $a2,$a2,0x1 -.L0f1129f4: -/* f1129f4: 54e40012 */ bnel $a3,$a0,.L0f112a40 -/* f1129f8: 8ca5000c */ lw $a1,0xc($a1) -/* f1129fc: 8c6d000c */ lw $t5,0xc($v1) -/* f112a00: 01ac7024 */ and $t6,$t5,$t4 -/* f112a04: 55c0000e */ bnezl $t6,.L0f112a40 -/* f112a08: 8ca5000c */ lw $a1,0xc($a1) -/* f112a0c: 1000000b */ beqz $zero,.L0f112a3c -/* f112a10: 24c60001 */ addiu $a2,$a2,0x1 -.L0f112a14: -/* f112a14: 54e2000a */ bnel $a3,$v0,.L0f112a40 -/* f112a18: 8ca5000c */ lw $a1,0xc($a1) -/* f112a1c: 8d0f1870 */ lw $t7,0x1870($t0) -/* f112a20: 51e00006 */ beqzl $t7,.L0f112a3c -/* f112a24: 24c60001 */ addiu $a2,$a2,0x1 -/* f112a28: 84b80004 */ lh $t8,0x4($a1) -/* f112a2c: 2b01002d */ slti $at,$t8,0x2d -/* f112a30: 54200003 */ bnezl $at,.L0f112a40 -/* f112a34: 8ca5000c */ lw $a1,0xc($a1) -/* f112a38: 24c60001 */ addiu $a2,$a2,0x1 -.L0f112a3c: -/* f112a3c: 8ca5000c */ lw $a1,0xc($a1) -.L0f112a40: -/* f112a40: 10a90003 */ beq $a1,$t1,.L0f112a50 -/* f112a44: 00000000 */ sll $zero,$zero,0x0 -/* f112a48: 54a0ffd9 */ bnezl $a1,.L0f1129b0 -/* f112a4c: 8ca20000 */ lw $v0,0x0($a1) -.L0f112a50: -/* f112a50: 03e00008 */ jr $ra -/* f112a54: 00c01025 */ or $v0,$a2,$zero -); +s32 currentPlayerGetNumInvItems(void) +{ + s32 numitems = 0; + struct invitem *item; + + if (g_Vars.currentplayer->equipallguns) { + numitems = WEAPON_PSYCHOSISGUN - currentStageForbidsSlayer(); + } + + item = g_Vars.currentplayer->weapons; + + while (item) { + if (item->type == INVITEMTYPE_PROP) { + struct prop *prop = item->type_prop.prop; + + if (prop) { + struct defaultobj *obj = prop->obj; + + if (obj) { + if (prop->type == PROPTYPE_WEAPON) { + if (obj->hidden & OBJHFLAG_00000400) { + numitems++; + } + } else if (prop->type == PROPTYPE_OBJ) { + if ((obj->flags2 & OBJFLAG2_00040000) == 0) { + numitems++; + } + } + } + } + } else if (item->type == INVITEMTYPE_1) { + if (g_Vars.currentplayer->equipallguns == false + || item->type1.weapon1 > WEAPON_PSYCHOSISGUN) { + numitems++; + } + } + + item = item->next; + + if (item == g_Vars.currentplayer->weapons) { + break; + } + } + + return numitems; +} GLOBAL_ASM( glabel func0f112a58 @@ -1671,7 +1641,7 @@ glabel func0f112f70 /* f112f8c: 8dcea244 */ lw $t6,-0x5dbc($t6) /* f112f90: 00408825 */ or $s1,$v0,$zero /* f112f94: 00008025 */ or $s0,$zero,$zero -/* f112f98: 0fc44a54 */ jal func0f112950 +/* f112f98: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f112f9c: adc01874 */ sw $zero,0x1874($t6) /* f112fa0: 5840000e */ blezl $v0,.L0f112fdc /* f112fa4: 8fbf001c */ lw $ra,0x1c($sp) @@ -1684,7 +1654,7 @@ glabel func0f112f70 /* f112fbc: 10000006 */ beqz $zero,.L0f112fd8 /* f112fc0: adf01874 */ sw $s0,0x1874($t7) .L0f112fc4: -/* f112fc4: 0fc44a54 */ jal func0f112950 +/* f112fc4: 0fc44a54 */ jal currentPlayerGetNumInvItems /* f112fc8: 26100001 */ addiu $s0,$s0,0x1 /* f112fcc: 0202082a */ slt $at,$s0,$v0 /* f112fd0: 1420fff5 */ bnez $at,.L0f112fa8 diff --git a/src/include/constants.h b/src/include/constants.h index d503619f9..f50131535 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -1372,6 +1372,7 @@ // obj->hidden #define OBJHFLAG_00000080 0x00000080 #define OBJHFLAG_00000200 0x00000200 +#define OBJHFLAG_00000400 0x00000400 #define OBJHFLAG_00000800 0x00000800 #define OBJHFLAG_ACTIVATED_BY_BOND 0x00004000 #define OBJHFLAG_ACTIVATED_BY_COOP 0x00040000 diff --git a/src/include/game/game_111600.h b/src/include/game/game_111600.h index ddb1f42c4..09266d777 100644 --- a/src/include/game/game_111600.h +++ b/src/include/game/game_111600.h @@ -31,7 +31,7 @@ bool currentPlayerHasKeyFlags(u32 wantkeyflags); bool currentPlayerHasBriefcase(void); bool currentPlayerHasDataUplink(void); bool currentPlayerHasProp(struct prop *prop); -u32 func0f112950(void); +s32 currentPlayerGetNumInvItems(void); u32 func0f112a58(void); struct textoverride *objGetTextOverride(struct defaultobj *obj); u32 func0f112bfc(void); diff --git a/src/include/types.h b/src/include/types.h index 3a19bc9b6..206453437 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -5062,7 +5062,7 @@ struct invitem_type3 { }; struct invitem { - /*0x00*/ u32 type; + /*0x00*/ s32 type; union { struct invitem_type1 type1;