diff --git a/data/odyssey_functions.csv b/data/odyssey_functions.csv index f52acefce..52e50c4eb 100644 --- a/data/odyssey_functions.csv +++ b/data/odyssey_functions.csv @@ -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 @@ -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 diff --git a/lib/al/Library/Nerve/NerveStateBase.cpp b/lib/al/Library/Nerve/NerveStateBase.cpp index 93f970909..7839be534 100644 --- a/lib/al/Library/Nerve/NerveStateBase.cpp +++ b/lib/al/Library/Nerve/NerveStateBase.cpp @@ -3,8 +3,6 @@ namespace al { NerveStateBase::NerveStateBase(const char* stateName) : NerveExecutor(stateName) {} -NerveStateBase::~NerveStateBase() = default; - void NerveStateBase::init() {} void NerveStateBase::appear() { @@ -31,7 +29,4 @@ void NerveStateBase::control() {} ActorStateBase::ActorStateBase(const char* name, LiveActor* actor) : NerveStateBase(name), mActor(actor) {} -template -HostStateBase::HostStateBase(const char* name, T* host) : NerveStateBase(name), mHost(host){}; - } // namespace al diff --git a/lib/al/Library/Nerve/NerveStateBase.h b/lib/al/Library/Nerve/NerveStateBase.h old mode 100755 new mode 100644 index 5a9335d7d..78c4a5005 --- a/lib/al/Library/Nerve/NerveStateBase.h +++ b/lib/al/Library/Nerve/NerveStateBase.h @@ -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(); @@ -16,6 +17,8 @@ class NerveStateBase : public NerveExecutor { bool isDead() const { return mIsDead; } + void setDead(bool isDead) { mIsDead = isDead; } + private: bool mIsDead = true; }; @@ -33,7 +36,9 @@ class ActorStateBase : public NerveStateBase { template 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; diff --git a/lib/al/Library/Wipe/WipeSimple.h b/lib/al/Library/Wipe/WipeSimple.h new file mode 100644 index 000000000..19e2f2915 --- /dev/null +++ b/lib/al/Library/Wipe/WipeSimple.h @@ -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 diff --git a/src/Scene/StageSceneStateEndSeparatePlay.cpp b/src/Scene/StageSceneStateEndSeparatePlay.cpp new file mode 100644 index 000000000..fbb91920f --- /dev/null +++ b/src/Scene/StageSceneStateEndSeparatePlay.cpp @@ -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(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); +} diff --git a/src/Scene/StageSceneStateEndSeparatePlay.h b/src/Scene/StageSceneStateEndSeparatePlay.h new file mode 100644 index 000000000..e9c7f8213 --- /dev/null +++ b/src/Scene/StageSceneStateEndSeparatePlay.h @@ -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 { +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; +}; diff --git a/src/Scene/StageSceneStatePauseMenu.h b/src/Scene/StageSceneStatePauseMenu.h new file mode 100644 index 000000000..27a77d19e --- /dev/null +++ b/src/Scene/StageSceneStatePauseMenu.h @@ -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 { +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; +}; diff --git a/src/Scene/StageSceneStateStartSeparatePlay.cpp b/src/Scene/StageSceneStateStartSeparatePlay.cpp new file mode 100644 index 000000000..0b21ca615 --- /dev/null +++ b/src/Scene/StageSceneStateStartSeparatePlay.cpp @@ -0,0 +1,141 @@ +#include "Scene/StageSceneStateStartSeparatePlay.h" + +#include "Library/Layout/LayoutActionFunction.h" +#include "Library/Layout/LayoutActorUtil.h" +#include "Library/Message/MessageHolder.h" +#include "Library/Nerve/NerveSetupUtil.h" +#include "Library/Nerve/NerveUtil.h" +#include "Library/Play/Layout/SimpleLayoutAppearWaitEnd.h" +#include "Library/Scene/Scene.h" +#include "Library/Se/SeFunction.h" +#include "Library/Wipe/WipeSimple.h" + +#include "Layout/FooterParts.h" +#include "Scene/StageSceneStatePauseMenu.h" +#include "Util/SpecialBuildUtil.h" +#include "Util/StageInputFunction.h" + +namespace { +NERVE_IMPL(StageSceneStateStartSeparatePlay, Appear); +NERVE_IMPL(StageSceneStateStartSeparatePlay, FadeOut); +NERVE_IMPL(StageSceneStateStartSeparatePlay, FadeIn); +NERVE_IMPL(StageSceneStateStartSeparatePlay, Back); +NERVE_IMPL(StageSceneStateStartSeparatePlay, WaitDraw); +NERVE_IMPL(StageSceneStateStartSeparatePlay, Wait); +NERVE_IMPL(StageSceneStateStartSeparatePlay, Applet); + +NERVES_MAKE_NOSTRUCT(StageSceneStateStartSeparatePlay, Wait, Applet); +NERVES_MAKE_STRUCT(StageSceneStateStartSeparatePlay, Appear, FadeOut, FadeIn, Back, WaitDraw); +} // namespace + +StageSceneStateStartSeparatePlay::StageSceneStateStartSeparatePlay( + const char* name, StageSceneStatePauseMenu* host, const al::LayoutInitInfo& info, + al::WipeSimple* wipeSimple, al::GamePadSystem* gamePadSystem, FooterParts* footerParts) + : al::HostStateBase(name, host), mGamePadSystem(gamePadSystem), + mWipeSimple(wipeSimple), mFooterParts(footerParts) { + initNerve(&NrvStageSceneStateStartSeparatePlay.Appear, 0); + + mControllerGuideMulti = new al::SimpleLayoutAppearWaitEnd( + "おすそ分け開始", "ControllerGuideMulti", info, nullptr, false); + al::killLayoutIfActive(mControllerGuideMulti); +} + +void StageSceneStateStartSeparatePlay::appear() { + field_40 = 0; + field_42 = false; + setDead(false); + if (rs::isModeE3LiveRom()) { + startTreeHouse(); + return; + } + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.Appear); +} + +void StageSceneStateStartSeparatePlay::startTreeHouse() { + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.FadeOut); +} + +bool StageSceneStateStartSeparatePlay::isNeedRequestGraphicsPreset() const { + return (field_42 && al::isNerve(this, &NrvStageSceneStateStartSeparatePlay.FadeIn)) || + (al::isNerve(this, &NrvStageSceneStateStartSeparatePlay.Appear) || + al::isNerve(this, &NrvStageSceneStateStartSeparatePlay.Back)); +} + +bool StageSceneStateStartSeparatePlay::isDrawViewRenderer() const { + if (isDead() || field_42) + return false; + if (al::isNerve(this, &NrvStageSceneStateStartSeparatePlay.WaitDraw)) + return true; + return al::isNerve(this, &NrvStageSceneStateStartSeparatePlay.FadeIn); +} + +void StageSceneStateStartSeparatePlay::exeAppear() { + if (al::isFirstStep(this)) { + mControllerGuideMulti->appear(); + al::startAction(mControllerGuideMulti, "Loop", "Loop"); + } + if (mControllerGuideMulti->isWait()) + al::setNerve(this, &Wait); +} + +void StageSceneStateStartSeparatePlay::exeWait() { + if (rs::isTriggerUiCancel(getScene())) { + field_42 = true; + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.Back); + return; + } + if (rs::isTriggerUiDecide(getScene())) + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.FadeOut); +} + +al::Scene* StageSceneStateStartSeparatePlay::getScene() { + return getHost()->getHost(); +} + +void StageSceneStateStartSeparatePlay::exeBack() { + if (al::isFirstStep(this)) { + mControllerGuideMulti->end(); + mFooterParts->changeTextFade( + al::getSystemMessageString(mFooterParts, "Footer", "MenuMessage_Footer")); + } + if (!al::isActive(mControllerGuideMulti)) + kill(); +} + +void StageSceneStateStartSeparatePlay::exeFadeOut() { + if (al::isFirstStep(this)) { + mWipeSimple->startClose(60); + al::startSe(mControllerGuideMulti, "Decide"); + al::startAction(mControllerGuideMulti, "Decide", nullptr); + } + if (mWipeSimple->isCloseEnd()) + al::setNerve(this, &Applet); +} + +void StageSceneStateStartSeparatePlay::exeApplet() { + if (ControllerAppletFunction::connectControllerSeparatePlay(mGamePadSystem)) { + rs::changeSeparatePlayMode(getScene(), true); + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.WaitDraw); + return; + } + mFooterParts->changeTextFade( + al::getSystemMessageString(mFooterParts, "Footer", "MenuMessage_Footer")); + field_42 = true; + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.FadeIn); +} + +void StageSceneStateStartSeparatePlay::exeFadeIn() { + if (al::isFirstStep(this)) { + mControllerGuideMulti->kill(); + mWipeSimple->startOpen(-1); + } + if (mWipeSimple->isOpenEnd()) + kill(); +} + +void StageSceneStateStartSeparatePlay::exeWaitDraw() { + if (al::isFirstStep(this) && !field_42) + getHost()->killPauseMenu(); + if (al::isGreaterEqualStep(this, 2)) + al::setNerve(this, &NrvStageSceneStateStartSeparatePlay.FadeIn); +} diff --git a/src/Scene/StageSceneStateStartSeparatePlay.h b/src/Scene/StageSceneStateStartSeparatePlay.h new file mode 100644 index 000000000..db5ee2d08 --- /dev/null +++ b/src/Scene/StageSceneStateStartSeparatePlay.h @@ -0,0 +1,44 @@ +#pragma once + +#include "Library/Nerve/NerveStateBase.h" + +namespace al { +class GamePadSystem; +class LayoutInitInfo; +class Scene; +class SimpleLayoutAppearWaitEnd; +class WipeSimple; +} // namespace al +class FooterParts; +class StageSceneStatePauseMenu; + +class StageSceneStateStartSeparatePlay : public al::HostStateBase { +public: + StageSceneStateStartSeparatePlay(const char* name, StageSceneStatePauseMenu* host, + const al::LayoutInitInfo& info, al::WipeSimple* wipeSimple, + al::GamePadSystem* gamePadSystem, FooterParts* footerParts); + + virtual void appear(); + + void startTreeHouse(); + bool isNeedRequestGraphicsPreset() const; + bool isDrawViewRenderer() const; + void exeAppear(); + void exeWait(); + al::Scene* getScene(); + void exeBack(); + void exeFadeOut(); + void exeApplet(); + void exeFadeIn(); + void exeWaitDraw(); + + bool getField42() const { return field_42; } + +private: + al::GamePadSystem* mGamePadSystem = nullptr; + al::SimpleLayoutAppearWaitEnd* mControllerGuideMulti = nullptr; + al::WipeSimple* mWipeSimple = nullptr; + FooterParts* mFooterParts = nullptr; + u16 field_40 = 0; + bool field_42 = false; +}; diff --git a/src/Util/SpecialBuildUtil.h b/src/Util/SpecialBuildUtil.h new file mode 100644 index 000000000..d51b0292a --- /dev/null +++ b/src/Util/SpecialBuildUtil.h @@ -0,0 +1,12 @@ +#pragma once + +namespace rs { +bool isModeE3Rom(); +bool isModeE3MovieRom(); +bool isModeE3LiveRom(); +bool isModeDiverRom(); +bool isModeJungleGymRom(); +bool isModeDiverOrJungleGymRom(); +bool isModeMovieRom(); +bool isModeEpdMovieRom(); +} // namespace rs