summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-02-27 23:15:52 -0800
committerGitHub <noreply@github.com>2022-02-27 23:15:52 -0800
commit4e10e89cca8484f2729d4adbc8d945bc0e46ad10 (patch)
treeca1fdb60456dcb4ab594ce1515622e2c2a674153
parentb906dcf24b31c87b6ecf6b07be92c930329d1d38 (diff)
parent4ffa704eb3920b2cf2613fa879cfd87470d2ef30 (diff)
Merge pull request #415 from hatal175/lamp
-rw-r--r--asm/object/lamp.s39
-rw-r--r--data/animations/object/lamp.s4
-rw-r--r--linker.ld3
-rw-r--r--src/object/lamp.c23
4 files changed, 25 insertions, 44 deletions
diff --git a/asm/object/lamp.s b/asm/object/lamp.s
deleted file mode 100644
index f94156fe..00000000
--- a/asm/object/lamp.s
+++ /dev/null
@@ -1,39 +0,0 @@
- .include "asm/macros.inc"
-
- .include "constants/constants.inc"
-
- .syntax unified
-
- .text
-
- thumb_func_start Lamp
-Lamp: @ 0x0809CE90
- push {lr}
- ldr r2, _0809CEA4 @ =gUnk_08123E80
- ldrb r1, [r0, #0xc]
- lsls r1, r1, #2
- adds r1, r1, r2
- ldr r1, [r1]
- bl _call_via_r1
- pop {pc}
- .align 2, 0
-_0809CEA4: .4byte gUnk_08123E80
-
- thumb_func_start sub_0809CEA8
-sub_0809CEA8: @ 0x0809CEA8
- push {r4, lr}
- adds r4, r0, #0
- movs r0, #1
- strb r0, [r4, #0xc]
- adds r0, r4, #0
- bl UpdateSpriteForCollisionLayer
- adds r0, r4, #0
- movs r1, #0
- bl InitializeAnimation
- pop {r4, pc}
-
- thumb_func_start sub_0809CEC0
-sub_0809CEC0: @ 0x0809CEC0
- push {lr}
- bl GetNextFrame
- pop {pc}
diff --git a/data/animations/object/lamp.s b/data/animations/object/lamp.s
index 4fbfe695..2c96780a 100644
--- a/data/animations/object/lamp.s
+++ b/data/animations/object/lamp.s
@@ -4,10 +4,6 @@
.section .rodata
.align 2
-gUnk_08123E80:: @ 08123E80
- .4byte sub_0809CEA8
- .4byte sub_0809CEC0
-
gSpriteAnimations_Lamp_0_0:: @ 08123E88
.include "animations/gSpriteAnimations_Lamp_0_0.s"
diff --git a/linker.ld b/linker.ld
index 7cc27ff5..58b7c954 100644
--- a/linker.ld
+++ b/linker.ld
@@ -791,7 +791,7 @@ SECTIONS {
asm/object/object90.o(.text);
asm/object/object91.o(.text);
src/object/bakerOven.o(.text);
- asm/object/lamp.o(.text);
+ src/object/lamp.o(.text);
src/object/windTribeFlag.o(.text);
src/object/bird.o(.text);
asm/object/bird.o(.text);
@@ -1546,6 +1546,7 @@ SECTIONS {
data/const/object/object91.o(.rodata);
data/const/object/bakerOven.o(.rodata);
data/animations/object/bakerOven.o(.rodata);
+ src/object/lamp.o(.rodata);
data/animations/object/lamp.o(.rodata);
data/const/object/bird.o(.rodata);
data/animations/object/bird.o(.rodata);
diff --git a/src/object/lamp.c b/src/object/lamp.c
new file mode 100644
index 00000000..caf458ad
--- /dev/null
+++ b/src/object/lamp.c
@@ -0,0 +1,23 @@
+#include "entity.h"
+
+void Lamp_Init(Entity* this);
+void Lamp_Action1(Entity* this);
+
+void Lamp(Entity* this) {
+ static void (*const actionFuncs[])(Entity*) = {
+ Lamp_Init,
+ Lamp_Action1,
+ };
+
+ actionFuncs[this->action](this);
+}
+
+void Lamp_Init(Entity* this) {
+ this->action = 1;
+ UpdateSpriteForCollisionLayer(this);
+ InitializeAnimation(this, 0);
+}
+
+void Lamp_Action1(Entity* this) {
+ GetNextFrame(this);
+}