aboutsummaryrefslogtreecommitdiff
path: root/map
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-03-18 19:12:59 +0900
committerAstatin <[email protected]>2025-03-18 19:12:59 +0900
commit579e73311319868d8b186e3442098358d839b3b3 (patch)
treeb21d556c7c6a5e72b0c25a224711c2e553e46abb /map
parenta29c10798a8064542ac04a5160baaa9b406ef239 (diff)
Add generation events to be executed on floor generation
Diffstat (limited to 'map')
-rw-r--r--map/generationevents.gbasm111
1 files changed, 111 insertions, 0 deletions
diff --git a/map/generationevents.gbasm b/map/generationevents.gbasm
new file mode 100644
index 0000000..482c00e
--- /dev/null
+++ b/map/generationevents.gbasm
@@ -0,0 +1,111 @@
+Generation_Event_Execution:
+ LD A, $mem_floor_count
+ LD D, A
+ LD HL, $mem_dungeon_generation_events
+ .loop:
+ LD A, (HL+)
+ CP $00
+ JR Z, =.skip
+ CP D
+ JR NZ, =.skip
+
+ LD A, (HL+)
+ PUSH HL
+ PUSH DE
+ LD BC, =Generation_Event_Jump_Table
+
+ .JUMP_TABLE
+
+ POP DE
+ POP HL
+
+ .skip:
+ LD A, L
+ AND $fc
+ ADD $04
+ LD L, A
+ CP $00
+ JR NZ, =.loop
+ RET
+
+Generation_Event_Jump_Table:
+ ; 00
+ RET
+ NOP
+ NOP
+ NOP
+
+ ; 01
+ JP =.Dialogue_Script
+ NOP
+
+ ; 02
+ JP =.Entity
+ NOP
+
+ ; 03
+ JP =.Remove_Stairs
+
+ .Dialogue_Script:
+ LD A, $enum_dungeon_dialogue_mode
+ LD $mem_requested_mode, A
+
+ LD A, (HL+)
+ LD ($mem_dialogue_script_program_counter), A
+ LD A, (HL)
+ LD ($mem_dialogue_script_program_counter+1), A
+ JP =Dialogue_script_step
+
+ .Entity:
+ LD A, (HL)
+ LD $mem_loaded_special_entity_index, A
+
+ CALL =FindFreeEntity
+ LD A, $07
+ CALL =Initialize_Entity
+ RET
+
+ .Remove_Stairs:
+ LD HL, $mem_object_list
+ LD (HL), $00
+ RET
+
+Init_DemoQuest_Event:
+ LD HL, $mem_dungeon_generation_events
+
+ LD (HL), $01 ; floor
+ INC HL
+ LD (HL), $01 ; jump table dialogue script
+ INC HL
+ LD (HL), high(=Demo_quest_init)
+ INC HL
+ LD (HL), low(=Demo_quest_init)
+
+ INC HL
+
+ LD (HL), $10 ; floor
+ INC HL
+ LD (HL), $02 ; jump table entity
+ INC HL
+ LD (HL), $06 ; demo quest bunny idx
+ INC HL
+
+ INC HL
+
+ LD (HL), $10 ; floor
+ INC HL
+ LD (HL), $03 ; jump table remove stairs
+ INC HL
+ INC HL
+
+ INC HL
+
+ LD (HL), $10 ; floor
+ INC HL
+ LD (HL), $01 ; jump table dialogue script
+ INC HL
+ LD (HL), high(=Demo_quest_floor_reach)
+ INC HL
+ LD (HL), low(=Demo_quest_floor_reach)
+
+ RET