From d2c47f49b443a0b04b86d909ce03acd7ed6dce2f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 23 Dec 2020 12:30:31 +1000 Subject: [PATCH] currentPlayerUpdateShieldShow --- src/game/chr/chraction.c | 2 +- src/game/game_0b63b0.c | 66 ++++++---------------------------- src/include/game/game_0b63b0.h | 2 +- src/include/types.h | 6 ++-- 4 files changed, 16 insertions(+), 60 deletions(-) diff --git a/src/game/chr/chraction.c b/src/game/chr/chraction.c index 6433882aa..74efe6ed6 100644 --- a/src/game/chr/chraction.c +++ b/src/game/chr/chraction.c @@ -7168,7 +7168,7 @@ glabel var7f1a8d98 .L0f035ad4: /* f035ad4: 11c00004 */ beqz $t6,.L0f035ae8 /* f035ad8: 00000000 */ nop -/* f035adc: 0fc30033 */ jal func0f0c00cc +/* f035adc: 0fc30033 */ jal currentPlayerUpdateShieldShow /* f035ae0: 00000000 */ nop /* f035ae4: 8fa30148 */ lw $v1,0x148($sp) .L0f035ae8: diff --git a/src/game/game_0b63b0.c b/src/game/game_0b63b0.c index 2bc53bf3e..f4ba5d5b1 100644 --- a/src/game/game_0b63b0.c +++ b/src/game/game_0b63b0.c @@ -9662,61 +9662,17 @@ Gfx *currentPlayerUpdateShootRot(Gfx *gdl) return gdl; } -GLOBAL_ASM( -glabel func0f0c00cc -/* f0c00cc: 3c04800a */ lui $a0,%hi(g_Vars) -/* f0c00d0: 24849fc0 */ addiu $a0,$a0,%lo(g_Vars) -/* f0c00d4: 8c830284 */ lw $v1,0x284($a0) -/* f0c00d8: 27bdffe0 */ addiu $sp,$sp,-32 -/* f0c00dc: afbf0014 */ sw $ra,0x14($sp) -/* f0c00e0: 44803000 */ mtc1 $zero,$f6 -/* f0c00e4: c4640280 */ lwc1 $f4,0x280($v1) -/* f0c00e8: 4606203c */ c.lt.s $f4,$f6 -/* f0c00ec: 00000000 */ nop -/* f0c00f0: 45020021 */ bc1fl .L0f0c0178 -/* f0c00f4: 44808000 */ mtc1 $zero,$f16 -/* f0c00f8: 8c6e027c */ lw $t6,0x27c($v1) -/* f0c00fc: 240100c8 */ addiu $at,$zero,0xc8 -/* f0c0100: 000e7c02 */ srl $t7,$t6,0x10 -/* f0c0104: 01e1001b */ divu $zero,$t7,$at -/* f0c0108: 0000c010 */ mfhi $t8 -/* f0c010c: 0018c880 */ sll $t9,$t8,0x2 -/* f0c0110: 27280320 */ addiu $t0,$t9,0x320 -/* f0c0114: 0c004b70 */ jal random -/* f0c0118: afa8001c */ sw $t0,0x1c($sp) -/* f0c011c: 3c04800a */ lui $a0,%hi(g_Vars) -/* f0c0120: 24849fc0 */ addiu $a0,$a0,%lo(g_Vars) -/* f0c0124: 8c890284 */ lw $t1,0x284($a0) -/* f0c0128: ad22027c */ sw $v0,0x27c($t1) -/* f0c012c: 8fab001c */ lw $t3,0x1c($sp) -/* f0c0130: 8c8a0058 */ lw $t2,0x58($a0) -/* f0c0134: 8c8d0284 */ lw $t5,0x284($a0) -/* f0c0138: 014b001a */ div $zero,$t2,$t3 -/* f0c013c: 00006010 */ mfhi $t4 -/* f0c0140: 448c4000 */ mtc1 $t4,$f8 -/* f0c0144: 15600002 */ bnez $t3,.L0f0c0150 -/* f0c0148: 00000000 */ nop -/* f0c014c: 0007000d */ break 0x7 -.L0f0c0150: -/* f0c0150: 2401ffff */ addiu $at,$zero,-1 -/* f0c0154: 15610004 */ bne $t3,$at,.L0f0c0168 -/* f0c0158: 3c018000 */ lui $at,0x8000 -/* f0c015c: 15410002 */ bne $t2,$at,.L0f0c0168 -/* f0c0160: 00000000 */ nop -/* f0c0164: 0006000d */ break 0x6 -.L0f0c0168: -/* f0c0168: 468042a0 */ cvt.s.w $f10,$f8 -/* f0c016c: e5aa0278 */ swc1 $f10,0x278($t5) -/* f0c0170: 8c830284 */ lw $v1,0x284($a0) -/* f0c0174: 44808000 */ mtc1 $zero,$f16 -.L0f0c0178: -/* f0c0178: 00000000 */ nop -/* f0c017c: e4700280 */ swc1 $f16,0x280($v1) -/* f0c0180: 8fbf0014 */ lw $ra,0x14($sp) -/* f0c0184: 27bd0020 */ addiu $sp,$sp,0x20 -/* f0c0188: 03e00008 */ jr $ra -/* f0c018c: 00000000 */ nop -); +void currentPlayerUpdateShieldShow(void) +{ + if (g_Vars.currentplayer->shieldshowtime < 0) { + s32 rand = ((g_Vars.currentplayer->shieldshowrnd >> 16) % 200) * 4 + 800; + + g_Vars.currentplayer->shieldshowrnd = random(); + g_Vars.currentplayer->shieldshowrot = g_Vars.thisframe240 % rand; + } + + g_Vars.currentplayer->shieldshowtime = 0; +} GLOBAL_ASM( glabel func0f0c0190 diff --git a/src/include/game/game_0b63b0.h b/src/include/game/game_0b63b0.h index b1f5aeb32..3259928cc 100644 --- a/src/include/game/game_0b63b0.h +++ b/src/include/game/game_0b63b0.h @@ -62,7 +62,7 @@ u32 func0f0bd764(void); void func0f0bd904(bool arg0); void func0f0bfc7c(struct coord *cam_pos, struct coord *cam_look, struct coord *cam_up); Gfx *currentPlayerUpdateShootRot(Gfx *gdl); -u32 func0f0c00cc(void); +void currentPlayerUpdateShieldShow(void); Gfx *func0f0c0190(Gfx *gdl); Gfx *func0f0c07c8(Gfx *gdl); void currentPlayerDie(bool force); diff --git a/src/include/types.h b/src/include/types.h index 4df45358b..4670b6452 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -2339,9 +2339,9 @@ struct player { /*0x026c*/ f32 eyesshutfrac; /*0x0270*/ u32 unk0270; /*0x0274*/ bool waitforzrelease; - /*0x0278*/ u32 unk0278; - /*0x027c*/ u32 unk027c; - /*0x0280*/ u32 unk0280; + /*0x0278*/ f32 shieldshowrot; + /*0x027c*/ u32 shieldshowrnd; + /*0x0280*/ f32 shieldshowtime; /*0x0284*/ s16 bondprevrooms[8]; /*0x0294*/ f32 liftground; /*0x0298*/ struct prop *lift;