summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com>2020-07-16 19:44:22 -0700
committerGitHub <noreply@github.com>2020-07-16 19:44:22 -0700
commitc8fd62c703067a8519df20be9331000090e8963d (patch)
treedb35145d21601cbea8d27a0993324a606d3e26b2
parente7ae99c1fab713a66b57e9602da69ffaa4652f1c (diff)
parent002049798bff4bfacfb3c99af82d3e41aeba4a7f (diff)
Merge pull request #27 from Macrepeh:Macrepeh-patch-1
MoblinLady/MayorHagen
-rw-r--r--asm/mayorHagen.s192
-rw-r--r--asm/moblinLady.s26
-rw-r--r--linker.ld4
-rw-r--r--src/npc/mayorHagen.c108
-rw-r--r--src/npc/moblinLady.c21
5 files changed, 131 insertions, 220 deletions
diff --git a/asm/mayorHagen.s b/asm/mayorHagen.s
deleted file mode 100644
index 2deaf59a..00000000
--- a/asm/mayorHagen.s
+++ /dev/null
@@ -1,192 +0,0 @@
- .include "asm/macros.inc"
-
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
-
- thumb_func_start MayorHagen
-MayorHagen: @ 0x0806CDA8
- push {r4, lr}
- adds r4, r0, #0
- ldrb r1, [r4, #0xc]
- cmp r1, #1
- beq _0806CDE8
- cmp r1, #1
- bgt _0806CDBC
- cmp r1, #0
- beq _0806CDC2
- b _0806CE58
-_0806CDBC:
- cmp r1, #2
- beq _0806CE3E
- b _0806CE58
-_0806CDC2:
- movs r0, #1
- strb r0, [r4, #0xc]
- adds r0, r4, #0
- adds r0, #0x69
- strb r1, [r0]
- adds r0, r4, #0
- bl sub_0801E99C
- adds r1, r4, #0
- adds r1, #0x68
- strb r0, [r1]
- adds r0, r4, #0
- movs r1, #2
- bl sub_0805E3A0
- adds r0, r4, #0
- bl sub_0807DD50
- b _0806CE58
-_0806CDE8:
- adds r2, r4, #0
- adds r2, #0x39
- movs r1, #0
- ldrsb r1, [r2, r1]
- cmp r1, #2
- bne _0806CE28
- movs r0, #0
- strb r1, [r4, #0xc]
- strb r0, [r2]
- adds r0, r4, #0
- adds r0, #0x58
- ldrb r0, [r0]
- adds r1, r4, #0
- adds r1, #0x69
- strb r0, [r1]
- ldr r1, _0806CE24 @ =gLinkEntity
- adds r0, r4, #0
- bl GetFacingDirection
- bl sub_0806F5A4
- adds r1, r0, #0
- adds r1, #4
- adds r0, r4, #0
- bl InitAnimationForceUpdate
- adds r0, r4, #0
- bl sub_0806F118
- b _0806CE58
- .align 2, 0
-_0806CE24: .4byte gLinkEntity
-_0806CE28:
- adds r0, r4, #0
- movs r1, #0
- bl sub_0807DDAC
- adds r0, r4, #0
- bl sub_0807DDE4
- adds r0, r4, #0
- bl UpdateAnimationSingleFrame
- b _0806CE58
-_0806CE3E:
- adds r0, r4, #0
- bl UpdateFuseInteraction
- cmp r0, #0
- beq _0806CE58
- movs r0, #1
- strb r0, [r4, #0xc]
- adds r0, r4, #0
- adds r0, #0x69
- ldrb r1, [r0]
- adds r0, r4, #0
- bl InitAnimationForceUpdate
-_0806CE58:
- pop {r4, pc}
- .align 2, 0
-
- thumb_func_start sub_0806CE5C
-sub_0806CE5C: @ 0x0806CE5C
- push {r4, lr}
- adds r4, r0, #0
- bl sub_0801E99C
- adds r1, r0, #0
- adds r0, r4, #0
- bl sub_08078784
- ldr r3, _0806CE7C @ =gUnk_08113F44
- adds r0, r4, #0
- movs r1, #1
- movs r2, #0
- bl sub_08078850
- pop {r4, pc}
- .align 2, 0
-_0806CE7C: .4byte gUnk_08113F44
-
- thumb_func_start sub_0806CE80
-sub_0806CE80: @ 0x0806CE80
- push {r4, r5, lr}
- adds r5, r0, #0
- ldr r0, _0806CEB4 @ =gUnk_02002A40
- ldrb r4, [r0, #8]
- cmp r4, #5
- bne _0806CED6
- movs r0, #0x46
- bl GetInventoryValue
- cmp r0, #0
- bne _0806CEC0
- movs r0, #0x70
- bl CheckLocalFlag
- cmp r0, #0
- beq _0806CEBC
- movs r0, #0x71
- bl CheckLocalFlag
- cmp r0, #0
- bne _0806CEB8
- movs r4, #0xb
- movs r0, #0x71
- bl SetLocalFlag
- b _0806CED6
- .align 2, 0
-_0806CEB4: .4byte gUnk_02002A40
-_0806CEB8:
- movs r4, #0xc
- b _0806CED6
-_0806CEBC:
- movs r4, #0xa
- b _0806CED6
-_0806CEC0:
- movs r0, #0x89
- bl CheckLocalFlag
- cmp r0, #0
- bne _0806CED4
- movs r4, #0xd
- movs r0, #0x89
- bl SetLocalFlag
- b _0806CED6
-_0806CED4:
- movs r4, #0xe
-_0806CED6:
- lsls r1, r4, #3
- ldr r0, _0806CEE4 @ =gUnk_08113F48
- adds r1, r1, r0
- adds r0, r5, #0
- bl ShowNPCDialogue
- pop {r4, r5, pc}
- .align 2, 0
-_0806CEE4: .4byte gUnk_08113F48
-
- thumb_func_start MayorHagen_Fusion
-MayorHagen_Fusion: @ 0x0806CEE8
- push {lr}
- adds r2, r0, #0
- ldrb r0, [r2, #0xc]
- cmp r0, #0
- bne _0806CF0E
- 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, #8
- bl InitAnimationForceUpdate
- b _0806CF14
-_0806CF0E:
- adds r0, r2, #0
- bl UpdateAnimationSingleFrame
-_0806CF14:
- pop {pc}
- .align 2, 0
diff --git a/asm/moblinLady.s b/asm/moblinLady.s
deleted file mode 100644
index 87f68f93..00000000
--- a/asm/moblinLady.s
+++ /dev/null
@@ -1,26 +0,0 @@
- .include "asm/macros.inc"
-
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start MoblinLady
-MoblinLady: @ 0x0806B9D0
- push {lr}
- adds r1, r0, #0
- ldrb r0, [r1, #0xc]
- cmp r0, #0
- bne _0806B9E6
- adds r0, #1
- strb r0, [r1, #0xc]
- adds r0, r1, #0
- bl sub_0807DD50
- b _0806B9EE
-_0806B9E6:
- adds r0, r1, #0
- movs r1, #0
- bl sub_0807DD94
-_0806B9EE:
- pop {pc} \ No newline at end of file
diff --git a/linker.ld b/linker.ld
index 58006a85..210cf138 100644
--- a/linker.ld
+++ b/linker.ld
@@ -598,7 +598,7 @@ SECTIONS {
asm/librari.o(.text);
asm/percy.o(.text);
asm/vaatiReborn.o(.text);
- asm/moblinLady.o(.text);
+ src/npc/moblinLady.o(.text);
asm/librarians.o(.text);
asm/farmers.o(.text);
asm/carlov.o(.text);
@@ -614,7 +614,7 @@ SECTIONS {
src/npc/windTribespeople.o(.text);
asm/windTribespeople.o(.text);
asm/gregal.o(.text);
- asm/mayorHagen.o(.text);
+ src/npc/mayorHagen.o(.text);
src/npc/bigGoron.o(.text);
asm/bigGoron.o(.text);
asm/ezloCap.o(.text);
diff --git a/src/npc/mayorHagen.c b/src/npc/mayorHagen.c
new file mode 100644
index 00000000..1eb0ff64
--- /dev/null
+++ b/src/npc/mayorHagen.c
@@ -0,0 +1,108 @@
+#include "global.h"
+#include "entity.h"
+#include "link.h"
+#include "room.h"
+#include "flags.h"
+#include "sprite.h"
+#include "textbox.h"
+#include "npc.h"
+extern void sub_0807DD50(Entity*);
+extern u32 sub_0806F5A4(u32);
+extern void sub_0806F118(Entity*);
+extern u32 sub_0801E99C();
+extern void sub_08078784(Entity*,u32);
+extern void sub_0807DDAC(Entity*,u32);
+extern void sub_0805E3A0(Entity*,u32);
+extern void sub_0807DDE4(Entity*);
+extern void sub_08078850();
+extern u32 gUnk_08113F44;
+extern u32 gUnk_08113F48;
+extern u32 GetInventoryValue(u32);
+extern u32 CheckLocalFlag(u32);
+extern void SetLocalFlag();
+extern void ShowNPCDialogue();
+
+void MayorHagen(Entity *this)
+{
+ u32 v;
+ switch (this->action) {
+ case 0:
+ this->action = 1;
+ this->field_0x69 = 0;
+ this->field_0x68 = sub_0801E99C(this);
+ sub_0805E3A0(this, 2);
+ sub_0807DD50(this);
+ break;
+ case 1:
+ v = this->interactType;
+ if (v == 2) {
+ this->action = v;
+ this->interactType = 0;
+ this->field_0x69 = this->animIndex;
+ InitAnimationForceUpdate(this,4 + sub_0806F5A4(GetFacingDirection(this, &gLinkEntity)));
+ sub_0806F118(this);
+ break;
+ }
+ sub_0807DDAC(this,0);
+ sub_0807DDE4(this);
+ UpdateAnimationSingleFrame(this);
+ break;
+ case 2:
+ if (UpdateFuseInteraction(this)) {
+ this->action = 1;
+ InitAnimationForceUpdate(this, this->field_0x69);
+ }
+ }
+}
+
+void sub_0806CE5C(Entity *this)
+{
+ sub_08078784(this,sub_0801E99C());
+ sub_08078850(this,1,0,&gUnk_08113F44);
+}
+
+void sub_0806CE80(Entity *this)
+{
+ u32 v;
+ u32 v2;
+ v = gUnk_02002A40.filler[8];
+ if (v == 5) {
+ //flippers
+ if (GetInventoryValue(0x46) == 0) {
+ if (CheckLocalFlag(0x70) != 0) {
+ v2 = CheckLocalFlag(0x71);
+ if (v2 == 0) {
+ v = 0xb;
+ SetLocalFlag(0x71);
+ }
+ else {
+ v = 0xc;
+ }
+ }
+ else {
+ v = 0xa;
+ }
+ }
+ else {
+ v2 = CheckLocalFlag(0x89);
+ if (v2 == 0) {
+ v = 0xd;
+ SetLocalFlag(0x89);
+ }
+ else {
+ v = 0xe;
+ }
+ }
+ }
+ ShowNPCDialogue(this,&gUnk_08113F48 + 2*v);
+}
+
+void MayorHagen_Fusion(Entity *this) {
+ if (this->action == 0) {
+ this->action++;
+ this->spriteSettings.b.draw = 1;
+ InitAnimationForceUpdate(this, 8);
+ } else {
+ UpdateAnimationSingleFrame(this);
+ }
+} \ No newline at end of file
diff --git a/src/npc/moblinLady.c b/src/npc/moblinLady.c
new file mode 100644
index 00000000..2dc1e5f6
--- /dev/null
+++ b/src/npc/moblinLady.c
@@ -0,0 +1,21 @@
+#include "global.h"
+#include "entity.h"
+#include "link.h"
+#include "room.h"
+#include "flags.h"
+#include "sprite.h"
+#include "textbox.h"
+#include "npc.h"
+extern void sub_0807DD50();
+extern void sub_0807DD94();
+
+
+void MoblinLady(Entity* this) {
+ if (this->action == 0) {
+ this->action++;
+ sub_0807DD50(this);
+ }
+ else {
+ sub_0807DD94(this,0);
+ }
+} \ No newline at end of file