mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-22 22:58:12 +03:00
AGS: Introduce Palette type
This commit is contained in:
+2
-2
@@ -162,7 +162,7 @@ AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id), dirty(
|
||||
acg.open("ACG.DAT");
|
||||
|
||||
// パレット
|
||||
memset(program_palette, 0, sizeof(program_palette));
|
||||
program_palette = {0};
|
||||
program_palette[0x00] = SETPALETTE16(0x0, 0x0, 0x0);
|
||||
program_palette[0x01] = SETPALETTE16(0x0, 0x0, 0xa);
|
||||
program_palette[0x02] = SETPALETTE16(0xa, 0x0, 0x0);
|
||||
@@ -224,7 +224,7 @@ AGS::AGS(const Config& config, const GameId& game_id) : game_id(game_id), dirty(
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(screen_palette, program_palette, sizeof(program_palette));
|
||||
screen_palette = program_palette;
|
||||
|
||||
// Bコマンド
|
||||
for(int i = 0; i < 10; i++) {
|
||||
|
||||
+7
-4
@@ -7,6 +7,7 @@
|
||||
#ifndef _AGS_H_
|
||||
#define _AGS_H_
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <stdio.h>
|
||||
#include "../common.h"
|
||||
@@ -16,6 +17,8 @@
|
||||
|
||||
#define MAX_CG 10000
|
||||
|
||||
using Palette = std::array<uint32, 256>;
|
||||
|
||||
static inline uint32 SETPALETTE256(uint32 R, uint32 G, uint32 B)
|
||||
{
|
||||
return ((R & 0xff) << 16) | ((G & 0xff) << 8) | (B & 0xff);
|
||||
@@ -81,8 +84,8 @@ private:
|
||||
|
||||
uint32* vram[3][480]; // 仮想VRAMへのポインタ
|
||||
|
||||
uint32 program_palette[256];
|
||||
uint32 screen_palette[256];
|
||||
Palette program_palette;
|
||||
Palette screen_palette;
|
||||
uint8 gaiji[188][32];
|
||||
|
||||
int fade_level = 0; // 0-255
|
||||
@@ -182,13 +185,13 @@ public:
|
||||
int screen_y;
|
||||
int screen_width;
|
||||
int screen_height;
|
||||
uint32 screen_palette[256];
|
||||
Palette screen_palette;
|
||||
uint32* window;
|
||||
int window_x;
|
||||
int window_y;
|
||||
int window_width;
|
||||
int window_height;
|
||||
uint32 window_palette[256];
|
||||
Palette window_palette;
|
||||
} WINDOW;
|
||||
WINDOW menu_w[10];
|
||||
WINDOW text_w[10];
|
||||
|
||||
+9
-12
@@ -122,11 +122,10 @@ void AGS::open_text_window(int index, bool erase)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 palette[256];
|
||||
memcpy(palette, screen_palette, sizeof(screen_palette));
|
||||
memcpy(screen_palette, text_w[index - 1].window_palette, sizeof(screen_palette));
|
||||
Palette palette = screen_palette;
|
||||
screen_palette = text_w[index - 1].window_palette;
|
||||
draw_screen(sx, sy, width, height);
|
||||
memcpy(screen_palette, palette, sizeof(screen_palette));
|
||||
screen_palette = palette;
|
||||
}
|
||||
|
||||
// テキスト描画位置更新
|
||||
@@ -181,11 +180,10 @@ void AGS::close_text_window(int index, bool update)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 palette[256];
|
||||
memcpy(palette, screen_palette, sizeof(screen_palette));
|
||||
memcpy(screen_palette, text_w[index - 1].screen_palette, sizeof(screen_palette));
|
||||
Palette palette = screen_palette;
|
||||
screen_palette = text_w[index - 1].screen_palette;
|
||||
draw_screen(sx, sy, width, height);
|
||||
memcpy(screen_palette, palette, sizeof(screen_palette));
|
||||
screen_palette = palette;
|
||||
}
|
||||
|
||||
// テキスト描画位置更新
|
||||
@@ -285,11 +283,10 @@ void AGS::close_menu_window(int index)
|
||||
}
|
||||
}
|
||||
|
||||
uint32 palette[256];
|
||||
memcpy(palette, screen_palette, sizeof(screen_palette));
|
||||
memcpy(screen_palette, menu_w[index - 1].screen_palette, sizeof(screen_palette));
|
||||
Palette palette = screen_palette;
|
||||
screen_palette = menu_w[index - 1].screen_palette;
|
||||
draw_screen(sx, sy, width, height);
|
||||
memcpy(screen_palette, palette, sizeof(screen_palette));
|
||||
screen_palette = palette;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user