summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTal Hayon <talhayon1@gmail.com>2022-04-14 19:41:22 +0300
committerTal Hayon <talhayon1@gmail.com>2022-04-14 19:41:22 +0300
commitcda3d6fbe5330ffd397da46c1427c4939105e3ff (patch)
tree542f2192959b194f4031edfe2dd152b05b430f64
parent3eb303c7c9123f9ec8899ac8724094ad5b1d1f7b (diff)
Put const data in mailbox
-rw-r--r--data/const/npc/mailbox.s11
-rw-r--r--linker.ld2
-rw-r--r--src/npc/mailbox.c38
3 files changed, 23 insertions, 28 deletions
diff --git a/data/const/npc/mailbox.s b/data/const/npc/mailbox.s
deleted file mode 100644
index 72b8880a..00000000
--- a/data/const/npc/mailbox.s
+++ /dev/null
@@ -1,11 +0,0 @@
- .include "asm/macros.inc"
- .include "constants/constants.inc"
-
- .section .rodata
- .align 2
-
-gMailboxBehaviors:: @ 0810C804
- .4byte sub_08063210
- .4byte sub_08063220
- .4byte sub_08063254
- .4byte sub_08063278
diff --git a/linker.ld b/linker.ld
index 51e46ad6..cdf1d2c3 100644
--- a/linker.ld
+++ b/linker.ld
@@ -1175,7 +1175,7 @@ SECTIONS {
data/animations/npc/pita.o(.rodata);
src/npc/minishEzlo.o(.rodata);
data/animations/npc/minishEzlo.o(.rodata);
- data/const/npc/mailbox.o(.rodata);
+ src/npc/mailbox.o(.rodata);
data/animations/npc/mailbox.o(.rodata);
data/const/npc/beedle.o(.rodata);
data/animations/npc/beedle.o(.rodata);
diff --git a/src/npc/mailbox.c b/src/npc/mailbox.c
index 1f7c7835..5c92eefc 100644
--- a/src/npc/mailbox.c
+++ b/src/npc/mailbox.c
@@ -4,11 +4,19 @@
#include "effects.h"
#include "npc.h"
-extern void sub_08063280(Entity*, u32);
-
-extern void (*gMailboxBehaviors[4])(Entity*);
+void sub_08063280(Entity*);
+void sub_08063210(Entity*);
+void sub_08063220(Entity*);
+void sub_08063254(Entity*);
+void sub_08063278(Entity*);
void Mailbox(Entity* this) {
+ static void (*const gMailboxBehaviors[4])(Entity*) = {
+ sub_08063210,
+ sub_08063220,
+ sub_08063254,
+ sub_08063278,
+ };
gMailboxBehaviors[this->action](this);
if (this->action != 0) {
@@ -34,30 +42,28 @@ void sub_08063220(Entity* this) {
if (this->animIndex != bVar1) {
InitAnimationForceUpdate(this, bVar1);
} else {
- sub_08063280(this, bVar1);
+ sub_08063280(this);
}
}
-void sub_08063254(Entity* this, u32 unused) {
- sub_08063280(this, unused);
+void sub_08063254(Entity* this) {
+ sub_08063280(this);
if ((this->frame & ANIM_DONE) != 0) {
this->action = 3;
MessageFromTarget(0);
}
}
-void sub_08063278(Entity* this, u32 unused) {
- sub_08063280(this, unused);
+void sub_08063278(Entity* this) {
+ sub_08063280(this);
}
-void sub_08063280(Entity* this, u32 unused) {
- Entity* e; // r4@1
- u8 var; // r2@1
+void sub_08063280(Entity* this) {
+ u8 var; // r2@1
- e = this;
- UpdateAnimationSingleFrame(e);
- var = e->frame & 0x7F;
- e->frame ^= var;
+ UpdateAnimationSingleFrame(this);
+ var = this->frame & ~ANIM_DONE;
+ this->frame ^= var;
if (var == 2)
- CreateFx(e, FX_MAILBOX_UNUSED, 0);
+ CreateFx(this, FX_MAILBOX_UNUSED, 0);
}