aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO1
-rw-r--r--enemiesattacks/freeze.gbasm2
-rw-r--r--entity/init.gbasm44
-rw-r--r--gui.gbasm4
-rw-r--r--map/objects.gbasm9
5 files changed, 57 insertions, 3 deletions
diff --git a/TODO b/TODO
index 8e125ac..babb6aa 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,6 @@
Bugs:
-> Emulator crash with "not implemented: Only XKB keymaps are supported when unfocused (or workspace change maybe ?)
-> There is no indicator that the max health is 20
- -> The bunny should not be able to spawn on the stairs and the enemies should not be able to spawn on top of another entity
Need to be refactored:
-> main is messy and unreadable
diff --git a/enemiesattacks/freeze.gbasm b/enemiesattacks/freeze.gbasm
index 4c755fd..c8abd78 100644
--- a/enemiesattacks/freeze.gbasm
+++ b/enemiesattacks/freeze.gbasm
@@ -28,5 +28,7 @@ Freeze_Enemy_Attack: ; Direction to face in E. Result in BC (XY), Direction in D
CALL =Fix_Bunny_screen
LD A, $04
LD $mem_bunny_status_clear_turn_counter, A
+ LD A, $enum_dungeon_mode
+ LD $mem_requested_mode, A
RET
diff --git a/entity/init.gbasm b/entity/init.gbasm
index 60edff6..d035820 100644
--- a/entity/init.gbasm
+++ b/entity/init.gbasm
@@ -48,7 +48,20 @@ Initialize_Entities:
INC A
CALL =RNG_Bound
ADD D
- LD (HL+), A
+
+ LD (HL), A
+
+ PUSH BC
+ LD C, (HL)
+ DEC HL
+ LD B, (HL)
+ INC HL
+
+ CALL =Carve_Entity_Collision_Map
+
+ POP BC
+
+ INC HL
LD A, $enum_direction_down
LD (HL+), A
@@ -152,6 +165,7 @@ Initialize_Enemy: ; HL => pointer to entity struct
LD B, high($mem_room_list)
+ ; X
LD A, (BC)
LD D, A
INC BC
@@ -172,7 +186,33 @@ Initialize_Enemy: ; HL => pointer to entity struct
INC A
CALL =RNG_Bound
ADD D
- LD (HL+), A
+ LD (HL), A
+
+ ; Check if spawning on collisionable tile
+ PUSH BC
+ LD C, (HL)
+ DEC HL
+ LD B, (HL)
+ INC HL
+
+ CALL =Is_Collisionable
+ CP $00
+ JR Z, =.no_collision
+
+ XOR A
+ LD (HL-), A
+ LD (HL-), A
+ LD (HL-), A
+
+ POP BC
+ RET
+
+ .no_collision:
+ CALL =Carve_Entity_Collision_Map
+
+ POP BC
+
+ INC HL
; Direction
LD A, $03
diff --git a/gui.gbasm b/gui.gbasm
index 3639b04..a22c0af 100644
--- a/gui.gbasm
+++ b/gui.gbasm
@@ -272,6 +272,10 @@ Check_Open_Menu_button:
CP $enum_dungeon_mode
RET NZ
+ LD A, $mem_bunny_status
+ BIT 0, A
+ RET NZ
+
LD A, $mem_last_button_action
AND $08
LD B, A
diff --git a/map/objects.gbasm b/map/objects.gbasm
index 6d084aa..5bedeee 100644
--- a/map/objects.gbasm
+++ b/map/objects.gbasm
@@ -14,6 +14,7 @@ Initialize_Objects:
Spawn_object_in_random_room: ; Object tile in A, Object jump table id in E, Object pointer in HL
LD (HL+), A
+ .place_in_random_room:
LD A, $mem_number_of_rooms
CALL =RNG_Bound
SLA A
@@ -44,8 +45,16 @@ Spawn_object_in_random_room: ; Object tile in A, Object jump table id in E, Obje
ADD D
LD (HL), A
+ LD C, (HL)
+
DEC HL
+ LD B, (HL)
+
+ CALL =Is_Collisionable
+ CP $00
+ JR NZ, =.place_in_random_room
+
LD BC, $mem_object_list
Object_check_collisions.loop:
LD A, (BC)