From 6baac0126f45cc965aa6d8e367327ace8dbf4bb8 Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Tue, 6 Feb 2024 22:30:04 -0600 Subject: [PATCH] Finish minigame_seq.c --- config/GMPE01_00/symbols.txt | 4 +- configure.py | 2 +- include/game/objsub.h | 2 +- src/game/minigame_seq.c | 413 ++++++++++++++++++++++++++++++++++- src/game/objsub.c | 4 +- 5 files changed, 409 insertions(+), 16 deletions(-) diff --git a/config/GMPE01_00/symbols.txt b/config/GMPE01_00/symbols.txt index c3234c1d..5da2e905 100644 --- a/config/GMPE01_00/symbols.txt +++ b/config/GMPE01_00/symbols.txt @@ -4952,7 +4952,7 @@ lbl_8012F574 = .data:0x8012F574; // type:object size:0xA scope:local data:string winWordTbl = .data:0x8012F580; // type:object size:0x18 scope:local winPosOfs = .data:0x8012F598; // type:object size:0x50 scope:local practiceTbl = .data:0x8012F5E8; // type:object size:0xAC scope:local -practicePosYTbl = .data:0x8012F694; // type:object size:0xC scope:local +yPosTbl$2366 = .data:0x8012F694; // type:object size:0xC scope:local seqStartFXTbl = .data:0x8012F6A0; // type:object size:0xF0 scope:local lbl_8012F790 = .data:0x8012F790; // type:object size:0x15 data:string lbl_8012F7A5 = .data:0x8012F7A5; // type:object size:0x10 data:string @@ -5826,7 +5826,7 @@ lbl_801D359E = .sdata:0x801D359E; // type:object size:0x5 scope:local data:strin lbl_801D35A3 = .sdata:0x801D35A3; // type:object size:0x7 scope:local lbl_801D35AA = .sdata:0x801D35AA; // type:object size:0x6 scope:local lbl_801D35B0 = .sdata:0x801D35B0; // type:object size:0x6 scope:local data:string -pauseStrTbl = .sdata:0x801D35B8; // type:object size:0x8 scope:local +pauseStr$2216 = .sdata:0x801D35B8; // type:object size:0x8 scope:local lbl_801D35C0 = .sdata:0x801D35C0; // type:object size:0x8 lbl_801D35C8 = .sdata:0x801D35C8; // type:object size:0x8 lbl_801D35D0 = .sdata:0x801D35D0; // type:object size:0x8 diff --git a/configure.py b/configure.py index 362f7bfd..92dd8b02 100644 --- a/configure.py +++ b/configure.py @@ -339,7 +339,7 @@ config.libs = [ Object(Matching, "game/frand.c"), Object(Matching, "game/audio.c"), Object(Matching, "game/EnvelopeExec.c"), - Object(NonMatching, "game/minigame_seq.c"), + Object(Matching, "game/minigame_seq.c"), Object(Matching, "game/ovllist.c"), Object(Matching, "game/esprite.c"), Object(NonMatching, "game/code_8003FF68.c"), diff --git a/include/game/objsub.h b/include/game/objsub.h index e4926f22..c83ecd03 100644 --- a/include/game/objsub.h +++ b/include/game/objsub.h @@ -19,7 +19,7 @@ typedef struct mg_info { u32 advice_mess; } MgInfo; -s16 omMgIndexGet(s16 overlay); +s32 omMgIndexGet(s16 overlay); void omGameSysInit(Process *objman); void omVibrate(s16 player_cfg_index, s16 duration, s16 off, s16 on); diff --git a/src/game/minigame_seq.c b/src/game/minigame_seq.c index 8b80385f..0c030084 100644 --- a/src/game/minigame_seq.c +++ b/src/game/minigame_seq.c @@ -5,6 +5,10 @@ #include "game/objsub.h" #include "game/object.h" #include "game/hsfman.h" +#include "game/window.h" +#include "game/wipe.h" +#include "game/pad.h" + #include "math.h" #include "stdarg.h" @@ -2604,7 +2608,7 @@ static int SeqUpdateDraw(SeqWork *work) if(work->time <= 20) { time = work->time; zrot = 365.0f*(time/20.0f); - scale = (double)1.3*sin(M_PI*(90.0f*(time/20.0f))/180.0); + scale = 1.3f*sin(M_PI*(90.0f*(time/20.0f))/180.0); HuSprGrpScaleSet(group, scale, scale); HuSprGrpZRotSet(group, zrot); } @@ -2683,7 +2687,7 @@ static char *winCharNameTbl[] = { static char *winWordTbl[] = { "カチ", - "WON", + "WON!", "ハイボク", "LOSE", "ユウショウ!", @@ -2723,7 +2727,7 @@ static s16 winPosOfs[][5][2] = { static s16 winnerNameW[8]; -#define GET_WIN_WORD_OFS() ((seqLanguage == 0) ? 0 : 1) +#define GET_LANG_IDX() ((seqLanguage == 0) ? 0 : 1) #define GET_WIN_KANAF() ((seqLanguage == 0) ? 1 : 0) @@ -2741,12 +2745,12 @@ static int SeqInitWin(SeqWork *work, va_list params) return 0; } if(win_type == 3) { - word_idx = GET_WIN_WORD_OFS(); + word_idx = GET_LANG_IDX(); } else { if(win_type == 4) { - word_idx = GET_WIN_WORD_OFS()+2; + word_idx = GET_LANG_IDX()+2; } else { - word_idx = GET_WIN_WORD_OFS()+4; + word_idx = GET_LANG_IDX()+4; } } word_grp = SeqMakeWord(work, winWordTbl[word_idx], GET_WIN_KANAF()); @@ -2762,9 +2766,9 @@ static int SeqInitWin(SeqWork *work, va_list params) if(winner < 0) { continue; } - word_grp = SeqMakeWord(work, winCharNameTbl[(winner*2)+GET_WIN_WORD_OFS()], 0); + word_grp = SeqMakeWord(work, winCharNameTbl[(winner*2)+GET_LANG_IDX()], 0); if(seqLanguage != 0) { - char *name = winCharNameTbl[(winner*2)+GET_WIN_WORD_OFS()]; + char *name = winCharNameTbl[(winner*2)+GET_LANG_IDX()]; word_w = 0.0f; for(i=word_w; iwork_s16[3]; i++, name++) { if(*name == ' ') { @@ -2773,7 +2777,7 @@ static int SeqInitWin(SeqWork *work, va_list params) word_w += 50.0f; } } - name = winCharNameTbl[(winner*2)+GET_WIN_WORD_OFS()]; + name = winCharNameTbl[(winner*2)+GET_LANG_IDX()]; word_x = 0.0f; for(i=word_x; iwork_s16[3]; i++, name++) { HuSprPosSet(work->spr_grp[word_grp], i, 25.0+(word_x-(0.5*word_w)), 0.0f); @@ -3174,6 +3178,173 @@ static int SeqUpdateRecord(SeqWork *work) return 1; } +static void PauseProc(void); + +void MGSeqPauseInit(void) +{ + MGSeqPauseEnableCtrl(0); + HuWinInit(1); + pauseProcess = HuPrcCreate(PauseProc, 100, 4096, 0); + HuPrcSetStat(pauseProcess, PROCESS_STAT_PAUSE_EN|PROCESS_STAT_UPAUSE_EN); + pauseActiveF = 1; + pauseExitF = 0; + pauseWaitF = 0; +} + +static void PauseProc(void) +{ + s16 mg; + s16 i; + s16 j; + + s16 char_mess_map[4]; + s16 char_mess[4][4]; + s16 window[3] = { -1, -1, -1 }; + + SeqWork work; + static char *pauseStr[] = { + "ポーズ", + "PAUSE" + }; + float ratio; + + HuAudFXPlay(5); + for(i=0; i<16; i++) { + work.sprite[i] = work.spr_grp[i] = -1; + } + SeqMakeWord(&work, pauseStr[GET_LANG_IDX()], 0); + for(i=0; iwork[0] == 0) { + if(omMgIndexGet(omcurovl) == -1) { + omDelObjEx(HuPrcCurrentGet(), object); + return; + } + object->work[0]++; + } + if(!omPauseChk() || _CheckFlag(0x1000C) || !pauseWaitF) { + return; + } + for(i=input=0; i<4; i++) { + input |= HuPadBtnDown[i]; + } + if(input & PAD_TRIGGER_Z) { + HuAudFXPlay(3); + pauseExitF = 1; + omSysPauseCtrl(0); + omSysExitReq = 1; + mgQuitExtraF = 1; + omDelObjEx(HuPrcCurrentGet(), object); + } } \ No newline at end of file diff --git a/src/game/objsub.c b/src/game/objsub.c index b6cc9206..157500c3 100644 --- a/src/game/objsub.c +++ b/src/game/objsub.c @@ -1174,7 +1174,7 @@ s16 mgTicTacToeGrid[3][3]; u8 mgIndexList[256]; GameStat mgGameStatBackup; -s16 omMgIndexGet(s16 overlay) { +s32 omMgIndexGet(s16 overlay) { s32 i; MgInfo *info; @@ -1182,7 +1182,7 @@ s16 omMgIndexGet(s16 overlay) { for (i = 0; info->ovl != ((u16)OVL_INVALID); i++) { if (info->ovl == overlay) { - return i; + return (s16)i; } info++; }