aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO2
-rw-r--r--animations/laser.gbasm2
-rw-r--r--animations/rotatingball.gbasm2
-rw-r--r--animations/sparkles.gbasm4
-rw-r--r--definitions.gbasm12
-rw-r--r--entity/actions.gbasm64
-rw-r--r--entity/bunny.gbasm8
-rw-r--r--entity/init.gbasm10
-rw-r--r--entity/list.gbasm39
-rw-r--r--entity/questgoal.gbasm119
-rw-r--r--gui.gbasm30
-rw-r--r--main.gbasm3
-rw-r--r--playerattacks/earcoptr.gbasm38
-rw-r--r--playerattacks/freeze.gbasm14
-rw-r--r--sprites/bunny/bunny-side.pngbin178 -> 178 bytes
-rw-r--r--tiles.gbasm2
-rw-r--r--tileset.gbasm8
17 files changed, 252 insertions, 105 deletions
diff --git a/TODO b/TODO
index ad5f32c..34a5157 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
Bugs:
-> Emulator crash with "not implemented: Only XKB keymaps are supported when unfocused (or workspace change maybe ?)
- -> Crash/infinite loop on dungeon generation
- -> Hoping over a fox doesn't cancel a laser attack
Accessibility issues:
-> freeze/earcopter attack patterns are not obvious (either needs to be shown on map or add select menu with infos if not possible + tutorial to explain the existence of select menu ?)
diff --git a/animations/laser.gbasm b/animations/laser.gbasm
index c76b464..a3536d7 100644
--- a/animations/laser.gbasm
+++ b/animations/laser.gbasm
@@ -118,7 +118,7 @@ Laser_Animation:
LD A, B
LD (HL+), A
- LD A, $64
+ LD A, $vram_animation_index+4
LD (HL+), A
LD A, $00
LD (HL+), A
diff --git a/animations/rotatingball.gbasm b/animations/rotatingball.gbasm
index 68f5b54..c52e542 100644
--- a/animations/rotatingball.gbasm
+++ b/animations/rotatingball.gbasm
@@ -77,7 +77,7 @@ Rotating_Ball_Animation:
LD A, (DE)
ADD B
LD (HL+), A
- LD A, $64
+ LD A, $vram_animation_index+4
LD (HL+), A
LD A, $00
LD (HL+), A
diff --git a/animations/sparkles.gbasm b/animations/sparkles.gbasm
index fe9c8ae..9f9c04a 100644
--- a/animations/sparkles.gbasm
+++ b/animations/sparkles.gbasm
@@ -68,7 +68,7 @@ Sparkle_Animation:
SRA A
SRA A
AND $02
- ADD $60
+ ADD $vram_animation_index
LD (HL+), A
LD A, $00
@@ -86,7 +86,7 @@ Sparkle_Animation:
SRA A
SRA A
AND $02
- ADD $60
+ ADD $vram_animation_index
LD (HL+), A
LD A, $00
diff --git a/definitions.gbasm b/definitions.gbasm
index d3f2ac5..30fc296 100644
--- a/definitions.gbasm
+++ b/definitions.gbasm
@@ -152,7 +152,8 @@
.DEFINE mem_loaded_entities_indices $c8a8 ; Takes the memory from $c8a8 to $c8ae
.DEFINE mem_loaded_enemies_indices $c8ab ; Takes the memory from $c8ab to $c8ae
-.DEFINE mem_loaded_entities_indices_end $c8af ; Takes the memory from $c8a8 to $c8ae
+.DEFINE mem_loaded_special_entity_index ($c8af)
+.DEFINE mem_loaded_entities_indices_end $c8b0 ; Takes the memory from $c8a8 to $c8af
.DEFINE mem_object_list $c900 ; Takes the memory from c900 to c97f
; struct objects {
@@ -218,6 +219,8 @@
; bit 3: blinking mode
; status: u8
; ; bit 0: whether or not turns should be skipped
+; ; 01: freeze
+; ; 02: invincible
; mana: u8
; _padding: u48
;
@@ -244,6 +247,13 @@
.DEFINE lcdc_guibg_tilemap $8d
.DEFINE lcdc_mapbg_tilemap $87
+.DEFINE vram_entity_index $02
+.DEFINE vram_animation_index $62
+.DEFINE vram_character_index $80
+.DEFINE vram_icon_index $F0
+.DEFINE vram_bg_index $20
+.DEFINE vram_object_index $60
+
; HIGH_RAM:
;
; 80-85 ; Free to use as temporary variables
diff --git a/entity/actions.gbasm b/entity/actions.gbasm
index 7032766..051b488 100644
--- a/entity/actions.gbasm
+++ b/entity/actions.gbasm
@@ -136,6 +136,10 @@ Turn_Jump_table:
JP =Penguin_Turn
NOP
+ ; 05
+ JP =QuestGoal_Turn
+ NOP
+
Interaction_Jump_table:
; 00
RET
@@ -151,66 +155,6 @@ Interaction_Jump_table:
JP =Open_Dialogue
NOP
-Open_Dialogue:
- LD A, L
- AND $f0
- LD L, A
-
- INC HL
-
- LD A, $mem_bunny_x
- CP (HL)
- JR Z, =.Vertical_check
-
- .Horizontal_check:
- INC A
- CP (HL)
- JR Z, =.Left
- .Right:
- INC HL
- INC HL
- LD (HL), $enum_direction_right
- JR =.Check_end
- .Left:
- INC HL
- INC HL
- LD (HL), $enum_direction_left
- JR =.Check_end
- .Vertical_check:
- INC HL
- LD A, $mem_bunny_y
- INC A
- CP (HL)
- JR Z, =.Up
- .Down:
- INC HL
- LD (HL), $enum_direction_down
- JR =.Check_end
- .Up:
- INC HL
- LD (HL), $enum_direction_up
- JR =.Check_end
- .Check_end:
-
- LD HL, $dialogue_first_line
- LD BC, =Bunny_Prefix
- CALL =Print_str
-
- LD HL, $dialogue_third_line
- LD BC, =Text_1
- CALL =Print_str
-
- LD A, $07
- LD $mem_display_flag, A
-
- LD A, $mem_bunny_direction
- AND $0f
- LD $mem_bunny_direction, A
-
- LD A, $enum_dungeon_dialogue_mode
- LD $mem_requested_mode, A
- RET
-
Enemy_Interaction:
LD A, L
AND $f0
diff --git a/entity/bunny.gbasm b/entity/bunny.gbasm
index d2b9148..8438d3e 100644
--- a/entity/bunny.gbasm
+++ b/entity/bunny.gbasm
@@ -106,10 +106,12 @@ Move_Bunny:
JR =.Start_action_or_movement.end
.Start_action_or_movement.test_action:
- LD A, $mem_last_button_action
- LD B, A
LD A, $mem_button_action
- CP B
+ LD B, A
+ LD A, $mem_last_button_action
+ XOR B
+ AND B
+ CP $00
JR Z, =.Start_action_or_movement.end
BIT 0, A
JR Z, =.Start_action_or_movement.end
diff --git a/entity/init.gbasm b/entity/init.gbasm
index 970607b..d263248 100644
--- a/entity/init.gbasm
+++ b/entity/init.gbasm
@@ -95,6 +95,8 @@ Initialize_Entities:
LD A, $ff
LD $mem_bunny_current_room_idx, A
+ LD A, $07
+ CALL =Initialize_Entity
CALL =Initialize_Enemy
CALL =Initialize_Enemy
CALL =Initialize_Enemy
@@ -133,6 +135,9 @@ Initialize_Enemy: ; HL => pointer to entity struct
CALL =RNG_Step
AND $03
ADD $03
+
+Initialize_Entity: ; HL => pointer to entity struct, A => entity loaded index
+ DBG
LD E, A
SLA A
SLA A
@@ -215,7 +220,6 @@ Initialize_Enemy: ; HL => pointer to entity struct
LD (HL-), A
LD (HL), A
-
POP BC
RET
@@ -262,9 +266,13 @@ Initialize_Enemy: ; HL => pointer to entity struct
LD A, (BC)
LD (HL+), A
+ INC BC
+
XOR A
; flags & status
LD (HL+), A
+
+ LD A, (BC)
LD (HL+), A
INC BC
diff --git a/entity/list.gbasm b/entity/list.gbasm
index acbe12d..7f09455 100644
--- a/entity/list.gbasm
+++ b/entity/list.gbasm
@@ -12,6 +12,9 @@ Entity_list:
; Starting health
.DB $02
+ ; Starting status
+ .DB $00
+
; Starting mana
.DB $05
@@ -30,6 +33,9 @@ Entity_list:
; Starting health
.DB $02
+ ; Starting status
+ .DB $00
+
; Starting mana
.DB $00
@@ -48,6 +54,9 @@ Entity_list:
; Starting health
.DB $02
+ ; Starting status
+ .DB $00
+
; Starting mana
.DB $00
@@ -66,6 +75,9 @@ Entity_list:
; Starting health
.DB $01
+ ; Starting status
+ .DB $00
+
; Starting mana
.DB $03
@@ -84,6 +96,9 @@ Entity_list:
; Starting health
.DB $00
+ ; Starting status
+ .DB $00
+
; Starting mana
.DB $00
@@ -102,7 +117,31 @@ Entity_list:
; Starting health
.DB $00
+ ; Starting status
+ .DB $00
+
; Starting mana
.DB $00
.PADTO =.Fimsh+8
+
+ .QuestGoalBunny:
+ ; Sprite address
+ .DB =OBJ_Tile_Image_Data.Bunny
+
+ ; Turn Jump Table index
+ .DB $05
+
+ ; Interaction Jump Table index
+ .DB $02
+
+ ; Starting health
+ .DB $00
+
+ ; Starting status
+ .DB $02
+
+ ; Starting mana
+ .DB $00
+
+ .PADTO =.QuestGoalBunny+8
diff --git a/entity/questgoal.gbasm b/entity/questgoal.gbasm
new file mode 100644
index 0000000..d39f786
--- /dev/null
+++ b/entity/questgoal.gbasm
@@ -0,0 +1,119 @@
+Open_Dialogue:
+ LD A, L
+ AND $f0
+ LD L, A
+
+ INC HL
+
+ LD A, $mem_bunny_x
+ CP (HL)
+ JR Z, =.Vertical_check
+
+ .Horizontal_check:
+ INC A
+ CP (HL)
+ JR Z, =.Left
+ .Right:
+ INC HL
+ INC HL
+ LD (HL), $enum_direction_right
+ JR =.Check_end
+ .Left:
+ INC HL
+ INC HL
+ LD (HL), $enum_direction_left
+ JR =.Check_end
+ .Vertical_check:
+ INC HL
+ LD A, $mem_bunny_y
+ INC A
+ CP (HL)
+ JR Z, =.Up
+ .Down:
+ INC HL
+ LD (HL), $enum_direction_down
+ JR =.Check_end
+ .Up:
+ INC HL
+ LD (HL), $enum_direction_up
+ JR =.Check_end
+ .Check_end:
+
+ LD HL, $dialogue_first_line
+ LD BC, =Bunny_Prefix
+ CALL =Print_str
+
+ LD HL, $dialogue_third_line
+ LD BC, =Text_1
+ CALL =Print_str
+
+ LD A, $07
+ LD $mem_display_flag, A
+
+ LD A, $mem_bunny_direction
+ AND $0f
+ LD $mem_bunny_direction, A
+
+ LD A, $enum_dungeon_dialogue_mode
+ LD $mem_requested_mode, A
+ RET
+
+QuestGoal_Turn:
+ LD A, $mem_map_loading_flags
+ BIT 3, A
+ RET Z
+
+ PUSH HL
+ PUSH BC
+ PUSH DE
+ INC HL
+ LD A, (HL+)
+ LD B, A
+ LD A, (HL+)
+ LD C, A
+ LD A, (HL+)
+ LD D, A
+
+ .Start_action_or_movement:
+ LD A, $mem_moving_animation_step
+ CP $00
+ JP NZ, =.Start_action_or_movement.end
+
+ .Try_Walking:
+
+ CALL =RNG_Step
+ BIT 0, A
+ JR Z, =.Start_action_or_movement.end
+
+ CALL =Walking.Random_walker
+ .Start_action_or_movement.end:
+
+ .End_movement:
+ LD A, $mem_moving_animation_step
+ CP $0f
+ JP NZ, =.End_movement.end
+ LD A, D
+ AND $07
+ BIT 3, D
+ LD D, A
+ JR Z, =.End_movement.end
+ LD A, $01
+ .ADD_A_TO_DIRECTION_BC
+
+ .End_movement.end:
+
+ .Skip_Turn:
+ LD A, L
+ AND $f0
+ LD L, A
+ INC HL
+ LD A, B
+ LD (HL+), A
+ LD A, C
+ LD (HL+), A
+ LD A, D
+ LD (HL+), A
+ POP DE
+ POP BC
+ POP HL
+ RET
diff --git a/gui.gbasm b/gui.gbasm
index 340783f..2ec6f5d 100644
--- a/gui.gbasm
+++ b/gui.gbasm
@@ -225,26 +225,36 @@ Reload_EP_Cost:
Check_dialogue_action:
LD A, $mem_current_mode
CP $enum_dungeon_menu_mode
- JR Z, =.Check_exit
+ JR Z, =.Dungeon_Menu
CP $enum_dungeon_dialogue_mode
RET NZ
- .Check_exit:
- LD A, $mem_last_button_action
+ .Dialogue_Box:
+ LD A, $mem_button_action
LD B, A
+ LD A, $mem_last_button_action
+ XOR B
+ AND B
+ CP $00
+ RET Z
+ BIT 0, A
+ JP NZ, =Exit_Menu
+ RET
+
+ .Dungeon_Menu:
LD A, $mem_button_action
- CP B
+ LD B, A
+ LD A, $mem_last_button_action
+ XOR B
+ AND B
+ CP $00
RET Z
BIT 3, A
JP NZ, =Exit_Menu
BIT 0, A
RET Z
- LD A, $mem_current_mode
- CP $enum_dungeon_menu_mode
- RET NZ
-
LD A, $mem_current_focused_attack_ep_cost
LD B, A
LD A, $mem_bunny_mana
@@ -274,6 +284,10 @@ Check_Open_Menu_button:
CP $enum_dungeon_mode
RET NZ
+ LD A, $mem_requested_mode
+ CP $enum_dungeon_mode
+ RET NZ
+
LD A, $mem_bunny_status
BIT 0, A
RET NZ
diff --git a/main.gbasm b/main.gbasm
index 88b269d..254cd7a 100644
--- a/main.gbasm
+++ b/main.gbasm
@@ -110,6 +110,8 @@ New_Dungeon:
LD (HL+), A
LD A, $03
LD (HL+), A
+ LD A, $06
+ LD $mem_loaded_special_entity_index, A
LD HL, $mem_bunny_attacks
LD A, $00
LD (HL+), A
@@ -313,6 +315,7 @@ STAT_Entrypoint:
.INCLUDE "entity/fox.gbasm"
.INCLUDE "entity/cat.gbasm"
.INCLUDE "entity/penguin.gbasm"
+.INCLUDE "entity/questgoal.gbasm"
.INCLUDE "entity/actions.gbasm"
.INCLUDE "entity/collisions.gbasm"
.INCLUDE "entity/display.gbasm"
diff --git a/playerattacks/earcoptr.gbasm b/playerattacks/earcoptr.gbasm
index fa174d3..d17d88b 100644
--- a/playerattacks/earcoptr.gbasm
+++ b/playerattacks/earcoptr.gbasm
@@ -22,15 +22,15 @@ Earcoptr_Attack_Loading_Regular:
RET C
SUB $10
- LD BC, $mem_entities_list
+ LD HL, $mem_entities_list
SLA A
SLA A
SLA A
SLA A
INC A
- LD C, A
+ LD L, A
- LD A, (BC)
+ LD A, (HL+)
LD E, A
LD A, $mem_bunny_x
@@ -39,9 +39,7 @@ Earcoptr_Attack_Loading_Regular:
CP $02
RET NC
- INC C
-
- LD A, (BC)
+ LD A, (HL)
LD E, A
LD A, $mem_bunny_y
@@ -50,18 +48,19 @@ Earcoptr_Attack_Loading_Regular:
CP $02
RET NC
- LD A, C
- ADD $04
- LD C, A
- LD A, (BC)
- SUB $01
- RET C
- LD (BC), A
-
- INC C
- LD A, (BC)
+ LD A, L
+ ADD $06
+ LD L, A
+
+ LD A, $02
+ CP (HL)
+ RET Z
+
+ DEC HL
+
+ LD A, (HL)
SET 3, A
- LD (BC), A
+ LD (HL-), A
LD A, $mem_moving_animation_step
LD B, A
@@ -69,6 +68,11 @@ Earcoptr_Attack_Loading_Regular:
SUB B
LD $mem_blinking_animation_counter, A
+ LD A, (HL)
+ SUB $01
+ RET C
+ LD (HL), A
+
RET
Earcoptr_Attack:
diff --git a/playerattacks/freeze.gbasm b/playerattacks/freeze.gbasm
index 936bf47..e7aefa7 100644
--- a/playerattacks/freeze.gbasm
+++ b/playerattacks/freeze.gbasm
@@ -82,15 +82,21 @@ Freeze_Attack_Loading_Regular:
RET C
LD A, C
- ADD $05
+ ADD $06
LD C, A
+
LD A, (BC)
- SET 1, A
- LD (BC), A
+ CP $02
+ RET Z
- INC C
LD A, $01
LD (BC), A
+
+ DEC C
+
+ LD A, (BC)
+ SET 1, A
+ LD (BC), A
RET
Freeze_Attack:
diff --git a/sprites/bunny/bunny-side.png b/sprites/bunny/bunny-side.png
index 09f9764..866bd3a 100644
--- a/sprites/bunny/bunny-side.png
+++ b/sprites/bunny/bunny-side.png
Binary files differ
diff --git a/tiles.gbasm b/tiles.gbasm
index 41fbcb9..3e91a30 100644
--- a/tiles.gbasm
+++ b/tiles.gbasm
@@ -24,7 +24,7 @@ Load_Tile:
LD BC, $0050
CALL =memcpy
- LD HL, $8600
+ LD HL, $8620
LD DE, =Animation_Sprites_Data
LD BC, $0060
CALL =memcpy
diff --git a/tileset.gbasm b/tileset.gbasm
index 25c04b3..e3a03ac 100644
--- a/tileset.gbasm
+++ b/tileset.gbasm
@@ -175,10 +175,10 @@ OBJ_Tile_Image_Data:
.Bunny:
; Bunny side
- .DB $00, $00, $44, $44, $aa, $ee, $aa, $ee, $fe, $b2, $fc, $b4, $fc, $94, $75, $4d ; 0x02
- .DB $ff, $82, $6f, $70, $3f, $20, $3f, $20, $31, $2e, $4e, $7f, $51, $71, $60, $60 ; 0x03
- .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $c0, $c0 ; 0x04
- .DB $34, $f4, $ce, $3a, $fe, $0a, $fc, $04, $bc, $44, $5c, $e4, $88, $f8, $f0, $f0 ; 0x05
+ .DB $00, $00, $22, $22, $55, $77, $55, $77, $7f, $59, $7e, $5a, $7e, $4a, $3a, $26 ; 0x02
+ .DB $7f, $41, $37, $38, $1f, $10, $1f, $10, $18, $17, $27, $3f, $28, $38, $30, $30 ; 0x03
+ .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $e0, $e0 ; 0x04
+ .DB $9a, $7a, $e7, $1d, $ff, $05, $fe, $02, $de, $22, $2e, $f2, $c4, $fc, $78, $78 ; 0x05
; Bunny back
.DB $00, $00, $00, $00, $00, $00, $1c, $1c, $2e, $32, $2f, $3b, $1f, $19, $0e, $0f ; 0x06