From 7b235da743067a39048aeff78aa3ed58d7d0de6c Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 16 Mar 2020 22:27:17 +1000 Subject: [PATCH] Decompile currentPlayerSetScaleBg2Gfx --- src/game/game_0b63b0.c | 2 +- src/game/game_157db0.c | 30 ++++----------------- src/include/game/game_157db0.h | 2 +- src/include/lib/lib_16110.h | 2 +- src/include/types.h | 48 +++++++++++++++++----------------- 5 files changed, 32 insertions(+), 52 deletions(-) diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 24656f4a4..f08f45497 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -5048,7 +5048,7 @@ void currentPlayerUpdateZoom(void) } stage = stageGetCurrent(); - func0f15c8c8((1 - (1 - stage->unk34) * (1 - scale) * (10.f / 9.0f)) * scale); + currentPlayerSetScaleBg2Gfx((1 - (1 - stage->unk34) * (1 - scale) * (10.f / 9.0f)) * scale); } GLOBAL_ASM( diff --git a/src/game/game_157db0.c b/src/game/game_157db0.c index 001d09d4a..8b5855b8d 100644 --- a/src/game/game_157db0.c +++ b/src/game/game_157db0.c @@ -5305,31 +5305,11 @@ glabel func0f15c8b8 /* f15c8c4: c5c00074 */ lwc1 $f0,0x74($t6) ); -GLOBAL_ASM( -glabel func0f15c8c8 -/* f15c8c8: 3c0e8008 */ lui $t6,%hi(var8007fc00) -/* f15c8cc: 8dcefc00 */ lw $t6,%lo(var8007fc00)($t6) -/* f15c8d0: 3c018008 */ lui $at,0x8008 -/* f15c8d4: 3c02800a */ lui $v0,%hi(g_Vars) -/* f15c8d8: 000e78c0 */ sll $t7,$t6,0x3 -/* f15c8dc: 01ee7823 */ subu $t7,$t7,$t6 -/* f15c8e0: 000f78c0 */ sll $t7,$t7,0x3 -/* f15c8e4: 002f0821 */ addu $at,$at,$t7 -/* f15c8e8: c424fcd8 */ lwc1 $f4,-0x328($at) -/* f15c8ec: 24429fc0 */ addiu $v0,$v0,%lo(g_Vars) -/* f15c8f0: 8c580288 */ lw $t8,0x288($v0) -/* f15c8f4: 460c2182 */ mul.s $f6,$f4,$f12 -/* f15c8f8: 27bdffe8 */ addiu $sp,$sp,-24 -/* f15c8fc: afbf0014 */ sw $ra,0x14($sp) -/* f15c900: e7060074 */ swc1 $f6,0x74($t8) -/* f15c904: 8c590288 */ lw $t9,0x288($v0) -/* f15c908: 0c0059d2 */ jal func00016748 -/* f15c90c: c72c0074 */ lwc1 $f12,0x74($t9) -/* f15c910: 8fbf0014 */ lw $ra,0x14($sp) -/* f15c914: 27bd0018 */ addiu $sp,$sp,0x18 -/* f15c918: 03e00008 */ jr $ra -/* f15c91c: 00000000 */ sll $zero,$zero,0x0 -); +void currentPlayerSetScaleBg2Gfx(f32 scale) +{ + g_Vars.currentplayerstats->scale_bg2gfx = g_Stages[var8007fc00].unk18 * scale; + func00016748(g_Vars.currentplayerstats->scale_bg2gfx); +} GLOBAL_ASM( glabel func0f15c920 diff --git a/src/include/game/game_157db0.h b/src/include/game/game_157db0.h index 5bf752459..e941016ef 100644 --- a/src/include/game/game_157db0.h +++ b/src/include/game/game_157db0.h @@ -29,7 +29,7 @@ u32 func0f15c850(void); u32 func0f15c880(void); f32 func0f15c888(void); u32 func0f15c8b8(void); -void func0f15c8c8(f32 arg0); +void currentPlayerSetScaleBg2Gfx(f32 arg0); void func0f15c920(void); u32 func0f15ca00(void); u32 func0f15cae0(void); diff --git a/src/include/lib/lib_16110.h b/src/include/lib/lib_16110.h index c86b20fea..f259b7b5a 100644 --- a/src/include/lib/lib_16110.h +++ b/src/include/lib/lib_16110.h @@ -17,7 +17,7 @@ u32 func000165d8(void); u32 func000166a4(void); u32 func000166dc(void); u32 func00016710(void); -u32 func00016748(void); +void func00016748(f32 arg0); u32 func00016760(void); u32 func00016784(void); u32 func00016798(void); diff --git a/src/include/types.h b/src/include/types.h index 7f0c46233..e26d4b33d 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3044,29 +3044,29 @@ struct body { }; struct stagetableentry { - s16 id; - u8 light_type; - u8 light_alpha; - u8 light_width; - u8 light_height; - u16 unk06; - u16 bgfileid; - u16 tilefileid; - u16 padsfileid; - u16 setupfileid; - u16 mpsetupfileid; - f32 unk14; - f32 unk18; - f32 unk1c; - u16 unk20; - u8 unk22; - s8 unk23; - u32 unk24; - u32 unk28; - s16 unk2c; - u16 unk2e; - u16 unk30; - f32 unk34; + /*0x00*/ s16 id; + /*0x02*/ u8 light_type; + /*0x03*/ u8 light_alpha; + /*0x04*/ u8 light_width; + /*0x05*/ u8 light_height; + /*0x06*/ u16 unk06; + /*0x08*/ u16 bgfileid; + /*0x0a*/ u16 tilefileid; + /*0x0c*/ u16 padsfileid; + /*0x0e*/ u16 setupfileid; + /*0x10*/ u16 mpsetupfileid; + /*0x14*/ f32 unk14; + /*0x18*/ f32 unk18; + /*0x1c*/ f32 unk1c; + /*0x20*/ u16 unk20; + /*0x22*/ u8 unk22; + /*0x23*/ s8 unk23; + /*0x24*/ u32 unk24; + /*0x28*/ u32 unk28; + /*0x2c*/ s16 unk2c; + /*0x2e*/ u16 unk2e; + /*0x30*/ u16 unk30; + /*0x34*/ f32 unk34; }; struct mpweaponset { @@ -3280,7 +3280,7 @@ struct playerstats { /*0x68*/ u32 cloaktime; /*0x6c*/ u32 speedpillcount; /*0x70*/ s32 mpindex; - /*0x74*/ u32 scale_bg2gfx; + /*0x74*/ f32 scale_bg2gfx; /*0x78*/ f32 damreceived; /*0x7c*/ f32 damtransmitted; };