From 836d3b2533933b3aba95a0123d5a2f94246a034f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Thu, 30 Jul 2020 23:10:27 +1000 Subject: [PATCH] Decompile propHide --- src/game/chr/chraicommands.c | 10 +++---- src/game/game_014f10.c | 2 +- src/game/game_015280.c | 2 +- src/game/game_015330.c | 2 +- src/game/game_0601b0.c | 48 ++++++++++++---------------------- src/game/game_0b63b0.c | 2 +- src/game/game_167ae0.c | 4 +-- src/game/propobj.c | 4 +-- src/include/game/game_0601b0.h | 2 +- src/include/gvars/gvars.h | 2 +- 10 files changed, 31 insertions(+), 47 deletions(-) diff --git a/src/game/chr/chraicommands.c b/src/game/chr/chraicommands.c index d0039f985..c79beb2fa 100644 --- a/src/game/chr/chraicommands.c +++ b/src/game/chr/chraicommands.c @@ -2469,7 +2469,7 @@ bool aiGiveObjectToChr(void) } else { func0f065c44(obj->prop); func0f0605c4(obj->prop); - func0f060300(obj->prop); + propHide(obj->prop); } if (obj->type != OBJTYPE_WEAPON || func0f08ae54(obj, chr) == 0) { @@ -5399,7 +5399,7 @@ bool aiHideChr(void) if (chr && chr->prop && chr->model) { func0f065c44(chr->prop); func0f0605c4(chr->prop); - func0f060300(chr->prop); + propHide(chr->prop); } g_Vars.aioffset += 3; @@ -5447,7 +5447,7 @@ bool aiHideObj(void) } else { func0f065c44(obj->prop); func0f0605c4(obj->prop); - func0f060300(obj->prop); + propHide(obj->prop); } } @@ -9601,7 +9601,7 @@ glabel ai0172 /* f05cae0: 02002025 */ or $a0,$s0,$zero /* f05cae4: 0fc18171 */ jal func0f0605c4 /* f05cae8: 02002025 */ or $a0,$s0,$zero -/* f05caec: 0fc180c0 */ jal func0f060300 +/* f05caec: 0fc180c0 */ jal propHide /* f05caf0: 02002025 */ or $a0,$s0,$zero /* f05caf4: 8e040004 */ lw $a0,0x4($s0) /* f05caf8: 0fc22b95 */ jal func0f08ae54 @@ -9631,7 +9631,7 @@ glabel ai0172 // if (prop && prop->weapon && prop->parent == NULL && prop->type == PROPTYPE_WEAPON) { // func0f065c44(prop); // func0f0605c4(prop); -// func0f060300(prop); +// propHide(prop); // func0f08ae54(prop->weapon, g_Vars.chrdata); // } // diff --git a/src/game/game_014f10.c b/src/game/game_014f10.c index b74285ded..7e605219f 100644 --- a/src/game/game_014f10.c +++ b/src/game/game_014f10.c @@ -24,7 +24,7 @@ void func0f014f10(void) && g_ChrsA[i].prop->type == PROPTYPE_CHR) { func0f020d44(g_ChrsA[i].prop, true); func0f0605c4(g_ChrsA[i].prop); - func0f060300(g_ChrsA[i].prop); + propHide(g_ChrsA[i].prop); propFree(g_ChrsA[i].prop); } } diff --git a/src/game/game_015280.c b/src/game/game_015280.c index 325647784..218221300 100644 --- a/src/game/game_015280.c +++ b/src/game/game_015280.c @@ -40,7 +40,7 @@ glabel func0f015280 /* f0152d8: 00000000 */ nop /* f0152dc: 8e390000 */ lw $t9,0x0($s1) /* f0152e0: 03304021 */ addu $t0,$t9,$s0 -/* f0152e4: 0fc180c0 */ jal func0f060300 +/* f0152e4: 0fc180c0 */ jal propHide /* f0152e8: 8d040000 */ lw $a0,0x0($t0) /* f0152ec: 8e290000 */ lw $t1,0x0($s1) /* f0152f0: 01305021 */ addu $t2,$t1,$s0 diff --git a/src/game/game_015330.c b/src/game/game_015330.c index a6cb239ed..1b61e17b2 100644 --- a/src/game/game_015330.c +++ b/src/game/game_015330.c @@ -38,7 +38,7 @@ glabel func0f015330 /* f015384: 00000000 */ nop /* f015388: 8e390000 */ lw $t9,0x0($s1) /* f01538c: 03304021 */ addu $t0,$t9,$s0 -/* f015390: 0fc180c0 */ jal func0f060300 +/* f015390: 0fc180c0 */ jal propHide /* f015394: 8d040000 */ lw $a0,0x0($t0) /* f015398: 8e290000 */ lw $t1,0x0($s1) /* f01539c: 01305021 */ addu $t2,$t1,$s0 diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 02d54fcf6..2cb5f5027 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -145,34 +145,18 @@ void propShow(struct prop *prop) prop->flags |= PROPFLAG_TANGIBLE; } -GLOBAL_ASM( -glabel func0f060300 -/* f060300: 908e0001 */ lbu $t6,0x1($a0) -/* f060304: 3c05800a */ lui $a1,%hi(g_Vars) -/* f060308: 24a59fc0 */ addiu $a1,$a1,%lo(g_Vars) -/* f06030c: 31cffffb */ andi $t7,$t6,0xfffb -/* f060310: a08f0001 */ sb $t7,0x1($a0) -/* f060314: 8ca3034c */ lw $v1,0x34c($a1) -/* f060318: 8ca20348 */ lw $v0,0x348($a1) -/* f06031c: 0043082b */ sltu $at,$v0,$v1 -/* f060320: 1020000b */ beqz $at,.L0f060350 -/* f060324: 00000000 */ nop -/* f060328: 8c580000 */ lw $t8,0x0($v0) -.L0f06032c: -/* f06032c: 54980005 */ bnel $a0,$t8,.L0f060344 -/* f060330: 24420004 */ addiu $v0,$v0,0x4 -/* f060334: ac400000 */ sw $zero,0x0($v0) -/* f060338: 3c03800a */ lui $v1,%hi(g_Vars+0x34c) -/* f06033c: 8c63a30c */ lw $v1,%lo(g_Vars+0x34c)($v1) -/* f060340: 24420004 */ addiu $v0,$v0,0x4 -.L0f060344: -/* f060344: 0043082b */ sltu $at,$v0,$v1 -/* f060348: 5420fff8 */ bnezl $at,.L0f06032c -/* f06034c: 8c580000 */ lw $t8,0x0($v0) -.L0f060350: -/* f060350: 03e00008 */ jr $ra -/* f060354: 00000000 */ nop -); +void propHide(struct prop *prop) +{ + struct prop **ptr; + + prop->flags &= ~PROPFLAG_TANGIBLE; + + for (ptr = g_Vars.tangibleprops; ptr < g_Vars.unk00034c; ptr++) { + if (*ptr == prop) { + *ptr = NULL; + } + } +} struct prop *propAllocate(void) { @@ -3075,7 +3059,7 @@ glabel func0f062b64 /* f062bd8: ac6a0040 */ sw $t2,0x40($v1) /* f062bdc: 0fc19711 */ jal func0f065c44 /* f062be0: a06c0002 */ sb $t4,0x2($v1) -/* f062be4: 0fc180c0 */ jal func0f060300 +/* f062be4: 0fc180c0 */ jal propHide /* f062be8: 02002025 */ or $a0,$s0,$zero /* f062bec: 8e0d003c */ lw $t5,0x3c($s0) /* f062bf0: 000d7ec0 */ sll $t7,$t5,0x1b @@ -3090,7 +3074,7 @@ glabel func0f062b64 /* f062c10: 02002025 */ or $a0,$s0,$zero /* f062c14: 0fc18171 */ jal func0f0605c4 /* f062c18: 02002025 */ or $a0,$s0,$zero -/* f062c1c: 0fc180c0 */ jal func0f060300 +/* f062c1c: 0fc180c0 */ jal propHide /* f062c20: 02002025 */ or $a0,$s0,$zero /* f062c24: 0fc1810e */ jal propFree /* f062c28: 02002025 */ or $a0,$s0,$zero @@ -3104,7 +3088,7 @@ glabel func0f062b64 /* f062c44: 02002025 */ or $a0,$s0,$zero /* f062c48: 0fc18171 */ jal func0f0605c4 /* f062c4c: 02002025 */ or $a0,$s0,$zero -/* f062c50: 0fc180c0 */ jal func0f060300 +/* f062c50: 0fc180c0 */ jal propHide /* f062c54: 02002025 */ or $a0,$s0,$zero /* f062c58: 10000014 */ b .L0f062cac /* f062c5c: 8fbf001c */ lw $ra,0x1c($sp) @@ -3116,7 +3100,7 @@ glabel func0f062b64 /* f062c70: 02002025 */ or $a0,$s0,$zero /* f062c74: 0fc18171 */ jal func0f0605c4 /* f062c78: 02002025 */ or $a0,$s0,$zero -/* f062c7c: 0fc180c0 */ jal func0f060300 +/* f062c7c: 0fc180c0 */ jal propHide /* f062c80: 02002025 */ or $a0,$s0,$zero /* f062c84: 0fc20be2 */ jal func0f082f88 /* f062c88: 02002025 */ or $a0,$s0,$zero diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index b8bd4d4c9..eb66b7e17 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -2226,7 +2226,7 @@ glabel func0f0b7c60 /* f0b7fe0: 8fa40044 */ lw $a0,0x44($sp) /* f0b7fe4: 0fc18171 */ jal func0f0605c4 /* f0b7fe8: 8fa40044 */ lw $a0,0x44($sp) -/* f0b7fec: 0fc180c0 */ jal func0f060300 +/* f0b7fec: 0fc180c0 */ jal propHide /* f0b7ff0: 8fa40044 */ lw $a0,0x44($sp) /* f0b7ff4: 0fc1810e */ jal propFree /* f0b7ff8: 8fa40044 */ lw $a0,0x44($sp) diff --git a/src/game/game_167ae0.c b/src/game/game_167ae0.c index 80b8be02c..497c8c07b 100644 --- a/src/game/game_167ae0.c +++ b/src/game/game_167ae0.c @@ -1338,7 +1338,7 @@ void func0f1691c0(void) campos.y = g_Vars.currentplayer->cam_pos.y; campos.z = g_Vars.currentplayer->cam_pos.z; - while (propptr >= g_Vars.unk000348) { + while (propptr >= g_Vars.tangibleprops) { prop = *propptr; if (prop) { @@ -1358,7 +1358,7 @@ void func0f1691c0(void) propptr = g_Vars.unk00034c - 1; - while (propptr >= g_Vars.unk000348) { + while (propptr >= g_Vars.tangibleprops) { prop = *propptr; if (prop) { diff --git a/src/game/propobj.c b/src/game/propobj.c index bcfbf8a3b..5e761880b 100644 --- a/src/game/propobj.c +++ b/src/game/propobj.c @@ -6186,7 +6186,7 @@ glabel setupParseObject /* f06b30c: 8e380014 */ lw $t8,0x14($s1) /* f06b310: 0fc18171 */ jal func0f0605c4 /* f06b314: 8e240014 */ lw $a0,0x14($s1) -/* f06b318: 0fc180c0 */ jal func0f060300 +/* f06b318: 0fc180c0 */ jal propHide /* f06b31c: 8e240014 */ lw $a0,0x14($s1) /* f06b320: 0fc1810e */ jal propFree /* f06b324: 8e240014 */ lw $a0,0x14($s1) @@ -10498,7 +10498,7 @@ glabel func0f06ef44 /* f06efa8: ae080040 */ sw $t0,0x40($s0) /* f06efac: 0fc18171 */ jal func0f0605c4 /* f06efb0: 02202025 */ or $a0,$s1,$zero -/* f06efb4: 0fc180c0 */ jal func0f060300 +/* f06efb4: 0fc180c0 */ jal propHide /* f06efb8: 02202025 */ or $a0,$s1,$zero /* f06efbc: 8fa90180 */ lw $t1,0x180($sp) /* f06efc0: 8e0a0018 */ lw $t2,0x18($s0) diff --git a/src/include/game/game_0601b0.h b/src/include/game/game_0601b0.h index adad45c44..1ef489ec7 100644 --- a/src/include/game/game_0601b0.h +++ b/src/include/game/game_0601b0.h @@ -5,7 +5,7 @@ u32 func0f0601b0(void); void propShow(struct prop *prop); -void func0f060300(struct prop *prop); +void propHide(struct prop *prop); struct prop *propAllocate(void); void propFree(struct prop *prop); void func0f0604bc(struct prop *prop); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index 0a95be8d2..0f1627bac 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -91,7 +91,7 @@ struct g_vars { /*00033c*/ struct prop *unk00033c; /*000340*/ struct prop *unk000340; /*000344*/ struct prop *freeprops; - /*000348*/ struct prop **unk000348; + /*000348*/ struct prop **tangibleprops; /*00034c*/ struct prop **unk00034c; /*000350*/ u32 unk000350; /*000354*/ struct prop *unk000354;