From 62d1bd9d0e9a957024b7fa165840321d9383bb1e Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 30 Jan 2026 07:57:11 +0100 Subject: [PATCH] actor: Added default hp setter in tact init --- src/action.s | 7 +++++-- src/actor.s | 13 +++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/action.s b/src/action.s index eb113b5..9474f7c 100644 --- a/src/action.s +++ b/src/action.s @@ -36,12 +36,15 @@ action_attack: ld h, c or a, h ret z ; no actor here... - + + push hl ; hl = actor + call act_attr_get_attack_damage + ; a = attack damage (source) + ld b, a ; b = damage ; TODO: for now just kill the actor ; later we need actual damage calculations - push hl pop de call act_die diff --git a/src/actor.s b/src/actor.s index 4479668..f347edf 100644 --- a/src/actor.s +++ b/src/actor.s @@ -261,6 +261,19 @@ act_draw: ; inputs: ; de: actor ptr act_init_set_tact: + push de + call act_attr_get_max_hp + ; bc = max hp + pop de + ld hl, act_hp + add hl, de + ; set default hp + ld a, b + ld [hl+], a + ld a, c + ld [hl], a + + call act_set_tact ret -- 2.30.2