From c734b58200443996b4dabd6cfbb2be30bfc8da6b Mon Sep 17 00:00:00 2001 From: zurachu Date: Fri, 14 Jul 2017 10:53:58 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=89=E3=81=AF=20=5FDEBUG=20=E3=83=9E?= =?UTF-8?q?=E3=82=AF=E3=83=AD=E3=82=92=E5=AE=9A=E7=BE=A9=E3=81=97=E3=81=A6?= =?UTF-8?q?=E5=88=A5=E3=83=93=E3=83=AB=E3=83=89=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=81=A8=E3=81=84=E3=81=91=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=8C=E3=80=81=E8=B5=B7=E5=8B=95=E6=99=82=E3=81=AB=E6=9C=80?= =?UTF-8?q?=E5=88=9D=E3=81=AE=E7=94=BB=E9=9D=A2=E3=81=8C=E5=87=BA=E3=82=8B?= =?UTF-8?q?=E3=81=BE=E3=81=A7=20START=20=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E6=8A=BC=E3=81=97=E3=81=A3=E3=81=B1=E3=81=AA=E3=81=97=E3=81=A7?= =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0=E3=83=A2=E3=83=BC=E3=83=89?= =?UTF-8?q?=E3=81=AB=E3=81=AA=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common.h | 1 + main.c | 86 ++++++++++++++++++++++++++++------------------------ pceth2_msg.c | 1 + pceth2_sav.c | 6 ++-- 4 files changed, 51 insertions(+), 43 deletions(-) diff --git a/common.h b/common.h index aac3de6..0c1d803 100644 --- a/common.h +++ b/common.h @@ -85,6 +85,7 @@ typedef struct tagSAVE_DATA { extern GLOBAL_SAVE_DATA global; extern SAVE_DATA play; extern unsigned short reg[]; +extern BOOL debug_mode; extern int msgView, speed, wait; void pceth2_Init(); diff --git a/main.c b/main.c index 1e2c612..027765e 100644 --- a/main.c +++ b/main.c @@ -54,6 +54,7 @@ BOOL file_load = FALSE; // ファイルを開けたかどうか +BOOL debug_mode = FALSE; int speed, wait, msgView; static PrecisionTimer s_frame_timer; @@ -75,7 +76,11 @@ void pceth2_waitKey(); void pceAppInit(void) { FramObject_Init(); - + + if(pcePadGetDirect() & PAD_C) { + debug_mode = TRUE; + } + /*{{2005/06/09 Naoyuki Sawa*/ if(ufe_setup() != 0) // UFE初期化 { @@ -113,12 +118,13 @@ void pceAppInit(void) // アーカイブ読み込み file_load = fpk_InitHandle(ARCHIVE_FILE_NAME); if (file_load) { -#ifdef _DEBUG - pceth2_Init(); - pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); // 2005/06/13追加 -#else - pceth2_TitleInit(); -#endif + if(debug_mode) { + pceth2_Init(); + pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); // 2005/06/13追加 + play.gameMode = GM_SCRIPT; + } else { + pceth2_TitleInit(); + } } } @@ -192,15 +198,15 @@ void pceAppProc(int cnt) } } -#ifdef _DEBUG - pceLCDPaint(0, 0, 82, DISP_X, 6); - pceFontSetType(2); - pceFontSetPos(0, 82); - pceFontSetTxColor(3); - pceFontSetBkColor(FC_SPRITE); - pceFontPrintf("%6lu/%6luus FREE:%8d", s_proc_us, s_frame_us, pceHeapGetMaxFreeSize()); - Ldirect_Update(); -#endif + if(debug_mode) { + pceLCDPaint(0, 0, 82, DISP_X, 6); + pceFontSetType(2); + pceFontSetPos(0, 82); + pceFontSetTxColor(3); + pceFontSetBkColor(FC_SPRITE); + pceFontPrintf("%6lu/%6luus FREE:%8d", s_proc_us, s_frame_us, pceHeapGetMaxFreeSize()); + Ldirect_Update(); + } Ldirect_Trans(); @@ -385,32 +391,32 @@ int pceth2_readScript(SCRIPT_DATA *s) // 最後まで読んだら終了 if (s->p >= s->size) { -#ifdef _DEBUG // デバッグモードの場合デバッグメニューに戻る - pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); -#else - switch(play.gameMode) - { - case GM_EVSCRIPT: - if (!pceth2_initMapSelect()) { // マップ選択肢があればマップ選択へ - JUMP = 0; // 2005/06/20 まるしすさん案:1e, 4, 1が来たらgotoの初期化 - if (TIME > EV_NIGHT) { // 一日終了 - TIME = EV_MORNING; - DAY++; - pceth2_calenderInit(); // カレンダー - } else { - pceth2_loadEVScript(); // 次のEVスクリプトを読む + if(debug_mode) { // デバッグモードの場合デバッグメニューに戻る + pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); + } else { + switch(play.gameMode) + { + case GM_EVSCRIPT: + if (!pceth2_initMapSelect()) { // マップ選択肢があればマップ選択へ + JUMP = 0; // 2005/06/20 まるしすさん案:1e, 4, 1が来たらgotoの初期化 + if (TIME > EV_NIGHT) { // 一日終了 + TIME = EV_MORNING; + DAY++; + pceth2_calenderInit(); // カレンダー + } else { + pceth2_loadEVScript(); // 次のEVスクリプトを読む + } + // if (play.evData.size == 0) { // 読めなかったら終了 + // pceAppReqExit(0); + // } } -// if (play.evData.size == 0) { // 読めなかったら終了 -// pceAppReqExit(0); -// } - } - break; - case GM_SCRIPT: - pceth2_closeScript(&play.scData); - play.gameMode = GM_EVSCRIPT; - break; + break; + case GM_SCRIPT: + pceth2_closeScript(&play.scData); + play.gameMode = GM_EVSCRIPT; + break; + } } -#endif return 0; } diff --git a/pceth2_msg.c b/pceth2_msg.c index 5cb4212..d9e4322 100644 --- a/pceth2_msg.c +++ b/pceth2_msg.c @@ -70,6 +70,7 @@ void pceth2_clearMessage(void) void pceth2_putKanji(const char *str) { FontFuchi_Printf("%c%c", *str, *(str + 1)); + Ldirect_VBuffView(TRUE); *(play.msg + play.msglen++) = *str; *(play.msg + play.msglen++) = *(str + 1); *(play.msg + play.msglen) = '\0'; diff --git a/pceth2_sav.c b/pceth2_sav.c index f467058..466ebb1 100644 --- a/pceth2_sav.c +++ b/pceth2_sav.c @@ -182,9 +182,9 @@ void pceth2_TitleInit() int pceth2_backTitle(SCRIPT_DATA *s) { s->p++; -#ifndef _DEBUG // デバッグ版は何もしない - pceth2_TitleInit(); -#endif + if(!debug_mode) { // デバッグ版は何もしない + pceth2_TitleInit(); + } return 0; } From f1be5a73731be130b3d218255b32dd9b5666d822 Mon Sep 17 00:00:00 2001 From: zurachu Date: Fri, 14 Jul 2017 14:27:46 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=89=E3=81=A7SELECT=E3=82=92=E6=8A=BC?= =?UTF-8?q?=E3=81=99=E3=81=A8=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E7=94=BB?= =?UTF-8?q?=E9=9D=A2=E3=81=AB=E6=88=BB=E3=81=A3=E3=81=A6=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=8C=E3=80=81=E3=83=87?= =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=B0=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=81=AB=E6=88=BB=E3=82=8A=E3=80=81=E3=83=87=E3=83=90=E3=83=83?= =?UTF-8?q?=E3=82=B0=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E4=B8=AD=E3=81=AE?= =?UTF-8?q?SELECT=E3=81=A7=E3=82=A2=E3=83=97=E3=83=AA=E7=B5=82=E4=BA=86?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 57 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/main.c b/main.c index 027765e..beedc83 100644 --- a/main.c +++ b/main.c @@ -60,8 +60,10 @@ int speed, wait, msgView; static PrecisionTimer s_frame_timer; static unsigned long s_frame_us, s_proc_us; +void pceth2_initGraphicAndSound(); int pceth2_readScript(SCRIPT_DATA *s); void pceth2_waitKey(); +void pceth2_startDebugMenu(); //============================================================================= //============================================================================= @@ -120,8 +122,7 @@ void pceAppInit(void) if (file_load) { if(debug_mode) { pceth2_Init(); - pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); // 2005/06/13追加 - play.gameMode = GM_SCRIPT; + pceth2_startDebugMenu(); } else { pceth2_TitleInit(); } @@ -191,10 +192,18 @@ void pceAppProc(int cnt) } if (pcePadGet() & PAD_D) { - if (play.gameMode == GM_TITLE) { - pceAppReqExit(0); + if(debug_mode) { + if(!strncmp(play.scData.name, DEBUG_FILE_NAME, 6)) { // デバッグメニュースクリプト中 + pceAppReqExit(0); + } else { + pceth2_startDebugMenu(); + } } else { - pceth2_TitleInit(); + if (play.gameMode == GM_TITLE) { + pceAppReqExit(0); + } else { + pceth2_TitleInit(); + } } } @@ -271,14 +280,6 @@ int pceAppNotify(int type, int param) */ void pceth2_Init() { - int i; - - pceth2_setPageTop(); - pceth2_clearMessage(); - - msgView = 1; - speed = 0; - memset(play, 0, sizeof(SAVE_DATA)); MONTH = START_MONTH; // 月 @@ -289,6 +290,23 @@ void pceth2_Init() memset(reg, 0, REG_NUM); // レジスタ + pceth2_initGraphicAndSound(); + + pceth2_loadEVScript(&play.evData); + +// play.gameMode = GM_EVSCRIPT; +} + +void pceth2_initGraphicAndSound() +{ + int i; + + pceth2_setPageTop(); + pceth2_clearMessage(); + + msgView = 1; + speed = 0; + for (i = 0; i <= GRP_NUM; i++) { pceth2_clearGraphic(i); } @@ -297,11 +315,7 @@ void pceth2_Init() Stop_PieceMML(); - pceth2_loadEVScript(&play.evData); - Ldirect_Update(); - -// play.gameMode = GM_EVSCRIPT; } /* @@ -392,7 +406,7 @@ int pceth2_readScript(SCRIPT_DATA *s) // 最後まで読んだら終了 if (s->p >= s->size) { if(debug_mode) { // デバッグモードの場合デバッグメニューに戻る - pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); + pceth2_startDebugMenu(); } else { switch(play.gameMode) { @@ -454,3 +468,10 @@ int pceth2_readScript(SCRIPT_DATA *s) Ldirect_Update(); return 0; } + +void pceth2_startDebugMenu() +{ + pceth2_initGraphicAndSound(); + pceth2_loadScript(&play.scData, DEBUG_FILE_NAME); + play.gameMode = GM_SCRIPT; +} From 12d9b334a003a4cdeb5eb18b33cf1c79195e8b65 Mon Sep 17 00:00:00 2001 From: zurachu Date: Fri, 14 Jul 2017 15:16:42 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E3=83=87=E3=83=90=E3=83=83=E3=82=B0?= =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=89=E3=81=A7=E5=AE=9F=E8=A1=8C=E4=B8=AD?= =?UTF-8?q?=E3=81=AB=E3=82=BB=E3=83=BC=E3=83=96=E3=81=97=E3=81=9F=E3=82=82?= =?UTF-8?q?=E3=81=AE=E3=82=92=E3=83=AD=E3=83=BC=E3=83=89=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=A8=E3=80=81=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97=E3=83=88?= =?UTF-8?q?=E3=81=8C=E7=B5=82=E3=82=8F=E3=81=A3=E3=81=9F=E5=BE=8C=E3=81=AB?= =?UTF-8?q?=E6=97=A5=E4=BB=98=E5=88=9D=E6=9C=9F=E7=8A=B6=E6=85=8B=E3=81=AE?= =?UTF-8?q?=E3=81=AF=E3=81=98=E3=82=81=E3=81=8B=E3=82=89=E3=81=AE=E3=82=B7?= =?UTF-8?q?=E3=83=BC=E3=83=B3=E3=81=AB=E7=A7=BB=E8=A1=8C=E3=81=97=E3=81=A6?= =?UTF-8?q?=E3=81=97=E3=81=BE=E3=81=A3=E3=81=A6=E3=81=84=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=81=A7=E3=80=81=E3=83=87=E3=83=90=E3=83=83=E3=82=B0=E3=83=A2?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=81=AB=E5=BE=A9=E5=B8=B0=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 繧サ繝シ繝悶ョ繝シ繧ソ縺ョ繧オ繧、繧コ繧貞、峨∴縺溘i菫ョ豁」縺悟、ァ縺阪¥縺ェ繧九◆繧√ gameMode 縺ョ荳贋ス阪ン繝繝医↓繝輔Λ繧ー繧貞・繧後k繧医≧縺ォ縺励◆縲 縺セ縺溘√ョ繝舌ャ繧ー繝「繝シ繝峨→繧上°繧翫d縺吶>繧医≧縲√Ο繝シ繝臥判髱「縺ョ陦ィ遉コ蜷阪r繧ケ繧ッ繝ェ繝励ヨ蜷阪↓縺励◆縲 --- common.h | 2 +- pceth2_sav.c | 24 +++++++++++++++++++----- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/common.h b/common.h index 0c1d803..1097a1c 100644 --- a/common.h +++ b/common.h @@ -65,7 +65,7 @@ typedef struct tagGLOBAL_SAVE_DATA { // セーブデータ構造体 typedef struct tagSAVE_DATA { - int gameMode; // ゲーム状態 + int gameMode; // ゲーム状態(セーブ時のみ、16bit目にデバッグモードフラグを保存) int msglen; // メッセージ長さ char msg[12*8*2+4]; // メッセージバッファ unsigned short flag[FLAG_NUM]; // フラグ diff --git a/pceth2_sav.c b/pceth2_sav.c index 466ebb1..095537f 100644 --- a/pceth2_sav.c +++ b/pceth2_sav.c @@ -22,6 +22,7 @@ GLOBAL_SAVE_DATA global; SAVE_DATA play; +static int const s_debug_mode_flag = 0x100; ///< @see common.h SAVE_DATA::gameMode //============================================================================= // グローバルセーブファイル @@ -85,7 +86,12 @@ BOOL pceth2_readSaveData(int num) char buf[FNAMELEN_SAV + 1]; sprintf(buf, "pceth2_%d.sav", num); - return (File_ReadTo((unsigned char*)&play, buf) == sizeof(SAVE_DATA)); + if(File_ReadTo((unsigned char*)&play, buf) == sizeof(SAVE_DATA)) { + debug_mode = play.gameMode & s_debug_mode_flag; + play.gameMode &= ~s_debug_mode_flag; + return TRUE; + } + return FALSE; } @@ -238,13 +244,18 @@ static void pceth2_drawSaveMenu() FontFuchi_PutStr("セーブ・ロード\n"); for (i = 0; i < SAVE_FILE_NUM; i++) { - FontFuchi_Printf("%c %d.",((i == global.save_index)? '>' : ' '), i); + FontFuchi_Printf("%c %d. ",((i == global.save_index)? '>' : ' '), i); sprintf(buf, "pceth2_%d.sav", i); if (pceFileOpen(&pfa, buf, FOMD_RD) == 0) { pceFileReadSct(&pfa, NULL, 0, sizeof(SAVE_DATA)); - month = ((SAVE_DATA*)pfa.aptr)->flag[0]; - day = ((SAVE_DATA*)pfa.aptr)->flag[1]; - FontFuchi_Printf("%2d月%2d日 %s曜日", month, day, date[pceth2_getDate(month, day)]); + if(((SAVE_DATA*)pfa.aptr)->gameMode & s_debug_mode_flag) { + FontFuchi_PutStr(((SAVE_DATA*)pfa.aptr)->scData.name); + } else { + month = ((SAVE_DATA*)pfa.aptr)->flag[0]; + day = ((SAVE_DATA*)pfa.aptr)->flag[1]; + FontFuchi_Printf("%1d月%2d日 %s曜日", month, day, date[pceth2_getDate(month, day)]); + } + pceFileClose(&pfa); } FontFuchi_PutStr("\n"); } @@ -310,6 +321,9 @@ void pceth2_SaveMenu() } } else if (phase == 1) { // セーブ play.gameMode = last_gameMode; // セーブ用に一瞬戻す + if(debug_mode) { + play.gameMode |= s_debug_mode_flag; + } pceth2_writeSaveData(global.save_index); play.gameMode = GM_SAVE; pceth2_drawSaveMenu();