mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-10-10 00:08:26 +03:00
Import system3 for win32 2016-01-16, downloaded from
http://homepage3.nifty.com/takeda-toshiya/alice/index.html
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
ALICE SOFT SYSTEM 3 for Win32
|
||||
|
||||
[ AGS - draw ]
|
||||
*/
|
||||
|
||||
#include "ags.h"
|
||||
|
||||
extern HINSTANCE g_hinst;
|
||||
|
||||
void AGS::load_cursor(int page)
|
||||
{
|
||||
// カーソルCGをロードする
|
||||
bool j_set = set_cg_dest;
|
||||
int j_x = cg_dest_x;
|
||||
int j_y = cg_dest_y;
|
||||
int dest = dest_screen;
|
||||
|
||||
set_cg_dest = true;
|
||||
cg_dest_x = 0;
|
||||
cg_dest_y = 0;
|
||||
dest_screen = 1;
|
||||
|
||||
load_cg(page, -1);
|
||||
|
||||
set_cg_dest = j_set;
|
||||
cg_dest_x = j_x;
|
||||
cg_dest_y = j_y;
|
||||
dest_screen = dest;
|
||||
|
||||
// フォントの生成
|
||||
for(int i = 0; i < 10; i++) {
|
||||
// パターン読み込み
|
||||
uint8 pat[34][34];
|
||||
memset(pat, 0, sizeof(pat));
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// パターン縁取り
|
||||
for(int y = 1; y <= 32; y++) {
|
||||
for(int x = 1; x <= 32; x++) {
|
||||
if(pat[y][x] == 0 && (pat[y - 1][x] == 1 || pat[y + 1][x] == 1 || pat[y][x - 1] == 1 || pat[y][x + 1] == 1)) {
|
||||
pat[y][x] = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// フォント生成
|
||||
uint8 amask[128], xmask[128];
|
||||
memset(amask, 0, sizeof(amask));
|
||||
memset(xmask, 0, sizeof(xmask));
|
||||
|
||||
for(int y = 0; y < 32; y++) {
|
||||
for(int x = 0; x < 32; x += 8) {
|
||||
amask[y * 4 + (x >> 3)] = (pat[y + 1][x + 1] == 0) ? 0x80 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 2] == 0) ? 0x40 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 3] == 0) ? 0x20 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 4] == 0) ? 0x10 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 5] == 0) ? 0x08 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 6] == 0) ? 0x04 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 7] == 0) ? 0x02 : 0;
|
||||
amask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 8] == 0) ? 0x01 : 0;
|
||||
|
||||
xmask[y * 4 + (x >> 3)] = (pat[y + 1][x + 1] == 1) ? 0x80 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 2] == 1) ? 0x40 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 3] == 1) ? 0x20 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 4] == 1) ? 0x10 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 5] == 1) ? 0x08 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 6] == 1) ? 0x04 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 7] == 1) ? 0x02 : 0;
|
||||
xmask[y * 4 + (x >> 3)] |= (pat[y + 1][x + 8] == 1) ? 0x01 : 0;
|
||||
}
|
||||
}
|
||||
if(hCursor[i]) {
|
||||
DestroyCursor(hCursor[i]);
|
||||
}
|
||||
hCursor[i] = CreateCursor(g_hinst, 2, 2, 32, 32, amask, xmask);
|
||||
}
|
||||
}
|
||||
|
||||
void AGS::select_cursor()
|
||||
{
|
||||
if(cursor_index == 0) {
|
||||
SetCursor(hArrow);
|
||||
} else if(1 <= cursor_index && cursor_index <= 10 && hCursor[cursor_index - 1]) {
|
||||
SetCursor(hCursor[cursor_index - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user