no message
This commit is contained in:
parent
4da11f995d
commit
e956330af1
|
@ -1838,10 +1838,10 @@ void initCode(Code* code, tic_mem* tic)
|
||||||
*code = (Code)
|
*code = (Code)
|
||||||
{
|
{
|
||||||
.tic = tic,
|
.tic = tic,
|
||||||
.data = tic->cart.bank.code.data,
|
.data = getBankCode()->data,
|
||||||
.tick = tick,
|
.tick = tick,
|
||||||
.escape = escape,
|
.escape = escape,
|
||||||
.cursor = {{tic->cart.bank.code.data, NULL, 0, 0}, NULL, 0},
|
.cursor = {{getBankCode()->data, NULL, 0, 0}, NULL, 0},
|
||||||
.rect = {0, TOOLBAR_SIZE + 1, TIC80_WIDTH, TIC80_HEIGHT - TOOLBAR_SIZE - TIC_FONT_HEIGHT - 1},
|
.rect = {0, TOOLBAR_SIZE + 1, TIC80_WIDTH, TIC80_HEIGHT - TOOLBAR_SIZE - TIC_FONT_HEIGHT - 1},
|
||||||
.scroll = {0, 0, {0, 0}, false},
|
.scroll = {0, 0, {0, 0}, false},
|
||||||
.tickCounter = 0,
|
.tickCounter = 0,
|
||||||
|
|
26
src/map.c
26
src/map.c
|
@ -314,7 +314,7 @@ static void drawTileIndex(Map* map, s32 x, s32 y)
|
||||||
{
|
{
|
||||||
s32 tx = 0, ty = 0;
|
s32 tx = 0, ty = 0;
|
||||||
getMouseMap(map, &tx, &ty);
|
getMouseMap(map, &tx, &ty);
|
||||||
index = map->tic->api.map_get(map->tic, &map->tic->cart.bank.map, tx, ty);
|
index = map->tic->api.map_get(map->tic, getBankMap(), tx, ty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ static void drawSheetOvr(Map* map, s32 x, s32 y)
|
||||||
|
|
||||||
for(s32 j = 0, index = 0; j < rect.h; j += TIC_SPRITESIZE)
|
for(s32 j = 0, index = 0; j < rect.h; j += TIC_SPRITESIZE)
|
||||||
for(s32 i = 0; i < rect.w; i += TIC_SPRITESIZE, index++)
|
for(s32 i = 0; i < rect.w; i += TIC_SPRITESIZE, index++)
|
||||||
map->tic->api.sprite(map->tic, &map->tic->cart.bank.tiles, index, x + i, y + j, NULL, 0);
|
map->tic->api.sprite(map->tic, getBankTiles(), index, x + i, y + j, NULL, 0);
|
||||||
|
|
||||||
{
|
{
|
||||||
s32 bx = map->sheet.rect.x * TIC_SPRITESIZE - 1 + x;
|
s32 bx = map->sheet.rect.x * TIC_SPRITESIZE - 1 + x;
|
||||||
|
@ -437,7 +437,7 @@ static void setMapSprite(Map* map, s32 x, s32 y)
|
||||||
|
|
||||||
for(s32 j = 0; j < map->sheet.rect.h; j++)
|
for(s32 j = 0; j < map->sheet.rect.h; j++)
|
||||||
for(s32 i = 0; i < map->sheet.rect.w; i++)
|
for(s32 i = 0; i < map->sheet.rect.w; i++)
|
||||||
map->tic->api.map_set(map->tic, &map->tic->cart.bank.map, (x+i)%TIC_MAP_WIDTH, (y+j)%TIC_MAP_HEIGHT, (mx+i) + (my+j) * SHEET_COLS);
|
map->tic->api.map_set(map->tic, getBankMap(), (x+i)%TIC_MAP_WIDTH, (y+j)%TIC_MAP_HEIGHT, (mx+i) + (my+j) * SHEET_COLS);
|
||||||
|
|
||||||
history_add(map->history);
|
history_add(map->history);
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ static void drawTileCursor(Map* map)
|
||||||
|
|
||||||
for(s32 j = 0, ty=my; j < map->sheet.rect.h; j++, ty+=TIC_SPRITESIZE)
|
for(s32 j = 0, ty=my; j < map->sheet.rect.h; j++, ty+=TIC_SPRITESIZE)
|
||||||
for(s32 i = 0, tx=mx; i < map->sheet.rect.w; i++, tx+=TIC_SPRITESIZE)
|
for(s32 i = 0, tx=mx; i < map->sheet.rect.w; i++, tx+=TIC_SPRITESIZE)
|
||||||
map->tic->api.sprite(map->tic, &map->tic->cart.bank.tiles, (sx+i) + (sy+j) * SHEET_COLS, tx, ty, NULL, 0);
|
map->tic->api.sprite(map->tic, getBankTiles(), (sx+i) + (sy+j) * SHEET_COLS, tx, ty, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawCursorPos(map, mx, my);
|
drawCursorPos(map, mx, my);
|
||||||
|
@ -512,7 +512,7 @@ static void processMouseDrawMode(Map* map)
|
||||||
{
|
{
|
||||||
s32 tx = 0, ty = 0;
|
s32 tx = 0, ty = 0;
|
||||||
getMouseMap(map, &tx, &ty);
|
getMouseMap(map, &tx, &ty);
|
||||||
s32 index = map->tic->api.map_get(map->tic, &map->tic->cart.bank.map, tx, ty);
|
s32 index = map->tic->api.map_get(map->tic, getBankMap(), tx, ty);
|
||||||
|
|
||||||
map->sheet.rect = (SDL_Rect){index % SHEET_COLS, index / SHEET_COLS, 1, 1};
|
map->sheet.rect = (SDL_Rect){index % SHEET_COLS, index / SHEET_COLS, 1, 1};
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ static void drawPasteData(Map* map)
|
||||||
|
|
||||||
for(s32 j = 0; j < h; j++)
|
for(s32 j = 0; j < h; j++)
|
||||||
for(s32 i = 0; i < w; i++)
|
for(s32 i = 0; i < w; i++)
|
||||||
map->tic->api.map_set(map->tic, &map->tic->cart.bank.map, (mx+i)%TIC_MAP_WIDTH, (my+j)%TIC_MAP_HEIGHT, data[i + j * w]);
|
map->tic->api.map_set(map->tic, getBankMap(), (mx+i)%TIC_MAP_WIDTH, (my+j)%TIC_MAP_HEIGHT, data[i + j * w]);
|
||||||
|
|
||||||
history_add(map->history);
|
history_add(map->history);
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ static void drawPasteData(Map* map)
|
||||||
|
|
||||||
for(s32 j = 0; j < h; j++)
|
for(s32 j = 0; j < h; j++)
|
||||||
for(s32 i = 0; i < w; i++)
|
for(s32 i = 0; i < w; i++)
|
||||||
map->tic->api.sprite(map->tic, &map->tic->cart.bank.tiles, data[i + j * w], mx + i*TIC_SPRITESIZE, my + j*TIC_SPRITESIZE, NULL, 0);
|
map->tic->api.sprite(map->tic, getBankTiles(), data[i + j * w], mx + i*TIC_SPRITESIZE, my + j*TIC_SPRITESIZE, NULL, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ static void fillMap(Map* map, s32 x, s32 y, u8 tile)
|
||||||
{
|
{
|
||||||
for(s32 j = 0; j < map->sheet.rect.h; j++)
|
for(s32 j = 0; j < map->sheet.rect.h; j++)
|
||||||
for(s32 i = 0; i < map->sheet.rect.w; i++)
|
for(s32 i = 0; i < map->sheet.rect.w; i++)
|
||||||
map->tic->api.map_set(map->tic, &map->tic->cart.bank.map, x+i, y+j, (mx+i) + (my+j) * SHEET_COLS);
|
map->tic->api.map_set(map->tic, getBankMap(), x+i, y+j, (mx+i) + (my+j) * SHEET_COLS);
|
||||||
|
|
||||||
for(s32 i = 0; i < COUNT_OF(dx); i++)
|
for(s32 i = 0; i < COUNT_OF(dx); i++)
|
||||||
{
|
{
|
||||||
|
@ -776,7 +776,7 @@ static void fillMap(Map* map, s32 x, s32 y, u8 tile)
|
||||||
bool match = true;
|
bool match = true;
|
||||||
for(s32 j = 0; j < map->sheet.rect.h; j++)
|
for(s32 j = 0; j < map->sheet.rect.h; j++)
|
||||||
for(s32 i = 0; i < map->sheet.rect.w; i++)
|
for(s32 i = 0; i < map->sheet.rect.w; i++)
|
||||||
if(map->tic->api.map_get(map->tic, &map->tic->cart.bank.map, nx+i, ny+j) != tile)
|
if(map->tic->api.map_get(map->tic, getBankMap(), nx+i, ny+j) != tile)
|
||||||
match = false;
|
match = false;
|
||||||
|
|
||||||
if(match)
|
if(match)
|
||||||
|
@ -801,7 +801,7 @@ static void processMouseFillMode(Map* map)
|
||||||
s32 tx = 0, ty = 0;
|
s32 tx = 0, ty = 0;
|
||||||
getMouseMap(map, &tx, &ty);
|
getMouseMap(map, &tx, &ty);
|
||||||
|
|
||||||
fillMap(map, tx, ty, map->tic->api.map_get(map->tic, &map->tic->cart.bank.map, tx, ty));
|
fillMap(map, tx, ty, map->tic->api.map_get(map->tic, getBankMap(), tx, ty));
|
||||||
history_add(map->history);
|
history_add(map->history);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ static void drawMapOvr(Map* map)
|
||||||
s32 scrollX = map->scroll.x % TIC_SPRITESIZE;
|
s32 scrollX = map->scroll.x % TIC_SPRITESIZE;
|
||||||
s32 scrollY = map->scroll.y % TIC_SPRITESIZE;
|
s32 scrollY = map->scroll.y % TIC_SPRITESIZE;
|
||||||
|
|
||||||
map->tic->api.map(map->tic, &map->tic->cart.bank.map, &map->tic->cart.bank.tiles, map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE,
|
map->tic->api.map(map->tic, getBankMap(), getBankTiles(), map->scroll.x / TIC_SPRITESIZE, map->scroll.y / TIC_SPRITESIZE,
|
||||||
TIC_MAP_SCREEN_WIDTH + 1, TIC_MAP_SCREEN_HEIGHT + 1, -scrollX, -scrollY, -1, 1);
|
TIC_MAP_SCREEN_WIDTH + 1, TIC_MAP_SCREEN_HEIGHT + 1, -scrollX, -scrollY, -1, 1);
|
||||||
|
|
||||||
if(map->canvas.grid || map->scroll.active)
|
if(map->canvas.grid || map->scroll.active)
|
||||||
|
@ -950,7 +950,7 @@ static void copySelectionToClipboard(Map* map)
|
||||||
normalizeMapRect(&x, &y);
|
normalizeMapRect(&x, &y);
|
||||||
|
|
||||||
s32 index = x + y * TIC_MAP_WIDTH;
|
s32 index = x + y * TIC_MAP_WIDTH;
|
||||||
*ptr++ = map->tic->cart.bank.map.data[index];
|
*ptr++ = getBankMap()->data[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
toClipboard(buffer, size, true);
|
toClipboard(buffer, size, true);
|
||||||
|
@ -978,7 +978,7 @@ static void deleteSelection(Map* map)
|
||||||
normalizeMapRect(&x, &y);
|
normalizeMapRect(&x, &y);
|
||||||
|
|
||||||
s32 index = x + y * TIC_MAP_WIDTH;
|
s32 index = x + y * TIC_MAP_WIDTH;
|
||||||
map->tic->cart.bank.map.data[index] = 0;
|
getBankMap()->data[index] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
history_add(map->history);
|
history_add(map->history);
|
||||||
|
|
|
@ -215,7 +215,7 @@ static void drawSwitch(Music* music, s32 x, s32 y, const char* label, s32 value,
|
||||||
|
|
||||||
static tic_track* getTrack(Music* music)
|
static tic_track* getTrack(Music* music)
|
||||||
{
|
{
|
||||||
return &music->tic->cart.bank.music.tracks.data[music->track];
|
return &getBankMusic()->tracks.data[music->track];
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 getRows(Music* music)
|
static s32 getRows(Music* music)
|
||||||
|
@ -368,7 +368,7 @@ static tic_track_pattern* getPattern(Music* music, s32 channel)
|
||||||
{
|
{
|
||||||
s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, channel);
|
s32 patternId = tic_tool_get_pattern_id(getTrack(music), music->tracker.frame, channel);
|
||||||
|
|
||||||
return patternId ? &music->tic->cart.bank.music.patterns.data[patternId - PATTERN_START] : NULL;
|
return patternId ? &getBankMusic()->patterns.data[patternId - PATTERN_START] : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static tic_track_pattern* getChannelPattern(Music* music)
|
static tic_track_pattern* getChannelPattern(Music* music)
|
||||||
|
|
|
@ -106,7 +106,7 @@ static void drawSwitch(Sfx* sfx, s32 x, s32 y, const char* label, s32 value, voi
|
||||||
|
|
||||||
static tic_sound_effect* getEffect(Sfx* sfx)
|
static tic_sound_effect* getEffect(Sfx* sfx)
|
||||||
{
|
{
|
||||||
return sfx->tic->cart.bank.sfx.data + sfx->index;
|
return getBankSfx()->data + sfx->index;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setIndex(Sfx* sfx, s32 delta)
|
static void setIndex(Sfx* sfx, s32 delta)
|
||||||
|
@ -169,7 +169,7 @@ static void drawLoopPanel(Sfx* sfx, s32 x, s32 y)
|
||||||
|
|
||||||
static tic_waveform* getWaveformById(Sfx* sfx, s32 i)
|
static tic_waveform* getWaveformById(Sfx* sfx, s32 i)
|
||||||
{
|
{
|
||||||
return &sfx->tic->cart.bank.sfx.waveform.envelopes[i];
|
return &getBankSfx()->waveform.envelopes[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static tic_waveform* getWaveform(Sfx* sfx)
|
static tic_waveform* getWaveform(Sfx* sfx)
|
||||||
|
|
16
src/sprite.c
16
src/sprite.c
|
@ -38,12 +38,12 @@ static void clearCanvasSelection(Sprite* sprite)
|
||||||
|
|
||||||
static u8 getSheetPixel(Sprite* sprite, s32 x, s32 y)
|
static u8 getSheetPixel(Sprite* sprite, s32 x, s32 y)
|
||||||
{
|
{
|
||||||
return getSpritePixel(sprite->tic->cart.bank.tiles.data, x, sprite->index >= TIC_BANK_SPRITES ? y + TIC_SPRITESHEET_SIZE: y);
|
return getSpritePixel(getBankTiles()->data, x, sprite->index >= TIC_BANK_SPRITES ? y + TIC_SPRITESHEET_SIZE: y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setSheetPixel(Sprite* sprite, s32 x, s32 y, u8 color)
|
static void setSheetPixel(Sprite* sprite, s32 x, s32 y, u8 color)
|
||||||
{
|
{
|
||||||
setSpritePixel(sprite->tic->cart.bank.tiles.data, x, sprite->index >= TIC_BANK_SPRITES ? y + TIC_SPRITESHEET_SIZE: y, color);
|
setSpritePixel(getBankTiles()->data, x, sprite->index >= TIC_BANK_SPRITES ? y + TIC_SPRITESHEET_SIZE: y, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static s32 getIndexPosX(Sprite* sprite)
|
static s32 getIndexPosX(Sprite* sprite)
|
||||||
|
@ -672,8 +672,8 @@ static void drawRGBSlider(Sprite* sprite, s32 x, s32 y, u8* value)
|
||||||
|
|
||||||
static void pasteColor(Sprite* sprite)
|
static void pasteColor(Sprite* sprite)
|
||||||
{
|
{
|
||||||
fromClipboard(sprite->tic->cart.bank.palette.data, sizeof(tic_palette), false, true);
|
fromClipboard(getBankPalette()->data, sizeof(tic_palette), false, true);
|
||||||
fromClipboard(&sprite->tic->cart.bank.palette.colors[sprite->color], sizeof(tic_rgb), false, true);
|
fromClipboard(&getBankPalette()->colors[sprite->color], sizeof(tic_rgb), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
|
static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
|
||||||
|
@ -708,7 +708,7 @@ static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
|
||||||
down = true;
|
down = true;
|
||||||
|
|
||||||
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
if(checkMouseClick(&rect, SDL_BUTTON_LEFT))
|
||||||
toClipboard(sprite->tic->cart.bank.palette.data, sizeof(tic_palette), false);
|
toClipboard(getBankPalette()->data, sizeof(tic_palette), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(down)
|
if(down)
|
||||||
|
@ -772,7 +772,7 @@ static void drawRGBSliders(Sprite* sprite, s32 x, s32 y)
|
||||||
{
|
{
|
||||||
enum{Gap = 6, Count = sizeof(tic_rgb)};
|
enum{Gap = 6, Count = sizeof(tic_rgb)};
|
||||||
|
|
||||||
u8* data = &sprite->tic->cart.bank.palette.data[sprite->color * Count];
|
u8* data = &getBankPalette()->data[sprite->color * Count];
|
||||||
|
|
||||||
for(s32 i = 0; i < Count; i++)
|
for(s32 i = 0; i < Count; i++)
|
||||||
drawRGBSlider(sprite, x, y + Gap*i, &data[i]);
|
drawRGBSlider(sprite, x, y + Gap*i, &data[i]);
|
||||||
|
@ -784,7 +784,7 @@ static void drawRGBSlidersOvr(Sprite* sprite, s32 x, s32 y)
|
||||||
{
|
{
|
||||||
enum{Gap = 6, Count = sizeof(tic_rgb), Size = CANVAS_SIZE, Max = 255};
|
enum{Gap = 6, Count = sizeof(tic_rgb), Size = CANVAS_SIZE, Max = 255};
|
||||||
|
|
||||||
u8* data = &sprite->tic->cart.bank.palette.data[sprite->color * Count];
|
u8* data = &getBankPalette()->data[sprite->color * Count];
|
||||||
|
|
||||||
for(s32 i = 0; i < Count; i++)
|
for(s32 i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
|
@ -959,7 +959,7 @@ static void drawSheetOvr(Sprite* sprite, s32 x, s32 y)
|
||||||
|
|
||||||
for(s32 j = 0, index = (sprite->index - sprite->index % TIC_BANK_SPRITES); j < rect.h; j += TIC_SPRITESIZE)
|
for(s32 j = 0, index = (sprite->index - sprite->index % TIC_BANK_SPRITES); j < rect.h; j += TIC_SPRITESIZE)
|
||||||
for(s32 i = 0; i < rect.w; i += TIC_SPRITESIZE, index++)
|
for(s32 i = 0; i < rect.w; i += TIC_SPRITESIZE, index++)
|
||||||
sprite->tic->api.sprite(sprite->tic, &sprite->tic->cart.bank.tiles, index, x + i, y + j, NULL, 0);
|
sprite->tic->api.sprite(sprite->tic, getBankTiles(), index, x + i, y + j, NULL, 0);
|
||||||
{
|
{
|
||||||
s32 bx = getIndexPosX(sprite) + x - 1;
|
s32 bx = getIndexPosX(sprite) + x - 1;
|
||||||
s32 by = getIndexPosY(sprite) + y - 1;
|
s32 by = getIndexPosY(sprite) + y - 1;
|
||||||
|
|
|
@ -2268,8 +2268,8 @@ static void renderStudio()
|
||||||
music = &studio.tic->config.music;
|
music = &studio.tic->config.music;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sfx = &studio.tic->cart.bank.sfx;
|
sfx = getBankSfx();
|
||||||
music = &studio.tic->cart.bank.music;
|
music = getBankMusic();
|
||||||
}
|
}
|
||||||
|
|
||||||
studio.tic->api.tick_start(studio.tic, sfx, music);
|
studio.tic->api.tick_start(studio.tic, sfx, music);
|
||||||
|
|
|
@ -105,13 +105,13 @@ void initWorld(World* world, tic_mem* tic, Map* map)
|
||||||
|
|
||||||
for(s32 i = 0; i < TIC80_WIDTH * TIC80_HEIGHT; i++)
|
for(s32 i = 0; i < TIC80_WIDTH * TIC80_HEIGHT; i++)
|
||||||
{
|
{
|
||||||
u8 index = tic->cart.bank.map.data[i];
|
u8 index = getBankMap()->data[i];
|
||||||
|
|
||||||
if(index)
|
if(index)
|
||||||
{
|
{
|
||||||
SDL_memset(colors, 0, sizeof colors);
|
SDL_memset(colors, 0, sizeof colors);
|
||||||
|
|
||||||
tic_tile* tile = &tic->cart.bank.tiles.data[index];
|
tic_tile* tile = &getBankTiles()->data[index];
|
||||||
|
|
||||||
for(s32 p = 0; p < TIC_SPRITESIZE * TIC_SPRITESIZE; p++)
|
for(s32 p = 0; p < TIC_SPRITESIZE * TIC_SPRITESIZE; p++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue