mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a37920c95 | ||
|
|
fa44889047 | ||
|
|
cee18a572e | ||
|
|
652d284628 | ||
|
|
d2661e97f1 | ||
|
|
0e9afe7c0a | ||
|
|
fbe8af5f7b | ||
|
|
0c1f8f8450 | ||
|
|
078525e2c2 | ||
|
|
d4a4022894 | ||
|
|
dc89c92139 | ||
|
|
4f351fc767 | ||
|
|
02ef4a1771 | ||
|
|
4a20d74f1a | ||
|
|
c9663c5cfc | ||
|
|
5c7e92391c | ||
|
|
0a15e6490f | ||
|
|
fe294bd34b | ||
|
|
e26779a189 | ||
|
|
f9b5fec03d | ||
|
|
d63e3503e7 | ||
|
|
3dd38959a3 | ||
|
|
f56ec88cda | ||
|
|
9706f516f9 | ||
|
|
b15690d9b7 | ||
|
|
26db7f46f5 | ||
|
|
1cf0dbc7e2 | ||
|
|
3f36eeee4c | ||
|
|
ff62533faf | ||
|
|
f60b21bc19 | ||
|
|
8fac291e84 |
@@ -2,7 +2,7 @@ name: Emscripten Build
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
EM_VERSION: 3.1.2
|
||||
EM_VERSION: 3.1.15
|
||||
EM_CACHE_FOLDER: 'emsdk-cache'
|
||||
|
||||
jobs:
|
||||
|
||||
@@ -26,7 +26,6 @@ jobs:
|
||||
SDL2:p
|
||||
SDL2_ttf:p
|
||||
SDL2_mixer:p
|
||||
libjpeg-turbo:p
|
||||
libwebp:p
|
||||
cjson:p
|
||||
nsis:p
|
||||
|
||||
@@ -28,7 +28,6 @@ check_symbol_exists(sigaction "signal.h" HAVE_SIGACTION)
|
||||
check_symbol_exists(uname "sys/utsname.h" HAVE_UNAME)
|
||||
|
||||
if (EMSCRIPTEN)
|
||||
set(HAVE_JPEG 1)
|
||||
set(DEFAULT_FONT_PATH /fonts/)
|
||||
elseif (ANDROID)
|
||||
set(SDL2MIXER_FOUND 1)
|
||||
@@ -59,11 +58,6 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindJPEG)
|
||||
if (JPEG_FOUND)
|
||||
set(HAVE_JPEG 1)
|
||||
endif()
|
||||
|
||||
optional_pkg_check_modules(WEBP IMPORTED_TARGET libwebp)
|
||||
if (WEBP_FOUND)
|
||||
set(HAVE_WEBP 1)
|
||||
|
||||
@@ -41,7 +41,7 @@ examine / modify variables in the game. There are two ways to use the debugger:
|
||||
- Through [Visual Studio Code](https://code.visualstudio.com/) (recommended):
|
||||
The [vscode-system3x](https://github.com/kichikuou/vscode-system3x) extension
|
||||
provides graphical debugging interface for System 3.x.
|
||||
- Using CUI debugger: Running xsystem35 with `-debugger` option will start the
|
||||
- Using CUI debugger: Running xsystem35 with `-debug` option will start the
|
||||
debugger with console interface. Type `help` to see a list of available
|
||||
commands.
|
||||
|
||||
@@ -81,7 +81,7 @@ Run xsystem35 from within the game directory.
|
||||
|
||||
[Homebrew](https://brew.sh/index_ja) is needed.
|
||||
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer sdl2_ttf libjpeg webp cjson
|
||||
$ brew install cmake pkg-config sdl2 sdl2_mixer sdl2_ttf webp cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
@@ -91,7 +91,7 @@ Run xsystem35 from within the game directory.
|
||||
|
||||
[MSYS2](https://www.msys2.org) is needed.
|
||||
|
||||
$ pacman -S cmake mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-libwebp mingw-w64-x86_64-cjson
|
||||
$ pacman -S cmake mingw-w64-x86_64-cmake mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-libwebp mingw-w64-x86_64-cjson
|
||||
$ mkdir -p out/debug
|
||||
$ cd out/debug
|
||||
$ cmake -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug ../../
|
||||
|
||||
@@ -16,8 +16,8 @@ android {
|
||||
}
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 31
|
||||
versionCode 7
|
||||
versionName "2.3.0"
|
||||
versionCode 10
|
||||
versionName "2.5.1"
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments "-DANDROID_APP_PLATFORM=android-16", "-DANDROID_STL=c++_static"
|
||||
|
||||
@@ -13,11 +13,10 @@ FetchContent_Declare(
|
||||
URL https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.0.18.tar.gz
|
||||
URL_HASH SHA1=6fc5130757b447d46c3da6abd58687e8576de8b8
|
||||
)
|
||||
# TODO: Use SDL2_mixer 2.0.5 once released
|
||||
FetchContent_Declare(
|
||||
SDL_mixer
|
||||
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer.git
|
||||
GIT_TAG 6845d9f3cb3f35542f1ec7e74dba6b30bf968959
|
||||
URL https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-2.6.0.tar.gz
|
||||
URL_HASH SHA1=a2aef03d74ac3dd9cd0004cff1834602a5dafa66
|
||||
)
|
||||
|
||||
# Compilation of SDL and companion libraries
|
||||
@@ -34,9 +33,12 @@ endif()
|
||||
FetchContent_GetProperties(SDL_mixer)
|
||||
if(NOT sdl_mixer_POPULATED)
|
||||
FetchContent_Populate(SDL_mixer)
|
||||
SET(SUPPORT_OGG ON CACHE BOOL "Enable OGG support in SDL_mixer" FORCE)
|
||||
SET(SDL2MIXER_OPUS OFF CACHE BOOL "Enable Opus music" FORCE)
|
||||
SET(SDL2MIXER_FLAC OFF CACHE BOOL "Enable FLAC music" FORCE)
|
||||
SET(SDL2MIXER_MOD OFF CACHE BOOL "Support loading MOD music" FORCE)
|
||||
SET(SDL2MIXER_MIDI OFF CACHE BOOL "Enable MIDI music" FORCE)
|
||||
SET(SDL2MIXER_SAMPLES OFF CACHE BOOL "Build the SDL2_mixer sample program(s)" FORCE)
|
||||
add_subdirectory(${sdl_mixer_SOURCE_DIR} ${sdl_mixer_BINARY_DIR})
|
||||
target_compile_definitions(SDL2_mixer PRIVATE MUSIC_WAV)
|
||||
endif()
|
||||
|
||||
# The main CMakeLists.txt of xsystem35
|
||||
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
#cmakedefine PACKAGE "@PACKAGE@"
|
||||
#define VERSION "2.3.0"
|
||||
#define VERSION "2.5.1"
|
||||
|
||||
#cmakedefine CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#cmakedefine SEQ_DEVICE "@SEQ_DEVICE@"
|
||||
|
||||
#cmakedefine HAVE_GETLOGIN @HAVE_GETLOGIN@
|
||||
#cmakedefine HAVE_JPEG @HAVE_JPEG@
|
||||
#cmakedefine HAVE_MMAP @HAVE_MMAP@
|
||||
#cmakedefine HAVE_SIGACTION @HAVE_SIGACTION@
|
||||
#cmakedefine HAVE_UNAME @HAVE_UNAME@
|
||||
|
||||
@@ -102,7 +102,6 @@ target_compile_options(modules PRIVATE -Wno-pointer-sign)
|
||||
if (EMSCRIPTEN)
|
||||
set(LIBS
|
||||
"SHELL:-s USE_ZLIB=1"
|
||||
"SHELL:-s USE_LIBJPEG=1"
|
||||
"SHELL:-s USE_SDL=2")
|
||||
target_compile_options(modules PRIVATE ${LIBS})
|
||||
target_link_options(modules PRIVATE ${LIBS})
|
||||
@@ -117,7 +116,3 @@ else()
|
||||
target_link_libraries(modules PRIVATE PkgConfig::SDL2MIXER)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (HAVE_JPEG AND NOT EMSCRIPTEN)
|
||||
target_link_libraries(modules PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
|
||||
+5
-1
@@ -139,6 +139,10 @@ static void Init() {
|
||||
DEBUG_COMMAND("Gpx.Init %d:\n", p1);
|
||||
}
|
||||
|
||||
static void Gpx_reset(void) {
|
||||
sf_free_all();
|
||||
}
|
||||
|
||||
static void Create() {
|
||||
/*
|
||||
Gpx.Create(): 新規 surface の作成(PixelとAlphaマップの両方)
|
||||
@@ -1217,4 +1221,4 @@ static const ModuleFunc functions[] = {
|
||||
{"StretchBlendScreen2x2WDS", StretchBlendScreen2x2WDS},
|
||||
};
|
||||
|
||||
const Module module_Gpx = {"Gpx", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
const Module module_Gpx = {"Gpx", functions, sizeof(functions) / sizeof(ModuleFunc), Gpx_reset};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "nt_scenario.h"
|
||||
#include "nt_msg.h"
|
||||
#include "nt_event.h"
|
||||
#include "sactcg.h"
|
||||
|
||||
#include "sactstring.h"
|
||||
|
||||
@@ -38,6 +39,17 @@ static void Init(void) { /* 0 */
|
||||
DEBUG_COMMAND_YET("NIGHTDLL.Init %p:\n", var);
|
||||
}
|
||||
|
||||
static void NIGHTDLL_reset(void) {
|
||||
nt_sstr_reset();
|
||||
nt_sp_clear_updatelist();
|
||||
for (int i = 0; i < SPRITEMAX; i++) {
|
||||
if (night.sp[i])
|
||||
nt_sp_free(night.sp[i]);
|
||||
}
|
||||
nt_scg_freeall();
|
||||
memset(&night, 0, sizeof(night));
|
||||
}
|
||||
|
||||
static void InitGame() { /* 1 */
|
||||
ags_setAntialiasedStringMode(TRUE);
|
||||
sys_setHankakuMode(2);
|
||||
@@ -651,4 +663,4 @@ static const ModuleFunc functions[] = {
|
||||
{"WaitKey", WaitKey},
|
||||
};
|
||||
|
||||
const Module module_NIGHTDLL = {"NIGHTDLL", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
const Module module_NIGHTDLL = {"NIGHTDLL", functions, sizeof(functions) / sizeof(ModuleFunc), NIGHTDLL_reset};
|
||||
|
||||
@@ -52,7 +52,7 @@ static void ntmain(struct _scoadr inadr) {
|
||||
struct _scoadr curadr;
|
||||
|
||||
while (!nact->is_quit) {
|
||||
for (int cnt = 0; !nact->wait_vsync && cnt < 10000; cnt++) {
|
||||
for (int cnt = 0; !nact->is_quit && !nact->wait_vsync && cnt < 10000; cnt++) {
|
||||
//SACT_DEBUG("%d:%x\n", sl_getPage(), sl_getIndex());
|
||||
if (!nact->popupmenu_opened) {
|
||||
exec_command();
|
||||
@@ -70,9 +70,7 @@ static void ntmain(struct _scoadr inadr) {
|
||||
}
|
||||
nact->callback();
|
||||
}
|
||||
if (!nact->is_message_locked) {
|
||||
sys_getInputInfo();
|
||||
}
|
||||
sys_getInputInfo();
|
||||
sdl_wait_vsync();
|
||||
nact->frame_count++;
|
||||
nact->wait_vsync = FALSE;
|
||||
|
||||
@@ -23,7 +23,6 @@ void nt_voice_set(int no) {
|
||||
}
|
||||
|
||||
void nt_cd_play(int no) {
|
||||
mus_cdrom_stop();
|
||||
mus_cdrom_start(no +1, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,24 @@ int nt_sstr_init() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int nt_sstr_reset(void) {
|
||||
for (int i = 0; i < idx; i++)
|
||||
free(stack[i]);
|
||||
idx = 0;
|
||||
free(stack);
|
||||
stack = NULL;
|
||||
|
||||
for (SList *l = strreplace; l; l = l->next) {
|
||||
strexchange_t *ex = l->data;
|
||||
free(ex->src);
|
||||
free(ex->dst);
|
||||
free(ex);
|
||||
}
|
||||
slist_free(strreplace);
|
||||
strreplace = NULL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列変数スタックに文字列を積む
|
||||
* @param strno: シナリオ上での文字列変数番号
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define __SACTSTRING_H__
|
||||
|
||||
extern int nt_sstr_init();
|
||||
extern int nt_sstr_reset(void);
|
||||
extern int nt_sstr_push(char *str);
|
||||
extern int nt_sstr_pop(char *str, int maxlen);
|
||||
extern int nt_sstr_regist_replace(char *sstr, char *dstr);
|
||||
|
||||
@@ -122,6 +122,7 @@ extern int nt_sp_updateme_part(sprite_t *sp, int x, int y, int w, int h);
|
||||
extern void nt_sp_add_updatelist(sprite_t *sp);
|
||||
extern void nt_sp_remove_updatelist(sprite_t *sp);
|
||||
extern int nt_sp_draw_wall(sprite_t *sp, MyRectangle *r);
|
||||
extern void nt_sp_clear_updatelist(void);
|
||||
|
||||
/* in nt_sprite_draw.c */
|
||||
extern int nt_sp_draw(sprite_t *sp, MyRectangle *r);
|
||||
|
||||
@@ -206,6 +206,13 @@ void nt_sp_remove_updatelist(sprite_t *sp) {
|
||||
updatelist = slist_remove(updatelist, sp);
|
||||
}
|
||||
|
||||
void nt_sp_clear_updatelist(void) {
|
||||
slist_free(updatelist);
|
||||
updatelist = NULL;
|
||||
slist_free(updatearea);
|
||||
updatearea = NULL;
|
||||
}
|
||||
|
||||
// デフォルトの壁紙update
|
||||
int nt_sp_draw_wall(sprite_t *sp, MyRectangle *area) {
|
||||
int sx, sy, w, h;
|
||||
|
||||
@@ -36,11 +36,7 @@
|
||||
#include "input.h"
|
||||
#include "ngraph.h"
|
||||
#include "cg.h"
|
||||
#ifdef HAVE_JPEG
|
||||
#include "jpeg.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
|
||||
#define FPS 30
|
||||
|
||||
@@ -88,8 +84,6 @@ static void ndd_run(int demonum) {
|
||||
alk_free(alk);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void Init() {
|
||||
int p1 = getCaliValue(); /* ISys3x */
|
||||
int p2 = getCaliValue(); /* IWinMsg */
|
||||
@@ -105,9 +99,7 @@ static void Run() {
|
||||
int p1 = getCaliValue(); // デモ番号 0,1,2
|
||||
int p2 = getCaliValue();
|
||||
|
||||
#ifdef HAVE_JPEG
|
||||
ndd_run(p1);
|
||||
#endif
|
||||
|
||||
DEBUG_COMMAND("NightDemonDemo.Run %d,%d:\n", p1, p2);
|
||||
}
|
||||
|
||||
+16
-1
@@ -153,6 +153,9 @@ static void Init() {
|
||||
|
||||
if (sact.version >= 120) {
|
||||
sact.logging = TRUE;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
EM_ASM( xsystem35.texthook.disableWheelEvent(0xffffffff) );
|
||||
#endif
|
||||
} else {
|
||||
sact.logging = FALSE;
|
||||
}
|
||||
@@ -2131,6 +2134,18 @@ static void XMenuTitleGet() {
|
||||
DEBUG_COMMAND_YET("SACT.XMenuTitleGet %d:\n", strno);
|
||||
}
|
||||
|
||||
static void SACT_reset(void) {
|
||||
ssnd_init();
|
||||
spxm_clear();
|
||||
ssel_reset();
|
||||
sstr_reset();
|
||||
sp_reset();
|
||||
|
||||
scg_freeall();
|
||||
sf_free(sact.dmap);
|
||||
memset(&sact, 0, sizeof(sact));
|
||||
}
|
||||
|
||||
static const ModuleFunc functions[] = {
|
||||
{"AddZKeyHideSprite", AddZKeyHideSprite},
|
||||
{"CG_Clear", CG_Clear},
|
||||
@@ -2254,4 +2269,4 @@ static const ModuleFunc functions[] = {
|
||||
{"XMenuTitleRegister", XMenuTitleRegister},
|
||||
};
|
||||
|
||||
const Module module_SACT = {"SACT", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
const Module module_SACT = {"SACT", functions, sizeof(functions) / sizeof(ModuleFunc), SACT_reset};
|
||||
|
||||
+1
-17
@@ -32,7 +32,6 @@
|
||||
#include "surface.h"
|
||||
#include "sacttimer.h"
|
||||
#include "variable.h"
|
||||
#include "mmap.h"
|
||||
|
||||
// スプライトの最大数
|
||||
#define SPRITEMAX 21845
|
||||
@@ -61,15 +60,6 @@ typedef struct {
|
||||
char *dst; // 置き換え文字列
|
||||
} strexchange_t;
|
||||
|
||||
// SACTEFAM を使ったマスク
|
||||
typedef struct {
|
||||
mmap_t *mmap;
|
||||
int datanum; // SACTEFAM.KLD 中のマスクファイルの数
|
||||
int *no; // シナリオ側での番号
|
||||
int *offset; // データへのオフセット
|
||||
} SACTEFAM_t;
|
||||
|
||||
|
||||
// CG_XX で作るCGの種類
|
||||
enum cgtype {
|
||||
CG_NOTUSED = 0,
|
||||
@@ -225,11 +215,8 @@ struct _sact {
|
||||
// 座標系の原点
|
||||
MyPoint origin;
|
||||
|
||||
// 文字列 push/pop/replce 用
|
||||
SList *strstack;
|
||||
// 文字列 replce 用
|
||||
SList *strreplace;
|
||||
char *strreplacesrc;
|
||||
char *strreplacedst;
|
||||
|
||||
// メッセージスプライト用メッセージバッファ
|
||||
char msgbuf[MSGBUFMAX];
|
||||
@@ -288,9 +275,6 @@ struct _sact {
|
||||
// depth map
|
||||
surface_t *dmap;
|
||||
|
||||
// SACTEFAM.KLD
|
||||
SACTEFAM_t am;
|
||||
|
||||
boolean zhiding; // Zkeyによる隠し中
|
||||
int zofftime;
|
||||
boolean zdooff;
|
||||
|
||||
+22
-15
@@ -37,11 +37,20 @@
|
||||
#include "ngraph.h"
|
||||
#include "sprite.h"
|
||||
#include "sdl_core.h"
|
||||
#include "mmap.h"
|
||||
|
||||
static surface_t *smask_get(int no);
|
||||
static surface_t *smask_mul(surface_t *sf, int val);
|
||||
|
||||
// SACTEFAM を使ったマスク
|
||||
typedef struct {
|
||||
mmap_t *mmap;
|
||||
int datanum; // SACTEFAM.KLD 中のマスクファイルの数
|
||||
int *no; // シナリオ側での番号
|
||||
int *offset; // データへのオフセット
|
||||
} SACTEFAM_t;
|
||||
|
||||
static SACTEFAM_t am;
|
||||
|
||||
struct ecopyparam {
|
||||
int sttime;
|
||||
@@ -55,21 +64,20 @@ static ecopyparam_t ecp;
|
||||
|
||||
// SACTEFAM.KLD の読み込み
|
||||
int smask_init(char *path) {
|
||||
int i;
|
||||
SACTEFAM_t *am;
|
||||
if (am.mmap)
|
||||
return OK; // already loaded
|
||||
|
||||
mmap_t *m = map_file(path);
|
||||
if (!m)
|
||||
return NG;
|
||||
am = &sact.am;
|
||||
am->mmap = m;
|
||||
am->datanum = LittleEndian_getDW(m->addr, 0);
|
||||
am->no = malloc(sizeof(int) * am->datanum);
|
||||
am->offset = malloc(sizeof(int) * am->datanum);
|
||||
am.mmap = m;
|
||||
am.datanum = LittleEndian_getDW(m->addr, 0);
|
||||
am.no = malloc(sizeof(int) * am.datanum);
|
||||
am.offset = malloc(sizeof(int) * am.datanum);
|
||||
|
||||
for (i = 0; i < am->datanum; i++) {
|
||||
am->no[i] = LittleEndian_getDW(m->addr, 16 + i * 16);
|
||||
am->offset[i] = LittleEndian_getDW(m->addr, 16 + i * 16 + 8);
|
||||
for (int i = 0; i < am.datanum; i++) {
|
||||
am.no[i] = LittleEndian_getDW(m->addr, 16 + i * 16);
|
||||
am.offset[i] = LittleEndian_getDW(m->addr, 16 + i * 16 + 8);
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -78,15 +86,14 @@ int smask_init(char *path) {
|
||||
// 指定番号の alphamask ファイルをよみだす
|
||||
static surface_t *smask_get(int no) {
|
||||
int i;
|
||||
SACTEFAM_t *am = &sact.am;
|
||||
|
||||
for (i = 0; i < am->datanum; i++) {
|
||||
if (am->no[i] == no) break;
|
||||
for (i = 0; i < am.datanum; i++) {
|
||||
if (am.no[i] == no) break;
|
||||
}
|
||||
|
||||
if (i == am->datanum) return NULL;
|
||||
if (i == am.datanum) return NULL;
|
||||
|
||||
return sf_getcg(am->mmap->addr + am->offset[i], 0 /*FIXME*/);
|
||||
return sf_getcg(am.mmap->addr + am.offset[i], 0 /*FIXME*/);
|
||||
}
|
||||
|
||||
// ベースになるマスクの alpha 値を拡大して取り出す
|
||||
|
||||
@@ -109,6 +109,9 @@ static void draw_log() {
|
||||
|
||||
|
||||
int sblog_start(void) {
|
||||
if (sact.version < 120)
|
||||
return NG;
|
||||
|
||||
static char *logmsg[LOGMSG_LINES];
|
||||
if (!logmsg[0]) {
|
||||
for (int i = 0; i < LOGMSG_LINES; i++)
|
||||
|
||||
@@ -67,6 +67,7 @@ static int slt_find(int no) {
|
||||
int ssnd_init() {
|
||||
// ch 1-8 をキャッシュとして使おう
|
||||
cachei = 0;
|
||||
memset(cache, 0, sizeof(cache));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,24 @@ int sstr_init() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sstr_reset(void) {
|
||||
for (int i = 0; i < idx; i++)
|
||||
free(stack[i]);
|
||||
idx = 0;
|
||||
free(stack);
|
||||
stack = NULL;
|
||||
|
||||
for (SList *l = sact.strreplace; l; l = l->next) {
|
||||
strexchange_t *ex = l->data;
|
||||
free(ex->src);
|
||||
free(ex->dst);
|
||||
free(ex);
|
||||
}
|
||||
slist_free(sact.strreplace);
|
||||
sact.strreplace = NULL;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文字列変数スタックに文字列を積む
|
||||
* @param strno: シナリオ上での文字列変数番号
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#define __SACTSTRING_H__
|
||||
|
||||
extern int sstr_init();
|
||||
extern int sstr_reset(void);
|
||||
extern int sstr_push(int strno);
|
||||
extern int sstr_pop(int strno);
|
||||
extern int sstr_regist_replace(int sstrtno, int dstrno);
|
||||
|
||||
@@ -121,6 +121,13 @@ int sp_init() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int sp_reset(void) {
|
||||
sp_clear_zkey_hidesprite_all();
|
||||
sp_clear_quakesprite_all();
|
||||
sp_free_all();
|
||||
return OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新規スプライトの作成
|
||||
* @param no: スプライト番号
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
|
||||
// in sprite.c
|
||||
extern int sp_init();
|
||||
extern int sp_reset(void);
|
||||
extern int sp_new(int no, int cg1, int cg2, int cg3, int type);
|
||||
extern int sp_new_msg(int no, int x, int y, int width, int height);
|
||||
extern int sp_set_wall_paper(int no);
|
||||
@@ -93,6 +94,7 @@ extern int smsg_update(sprite_t *sp);
|
||||
|
||||
// in sprite_sel.c
|
||||
extern void ssel_init();
|
||||
extern void ssel_reset(void);
|
||||
extern void ssel_clear();
|
||||
extern void ssel_add(int nString, int wI);
|
||||
extern int ssel_select(int wNum, int wChoiceSize, int wMenuOutSpc, int wChoiceLineSpace, int wChoiceAutoMoveCursor, int nAlign);
|
||||
|
||||
+17
-19
@@ -223,16 +223,15 @@ static void cb_waitkey_simple(agsevent_t *e) {
|
||||
}
|
||||
break;
|
||||
|
||||
case AGSEVENT_BUTTON_RELEASE:
|
||||
case AGSEVENT_MOUSE_WHEEL:
|
||||
// back log view mode に移行
|
||||
if (e->d3 == AGSEVENT_WHEEL_UP ||
|
||||
e->d3 == AGSEVENT_WHEEL_DN) {
|
||||
// MessageKey 待ちのときのみ
|
||||
if (sact.waittype != KEYWAIT_MESSAGE) break;
|
||||
sblog_start();
|
||||
// MessageKey 待ちのときのみ
|
||||
if (sact.waittype != KEYWAIT_MESSAGE) break;
|
||||
if (sblog_start() == OK)
|
||||
sact.waittype = KEYWAIT_BACKLOG;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGSEVENT_BUTTON_RELEASE:
|
||||
if (sact.zhiding) {
|
||||
slist_foreach(sact.sp_zhide, cb_focused_zkey, &update);
|
||||
sact.zhiding = FALSE;
|
||||
@@ -252,8 +251,8 @@ static void cb_waitkey_simple(agsevent_t *e) {
|
||||
case KEY_PAGEDOWN:
|
||||
// MessageKey 待ちのときのみ
|
||||
if (sact.waittype != KEYWAIT_MESSAGE) break;
|
||||
sblog_start();
|
||||
sact.waittype = KEYWAIT_BACKLOG;
|
||||
if (sblog_start() == OK)
|
||||
sact.waittype = KEYWAIT_BACKLOG;
|
||||
break;
|
||||
default:
|
||||
sact.waitkey = e->d3;
|
||||
@@ -407,19 +406,18 @@ static void cb_waitkey_backlog(agsevent_t *e) {
|
||||
break;
|
||||
|
||||
case AGSEVENT_BUTTON_RELEASE:
|
||||
switch(e->d3) {
|
||||
case AGSEVENT_WHEEL_UP:
|
||||
sblog_pagenext();
|
||||
break;
|
||||
case AGSEVENT_WHEEL_DN:
|
||||
sblog_pagepre();
|
||||
break;
|
||||
case AGSEVENT_BUTTON_RIGHT:
|
||||
if (e->d3 == AGSEVENT_BUTTON_RIGHT) {
|
||||
sblog_end();
|
||||
sact.waittype = KEYWAIT_MESSAGE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case AGSEVENT_MOUSE_WHEEL:
|
||||
if (e->d3 > 0)
|
||||
sblog_pagenext();
|
||||
else
|
||||
sblog_pagepre();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -225,7 +225,9 @@ static void remove_selwindow() {
|
||||
|
||||
// 作業用 surface の削除
|
||||
sf_free(selcanvas);
|
||||
selcanvas = NULL;
|
||||
sf_free(sact.sel.charcanvas);
|
||||
sact.sel.charcanvas = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -259,6 +261,17 @@ void ssel_init() {
|
||||
sact.sel.font_type = FONT_GOTHIC;
|
||||
}
|
||||
|
||||
void ssel_reset(void) {
|
||||
ssel_clear();
|
||||
if (selcanvas) {
|
||||
sf_free(selcanvas);
|
||||
selcanvas = NULL;
|
||||
}
|
||||
if (sact.sel.charcanvas) {
|
||||
sf_free(sact.sel.charcanvas);
|
||||
sact.sel.charcanvas = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
内部の選択肢情報をクリア
|
||||
|
||||
@@ -76,6 +76,7 @@ int resolve_module(S39AIN_DLLINF *dll) {
|
||||
if (strcasecmp((*mod)->name, dll->name) == 0) {
|
||||
for (int i = 0; i < dll->function_num; i++)
|
||||
resolve_func(&dll->function[i], *mod);
|
||||
dll->reset = (*mod)->reset;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ typedef struct {
|
||||
const char *name;
|
||||
const ModuleFunc *funcs; // must be sorted by name
|
||||
int nfunc;
|
||||
void (*reset)(void);
|
||||
} Module;
|
||||
|
||||
extern const Module module_AliceLogo;
|
||||
|
||||
@@ -27,6 +27,18 @@ static int window_width;
|
||||
static int window_height;
|
||||
static int map_width;
|
||||
|
||||
static void oujimisc_reset(void) {
|
||||
for (int i = 0; i < NUM_MAPS; i++) {
|
||||
free(mapdata[i]);
|
||||
mapdata[i] = NULL;
|
||||
}
|
||||
setChipParam_index = 0;
|
||||
memset(chip_params, 0, sizeof(chip_params));
|
||||
window_width = 0;
|
||||
window_height = 0;
|
||||
map_width = 0;
|
||||
}
|
||||
|
||||
static void MakeMapSetParam() {
|
||||
int p1 = getCaliValue();
|
||||
int p2 = getCaliValue();
|
||||
@@ -328,4 +340,4 @@ static const ModuleFunc functions[] = {
|
||||
{"TempMapSaveToShadow", TempMapSaveToShadow},
|
||||
};
|
||||
|
||||
const Module module_oujimisc = {"oujimisc", functions, sizeof(functions) / sizeof(ModuleFunc)};
|
||||
const Module module_oujimisc = {"oujimisc", functions, sizeof(functions) / sizeof(ModuleFunc), oujimisc_reset};
|
||||
|
||||
+1
-8
@@ -41,13 +41,7 @@ target_sources(xsystem35 PRIVATE
|
||||
|
||||
# CG
|
||||
target_sources(xsystem35 PRIVATE
|
||||
pms.c vsp.c bmp.c qnt.c)
|
||||
if (HAVE_JPEG)
|
||||
target_sources(xsystem35 PRIVATE jpeg.c)
|
||||
if (NOT EMSCRIPTEN)
|
||||
target_link_libraries(xsystem35 PRIVATE JPEG::JPEG)
|
||||
endif()
|
||||
endif()
|
||||
pms.c vsp.c bmp.c qnt.c jpeg.c)
|
||||
if (HAVE_WEBP)
|
||||
target_sources(xsystem35 PRIVATE webp.c)
|
||||
target_link_libraries(xsystem35 PRIVATE PkgConfig::WEBP)
|
||||
@@ -88,7 +82,6 @@ if (EMSCRIPTEN)
|
||||
|
||||
set(LIBS
|
||||
"SHELL:-s USE_ZLIB=1"
|
||||
"SHELL:-s USE_LIBJPEG=1"
|
||||
"SHELL:-s USE_SDL=2"
|
||||
"SHELL:-s USE_SDL_TTF=2")
|
||||
target_compile_options(xsystem35 PRIVATE ${LIBS})
|
||||
|
||||
@@ -117,11 +117,18 @@ void ags_init(const char *render_driver) {
|
||||
cg_init();
|
||||
}
|
||||
|
||||
void ags_remove() {
|
||||
void ags_remove(void) {
|
||||
ags_autorepeat(TRUE);
|
||||
sdl_Remove();
|
||||
}
|
||||
|
||||
void ags_reset(void) {
|
||||
nact->ags.mouse_movesw = 2;
|
||||
nact->ags.eventcb = NULL;
|
||||
initPal(&pal_256);
|
||||
cg_reset();
|
||||
}
|
||||
|
||||
void ags_setWorldSize(int width, int height, int depth) {
|
||||
nact->ags.world_size.width = width;
|
||||
nact->ags.world_size.height = height;
|
||||
@@ -294,6 +301,20 @@ void ags_getPixel(int x, int y, Palette *cell) {
|
||||
sdl_getPixel(x, y, cell);
|
||||
}
|
||||
|
||||
void ags_copyPaletteShift(int sx, int sy, int w, int h, int dx, int dy, BYTE sprite) {
|
||||
if (!ags_check_param(&sx, &sy, &w, &h)) return;
|
||||
if (!ags_check_param(&dx, &dy, &w, &h)) return;
|
||||
|
||||
for (int y = 0; y < h; y++) {
|
||||
BYTE *src = GETOFFSET_PIXEL(nact->ags.dib, sx, sy + y);
|
||||
BYTE *dst = GETOFFSET_PIXEL(nact->ags.dib, dx, dy + y);
|
||||
for (int x = 0; x < w; x++, src++, dst++) {
|
||||
if (*src != sprite)
|
||||
*dst = (*src & 0xf0) | (*dst & 0x0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ags_changeColorArea(int sx, int sy, int w, int h, int dst, int src, int cnt) {
|
||||
if (nact->ags.world_depth != 8) return;
|
||||
|
||||
|
||||
@@ -91,12 +91,11 @@ typedef struct _agsevent agsevent_t;
|
||||
#define AGSEVENT_KEY_PRESS 4
|
||||
#define AGSEVENT_KEY_RELEASE 5
|
||||
#define AGSEVENT_TIMER 6
|
||||
#define AGSEVENT_MOUSE_WHEEL 7
|
||||
|
||||
#define AGSEVENT_BUTTON_LEFT 1
|
||||
#define AGSEVENT_BUTTON_MID 2
|
||||
#define AGSEVENT_BUTTON_RIGHT 3
|
||||
#define AGSEVENT_WHEEL_UP 4
|
||||
#define AGSEVENT_WHEEL_DN 5
|
||||
|
||||
|
||||
struct _ags {
|
||||
@@ -126,8 +125,9 @@ typedef struct _ags ags_t;
|
||||
|
||||
|
||||
/* 初期化関係 */
|
||||
extern void ags_init(const char *render_driver);
|
||||
extern void ags_remove();
|
||||
void ags_init(const char *render_driver);
|
||||
void ags_remove(void);
|
||||
void ags_reset(void);
|
||||
|
||||
/* ウィンド関係 */
|
||||
extern void ags_setWorldSize(int width, int height, int depth);
|
||||
@@ -161,6 +161,7 @@ extern void ags_copyArea_shadow_withrate(int sx, int sy, int w, int h, int dx, i
|
||||
|
||||
extern void ags_wrapColor(int x, int y, int w, int h, int p1, int p2);
|
||||
extern void ags_getPixel(int x, int y, Palette *cell);
|
||||
extern void ags_copyPaletteShift(int sx, int sy, int w, int h, int dx, int dy, BYTE sprite);
|
||||
extern void ags_changeColorArea(int x, int y, int w, int h, int dst, int src, int cnt);
|
||||
|
||||
extern void* ags_saveRegion(int x, int y, int w, int h);
|
||||
|
||||
+6
-2
@@ -22,11 +22,15 @@
|
||||
#include "portab.h"
|
||||
#include "bgm.h"
|
||||
|
||||
int musbgm_init() {
|
||||
int musbgm_init(void) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_exit() {
|
||||
int musbgm_exit(void) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int musbgm_reset(void) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,11 +26,16 @@
|
||||
#include "bgi.h"
|
||||
#include "sdl_core.h"
|
||||
|
||||
int musbgm_init() {
|
||||
int musbgm_init(void) {
|
||||
return bgi_read(nact->files.bgi);
|
||||
}
|
||||
|
||||
int musbgm_exit() {
|
||||
int musbgm_exit(void) {
|
||||
musbgm_stopall(0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musbgm_reset(void) {
|
||||
musbgm_stopall(0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2019 <KichikuouChrome@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
#ifndef __BGM_H__
|
||||
#define __BGM_H__
|
||||
|
||||
extern int musbgm_init();
|
||||
extern int musbgm_exit();
|
||||
extern int musbgm_play(int no, int time, int vol);
|
||||
extern int musbgm_stop(int no, int time);
|
||||
extern int musbgm_fade(int no, int time, int vol);
|
||||
extern int musbgm_getpos(int no);
|
||||
extern int musbgm_getlen(int no);
|
||||
extern int musbgm_isplaying(int no);
|
||||
extern int musbgm_stopall(int time);
|
||||
extern int musbgm_wait(int no, int timeout);
|
||||
int musbgm_init(void);
|
||||
int musbgm_exit(void);
|
||||
int musbgm_reset(void);
|
||||
int musbgm_play(int no, int time, int vol);
|
||||
int musbgm_stop(int no, int time);
|
||||
int musbgm_fade(int no, int time, int vol);
|
||||
int musbgm_getpos(int no);
|
||||
int musbgm_getlen(int no);
|
||||
int musbgm_isplaying(int no);
|
||||
int musbgm_stopall(int time);
|
||||
int musbgm_wait(int no, int timeout);
|
||||
|
||||
#endif /* __BGM_H__ */
|
||||
|
||||
+7
-2
@@ -75,11 +75,16 @@ static Mix_Music *bgm_load(int no) {
|
||||
return mix_music;
|
||||
}
|
||||
|
||||
int musbgm_init() {
|
||||
int musbgm_init(void) {
|
||||
return bgi_read(nact->files.bgi);
|
||||
}
|
||||
|
||||
int musbgm_exit() {
|
||||
int musbgm_exit(void) {
|
||||
free_music();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musbgm_reset(void) {
|
||||
free_music();
|
||||
return OK;
|
||||
}
|
||||
|
||||
+27
-17
@@ -51,25 +51,35 @@ int *getVariable();
|
||||
static int buf[CALI_DEPTH_MAX]; /* 計算式バッファ */
|
||||
static int *cali = buf; /* インデックス */
|
||||
|
||||
/* 変数番号を返す */
|
||||
static int *getVar(int c0) {
|
||||
if ((c0 & 0x40) == 0)
|
||||
return v_ref(c0 & 0x3f); // 0 - 0x3f
|
||||
|
||||
int c1 = sl_getc();
|
||||
if (c0 != 0xc0)
|
||||
return v_ref(((c0 & 0x3f) * 256) + c1); // 0x100 - 0x3fff
|
||||
|
||||
if (c1 == 1) {
|
||||
c0 = sl_getc();
|
||||
c1 = sl_getc();
|
||||
int index = getCaliValue();
|
||||
return v_ref_indexed(c0 << 8 | c1, index);
|
||||
} else if (c1 >= 0x40) {
|
||||
return v_ref(c1); // 0x40 - 0xff
|
||||
int addr = sl_getIndex();
|
||||
int var;
|
||||
if ((c0 & 0x40) == 0) {
|
||||
var = c0 & 0x3f; // 0 - 0x3f
|
||||
} else {
|
||||
int c1 = sl_getc();
|
||||
if (c0 != 0xc0)
|
||||
var = (c0 & 0x3f) * 256 + c1; // 0x100 - 0x3fff
|
||||
else if (c1 == 1) {
|
||||
c0 = sl_getc();
|
||||
c1 = sl_getc();
|
||||
var = c0 << 8 | c1;
|
||||
int index = getCaliValue();
|
||||
int *store = v_ref_indexed(var, index);
|
||||
if (!store)
|
||||
WARNING("%03d:%05x: Out of bounds index access: %s[%d]\n", sl_getPage(), addr, v_name(var), index);
|
||||
return store;
|
||||
} else if (c1 >= 0x40) {
|
||||
var = c1; // 0x40 - 0xff
|
||||
} else {
|
||||
SYSERROR("Invalid variable reference at %d:0x%x", sl_getPage(), addr);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
SYSERROR("Invalid variable reference at %d:0x%x", sl_getPage(), sl_getIndex() - 2);
|
||||
return NULL;
|
||||
int *store = v_ref(var);
|
||||
if (!store)
|
||||
WARNING("%03d:%05x: Out of bounds array access: %s\n", sl_getPage(), addr, v_name(var));
|
||||
return store;
|
||||
}
|
||||
|
||||
/* 変数番号が返る */
|
||||
|
||||
+8
-2
@@ -34,7 +34,8 @@
|
||||
#include "music_private.h"
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit();
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
static int cdrom_start(int, int);
|
||||
static int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
@@ -43,6 +44,7 @@ static int cdrom_getPlayingInfo(cd_time *);
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
@@ -143,7 +145,7 @@ int cdrom_init(char *dev_cd) {
|
||||
}
|
||||
|
||||
/* デバイスの後始末 */
|
||||
int cdrom_exit() {
|
||||
int cdrom_exit(void) {
|
||||
if (enabled) {
|
||||
cdrom_stop();
|
||||
close(cd_fd);
|
||||
@@ -151,6 +153,10 @@ int cdrom_exit() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_reset(void) {
|
||||
return cdrom_stop();
|
||||
}
|
||||
|
||||
/* トラック番号 trk の演奏 trk = 1~ */
|
||||
int cdrom_start(int trk, int loop) {
|
||||
struct ioc_play_msf msf;
|
||||
|
||||
+8
-2
@@ -43,7 +43,8 @@ struct cdrom_msf0 {
|
||||
#include "music_private.h"
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit();
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
static int cdrom_start(int, int);
|
||||
static int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
@@ -52,6 +53,7 @@ static int cdrom_getPlayingInfo(cd_time *);
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
@@ -174,7 +176,7 @@ static int cdrom_init(char *dev_cd) {
|
||||
}
|
||||
|
||||
/* デバイスの後始末 */
|
||||
static int cdrom_exit() {
|
||||
static int cdrom_exit(void) {
|
||||
if (enabled) {
|
||||
cdrom_stop();
|
||||
close(cd_fd);
|
||||
@@ -182,6 +184,10 @@ static int cdrom_exit() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int cdrom_reset(void) {
|
||||
return cdrom_stop();
|
||||
}
|
||||
|
||||
/* トラック番号 trk の演奏 trk = 1~ */
|
||||
static int cdrom_start(int trk, int loop) {
|
||||
struct cdrom_msf msf;
|
||||
|
||||
+9
-2
@@ -24,7 +24,8 @@
|
||||
#include "cdrom.h"
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit();
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
static int cdrom_start(int, int);
|
||||
static int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
@@ -33,6 +34,7 @@ static int cdrom_getPlayingInfo(cd_time *);
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
@@ -44,7 +46,12 @@ int cdrom_init(char *name) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_exit() {
|
||||
int cdrom_reset(void) {
|
||||
cdrom_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_exit(void) {
|
||||
cdrom_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
+8
-2
@@ -26,7 +26,8 @@
|
||||
#include "cdrom.h"
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit();
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
static int cdrom_start(int, int);
|
||||
static int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
@@ -35,6 +36,7 @@ static int cdrom_getPlayingInfo(cd_time *);
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
@@ -46,7 +48,11 @@ int cdrom_init(char *name) {
|
||||
return NG;
|
||||
}
|
||||
|
||||
int cdrom_exit() {
|
||||
int cdrom_exit(void) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_reset(void) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
static int frame_of_getpos = -1;
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit();
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
extern int cdrom_start(int, int);
|
||||
extern int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
@@ -37,6 +38,7 @@ static int cdrom_getPlayingInfo(cd_time *);
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
@@ -48,7 +50,12 @@ int cdrom_init(char *name) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_exit() {
|
||||
int cdrom_exit(void) {
|
||||
cdrom_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int cdrom_reset(void) {
|
||||
cdrom_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ typedef struct {
|
||||
struct _cdromdevice {
|
||||
int (* init)(char *);
|
||||
int (* exit)(void);
|
||||
int (* reset)(void);
|
||||
// Play through the track loop times. If loop == 0, loops forever.
|
||||
int (* start)(int trk, int loop);
|
||||
int (* stop)(void);
|
||||
|
||||
+11
-2
@@ -35,7 +35,8 @@
|
||||
#include "music_private.h"
|
||||
|
||||
static int cdrom_init(char *);
|
||||
static int cdrom_exit();
|
||||
static int cdrom_exit(void);
|
||||
static int cdrom_reset(void);
|
||||
static int cdrom_start(int, int);
|
||||
static int cdrom_stop();
|
||||
static int cdrom_getPlayingInfo(cd_time *);
|
||||
@@ -44,6 +45,7 @@ static int cdrom_getPlayingInfo(cd_time *);
|
||||
cdromdevice_t cdrom = {
|
||||
cdrom_init,
|
||||
cdrom_exit,
|
||||
cdrom_reset,
|
||||
cdrom_start,
|
||||
cdrom_stop,
|
||||
cdrom_getPlayingInfo,
|
||||
@@ -98,7 +100,14 @@ static int cdrom_init(char *playlist_path) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int cdrom_exit() {
|
||||
static int cdrom_exit(void) {
|
||||
if (enabled) {
|
||||
cdrom_stop();
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int cdrom_reset(void) {
|
||||
if (enabled) {
|
||||
cdrom_stop();
|
||||
}
|
||||
|
||||
@@ -33,28 +33,26 @@
|
||||
#include "pms.h"
|
||||
#include "bmp.h"
|
||||
#include "qnt.h"
|
||||
#ifdef HAVE_JPEG
|
||||
#include "jpeg.h"
|
||||
#endif
|
||||
#include "ald_manager.h"
|
||||
#include "savedata.h"
|
||||
#include "cache.h"
|
||||
|
||||
/* VSPのパレット展開バンク */
|
||||
int cg_vspPB = -1;
|
||||
int cg_vspPB;
|
||||
/* cg,palette 展開フラグ (funciotn flag) */
|
||||
int cg_fflg = 7;
|
||||
int cg_fflg;
|
||||
/* CGをロードした回数を書き込む変数 */
|
||||
int *cg_loadCountVar = NULL;
|
||||
int *cg_loadCountVar;
|
||||
/* Brightness (PD command) */
|
||||
int cg_brightness = 255;
|
||||
int cg_brightness;
|
||||
|
||||
#define GCMD_EXTRACTCG(c) ((c) & 0x01)
|
||||
#define GCMD_SET_PALETTE(c) ((c) & 0x02)
|
||||
#define GCMD_LOAD_PALETTE(c) ((c) & 0x04)
|
||||
|
||||
/* CG表示位置に関する情報 */
|
||||
static CG_WHERETODISP loc_policy = OFFSET_NOMOVE, loc_policy0;
|
||||
static CG_WHERETODISP loc_policy, loc_policy0;
|
||||
static MyPoint loc_where, loc_where0;
|
||||
|
||||
/* extracted cg data cache control object */
|
||||
@@ -87,10 +85,8 @@ static CG_TYPE check_cgformat(BYTE *data) {
|
||||
return ALCG_BMP8;
|
||||
} else if (vsp_checkfmt(data)) {
|
||||
return ALCG_VSP;
|
||||
#ifdef HAVE_JPEG
|
||||
} else if (jpeg_checkfmt(data) && nact->ags.world_depth >= 15) {
|
||||
return ALCG_JPEG;
|
||||
#endif
|
||||
}
|
||||
WARNING("Unknown Cg Type\n");
|
||||
return ALCG_UNKNOWN;
|
||||
@@ -221,11 +217,9 @@ static cgdata *loader(int no) {
|
||||
case ALCG_QNT:
|
||||
cg = qnt_extract(dfile->data);
|
||||
break;
|
||||
#ifdef HAVE_JPEG
|
||||
case ALCG_JPEG:
|
||||
cg = jpeg_extract(dfile->data, dfile->size);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -244,8 +238,19 @@ static cgdata *loader(int no) {
|
||||
/*
|
||||
* Initilize cache
|
||||
*/
|
||||
void cg_init() {
|
||||
void cg_init(void) {
|
||||
cacheid = cache_new(cgdata_free);
|
||||
cg_reset();
|
||||
}
|
||||
|
||||
void cg_reset(void) {
|
||||
cg_vspPB = -1;
|
||||
cg_fflg = 7;
|
||||
cg_loadCountVar = NULL;
|
||||
cg_brightness = 255;
|
||||
loc_policy = loc_policy0 = OFFSET_NOMOVE;
|
||||
memset(&loc_where, 0, sizeof(loc_where));
|
||||
memset(&loc_where0, 0, sizeof(loc_where0));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -413,11 +418,9 @@ int cg_load_with_filename(char *fname_utf8, int x, int y) {
|
||||
case ALCG_BMP24:
|
||||
cg = bmp16m_extract(data);
|
||||
break;
|
||||
#ifdef HAVE_JPEG
|
||||
case ALCG_JPEG:
|
||||
cg = jpeg_extract(data, filesize);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ typedef enum {
|
||||
OFFSET_RELATIVE_JC /* relative location and use til J4 cmd */
|
||||
} CG_WHERETODISP;
|
||||
|
||||
extern void cg_init();
|
||||
extern void cg_init(void);
|
||||
extern void cg_reset(void);
|
||||
extern void cg_set_display_location(int x, int y, CG_WHERETODISP policy);
|
||||
extern void cg_load(int no, int flg);
|
||||
extern void cg_load_with_alpha(int cgno, int shadowno);
|
||||
|
||||
+43
-10
@@ -619,6 +619,7 @@ void commands2F37() {
|
||||
}
|
||||
|
||||
void commands2F38() {
|
||||
sys_clearWheelInfo();
|
||||
DEBUG_COMMAND("iptClearWheelCount:\n");
|
||||
}
|
||||
|
||||
@@ -626,8 +627,7 @@ void commands2F39() {
|
||||
int *vForward = getCaliVariable();
|
||||
int *vBack = getCaliVariable();
|
||||
|
||||
*vForward = 0;
|
||||
*vBack = 0;
|
||||
sys_getWheelInfo(vForward, vBack);
|
||||
DEBUG_COMMAND("iptGetWheelCount %d, %d:\n", *vForward, *vBack);
|
||||
}
|
||||
|
||||
@@ -665,12 +665,12 @@ void commands2F3D() {
|
||||
}
|
||||
|
||||
void commands2F3E() {
|
||||
nact->is_message_locked = TRUE;
|
||||
// no-op
|
||||
DEBUG_COMMAND("sysWinMsgLock:\n");
|
||||
}
|
||||
|
||||
void commands2F3F() {
|
||||
nact->is_message_locked = FALSE;
|
||||
// no-op
|
||||
DEBUG_COMMAND("sysWinMsgUnlock:\n");
|
||||
}
|
||||
|
||||
@@ -735,7 +735,10 @@ void commands2F43() {
|
||||
int eLength = getCaliValue();
|
||||
int eColor = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("grDrawFillCircle %d, %d, %d, %d:\n", eX, eY, eLength, eColor);
|
||||
sdl_fillCircle(eX, eY, eLength, eColor);
|
||||
ags_updateArea(eX, eY, eLength, eLength);
|
||||
|
||||
DEBUG_COMMAND("grDrawFillCircle %d, %d, %d, %d:\n", eX, eY, eLength, eColor);
|
||||
}
|
||||
|
||||
void commands2F44() {
|
||||
@@ -1001,13 +1004,35 @@ void commands2F5D() {
|
||||
DEBUG_COMMAND_YET("grSetCEParam %d, %d:\n", eNum, eData);
|
||||
}
|
||||
|
||||
struct grEffectMoveView_data {
|
||||
int origin_x;
|
||||
int origin_y;
|
||||
int target_x;
|
||||
int target_y;
|
||||
};
|
||||
|
||||
static void grEffectMoveView_step(void *data, double progress) {
|
||||
struct grEffectMoveView_data *d = data;
|
||||
int x = d->origin_x + (d->target_x - d->origin_x) * progress;
|
||||
int y = d->origin_y + (d->target_y - d->origin_y) * progress;
|
||||
ags_setViewArea(x, y, nact->ags.view_area.w, nact->ags.view_area.h);
|
||||
ags_updateFull();
|
||||
}
|
||||
|
||||
void commands2F5E() {
|
||||
int eX = getCaliValue();
|
||||
int eY = getCaliValue();
|
||||
int eTime = getCaliValue();
|
||||
int eFlag = getCaliValue();
|
||||
|
||||
DEBUG_COMMAND_YET("grEffectMoveView %d, %d, %d, %d:\n", eX, eY, eTime, eFlag);
|
||||
|
||||
struct grEffectMoveView_data data = {
|
||||
.origin_x = nact->ags.view_area.x,
|
||||
.origin_y = nact->ags.view_area.y,
|
||||
.target_x = eX,
|
||||
.target_y = eY
|
||||
};
|
||||
ags_runEffect(eTime, eFlag, grEffectMoveView_step, &data);
|
||||
DEBUG_COMMAND("grEffectMoveView %d, %d, %d, %d:\n", eX, eY, eTime, eFlag);
|
||||
}
|
||||
|
||||
void commands2F5F() {
|
||||
@@ -1314,11 +1339,13 @@ void commands2F79() {
|
||||
}
|
||||
|
||||
void commands2F7A() {
|
||||
DEBUG_COMMAND_YET("menuFreeShelterDIB:\n");
|
||||
// no-op
|
||||
DEBUG_COMMAND("menuFreeShelterDIB:\n");
|
||||
}
|
||||
|
||||
void commands2F7B() {
|
||||
DEBUG_COMMAND_YET("msgFreeShelterDIB:\n");
|
||||
// no-op
|
||||
DEBUG_COMMAND("msgFreeShelterDIB:\n");
|
||||
}
|
||||
|
||||
void commands2F7C() {
|
||||
@@ -1505,5 +1532,11 @@ void commands2F8B() {
|
||||
|
||||
void commands2F8C() {
|
||||
DEBUG_COMMAND("sysReset:\n");
|
||||
sys_reset();
|
||||
nact_quit(TRUE);
|
||||
}
|
||||
|
||||
void cmd2F_reset(void) {
|
||||
cb_sel_init_page = 0;
|
||||
cb_sel_init_address = 0;
|
||||
memset(fnctbl, 0, sizeof(fnctbl));
|
||||
}
|
||||
|
||||
+30
-37
@@ -30,13 +30,6 @@
|
||||
#include "message.h"
|
||||
#include "selection.h"
|
||||
|
||||
/* 選択肢Window情報 */
|
||||
Bcom_WindowInfo selWinInfo[SELWINMAX] = {{ 464, 80, 160, 160, TRUE }};
|
||||
/* 現在の選択肢Window番号 */
|
||||
static int selWinNo;
|
||||
/* 現在のMessageWindow番号 */
|
||||
static int msgWinNo;
|
||||
|
||||
void commandB0() {
|
||||
/* メッセージウィンドウをクリアする。*/
|
||||
int num = getCaliValue();
|
||||
@@ -65,28 +58,30 @@ void commandB1() {
|
||||
WARNING("commandB1(): Window number is out of range %d", num);
|
||||
return;
|
||||
}
|
||||
selWinInfo[num].x = X1;
|
||||
selWinInfo[num].y = Y1;
|
||||
selWinInfo[num].width = X2;
|
||||
selWinInfo[num].height = Y2;
|
||||
selWinInfo[num].save = (V == 0) ? false : true;
|
||||
nact->sel.wininfo[num].x = X1;
|
||||
nact->sel.wininfo[num].y = Y1;
|
||||
nact->sel.wininfo[num].width = X2;
|
||||
nact->sel.wininfo[num].height = Y2;
|
||||
nact->sel.wininfo[num].save = (V == 0) ? false : true;
|
||||
|
||||
DEBUG_COMMAND("B1 %d,%d,%d,%d,%d,%d:\n", num + 1, X1, Y1, X2, Y2, V);
|
||||
}
|
||||
|
||||
void commandB2() {
|
||||
int num = getCaliValue() - 1 ;
|
||||
int num = getCaliValue();
|
||||
int W = getCaliValue();
|
||||
int C1 = getCaliValue();
|
||||
int C2 = getCaliValue();
|
||||
int C3 = getCaliValue();
|
||||
int dot = getCaliValue();
|
||||
|
||||
if (num < 0 || num >= SELWINMAX) {
|
||||
if (num < 1 || num - 1 >= SELWINMAX) {
|
||||
WARNING("commandB2(): Window number is out of range %d", num);
|
||||
return;
|
||||
}
|
||||
nact->sel.win = &selWinInfo[num];
|
||||
|
||||
nact->sel.winno = num;
|
||||
nact->sel.win = &nact->sel.wininfo[num - 1];
|
||||
|
||||
nact->sel.WindowFrameType = W;
|
||||
nact->sel.FrameCgNoTop = C1;
|
||||
@@ -94,9 +89,7 @@ void commandB2() {
|
||||
nact->sel.FrameCgNoBot = C3;
|
||||
nact->sel.Framedot = W == 0 ? 0 : W == 1 ? 8 : dot ;
|
||||
|
||||
selWinNo = num + 1;
|
||||
|
||||
DEBUG_COMMAND("B2 %d,%d,%d,%d,%d,%d:\n", num + 1, W, C1, C2, C3, dot);
|
||||
DEBUG_COMMAND("B2 %d,%d,%d,%d,%d,%d:\n", num, W, C1, C2, C3, dot);
|
||||
}
|
||||
|
||||
void commandB3() {
|
||||
@@ -121,23 +114,23 @@ void commandB3() {
|
||||
}
|
||||
|
||||
void commandB4() {
|
||||
int num = getCaliValue() - 1;
|
||||
int num = getCaliValue();
|
||||
int W = getCaliValue();
|
||||
int C1 = getCaliValue();
|
||||
int C2 = getCaliValue();
|
||||
int N = getCaliValue();
|
||||
int M = getCaliValue();
|
||||
|
||||
if (num < 0 || num >= MSGWINMAX) {
|
||||
if (num < 1 || num - 1 >= MSGWINMAX) {
|
||||
WARNING("commandB4(): Window number is out of range %d", num);
|
||||
num = 0;
|
||||
}
|
||||
|
||||
msgWinNo = num + 1;
|
||||
nact->msg.win = &nact->msg.wininfo[num];
|
||||
nact->msg.winno = num;
|
||||
nact->msg.win = &nact->msg.wininfo[num - 1];
|
||||
msg_openWindow(W, C1, C2, N, M);
|
||||
|
||||
DEBUG_COMMAND("B4 %d,%d,%d,%d,%d,%d:\n", num + 1, W, C1, C2, N, M);
|
||||
DEBUG_COMMAND("B4 %d,%d,%d,%d,%d,%d:\n", num, W, C1, C2, N, M);
|
||||
}
|
||||
|
||||
void commandB10() {
|
||||
@@ -155,8 +148,8 @@ void commandB11() {
|
||||
int *sel_no_var = getCaliVariable();
|
||||
int *msg_no_var = getCaliVariable();
|
||||
|
||||
*sel_no_var = selWinNo;
|
||||
*msg_no_var = msgWinNo;
|
||||
*sel_no_var = nact->sel.winno;
|
||||
*msg_no_var = nact->msg.winno;
|
||||
|
||||
DEBUG_COMMAND("B11 %d,%d:\n", *sel_no_var, *msg_no_var);
|
||||
}
|
||||
@@ -187,8 +180,8 @@ void commandB21() {
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
*x_var = selWinInfo[selWinNo - 1].x;
|
||||
*y_var = selWinInfo[selWinNo - 1].y;
|
||||
*x_var = nact->sel.win->x;
|
||||
*y_var = nact->sel.win->y;
|
||||
|
||||
DEBUG_COMMAND("B21 %d,%d,%d:\n", no, *x_var, *y_var);
|
||||
}
|
||||
@@ -198,8 +191,8 @@ void commandB22() {
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
*x_var = selWinInfo[selWinNo - 1].width;
|
||||
*y_var = selWinInfo[selWinNo - 1].height;
|
||||
*x_var = nact->sel.win->width;
|
||||
*y_var = nact->sel.win->height;
|
||||
|
||||
DEBUG_COMMAND("B22 %d,%d,%d:\n", no, *x_var, *y_var);
|
||||
}
|
||||
@@ -209,8 +202,8 @@ void commandB23() {
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
*x_var = nact->msg.wininfo[msgWinNo - 1].x;
|
||||
*y_var = nact->msg.wininfo[msgWinNo - 1].y;
|
||||
*x_var = nact->msg.win->x;
|
||||
*y_var = nact->msg.win->y;
|
||||
|
||||
DEBUG_COMMAND("B23 %d,%d,%d:\n", no, *x_var, *y_var);
|
||||
}
|
||||
@@ -220,8 +213,8 @@ void commandB24() {
|
||||
int *x_var_size = getCaliVariable();
|
||||
int *y_var_size = getCaliVariable();
|
||||
|
||||
*x_var_size = nact->msg.wininfo[msgWinNo - 1].width;
|
||||
*y_var_size = nact->msg.wininfo[msgWinNo - 1].height;
|
||||
*x_var_size = nact->msg.win->width;
|
||||
*y_var_size = nact->msg.win->height;
|
||||
|
||||
DEBUG_COMMAND("B24 %d,%d,%d:\n", no, *x_var_size, *y_var_size);
|
||||
}
|
||||
@@ -232,8 +225,8 @@ void commandB31() {
|
||||
int *x_var = getCaliVariable();
|
||||
int *y_var = getCaliVariable();
|
||||
|
||||
*x_var = selWinInfo[no - 1].x;
|
||||
*y_var = selWinInfo[no - 1].y;
|
||||
*x_var = nact->sel.wininfo[no - 1].x;
|
||||
*y_var = nact->sel.wininfo[no - 1].y;
|
||||
|
||||
DEBUG_COMMAND("B31 %d,%d,%d:\n", no, *x_var, *y_var);
|
||||
}
|
||||
@@ -243,8 +236,8 @@ void commandB32() {
|
||||
int *x_var_size = getCaliVariable();
|
||||
int *y_var_size = getCaliVariable();
|
||||
|
||||
*x_var_size = selWinInfo[no - 1].width;
|
||||
*y_var_size = selWinInfo[no - 1].height;
|
||||
*x_var_size = nact->sel.wininfo[no - 1].width;
|
||||
*y_var_size = nact->sel.wininfo[no - 1].height;
|
||||
|
||||
DEBUG_COMMAND("B32 %d,%d,%d:\n", no, *x_var_size, *y_var_size);
|
||||
}
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ void commandLL() {
|
||||
DEBUG_COMMAND("LL %d,%d,%d,%d:\n",type, link_no, _var, num);
|
||||
|
||||
if (dfile->size < num * sizeof(WORD)) {
|
||||
WARNING("data shortage (req = %d, result = %d)\n", num, dfile->size/ sizeof(WORD));
|
||||
WARNING("data shortage (link_no = %d, requested %d, loaded %d)\n", link_no, num, dfile->size/ sizeof(WORD));
|
||||
/* sysVar[0] = 254; 大嘘*/
|
||||
/* return; */
|
||||
num = dfile->size / sizeof(WORD);
|
||||
|
||||
+7
-7
@@ -37,21 +37,16 @@ static int next_cdrom_loopcnt = 0;
|
||||
void commandSS() {
|
||||
/* 音楽演奏を開始する(CDのみ)*/
|
||||
int num = getCaliValue();
|
||||
static int pre = 0;
|
||||
|
||||
DEBUG_COMMAND("SS %d:\n",num);
|
||||
|
||||
if (num == 0) {
|
||||
mus_cdrom_stop();
|
||||
} else {
|
||||
if (pre != num) {
|
||||
mus_cdrom_stop();
|
||||
mus_cdrom_start(num + 1, next_cdrom_loopcnt);
|
||||
}
|
||||
mus_cdrom_start(num + 1, next_cdrom_loopcnt);
|
||||
}
|
||||
|
||||
next_cdrom_loopcnt = 0;
|
||||
pre = num;
|
||||
}
|
||||
|
||||
void commandSC() {
|
||||
@@ -103,7 +98,12 @@ void commandSR() {
|
||||
if (num == 0) {
|
||||
int t, m, s, f;
|
||||
if (mus_cdrom_get_playposition(&t, &m, &s, &f) == OK) {
|
||||
*var = t - 1;
|
||||
// System3.5 returns the music number (track_no - 1),
|
||||
// while System3.6 and later return the track number.
|
||||
if (!memcmp(sl_sco, "S350", 4))
|
||||
*var = t - 1;
|
||||
else
|
||||
*var = t;
|
||||
} else {
|
||||
*var = 0;
|
||||
}
|
||||
|
||||
+27
-1
@@ -964,7 +964,7 @@ static void va_updatePreArea(int i) {
|
||||
ags_updateArea(VAcmd[i].preX, VAcmd[i].preY, VAcmd[i].unitWidth, VAcmd[i].unitHeight);
|
||||
}
|
||||
|
||||
void va_animation() {
|
||||
void va_animation(void) {
|
||||
int i;
|
||||
int x, y, w, h;
|
||||
|
||||
@@ -1050,3 +1050,29 @@ static void va_update() {
|
||||
status_check_count = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void va_reset(void) {
|
||||
free(UnitMap);
|
||||
UnitMap = NULL;
|
||||
|
||||
nPageNum = 0;
|
||||
x0Map = 0;
|
||||
y0Map = 0;
|
||||
cxMap = 0;
|
||||
cyMap = 0;
|
||||
cxUnit = 0;
|
||||
cyUnit = 0;
|
||||
|
||||
free(_vh_src);
|
||||
free(_vh_dst);
|
||||
_vh_src = vh_src = NULL;
|
||||
_vh_dst = vh_dst = NULL;
|
||||
vh_cnt_src = 0;
|
||||
vh_cnt_dst = 0;
|
||||
|
||||
free(srcimg);
|
||||
srcimg = NULL;
|
||||
|
||||
memset(VAcmd, 0, sizeof(VAcmd));
|
||||
inAnimation = FALSE;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,11 @@ void commandZZ0() {
|
||||
DEBUG_COMMAND("ZZ0 %d:\n",sw);
|
||||
|
||||
if (sw == 0) {
|
||||
#ifdef __EMSCRIPTEN__
|
||||
nact_quit(TRUE);
|
||||
#else
|
||||
sys_exit(sysVar[0]);
|
||||
#endif
|
||||
} else if (sw == 1) {
|
||||
while (TRUE) {
|
||||
usleep(1000*1000);
|
||||
@@ -566,3 +570,7 @@ void commandZU() {
|
||||
|
||||
DEBUG_COMMAND("ZU %d:\n",sw);
|
||||
}
|
||||
|
||||
void cmdz_reset(void) {
|
||||
memset(counters, 0, sizeof(counters));
|
||||
}
|
||||
|
||||
+8
-4
@@ -51,9 +51,9 @@ void dbg_init(const char *symbols_path, boolean use_dap) {
|
||||
dbg_impl->init(symbols_path);
|
||||
}
|
||||
|
||||
void dbg_quit(bool restart) {
|
||||
void dbg_quit(void) {
|
||||
if (dbg_impl)
|
||||
dbg_impl->quit(restart);
|
||||
dbg_impl->quit();
|
||||
}
|
||||
|
||||
int dbg_lookup_var(const char *name) {
|
||||
@@ -142,13 +142,17 @@ static int eval_variable(void) {
|
||||
int var = dbg_lookup_var(buf);
|
||||
if (var < 0)
|
||||
eval_error("unknown variable \"%s\"", buf);
|
||||
int *store;
|
||||
if (consume('[')) {
|
||||
int index = eval_expr();
|
||||
expect(']');
|
||||
return *v_ref_indexed(var, index);;
|
||||
store = v_ref_indexed(var, index);
|
||||
} else {
|
||||
return *v_ref(var);
|
||||
store = v_ref(var);
|
||||
}
|
||||
if (!store)
|
||||
eval_error("out of bounds array access");
|
||||
return *store;
|
||||
}
|
||||
|
||||
static int eval_prim(void) {
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ extern DebuggerState dbg_state;
|
||||
|
||||
#define dbg_trapped() (dbg_state != DBG_RUNNING)
|
||||
void dbg_init(const char *symbols_path, boolean use_dap);
|
||||
void dbg_quit(bool restart);
|
||||
void dbg_quit(void);
|
||||
void dbg_main(int bp_no);
|
||||
void dbg_onsleep(void);
|
||||
BYTE dbg_handle_breakpoint(int page, int addr);
|
||||
@@ -52,7 +52,7 @@ boolean dbg_console_vprintf(int lv, const char *format, va_list ap);
|
||||
|
||||
#define dbg_trapped() false
|
||||
#define dbg_init(symbols_path, use_dap)
|
||||
#define dbg_quit(restart)
|
||||
#define dbg_quit()
|
||||
#define dbg_main(bp_no)
|
||||
#define dbg_onsleep()
|
||||
#define dbg_handle_breakpoint(page, addr) BREAKPOINT
|
||||
|
||||
+1
-1
@@ -344,7 +344,7 @@ static void dbg_cui_init(const char *symbols_path) {
|
||||
dbg_state = DBG_STOPPED_ENTRY;
|
||||
}
|
||||
|
||||
static void dbg_cui_quit(bool restart) {
|
||||
static void dbg_cui_quit(void) {
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
||||
+17
-13
@@ -82,14 +82,10 @@ static void emit_initialized_event(void) {
|
||||
send_json(event);
|
||||
}
|
||||
|
||||
static void emit_terminated_event(bool restart) {
|
||||
cJSON *event = cJSON_CreateObject(), *body;
|
||||
static void emit_terminated_event(void) {
|
||||
cJSON *event = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(event, "type", "event");
|
||||
cJSON_AddStringToObject(event, "event", "terminated");
|
||||
if (restart) {
|
||||
cJSON_AddItemToObjectCS(event, "body", body = cJSON_CreateObject());
|
||||
cJSON_AddBoolToObject(body, "restart", true);
|
||||
}
|
||||
send_json(event);
|
||||
}
|
||||
|
||||
@@ -378,7 +374,11 @@ static void cmd_variables(cJSON *args, cJSON *resp) {
|
||||
cJSON_AddItemToArray(variables, var);
|
||||
cJSON_AddStringToObject(var, "name", dsym_variable_name(symbols, i));
|
||||
char value[20];
|
||||
sprintf(value, "%d", *v_ref(i));
|
||||
int *store = v_ref(i);
|
||||
if (store)
|
||||
sprintf(value, "%d", *store);
|
||||
else
|
||||
strcpy(value, "(Out of bounds)");
|
||||
cJSON_AddStringToObject(var, "value", value);
|
||||
cJSON_AddNumberToObject(var, "variablesReference", 0);
|
||||
}
|
||||
@@ -430,13 +430,19 @@ static void cmd_setVariable(cJSON *args, cJSON *resp) {
|
||||
cJSON_AddStringToObject(resp, "message", "syntax error");
|
||||
return;
|
||||
}
|
||||
*v_ref(var) = parsed_value & 0xffff;
|
||||
int *store = v_ref(var);
|
||||
if (!store) {
|
||||
cJSON_AddBoolToObject(resp, "success", false);
|
||||
cJSON_AddStringToObject(resp, "message", "out of bounds array access");
|
||||
return;
|
||||
}
|
||||
*store = parsed_value & 0xffff;
|
||||
|
||||
cJSON *body;
|
||||
cJSON_AddBoolToObject(resp, "success", true);
|
||||
cJSON_AddItemToObjectCS(resp, "body", body = cJSON_CreateObject());
|
||||
char new_value[20];
|
||||
sprintf(new_value, "%d", *v_ref(var));
|
||||
sprintf(new_value, "%d", *store);
|
||||
cJSON_AddStringToObject(body, "value", new_value);
|
||||
} else if (cJSON_IsNumber(vref) && vref->valueint == VREF_STRINGS) {
|
||||
int idx;
|
||||
@@ -590,10 +596,8 @@ static void dbg_dap_init(const char *path) {
|
||||
}
|
||||
}
|
||||
|
||||
static void dbg_dap_quit(bool restart) {
|
||||
emit_terminated_event(restart);
|
||||
if (restart)
|
||||
exit(0); // The front end will restart xsystem35, so we can just exit.
|
||||
static void dbg_dap_quit(void) {
|
||||
emit_terminated_event();
|
||||
}
|
||||
|
||||
static void dbg_dap_repl(int bp_no) {
|
||||
|
||||
@@ -55,7 +55,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
void (*init)(const char *symbols_path);
|
||||
void (*quit)(bool restart);
|
||||
void (*quit)(void);
|
||||
void (*repl)(int bp_no);
|
||||
void (*onsleep)(void);
|
||||
void (*console_output)(int lv, const char *output);
|
||||
|
||||
+10
-108
@@ -279,110 +279,11 @@ static int eCopyArea23(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
return key;
|
||||
}
|
||||
|
||||
#define SCA25_6_SLICE 10
|
||||
static int eCopyArea25(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
int r, rr, x, xx, y, yy, key = 0, cnt;
|
||||
int waitcnt = opt == 0 ? 20 : opt;
|
||||
int w2=w/2,h2=h/2,h1=h-1,mr=(int)(sqrt(w2*w2+h2*h2));
|
||||
int ux=0,uy=0,ux_y=h2-1,uw,uh;
|
||||
|
||||
cnt = sdl_getTicks();
|
||||
for (r = SCA25_6_SLICE; r < mr; r += SCA25_6_SLICE ) {
|
||||
cnt += waitcnt;
|
||||
rr=r*r;
|
||||
uw=uh=0;
|
||||
for (y = 0; y < h2; y++) {
|
||||
yy=h2-y;
|
||||
xx=rr-yy*yy;
|
||||
if (xx > 0) {
|
||||
x=(int)(sqrt(xx));
|
||||
x=(w2>x)?x:w2;
|
||||
xx=w2-x;
|
||||
ux=dx+xx;
|
||||
uw=x*2;
|
||||
if (uh == 0) {
|
||||
uh=(h2-y)*2;
|
||||
uy=dy+y;
|
||||
}
|
||||
if (xx == 0) {
|
||||
ags_copyArea(sx+xx, sy+y, uw, ux_y-y+1, ux, dy+y);
|
||||
ags_copyArea(sx+xx, sy+h1-ux_y, uw, ux_y-y+1, ux, dy+h1-ux_y);
|
||||
ux_y=y;
|
||||
break;
|
||||
}
|
||||
ags_copyArea(sx+xx, sy+y , uw, 1, ux, dy+y );
|
||||
ags_copyArea(sx+xx, sy+h1-y, uw, 1, ux, dy+h1-y);
|
||||
}
|
||||
}
|
||||
ags_updateArea(ux,uy,uw,uh);
|
||||
EC_WAIT;
|
||||
}
|
||||
|
||||
ags_copyArea(sx,sy,w,h,dx,dy);
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
return key;
|
||||
}
|
||||
|
||||
static int eCopyArea26(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
int r, rr, x, xx=0, y, yy, key = 0, cnt;
|
||||
int waitcnt = opt == 0 ? 20 : opt;
|
||||
int w2=w/2,w1=w-1,h2=h/2,h1=h-1,mr=(int)(sqrt(w2*w2+h2*h2));
|
||||
int ux=0,uy=0,ux_y=0,uw,uh;
|
||||
|
||||
cnt = sdl_getTicks();
|
||||
for (r = mr - SCA25_6_SLICE; r > 0; r -= SCA25_6_SLICE) {
|
||||
cnt += waitcnt;
|
||||
rr=r*r;
|
||||
uy=ux_y;
|
||||
uw=uh=0;
|
||||
for (y = ux_y; y < h2; y++) {
|
||||
yy=h2-y;
|
||||
xx=rr-yy*yy;
|
||||
if (xx < 0) {
|
||||
uy++;
|
||||
continue;
|
||||
}
|
||||
x=(int)(sqrt(xx));
|
||||
x=(w2>x)?x:w2;
|
||||
xx=w2-x;
|
||||
if (xx == 0) break;
|
||||
if ((xx-ux) > uw) uw=xx-ux;
|
||||
uh++;
|
||||
ags_copyArea(sx+ux, sy+y, xx-ux, 1, dx+ux, dy+y);
|
||||
ags_copyArea(sx+w1-xx, sy+y, xx-ux, 1, dx+w1-xx, dy+y);
|
||||
ags_copyArea(sx+ux, sy+h1-y, xx-ux, 1, dx+ux, dy+h1-y);
|
||||
ags_copyArea(sx+w1-xx, sy+h1-y, xx-ux, 1, dx+w1-xx, dy+h1-y);
|
||||
}
|
||||
if (uy != ux_y) {
|
||||
ags_copyArea(sx, sy+ux_y,w,uy-ux_y,dx,dy+ux_y);
|
||||
ags_updateArea(dx,dy+ux_y,w,uy-ux_y);
|
||||
ags_copyArea(sx, sy+h-uy,w,uy-ux_y,dx,dy+h-uy);
|
||||
ags_updateArea(dx,dy+h-uy,w,uy-ux_y);
|
||||
ux_y=uy;
|
||||
}
|
||||
ags_updateArea(dx+ux, dy+uy, uw, uh);
|
||||
ags_updateArea(dx+w1-ux-uw, dy+uy, uw, uh);
|
||||
ags_updateArea(dx+ux, dy+h-uy-uh, uw, uh);
|
||||
ags_updateArea(dx+w1-ux-uw, dy+h-uy-uh, uw, uh);
|
||||
ux=xx;
|
||||
EC_WAIT;
|
||||
}
|
||||
|
||||
ags_copyArea(sx,sy,w,h,dx,dy);
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
return key;
|
||||
}
|
||||
|
||||
static int eCopyArea1000(int sx, int sy, int w, int h, int dx, int dy, int opt, int spCol) {
|
||||
/* XOR */
|
||||
return sys_getInputInfo();
|
||||
}
|
||||
|
||||
static int eCopyArea1001(int sx, int sy, int w, int h, int dx, int dy, int opt, int spCol) {
|
||||
/* パレットシフト */
|
||||
return sys_getInputInfo();
|
||||
}
|
||||
|
||||
static int eCopyArea2000(int sx, int sy, int w, int h, int dx, int dy, int opt) {
|
||||
sdl_fillRectangleRGB(dx, dy, w, h, 0, 0, 0);
|
||||
ags_copyArea_alphaLevel(sx, sy, w, h, dx, dy, opt);
|
||||
@@ -457,6 +358,9 @@ static int duration(enum nact_effect effect, int opt, SDL_Rect *rect) {
|
||||
return (opt ? opt : 30) * rect->h / 16;
|
||||
case NACT_EFFECT_MOSAIC:
|
||||
return (opt ? opt : 100) * 8;
|
||||
case NACT_EFFECT_CIRCLE_WIPE_OUT:
|
||||
case NACT_EFFECT_CIRCLE_WIPE_IN:
|
||||
return (opt ? opt : 20) * sqrt(rect->w * rect->w + rect->h * rect->h) / 40;
|
||||
case NACT_EFFECT_FADEIN:
|
||||
case NACT_EFFECT_WHITEIN:
|
||||
case NACT_EFFECT_FADEOUT:
|
||||
@@ -492,6 +396,8 @@ static int duration(enum nact_effect effect, int opt, SDL_Rect *rect) {
|
||||
return opt ? opt : 1000;
|
||||
case NACT_EFFECT_LINEAR_BLUR:
|
||||
return opt ? opt : 1700;
|
||||
case NACT_EFFECT_PALETTE_SHIFT:
|
||||
return 0;
|
||||
}
|
||||
return 1000;
|
||||
}
|
||||
@@ -608,20 +514,16 @@ void ags_eCopyArea(int sx, int sy, int w, int h, int dx, int dy, int sw, int opt
|
||||
case 23:
|
||||
ret = eCopyArea23(sx, sy, w, h, dx, dy, opt);
|
||||
break;
|
||||
case 25:
|
||||
ret = eCopyArea25(sx, sy, w, h, dx, dy, opt);
|
||||
break;
|
||||
case 26:
|
||||
ret = eCopyArea26(sx, sy, w, h, dx, dy, opt);
|
||||
break;
|
||||
|
||||
case 1000:
|
||||
if (nact->ags.world_depth != 8) return;
|
||||
ret = eCopyArea1000(sx, sy, w, h, dx, dy, opt, spCol);
|
||||
break;
|
||||
case 1001:
|
||||
if (nact->ags.world_depth != 8) return;
|
||||
ret = eCopyArea1001(sx, sy, w, h, dx, dy, opt, spCol);
|
||||
case NACT_EFFECT_PALETTE_SHIFT:
|
||||
if (nact->ags.world_depth != 8 || spCol == -1) return;
|
||||
ags_copyPaletteShift(sx, sy, w, h, dx, dy, spCol);
|
||||
ags_updateArea(dx, dy, w, h);
|
||||
ret = sys_getInputInfo();
|
||||
break;
|
||||
case 2000:
|
||||
if (nact->ags.world_depth == 8) return;
|
||||
|
||||
+6
-1
@@ -20,7 +20,7 @@
|
||||
#ifndef __EFFECT_H__
|
||||
#define __EFFECT_H__
|
||||
|
||||
// Effect types of the CE command.
|
||||
// Effect types of the CE/CD command.
|
||||
enum nact_effect {
|
||||
NACT_EFFECT_WIPE_IN = 7,
|
||||
NACT_EFFECT_WIPE_OUT = 8,
|
||||
@@ -35,6 +35,8 @@ enum nact_effect {
|
||||
NACT_EFFECT_WIPE_OUT_H = 20,
|
||||
NACT_EFFECT_WIPE_IN_H = 21,
|
||||
NACT_EFFECT_MOSAIC = 24,
|
||||
NACT_EFFECT_CIRCLE_WIPE_OUT = 25,
|
||||
NACT_EFFECT_CIRCLE_WIPE_IN = 26,
|
||||
NACT_EFFECT_FADEIN = 27,
|
||||
NACT_EFFECT_WHITEIN = 28,
|
||||
NACT_EFFECT_FADEOUT = 29,
|
||||
@@ -62,6 +64,7 @@ enum nact_effect {
|
||||
NACT_EFFECT_WINDMILL_180 = 51,
|
||||
NACT_EFFECT_WINDMILL_360 = 52,
|
||||
NACT_EFFECT_LINEAR_BLUR = 53,
|
||||
NACT_EFFECT_PALETTE_SHIFT = 1001, // CD command only
|
||||
};
|
||||
|
||||
// Effect types of SCAT.DrawEffect and Gpx.EffectCopy.
|
||||
@@ -131,6 +134,8 @@ enum sdl_effect_type {
|
||||
EFFECT_WIPE_IN_V,
|
||||
EFFECT_WIPE_OUT_H,
|
||||
EFFECT_WIPE_IN_H,
|
||||
EFFECT_CIRCLE_WIPE_OUT,
|
||||
EFFECT_CIRCLE_WIPE_IN,
|
||||
EFFECT_BLIND_DOWN,
|
||||
EFFECT_BLIND_UP,
|
||||
EFFECT_BLIND_LR,
|
||||
|
||||
+15
-6
@@ -65,6 +65,14 @@ int sys_getMouseInfo(MyPoint *p, boolean is_dibgeo) {
|
||||
return key;
|
||||
}
|
||||
|
||||
void sys_getWheelInfo(int *forward, int *back) {
|
||||
sdl_getWheelInfo(forward, back);
|
||||
}
|
||||
|
||||
void sys_clearWheelInfo(void) {
|
||||
sdl_clearWheelInfo();
|
||||
}
|
||||
|
||||
int sys_getKeyInfo() {
|
||||
return sdl_getKeyInfo();
|
||||
}
|
||||
@@ -92,7 +100,8 @@ int sys_keywait(int msec, unsigned flags) {
|
||||
|
||||
int key=0, n;
|
||||
int end = msec == INT_MAX ? INT_MAX : sdl_getTicks() + msec;
|
||||
while (!((flags & KEYWAIT_SKIPPABLE) && msgskip_isSkipping()) &&
|
||||
while (!nact->is_quit &&
|
||||
!((flags & KEYWAIT_SKIPPABLE) && msgskip_isSkipping()) &&
|
||||
(n = end - sdl_getTicks()) > 0) {
|
||||
if (n <= 16)
|
||||
sdl_sleep(n);
|
||||
@@ -122,19 +131,19 @@ void sys_hit_any_key() {
|
||||
if (nact->messagewait_cancelled) {
|
||||
nact->messagewait_cancelled = FALSE;
|
||||
/* consume the input that cancelled message wait */
|
||||
while(0 == (key & hak_ignore_mask)) {
|
||||
while (!nact->is_quit && !(key & hak_ignore_mask)) {
|
||||
key = sys_keywait(INT_MAX, KEYWAIT_CANCELABLE);
|
||||
}
|
||||
while(key & hak_releasewait_mask) {
|
||||
while (!nact->is_quit && key & hak_releasewait_mask) {
|
||||
key = sys_keywait(100, KEYWAIT_CANCELABLE);
|
||||
}
|
||||
}
|
||||
|
||||
while (!msgskip_isSkipping() && 0 == (key & hak_ignore_mask)) {
|
||||
while (!nact->is_quit && !msgskip_isSkipping() && 0 == (key & hak_ignore_mask)) {
|
||||
key = sys_keywait(100, KEYWAIT_CANCELABLE | KEYWAIT_SKIPPABLE);
|
||||
}
|
||||
|
||||
while (!msgskip_isSkipping() && (key & hak_releasewait_mask)) {
|
||||
while (!nact->is_quit && !msgskip_isSkipping() && (key & hak_releasewait_mask)) {
|
||||
key = sys_keywait(100, KEYWAIT_CANCELABLE | KEYWAIT_SKIPPABLE);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +157,7 @@ void sys_key_releasewait(int key, boolean zi_mask_enabled) {
|
||||
mask = 0xffffffff;
|
||||
}
|
||||
|
||||
while(key & mask) {
|
||||
while (!nact->is_quit && key & mask) {
|
||||
key = sys_keywait(50, KEYWAIT_NONCANCELABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ extern int sys_getMouseInfo(MyPoint *p, boolean is_dibgeo);
|
||||
extern int sys_getInputInfo(void);
|
||||
extern int sys_getKeyInfo(void);
|
||||
extern int sys_getJoyInfo(void);
|
||||
extern void sys_getWheelInfo(int *forward, int *back);
|
||||
extern void sys_clearWheelInfo(void);
|
||||
extern void sys_key_releasewait(int key, boolean zi_mask_enabled);
|
||||
extern void sys_hit_any_key();
|
||||
extern void set_hak_keymode(int key, int mode);
|
||||
|
||||
+16
-31
@@ -17,16 +17,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <jpeglib.h>
|
||||
#undef max
|
||||
#undef min
|
||||
#include <SDL_cpuinfo.h>
|
||||
|
||||
#if defined(__ARM_NEON)
|
||||
#define STBI_NEON
|
||||
#endif
|
||||
#define STBI_NO_STDIO
|
||||
#define STBI_ONLY_JPEG
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "system.h"
|
||||
#include "ags.h"
|
||||
#include "jpeg.h"
|
||||
|
||||
boolean jpeg_checkfmt(BYTE *data) {
|
||||
@@ -34,37 +38,18 @@ boolean jpeg_checkfmt(BYTE *data) {
|
||||
}
|
||||
|
||||
cgdata *jpeg_extract(BYTE *data, size_t size) {
|
||||
struct jpeg_decompress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
|
||||
// TODO: Error handling
|
||||
cinfo.err = jpeg_std_error(&jerr);
|
||||
jpeg_create_decompress(&cinfo);
|
||||
|
||||
jpeg_mem_src(&cinfo, data, size);
|
||||
if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK) {
|
||||
WARNING("jpeg_read_header failed\n");
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
int width, height, channels;
|
||||
BYTE *pixels = stbi_load_from_memory(data, size, &width, &height, &channels, 3);
|
||||
if (!pixels) {
|
||||
WARNING("cannot decode jpeg: %s\n", stbi_failure_reason());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
jpeg_start_decompress(&cinfo);
|
||||
|
||||
cgdata *cg = calloc(1, sizeof(cgdata));
|
||||
cg->type = ALCG_JPEG;
|
||||
cg->width = cinfo.output_width;
|
||||
cg->height = cinfo.output_height;
|
||||
cg->width = width;
|
||||
cg->height = height;
|
||||
cg->depth = 24;
|
||||
cg->pic = malloc(3 * cg->width * cg->height);
|
||||
|
||||
int row_stride = cinfo.output_width * cinfo.output_components;
|
||||
|
||||
while (cinfo.output_scanline < cinfo.output_height) {
|
||||
JSAMPROW dst = cg->pic + cinfo.output_scanline * row_stride;
|
||||
jpeg_read_scanlines(&cinfo, &dst, 1);
|
||||
}
|
||||
jpeg_finish_decompress(&cinfo);
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
|
||||
cg->pic = pixels;
|
||||
return cg;
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ typedef struct inputnum_param {
|
||||
|
||||
extern void menu_open(void);
|
||||
extern void menu_quitmenu_open(void);
|
||||
extern void menu_resetmenu_open(void);
|
||||
extern boolean menu_inputstring(INPUTSTRING_PARAM *);
|
||||
extern boolean menu_inputstring2(INPUTSTRING_PARAM *);
|
||||
extern boolean menu_inputnumber(INPUTNUM_PARAM *);
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ on_button5_clicked (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
menu_ok_exit = TRUE;
|
||||
nact->is_quit = TRUE;
|
||||
nact_quit(FALSE);
|
||||
nact->popupmenu_opened = FALSE;
|
||||
}
|
||||
|
||||
|
||||
+24
-2
@@ -56,8 +56,30 @@ void menu_quitmenu_open(void) {
|
||||
return;
|
||||
}
|
||||
if (buttonid == 1) {
|
||||
nact->is_quit = TRUE;
|
||||
nact->wait_vsync = TRUE;
|
||||
nact_quit(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void menu_resetmenu_open(void) {
|
||||
const SDL_MessageBoxButtonData buttons[] = {
|
||||
{ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, 1, "Restart" },
|
||||
{ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, 0, "Cancel" },
|
||||
};
|
||||
const SDL_MessageBoxData messagebox_data = {
|
||||
.flags = SDL_MESSAGEBOX_INFORMATION,
|
||||
.window = sdl_window,
|
||||
.title = "Confirm",
|
||||
.message = "Restart the game?",
|
||||
.numbuttons = SDL_arraysize(buttons),
|
||||
.buttons = buttons,
|
||||
};
|
||||
int buttonid = 0;
|
||||
if (SDL_ShowMessageBox(&messagebox_data, &buttonid) < 0) {
|
||||
WARNING("error displaying message box");
|
||||
return;
|
||||
}
|
||||
if (buttonid == 1) {
|
||||
nact_quit(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+16
-8
@@ -47,13 +47,10 @@
|
||||
// static Bcom_WindowInfo winInfo = {8,311,616,80,0};
|
||||
/* Window枠の種類 */
|
||||
static int frameType;
|
||||
static int frameCgNoTop;
|
||||
static int frameCgNoMid;
|
||||
static int frameCgNoBot;
|
||||
static int frameDot;
|
||||
/* 文字飾りの設定 */
|
||||
static int msgDecorateColor = 0;
|
||||
static int msgDecorateType = 0;
|
||||
static int msgDecorateColor;
|
||||
static int msgDecorateType;
|
||||
/* 現在の文字表示位置 */
|
||||
static MyPoint msgcur;
|
||||
static boolean nextLineIsAfterKaigyou = FALSE;
|
||||
@@ -90,12 +87,26 @@ void msg_init() {
|
||||
msg.mg_policyR = 0;
|
||||
msg.mg_policyA = 0;
|
||||
|
||||
for (int i = 0; i < MSGWINMAX; i++) {
|
||||
if (msg.wininfo[i].savedimg)
|
||||
ags_delRegion(msg.wininfo[i].savedimg);
|
||||
}
|
||||
memset(msg.wininfo, 0, sizeof(msg.wininfo));
|
||||
|
||||
msg.winno = 1;
|
||||
msg.win = &msg.wininfo[0];
|
||||
msg.wininfo[0].x = 8;
|
||||
msg.wininfo[0].y = 311;
|
||||
msg.wininfo[0].width = 616;
|
||||
msg.wininfo[0].height = 80;
|
||||
msg.wininfo[0].save = TRUE;
|
||||
|
||||
// Private variables
|
||||
msgDecorateColor = 0;
|
||||
msgDecorateType = 0;
|
||||
msgcur.x = 0;
|
||||
msgcur.y = 0;
|
||||
nextLineIsAfterKaigyou = FALSE;
|
||||
}
|
||||
|
||||
void msg_setFontSize(int size) {
|
||||
@@ -303,9 +314,6 @@ void msg_openWindow(int W, int C1, int C2, int N, int M) {
|
||||
frameDot = 8;
|
||||
break;
|
||||
case WINDOW_FRAME_CG:
|
||||
frameCgNoTop = C1;
|
||||
frameCgNoMid = C2;
|
||||
frameCgNoBot = N;
|
||||
frameDot = M;
|
||||
break;
|
||||
default:
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ struct __message {
|
||||
|
||||
/* メッセージ window */
|
||||
int winno;
|
||||
Bcom_WindowInfo *win; // 現在使用中の window
|
||||
Bcom_WindowInfo *win; // points to wininfo[winno - 1]
|
||||
Bcom_WindowInfo wininfo[MSGWINMAX];
|
||||
};
|
||||
typedef struct __message msg_t;
|
||||
|
||||
+9
-2
@@ -24,7 +24,8 @@
|
||||
#include "midi.h"
|
||||
|
||||
static int midi_initilize(char *pname, int subdev);
|
||||
static int midi_exit();
|
||||
static int midi_exit(void);
|
||||
static int midi_reset(void);
|
||||
static int midi_start(int no, int loop, char *data, int datalen);
|
||||
static int midi_stop();
|
||||
static int midi_pause(void);
|
||||
@@ -41,6 +42,7 @@ static boolean midi_fading();
|
||||
mididevice_t midi = {
|
||||
midi_initilize,
|
||||
midi_exit,
|
||||
midi_reset,
|
||||
midi_start,
|
||||
midi_stop,
|
||||
midi_pause,
|
||||
@@ -58,7 +60,12 @@ static int midi_initilize(char *pname, int subdev) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_exit() {
|
||||
static int midi_exit(void) {
|
||||
midi_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_reset(void) {
|
||||
midi_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#include "midi.h"
|
||||
|
||||
static int midi_initilize(char *pname, int subdev);
|
||||
static int midi_exit();
|
||||
static int midi_exit(void);
|
||||
static int midi_reset(void);
|
||||
static int midi_start(int no, int loop, char *data, int datalen);
|
||||
static int midi_stop();
|
||||
extern int midi_pause(void);
|
||||
@@ -42,6 +43,7 @@ extern boolean midi_fading();
|
||||
mididevice_t midi = {
|
||||
midi_initilize,
|
||||
midi_exit,
|
||||
midi_reset,
|
||||
midi_start,
|
||||
midi_stop,
|
||||
midi_pause,
|
||||
@@ -59,7 +61,12 @@ static int midi_initilize(char *pname, int subdev) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_exit() {
|
||||
static int midi_exit(void) {
|
||||
midi_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_reset(void) {
|
||||
midi_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ typedef struct mididevice mididevice_t;
|
||||
struct mididevice {
|
||||
int (* init)(char *, int);
|
||||
int (* exit)(void);
|
||||
int (* reset)(void);
|
||||
// Play through the music loop times. If loop == 0, loops forever.
|
||||
int (* start)(int no, int loop, char *data, int datalen);
|
||||
int (* stop)(void);
|
||||
|
||||
+16
-7
@@ -40,7 +40,8 @@ typedef struct midievent midievent_t;
|
||||
static int midi_thread(void *);
|
||||
|
||||
static int midi_initialize(char *devnm, int subdev);
|
||||
static int midi_exit();
|
||||
static int midi_exit(void);
|
||||
static int midi_reset(void);
|
||||
static int midi_start(int no, int loop, char *data, int datalen);
|
||||
static int midi_stop();
|
||||
static int midi_pause();
|
||||
@@ -50,13 +51,14 @@ static int midi_getflag(int mode, int idx);
|
||||
static int midi_setflag(int mode, int idx, int val);
|
||||
|
||||
static void midi_allnotesoff();
|
||||
static void midi_reset();
|
||||
static void midi_send_reset();
|
||||
static void midi_settempo(midievent_t event);
|
||||
static void midi_sync(midievent_t event);
|
||||
|
||||
mididevice_t midi_portmidi = {
|
||||
midi_initialize,
|
||||
midi_exit,
|
||||
midi_reset,
|
||||
midi_start,
|
||||
midi_stop,
|
||||
midi_pause,
|
||||
@@ -104,7 +106,7 @@ static int midi_initialize(char *devnm, int subdev) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_exit() {
|
||||
static int midi_exit(void) {
|
||||
NOTICE("midi_exit\n");
|
||||
if (thread_running) {
|
||||
midi_stop();
|
||||
@@ -117,6 +119,13 @@ static int midi_exit() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_reset(void) {
|
||||
if (thread_running) {
|
||||
midi_stop();
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_start(int no, int loop, char *data, int datalen) {
|
||||
NOTICE("midi_start: no = %i loop = %i datalen = %i\n", no, loop, datalen);
|
||||
should_stop = FALSE;
|
||||
@@ -222,8 +231,8 @@ static void midi_allnotesoff() {
|
||||
}
|
||||
}
|
||||
|
||||
static void midi_reset() {
|
||||
NOTICE("midi_reset\n");
|
||||
static void midi_send_reset() {
|
||||
NOTICE("midi_send_reset\n");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
Pm_WriteShort(stream, 0, Pm_Message(0xb0 + i, 0x78, 0x00));
|
||||
Pm_WriteShort(stream, 0, Pm_Message(0xb0 + i, 0x79, 0x00));
|
||||
@@ -329,7 +338,7 @@ static int midi_thread(void *args) {
|
||||
|
||||
start:
|
||||
midi_allnotesoff();
|
||||
midi_reset();
|
||||
midi_send_reset();
|
||||
|
||||
boolean pausing = FALSE;
|
||||
int nevents = midi->eventsize;
|
||||
@@ -400,7 +409,7 @@ static int midi_thread(void *args) {
|
||||
|
||||
midi_allnotesoff();
|
||||
usleep(10000);
|
||||
midi_reset();
|
||||
midi_send_reset();
|
||||
usleep(10000);
|
||||
|
||||
should_stop = FALSE;
|
||||
|
||||
+11
-2
@@ -59,7 +59,8 @@ static struct {
|
||||
|
||||
static void send_reset();
|
||||
static int midi_initilize(char *devnm, int subdev);
|
||||
static int midi_exit();
|
||||
static int midi_exit(void);
|
||||
static int midi_reset(void);
|
||||
static int midi_start(int no, int loop, char *data, int datalen);
|
||||
static int midi_stop();
|
||||
static int midi_pause(void);
|
||||
@@ -83,6 +84,7 @@ static void seq_mywrite(unsigned char *d, int n, int p);
|
||||
mididevice_t midi_rawmidi = {
|
||||
midi_initilize,
|
||||
midi_exit,
|
||||
midi_reset,
|
||||
midi_start,
|
||||
midi_stop,
|
||||
midi_pause,
|
||||
@@ -354,7 +356,14 @@ static int midi_initilize(char *devnm, int subdev) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_exit() {
|
||||
static int midi_exit(void) {
|
||||
if (enabled) {
|
||||
midi_stop();
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_reset(void) {
|
||||
if (enabled) {
|
||||
midi_stop();
|
||||
}
|
||||
|
||||
+9
-2
@@ -31,7 +31,8 @@
|
||||
#endif
|
||||
|
||||
static int midi_initilize(char *pname, int subdev);
|
||||
static int midi_exit();
|
||||
static int midi_exit(void);
|
||||
static int midi_reset(void);
|
||||
static int midi_start(int no, int loop, char *data, int datalen);
|
||||
static int midi_stop();
|
||||
static int midi_pause(void);
|
||||
@@ -48,6 +49,7 @@ static boolean midi_fading();
|
||||
mididevice_t midi = {
|
||||
midi_initilize,
|
||||
midi_exit,
|
||||
midi_reset,
|
||||
midi_start,
|
||||
midi_stop,
|
||||
midi_pause,
|
||||
@@ -71,11 +73,16 @@ static int midi_initilize(char *pname, int subdev) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_exit() {
|
||||
static int midi_exit(void) {
|
||||
Mix_Quit();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_reset(void) {
|
||||
midi_stop();
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int midi_start(int no, int loop, char *data, int datalen) {
|
||||
midi_stop();
|
||||
|
||||
|
||||
+10
-8
@@ -36,12 +36,18 @@ int mus_init(int audio_buffer_size) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int mus_exit() {
|
||||
void mus_exit(void) {
|
||||
musbgm_exit();
|
||||
if (prv.cd_valid) muscd_exit();
|
||||
if (prv.midi_valid) musmidi_exit();
|
||||
if (prv.pcm_valid) muspcm_exit();
|
||||
return OK;
|
||||
}
|
||||
|
||||
void mus_reset(void) {
|
||||
musbgm_reset();
|
||||
if (prv.cd_valid) muscd_reset();
|
||||
if (prv.midi_valid) musmidi_reset();
|
||||
if (prv.pcm_valid) muspcm_reset();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -51,9 +57,7 @@ int mus_exit() {
|
||||
*/
|
||||
int mus_cdrom_start(int track, int loop) {
|
||||
if (!prv.cd_valid) return NG;
|
||||
muscd_start(track, loop);
|
||||
muscd_cb();
|
||||
return OK;
|
||||
return muscd_start(track, loop);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -61,9 +65,7 @@ int mus_cdrom_start(int track, int loop) {
|
||||
*/
|
||||
int mus_cdrom_stop() {
|
||||
if (!prv.cd_valid) return NG;
|
||||
muscd_stop();
|
||||
muscd_cb();
|
||||
return OK;
|
||||
return muscd_stop();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+2
-1
@@ -36,7 +36,8 @@ enum MixDevice {
|
||||
|
||||
/* init and exit */
|
||||
extern int mus_init(int audio_buffer_size);
|
||||
extern int mus_exit();
|
||||
extern void mus_exit(void);
|
||||
extern void mus_reset(void);
|
||||
|
||||
/* cdrom related function */
|
||||
extern int mus_cdrom_start(int track, int loop);
|
||||
|
||||
+24
-72
@@ -29,96 +29,48 @@
|
||||
#include "music_cdrom.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
enum {
|
||||
CDROM_START,
|
||||
CDROM_STOPCHECK,
|
||||
CDROM_LOOPCHECK,
|
||||
CDROM_STOP,
|
||||
CDROM_NOP
|
||||
};
|
||||
|
||||
int muscd_init() {
|
||||
int muscd_init(void) {
|
||||
int st = cd_init(&prv.cddev);
|
||||
int ret;
|
||||
|
||||
if (st == -1) {
|
||||
prv.cd_valid = FALSE;
|
||||
ret = NG;
|
||||
} else {
|
||||
prv.cd_valid = TRUE;
|
||||
prv.cdrom.dev = &prv.cddev;
|
||||
prv.cdrom.st = CDROM_NOP;
|
||||
prv.cdrom.in_play = FALSE;
|
||||
ret = OK;
|
||||
return NG;
|
||||
}
|
||||
|
||||
return ret;
|
||||
prv.cd_valid = TRUE;
|
||||
prv.cd_current_track = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int muscd_exit() {
|
||||
int muscd_exit(void) {
|
||||
if (prv.cd_valid) {
|
||||
prv.cddev.exit();
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int muscd_start(int trk, int loop) {
|
||||
prv.cdrom.track = trk;
|
||||
prv.cdrom.loop = loop;
|
||||
prv.cdrom.cnt = 0;
|
||||
|
||||
prv.cdrom.st = CDROM_START;
|
||||
prv.cdrom.in_play = FALSE;
|
||||
|
||||
memset(&prv.cdrom.time, 0, sizeof(cd_time));
|
||||
|
||||
int muscd_reset(void) {
|
||||
if (prv.cd_valid) {
|
||||
prv.cddev.reset();
|
||||
prv.cd_current_track = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int muscd_stop() {
|
||||
prv.cdrom.st = CDROM_STOP;
|
||||
int muscd_start(int trk, int loop) {
|
||||
if (trk == prv.cd_current_track)
|
||||
return OK;
|
||||
prv.cddev.stop();
|
||||
|
||||
prv.cddev.start(trk, loop);
|
||||
prv.cd_current_track = trk;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int muscd_stop(void) {
|
||||
prv.cddev.stop();
|
||||
prv.cd_current_track = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int muscd_getpos(cd_time *tm) {
|
||||
return prv.cddev.getpos(tm);
|
||||
}
|
||||
|
||||
int muscd_cb() {
|
||||
cdobj_t *obj = &prv.cdrom;
|
||||
|
||||
switch(obj->st) {
|
||||
case CDROM_START:
|
||||
obj->in_play = TRUE;
|
||||
obj->dev->start(obj->track, obj->loop);
|
||||
obj->st = CDROM_STOPCHECK;
|
||||
break;
|
||||
case CDROM_STOPCHECK:
|
||||
if (NG == obj->dev->getpos(&(obj->time))) {
|
||||
obj->st = CDROM_LOOPCHECK;
|
||||
}
|
||||
break;
|
||||
case CDROM_LOOPCHECK:
|
||||
obj->cnt++;
|
||||
if (obj->loop == 0) {
|
||||
obj->st = CDROM_START;
|
||||
break;
|
||||
}
|
||||
if (--obj->loop == 0) {
|
||||
obj->st = CDROM_STOP;
|
||||
} else {
|
||||
obj->st = CDROM_START;
|
||||
}
|
||||
break;
|
||||
case CDROM_STOP:
|
||||
obj->dev->stop();
|
||||
|
||||
obj->in_play = FALSE;
|
||||
obj->st = CDROM_NOP;
|
||||
break;
|
||||
case CDROM_NOP:
|
||||
break;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
+6
-21
@@ -27,26 +27,11 @@
|
||||
#include "portab.h"
|
||||
#include "cdrom.h"
|
||||
|
||||
struct _cdobj {
|
||||
int st; // オブジェクトの遷移状態
|
||||
|
||||
int track; // 演奏トラック
|
||||
int loop; // くりかえし数 (0の場合は無限)
|
||||
int cnt; // 実際に繰り返した数
|
||||
|
||||
boolean in_play; // 演奏中?
|
||||
|
||||
cd_time time; // 演奏位置
|
||||
|
||||
cdromdevice_t *dev;
|
||||
};
|
||||
typedef struct _cdobj cdobj_t;
|
||||
|
||||
extern int muscd_init();
|
||||
extern int muscd_exit();
|
||||
extern int muscd_start(int trk, int loop);
|
||||
extern int muscd_stop();
|
||||
extern int muscd_getpos(cd_time *tm);
|
||||
extern int muscd_cb();
|
||||
int muscd_init(void);
|
||||
int muscd_exit(void);
|
||||
int muscd_reset(void);
|
||||
int muscd_start(int trk, int loop);
|
||||
int muscd_stop(void);
|
||||
int muscd_getpos(cd_time *tm);
|
||||
|
||||
#endif /* __MUSIC_CDROM_H__ */
|
||||
|
||||
+38
-33
@@ -29,9 +29,7 @@
|
||||
#include "midi.h"
|
||||
#include "ald_manager.h"
|
||||
|
||||
static int midino;
|
||||
|
||||
int musmidi_init() {
|
||||
int musmidi_init(void) {
|
||||
int st = midi_init(&prv.mididev);
|
||||
|
||||
if (st == -1) {
|
||||
@@ -39,101 +37,108 @@ int musmidi_init() {
|
||||
return NG;
|
||||
} else {
|
||||
prv.midi_valid = TRUE;
|
||||
prv.midi.dev = &prv.mididev;
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
int musmidi_exit() {
|
||||
int musmidi_exit(void) {
|
||||
if (prv.midi_valid) {
|
||||
prv.mididev.exit();
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musmidi_reset(void) {
|
||||
if (prv.midi_valid) {
|
||||
prv.mididev.reset();
|
||||
prv.midi_current_track = 0;
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musmidi_start(int no, int loop) {
|
||||
if (!prv.midi_valid) return NG;
|
||||
if (midino == no)
|
||||
if (prv.midi_current_track == no)
|
||||
return OK;
|
||||
|
||||
dridata *dfile = ald_getdata(DRIFILE_MIDI, no -1);
|
||||
if (dfile == NULL)
|
||||
return NG;
|
||||
|
||||
prv.midi.dev->start(no, loop, dfile->data, dfile->size);
|
||||
prv.mididev.start(no, loop, dfile->data, dfile->size);
|
||||
|
||||
if (prv.midi.dfile)
|
||||
ald_freedata(prv.midi.dfile);
|
||||
prv.midi.dfile = dfile;
|
||||
midino = no;
|
||||
if (prv.midi_dfile)
|
||||
ald_freedata(prv.midi_dfile);
|
||||
prv.midi_dfile = dfile;
|
||||
prv.midi_current_track = no;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musmidi_stop() {
|
||||
int musmidi_stop(void) {
|
||||
if (!prv.midi_valid) return NG;
|
||||
|
||||
prv.midi.dev->stop();
|
||||
prv.mididev.stop();
|
||||
|
||||
if (prv.midi.dfile) {
|
||||
ald_freedata(prv.midi.dfile);
|
||||
prv.midi.dfile = NULL;
|
||||
if (prv.midi_dfile) {
|
||||
ald_freedata(prv.midi_dfile);
|
||||
prv.midi_dfile = NULL;
|
||||
}
|
||||
midino = 0;
|
||||
prv.midi_current_track = 0;
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musmidi_pause() {
|
||||
int musmidi_pause(void) {
|
||||
if (!prv.midi_valid) return NG;
|
||||
|
||||
prv.midi.dev->pause();
|
||||
prv.mididev.pause();
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musmidi_unpause() {
|
||||
int musmidi_unpause(void) {
|
||||
if (!prv.midi_valid) return NG;
|
||||
|
||||
prv.midi.dev->unpause();
|
||||
prv.mididev.unpause();
|
||||
return OK;
|
||||
}
|
||||
|
||||
midiplaystate musmidi_getpos() {
|
||||
midiplaystate musmidi_getpos(void) {
|
||||
midiplaystate st = {FALSE, 0, 0};
|
||||
if (!prv.midi_valid || !midino) return st;
|
||||
if (!prv.midi_valid || !prv.midi_current_track) return st;
|
||||
|
||||
prv.midi.dev->getpos(&st);
|
||||
prv.mididev.getpos(&st);
|
||||
if (st.in_play)
|
||||
st.play_no = midino;
|
||||
st.play_no = prv.midi_current_track;
|
||||
else
|
||||
midino = 0;
|
||||
prv.midi_current_track = 0;
|
||||
return st;
|
||||
}
|
||||
|
||||
int musmidi_setflag(int mode, int index, int val) {
|
||||
if (!prv.midi_valid) return NG;
|
||||
|
||||
prv.midi.dev->setflag(mode, index, val);
|
||||
prv.mididev.setflag(mode, index, val);
|
||||
return OK;
|
||||
}
|
||||
|
||||
int musmidi_getflag(int mode, int index) {
|
||||
if (!prv.midi_valid) return 0;
|
||||
|
||||
return prv.midi.dev->getflag(mode, index);
|
||||
return prv.mididev.getflag(mode, index);
|
||||
}
|
||||
|
||||
int musmidi_fadestart(int time, int volume, int stop) {
|
||||
if (!prv.midi_valid) return NG;
|
||||
|
||||
if (!prv.midi.dev->fadestart)
|
||||
if (!prv.mididev.fadestart)
|
||||
return NG;
|
||||
return prv.midi.dev->fadestart(time, volume, stop);
|
||||
return prv.mididev.fadestart(time, volume, stop);
|
||||
}
|
||||
|
||||
boolean musmidi_fading() {
|
||||
boolean musmidi_fading(void) {
|
||||
if (!prv.midi_valid) return FALSE;
|
||||
|
||||
if (!prv.midi.dev->fading)
|
||||
if (!prv.mididev.fading)
|
||||
return FALSE;
|
||||
return prv.midi.dev->fading();
|
||||
return prv.mididev.fading();
|
||||
}
|
||||
|
||||
+12
-18
@@ -3,24 +3,18 @@
|
||||
|
||||
#include "portab.h"
|
||||
#include "midi.h"
|
||||
#include "ald_manager.h"
|
||||
|
||||
struct _midiobj {
|
||||
mididevice_t *dev;
|
||||
dridata *dfile;
|
||||
};
|
||||
typedef struct _midiobj midiobj_t;
|
||||
|
||||
extern int musmidi_init();
|
||||
extern int musmidi_exit();
|
||||
extern int musmidi_start(int no, int loop);
|
||||
extern int musmidi_stop();
|
||||
extern int musmidi_pause();
|
||||
extern int musmidi_unpause();
|
||||
extern midiplaystate musmidi_getpos();
|
||||
extern int musmidi_setflag(int mode, int index, int val);
|
||||
extern int musmidi_getflag(int mode, int index);
|
||||
extern int musmidi_fadestart(int time, int volume, int stop);
|
||||
extern boolean musmidi_fading();
|
||||
int musmidi_init(void);
|
||||
int musmidi_exit(void);
|
||||
int musmidi_reset(void);
|
||||
int musmidi_start(int no, int loop);
|
||||
int musmidi_stop(void);
|
||||
int musmidi_pause(void);
|
||||
int musmidi_unpause(void);
|
||||
midiplaystate musmidi_getpos(void);
|
||||
int musmidi_setflag(int mode, int index, int val);
|
||||
int musmidi_getflag(int mode, int index);
|
||||
int musmidi_fadestart(int time, int volume, int stop);
|
||||
boolean musmidi_fading(void);
|
||||
|
||||
#endif /* __MUSIC_MIDI_H__ */
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
extern int muspcm_init(int audio_buffer_size);
|
||||
extern int muspcm_exit(void);
|
||||
extern int muspcm_reset(void);
|
||||
extern int muspcm_load_no(int slot, int no);
|
||||
extern int muspcm_load_mixlr(int slot, int noL, int noR);
|
||||
extern int muspcm_unload(int slot);
|
||||
|
||||
+5
-4
@@ -29,6 +29,7 @@
|
||||
#include "music_cdrom.h"
|
||||
#include "music_midi.h"
|
||||
#include "music_pcm.h"
|
||||
#include "ald_manager.h"
|
||||
|
||||
struct _musprvdat {
|
||||
boolean cd_valid;
|
||||
@@ -38,9 +39,6 @@ struct _musprvdat {
|
||||
cdromdevice_t cddev;
|
||||
mididevice_t mididev;
|
||||
|
||||
cdobj_t cdrom; // cdrom object
|
||||
midiobj_t midi; // midi object
|
||||
|
||||
// ゲーム内での volume 設定 (%値)
|
||||
int vol_master;
|
||||
int vol_pcm;
|
||||
@@ -49,8 +47,11 @@ struct _musprvdat {
|
||||
int vol_pcm_sub[128 + 1 + 2]; // volval の channel
|
||||
int volval[16]; // 各channel 毎の volume valance
|
||||
|
||||
// 最大トラック数
|
||||
int cd_maxtrk;
|
||||
int cd_current_track;
|
||||
|
||||
dridata *midi_dfile;
|
||||
int midi_current_track;
|
||||
};
|
||||
|
||||
#define prv musprv
|
||||
|
||||
+42
-10
@@ -54,8 +54,6 @@ MG コマンド: 表示時の ZH に依存
|
||||
|
||||
*/
|
||||
|
||||
/* defined by cmdv.c */
|
||||
extern void va_animation();
|
||||
/* 半角モード */
|
||||
static int msg_msgHankakuMode = 0; /* 0:全角 1:半角, 2: 無変換 */
|
||||
|
||||
@@ -125,10 +123,7 @@ void nact_main() {
|
||||
|
||||
if (++cnt >= 10000 || nact->wait_vsync || nact->popupmenu_opened || dbg_trapped()) {
|
||||
nact->callback(); // Async in emscripten
|
||||
|
||||
if (!nact->is_message_locked)
|
||||
sys_getInputInfo();
|
||||
|
||||
sys_getInputInfo();
|
||||
sdl_wait_vsync();
|
||||
nact->frame_count++;
|
||||
nact->wait_vsync = FALSE;
|
||||
@@ -147,18 +142,55 @@ static void nact_callback() {
|
||||
if (nact->popupmenu_opened) {
|
||||
menu_gtkmainiteration();
|
||||
}
|
||||
if (nact->is_quit) {
|
||||
if (nact->is_quit && !nact->restart) {
|
||||
sys_exit(0);
|
||||
}
|
||||
}
|
||||
|
||||
void nact_init() {
|
||||
nact->ags.mouse_movesw = 2;
|
||||
nact->is_quit = FALSE;
|
||||
nact->restart = FALSE;
|
||||
nact->callback = nact_callback;
|
||||
nact->is_va_animation = FALSE;
|
||||
nact->is_cursor_animation = FALSE;
|
||||
nact->is_message_locked = FALSE;
|
||||
nact->encoding = SHIFT_JIS;
|
||||
|
||||
free(nact->game_title_utf8);
|
||||
nact->game_title_utf8 = NULL;
|
||||
nact->scenario_version = 0;
|
||||
|
||||
nact->datatbl_addr = NULL;
|
||||
nact->fnc_return_value = 0;
|
||||
|
||||
nact->messagewait_enable = FALSE;
|
||||
nact->messagewait_cancelled = FALSE;
|
||||
nact->messagewait_time = 0;
|
||||
nact->messagewait_cancel = FALSE;
|
||||
|
||||
msg_init();
|
||||
nact->is_msg_out = TRUE;
|
||||
nact->callback = nact_callback;
|
||||
nact->msgout = NULL;
|
||||
|
||||
sel_init();
|
||||
|
||||
nact->patch_ec = 1; // TODO: revisit
|
||||
nact->patch_emen = 0;
|
||||
nact->patch_g0 = 0;
|
||||
|
||||
msg_msgHankakuMode = 0;
|
||||
}
|
||||
|
||||
void nact_reset(void) {
|
||||
nact_init();
|
||||
sl_reinit();
|
||||
v_reset();
|
||||
va_reset();
|
||||
cmdz_reset();
|
||||
cmd2F_reset();
|
||||
}
|
||||
|
||||
void nact_quit(boolean restart) {
|
||||
nact->is_quit = TRUE;
|
||||
nact->restart = restart;
|
||||
nact->wait_vsync = TRUE;
|
||||
}
|
||||
|
||||
+12
-6
@@ -46,20 +46,29 @@ extern void sys_addMsg(const char *str);
|
||||
extern void sys_setHankakuMode(int mode);
|
||||
extern void sys_setCharacterEncoding(CharacterEncoding encoding);
|
||||
|
||||
// extern boolean sys_nact_engine();
|
||||
extern void nact_main();
|
||||
extern void nact_init();
|
||||
extern void nact_reset(void);
|
||||
extern void nact_quit(boolean restart);
|
||||
|
||||
// cmd_check.c
|
||||
extern void exec_command(void);
|
||||
|
||||
// cmdv.c
|
||||
void va_animation(void);
|
||||
void va_reset(void);
|
||||
// cmdz.c
|
||||
void cmdz_reset(void);
|
||||
// cmd2F.c
|
||||
void cmd2F_reset(void);
|
||||
|
||||
typedef struct {
|
||||
/* general */
|
||||
boolean is_quit; /* quit command */
|
||||
boolean restart;
|
||||
void (*callback)(void); /* main の callback */
|
||||
boolean is_va_animation; /* VA command working */
|
||||
boolean is_cursor_animation; /* animation cursor working */
|
||||
boolean is_message_locked; /* pointer 等の event handler を呼び出さない */
|
||||
boolean popupmenu_opened; /* popup menu が 開いているか */
|
||||
CharacterEncoding encoding;
|
||||
|
||||
@@ -72,10 +81,7 @@ typedef struct {
|
||||
int fnc_return_value; /* 関数の戻り値として返す値 (~0,cali:で渡す値) */
|
||||
|
||||
/* key wait */
|
||||
int waittime;
|
||||
int waitcancel_key;
|
||||
int waitcancel_key_mask;
|
||||
boolean waitcancel_enabled;
|
||||
int waitcancel_key; // TODO: remove this
|
||||
|
||||
/* message wait */
|
||||
boolean messagewait_enable;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
int muspcm_init(int audio_buffer_size) { return NG; }
|
||||
int muspcm_exit(void) { return NG; }
|
||||
int muspcm_reset(void) { return NG; }
|
||||
int muspcm_load_no(int slot, int no) { return NG; }
|
||||
int muspcm_load_mixlr(int slot, int noL, int noR) { return NG; }
|
||||
int muspcm_unload(int slot) { return NG; }
|
||||
|
||||
@@ -32,6 +32,10 @@ EM_JS(int, muspcm_exit, (void), {
|
||||
return xsystem35.Status.OK;
|
||||
});
|
||||
|
||||
EM_JS(int, muspcm_reset, (void), {
|
||||
return xsystem35.audio.pcm_reset();;
|
||||
});
|
||||
|
||||
EM_JS(int, muspcm_load_no, (int slot, int no), { // async
|
||||
return xsystem35.audio.pcm_load(slot, no);
|
||||
});
|
||||
|
||||
@@ -142,6 +142,12 @@ int muspcm_exit(void) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int muspcm_reset(void) {
|
||||
for (int i = 0; i < PCM_SLOTS; i++)
|
||||
muspcm_unload(i);
|
||||
return OK;
|
||||
}
|
||||
|
||||
// 番号指定のPCMファイル読み込み
|
||||
int muspcm_load_no(int slot, int no) {
|
||||
if ((unsigned)slot >= PCM_SLOTS)
|
||||
|
||||
+9
-1
@@ -81,7 +81,7 @@ int s39ain_init(const char *path_to_ain, S39AIN *ain) {
|
||||
}
|
||||
p += 8;
|
||||
ain->dllnum = LittleEndian_getDW(p, 0);
|
||||
ain->dll = malloc(sizeof(S39AIN_DLLINF) * ain->dllnum);
|
||||
ain->dll = calloc(ain->dllnum, sizeof(S39AIN_DLLINF));
|
||||
|
||||
p += 4;
|
||||
for (i = 0; i < ain->dllnum; i++) {
|
||||
@@ -161,3 +161,11 @@ int s39ain_init(const char *path_to_ain, S39AIN *ain) {
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int s39ain_reset(S39AIN *ain) {
|
||||
for (int i = 0; i < ain->dllnum; i++) {
|
||||
if (ain->dll[i].reset)
|
||||
ain->dll[i].reset();
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
+3
-1
@@ -39,6 +39,7 @@ typedef struct S39AIN_DLLINF {
|
||||
char *name; /* DLL 名 */
|
||||
int function_num; /* 関数の数 */
|
||||
S39AIN_DLLFN *function; /* 関数本体 */
|
||||
void (*reset)(void);
|
||||
} S39AIN_DLLINF;
|
||||
|
||||
/* シナリオ関数情報 */
|
||||
@@ -61,6 +62,7 @@ typedef struct {
|
||||
char **msg; /* MSGI に関する情報 */
|
||||
} S39AIN;
|
||||
|
||||
extern int s39ain_init(const char *path, S39AIN *ain);
|
||||
int s39ain_init(const char *path, S39AIN *ain);
|
||||
int s39ain_reset(S39AIN *ain);
|
||||
|
||||
#endif /* __S39AIN_H__ */
|
||||
|
||||
+9
-9
@@ -392,11 +392,11 @@ int save_loadAll(int no) {
|
||||
sl_jmpFar2(save_base->scoPage, save_base->scoIndex);
|
||||
|
||||
for (i = 0; i < SELWINMAX; i++) {
|
||||
selWinInfo[i].x = save_base->selWinInfo[i].x;
|
||||
selWinInfo[i].y = save_base->selWinInfo[i].y;
|
||||
selWinInfo[i].width = save_base->selWinInfo[i].width;
|
||||
selWinInfo[i].height = save_base->selWinInfo[i].height;
|
||||
// selWinInfo[i].save = TRUE;
|
||||
nact->sel.wininfo[i].x = save_base->selWinInfo[i].x;
|
||||
nact->sel.wininfo[i].y = save_base->selWinInfo[i].y;
|
||||
nact->sel.wininfo[i].width = save_base->selWinInfo[i].width;
|
||||
nact->sel.wininfo[i].height = save_base->selWinInfo[i].height;
|
||||
// nact->sel.wininfo[i].save = TRUE;
|
||||
}
|
||||
for (i = 0; i < MSGWINMAX; i++) {
|
||||
nact->msg.wininfo[i].x = save_base->msgWinInfo[i].x;
|
||||
@@ -468,10 +468,10 @@ int save_saveAll(int no) {
|
||||
save_base->scoIndex = sl_getIndex();
|
||||
|
||||
for (i = 0; i < SELWINMAX; i++) {
|
||||
save_base->selWinInfo[i].x = (WORD)selWinInfo[i].x;
|
||||
save_base->selWinInfo[i].y = (WORD)selWinInfo[i].y;
|
||||
save_base->selWinInfo[i].width = (WORD)selWinInfo[i].width;
|
||||
save_base->selWinInfo[i].height = (WORD)selWinInfo[i].height;
|
||||
save_base->selWinInfo[i].x = (WORD)nact->sel.wininfo[i].x;
|
||||
save_base->selWinInfo[i].y = (WORD)nact->sel.wininfo[i].y;
|
||||
save_base->selWinInfo[i].width = (WORD)nact->sel.wininfo[i].width;
|
||||
save_base->selWinInfo[i].height = (WORD)nact->sel.wininfo[i].height;
|
||||
}
|
||||
|
||||
for (i = 0; i < MSGWINMAX; i++) {
|
||||
|
||||
@@ -108,8 +108,6 @@ typedef struct {
|
||||
emscripten_align1_int rsv2;
|
||||
} Ald_sysVarHdr;
|
||||
|
||||
/* defined by cmdb.c */
|
||||
extern Bcom_WindowInfo selWinInfo[];
|
||||
/* defined by variable.c */
|
||||
extern int strvar_len;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ boolean sl_init(void) {
|
||||
labelCallCnt = 0;
|
||||
pageCallCnt = 0;
|
||||
labelCallCnt_afterPageCall = 0;
|
||||
dataPushCnt = 0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -54,12 +54,13 @@ extern void sdl_updateAll(MyRectangle *view_rect);
|
||||
extern void sdl_updateScreen(void);
|
||||
|
||||
/* パレット関係 */
|
||||
extern void sdl_setPalette(Palette256 *pal, int src, int cnt);
|
||||
extern void sdl_setPalette(Palette256 *pal, int first, int count);
|
||||
|
||||
/* 描画関係 */
|
||||
extern void sdl_drawRectangle(int x, int y, int w, int h, BYTE c);
|
||||
extern void sdl_fillRectangle(int x, int y, int w, int h, BYTE c);
|
||||
extern void sdl_fillRectangleRGB(int x, int y, int w, int h, BYTE r, BYTE g, BYTE b);
|
||||
extern void sdl_fillCircle(int left, int top, int diameter, BYTE c);
|
||||
extern void sdl_drawLine(int x1, int y1, int x2, int y2, BYTE c);
|
||||
extern SDL_Rect sdl_floodFill(int x, int y, int col);
|
||||
extern SDL_Rect sdl_drawString(int x, int y, const char *str_utf8, BYTE col);
|
||||
@@ -97,6 +98,8 @@ extern void sdl_setCursorType(int type);
|
||||
extern boolean sdl_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDirEntry *cursordirentry);
|
||||
extern int sdl_getKeyInfo();
|
||||
extern int sdl_getMouseInfo(MyPoint *p);
|
||||
extern void sdl_getWheelInfo(int *forward, int *back);
|
||||
extern void sdl_clearWheelInfo(void);
|
||||
extern int sdl_getJoyInfo(void);
|
||||
extern void sdl_setAutoRepeat(boolean enable);
|
||||
extern MyPoint sdl_translateMouseCoords(int x, int y);
|
||||
|
||||
@@ -133,6 +133,8 @@ boolean sdl_cursorNew(BYTE* data, int no, CursorImage *cursorImage, TCursorDirEn
|
||||
}
|
||||
}
|
||||
|
||||
if (cursor[no])
|
||||
SDL_FreeCursor(cursor[no]);
|
||||
cursor[no] = SDL_CreateCursor(buf3, buf4, 32, 32, cursordirentry->wxHotspot, cursordirentry->wyHotspot);
|
||||
|
||||
free(buf1);
|
||||
|
||||
+39
-24
@@ -49,6 +49,12 @@ static void sdl_pal_check(void) {
|
||||
}
|
||||
}
|
||||
|
||||
static Uint32 palette_color(BYTE c) {
|
||||
if (sdl_dib->format->BitsPerPixel == 8)
|
||||
return c;
|
||||
return SDL_MapRGB(sdl_dib->format, sdl_col[c].r, sdl_col[c].g, sdl_col[c].b);
|
||||
}
|
||||
|
||||
void sdl_updateScreen(void) {
|
||||
if (!sdl_dirty)
|
||||
return;
|
||||
@@ -112,26 +118,20 @@ void sdl_updateAll(MyRectangle *view_rect) {
|
||||
}
|
||||
|
||||
/* Color の複数個指定 */
|
||||
void sdl_setPalette(Palette256 *pal, int src, int cnt) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cnt; i++) {
|
||||
sdl_col[src + i].r = pal->red [src + i];
|
||||
sdl_col[src + i].g = pal->green[src + i];
|
||||
sdl_col[src + i].b = pal->blue [src + i];
|
||||
}
|
||||
|
||||
if (sdl_dib->format->BitsPerPixel == 8) {
|
||||
SDL_SetPaletteColors(sdl_dib->format->palette, sdl_col, src, cnt);
|
||||
void sdl_setPalette(Palette256 *pal, int first, int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
sdl_col[first + i].r = pal->red [first + i];
|
||||
sdl_col[first + i].g = pal->green[first + i];
|
||||
sdl_col[first + i].b = pal->blue [first + i];
|
||||
}
|
||||
if (sdl_dib->format->BitsPerPixel == 8)
|
||||
SDL_SetPaletteColors(sdl_dib->format->palette, &sdl_col[first], first, count);
|
||||
}
|
||||
|
||||
/* 矩形の描画 */
|
||||
void sdl_drawRectangle(int x, int y, int w, int h, BYTE c) {
|
||||
sdl_pal_check();
|
||||
|
||||
Uint32 col = (sdl_dib->format->BitsPerPixel == 8) ? c
|
||||
: SDL_MapRGB(sdl_dib->format, sdl_col[c].r, sdl_col[c].g, sdl_col[c].b);
|
||||
Uint32 col = palette_color(c);
|
||||
|
||||
SDL_Rect rect = {x, y, w, 1};
|
||||
SDL_FillRect(sdl_dib, &rect, col);
|
||||
@@ -151,11 +151,7 @@ void sdl_fillRectangle(int x, int y, int w, int h, BYTE c) {
|
||||
sdl_pal_check();
|
||||
|
||||
SDL_Rect rect = {x, y, w, h};
|
||||
|
||||
Uint32 col = (sdl_dib->format->BitsPerPixel == 8) ? c
|
||||
: SDL_MapRGB(sdl_dib->format, sdl_col[c].r, sdl_col[c].g, sdl_col[c].b);
|
||||
|
||||
SDL_FillRect(sdl_dib, &rect, col);
|
||||
SDL_FillRect(sdl_dib, &rect, palette_color(c));
|
||||
}
|
||||
|
||||
void sdl_fillRectangleRGB(int x, int y, int w, int h, BYTE r, BYTE g, BYTE b) {
|
||||
@@ -166,6 +162,28 @@ void sdl_fillRectangleRGB(int x, int y, int w, int h, BYTE r, BYTE g, BYTE b) {
|
||||
SDL_FillRect(sdl_dib, &rect, SDL_MapRGB(sdl_dib->format, r, g, b));
|
||||
}
|
||||
|
||||
void sdl_fillCircle(int left, int top, int diameter, BYTE c) {
|
||||
diameter &= ~1;
|
||||
if (diameter <= 0)
|
||||
return;
|
||||
|
||||
Uint32 col = palette_color(c);
|
||||
|
||||
// This draws a circle that is pixel-identical to System3.9's grDrawFillCircle.
|
||||
for (int y = 0; y < diameter; y++) {
|
||||
int dy = diameter - 2*y;
|
||||
int dx = diameter - 1;
|
||||
for (int x = 0; 2*x < diameter; x++) {
|
||||
if (dy*dy + dx*dx <= diameter*diameter) {
|
||||
SDL_Rect rect = {left + x, top + y, diameter - 2*x, 1};
|
||||
SDL_FillRect(sdl_dib, &rect, col);
|
||||
break;
|
||||
}
|
||||
dx -= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 領域コピー */
|
||||
void sdl_copyArea(int sx, int sy, int w, int h, int dx, int dy) {
|
||||
if (sx == dx && sy == dy)
|
||||
@@ -264,8 +282,7 @@ void sdl_drawLine(int x1, int y1, int x2, int y2, BYTE c) {
|
||||
#undef TYPE
|
||||
|
||||
SDL_Rect sdl_floodFill(int x, int y, int c) {
|
||||
Uint32 col = (sdl_dib->format->BitsPerPixel == 8) ? c
|
||||
: SDL_MapRGB(sdl_dib->format, sdl_col[c].r, sdl_col[c].g, sdl_col[c].b);
|
||||
Uint32 col = palette_color(c);
|
||||
|
||||
switch (sdl_dib->format->BytesPerPixel) {
|
||||
case 1:
|
||||
@@ -312,10 +329,8 @@ void sdl_wrapColor(int sx, int sy, int w, int h, BYTE c, int rate) {
|
||||
SDL_Surface *s = SDL_CreateRGBSurface(0, w, h, sdl_dib->format->BitsPerPixel, 0, 0, 0, 0);
|
||||
assert(s->format->BitsPerPixel > 8);
|
||||
|
||||
Uint32 col = SDL_MapRGB(sdl_dib->format, sdl_col[c].r, sdl_col[c].g, sdl_col[c].b);
|
||||
|
||||
SDL_Rect r_src = {0, 0, w, h};
|
||||
SDL_FillRect(s, &r_src, col);
|
||||
SDL_FillRect(s, &r_src, palette_color(c));
|
||||
|
||||
SDL_SetSurfaceBlendMode(s, SDL_BLENDMODE_BLEND);
|
||||
SDL_SetSurfaceAlphaMod(s, rate);
|
||||
|
||||
@@ -44,6 +44,8 @@ enum sdl_effect_type from_nact_effect(enum nact_effect effect) {
|
||||
case NACT_EFFECT_WIPE_OUT_H: return EFFECT_WIPE_OUT_H;
|
||||
case NACT_EFFECT_WIPE_IN_H: return EFFECT_WIPE_IN_H;
|
||||
case NACT_EFFECT_MOSAIC: return EFFECT_MOSAIC;
|
||||
case NACT_EFFECT_CIRCLE_WIPE_OUT: return EFFECT_CIRCLE_WIPE_OUT;
|
||||
case NACT_EFFECT_CIRCLE_WIPE_IN: return EFFECT_CIRCLE_WIPE_IN;
|
||||
case NACT_EFFECT_FADEIN: return EFFECT_FADEIN;
|
||||
case NACT_EFFECT_WHITEIN: return EFFECT_WHITEIN;
|
||||
case NACT_EFFECT_FADEOUT: return EFFECT_FADEOUT_FROM_NEW;
|
||||
@@ -634,6 +636,56 @@ static void wipe_free(struct sdl_effect *eff) {
|
||||
free(eff);
|
||||
}
|
||||
|
||||
// EFFECT_CIRCLE_WIPE_*
|
||||
|
||||
static void circle_wipe_step(struct sdl_effect *eff, double progress);
|
||||
static void circle_wipe_free(struct sdl_effect *eff);
|
||||
|
||||
static struct sdl_effect *circle_wipe_new(SDL_Rect *rect, SDL_Surface *old, SDL_Surface *new, enum sdl_effect_type type) {
|
||||
struct sdl_effect *eff = calloc(1, sizeof(struct sdl_effect));
|
||||
if (!eff)
|
||||
NOMEMERR();
|
||||
effect_init(eff, rect, old, new, type);
|
||||
eff->step = circle_wipe_step;
|
||||
eff->finish = circle_wipe_free;
|
||||
return eff;
|
||||
}
|
||||
|
||||
static void circle_wipe_step(struct sdl_effect *eff, double progress) {
|
||||
SDL_Texture *bg = eff->tx_old;
|
||||
SDL_Texture *fg = eff->tx_new;
|
||||
if (eff->type == EFFECT_CIRCLE_WIPE_IN) {
|
||||
bg = eff->tx_new;
|
||||
fg = eff->tx_old;
|
||||
progress = 1 - progress;
|
||||
}
|
||||
SDL_RenderCopy(sdl_renderer, bg, NULL, &eff->dst_rect);
|
||||
|
||||
int hw = eff->dst_rect.w / 2;
|
||||
int hh = eff->dst_rect.h / 2;
|
||||
int r = sqrt(hw*hw + hh*hh) * progress;
|
||||
|
||||
for (int y = -r; y < r; y++) {
|
||||
if (y < -hh || y >= hh)
|
||||
continue;
|
||||
for (int x = max(-r, -hw); x < 0; x++) {
|
||||
if (y*y + x*x <= r*r) {
|
||||
SDL_Rect sr = {hw + x, hh + y, -2*x, 1};
|
||||
SDL_Rect dr = {eff->dst_rect.x + hw + x, eff->dst_rect.y + hh + y, -2*x, 1};
|
||||
SDL_RenderCopy(sdl_renderer, fg, &sr, &dr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_RenderPresent(sdl_renderer);
|
||||
}
|
||||
|
||||
static void circle_wipe_free(struct sdl_effect *eff) {
|
||||
effect_finish(eff, true);
|
||||
free(eff);
|
||||
}
|
||||
|
||||
// EFFECT_BLIND_*
|
||||
|
||||
static void blind_step(struct sdl_effect *eff, double progress);
|
||||
@@ -1530,6 +1582,9 @@ struct sdl_effect *sdl_effect_init(SDL_Rect *rect, agsurface_t *old, int ox, int
|
||||
case EFFECT_WIPE_OUT_H:
|
||||
case EFFECT_WIPE_IN_H:
|
||||
return wipe_new(rect, sf_old, sf_new, type);
|
||||
case EFFECT_CIRCLE_WIPE_OUT:
|
||||
case EFFECT_CIRCLE_WIPE_IN:
|
||||
return circle_wipe_new(rect, sf_old, sf_new, type);
|
||||
case EFFECT_BLIND_DOWN:
|
||||
case EFFECT_BLIND_UP:
|
||||
case EFFECT_BLIND_LR:
|
||||
|
||||
@@ -44,6 +44,7 @@ static void keyEventProsess(SDL_KeyboardEvent *e, boolean pressed);
|
||||
|
||||
/* pointer の状態 */
|
||||
static int mousex, mousey, mouseb;
|
||||
static int mouse_wheel_up, mouse_wheel_down;
|
||||
boolean RawKeyInfo[256];
|
||||
|
||||
/* SDL Joystick */
|
||||
@@ -156,6 +157,18 @@ static void sdl_getEvent(void) {
|
||||
mousey = e.motion.y;
|
||||
send_agsevent(AGSEVENT_MOUSE_MOTION, 0);
|
||||
break;
|
||||
|
||||
case SDL_MOUSEWHEEL:
|
||||
{
|
||||
int y = e.wheel.y * (e.wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? -1 : 1);
|
||||
if (y > 0)
|
||||
mouse_wheel_up += y;
|
||||
else if (y < 0)
|
||||
mouse_wheel_down -= y;
|
||||
send_agsevent(AGSEVENT_MOUSE_WHEEL, y);
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
mouseb |= (1 << e.button.button);
|
||||
RawKeyInfo[mouse_to_rawkey(e.button.button)] = TRUE;
|
||||
@@ -311,6 +324,19 @@ int sdl_getMouseInfo(MyPoint *p) {
|
||||
return m1 | m2;
|
||||
}
|
||||
|
||||
void sdl_getWheelInfo(int *forward, int *back) {
|
||||
*forward = mouse_wheel_up;
|
||||
*back = mouse_wheel_down;
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
EM_ASM( xsystem35.texthook.disableWheelEvent(100) );
|
||||
#endif
|
||||
}
|
||||
|
||||
void sdl_clearWheelInfo(void) {
|
||||
mouse_wheel_up = mouse_wheel_down = 0;
|
||||
}
|
||||
|
||||
int sdl_getJoyInfo(void) {
|
||||
sdl_getEvent();
|
||||
return joyinfo;
|
||||
|
||||
+38
-12
@@ -53,9 +53,9 @@ static char elm[ELEMENT_MAX][ELEMENT_LENGTH];
|
||||
/* 選択したときに返す値 */
|
||||
static int elmv[ELEMENT_MAX];
|
||||
/* 現在登録中の選択肢の番号 */
|
||||
static int regnum = 0;
|
||||
static int regnum;
|
||||
/* 選択肢の要素の最大長さ */
|
||||
static int maxElementLength = 0;
|
||||
static int maxElementLength;
|
||||
/* 選択肢ウィンド退避 */
|
||||
static MyRectangle saveArea;
|
||||
/* 選択ウィンドの退避用 */
|
||||
@@ -69,7 +69,7 @@ static int cb_select_address;
|
||||
static int cb_cancel_page;
|
||||
static int cb_cancel_address;
|
||||
/* 選択肢 window を開いた時のマウスカーソルの動作 */
|
||||
static int default_element = 1;
|
||||
static int default_element;
|
||||
/* 最後に選んだ選択肢の要素番号 */
|
||||
static int last_selected_element;
|
||||
/* キーボードによる選択操作用 */
|
||||
@@ -110,17 +110,43 @@ void sel_init() {
|
||||
sel.WinResizeWidth = FALSE;
|
||||
sel.WinResizeHeight = TRUE;
|
||||
|
||||
#if 0
|
||||
sel.WinInfo.x = 464;
|
||||
sel.WinInfo.y = 80;
|
||||
sel.WinInfo.width = 160;
|
||||
sel.WinInfo.height = 160;
|
||||
sel.WinInfo.save = TRUE;
|
||||
sel.savedImage = NULL;
|
||||
#endif
|
||||
for (int i = 0; i < SELWINMAX; i++) {
|
||||
if (sel.wininfo[i].savedimg)
|
||||
ags_delRegion(sel.wininfo[i].savedimg);
|
||||
}
|
||||
memset(sel.wininfo, 0, sizeof(sel.wininfo));
|
||||
|
||||
sel.winno = 1;
|
||||
sel.win = &sel.wininfo[0];
|
||||
sel.wininfo[0].x = 464;
|
||||
sel.wininfo[0].y = 80;
|
||||
sel.wininfo[0].width = 160;
|
||||
sel.wininfo[0].height = 160;
|
||||
sel.wininfo[0].save = TRUE;
|
||||
|
||||
/* 選択肢を登録中 */
|
||||
sel.in_setting = FALSE;
|
||||
|
||||
// Private variables
|
||||
memset(elm, 0, sizeof(elm));
|
||||
memset(elmv, 0, sizeof(elmv));
|
||||
regnum = 0;
|
||||
maxElementLength = 0;
|
||||
|
||||
if (saveimg) {
|
||||
ags_delRegion(saveimg);
|
||||
saveimg = NULL;
|
||||
}
|
||||
if (saveimg2) {
|
||||
ags_delRegion(saveimg2);
|
||||
saveimg2 = NULL;
|
||||
}
|
||||
cb_select_page = 0;
|
||||
cb_select_address = 0;
|
||||
cb_cancel_page = 0;
|
||||
cb_cancel_address = 0;
|
||||
default_element = 1;
|
||||
last_selected_element = 0;
|
||||
}
|
||||
|
||||
/* 登録された選択肢の個数を削減する */
|
||||
@@ -431,7 +457,7 @@ void sel_select() {
|
||||
}
|
||||
|
||||
sys_key_releasewait(SYS35KEY_RET, FALSE);
|
||||
while (1) {
|
||||
while (!nact->is_quit) {
|
||||
key = sys_keywait(25, KEYWAIT_CANCELABLE);
|
||||
|
||||
if (!key && prevkey == SYS35KEY_SPC) break;
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ struct _selection {
|
||||
|
||||
/* 選択肢 Window */
|
||||
int winno;
|
||||
Bcom_WindowInfo *win; // 現在使用中の window
|
||||
Bcom_WindowInfo *win; // points to wininfo[winno - 1]
|
||||
Bcom_WindowInfo wininfo[SELWINMAX];
|
||||
|
||||
/* 選択肢を登録中 */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user