mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-12 09:18:21 +03:00
244 lines
5.6 KiB
C++
244 lines
5.6 KiB
C++
/*
|
|
ALICE SOFT SYSTEM 3 for Win32
|
|
|
|
[ AGS ]
|
|
*/
|
|
|
|
#ifndef _AGS_H_
|
|
#define _AGS_H_
|
|
|
|
#include <windows.h>
|
|
#include <gdiplus.h>
|
|
#include <stdio.h>
|
|
#include "../common.h"
|
|
#include "nact.h"
|
|
|
|
// フェード処理
|
|
static const int fade_x[16] = {0, 2, 2, 0, 1, 3, 3, 1, 1, 3, 3, 1, 0, 2, 2, 0};
|
|
static const int fade_y[16] = {0, 2, 0, 2, 1, 3, 1, 3, 0, 2, 0, 2, 1, 3, 1, 3};
|
|
|
|
#define MAX_CG 10000
|
|
|
|
static inline uint32 SETPALETTE256(uint32 R, uint32 G, uint32 B)
|
|
{
|
|
return ((R & 0xff) << 16) | ((G & 0xff) << 8) | (B & 0xff);
|
|
}
|
|
|
|
static inline uint32 SETPALETTE16(uint32 R, uint32 G, uint32 B)
|
|
{
|
|
R = (255 * (R & 0x0f)) / 15;
|
|
G = (255 * (G & 0x0f)) / 15;
|
|
B = (255 * (B & 0x0f)) / 15;
|
|
return SETPALETTE256(R, G, B);
|
|
}
|
|
|
|
class AGS
|
|
{
|
|
protected:
|
|
NACT* nact;
|
|
private:
|
|
// GDI+
|
|
Gdiplus::GdiplusStartupInput gdiSI;
|
|
ULONG_PTR gdiToken;
|
|
|
|
// DIBSection 8bpp * 3 (表, 裏, メニュー)
|
|
HDC hdcDibScreen[3];
|
|
HBITMAP hBmpScreen[3];
|
|
LPBYTE lpBufScreen[3];
|
|
LPDWORD lpBmpScreen[3];
|
|
LPBITMAPINFO lpDibScreen[3];
|
|
|
|
// DIBSection 24bpp (最終出力先)
|
|
HDC hdcDibDest;
|
|
HBITMAP hBmpDest;
|
|
LPBYTE lpBufDest;
|
|
LPDWORD lpBmpDest;
|
|
LPBITMAPINFO lpDibDest;
|
|
|
|
// DIBSection 24bpp (テキスト描画)
|
|
HDC hdcDibText;
|
|
HBITMAP hBmpText;
|
|
LPBYTE lpBufText;
|
|
LPDWORD lpBmpText;
|
|
LPBITMAPINFO lpDibText;
|
|
|
|
// DIBSection 24bpp (メニュー描画)
|
|
HDC hdcDibMenu;
|
|
HBITMAP hBmpMenu;
|
|
LPBYTE lpBufMenu;
|
|
LPDWORD lpBmpMenu;
|
|
LPBITMAPINFO lpDibMenu;
|
|
|
|
// フォント
|
|
HFONT hFont16;
|
|
HFONT hFont24;
|
|
HFONT hFont32;
|
|
HFONT hFont48;
|
|
HFONT hFont64;
|
|
|
|
// カーソル
|
|
HCURSOR hArrow;
|
|
HCURSOR hCursor[10];
|
|
|
|
// AGS
|
|
#if defined(_SYSTEM1)
|
|
void load_vsp2l(uint8* data, int page, int transparent); // Little Vampire
|
|
void load_gl3(uint8* data, int page, int transparent); // あぶない天狗伝説
|
|
void load_gm3(uint8* data, int page, int transparent); // Intruder
|
|
void load_vsp(uint8* data, int page, int transparent);
|
|
#else
|
|
void load_gl3(uint8* data, int page, int transparent); // あぶない天狗伝説
|
|
void load_vsp(uint8* data, int page, int transparent);
|
|
void load_pms(uint8* data, int page, int transparent);
|
|
#endif
|
|
#if defined(_SYSTEM3)
|
|
void load_bmp(const _TCHAR *file_path);
|
|
#endif
|
|
|
|
void draw_char(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, uint16 code, int size, uint8 color);
|
|
uint16 convert_zenkaku(uint16 code);
|
|
uint16 convert_hankaku(uint16 code);
|
|
|
|
void draw_window(int sx, int sy, int ex, int ey, bool frame, uint8 frame_color, uint8 back_color);
|
|
|
|
void draw_screen(int sx, int sy, int width, int heignt);
|
|
void invalidate_screen(int sx, int sy, int width, int height);
|
|
|
|
uint32* vram[3][480]; // 仮想VRAMへのポインタ
|
|
|
|
uint32 program_palette[256];
|
|
uint32 screen_palette[256];
|
|
uint8 gaiji[188][32];
|
|
|
|
bool fader; // フェードの状態
|
|
uint32 fader_screen[640 * 480];
|
|
|
|
public:
|
|
AGS(NACT* parent);
|
|
~AGS();
|
|
|
|
void update_screen(HDC hdc, int sx, int sy, int width, int height);
|
|
void flush_screen(bool update);
|
|
|
|
void load_cg(int page, int transparent);
|
|
|
|
void set_palette(int index, int r, int g, int b);
|
|
uint8 get_pixel(int dest, int x, int y);
|
|
void set_pixel(int dest, int x, int y, uint8 color);
|
|
|
|
void fade_start();
|
|
void fade_end();
|
|
void fade_out(int depth, bool white);
|
|
void fade_in(int depth);
|
|
bool now_fade() { return fader; }
|
|
|
|
void copy(int sx, int sy, int ex, int ey, int dx, int dy);
|
|
void gcopy(int gsc, int gde, int glx, int gly, int gsw);
|
|
void paint(int x, int y, uint8 color);
|
|
void draw_box(int index);
|
|
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 draw_text(char string[]);
|
|
|
|
void clear_text_window(int index, bool erase);
|
|
bool return_text_line(int index);
|
|
void draw_push(int index);
|
|
void open_text_window(int index, bool erase);
|
|
void close_text_window(int index, bool update);
|
|
|
|
void clear_menu_window();
|
|
void open_menu_window(int index);
|
|
void redraw_menu_window(int index, int selected);
|
|
void close_menu_window(int index);
|
|
|
|
void load_cursor(int page);
|
|
void select_cursor();
|
|
|
|
// ACG.DAT
|
|
_TCHAR acg[16];
|
|
|
|
// 画面選択
|
|
int src_screen;
|
|
int dest_screen;
|
|
|
|
int scroll;
|
|
int screen_height;
|
|
|
|
// メッセージ表示
|
|
int text_dest_x;
|
|
int text_dest_y;
|
|
int text_space;
|
|
int text_font_size;
|
|
int old_text_font_size;
|
|
uint8 text_font_color;
|
|
uint8 text_frame_color;
|
|
uint8 text_back_color;
|
|
int text_font_maxsize; // その行での最大フォントサイズ
|
|
|
|
// メニュー表示
|
|
int menu_dest_x;
|
|
int menu_dest_y;
|
|
int menu_font_size;
|
|
int old_menu_font_size;
|
|
uint8 menu_font_color;
|
|
uint8 menu_frame_color;
|
|
uint8 menu_back_color;
|
|
bool menu_fix;
|
|
|
|
bool draw_hankaku;
|
|
bool draw_menu;
|
|
|
|
// ウィンドウ (Bコマンド)
|
|
typedef struct {
|
|
int sx;
|
|
int sy;
|
|
int ex;
|
|
int ey;
|
|
bool frame;
|
|
bool push;
|
|
uint32* screen;
|
|
int screen_x;
|
|
int screen_y;
|
|
int screen_width;
|
|
int screen_height;
|
|
uint32 screen_palette[256];
|
|
uint32* window;
|
|
int window_x;
|
|
int window_y;
|
|
int window_width;
|
|
int window_height;
|
|
uint32 window_palette[256];
|
|
} WINDOW;
|
|
WINDOW menu_w[10];
|
|
WINDOW text_w[10];
|
|
|
|
// ボックス (E, Y7コマンド)
|
|
typedef struct {
|
|
uint8 color;
|
|
int sx;
|
|
int sy;
|
|
int ex;
|
|
int ey;
|
|
} BOX;
|
|
BOX box[20];
|
|
|
|
// CG表示
|
|
bool set_cg_dest;
|
|
int cg_dest_x;
|
|
int cg_dest_y;
|
|
bool get_palette;
|
|
bool extract_palette;
|
|
bool extract_cg;
|
|
bool extract_palette_cg[MAX_CG];
|
|
int palette_bank;
|
|
|
|
// マウスカーソル
|
|
uint8 cursor_color;
|
|
int cursor_index;
|
|
};
|
|
|
|
#endif
|