Matched board/tutorial

This commit is contained in:
mrshigure 2024-02-11 00:26:08 -08:00
parent 7d2a6cdac8
commit a6ab530d81
15 changed files with 175 additions and 28 deletions

View file

@ -388,7 +388,7 @@ config.libs = [
Object(NonMatching, "game/board/last5.c"),
Object(NonMatching, "game/board/pause.c"),
Object(Matching, "game/board/com_path.c"),
Object(NonMatching, "game/board/tutorial.c"),
Object(Matching, "game/board/tutorial.c"),
Object(NonMatching, "game/kerent.c"),
],
},

View file

@ -45,7 +45,7 @@ typedef struct w10DllUnk04 {
extern s16 lbl_1_bss_20;
extern s16 lbl_1_bss_22[];
extern s16 lbl_1_bss_20;
extern s32 boardTutorialData;
extern s32 boardTutorialData[4];
void fn_1_C10(s16);
void fn_1_1FB0(void);

View file

@ -23,9 +23,9 @@ void BoardStatusShowSetAll(s32);
void BoardMGSetupTutorialExec(void);
void BoardBooHouseTutorialExec(void);
void BoardStatusItemSet(s32);
void BoardTutorialItemSet(s32);
void BoardTutorialItemSet(s8);
void BoardCharWheelSetTarget(s32);
void BoardTutorialDirInputSet(s32, s32, s32);
void BoardTutorialDirInputSet(s8, s8, s16);
void BoardSpaceStarSetIndex(s32);
s32 BoardModelRotYSet(s16, f32);
f32 BoardModelRotYGet(s16);
@ -54,7 +54,7 @@ void BoardLotteryHostSet(s16);
void BoardStarHostSet(s16);
void BoardBooHouseHostSet(s16);
void BoardTutorialHookSet(void*);
void BoardTutorialBlockSetPos(s32, s32);
void BoardTutorialBlockSetPos(s32, s8);
s32 BoardCameraRotGet(Vec*);
s32 BoardModelScaleSet(s16, f32, f32, f32);
s32 BoardIsKill(void);

View file

@ -10,6 +10,7 @@ void BoardComKeySetDown(void);
s8 BoardComPreferItemGet(s32 arg0, s8 *arg1, s8 arg2);
s8 BoardComPreferItemCheck(s32 arg0, s8 arg1, s8 arg2, s8 arg3);
s32 BoardComItemWeightGet(s32 arg0, s32 arg1);
s32 BoardComTutorialItemGet(s32 arg0);
s32 BoardComUseItemSet(s32 arg0, s32 arg1);
BOOL BoardComUseItemCheck(s32 arg0);
s32 BoardComJunctionInputGet(s32 arg0, Vec *arg1, s32 arg2, float *arg3);

View file

@ -3,6 +3,27 @@
#include "dolphin/types.h"
void BoardTutorialInit(void);
void BoardTutorialKill(void);
void BoardTutorialHookSet(void *arg0);
void BoardTutorialHookExec(s16 arg0, s32 arg1);
void BoardTutorialPlayerInit(void);
void BoardTutorialWorkSave(void);
void BoardTutorialWorkRestore(void);
void BoardTutorialDirInputSet(s8 arg0, s8 arg1, s16 arg2);
void BoardTutorialBlockSetPos(s32 arg0, s8 arg1);
void BoardTutorialItemSet(s8 arg0);
void BoardTutorialHostSet(s16 arg0);
void BoardTutorialHostHide(s8 arg0);
extern s32 boardTutorialData[4];
extern s8 boardTutorialDirInputX;
extern s8 boardTutorialDirInputY;
extern s16 boardTutorialDirInputTime;
extern s32 boardTutorialBlockPos;
extern s8 boardTutorialBlockItem;
extern s8 boardTutorialBlockF;
extern s8 boardTutorialUseItem;
extern s8 boardTutorialF;
#endif

View file

@ -108,7 +108,7 @@ void fn_1_1834(void) {
void fn_1_18BC(void) {
fn_1_BA0(0x2E0028);
fn_1_BA0(0x2E0029);
boardTutorialData = 0;
boardTutorialData[0] = 0;
BoardStatusItemSet(0);
}

View file

@ -1,6 +1,7 @@
#include "game/board/basic_space.h"
#include "game/board/main.h"
#include "game/board/player.h"
#include "game/board/tutorial.h"
#include "game/data.h"
#include "game/flag.h"
#include "game/object.h"
@ -34,7 +35,6 @@ static void CoinChgSeparate(omObjData*, coinChg*);
static void CoinChgShow(omObjData*, coinChg*);
static void CoinChgDisappear(omObjData*, coinChg*);
extern void BoardTutorialHookExec(s16, s32);
extern void BoardCameraViewSet(s32);
extern void BoardPlayerPosGet(s32, Vec*);
extern void BoardModelPosGet(s16, Vec*);

View file

@ -10,6 +10,7 @@
#include "game/hsfdraw.h"
#include "game/board/main.h"
#include "game/board/player.h"
#include "game/board/tutorial.h"
#include "game/pad.h"
#include "game/msm.h"
@ -61,8 +62,6 @@ extern s32 BoardSpacePosGet(s32 layer, s32 space, Vec *pos);
extern void BoardMGSetupPlayClear(void);
extern void BoardStartExec(void);
extern s8 boardTutorialF;
static void InitBoardFunc(omObjData *object);
static void ExecBoardFunc(omObjData *object);
static void KillBoardFunc(omObjData *object);

View file

@ -2,6 +2,7 @@
#include "game/objsub.h"
#include "game/board/com.h"
#include "game/board/roll.h"
#include "game/board/tutorial.h"
#include "game/board/view.h"
//// #include "game/board/ui.h"
@ -32,8 +33,6 @@ extern f32 BoardModelMotionMaxTimeGet(s16);
extern void BoardModelMotionTimeRangeSet(s16, s32, s32);
extern void BoardModelAttrSet(s16, s32);
extern void BoardModelAttrReset(s16, s32);
//// #include "game/board/tutorial.h"
extern BoardTutorialHookExec(s16, s32);
//// #include "game/board/com.h"
//// #include "game/board/overhead.h"
//// #include "game/chrman.h"
@ -44,9 +43,6 @@ extern s8 HuPadStkX[4];
extern s8 HuPadStkY[4];
extern u16 HuPadBtnDown[4];
extern u8 HuPadDStk[4];
extern s16 boardTutorialDirInputTime;
extern s8 boardTutorialDirInputX;
extern s8 boardTutorialDirInputY;
//// #include "game/board/view.h"
////

View file

@ -40,7 +40,6 @@ typedef struct {
s32 BoardRollResizeCheck(void);
s32 BoardPauseActiveCheck(void);
void BoardTutorialHookExec(s16, s32);
static void RollMain(void);
static void DiceCreate(s32 arg0);

View file

@ -3,6 +3,7 @@
#include "game/board/main.h"
#include "game/board/player.h"
#include "game/board/space.h"
#include "game/board/tutorial.h"
#include "game/hsfman.h"
#include "game/data.h"
#include "game/sprite.h"
@ -51,9 +52,6 @@ static s16 starPlatMdl = -1;
static s32 ExecPipeSpace(s32 player, s32 space);
extern s8 boardTutorialBlockF;
extern s32 boardTutorialBlockPos;
void BoardSpaceWalkEventFuncSet(BoardSpaceEventFunc func)
{

138
src/game/board/tutorial.c Executable file
View file

@ -0,0 +1,138 @@
#include "game/board/tutorial.h"
#include "game/flag.h"
#include "game/gamework_data.h"
#include "game/process.h"
#include "game/board/main.h"
#include "game/board/model.h"
s32 boardTutorialData[4]; // maybe a single s32 + padding?
static void (*tutorialHook)(s16, s32);
s8 boardTutorialDirInputX;
s8 boardTutorialDirInputY;
s16 boardTutorialDirInputTime;
s32 boardTutorialBlockPos;
s8 boardTutorialBlockItem;
s8 boardTutorialBlockF;
s8 boardTutorialUseItem;
static s16 hostMdl;
s8 boardTutorialF;
static Process *tutorialProcess;
static void *playerCfgCopy;
static void *playerCopy;
static void *systemCopy;
static void *gameStatCopy;
static void TutorialProcFunc(void) {
while (1) {
if (_CheckFlag(0x10010)) {
BoardTutorialHookExec(0x1E, 0);
}
HuPrcVSleep();
}
}
void BoardTutorialInit(void) {
boardTutorialDirInputTime = -1;
boardTutorialBlockF = 0;
boardTutorialUseItem = -1;
tutorialHook = NULL;
tutorialProcess = NULL;
boardTutorialF = 0;
if (_CheckFlag(0x1000B)) {
tutorialProcess = HuPrcChildCreate(TutorialProcFunc, 0x2002, 0x2000, 0, boardMainProc);
}
}
void BoardTutorialKill(void) {
if (_CheckFlag(0x1000B)) {
if (tutorialProcess) {
HuPrcKill(tutorialProcess);
}
boardTutorialF = 0;
}
}
void BoardTutorialHookSet(void *arg0) {
tutorialHook = arg0;
}
void BoardTutorialHookExec(s16 arg0, s32 arg1) {
if (tutorialHook) {
tutorialHook(arg0, arg1);
}
}
void BoardTutorialPlayerInit(void) {
s32 i;
for (i = 0; i < 4; i++) {
GWPlayer[i].com = 1;
GWPlayerCfg[i].iscom = 1;
}
GWSystem.board = 6;
}
void BoardTutorialWorkSave(void) {
OSReport("-O-O-O-O-O-O-O Tutorial Save Work\n");
if (gameStatCopy) {
HuMemDirectFree(gameStatCopy);
}
if (systemCopy) {
HuMemDirectFree(systemCopy);
}
if (playerCopy) {
HuMemDirectFree(playerCopy);
}
if (playerCfgCopy) {
HuMemDirectFree(playerCfgCopy);
}
gameStatCopy = HuMemDirectMalloc(HEAP_SYSTEM, sizeof(GWGameStat));
systemCopy = HuMemDirectMalloc(HEAP_SYSTEM, sizeof(GWSystem));
playerCopy = HuMemDirectMalloc(HEAP_SYSTEM, sizeof(GWPlayer));
playerCfgCopy = HuMemDirectMalloc(HEAP_SYSTEM, sizeof(GWPlayerCfg));
memcpy(gameStatCopy, &GWGameStat, sizeof(GWGameStat));
memcpy(systemCopy, &GWSystem, sizeof(GWSystem));
memcpy(playerCopy, GWPlayer, sizeof(GWPlayer));
memcpy(playerCfgCopy, GWPlayerCfg, sizeof(GWPlayerCfg));
}
void BoardTutorialWorkRestore(void) {
OSReport("-O-O-O-O-O-O-O Tutorial Load Work\n");
memcpy(&GWGameStat, gameStatCopy, sizeof(GWGameStat));
memcpy(&GWSystem, systemCopy, sizeof(GWSystem));
memcpy(GWPlayer, playerCopy, sizeof(GWPlayer));
memcpy(GWPlayerCfg, playerCfgCopy, sizeof(GWPlayerCfg));
HuMemDirectFree(gameStatCopy);
HuMemDirectFree(systemCopy);
HuMemDirectFree(playerCopy);
HuMemDirectFree(playerCfgCopy);
gameStatCopy = NULL;
systemCopy = NULL;
playerCopy = NULL;
playerCfgCopy = NULL;
}
void BoardTutorialDirInputSet(s8 arg0, s8 arg1, s16 arg2) {
boardTutorialDirInputX = arg0;
boardTutorialDirInputY = arg1;
boardTutorialDirInputTime = arg2;
}
void BoardTutorialBlockSetPos(s32 arg0, s8 arg1) {
boardTutorialBlockF = 1;
boardTutorialBlockPos = arg0;
boardTutorialBlockItem = arg1;
BoardSpaceBlockPosSet();
}
void BoardTutorialItemSet(s8 arg0) {
boardTutorialUseItem = arg0;
}
void BoardTutorialHostSet(s16 arg0) {
hostMdl = arg0;
}
void BoardTutorialHostHide(s8 arg0) {
BoardModelVisibilitySet(hostMdl, arg0);
}

View file

@ -9,10 +9,12 @@
#include "game/pad.h"
#include "game/process.h"
#include "game/window.h"
#include "game/board/com.h"
#include "game/board/item.h"
#include "game/board/main.h"
#include "game/board/model.h"
#include "game/board/player.h"
#include "game/board/tutorial.h"
#include "board_unsplit.h"
#include "math.h"
@ -93,12 +95,9 @@ typedef struct {
} UnkUiWork04;
void BoardPlayerSparkSet(s32);
void BoardTutorialHookExec(s16, s32);
void BoardBowserSuitMotionCreate(void);
s16 BoardBowserSuitPlayerModelGet(void);
void CharModelLayerSetAll(s32);
s32 BoardComTutorialItemGet(s32);
void BoardTutorialHostHide(s32);
static void KillAllBoardStatus(void);
static void CreateBoardStatusSprite(s32 arg0, UnkUiStatusStruct *arg1);

View file

@ -1,8 +1,10 @@
#include "game/board/warp.h"
#include "game/board/main.h"
#include "game/board/player.h"
#include "game/board/tutorial.h"
#include "game/wipe.h"
#include "game/gamework_data.h"
#include "game/hsfdraw.h"
#include "game/hsfex.h"
#include "game/objsub.h"
#include "board_unsplit.h"
@ -22,13 +24,8 @@ extern s32 BoardCharWheelResultGet(void);
extern f32 BoardModelMotionTimeGet(s16);
extern void BoardModelHookReset(s16);
extern s32 BoardModelHookSet(s16, char*, s16);
extern void BoardPlayerPosSet(s32, f32, f32, f32);
extern void BoardPlayerRotYSet(s32, f32);
extern void Hu3DModelObjPosGet(s16, char*, Vec*);
extern s32 BoardModelMotionEndCheck(s16);
extern s32 boardTutorialData[4];
static Vec warpPos;
static s8 warpState;

View file

@ -2,8 +2,7 @@
#include "game/wipe.h"
#include "game/memory.h"
#include "game/flag.h"
extern s8 boardTutorialF;
#include "game/board/tutorial.h"
s16 HuSysVWaitGet(s16 old);