mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-29 10:28:02 +03:00
Introduce ScreenId enum
This commit is contained in:
+8
-11
@@ -54,16 +54,16 @@ AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id)
|
||||
sdlTexture = SDL_CreateTexture(g_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
|
||||
scanline_texture = NULL;
|
||||
|
||||
// DIBSection 8bpp * 3 (表, 裏, メニュー)
|
||||
for(int i = 0; i < 3; i++) {
|
||||
// DIBSection 8bpp
|
||||
for(int i = 0; i < NR_SCREENS; i++) {
|
||||
hBmpScreen[i] = SDL_CreateRGBSurfaceWithFormat(0, 640, 480, 8, SDL_PIXELFORMAT_INDEX8);
|
||||
vram[i] = reinterpret_cast<uint8_t(*)[640]>(hBmpScreen[i]->pixels);
|
||||
}
|
||||
|
||||
// All surfaces share the same palette.
|
||||
screen_palette = hBmpScreen[0]->format->palette;
|
||||
SDL_SetSurfacePalette(hBmpScreen[1], screen_palette);
|
||||
SDL_SetSurfacePalette(hBmpScreen[2], screen_palette);
|
||||
screen_palette = hBmpScreen[SCREEN_FRONT]->format->palette;
|
||||
SDL_SetSurfacePalette(hBmpScreen[SCREEN_BACK], screen_palette);
|
||||
SDL_SetSurfacePalette(hBmpScreen[SCREEN_MENU], screen_palette);
|
||||
|
||||
if (!config.censor_list.empty())
|
||||
load_censor_list(config.censor_list.c_str());
|
||||
@@ -186,9 +186,6 @@ AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id)
|
||||
|
||||
SDL_SetPaletteColors(screen_palette, program_palette->colors, 0, 256);
|
||||
|
||||
// 画面選択
|
||||
src_screen = dest_screen = 0;
|
||||
|
||||
// CG表示
|
||||
cg_dest = std::nullopt;
|
||||
palette_bank = -1;
|
||||
@@ -220,7 +217,7 @@ AGS::~AGS()
|
||||
|
||||
SDL_FreePalette(program_palette);
|
||||
|
||||
for(int i = 0; i < 3; i++) {
|
||||
for(int i = 0; i < NR_SCREENS; i++) {
|
||||
SDL_FreeSurface(hBmpScreen[i]);
|
||||
}
|
||||
|
||||
@@ -308,7 +305,7 @@ void AGS::update_screen()
|
||||
if (!SDL_RectEmpty(&dirty_rect)) {
|
||||
SDL_Surface *sf;
|
||||
SDL_LockTextureToSurface(sdlTexture, &dirty_rect, &sf);
|
||||
SDL_BlitSurface(hBmpScreen[0], &dirty_rect, sf, NULL);
|
||||
SDL_BlitSurface(hBmpScreen[SCREEN_FRONT], &dirty_rect, sf, NULL);
|
||||
SDL_UnlockTexture(sdlTexture);
|
||||
dirty_rect = {};
|
||||
}
|
||||
@@ -350,7 +347,7 @@ void AGS::set_scanline_mode(bool enable)
|
||||
bool AGS::save_screenshot(const char* path)
|
||||
{
|
||||
SDL_Surface* sf = SDL_CreateRGBSurface(0, screen_width, screen_height, 32, 0, 0, 0, 0);
|
||||
SDL_BlitSurface(hBmpScreen[0], NULL, sf, NULL);
|
||||
SDL_BlitSurface(hBmpScreen[SCREEN_FRONT], NULL, sf, NULL);
|
||||
|
||||
if (scanline_texture) {
|
||||
SDL_Renderer* renderer = SDL_CreateSoftwareRenderer(sf);
|
||||
|
||||
+21
-15
@@ -20,6 +20,13 @@
|
||||
|
||||
struct Config;
|
||||
|
||||
enum ScreenId {
|
||||
SCREEN_FRONT,
|
||||
SCREEN_BACK,
|
||||
SCREEN_MENU,
|
||||
NR_SCREENS,
|
||||
};
|
||||
|
||||
enum CgFlags {
|
||||
CG_EXTRACT_CG = 1,
|
||||
CG_EXTRACT_PALETTE = 2,
|
||||
@@ -35,8 +42,8 @@ private:
|
||||
SDL_Texture* scanline_texture;
|
||||
|
||||
// Surface
|
||||
SDL_Surface* hBmpScreen[3]; // 8bpp * 3 (表, 裏, メニュー)
|
||||
uint8_t (*vram[3])[640]; // convenience pointer to hBmpScreen[i]->pixels
|
||||
SDL_Surface* hBmpScreen[NR_SCREENS]; // 8bpp
|
||||
uint8_t (*vram[NR_SCREENS])[640]; // convenience pointer to hBmpScreen[i]->pixels
|
||||
|
||||
SDL_Palette* program_palette;
|
||||
SDL_Palette* screen_palette;
|
||||
@@ -59,8 +66,8 @@ private:
|
||||
CG load_pms(int page, const std::vector<uint8_t>& data, bool set_palette, int transparent, uint8_t flags);
|
||||
CG load_vsp(const std::vector<uint8_t>& data, bool set_palette, int transparent, uint8_t flags);
|
||||
|
||||
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_char(ScreenId dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color);
|
||||
void draw_char_antialias(ScreenId dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color, uint8 cache[]);
|
||||
|
||||
uint8_t palR(uint8_t col) const { return screen_palette->colors[col].r; }
|
||||
uint8_t palG(uint8_t col) const { return screen_palette->colors[col].g; }
|
||||
@@ -83,17 +90,17 @@ public:
|
||||
CG load_cg_surface(int page, int transparent, uint8_t flags);
|
||||
// Returns an ACG page bytes, without decoding it.
|
||||
std::vector<uint8_t> load_cg_data(int page) { return acg.load(page); }
|
||||
void blit_cg(int dest, CG& cg, const SDL_Rect* src, int dx, int dy);
|
||||
void blit_cg(ScreenId dest, CG& cg, const SDL_Rect* src, int dx, int dy);
|
||||
void set_cg_file(const char *file_name);
|
||||
|
||||
void load_censor_list(const char* fname);
|
||||
|
||||
void set_palette(int index, uint8_t r, uint8_t g, uint8_t b);
|
||||
std::vector<uint32_t> get_screen_palette() const;
|
||||
uint8 get_pixel(int dest, int x, int y) const { return vram[dest][y][x]; }
|
||||
void set_pixel(int dest, int x, int y, uint8 color) { vram[dest][y][x] = color; }
|
||||
uint8 get_pixel(ScreenId dest, int x, int y) const { return vram[dest][y][x]; }
|
||||
void set_pixel(ScreenId dest, int x, int y, uint8 color) { vram[dest][y][x] = color; }
|
||||
void invalidate_screen(int sx, int sy, int width, int height);
|
||||
void draw_gaiji(int dest, int dest_x, int dest_y, const uint8_t bitmap[32], int size, uint8 color);
|
||||
void draw_gaiji(ScreenId dest, int dest_x, int dest_y, const uint8_t bitmap[32], int size, uint8 color);
|
||||
bool is_faded() const { return fade_level != 0; }
|
||||
|
||||
void fade_out(int duration_ms, bool white);
|
||||
@@ -102,19 +109,19 @@ public:
|
||||
void copy(int sx, int sy, int ex, int ey, int dx, int dy) {
|
||||
copy_screen(src_screen, dest_screen, sx, sy, ex, ey, dx, dy);
|
||||
}
|
||||
void copy_screen(int src, int dest, int sx, int sy, int ex, int ey, int dx, int dy,
|
||||
void copy_screen(ScreenId src, ScreenId dest, int sx, int sy, int ex, int ey, int dx, int dy,
|
||||
int transparent_color = -1);
|
||||
void gcopy(int gsc, int gde, int glx, int gly, int gsw);
|
||||
void paint(int x, int y, uint8 color);
|
||||
void draw_mesh(int sx, int sy, int width, int height);
|
||||
void box_fill(int dest, int sx, int sy, int ex, int ey, uint8 color);
|
||||
void box_line(int dest, int sx, int sy, int ex, int ey, uint8 color);
|
||||
void box_fill(ScreenId dest, int sx, int sy, int ex, int ey, uint8 color);
|
||||
void box_line(ScreenId dest, int sx, int sy, int ex, int ey, uint8 color);
|
||||
void draw_window(int sx, int sy, int ex, int ey, bool frame, uint8 frame_color, uint8 back_color);
|
||||
|
||||
CG save_rect(int x, int y, int width, int height);
|
||||
void restore_rect(const CG& cg);
|
||||
|
||||
int draw_text(int dest, int x, int y, std::u16string_view codes, int font_size, uint8 color);
|
||||
int draw_text(ScreenId dest, int x, int y, std::u16string_view codes, int font_size, uint8 color);
|
||||
|
||||
void load_cursor(int page, uint8_t flags);
|
||||
void select_cursor();
|
||||
@@ -126,9 +133,8 @@ public:
|
||||
|
||||
SDL_Rect dirty_rect = {};
|
||||
|
||||
// 画面選択
|
||||
int src_screen;
|
||||
int dest_screen;
|
||||
ScreenId src_screen = SCREEN_FRONT;
|
||||
ScreenId dest_screen = SCREEN_FRONT;
|
||||
|
||||
int scroll = 0;
|
||||
int window_width, window_height;
|
||||
|
||||
@@ -14,10 +14,10 @@ void AGS::load_cursor(int page, uint8_t flags)
|
||||
{
|
||||
// カーソルCGをロードする
|
||||
auto j_backup = cg_dest;
|
||||
int dest = dest_screen;
|
||||
ScreenId dest = dest_screen;
|
||||
|
||||
cg_dest = {0, 0};
|
||||
dest_screen = 1;
|
||||
dest_screen = SCREEN_BACK;
|
||||
|
||||
load_cg(page, -1, flags);
|
||||
|
||||
@@ -32,7 +32,7 @@ void AGS::load_cursor(int page, uint8_t flags)
|
||||
|
||||
for(int y = 0; y < 32; y++) {
|
||||
for(int x = 0; x < 32; x++) {
|
||||
pat[y + 1][x + 1] = (vram[1][y >> 1][(x >> 1) + 16 * i] & 0xf) ? 1 : 0;
|
||||
pat[y + 1][x + 1] = (vram[SCREEN_BACK][y >> 1][(x >> 1) + 16 * i] & 0xf) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+28
-28
@@ -108,13 +108,13 @@ CG AGS::load_cg_surface(int page, int transparent, uint8_t flags)
|
||||
return cg;
|
||||
}
|
||||
|
||||
void AGS::blit_cg(int dest, CG& cg, const SDL_Rect* src, int dx, int dy)
|
||||
void AGS::blit_cg(ScreenId dest, CG& cg, const SDL_Rect* src, int dx, int dy)
|
||||
{
|
||||
if (!cg.surface())
|
||||
return;
|
||||
SDL_Rect dstrect = { dx, dy, src ? src->w : cg.width(), src ? src->h : cg.height() };
|
||||
SDL_BlitSurface(cg.surface(), src, hBmpScreen[dest], &dstrect);
|
||||
if (dest == 0) {
|
||||
if (dest == SCREEN_FRONT) {
|
||||
invalidate_screen(dstrect.x, dstrect.y, dstrect.w, dstrect.h);
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void AGS::load_cg(int page, int transparent, uint8_t flags)
|
||||
blit_cg(dest_screen, cg, NULL, cg.x, cg.y);
|
||||
}
|
||||
|
||||
void AGS::copy_screen(int src, int dest, int sx, int sy, int ex, int ey, int dx, int dy, int transparent_color)
|
||||
void AGS::copy_screen(ScreenId src, ScreenId dest, int sx, int sy, int ex, int ey, int dx, int dy, int transparent_color)
|
||||
{
|
||||
int width = ex - sx + 1;
|
||||
int height = ey - sy + 1;
|
||||
@@ -150,15 +150,15 @@ void AGS::copy_screen(int src, int dest, int sx, int sy, int ex, int ey, int dx,
|
||||
if (transparent_color >= 0)
|
||||
SDL_SetColorKey(src_surface, SDL_FALSE, 0);
|
||||
|
||||
if (dest == 0)
|
||||
if (dest == SCREEN_FRONT)
|
||||
invalidate_screen(dx, dy, width, height);
|
||||
}
|
||||
|
||||
void AGS::gcopy(int gsc, int gde, int glx, int gly, int gsw)
|
||||
{
|
||||
// N88-BASIC時代のコピーコマンド
|
||||
int src = (gsw == 0 || gsw == 2) ? 0 : 1;
|
||||
int dest = (gsw == 0 || gsw == 3) ? 0 : 1;
|
||||
ScreenId src = (gsw == 0 || gsw == 2) ? SCREEN_FRONT : SCREEN_BACK;
|
||||
ScreenId dest = (gsw == 0 || gsw == 3) ? SCREEN_FRONT : SCREEN_BACK;
|
||||
int sx = (gsc % 80) * 8;
|
||||
int sy = gsc / 80;
|
||||
int dx = (gde % 80) * 8;
|
||||
@@ -168,14 +168,14 @@ void AGS::gcopy(int gsc, int gde, int glx, int gly, int gsw)
|
||||
|
||||
SDL_BlitSurface(hBmpScreen[src], &srcrect, hBmpScreen[dest], &destrect);
|
||||
|
||||
if(dest == 0) {
|
||||
if(dest == SCREEN_FRONT) {
|
||||
invalidate_screen(dx, dy, glx * 8, gly);
|
||||
}
|
||||
}
|
||||
|
||||
void AGS::paint(int x, int y, uint8 color)
|
||||
{
|
||||
uint8_t old_color = vram[0][y][x];
|
||||
uint8_t old_color = vram[SCREEN_FRONT][y][x];
|
||||
if (old_color == color)
|
||||
return;
|
||||
|
||||
@@ -186,25 +186,25 @@ void AGS::paint(int x, int y, uint8 color)
|
||||
while (!stack.empty()) {
|
||||
std::tie(x, y) = stack.back();
|
||||
stack.pop_back();
|
||||
while (x >= 0 && vram[0][y][x] == old_color) x--;
|
||||
while (x >= 0 && vram[SCREEN_FRONT][y][x] == old_color) x--;
|
||||
x++;
|
||||
minx = std::min(x, minx);
|
||||
bool span_above = false, span_below = false;
|
||||
for (; x < 640 && vram[0][y][x] == old_color; x++) {
|
||||
vram[0][y][x] = color;
|
||||
for (; x < 640 && vram[SCREEN_FRONT][y][x] == old_color; x++) {
|
||||
vram[SCREEN_FRONT][y][x] = color;
|
||||
if (y > 0) {
|
||||
if (!span_above && vram[0][y - 1][x] == old_color) {
|
||||
if (!span_above && vram[SCREEN_FRONT][y - 1][x] == old_color) {
|
||||
stack.push_back({x, y - 1});
|
||||
span_above = true;
|
||||
} else if (span_above && vram[0][y - 1][x] != old_color) {
|
||||
} else if (span_above && vram[SCREEN_FRONT][y - 1][x] != old_color) {
|
||||
span_above = false;
|
||||
}
|
||||
}
|
||||
if (y < screen_height - 1) {
|
||||
if (!span_below && vram[0][y + 1][x] == old_color) {
|
||||
if (!span_below && vram[SCREEN_FRONT][y + 1][x] == old_color) {
|
||||
stack.push_back({x, y + 1});
|
||||
span_below = true;
|
||||
} else if (span_below && vram[0][y + 1][x] != old_color) {
|
||||
} else if (span_below && vram[SCREEN_FRONT][y + 1][x] != old_color) {
|
||||
span_below = false;
|
||||
}
|
||||
}
|
||||
@@ -221,25 +221,25 @@ void AGS::draw_mesh(int sx, int sy, int width, int height)
|
||||
// super d.p.s
|
||||
for(int y = sy, h = 0; h < height && y < 480; y += 2, h += 2) {
|
||||
for(int x = sx, w = 0; w < width && x < 640; x += 2, w += 2) {
|
||||
vram[0][y][x] = 255;
|
||||
vram[SCREEN_FRONT][y][x] = 255;
|
||||
}
|
||||
for(int x = sx + 1, w = 1; w < width && x < 640; x += 2, w += 2) {
|
||||
vram[0][y + 1][x] = 255;
|
||||
vram[SCREEN_FRONT][y + 1][x] = 255;
|
||||
}
|
||||
}
|
||||
invalidate_screen(sx, sy, width, height);
|
||||
}
|
||||
|
||||
void AGS::box_fill(int dest, int sx, int sy, int ex, int ey, uint8 color)
|
||||
void AGS::box_fill(ScreenId dest, int sx, int sy, int ex, int ey, uint8 color)
|
||||
{
|
||||
SDL_Rect rect = {sx, sy, ex - sx + 1, ey - sy + 1};
|
||||
SDL_FillRect(hBmpScreen[dest], &rect, color);
|
||||
if(dest == 0) {
|
||||
if(dest == SCREEN_FRONT) {
|
||||
invalidate_screen(sx, sy, ex - sx + 1, ey - sy + 1);
|
||||
}
|
||||
}
|
||||
|
||||
void AGS::box_line(int dest, int sx, int sy, int ex, int ey, uint8 color)
|
||||
void AGS::box_line(ScreenId dest, int sx, int sy, int ex, int ey, uint8 color)
|
||||
{
|
||||
SDL_Rect top = {sx, sy, ex - sx + 1, 1};
|
||||
SDL_Rect bottom = {sx, ey, ex - sx + 1, 1};
|
||||
@@ -250,7 +250,7 @@ void AGS::box_line(int dest, int sx, int sy, int ex, int ey, uint8 color)
|
||||
SDL_FillRect(hBmpScreen[dest], &bottom, color);
|
||||
SDL_FillRect(hBmpScreen[dest], &left, color);
|
||||
SDL_FillRect(hBmpScreen[dest], &right, color);
|
||||
if(dest == 0) {
|
||||
if(dest == SCREEN_FRONT) {
|
||||
invalidate_screen(sx, sy, ex - sx + 1, ey - sy + 1);
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@ void AGS::box_line(int dest, int sx, int sy, int ex, int ey, uint8 color)
|
||||
void AGS::draw_window(int sx, int sy, int ex, int ey, bool frame, uint8 frame_color, uint8 back_color)
|
||||
{
|
||||
SDL_Rect rect = {sx, sy, ex - sx + 1, ey - sy + 1};
|
||||
SDL_FillRect(hBmpScreen[0], &rect, back_color);
|
||||
SDL_FillRect(hBmpScreen[SCREEN_FRONT], &rect, back_color);
|
||||
|
||||
if (frame) {
|
||||
SDL_Rect rects[] = {
|
||||
@@ -267,8 +267,8 @@ void AGS::draw_window(int sx, int sy, int ex, int ey, bool frame, uint8 frame_co
|
||||
{sx + 1, sy + 1, 2, ey - sy - 1},
|
||||
{ex - 2, sy + 1, 2, ey - sy - 1},
|
||||
};
|
||||
SDL_FillRects(hBmpScreen[0], rects, 4, frame_color);
|
||||
box_line(0, sx + 4, sy + 4, ex - 4, ey - 4, frame_color);
|
||||
SDL_FillRects(hBmpScreen[SCREEN_FRONT], rects, 4, frame_color);
|
||||
box_line(SCREEN_FRONT, sx + 4, sy + 4, ex - 4, ey - 4, frame_color);
|
||||
}
|
||||
invalidate_screen(sx, sy, ex - sx + 1, ey - sy + 1);
|
||||
}
|
||||
@@ -279,15 +279,15 @@ CG AGS::save_rect(int x, int y, int width, int height)
|
||||
SDL_SetPaletteColors(cg.palette(), screen_palette->colors, 0, 256);
|
||||
|
||||
SDL_Rect rect = {x, y, width, height};
|
||||
SDL_BlitSurface(hBmpScreen[0], &rect, cg.surface(), NULL);
|
||||
SDL_BlitSurface(hBmpScreen[SCREEN_FRONT], &rect, cg.surface(), NULL);
|
||||
return cg;
|
||||
}
|
||||
|
||||
void AGS::restore_rect(const CG& cg)
|
||||
{
|
||||
SDL_SetSurfacePalette(hBmpScreen[0], cg.palette());
|
||||
SDL_SetSurfacePalette(hBmpScreen[SCREEN_FRONT], cg.palette());
|
||||
SDL_Rect rect = {cg.x, cg.y, cg.width(), cg.height()};
|
||||
SDL_BlitSurface(cg.surface(), NULL, hBmpScreen[0], &rect);
|
||||
SDL_BlitSurface(cg.surface(), NULL, hBmpScreen[SCREEN_FRONT], &rect);
|
||||
invalidate_screen(cg.x, cg.y, cg.width(), cg.height());
|
||||
SDL_SetSurfacePalette(hBmpScreen[0], screen_palette);
|
||||
SDL_SetSurfacePalette(hBmpScreen[SCREEN_FRONT], screen_palette);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ bool antialias = true;
|
||||
|
||||
} // namespace
|
||||
|
||||
int AGS::draw_text(int dest, int x, int y, std::u16string_view codes, int font_size, uint8 color)
|
||||
int AGS::draw_text(ScreenId dest, int x, int y, std::u16string_view codes, int font_size, uint8 color)
|
||||
{
|
||||
uint8 antialias_cache[256*7];
|
||||
if (antialias)
|
||||
@@ -58,12 +58,12 @@ int AGS::draw_text(int dest, int x, int y, std::u16string_view codes, int font_s
|
||||
}
|
||||
|
||||
// 画面更新
|
||||
if (dest == 0)
|
||||
if (dest == SCREEN_FRONT)
|
||||
invalidate_screen(x, dest_y, dest_x - x, ascent - descent);
|
||||
return dest_x;
|
||||
}
|
||||
|
||||
void AGS::draw_char(int dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color)
|
||||
void AGS::draw_char(ScreenId dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color)
|
||||
{
|
||||
// パターン取得
|
||||
SDL_Color white = {0xff, 0xff, 0xff};
|
||||
@@ -97,7 +97,7 @@ int AGS::nearest_color(int r, int g, int b) {
|
||||
return col;
|
||||
}
|
||||
|
||||
void AGS::draw_char_antialias(int dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color, uint8 cache[])
|
||||
void AGS::draw_char_antialias(ScreenId dest, int dest_x, int dest_y, uint16 code, TTF_Font* font, uint8 color, uint8 cache[])
|
||||
{
|
||||
// パターン取得
|
||||
SDL_Color black = {0, 0, 0};
|
||||
@@ -131,7 +131,7 @@ 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, const uint8_t bitmap[32], int size, uint8 color)
|
||||
void AGS::draw_gaiji(ScreenId dest, int dest_x, int dest_y, const uint8_t bitmap[32], int size, uint8 color)
|
||||
{
|
||||
bool pattern[16][16];
|
||||
|
||||
|
||||
+42
-46
@@ -231,16 +231,13 @@ private:
|
||||
|
||||
// --- screens and CG loading -------------------------------------------
|
||||
|
||||
// The second VRAM page for offscreen work.
|
||||
static constexpr int WORK_SCREEN = 1;
|
||||
|
||||
// Palette index the color keyed blits treat as transparent.
|
||||
static constexpr int TRANSPARENT_COLOR = 7;
|
||||
|
||||
// Y 111
|
||||
void load_cg_to_work_screen(int page) {
|
||||
int saved = ags->dest_screen;
|
||||
ags->dest_screen = WORK_SCREEN;
|
||||
ScreenId saved = ags->dest_screen;
|
||||
ags->dest_screen = SCREEN_BACK;
|
||||
load_cg(page, -1);
|
||||
ags->dest_screen = saved;
|
||||
}
|
||||
@@ -411,7 +408,7 @@ private:
|
||||
|
||||
if (map_id == 0) {
|
||||
// Fill the direction key panel area with color 1.
|
||||
ags->box_fill(0, 16, 304, 103, 391, 1);
|
||||
ags->box_fill(SCREEN_FRONT, 16, 304, 103, 391, 1);
|
||||
reset_map_overview();
|
||||
} else if (map_id == 255) {
|
||||
for (auto& record : map_explored)
|
||||
@@ -444,7 +441,6 @@ private:
|
||||
// T ...,255 leaves no sprite to draw.
|
||||
static constexpr uint8_t SPRITE_HIDDEN = 0xff;
|
||||
|
||||
static constexpr int MAP_WORK_SCREEN = 2;
|
||||
static constexpr int ANIMATION_FRAME_MS = 16;
|
||||
|
||||
uint16_t map_view_x = 0;
|
||||
@@ -567,7 +563,7 @@ private:
|
||||
if (!map_base_visible_view)
|
||||
base = CELL_EMPTY;
|
||||
if (base == CELL_EMPTY) {
|
||||
ags->box_fill(MAP_WORK_SCREEN, px, py,
|
||||
ags->box_fill(SCREEN_MENU, px, py,
|
||||
px + TILE_SIZE - 1, py + TILE_SIZE - 1, 0);
|
||||
} else {
|
||||
draw_map_tile(base, px, py, false);
|
||||
@@ -605,7 +601,7 @@ private:
|
||||
for (int frame = 1; frame <= frames && !terminate; frame++) {
|
||||
int wx = step_position(window_x, view_step_x, frame, frames);
|
||||
int wy = step_position(window_y, view_step_y, frame, frames);
|
||||
ags->copy_screen(MAP_WORK_SCREEN, 0, wx, wy,
|
||||
ags->copy_screen(SCREEN_MENU, SCREEN_FRONT, wx, wy,
|
||||
wx + VIEW_COLS * TILE_SIZE - 1,
|
||||
wy + VIEW_ROWS * TILE_SIZE - 1, VIEW_X, VIEW_Y);
|
||||
if (map_sprite_frame != SPRITE_HIDDEN) {
|
||||
@@ -636,7 +632,7 @@ private:
|
||||
return;
|
||||
}
|
||||
int index = tile % TILES_PER_BANK;
|
||||
blit_sheet(MAP_WORK_SCREEN, map_tile_cg[bank],
|
||||
blit_sheet(SCREEN_MENU, map_tile_cg[bank],
|
||||
(index % SHEET_COLS) * TILE_SIZE,
|
||||
(index / SHEET_COLS) * TILE_SIZE,
|
||||
TILE_SIZE, TILE_SIZE, px, py, transparent);
|
||||
@@ -654,11 +650,11 @@ private:
|
||||
int bottom = std::min(py + TILE_SIZE, VIEW_Y + VIEW_ROWS * TILE_SIZE);
|
||||
if (left >= right || top >= bottom)
|
||||
return;
|
||||
blit_sheet(0, map_sprite_cg, frame * TILE_SIZE + (left - px), top - py,
|
||||
blit_sheet(SCREEN_FRONT, map_sprite_cg, frame * TILE_SIZE + (left - px), top - py,
|
||||
right - left, bottom - top, left, top, true);
|
||||
}
|
||||
|
||||
void blit_sheet(int dest, CG& cg, int sheet_x, int sheet_y,
|
||||
void blit_sheet(ScreenId dest, CG& cg, int sheet_x, int sheet_y,
|
||||
int width, int height, int dx, int dy, bool transparent) {
|
||||
SDL_Rect src = { sheet_x, sheet_y, width, height };
|
||||
if (src.x + width > cg.width() || src.y + height > cg.height()) {
|
||||
@@ -699,7 +695,7 @@ private:
|
||||
|
||||
void reset_map_overview() {
|
||||
map_overview_rebuild_pending = true;
|
||||
ags->box_fill(0, OVERVIEW_X, OVERVIEW_Y,
|
||||
ags->box_fill(SCREEN_FRONT, OVERVIEW_X, OVERVIEW_Y,
|
||||
OVERVIEW_X + OVERVIEW_W - 1, OVERVIEW_Y + OVERVIEW_H - 1, 0);
|
||||
}
|
||||
|
||||
@@ -737,7 +733,7 @@ private:
|
||||
}
|
||||
|
||||
void rebuild_map_overview() {
|
||||
ags->box_fill(0, OVERVIEW_X, OVERVIEW_Y,
|
||||
ags->box_fill(SCREEN_FRONT, OVERVIEW_X, OVERVIEW_Y,
|
||||
OVERVIEW_X + OVERVIEW_W - 1, OVERVIEW_Y + OVERVIEW_H - 1, 0);
|
||||
for (int y = 0; y < MAP_HEIGHT; y++) {
|
||||
for (int x = 0; x < MAP_WIDTH; x++) {
|
||||
@@ -762,7 +758,7 @@ private:
|
||||
if (bank >= NR_TILE_BANKS || !map_tile_cg[bank])
|
||||
return;
|
||||
int index = tile % TILES_PER_BANK;
|
||||
blit_sheet(0, map_tile_cg[bank],
|
||||
blit_sheet(SCREEN_FRONT, map_tile_cg[bank],
|
||||
(index % SHEET_COLS) * OVERVIEW_CELL,
|
||||
OVERVIEW_PATTERN_Y + (index / SHEET_COLS) * OVERVIEW_CELL,
|
||||
OVERVIEW_CELL, OVERVIEW_CELL,
|
||||
@@ -781,12 +777,12 @@ private:
|
||||
if (!map_marker_saved_color_stale) {
|
||||
int px = OVERVIEW_X + map_marker_prev_x * OVERVIEW_CELL;
|
||||
int py = OVERVIEW_Y + map_marker_prev_y * OVERVIEW_CELL;
|
||||
ags->box_fill(0, px, py, px + OVERVIEW_CELL - 1, py + OVERVIEW_CELL - 1,
|
||||
ags->box_fill(SCREEN_FRONT, px, py, px + OVERVIEW_CELL - 1, py + OVERVIEW_CELL - 1,
|
||||
map_marker_saved_color);
|
||||
}
|
||||
map_marker_prev_x = map_marker_x;
|
||||
map_marker_prev_y = map_marker_y;
|
||||
map_marker_saved_color = ags->get_pixel(0, x, y);
|
||||
map_marker_saved_color = ags->get_pixel(SCREEN_FRONT, x, y);
|
||||
map_marker_saved_color_stale = false;
|
||||
}
|
||||
|
||||
@@ -794,7 +790,7 @@ private:
|
||||
if (now >= map_marker_blink_deadline) {
|
||||
map_marker_blink_deadline = now + ticks_to_ms(map_animation_ticks + 10);
|
||||
map_marker_blink_color ^= 0x0f;
|
||||
ags->box_fill(0, x, y, x + OVERVIEW_CELL - 1, y + OVERVIEW_CELL - 1, map_marker_blink_color);
|
||||
ags->box_fill(SCREEN_FRONT, x, y, x + OVERVIEW_CELL - 1, y + OVERVIEW_CELL - 1, map_marker_blink_color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1050,19 +1046,19 @@ private:
|
||||
// the work screen.
|
||||
void draw_key_panel() {
|
||||
int x = key_panel_src_x;
|
||||
ags->copy_screen(WORK_SCREEN, 0, x + 104, 304, x + 191, 391, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, x + 104, 304, x + 191, 391, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
switch (key_panel_direction) {
|
||||
case 1:
|
||||
ags->copy_screen(WORK_SCREEN, 0, x + 192, 304, x + 279, 343, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, x + 192, 304, x + 279, 343, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
break;
|
||||
case 2:
|
||||
ags->copy_screen(WORK_SCREEN, 0, x + 192, 352, x + 279, 391, KEY_PANEL_X, KEY_PANEL_Y + 48);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, x + 192, 352, x + 279, 391, KEY_PANEL_X, KEY_PANEL_Y + 48);
|
||||
break;
|
||||
case 4:
|
||||
ags->copy_screen(WORK_SCREEN, 0, x + 280, 304, x + 319, 391, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, x + 280, 304, x + 319, 391, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
break;
|
||||
case 8:
|
||||
ags->copy_screen(WORK_SCREEN, 0, x + 328, 304, x + 367, 391, KEY_PANEL_X + 48, KEY_PANEL_Y);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, x + 328, 304, x + 367, 391, KEY_PANEL_X + 48, KEY_PANEL_Y);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1104,12 +1100,12 @@ private:
|
||||
}
|
||||
|
||||
void draw_digit(int digit, int x, int y, uint8_t color) {
|
||||
ags->box_fill(0, x, y, x + DIGIT_WIDTH - 1, y + DIGIT_HEIGHT - 1, DIGIT_BACK_COLOR);
|
||||
ags->box_fill(SCREEN_FRONT, x, y, x + DIGIT_WIDTH - 1, y + DIGIT_HEIGHT - 1, DIGIT_BACK_COLOR);
|
||||
for (int row = 0; row < DIGIT_HEIGHT; row++) {
|
||||
uint8_t bits = digit_font[digit][row];
|
||||
for (int col = 0; col < DIGIT_WIDTH; col++) {
|
||||
if (bits & (0x80 >> col))
|
||||
ags->set_pixel(0, x + col, y + row, color);
|
||||
ags->set_pixel(SCREEN_FRONT, x + col, y + row, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1128,7 +1124,7 @@ private:
|
||||
int i = 0;
|
||||
while (i < digits && d[i] == 0) {
|
||||
// Leading zeros are blanked.
|
||||
ags->box_fill(0, x + i * DIGIT_WIDTH, y,
|
||||
ags->box_fill(SCREEN_FRONT, x + i * DIGIT_WIDTH, y,
|
||||
x + i * DIGIT_WIDTH + DIGIT_WIDTH - 1, y + DIGIT_HEIGHT - 1,
|
||||
DIGIT_BACK_COLOR);
|
||||
i++;
|
||||
@@ -1168,7 +1164,7 @@ private:
|
||||
draw_number(VAR_PE_SCORE, 2, 88, 272);
|
||||
} else {
|
||||
// Redraw the direction key panel from the work screen.
|
||||
ags->copy_screen(WORK_SCREEN, 0, 104, 304, 191, 391, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, 104, 304, 191, 391, KEY_PANEL_X, KEY_PANEL_Y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,7 +1197,7 @@ private:
|
||||
|
||||
load_cg_to_work_screen(230);
|
||||
// Save the part of the display CG 208 overwrites.
|
||||
ags->copy_screen(0, WORK_SCREEN, 16, 192, 367, 294, 0, 48);
|
||||
ags->copy_screen(SCREEN_FRONT, SCREEN_BACK, 16, 192, 367, 294, 0, 48);
|
||||
load_cg(208, -1);
|
||||
|
||||
VAR_TROOP_COUNT_FULL = VAR_TROOP_COUNT;
|
||||
@@ -1254,7 +1250,7 @@ private:
|
||||
}
|
||||
|
||||
// Restore the saved area.
|
||||
ags->copy_screen(WORK_SCREEN, 0, 0, 48, 351, 150, 16, 192);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, 0, 48, 351, 150, 16, 192);
|
||||
}
|
||||
|
||||
const TroopButton* troop_button_at(int x, int y) {
|
||||
@@ -1268,7 +1264,7 @@ private:
|
||||
void draw_troop_button(int image_x, const TroopButton& b) {
|
||||
// The subtract buttons use the lower row of images.
|
||||
int image_y = b.step < 0 ? 24 : 4;
|
||||
ags->copy_screen(WORK_SCREEN, 0, image_x, image_y,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, image_x, image_y,
|
||||
image_x + TROOP_BUTTON_WIDTH - 1,
|
||||
image_y + TROOP_BUTTON_HEIGHT - 1, b.x, b.y);
|
||||
}
|
||||
@@ -1288,7 +1284,7 @@ private:
|
||||
int digit = value / divisor;
|
||||
value %= divisor;
|
||||
divisor /= 10;
|
||||
ags->copy_screen(WORK_SCREEN, 0, digit * 48, 0, digit * 48 + 47, 47,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, digit * 48, 0, digit * 48 + 47, 47,
|
||||
120 + i * 48, 232);
|
||||
}
|
||||
}
|
||||
@@ -1357,7 +1353,7 @@ private:
|
||||
uint16_t bit = 0x8000 >> col;
|
||||
if (!(cursor.silhouette[row] & bit))
|
||||
continue;
|
||||
ags->set_pixel(0, x + col, y + row, (cursor.body[row] & bit) ? 15 : 0);
|
||||
ags->set_pixel(SCREEN_FRONT, x + col, y + row, (cursor.body[row] & bit) ? 15 : 0);
|
||||
}
|
||||
}
|
||||
ags->invalidate_screen(x, y, MOUSE_CURSOR_SIZE, MOUSE_CURSOR_SIZE);
|
||||
@@ -1437,13 +1433,13 @@ private:
|
||||
int ex = sx + cell_w - 1;
|
||||
int ey = sy + (wide ? 31 : 32);
|
||||
if (state == 0) {
|
||||
ags->box_fill(WORK_SCREEN, sx, sy, ex, ey, 0);
|
||||
ags->box_fill(SCREEN_BACK, sx, sy, ex, ey, 0);
|
||||
} else {
|
||||
for (int n = 0; n < 3; n++)
|
||||
ags->box_line(WORK_SCREEN, sx + n, sy + n, ex - n, ey - n, 15);
|
||||
ags->box_line(SCREEN_BACK, sx + n, sy + n, ex - n, ey - n, 15);
|
||||
}
|
||||
}
|
||||
ags->copy_screen(WORK_SCREEN, 0, GRID_COPY_X1, 0, GRID_COPY_X2, GRID_COPY_Y2,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, GRID_COPY_X1, 0, GRID_COPY_X2, GRID_COPY_Y2,
|
||||
GRID_COPY_X1, 0);
|
||||
|
||||
int& cx = grid_cursor_x[wide ? 1 : 0];
|
||||
@@ -1470,7 +1466,7 @@ private:
|
||||
if (!cursor_drawn)
|
||||
return;
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
ags->copy_screen(WORK_SCREEN, 0, cx, cy, cx + MOUSE_CURSOR_SIZE - 1,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, cx, cy, cx + MOUSE_CURSOR_SIZE - 1,
|
||||
cy + MOUSE_CURSOR_SIZE - 1, cx, cy);
|
||||
cursor_drawn = false;
|
||||
};
|
||||
@@ -1568,7 +1564,7 @@ private:
|
||||
load_cg_to_work_screen(VAR_BATTLE_DRAW_CG);
|
||||
break;
|
||||
case 1:
|
||||
ags->box_fill(WORK_SCREEN, 0, 0, 4 * BATTLE_FRAME_W - 1, BATTLE_FRAME_H - 1,
|
||||
ags->box_fill(SCREEN_BACK, 0, 0, 4 * BATTLE_FRAME_W - 1, BATTLE_FRAME_H - 1,
|
||||
BATTLE_BACK_COLOR);
|
||||
break;
|
||||
case 2:
|
||||
@@ -1581,7 +1577,7 @@ private:
|
||||
part -= BATTLE_PARTS_PER_ROW;
|
||||
int sx = part * BATTLE_PART_SIZE;
|
||||
int sy = BATTLE_PART_SHEET_Y + row * BATTLE_PART_SIZE;
|
||||
ags->copy_screen(WORK_SCREEN, WORK_SCREEN,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_BACK,
|
||||
sx, sy, sx + BATTLE_PART_SIZE - 1, sy + BATTLE_PART_SIZE - 1,
|
||||
part_x, part_y, TRANSPARENT_COLOR);
|
||||
}
|
||||
@@ -1594,7 +1590,7 @@ private:
|
||||
int frame = mode - 3;
|
||||
int sx = frame * BATTLE_FRAME_W;
|
||||
int dx = (frame < 2) ? BATTLE_LEFT_DEST_X : BATTLE_RIGHT_DEST_X;
|
||||
ags->copy_screen(WORK_SCREEN, 0, sx, 0, sx + BATTLE_FRAME_W - 1,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, sx, 0, sx + BATTLE_FRAME_W - 1,
|
||||
BATTLE_FRAME_H - 1, dx, BATTLE_DEST_Y);
|
||||
}
|
||||
break;
|
||||
@@ -1614,7 +1610,7 @@ private:
|
||||
for (int half = 0; half < 2; half++) {
|
||||
int sx = base_x + half * BATTLE_FRAME_W;
|
||||
for (int frame = 0; frame < 2; frame++) {
|
||||
ags->copy_screen(WORK_SCREEN, WORK_SCREEN,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_BACK,
|
||||
sx, BATTLE_TEMPLATE_Y,
|
||||
sx + BATTLE_FRAME_W - 1, BATTLE_TEMPLATE_Y + BATTLE_TEMPLATE_H - 1,
|
||||
base_x + frame * BATTLE_FRAME_W, half * BATTLE_TEMPLATE_H);
|
||||
@@ -1663,7 +1659,7 @@ private:
|
||||
int value = table[offset] | (table[offset + 1] << 8);
|
||||
int x = DISSOLVE_X + value % DISSOLVE_STRIDE;
|
||||
int y = DISSOLVE_Y + value / DISSOLVE_STRIDE;
|
||||
ags->copy_screen(WORK_SCREEN, 0, x, y, x, y, x, y);
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, x, y, x, y, x, y);
|
||||
if ((i & 0x2f) == 0x2f)
|
||||
wait_ticks(1);
|
||||
}
|
||||
@@ -1779,13 +1775,13 @@ private:
|
||||
}
|
||||
|
||||
void clear_credit_column() {
|
||||
ags->box_fill(WORK_SCREEN, CREDIT_X1, 0, CREDIT_X2, 399, 0);
|
||||
ags->box_fill(SCREEN_BACK, CREDIT_X1, 0, CREDIT_X2, 399, 0);
|
||||
}
|
||||
|
||||
void draw_credit_text(int x, int y, std::string_view str, bool hankaku) {
|
||||
int saved_screen = ags->dest_screen;
|
||||
ScreenId saved_screen = ags->dest_screen;
|
||||
bool saved_hankaku = draw_hankaku;
|
||||
ags->dest_screen = WORK_SCREEN;
|
||||
ags->dest_screen = SCREEN_BACK;
|
||||
draw_hankaku = hankaku;
|
||||
text.pos.x = x;
|
||||
text.pos.y = y;
|
||||
@@ -1798,10 +1794,10 @@ private:
|
||||
constexpr int band_rows[] = {315, 317, 384, 386};
|
||||
|
||||
for (int step = 0; step < steps && !terminate; step++) {
|
||||
ags->copy_screen(WORK_SCREEN, 0, CREDIT_X1, step, CREDIT_X2,
|
||||
ags->copy_screen(SCREEN_BACK, SCREEN_FRONT, CREDIT_X1, step, CREDIT_X2,
|
||||
step + CREDIT_BAND_H - 1, CREDIT_X1, CREDIT_BAND_Y);
|
||||
for (int row : band_rows)
|
||||
ags->box_fill(0, CREDIT_X1, row, CREDIT_X2, row, 0);
|
||||
ags->box_fill(SCREEN_FRONT, CREDIT_X1, row, CREDIT_X2, row, 0);
|
||||
wait_ticks(get_key() ? 1 : 4);
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
@@ -639,47 +639,47 @@ public:
|
||||
// One the actual MSX, this bar was constructed in an irregular fashion. This code constructs a more consistent version, where each square
|
||||
// is 35px wide with 2px borders on each side. Since the borders are overlapped, this means each sub-sprite is placed 37px apart.
|
||||
else if (param == 46) {
|
||||
// Originally this would have loaded Image 296, the party status bar, to screen 1 for future reference. However, due to trouble with
|
||||
// Originally this would have loaded Image 296, the party status bar, to the back screen for future reference. However, due to trouble with
|
||||
// the palette, I decided to load it before using each subcommand, instead.
|
||||
/*ags->dest_screen = 1;
|
||||
/*ags->dest_screen = SCREEN_BACK;
|
||||
load_cg(296, -1);
|
||||
ags->dest_screen = 0;*/
|
||||
ags->dest_screen = SCREEN_FRONT;*/
|
||||
}
|
||||
else if (param == 30) {
|
||||
// Load party status bar to screen 1.
|
||||
ags->dest_screen = 1;
|
||||
// Load party status bar to the back screen.
|
||||
ags->dest_screen = SCREEN_BACK;
|
||||
load_cg(296, -1);
|
||||
ags->dest_screen = 0;
|
||||
ags->dest_screen = SCREEN_FRONT;
|
||||
|
||||
// Draw Wataru's icon.
|
||||
ags->src_screen = 1;
|
||||
ags->src_screen = SCREEN_BACK;
|
||||
ags->copy(10, 182, 48, 224, 7, 210);
|
||||
ags->src_screen = 0;
|
||||
ags->src_screen = SCREEN_FRONT;
|
||||
}
|
||||
else if (param >= 34 && param <= 39) {
|
||||
int x = (39 - param) * 37 + 45;
|
||||
|
||||
// Load party status bar to screen 1.
|
||||
ags->dest_screen = 1;
|
||||
// Load party status bar to the back screen.
|
||||
ags->dest_screen = SCREEN_BACK;
|
||||
load_cg(296, -1);
|
||||
ags->dest_screen = 0;
|
||||
ags->dest_screen = SCREEN_FRONT;
|
||||
|
||||
// Draw a blank party icon to init or clear the party box.
|
||||
ags->src_screen = 1;
|
||||
ags->src_screen = SCREEN_BACK;
|
||||
ags->copy(269, 182, 307, 224, x, 210);
|
||||
ags->src_screen = 0;
|
||||
ags->src_screen = SCREEN_FRONT;
|
||||
} else {
|
||||
int x = (45 - param) * 37 + 45;
|
||||
|
||||
// Load party status bar to screen 1.
|
||||
ags->dest_screen = 1;
|
||||
// Load party status bar to the back screen.
|
||||
ags->dest_screen = SCREEN_BACK;
|
||||
load_cg(296, -1);
|
||||
ags->dest_screen = 0;
|
||||
ags->dest_screen = SCREEN_FRONT;
|
||||
|
||||
// Draw a party member's icon to the party bar.
|
||||
ags->src_screen = 1;
|
||||
ags->src_screen = SCREEN_BACK;
|
||||
ags->copy(x + 2, 182, x + 38, 224, x, 210);
|
||||
ags->src_screen = 0;
|
||||
ags->src_screen = SCREEN_FRONT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ public:
|
||||
} else if (cmd == 2) {
|
||||
if (param == 0) {
|
||||
// Clear the screen
|
||||
ags->box_fill(0, 0, 0, 640, 400, 0);
|
||||
ags->box_fill(SCREEN_FRONT, 0, 0, 640, 400, 0);
|
||||
} else {
|
||||
// Restore the screen
|
||||
load_cg(74, 8);
|
||||
@@ -884,9 +884,9 @@ public:
|
||||
|
||||
WAIT(2000);
|
||||
draw_box(0);
|
||||
ags->dest_screen = 1;
|
||||
ags->dest_screen = SCREEN_BACK;
|
||||
load_cg(173, -1);
|
||||
ags->dest_screen = 0;
|
||||
ags->dest_screen = SCREEN_FRONT;
|
||||
ags->gcopy(0x1ecd, 0x3a2a, 8, 60, 3);
|
||||
WAIT(667);
|
||||
ags->gcopy(0x1b65, 0x262e, 8, 60, 3);
|
||||
@@ -963,7 +963,7 @@ public:
|
||||
break;
|
||||
case 7:
|
||||
if (param == 1) {
|
||||
ags->box_fill(0, 40, 8, 598, 270, 0);
|
||||
ags->box_fill(SCREEN_FRONT, 40, 8, 598, 270, 0);
|
||||
}
|
||||
break;
|
||||
case 255:
|
||||
@@ -1000,10 +1000,10 @@ public:
|
||||
// Unknown
|
||||
}
|
||||
else if (param == 6) {
|
||||
ags->box_fill(0, 0, 0, 424, 276, 0);
|
||||
ags->box_fill(SCREEN_FRONT, 0, 0, 424, 276, 0);
|
||||
}
|
||||
else if (param == 7) {
|
||||
ags->box_fill(0, 0, 0, 640, 276, 0);
|
||||
ags->box_fill(SCREEN_FRONT, 0, 0, 640, 276, 0);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
|
||||
@@ -789,10 +789,10 @@ void NACT_Sys3::exec_y(int cmd, int param)
|
||||
text.line_space = (param == 0) ? 2 : 0;
|
||||
break;
|
||||
case 30:
|
||||
ags->src_screen = param ? 1 : 0;
|
||||
ags->src_screen = param ? SCREEN_BACK : SCREEN_FRONT;
|
||||
break;
|
||||
case 31:
|
||||
ags->dest_screen = param ? 1 : 0;
|
||||
ags->dest_screen = param ? SCREEN_BACK : SCREEN_FRONT;
|
||||
break;
|
||||
case 32:
|
||||
RND = (param <= 480) ? param : 480;
|
||||
@@ -822,9 +822,9 @@ void NACT_Sys3::exec_y(int cmd, int param)
|
||||
break;
|
||||
case 61:
|
||||
if(param) {
|
||||
ags->set_pixel(D03, D01, D02, (uint8)RND);
|
||||
ags->set_pixel(static_cast<ScreenId>(D03), D01, D02, (uint8)RND);
|
||||
} else {
|
||||
RND = ags->get_pixel(D03, D01, D02);
|
||||
RND = ags->get_pixel(static_cast<ScreenId>(D03), D01, D02);
|
||||
}
|
||||
break;
|
||||
case 70:
|
||||
@@ -1201,7 +1201,7 @@ bool NACT_Sys3::k3_hack(const K3HackInfo* info_table)
|
||||
draw_text("12345");
|
||||
text.font_size = orig_font_size;
|
||||
int left = info->left + info->w * (var[info->var] - 1);
|
||||
ags->box_line(0, left, info->top, left + info->w, info->top + info->h, text.font_color);
|
||||
ags->box_line(SCREEN_FRONT, left, info->top, left + info->w, info->top + info->h, text.font_color);
|
||||
}
|
||||
|
||||
// Only You: Prevents the cursor from being locked due to unselectable cells.
|
||||
@@ -1259,7 +1259,7 @@ bool NACT_Sys3::k3_hack(const K3HackInfo* info_table)
|
||||
if (info->draw_window) {
|
||||
// Clear the menu window.
|
||||
ags->box_fill(
|
||||
0, info->left - 6, info->top - 6,
|
||||
SCREEN_FRONT, info->left - 6, info->top - 6,
|
||||
info->left + info->w * info->cols + 6, info->top + info->h + 6, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ void NACT::draw_text(std::string_view string, bool wait)
|
||||
return;
|
||||
|
||||
TextContext& ctx = draw_menu ? menu : text;
|
||||
int screen = draw_menu ? 2 : ags->dest_screen;
|
||||
ScreenId screen = draw_menu ? SCREEN_MENU : ags->dest_screen;
|
||||
if (ctx.current_line_height < ctx.font_size)
|
||||
ctx.current_line_height = ctx.font_size;
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ void NACT::clear_text_window(int index, bool erase)
|
||||
if (w.frame && ags->is_faded()) {
|
||||
ags->draw_window(w.sx - 8, w.sy - 8, w.ex + 8, w.ey + 8, true, text.frame_color, text.back_color);
|
||||
} else {
|
||||
ags->box_fill(0, w.sx, w.sy, w.ex, w.ey, text.back_color);
|
||||
ags->box_fill(SCREEN_FRONT, w.sx, w.sy, w.ex, w.ey, text.back_color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ void NACT::draw_push(int index)
|
||||
Window& w = text_w[index - 1];
|
||||
int x = w.ex - 16;
|
||||
int y = w.ey - 16;
|
||||
ags->draw_gaiji(0, x, y, push_bitmap ? push_bitmap : builtin_bitmap, 16, text.font_color);
|
||||
ags->draw_gaiji(SCREEN_FRONT, x, y, push_bitmap ? push_bitmap : builtin_bitmap, 16, text.font_color);
|
||||
ags->invalidate_screen(x, y, 16, 16);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ void NACT::close_text_window(int index, bool update)
|
||||
|
||||
void NACT::clear_menu_window()
|
||||
{
|
||||
ags->box_fill(2, 0, 0, 639, 479, menu.back_color);
|
||||
ags->box_fill(SCREEN_MENU, 0, 0, 639, 479, menu.back_color);
|
||||
menu.reset_pos(2, 2);
|
||||
}
|
||||
|
||||
@@ -239,8 +239,8 @@ void NACT::open_menu_window(int index)
|
||||
}
|
||||
|
||||
ags->draw_window(wsx, wsy, wex, wey, w.frame, menu.frame_color, menu.back_color);
|
||||
ags->copy_screen(2, 0, 0, 0, width - 1, height - 1, sx, sy);
|
||||
ags->box_line(0, sx, sy, ex, sy + menu.font_size + 3, menu.frame_color);
|
||||
ags->copy_screen(SCREEN_MENU, SCREEN_FRONT, 0, 0, width - 1, height - 1, sx, sy);
|
||||
ags->box_line(SCREEN_FRONT, sx, sy, ex, sy + menu.font_size + 3, menu.frame_color);
|
||||
ags->invalidate_screen(wsx, wsy, wwidth, wheight);
|
||||
}
|
||||
|
||||
@@ -254,8 +254,8 @@ void NACT::redraw_menu_window(int index, int selected)
|
||||
int width = ex - sx + 1;
|
||||
int height = ey - sy + 1;
|
||||
|
||||
ags->copy_screen(2, 0, 0, 0, width - 1, height - 1, sx, sy);
|
||||
ags->box_line(0, sx, sy + (menu.font_size + 4) * selected, ex, sy + (menu.font_size + 4) * (selected + 1) - 1, menu.frame_color);
|
||||
ags->copy_screen(SCREEN_MENU, SCREEN_FRONT, 0, 0, width - 1, height - 1, sx, sy);
|
||||
ags->box_line(SCREEN_FRONT, sx, sy + (menu.font_size + 4) * selected, ex, sy + (menu.font_size + 4) * (selected + 1) - 1, menu.frame_color);
|
||||
ags->invalidate_screen(sx, sy, width, height);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user