From 55be558d7cf809b5aeae14e80f6b730b768f36b1 Mon Sep 17 00:00:00 2001 From: shibbo Date: Sat, 2 Mar 2024 18:31:20 -0500 Subject: [PATCH] `AstroCountDownPlate.o` 100% --- csv/MapObj.csv | 48 +++--- data/Game.json | 2 +- data/json/MapObj.json | 2 +- docs/PROGRESS.md | 2 +- docs/lib/MapObj.md | 2 +- docs/lib/MapObj/AstroCountDownPlate.md | 50 +++--- include/Game/LiveActor/DisplayListMaker.hpp | 12 ++ include/Game/LiveActor/MaterialCtrl.hpp | 9 ++ include/Game/MapObj/AstroCountDownPlate.hpp | 33 ++++ include/Game/Util/DemoUtil.hpp | 2 + include/Game/Util/EventUtil.hpp | 4 + include/Game/Util/LiveActorUtil.hpp | 3 + include/Game/Util/MathUtil.hpp | 2 + .../JSystem/J3DGraphBase/J3DStruct.hpp | 32 +++- source/Game/MapObj/AstroCountDownPlate.cpp | 151 ++++++++++++++++++ 15 files changed, 300 insertions(+), 54 deletions(-) create mode 100644 include/Game/MapObj/AstroCountDownPlate.hpp create mode 100644 source/Game/MapObj/AstroCountDownPlate.cpp diff --git a/csv/MapObj.csv b/csv/MapObj.csv index 1f8b10b7..7a2f944b 100644 --- a/csv/MapObj.csv +++ b/csv/MapObj.csv @@ -180,30 +180,30 @@ execute__Q212NrvAstroCore16AstroCoreNrvWaitCFP5Spine,AstroCore.o,MapObj.a,true __cl__Q22MR43FunctorV0MCFv,AstroCore.o,MapObj.a,true clone__Q22MR43FunctorV0MCFP7JKRHeap,AstroCore.o,MapObj.a,true __dt__9AstroCoreFv,AstroCore.o,MapObj.a,true -__ct__19AstroCountDownPlateFPCc,AstroCountDownPlate.o,MapObj.a,false -init__19AstroCountDownPlateFRC12JMapInfoIter,AstroCountDownPlate.o,MapObj.a,false -exeWait__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -exeRevival__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -exeCountToZero__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -initTextureAtNumLeftStar__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -setNumLeftStar__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -selectNrvWait__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -setupStateWait__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -startDemoStartCountDown__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -startDemoLastBattle__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false -__sinit_\AstroCountDownPlate_cpp,AstroCountDownPlate.o,MapObj.a,false -__ct__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadFv,AstroCountDownPlate.o,MapObj.a,false -__ct__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveFv,AstroCountDownPlate.o,MapObj.a,false -__ct__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalFv,AstroCountDownPlate.o,MapObj.a,false -__ct__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroFv,AstroCountDownPlate.o,MapObj.a,false -execute__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroCFP5Spine,AstroCountDownPlate.o,MapObj.a,false -execute__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalCFP5Spine,AstroCountDownPlate.o,MapObj.a,false -execute__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveCFP5Spine,AstroCountDownPlate.o,MapObj.a,false -execute__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadCFP5Spine,AstroCountDownPlate.o,MapObj.a,false -Functor<19AstroCountDownPlate>__2MRFP19AstroCountDownPlateM19AstroCountDownPlateFPCvPv_v_Q22MR65FunctorV0M,AstroCountDownPlate.o,MapObj.a,false -__cl__Q22MR65FunctorV0MCFv,AstroCountDownPlate.o,MapObj.a,false -clone__Q22MR65FunctorV0MCFP7JKRHeap,AstroCountDownPlate.o,MapObj.a,false -__dt__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,false +__ct__19AstroCountDownPlateFPCc,AstroCountDownPlate.o,MapObj.a,true +init__19AstroCountDownPlateFRC12JMapInfoIter,AstroCountDownPlate.o,MapObj.a,true +exeWait__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +exeRevival__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +exeCountToZero__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +initTextureAtNumLeftStar__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +setNumLeftStar__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +selectNrvWait__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +setupStateWait__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +startDemoStartCountDown__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +startDemoLastBattle__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true +__sinit_\AstroCountDownPlate_cpp,AstroCountDownPlate.o,MapObj.a,true +__ct__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadFv,AstroCountDownPlate.o,MapObj.a,true +__ct__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveFv,AstroCountDownPlate.o,MapObj.a,true +__ct__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalFv,AstroCountDownPlate.o,MapObj.a,true +__ct__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroFv,AstroCountDownPlate.o,MapObj.a,true +execute__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroCFP5Spine,AstroCountDownPlate.o,MapObj.a,true +execute__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalCFP5Spine,AstroCountDownPlate.o,MapObj.a,true +execute__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveCFP5Spine,AstroCountDownPlate.o,MapObj.a,true +execute__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadCFP5Spine,AstroCountDownPlate.o,MapObj.a,true +Functor<19AstroCountDownPlate>__2MRFP19AstroCountDownPlateM19AstroCountDownPlateFPCvPv_v_Q22MR65FunctorV0M,AstroCountDownPlate.o,MapObj.a,true +__cl__Q22MR65FunctorV0MCFv,AstroCountDownPlate.o,MapObj.a,true +clone__Q22MR65FunctorV0MCFP7JKRHeap,AstroCountDownPlate.o,MapObj.a,true +__dt__19AstroCountDownPlateFv,AstroCountDownPlate.o,MapObj.a,true __ct__9AstroDomeFPCc,AstroDome.o,MapObj.a,false init__9AstroDomeFRC12JMapInfoIter,AstroDome.o,MapObj.a,false appear__9AstroDomeFv,AstroDome.o,MapObj.a,false diff --git a/data/Game.json b/data/Game.json index fb986c6f..dd976731 100644 --- a/data/Game.json +++ b/data/Game.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, "label": "Game", - "message": "13.406%", + "message": "13.454%", "color": "blue" } \ No newline at end of file diff --git a/data/json/MapObj.json b/data/json/MapObj.json index 245ec8b2..dde258dd 100644 --- a/data/json/MapObj.json +++ b/data/json/MapObj.json @@ -1,6 +1,6 @@ { "schemaVersion": 1, "label": "MapObj", - "message": "26.309%", + "message": "26.568%", "color": "tan" } \ No newline at end of file diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 375b653a..22e7cefe 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -12,7 +12,7 @@ | [Gravity](https://github.com/shibbo/Petari/blob/master/docs/lib/Gravity.md) | 73.07927450580803% | | [LiveActor](https://github.com/shibbo/Petari/blob/master/docs/lib/LiveActor.md) | 42.01936376210235% | | [Map](https://github.com/shibbo/Petari/blob/master/docs/lib/Map.md) | 17.65918333240488% | -| [MapObj](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj.md) | 26.309165981965492% | +| [MapObj](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj.md) | 26.568659060416643% | | [NameObj](https://github.com/shibbo/Petari/blob/master/docs/lib/NameObj.md) | 30.427688079697695% | | [NPC](https://github.com/shibbo/Petari/blob/master/docs/lib/NPC.md) | 2.155878467635403% | | [NWC24](https://github.com/shibbo/Petari/blob/master/docs/lib/NWC24.md) | 0.0% | diff --git a/docs/lib/MapObj.md b/docs/lib/MapObj.md index b1c5acb5..50512b64 100644 --- a/docs/lib/MapObj.md +++ b/docs/lib/MapObj.md @@ -17,7 +17,7 @@ | [ArrowSwitchMultiHolder.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/ArrowSwitchMultiHolder.md) | 100.0% | 7 / 7 | 100.0% | :white_check_mark: | [AssemblyBlock.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AssemblyBlock.md) | 87.1111111111111% | 21 / 22 | 95.45454545454545% | :eight_pointed_black_star: | [AstroCore.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AstroCore.md) | 100.0% | 16 / 16 | 100.0% | :white_check_mark: -| [AstroCountDownPlate.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AstroCountDownPlate.md) | 0.0% | 0 / 24 | 0.0% | :x: +| [AstroCountDownPlate.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AstroCountDownPlate.md) | 100.0% | 24 / 24 | 100.0% | :white_check_mark: | [AstroDome.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AstroDome.md) | 0.0% | 0 / 16 | 0.0% | :x: | [AstroDomeAsteroid.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AstroDomeAsteroid.md) | 0.0% | 0 / 10 | 0.0% | :x: | [AstroDomeBlueStar.o](https://github.com/shibbo/Petari/blob/master/docs/lib/MapObj/AstroDomeBlueStar.md) | 0.0% | 0 / 55 | 0.0% | :x: diff --git a/docs/lib/MapObj/AstroCountDownPlate.md b/docs/lib/MapObj/AstroCountDownPlate.md index 7a88bbc8..26d0f7d2 100644 --- a/docs/lib/MapObj/AstroCountDownPlate.md +++ b/docs/lib/MapObj/AstroCountDownPlate.md @@ -5,31 +5,31 @@ | :white_check_mark: | Function is completed. -# 0 / 24 Completed -- (0.0%) +# 24 / 24 Completed -- (100.0%) # AstroCountDownPlate.o | Symbol | Decompiled? | | ------------- | ------------- | -| `__ct__19AstroCountDownPlateFPCc` | :x: | -| `init__19AstroCountDownPlateFRC12JMapInfoIter` | :x: | -| `exeWait__19AstroCountDownPlateFv` | :x: | -| `exeRevival__19AstroCountDownPlateFv` | :x: | -| `exeCountToZero__19AstroCountDownPlateFv` | :x: | -| `initTextureAtNumLeftStar__19AstroCountDownPlateFv` | :x: | -| `setNumLeftStar__19AstroCountDownPlateFv` | :x: | -| `selectNrvWait__19AstroCountDownPlateFv` | :x: | -| `setupStateWait__19AstroCountDownPlateFv` | :x: | -| `startDemoStartCountDown__19AstroCountDownPlateFv` | :x: | -| `startDemoLastBattle__19AstroCountDownPlateFv` | :x: | -| `__sinit_\AstroCountDownPlate_cpp` | :x: | -| `__ct__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadFv` | :x: | -| `__ct__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveFv` | :x: | -| `__ct__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalFv` | :x: | -| `__ct__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroFv` | :x: | -| `execute__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroCFP5Spine` | :x: | -| `execute__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalCFP5Spine` | :x: | -| `execute__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveCFP5Spine` | :x: | -| `execute__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadCFP5Spine` | :x: | -| `Functor<19AstroCountDownPlate>__2MRFP19AstroCountDownPlateM19AstroCountDownPlateFPCvPv_v_Q22MR65FunctorV0M` | :x: | -| `__cl__Q22MR65FunctorV0MCFv` | :x: | -| `clone__Q22MR65FunctorV0MCFP7JKRHeap` | :x: | -| `__dt__19AstroCountDownPlateFv` | :x: | +| `__ct__19AstroCountDownPlateFPCc` | :white_check_mark: | +| `init__19AstroCountDownPlateFRC12JMapInfoIter` | :white_check_mark: | +| `exeWait__19AstroCountDownPlateFv` | :white_check_mark: | +| `exeRevival__19AstroCountDownPlateFv` | :white_check_mark: | +| `exeCountToZero__19AstroCountDownPlateFv` | :white_check_mark: | +| `initTextureAtNumLeftStar__19AstroCountDownPlateFv` | :white_check_mark: | +| `setNumLeftStar__19AstroCountDownPlateFv` | :white_check_mark: | +| `selectNrvWait__19AstroCountDownPlateFv` | :white_check_mark: | +| `setupStateWait__19AstroCountDownPlateFv` | :white_check_mark: | +| `startDemoStartCountDown__19AstroCountDownPlateFv` | :white_check_mark: | +| `startDemoLastBattle__19AstroCountDownPlateFv` | :white_check_mark: | +| `__sinit_\AstroCountDownPlate_cpp` | :white_check_mark: | +| `__ct__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadFv` | :white_check_mark: | +| `__ct__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveFv` | :white_check_mark: | +| `__ct__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalFv` | :white_check_mark: | +| `__ct__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroFv` | :white_check_mark: | +| `execute__Q222NrvAstroCountDownPlate33AstroCountDownPlateNrvCountToZeroCFP5Spine` | :white_check_mark: | +| `execute__Q222NrvAstroCountDownPlate29AstroCountDownPlateNrvRevivalCFP5Spine` | :white_check_mark: | +| `execute__Q222NrvAstroCountDownPlate27AstroCountDownPlateNrvAliveCFP5Spine` | :white_check_mark: | +| `execute__Q222NrvAstroCountDownPlate26AstroCountDownPlateNrvDeadCFP5Spine` | :white_check_mark: | +| `Functor<19AstroCountDownPlate>__2MRFP19AstroCountDownPlateM19AstroCountDownPlateFPCvPv_v_Q22MR65FunctorV0M` | :white_check_mark: | +| `__cl__Q22MR65FunctorV0MCFv` | :white_check_mark: | +| `clone__Q22MR65FunctorV0MCFP7JKRHeap` | :white_check_mark: | +| `__dt__19AstroCountDownPlateFv` | :white_check_mark: | diff --git a/include/Game/LiveActor/DisplayListMaker.hpp b/include/Game/LiveActor/DisplayListMaker.hpp index 47a904e3..e478591f 100644 --- a/include/Game/LiveActor/DisplayListMaker.hpp +++ b/include/Game/LiveActor/DisplayListMaker.hpp @@ -1,8 +1,11 @@ #pragma once +#include "Game/LiveActor/MaterialCtrl.hpp" #include +#include class J3DAnmBase; +class ResourceHolder; class DisplayListMaker { public: @@ -20,4 +23,13 @@ public: void update(); bool isValidDiff(); + + MaterialCtrl** mMaterialCtrls; // _0 + u32 mNumMaterialCtrls; // _4 + u32 _8; + u32 mPrgFlag; // _C + u32 mCurFlag; // _10 + J3DModel* mModel; // _14 + FogCtrl* mFogCtrl; // _18 + ResourceHolder* mResHolder; // _1C }; \ No newline at end of file diff --git a/include/Game/LiveActor/MaterialCtrl.hpp b/include/Game/LiveActor/MaterialCtrl.hpp index 58d1c3b5..1c3eb3d7 100644 --- a/include/Game/LiveActor/MaterialCtrl.hpp +++ b/include/Game/LiveActor/MaterialCtrl.hpp @@ -34,6 +34,15 @@ public: J3DGXColor* mColor; // _10 }; +class TexMtxCtrl : public MaterialCtrl { +public: + TexMtxCtrl(J3DModelData *, const char *); + + void setTexMtx(u32, J3DTexMtx *); + + J3DTexMtx* mMatricies[8]; // _C +}; + class ProjmapEffectMtxSetter { public: void updateMtxUseBaseMtx(); diff --git a/include/Game/MapObj/AstroCountDownPlate.hpp b/include/Game/MapObj/AstroCountDownPlate.hpp new file mode 100644 index 00000000..1076cd0c --- /dev/null +++ b/include/Game/MapObj/AstroCountDownPlate.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include "Game/LiveActor/LiveActor.hpp" +#include + +class AstroCountDownPlate : public LiveActor { +public: + AstroCountDownPlate(const char *); + + virtual ~AstroCountDownPlate(); + virtual void init(const JMapInfoIter &); + + void exeWait(); + void exeRevival(); + void exeCountToZero(); + void initTextureAtNumLeftStar(); + void setNumLeftStar(); + void selectNrvWait(); + void setupStateWait(); + void startDemoStartCountDown(); + void startDemoLastBattle(); + + J3DTexMtx _8C; + J3DTexMtx _120; + u8 _1B4; +}; + +namespace NrvAstroCountDownPlate { + NERVE_DECL(AstroCountDownPlateNrvDead, AstroCountDownPlate, AstroCountDownPlate::exeWait); + NERVE_DECL(AstroCountDownPlateNrvAlive, AstroCountDownPlate, AstroCountDownPlate::exeWait); + NERVE_DECL(AstroCountDownPlateNrvRevival, AstroCountDownPlate, AstroCountDownPlate::exeRevival); + NERVE_DECL(AstroCountDownPlateNrvCountToZero, AstroCountDownPlate, AstroCountDownPlate::exeCountToZero); +}; \ No newline at end of file diff --git a/include/Game/Util/DemoUtil.hpp b/include/Game/Util/DemoUtil.hpp index 216f594d..bf0d0994 100644 --- a/include/Game/Util/DemoUtil.hpp +++ b/include/Game/Util/DemoUtil.hpp @@ -6,11 +6,13 @@ class NameObj; class LiveActor; namespace MR { + bool tryRegisterDemoCast(LiveActor *, const char *, const JMapInfoIter &); bool tryRegisterDemoCast(LiveActor *, const JMapInfoIter &); bool isDemoCast(const LiveActor *, const char *); void registerDemoActionFunctor(const LiveActor *, const MR::FunctorBase &, const char *); + bool tryRegisterDemoActionFunctorDirect(const LiveActor *, const MR::FunctorBase &, const char *, const char *); void registerDemoActionNerve(const LiveActor *, const Nerve *, const char *); bool tryRegisterDemoActionFunctor(const LiveActor *, const MR::FunctorBase &, const char *); diff --git a/include/Game/Util/EventUtil.hpp b/include/Game/Util/EventUtil.hpp index a7665fd3..62c96743 100644 --- a/include/Game/Util/EventUtil.hpp +++ b/include/Game/Util/EventUtil.hpp @@ -81,4 +81,8 @@ namespace MR { const char* getCometNameFromId(int); s32 getEncounterGalaxyCometPowerStarId(const char *); + + s32 getPowerStarLeftToDisplayCountDownPlate(); + + bool isOnGameEventFlagViewNormalEnding(); }; diff --git a/include/Game/Util/LiveActorUtil.hpp b/include/Game/Util/LiveActorUtil.hpp index 365e3e5c..045818c9 100644 --- a/include/Game/Util/LiveActorUtil.hpp +++ b/include/Game/Util/LiveActorUtil.hpp @@ -21,6 +21,7 @@ class BtkCtrl; class MsgSharedGroup; class ResTIMG; class LiveActor; +class TexMtxCtrl; namespace MR { enum CollisionScaleType { @@ -331,4 +332,6 @@ namespace MR { PartsModel* createBloomModel(LiveActor *, MtxPtr); CollisionParts* getCollisionParts(const LiveActor *); + + TexMtxCtrl* initDLMakerTexMtx(LiveActor *, const char *); }; diff --git a/include/Game/Util/MathUtil.hpp b/include/Game/Util/MathUtil.hpp index d8792da2..f13cd044 100644 --- a/include/Game/Util/MathUtil.hpp +++ b/include/Game/Util/MathUtil.hpp @@ -122,6 +122,8 @@ namespace MR { f32 getScaleWithReactionValueZeroToOne(f32, f32, f32); + f32 getConvergeVibrationValue(f32, f32, f32, f32, f32); + void calcReboundVelocity(TVec3f *, const TVec3f &, f32, f32); void getRotatedAxisZ(TVec3f *, const TVec3f &); diff --git a/libs/JSystem/include/JSystem/J3DGraphBase/J3DStruct.hpp b/libs/JSystem/include/JSystem/J3DGraphBase/J3DStruct.hpp index 8749bd95..72d0648d 100644 --- a/libs/JSystem/include/JSystem/J3DGraphBase/J3DStruct.hpp +++ b/libs/JSystem/include/JSystem/J3DGraphBase/J3DStruct.hpp @@ -1,6 +1,8 @@ #pragma once #include +#include +#include class J3DGXColor { public: @@ -29,4 +31,32 @@ public: f32 mFarZ; // _10 _GXColor mColor; // _14 u16 mTable[10]; // _18 -}; \ No newline at end of file +}; + +struct J3DTextureSRTInfo { + f32 mScaleX; // _0 + f32 mScaleY; // _4 + s16 mRotation; // _8 + s16 mPad; // _A + f32 mTransX; // _C + f32 mTransY; // _10 +}; + +struct J3DTexMtxInfo { + + void operator=(const J3DTexMtxInfo &); + + u8 mProjection; // _0 + u8 mInfo; // _1 + s16 mPad; // _2 + TVec3f mCenter; // _4 + J3DTextureSRTInfo mSRTInfo; // _10 + Mtx44 mEffectMtx; // _24 +}; + +struct J3DTexMtx { + J3DTexMtxInfo mInfo; + Mtx mOutputMatrix; +}; + +static J3DTexMtxInfo j3dDefaultTexMtxInfo; \ No newline at end of file diff --git a/source/Game/MapObj/AstroCountDownPlate.cpp b/source/Game/MapObj/AstroCountDownPlate.cpp new file mode 100644 index 00000000..70d827d1 --- /dev/null +++ b/source/Game/MapObj/AstroCountDownPlate.cpp @@ -0,0 +1,151 @@ +#include "Game/MapObj/AstroCountDownPlate.hpp" +#include "Game/MapObj/AstroMapObjFunction.hpp" +#include "Game/LiveActor/MaterialCtrl.hpp" + +namespace { + const char* cMaterialName01 = "StarNumber01_v_x"; + const char* cMaterialName10 = "StarNumber01_v_x(2)"; + const char* cLastBattleDemoName = "ロゼッタ最終決戦デモ"; + const char* cStartCountDownDemoName = "ロゼッタカウントダウン開始デモ"; +}; + +AstroCountDownPlate::AstroCountDownPlate(const char *pName) : LiveActor(pName) { + _8C.mInfo = j3dDefaultTexMtxInfo; + _120.mInfo = j3dDefaultTexMtxInfo; + _1B4 = 0; +} + +void AstroCountDownPlate::init(const JMapInfoIter &rIter) { + MR::initDefaultPos(this, rIter); + initModelManagerWithAnm("AstroCountDownPlate", nullptr, true); + initTextureAtNumLeftStar(); + MR::newDifferedDLBuffer(this); + MR::connectToSceneMapObj(this); + initEffectKeeper(0, nullptr, false); + initSound(2, false); + MR::invalidateClipping(this); + + if (MR::tryRegisterDemoCast(this, cStartCountDownDemoName, rIter)) { + MR::FunctorV0M startDemoFunc = MR::Functor(this, &AstroCountDownPlate::startDemoStartCountDown); + MR::tryRegisterDemoActionFunctorDirect(this, startDemoFunc, cStartCountDownDemoName, nullptr); + } + + if (MR::tryRegisterDemoCast(this, cLastBattleDemoName, rIter)) { + MR::FunctorV0M lastBattleFunc = MR::Functor(this, &AstroCountDownPlate::startDemoLastBattle); + MR::tryRegisterDemoActionFunctorDirect(this, lastBattleFunc, cLastBattleDemoName, nullptr); + } + + MR::registerDemoSimpleCastAll(this); + initNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvDead::sInstance); + selectNrvWait(); + makeActorAppeared(); +} + +void AstroCountDownPlate::exeWait() { + if (MR::isFirstStep(this) && isNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvAlive::sInstance) && !MR::isEffectValid(this, "Light")) { + MR::emitEffect(this, "Light"); + _1B4 = 1; + } + + if (_1B4) { + MR::startLevelSound(this, "SE_OJ_LV_CDN_PLATE_LIGHT", -1, -1, -1); + } +} + +void AstroCountDownPlate::exeRevival() { + if (MR::isFirstStep(this)) { + MR::showMaterial(this, cMaterialName01); + MR::showMaterial(this, cMaterialName10); + MR::tryStartAllAnim(this, "Revival"); + MR::emitEffect(this, "Light"); + _1B4 = 1; + } + + if (_1B4) { + MR::startLevelSound(this, "SE_OJ_LV_CDN_PLATE_LIGHT", -1, -1, -1); + } + + if (MR::isBrkStopped(this)) { + setNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvAlive::sInstance); + } +} + +void AstroCountDownPlate::exeCountToZero() { + if (MR::isFirstStep(this)) { + MR::showMaterial(this, cMaterialName01); + MR::showMaterial(this, cMaterialName10); + MR::startSound(this, "SE_OJ_CDN_PLATE_ONE_TO_ZERO", -1, -1); + } + + f32 v2 = MR::calcNerveRate(this, 50); + f32 v3 = MR::getConvergeVibrationValue(v2, 0.1f, 0.0f, 0.30000001f, 4.0f); + _8C.mInfo.mSRTInfo.mTransY = v3; + + if (_1B4) { + MR::startLevelSound(this, "SE_OJ_LV_CDN_PLATE_LIGHT", -1, -1, -1); + } + + if (MR::isStep(this, 50)) { + setNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvAlive::sInstance); + } +} + +void AstroCountDownPlate::initTextureAtNumLeftStar() { + MR::initDLMakerTexMtx(this, cMaterialName01)->setTexMtx(0, &_8C); + MR::initDLMakerTexMtx(this, cMaterialName10)->setTexMtx(0, &_120); + setNumLeftStar(); +} + +void AstroCountDownPlate::setNumLeftStar() { + s32 starLeft = MR::getPowerStarLeftToDisplayCountDownPlate(); + f32 mod = starLeft % 10; + _120.mInfo.mSRTInfo.mTransY = 0.1f * (starLeft / 10); + _8C.mInfo.mSRTInfo.mTransY = 0.1f * mod; +} + +void AstroCountDownPlate::selectNrvWait() { + if (AstroMapObjFunction::isAlreadyRevival("AstroCountDownPlate", -1)) { + setNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvAlive::sInstance); + } + else { + setNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvDead::sInstance); + } + + setupStateWait(); +} + +void AstroCountDownPlate::setupStateWait() { + if (isNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvDead::sInstance)) { + MR::hideMaterial(this, cMaterialName01); + MR::hideMaterial(this, cMaterialName10); + } + else { + MR::showMaterial(this, cMaterialName01); + MR::showMaterial(this, cMaterialName10); + if (!MR::isOnGameEventFlagViewNormalEnding()) { + MR::startBrk(this, "Red"); + } + else { + MR::startBrk(this, "Green"); + } + } +} + +void AstroCountDownPlate::startDemoStartCountDown() { + setNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvRevival::sInstance); +} + +void AstroCountDownPlate::startDemoLastBattle() { + setNerve(&NrvAstroCountDownPlate::AstroCountDownPlateNrvCountToZero::sInstance); +} + +namespace NrvAstroCountDownPlate { + INIT_NERVE(AstroCountDownPlateNrvDead); + INIT_NERVE(AstroCountDownPlateNrvAlive); + INIT_NERVE(AstroCountDownPlateNrvRevival); + INIT_NERVE(AstroCountDownPlateNrvCountToZero); +}; + +AstroCountDownPlate::~AstroCountDownPlate() { + +}