From 8726e6990d7a64737816c4b6489f59cd4b2e1baf Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 30 Dec 2019 08:23:19 +1000 Subject: [PATCH] Decompile func0f060438 --- src/game/game_0601b0.c | 52 +++++++++------------------------- src/include/game/game_0601b0.h | 2 +- src/include/gvars/gvars.h | 19 ++----------- src/include/types.h | 13 ++++++++- 4 files changed, 30 insertions(+), 56 deletions(-) diff --git a/src/game/game_0601b0.c b/src/game/game_0601b0.c index 4448055e1..31508062e 100644 --- a/src/game/game_0601b0.c +++ b/src/game/game_0601b0.c @@ -379,44 +379,20 @@ glabel func0f060358 /* f060434: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f060438 -/* f060438: 908e0000 */ lbu $t6,0x0($a0) -/* f06043c: 24010003 */ addiu $at,$zero,0x3 -/* f060440: 55c1000d */ bnel $t6,$at,.L0f060478 -/* f060444: 9089003d */ lbu $t1,0x3d($a0) -/* f060448: 908f003d */ lbu $t7,0x3d($a0) -/* f06044c: 3c03800a */ lui $v1,%hi(g_Vars) -/* f060450: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) -/* f060454: 000fc0c0 */ sll $t8,$t7,0x3 -/* f060458: 030fc023 */ subu $t8,$t8,$t7 -/* f06045c: 0018c080 */ sll $t8,$t8,0x2 -/* f060460: 00781021 */ addu $v0,$v1,$t8 -/* f060464: 94590362 */ lhu $t9,0x362($v0) -/* f060468: 2728ffff */ addiu $t0,$t9,-1 -/* f06046c: 1000000b */ beqz $zero,.L0f06049c -/* f060470: a4480362 */ sh $t0,0x362($v0) -/* f060474: 9089003d */ lbu $t1,0x3d($a0) -.L0f060478: -/* f060478: 3c03800a */ lui $v1,%hi(g_Vars) -/* f06047c: 24639fc0 */ addiu $v1,$v1,%lo(g_Vars) -/* f060480: 000950c0 */ sll $t2,$t1,0x3 -/* f060484: 01495023 */ subu $t2,$t2,$t1 -/* f060488: 000a5080 */ sll $t2,$t2,0x2 -/* f06048c: 006a1021 */ addu $v0,$v1,$t2 -/* f060490: 944b0360 */ lhu $t3,0x360($v0) -/* f060494: 256cffff */ addiu $t4,$t3,-1 -/* f060498: a44c0360 */ sh $t4,0x360($v0) -.L0f06049c: -/* f06049c: 8c6d0344 */ lw $t5,0x344($v1) -/* f0604a0: 240effff */ addiu $t6,$zero,-1 -/* f0604a4: ac800024 */ sw $zero,0x24($a0) -/* f0604a8: ac800004 */ sw $zero,0x4($a0) -/* f0604ac: a48e0028 */ sh $t6,0x28($a0) -/* f0604b0: ac8d0020 */ sw $t5,0x20($a0) -/* f0604b4: 03e00008 */ jr $ra -/* f0604b8: ac640344 */ sw $a0,0x344($v1) -); +void func0f060438(struct prop *prop) +{ + if (prop->type == PROPTYPE_CHR) { + g_Vars.unk000360[prop->index].chrpropcount--; + } else { + g_Vars.unk000360[prop->index].nonchrpropcount--; + } + + prop->next = g_Vars.unk000344; + prop->prev = NULL; + prop->chr = NULL; + prop->room = -1; + g_Vars.unk000344 = prop; +} GLOBAL_ASM( glabel func0f0604bc diff --git a/src/include/game/game_0601b0.h b/src/include/game/game_0601b0.h index ec5daa672..03bd2cd58 100644 --- a/src/include/game/game_0601b0.h +++ b/src/include/game/game_0601b0.h @@ -7,7 +7,7 @@ u32 func0f0601b0(void); void propHide(struct prop *prop); u32 func0f060300(struct prop *prop); struct prop *func0f060358(void); -u32 func0f060438(void); +void func0f060438(struct prop *prop); void func0f0604bc(struct prop *prop); u32 func0f060538(void); void func0f0605c4(struct prop *prop); diff --git a/src/include/gvars/gvars.h b/src/include/gvars/gvars.h index c053ebe8a..835b4fa97 100644 --- a/src/include/gvars/gvars.h +++ b/src/include/gvars/gvars.h @@ -93,27 +93,14 @@ struct g_vars { /*000338*/ struct prop *props; /*00033c*/ struct prop *unk00033c; /*000340*/ struct prop *unk000340; - /*000344*/ u32 unk000344; - /*000348*/ u32 unk000348; + /*000344*/ struct prop *unk000344; + /*000348*/ struct prop *unk000348; /*00034c*/ u32 unk00034c; /*000350*/ u32 unk000350; /*000354*/ struct prop *unk000354; /*000358*/ u32 unk000358; /*00035c*/ u32 unk00035c; - /*000360*/ u32 unk000360; - /*000364*/ u32 unk000364; - /*000368*/ u32 unk000368; - /*00036c*/ u32 unk00036c; - /*000370*/ u32 unk000370; - /*000374*/ u32 unk000374; - /*000378*/ u32 unk000378; - /*00037c*/ u32 unk00037c; - /*000380*/ u32 unk000380; - /*000384*/ u32 unk000384; - /*000388*/ u32 unk000388; - /*00038c*/ u32 unk00038c; - /*000390*/ u32 unk000390; - /*000394*/ u32 unk000394; + /*000360*/ struct gvars360 unk000360[2]; // may also start at 35c or 358 with props moved forward /*000398*/ u32 unk000398; /*00039c*/ u32 unk00039c; /*0003a0*/ u32 unk0003a0; diff --git a/src/include/types.h b/src/include/types.h index 09de921d5..bfa021aa9 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -47,7 +47,7 @@ struct prop { s16 unk38; s16 unk3a; u8 unk3c; - u8 unk3d; + u8 index; u8 unk3e; u8 unk3f_00 : 1; u8 unk3f_01 : 1; @@ -3892,4 +3892,15 @@ struct savefile_solo { /*0xac*/ u8 firingrangescores[4]; }; +struct gvars360 { + u16 nonchrpropcount; + u16 chrpropcount; + u32 unk04; + u32 unk08; + u32 unk0c; + u32 unk10; + u32 unk14; + u32 unk18; +}; + #endif