From 74935d100edc32dac461a19191c966796b3f5bd5 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 22 Jun 2025 05:49:31 +0200 Subject: [PATCH] unit: obj reset is now in a sub routine --- src/rand.s | 37 ------------------------------------- src/sys.s | 6 ++++++ src/update.s | 3 +-- src/wram.s | 10 +--------- 4 files changed, 8 insertions(+), 48 deletions(-) diff --git a/src/rand.s b/src/rand.s index 0305c4c..1fb95f1 100644 --- a/src/rand.s +++ b/src/rand.s @@ -92,40 +92,3 @@ roll_d16: pop hl ret - - ; updates dice display if the timer is not 0 -dice_display_update: - ld a, [dd_timer] - cp a, 0 - ret z - - dec a ; timer-- - ld [dd_timer], a - - ; display sprite - call load_scroll - call load_unit_obj - - - ; set y - ld a, [dd_y] - mul8 a - add a, OBJ_OFF_Y - sub a, b - ld [hl+], a - - ; set x pos - ld a, [dd_x] - mul8 a - add a, OBJ_OFF_X - sub a, c - ld [hl+], a - - ; set tile - ld a, [dd_d16] - ld [hl+], a - - xor a, a - ld [hl], a - - ret diff --git a/src/sys.s b/src/sys.s index 078879d..1648baf 100644 --- a/src/sys.s +++ b/src/sys.s @@ -86,3 +86,9 @@ load_unit_obj: @load_unit_empty: ld hl, empty_oam ret + + ; resets unit obj +reset_unit_obj: + xor a, a + ld [unit_sprite], a + ret diff --git a/src/update.s b/src/update.s index 3327007..08290a1 100644 --- a/src/update.s +++ b/src/update.s @@ -30,8 +30,7 @@ update: ld [frame_count], a ; reset objects - xor a, a - ld [unit_sprite], a + call reset_unit_obj ld de, game_mode jp st_update diff --git a/src/wram.s b/src/wram.s index 79e7432..a160117 100644 --- a/src/wram.s +++ b/src/wram.s @@ -8,6 +8,7 @@ scratch: .adv 16 shadow_oam: .adv OBJSMAX * oamsize +shadow_oam_end: frame_ready: .adv 1 frame_count: .adv 1 @@ -25,15 +26,6 @@ game_mode: .adv st_size ; status text buffer status_text: .adv 32 -; dice display -; display the last d16 result -; at tile y/x for time frames -dd_d16: .adv 1 -dd_flags: .adv 1 -dd_y: .adv 1 -dd_x: .adv 1 -dd_timer: .adv 1 - ; offset into bg_update_queue bg_update_index: .adv 2 bg_update_queue: .adv bge_size * BGE_MAX -- 2.30.2