Skip to content

Commit

Permalink
Implement StageSceneStateStartSeparatePlay and StageSceneStateEndSepa…
Browse files Browse the repository at this point in the history
…ratePlay

Co-authored-by: GRAnimated <[email protected]>
  • Loading branch information
LynxDev2 and GRAnimated committed Oct 18, 2024
1 parent 0559e0b commit bae967e
Show file tree
Hide file tree
Showing 10 changed files with 489 additions and 42 deletions.
70 changes: 35 additions & 35 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -31165,20 +31165,20 @@ Address,Quality,Size,Name
0x00000071004db3ac,U,000008,_ZNK12_GLOBAL__N_144StageSceneStateCollectionListNrvViewHackList7executeEPN2al11NerveKeeperE
0x00000071004db3b4,U,000008,_ZNK12_GLOBAL__N_148StageSceneStateCollectionListNrvViewSouvenirList7executeEPN2al11NerveKeeperE
0x00000071004db3bc,U,000008,_ZNK12_GLOBAL__N_142StageSceneStateCollectionListNrvChangeView7executeEPN2al11NerveKeeperE
0x00000071004db3c4,U,000096,_ZN30StageSceneStateEndSeparatePlayC1EPKcP24StageSceneStatePauseMenuRKN2al14LayoutInitInfoEPNS4_10WipeSimpleEPNS4_13GamePadSystemE
0x00000071004db424,U,000020,_ZN30StageSceneStateEndSeparatePlay6appearEv
0x00000071004db438,U,000088,_ZNK30StageSceneStateEndSeparatePlay27isNeedRequestGraphicsPresetEv
0x00000071004db490,U,000084,_ZN30StageSceneStateEndSeparatePlay10exeFadeOutEv
0x00000071004db4e4,U,000084,_ZN30StageSceneStateEndSeparatePlay9exeAppletEv
0x00000071004db538,U,000012,_ZN30StageSceneStateEndSeparatePlay8getSceneEv
0x00000071004db544,U,000084,_ZN30StageSceneStateEndSeparatePlay9exeFadeInEv
0x00000071004db598,U,000096,_ZN30StageSceneStateEndSeparatePlay11exeWaitDrawEv
0x00000071004db5f8,U,000108,_ZNK30StageSceneStateEndSeparatePlay18isDrawViewRendererEv
0x00000071004db664,U,000036,_ZN30StageSceneStateEndSeparatePlayD0Ev
0x00000071004db688,U,000088,_ZNK12_GLOBAL__N_140StageSceneStateEndSeparatePlayNrvFadeOut7executeEPN2al11NerveKeeperE
0x00000071004db6e0,U,000088,_ZNK12_GLOBAL__N_139StageSceneStateEndSeparatePlayNrvFadeIn7executeEPN2al11NerveKeeperE
0x00000071004db738,U,000084,_ZNK12_GLOBAL__N_139StageSceneStateEndSeparatePlayNrvApplet7executeEPN2al11NerveKeeperE
0x00000071004db78c,U,000100,_ZNK12_GLOBAL__N_141StageSceneStateEndSeparatePlayNrvWaitDraw7executeEPN2al11NerveKeeperE
0x00000071004db3c4,O,000096,_ZN30StageSceneStateEndSeparatePlayC1EPKcP24StageSceneStatePauseMenuRKN2al14LayoutInitInfoEPNS4_10WipeSimpleEPNS4_13GamePadSystemE
0x00000071004db424,O,000020,_ZN30StageSceneStateEndSeparatePlay6appearEv
0x00000071004db438,O,000088,_ZNK30StageSceneStateEndSeparatePlay27isNeedRequestGraphicsPresetEv
0x00000071004db490,O,000084,_ZN30StageSceneStateEndSeparatePlay10exeFadeOutEv
0x00000071004db4e4,O,000084,_ZN30StageSceneStateEndSeparatePlay9exeAppletEv
0x00000071004db538,O,000012,_ZN30StageSceneStateEndSeparatePlay8getSceneEv
0x00000071004db544,O,000084,_ZN30StageSceneStateEndSeparatePlay9exeFadeInEv
0x00000071004db598,O,000096,_ZN30StageSceneStateEndSeparatePlay11exeWaitDrawEv
0x00000071004db5f8,O,000108,_ZNK30StageSceneStateEndSeparatePlay18isDrawViewRendererEv
0x00000071004db664,O,000036,_ZN30StageSceneStateEndSeparatePlayD0Ev
0x00000071004db688,O,000088,_ZNK12_GLOBAL__N_140StageSceneStateEndSeparatePlayNrvFadeOut7executeEPN2al11NerveKeeperE
0x00000071004db6e0,O,000088,_ZNK12_GLOBAL__N_139StageSceneStateEndSeparatePlayNrvFadeIn7executeEPN2al11NerveKeeperE
0x00000071004db738,O,000084,_ZNK12_GLOBAL__N_139StageSceneStateEndSeparatePlayNrvApplet7executeEPN2al11NerveKeeperE
0x00000071004db78c,O,000100,_ZNK12_GLOBAL__N_141StageSceneStateEndSeparatePlayNrvWaitDraw7executeEPN2al11NerveKeeperE
0x00000071004db7f0,U,000084,_ZN31StageSceneStateGetLifeMaxUpItemC1EPKcPN2al5SceneEP16StageSceneLayout
0x00000071004db844,U,000016,_ZN31StageSceneStateGetLifeMaxUpItem6appearEv
0x00000071004db854,U,000012,_ZN31StageSceneStateGetLifeMaxUpItem4killEv
Expand Down Expand Up @@ -31787,27 +31787,27 @@ Address,Quality,Size,Name
0x00000071004f2124,U,000008,_ZNK12_GLOBAL__N_134StageSceneStateStageMapNrvReAdsorb7executeEPN2al11NerveKeeperE
0x00000071004f212c,U,000144,_ZNK12_GLOBAL__N_134StageSceneStateStageMapNrvEndClose7executeEPN2al11NerveKeeperE
0x00000071004f21bc,U,000072,_ZNK12_GLOBAL__N_135StageSceneStateStageMapNrvChangeOut7executeEPN2al11NerveKeeperE
0x00000071004f2204,U,000176,_ZN32StageSceneStateStartSeparatePlayC1EPKcP24StageSceneStatePauseMenuRKN2al14LayoutInitInfoEPNS4_10WipeSimpleEPNS4_13GamePadSystemEP11FooterParts
0x00000071004f22b4,U,000076,_ZN32StageSceneStateStartSeparatePlay6appearEv
0x00000071004f2300,U,000016,_ZN32StageSceneStateStartSeparatePlay14startTreeHouseEv
0x00000071004f2310,U,000108,_ZNK32StageSceneStateStartSeparatePlay27isNeedRequestGraphicsPresetEv
0x00000071004f237c,U,000108,_ZNK32StageSceneStateStartSeparatePlay18isDrawViewRendererEv
0x00000071004f23e8,U,000120,_ZN32StageSceneStateStartSeparatePlay9exeAppearEv
0x00000071004f2460,U,000136,_ZN32StageSceneStateStartSeparatePlay7exeWaitEv
0x00000071004f24e8,U,000012,_ZN32StageSceneStateStartSeparatePlay8getSceneEv
0x00000071004f24f4,U,000128,_ZN32StageSceneStateStartSeparatePlay7exeBackEv
0x00000071004f2574,U,000160,_ZN32StageSceneStateStartSeparatePlay10exeFadeOutEv
0x00000071004f2614,U,000144,_ZN32StageSceneStateStartSeparatePlay9exeAppletEv
0x00000071004f26a4,U,000112,_ZN32StageSceneStateStartSeparatePlay9exeFadeInEv
0x00000071004f2714,U,000096,_ZN32StageSceneStateStartSeparatePlay11exeWaitDrawEv
0x00000071004f2774,U,000036,_ZN32StageSceneStateStartSeparatePlayD0Ev
0x00000071004f2798,U,000124,_ZNK12_GLOBAL__N_141StageSceneStateStartSeparatePlayNrvAppear7executeEPN2al11NerveKeeperE
0x00000071004f2814,U,000008,_ZNK12_GLOBAL__N_142StageSceneStateStartSeparatePlayNrvFadeOut7executeEPN2al11NerveKeeperE
0x00000071004f281c,U,000116,_ZNK12_GLOBAL__N_141StageSceneStateStartSeparatePlayNrvFadeIn7executeEPN2al11NerveKeeperE
0x00000071004f2890,U,000132,_ZNK12_GLOBAL__N_139StageSceneStateStartSeparatePlayNrvBack7executeEPN2al11NerveKeeperE
0x00000071004f2914,U,000100,_ZNK12_GLOBAL__N_143StageSceneStateStartSeparatePlayNrvWaitDraw7executeEPN2al11NerveKeeperE
0x00000071004f2978,U,000136,_ZNK12_GLOBAL__N_139StageSceneStateStartSeparatePlayNrvWait7executeEPN2al11NerveKeeperE
0x00000071004f2a00,U,000008,_ZNK12_GLOBAL__N_141StageSceneStateStartSeparatePlayNrvApplet7executeEPN2al11NerveKeeperE
0x00000071004f2204,O,000176,_ZN32StageSceneStateStartSeparatePlayC1EPKcP24StageSceneStatePauseMenuRKN2al14LayoutInitInfoEPNS4_10WipeSimpleEPNS4_13GamePadSystemEP11FooterParts
0x00000071004f22b4,O,000076,_ZN32StageSceneStateStartSeparatePlay6appearEv
0x00000071004f2300,O,000016,_ZN32StageSceneStateStartSeparatePlay14startTreeHouseEv
0x00000071004f2310,O,000108,_ZNK32StageSceneStateStartSeparatePlay27isNeedRequestGraphicsPresetEv
0x00000071004f237c,O,000108,_ZNK32StageSceneStateStartSeparatePlay18isDrawViewRendererEv
0x00000071004f23e8,O,000120,_ZN32StageSceneStateStartSeparatePlay9exeAppearEv
0x00000071004f2460,O,000136,_ZN32StageSceneStateStartSeparatePlay7exeWaitEv
0x00000071004f24e8,O,000012,_ZN32StageSceneStateStartSeparatePlay8getSceneEv
0x00000071004f24f4,O,000128,_ZN32StageSceneStateStartSeparatePlay7exeBackEv
0x00000071004f2574,O,000160,_ZN32StageSceneStateStartSeparatePlay10exeFadeOutEv
0x00000071004f2614,O,000144,_ZN32StageSceneStateStartSeparatePlay9exeAppletEv
0x00000071004f26a4,O,000112,_ZN32StageSceneStateStartSeparatePlay9exeFadeInEv
0x00000071004f2714,O,000096,_ZN32StageSceneStateStartSeparatePlay11exeWaitDrawEv
0x00000071004f2774,O,000036,_ZN32StageSceneStateStartSeparatePlayD0Ev
0x00000071004f2798,O,000124,_ZNK12_GLOBAL__N_141StageSceneStateStartSeparatePlayNrvAppear7executeEPN2al11NerveKeeperE
0x00000071004f2814,O,000008,_ZNK12_GLOBAL__N_142StageSceneStateStartSeparatePlayNrvFadeOut7executeEPN2al11NerveKeeperE
0x00000071004f281c,O,000116,_ZNK12_GLOBAL__N_141StageSceneStateStartSeparatePlayNrvFadeIn7executeEPN2al11NerveKeeperE
0x00000071004f2890,O,000132,_ZNK12_GLOBAL__N_139StageSceneStateStartSeparatePlayNrvBack7executeEPN2al11NerveKeeperE
0x00000071004f2914,O,000100,_ZNK12_GLOBAL__N_143StageSceneStateStartSeparatePlayNrvWaitDraw7executeEPN2al11NerveKeeperE
0x00000071004f2978,O,000136,_ZNK12_GLOBAL__N_139StageSceneStateStartSeparatePlayNrvWait7executeEPN2al11NerveKeeperE
0x00000071004f2a00,O,000008,_ZNK12_GLOBAL__N_141StageSceneStateStartSeparatePlayNrvApplet7executeEPN2al11NerveKeeperE
0x00000071004f2a08,U,000384,_ZN19StageSceneStateTalkC2EPKcPN2al5SceneEP25EventFlowSceneExecuteCtrlP16StageSceneLayoutP13CinemaCaptionP13PlayGuideSkipP30StageSceneStateMiniGameRankingP23StageSceneStateSkipDemoP23StageSceneStateWorldMapP23StageSceneStateGetShineP27StageSceneStateGetShineMainP29StageSceneStateCollectionListP14GameDataHolderPNS2_10WipeSimpleE
0x00000071004f2b88,U,000076,_ZN19StageSceneStateTalk6appearEv
0x00000071004f2bd4,U,000012,_ZN19StageSceneStateTalk4killEv
Expand Down
5 changes: 0 additions & 5 deletions lib/al/Library/Nerve/NerveStateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace al {
NerveStateBase::NerveStateBase(const char* stateName) : NerveExecutor(stateName) {}

NerveStateBase::~NerveStateBase() = default;

void NerveStateBase::init() {}

void NerveStateBase::appear() {
Expand All @@ -31,7 +29,4 @@ void NerveStateBase::control() {}
ActorStateBase::ActorStateBase(const char* name, LiveActor* actor)
: NerveStateBase(name), mActor(actor) {}

template <class T>
HostStateBase<T>::HostStateBase(const char* name, T* host) : NerveStateBase(name), mHost(host){};

} // namespace al
9 changes: 7 additions & 2 deletions lib/al/Library/Nerve/NerveStateBase.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ namespace al {
class NerveStateBase : public NerveExecutor {
public:
NerveStateBase(const char* stateName);
virtual ~NerveStateBase();
// Temporarily removed to avoid mismatch in the StageSceneStateEndSeparatePlay dtor
// virtual ~NerveStateBase();

virtual void init();
virtual void appear();
Expand All @@ -16,6 +17,8 @@ class NerveStateBase : public NerveExecutor {

bool isDead() const { return mIsDead; }

void setDead(bool isDead) { mIsDead = isDead; }

private:
bool mIsDead = true;
};
Expand All @@ -33,7 +36,9 @@ class ActorStateBase : public NerveStateBase {
template <class T>
class HostStateBase : public NerveStateBase {
public:
HostStateBase(const char* name, T* host);
HostStateBase(const char* name, T* host) : NerveStateBase(name), mHost(host){};

T* getHost() { return mHost; }

private:
T* mHost;
Expand Down
29 changes: 29 additions & 0 deletions lib/al/Library/Wipe/WipeSimple.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "Library/Layout/LayoutActor.h"

namespace al {
class LayoutInitInfo;

class WipeSimple : public LayoutActor {
public:
WipeSimple(const char*, const char*, const LayoutInitInfo&, const char*);

void startClose(s32);
void tryStartClose(s32);
void startCloseEnd();
void startOpen(s32);
void tryStartOpen(s32);
bool isCloseEnd() const;
bool isOpenEnd() const;
void exeClose();
void exeCloseEnd();
void exeOpen();

virtual void appear();

private:
s32 mTime = -1;
};

} // namespace al
79 changes: 79 additions & 0 deletions src/Scene/StageSceneStateEndSeparatePlay.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#include "Scene/StageSceneStateEndSeparatePlay.h"

#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Nerve/NerveUtil.h"
#include "Library/Wipe/WipeSimple.h"

#include "Scene/StageSceneStatePauseMenu.h"
#include "Util/StageInputFunction.h"

namespace {
NERVE_IMPL(StageSceneStateEndSeparatePlay, FadeOut);
NERVE_IMPL(StageSceneStateEndSeparatePlay, FadeIn);
NERVE_IMPL(StageSceneStateEndSeparatePlay, Applet);
NERVE_IMPL(StageSceneStateEndSeparatePlay, WaitDraw);

NERVES_MAKE_NOSTRUCT(StageSceneStateEndSeparatePlay, Applet);
NERVES_MAKE_STRUCT(StageSceneStateEndSeparatePlay, FadeOut, FadeIn, WaitDraw);
} // namespace

StageSceneStateEndSeparatePlay::StageSceneStateEndSeparatePlay(const char* name,
StageSceneStatePauseMenu* host,
const al::LayoutInitInfo& info,
al::WipeSimple* wipeSimple,
al::GamePadSystem* gamePadSystem)
: al::HostStateBase<StageSceneStatePauseMenu>(name, host), mGamePadSystem(gamePadSystem),
mWipeSimple(wipeSimple) {
initNerve(&NrvStageSceneStateEndSeparatePlay.FadeOut, 0);
}

void StageSceneStateEndSeparatePlay::appear() {
setDead(false);
field_30 = false;
al::setNerve(this, &NrvStageSceneStateEndSeparatePlay.FadeOut);
}

bool StageSceneStateEndSeparatePlay::isNeedRequestGraphicsPreset() const {
return (field_30 && al::isNerve(this, &NrvStageSceneStateEndSeparatePlay.FadeIn)) ||
al::isNerve(this, &NrvStageSceneStateEndSeparatePlay.FadeOut);
}

void StageSceneStateEndSeparatePlay::exeFadeOut() {
if (al::isFirstStep(this))
mWipeSimple->startClose(-1);
if (mWipeSimple->isCloseEnd())
al::setNerve(this, &Applet);
}

void StageSceneStateEndSeparatePlay::exeApplet() {
if (ControllerAppletFunction::connectControllerSinglePlay(mGamePadSystem))
rs::changeSeparatePlayMode(getScene(), false);
else
field_30 = true;
al::setNerve(this, &NrvStageSceneStateEndSeparatePlay.WaitDraw);
}

al::Scene* StageSceneStateEndSeparatePlay::getScene() {
return getHost()->getHost();
}

void StageSceneStateEndSeparatePlay::exeFadeIn() {
if (al::isFirstStep(this))
mWipeSimple->startOpen(-1);
if (mWipeSimple->isOpenEnd())
kill();
}

void StageSceneStateEndSeparatePlay::exeWaitDraw() {
if (al::isFirstStep(this) && !field_30)
getHost()->killPauseMenu();
if (al::isGreaterEqualStep(this, 2))
al::setNerve(this, &NrvStageSceneStateEndSeparatePlay.FadeIn);
}

bool StageSceneStateEndSeparatePlay::isDrawViewRenderer() const {
if (isDead() || field_30)
return false;
return al::isNerve(this, &NrvStageSceneStateEndSeparatePlay.WaitDraw) ||
al::isNerve(this, &NrvStageSceneStateEndSeparatePlay.FadeIn);
}
35 changes: 35 additions & 0 deletions src/Scene/StageSceneStateEndSeparatePlay.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "Library/Nerve/NerveStateBase.h"

namespace al {
class GamePadSystem;
class LayoutInitInfo;
class Scene;
class WipeSimple;
} // namespace al
class StageSceneStatePauseMenu;

class StageSceneStateEndSeparatePlay : public al::HostStateBase<StageSceneStatePauseMenu> {
public:
StageSceneStateEndSeparatePlay(const char* name, StageSceneStatePauseMenu* host,
const al::LayoutInitInfo& info, al::WipeSimple* wipeSimple,
al::GamePadSystem* gamePadSystem);

virtual void appear();

bool isNeedRequestGraphicsPreset() const;
void exeFadeOut();
void exeApplet();
al::Scene* getScene();
void exeFadeIn();
void exeWaitDraw();
bool isDrawViewRenderer() const;

bool getField30() const { return field_30; }

private:
al::GamePadSystem* mGamePadSystem = nullptr;
al::WipeSimple* mWipeSimple = nullptr;
bool field_30 = false;
};
107 changes: 107 additions & 0 deletions src/Scene/StageSceneStatePauseMenu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#pragma once

#include "Library/Nerve/NerveStateBase.h"

#include "System/GameDataHolderAccessor.h"

namespace al {
class ActorInitInfo;
class HtmlViewer;
class KeyRepeatCtrl;
class LayoutInitInfo;
class PauseCameraCtrl;
class Scene;
struct SceneInitInfo;
class SimpleLayoutAppearWaitEnd;
class WindowConfirm;
class WipeSimple;
} // namespace al
class FooterParts;
class GameDataHolder;
class MenuSelectParts;
class SceneAudioSystemPauseController;
class StageSceneLayout;
class StageSceneStateEndSeparatePlay;
class StageSceneStateOption;
class StageSceneStateStartSeparatePlay;

class StageSceneStatePauseMenu : public al::HostStateBase<al::Scene> {
public:
StageSceneStatePauseMenu(const char* name, al::Scene* host,
al::SimpleLayoutAppearWaitEnd* menuLayout,
GameDataHolder* gameDataHolder, const al::SceneInitInfo& sceneInitInfo,
const al::ActorInitInfo& actorInitInfo,
const al::LayoutInitInfo& layoutInitInfo,
al::WindowConfirm* windowConfirm, StageSceneLayout* stageSceneLayout,
bool a11,
SceneAudioSystemPauseController* sceneAudioSystemPauseController);

virtual void appear();
virtual void kill();

void killPauseMenu();
void killMarioModel();
bool isNeedKillHost() const;
void startNormal();
void startAfterTitle();
void killAllOptionLayout();
bool isEndToCancel() const;
bool isEndToHelp() const;
bool isLoadData() const;
s32 getSelectedFileId() const;
bool isChangeLanguage() const;
const char* getLanguage() const;
bool isNewGame() const;
bool isModeSelectEnd() const;
bool checkNeedKillByHostAndEnd();
void startActionMario(const char*);
al::LiveActor* getMarioActor() const;
bool isDrawLayout() const;
bool isDrawLayoutMain() const;
bool isDrawViewRenderer() const;
bool isDrawChromakey() const;
void exeAppear();
void setNormal();
void appearMarioModel();
void updatePlayerPose();
void exeWait();
void changeNerveAndReturn(const al::Nerve* nerve);
void exeFadeBeforeHelp();
void exeStartHelp();
void exeWaitDraw();
void exeEnd();
void exeStartSeparatePlay();
void exeEndSeparatePlay();
void exeOption();
void exeSave();
void exeConfirmNewGame();
void exeNotExistEmptyFile();
void startPauseCamera();
void setAfterTitle();

private:
al::SimpleLayoutAppearWaitEnd* mMenuLayout = nullptr;
al::SimpleLayoutAppearWaitEnd* mMenuGuide = nullptr;
al::SimpleLayoutAppearWaitEnd* mMenuRight = nullptr;
FooterParts* mFooterParts;
MenuSelectParts* mSelectParts = nullptr;
al::WipeSimple* mMenuWipe = nullptr;
al::WipeSimple* mHelpWipe = nullptr;
s32 mStartType = 0;
StageSceneStateStartSeparatePlay* mStateStartSeparatePlay = nullptr;
StageSceneStateEndSeparatePlay* mStateEndSeparatePlay = nullptr;
StageSceneStateOption* mStateOption = nullptr;
al::LiveActor* mMarioHigh = nullptr;
char field_0x80[40];
GameDataHolderAccessor mGameDataHolderAccessor;
al::PauseCameraCtrl* mPauseCameraCtrl = nullptr;
al::WindowConfirm* mWindowConfirm = nullptr;
bool mIsNewGame = false;
al::KeyRepeatCtrl* mKeyRepeatCtrl = nullptr;
StageSceneLayout* mStageSceneLayout = nullptr;
bool mIsNormal = true;
bool mIsPauseMenu = false;
f32 mPrevNearClipDistance = 25.0f;
SceneAudioSystemPauseController* mSceneAudioSystemPauseController = nullptr;
al::HtmlViewer* mHtmlViewer = nullptr;
};
Loading

0 comments on commit bae967e

Please sign in to comment.