aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-01-24 18:49:12 +0900
committerAstatin <[email protected]>2025-01-24 18:49:12 +0900
commitcf80989154bbb8985bec1d2e089c680714b9b804 (patch)
tree4dd903e51d5a8f997ae84ce5dd4bd78bec8c30bf
parent1a6621e5b1da42ee4b6b9132790ec744efc009c2 (diff)
Fix XY/YX/BC/CB issue thingy
-rw-r--r--TODO2
-rw-r--r--enemiesattacks/laser.gbasm1
-rw-r--r--enemiesattacks/walk.gbasm4
-rw-r--r--entity/actions.gbasm3
-rw-r--r--entity/bunny.gbasm6
-rw-r--r--entity/collisions.gbasm18
-rw-r--r--entity/utils.gbasm7
-rw-r--r--playerattacks/hop.gbasm3
8 files changed, 17 insertions, 27 deletions
diff --git a/TODO b/TODO
index 67e7156..faa1f79 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,5 @@
Need to be refactored:
- -> AB/BC/XY/YX thingy issue that makes me angry (functions/macro to predict position could be merged after)
+ -> Fox is sometimes moving too far when walking thingy
-> main is messy and unreadable
-> rework mode checks (heatlh update should happen on both dungeon and dead mode)
-> general structure is messy (why is Update_Animation_Step in entity/action.gbasm ?? What is even entity/action.gbasm supposed to be ??)
diff --git a/enemiesattacks/laser.gbasm b/enemiesattacks/laser.gbasm
index 63aad07..b351141 100644
--- a/enemiesattacks/laser.gbasm
+++ b/enemiesattacks/laser.gbasm
@@ -94,7 +94,6 @@ Laser_Attack: ; Direction to face in E. Result in BC (XY), Direction in D
.skip_animation_wait_frames_update:
LD A, $mem_animation_wait_frames
- DBG
POP DE
diff --git a/enemiesattacks/walk.gbasm b/enemiesattacks/walk.gbasm
index 9b196e5..ad17ad0 100644
--- a/enemiesattacks/walk.gbasm
+++ b/enemiesattacks/walk.gbasm
@@ -78,7 +78,6 @@ Walking: ; entity XY in BC, Breaks DE
OR $08
PUSH BC
CALL =Get_Position_After_Move
- LD A, C
CALL =Is_Collisionable
POP BC
CP $00
@@ -123,10 +122,9 @@ Walking: ; entity XY in BC, Breaks DE
.skip_invert_axis2:
.Check_Collision:
- LD A, D
PUSH BC
+ LD A, D
CALL =Get_Position_After_Move
- LD A, C
CALL =Is_Collisionable
CALL =Carve_Entity_Collision_Map
POP BC
diff --git a/entity/actions.gbasm b/entity/actions.gbasm
index f97fbc4..f44e41b 100644
--- a/entity/actions.gbasm
+++ b/entity/actions.gbasm
@@ -283,7 +283,8 @@ Fox_Turn:
CALL =Laser_sight_check
LD A, E
CP $00
- JR Z, =.nyo_basic_attack
+ ;JR Z, =.nyo_basic_attack
+ JR =.nyo_basic_attack
; CALL =Basic_Attack
LD A, L
diff --git a/entity/bunny.gbasm b/entity/bunny.gbasm
index 7e9afa5..3804b6a 100644
--- a/entity/bunny.gbasm
+++ b/entity/bunny.gbasm
@@ -66,7 +66,6 @@ Move_Bunny:
LD A, D
CALL =Get_Position_After_Move
- LD A, C
CALL =Is_Collisionable
CALL =Carve_Entity_Collision_Map
CP $00
@@ -86,13 +85,8 @@ Move_Bunny:
JR Z, =.Start_action_or_movement.end
PUSH BC
- LD A, B
- LD B, C
- LD C, A
LD A, $01
- DBG
.ADD_A_TO_DIRECTION_BC
- DBG
LD A, B
LD $mem_bunny_predicted_x, A
LD A, C
diff --git a/entity/collisions.gbasm b/entity/collisions.gbasm
index 13120a6..d19bf08 100644
--- a/entity/collisions.gbasm
+++ b/entity/collisions.gbasm
@@ -1,9 +1,12 @@
-Carve_Entity_Collision_Map: ; X in C, Y in B
+Carve_Entity_Collision_Map: ; XY in BC
PUSH BC
PUSH HL
PUSH AF
- LD A, C
+ LD A, B
+ LD B, C
+ LD C, A
+
AND $e0
JR NZ, =Carve_Entity_Collision_Map.end
@@ -38,18 +41,21 @@ Carve_Entity_Collision_Map: ; X in C, Y in B
POP BC
RET
-Is_Collisionable: ; X in A, Y in B, Result A
+Is_Collisionable: ; XY in BC, Result A
PUSH BC
PUSH HL
+ LD A, B
CP $20
JR NC, =Is_Collisionable.Solid
- LD C, A
- LD A, B
+ LD A, C
CP $20
JR NC, =Is_Collisionable.Solid
- LD A, C
+
+ LD A, B
+ LD B, C
+ LD C, A
LD H, $00
CP $10
diff --git a/entity/utils.gbasm b/entity/utils.gbasm
index e2b7c1c..8a44d6d 100644
--- a/entity/utils.gbasm
+++ b/entity/utils.gbasm
@@ -43,7 +43,7 @@
$end:
.END
-Get_Position_After_Move: ; entity (whatever alignement) in HL, direction to test in A, X Result in C, Y result in B, E being how much tile entity will move
+Get_Position_After_Move: ; entity (whatever alignement) in HL, direction to test in A, XY result in BC, E being how much tile entity will move
PUSH HL
PUSH DE
LD D, A
@@ -77,11 +77,6 @@ Get_Position_After_Move: ; entity (whatever alignement) in HL, direction to test
.ADD_A_TO_DIRECTION_BC
Get_Position_After_Move.Skip_Move:
-
- LD A, C
- LD C, B
- LD B, A
-
POP DE
POP HL
RET
diff --git a/playerattacks/hop.gbasm b/playerattacks/hop.gbasm
index cd69763..8b48f6d 100644
--- a/playerattacks/hop.gbasm
+++ b/playerattacks/hop.gbasm
@@ -158,9 +158,6 @@ Hop_Attack:
LD A, $02
.ADD_A_TO_DIRECTION_BC
- LD A, B
- LD B, C
- LD C, A
CALL =Is_Collisionable
CALL =Carve_Entity_Collision_Map
CP $00