no message

This commit is contained in:
BADIM-PC\Vadim 2017-10-20 09:36:54 +03:00
parent 2f99f85d34
commit 9480723418
3 changed files with 38 additions and 11 deletions

View File

@ -1483,6 +1483,11 @@ static void onStudioEvent(Sprite* sprite, 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 initSprite(Sprite* sprite, tic_mem* tic) void initSprite(Sprite* sprite, tic_mem* tic)
{ {
if(sprite->select.back == NULL) sprite->select.back = (u8*)SDL_malloc(CANVAS_SIZE*CANVAS_SIZE); if(sprite->select.back == NULL) sprite->select.back = (u8*)SDL_malloc(CANVAS_SIZE*CANVAS_SIZE);
@ -1511,5 +1516,6 @@ void initSprite(Sprite* sprite, tic_mem* tic)
.mode = SPRITE_DRAW_MODE, .mode = SPRITE_DRAW_MODE,
.history = history_create(tic->cart.gfx.tiles, TIC_SPRITES * sizeof(tic_tile)), .history = history_create(tic->cart.gfx.tiles, TIC_SPRITES * sizeof(tic_tile)),
.event = onStudioEvent, .event = onStudioEvent,
.scanline = scanline,
}; };
} }

View File

@ -60,7 +60,8 @@ struct Sprite
struct History* history; struct History* history;
void (*tick)(Sprite*); void (*tick)(Sprite*);
void(*event)(Sprite*, StudioEvent); void (*event)(Sprite*, StudioEvent);
void (*scanline)(tic_mem* tic, s32 row);
}; };
void initSprite(Sprite*, tic_mem*); void initSprite(Sprite*, tic_mem*);

View File

@ -1413,20 +1413,33 @@ static void blit(u32* out, u32* bgOut, s32 pitch, s32 bgPitch)
u32* row = out; u32* row = out;
const u32* pal = srcPaletteBlit(studio.tic->cart.palette.data); const u32* pal = srcPaletteBlit(studio.tic->cart.palette.data);
void(*scanline)(tic_mem* memory, s32 row) = NULL;
switch(studio.mode)
{
case TIC_RUN_MODE:
scanline = studio.tic->api.scanline;
break;
case TIC_SPRITE_MODE:
scanline = studio.sprite.scanline;
break;
default:
break;
}
for(s32 r = 0, pos = 0; r < TIC80_HEIGHT; r++, row += pitchWidth) for(s32 r = 0, pos = 0; r < TIC80_HEIGHT; r++, row += pitchWidth)
{ {
if(scanline)
if(studio.mode == TIC_RUN_MODE || studio.mode == TIC_MENU_MODE)
{ {
studio.tic->api.scanline(studio.tic, r); scanline(studio.tic, r);
pal = paletteBlit(); pal = paletteBlit();
}
if(bgOut) if(bgOut)
{ {
u8 border = tic_tool_peek4(studio.tic->ram.vram.mapping, studio.tic->ram.vram.vars.border & 0xf); u8 border = tic_tool_peek4(studio.tic->ram.vram.mapping, studio.tic->ram.vram.vars.border & 0xf);
SDL_memset4(bgOut, pal[border], TIC80_WIDTH); SDL_memset4(bgOut, pal[border], TIC80_WIDTH);
bgOut += bgPitchWidth; bgOut += bgPitchWidth;
}
} }
SDL_memset4(row, 0, pitchWidth); SDL_memset4(row, 0, pitchWidth);
@ -2022,6 +2035,13 @@ static void renderStudio()
} }
studio.tic->api.tick_start(studio.tic, src); studio.tic->api.tick_start(studio.tic, src);
switch(studio.mode)
{
case TIC_RUN_MODE: break;
default:
memcpy(studio.tic->ram.vram.palette.data, studio.tic->config.palette.data, sizeof(tic_palette));
}
} }
switch(studio.mode) switch(studio.mode)