aboutsummaryrefslogtreecommitdiff
path: root/map
diff options
context:
space:
mode:
authorAstatin <[email protected]>2024-11-05 19:42:46 +0900
committerAstatin <[email protected]>2024-11-05 19:42:46 +0900
commit6c8f7c72cb96ce59ffcda5279225381ecb394b4f (patch)
tree941e6b464bd0fe90b325ae792b3a6fdbdc9b40fe /map
parent14ae7d8def1159b395bf1176b351651cbd98ba19 (diff)
Add a jump table macro
Diffstat (limited to 'map')
-rw-r--r--map/objects.gbasm32
1 files changed, 18 insertions, 14 deletions
diff --git a/map/objects.gbasm b/map/objects.gbasm
index e3410d4..5e79eab 100644
--- a/map/objects.gbasm
+++ b/map/objects.gbasm
@@ -41,15 +41,24 @@ Spawn_stairs:
LD (HL+), A
- LD BC, =Stairs_action
- LD A, B
- LD (HL+), A
- LD A, C
+ LD A, $01
LD (HL+), A
INC HL
INC HL
INC HL
+ INC HL
+ RET
+
+Object_Interaction_Jump_table:
+ ; 00
RET
+ NOP
+ NOP
+ NOP
+
+ ; 01
+ JP =Stairs_action
+ NOP
Stairs_action:
DI
@@ -196,10 +205,7 @@ Object_Interactions_Check:
CP B
JR NZ, =Object_Interactions_Check.next
- LD A, (HL+)
- LD D, A
- LD A, (HL+)
- LD E, A
+ LD E, (HL)
PUSH BC
@@ -208,12 +214,10 @@ Object_Interactions_Check:
AND $f8
LD L, A
- ; This is confusing but this thing is actually CALL DE
- LD BC, =Object_Interactions_Check.interaction_end
- PUSH BC
- PUSH DE
- RET
- Object_Interactions_Check.interaction_end:
+ LD BC, =Object_Interaction_Jump_table
+ LD A, E
+
+ .JUMP_TABLE
POP BC