From 8871729a65615df0eab213bbbf942abe75771704 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 8 Jul 2023 22:35:16 +0100 Subject: Avoid drawing the whole screen on each frame This allows supporting 386DX "just about" (there will be flickering). --- src/map.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/map.c') diff --git a/src/map.c b/src/map.c index e5e67d1..5599ae9 100644 --- a/src/map.c +++ b/src/map.c @@ -74,8 +74,8 @@ void map_init(const uint8_t map[]) } #endif - e->x = ent[1] * MAP_TILE_W; - e->y = ent[2] * MAP_TILE_H; + e->ox = e->x = ent[1] * MAP_TILE_W; + e->oy = e->y = ent[2] * MAP_TILE_H; e->dir = ent[3] & 1; init[*ent - 1](e); @@ -98,15 +98,8 @@ void map_render() src.y = (t / MAP_TILESET_COLS) * MAP_TILE_H; blitrc(binary_tiles_start, &src, &dst); - } - - for (uint8_t y = 0; y < MAP_H; y++) - for (uint8_t x = 0; x < MAP_W; x++) - { - dst.x = x * MAP_TILE_W; - dst.y = y * MAP_TILE_H + MAP_OFFS_Y; - uint8_t t = gold[x + y * MAP_W]; + t = gold[x + y * MAP_W]; /* not gold, skip! */ if (t == 0xff) @@ -150,7 +143,9 @@ uint8_t map_update_gold(uint16_t x, uint16_t y) src.x = (t % MAP_TILESET_COLS) * MAP_TILE_W; src.y = (t / MAP_TILESET_COLS) * MAP_TILE_H; + blit_target(TARGET_BUFFER); blitrc(binary_tiles_start, &src, &dst); + blit_target(TARGET_SCREEN); total_gold--; return 1; -- cgit v1.2.3