From d1ab7020a9d7294d3fadf563e299038681dc7e33 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 24 Aug 2025 08:33:02 +0200 Subject: [PATCH] action: Added miss text Fixed actor lookup returning actors of type NULL --- src/action.s | 10 ++++++++-- src/strings.s | 4 ++++ src/unit.s | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/action.s b/src/action.s index d121c6b..b9785a5 100644 --- a/src/action.s +++ b/src/action.s @@ -228,11 +228,10 @@ unit_action_attack_damage_calc: call unit_attack_get_attack_tile call unit_find_at - ldnull bc ld a, h or a, l pop de - ret z ; no unit found + jp z, @miss ; no unit found push hl pop bc @@ -247,6 +246,13 @@ unit_action_attack_damage_calc: ldnull bc ret +@miss: + ld hl, STR_MISS + ld de, UI_STATUS_LINE + call puts + call ui_request_redraw + ldnull bc + ret ; default attack state diff --git a/src/strings.s b/src/strings.s index 8731dae..d3b6f65 100644 --- a/src/strings.s +++ b/src/strings.s @@ -71,6 +71,10 @@ STR_HIT_FOR: .str "hit for " .db 0 +STR_MISS: +.str "miss" +.db 0 + STR_SLASH: .str "/" .db 0 diff --git a/src/unit.s b/src/unit.s index 11971a4..6e36a23 100644 --- a/src/unit.s +++ b/src/unit.s @@ -837,6 +837,15 @@ unit_find_at: push af push hl + push hl + ; do not find type null + ld de, act_type + add hl, de + ld a, [hl] + pop hl + cp a, 0 + jr z, @no_match REL + ld de, act_pos_y add hl, de ; hl = y pos -- 2.30.2