From 5e27cf969d24c94f143599902df91a0849ca53a8 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Tue, 14 Jan 2020 21:59:09 +1000 Subject: [PATCH] Decompile heliTryStop --- src/game/game_066310.c | 36 +++++++++++++--------------------- src/include/game/game_066310.h | 2 +- src/include/types.h | 2 +- 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/src/game/game_066310.c b/src/game/game_066310.c index 551441457..cb9fbcca2 100644 --- a/src/game/game_066310.c +++ b/src/game/game_066310.c @@ -24773,28 +24773,20 @@ glabel func0f07b038 /* f07b074: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel heliTryStop -/* f07b078: 27bdffe8 */ addiu $sp,$sp,-24 -/* f07b07c: afbf0014 */ sw $ra,0x14($sp) -/* f07b080: 0fc1eb7d */ jal heliFromObj -/* f07b084: 00000000 */ sll $zero,$zero,0x0 -/* f07b088: 10400007 */ beqz $v0,.L0f07b0a8 -/* f07b08c: 240e0078 */ addiu $t6,$zero,0x78 -/* f07b090: 44802000 */ mtc1 $zero,$f4 -/* f07b094: a0400096 */ sb $zero,0x96($v0) -/* f07b098: ac4e00c4 */ sw $t6,0xc4($v0) -/* f07b09c: e44400a4 */ swc1 $f4,0xa4($v0) -/* f07b0a0: 10000002 */ beqz $zero,.L0f07b0ac -/* f07b0a4: 24020001 */ addiu $v0,$zero,0x1 -.L0f07b0a8: -/* f07b0a8: 00001025 */ or $v0,$zero,$zero -.L0f07b0ac: -/* f07b0ac: 8fbf0014 */ lw $ra,0x14($sp) -/* f07b0b0: 27bd0018 */ addiu $sp,$sp,0x18 -/* f07b0b4: 03e00008 */ jr $ra -/* f07b0b8: 00000000 */ sll $zero,$zero,0x0 -); +bool heliTryStop(struct defaultobj *obj) +{ + struct heliobj *heli = heliFromObj(obj); + + if (heli) { + heli->attackmode = 0; + heli->patroltimer60 = 120; + heli->power = 0; + + return true; + } + + return false; +} bool heliSetArmed(struct defaultobj *obj, bool armed) { diff --git a/src/include/game/game_066310.h b/src/include/game/game_066310.h index ad12af7bb..08a0d4a45 100644 --- a/src/include/game/game_066310.h +++ b/src/include/game/game_066310.h @@ -166,7 +166,7 @@ u32 func0f07ae18(struct heliobj *heli, u32 arg1); u32 func0f07af34(struct heliobj *heli); void heliSetTarget(struct heliobj *heli, s32 arg1); u32 func0f07b038(struct heliobj *heli); -void heliTryStop(struct heliobj *heli); +bool heliTryStop(struct defaultobj *obj); bool heliSetArmed(struct defaultobj *obj, bool armed); void heliRestartTimer(struct defaultobj *obj); f32 heliGetTimer(struct heliobj *heli); diff --git a/src/include/types.h b/src/include/types.h index b4999513f..f33b4ec12 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -823,7 +823,7 @@ struct heliobj { /*0x98*/ u32 vx; /*0x9c*/ u32 vy; /*0xa0*/ u32 vz; - /*0xa4*/ u32 power; + /*0xa4*/ f32 power; /*0xa8*/ u32 otx; /*0xac*/ u32 oty; /*0xb0*/ u32 otz;