no message

This commit is contained in:
BADIM-PC\Vadim 2017-10-20 09:58:35 +03:00
parent 9480723418
commit bf93beb4c4
5 changed files with 15 additions and 27 deletions

View File

@ -963,9 +963,6 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v
{
Console* console = (Console*)data;
tic_palette pal;
memcpy(&pal, console->tic->ram.vram.palette.data, sizeof(tic_palette));
if(name)
{
static const char GifExt[] = ".gif";
@ -993,7 +990,7 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v
u8 src = image->buffer[x + y * image->width];
const gif_color* c = &image->palette[src];
tic_rgb rgb = {c->r, c->g, c->b};
u8 color = tic_tool_find_closest_color(console->tic->ram.vram.palette.colors, &rgb);
u8 color = tic_tool_find_closest_color(console->tic->cart.palette.colors, &rgb);
setSpritePixel(console->tic->cart.gfx.tiles, x, y, color);
}
@ -1010,8 +1007,6 @@ static void onImportSprites(const char* name, const void* buffer, size_t size, v
}
else printBack(console, "\nfile not imported :|");
memcpy(console->tic->ram.vram.palette.data, &pal, sizeof(tic_palette));
commandDone(console);
}
@ -2320,7 +2315,7 @@ static void cmdInjectCode(Console* console, const char* param, const char* name)
bool watch = strcmp(param, "-code-watch") == 0;
if(watch || strcmp(param, "-code") == 0)
{
bool loaded = loadFileIntoBuffer(console, &embed.file.code.data, name);
bool loaded = loadFileIntoBuffer(console, embed.file.code.data, name);
if(loaded)
{

View File

@ -513,11 +513,6 @@ static void drawMoveButtons(Sprite* sprite)
}
}
static void updateCartPalette(Sprite* sprite)
{
SDL_memcpy(sprite->tic->cart.palette.data, sprite->tic->ram.vram.palette.data, sizeof(tic_palette));
}
static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
{
enum {Size = CANVAS_SIZE, Max = 255};
@ -545,8 +540,6 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
{
s32 mx = getMouseX() - x;
*value = mx * Max / (Size-1);
updateCartPalette(sprite);
}
}
@ -591,10 +584,7 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
{
(*value)--;
updateCartPalette(sprite);
}
}
if(down)
@ -632,10 +622,7 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
{
(*value)++;
updateCartPalette(sprite);
}
}
if(down)
@ -682,7 +669,7 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
down = true;
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
toClipboard(sprite->tic->ram.vram.palette.data, sizeof(tic_palette), false);
toClipboard(sprite->tic->cart.palette.data, sizeof(tic_palette), false);
}
if(down)
@ -747,7 +734,7 @@ static void drawRGBSliders(Sprite* sprite, s32 x, s32 y)
{
enum{Gap = 6, Count = sizeof(tic_rgb)};
u8* data = &sprite->tic->ram.vram.palette.data[sprite->color * Count];
u8* data = &sprite->tic->cart.palette.data[sprite->color * Count];
for(s32 i = 0; i < Count; i++)
drawRGBSlider(sprite, x, y + Gap*i, &data[i]);

View File

@ -1390,7 +1390,7 @@ static u32* srcPaletteBlit(const u8* src)
memset(pal, 0xff, sizeof pal);
u8* dst = (u8*)pal;
const u8* end = src + sizeof studio.tic->ram.vram.palette;
const u8* end = src + sizeof(tic_palette);
enum{RGB = sizeof(tic_rgb)};
@ -2007,6 +2007,11 @@ static void renderCursor()
blitCursor(studio.tic->config.gfx.tiles[getConfig()->theme.cursor.sprite].data);
}
void useSystemPalette()
{
memcpy(studio.tic->ram.vram.palette.data, studio.tic->config.palette.data, sizeof(tic_palette));
}
static void renderStudio()
{
showTooltip("");
@ -2040,7 +2045,7 @@ static void renderStudio()
{
case TIC_RUN_MODE: break;
default:
memcpy(studio.tic->ram.vram.palette.data, studio.tic->config.palette.data, sizeof(tic_palette));
useSystemPalette();
}
}

View File

@ -199,4 +199,5 @@ void playSystemSfx(s32 id);
void runGameFromSurf();
void gotoSurf();
void exitFromGameMenu();
void runProject();
void runProject();
void useSystemPalette();

View File

@ -441,8 +441,8 @@ static void api_pause(tic_mem* memory)
memcpy(&machine->pause.music_pos, &memory->ram.music_pos, sizeof memory->ram.music_pos);
memcpy(&machine->pause.vram, &memory->ram.vram, sizeof memory->ram.vram);
api_reset(memory);
memcpy(memory->ram.vram.palette.data, memory->config.palette.data, sizeof(tic_palette));
// api_reset(memory);
// memcpy(memory->ram.vram.palette.data, memory->config.palette.data, sizeof(tic_palette));
}
static void api_resume(tic_mem* memory)