defs: removed y_hi from actors and rectangles
authorLukas Krickl <lukas@krickl.dev>
Sun, 21 Sep 2025 04:39:09 +0000 (06:39 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 21 Sep 2025 04:39:09 +0000 (06:39 +0200)
src/actor.s
src/defs.s
src/macros.inc
src/player.s
src/rectangle.s
src/video.s

index d7a2a6433f8f1480bd09ad91188d8950c0f63379..3de0ba1068f32dec6593cb444fbd45f4816308a6 100644 (file)
@@ -29,13 +29,8 @@ actor_draw:
        ld b, a
        ld a, [de]
        add a, OBJ_OFF_Y
-       inc de ; de = y_hi 
        add a, b ; a = y postion
 
-       ld b, a
-       ld a, [de] ; a = y_hi
-       adjust_y_row
-
        inc de ; de = x pos
 
        ld [hl+], a
index 84bce887d0cc139332e07801737a838371db16bb..c3399a5161e6c235dacc6f3024424b796e93deab 100644 (file)
@@ -47,7 +47,6 @@
        ; if flags == 0 the rectangle is free
 .de r_flags, 1
 .de r_pos_y, 1
-.de r_pos_y_hi, 1
 .de r_pos_x, 1
 .de r_h, 1
 .de r_w, 1
@@ -69,7 +68,6 @@
 .de act_flags, 1
 
 .de act_pos_y, 1 ; y/x position
-.de act_pos_y_hi, 1 ; high byte of 16 bit y position 
 .de act_pos_x, 1
 
   ; custom parameter
index e29fe98b1ea5a749629f03dff68194d7ae3fc43f..c0f36f31cf2bc9ba403c6930e6a38169013617d8 100644 (file)
@@ -181,7 +181,7 @@ $1:
 
        ; placeholder for y, row and x
        ; since those are set at runtime
-       .db 0, 0, 0
+       .db 0, 0
 
        .db $3
 
@@ -193,7 +193,7 @@ $1:
        
        ; placeholder for collision rectangle
        ; since those are runtime values
-       .db 0, 0, 0, 0, 0, 0
+       .db 0, 0, 0, 0, 0
 #endmacro
        
        ; defines a map object
@@ -207,29 +207,6 @@ $1:
        dw $4
 #endmacro
        
-       ; adjusts an input position 
-       ; to draw correctly based on the current map row
-       ; inputs:
-       ;               a: hi y position
-       ;               b: unadjusted lo y position
-       ;       returns:
-       ;               a: real y position (or 0 if out of bounds)
-       ;       uses: a, b, c
-#macro adjust_y_row
-.beginscope
-       ld c, a
-       ld a, [map_curr_row]
-       div16 a ; 16 rows per screen page -> row count to hi y position
-       cp a, c
-       jr c, @zero REL
-
-       ld a, b 
-       jr @done REL
-@zero:
-       xor a, a
-@done:
-.endscope
-#endmacro
        
        ; defines a rectangle
        ; inputs:
index b8946617569a5858736d892591b9fb5b6d4c9852..c71d59751ed4d29dede488c40b19710c2d314755 100644 (file)
@@ -8,9 +8,6 @@ player_init:
        ld a, 0
        ld [player+act_pos_x], a
 
-       ld a, 0 
-       ld [player+act_pos_y_hi], a
-
        ld a, 0x30 ; initial next scroll
        ld [player_next_scroll_y], a
        ret
@@ -94,17 +91,11 @@ player_try_scroll_up:
        ;               b/c: y/x movement
        ;       returns:
        ;               b/c: new y/x position
-       ;                 d: new y hi position
 player_stage_move_p:
        ld a, [player+act_pos_y]
        add a, b
        ld b, a
 
-       ld a, [player+act_pos_y_hi]
-       adc a, 0
-       ld [player+act_pos_y_hi], a
-       ld d, a
-
        ld a, [player+act_pos_x]
        add a, c
        ld c, a
@@ -116,17 +107,11 @@ player_stage_move_p:
        ;               b/c: y/x movement
        ;       returns:
        ;               b/c: new y/x position
-       ;                 d: new y hi position
 player_stage_move_n:
        ld a, [player+act_pos_y]
        sub a, b
        ld b, a
 
-       ld a, [player+act_pos_y_hi]
-       sbc a, 0
-       ld [player+act_pos_y_hi], a
-       ld d, a
-
        ld a, [player+act_pos_x]
        sub a, c
        ld c, a
@@ -138,7 +123,6 @@ player_stage_move_n:
        ; moves scroll and performs map loads if needed
        ; inputs:
        ;               b/c: new y/x position
-       ;               d: new y hi position
 player_try_move:
        ld a, b
        ld [player+act_pos_y], a
@@ -146,8 +130,6 @@ player_try_move:
        ld a, c
        ld [player+act_pos_x], a
 
-       ld a, d
-       ld [player+act_pos_y_hi], a
        ret
 
        ; draws the special player actor
index f41e049f7fc955711ee7458a5e5e73a1ddf766a2..8b3b22f990d7d365fe88759726978070ab259b53 100644 (file)
@@ -1,3 +1,10 @@
+       ; limitations:
+       ;               positions can never wrap around a page
+       ;   in this engine
+       ;               all positions are 8-bit only
+       ;               great care must be taken to avoid 
+       ;   collisions from overlapping a page swap!
+
 
        ; attempts to add a rectangle
        ; to the rectangle buffer
@@ -29,10 +36,6 @@ rect_try_add:
        ld a, b
        ld [hl+], a
 
-       ; wirte y hi
-       xor a, a
-       ld [hl+], a
-
        ; wirte x
        ld a, c
        ld [hl+], a
index 0aad5f00df3a8a4707e1c5922a9994a5ff445a98..e4bb9d43a516b7465294e81ac2f74adb532bfa84 100644 (file)
@@ -87,10 +87,6 @@ scroll_up_adjust:
        cp a, 0x70
        call nc, actor_despawn
        pop af
-       
-       ld a, [hl]
-       adc a, 0
-       ld [hl], a
 
        pop hl
        
@@ -106,10 +102,6 @@ scroll_up_adjust:
        add a, 1
        ld [player+act_pos_y], a
 
-       ld a, [player+act_pos_y_hi]
-       adc a, 0
-       ld [player+act_pos_y_hi], a
-
        ; TODO: adjust rectangles
        ret