From 280828548eaf0039f4378206f180dc800158402f Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Fri, 20 Oct 2017 10:16:38 +0300 Subject: [PATCH] no message --- src/map.c | 6 ++++++ src/map.h | 1 + src/studio.c | 15 +++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/map.c b/src/map.c index be701c3..70e439f 100644 --- a/src/map.c +++ b/src/map.c @@ -1131,6 +1131,11 @@ static void onStudioEvent(Map* map, StudioEvent event) } } +static void scanline(tic_mem* tic, s32 row) +{ + memcpy(tic->ram.vram.palette.data, row < (TOOLBAR_SIZE-1) ? tic->config.palette.data : tic->cart.palette.data, sizeof(tic_palette)); +} + void initMap(Map* map, tic_mem* tic) { if(map->history) history_delete(map->history); @@ -1171,6 +1176,7 @@ void initMap(Map* map, tic_mem* tic) }, .history = history_create(&tic->cart.gfx.map, sizeof tic->cart.gfx.map), .event = onStudioEvent, + .scanline = scanline, }; normalizeMap(&map->scroll.x, &map->scroll.y); diff --git a/src/map.h b/src/map.h index 41bdcda..8d11256 100644 --- a/src/map.h +++ b/src/map.h @@ -80,6 +80,7 @@ struct Map void(*tick)(Map*); void(*event)(Map*, StudioEvent); + void(*scanline)(tic_mem* tic, s32 row); }; void initMap(Map*, tic_mem*); \ No newline at end of file diff --git a/src/studio.c b/src/studio.c index 2c85c68..c495c5b 100644 --- a/src/studio.c +++ b/src/studio.c @@ -1411,7 +1411,7 @@ static void blit(u32* out, u32* bgOut, s32 pitch, s32 bgPitch) const s32 pitchWidth = pitch/sizeof *out; const s32 bgPitchWidth = bgPitch/sizeof *bgOut; u32* row = out; - const u32* pal = srcPaletteBlit(studio.tic->cart.palette.data); + const u32* pal = paletteBlit(); void(*scanline)(tic_mem* memory, s32 row) = NULL; @@ -1423,6 +1423,9 @@ static void blit(u32* out, u32* bgOut, s32 pitch, s32 bgPitch) case TIC_SPRITE_MODE: scanline = studio.sprite.scanline; break; + case TIC_MAP_MODE: + scanline = studio.map.scanline; + break; default: break; } @@ -2040,15 +2043,11 @@ static void renderStudio() } studio.tic->api.tick_start(studio.tic, src); - - switch(studio.mode) - { - case TIC_RUN_MODE: break; - default: - useSystemPalette(); - } } + if(studio.mode != TIC_RUN_MODE) + useSystemPalette(); + switch(studio.mode) { case TIC_START_MODE: studio.start.tick(&studio.start); break;