From aae15c34e1b0224bc19b2185e5673916e2b6895d Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sun, 19 Jan 2025 11:08:19 +0900 Subject: [PATCH] AGS: Update draw_push() to use draw_gaiji() --- src/sys/ags.h | 2 +- src/sys/ags_text.cpp | 9 ++++----- src/sys/ags_window.cpp | 29 ++++++----------------------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/src/sys/ags.h b/src/sys/ags.h index 7af3aa0..cb62472 100644 --- a/src/sys/ags.h +++ b/src/sys/ags.h @@ -63,7 +63,7 @@ private: void draw_char(int dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color); void draw_char_antialias(int dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color, uint8 cache[]); - void draw_gaiji(int dest, int dest_x, int dest_y, uint16 code, int size, uint8 color); + void draw_gaiji(int dest, int dest_x, int dest_y, const uint8_t bitmap[32], int size, uint8 color); void draw_screen(int sx, int sy, int width, int heignt); void invalidate_screen(int sx, int sy, int width, int height); diff --git a/src/sys/ags_text.cpp b/src/sys/ags_text.cpp index 629df33..6f7413d 100644 --- a/src/sys/ags_text.cpp +++ b/src/sys/ags_text.cpp @@ -386,7 +386,7 @@ void AGS::draw_text(const char* string, bool text_wait) // 文字出力 if (GAIJI_FIRST <= code && code <= GAIJI_LAST) { // Use unadjusted dest_y here. - draw_gaiji(screen, dest_x, ctx.pos.y, code, ctx.font_size, ctx.font_color); + draw_gaiji(screen, dest_x, ctx.pos.y, gaiji[code - GAIJI_FIRST], ctx.font_size, ctx.font_color); dest_x += ctx.font_size; } else { if (!draw_menu) @@ -490,15 +490,14 @@ void AGS::draw_char_antialias(int dest, int dest_x, int dest_y, uint16 code, TTF SDL_FreeSurface(fs); } -void AGS::draw_gaiji(int dest, int dest_x, int dest_y, uint16 code, int size, uint8 color) +void AGS::draw_gaiji(int dest, int dest_x, int dest_y, const uint8_t bitmap[32], int size, uint8 color) { - int index = code - GAIJI_FIRST; bool pattern[16][16]; // パターン取得 for(int y = 0; y < 16; y++) { - uint8 l = gaiji[index][y * 2 + 0]; - uint8 r = gaiji[index][y * 2 + 1]; + uint8 l = bitmap[y * 2 + 0]; + uint8 r = bitmap[y * 2 + 1]; pattern[y][ 0] = ((l & 0x80) != 0); pattern[y][ 1] = ((l & 0x40) != 0); diff --git a/src/sys/ags_window.cpp b/src/sys/ags_window.cpp index a7cccf1..14e2414 100644 --- a/src/sys/ags_window.cpp +++ b/src/sys/ags_window.cpp @@ -130,34 +130,17 @@ bool AGS::return_text_line(int index) void AGS::draw_push(int index) { - // Pushのパターンデータ - static uint16 pattern[16] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xe000, - 0x9000, 0x9974, 0xe944, 0x8977, 0x8915, 0x8775, 0x0000, 0xffff + const uint8_t push_bitmap[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, + 0x90, 0x00, 0x99, 0x74, 0xe9, 0x44, 0x89, 0x77, + 0x89, 0x15, 0x87, 0x75, 0x00, 0x00, 0xff, 0xff }; Window& w = text_w[index - 1]; int x = w.ex - 16; int y = w.ey - 16; - - for(int i = 0; i < 16; i++) { - if(pattern[i] & 0x8000) vram[0][y + i][x + 0] = text.font_color; - if(pattern[i] & 0x4000) vram[0][y + i][x + 1] = text.font_color; - if(pattern[i] & 0x2000) vram[0][y + i][x + 2] = text.font_color; - if(pattern[i] & 0x1000) vram[0][y + i][x + 3] = text.font_color; - if(pattern[i] & 0x0800) vram[0][y + i][x + 4] = text.font_color; - if(pattern[i] & 0x0400) vram[0][y + i][x + 5] = text.font_color; - if(pattern[i] & 0x0200) vram[0][y + i][x + 6] = text.font_color; - if(pattern[i] & 0x0100) vram[0][y + i][x + 7] = text.font_color; - if(pattern[i] & 0x0080) vram[0][y + i][x + 8] = text.font_color; - if(pattern[i] & 0x0040) vram[0][y + i][x + 9] = text.font_color; - if(pattern[i] & 0x0020) vram[0][y + i][x + 10] = text.font_color; - if(pattern[i] & 0x0010) vram[0][y + i][x + 11] = text.font_color; - if(pattern[i] & 0x0008) vram[0][y + i][x + 12] = text.font_color; - if(pattern[i] & 0x0004) vram[0][y + i][x + 13] = text.font_color; - if(pattern[i] & 0x0002) vram[0][y + i][x + 14] = text.font_color; - if(pattern[i] & 0x0001) vram[0][y + i][x + 15] = text.font_color; - } + draw_gaiji(0, x, y, push_bitmap, 16, text.font_color); draw_screen(x, y, 16, 16); }