From 2be83d7ba32823e5a78334deeed5c96b3e246d55 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 24 Oct 2024 20:24:09 +0200 Subject: [PATCH] wip: map actor loading --- src/map.s | 30 ++++++++++++++++++++++++++++++ src/video.s | 6 +++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/map.s b/src/map.s index 83845c2..f6682d9 100644 --- a/src/map.s +++ b/src/map.s @@ -32,6 +32,36 @@ ; curr_room_init_act: ptr to initial actors to be loaded map_load: call room_draw + call room_load_actors + ret + + ; loads actors from + ; [curr_room_init_act] + ; into the active actor table +room_load_actors: + ; clear actor table + ld d, 0 + ld bc, ACTORS_MAX * actor_size + ld hl, actor_table + call memset + + ; hl = ptr to initial actor table + ld hl, curr_room_init_act + ld a, [hl+] + ld d, a + ld a, [hl] + ld e, a + ; de = length...source table + + ld b, 0 + ld a, [de] + ld e, a ; be = len + + inc de ; de = source table + ld hl, actor_table ; hl = dst + call memcpy + + ret ; maps are collections of rooms diff --git a/src/video.s b/src/video.s index 06108ab..9cbdffb 100644 --- a/src/video.s +++ b/src/video.s @@ -93,8 +93,12 @@ video_init: ldhi a, base_room_flags ld [curr_room_flags+1], a - call room_draw + ldlo a, base_room_actors + ld [curr_room_init_act], a + ldhi a, base_room_actors + ld [curr_room_init_act+1], a + call map_load ; set up bgp ld a, BGP -- 2.30.2