aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-09-09 16:53:39 +0200
committerAstatin <[email protected]>2025-09-09 16:53:39 +0200
commitb5ca0d4bff573f14ac7d3b47ebd7b23c56346b5e (patch)
tree60be3e7de9dd156416b981df014e67244c0038f0
parent03c359596bdacbf39cdc244d2f164d0ec94d5505 (diff)
Add per entity dialogue + screen darkening animation for future big menu openingHEADlatestmain
-rw-r--r--definitions.gbasm6
-rw-r--r--dialogues/game.gbasm6
-rw-r--r--dialogues/text.gbasm14
-rw-r--r--dialogues/text.gbtxt11
-rw-r--r--entity/questgoal.gbasm25
-rw-r--r--init.gbasm6
-rw-r--r--main.gbasm4
-rw-r--r--map/dungeons.gbasm20
-rw-r--r--map/dungeons/campsite.gbasm3
-rw-r--r--map/dungeons/morningforest.gbasm3
-rw-r--r--map/generationevents.gbasm59
-rw-r--r--map/objects.gbasm6
-rw-r--r--modes/bigmenu.gbasm38
-rw-r--r--modes/dungeon.gbasm4
-rw-r--r--modes/loading.gbasm2
-rw-r--r--modes/vblank_handler_list.gbasm1
-rw-r--r--utils.gbasm2
17 files changed, 175 insertions, 35 deletions
diff --git a/definitions.gbasm b/definitions.gbasm
index 3a8490b..bde1c0a 100644
--- a/definitions.gbasm
+++ b/definitions.gbasm
@@ -193,6 +193,9 @@
.DEFINE mem_dungeon_custom_vblank_function $c07d ; Takes $c07d - $c07f (bank + ptr)
+.DEFINE mem_gui_text_bold_palette ($c080)
+.DEFINE mem_gui_text_thin_palette ($c081)
+
; ## WARNING THE SPACE BETWEEN $c400 and $c800 is used as a buffer for the loading map function during dungeon generation
.DEFINE mem_map_loading_buffer $c400
@@ -300,7 +303,8 @@
; shaking = 4
; doubleseed = 5
; slide (forcing no hops on move) = 6
-; _padding: u40
+; dialogue_ptr: u24 (bank+ptr)
+; _padding: u16
;
; # SANTA CHRISTMAS LIST PLEASE #
; health, max health, list of possible attacks, maybe remaining attacks ? AI status (blind, scared, slow, etc..)
diff --git a/dialogues/game.gbasm b/dialogues/game.gbasm
index 704f19c..931d31a 100644
--- a/dialogues/game.gbasm
+++ b/dialogues/game.gbasm
@@ -24,3 +24,9 @@ Learn_Attack_Duplicate_Dialogue_Script:
.TEXT =dup_attack_4t =Empty
.LEARN_ATTACK_RET
+Placeholder_Dialogue_Script:
+ .TEXTB =Placeholder_1t =Empty
+ .TEXT =Placeholder_2t =Placeholder_2b
+ .TEXT =Placeholder_3t =Empty
+ .TEXT =Placeholder_4t =Placeholder_4b
+ .END
diff --git a/dialogues/text.gbasm b/dialogues/text.gbasm
index ea176b4..2d118fc 100644
--- a/dialogues/text.gbasm
+++ b/dialogues/text.gbasm
@@ -87,3 +87,17 @@ Dialogue_3_2b:
.DB 0x8f, 0x92, 0x97, 0x8d, 0x0, 0xa0, 0x91, 0x98, 0x0, 0x8c, 0x8a, 0x95, 0x95, 0x8e, 0x8d, 0xff
Dialogue_3_3t:
.DB 0x8f, 0x98, 0x9b, 0x0, 0x91, 0x8e, 0x95, 0x99, 0x0, 0x8e, 0x8a, 0x9b, 0x95, 0x92, 0x8e, 0x9b, 0xa4, 0xff
+; TODO:
+.DB 0x9b, 0x8e, 0x96, 0x98, 0x9f, 0x8e, 0x0, 0x9d, 0x91, 0x92, 0x9c, 0xff
+Placeholder_1t:
+.DB 0xa2, 0x98, 0x0, 0x8a, 0x9c, 0x9d, 0x8a, 0x9d, 0x92, 0x97, 0x0, 0xa5, 0xff
+Placeholder_2t:
+.DB 0xa0, 0x91, 0x8a, 0x9d, 0x0, 0x92, 0x9c, 0x0, 0x9d, 0x91, 0x92, 0x9c, 0xff
+Placeholder_2b:
+.DB 0x9c, 0x95, 0x98, 0x98, 0x99, 0xa2, 0x0, 0x93, 0x98, 0x8b, 0x0, 0xa2, 0x98, 0x9e, 0xa8, 0x9b, 0x8e, 0xff
+Placeholder_3t:
+.DB 0x8d, 0x98, 0x92, 0x97, 0x90, 0x0, 0xa6, 0xff
+Placeholder_4t:
+.DB 0x8a, 0x9d, 0x0, 0x95, 0x8e, 0x8a, 0x9c, 0x9d, 0x0, 0xa0, 0x9b, 0x92, 0x9d, 0x8e, 0x0, 0x9d, 0x91, 0x8e, 0xff
+Placeholder_4b:
+.DB 0x8d, 0x92, 0x8a, 0x95, 0x98, 0x90, 0x9e, 0x8e, 0x9c, 0xa4, 0xa4, 0xa4, 0xff
diff --git a/dialogues/text.gbtxt b/dialogues/text.gbtxt
index 51a18e2..51a1dc0 100644
--- a/dialogues/text.gbtxt
+++ b/dialogues/text.gbtxt
@@ -71,3 +71,14 @@ Dialogue_3_2t: I should try to
Dialogue_3_2b: find who called
Dialogue_3_3t: for help earlier.
+
+; TODO: Remove this
+Placeholder_1t: Yo Astatin !
+
+Placeholder_2t: What is this
+Placeholder_2b: sloopy job you're
+
+Placeholder_3t: doing ?
+
+Placeholder_4t: At least write the
+Placeholder_4b: dialogues...
diff --git a/entity/questgoal.gbasm b/entity/questgoal.gbasm
index 17eecb8..8903e28 100644
--- a/entity/questgoal.gbasm
+++ b/entity/questgoal.gbasm
@@ -43,7 +43,21 @@ Open_Dialogue:
OR (HL)
LD (HL), A
- .START_SCRIPT =Demo_quest_bunny
+ LD A, L
+ AND $f0
+ OR $0b
+ LD L, A
+
+ LD A, (HL+)
+ DBG
+ LD $mem_dialogue_script_bank, A
+ LD A, (HL+)
+ DBG
+ LD ($mem_dialogue_script_program_counter), A
+ LD A, (HL)
+ DBG
+ LD ($mem_dialogue_script_program_counter+1), A
+ CALL =Dialogue_script_step
LD A, $00
LD $mem_bunny_animation, A
@@ -101,9 +115,12 @@ QuestGoal_Turn:
RET
Static_Human_Turn:
- LD A, $mem_map_loading_flags
- BIT 3, A
- RET Z
+ LD A, $mem_current_mode
+ CP $enum_dungeon_mode
+ RET NZ
+ LD A, $mem_requested_mode
+ CP $enum_dungeon_mode
+ RET NZ
INC HL
INC HL
diff --git a/init.gbasm b/init.gbasm
index 08fab8f..a944e25 100644
--- a/init.gbasm
+++ b/init.gbasm
@@ -83,6 +83,12 @@ Empty_VRAM: ; (Clear screen)
LD A, $obj_palette_frozen
LD $reg_obj1_palette, A
+ ; Saved thin/bold palette
+ LD A, $palette_bold_font
+ LD $mem_gui_text_bold_palette, A
+ LD A, $palette_thin_font
+ LD $mem_gui_text_thin_palette, A
+
; Interrupt jmp instruction
LD A, $c3 ; Unconditional imm16 jump
LD ($mem_vblank_jump_instruction), A
diff --git a/main.gbasm b/main.gbasm
index 2dcbbe3..0ff7fcf 100644
--- a/main.gbasm
+++ b/main.gbasm
@@ -20,9 +20,9 @@ Entrypoint:
LD A, $01
LD $mem_number_of_attacks, A
- LD A, bank(=Camp_Site)
+ LD A, bank(=Morning_Forest)
LD ($mem_dungeon), A
- LD HL, ptr(=Camp_Site)
+ LD HL, ptr(=Morning_Forest)
LD A, H
LD ($mem_dungeon+1), A
LD A, L
diff --git a/map/dungeons.gbasm b/map/dungeons.gbasm
index 8afe451..8b7e711 100644
--- a/map/dungeons.gbasm
+++ b/map/dungeons.gbasm
@@ -29,24 +29,30 @@
.PADTO =$start+8
.END
-.MACRODEF GEN_EVENT_SPECIAL_ENTITY floor entity_idx
+.MACRODEF GEN_EVENT_SPECIAL_ENTITY floor entity_instance_idx entity_blueprint_idx
$load:
- .DB low($floor), $03, $07, low($entity_idx)
+ .DB low($floor), $03, $07, low($entity_blueprint_idx)
.PADTO =$load+8
$spawn:
- .DB low($floor), $04, $07
+ .DB low($floor), $04, low($entity_instance_idx), $07
.PADTO =$spawn+8
.END
-.MACRODEF GEN_EVENT_LOAD_ENTITY floor loaded_entity_idx entity_idx
+.MACRODEF GEN_EVENT_LOAD_ENTITY floor loaded_entity_idx entity_blueprint_idx
$load:
- .DB low($floor), $03, low($loaded_entity_idx), low($entity_idx)
+ .DB low($floor), $03, low($loaded_entity_idx), low($entity_blueprint_idx)
.PADTO =$load+8
.END
-.MACRODEF GEN_EVENT_SPAWN_LOADED_ENTITY_XY floor loaded_entity_idx arg_x arg_y arg_d
+.MACRODEF GEN_EVENT_SPAWN_LOADED_ENTITY_XY floor entity_instance_idx loaded_entity_idx arg_x arg_y arg_d
$spawn:
- .DB low($floor), $05, low($loaded_entity_idx), low($arg_x), low($arg_y), low($arg_d)
+ .DB low($floor), $05, low($entity_instance_idx), low($loaded_entity_idx), low($arg_x), low($arg_y), low($arg_d)
+ .PADTO =$spawn+8
+.END
+
+.MACRODEF GEN_EVENT_ENTITY_SET_DIALOGUE floor entity_instance_idx =dialogue_ptr
+ $spawn:
+ .DB low($floor), $06, low($entity_instance_idx), bank(=dialogue_ptr), high(ptr(=dialogue_ptr)), low(ptr(=dialogue_ptr))
.PADTO =$spawn+8
.END
diff --git a/map/dungeons/campsite.gbasm b/map/dungeons/campsite.gbasm
index cef4abb..ccc40ae 100644
--- a/map/dungeons/campsite.gbasm
+++ b/map/dungeons/campsite.gbasm
@@ -18,7 +18,8 @@ Camp_Site:
.generation_events:
.GEN_EVENT_LOAD_ENTITY $01 $05 $08
- .GEN_EVENT_SPAWN_LOADED_ENTITY_XY $01 $05 $11 $10 $01
+ .GEN_EVENT_SPAWN_LOADED_ENTITY_XY $01 $01 $05 $11 $10 $01
+ .GEN_EVENT_ENTITY_SET_DIALOGUE $01 $01 =Placeholder_Dialogue_Script
.GEN_EVENT_REMOVE_STAIRS $01
.generation_events.end:
diff --git a/map/dungeons/morningforest.gbasm b/map/dungeons/morningforest.gbasm
index 1b80a18..63f5092 100644
--- a/map/dungeons/morningforest.gbasm
+++ b/map/dungeons/morningforest.gbasm
@@ -16,7 +16,8 @@ Morning_Forest:
.generation_events:
.GEN_EVENT_DIALOGUE $01 =Demo_quest_init
.GEN_EVENT_DIALOGUE $10 =Demo_quest_floor_reach
- .GEN_EVENT_SPECIAL_ENTITY $10 $06
+ .GEN_EVENT_SPECIAL_ENTITY $10 $0f $06
+ .GEN_EVENT_ENTITY_SET_DIALOGUE $10 $0f =Demo_quest_bunny
.GEN_EVENT_REMOVE_STAIRS $10
.generation_events.end:
diff --git a/map/generationevents.gbasm b/map/generationevents.gbasm
index 5fc35de..7d88f1d 100644
--- a/map/generationevents.gbasm
+++ b/map/generationevents.gbasm
@@ -29,7 +29,7 @@ Generation_Event_Execution:
RET
Generation_Event_Jump_Table:
- ; 00
+; 00
RET
NOP
NOP
@@ -55,17 +55,21 @@ Generation_Event_Jump_Table:
JP =.Entity_XY
NOP
+ ; 06
+ JP =.Set_Dialogue_Ptr
+ NOP
+
.Dialogue_Script:
- LD A, $enum_dungeon_dialogue_mode
- LD $mem_requested_mode, A
+ LD A, $enum_dungeon_dialogue_mode
+ LD $mem_requested_mode, A
- LD A, (HL+)
- LD $mem_dialogue_script_bank, 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
+ LD A, (HL+)
+ LD $mem_dialogue_script_bank, 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
.Load_Entity:
LD A, (HL+)
@@ -78,31 +82,58 @@ Generation_Event_Jump_Table:
RET
.Entity_Random_Room:
+ LD A, (HL+)
+ LD E, A
+ SWAP E
+
LD A, $01
LD $tmp_var_3, A
LD D, (HL)
- CALL =FindFreeEntity
+ LD H, high($mem_entities_list)
+ LD L, E
LD A, D
JP =Initialize_Entity
.Entity_XY:
LD A, (HL+)
+ LD E, A
+ SWAP E
+
+ LD A, (HL+)
LD D, A
LD A, (HL+)
LD B, A
LD A, (HL+)
LD C, A
LD A, (HL)
- DBG
SWAP A
OR $02
LD $tmp_var_3, A
- CALL =FindFreeEntity
+ LD H, high($mem_entities_list)
+ LD L, E
LD A, D
JP =Initialize_Entity
+ .Set_Dialogue_Ptr:
+ LD D, high($mem_entities_list)
+ LD A, (HL+)
+ LD E, A
+ SWAP E
+ LD A, $0b
+ OR E
+ LD E, A
+ LD A, (HL+)
+ LD (DE), A
+ INC DE
+ LD A, (HL+)
+ LD (DE), A
+ INC DE
+ LD A, (HL)
+ LD (DE), A
+ RET
+
.Remove_Stairs:
LD HL, $mem_object_list
LD (HL), $00
- RET
+ RET
diff --git a/map/objects.gbasm b/map/objects.gbasm
index 0bfc20f..1ff9d53 100644
--- a/map/objects.gbasm
+++ b/map/objects.gbasm
@@ -154,7 +154,7 @@ Check_other_object_collision: ; Object in HL (with only sprite x & y set), will
Spawn_stairs:
LD A, $60
- LD E, $01
+ LD E, $08
JP =Spawn_object_in_random_room_avoid_bunny
Spawn_carrot:
@@ -202,6 +202,10 @@ Object_Interaction_Jump_table:
JP =Fimsh_Attack_Box_Action
NOP
+ ; 08
+ JP =Open_Big_Menu
+ NOP
+
Stairs_Action:
LD A, $enum_dungeon_generation_mode
LD $mem_current_mode, A
diff --git a/modes/bigmenu.gbasm b/modes/bigmenu.gbasm
new file mode 100644
index 0000000..ba3da74
--- /dev/null
+++ b/modes/bigmenu.gbasm
@@ -0,0 +1,38 @@
+Open_Big_Menu_Loading_VBlank:
+ LD A, $mem_prepared_color_palette
+ RR A
+ OR 0b11000000
+ LD $mem_prepared_color_palette, A
+ LD A, $reg_obj0_palette
+ RR A
+ OR 0b11000000
+ LD $reg_obj0_palette, A
+ LD A, $mem_gui_text_bold_palette
+ RR A
+ OR 0b11000000
+ LD $mem_gui_text_bold_palette, A
+ LD A, $mem_gui_text_thin_palette
+ RR A
+ OR 0b11000000
+ LD $mem_gui_text_thin_palette, A
+ RET
+
+Open_Big_Menu_Loading_Regular:
+ RET
+
+Open_Big_Menu:
+ LD BC, =Open_Big_Menu_Loading_VBlank
+ LD A, B
+ LD $mem_loading_mode_vblank_func_pointer_high, A
+ LD A, C
+ LD $mem_loading_mode_vblank_func_pointer_low, A
+
+ LD BC, =Open_Big_Menu_Loading_Regular
+ LD A, B
+ LD $mem_loading_mode_regular_func_pointer_high, A
+ LD A, C
+ LD $mem_loading_mode_regular_func_pointer_low, A
+
+ LD A, $enum_loading_mode
+ LD $mem_requested_mode, A
+ RET
diff --git a/modes/dungeon.gbasm b/modes/dungeon.gbasm
index 044cd53..5db8e6b 100644
--- a/modes/dungeon.gbasm
+++ b/modes/dungeon.gbasm
@@ -116,7 +116,7 @@ STAT_Entrypoint:
CP $67
JR Z, =.Start_dialogue
.Thin_font:
- LD A, $palette_thin_font
+ LD A, $mem_gui_text_thin_palette
LD $reg_bg_palette, A
JR =.skip_dialogue
@@ -128,7 +128,7 @@ STAT_Entrypoint:
LD A, $mem_display_flag
BIT 1, A
JR Z, =.Thin_font
- LD A, $palette_bold_font
+ LD A, $mem_gui_text_bold_palette
LD $reg_bg_palette, A
LD A, $77
LD $reg_lyc, A
diff --git a/modes/loading.gbasm b/modes/loading.gbasm
index aad23bd..3a7f9af 100644
--- a/modes/loading.gbasm
+++ b/modes/loading.gbasm
@@ -2,7 +2,7 @@ Loading_VBLANK_Entrypoint:
.SET_WINDOW_LCDC_E
.ENABLE_TOP_BAR
- LD A, $palette_bold_font
+ LD A, $mem_gui_text_bold_palette
LD $reg_bg_palette, A
CALL $OAM_DMA_Transfer_routine
diff --git a/modes/vblank_handler_list.gbasm b/modes/vblank_handler_list.gbasm
index cacbdf7..13abe92 100644
--- a/modes/vblank_handler_list.gbasm
+++ b/modes/vblank_handler_list.gbasm
@@ -33,3 +33,4 @@ VBlank_Handler_List:
.INCLUDE "modes/dungeon.gbasm"
.INCLUDE "modes/loading.gbasm"
.INCLUDE "modes/dungeongeneration.gbasm"
+.INCLUDE "modes/bigmenu.gbasm"
diff --git a/utils.gbasm b/utils.gbasm
index 328dbe2..588121b 100644
--- a/utils.gbasm
+++ b/utils.gbasm
@@ -64,7 +64,7 @@ tilemap_memcpy: ; src = DE, dest = HL, n = C
OR E
LD $reg_lcd_controller, A
- LD A, $palette_bold_font
+ LD A, $mem_gui_text_bold_palette
LD $reg_bg_palette, A
.END