From 5ab0c46190d2e704d0edaa8e50ee867e3f2f9e99 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 19 Sep 2025 10:48:34 +0200 Subject: [PATCH] defs: wip rowpatterns --- TODO.md | 2 ++ src/defs.s | 16 +++++++++++++--- src/main.s | 1 + src/map.s | 19 ++++++++----------- src/rowpatterns.s | 0 src/wram.s | 7 +++++-- 6 files changed, 29 insertions(+), 16 deletions(-) create mode 100644 src/rowpatterns.s diff --git a/TODO.md b/TODO.md index b988cd2..3475240 100644 --- a/TODO.md +++ b/TODO.md @@ -41,6 +41,7 @@ ## actors: [ ] actors have a specific collision box +[ ] actors update code is based on type ## map @@ -53,6 +54,7 @@ - enemy spwaner (spwans n enemies of a specific type) - enemies always spawn slightly off screen and walk in once a spwaner is triggered [ ] scrolling is only possible up. moving back cannot be done +[ ] maps can run code when objects are loaded based on type ## sate machine diff --git a/src/defs.s b/src/defs.s index 76868ed..df046ab 100644 --- a/src/defs.s +++ b/src/defs.s @@ -83,7 +83,17 @@ .def int DIRLEFT = BTNLEFT .def int DIRRIGHT = BTNRIGHT + + ; row pattern struct +.se 0 +.de pat_tilemap, 10 +.de pat_size, 0 -; mapgen flags -.se 1 -.de MAPGEN_F_NO_ACT_SG, 1 + ; map object struct +.se 0 +.de mo_type, 1 +.de mo_flags, 1 +.de mo_page, 1 +.de mo_row, 1 +.de mo_dat, 4 +.de mo_size, 0 diff --git a/src/main.s b/src/main.s index 24402c5..1a46e01 100644 --- a/src/main.s +++ b/src/main.s @@ -60,6 +60,7 @@ main: #include "ui.s" #include "audio.s" #include "map.s" +#include "rowpatterns.s" #include "math.s" #include "game.s" diff --git a/src/map.s b/src/map.s index 916032d..480856f 100644 --- a/src/map.s +++ b/src/map.s @@ -1,12 +1,9 @@ - ; loads a map - ; including the required tileset - ; sets current page to 0 - ; draws page 0 to the screen - ; loads map objects -map_load: - ret - - ; draws a single row of tiles:w -map_draw_row: - ret + ; tile space +.def int TS = 0x30 +pat_empty: +.db TS, TS, TS, TS, TS, TS, TS, TS, TS, TS + + ; enf of level row pattern +pat_eol: +.db 0xFF diff --git a/src/rowpatterns.s b/src/rowpatterns.s new file mode 100644 index 0000000..e69de29 diff --git a/src/wram.s b/src/wram.s index 5e2f38c..2ebcb35 100644 --- a/src/wram.s +++ b/src/wram.s @@ -60,6 +60,9 @@ srand: .adv 2 player_unit: .adv 0 actors: .adv act_size * ACTS_MAX + ; current page the map is on map_current_page: .adv 1 - -state_end: + ; current row that is being drawn +map_current_row: .adv 1 + ; current pattern to be drawn +map_current_pattern: .adv 2 -- 2.30.2