diff --git a/asm/gina.s b/asm/gina.s deleted file mode 100644 index f6471f82..00000000 --- a/asm/gina.s +++ /dev/null @@ -1,110 +0,0 @@ - .include "asm/macros.inc" - - .include "constants/constants.inc" - - .syntax unified - - .text - - - thumb_func_start Gina -Gina: @ 0x0806C13C - push {r4, lr} - adds r4, r0, #0 - ldrb r0, [r4, #0xc] - cmp r0, #1 - beq _0806C182 - cmp r0, #1 - bgt _0806C150 - cmp r0, #0 - beq _0806C156 - b _0806C1D2 -_0806C150: - cmp r0, #2 - beq _0806C1BE - b _0806C1D2 -_0806C156: - movs r2, #1 - movs r0, #1 - strb r0, [r4, #0xc] - ldrb r1, [r4, #0x18] - subs r0, #5 - ands r0, r1 - orrs r0, r2 - strb r0, [r4, #0x18] - adds r0, r4, #0 - bl sub_0801E99C - adds r1, r4, #0 - adds r1, #0x68 - strb r0, [r1] - ldrb r1, [r1] - adds r0, r4, #0 - bl sub_08078784 - adds r0, r4, #0 - bl sub_0807DD50 - b _0806C1D2 -_0806C182: - adds r2, r4, #0 - adds r2, #0x39 - movs r1, #0 - ldrsb r1, [r2, r1] - cmp r1, #2 - bne _0806C1B4 - movs r0, #0 - strb r1, [r4, #0xc] - strb r0, [r2] - ldr r1, _0806C1B0 @ =gPlayerEntity - adds r0, r4, #0 - bl GetFacingDirection - bl sub_0806F5A4 - adds r1, r0, #0 - adds r0, r4, #0 - bl InitAnimationForceUpdate - adds r0, r4, #0 - bl sub_0806F118 - b _0806C1D2 - .align 2, 0 -_0806C1B0: .4byte gPlayerEntity -_0806C1B4: - adds r0, r4, #0 - movs r1, #0 - bl sub_0807DD94 - b _0806C1D2 -_0806C1BE: - adds r0, r4, #0 - bl UpdateFuseInteraction - cmp r0, #0 - beq _0806C1D2 - movs r0, #1 - strb r0, [r4, #0xc] - movs r0, #0x88 - bl SetLocalFlag -_0806C1D2: - pop {r4, pc} - - thumb_func_start Gina_Fusion -Gina_Fusion: @ 0x0806C1D4 - push {lr} - adds r2, r0, #0 - ldrb r0, [r2, #0xc] - cmp r0, #0 - bne _0806C1FA - adds r0, #1 - strb r0, [r2, #0xc] - ldrb r1, [r2, #0x18] - movs r0, #4 - rsbs r0, r0, #0 - ands r0, r1 - movs r1, #1 - orrs r0, r1 - strb r0, [r2, #0x18] - adds r0, r2, #0 - movs r1, #2 - bl InitAnimationForceUpdate - b _0806C200 -_0806C1FA: - adds r0, r2, #0 - bl UpdateAnimationSingleFrame -_0806C200: - pop {pc} - .align 2, 0 diff --git a/linker.ld b/linker.ld index f892a40f..fc72936e 100644 --- a/linker.ld +++ b/linker.ld @@ -620,7 +620,7 @@ SECTIONS { src/npc/dampe.o(.text); asm/drLeft.o(.text); src/npc/kingGustaf.o(.text); - asm/gina.o(.text); + src/npc/gina.o(.text); src/npc/simon.o(.text); src/npc/anju.o(.text); asm/mama.o(.text); diff --git a/src/npc/carpenter.c b/src/npc/carpenter.c index 775ddce5..9b1e5606 100644 --- a/src/npc/carpenter.c +++ b/src/npc/carpenter.c @@ -91,7 +91,7 @@ void sub_08067314(Entity* this) { void Carpenter_Fusion(Entity* this) { if (this->action == 0) { - if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type*4]) != 0) { + if (LoadExtraSpriteData(this, &gUnk_08110CA8[this->type * 4]) != 0) { this->action = this->action + 1; this->spriteSettings.b.draw = 1; sub_0805E3A0(this, 2); diff --git a/src/npc/dog.c b/src/npc/dog.c index dfa6c92a..378117ce 100644 --- a/src/npc/dog.c +++ b/src/npc/dog.c @@ -54,7 +54,7 @@ void sub_08069B44(Entity* this) { sVar3 = uVar5 >> 0x10; uVar2 = uVar5; } - + uVar4 = this->actionDelay == 0 ? 0x20 : this->actionDelay; this->field_0x6e.HWORD = sVar3 - uVar4; diff --git a/src/npc/festari.c b/src/npc/festari.c index 4eeefd09..4d63805f 100644 --- a/src/npc/festari.c +++ b/src/npc/festari.c @@ -82,17 +82,17 @@ void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) { actions = context->postScriptActions & 0xfff00004; context->postScriptActions = context->postScriptActions ^ actions; if (actions != 0) { - while (actions != 0) { + while (actions != 0) { bit = (~actions + 1) & actions; actions ^= bit; - switch(bit) { + switch (bit) { case 4: this->field_0x80.HWORD = 9; break; - + case 0x200000: this->field_0x80.HWORD = 10; - break; + break; case 0x400000: if (this->animationState == 2) { this->field_0x80.HWORD = 0xb; @@ -100,17 +100,15 @@ void sub_0805FF2C(Entity* this, ScriptExecutionContext* context) { this->field_0x80.HWORD = 0xc; } break; - case 0x100000: + case 0x100000: this->field_0x80.HWORD = 8; - break; - + break; } } } HandlePostScriptActions(this, context); } - void Festari_Fusion(Entity* this) { if (this->action == 0) { this->action += 1; @@ -120,4 +118,4 @@ void Festari_Fusion(Entity* this) { } else { UpdateAnimationSingleFrame(this); } -} \ No newline at end of file +} diff --git a/src/npc/gina.c b/src/npc/gina.c new file mode 100644 index 00000000..5d0dea86 --- /dev/null +++ b/src/npc/gina.c @@ -0,0 +1,46 @@ +#include "global.h" +#include "entity.h" +#include "player.h" +#include "npc.h" +#include "flags.h" +#include "functions.h" +#include "script.h" + +void Gina(Entity* this) { + switch (this->action) { + case 0: + this->action = 1; + this->spriteSettings.b.draw = 1; + + this->field_0x68.HALF.LO = sub_0801E99C(this); + sub_08078784(this, this->field_0x68.HALF.LO); + sub_0807DD50(this); + break; + case 1: + if (this->interactType == 2) { + this->action = 2; + this->interactType = 0; + InitAnimationForceUpdate(this, sub_0806F5A4(GetFacingDirection(this, &gPlayerEntity))); + sub_0806F118(this); + } else { + sub_0807DD94(this, NULL); + } + break; + case 2: + if (UpdateFuseInteraction(this) != 0) { + this->action = 1; + SetLocalFlag(0x88); + } + break; + } +} + +void Gina_Fusion(Entity* this) { + if (this->action == 0) { + this->action += 1; + this->spriteSettings.b.draw = 1; + InitAnimationForceUpdate(this, 2); + } else { + UpdateAnimationSingleFrame(this); + } +}