diff options
author | Astatin <[email protected]> | 2025-02-25 16:54:34 +0900 |
---|---|---|
committer | Astatin <[email protected]> | 2025-02-25 16:54:34 +0900 |
commit | b21954eb05d9285ed7542a1f42ed755a147782a8 (patch) | |
tree | 935794c0eb59ff484d4e9c3a9849d588fbd5919b /map | |
parent | 18d7d064daf704193f8dff6b2ef3ae68b7fc3aac (diff) |
Fix initialization and flickering issues
Diffstat (limited to 'map')
-rw-r--r-- | map/objects.gbasm | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/map/objects.gbasm b/map/objects.gbasm index dd89e87..6d084aa 100644 --- a/map/objects.gbasm +++ b/map/objects.gbasm @@ -4,14 +4,14 @@ Initialize_Objects: LD $mem_map_loading_flags, A LD HL, $mem_object_list LD BC, $0080 - CALL =bzero + CALL =bff LD HL, $mem_object_list CALL =Spawn_stairs CALL =Spawn_carrot CALL =Spawn_leaf RET -Spawn_object_in_random_room: ; Object tile in A, Object jump table id in E +Spawn_object_in_random_room: ; Object tile in A, Object jump table id in E, Object pointer in HL LD (HL+), A LD A, $mem_number_of_rooms @@ -214,18 +214,25 @@ Display_Object: AND $f8 LD L, A - LD A, (HL+) + LD A, (HL) + CP $FF + RET Z LD C, A + CP $00 + JR NZ, =.skip_remove_object_after_display + LD (HL), $FF + .skip_remove_object_after_display: + INC HL LD A, (HL+) ADD $80 LD D, A LD A, $mem_viewport_x SUB $83 CP D - JR NC, =Display_Objects.End + RET NC ADD $0e CP D - JR C, =Display_Objects.End + RET C LD A, D SUB $80 LD D, A @@ -236,10 +243,10 @@ Display_Object: LD A, $mem_viewport_y SUB $83 CP B - JR NC, =Display_Objects.End + RET NC ADD $0e CP B - JR C, =Display_Objects.End + RET C LD A, B SUB $80 LD B, A @@ -276,7 +283,6 @@ Display_Object: LD A, C LD (DE), A - Display_Objects.End: RET Display_Objects.Nothing: |