Fix GameBoy VRAM shared memory overlap bug between background tiles and stamina UI sprites
This commit is contained in:
+2
-1
@@ -95,7 +95,8 @@ void engine_init(void) {
|
||||
set_sprite_data(player_TILE_COUNT, enemy_TILE_COUNT, enemy_tiles);
|
||||
set_sprite_data(player_TILE_COUNT + enemy_TILE_COUNT, gameover_TILE_COUNT, gameover_tiles);
|
||||
set_sprite_data(player_TILE_COUNT + enemy_TILE_COUNT + gameover_TILE_COUNT, victory_TILE_COUNT, victory_tiles);
|
||||
set_sprite_data(player_TILE_COUNT + enemy_TILE_COUNT + gameover_TILE_COUNT + victory_TILE_COUNT, stamina_TILE_COUNT * 2, stamina_tiles);
|
||||
// Load stamina_tiles AFTER the background tiles to prevent VRAM overlap in the shared block (indices > 127)
|
||||
set_sprite_data(tiles_TILE_COUNT, stamina_TILE_COUNT * 2, stamina_tiles);
|
||||
|
||||
// SPAWN DEL GIOCATORE
|
||||
player_lx = 1;
|
||||
|
||||
+2
-1
@@ -57,7 +57,8 @@ void update_stamina_display(void) {
|
||||
uint8_t num_pixels = temp / 100;
|
||||
|
||||
// Offset di base nella VRAM dove sono caricati i tile della stamina
|
||||
uint8_t base_tile = player_TILE_COUNT + enemy_TILE_COUNT + gameover_TILE_COUNT + victory_TILE_COUNT; // 44
|
||||
// Caricato a partire da tiles_TILE_COUNT per non sovrascrivere la VRAM condivisa (>=128)
|
||||
uint8_t base_tile = tiles_TILE_COUNT;
|
||||
|
||||
for (uint8_t i = 0; i < 5; i++) {
|
||||
uint8_t tile_idx;
|
||||
|
||||
Reference in New Issue
Block a user