aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2024-11-14 19:05:56 +0900
committerAstatin <[email protected]>2024-11-14 19:05:56 +0900
commitcfd36cc6a11923c8863b699e70b90149ad1c731a (patch)
tree1adb07333cb0bba92812cda105a4b2db2fc89fd8
parent8a9209f59366c70da07c87e31d21ea0d4754bc84 (diff)
[WIP] Adding hop attack (still need to enable back the normal map loading, there seem to be an off by one error on the entity while hopping in a positive direction, still need to split the loading in multiple frame to not go out of VBlank)
-rw-r--r--attacks.gbasm77
-rw-r--r--definitions.gbasm5
-rw-r--r--entity/bunny.gbasm43
-rw-r--r--entity/display.gbasm37
-rw-r--r--main.gbasm4
5 files changed, 138 insertions, 28 deletions
diff --git a/attacks.gbasm b/attacks.gbasm
index b758f89..168285a 100644
--- a/attacks.gbasm
+++ b/attacks.gbasm
@@ -1,14 +1,9 @@
-Hop_Attack_Loading_VBlank:
- LD A, $mem_current_mode
- CP $enum_loading_mode
- RET NZ
-
- LD A, $mem_viewport_y
- INC A
- LD $mem_viewport_y, A
- LD C, $00
- Hop_Attack_Loading_VBlank.loop:
+Preload_Map_Hop:
+ LD C, $01
+ Preload_Map_Hop.loop:
PUSH BC
+
+ ; Getting the +1/-1 value of the direction to B
LD A, $mem_bunny_direction
AND $07
DEC A
@@ -16,34 +11,82 @@ Hop_Attack_Loading_VBlank:
SLA A
DEC A
LD B, A
+
LD A, $mem_bunny_direction
AND $07
DEC A
BIT 1, A
- JR NZ, =Hop_Attack_Loading_VBlank.Map_Load.vertical
+ DBG
+ JR NZ, =Preload_Map_Hop.Map_Load.vertical
- Hop_Attack_Loading_VBlank.Map_Load.horizontal:
+ Preload_Map_Hop.Map_Load.horizontal:
CALL =Load_Next_Block_Column
- JR =Hop_Attack_Loading_VBlank.Map_Load.End
+ JR =Preload_Map_Hop.Map_Load.End
- Hop_Attack_Loading_VBlank.Map_Load.vertical:
+ Preload_Map_Hop.Map_Load.vertical:
CALL =Load_Next_Block_Row
- Hop_Attack_Loading_VBlank.Map_Load.End:
+ Preload_Map_Hop.Map_Load.End:
+ CALL =Display_Prepared_Block
POP BC
INC C
LD A, $10
CP C
- JR NZ, =Hop_Attack_Loading_VBlank.loop
+ JR NZ, =Preload_Map_Hop.loop
+RET
+
+Hop_Attack_Loading_VBlank:
+ LD A, $mem_current_mode
+ CP $enum_loading_mode
+ RET NZ
+
+ CALL =Preload_Map_Hop
+ LD A, $mem_bunny_direction
+ AND $07
+ LD D, A
+ LD A, $mem_viewport_x
+ LD B, A
LD A, $mem_viewport_y
- DEC A
+ LD C, A
+ LD A, $01
+ .ADD_A_TO_DIRECTION_BC
+ LD A, B
+ LD $mem_viewport_x, A
+ LD A, C
LD $mem_viewport_y, A
+ CALL =Preload_Map_Hop
+
+ LD A, $mem_bunny_direction
+ AND $07
+ LD D, A
+ LD A, $mem_viewport_x
+ LD B, A
+ LD A, $mem_viewport_y
+ LD C, A
+ LD A, $FF
+ .ADD_A_TO_DIRECTION_BC
+ LD A, B
+ LD $mem_viewport_x, A
+ LD A, C
+ LD $mem_viewport_y, A
+
+
LD A, $enum_dungeon_mode
LD $mem_current_mode, A
LD $mem_requested_mode, A
+ LD A, $mem_bunny_direction
+ AND $07
+ OR $38
+ LD $mem_bunny_direction, A
+ LD A, $mem_map_loading_flags
+ SET 3, A
+ LD $mem_map_loading_flags, A
+ LD A, $mem_bunny_flags
+ SET 0, A
+ LD $mem_bunny_flags, A
RET
Hop_Attack_Loading_Regular:
diff --git a/definitions.gbasm b/definitions.gbasm
index 0dc9a56..04daa19 100644
--- a/definitions.gbasm
+++ b/definitions.gbasm
@@ -30,6 +30,7 @@
.DEFINE mem_bunny_direction ($cb03)
; aaaamddd: a = animation, m = is_moving, d = direction
.DEFINE mem_bunny_health ($cb06)
+.DEFINE mem_bunny_flags ($cb07)
.DEFINE mem_viewport_x ($c008)
.DEFINE mem_viewport_y ($c009)
.DEFINE mem_rng_state_1 ($c00a) ; 2 bytes
@@ -131,7 +132,9 @@
; turn_function_jump_table_index: u8
; action_function_jump_table_index: u8
; health: u8 (DAA decimal !!)
-; _padding: u72
+; flags: u8
+; bit 0: speed 2x
+; _padding: u64
;
; # SANTA CHRISTMAS LIST PLEASE #
; health, max health, list of possible attacks, maybe remaining attacks ? AI status (blind, scared, slow, etc..)
diff --git a/entity/bunny.gbasm b/entity/bunny.gbasm
index 01206e8..7726bd8 100644
--- a/entity/bunny.gbasm
+++ b/entity/bunny.gbasm
@@ -9,6 +9,13 @@ Move_Bunny:
Move_Bunny.not_dead:
+ LD A, $mem_bunny_flags
+ LD E, $01
+ BIT 0, A
+ JR Z, =Normal_speed
+ LD E, $02
+ Normal_speed:
+
Start_action_or_movement:
LD A, $mem_map_loading_flags
BIT 3, A
@@ -77,7 +84,7 @@ Move_Bunny:
LD B, A
LD A, $mem_prepared_viewport_y
LD C, A
- LD A, $01
+ LD A, E
.ADD_A_TO_DIRECTION_BC
LD A, B
LD $mem_prepared_viewport_x, A
@@ -95,14 +102,13 @@ Move_Bunny:
LD A, $mem_bunny_direction
BIT 3, A
JR Z, =End_movement.end
- LD $mem_bunny_direction, A
LD D, A
LD A, $mem_bunny_x
LD B, A
LD A, $mem_bunny_y
LD C, A
- LD A, $01
+ LD A, E
.ADD_A_TO_DIRECTION_BC
LD A, B
LD $mem_bunny_x, A
@@ -119,8 +125,39 @@ Move_Bunny:
LD $mem_viewport_x, A
LD A, C
LD $mem_viewport_y, A
+
+ LD A, $mem_bunny_flags
+ RES 0, A
+ LD $mem_bunny_flags, A
End_movement.end:
+ Middle_movement_doublespeed_viewport_update:
+ LD A, $mem_map_loading_flags
+ BIT 3, A
+ JP Z, =Middle_movement_doublespeed_viewport_update.end
+ LD A, $mem_moving_animation_step
+ CP $08
+ JP NZ, =Middle_movement_doublespeed_viewport_update.end
+ LD A, $mem_bunny_direction
+ BIT 3, A
+ JR Z, =Middle_movement_doublespeed_viewport_update.end
+ LD A, E
+ CP $02
+ JR NZ, =Middle_movement_doublespeed_viewport_update.end
+
+ LD A, $mem_viewport_x
+ LD B, A
+ LD A, $mem_viewport_y
+ LD C, A
+ LD A, $01
+ .ADD_A_TO_DIRECTION_BC
+ LD A, B
+ LD $mem_viewport_x, A
+ LD A, C
+ LD $mem_viewport_y, A
+ Middle_movement_doublespeed_viewport_update.end:
+
+
Interaction:
LD A, $mem_map_loading_flags
BIT 3, A
diff --git a/entity/display.gbasm b/entity/display.gbasm
index 8a0daf1..ada77e2 100644
--- a/entity/display.gbasm
+++ b/entity/display.gbasm
@@ -77,7 +77,7 @@ Display_Entity:
SUB C
AND $0f
SWAP A
- ADD $02
+ ADD $06
LD C, A
LD A, $mem_map_loading_flags
@@ -183,18 +183,45 @@ Display_Entity:
.ADD_A_TO_DIRECTION_BC
Display_Entity.Action_Animation.end:
+ Display_Entity.SuperJump_Animation:
+ LD A, D
+ AND $f0
+ CP $30
+ JR NZ, =Display_Entity.SuperJump_Animation.end
+
+ LD A, $mem_moving_animation_step
+ CP $00
+ JR Z, =Display_Entity.SuperJump_Animation.end
+ .ADD_A_TO_DIRECTION_BC
+ LD A, $mem_moving_animation_step
+ SUB $08
+ .ABS
+ SLA A
+ CPL
+ INC A
+ ADD $16
+ CPL
+ INC A
+ ADD C
+ LD C, A
+ Display_Entity.SuperJump_Animation.end:
+
Display_Entity.Moving_Hops:
LD A, D
- BIT 3, A
- LD A, $00
- JR Z, =Display_Entity.Moving_Hops.not_moving
+ AND $f8
+ CP $08
+ JR NZ, =Display_Entity.Moving_Hops.end
LD A, $mem_moving_animation_step
- Display_Entity.Moving_Hops.not_moving:
SUB $08
.ABS
SUB $04
.ABS
+ CPL
+ INC A
+ ADD $04
+ CPL
+ INC A
ADD C
LD C, A
Display_Entity.Moving_Hops.end:
diff --git a/main.gbasm b/main.gbasm
index fe02ec3..7c262d6 100644
--- a/main.gbasm
+++ b/main.gbasm
@@ -114,7 +114,7 @@ VBLANK_Entrypoint:
LD A, $mem_current_mode
CP $enum_dungeon_mode
JR NZ, =Skip_VBlank_Dungeon_Update
- CALL =Display_Prepared_Block
+ ; CALL =Display_Prepared_Block
CALL =Display_Object
Skip_VBlank_Dungeon_Update:
@@ -138,7 +138,7 @@ VBLANK_Entrypoint:
CALL =Object_Interactions_Check
CALL =Entities_Actions
- CALL =Prepare_Scrolling_Map
+ ; CALL =Prepare_Scrolling_Map
Skip_Dungeon_Update: