From fe0b2a44b5aa7c2e6fa2a4f8311b69fc12de10ee Mon Sep 17 00:00:00 2001 From: "BADIM-PC\\Vadim" Date: Fri, 20 Oct 2017 10:31:38 +0300 Subject: [PATCH] no message --- src/code.c | 20 +++++++++++--------- src/dialog.c | 10 +++++----- src/map.c | 22 +++++++++++----------- src/menu.c | 10 +++++----- src/music.c | 4 ++-- src/sfx.c | 12 ++++++------ src/sprite.c | 4 ++-- src/studio.c | 2 +- src/studio.h | 2 +- 9 files changed, 44 insertions(+), 42 deletions(-) diff --git a/src/code.c b/src/code.c index 42c5c60..ed41b57 100644 --- a/src/code.c +++ b/src/code.c @@ -26,7 +26,7 @@ #define TEXT_CURSOR_DELAY (TIC_FRAMERATE / 2) #define TEXT_CURSOR_BLINK_PERIOD TIC_FRAMERATE #define TEXT_BUFFER_WIDTH STUDIO_TEXT_BUFFER_WIDTH -#define TEXT_BUFFER_HEIGHT ((TIC80_HEIGHT - TOOLBAR_SIZE - STUDIO_TEXT_HEIGHT) / STUDIO_TEXT_HEIGHT) +#define TEXT_BUFFER_HEIGHT ((TIC80_HEIGHT - TOOLBAR_SIZE_ - STUDIO_TEXT_HEIGHT) / STUDIO_TEXT_HEIGHT) struct OutlineItem { @@ -34,7 +34,7 @@ struct OutlineItem char* pos; }; -#define OUTLINE_SIZE ((TIC80_HEIGHT - TOOLBAR_SIZE*2)/TIC_FONT_HEIGHT) +#define OUTLINE_SIZE ((TIC80_HEIGHT - TOOLBAR_SIZE_*2)/TIC_FONT_HEIGHT) #define OUTLINE_ITEMS_SIZE (OUTLINE_SIZE * sizeof(OutlineItem)) static void history(Code* code) @@ -1408,12 +1408,14 @@ static void textEditTick(Code* code) static void drawPopupBar(Code* code, const char* title) { - code->tic->api.rect(code->tic, 0, TOOLBAR_SIZE-1, TIC80_WIDTH, TIC_FONT_HEIGHT + 1, systemColor(tic_color_blue)); - code->tic->api.fixed_text(code->tic, title, 0, TOOLBAR_SIZE, systemColor(tic_color_white)); + enum {TextY = TOOLBAR_SIZE_ + 1}; - code->tic->api.fixed_text(code->tic, code->popup.text, (s32)strlen(title)*TIC_FONT_WIDTH, TOOLBAR_SIZE, systemColor(tic_color_white)); + code->tic->api.rect(code->tic, 0, TOOLBAR_SIZE_, TIC80_WIDTH, TIC_FONT_HEIGHT + 1, systemColor(tic_color_blue)); + code->tic->api.fixed_text(code->tic, title, 0, TextY, systemColor(tic_color_white)); - drawCursor(code, (s32)(strlen(title) + strlen(code->popup.text)) * TIC_FONT_WIDTH, TOOLBAR_SIZE, ' '); + code->tic->api.fixed_text(code->tic, code->popup.text, (s32)strlen(title)*TIC_FONT_WIDTH, TextY, systemColor(tic_color_white)); + + drawCursor(code, (s32)(strlen(title) + strlen(code->popup.text)) * TIC_FONT_WIDTH, TextY, ' '); } static void updateFindCode(Code* code, char* pos) @@ -1574,7 +1576,7 @@ static void textGoToTick(Code* code) code->tic->api.clear(code->tic, getConfig()->theme.code.bg); if(code->jump.line >= 0) - code->tic->api.rect(code->tic, 0, (code->jump.line - code->scroll.y) * TIC_FONT_HEIGHT + TOOLBAR_SIZE-1, + code->tic->api.rect(code->tic, 0, (code->jump.line - code->scroll.y) * TIC_FONT_HEIGHT + TOOLBAR_SIZE_ + 1, TIC80_WIDTH, TIC_FONT_HEIGHT+1, getConfig()->theme.code.select); drawCode(code, false); @@ -1689,7 +1691,7 @@ static void textOutlineTick(Code* code) static void drawCodeToolbar(Code* code) { - code->tic->api.rect(code->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE-1, systemColor(tic_color_white)); + code->tic->api.rect(code->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE_, systemColor(tic_color_white)); static const u8 Icons[] = { @@ -1836,7 +1838,7 @@ void initCode(Code* code, tic_mem* tic) .tick = tick, .escape = escape, .cursor = {{tic->cart.code.data, NULL, 0, 0}, NULL, 0}, - .rect = {0, TOOLBAR_SIZE, 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}, .tickCounter = 0, .history = NULL, diff --git a/src/dialog.c b/src/dialog.c index 1c9c52a..a0c5cbc 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -117,7 +117,7 @@ static void processKeydown(Dialog* dlg, SDL_Keysym* keysum) static void drawDialog(Dialog* dlg) { - enum {Width = TIC80_WIDTH/2, Height = TIC80_HEIGHT/2-TOOLBAR_SIZE-1}; + enum {Width = TIC80_WIDTH/2, Height = TIC80_HEIGHT/2-TOOLBAR_SIZE_}; tic_mem* tic = dlg->tic; @@ -126,7 +126,7 @@ static void drawDialog(Dialog* dlg) rect.x -= dlg->pos.x; rect.y -= dlg->pos.y; - SDL_Rect header = {rect.x, rect.y-(TOOLBAR_SIZE-2), rect.w, TOOLBAR_SIZE-1}; + SDL_Rect header = {rect.x, rect.y-(TOOLBAR_SIZE_-1), rect.w, TOOLBAR_SIZE_}; if(checkMousePos(&header)) { @@ -159,13 +159,13 @@ static void drawDialog(Dialog* dlg) tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_blue)); tic->api.rect_border(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_white)); tic->api.line(tic, rect.x, rect.y+Height, rect.x+Width-1, rect.y+Height, systemColor(tic_color_black)); - tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE-3), rect.w, TOOLBAR_SIZE-3, systemColor(tic_color_white)); - tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE-2), rect.x+Width-2, rect.y-(TOOLBAR_SIZE-2), systemColor(tic_color_white)); + tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE_-2), rect.w, TOOLBAR_SIZE_-2, systemColor(tic_color_white)); + tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE_-1), rect.x+Width-2, rect.y-(TOOLBAR_SIZE_-1), systemColor(tic_color_white)); { static const char Label[] = "WARNING!"; s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, 0); - tic->api.text(tic, Label, rect.x + (Width - size)/2, rect.y-(TOOLBAR_SIZE-3), systemColor(tic_color_gray)); + tic->api.text(tic, Label, rect.x + (Width - size)/2, rect.y-(TOOLBAR_SIZE_-2), systemColor(tic_color_gray)); } { diff --git a/src/map.c b/src/map.c index 70e439f..f6d107f 100644 --- a/src/map.c +++ b/src/map.c @@ -26,9 +26,9 @@ #define SHEET_COLS (TIC_SPRITESHEET_SIZE / TIC_SPRITESIZE) #define MAP_WIDTH (TIC80_WIDTH) -#define MAP_HEIGHT (TIC80_HEIGHT - TOOLBAR_SIZE) +#define MAP_HEIGHT (TIC80_HEIGHT - TOOLBAR_SIZE_) #define MAP_X (0) -#define MAP_Y (TOOLBAR_SIZE) +#define MAP_Y (TOOLBAR_SIZE_) #define MAX_SCROLL_X (TIC_MAP_WIDTH * TIC_SPRITESIZE) #define MAX_SCROLL_Y (TIC_MAP_HEIGHT * TIC_SPRITESIZE) @@ -293,7 +293,7 @@ static void drawTileIndex(Map* map, s32 x, s32 y) if(map->sheet.show) { - SDL_Rect rect = {TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE-1, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE}; + SDL_Rect rect = {TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE_, TIC_SPRITESHEET_SIZE, TIC_SPRITESHEET_SIZE}; if(checkMousePos(&rect)) { @@ -328,7 +328,7 @@ static void drawTileIndex(Map* map, s32 x, s32 y) static void drawMapToolbar(Map* map, s32 x, s32 y) { - map->tic->api.rect(map->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE-1, systemColor(tic_color_white)); + map->tic->api.rect(map->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE_, systemColor(tic_color_white)); drawTileIndex(map, TIC80_WIDTH/2 - TIC_FONT_WIDTH, y); @@ -417,7 +417,7 @@ static void drawCursorPos(Map* map, s32 x, s32 y) if(px + width >= TIC80_WIDTH) px = x - (width + 2); s32 py = y - (TIC_FONT_HEIGHT + 2); - if(py <= TOOLBAR_SIZE) py = y + (TIC_SPRITESIZE + 3); + if(py <= TOOLBAR_SIZE_) py = y + (TIC_SPRITESIZE + 3); map->tic->api.rect(map->tic, px - 1, py - 1, width + 1, TIC_FONT_HEIGHT + 1, systemColor(tic_color_white)); map->tic->api.text(map->tic, pos, px, py, systemColor(tic_color_light_blue)); @@ -559,10 +559,10 @@ static void drawSelectionRect(Map* map, s32 x, s32 y, s32 w, s32 h) u8 color = systemColor(tic_color_white); s32 index = map->tickCounter / 10; - for(s32 i = x; i < (x+w); i++) map->tic->api.pixel(map->tic, i, y, index++ % Step ? color : 0); index++; - for(s32 i = y; i < (y+h); i++) map->tic->api.pixel(map->tic, x + w-1, i, index++ % Step ? color : 0); index++; - for(s32 i = (x+w-1); i >= x; i--) map->tic->api.pixel(map->tic, i, y + h-1, index++ % Step ? color : 0); index++; - for(s32 i = (y+h-1); i >= y; i--) map->tic->api.pixel(map->tic, x, i, index++ % Step ? color : 0); + for(s32 i = x; i < (x+w); i++) {map->tic->api.pixel(map->tic, i, y, index++ % Step ? color : 0);} index++; + for(s32 i = y; i < (y+h); i++) {map->tic->api.pixel(map->tic, x + w-1, i, index++ % Step ? color : 0);} index++; + for(s32 i = (x+w-1); i >= x; i--) {map->tic->api.pixel(map->tic, i, y + h-1, index++ % Step ? color : 0);} index++; + for(s32 i = (y+h-1); i >= y; i--) {map->tic->api.pixel(map->tic, x, i, index++ % Step ? color : 0);} } static void drawPasteData(Map* map) @@ -1113,7 +1113,7 @@ static void tick(Map* map) map->tic->api.clear(map->tic, TIC_COLOR_BG); drawMap(map); - drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE-1); + drawSheet(map, TIC80_WIDTH - TIC_SPRITESHEET_SIZE - 1, TOOLBAR_SIZE_); drawMapToolbar(map, TIC80_WIDTH - 9*TIC_FONT_WIDTH, 1); drawToolbar(map->tic, TIC_COLOR_BG, false); } @@ -1133,7 +1133,7 @@ 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)); + memcpy(tic->ram.vram.palette.data, row < TOOLBAR_SIZE_ ? tic->config.palette.data : tic->cart.palette.data, sizeof(tic_palette)); } void initMap(Map* map, tic_mem* tic) diff --git a/src/menu.c b/src/menu.c index e0467d2..8bf8a92 100644 --- a/src/menu.c +++ b/src/menu.c @@ -24,7 +24,7 @@ #include "fs.h" #define DIALOG_WIDTH (TIC80_WIDTH/2) -#define DIALOG_HEIGHT (TIC80_HEIGHT/2-TOOLBAR_SIZE-1) +#define DIALOG_HEIGHT (TIC80_HEIGHT/2-TOOLBAR_SIZE_) static const char* Rows[] = { @@ -78,7 +78,7 @@ static void drawDialog(Menu* menu) tic_mem* tic = menu->tic; - SDL_Rect header = {rect.x, rect.y-(TOOLBAR_SIZE-2), rect.w, TOOLBAR_SIZE-1}; + SDL_Rect header = {rect.x, rect.y-(TOOLBAR_SIZE_-1), rect.w, TOOLBAR_SIZE_}; if(checkMousePos(&header)) { @@ -113,13 +113,13 @@ static void drawDialog(Menu* menu) tic->api.rect(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_blue)); tic->api.rect_border(tic, rect.x, rect.y, rect.w, rect.h, systemColor(tic_color_white)); tic->api.line(tic, rect.x, rect.y+DIALOG_HEIGHT, rect.x+DIALOG_WIDTH-1, rect.y+DIALOG_HEIGHT, systemColor(tic_color_black)); - tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE-3), rect.w, TOOLBAR_SIZE-3, systemColor(tic_color_white)); - tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE-2), rect.x+DIALOG_WIDTH-2, rect.y-(TOOLBAR_SIZE-2), systemColor(tic_color_white)); + tic->api.rect(tic, rect.x, rect.y-(TOOLBAR_SIZE_-2), rect.w, TOOLBAR_SIZE_-2, systemColor(tic_color_white)); + tic->api.line(tic, rect.x+1, rect.y-(TOOLBAR_SIZE_-1), rect.x+DIALOG_WIDTH-2, rect.y-(TOOLBAR_SIZE_-1), systemColor(tic_color_white)); { static const char Label[] = "GAME MENU"; s32 size = tic->api.text(tic, Label, 0, -TIC_FONT_HEIGHT, 0); - tic->api.text(tic, Label, rect.x + (DIALOG_WIDTH - size)/2, rect.y-(TOOLBAR_SIZE-3), systemColor(tic_color_gray)); + tic->api.text(tic, Label, rect.x + (DIALOG_WIDTH - size)/2, rect.y-(TOOLBAR_SIZE_-2), systemColor(tic_color_gray)); } { diff --git a/src/music.c b/src/music.c index 799b639..9d5fde6 100644 --- a/src/music.c +++ b/src/music.c @@ -1478,7 +1478,7 @@ static void drawModeTabs(Music* music) static void drawMusicToolbar(Music* music) { - music->tic->api.rect(music->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE - 1, systemColor(tic_color_white)); + music->tic->api.rect(music->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE_, systemColor(tic_color_white)); drawPlayButtons(music); drawModeTabs(music); @@ -1573,7 +1573,7 @@ static void drawTrackerLayout(Music* music) music->tic->api.clear(music->tic, systemColor(tic_color_gray)); - drawTopPanel(music, 6, TOOLBAR_SIZE + 4); + drawTopPanel(music, 6, TOOLBAR_SIZE_ + 3); drawTracker(music, 6, 35); } diff --git a/src/sfx.c b/src/sfx.c index 4a8b585..a6b46d3 100644 --- a/src/sfx.c +++ b/src/sfx.c @@ -796,7 +796,7 @@ static void drawModeTabs(Sfx* sfx) static void drawSfxToolbar(Sfx* sfx) { - sfx->tic->api.rect(sfx->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE-1, systemColor(tic_color_white)); + sfx->tic->api.rect(sfx->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE_, systemColor(tic_color_white)); enum{Width = 3 * TIC_FONT_WIDTH}; s32 x = TIC80_WIDTH - Width - TIC_SPRITESIZE*3; @@ -854,13 +854,13 @@ static void envelopesTick(Sfx* sfx) drawSfxToolbar(sfx); drawToolbar(sfx->tic, TIC_COLOR_BG, false); - drawTopPanel(sfx, Start, TOOLBAR_SIZE + Gap - 1); - drawCanvasTabs(sfx, Start-Gap, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT+1); + drawTopPanel(sfx, Start, TOOLBAR_SIZE_ + Gap); + drawCanvasTabs(sfx, Start-Gap, TOOLBAR_SIZE_ + Gap + TIC_FONT_HEIGHT+2); if(sfx->canvasTab == SFX_WAVE_TAB) - drawWaveButtons(sfx, Start + CANVAS_WIDTH + Gap-1, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT+1); + drawWaveButtons(sfx, Start + CANVAS_WIDTH + Gap-1, TOOLBAR_SIZE_ + Gap + TIC_FONT_HEIGHT+2); - drawLoopPanel(sfx, Gap, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT+91); - drawCanvas(sfx, Start-1, TOOLBAR_SIZE + Gap + TIC_FONT_HEIGHT); + drawLoopPanel(sfx, Gap, TOOLBAR_SIZE_ + Gap + TIC_FONT_HEIGHT+92); + drawCanvas(sfx, Start-1, TOOLBAR_SIZE_ + Gap + TIC_FONT_HEIGHT + 1); drawOctavePanel(sfx, Start + Gap + PIANO_WIDTH + Gap-1, TIC80_HEIGHT - TIC_FONT_HEIGHT - (PIANO_HEIGHT - TIC_FONT_HEIGHT)/2 - Gap); } diff --git a/src/sprite.c b/src/sprite.c index d134b5b..b78a21d 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -1334,7 +1334,7 @@ static void processKeydown(Sprite* sprite, SDL_Keycode keycode) static void drawSpriteToolbar(Sprite* sprite) { - sprite->tic->api.rect(sprite->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE-1, systemColor(tic_color_white)); + sprite->tic->api.rect(sprite->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE_, systemColor(tic_color_white)); // draw sprite size control { @@ -1472,7 +1472,7 @@ 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)); + memcpy(tic->ram.vram.palette.data, row < TOOLBAR_SIZE_ ? tic->config.palette.data : tic->cart.palette.data, sizeof(tic_palette)); } void initSprite(Sprite* sprite, tic_mem* tic) diff --git a/src/studio.c b/src/studio.c index c495c5b..74547f0 100644 --- a/src/studio.c +++ b/src/studio.c @@ -505,7 +505,7 @@ u8 systemColor(u8 color) void drawToolbar(tic_mem* tic, u8 color, bool bg) { if(bg) - studio.tic->api.rect(tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE-1, systemColor(tic_color_white)); + studio.tic->api.rect(tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE_, systemColor(tic_color_white)); static const u8 TabIcon[] = { diff --git a/src/studio.h b/src/studio.h index 6a09370..71a22d0 100644 --- a/src/studio.h +++ b/src/studio.h @@ -43,7 +43,7 @@ #define TIC_MOD_CTRL (KMOD_GUI|KMOD_CTRL) -#define TOOLBAR_SIZE 8 +#define TOOLBAR_SIZE_ 7 #define STUDIO_TEXT_WIDTH (TIC_FONT_WIDTH) #define STUDIO_TEXT_HEIGHT (TIC_FONT_HEIGHT+1) #define STUDIO_TEXT_BUFFER_WIDTH (TIC80_WIDTH / STUDIO_TEXT_WIDTH)