From 5c501e8faf6f57b8b7b9a526bf791c12c9570bfd Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Fri, 21 Nov 2025 18:08:08 +0100 Subject: [PATCH] actors: refactoring actor system --- src/actor.s | 33 ++++- src/debug.s | 122 ---------------- src/defs.s | 45 ++---- src/enemy.s | 7 - src/levels.s | 35 ++--- src/macros.inc | 22 +-- src/map.s | 2 - src/tiles.s | 375 +------------------------------------------------ src/ui.s | 115 +-------------- src/update.s | 10 -- src/video.s | 2 - src/wram.s | 16 +-- 12 files changed, 71 insertions(+), 713 deletions(-) diff --git a/src/actor.s b/src/actor.s index cc83bc4..0072e63 100644 --- a/src/actor.s +++ b/src/actor.s @@ -1 +1,32 @@ - ; common routines for both player and enemy + + ; update routines for each actor +actor_map_update_table: + + ; draw routine for each actor +actor_map_draw_table: + + ; combat update table +actor_combat_update_table: + + ; combat draw table +actor_combat_draw_table: + + + ; updates and draws an actor + ; calls different routines fro combat and map state + ; inputs: + ; hl: actor ptr +actors_map_update: + ; TODO: read type, get ptr from table + ; and call + ret + + + ; calls combat update and draw routines +actors_combat_update: + ; TODO: read type, get ptr from table + ; and call + ret + +act_shop_keeper: + actdef ACT_T_SHOP_KEEPER, 0, 10, 10, 0, 0 diff --git a/src/debug.s b/src/debug.s index edd387a..e69de29 100644 --- a/src/debug.s +++ b/src/debug.s @@ -1,122 +0,0 @@ - - ; checks debug flags and decides if - ; update should be suspended - ; calls debug_update - ; inputs: - ; debug_flags - ; returns: - ; a: 0 -> do not suspend - ; a: 1 -> do suspend -debug_should_suspend_update: - call debug_update - - ld a, [debug_flags] - and a, DEBUG_F_ENABLE - jr z, @do_not_suspend REL - - ; select button influences suspend - ld b, BTNSELECT - input_just - jr nz, @do_not_suspend REL -@do_suspend: - ld a, 0 - ret -@do_not_suspend: - ld a, 1 - ret - - - ; updates debug code - ; when in debug mode the - ; user can slow step through tile - ; updates -debug_update: - ld a, [debug_flags] - and a, DEBUG_F_ENABLE - jp z, @poll_toggle_debug - - ; debug mode is anebled here - ; TODO: implement debug code - - ; draw current update tile - ; using a cursor - call debug_current_tile_draw - -@poll_toggle_debug: - ; debug mode can be enabled by pressing select 4 times in a - ; row as the only input - - ; do nothing if no inputs were made this frame - ld a, [curr_inputs] - cp a, 0 - ret z - - ; if curr inputs matches prev inputs - ; also do nothing - ld b, a - ld a, [prev_inputs] - xor a, b - ret z - - ld b, BTNSELECT - input_just - jr z, @reset_enable_counter REL - ; if select was not the only button also reset - ld a, [curr_inputs] - and a, (~BTNSELECT) & 0xFF - jr nz, @reset_enable_counter REL - - ; counter++ - ld a, [debug_enable_count] - inc a - ld [debug_enable_count], a - - ; if counter is at 4 toggle DEBUG flag - cp a, 4 - ret nz ; do nothing if 0 - - ld a, [debug_flags] - xor a, DEBUG_F_ENABLE - ld [debug_flags], a - - ; make sure to reset the counter :^) -@reset_enable_counter: - xor a, a - ld [debug_enable_count], a - ret - - ; draws a cursor at the location - ; of the current update tile -debug_current_tile_draw: - ld a, 1 - call oamalloc - - ; y position - ld a, [scroll_y] - ld b, a - - ld a, [update_tile_y] - mul16 a - add a, OBJ_OFF_Y - sub a, b ; - scroll - ld [hl+], a - - ; x pos - ld a, [scroll_x] - ld b, a - - ld a, [update_tile_x] - mul16 a - add a, OBJ_OFF_X - sub a, b ; - scroll x - - ld [hl+], a - - ; tile - ld a, PLAYER_CURSOR_L - ld [hl+], a - - ; flags - xor a, a - ld [hl+], a - ret diff --git a/src/defs.s b/src/defs.s index 89f88c3..85df594 100644 --- a/src/defs.s +++ b/src/defs.s @@ -5,12 +5,12 @@ #define UI_STATUS_LINE shadow_ui+1 -#define TILES_ADJACENT_MAX 8 - .def int OAMDMAFN = 0xFF80 #define WRAM 0xC000 #define WRAMLEN 0xFFF +#define ACT_MAX 4 + #define NULL 0 #define STACK_BEGIN 0xDFFF @@ -27,7 +27,6 @@ #define UI_TILE_HEIGHT 4 ; player position offset to get center of tile -#define PLAYER_TILE_OFFSET 8 #define MAP_W 16 #define MAP_H 16 #define MAP_TILES (MAP_W * MAP_H) @@ -35,6 +34,8 @@ ; actor type enum .se 0 .de ACT_T_NULL, 1 +.de ACT_T_PLAYER, 1 +.de ACT_T_SHOP_KEEPER, 1 ; actor struct ; act_def @@ -47,6 +48,8 @@ .de act_p0, 1 ; state parameter .de act_state, 1 +.de act_hp, 1 +.de act_mp, 1 .de act_size, 0 @@ -71,46 +74,23 @@ ; tile type enum .se 0 .de TT_EMPTY, 1 -.de TT_WORKERS, 1 -.de TT_HIVE, 1 -.de TT_FOOD, 1 ; tile index enum ; order of tile defs in tiles.s .se 0 .de TI_EMPTY, 1 -.de TI_PLAYER_WORKERS, 1 -.de TI_PLAYER_HIVE, 1 -.de TI_ENEMY_WORKERS, 1 -.de TI_ENEMY_HIVE, 1 -.de TI_FOOD, 1 -.de TI_SIZE, 0 - - ; owner enum -.se 0 -.de TO_NULL, 1 -.de TO_PLAYER, 1 -.de TO_ENEMY, 1 ; tile flags .se 1 - ; set when the tile gained resources - ; this tick -.de TF_INC, 1 - ; set when the tile lost resources - ; this tick -.de TF_DEC, 2 ; tile struct .se 0 .de t_type, 1 .de t_flags, 1 - ; owning actor -.de t_owner, 1 - ; based on type - ; nnnn0000: resource meta info (optional) - ; 0000nnnn: current resource count (0-15) -.de t_resource, 1 + ; actor currently + ; standing on tile + ; 0 = player, 1-N = map actors +.de t_actor, 1 ; 2 bytes of custom state storage ; to be used by tile routine .de t_p0, 1 @@ -118,11 +98,6 @@ ; graphical tile .de t_tile, 1 .de t_size, 0 - - ; tile adjacent struct -.se 0 -.de ta_ptr, 2 -.de ta_size, 0 diff --git a/src/enemy.s b/src/enemy.s index a14c34c..8b13789 100644 --- a/src/enemy.s +++ b/src/enemy.s @@ -1,8 +1 @@ - ; inits enemy -enemy_init: - ret - - ; updates enemy AI -enemy_update: - ret diff --git a/src/levels.s b/src/levels.s index 82f79a7..8677f0f 100644 --- a/src/levels.s +++ b/src/levels.s @@ -1,46 +1,35 @@ ; level to cell map level_def_to_tile: dw tile_grass - dw tile_player_hive - dw tile_enemy_hive - dw tile_food ; tile grass .def int TGS = TI_EMPTY - ; tile player hive -.def int TPH = TI_PLAYER_HIVE - - ; tile enemy hive -.def int TEH = TI_ENEMY_HIVE - - ; tile food -.def int TFD = TI_FOOD ; level definitions ; levels always have a header ; with flags, tilesets to load - ; followed by a 16x16 tilemap + ; followed by a MAP_WxMAP_H tilemap ; the tilemap is an index into a tile lookup - ; table. The tile defs are then copied to a map_tiles table (16x16) + ; table. The tile defs are then copied to a map_tiles table (MAP_W*MAP_H) ; where each tile has values and its current state. The map can be drawn from this. l1: mapdef 0, map_r_nop, bank8000, bank8800, bank8C00, bank9000 - .db TPH, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD, TFD - .db TFD, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD - .db TFD, TFD, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS - .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS - .db TGS, TFD, TFD, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD, TGS, TGS, TGS, TFD, TFD - .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD - .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD - .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD - .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TFD - .db TGS, TGS, TGS, TFD, TFD, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TEH + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS + .db TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS, TGS diff --git a/src/macros.inc b/src/macros.inc index 8ed25f1..c8324a5 100644 --- a/src/macros.inc +++ b/src/macros.inc @@ -171,23 +171,25 @@ $1: ; inputs: ; $1: type ; $2: flags - ; $3: tile owner - ; $4: resource count - ; $5: tile gfx + ; $3: tile gfx #macro tiledef - .db $1, $2, $3, $4 - ; p0 and state + .db $1, $2, 0 + ; t_actor, p0 and state .db 0, 0 - .db $5 + .db $3 #endmacro ; defines a new actor ; inputs: ; $1: type ; $2: flags + ; $3: y + ; $4: x + ; $5: hp + ; $6: mp #macro actdef - .db $1, $2 - - ; placeholder for y, x p0 and state - .db 0, 0, 0, 0 + .db $1, $2, $3, $4 + ; p0 and state + .db 0, 0 + .db $5, $6 #endmacro diff --git a/src/map.s b/src/map.s index d073617..2f3d4bc 100644 --- a/src/map.s +++ b/src/map.s @@ -33,8 +33,6 @@ map_load: call player_init call ui_init - call tile_update_reset - ret ; loads a tileset diff --git a/src/tiles.s b/src/tiles.s index 0a8891f..86bb92e 100644 --- a/src/tiles.s +++ b/src/tiles.s @@ -1,385 +1,14 @@ ; tile definitions #define GFX_GRASS 0x20 -#define GFX_PHIVE 0x26 -#define GFX_EHIVE 0x46 -#define GFX_FOOD 0x08 -#define GFX_PWORKERS 0x28 -#define GFX_EWORKERS 0x48 - ; resets update tile to 0/0 -tile_update_reset: - xor a, a - ld [update_tile_y], a - ld [update_tile_x], a - - call tile_update_get - - ret - - ; inits the next tile - ; increments update_tile_y/x - ; resets when out of bounds -tile_update_get_next: - ld a, [update_tile_x] - inc a - cp a, MAP_W - jr nz, @not_y REL - ld a, [update_tile_y] - inc a - and a, MAP_H-1 - ld [update_tile_y], a - xor a, a ; reset x -@not_y: - ld [update_tile_x], a - - call tile_update_get - ret - - ; sets update_tile to the current selected tile - ; bsed on y/x position -tile_update_get: - ld a, [update_tile_y] - ld b, a - ld a, [update_tile_x] - ld c, a - call map_get_tile - - ld a, h - ld [update_tile], a - ld a, l - ld [update_tile+1], a - ret - - ; updates the next tile - ; in the queue - ; inputs: - ; next_update_tile - ; sets next_update_tile to next tile - ; wraps to first tile if end is reached -tile_update_selected: - call tile_update_get_next - - ld a, [update_tile] - ld d, a - ld a, [update_tile+1] - ld e, a - - call tile_update - - ; prepare the tile for drawing - ld a, [update_tile_y] - ld b, a - ld a, [update_tile_x] - ld c, a - call map_draw_tile_prep - - ret - - ; draws the recently updated tile - ; based on update_tile prep set in previous frame -tile_update_draw: - jp map_draw_tile - - - ; updates a tile with its - ; routine - ; inputs: - ; de: tile -tile_update: - push de - call tile_get_adjacent - pop de - - ld a, [de] ; load tile type - add a, a ; * 2 offset into table - - ld b, 0 - ld c, a ; bc = offset - - ld hl, tile_update_table - add hl, bc - - ; load ptr - ld a, [hl+] - ld b, a - ld a, [hl] - ld h, a - ld l, b - jp hl - - ; table of update routines - ; for each tile -tile_update_table: - dw tile_update_empty - dw tile_update_used - dw tile_update_hive - dw tile_update_food - -strz str_empty, "EMPTY " -strz str_hive, "HIVE " -strz str_used, "HILL " -strz str_food, "FOOD " - - ; mapping of tile ids to - ; the tile names -tile_str_table: - dw str_empty - dw str_used - dw str_hive - dw str_food - - ; gets the controlling actor of a tile - ; returns NULL if TO_NULL is set - ; inputs: - ; de: tile - ; returns: - ; bc: actor -tile_get_actor: - ld bc, NULL - ; TODO: - ret - - ; stores an adjacent tile - ; inputs: - ; $1: skip if x position equal - ; $2: tile offset based on bc - ; bc: current tile ptr - ; de: destination - ; returns: - ; de: next destination -#macro tile_adjacent_store -.beginscope - ; check if x is 0 - ; if so skip left tile - ld a, [update_tile_x] - cp a, $1 - jr z, @skip REL - - ; store left tile - ld hl, $2 - add hl, bc - ; move to new position - - ; store tile - ld a, h - ld [de], a - inc de - ld a, l - ld [de], a - inc de - - jr @done REL -@skip: - inc de - inc de -@done: -.endscope -#endmacro - - ; stores pointers to - ; all adjacent tiles - ; stores NULL if adjacent tile is out - ; of bounds - ; also counts the amount of seen types - ; in tiles_adjacen_types -tile_get_adjacent: - ; clear adjacent tiles - ; stored by previous frame - ld hl, tiles_adjacent - ld bc, ta_size * TILES_ADJACENT_MAX - ld de, 0 - call memset - - ; bc = y/x - ld a, [update_tile_y] - ld b, a - ld a, [update_tile_x] - ld c, a - call map_get_tile - - ; hl = current tile - push hl - pop bc ; bc = current tile - - ; de = destination - ld de, tiles_adjacent - - ; now get all tiles adjacent - - ; 1) get tiles above (up to 3 tiles) - - ; check if y is already 0, if so skip - ld a, [update_tile_y] - cp a, 0 - jp z, @skip_above - ; up/center tile - tile_adjacent_store 0xFF, (-1 * (t_size * MAP_W)) & 0xFFFF - ; up/left tile - tile_adjacent_store 0, (-1 * (t_size * (MAP_W+1))) & 0xFFFF - ; up/right tile - tile_adjacent_store (MAP_W-1), (-1 * (t_size * (MAP_W-1))) & 0xFFFF - -@skip_above: - - ; 2) get tiles left and right (up to 2 tiles) - - ; left - tile_adjacent_store 0, (-1 * t_size) & 0xFFFF - ; right - tile_adjacent_store (MAP_W-1), t_size - - ; 3) get tiles below (up to 3 tiles) - - ; check if y is already MAP_H-1 if so skip - ld a, [update_tile_y] - cp a, MAP_H-1 - jp z, @skip_below - - ; down/center tile - tile_adjacent_store 0xFF, (t_size * MAP_W) - ; down/left tile - tile_adjacent_store 0, (t_size * (MAP_W+1)) - ; down/right tile - tile_adjacent_store (MAP_W-1), (t_size * (MAP_W-1)) -@skip_below: - - ret - - ; checks one tile for a type match - ; inputs: - ; hl: ptr to next tile - ; a: expected tile type - ; b: current tile match count - ; returns: - ; incremnets b if type matches - ; hl+=2 (next ptr) - ; preserves: - ; a -#macro tile_count_adjacent_check -.beginscope - push af - ld a, [hl+] - ld d, a - ld a, [hl+] - ld e, a - ; hl = next ptr - - ; de = ptr to tile - push hl - ld hl, t_type - add hl, de - ; hl = tile type - ld a, [hl] - ld c, a ; c = tile type - pop hl - - pop af - cp a, c - ; check if match - jr nz, @no_match REL - inc b ; result++ -@no_match: -.endscope -#endmacro - - ; counts adjacent tiles of specific type - ; inputs: - ; a: expected type - ; returns: - ; a: count of type -tile_count_adjacent: - ; b = result - ld b, 0 - - ; hl = ptrs to tiles - ld hl, tiles_adjacent - - ; check 8 tiles - tile_count_adjacent_check - tile_count_adjacent_check - tile_count_adjacent_check - tile_count_adjacent_check - - tile_count_adjacent_check - tile_count_adjacent_check - tile_count_adjacent_check - tile_count_adjacent_check - - ; result is in a now - ld a, b - ret - - - ; updates empty tile - ; inputs: - ; de: tile -tile_update_empty: - ld a, TT_FOOD - push de - call tile_count_adjacent - pop de - - ; if 2 adjacnet food tiles - ; turn into food - cp a, 2 - ret c - - push de - pop hl ; hl = dst - ld de, tile_food - ld bc, t_size - call memcpy - ret - - ; updates controlled tile - ; inputs: - ; de: tile -tile_update_used: - ret - - ; updates hive - ; inputs: - ; de: tile -tile_update_hive: - ret - - ; updates food tile - ; inputs: - ; de: tile -tile_update_food: - inc de ; flags - ld a, [de] - inc a - ld [de], a - ret - ; maps from tile ids ; to tile presets (tile index) tile_id_table: dw tile_grass - dw tile_grass - dw tile_player_hive - dw tile_grass - dw tile_enemy_hive - dw tile_food + dw tile_grass tile_grass: - tiledef TT_EMPTY, 0, TO_NULL, 0, GFX_GRASS - -tile_player_hive: - tiledef TT_HIVE, 0, TO_PLAYER, 0, GFX_PHIVE - -tile_enemy_hive: - tiledef TT_HIVE, 0, TO_ENEMY, 0, GFX_EHIVE - -tile_food: - tiledef TT_FOOD, 0, 0, TO_NULL, GFX_FOOD - -tile_player_workers: - tiledef TT_WORKERS, 0, TO_PLAYER, 0, GFX_PWORKERS - -tile_enemy_workers: - tiledef TT_WORKERS, 0, TO_ENEMY, 0, GFX_EWORKERS + tiledef TT_EMPTY, 0, GFX_GRASS diff --git a/src/ui.s b/src/ui.s index 45e6107..4507858 100644 --- a/src/ui.s +++ b/src/ui.s @@ -13,8 +13,6 @@ ; inits UI ui_init: - ld hl, ui_draw_nop - call ui_request_draw ret ; updates UI @@ -23,124 +21,13 @@ ui_init: ; the player cursor enters a new tile ; sets current tile y/x and ptr ui_update: - ; check y - ld a, [current_tile_y] - ld b, a - ld a, [player+act_pos_y] - add a, PLAYER_TILE_OFFSET - div16 a - ld [current_tile_y], a - cp a, b ; are they differnet? - jr nz, @draw_new REL - - ; check x - ld a, [current_tile_x] - ld b, a - ld a, [player+act_pos_x] - add a, PLAYER_TILE_OFFSET - div16 a - ld [current_tile_x], a - cp a, b ; ar they dfifernet? - ret z ; no need to proceed - -@draw_new: - - ; save current tile - ; this can be used in various places - ld a, [current_tile_y] - ld b, a - ld a, [current_tile_x] - ld c, a - call map_get_tile - ld a, h - ld [current_tile], a - ld a, l - ld [current_tile+1], a - - ld hl, ui_draw_tile_name - call ui_request_draw - ret - - ; requests a draw - ; for UI information about the current tile - ; inputs: - ; hl: routine ptr to draw -ui_request_draw: - ld a, h - ld [ui_draw_routine], a - ld a, l - ld [ui_draw_routine+1], a ret - ; no draw -ui_draw_nop: - ret - ; ui draw tile name -ui_draw_tile_name: - ld a, [current_tile] - ld h, a - ld a, [current_tile+1] - ld l, a - - push hl - - ld a, [hl] ; load type - add a, a ; * 2 for offset - - ld d, 0 - ld e, a - ld hl, tile_str_table - add hl, de - - ld a, [hl+] - ld b, a - ld a, [hl] - ld h, a - ld a, b - ld l, a - - ld de, UI_TILE_NAME+2 - call puts - - ld hl, ui_draw_nop - call ui_request_draw - - ; draw owner - pop hl - ld de, t_owner - add hl, de - - ld a, [hl] - cp a, TO_NULL - jr nz, @not_null REL - - ld a, 0xF4 ; ' ' - ld [UI_TILE_NAME], a - ret -@not_null: - - cp a, TO_PLAYER - jr nz, @not_player REL - ld a, 0xE9 ; P - ld [UI_TILE_NAME], a - ret -@not_player: - - ld a, 0xDE ; E - ld [UI_TILE_NAME], a - ret - ; draws the entire UI ; only call during blank ui_draw: - ld a, [ui_draw_routine] - ld h, a - ld a, [ui_draw_routine+1] - ld l, a - xor a, h - ret z - jp hl + ret diff --git a/src/update.s b/src/update.s index 3bab360..97cf79b 100644 --- a/src/update.s +++ b/src/update.s @@ -9,20 +9,10 @@ update_game: ; player should update even in debug mode call player_update call player_draw - -#ifdef DEBUG - ; do we skip update this frame? - call debug_should_suspend_update - cp a, 0 - ret z -#endif ; tick rng every frame call rand - call enemy_update - - call tile_update_selected call ui_update diff --git a/src/video.s b/src/video.s index ae27dbf..3de459d 100644 --- a/src/video.s +++ b/src/video.s @@ -21,8 +21,6 @@ vblank: call poll_inputs call ui_draw - - call tile_update_draw ; dma previous frame's oam call OAMDMAFN diff --git a/src/wram.s b/src/wram.s index cae2040..cc6d33f 100644 --- a/src/wram.s +++ b/src/wram.s @@ -70,8 +70,9 @@ animation_frame: .adv 1 srand: .adv 2 +actors: player: .adv act_size -enemy: .adv act_size +map_actors: .adv act_size * ACT_MAX tmp_y: .adv 1 tmp_x: .adv 1 @@ -80,23 +81,10 @@ tmp_x: .adv 1 map: .adv 2 ; ptr to current tile to be updated -tile_curr: .adv 2 tiles: .adv t_size * MAP_TILES tiles_end: .adv 0 - ; list of pointers - ; to all adjacent tiles - ; set to NULL if no tile is adjacent - ; byte 0: h, byte 1: l - ; always in the followign order: - ; tl, tc, tr - ; cl, cr - ; bl, bc, br - ; tiles that are not mapped are left with 00 00 as a pointer -tiles_adjacent: .adv ta_size * TILES_ADJACENT_MAX - -ui_draw_routine: .adv 2 ; the following valuess are set by ui_update ; coordinates of current tile -- 2.30.2