From: Lukas Krickl Date: Sun, 21 Sep 2025 04:39:09 +0000 (+0200) Subject: defs: removed y_hi from actors and rectangles X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=8333cf8ad7d199e509b3573d2e9762d1811e99a4;p=gbrg%2F.git defs: removed y_hi from actors and rectangles --- diff --git a/src/actor.s b/src/actor.s index d7a2a64..3de0ba1 100644 --- a/src/actor.s +++ b/src/actor.s @@ -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 diff --git a/src/defs.s b/src/defs.s index 84bce88..c3399a5 100644 --- a/src/defs.s +++ b/src/defs.s @@ -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 diff --git a/src/macros.inc b/src/macros.inc index e29fe98..c0f36f3 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -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: diff --git a/src/player.s b/src/player.s index b894661..c71d597 100644 --- a/src/player.s +++ b/src/player.s @@ -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 diff --git a/src/rectangle.s b/src/rectangle.s index f41e049..8b3b22f 100644 --- a/src/rectangle.s +++ b/src/rectangle.s @@ -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 diff --git a/src/video.s b/src/video.s index 0aad5f0..e4bb9d4 100644 --- a/src/video.s +++ b/src/video.s @@ -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