From: Lukas Krickl Date: Sat, 28 Jun 2025 10:11:39 +0000 (+0200) Subject: actor: fixed movement being slow when picking two directions X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=b19e8c938828a25bb971c741a61d5c81b2a1e0c1;p=gbrg%2F.git actor: fixed movement being slow when picking two directions This was caused due to try_move_x destroying registers. The fix was to simply push and pop de and hl. --- diff --git a/BUGS.md b/BUGS.md index fa76b8e..b5b30c1 100644 --- a/BUGS.md +++ b/BUGS.md @@ -1,6 +1,4 @@ # Known Bugs -## Movement in multiple directions slows donw movement to a crawl -When pressing two direction buttons movement speed calculations slow down a lot. diff --git a/src/unit.s b/src/unit.s index 7768801..6a38339 100644 --- a/src/unit.s +++ b/src/unit.s @@ -221,8 +221,12 @@ unit_handle_inputs: input_held BTNUP jr z, @notup REL - + + push de + push hl call unit_try_move_up + pop hl + pop de pop bc ld bc, st_unit_delay_to_active @@ -232,8 +236,12 @@ unit_handle_inputs: input_held BTNDOWN jr z, @notdown REL + push de + push hl call unit_try_move_down - + pop hl + pop de + pop bc ld bc, st_unit_delay_to_active push bc @@ -242,7 +250,11 @@ unit_handle_inputs: input_held BTNLEFT jr z, @notleft REL + push de + push hl call unit_try_move_left + pop hl + pop de pop bc ld bc, st_unit_delay_to_active