diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md
index 7ad9a2b79..bcf9877f8 100644
--- a/docs/recommended_todo.md
+++ b/docs/recommended_todo.md
@@ -26,35 +26,34 @@
| JAudio//JAI/JAISoundTable.cpp | 4382 | J2D/J2DBloSaver.cpp | 5301 |
| JAudio//JAI/JAIFx.cpp | 6025 | JParticle/JPAMath.cpp | 6293 |
| JParticle/JPAResourceLoader.cpp | 9831 | JAudio//JAI/JAISequenceHeap.cpp | 10033 |
-| JAudio//JAI/JAIInitData.cpp | 10317 | JStudio_JStage/object-light.cpp | 10504 |
-| JAudio//JAS/JASDSPChannel.cpp | 11896 | JAudio//JAS/JASTaskThread.cpp | 12200 |
-| JAudio//JAS/JASWSParser.cpp | 12435 | JParticle/JPADynamicsBlock.cpp | 12718 |
-| JMessage/resource.cpp | 13104 | J3D/J3DJoint.cpp | 13780 |
-| JAudio//JAS/JASAiCtrl.cpp | 14267 | J3D/J3DShape.cpp | 14990 |
-| J2D/J2DMaterial.cpp | 15401 | JStudio_JParticle/object-particle.cpp | 16851 |
-| J3D/J3DCluster.cpp | 18929 | J2D/J2DMaterialFactory.cpp | 18966 |
-| J2D/J2DTextBoxEx.cpp | 19100 | JAudio//JAS/JASChannel.cpp | 19252 |
-| JAudio//JAS/JASBNKParser.cpp | 19529 | JStudio/fvb.cpp | 20332 |
-| J3D/J3DTevs.cpp | 20723 | J3D/J3DMtxBuffer.cpp | 20816 |
-| J3D/J3DModelLoaderCalcSize.cpp | 21358 | J3D/J3DMaterial.cpp | 21616 |
-| JAudio//JAI/JAIAnimation.cpp | 22715 | J2D/J2DWindow.cpp | 23735 |
-| J3D/J3DGD.cpp | 24264 | J3D/J3DModel.cpp | 25170 |
-| JAudio//JAI/JAIBasic.cpp | 29235 | J3D/J3DMaterialAttach.cpp | 29965 |
-| J2D/J2DScreen.cpp | 30766 | JStudio/functionvalue.cpp | 31270 |
-| J3D/J3DMaterialFactory_v21.cpp | 35247 | JMessage/processor.cpp | 35777 |
-| J2D/J2DPicture.cpp | 41698 | JAudio//JAS/JASAramStream.cpp | 47117 |
-| J2D/J2DWindowEx.cpp | 47225 | JAudio//JAS/JASSeqParser.cpp | 47291 |
-| JAudio//JAI/JAISound.cpp | 51800 | JAudio//JAI/JAIStreamMgr.cpp | 53015 |
-| JAudio//JAI/JAISeMgr.cpp | 64949 | JAudio//JAI/JAISequenceMgr.cpp | 68811 |
-| JAudio//JAS/JASTrack.cpp | 72438 | J3D/J3DMaterialFactory.cpp | 75581 |
-| J2D/J2DPictureEx.cpp | 90428 | JParticle/JPAResource.cpp | 95931 |
-| JParticle/JPABaseShape.cpp | 96437 | JStudio/jstudio-object.cpp | 104283 |
-| J2D/J2DMatBlock.cpp | 127713 | J3D/J3DMatBlock.cpp | 165948 |
+| JAudio//JAI/JAIInitData.cpp | 10317 | JAudio//JAS/JASDSPChannel.cpp | 11896 |
+| JAudio//JAS/JASTaskThread.cpp | 12200 | JAudio//JAS/JASWSParser.cpp | 12435 |
+| JParticle/JPADynamicsBlock.cpp | 12718 | JMessage/resource.cpp | 13104 |
+| J3D/J3DJoint.cpp | 13780 | JAudio//JAS/JASAiCtrl.cpp | 14267 |
+| J3D/J3DShape.cpp | 14990 | J2D/J2DMaterial.cpp | 15401 |
+| JStudio_JParticle/object-particle.cpp | 16851 | J3D/J3DCluster.cpp | 18929 |
+| J2D/J2DMaterialFactory.cpp | 18966 | J2D/J2DTextBoxEx.cpp | 19100 |
+| JAudio//JAS/JASChannel.cpp | 19252 | JAudio//JAS/JASBNKParser.cpp | 19529 |
+| JStudio/fvb.cpp | 20332 | J3D/J3DTevs.cpp | 20723 |
+| J3D/J3DMtxBuffer.cpp | 20816 | J3D/J3DModelLoaderCalcSize.cpp | 21358 |
+| J3D/J3DMaterial.cpp | 21616 | JAudio//JAI/JAIAnimation.cpp | 22734 |
+| J2D/J2DWindow.cpp | 23735 | J3D/J3DGD.cpp | 24264 |
+| J3D/J3DModel.cpp | 25170 | JAudio//JAI/JAIBasic.cpp | 29235 |
+| J3D/J3DMaterialAttach.cpp | 29965 | J2D/J2DScreen.cpp | 30766 |
+| JStudio/functionvalue.cpp | 31270 | J3D/J3DMaterialFactory_v21.cpp | 35247 |
+| JMessage/processor.cpp | 35777 | JAudio//JAS/JASAramStream.cpp | 47117 |
+| J2D/J2DWindowEx.cpp | 47225 | JAudio//JAI/JAISound.cpp | 51880 |
+| JAudio//JAI/JAIStreamMgr.cpp | 53015 | JAudio//JAI/JAISeMgr.cpp | 64969 |
+| JAudio//JAI/JAISequenceMgr.cpp | 68811 | JAudio//JAS/JASTrack.cpp | 72438 |
+| J3D/J3DMaterialFactory.cpp | 75581 | J2D/J2DPictureEx.cpp | 90428 |
+| JParticle/JPAResource.cpp | 95931 | JParticle/JPABaseShape.cpp | 96437 |
+| JStudio/jstudio-object.cpp | 104283 | J2D/J2DMatBlock.cpp | 127713 |
+| J3D/J3DMatBlock.cpp | 165948 | | |
###
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
-| ebi2DCallBack.cpp | 10843 | particleMgr.cpp | 12945 |
+| ebi2DCallBack.cpp | 10768 | particleMgr.cpp | 12945 |
| ebiP2Title.cpp | 23868 | efxPikmin.cpp | 31834 |
| efxEnemy.cpp | 32976 | efxBase.cpp | 34373 |
@@ -62,38 +61,38 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| PSBnkMgr.cpp | 10222 | PSSe.cpp | 22235 |
-| PSSeq.cpp | 27178 | PSAutoBgm.cpp | 53631 |
-| PSGame.cpp | 75740 | | |
+| PSSeq.cpp | 27178 | PSAutoBgm.cpp | 53627 |
+| PSGame.cpp | 75695 | | |
###
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| cellIterator.cpp | 7343 | flockMgr.cpp | 7479 |
-| naviWhistle.cpp | 8528 | itemWeed.cpp | 9123 |
+| naviWhistle.cpp | 8528 | itemWeed.cpp | 9175 |
| creatureLOD.cpp | 10130 | aiEnter.cpp | 10852 |
-| itemHoney.cpp | 12291 | aiBreakGate.cpp | 13960 |
-| texCaster.cpp | 16211 | gameCaveInfo.cpp | 16285 |
-| singleGS_CaveResult.cpp | 19814 | itemCave.cpp | 20306 |
-| pathfinder.cpp | 22687 | itemPikihead.cpp | 24012 |
+| itemHoney.cpp | 12304 | aiBreakGate.cpp | 13960 |
+| texCaster.cpp | 16129 | gameCaveInfo.cpp | 16285 |
+| singleGS_CaveResult.cpp | 19826 | itemCave.cpp | 20319 |
+| pathfinder.cpp | 22687 | itemPikihead.cpp | 24017 |
| gameCPlate.cpp | 24190 | dynCreature.cpp | 25766 |
| gameDynamics.cpp | 27134 | vsCardMgr.cpp | 30816 |
-| itemBridge.cpp | 32279 | itemGate.cpp | 33044 |
+| itemBridge.cpp | 32335 | itemGate.cpp | 33086 |
| routeMgr.cpp | 34733 | piki.cpp | 35847 |
-| gamePlayDataMemCard.cpp | 36191 | gamePlayData.cpp | 37263 |
-| fakePiki.cpp | 42148 | collinfo.cpp | 43051 |
+| gamePlayDataMemCard.cpp | 36191 | gamePlayData.cpp | 37326 |
+| fakePiki.cpp | 42148 | collinfo.cpp | 42951 |
| cellPyramid.cpp | 48069 | aiFormation.cpp | 53090 |
-| pelletState.cpp | 63252 | itemUjamushi.cpp | 64521 |
-| itemPlant.cpp | 73541 | baseGameSection.cpp | 86125 |
+| pelletState.cpp | 63251 | itemUjamushi.cpp | 64561 |
+| itemPlant.cpp | 73568 | baseGameSection.cpp | 86076 |
| aiPrimitives.cpp | 117179 | pelletMgr.cpp | 134458 |
| pikiState.cpp | 140997 | navi.cpp | 148740 |
-| naviState.cpp | 163222 | singleGS_Zukan.cpp | 163862 |
+| naviState.cpp | 163246 | singleGS_Zukan.cpp | 163886 |
| gameMapParts.cpp | 164114 | | |
###
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
-| khFinalResult.cpp | 59742 | khDayEndResult.cpp | 81952 |
-| khWorldMap.cpp | 158699 | | |
+| khFinalResult.cpp | 60103 | khDayEndResult.cpp | 81751 |
+| khWorldMap.cpp | 149430 | | |
###
| File | Size (bytes) | File | Size (bytes) |
@@ -104,7 +103,7 @@
| panModoki.cpp | 45170 | kingChappyState.cpp | 50807 |
| umiMushi.cpp | 60146 | kingChappy.cpp | 64498 |
| hiScore2D.cpp | 76415 | blackMan.cpp | 121903 |
-| zukan2D.cpp | 134438 | challengeResult2D.cpp | 142165 |
+| zukan2D.cpp | 134435 | challengeResult2D.cpp | 142165 |
| challengeSelect2D.cpp | 186008 | vsSelect2D.cpp | 196392 |
###
@@ -174,15 +173,15 @@
| matMath.cpp | 26236 | moviePlayer.cpp | 26415 |
| windowMessage.cpp | 29714 | system.cpp | 29894 |
| memoryCard.cpp | 31280 | bootSection.cpp | 38584 |
-| movieMessage.cpp | 44386 | pikmin2MemoryCardMgr.cpp | 51733 |
+| movieMessage.cpp | 44348 | pikmin2MemoryCardMgr.cpp | 51733 |
| graphics.cpp | 76138 | messageRendering.cpp | 89561 |
###
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| PSMainSide_CreaturePrm.cpp | 2600 | PSMainSide_ObjCalc.cpp | 7695 |
-| PSMainSide_Sound.cpp | 11782 | PSMainSide_Director.cpp | 29610 |
-| PSMainSide_Se.cpp | 45066 | PSMainSide_Scene.cpp | 49638 |
-| PSMainSide_ObjSound.cpp | 74707 | PSMainSide_Factory.cpp | 88161 |
+| PSMainSide_Sound.cpp | 11860 | PSMainSide_Director.cpp | 29610 |
+| PSMainSide_Se.cpp | 45016 | PSMainSide_Scene.cpp | 49638 |
+| PSMainSide_ObjSound.cpp | 74737 | PSMainSide_Factory.cpp | 88161 |
diff --git a/include/Game/Entities/ItemBigFountain.h b/include/Game/Entities/ItemBigFountain.h
index 724f09462..f1275a663 100644
--- a/include/Game/Entities/ItemBigFountain.h
+++ b/include/Game/Entities/ItemBigFountain.h
@@ -51,6 +51,7 @@ struct State : public ItemState- {
// _00 = VTBL
// _00-_0C = ItemState
+ u32 _0C; // _0C
};
struct AppearState : public State {
@@ -64,9 +65,8 @@ struct AppearState : public State {
virtual void cleanup(Item* item); // _10
// _00 = VTBL
- // _00-_0C = State
- u32 _0C; // _0C
- f32 _10; // _10
+ // _00-_10 = State
+ f32 mAppearTimer; // _10
};
struct CloseState : public State {
@@ -80,8 +80,7 @@ struct CloseState : public State {
virtual void cleanup(Item* item); // _10
// _00 = VTBL
- // _00-_0C = State
- u32 _0C; // _0C
+ // _00-_10 = State
};
struct OutState : public State {
@@ -96,8 +95,7 @@ struct OutState : public State {
virtual bool canRide() { return true; } // _34 (weak)
// _00 = VTBL
- // _00-_0C = State
- u32 _0C; // _0C
+ // _00-_10 = State
};
struct WaitState : public State {
@@ -113,8 +111,7 @@ struct WaitState : public State {
virtual void onKeyEvent(Item* item, const SysShape::KeyEvent& keyEvent); // _24
// _00 = VTBL
- // _00-_0C = State
- u32 _0C; // _0C
+ // _00-_10 = State
};
struct FountainParms : public CreatureParms {
diff --git a/include/Game/Entities/ItemRock.h b/include/Game/Entities/ItemRock.h
index 3be47bb92..dc4708679 100644
--- a/include/Game/Entities/ItemRock.h
+++ b/include/Game/Entities/ItemRock.h
@@ -36,9 +36,9 @@ struct State : public ItemState
- {
// _00 = VTBL
// _00-_0C = ItemState
- u32 _0C; // _0C, unknown - probably was mName
- u8 mIsDamaged; // _10
- u8 mIsFullSize; // _11
+ u32 _0C; // _0C, unknown - probably was mName
+ bool mIsDamaged; // _10
+ bool mIsFullSize; // _11
};
struct NormalState : public State {
diff --git a/include/Game/Entities/ItemTreasure.h b/include/Game/Entities/ItemTreasure.h
index ed0dcaa08..6bb5e2120 100644
--- a/include/Game/Entities/ItemTreasure.h
+++ b/include/Game/Entities/ItemTreasure.h
@@ -18,6 +18,11 @@ struct Pellet;
namespace ItemTreasure {
struct Item;
+enum StateID {
+ ITEMTREASURE_Normal = 0,
+ ITEMTREASURE_StateCount, // 1
+};
+
struct FSM : public ItemFSM
- {
virtual void init(Item*); // _08
diff --git a/include/Game/GameMessage.h b/include/Game/GameMessage.h
index 5acee3226..9893a78c4 100644
--- a/include/Game/GameMessage.h
+++ b/include/Game/GameMessage.h
@@ -88,8 +88,8 @@ struct GameMessageVsGetDoping : public GameMessage {
};
struct GameMessageVsGetOtakara : public GameMessage {
- inline GameMessageVsGetOtakara(u32 onyonType)
- : mOnionType(onyonType)
+ inline GameMessageVsGetOtakara(u32 playerID)
+ : mPlayerID(playerID)
, mUnused08(1)
{
}
@@ -97,8 +97,8 @@ struct GameMessageVsGetOtakara : public GameMessage {
virtual bool actVs(VsGameSection*); // _10
// _00 = VTBL
- u32 mOnionType; // _04, onyon type according to ghidra, but that enum is meant to be a short
- int mUnused08; // _08
+ u32 mPlayerID; // _04
+ int mUnused08; // _08
};
struct GameMessageVsGotCard : public GameMessage {
diff --git a/include/Game/Highscore.h b/include/Game/Highscore.h
index cfc5f5e06..86f1eb2c4 100644
--- a/include/Game/Highscore.h
+++ b/include/Game/Highscore.h
@@ -3,6 +3,10 @@
struct Stream;
+#define GAME_HIGHSCORE_COUNT 16
+
+#define GAME_HIGHSCORE_RANK_NUM 3
+
namespace Game {
// Size: 0xC
struct Highscore {
diff --git a/include/Game/VsGame.h b/include/Game/VsGame.h
index 417749817..984c3b9d4 100644
--- a/include/Game/VsGame.h
+++ b/include/Game/VsGame.h
@@ -16,6 +16,9 @@
#include "efx/TNaviEffect.h"
#include "efx/TPk.h"
+#define CH_SCORE_POKO_MULTIPLIER 10
+#define CH_SCORE_PIKMIN_MULTIPLIER 10
+
struct JUTTexture;
struct LightObj;
@@ -534,8 +537,6 @@ struct TitleState : public State {
void execChallenge(VsGameSection*);
void execVs(VsGameSection*);
- inline int getChallengeStageNum() { return 30; }
-
inline int getVsStageNum() { return mSection->mVsStageList->mStageData.getChildCount(); }
// _00 = VTBL
diff --git a/include/Game/VsGameSection.h b/include/Game/VsGameSection.h
index 9a182d53e..2aa63120f 100644
--- a/include/Game/VsGameSection.h
+++ b/include/Game/VsGameSection.h
@@ -10,6 +10,24 @@
#include "Game/Entities/ItemBigFountain.h"
#include "Game/Entities/ItemHole.h"
+#define VS_YELLOW_MARLBE_NUM 7
+
+#define VS_CHERRY_MAX_COUNT 10
+
+#define VS_CHERRY_MIN_WEIGHT 1
+#define VS_CHERRY_MAX_WEIGHT 1
+
+#define VS_MARBLE_MIN_WEIGHT 1
+#define VS_MARBLE_MAX_WEIGHT 8
+
+#define VS_WIN_YELLOW_MARBLE_NUM 4
+
+#define VS_PIKMIN_HANDICAP_MULTIPLIER 5
+#define VS_PIKMIN_HANDICAP_DEFAULT_VALUE 2
+
+#define VS_SHEARWIG_SPAWN_RADIUS 20.0f
+#define VS_CHERRY_SPAWN_RANDOM_OFFSET 20.0f
+
struct Controller;
namespace Game {
@@ -39,6 +57,11 @@ struct VsGameSection : public BaseGameSection {
f32 mDropMaximumDistance; // _04
};
+ enum MenuFlags {
+ VsSection_MenuCaveMoreOpen = 2,
+ VsSection_MenuKanketuOpen = 4,
+ };
+
VsGameSection(JKRHeap*, bool);
virtual ~VsGameSection(); // _08
@@ -103,7 +126,7 @@ struct VsGameSection : public BaseGameSection {
VsGame::State* mCurrentState; // _180
DvdThreadCommand mDvdThreadCommand; // _184
f32 mGhostIconTimers[2]; // _1F0
- u8 mMenuFlags; // _1F8
+ BitFlag mMenuFlags; // _1F8
struct ItemHole::Item* mHole; // _1FC
struct ItemBigFountain::Item* mFountain; // _200
bool mIsMenuRunning; // _204
@@ -134,7 +157,7 @@ struct VsGameSection : public BaseGameSection {
f32 mYellowScore[2]; // _370
f32 mRedBlueScore[2]; // _378
Pellet* mMarbleRedBlue[2]; // _380
- Pellet* mMarbleYellow[7]; // _388
+ Pellet* mMarbleYellow[VS_YELLOW_MARLBE_NUM]; // _388
int mDopeCounts[2][2]; // _3A4
int mPlayer2Cherries; // _3B4
int mPlayer1Cherries; // _3B8
@@ -144,8 +167,7 @@ struct VsGameSection : public BaseGameSection {
f32 mSpawnTimer; // _3C8
int mMaxCherries; // _3CC
Pellet** mCherryArray; // _3D0
- int mMarbleCountP1; // _3D4
- int mMarbleCountP2; // _3D8
+ int mMarbleCount[2]; // _3D4
int mYellowMarbleCounts[2]; // _3DC
};
} // namespace Game
diff --git a/include/Game/gamePlayData.h b/include/Game/gamePlayData.h
index 6a9ad422e..25c68fd94 100644
--- a/include/Game/gamePlayData.h
+++ b/include/Game/gamePlayData.h
@@ -265,7 +265,7 @@ struct PlayData : public CNode {
CaveOtakara()
: mCaveCount(0)
, mOtakaraCountsOld(nullptr)
- , _08(nullptr)
+ , mVisitStatus(nullptr)
{
}
@@ -278,11 +278,11 @@ struct PlayData : public CNode {
if (caves > 0) {
mCaveCount = caves;
mOtakaraCountsOld = new u8[caves];
- _08 = new int[caves];
+ mVisitStatus = new int[caves];
if (mCaveCount > 0) {
for (int j = 0; j < mCaveCount; j++) {
mOtakaraCountsOld[j] = 0;
- _08[j] = 0;
+ mVisitStatus[j] = 0;
}
}
}
@@ -293,7 +293,7 @@ struct PlayData : public CNode {
if (mCaveCount > 0) {
for (int j = 0; j < mCaveCount; j++) {
mOtakaraCountsOld[j] = 0;
- _08[j] = 0;
+ mVisitStatus[j] = 0;
}
}
}
@@ -305,8 +305,8 @@ struct PlayData : public CNode {
// so I guess it's both for some reason.
u8* mOtakaraCountsOld; // _04
- // Pointer to array indexed by cave index.
- int* _08; // _08
+ // Pointer to array indexed by cave index. 0 = not visited, 1 or 2 = visited?
+ int* mVisitStatus; // _08
};
struct LimitGen {
@@ -415,6 +415,7 @@ struct PlayData : public CNode {
bool isCaveFirstReturn(int, ID32&);
bool closeCourse(int);
+ inline void setStoryFlag(StoryFlags flag) { mStoryFlags |= flag; }
inline bool isStoryFlag(StoryFlags flag) { return mStoryFlags & flag; }
inline bool hasGotWhites() { return !isDemoFlag(DEMO_White_Candypop); }
diff --git a/include/Game/gameStat.h b/include/Game/gameStat.h
index 6604cc2cd..776cf323c 100644
--- a/include/Game/gameStat.h
+++ b/include/Game/gameStat.h
@@ -80,7 +80,7 @@ int getZikatuPikmins(int);
extern PikiNaviCounter workPikis;
extern PikiNaviCounter formationPikis;
extern PikiCounter zikatuPikis; // Wild pikis, that you find & whistle to unlock the type
-extern PikiCounter mePikis;
+extern PikiCounter mePikis; // Counter for the number of active Pikmin seeds (PikiHead)
extern PikiCounter alivePikis;
/// @brief Checks for wild Pikmin
diff --git a/include/JSystem/J2D/J2DPicture.h b/include/JSystem/J2D/J2DPicture.h
index dea70c347..358363d1d 100644
--- a/include/JSystem/J2D/J2DPicture.h
+++ b/include/JSystem/J2D/J2DPicture.h
@@ -7,7 +7,7 @@
// Size: 0x168
struct J2DPicture : public J2DPane {
struct TCornerColor {
- TCornerColor() {}
+ TCornerColor() { }
TCornerColor(u32 col1, u32 col2, u32 col3, u32 col4)
{
@@ -142,7 +142,7 @@ struct J2DPicture : public J2DPane {
virtual u8 getUsableTlut(u8 id); // _148
virtual bool isUsed(const ResTIMG* resource); // _4C
virtual bool isUsed(const ResFONT* resource) { return J2DPane::isUsed(resource); } // _50 (weak)
- virtual void rewriteAlpha() {} // _58 (weak)
+ virtual void rewriteAlpha() { } // _58 (weak)
void initinfo();
void private_readStream(J2DPane* parent, JSURandomInputStream* input, JKRArchive* arc);
diff --git a/include/JSystem/JAudio/JAI/JAISound.h b/include/JSystem/JAudio/JAI/JAISound.h
index 79b2c7258..97f5f3c1d 100644
--- a/include/JSystem/JAudio/JAI/JAISound.h
+++ b/include/JSystem/JAudio/JAI/JAISound.h
@@ -145,7 +145,7 @@ struct JAISound : public JSULink {
u8 _17; // _17
u8 _18; // _18
u8 mDistanceParameterMoveTime; // _19
- u8 _1A; // _1A
+ u8 mIsPlayingWithActor; // _1A
u8 _1B; // _1B
s16 mAdjustPriority; // _1C
u32 mSoundID; // _20
diff --git a/include/JSystem/JAudio/JAS/JASTrack.h b/include/JSystem/JAudio/JAS/JASTrack.h
index 9f7436643..e55fcce6d 100644
--- a/include/JSystem/JAudio/JAS/JASTrack.h
+++ b/include/JSystem/JAudio/JAS/JASTrack.h
@@ -226,7 +226,7 @@ struct JASTrack : public JSUList {
};
union TimedParam_ {
- TimedParam_() {}
+ TimedParam_() { }
AInnerParam_ mInnerParam; // get individual params by member name
MoveParam_ mMoveParams[TIMED_Count]; // get individual params by index
diff --git a/include/P2JME/Movie.h b/include/P2JME/Movie.h
index 5c82db49d..3912255cf 100644
--- a/include/P2JME/Movie.h
+++ b/include/P2JME/Movie.h
@@ -86,7 +86,7 @@ struct PodIconScreen : P2DScreen::Mgr_tuning {
mMomentum = Vector3f(1.0f, randFloat(), 0.0f);
mMomentum.normalise();
mPosition = Vector3f(0.0f);
- Game::playData->mStoryFlags& Game::STORY_DebtPaid ? setXY(mInitialPos.x - 250.0f, mInitialPos.y - 25.0f)
+ Game::playData->isStoryFlag(Game::STORY_DebtPaid) ? setXY(mInitialPos.x - 250.0f, mInitialPos.y - 25.0f)
: setXY(mInitialPos.x - 250.0f, mInitialPos.y - 10.0f);
// mIsVisible = true; // should be here, but we are reaching limits of inline complexity
mState = 0;
diff --git a/include/PSM/Se.h b/include/PSM/Se.h
index ee1512771..0ec7dbdb2 100644
--- a/include/PSM/Se.h
+++ b/include/PSM/Se.h
@@ -104,7 +104,7 @@ struct SeSound : public JAISe {
inline SeSound()
: mPerspInfo()
, mPlayerNum(0)
- , _4A0(1.0f)
+ , mDistanceModifier(1.0f)
{
}
@@ -127,7 +127,7 @@ struct SeSound : public JAISe {
// _00-_484 = JAISe
PSGame::SoundTable::SePerspInfo mPerspInfo; // _484
u8 mPlayerNum; // _49C
- f32 _4A0; // _4A0
+ f32 mDistanceModifier; // _4A0
static f32 cDol_0Rad;
static f32 cDol_HalfRad;
diff --git a/include/kh/khFinalResult.h b/include/kh/khFinalResult.h
index 5ce5823ed..b0d2c2f3a 100644
--- a/include/kh/khFinalResult.h
+++ b/include/kh/khFinalResult.h
@@ -58,7 +58,10 @@ struct ObjFinalResult : public ::Screen::ObjBase {
enum ObjState { StatusNormal, StatusScrollUp, StatusScrollDown, StatusForceScroll };
- enum ObjFlag { SaveOpen = 4 };
+ enum ObjFlag {
+ FinalResult_SaveOpen = 4,
+ FinalResult_NeedScrollSe = 8,
+ };
virtual ~ObjFinalResult() { } // _08 (weak)
virtual void doCreate(JKRArchive*); // _4C
@@ -124,16 +127,16 @@ struct ObjFinalResult : public ::Screen::ObjBase {
static struct StaticValues {
inline StaticValues()
{
- mAnimSpeed = 1.0f;
- _04 = 16;
- _08 = 90;
- _1C = 30;
- _1D = 100;
- mFadeAlphaRate = 10;
- _1F = 160;
- _20 = 32;
- _21 = 80;
- _0C = 0.05f;
+ mAnimSpeed = 1.0f;
+ _04 = 16;
+ mAutoScrollInterval = 90;
+ mRandAnimMinInterval = 30;
+ mRandAnimRandRange = 100;
+ mFadeAlphaRate = 10;
+ mSaveOpenGoalAlpha = 160;
+ mSaveOpenAlphaRate = 32;
+ mSelectionAlpha = 80;
+ mColorChangeSpeed = 0.05f;
mColors[0].set(255, 0, 64, 0);
mColors[1].set(255, 255, 0, 0);
mColors[2].set(255, 48, 80, 0);
@@ -141,15 +144,15 @@ struct ObjFinalResult : public ::Screen::ObjBase {
f32 mAnimSpeed; // _00
int _04; // _04
- int _08; // _08
- f32 _0C; // _0C
+ int mAutoScrollInterval; // _08
+ f32 mColorChangeSpeed; // _0C
JUtility::TColor mColors[3]; // _10
- u8 _1C; // _1C
- u8 _1D; // _1D
+ u8 mRandAnimMinInterval; // _1C
+ u8 mRandAnimRandRange; // _1D
u8 mFadeAlphaRate; // _1E
- u8 _1F; // _1F
- u8 _20; // _20
- u8 _21; // _21
+ u8 mSaveOpenGoalAlpha; // _1F
+ u8 mSaveOpenAlphaRate; // _20
+ u8 mSelectionAlpha; // _21
} msVal;
};
diff --git a/include/kh/khLostItem.h b/include/kh/khLostItem.h
index e03382b98..8a109566a 100644
--- a/include/kh/khLostItem.h
+++ b/include/kh/khLostItem.h
@@ -7,8 +7,8 @@
namespace kh {
namespace Screen {
enum LostItemFlags {
- LOSTITEM_Unk1 = 0x1,
- LOSTITEM_Unk2 = 0x2,
+ LOSTITEM_IsActive = 0x1,
+ LOSTITEM_Unk2 = 0x2,
};
struct LostItem {
@@ -16,13 +16,13 @@ struct LostItem {
bool update();
- Rectf mRect; // _00
- f32 _10; // _10
- u32 _14; // _14
- u16 mAngle; // _18
- u16 _1A; // _1A
- u8 mAlpha; // _1C
- u8 mCounter; // _1D
+ Rectf mRect; // _00
+ f32 mFallSpeed; // _10
+ u32 mAlphaChangeSpeed; // _14
+ u16 mAngle; // _18
+ u16 mAngleChangeSpeed; // _1A
+ u8 mAlpha; // _1C
+ u8 mCounter; // _1D
};
struct LostItemMgr {
diff --git a/include/kh/khUtil.h b/include/kh/khUtil.h
index 8f76727ec..cb473277f 100644
--- a/include/kh/khUtil.h
+++ b/include/kh/khUtil.h
@@ -49,7 +49,7 @@ struct khUtilFadePane : public P2DScreen::CallBackNode {
void fadeout();
void set_init_alpha(u8);
- static khUtilFadePane* create(P2DScreen::Mgr*, u64, u8);
+ static khUtilFadePane* create(P2DScreen::Mgr* screen, u64 tag, u8 changeSpeed);
inline void createNode(J2DPane* pane)
{
@@ -68,7 +68,7 @@ struct khUtilFadePane : public P2DScreen::CallBackNode {
khPaneNode mPaneNode; // _1C
int mState; // _28
u8 mCurrentAlpha; // _2C
- u8 mChangeAlpha; // _2D
+ u8 mChangeSpeed; // _2D
};
struct khUtilFadePaneWM : public khUtilFadePane {
diff --git a/include/utilityU.h b/include/utilityU.h
index 2d29da781..7b692f46a 100644
--- a/include/utilityU.h
+++ b/include/utilityU.h
@@ -41,7 +41,7 @@ void PSPauseOff();
void PSPauseOn(u8, u8);
void PSPlayCaveHoleSound(::PSM::Creature*);
void PSSetCurCameraNo(u8);
-void PSSetLastBeedamaDirection(bool, bool);
+void PSSetLastBeedamaDirection(bool isOlimar, bool isOn);
void PSStart2DStream(u32);
void PSStartChallengeTimeUpStream();
JAISound* PSStartEnemyDownSmokeSE(Game::EnemyBase*, f32);
diff --git a/src/JSystem/JAudio/JAI/JAIAnimation.cpp b/src/JSystem/JAudio/JAI/JAIAnimation.cpp
index a517f5ac2..baf5868fc 100644
--- a/src/JSystem/JAudio/JAI/JAIAnimation.cpp
+++ b/src/JSystem/JAudio/JAI/JAIAnimation.cpp
@@ -979,7 +979,7 @@ void JAIAnimeSound::startAnimSound(u32 id, JAISound** handlePtr, JAInter::Actor*
{
JAIBasic::msBasic->startSoundActorT(id, handlePtr, actor, 0, p4);
if (*handlePtr) {
- (*handlePtr)->_1A = 1;
+ (*handlePtr)->mIsPlayingWithActor = true;
}
}
diff --git a/src/JSystem/JAudio/JAI/JAIObject.cpp b/src/JSystem/JAudio/JAI/JAIObject.cpp
index e009283ad..1daa953d2 100644
--- a/src/JSystem/JAudio/JAI/JAIObject.cpp
+++ b/src/JSystem/JAudio/JAI/JAIObject.cpp
@@ -280,7 +280,7 @@ JAISound* JAInter::Object::startSound(u32 id, u32 p2)
JAInter::Actor actor((this == nullptr) ? (void*)vec : (void*)this, vec, nullptr, 0);
JAIBasic::msBasic->startSoundActorT(id, mSounds + handleNo, &actor, p2, 4);
if (mSounds[handleNo]) {
- mSounds[handleNo]->_1A = 1;
+ mSounds[handleNo]->mIsPlayingWithActor = true;
}
return mSounds[handleNo];
@@ -307,15 +307,15 @@ void JAInter::Object::disable()
}
if (handlePtr) {
- Vec* vec = _24;
- handlePtr->_0C.x = vec->x;
- handlePtr->_0C.y = vec->y;
- handlePtr->_0C.z = vec->z;
- handlePtr->mSound = mSounds[i];
- mSounds[i]->_1A = 0;
- mSounds[i]->_3C = &handlePtr->_0C;
- mSounds[i]->mMainSoundPPointer = (void**)&handlePtr->mSound;
- mSounds[i] = nullptr;
+ Vec* vec = _24;
+ handlePtr->_0C.x = vec->x;
+ handlePtr->_0C.y = vec->y;
+ handlePtr->_0C.z = vec->z;
+ handlePtr->mSound = mSounds[i];
+ mSounds[i]->mIsPlayingWithActor = false;
+ mSounds[i]->_3C = &handlePtr->_0C;
+ mSounds[i]->mMainSoundPPointer = (void**)&handlePtr->mSound;
+ mSounds[i] = nullptr;
continue;
}
diff --git a/src/JSystem/JAudio/JAI/JAISeMgr.cpp b/src/JSystem/JAudio/JAI/JAISeMgr.cpp
index 5295bfec9..51ace8d6e 100644
--- a/src/JSystem/JAudio/JAI/JAISeMgr.cpp
+++ b/src/JSystem/JAudio/JAI/JAISeMgr.cpp
@@ -159,7 +159,7 @@ void checkNextFrameSe()
soundObj->mPosition = JAInter::Const::dummyZeroVec;
soundObj->_0C = soundObj->mPosition;
soundObj->mDistance = 0.0f;
- } else if (sound->_1A == 0) {
+ } else if (sound->mIsPlayingWithActor == false) {
soundObj->_0C = soundObj->mPosition;
u8 val3 = sound->_18;
if (val3 == 4) {
diff --git a/src/JSystem/JAudio/JAI/JAISound.cpp b/src/JSystem/JAudio/JAI/JAISound.cpp
index 81039a3ae..7e6b29dae 100644
--- a/src/JSystem/JAudio/JAI/JAISound.cpp
+++ b/src/JSystem/JAudio/JAI/JAISound.cpp
@@ -1314,7 +1314,7 @@ void JAISe::setSeDistanceVolume(u8 moveTime)
void JAISe::setSeDistancePan(u8 moveTime)
{
f32 pan = 0.5f;
- if (!_1A) {
+ if (!mIsPlayingWithActor) {
pan = setDistancePanCommon();
} else if (mCreatureObj) {
pan = static_cast(mCreatureObj)->mPan;
@@ -1488,7 +1488,7 @@ void JAISe::setSeDistanceFir(u8) { }
void JAISe::setSeDistanceDolby(u8 moveTime)
{
f32 dolby = 0.0f;
- if (!_1A) {
+ if (!mIsPlayingWithActor) {
dolby = setDistanceDolbyCommon();
} else if (mCreatureObj) {
dolby = static_cast(mCreatureObj)->mDolby;
@@ -2152,12 +2152,12 @@ void JAISound::initParameter(void* handlePtr, JAInter::Actor* actor, u32 soundID
_3C = nullptr;
_30 = actor->mUnk;
}
- _1A = actor->mFlag.boolView[0];
+ mIsPlayingWithActor = actor->mFlag.boolView[0];
} else {
- mCreatureObj = nullptr;
- _3C = nullptr;
- _1A = 0;
- _30 = 0;
+ mCreatureObj = nullptr;
+ _3C = nullptr;
+ mIsPlayingWithActor = false;
+ _30 = 0;
}
mMainSoundPPointer = (void**)handlePtr;
mFadeCounter = fadeTime;
diff --git a/src/JSystem/JUtility/JUTTexture.cpp b/src/JSystem/JUtility/JUTTexture.cpp
index c5a09d6fa..ab7c080ca 100644
--- a/src/JSystem/JUtility/JUTTexture.cpp
+++ b/src/JSystem/JUtility/JUTTexture.cpp
@@ -30,8 +30,8 @@ JUTTexture::JUTTexture(int sizeX, int sizeY, GXTexFmt textureFormat)
img->mDoEdgeLOD = GX_FALSE;
img->mIsBiasClamp = GX_FALSE;
img->mIsMaxAnisotropy = GX_FALSE;
- img->mMinFilterType = 1;
- img->mMagFilterType = 1;
+ img->mMinFilterType = GX_LINEAR;
+ img->mMagFilterType = GX_LINEAR;
img->mMinLOD = 0;
img->mMaxLOD = 0;
img->mTotalImageCount = 1;
diff --git a/src/plugProjectEbisawaU/ebi2DCallBack.cpp b/src/plugProjectEbisawaU/ebi2DCallBack.cpp
index 4630f3f1c..42e2fcd57 100644
--- a/src/plugProjectEbisawaU/ebi2DCallBack.cpp
+++ b/src/plugProjectEbisawaU/ebi2DCallBack.cpp
@@ -306,8 +306,8 @@ void E2DCallBack_AnmBase::loadAnm(char* path, JKRArchive* archive, s32 frame, s3
mFrameCtrl.mFrame = (s16)frame;
mFrameCtrl.mLoop = (s16)frame;
- if (mAnim->mTotalFrameCount < maxFrame) {
- maxFrame = mAnim->mTotalFrameCount;
+ if (mAnim->getFrameMax() < maxFrame) {
+ maxFrame = mAnim->getFrameMax();
}
mFrameCtrl.mEnd = maxFrame;
}
@@ -329,8 +329,8 @@ void E2DCallBack_AnmBase::play(f32 speed, J3DAnmAttr attr, bool doPlayFromStart)
mFrameCtrl.mFrame = mFrameCtrl.mStart;
}
- mAnim->mCurrentFrame = mFrameCtrl.mFrame;
- mIsFinished = false;
+ mAnim->setFrame(mFrameCtrl.mFrame);
+ mIsFinished = false;
}
/**
@@ -349,8 +349,8 @@ void E2DCallBack_AnmBase::playBack(f32 speed, bool doPlayFromEnd)
mFrameCtrl.mFrame = mFrameCtrl.mEnd;
}
- mAnim->mCurrentFrame = mFrameCtrl.mFrame;
- mIsFinished = false;
+ mAnim->setFrame(mFrameCtrl.mFrame);
+ mIsFinished = false;
}
/**
@@ -378,8 +378,8 @@ void E2DCallBack_AnmBase::disconnect()
*/
void E2DCallBack_AnmBase::setStartFrame()
{
- mFrameCtrl.mFrame = mFrameCtrl.mStart;
- mAnim->mCurrentFrame = mFrameCtrl.mFrame;
+ mFrameCtrl.mFrame = mFrameCtrl.mStart;
+ mAnim->setFrame(mFrameCtrl.mFrame);
}
/**
@@ -388,8 +388,8 @@ void E2DCallBack_AnmBase::setStartFrame()
*/
void E2DCallBack_AnmBase::setEndFrame()
{
- mFrameCtrl.mFrame = mFrameCtrl.mEnd;
- mAnim->mCurrentFrame = mFrameCtrl.mFrame;
+ mFrameCtrl.mFrame = mFrameCtrl.mEnd;
+ mAnim->setFrame(mFrameCtrl.mFrame);
}
/**
@@ -398,10 +398,10 @@ void E2DCallBack_AnmBase::setEndFrame()
*/
void E2DCallBack_AnmBase::setRandFrame()
{
- f32 startFrame = mFrameCtrl.mStart;
- f32 endFrame = mFrameCtrl.mEnd;
- mFrameCtrl.mFrame = randEbisawaFloat() * (endFrame - startFrame) + startFrame;
- mAnim->mCurrentFrame = mFrameCtrl.mFrame;
+ f32 startFrame = mFrameCtrl.mStart;
+ f32 endFrame = mFrameCtrl.mEnd;
+ mFrameCtrl.mFrame = randEbisawaFloat() * (endFrame - startFrame) + startFrame;
+ mAnim->setFrame(mFrameCtrl.mFrame);
}
/**
@@ -423,7 +423,7 @@ void E2DCallBack_AnmBase::do_update()
{
if (mPane) {
mFrameCtrl.update();
- mAnim->mCurrentFrame = mFrameCtrl.mFrame;
+ mAnim->setFrame(mFrameCtrl.mFrame);
}
if (mFrameCtrl.mState & 1) {
mIsFinished = true;
diff --git a/src/plugProjectHikinoU/PSAutoBgm.cpp b/src/plugProjectHikinoU/PSAutoBgm.cpp
index 40b15f577..d621c0833 100644
--- a/src/plugProjectHikinoU/PSAutoBgm.cpp
+++ b/src/plugProjectHikinoU/PSAutoBgm.cpp
@@ -40,7 +40,7 @@ Conductor::Conductor(AutoBgm* autoBgm, int p2)
* @note Address: 0x80339024
* @note Size: 0x290
*/
-Conductor::~Conductor() {}
+Conductor::~Conductor() { }
/**
* @note Address: N/A
@@ -211,7 +211,7 @@ void Track::afterGetFromFree()
* @note Address: 0x803397D8
* @note Size: 0x3DC
*/
-Track::~Track() {}
+Track::~Track() { }
/**
* @note Address: 0x80339BB4
diff --git a/src/plugProjectHikinoU/PSGame.cpp b/src/plugProjectHikinoU/PSGame.cpp
index c97eb502f..3046c8846 100644
--- a/src/plugProjectHikinoU/PSGame.cpp
+++ b/src/plugProjectHikinoU/PSGame.cpp
@@ -596,7 +596,7 @@ void PikScene::getJumpMainBgm()
*/
PSSystem::Scene* PikSceneMgr::newAndSetGlobalScene()
{
- JUT_ASSERTLINE(1002, !mScenes, "2�d�ɃO���[�o���V�[�����쐬���悤�Ƃ���"); // 'I tried to create a global scene twice'
+ JUT_ASSERTLINE(1002, !mScenes, "2重にグローバルシーンを作成しようとした"); // 'I tried to create a global scene twice'
SceneInfo info;
info.mSceneType = SceneInfo::SCENE_NULL;
info.mCameras = 0;
@@ -637,11 +637,11 @@ PSSystem::Scene* PikSceneMgr::newAndSetCurrentScene(SceneInfo& info)
{
u8 sceneType = info.getSceneType();
P2ASSERTLINE(1093, sceneType != SceneInfo::SCENE_NULL);
- JUT_ASSERTLINE(1094, sceneType < SceneInfo::SCENE_COUNT, "scene no���s��"); // 'scene no is invalid'
+ JUT_ASSERTLINE(1094, sceneType < SceneInfo::SCENE_COUNT, "scene noが不正"); // 'scene no is invalid'
checkScene();
- JUT_ASSERTLINE(1095, !mScenes->mChild, "�O���mCurrentScene�̌㏈�����s��"); // 'previous mCurrentScene post-processing is invalid
+ JUT_ASSERTLINE(1095, !mScenes->mChild, "前回のmCurrentSceneの後処理が不正"); // 'previous mCurrentScene post-processing is invalid
info.setStageCamera();
@@ -2073,7 +2073,7 @@ u16 seqCpuSync(JASTrack* track, u16 command)
P2ASSERTLINE(1887, Rappa::getRappa(1));
return Rappa::getRappa(1)->syncCpu_WaitChk(track);
case 0x5000:
- return Game::playData->mStoryFlags & Game::STORY_DebtPaid;
+ return Game::playData->isStoryFlag(Game::STORY_DebtPaid);
case 0:
u16 ret = 0;
u8 com = command;
diff --git a/src/plugProjectKandoU/aiBore.cpp b/src/plugProjectKandoU/aiBore.cpp
index 35bbfca35..2b0a4bce5 100644
--- a/src/plugProjectKandoU/aiBore.cpp
+++ b/src/plugProjectKandoU/aiBore.cpp
@@ -138,7 +138,7 @@ void ActRest::init(ActionArg* arg)
{
mState = REST_Start;
sitDown();
- mTimer = randFloat() * 4.0f + 5.0f; // 4-9s
+ mTimer = randFloat() * 4.0f + 5.0f; // 5-9s
mFlag.clear();
mParent->mAnimSpeed = 30.0f;
}
diff --git a/src/plugProjectKandoU/baseGameSection.cpp b/src/plugProjectKandoU/baseGameSection.cpp
index e6a0fb42e..a58766e62 100644
--- a/src/plugProjectKandoU/baseGameSection.cpp
+++ b/src/plugProjectKandoU/baseGameSection.cpp
@@ -257,7 +257,7 @@ void BaseGameSection::init()
mXfbBoundsX = 0;
onInit();
sys->heapStatusEnd("baseGameSection::init");
- mTreasureGetState = false;
+ mTreasureGetState = 0;
}
/**
@@ -512,7 +512,7 @@ void BaseGameSection::initJ3D()
Sys::DrawBuffer::CreateArg drawArg;
drawArg.mSortType = J3DDrawBuffer::J3DSORT_Mat;
drawArg.mDrawType = J3DDrawBuffer::J3DDRAW_Head;
- drawArg.mFlags.typeView |= 1;
+ drawArg.mFlags.set(Sys::DrawBuffer::DRAWBUFF_Unk1);
j3dStuff(mTransparentDrawBuffer, drawArg, false);
}
@@ -817,28 +817,28 @@ void BaseGameSection::initGenerators()
CI_LOOP(iNavi) { naviCount++; }
switch (naviCount) {
case 0: {
- bool olimarAlive = false;
- Vector3f vec_0x1c30 = Vector3f(0.0f);
+ bool olimarAlive = false;
+ Vector3f velocity = Vector3f(0.0f);
f32 mapRotation = mapMgr->getMapRotation();
- Vector3f vec_0x1c24(-40.0f, 0.0f, 2.0f);
+ Vector3f position(-40.0f, 0.0f, 2.0f);
if (gameSystem->isVersusMode()) {
Onyon* redOnyon = ItemOnyon::mgr->getOnyon(Red);
P2ASSERTLINE(2739, redOnyon);
- vec_0x1c24 = redOnyon->getPosition();
+ position = redOnyon->getPosition();
} else {
if (!mapMgr->getDemoMatrix()) {
- mapMgr->getStartPosition(vec_0x1c24, 0);
- vec_0x1c24.y = mapMgr->getMinY(vec_0x1c24) + 8.5f;
- vec_0x1c24.x += -4.526f;
- vec_0x1c24.z += 7.453f;
+ mapMgr->getStartPosition(position, 0);
+ position.y = mapMgr->getMinY(position) + 8.5f;
+ position.x += -4.526f;
+ position.z += 7.453f;
} else {
Matrixf* demoMtx = mapMgr->getDemoMatrix();
Vector3f vec_0x1c78;
- PSMTXMultVec((PSQuaternion*)demoMtx, (Vec*)&vec_0x1c24, (Vec*)&vec_0x1c78);
- vec_0x1c24 = vec_0x1c78;
- vec_0x1c24.y = mapMgr->getMinY(vec_0x1c24);
- vec_0x1c30 = Vector3f(0.0f);
+ PSMTXMultVec((PSQuaternion*)demoMtx, (Vec*)&position, (Vec*)&vec_0x1c78);
+ position = vec_0x1c78;
+ position.y = mapMgr->getMinY(position);
+ velocity.set(0.0f);
}
}
Navi* olimar = naviMgr->birth();
@@ -846,8 +846,8 @@ void BaseGameSection::initGenerators()
olimar->mFaceDir = roundAng(mapRotation);
olimar->setCamera(mOlimarCamera);
olimar->setController(mControllerP1);
- olimar->setPosition(vec_0x1c24, false);
- olimar->setVelocity(vec_0x1c30);
+ olimar->setPosition(position, false);
+ olimar->setVelocity(velocity);
if (playData->mDeadNaviID & 1) {
@@ -858,24 +858,24 @@ void BaseGameSection::initGenerators()
}
mapRotation = mapMgr->getMapRotation();
- vec_0x1c24 = Vector3f(-60.0f, 0.0f, -10.0f);
+ position = Vector3f(-60.0f, 0.0f, -10.0f);
if (gameSystem->isVersusMode()) {
Onyon* blueOnyon = ItemOnyon::mgr->getOnyon(Blue);
P2ASSERTLINE(2791, blueOnyon);
- vec_0x1c24 = blueOnyon->getPosition();
+ position = blueOnyon->getPosition();
} else {
if (!mapMgr->getDemoMatrix()) {
- mapMgr->getStartPosition(vec_0x1c24, 0);
- vec_0x1c24.y = mapMgr->getMinY(vec_0x1c24) + 8.5f;
- vec_0x1c24.x += 18.082f;
- vec_0x1c24.z += -11.428f;
+ mapMgr->getStartPosition(position, 0);
+ position.y = mapMgr->getMinY(position) + 8.5f;
+ position.x += 18.082f;
+ position.z += -11.428f;
} else {
Matrixf* demoMtx = mapMgr->getDemoMatrix();
Vector3f vec_0x1c78;
- PSMTXMultVec((PSQuaternion*)demoMtx, (Vec*)&vec_0x1c24, (Vec*)&vec_0x1c78);
- vec_0x1c24 = vec_0x1c78;
- vec_0x1c24.y = mapMgr->getMinY(vec_0x1c24);
- vec_0x1c30 = Vector3f(0.0f);
+ PSMTXMultVec((PSQuaternion*)demoMtx, (Vec*)&position, (Vec*)&vec_0x1c78);
+ position = vec_0x1c78;
+ position.y = mapMgr->getMinY(position);
+ velocity = Vector3f(0.0f);
}
}
Navi* louie = naviMgr->birth();
@@ -885,8 +885,8 @@ void BaseGameSection::initGenerators()
louie->setController(mControllerP2);
louie->mFaceDir = roundAng(mapRotation);
- louie->setPosition(vec_0x1c24, false);
- louie->setVelocity(vec_0x1c30);
+ louie->setPosition(position, false);
+ louie->setVelocity(velocity);
if (!(playData->mDeadNaviID >> 1 & 1)) {
louie->mHealth = playData->mNaviLifeMax[1];
}
diff --git a/src/plugProjectKandoU/collinfo.cpp b/src/plugProjectKandoU/collinfo.cpp
index a87f780d7..5f26e946a 100644
--- a/src/plugProjectKandoU/collinfo.cpp
+++ b/src/plugProjectKandoU/collinfo.cpp
@@ -182,6 +182,7 @@ Platform* PlatAttacher::getPlatform(int i)
AgePlatform::AgePlatform()
{
mTriDivider = new Sys::OBBTree[2]; // something here has to generate four weak dtors
+ new Sys::GridDivider;
}
/**
@@ -244,7 +245,6 @@ void CollTree::release()
* @note Address: 0x801341F8
* @note Size: 0x348
*/
-// matches so long as kill isn't in the header........
void CollTree::releaseRec(CollPart* part)
{
CollPart* next = part->getNext();
@@ -1687,10 +1687,7 @@ CollPartFactory* CollPartFactory::load(char* path)
return nullptr;
} else {
RamStream input(data, -1);
- input.mMode = STREAM_MODE_TEXT;
- if (input.mMode == STREAM_MODE_TEXT) {
- input.mTabCount = 0;
- }
+ input.setMode(STREAM_MODE_TEXT, 1);
factory = new CollPartFactory(input);
delete[] data;
}
diff --git a/src/plugProjectKandoU/gamePelletList.cpp b/src/plugProjectKandoU/gamePelletList.cpp
index ace7145c9..8d843004f 100644
--- a/src/plugProjectKandoU/gamePelletList.cpp
+++ b/src/plugProjectKandoU/gamePelletList.cpp
@@ -5,7 +5,6 @@
#include "System.h"
static const char className[] = "gamePelletList";
-#define CONFIG_COUNT 5 // should match mConfigCnt
namespace Game {
namespace PelletList {
@@ -18,7 +17,7 @@ Mgr* Mgr::mInstance;
*/
PelletConfigList* Mgr::getConfigList(cKind kind)
{
- P2ASSERTBOUNDSLINE(16, 0, kind, CONFIG_COUNT);
+ P2ASSERTBOUNDSLINE(16, 0, kind, PLK_Size);
return &mInstance->mConfigList[kind];
}
@@ -38,7 +37,7 @@ PelletConfig* Mgr::getConfigAndKind(char* config, cKind& kind)
bool isValid;
cKind kindCopy;
- for (int i = 0; i < CONFIG_COUNT; i++) {
+ for (int i = 0; i < PLK_Size; i++) {
kind = (cKind)i;
PelletConfig* list = getConfigList(kind)->getPelletConfig(config);
if (list) {
@@ -55,7 +54,7 @@ PelletConfig* Mgr::getConfigAndKind(char* config, cKind& kind)
*/
Mgr::Mgr()
{
- mConfigList = new PelletConfigList[CONFIG_COUNT];
+ mConfigList = new PelletConfigList[PLK_Size];
loadResource();
}
@@ -101,9 +100,9 @@ void Mgr::loadResource()
JUT_ASSERTLINE(154, archive, "no pelletlist.szs\n");
- const char* configs[CONFIG_COUNT]
+ const char* configs[PLK_Size]
= { "numberpellet_config.txt", "carcass_config.txt", "fruit_config.txt", "otakara_config.txt", "item_config.txt" };
- for (int i = 0; i < CONFIG_COUNT; i++) {
+ for (int i = 0; i < PLK_Size; i++) {
void* data = archive->getResource(configs[i]);
JUT_ASSERTLINE(168, data, "no config file [%s]\n", configs[i]);
RamStream stream(data, -1);
diff --git a/src/plugProjectKandoU/gamePlayCommonData.cpp b/src/plugProjectKandoU/gamePlayCommonData.cpp
index 1fcb7d1c4..6c467d6cb 100644
--- a/src/plugProjectKandoU/gamePlayCommonData.cpp
+++ b/src/plugProjectKandoU/gamePlayCommonData.cpp
@@ -5,7 +5,6 @@
#include "Game/gamePlayData.h"
#include "P2Macros.h"
#include "System.h"
-#include "types.h"
namespace Game {
@@ -14,16 +13,14 @@ namespace Game {
* @note Size: 0xFC
*/
PlayCommonData::PlayCommonData()
- : mChallengeFlags()
- , mChallengeData()
{
- mHiScoreClear = new Highscore*[16];
- mHiScoreComplete = new Highscore*[16];
- for (int i = 0; i < 0x10; i++) {
+ mHiScoreClear = new Highscore*[GAME_HIGHSCORE_COUNT];
+ mHiScoreComplete = new Highscore*[GAME_HIGHSCORE_COUNT];
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
mHiScoreClear[i] = new Lowscore();
mHiScoreComplete[i] = new Lowscore();
- mHiScoreClear[i]->allocate(3);
- mHiScoreComplete[i]->allocate(3);
+ mHiScoreClear[i]->allocate(GAME_HIGHSCORE_RANK_NUM);
+ mHiScoreComplete[i]->allocate(GAME_HIGHSCORE_RANK_NUM);
}
reset();
}
@@ -36,7 +33,7 @@ void PlayCommonData::reset()
{
mChallengeFlags.clear();
mChallengeData.reset();
- for (int i = 0; i < 0x10; i++) {
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
mHiScoreClear[i]->clear();
mHiScoreComplete[i]->clear();
}
@@ -67,7 +64,7 @@ void PlayCommonData::write(Stream& output)
{
output.writeInt(2);
output.writeBytes(&mChallengeFlags.typeView, 1);
- for (int i = 0; i < 0x10; i++) {
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
mHiScoreClear[i]->write(output);
mHiScoreComplete[i]->write(output);
}
@@ -85,13 +82,13 @@ void PlayCommonData::read(Stream& stream)
u8 fileByte = stream.readByte();
mChallengeFlags.typeView = fileByte;
if (fileInt >= 2) {
- for (int i = 0; i < 0x10; i++) {
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
mHiScoreClear[i]->read(stream);
mHiScoreComplete[i]->read(stream);
}
} else {
if (fileInt <= 1) {
- for (int i = 0; i < 0xf; i++) {
+ for (int i = 0; i < (GAME_HIGHSCORE_COUNT - 1); i++) {
mHiScoreClear[i]->read(stream);
mHiScoreComplete[i]->read(stream);
}
@@ -106,11 +103,7 @@ void PlayCommonData::read(Stream& stream)
*/
Highscore* PlayCommonData::getHighscore_clear(int index)
{
- bool isValidIndex = false;
- if (0 <= index && index < 0x10) {
- isValidIndex = true;
- }
- P2ASSERTLINE(155, isValidIndex);
+ P2ASSERTBOUNDSLINE(155, 0, index, GAME_HIGHSCORE_COUNT);
return mHiScoreClear[index];
}
@@ -120,11 +113,7 @@ Highscore* PlayCommonData::getHighscore_clear(int index)
*/
Highscore* PlayCommonData::getHighscore_complete(int index)
{
- bool isValidIndex = false;
- if (0 <= index && index < 0x10) {
- isValidIndex = true;
- }
- P2ASSERTLINE(162, isValidIndex);
+ P2ASSERTBOUNDSLINE(162, 0, index, GAME_HIGHSCORE_COUNT);
return mHiScoreComplete[index];
}
@@ -155,7 +144,7 @@ void PlayCommonData::entryHighscores_common(Game::Highscore** highscores, int ne
Highscore* startHighScore = highscores[0];
totals[0] = newTotal;
scores[0] = startHighScore->entryScore(newTotal);
- for (int i = 0; i < 8; i++) {
+ for (int i = 0; i < DeathCounter::COD_SourceCount + 1; i++) {
int j = i + 1;
Highscore* currHighScore = highscores[j];
totals[j] = DeathMgr::get_total(i);
@@ -168,12 +157,12 @@ void PlayCommonData::entryHighscores_common(Game::Highscore** highscores, int ne
scores[j] = currHighScore->entryScore(totals[j]);
}
- Highscore* finalHighScore = highscores[15];
+ Highscore* timeScore = highscores[15];
CommonSaveData::Mgr* playCommonData = sys->getCommonDataMgr();
int timeTotal = playData->calcPlayMinutes();
timeTotal += playCommonData->mTime;
totals[15] = timeTotal;
- scores[15] = finalHighScore->entryScore(timeTotal);
+ scores[15] = timeScore->entryScore(timeTotal);
}
/**
@@ -391,11 +380,7 @@ void PlayCommonData::challenge_setKunsho(int index)
Highscore* PlayCommonData::challenge_getHighscore(int courseIndex, int scoreType)
{
PlayChallengeGameData::CourseState* state = mChallengeData.getState(courseIndex);
- bool isValidScoreType = false;
- if (0 <= scoreType && scoreType <= 1) {
- isValidScoreType = true;
- }
- P2ASSERTLINE(401, isValidScoreType);
+ P2ASSERTBOUNDSINCLUSIVELINE(401, 0, scoreType, 1);
return &state->mHighscores[scoreType];
}
diff --git a/src/plugProjectKandoU/gamePlayData.cpp b/src/plugProjectKandoU/gamePlayData.cpp
index 7808eb424..6103d4565 100644
--- a/src/plugProjectKandoU/gamePlayData.cpp
+++ b/src/plugProjectKandoU/gamePlayData.cpp
@@ -1100,7 +1100,7 @@ bool PlayData::isCaveFirstTime(int courseIndex, ID32& caveID)
int id = info->getCaveIndex_FromID(caveID);
if (id != -1) {
if (id >= 0 && id < ota->mCaveCount) {
- return ota->_08[id] == 0;
+ return ota->mVisitStatus[id] == 0;
}
return false;
}
@@ -1128,11 +1128,11 @@ void PlayData::setCaveVisit(int courseIndex, ID32& caveID)
CaveOtakara* ota = &mCaveOtakara[courseIndex];
int id = info->getCaveIndex_FromID(caveID);
if (id != -1) {
- if (ota->_08[id] == 0) {
- ota->_08[id] = 1;
+ if (ota->mVisitStatus[id] == 0) {
+ ota->mVisitStatus[id] = 1;
return;
}
- ota->_08[id] = 2;
+ ota->mVisitStatus[id] = 2;
return;
}
}
@@ -1257,7 +1257,7 @@ void PlayData::CaveOtakara::write(Stream& output)
output.writeByte(mOtakaraCountsOld[i]);
output.textWriteText("# 個数\r\n");
output.textWriteTab(output.mTabCount);
- output.writeByte(_08[i]);
+ output.writeByte(mVisitStatus[i]);
output.textWriteText("# 状態\r\n");
}
}
@@ -1273,7 +1273,7 @@ void PlayData::CaveOtakara::read(Stream& input)
JUT_ASSERTLINE(1797, existingCaveCount == mCaveCount, "セーブしたときと洞窟の数があいません\n");
for (int i = 0; i < mCaveCount; i++) {
mOtakaraCountsOld[i] = input.readByte();
- _08[i] = input.readByte();
+ mVisitStatus[i] = input.readByte();
}
}
@@ -1504,7 +1504,7 @@ bool PlayData::doneWorldMapEffect()
data->mCaveCount = datanew->mCaveCount;
for (int j = 0; j < datanew->mCaveCount; j++) {
data->mOtakaraCountsOld[j] = datanew->mOtakaraCountsOld[j];
- data->_08[j] = datanew->_08[j];
+ data->mVisitStatus[j] = datanew->mVisitStatus[j];
}
}
}
@@ -1559,7 +1559,7 @@ bool PlayData::isCaveFirstTime_Old(int courseIndex, ID32& caveID)
int caveIndex = info->getCaveIndex_FromID(caveID);
if (caveIndex != -1) {
if (0 <= caveIndex && caveIndex < otakara->mCaveCount) {
- return otakara->_08[caveIndex] == 0;
+ return otakara->mVisitStatus[caveIndex] == 0;
}
return false;
}
diff --git a/src/plugProjectKandoU/interactNavi.cpp b/src/plugProjectKandoU/interactNavi.cpp
index 32107f193..30c0200e8 100644
--- a/src/plugProjectKandoU/interactNavi.cpp
+++ b/src/plugProjectKandoU/interactNavi.cpp
@@ -251,12 +251,12 @@ bool InteractFue::actNavi(Game::Navi* navi)
NaviFollowArg followArg(mIsNewToParty);
navi->transit(NSID_Follow, &followArg);
- Navi* otherNavi = naviMgr->getAt(1 - navi->mNaviIndex);
+ Navi* otherNavi = naviMgr->getAt(GET_OTHER_NAVI(navi));
InteractFue fue(otherNavi, true, true); // DO combine parties, is new to party
Iterator cellIt((Container*)navi->mCPlateMgr);
- Creature* entities[110];
+ Creature* entities[MAX_PIKI_COUNT + 10];
int index = 0;
CI_LOOP(cellIt) { entities[index++] = *cellIt; }
diff --git a/src/plugProjectKandoU/itemBarrel.cpp b/src/plugProjectKandoU/itemBarrel.cpp
index 678292dab..6aca91358 100644
--- a/src/plugProjectKandoU/itemBarrel.cpp
+++ b/src/plugProjectKandoU/itemBarrel.cpp
@@ -32,9 +32,9 @@ Mgr* mgr;
void FSM::init(Item*)
{
create(BARREL_StateCount);
- registerState(new NormalState());
- registerState(new DamagedState());
- registerState(new DeadState());
+ registerState(new NormalState);
+ registerState(new DamagedState);
+ registerState(new DeadState);
}
/**
@@ -292,9 +292,8 @@ f32 Item::getWorkRadius()
if (isAlive()) {
mCollTree->getBoundingSphere(bounds);
return bounds.mRadius;
- } else {
- return 0.0f;
}
+ return 0.0f;
}
/**
@@ -331,13 +330,13 @@ bool Item::interactAttack(InteractAttack& interaction)
if (mCurrentState) {
mCurrentState->onDamage(this, interaction.mDamage);
switch (mSoundEvent.event()) {
- case 1:
+ case TSE_Active:
P2ASSERTLINE(361, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventStart();
break;
- case 2:
+ case TSE_ApplyTransition:
break;
- case 3:
+ case TSE_Apply:
P2ASSERTLINE(368, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventRestart();
break;
@@ -376,7 +375,7 @@ Mgr::Mgr()
*/
BaseItem* Mgr::birth()
{
- Item* item = new Item();
+ Item* item = new Item;
entry(item);
return item;
}
@@ -401,7 +400,7 @@ BaseItem* Mgr::generatorBirth(Vector3f& position, Vector3f& p2, GenItemParm* par
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("model.bmd", 0, 0x20000);
+ loadBmd("model.bmd", 0, J3DMODEL_CreateNewDL);
mModelData[0]->newSharedDisplayList(0x40000);
mModelData[0]->makeSharedDL();
JKRArchive* arc = openTextArc("texts.szs");
diff --git a/src/plugProjectKandoU/itemBigFountain.cpp b/src/plugProjectKandoU/itemBigFountain.cpp
index 6ab7a6d81..372dbb54b 100644
--- a/src/plugProjectKandoU/itemBigFountain.cpp
+++ b/src/plugProjectKandoU/itemBigFountain.cpp
@@ -36,7 +36,7 @@ void FSM::init(Item* item)
void AppearState::init(Item* item, StateArg* arg)
{
item->mBuryDepth = 45.0f;
- _10 = 0.0f;
+ mAppearTimer = 0.0f;
item->setAlive(true);
}
@@ -46,9 +46,9 @@ void AppearState::init(Item* item, StateArg* arg)
*/
void AppearState::exec(Item* item)
{
- _10 += sys->mDeltaTime;
+ mAppearTimer += sys->mDeltaTime;
- f32 timeRemaining = 1.0f - 0.8333333f * _10;
+ f32 timeRemaining = 1.0f - 0.8333333f * mAppearTimer;
if (timeRemaining <= 0.0f) {
timeRemaining = 0.0f;
@@ -437,11 +437,11 @@ bool Item::interactAttack(InteractAttack& attack)
if (mCurrentState) {
mCurrentState->onDamage(this, attack.mDamage);
switch (mSoundEvent.event()) {
- case 1:
+ case TSE_Active:
P2ASSERTLINE(559, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventStart();
break;
- case 3:
+ case TSE_Apply:
P2ASSERTLINE(566, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventRestart();
break;
@@ -498,7 +498,7 @@ Mgr::Mgr()
setModelSize(1);
mObjectPathComponent = "user/Kando/objects/kanketusen";
mItemName = "帰還間欠泉"; // 'return geyser'
- mParms = new FountainParms();
+ mParms = new FountainParms;
void* data = JKRDvdRipper::loadToMainRAM("user/Abe/item/fountainParms.txt", nullptr, Switch_0, 0, nullptr,
JKRDvdRipper::ALLOC_DIR_BOTTOM, 0, nullptr, nullptr);
@@ -517,7 +517,7 @@ Mgr::Mgr()
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("kanketusen.bmd", 0, 0x20020000);
+ loadBmd("kanketusen.bmd", 0, J3DMODEL_Unk30 | J3DMODEL_CreateNewDL);
mModelData[0]->newSharedDisplayList(0x40000);
mModelData[0]->makeSharedDL();
diff --git a/src/plugProjectKandoU/itemBridge.cpp b/src/plugProjectKandoU/itemBridge.cpp
index 6ff592a40..83c229819 100644
--- a/src/plugProjectKandoU/itemBridge.cpp
+++ b/src/plugProjectKandoU/itemBridge.cpp
@@ -1063,11 +1063,11 @@ f32 Item::getWorkDistance(Sys::Sphere& sphere)
bool Item::interactAttack(InteractAttack& attack)
{
switch (mSoundEvent.event()) {
- case 1:
+ case TSE_Active:
P2ASSERTLINE(825, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventStart();
break;
- case 3:
+ case TSE_Apply:
P2ASSERTLINE(832, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventRestart();
break;
@@ -1251,15 +1251,15 @@ void Mgr::onLoadResources()
mObjectPathComponent = "user/Kando/bridge/s_bridge";
loadArchive("arc.szs");
- loadBmd("s_bridge.bmd", BRIDGETYPE_Short, 0x20000);
+ loadBmd("s_bridge.bmd", BRIDGETYPE_Short, J3DMODEL_CreateNewDL);
mObjectPathComponent = "user/Kando/bridge/slope_u";
loadArchive("arc.szs");
- loadBmd("slope_u.bmd", BRIDGETYPE_Sloped, 0x20000);
+ loadBmd("slope_u.bmd", BRIDGETYPE_Sloped, J3DMODEL_CreateNewDL);
mObjectPathComponent = "user/Kando/bridge/l_bridge";
loadArchive("arc.szs");
- loadBmd("l_bridge.bmd", BRIDGETYPE_Long, 0x20000);
+ loadBmd("l_bridge.bmd", BRIDGETYPE_Long, J3DMODEL_CreateNewDL);
for (int i = 0; i < BRIDGETYPE_COUNT; i++) {
mModelData[i]->newSharedDisplayList(0x40000);
diff --git a/src/plugProjectKandoU/itemCave.cpp b/src/plugProjectKandoU/itemCave.cpp
index dd8f66e59..947dd2166 100644
--- a/src/plugProjectKandoU/itemCave.cpp
+++ b/src/plugProjectKandoU/itemCave.cpp
@@ -754,7 +754,7 @@ Mgr::Mgr()
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("dungeon_hole.bmd", 0, 0x20000);
+ loadBmd("dungeon_hole.bmd", 0, J3DMODEL_CreateNewDL);
JKRArchive* arc = openTextArc("texts.szs");
mPlatformA = loadPlatform(arc, "cap_platform.bin");
mPlatformB = loadPlatform(arc, "side_platform.bin");
diff --git a/src/plugProjectKandoU/itemDownFloor.cpp b/src/plugProjectKandoU/itemDownFloor.cpp
index df8666373..3dd1163e9 100644
--- a/src/plugProjectKandoU/itemDownFloor.cpp
+++ b/src/plugProjectKandoU/itemDownFloor.cpp
@@ -422,11 +422,11 @@ void Item::platCallback(PlatEvent& event)
if (mDownFloorType == DFTYPE_PaperBag && mWeightBuffer > 0) {
switch (mSoundEvent.event()) {
- case 1:
+ case TSE_Active:
P2ASSERTLINE(731, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventStart();
break;
- case 3:
+ case TSE_Apply:
P2ASSERTLINE(738, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventRestart();
break;
@@ -474,9 +474,9 @@ Mgr::Mgr()
JKRArchive* textArc = openTextArc("texts.szs");
loadArchive("arc.szs");
- loadBmd("down_floor_1.bmd", 0, 0x20000);
- loadBmd("down_floor_2.bmd", 1, 0x20000);
- loadBmd("down_floor_3.bmd", 2, 0x20020000);
+ loadBmd("down_floor_1.bmd", 0, J3DMODEL_CreateNewDL);
+ loadBmd("down_floor_2.bmd", 1, J3DMODEL_CreateNewDL);
+ loadBmd("down_floor_3.bmd", 2, J3DMODEL_Unk30 | J3DMODEL_CreateNewDL);
loadAnimMgr(textArc, "animmgr.txt");
mPlatforms = new Platform*[3];
diff --git a/src/plugProjectKandoU/itemGate.cpp b/src/plugProjectKandoU/itemGate.cpp
index 3ee57b3a6..ce9a955a3 100644
--- a/src/plugProjectKandoU/itemGate.cpp
+++ b/src/plugProjectKandoU/itemGate.cpp
@@ -222,11 +222,11 @@ bool ItemGate::interactAttack(Game::InteractAttack& attack)
if (mCurrentState) {
mCurrentState->onDamage(this, attack.mDamage);
switch (mSoundEvent.event()) {
- case 1:
+ case TSE_Active:
P2ASSERTLINE(380, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventStart();
break;
- case 3:
+ case TSE_Apply:
P2ASSERTLINE(386, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventRestart();
break;
@@ -768,7 +768,7 @@ ItemGateMgr::ItemGateMgr()
mObjectPathComponent = "user/Kando/objects/gates";
setModelSize(1);
loadArchive("gate-arc.szs");
- loadBmd("gate_soft.bmd", 0, 0x20000000);
+ loadBmd("gate_soft.bmd", 0, J3DMODEL_Unk30);
JKRArchive* arc = openTextArc("gate-texts.szs");
loadAnimMgr(arc, "gateAnimMgr.txt");
loadCollision(arc, "gateColl.txt");
@@ -1096,7 +1096,7 @@ ItemDengekiGate::Mgr::Mgr()
mObjectPathComponent = "user/Kando/objects/gates";
setModelSize(1);
loadArchive("e-gate-arc.szs");
- loadBmd("e-gate.bmd", 0, 0x21000000);
+ loadBmd("e-gate.bmd", 0, J3DMODEL_Unk30 | J3DMODEL_Unk25);
JKRArchive* texts = openTextArc("e-gate-texts.szs");
loadAnimMgr(texts, "e-animmgr.txt");
loadCollision(texts, "e-coll.txt");
diff --git a/src/plugProjectKandoU/itemHole.cpp b/src/plugProjectKandoU/itemHole.cpp
index ed42e16e1..8fa149321 100644
--- a/src/plugProjectKandoU/itemHole.cpp
+++ b/src/plugProjectKandoU/itemHole.cpp
@@ -43,9 +43,9 @@ Mgr* mgr;
void FSM::init(Game::CFSMItem*)
{
create(HOLE_StateCount);
- registerState(new NormalState());
- registerState(new AppearState());
- registerState(new CloseState());
+ registerState(new NormalState);
+ registerState(new AppearState);
+ registerState(new CloseState);
}
/**
@@ -392,8 +392,8 @@ Mgr::Mgr()
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("dungeon_hole.bmd", 0, 0x20000);
- mModelData[0]->newSharedDisplayList(0x40000);
+ loadBmd("dungeon_hole.bmd", 0, J3DMODEL_CreateNewDL);
+ mModelData[0]->newSharedDisplayList(J3DMODEL_UseSingleSharedDL);
mModelData[0]->makeSharedDL();
JKRArchive* archive = openTextArc("texts.szs");
mCapPlatform = loadPlatform(archive, "cap_platform.bin");
diff --git a/src/plugProjectKandoU/itemHoney.cpp b/src/plugProjectKandoU/itemHoney.cpp
index fa5a814e2..6beabae83 100644
--- a/src/plugProjectKandoU/itemHoney.cpp
+++ b/src/plugProjectKandoU/itemHoney.cpp
@@ -549,7 +549,7 @@ void Mgr::onLoadResources()
{
sys->heapStatusStart("itemHoney", nullptr);
loadArchive("arc.szs");
- loadBmd("mitu.bmd", 0, 0x20000);
+ loadBmd("mitu.bmd", 0, J3DMODEL_CreateNewDL);
(*mModelData)->newSharedDisplayList(0x40000);
JKRArchive* arc = openTextArc("texts.szs");
loadAnimMgr(arc, "honeyAnimMgr.txt");
diff --git a/src/plugProjectKandoU/itemPikihead.cpp b/src/plugProjectKandoU/itemPikihead.cpp
index f8014943d..1b33fe848 100644
--- a/src/plugProjectKandoU/itemPikihead.cpp
+++ b/src/plugProjectKandoU/itemPikihead.cpp
@@ -383,7 +383,7 @@ void Item::onInit(CreatureInitArg* settings)
mHeadType = itemInitArg->mHeadType;
mAutopluckedTimer = itemInitArg->mAutopluckTimer;
} else {
- mColor = randFloat() * 5.0f;
+ mColor = randInt(5);
mHeadType = Leaf;
mAutopluckedTimer = -1.0f;
}
@@ -907,7 +907,7 @@ Mgr::Mgr()
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("pikihead.bmd", 0, 0x20000);
+ loadBmd("pikihead.bmd", 0, J3DMODEL_CreateNewDL);
(*mModelData)->newSharedDisplayList(0x40000);
JKRArchive* arc = openTextArc("texts.szs");
loadAnimMgr(arc, "pikiheadAnimMgr.txt");
diff --git a/src/plugProjectKandoU/itemPlant.cpp b/src/plugProjectKandoU/itemPlant.cpp
index 4a54157f2..0d9102212 100644
--- a/src/plugProjectKandoU/itemPlant.cpp
+++ b/src/plugProjectKandoU/itemPlant.cpp
@@ -2343,7 +2343,7 @@ BaseItem* Mgr::birth()
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("model.bmd", 0, 0x20020000);
+ loadBmd("model.bmd", 0, J3DMODEL_Unk26 | J3DMODEL_CreateNewDL);
mAnmColor = static_cast(J3DAnmLoaderDataBase ::load(JKRFileLoader::getGlbResource("model.bpk", nullptr)));
JKRArchive* textArc = openTextArc("texts.szs");
diff --git a/src/plugProjectKandoU/itemRock.cpp b/src/plugProjectKandoU/itemRock.cpp
index 78694931e..ce5ad88e4 100644
--- a/src/plugProjectKandoU/itemRock.cpp
+++ b/src/plugProjectKandoU/itemRock.cpp
@@ -29,9 +29,9 @@ void FSM::init(Item*)
*/
void NormalState::init(Item* item, StateArg* stateArg)
{
- static_cast(item)->startWaitMotion();
- mIsDamaged = 0;
- mIsFullSize = 0;
+ item->startWaitMotion();
+ mIsDamaged = false;
+ mIsFullSize = false;
}
/**
@@ -44,7 +44,7 @@ void NormalState::exec(Item* item)
if (item->mSize > Item::SIZE_Max) {
item->mSizeTimer += sys->mDeltaTime;
if (item->mSizeTimer >= changeTime) {
- mIsFullSize = 1;
+ mIsFullSize = true;
item->mHealth = item->mHealthLimits[item->mSize - 1];
transit(item, ITEMROCK_Up, nullptr);
}
@@ -68,7 +68,7 @@ void NormalState::onDamage(Item* item, f32 damage)
item->mHealth -= item->mDamageBuffer;
item->mDamageBuffer = 0.0f;
if (item->mHealth < item->mHealthLimits[item->mSize + 1]) {
- mIsDamaged = 1;
+ mIsDamaged = true;
transit(item, ITEMROCK_Down, nullptr);
}
}
@@ -277,7 +277,7 @@ void Item::emitDamageEffect()
efx::ArgKouhai fxArg(mPosition, type);
damageFX.create(&fxArg);
- mMakeEffectDelay = (int)(randFloat() * 5.0f) + 6;
+ mMakeEffectDelay = randInt(5) + 6;
}
}
@@ -661,8 +661,8 @@ BaseItem* Mgr::generatorBirth(Vector3f& pos, Vector3f& rot, GenItemParm* parm)
void Mgr::onLoadResources()
{
loadArchive("arc.szs");
- loadBmd("rock.bmd", 0, 0x20020000);
- mModelData[0]->newSharedDisplayList(0x40000);
+ loadBmd("rock.bmd", 0, J3DMODEL_Unk30 | J3DMODEL_CreateNewDL);
+ mModelData[0]->newSharedDisplayList(J3DMODEL_UseSingleSharedDL);
mModelData[0]->makeSharedDL();
JKRArchive* textArc = openTextArc("texts.szs");
diff --git a/src/plugProjectKandoU/itemTreasure.cpp b/src/plugProjectKandoU/itemTreasure.cpp
index 0a61e61f0..7e9de74c1 100644
--- a/src/plugProjectKandoU/itemTreasure.cpp
+++ b/src/plugProjectKandoU/itemTreasure.cpp
@@ -29,7 +29,7 @@ Mgr* mgr;
*/
void FSM::init(Item* item)
{
- create(1);
+ create(ITEMTREASURE_StateCount);
registerState(new NormalState);
}
@@ -108,41 +108,48 @@ void NormalState::onDamage(Item* item, f32 damage)
void Item::releasePellet()
{
if (mPellet) {
+ // Detach the pellet object from the Item
mPellet->endCapture();
+
+ // spawn the stain texture in the pellet's spot
TexCaster::Caster* caster = mPellet->mCaster;
if (caster) {
caster->fadein(0.5f);
}
+ // create appear dust, change size with size of the pellet
f32 scale = mPellet->getPickRadius();
-
efx::ArgScale arg(mPosition, scale);
efx::TOtakaraAp efx;
efx.create(&arg);
+ // Play the spawn sound effect
mSoundObj->startSound(PSSE_EV_TREASURE_JUMP_OUT, 0);
+ // Give an initial x and z velocity between -5.0 and +5.0
Vector3f velocity;
velocity.x = 10.0f * (randFloat() - 0.5f);
velocity.z = 10.0f * (randFloat() - 0.5f);
velocity.y = 150.0f;
-
mPellet->setVelocity(velocity);
+ // spawn between 1-4 enemies in versus mode
if (gameSystem->isVersusMode()) {
- f32 test = randFloat() * 3.0f;
+ int num = randInt(3);
+
GameMessageVsBirthTekiTreasure mesg;
mesg.mPosition = mPosition;
mesg.mDoSetExitTimer = false;
- mesg.mTekiBirthNum = (int)test + 1;
+ mesg.mTekiBirthNum = num + 1;
gameSystem->mSection->sendMessage(mesg);
}
+ // stop the working music mix
mSoundEvent.finish();
-
P2ASSERTLINE(327, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventFinish();
+ // mark the item as dead
setAlive(false);
mPellet = nullptr;
}
@@ -173,7 +180,7 @@ void Item::constructor() { mSoundObj = new PSM::WorkItem(this); }
void Item::onInit(CreatureInitArg*)
{
mModel = nullptr;
- mFsm->start(this, 0, nullptr);
+ mFsm->start(this, ITEMTREASURE_Normal, nullptr);
setAlive(true);
mCollTree->createSingleSphere(&mDummyShape, 0, mBoundingSphere, nullptr);
}
@@ -212,9 +219,11 @@ void Item::doAI()
part->mRadius = getWorkRadius();
if (mPellet) {
+ // Use a matrix to offset the pellet such that it appears in the ground while buried
+ // The math here is way more involved than it really needs to be, but thats just the
+ // nature of how the pellet height value works
f32 halfMax = (mPellet->getBuryDepthMax() * 0.5f);
f32 depth = halfMax - mTotalLife;
-
Matrixf mtx;
PSMTXCopy(mPellet->mBaseTrMatrix.mMatrix.mtxView, mtx.mMatrix.mtxView);
mtx.mMatrix.structView.ty = depth;
@@ -222,12 +231,14 @@ void Item::doAI()
mtx.mMatrix.structView.tz = 0.0f;
mPellet->updateCapture(mtx);
+ // force hide pellet if not visible
if (mTotalLife >= mPellet->getBuryDepthMax()) {
mPellet->mLod.resetFlag(AILOD_IsVisible | AILOD_IsVisVP0 | AILOD_IsVisVP1);
}
mPellet->mDepth = mTotalLife;
}
+ // if still alive, update the bgm working mix for this item
if (isAlive()) {
int state = mSoundEvent.update();
switch (state) {
@@ -282,12 +293,15 @@ f32 Item::getWorkDistance(Sys::Sphere& bounds)
*/
void Item::setTreasure(Pellet* pelt)
{
+ // Assign the pellet object to the Item, including setting the health
Vector3f pos = mPosition;
mMatrix.makeT(pos);
mPellet = pelt;
if (mPellet) {
mPellet->startCapture(&mMatrix);
mTotalLife = mPellet->getBuryDepth();
+
+ // In versus, overwrite the depth value of yellow marbles
if (gameSystem->isVersusMode() && mPellet->mPelletFlag == Pellet::FLAG_VS_BEDAMA_YELLOW) {
mTotalLife = VsOtakaraName::cBedamaYellowDepth;
}
@@ -345,11 +359,11 @@ bool Item::interactAttack(InteractAttack& act)
int id = mSoundEvent.event();
switch (id) {
- case 1:
+ case TSE_Active:
P2ASSERTLINE(555, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventStart();
break;
- case 3:
+ case TSE_Apply:
P2ASSERTLINE(561, mSoundObj->getCastType() == PSM::CCT_WorkItem);
static_cast(mSoundObj)->eventRestart();
break;
@@ -383,6 +397,7 @@ bool Item::isVisible() { return (!mPellet) ? false : !(mTotalLife / mPellet->get
*/
bool Item::ignoreAtari(Creature* obj)
{
+ // this should definitely be an inlined isVisible but it isn't cooperating here
bool check;
if (!mPellet) {
check = false;
@@ -396,11 +411,8 @@ bool Item::ignoreAtari(Creature* obj)
Piki* piki = static_cast(obj);
if (piki->isPiki() && piki->getKind() == White) {
return false;
- } else {
- return true;
}
- } else {
- return false;
+ return true;
}
return false;
}
diff --git a/src/plugProjectKandoU/itemUjamushi.cpp b/src/plugProjectKandoU/itemUjamushi.cpp
index d89913aa5..2b5aaac6d 100644
--- a/src/plugProjectKandoU/itemUjamushi.cpp
+++ b/src/plugProjectKandoU/itemUjamushi.cpp
@@ -2418,8 +2418,8 @@ Mgr::Mgr()
mObjectPathComponent = "user/Kando/objects/ujamushi";
setModelSize(2);
loadArchive("arc.szs");
- loadBmd("ujamushi_poly.bmd", 0, 0x20000);
- loadBmd("ujamushi_bill.bmd", 1, 0x20020000);
+ loadBmd("ujamushi_poly.bmd", 0, J3DMODEL_CreateNewDL);
+ loadBmd("ujamushi_bill.bmd", 1, J3DMODEL_Unk26 | J3DMODEL_CreateNewDL);
_308 = 0;
_304 = 0;
_30C = 0.0f;
diff --git a/src/plugProjectKandoU/itemWeed.cpp b/src/plugProjectKandoU/itemWeed.cpp
index 1a4ae467c..7d89c865b 100644
--- a/src/plugProjectKandoU/itemWeed.cpp
+++ b/src/plugProjectKandoU/itemWeed.cpp
@@ -277,10 +277,10 @@ Mgr::Mgr()
mObjectPathComponent = "user/Kando/objects/weed";
setModelSize(4);
loadArchive("arc.szs");
- loadBmd("weed1.bmd", 0, 0x20000);
- loadBmd("stone1.bmd", 1, 0x20000);
- loadBmd("stone2.bmd", 2, 0x20000);
- loadBmd("stone3.bmd", 3, 0x20000);
+ loadBmd("weed1.bmd", 0, J3DMODEL_CreateNewDL);
+ loadBmd("stone1.bmd", 1, J3DMODEL_CreateNewDL);
+ loadBmd("stone2.bmd", 2, J3DMODEL_CreateNewDL);
+ loadBmd("stone3.bmd", 3, J3DMODEL_CreateNewDL);
for (int i = 0; i < 4; i++) {
J3DModelData* modelData = getModelData(i);
modelData->newSharedDisplayList(0x40000);
diff --git a/src/plugProjectKandoU/naviState.cpp b/src/plugProjectKandoU/naviState.cpp
index 2fb9159e5..8d70b9863 100644
--- a/src/plugProjectKandoU/naviState.cpp
+++ b/src/plugProjectKandoU/naviState.cpp
@@ -1450,7 +1450,7 @@ void NaviFollowState::exec(Navi* navi)
// get right id for each navi for sounds
// 0 for olimar, 1 for louie, or 2 for president
int naviID = navi->mNaviIndex;
- if (naviID == NAVIID_Louie && gameSystem->isStoryMode() && playData->mStoryFlags & STORY_DebtPaid) {
+ if (naviID == NAVIID_Louie && gameSystem->isStoryMode() && playData->isStoryFlag(STORY_DebtPaid)) {
naviID++;
}
@@ -3972,7 +3972,7 @@ void NaviContainerState::init(Navi* navi, StateArg* stateArg)
disp.mHasWhite = playData->hasContainer(White);
disp.mHasPurple = playData->hasContainer(Purple);
- disp.mHasPaidDebt = playData->mStoryFlags & STORY_DebtPaid;
+ disp.mHasPaidDebt = playData->isStoryFlag(STORY_DebtPaid);
if (!disp.mHasWhite && !disp.mHasPurple) {
mIsScreenOpen = false;
} else {
@@ -6009,7 +6009,7 @@ void NaviPelletState::init(Navi* navi, StateArg* stateArg)
if (navi->mNaviIndex == NAVIID_Olimar) {
navi->mSoundObj->startSound(PSSE_PL_SLEEP_ORIMA, 0);
- } else if (playData->mStoryFlags & STORY_DebtPaid) {
+ } else if (playData->isStoryFlag(STORY_DebtPaid)) {
navi->mSoundObj->startSound(PSSE_PL_SLEEP_SHACHO, 0);
} else {
navi->mSoundObj->startSound(PSSE_PL_SLEEP_LUGI, 0);
@@ -6063,8 +6063,8 @@ void NaviPelletState::exec(Navi* navi)
}
if (mState == 1 || mState == 0) {
- // probably a combination of enums
- if (navi->mController1 && navi->mController1->getButtonDown() & 0x70f) {
+ if (navi->mController1
+ && navi->mController1->getButtonDown() & (Controller::PRESS_Z | Controller::PRESS_R | Controller::PRESS_L)) {
if (mDoForceWakeup) {
navi->mAnimSpeed = 60.0f;
navi->finishMotion();
@@ -6072,7 +6072,7 @@ void NaviPelletState::exec(Navi* navi)
navi->startMotion(IPikiAnims::GETUP, IPikiAnims::GETUP, navi, nullptr);
if (navi->mNaviIndex == NAVIID_Olimar) {
navi->mSoundObj->startSound(PSSE_PL_WAKEUP_ORIMA, 0);
- } else if (playData->mStoryFlags & STORY_DebtPaid) {
+ } else if (playData->isStoryFlag(STORY_DebtPaid)) {
navi->mSoundObj->startSound(PSSE_PL_WAKEUP_SHACHO, 0);
} else {
navi->mSoundObj->startSound(PSSE_PL_WAKEUP_LUGI, 0);
@@ -6109,7 +6109,7 @@ void NaviPelletState::onKeyEvent(Navi* navi, SysShape::KeyEvent const& key)
if (mDoForceWakeup) {
if (key.mType == 1) {
if (navi->mAnimator.mSelfAnimator.isFlag(SysShape::Animator::AnimFinishMotion)) {
- if (playData->mStoryFlags & STORY_DebtPaid) {
+ if (playData->isStoryFlag(STORY_DebtPaid)) {
navi->mSoundObj->startSound(PSSE_PL_WAKEUP_SHACHO, 0);
} else {
navi->mSoundObj->startSound(PSSE_PL_WAKEUP_LUGI, 0);
diff --git a/src/plugProjectKandoU/onyonMgr.cpp b/src/plugProjectKandoU/onyonMgr.cpp
index 9afc54bd1..bc7a1d763 100644
--- a/src/plugProjectKandoU/onyonMgr.cpp
+++ b/src/plugProjectKandoU/onyonMgr.cpp
@@ -2105,7 +2105,7 @@ void ItemOnyon::Mgr::load()
closeTextArc(onyontextarc);
if ((gameSystem->isChallengeMode() || gameSystem->mIsInCave) && !gameSystem->isVersusMode()) {
- if (playData->mStoryFlags & STORY_DebtPaid) {
+ if (playData->isStoryFlag(STORY_DebtPaid)) {
mObjectPathComponent = "user/Kando/pod_gold";
} else {
mObjectPathComponent = "user/Kando/pod";
@@ -2150,7 +2150,7 @@ void ItemOnyon::Mgr::load()
P2ASSERTLINE(3156, file);
mUfoTevAnim[1].attachResource(file, mModelData[2]);
- if (playData->mStoryFlags & STORY_DebtPaid) {
+ if (playData->isStoryFlag(STORY_DebtPaid)) {
mObjectPathComponent = "user/Kando/ufo_gold";
} else {
mObjectPathComponent = "user/Kando/ufo";
diff --git a/src/plugProjectKandoU/pelletBirthBuffer.cpp b/src/plugProjectKandoU/pelletBirthBuffer.cpp
index a76f81e23..9cebc7337 100644
--- a/src/plugProjectKandoU/pelletBirthBuffer.cpp
+++ b/src/plugProjectKandoU/pelletBirthBuffer.cpp
@@ -9,7 +9,7 @@ PelletInitArg PelletBirthBuffer::sArgs[MAX_PELLET_COUNT];
* @note Address: 0x8023D41C
* @note Size: 0xC
*/
-void PelletBirthBuffer::clear() { PelletBirthBuffer::sNum = 0; }
+void PelletBirthBuffer::clear() { sNum = 0; }
/**
* @note Address: 0x8023D428
@@ -25,8 +25,8 @@ void PelletBirthBuffer::entry(Game::PelletInitArg& initArg)
return;
}
- if (PelletBirthBuffer::sNum < MAX_PELLET_COUNT) {
- PelletBirthBuffer::sArgs[PelletBirthBuffer::sNum++] = initArg;
+ if (sNum < MAX_PELLET_COUNT) {
+ sArgs[sNum++] = initArg;
} else {
JUT_PANICLINE(31, "too many birthbuffer\n");
}
@@ -42,15 +42,15 @@ void PelletBirthBuffer::birthAll()
return;
}
- for (int i = 0; i < PelletBirthBuffer::sNum; i++) {
- Pellet* newPel = pelletMgr->birth(&PelletBirthBuffer::sArgs[i]);
+ for (int i = 0; i < sNum; i++) {
+ Pellet* newPel = pelletMgr->birth(&sArgs[i]);
if (newPel) {
newPel->kill(nullptr);
newPel->mMgr->setFromTeki(newPel);
}
}
- PelletBirthBuffer::sNum = 0;
+ sNum = 0;
}
} // namespace Game
diff --git a/src/plugProjectKandoU/pelletConfig.cpp b/src/plugProjectKandoU/pelletConfig.cpp
index f2210e7ec..346010a4b 100644
--- a/src/plugProjectKandoU/pelletConfig.cpp
+++ b/src/plugProjectKandoU/pelletConfig.cpp
@@ -23,24 +23,23 @@ PelletConfigList::PelletConfigList()
*/
PelletConfig::PelletConfig()
{
- mParams.mIndex = -1;
- mParams.mUnique.mData = "no";
- mParams.mIndirect.mData = "no";
- mParams.mTxtArchive.mData = nullptr;
- mParams.mDepth.mData = 0.0f;
- mParams.mDepthA.mData = 10.0f;
- mParams.mDepthB.mData = 20.0f;
- mParams.mDepthC.mData = 30.0f;
- mParams.mDepthD.mData = 40.0f;
- mParams.mNumPMotions.mData = 0;
- reinterpret_cast(&mParams.mMessage.mData)[1] = 0;
- reinterpret_cast(&mParams.mMessage.mData)[0] = 0;
- mParams.mOffset.mData.x = 0.0f;
- mParams.mOffset.mData.y = 0.0f;
- mParams.mOffset.mData.z = 0.0f;
- mParams.mCode.mData = 0;
- mParams.mDictionary.mData = 0;
- mParams.mIndirectState = Indirect_No;
+ mParams.mIndex = -1;
+ mParams.mUnique.mData = "no";
+ mParams.mIndirect.mData = "no";
+ mParams.mTxtArchive.mData = nullptr;
+ mParams.mDepth.mData = 0.0f;
+ mParams.mDepthA.mData = 10.0f;
+ mParams.mDepthB.mData = 20.0f;
+ mParams.mDepthC.mData = 30.0f;
+ mParams.mDepthD.mData = 40.0f;
+ mParams.mNumPMotions.mData = 0;
+ mParams.mMessage.mData = 0;
+ mParams.mOffset.mData.x = 0.0f;
+ mParams.mOffset.mData.y = 0.0f;
+ mParams.mOffset.mData.z = 0.0f;
+ mParams.mCode.mData = 0;
+ mParams.mDictionary.mData = 0;
+ mParams.mIndirectState = Indirect_No;
}
/**
diff --git a/src/plugProjectKandoU/pelletState.cpp b/src/plugProjectKandoU/pelletState.cpp
index fb65943ec..6386e9394 100644
--- a/src/plugProjectKandoU/pelletState.cpp
+++ b/src/plugProjectKandoU/pelletState.cpp
@@ -238,7 +238,7 @@ bool PelletGoalState::checkMovie(Pellet* pelt)
if (!strcmp(pelt->mConfig->mParams.mName.mData, "loozy")) {
sys->getPlayCommonData()->enableLouieRescue();
sys->mPlayData->mDoSaveOptions = true;
- playData->mStoryFlags |= STORY_LouieRescued;
+ playData->setStoryFlag(STORY_LouieRescued);
}
bool draw2d = false;
diff --git a/src/plugProjectKandoU/pikiMgr.cpp b/src/plugProjectKandoU/pikiMgr.cpp
index 538675093..8db6f4949 100644
--- a/src/plugProjectKandoU/pikiMgr.cpp
+++ b/src/plugProjectKandoU/pikiMgr.cpp
@@ -131,7 +131,7 @@ Piki* PikiMgr::birth()
CI_LOOP(iter)
{
Piki* currPiki = *iter;
- if ((int)currPiki->mPikiKind == Bulbmin && currPiki->isAlive() && currPiki->isTekiFollowAI()) {
+ if (currPiki->getKind() == Bulbmin && currPiki->isAlive() && currPiki->isTekiFollowAI()) {
toKill = currPiki;
break;
}
diff --git a/src/plugProjectKandoU/registItem.cpp b/src/plugProjectKandoU/registItem.cpp
index 6a79c4f60..93d354e40 100644
--- a/src/plugProjectKandoU/registItem.cpp
+++ b/src/plugProjectKandoU/registItem.cpp
@@ -23,14 +23,14 @@ inline void GenerateMgr(T2& mgr, char* name)
*/
void ItemMgr::createManagers(u32 flags)
{
- bool inCave = (flags >> 1) & 1;
- bool isExitFloor = flags & 1;
+ bool isGround = (flags >> 1) & 1;
+ bool isCave = flags & 1;
GenerateMgr(ItemBarrel::mgr, "-Barrel-");
GenerateMgr(ItemUjamushi::mgr, "-Ujamushi-");
sys->heapStatusStart("-Weed-", nullptr);
- if (inCave) {
+ if (isGround) {
ItemWeed::mgr = new ItemWeed::Mgr;
ItemWeed::mgr->loadResources();
itemMgr->addMgr(ItemWeed::mgr);
@@ -44,7 +44,7 @@ void ItemMgr::createManagers(u32 flags)
GenerateMgr(ItemPikihead::mgr, "-PikiHead-");
sys->heapStatusStart("-Plant-", nullptr);
- if (inCave) {
+ if (isGround) {
ItemPlant::mgr = new ItemPlant::Mgr;
ItemPlant::mgr->loadResources();
itemMgr->addMgr(ItemPlant::mgr);
@@ -54,7 +54,7 @@ void ItemMgr::createManagers(u32 flags)
sys->heapStatusEnd("-Plant-");
sys->heapStatusStart("-Rock-", nullptr);
- if (inCave) {
+ if (isGround) {
ItemRock::mgr = new ItemRock::Mgr;
ItemRock::mgr->loadResources();
itemMgr->addMgr(ItemRock::mgr);
@@ -73,7 +73,7 @@ void ItemMgr::createManagers(u32 flags)
sys->heapStatusEnd("-Onyon-");
sys->heapStatusStart("-Hole-", nullptr);
- if (isExitFloor) {
+ if (isCave) {
ItemHole::mgr = new ItemHole::Mgr;
ItemHole::mgr->loadResources();
itemMgr->addMgr(ItemHole::mgr);
@@ -83,7 +83,7 @@ void ItemMgr::createManagers(u32 flags)
sys->heapStatusEnd("-Hole-");
sys->heapStatusStart("-Cave-", nullptr);
- if (inCave) {
+ if (isGround) {
ItemCave::mgr = new ItemCave::Mgr;
ItemCave::mgr->loadResources();
itemMgr->addMgr(ItemCave::mgr);
@@ -93,7 +93,7 @@ void ItemMgr::createManagers(u32 flags)
sys->heapStatusEnd("-Cave-");
sys->heapStatusStart("-BigFountain-", nullptr);
- if (isExitFloor) {
+ if (isCave) {
ItemBigFountain::mgr = new ItemBigFountain::Mgr;
ItemBigFountain::mgr->loadResources();
itemMgr->addMgr(ItemBigFountain::mgr);
@@ -103,7 +103,7 @@ void ItemMgr::createManagers(u32 flags)
sys->heapStatusEnd("-BigFountain-");
sys->heapStatusStart("-Bridge-", nullptr);
- if (inCave) {
+ if (isGround) {
ItemBridge::mgr = new ItemBridge::Mgr;
ItemBridge::mgr->loadResources();
itemMgr->addMgr(ItemBridge::mgr);
@@ -118,7 +118,7 @@ void ItemMgr::createManagers(u32 flags)
sys->heapStatusEnd("-Gate-");
sys->heapStatusStart("-DengekiGate-", nullptr);
- if (inCave) {
+ if (isGround) {
ItemDengekiGate::mgr = new ItemDengekiGate::Mgr;
itemMgr->addMgr(ItemDengekiGate::mgr);
} else {
diff --git a/src/plugProjectKandoU/singleGS_CaveGame.cpp b/src/plugProjectKandoU/singleGS_CaveGame.cpp
index 461c79d59..0b45a42b0 100644
--- a/src/plugProjectKandoU/singleGS_CaveGame.cpp
+++ b/src/plugProjectKandoU/singleGS_CaveGame.cpp
@@ -497,8 +497,8 @@ void CaveState::onMovieStart(SingleGameSection* game, MovieConfig* config, u32,
naviType = Screen::Game2DMgr::GOTITLE_OlimarDown;
game->setPlayerMode(NAVIID_Olimar);
} else {
- naviType = (playData->mStoryFlags & STORY_DebtPaid) ? Screen::Game2DMgr::GOTITLE_PresidentDown
- : Screen::Game2DMgr::GOTITLE_LouieDown;
+ naviType
+ = playData->isStoryFlag(STORY_DebtPaid) ? Screen::Game2DMgr::GOTITLE_PresidentDown : Screen::Game2DMgr::GOTITLE_LouieDown;
game->setPlayerMode(NAVIID_Louie);
}
Screen::gGame2DMgr->open_GameOver(naviType);
diff --git a/src/plugProjectKandoU/singleGS_CaveResult.cpp b/src/plugProjectKandoU/singleGS_CaveResult.cpp
index 65a3c0b24..b457e0994 100644
--- a/src/plugProjectKandoU/singleGS_CaveResult.cpp
+++ b/src/plugProjectKandoU/singleGS_CaveResult.cpp
@@ -89,8 +89,8 @@ void CaveResultState::loadResource()
mResultTextures->create(arg);
JUTTexture* texture = new JUTTexture(sys->getRenderModeWidth(), sys->getRenderModeHeight(), GX_TF_RGB565);
- texture->mMinFilter = 0;
- texture->mMagFilter = 0;
+ texture->mMinFilter = GX_NEAR;
+ texture->mMagFilter = GX_NEAR;
mSection->mXfbTexture2d = texture;
createResultNodes();
diff --git a/src/plugProjectKandoU/singleGS_DayEnd.cpp b/src/plugProjectKandoU/singleGS_DayEnd.cpp
index 1c20b0859..55aa968da 100644
--- a/src/plugProjectKandoU/singleGS_DayEnd.cpp
+++ b/src/plugProjectKandoU/singleGS_DayEnd.cpp
@@ -207,7 +207,7 @@ void DayEndState::onMovieStart(SingleGameSection* game, MovieConfig* movie, u32,
PikiKillArg arg(CKILL_DontCountAsDeath);
pikiBuffer[j]->kill(&arg);
}
- pikiMgr->moveAllPikmins(*(Vector3f*)&origin, 50.0f, nullptr);
+ pikiMgr->moveAllPikmins(origin, 50.0f, nullptr);
Iterator iterator2(pikiMgr);
CI_LOOP(iterator2)
diff --git a/src/plugProjectKandoU/singleGS_Ending.cpp b/src/plugProjectKandoU/singleGS_Ending.cpp
index 73f82e275..98cd67d93 100644
--- a/src/plugProjectKandoU/singleGS_Ending.cpp
+++ b/src/plugProjectKandoU/singleGS_Ending.cpp
@@ -88,16 +88,16 @@ void EndingState::dvdload()
BirthMgr::account_today();
DeathMgr::account_today();
int day = gameSystem->mTimeMgr->mDayCount;
- int bufferA[16];
- int bufferB[16];
+ int bufferA[GAME_HIGHSCORE_COUNT];
+ int bufferB[GAME_HIGHSCORE_COUNT];
sys->getPlayCommonData()->entryHighscores_clear(day, bufferA, bufferB);
mResultData = kh::Screen::SceneFinalResult::createDispMember(bufferA, bufferB, sys->getPlayCommonData()->mHiScoreClear);
} else {
BirthMgr::account_today();
DeathMgr::account_today();
int day = gameSystem->mTimeMgr->mDayCount;
- int bufferA[16];
- int bufferB[16];
+ int bufferA[GAME_HIGHSCORE_COUNT];
+ int bufferB[GAME_HIGHSCORE_COUNT];
sys->getPlayCommonData()->entryHighscores_complete(day, bufferA, bufferB);
mResultData = kh::Screen::SceneFinalResult::createDispMember(bufferA, bufferB, sys->getPlayCommonData()->mHiScoreComplete);
}
@@ -139,9 +139,7 @@ void EndingState::exec(SingleGameSection* game)
mStatus = EndingStatus_ShowContinueMesg;
og::Screen::DispMemberFinalMessage disp;
Screen::gGame2DMgr->open_FinalMessage(disp);
- PSGame::PikSceneMgr* mgr = static_cast(PSSystem::getSceneMgr());
- mgr->checkScene();
- mgr->mScenes->mChild->startMainSeq();
+ PSSystem::getSceneMgr()->doStartMainSeq();
} else {
mStatus = EndingStatus_LoadFirstMovie;
}
@@ -189,18 +187,17 @@ void EndingState::exec(SingleGameSection* game)
Screen::gGame2DMgr->setGamePad(mController);
Screen::gGame2DMgr->open_FinalResult(disp);
- PSGame::PikSceneMgr* mgr = static_cast(PSSystem::getSceneMgr());
- mgr->checkScene();
- mgr->mScenes->mChild->startMainSeq();
+ PSSystem::getSceneMgr()->doStartMainSeq();
playData->clearCurrentCave();
sys->mPlayData->mDoSaveOptions = true;
sys->getPlayCommonData()->mChallengeFlags.set(1);
+ // Only open Wistful Wild if Perplexing Pool is opened
if (playData->courseOpen(2)) {
playData->openCourse(3);
}
- playData->mStoryFlags |= STORY_DebtPaid;
- playData->setSaveFlag(4, nullptr);
+ playData->setStoryFlag(STORY_DebtPaid);
+ playData->setSaveFlag(STORYSAVE_DebtPaid, nullptr);
}
}
break;
@@ -248,22 +245,20 @@ void EndingState::exec(SingleGameSection* game)
mThpState = 0;
mTHPPlayer->play();
}
- } else {
- if (mTHPPlayer->isFinishPlaying()) {
- mTHPPlayer->stop();
- kh::Screen::DispFinalResult disp(mResultData, kh::Screen::DispFinalResult::Complete, mMainHeap);
- Screen::gGame2DMgr->setGamePad(mController);
- Screen::gGame2DMgr->open_FinalResult(disp);
+ } else if (mTHPPlayer->isFinishPlaying()) {
+ mTHPPlayer->stop();
+ kh::Screen::DispFinalResult disp(mResultData, kh::Screen::DispFinalResult::Complete, mMainHeap);
+ Screen::gGame2DMgr->setGamePad(mController);
+ Screen::gGame2DMgr->open_FinalResult(disp);
- PSSystem::getSceneMgr()->doStartMainSeq();
+ PSSystem::getSceneMgr()->doStartMainSeq();
- playData->clearCurrentCave();
- sys->mPlayData->mDoSaveOptions = true;
- sys->getPlayCommonData()->mChallengeFlags.set(2);
- playData->mStoryFlags |= STORY_AllTreasuresCollected;
- mStatus = EndingStatus_ShowFinalResultsComplete;
- playData->setSaveFlag(1, nullptr);
- }
+ playData->clearCurrentCave();
+ sys->mPlayData->mDoSaveOptions = true;
+ sys->getPlayCommonData()->mChallengeFlags.set(2);
+ playData->setStoryFlag(STORY_AllTreasuresCollected);
+ mStatus = EndingStatus_ShowFinalResultsComplete;
+ playData->setSaveFlag(STORYSAVE_WorldMap, nullptr);
}
break;
case EndingStatus_Unused9:
@@ -285,9 +280,9 @@ void EndingState::exec(SingleGameSection* game)
playData->clearCurrentCave();
sys->mPlayData->mDoSaveOptions = true;
sys->getPlayCommonData()->mChallengeFlags.set(2);
- playData->mStoryFlags |= STORY_AllTreasuresCollected;
+ playData->setStoryFlag(STORY_AllTreasuresCollected);
mStatus = EndingStatus_ShowFinalResultsComplete;
- playData->setSaveFlag(1, nullptr);
+ playData->setSaveFlag(STORYSAVE_WorldMap, nullptr);
}
}
break;
diff --git a/src/plugProjectKandoU/singleGS_MainGame.cpp b/src/plugProjectKandoU/singleGS_MainGame.cpp
index a039646d0..06933ce65 100644
--- a/src/plugProjectKandoU/singleGS_MainGame.cpp
+++ b/src/plugProjectKandoU/singleGS_MainGame.cpp
@@ -151,7 +151,7 @@ void GameState::init(SingleGameSection* game, StateArg* arg)
}
}
}
- if (startType == 1) {
+ if (startType == MapEnter_CaveGeyser) {
gameSystem->mTimeMgr->setTime(playData->mCaveSaveData.mTime);
}
} break;
@@ -629,8 +629,8 @@ void GameState::onMovieStart(SingleGameSection* game, MovieConfig* config, u32,
naviType = Screen::Game2DMgr::GOTITLE_OlimarDown;
game->setPlayerMode(NAVIID_Olimar);
} else {
- naviType = (playData->mStoryFlags & STORY_DebtPaid) ? Screen::Game2DMgr::GOTITLE_PresidentDown
- : Screen::Game2DMgr::GOTITLE_LouieDown;
+ naviType
+ = playData->isStoryFlag(STORY_DebtPaid) ? Screen::Game2DMgr::GOTITLE_PresidentDown : Screen::Game2DMgr::GOTITLE_LouieDown;
game->setPlayerMode(NAVIID_Louie);
}
Screen::gGame2DMgr->open_GameOver(naviType);
@@ -758,7 +758,7 @@ void GameState::onMovieDone(SingleGameSection* game, MovieConfig* config, u32, u
// Regular/first time course landing, check usual stuff after it
if (config->is("s00_coursein") || config->is("x01_coursein_forest") || config->is("x01_coursein_yakushima")
|| config->is("x01_coursein_last")) {
- if ((playData->mStoryFlags & STORY_DebtPaid) && !playData->isDemoFlag(DEMO_President_Start)) {
+ if (playData->isStoryFlag(STORY_DebtPaid) && !playData->isDemoFlag(DEMO_President_Start)) {
playData->setDemoFlag(DEMO_President_Start);
char* name = const_cast(game->mCurrentCourseInfo->mName);
MoviePlayArg moviePlayArg("g35_president_gamestart", name, game->mMovieFinishCallback, 0);
diff --git a/src/plugProjectKandoU/singleGS_MainResult.cpp b/src/plugProjectKandoU/singleGS_MainResult.cpp
index 396ef3580..f05014674 100644
--- a/src/plugProjectKandoU/singleGS_MainResult.cpp
+++ b/src/plugProjectKandoU/singleGS_MainResult.cpp
@@ -91,7 +91,7 @@ unknown MainResultState::open2D(SingleGameSection* game)
{
mStatus = Result_ScreenActive;
playData->clearCurrentCave();
- playData->setSaveFlag(1, mBeforeSaveDelegate);
+ playData->setSaveFlag(STORYSAVE_WorldMap, mBeforeSaveDelegate);
int pokos = playData->mPokoCount;
kh::Screen::MailCategory mailtype;
if (pokos < 3000) {
@@ -102,15 +102,15 @@ unknown MainResultState::open2D(SingleGameSection* game)
mailtype = kh::Screen::PokoUnder8000;
} else if (pokos < 10000) {
mailtype = kh::Screen::PokoUnder10000;
- } else if (playData->mStoryFlags & STORY_AllTreasuresCollected) {
+ } else if (playData->isStoryFlag(STORY_AllTreasuresCollected)) {
mailtype = kh::Screen::AllTreasures;
- } else if (playData->mStoryFlags & STORY_LouieRescued) {
+ } else if (playData->isStoryFlag(STORY_LouieRescued)) {
mailtype = kh::Screen::SavedLouie;
} else {
mailtype = kh::Screen::PayDebt;
}
- kh::Screen::DispDayEndResult disp(&mResultNode, playData->mTreasureCount, pokos, playData->mStoryFlags & STORY_DebtPaid, mIncP,
+ kh::Screen::DispDayEndResult disp(&mResultNode, playData->mTreasureCount, pokos, playData->isStoryFlag(STORY_DebtPaid), mIncP,
theTekiHeap, mailtype);
Screen::gGame2DMgr->open_DayEndResult(disp);
}
diff --git a/src/plugProjectKandoU/singleGS_WorldMap.cpp b/src/plugProjectKandoU/singleGS_WorldMap.cpp
index 0b6243459..feb422b44 100644
--- a/src/plugProjectKandoU/singleGS_WorldMap.cpp
+++ b/src/plugProjectKandoU/singleGS_WorldMap.cpp
@@ -110,7 +110,7 @@ void SelectState::initNext(SingleGameSection* section)
section->mWipeInFader->start(1.0f);
section->refreshHIO();
- mController->setButtonRepeat(0x3000000, 0x1E, 1);
+ mController->setButtonRepeat((Controller::ANALOG_LEFT | Controller::ANALOG_RIGHT), 30, 1);
sys->dvdLoadUseCallBack(§ion->mDvdThread, mDvdLoadCallback);
}
diff --git a/src/plugProjectKandoU/singleGS_Zukan.cpp b/src/plugProjectKandoU/singleGS_Zukan.cpp
index 9568f6d33..908eae73f 100644
--- a/src/plugProjectKandoU/singleGS_Zukan.cpp
+++ b/src/plugProjectKandoU/singleGS_Zukan.cpp
@@ -3985,11 +3985,11 @@ void ZukanState::dvdloadA()
mCameraAspect = 0.0f;
mTexture2 = new JUTTexture((int)getWindowWidth(), (int)getWindowHeight(), GX_TF_RGB565);
- mTexture2->mMinFilter = 0;
- mTexture2->mMagFilter = 0;
+ mTexture2->mMinFilter = GX_NEAR;
+ mTexture2->mMagFilter = GX_NEAR;
mTexture = new JUTTexture((int)getWindowWidth() / 2, (int)getWindowHeight() / 2, GX_TF_RGB565);
- mTexture->mMinFilter = 0;
- mTexture->mMagFilter = 0;
+ mTexture->mMinFilter = GX_NEAR;
+ mTexture->mMagFilter = GX_NEAR;
mGameSect->useSpecificFBTexture(mTexture);
mGameSect->setXfbBounds(mCameraAspect.x, mCameraAspect.y);
diff --git a/src/plugProjectKandoU/singleGameSection.cpp b/src/plugProjectKandoU/singleGameSection.cpp
index 28b3b061f..18c35a44c 100644
--- a/src/plugProjectKandoU/singleGameSection.cpp
+++ b/src/plugProjectKandoU/singleGameSection.cpp
@@ -642,15 +642,14 @@ void SingleGameSection::saveMainMapSituation(bool isSubmergedCastle)
{
if (isSubmergedCastle) {
Iterator iterator(pikiMgr, 0, nullptr);
- iterator.first();
- while (!iterator.isDone()) {
+ CI_LOOP(iterator)
+ {
Piki* piki = (*iterator);
if (piki->isAlive() && piki->getKind() != Blue) {
playData->mPikiContainer.getCount(piki->getKind(), piki->getHappa())++;
PikiKillArg killArg(CKILL_DontCountAsDeath | CKILL_Unk17);
piki->kill(&killArg);
}
- iterator.next();
}
}
pikiMgr->caveSaveFormationPikmins(false);
@@ -695,7 +694,7 @@ void SingleGameSection::openCaveInMenu(ItemCave::Item* cave, int naviID)
disp.mUnusedValue = 0;
disp.mCaveOtakaraNum = cave->getCaveOtakaraNum();
disp.mCaveOtakaraMax = cave->getCaveOtakaraMax();
- disp.mPayedDebt = playData->mStoryFlags & STORY_DebtPaid;
+ disp.mPayedDebt = playData->isStoryFlag(STORY_DebtPaid);
disp.mPikisField = GameStat::getMapPikmins(AllPikminCalcs) - GameStat::getZikatuPikmins(AllPikminCalcs);
int enteringPikiCount = 0;
@@ -716,7 +715,7 @@ void SingleGameSection::openCaveInMenu(ItemCave::Item* cave, int naviID)
disp.mPikis = enteringPikiCount;
disp.mCaveID = mCaveIndex;
if (Screen::gGame2DMgr->open_CaveInMenu(disp)) {
- playData->setSaveFlag(3, nullptr);
+ playData->setSaveFlag(STORYSAVE_Cave, nullptr);
playData->setCurrentCourse(getCurrentCourseInfo()->mCourseIndex);
playData->setCurrentCave(cave->mCaveID, 0);
getCurrentCourseInfo()->getCaveinfoFilename_FromID(cave->mCaveID);
@@ -752,7 +751,7 @@ void SingleGameSection::openCaveMoreMenu(ItemHole::Item* hole, Controller* input
}
if (Screen::gGame2DMgr->open_CaveMoreMenu(disp)) {
- playData->setSaveFlag(3, nullptr);
+ playData->setSaveFlag(STORYSAVE_Cave, nullptr);
mHole = hole;
mOpenMenuFlags |= 2;
gameSystem->setPause(true, "openCaveMore", 3);
@@ -1005,9 +1004,10 @@ void SingleGameSection::setDispMemberSMenu(og::Screen::DispMemberSMenuAll& disp)
disp.mSMenuMap.mDataMap.mCurrentPikminCounts[og::Screen::MAPPIKI_White] = GameStat::formationPikis.getCount(id, White);
disp.mSMenuMap.mDataMap.mCurrentPikminCounts[og::Screen::MAPPIKI_Purple] = GameStat::formationPikis.getCount(id, Purple);
- int form = GameStat::formationPikis;
- int work = GameStat::workPikis;
- int alive = GameStat::alivePikis;
+ int form = GameStat::formationPikis;
+ int work = GameStat::workPikis;
+ int alive = GameStat::alivePikis;
+
disp.mSMenuMap.mDataMap.mFreePikmin = alive - form - work;
disp.mSMenuMap.mDataMap.mPokos = _aiConstants->mDebt.mData - playData->mPokoCount;
disp.mSMenuMap.mInCave = gameSystem->mIsInCave;
@@ -1154,7 +1154,7 @@ void SingleGameSection::updateMainMapScreen()
disp.mHasSpicy = false;
}
- if (playData->mStoryFlags & STORY_DebtPaid) {
+ if (playData->isStoryFlag(STORY_DebtPaid)) {
disp.mPayDebt = true;
}
@@ -1246,7 +1246,7 @@ void SingleGameSection::updateCaveScreen()
disp.mDataGame.mPokoCount = playData->getPokoCount() + playData->getCavePokoCount();
- if (playData->mStoryFlags & STORY_DebtPaid) {
+ if (playData->isStoryFlag(STORY_DebtPaid)) {
disp.mPayDebt = true;
}
diff --git a/src/plugProjectKandoU/texCaster.cpp b/src/plugProjectKandoU/texCaster.cpp
index 9c7c3bac2..74be0e656 100644
--- a/src/plugProjectKandoU/texCaster.cpp
+++ b/src/plugProjectKandoU/texCaster.cpp
@@ -674,11 +674,7 @@ void Mgr::drawInit(Graphics& gfx)
void Mgr::draw(Graphics& gfx)
{
drawInit(gfx);
-
- Caster* child = static_cast(mCaster.mChild);
- for (child; child; child = static_cast(child->mNext)) {
- child->draw(gfx);
- }
+ FOREACH_NODE(Caster, mCaster.mChild, child) { child->draw(gfx); }
}
} // namespace TexCaster
diff --git a/src/plugProjectKandoU/vsGS_Game.cpp b/src/plugProjectKandoU/vsGS_Game.cpp
index cf3c98159..b61436e81 100644
--- a/src/plugProjectKandoU/vsGS_Game.cpp
+++ b/src/plugProjectKandoU/vsGS_Game.cpp
@@ -74,8 +74,8 @@ void GameState::init(VsGameSection* section, StateArg* stateArg)
section->mTimeLimit += mFloorExtendTimer;
}
- section->mMarbleCountP2 = 0;
- section->mMarbleCountP1 = 0;
+ section->mMarbleCount[1] = 0;
+ section->mMarbleCount[0] = 0;
section->mYellowMarbleCounts[1] = 0;
section->mYellowMarbleCounts[0] = 0;
section->mGhostIconTimers[1] = 0.0f;
@@ -161,7 +161,7 @@ void GameState::exec(VsGameSection* section)
section->BaseGameSection::doUpdate();
- if (section->mCurrentState->mId != VGS_Game) {
+ if (section->getCurrState()->mId != VGS_Game) {
return;
}
@@ -282,7 +282,7 @@ void GameState::exec(VsGameSection* section)
return;
}
- if (!gameSystem->paused() && section->mTimeLimit > 0.0f && isFlag(VSGS_IntroDone) && !section->mMenuFlags
+ if (!gameSystem->paused() && section->mTimeLimit > 0.0f && isFlag(VSGS_IntroDone) && !section->mMenuFlags.typeView
&& gameSystem->isFlag(GAMESYS_IsGameWorldActive) && !gameSystem->paused_soft()
&& moviePlayer->mDemoState
== DEMOSTATE_Inactive) { // check game is in a state where timer should go down (not paused/menu/CS/etc)
@@ -329,7 +329,7 @@ void GameState::exec(VsGameSection* section)
}
}
- if (!section->mMenuFlags || section->updateCaveMenus()) {
+ if (!section->mMenuFlags.typeView || section->updateCaveMenus()) {
update_GameChallenge(section);
if (mSubState == 0) {
checkSMenu(section);
@@ -561,7 +561,7 @@ void GameState::onRedOrBlueSuckStart(VsGameSection* section, int player, bool is
{
if (isYellow) {
section->mYellowMarbleCounts[player]++;
- if (isYellow && section->mYellowMarbleCounts[player] < 4) {
+ if (isYellow && section->mYellowMarbleCounts[player] < VS_WIN_YELLOW_MARBLE_NUM) {
return;
}
}
@@ -995,15 +995,15 @@ void GameState::update_GameChallenge(VsGameSection* section)
disp.mGhostIconTimerP1 = section->mGhostIconTimers[0];
disp.mGhostIconTimerP2 = section->mGhostIconTimers[1];
- int marbleCountP1 = section->mMarbleCountP1;
- int marbleCountP2 = section->mMarbleCountP2;
+ int marbleCountP1 = section->mMarbleCount[0];
+ int marbleCountP2 = section->mMarbleCount[1];
- if (section->mMarbleCountP1 == 4 && moviePlayer->isFlag(MVP_IsActive)) {
- marbleCountP1 = section->mMarbleCountP1 - 1;
+ if (section->mMarbleCount[0] == VS_WIN_YELLOW_MARBLE_NUM && moviePlayer->isFlag(MVP_IsActive)) {
+ marbleCountP1 = section->mMarbleCount[0] - 1;
}
- if (section->mMarbleCountP2 == 4 && moviePlayer->isFlag(MVP_IsActive)) {
- marbleCountP2 = section->mMarbleCountP2 - 1;
+ if (section->mMarbleCount[1] == VS_WIN_YELLOW_MARBLE_NUM && moviePlayer->isFlag(MVP_IsActive)) {
+ marbleCountP2 = section->mMarbleCount[1] - 1;
}
disp.mMarbleCountP1 = marbleCountP1;
diff --git a/src/plugProjectKandoU/vsGS_Load.cpp b/src/plugProjectKandoU/vsGS_Load.cpp
index 4888d53cd..fb8113129 100644
--- a/src/plugProjectKandoU/vsGS_Load.cpp
+++ b/src/plugProjectKandoU/vsGS_Load.cpp
@@ -51,7 +51,7 @@ void LoadState::init(Game::VsGameSection* section, StateArg* args)
mIsGameStarting = 0;
mAutoStartTime = 15.0f;
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
section->mMarbleYellow[i] = nullptr;
}
}
diff --git a/src/plugProjectKandoU/vsGS_Result.cpp b/src/plugProjectKandoU/vsGS_Result.cpp
index 3571c89e6..c05b32d59 100644
--- a/src/plugProjectKandoU/vsGS_Result.cpp
+++ b/src/plugProjectKandoU/vsGS_Result.cpp
@@ -97,8 +97,8 @@ void ResultState::prepareMorimuraInfo(VsGameSection* section)
mResultInfo->mDisplayIndex = stageData->mStageIndex;
mResultInfo->mStageIndex = stageIndex;
mResultInfo->mTimeLeft = (int)section->mTimeLimit;
- mResultInfo->mPokos = section->mPokoCount * 10;
- mResultInfo->mPikminLeft = mPikminLeft * 10;
+ mResultInfo->mPokos = section->mPokoCount * CH_SCORE_POKO_MULTIPLIER;
+ mResultInfo->mPikminLeft = mPikminLeft * CH_SCORE_PIKMIN_MULTIPLIER;
mResultInfo->mScore = mResultInfo->mPokos + mResultInfo->mTimeLeft + mResultInfo->mPikminLeft;
mResultInfo->mHighScore = highScore;
diff --git a/src/plugProjectKandoU/vsGS_Title.cpp b/src/plugProjectKandoU/vsGS_Title.cpp
index f16cc91a7..b18e3064b 100644
--- a/src/plugProjectKandoU/vsGS_Title.cpp
+++ b/src/plugProjectKandoU/vsGS_Title.cpp
@@ -101,14 +101,14 @@ void TitleState::dvdload()
PSSystem::getSceneMgr()->doFirstLoad();
PSSystem::getSceneMgr()->doStartMainSeq();
- mChallengeTitleInfo = new Challenge2D_TitleInfo(getChallengeStageNum());
+ mChallengeTitleInfo = new Challenge2D_TitleInfo(CHALLENGE_COURSE_COUNT);
mVsTitleInfo = new Vs2D_TitleInfo(getVsStageNum());
for (int i = 0; i < 5; i++) {
sys->getPlayCommonData()->challenge_get_CourseState(i);
}
- for (int i = 0; i < getChallengeStageNum(); i++) {
+ for (int i = 0; i < CHALLENGE_COURSE_COUNT; i++) {
PlayChallengeGameData::CourseState* scores = sys->getPlayCommonData()->challenge_get_CourseState(i);
Challenge2D_TitleInfo::Info* displayData = (*mChallengeTitleInfo)(i);
ChallengeGame::StageData* fileData = mSection->mChallengeStageList->getStageData(i);
diff --git a/src/plugProjectKandoU/vsGameSection.cpp b/src/plugProjectKandoU/vsGameSection.cpp
index 6fb79697d..f5bf9c7ac 100644
--- a/src/plugProjectKandoU/vsGameSection.cpp
+++ b/src/plugProjectKandoU/vsGameSection.cpp
@@ -13,6 +13,7 @@
#include "Game/gameStat.h"
#include "Game/GameSystem.h"
#include "Game/MoviePlayer.h"
+#include "Game/PikiState.h"
#include "Game/Navi.h"
#include "Game/NaviParms.h"
#include "Game/PikiMgr.h"
@@ -75,17 +76,16 @@ int VsGameSection::mDrawCount;
VsGameSection::VsGameSection(JKRHeap* heap, bool gameMode)
: BaseGameSection(heap)
- , mMenuFlags(0)
{
mIsVersusMode = gameMode;
mIsChallengePerfect = true;
mChallengeStageNum = 0;
mVsStageNum = 0;
mVsWinner = -1;
- mLouieHandicap = 2;
- mOlimarHandicap = 2;
- mMarbleCountP2 = 0;
- mMarbleCountP1 = 0;
+ mLouieHandicap = VS_PIKMIN_HANDICAP_DEFAULT_VALUE;
+ mOlimarHandicap = VS_PIKMIN_HANDICAP_DEFAULT_VALUE;
+ mMarbleCount[1] = 0;
+ mMarbleCount[0] = 0;
mYellowMarbleCounts[1] = 0;
mYellowMarbleCounts[0] = 0;
mEditNumber = -2;
@@ -141,12 +141,7 @@ void VsGameSection::section_fadeout() { mCurrentState->on_section_fadeout(this);
* @note Address: 0x801C1148
* @note Size: 0x90
*/
-void VsGameSection::startMainBgm()
-{
- PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
- sceneMgr->checkScene();
- sceneMgr->mScenes->mChild->startMainSeq();
-}
+void VsGameSection::startMainBgm() { PSSystem::getSceneMgr()->doStartMainSeq(); }
/**
* @note Address: 0x801C11D8
@@ -178,19 +173,20 @@ void VsGameSection::onInit()
sprintf(mEditFilename, "random");
setupFixMemory();
- mChallengeStageList = new ChallengeGame::StageList();
+ mChallengeStageList = new ChallengeGame::StageList;
addGenNode(mChallengeStageList);
- mVsStageList = new VsGame::StageList();
+ mVsStageList = new VsGame::StageList;
addGenNode(mVsStageList);
loadChallengeStageList();
loadVsStageList();
- mFsm = new VsGame::FSM();
+ mFsm = new VsGame::FSM;
static_cast(mFsm)->init(this);
initPlayData();
mFsm->start(this, VsGame::VGS_Title, nullptr);
- mCurrentFloor = 0;
+ mCurrentFloor = 0;
+
mRedBlueYellowScore[1] = 0.0f;
mRedBlueYellowScore[0] = 0.0f;
mYellowScore[1] = 0.0f;
@@ -204,23 +200,13 @@ void VsGameSection::onInit()
mMarbleRedBlue[1] = nullptr;
mMarbleRedBlue[0] = nullptr;
- Radar::mgr = new Radar::Mgr();
+ Radar::mgr = new Radar::Mgr;
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
mMarbleYellow[i] = nullptr;
}
}
-/**
- * @note Address: 0x801C13E4
- * @note Size: 0x34
- */
-// void StateMachine::start(VsGameSection* section, int stateID, StateArg* arg)
-// {
-// section->mCurrentState = nullptr;
-// transit(section, stateID, arg);
-// }
-
/**
* @note Address: 0x801C1418
* @note Size: 0x8
@@ -314,7 +300,7 @@ void VsGameSection::onSetSoundScene()
}
floorInfo.mAlphaType = static_cast(mapMgr)->mFloorInfo->mParms.mFloorAlphaType.mValue;
- floorInfo.mBetaType = 0; // hardcoded mBetaType to 0; ignores floorinfo f012 setting
+ floorInfo.mBetaType = PSGame::CaveFloorInfo::BetaType_Normal; // hardcoded mBetaType to 0; ignores floorinfo f012 setting
if (!gameSystem->isMultiplayerMode()) {
floorInfo.setStageFlag(PSGame::SceneInfo::SCENEFLAG_Unk0, PSGame::SceneInfo::SFBS_1);
@@ -323,11 +309,8 @@ void VsGameSection::onSetSoundScene()
}
setDefaultPSSceneInfo(floorInfo);
- PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
- static_cast(sceneMgr)->newAndSetCurrentScene(floorInfo);
- sceneMgr = PSSystem::getSceneMgr();
- sceneMgr->checkScene();
- sceneMgr->mScenes->mChild->scene1stLoadSync();
+ PSMSetSceneInfo(floorInfo);
+ PSSystem::getSceneMgr()->doFirstLoad();
naviMgr->createPSMDirectorUpdator();
}
@@ -339,8 +322,8 @@ void VsGameSection::initPlayData()
{
playData->reset();
playData->setDevelopSetting(true, true);
- playData->mNaviLifeMax[NAVIID_Olimar] = naviMgr->mNaviParms->mNaviParms.mMaxHealth.mValue;
- playData->mNaviLifeMax[NAVIID_Louie] = naviMgr->mNaviParms->mNaviParms.mMaxHealth.mValue;
+ playData->mNaviLifeMax[NAVIID_Olimar] = naviMgr->mNaviParms->mNaviParms.mMaxHealth();
+ playData->mNaviLifeMax[NAVIID_Louie] = naviMgr->mNaviParms->mNaviParms.mMaxHealth();
}
/**
@@ -351,7 +334,7 @@ void VsGameSection::initPlayData()
void VsGameSection::onSetupFloatMemory()
{
Farm::farmMgr = nullptr;
- mTekiMgr = new VsGame::TekiMgr();
+ mTekiMgr = new VsGame::TekiMgr;
mCardMgr = new VsGame::CardMgr(this, mTekiMgr);
mCardMgr->loadResource();
const char* marbles[3] = { VsOtakaraName::cBedamaRed, VsOtakaraName::cBedamaBlue, VsOtakaraName::cBedamaYellow };
@@ -386,11 +369,11 @@ void VsGameSection::postSetupFloatMemory()
Vector3f position = Vector3f(0.0f);
createRedBlueBedamas(position);
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
mMarbleYellow[i] = nullptr;
}
- createYellowBedamas(7);
+ createYellowBedamas(VS_YELLOW_MARLBE_NUM);
initCardPellets();
}
@@ -415,17 +398,18 @@ void VsGameSection::onClearHeap()
*/
void VsGameSection::loadChallengeStageList()
{
- JKRDvdRipper::EAllocDirection EAlloc = JKRDvdRipper::ALLOC_DIR_BOTTOM;
- JKRExpandSwitch expandSwitch = JKRExpandSwitch();
- void* loadRam = JKRDvdRipper::loadToMainRAM(
- ((gGameConfig.mParms.mKFesVersion.mData) ? "/user/Matoba/challenge/kfes-stages.txt" : "/user/Matoba/challenge/stages.txt"), nullptr,
- expandSwitch, nullptr, nullptr, EAlloc, nullptr, nullptr, nullptr);
- if (!loadRam) {
+ // If KFesVersion is enabled, use the alternate stage list config
+ void* file = JKRDvdRipper::loadToMainRAM(
+ gGameConfig.mParms.mKFesVersion() ? "/user/Matoba/challenge/kfes-stages.txt" : "/user/Matoba/challenge/stages.txt", nullptr,
+ Switch_0, nullptr, nullptr, JKRDvdRipper::ALLOC_DIR_BOTTOM, nullptr, nullptr, nullptr);
+
+ if (!file) {
return;
}
- RamStream ram(loadRam, -1);
- ram.setMode(STREAM_MODE_TEXT, 1);
- mChallengeStageList->read(ram);
+
+ RamStream stream(file, -1);
+ stream.setMode(STREAM_MODE_TEXT, 1);
+ mChallengeStageList->read(stream);
}
/**
@@ -434,17 +418,15 @@ void VsGameSection::loadChallengeStageList()
*/
void VsGameSection::loadVsStageList()
{
- JKRDvdRipper::EAllocDirection EAlloc = JKRDvdRipper::ALLOC_DIR_BOTTOM;
- JKRExpandSwitch expandSwitch = JKRExpandSwitch();
- void* loadRam = JKRDvdRipper::loadToMainRAM("/user/abe/vs/stages.txt", nullptr, expandSwitch, nullptr, nullptr, EAlloc, nullptr,
- nullptr, nullptr);
- if (!loadRam) {
+ void* file = JKRDvdRipper::loadToMainRAM("/user/abe/vs/stages.txt", nullptr, Switch_0, nullptr, nullptr, JKRDvdRipper::ALLOC_DIR_BOTTOM,
+ nullptr, nullptr, nullptr);
+ if (!file) {
return;
}
- RamStream ram(loadRam, -1);
- ram.setMode(STREAM_MODE_TEXT, 1);
- mVsStageList->read(ram);
+ RamStream stream(file, -1);
+ stream.setMode(STREAM_MODE_TEXT, 1);
+ mVsStageList->read(stream);
}
/**
@@ -471,38 +453,48 @@ void VsGameSection::gmPikminZero() { }
void VsGameSection::goNextFloor(ItemHole::Item* hole) { mCurrentState->onNextFloor(this, hole); }
/**
+ * This function attempts to open the "Do you want to delve deeper?" message box upon interacting with a Hole object.
+ * If it opens succesfully, gameplay will be paused, and the active Hole object will be set.
+ *
* @note Address: 0x801C1C9C
* @note Size: 0x1D8
*/
void VsGameSection::openCaveMoreMenu(ItemHole::Item* hole, Controller* controller)
{
+ // Abort function if entering a cave was already confirmed.
if (mCurrentState->goingToCave(this)) {
return;
}
+ // In a multiplayer mode, set the menu to use the controller given to the function, otherwise always use the Player 1 controller.
if (gameSystem->isMultiplayerMode() && controller) {
Screen::gGame2DMgr->setGamePad(controller);
} else {
Screen::gGame2DMgr->setGamePad(mControllerP1);
}
+ // This cave ID isn't used for anything (2p_c isn't even in the list of valid cave IDs)
og::Screen::DispMemberCaveMore cave;
cave.mCaveID = '2p_c';
- int mePikis = GameStat::mePikis;
+
+ // If there are any Pikmin seeds in the map, enable the warning
+ int mePikis = GameStat::mePikis;
if (mePikis > 0) {
cave.mPikiInDanger = true;
- int map_pikis = GameStat::getMapPikmins(AllPikminCalcs);
- if (mePikis == map_pikis) {
+
+ // If the number of Pikmin seeds in the map equals the total Pikmin count in the map,
+ // set the screen to say you are unable to proceed, because all Pikmin are buried.
+ if (mePikis == GameStat::getMapPikmins(AllPikminCalcs)) {
cave.mCantProceed = true;
} else {
cave.mCantProceed = false;
}
-
} else {
cave.mCantProceed = false;
cave.mPikiInDanger = false;
}
+ // Open the cave menu UI, only pause gameplay and set the active hole object if the screen was loaded successfully.
bool open = Screen::gGame2DMgr->open_CaveMoreMenu(cave);
if (open) {
mHole = hole;
@@ -517,6 +509,7 @@ void VsGameSection::openCaveMoreMenu(ItemHole::Item* hole, Controller* controlle
*/
void VsGameSection::openKanketuMenu(ItemBigFountain::Item* fountain, Controller* controller)
{
+ // In a multiplayer mode, set the menu to use the controller given to the function, otherwise always use the Player 1 controller.
if (gameSystem->isMultiplayerMode() && controller) {
Screen::gGame2DMgr->setGamePad(controller);
} else {
@@ -524,25 +517,29 @@ void VsGameSection::openKanketuMenu(ItemBigFountain::Item* fountain, Controller*
}
og::Screen::DispMemberKanketuMenu cave;
+
+ // If there are any Pikmin seeds in the map, enable the warning
int mePikis = GameStat::mePikis;
if (mePikis > 0) {
cave.mPikiInDanger = true;
- int map_pikis = GameStat::getMapPikmins(AllPikminCalcs);
- if (mePikis == map_pikis) {
+
+ // If the number of Pikmin seeds in the map equals the total Pikmin count in the map,
+ // set the screen to say you are unable to proceed, because all Pikmin are buried.
+ if (mePikis == GameStat::getMapPikmins(AllPikminCalcs)) {
cave.mCantProceed = true;
} else {
cave.mCantProceed = false;
}
-
} else {
cave.mCantProceed = false;
cave.mPikiInDanger = false;
}
+ // Open the geyser menu UI, only pause gameplay and set the active geyser object if the screen was loaded successfully.
bool open = Screen::gGame2DMgr->open_ChallengeKanketuMenu(cave);
if (open) {
mFountain = fountain;
- mMenuFlags |= 4;
+ mMenuFlags.set(VsSection_MenuKanketuOpen);
gameSystem->setPause(true, "op-kk", 3);
gameSystem->setMoviePause(true, "op-kk");
}
@@ -554,9 +551,9 @@ void VsGameSection::openKanketuMenu(ItemBigFountain::Item* fountain, Controller*
*/
void VsGameSection::clearCaveMenus()
{
- mMenuFlags = 0;
- mHole = nullptr;
- mFountain = nullptr;
+ mMenuFlags.clear();
+ mHole = nullptr;
+ mFountain = nullptr;
}
/**
@@ -565,7 +562,7 @@ void VsGameSection::clearCaveMenus()
*/
bool VsGameSection::updateCaveMenus()
{
- if (mMenuFlags & 2) {
+ if (mMenuFlags.isSet(VsSection_MenuCaveMoreOpen)) {
switch (Screen::gGame2DMgr->check_CaveMoreMenu()) {
case Screen::Game2DMgr::CHECK2D_CaveMoreMenu_MenuOpen:
break;
@@ -575,14 +572,14 @@ bool VsGameSection::updateCaveMenus()
playData->mNaviLifeMax[NAVIID_Louie] = naviMgr->getAt(NAVIID_Louie)->mHealth;
gameSystem->setPause(false, "more-yes", 3);
gameSystem->setMoviePause(false, "more-yes");
- mMenuFlags &= ~2;
+ mMenuFlags.unset(VsSection_MenuCaveMoreOpen);
goNextFloor(mHole);
return true;
case Screen::Game2DMgr::CHECK2D_CaveMoreMenu_Cancel:
gameSystem->setPause(false, "more-no", 3);
gameSystem->setMoviePause(false, "more-no");
- mMenuFlags &= ~2;
+ mMenuFlags.unset(VsSection_MenuCaveMoreOpen);
break;
case Screen::Game2DMgr::CHECK2D_CaveMoreMenu_Unused:
@@ -590,7 +587,7 @@ bool VsGameSection::updateCaveMenus()
break;
}
- } else if (mMenuFlags & 4) {
+ } else if (mMenuFlags.isSet(VsSection_MenuKanketuOpen)) {
switch (Screen::gGame2DMgr->check_KanketuMenu()) {
case Screen::Game2DMgr::CHECK2D_KanketuMenu_MenuOpen:
break;
@@ -598,7 +595,7 @@ bool VsGameSection::updateCaveMenus()
case Screen::Game2DMgr::CHECK2D_KanketuMenu_Confirm:
gameSystem->setPause(false, "kk-yes", 3);
gameSystem->setMoviePause(false, "kk-yes");
- mMenuFlags &= ~4;
+ mMenuFlags.unset(VsSection_MenuKanketuOpen);
MoviePlayArg arg("s0C_cv_escape", nullptr, mMovieFinishCallback, 0);
arg.mOrigin = mFountain->getPosition();
arg.mAngle = mFountain->getFaceDir();
@@ -611,7 +608,7 @@ bool VsGameSection::updateCaveMenus()
case Screen::Game2DMgr::CHECK2D_KanketuMenu_Cancel:
gameSystem->setPause(false, "kk-no", 3);
gameSystem->setMoviePause(false, "kk-no");
- mMenuFlags &= ~4;
+ mMenuFlags.unset(VsSection_MenuKanketuOpen);
break;
case Screen::Game2DMgr::CHECK2D_KanketuMenu_Unused:
@@ -679,7 +676,7 @@ void VsGameSection::createFallPikmins(PikiContainer& setPikmin, int unused2)
Piki* piki = pikiMgr->birth();
spawn += start;
if (piki) {
- PikiInitArg arg(15);
+ PikiInitArg arg(PIKISTATE_Tane);
piki->init(&arg);
piki->mFaceDir = randFloat() * TAU;
piki->setPosition(spawn, false);
@@ -712,9 +709,9 @@ void VsGameSection::createVsPikmins()
pikmin->clear();
int& reds = pikmin->getCount(Red, Leaf);
- reds = mOlimarHandicap * 5;
+ reds = mOlimarHandicap * VS_PIKMIN_HANDICAP_MULTIPLIER;
int& blues = pikmin->getCount(Blue, Leaf);
- blues = mLouieHandicap * 5;
+ blues = mLouieHandicap * VS_PIKMIN_HANDICAP_MULTIPLIER;
Vector3f spawnOnyonPos;
for (int color = FirstPikmin; color < PikiColorCount; color++) {
@@ -737,7 +734,7 @@ void VsGameSection::createVsPikmins()
spawn += spawnOnyonPos;
if (piki) {
- PikiInitArg arg(-1);
+ PikiInitArg arg(PIKISTATE_NULL);
piki->init(&arg);
piki->setPosition(spawn, false);
piki->changeShape(color);
@@ -746,22 +743,22 @@ void VsGameSection::createVsPikmins()
}
}
}
+
const char* marbles[2] = { VsOtakaraName::cBedamaRed, VsOtakaraName::cBedamaBlue };
for (int onyonType = 0; onyonType < 2; onyonType++) {
Onyon* currentOnyon = ItemOnyon::mgr->getOnyon(1 - onyonType);
PelletIterator pelletIter;
- pelletIter.first();
- while (!pelletIter.isDone()) {
+ CI_LOOP(pelletIter)
+ {
Pellet* pellet = *pelletIter;
- int i = strcmp(marbles[onyonType], pellet->mConfig->mParams.mName.mData);
- if (i == 0) {
+ if (!strcmp(marbles[onyonType], pellet->mConfig->mParams.mName.mData)) {
Vector3f flagPos = currentOnyon->getFlagSetPos();
flagPos.y += pellet->getCylinderHeight() * 0.5f;
pellet->setPosition(flagPos, false);
}
- pelletIter.next();
}
}
+
Navi* orima = naviMgr->getAt(NAVIID_Olimar);
orima->mSprayCounts[0] = mVsStageData->mStartNumSpicy;
orima->mSprayCounts[1] = mVsStageData->mStartNumBitter;
@@ -828,10 +825,15 @@ bool GameMessageVsRedOrSuckStart::actVs(VsGameSection* section)
bool GameMessageVsGetOtakara::actVs(VsGameSection* section)
{
if (section->mCurrentState) {
- section->mYellowMarbleCounts[mOnionType - 2]++;
- PSSetLastBeedamaDirection(mOnionType == 0, section->mYellowMarbleCounts[mOnionType - 2] == 3);
- if (section->mYellowMarbleCounts[mOnionType - 2] >= 4) {
- section->mCurrentState->onBattleFinished(section, mOnionType, true);
+ // increase the players marble count
+ section->mMarbleCount[mPlayerID]++;
+
+ // update the 1 away bgm mix
+ PSSetLastBeedamaDirection(mPlayerID == 0, section->mMarbleCount[mPlayerID] == (VS_WIN_YELLOW_MARBLE_NUM - 1));
+
+ // If the player has 4 marbles, end the game
+ if (section->mMarbleCount[mPlayerID] >= VS_WIN_YELLOW_MARBLE_NUM) {
+ section->mCurrentState->onBattleFinished(section, mPlayerID, true);
}
}
@@ -855,12 +857,12 @@ bool GameMessageVsAddEnemy::actVs(VsGameSection* section)
bool GameMessagePelletBorn::actVs(VsGameSection* section)
{
if (mPellet->mPelletFlag == Pellet::FLAG_VS_BEDAMA_YELLOW) { // is yellow bedama
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
if (section->mMarbleYellow[i] == mPellet) {
return false;
}
}
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
if (!section->mMarbleYellow[i]) {
section->mMarbleYellow[i] = mPellet;
return true;
@@ -878,7 +880,7 @@ bool GameMessagePelletBorn::actVs(VsGameSection* section)
bool GameMessagePelletDead::actVs(VsGameSection* section)
{
if (mPellet->mPelletFlag == Pellet::FLAG_VS_BEDAMA_YELLOW) { // is yellow bedama
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
if (section->mMarbleYellow[i] == mPellet) {
section->mMarbleYellow[i] = nullptr;
return true;
@@ -897,7 +899,7 @@ bool GameMessagePelletDead::actVs(VsGameSection* section)
bool GameMessageVsBirthTekiTreasure::actVs(VsGameSection* section)
{
// This function spawns the shearwigs (suprise maggots)
- Sys::Sphere sphere(mPosition, 20.0f);
+ Sys::Sphere sphere(mPosition, VS_SHEARWIG_SPAWN_RADIUS);
int target = 0;
int redPikis = 0;
int bluePikis = 0;
@@ -1015,8 +1017,8 @@ Pellet* VsGameSection::createCardPellet()
pelletArg.mTextIdentifier = config->mParams.mName.mData;
pelletArg.mPelletType = kind;
pelletArg.mDoSkipCreateModel = true;
- pelletArg.mMinCarriers = 1;
- pelletArg.mMaxCarriers = 1;
+ pelletArg.mMinCarriers = VS_CHERRY_MIN_WEIGHT;
+ pelletArg.mMaxCarriers = VS_CHERRY_MAX_WEIGHT;
for (int i = 0; i < mMaxCherries; i++) {
Pellet* pellet = mCherryArray[i];
@@ -1035,7 +1037,7 @@ Pellet* VsGameSection::createCardPellet()
*/
void VsGameSection::initCardPellets()
{
- mMaxCherries = 10;
+ mMaxCherries = VS_CHERRY_MAX_COUNT;
mCherryArray = new Pellet*[mMaxCherries];
char* name = const_cast(VsOtakaraName::cCoin);
@@ -1047,8 +1049,8 @@ void VsGameSection::initCardPellets()
arg.mPelletIndex = config->mParams.mIndex;
arg.mTextIdentifier = config->mParams.mName.mData;
arg.mPelletType = kind;
- arg.mMinCarriers = 1;
- arg.mMaxCarriers = 1;
+ arg.mMinCarriers = VS_CHERRY_MIN_WEIGHT;
+ arg.mMaxCarriers = VS_CHERRY_MAX_WEIGHT;
for (int j = 0; j < mMaxCherries; j++) {
Pellet* pellet = pelletMgr->birth(&arg);
@@ -1180,7 +1182,7 @@ void VsGameSection::dropCard(VsGameSection::DropCardArg& arg)
{
Vector3f spawn;
Cave::randMapMgr->getItemDropPosition(spawn, arg.mDropMinDistance, arg.mDropMaximumDistance);
- f32 radius = (randFloat() * 20.0f);
+ f32 radius = (randFloat() * VS_CHERRY_SPAWN_RANDOM_OFFSET);
f32 angle = randFloat() * TAU;
spawn += Vector3f(radius * sinf(angle), 0.0f, radius * cosf(angle));
@@ -1217,8 +1219,8 @@ void VsGameSection::createYellowBedamas(int bedamas)
if (bedamas == 0) {
return;
}
- if (bedamas >= 7) {
- bedamas = 7;
+ if (bedamas >= VS_YELLOW_MARLBE_NUM) {
+ bedamas = VS_YELLOW_MARLBE_NUM;
}
}
@@ -1233,8 +1235,8 @@ void VsGameSection::createYellowBedamas(int bedamas)
pelletArg.mTextIdentifier = config->mParams.mName.mData;
pelletArg.mPelletType = kind;
- pelletArg.mMinCarriers = 1;
- pelletArg.mMaxCarriers = 8;
+ pelletArg.mMinCarriers = VS_MARBLE_MIN_WEIGHT;
+ pelletArg.mMaxCarriers = VS_MARBLE_MAX_WEIGHT;
JUT_ASSERTLINE(2163, bedamas <= 50, "oosugi %d\n", bedamas);
Vector3f positions[50];
@@ -1260,8 +1262,8 @@ void VsGameSection::createRedBlueBedamas(Vector3f& pos)
pelletArg.mPelletIndex = config->mParams.mIndex;
pelletArg.mTextIdentifier = config->mParams.mName.mData;
pelletArg.mPelletType = kind;
- pelletArg.mMinCarriers = 1;
- pelletArg.mMaxCarriers = 8;
+ pelletArg.mMinCarriers = VS_MARBLE_MIN_WEIGHT;
+ pelletArg.mMaxCarriers = VS_MARBLE_MAX_WEIGHT;
Pellet* pellet = pelletMgr->birth(&pelletArg);
Vector3f position;
Cave::randMapMgr->getItemDropPosition(position, 0.2f, 0.8f);
@@ -1276,14 +1278,13 @@ void VsGameSection::createRedBlueBedamas(Vector3f& pos)
*/
void VsGameSection::calcVsScores()
{
-
- f32 yellowMarbleRedDist[7];
- f32 yellowMarbleBlueDist[7];
+ f32 yellowMarbleRedDist[VS_YELLOW_MARLBE_NUM];
+ f32 yellowMarbleBlueDist[VS_YELLOW_MARLBE_NUM];
Onyon* onyons[2];
onyons[0] = ItemOnyon::mgr->getOnyon(ONYON_TYPE_RED);
onyons[1] = ItemOnyon::mgr->getOnyon(ONYON_TYPE_BLUE);
- for (int i = 0; i < 7; i++) {
+ for (int i = 0; i < VS_YELLOW_MARLBE_NUM; i++) {
Pellet* marble = mMarbleYellow[i];
if (marble && marble->isAlive() && marble->getStateID() == 0) {
@@ -1336,7 +1337,7 @@ void VsGameSection::calcVsScores()
f32 yellowScore[2];
for (int i = 0; i < 2; i++) {
f32 count = mYellowMarbleCounts[i];
- for (int j = 0; j < 7; j++) {
+ for (int j = 0; j < VS_YELLOW_MARLBE_NUM; j++) {
if (i == 0 && yellowMarbleRedDist[j] >= 0.0f) {
count += yellowMarbleRedDist[j];
}
@@ -1373,9 +1374,9 @@ void VsGameSection::calcVsScores()
mRedBlueYellowScore[1] = redBlueScore[0] + ((yellowScore[1] - yellowScore[0]) - redBlueScore[1]);
f32 cherryValue;
- f32 cherryRedDist[10];
- f32 cherryBlueDist[10];
- for (int i = 0; i < 10; i++) {
+ f32 cherryRedDist[VS_CHERRY_MAX_COUNT];
+ f32 cherryBlueDist[VS_CHERRY_MAX_COUNT];
+ for (int i = 0; i < VS_CHERRY_MAX_COUNT; i++) {
Pellet* cherry = mCherryArray[i];
if (cherry->isAlive() && cherry->getStateID() == 0) {
int cherryCarryFactor = -1;
@@ -1427,7 +1428,7 @@ void VsGameSection::calcVsScores()
for (int i = 0; i < 2; i++) {
mMaxCherryScore[i] = 0.0f;
f32 count = 0.0f;
- for (int j = 0; j < 10; j++) {
+ for (int j = 0; j < VS_CHERRY_MAX_COUNT; j++) {
f32 miniCount = 0.0f;
if (i == 0 && cherryRedDist[j] >= 0.0f) {
count += cherryRedDist[j];
@@ -1479,83 +1480,4 @@ void VsGameSection::clearGetCherryCount()
mPlayer2Cherries = 0;
}
-/**
- * @note Address: 0x801C49E0
- * @note Size: 0x4
- */
-// void StateMachine::init(VsGameSection*) { }
-
-/**
- * @note Address: 0x801C49E4
- * @note Size: 0x64
- */
-// void StateMachine::create(int states)
-// {
-// mLimit = states;
-// mCount = 0;
-// mStates = new FSMState*[mLimit];
-// mIndexToIDArray = new int[mLimit];
-// mIdToIndexArray = new int[mLimit];
-// }
-
-/**
- * @note Address: 0x801C4A48
- * @note Size: 0x9C
- */
-// void StateMachine::transit(VsGameSection* section, int stateID, StateArg* arg)
-// {
-
-// int stateIndex = mIdToIndexArray[stateID];
-// VsGame::State* currentState = section->mCurrentState;
-// if (currentState) {
-// currentState->cleanup(section);
-// mCurrentID = currentState->mId;
-// }
-// if (stateIndex >= mLimit) {
-// while (true)
-// ;
-// }
-// VsGame::State* state = static_cast(mStates[stateIndex]);
-// section->mCurrentState = state;
-// state->init(section, arg);
-// }
-
-/**
- * @note Address: 0x801C4AEC
- * @note Size: 0x84
- */
-// void StateMachine::registerState(FSMState* state)
-// {
-// if (mCount >= mLimit) {
-// return;
-// }
-// mStates[mCount] = state;
-// bool inBounds;
-// if (state->mId < 0 || state->mId >= mLimit) {
-// inBounds = false;
-// } else {
-// inBounds = true;
-// }
-
-// if (!inBounds) {
-// return;
-// }
-
-// state->mStateMachine = this;
-// mIndexToIDArray[mCount] = state->mId;
-// mIdToIndexArray[state->mId] = mCount;
-// mCount++;
-// }
-
-/**
- * @note Address: 0x801C4B70
- * @note Size: 0x38
- */
-// void StateMachine::exec(VsGameSection* section)
-// {
-// if (section->mCurrentState) {
-// section->mCurrentState->exec(section);
-// }
-// }
-
} // namespace Game
diff --git a/src/plugProjectKonoU/khCaveResult.cpp b/src/plugProjectKonoU/khCaveResult.cpp
index 5c3907216..b5c9df551 100644
--- a/src/plugProjectKonoU/khCaveResult.cpp
+++ b/src/plugProjectKonoU/khCaveResult.cpp
@@ -726,7 +726,7 @@ void ObjCaveResult::statusForceScroll()
FOREACH_NODE(Game::Result::TNode, mResultNode->mChild, cNode)
{
LostItemMgr* mgr = cNode->mItemMgr;
- if (i == mScrollSelIndex + 2 && (mgr->mFlags & LOSTITEM_Unk1) != 1) {
+ if (i == mScrollSelIndex + 2 && (mgr->mFlags & LOSTITEM_IsActive) != 1) {
cNode->mItemMgr->init(pos, i % 2); // is i odd
}
i++;
@@ -861,30 +861,30 @@ void ObjCaveResult::updateAnimation()
mScissorMin = vec1.y + 0.5f;
mScissorMax = vec2.y - yoffs;
- mMainAnim->mCurrentFrame = mAnimTimers[0];
- mMainAnimColor->mCurrentFrame = mAnimTimers[2];
- mAnimTexSRT->mCurrentFrame = mAnimTimers[4];
- mAnimTevReg->mCurrentFrame = mAnimTimers[5];
+ mMainAnim->setFrame(mAnimTimers[0]);
+ mMainAnimColor->setFrame(mAnimTimers[2]);
+ mAnimTexSRT->setFrame(mAnimTimers[4]);
+ mAnimTevReg->setFrame(mAnimTimers[5]);
mScreenMain->animation();
if (!isFlag(CAVERESFLAG_SaveOpen)) {
mAnimTimers[0] += 1.0f;
- if (mAnimTimers[0] >= mMainAnim->mTotalFrameCount) {
+ if (mAnimTimers[0] >= mMainAnim->getFrameMax()) {
mAnimTimers[0] = 0.0f;
}
mAnimTimers[2] += 1.0f;
- if (mAnimTimers[2] >= mMainAnimColor->mTotalFrameCount) {
+ if (mAnimTimers[2] >= mMainAnimColor->getFrameMax()) {
mAnimTimers[2] = 0.0f;
}
mAnimTimers[4] += 1.0f;
- if (mAnimTimers[4] >= mAnimTexSRT->mTotalFrameCount) {
+ if (mAnimTimers[4] >= mAnimTexSRT->getFrameMax()) {
mAnimTimers[4] = 0.0f;
}
mAnimTimers[5] += 1.0f;
- if (mAnimTimers[5] >= mAnimTevReg->mTotalFrameCount) {
+ if (mAnimTimers[5] >= mAnimTevReg->getFrameMax()) {
mAnimTimers[5] = 0.0f;
}
}
@@ -893,8 +893,8 @@ void ObjCaveResult::updateAnimation()
mScreenMain->search('Panacomp')->updateScale(mScaleMgr->calc());
if (isFlag(CAVERESFLAG_DrawComp)) {
- mCompleteAnim->mCurrentFrame = mAnimTimers[1];
- mCompleteAnimColor->mCurrentFrame = mAnimTimers[3];
+ mCompleteAnim->setFrame(mAnimTimers[1]);
+ mCompleteAnimColor->setFrame(mAnimTimers[3]);
mScreenComplete->animation();
if (mAnimTimers[1] >= 30.0f && !isFlag(CAVERESFLAG_MakeEfx)) {
u16 y = System::getRenderModeObj()->efbHeight;
@@ -956,15 +956,15 @@ void ObjCaveResult::pikminSE()
*/
LostItem::LostItem()
{
- mRect.p1.y = 0.0f;
- mRect.p1.x = 0.0f;
- mRect.p2.y = 0.0f;
- mRect.p2.x = 0.0f;
- mAlpha = 255;
- _14 = -40;
- _1A = 0;
- mAngle = 0;
- mCounter = false;
+ mRect.p1.y = 0.0f;
+ mRect.p1.x = 0.0f;
+ mRect.p2.y = 0.0f;
+ mRect.p2.x = 0.0f;
+ mAlpha = 255;
+ mAlphaChangeSpeed = -40;
+ mAngleChangeSpeed = 0;
+ mAngle = 0;
+ mCounter = false;
}
/**
@@ -973,30 +973,29 @@ LostItem::LostItem()
*/
bool LostItem::update()
{
- bool flag;
+ bool finished;
if (mAlpha == 0) {
- flag = true;
-
+ finished = true;
} else {
if (mCounter == 0) {
- mAlpha += _14;
- if (mAlpha < (int)-_14) {
+ mAlpha += mAlphaChangeSpeed;
+ if (mAlpha < (int)-mAlphaChangeSpeed) {
mAlpha = 0;
}
} else {
mCounter--;
}
- flag = false;
- mRect.p2.y += _10;
+ finished = false;
+ mRect.p2.y += mFallSpeed;
mRect.p2.x *= 0.85f;
mRect.p2.y *= 0.85f;
mRect.p1.x += mRect.p2.x;
mRect.p1.y += mRect.p2.y;
- mAngle += _1A;
+ mAngle += mAngleChangeSpeed;
}
- return flag;
+ return finished;
}
/**
@@ -1021,49 +1020,52 @@ LostItemMgr::LostItemMgr(int count)
*/
void LostItemMgr::init(const JGeometry::TVec2f& pos, bool isOdd)
{
- if (mMaxPanes) {
- f32 x = pos.x;
- f32 y = pos.y;
- if (isOdd) {
- x += 60.0f;
- }
+ if (mMaxPanes == 0) {
+ return;
+ }
- for (int i = 0; i < mMaxPanes; i++) {
- f32 x1 = randFloat();
- f32 x2 = randFloat();
- f32 y1 = randFloat();
- f32 y2 = randFloat();
- f32 test = randFloat();
-
- LostItem* item = &mItemList[i];
- item->mRect.p1.x = x;
- item->mRect.p1.y = y;
- item->mRect.p2.x = 40.0f * test - 20.0f;
- item->mRect.p2.y = 32.0f * y2 - 30.0f;
-
- item->_10 = (4.0f * y1 + 2.0f);
- item->_1A = (10000.0f * x2 - 5000.0f);
- item->mCounter = (10.0f * x1 + 8.0f);
- }
+ f32 x = pos.x;
+ f32 y = pos.y;
+ if (isOdd) {
+ x += 60.0f;
+ }
+
+ for (int i = 0; i < mMaxPanes; i++) {
+ f32 x1 = randFloat();
+ f32 x2 = randFloat();
+ f32 y1 = randFloat();
+ f32 y2 = randFloat();
+ f32 test = randFloat();
+
+ LostItem* item = &mItemList[i];
+ item->mRect.p1.x = x;
+ item->mRect.p1.y = y;
+ item->mRect.p2.x = 40.0f * test - 20.0f;
+ item->mRect.p2.y = 32.0f * y2 - 30.0f;
+
+ item->mFallSpeed = (4.0f * y1 + 2.0f);
+ item->mAngleChangeSpeed = (10000.0f * x2 - 5000.0f);
+ item->mCounter = (10.0f * x1 + 8.0f);
+ }
- f32 xoffs[5] = { kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX1, kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX2,
- kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX3, kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX4,
- kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX5 };
+ f32 xoffs[5] = { kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX1, kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX2,
+ kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX3, kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX4,
+ kh::Screen::ObjCaveResult::msVal.mLostItemSmokeOffsetX5 };
- if (isOdd) {
- xoffs[0] += 60.0f;
- }
- f32 efxY = pos.y - 10.0f;
- f32 efxX = pos.x;
- for (int i = 0; i < 5; i++) {
- efx2d::T2DChangesmoke efx;
- Vector2f pos(efxX + xoffs[i], efxY);
- efx2d::Arg arg(pos);
- efx.create(&arg);
- }
- PSSystem::spSysIF->playSystemSe(PSSE_SY_PIKI_DECREMENT, 0);
- setFlag(0x1 + 0x2);
+ if (isOdd) {
+ xoffs[0] += 60.0f;
+ }
+ f32 efxY = pos.y - 10.0f;
+ f32 efxX = pos.x;
+ for (int i = 0; i < 5; i++) {
+ efx2d::T2DChangesmoke efx;
+ Vector2f pos(efxX + xoffs[i], efxY);
+ efx2d::Arg arg(pos);
+ efx.create(&arg);
}
+
+ PSSystem::spSysIF->playSystemSe(PSSE_SY_PIKI_DECREMENT, 0);
+ setFlag(LOSTITEM_IsActive | 0x2);
}
/**
@@ -1072,17 +1074,17 @@ void LostItemMgr::init(const JGeometry::TVec2f& pos, bool isOdd)
*/
void LostItemMgr::update()
{
- if (!isFlag(0x1)) {
+ if (!isFlag(LOSTITEM_IsActive)) {
return;
}
bool doend = true;
- for (int i = 0; i < (int)mMaxPanes; i++) {
+ for (int i = 0; i < mMaxPanes; i++) {
doend &= mItemList[i].update();
}
if (doend) {
- resetFlag(0x1);
+ resetFlag(LOSTITEM_IsActive);
}
}
@@ -1092,10 +1094,10 @@ void LostItemMgr::update()
*/
void LostItemMgr::draw(P2DScreen::Mgr_tuning* screen, u64 tag, const ResTIMG* timg, Graphics& gfx)
{
- if (isFlag(0x1)) {
+ if (isFlag(LOSTITEM_IsActive)) {
kh::Screen::setTex(screen, tag, timg);
J2DPane* pane = screen->search(tag);
- for (int i = 0; i < (int)mMaxPanes; i++) {
+ for (int i = 0; i < mMaxPanes; i++) {
pane->mOffset = JGeometry::TVec2f(mItemList[i].mRect.p1.x, mItemList[i].mRect.p1.y);
pane->calcMtx();
diff --git a/src/plugProjectKonoU/khDayEndResult.cpp b/src/plugProjectKonoU/khDayEndResult.cpp
index 3b9d10de7..d6d6814fb 100644
--- a/src/plugProjectKonoU/khDayEndResult.cpp
+++ b/src/plugProjectKonoU/khDayEndResult.cpp
@@ -223,7 +223,7 @@ void ObjDayEndResultBase::doUpdateFinish()
bool ObjDayEndResultBase::doUpdateFadein()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += msVal.mAnimRate;
@@ -250,7 +250,7 @@ void ObjDayEndResultBase::doUpdateFadeinFinish()
bool ObjDayEndResultBase::doUpdateFadeout()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += msVal.mAnimRate;
@@ -284,51 +284,51 @@ void ObjDayEndResultBase::doDraw(Graphics& gfx)
*/
void ObjDayEndResultBase::updateCommon()
{
- mTitleAnmTransform->mCurrentFrame = mTitleAnimTransformTimer;
- mTitleAnmColor->mCurrentFrame = mTitleAnimColorTimer;
+ mTitleAnmTransform->setFrame(mTitleAnimTransformTimer);
+ mTitleAnmColor->setFrame(mTitleAnimColorTimer);
mScreenTitle->animation();
mTitleAnimTransformTimer += 1.0f;
mTitleAnimColorTimer += 1.0f;
- if (mTitleAnimTransformTimer >= mTitleAnmTransform->mTotalFrameCount) {
+ if (mTitleAnimTransformTimer >= mTitleAnmTransform->getFrameMax()) {
mTitleAnimTransformTimer = 0.0f;
}
- if (mTitleAnimColorTimer >= mTitleAnmColor->mTotalFrameCount) {
+ if (mTitleAnimColorTimer >= mTitleAnmColor->getFrameMax()) {
mTitleAnimColorTimer = 0.0f;
}
- mMainAnimSRT->mCurrentFrame = mMainAnimTimer3;
- mMainAnimTev->mCurrentFrame = mMainAnimTimer4;
+ mMainAnimSRT->setFrame(mMainAnimTimer3);
+ mMainAnimTev->setFrame(mMainAnimTimer4);
mScreenMain->animation();
mMainAnimTimer3 += 1.0f;
mMainAnimTimer4 += 1.0f;
- if (mMainAnimTimer3 >= mMainAnimSRT->mTotalFrameCount) {
+ if (mMainAnimTimer3 >= mMainAnimSRT->getFrameMax()) {
mMainAnimTimer3 = 0.0f;
}
- if (mMainAnimTimer4 >= mMainAnimTev->mTotalFrameCount) {
+ if (mMainAnimTimer4 >= mMainAnimTev->getFrameMax()) {
mMainAnimTimer4 = 0.0f;
}
- mMainAnimTrans2->mCurrentFrame = mMainAnimTimer2;
+ mMainAnimTrans2->setFrame(mMainAnimTimer2);
mScreenMain->search('Ntitle')->animationTransform();
mMainAnimTimer2 += 1.0f;
- if (mMainAnimTimer2 >= mMainAnimTrans2->mTotalFrameCount) {
+ if (mMainAnimTimer2 >= mMainAnimTrans2->getFrameMax()) {
mMainAnimTimer2 = 0.0f;
}
- mStarsAnimColor->mCurrentFrame = mStarsAnimTimer1;
+ mStarsAnimColor->setFrame(mStarsAnimTimer1);
mScreenStars->animation();
mStarsAnimTimer1 += 1.0f;
- if (mStarsAnimTimer1 >= mStarsAnimColor->mTotalFrameCount) {
+ if (mStarsAnimTimer1 >= mStarsAnimColor->getFrameMax()) {
mStarsAnimTimer1 = 0.0f;
}
@@ -550,7 +550,7 @@ bool ObjDayEndResultItem::doStart(const ::Screen::StartSceneArg* sceneArg)
bool ObjDayEndResultItem::doUpdateFadein()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += ObjDayEndResultBase::msVal.mAnimRate;
@@ -645,7 +645,7 @@ bool ObjDayEndResultItem::doUpdate()
bool ObjDayEndResultItem::doUpdateFadeout()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += ObjDayEndResultBase::msVal.mAnimRate;
@@ -938,11 +938,11 @@ void ObjDayEndResultItem::updateCommon()
mScreenMain->animation();
- mMainAnimTrans3->mCurrentFrame = mMainAnimTimer5;
+ mMainAnimTrans3->setFrame(mMainAnimTimer5);
mScreenMain->search('N_3d')->animationTransform();
mMainAnimTimer5++;
- if (mMainAnimTimer5 >= mMainAnimTrans3->mTotalFrameCount) {
+ if (mMainAnimTimer5 >= mMainAnimTrans3->getFrameMax()) {
mMainAnimTimer5 = 0.0f;
}
}
@@ -1216,7 +1216,7 @@ void ObjDayEndResultIncP::doCreate(JKRArchive* arc)
bool ObjDayEndResultIncP::doUpdateFadein()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += ObjDayEndResultBase::msVal.mAnimRate;
@@ -1336,7 +1336,7 @@ bool ObjDayEndResultIncP::doUpdate()
bool ObjDayEndResultIncP::doUpdateFadeout()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += ObjDayEndResultBase::msVal.mAnimRate;
@@ -1382,13 +1382,13 @@ void ObjDayEndResultIncP::statusNormal()
*/
void ObjDayEndResultIncP::statusFadeout()
{
- mMainAnimTrans3->mCurrentFrame = mMainAnimTimer5;
+ mMainAnimTrans3->setFrame(mMainAnimTimer5);
if (mMainAnimTimer5 < 404.0f) {
mMainAnimTimer5 += 1.0f;
return;
}
- mMainAnimTrans4->mCurrentFrame = mMainAnimTimer6;
+ mMainAnimTrans4->setFrame(mMainAnimTimer6);
if (mMainAnimTimer6 < 409.0f) {
mMainAnimTimer6 += 1.0f;
return;
@@ -1425,13 +1425,13 @@ void ObjDayEndResultIncP::statusDecP()
*/
void ObjDayEndResultIncP::statusFadein()
{
- mMainAnimTrans4->mCurrentFrame = mMainAnimTimer6;
+ mMainAnimTrans4->setFrame(mMainAnimTimer6);
if (mMainAnimTimer6 > 404.0f) {
mMainAnimTimer6--;
return;
}
- mMainAnimTrans3->mCurrentFrame = mMainAnimTimer5;
+ mMainAnimTrans3->setFrame(mMainAnimTimer5);
if (mMainAnimTimer5 > 399.0f) {
mMainAnimTimer5--;
return;
@@ -1750,9 +1750,9 @@ bool ObjDayEndResultMail::doStart(const ::Screen::StartSceneArg* arg)
*/
bool ObjDayEndResultMail::doUpdateFadein()
{
- mMainAnimTrans4->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans4->setFrame(mMainAnimTimer1);
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += msVal.mAnimRate;
@@ -1765,7 +1765,7 @@ bool ObjDayEndResultMail::doUpdateFadein()
} else {
result = false;
}
- mCharacterAnimTrans->mCurrentFrame = mMainAnimTimer1;
+ mCharacterAnimTrans->setFrame(mMainAnimTimer1);
mScreenCharacter->search('NitemW')->animationTransform();
mScreenMain->search('NitemW0')->updateScale(mCharacterIconScaleX, mCharacterIconScaleY);
mScreenMain->update();
@@ -1850,7 +1850,7 @@ bool ObjDayEndResultMail::doUpdate()
bool ObjDayEndResultMail::doUpdateFadeout()
{
updateCommon();
- mMainAnimTrans1->mCurrentFrame = mMainAnimTimer1;
+ mMainAnimTrans1->setFrame(mMainAnimTimer1);
mScreenMain->search('NitemW')->animationTransform();
mMainAnimTimer1 += msVal.mAnimRate;
@@ -1864,7 +1864,7 @@ bool ObjDayEndResultMail::doUpdateFadeout()
} else {
result = false;
}
- mCharacterAnimTrans->mCurrentFrame = mMainAnimTimer1;
+ mCharacterAnimTrans->setFrame(mMainAnimTimer1);
mScreenCharacter->search('NitemW')->animationTransform();
mScreenMain->search('NitemW0')->updateScale(mCharacterIconScaleX, mCharacterIconScaleY);
mScreenMain->update();
@@ -1915,7 +1915,7 @@ void ObjDayEndResultMail::statusNormal()
*/
void ObjDayEndResultMail::statusFadeoutToLeft()
{
- mMainAnimTrans3->mCurrentFrame = mSideMoveTimer;
+ mMainAnimTrans3->setFrame(mSideMoveTimer);
if (mSideMoveTimer > 344.0f) {
mSideMoveTimer -= 1.0f;
} else {
@@ -1939,7 +1939,7 @@ void ObjDayEndResultMail::statusFadeoutToLeft()
*/
void ObjDayEndResultMail::statusFadeinFromLeft()
{
- mMainAnimTrans3->mCurrentFrame = mSideMoveTimer;
+ mMainAnimTrans3->setFrame(mSideMoveTimer);
if (mSideMoveTimer > 399.0f) {
mSideMoveTimer -= 1.0f;
} else {
@@ -1953,7 +1953,7 @@ void ObjDayEndResultMail::statusFadeinFromLeft()
*/
void ObjDayEndResultMail::statusFadeoutToRight()
{
- mMainAnimTrans3->mCurrentFrame = mSideMoveTimer;
+ mMainAnimTrans3->setFrame(mSideMoveTimer);
if (mSideMoveTimer < 404.0f) {
mSideMoveTimer += 1.0f;
} else {
@@ -1977,7 +1977,7 @@ void ObjDayEndResultMail::statusFadeoutToRight()
*/
void ObjDayEndResultMail::statusFadeinFromRight()
{
- mMainAnimTrans3->mCurrentFrame = mSideMoveTimer;
+ mMainAnimTrans3->setFrame(mSideMoveTimer);
if (mSideMoveTimer < 349.0f) {
mSideMoveTimer += 1.0f;
} else {
@@ -2304,17 +2304,17 @@ void ObjDayEndResultTitl::doDraw(Graphics& gfx)
*/
void ObjDayEndResultTitl::updateCommon()
{
- mMainAnimTrans->mCurrentFrame = mAnimTimer1;
- mMainAnimSRT->mCurrentFrame = mAnimTimer2;
+ mMainAnimTrans->setFrame(mAnimTimer1);
+ mMainAnimSRT->setFrame(mAnimTimer2);
mScreenMain->animation();
mAnimTimer1 += 1.0f;
- if (mAnimTimer1 >= mMainAnimTrans->mTotalFrameCount) {
+ if (mAnimTimer1 >= mMainAnimTrans->getFrameMax()) {
mAnimTimer1 = 0.0f;
}
mAnimTimer2 += 1.0f;
- if (mAnimTimer2 >= mMainAnimSRT->mTotalFrameCount) {
+ if (mAnimTimer2 >= mMainAnimSRT->getFrameMax()) {
mAnimTimer2 = 0.0f;
}
}
diff --git a/src/plugProjectKonoU/khFinalFloor.cpp b/src/plugProjectKonoU/khFinalFloor.cpp
index 5f9f77ef3..dcd138775 100644
--- a/src/plugProjectKonoU/khFinalFloor.cpp
+++ b/src/plugProjectKonoU/khFinalFloor.cpp
@@ -139,8 +139,8 @@ bool ObjFinalFloor::updateAnimation()
// Update the animation for each viewport
for (int i = 0; i < mViewportCount; i++) {
// Set the current frame for each animation and update the screen manager
- mAnim1[i]->mCurrentFrame = mAnimTime1[i];
- mAnim2[i]->mCurrentFrame = mAnimTime2[i];
+ mAnim1[i]->setFrame(mAnimTime1[i]);
+ mAnim2[i]->setFrame(mAnimTime2[i]);
mScreen[i]->animation();
// Check if the game is in demo mode
@@ -148,9 +148,9 @@ bool ObjFinalFloor::updateAnimation()
mScreen[i]->hide();
// Reset animation if current frame is >75% of the length.
- if (mAnimTime1[i] > (mAnim1[i]->mTotalFrameCount * 3) >> 2) {
- mAnimTime1[i] = mAnim1[i]->mTotalFrameCount;
- mAnimTime2[i] = mAnim2[i]->mTotalFrameCount;
+ if (mAnimTime1[i] > (mAnim1[i]->getFrameMax() * 3) >> 2) {
+ mAnimTime1[i] = mAnim1[i]->getFrameMax();
+ mAnimTime2[i] = mAnim2[i]->getFrameMax();
} else {
mAnimTime2[i] = 0.0f;
mAnimTime1[i] = 0.0f;
@@ -163,7 +163,7 @@ bool ObjFinalFloor::updateAnimation()
// Update the animation times and check if the animation has finished
mAnimTime1[i] += msVal.mAnimSpeed;
mAnimTime2[i] += msVal.mAnimSpeed;
- if (mAnimTime1[i] >= mAnim1[i]->mTotalFrameCount || mAnimTime2[i] >= mAnim2[i]->mTotalFrameCount) {
+ if (mAnimTime1[i] >= mAnim1[i]->getFrameMax() || mAnimTime2[i] >= mAnim2[i]->getFrameMax()) {
ret = true;
}
}
@@ -189,7 +189,7 @@ void ObjFinalFloor::stopSound()
*/
void ObjFinalFloor::restartSound()
{
- if (mAnimTime1[0] <= (mAnim1[0]->mTotalFrameCount * 3) >> 2) {
+ if (mAnimTime1[0] <= (mAnim1[0]->getFrameMax() * 3) >> 2) {
PSSystem::spSysIF->playSystemSe(PSSE_FINALLEVEL_COME, &mSound, 0);
startBGM();
}
diff --git a/src/plugProjectKonoU/khFinalResult.cpp b/src/plugProjectKonoU/khFinalResult.cpp
index 209d514b9..137d46506 100644
--- a/src/plugProjectKonoU/khFinalResult.cpp
+++ b/src/plugProjectKonoU/khFinalResult.cpp
@@ -39,13 +39,14 @@ OneResultData::OneResultData(int score1, int score5, int score2, int score3, int
*/
TotalResultData::TotalResultData(const int* p1, const int* p2, Game::Highscore** scores)
{
- JKRArchive* arc = nullptr;
- char* bloNames[16] = { "result_final_image00.blo", "result_final_image01.blo", "result_final_image02.blo", "result_final_image03.blo",
- "result_final_image04.blo", "result_final_image05.blo", "result_final_image06.blo", "result_final_image07.blo",
- "result_final_image08.blo", "result_final_image09.blo", "result_final_image10.blo", "result_final_image11.blo",
- "result_final_image12.blo", "result_final_image13.blo", "result_final_image14.blo", "result_final_image15.blo" };
+ JKRArchive* arc = nullptr;
+ char* bloNames[GAME_HIGHSCORE_COUNT]
+ = { "result_final_image00.blo", "result_final_image01.blo", "result_final_image02.blo", "result_final_image03.blo",
+ "result_final_image04.blo", "result_final_image05.blo", "result_final_image06.blo", "result_final_image07.blo",
+ "result_final_image08.blo", "result_final_image09.blo", "result_final_image10.blo", "result_final_image11.blo",
+ "result_final_image12.blo", "result_final_image13.blo", "result_final_image14.blo", "result_final_image15.blo" };
- int scoreIDs[16] = { 0, 8, 1, 2, 3, 4, 5, 6, 7, 14, 10, 11, 9, 13, 12, 15 };
+ int scoreIDs[GAME_HIGHSCORE_COUNT] = { 0, 8, 1, 2, 3, 4, 5, 6, 7, 14, 10, 11, 9, 13, 12, 15 };
LoadResource::Arg arg("/new_screen/cmn/result_final_image.szs");
LoadResource::Node* node = gLoadResourceMgr->mountArchive(arg);
@@ -56,8 +57,8 @@ TotalResultData::TotalResultData(const int* p1, const int* p2, Game::Highscore**
JUT_PANICLINE(107, "failed");
}
- mResults = new OneResultData*[16];
- for (int i = 0; i < 16; i++) {
+ mResults = new OneResultData*[GAME_HIGHSCORE_COUNT];
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
mResults[i] = new OneResultData(p1[scoreIDs[i]], p2[scoreIDs[i]], scores[scoreIDs[i]]->getScore(0),
scores[scoreIDs[i]]->getScore(1), scores[scoreIDs[i]]->getScore(2), bloNames[i], arc);
}
@@ -78,7 +79,7 @@ void TotalResultData::init()
*/
void TotalResultData::draw(Graphics& gfx, u32 yPos, u32 height)
{
- for (int i = 0; i < 16; i++) {
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
if (mResults[i]->mDoDraw == true) {
gfx.mOrthoGraph.setPort();
GXSetScissor(0, yPos, sys->getRenderModeWidth(), height);
@@ -137,13 +138,13 @@ ObjFinalResult::ObjFinalResult()
mCurrentPage = 1;
mScrollTargetPos = msVal._04;
mScrollMoveProgress = 0;
- mAutoScrollDelay = msVal._08;
+ mAutoScrollDelay = msVal.mAutoScrollInterval;
mState = StatusForceScroll;
mRandAnimCounter2 = -1;
mRandAnimCounter1 = -1;
mFlags = 0;
- mFlags |= 8;
+ mFlags |= FinalResult_NeedScrollSe;
mFadeAlpha = 0;
/*
stwu r1, -0x10(r1)
@@ -306,8 +307,8 @@ void ObjFinalResult::doCreate(JKRArchive* arc)
setInfAlpha(mScreen->search('NICON'));
for (int i = 0; i <= 7; i++) {
- mScreen->search(getSerialTagName('Nsel00', i))->setAlpha(msVal._21);
- mScreen->search(getSerialTagName('Nicon00', i))->setAlpha(msVal._21);
+ mScreen->search(getSerialTagName('Nsel00', i))->setAlpha(msVal.mSelectionAlpha);
+ mScreen->search(getSerialTagName('Nicon00', i))->setAlpha(msVal.mSelectionAlpha);
}
JKRHeap* oldHeap = JKRGetCurrentHeap();
if (disp->mHeap) {
@@ -1150,9 +1151,9 @@ void ObjFinalResult::doCreate(JKRArchive* arc)
bool ObjFinalResult::doUpdate()
{
updateCommon();
- if (mFlags & SaveOpen) {
- if (mFadeAlpha < msVal._1F) {
- mFadeAlpha += msVal._20;
+ if (mFlags & FinalResult_SaveOpen) {
+ if (mFadeAlpha < msVal.mSaveOpenGoalAlpha) {
+ mFadeAlpha += msVal.mSaveOpenAlphaRate;
}
mSaveMgr->update();
if (mSaveMgr->isFinish()) {
@@ -1164,7 +1165,7 @@ bool ObjFinalResult::doUpdate()
disp->mExitStatus = ::Screen::Game2DMgr::CHECK2D_FinalResult_Finished;
break;
case ebi::Save::TMgr::End_Cancel:
- mFlags &= ~SaveOpen;
+ mFlags &= ~FinalResult_SaveOpen;
break;
}
}
@@ -1187,12 +1188,12 @@ bool ObjFinalResult::doUpdate()
if (mState == StatusNormal && mCurrentPage == 7) {
Controller* pad = getGamePad();
if (pad->getButtonDown() & Controller::PRESS_A) {
- mFlags |= SaveOpen;
+ mFlags |= FinalResult_SaveOpen;
mSaveMgr->start();
}
}
if (mFadeAlpha) {
- mFadeAlpha -= msVal._20;
+ mFadeAlpha -= msVal.mSaveOpenAlphaRate;
}
}
return false;
@@ -1258,7 +1259,7 @@ void ObjFinalResult::doDraw(Graphics& gfx)
JUT_ASSERTLINE(479, getDispMember()->isID(OWNER_KH, MEMBER_FINAL_RESULT), "disp member err");
DispFinalResult* disp = static_cast(getDispMember());
TotalResultData* data = disp->mTotalResultData;
- for (int i = 0; i < 16; i++) {
+ for (int i = 0; i < GAME_HIGHSCORE_COUNT; i++) {
data->mResults[i]->mDoDraw = false;
}
@@ -1296,7 +1297,7 @@ void ObjFinalResult::doDraw(Graphics& gfx)
gfx.mOrthoGraph.fillBox(JGeometry::TBox2f(0.0f, 0.0f, zero + x, zero + y));
}
- if (mFlags & SaveOpen) {
+ if (mFlags & FinalResult_SaveOpen) {
gfx.mPerspGraph.setPort();
mSaveMgr->draw();
}
@@ -1313,64 +1314,64 @@ void ObjFinalResult::updateCommon()
mScissorYPos = pos1.y + 0.5f;
mScissorBoundsHeight = pos2.y - pos1.y;
- mAnmTrans5->mCurrentFrame = mAnimTimers[2];
+ mAnmTrans5->setFrame(mAnimTimers[2]);
mAnimTimers[2] += 1.0f;
- if (mAnimTimers[2] >= mAnmTrans5->mTotalFrameCount) {
+ if (mAnimTimers[2] >= mAnmTrans5->getFrameMax()) {
mAnimTimers[2] = 0.0f;
}
- mAnmTrans1->mCurrentFrame = mAnimTimers[3];
- mAnmCol1->mCurrentFrame = mAnimTimers[3];
+ mAnmTrans1->setFrame(mAnimTimers[3]);
+ mAnmCol1->setFrame(mAnimTimers[3]);
mAnimTimers[3] += 1.0f;
if (mAnimTimers[3] >= 99.0f) {
mAnimTimers[3] = 0.0f;
}
- mAnmTrans4->mCurrentFrame = mAnimTimers[4];
- mAnmCol2->mCurrentFrame = mAnimTimers[4];
+ mAnmTrans4->setFrame(mAnimTimers[4]);
+ mAnmCol2->setFrame(mAnimTimers[4]);
mAnimTimers[4] += 1.0f;
if (mAnimTimers[4] >= 59.0f) {
mAnimTimers[4] = 0.0f;
}
- mAnmTrans6->mCurrentFrame = mAnimTimers[5];
- mAnmCol3->mCurrentFrame = mAnimTimers[5];
- mAnmSRT->mCurrentFrame = mAnimTimers[6];
- mAnmTev->mCurrentFrame = mAnimTimers[7];
+ mAnmTrans6->setFrame(mAnimTimers[5]);
+ mAnmCol3->setFrame(mAnimTimers[5]);
+ mAnmSRT->setFrame(mAnimTimers[6]);
+ mAnmTev->setFrame(mAnimTimers[7]);
mAnimTimers[5] += 1.0f;
- if (mAnimTimers[5] >= mAnmCol3->mTotalFrameCount) {
+ if (mAnimTimers[5] >= mAnmCol3->getFrameMax()) {
mAnimTimers[5] = 0.0f;
}
mAnimTimers[6] += 1.0f;
- if (mAnimTimers[6] >= mAnmSRT->mTotalFrameCount) {
+ if (mAnimTimers[6] >= mAnmSRT->getFrameMax()) {
mAnimTimers[6] = 0.0f;
}
mAnimTimers[7] += 1.0f;
- if (mAnimTimers[7] >= mAnmTev->mTotalFrameCount) {
+ if (mAnimTimers[7] >= mAnmTev->getFrameMax()) {
mAnimTimers[7] = 0.0f;
}
- mAnmTrans2->mCurrentFrame = mAnimTimers[0];
+ mAnmTrans2->setFrame(mAnimTimers[0]);
if (mRandAnimCounter1 == 0) {
mAnimTimers[0] += msVal.mAnimSpeed;
if (mAnimTimers[0] >= 40.0f) {
mAnimTimers[0] = 0.0f;
- mRandAnimCounter1 = (f32)msVal._1D * randFloat() + (f32)msVal._1C;
+ mRandAnimCounter1 = (f32)msVal.mRandAnimRandRange * randFloat() + (f32)msVal.mRandAnimMinInterval;
}
} else {
mRandAnimCounter1--;
}
- mAnmTrans3->mCurrentFrame = mAnimTimers[1];
+ mAnmTrans3->setFrame(mAnimTimers[1]);
if (mRandAnimCounter2 == 0) {
mAnimTimers[1] += msVal.mAnimSpeed;
if (mAnimTimers[1] >= 49.0f) {
mAnimTimers[1] = 0.0f;
- mRandAnimCounter2 = (f32)msVal._1D * randFloat() + (f32)msVal._1C;
+ mRandAnimCounter2 = (f32)msVal.mRandAnimRandRange * randFloat() + (f32)msVal.mRandAnimMinInterval;
}
} else {
mRandAnimCounter2--;
@@ -1388,7 +1389,7 @@ void ObjFinalResult::updateCommon()
mColor = getClr(msVal.mColors[1], msVal.mColors[0], time - 3.0f);
}
- mTimer += msVal._0C;
+ mTimer += msVal.mColorChangeSpeed;
if (mTimer >= 4.0f) {
mTimer -= 4.0f;
}
@@ -1422,9 +1423,9 @@ void ObjFinalResult::statusNormal()
if (pad->getButton() & Controller::PRESS_UP) {
if (mCurrentPage) {
mCurrentPage--;
- mScreen->search(getSerialTagName('Nsel00', mCurrentPage + 1))->setAlpha(msVal._21);
+ mScreen->search(getSerialTagName('Nsel00', mCurrentPage + 1))->setAlpha(msVal.mSelectionAlpha);
mScreen->search(getSerialTagName('Nsel00', mCurrentPage))->setAlpha(255);
- mScreen->search(getSerialTagName('Nicon00', mCurrentPage + 1))->setAlpha(msVal._21);
+ mScreen->search(getSerialTagName('Nicon00', mCurrentPage + 1))->setAlpha(msVal.mSelectionAlpha);
mScreen->search(getSerialTagName('Nicon00', mCurrentPage))->setAlpha(255);
mState = StatusScrollUp;
statusScrollUp();
@@ -1435,9 +1436,9 @@ void ObjFinalResult::statusNormal()
if (pad->getButton() & Controller::PRESS_DOWN) {
if (mCurrentPage != 7) {
mCurrentPage++;
- mScreen->search(getSerialTagName('Nsel00', mCurrentPage - 1))->setAlpha(msVal._21);
+ mScreen->search(getSerialTagName('Nsel00', mCurrentPage - 1))->setAlpha(msVal.mSelectionAlpha);
mScreen->search(getSerialTagName('Nsel00', mCurrentPage))->setAlpha(255);
- mScreen->search(getSerialTagName('Nicon00', mCurrentPage - 1))->setAlpha(msVal._21);
+ mScreen->search(getSerialTagName('Nicon00', mCurrentPage - 1))->setAlpha(msVal.mSelectionAlpha);
mScreen->search(getSerialTagName('Nicon00', mCurrentPage))->setAlpha(255);
mState = StatusScrollDown;
statusScrollDown();
@@ -1483,9 +1484,9 @@ void ObjFinalResult::statusScrollDown()
void ObjFinalResult::statusForceScroll()
{
if (!mAutoScrollDelay) {
- if (mFlags & 8) {
+ if (mFlags & FinalResult_NeedScrollSe) {
PSSystem::spSysIF->playSystemSe(PSSE_SY_MESSAGE_EXIT, 0);
- mFlags &= ~8;
+ mFlags &= ~FinalResult_NeedScrollSe;
}
mScrollYPos = -mScrollMove - (mScrollMove * (f32)(mScrollMoveProgress - mScrollTargetPos)) / (f32)mScrollTargetPos;
if (mScrollMoveProgress++ == mScrollTargetPos) {
@@ -1500,8 +1501,8 @@ void ObjFinalResult::statusForceScroll()
}
mScrollMoveProgress = 1;
mScrollYPos = 0.0f;
- mAutoScrollDelay = msVal._08;
- mFlags |= 8;
+ mAutoScrollDelay = msVal.mAutoScrollInterval;
+ mFlags |= FinalResult_NeedScrollSe;
}
} else {
mAutoScrollDelay--;
@@ -1519,7 +1520,7 @@ void ObjFinalResult::drawReplace(Graphics& gfx, int id)
TotalResultData* data = disp->mTotalResultData;
int id2 = id * 2 + 1;
- u64 mesgIds[16] = {
+ u64 mesgIds[GAME_HIGHSCORE_COUNT] = {
'8452_00', // "Days Spent:"
'8453_00', // "Pikmin Lost:"
'8454_00', // "Pikmin Lost in Battle:"
diff --git a/src/plugProjectKonoU/khPayDept.cpp b/src/plugProjectKonoU/khPayDept.cpp
index 89b360096..1e42bae13 100644
--- a/src/plugProjectKonoU/khPayDept.cpp
+++ b/src/plugProjectKonoU/khPayDept.cpp
@@ -165,13 +165,13 @@ void ObjPayDept::doDraw(Graphics& gfx)
*/
bool ObjPayDept::updateAnimation()
{
- bool ret = false;
- mAnim1->mCurrentFrame = mAnimTime1;
- mAnim2->mCurrentFrame = mAnimTime2;
+ bool ret = false;
+ mAnim1->setFrame(mAnimTime1);
+ mAnim2->setFrame(mAnimTime2);
mScreen->animation();
mAnimTime1 += msVal.mAnimSpeed;
mAnimTime2 += msVal.mAnimSpeed;
- if (mAnimTime1 >= mAnim1->mTotalFrameCount || mAnimTime2 >= mAnim2->mTotalFrameCount) {
+ if (mAnimTime1 >= mAnim1->getFrameMax() || mAnimTime2 >= mAnim2->getFrameMax()) {
ret = true;
}
return ret;
diff --git a/src/plugProjectKonoU/khReadyGo.cpp b/src/plugProjectKonoU/khReadyGo.cpp
index 39388e8be..a0a904561 100644
--- a/src/plugProjectKonoU/khReadyGo.cpp
+++ b/src/plugProjectKonoU/khReadyGo.cpp
@@ -148,14 +148,14 @@ bool ObjReadyGo::updateAnimation()
// Update animations for each screen
for (int i = 0; i < mScreenNum; i++) {
- mAnim1[i]->mCurrentFrame = mAnimTime1[i];
- mAnim2[i]->mCurrentFrame = mAnimTime2[i];
+ mAnim1[i]->setFrame(mAnimTime1[i]);
+ mAnim2[i]->setFrame(mAnimTime2[i]);
mScreen[i]->animation();
mAnimTime1[i] += msVal.mAnimSpeed;
mAnimTime2[i] += msVal.mAnimSpeed;
// Check if the animation is complete
- if (mAnimTime1[i] >= mAnim1[i]->mTotalFrameCount - 2 || mAnimTime2[i] >= mAnim2[i]->mTotalFrameCount - 2) {
+ if (mAnimTime1[i] >= mAnim1[i]->getFrameMax() - 2 || mAnimTime2[i] >= mAnim2[i]->getFrameMax() - 2) {
done = true;
}
diff --git a/src/plugProjectKonoU/khUtil.cpp b/src/plugProjectKonoU/khUtil.cpp
index 344292356..79d592949 100644
--- a/src/plugProjectKonoU/khUtil.cpp
+++ b/src/plugProjectKonoU/khUtil.cpp
@@ -84,12 +84,12 @@ f32 getPaneCenterY(J2DPane* pane)
* @note Address: 0x8040BAE4
* @note Size: 0xA4
*/
-khUtilFadePane* khUtilFadePane::create(P2DScreen::Mgr* mgr, u64 tag, u8 c)
+khUtilFadePane* khUtilFadePane::create(P2DScreen::Mgr* mgr, u64 tag, u8 changeSpeed)
{
if (mgr == nullptr) {
return nullptr;
}
- khUtilFadePane* pane = new khUtilFadePane(c);
+ khUtilFadePane* pane = new khUtilFadePane(changeSpeed);
P2ASSERTLINE(146, pane != nullptr);
pane->add(mgr->addCallBack(tag, pane));
return pane;
@@ -99,12 +99,12 @@ khUtilFadePane* khUtilFadePane::create(P2DScreen::Mgr* mgr, u64 tag, u8 c)
* @note Address: 0x8040BB88
* @note Size: 0x88
*/
-khUtilFadePane::khUtilFadePane(u8 c)
+khUtilFadePane::khUtilFadePane(u8 changeSpeed)
: CallBackNode()
, mPaneNode(nullptr)
, mState(0)
- , mCurrentAlpha('\0')
- , mChangeAlpha(c)
+ , mCurrentAlpha(0)
+ , mChangeSpeed(changeSpeed)
{
}
@@ -116,21 +116,21 @@ void khUtilFadePane::update()
{
switch (mState) {
case 0:
- if (mCurrentAlpha > 255 - mChangeAlpha) {
+ if (mCurrentAlpha > 255 - mChangeSpeed) {
mCurrentAlpha = 255;
mState = 1;
fadein_finish();
} else {
- mCurrentAlpha += mChangeAlpha;
+ mCurrentAlpha += mChangeSpeed;
}
break;
case 2:
- if (mCurrentAlpha < mChangeAlpha) {
+ if (mCurrentAlpha < mChangeSpeed) {
mCurrentAlpha = 0;
mState = 3;
fadeout_finish();
} else {
- mCurrentAlpha -= mChangeAlpha;
+ mCurrentAlpha -= mChangeSpeed;
}
break;
}
diff --git a/src/plugProjectKonoU/khWinLose.cpp b/src/plugProjectKonoU/khWinLose.cpp
index 8aada56cd..696acd47e 100644
--- a/src/plugProjectKonoU/khWinLose.cpp
+++ b/src/plugProjectKonoU/khWinLose.cpp
@@ -158,8 +158,8 @@ bool ObjWinLose::updateAnimation()
// Loop through each screen
for (int i = 0; i < mScreenNum; i++) {
if (mScreenA[i]) {
- mAnim1[i]->mCurrentFrame = mAnimTime1[i];
- mAnim3[i]->mCurrentFrame = mAnimTime3[i];
+ mAnim1[i]->setFrame(mAnimTime1[i]);
+ mAnim3[i]->setFrame(mAnimTime3[i]);
mScreenA[i]->animation();
@@ -172,7 +172,7 @@ bool ObjWinLose::updateAnimation()
}
// Check if the animation has finished for both the first and third animations
- if (mAnimTime1[i] >= mAnim1[i]->mTotalFrameCount || mAnimTime3[i] >= mAnim3[i]->mTotalFrameCount) {
+ if (mAnimTime1[i] >= mAnim1[i]->getFrameMax() || mAnimTime3[i] >= mAnim3[i]->getFrameMax()) {
mAnimTime3[i] = 0.0f;
mAnimTime1[i] = 0.0f;
@@ -185,8 +185,8 @@ bool ObjWinLose::updateAnimation()
// Check if it's time to update the second and fourth animations
if (mDoUpdateAnim) {
- mAnim2[i]->mCurrentFrame = mAnimTime2[i];
- mAnim4[i]->mCurrentFrame = mAnimTime4[i];
+ mAnim2[i]->setFrame(mAnimTime2[i]);
+ mAnim4[i]->setFrame(mAnimTime4[i]);
mScreenB[i]->animation();
@@ -194,10 +194,10 @@ bool ObjWinLose::updateAnimation()
mAnimTime4[i] += 1.0f;
// Check if the animation has finished for both the second and fourth animations
- if (mAnimTime2[i] >= mAnim2[i]->mTotalFrameCount) {
+ if (mAnimTime2[i] >= mAnim2[i]->getFrameMax()) {
mAnimTime2[i] = 0.0f;
}
- if (mAnimTime4[i] >= mAnim4[i]->mTotalFrameCount) {
+ if (mAnimTime4[i] >= mAnim4[i]->getFrameMax()) {
mAnimTime4[i] = 0.0f;
}
diff --git a/src/plugProjectKonoU/khWorldMap.cpp b/src/plugProjectKonoU/khWorldMap.cpp
index c87432560..1f02caff5 100644
--- a/src/plugProjectKonoU/khWorldMap.cpp
+++ b/src/plugProjectKonoU/khWorldMap.cpp
@@ -412,7 +412,7 @@ void WorldMap::loadResource()
const char** usePath;
usePath = paths[0]; // normal ship
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
usePath = paths[1]; // gold ship
}
@@ -490,7 +490,7 @@ void WorldMap::loadResource()
og::Screen::setCallBack_CounterDay(mScreenInfo, 'Pday_r', 'Pday_l', 'Pday_c', &mInitArg.mCurrentDay, 3, arc);
int money = ::Game::playData->mPokoCount;
- if (::Game::playData->mStoryFlags & ::Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
// debt is paid
mScreenInfo->search('Nfinal_f')->hide(); // hide the debt amount
mScreenInfo->search('Ncomp_f')->show(); // show complete amount across screen
@@ -626,24 +626,24 @@ void WorldMap::loadResource()
*/
void WorldMap::update(Game::WorldMap::UpdateArg& arg)
{
- arg.mCourseInfo = mInitArg.mStages->getCourseInfo(mCurrentCourseIndex);
- mKitaAnim1->mCurrentFrame = mAnimTimers[0];
- mKitaAnim3->mCurrentFrame = mAnimTimers[2];
- mKitaAnim4->mCurrentFrame = mAnimTimers[3];
- mKitaAnim5->mCurrentFrame = mAnimTimers[4];
+ arg.mCourseInfo = mInitArg.mStages->getCourseInfo(mCurrentCourseIndex);
+ mKitaAnim1->setFrame(mAnimTimers[0]);
+ mKitaAnim3->setFrame(mAnimTimers[2]);
+ mKitaAnim4->setFrame(mAnimTimers[3]);
+ mKitaAnim5->setFrame(mAnimTimers[4]);
- mRocketAnim1->mCurrentFrame = mAnimTimers[5];
- mRocketAnim2->mCurrentFrame = mAnimTimers[6];
+ mRocketAnim1->setFrame(mAnimTimers[5]);
+ mRocketAnim2->setFrame(mAnimTimers[6]);
- mInfoAnim1->mCurrentFrame = mAnimTimers[7];
- mInfoAnim2->mCurrentFrame = mAnimTimers[8];
- mInfoAnim3->mCurrentFrame = mAnimTimers[9];
+ mInfoAnim1->setFrame(mAnimTimers[7]);
+ mInfoAnim2->setFrame(mAnimTimers[8]);
+ mInfoAnim3->setFrame(mAnimTimers[9]);
mScreenKitagawa->animation();
mScreenRocket->animation();
mScreenInfo->animation();
- mKitaAnim2->mCurrentFrame = mAnimTimers[1];
+ mKitaAnim2->setFrame(mAnimTimers[1]);
for (int i = 0; i < 4; i++) {
mScreenKitagawa->search(getSerialTagName('Pland0', i))->animationTransform();
@@ -651,47 +651,47 @@ void WorldMap::update(Game::WorldMap::UpdateArg& arg)
}
mAnimTimers[2] += 1.0f;
- if (mAnimTimers[2] >= mKitaAnim3->mTotalFrameCount) {
+ if (mAnimTimers[2] >= mKitaAnim3->getFrameMax()) {
mAnimTimers[2] = 0.0f;
}
mAnimTimers[3] += 1.0f;
- if (mAnimTimers[3] >= mKitaAnim4->mTotalFrameCount) {
+ if (mAnimTimers[3] >= mKitaAnim4->getFrameMax()) {
mAnimTimers[3] = 0.0f;
}
mAnimTimers[4] += 1.0f;
- if (mAnimTimers[4] >= mKitaAnim5->mTotalFrameCount) {
+ if (mAnimTimers[4] >= mKitaAnim5->getFrameMax()) {
mAnimTimers[4] = 0.0f;
}
mAnimTimers[5] += 1.0f;
- if (mAnimTimers[5] >= mRocketAnim1->mTotalFrameCount) {
+ if (mAnimTimers[5] >= mRocketAnim1->getFrameMax()) {
mAnimTimers[5] = 0.0f;
}
mAnimTimers[6] += 1.0f;
- if (mAnimTimers[6] >= mRocketAnim2->mTotalFrameCount) {
+ if (mAnimTimers[6] >= mRocketAnim2->getFrameMax()) {
mAnimTimers[6] = 0.0f;
}
mAnimTimers[7] += 0.5f;
- if (mAnimTimers[7] >= mInfoAnim1->mTotalFrameCount) {
+ if (mAnimTimers[7] >= mInfoAnim1->getFrameMax()) {
mAnimTimers[7] = 0.0f;
}
mAnimTimers[8] += 0.5f;
- if (mAnimTimers[8] >= mInfoAnim2->mTotalFrameCount) {
+ if (mAnimTimers[8] >= mInfoAnim2->getFrameMax()) {
mAnimTimers[8] = 0.0f;
}
mAnimTimers[9] += 0.5f;
- if (mAnimTimers[9] >= mInfoAnim3->mTotalFrameCount) {
+ if (mAnimTimers[9] >= mInfoAnim3->getFrameMax()) {
mAnimTimers[9] = 0.0f;
}
mAnimTimers[1] += 1.0f;
- if (mAnimTimers[1] >= mKitaAnim2->mTotalFrameCount) {
+ if (mAnimTimers[1] >= mKitaAnim2->getFrameMax()) {
mAnimTimers[1] = 0.0f;
}
@@ -4216,7 +4216,7 @@ void WorldMap::changeInfo()
mScreenInfo->search('Ngr_fl0')->hide();
}
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid || mGroundTreasureMax == mGroundTreasureCount) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid) || mGroundTreasureMax == mGroundTreasureCount) {
mGroundTreasureCounterMax->getMotherPane()->show();
mScreenInfo->search('Pg_sra')->show();
mGroundTreasureCounterCollected->getMotherPane()->move(0.0f, 0.0f);
@@ -4248,7 +4248,7 @@ void WorldMap::changeInfo()
mCaveOtaNum[i] = Game::playData->getOtakaraNum_Course_CaveID(mCurrentCourseIndex, caveID);
mCaveOtaMax[i] = Game::playData->getOtakaraMax_Course_CaveID(mCurrentCourseIndex, caveID);
if (Game::playData->isCaveFirstTime(mCurrentCourseIndex, caveID)) {
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
mCaveTreasureCounterCollected[i]->setBlind(true);
mCaveTreasureCounterMax[i]->setBlind(true);
} else {
@@ -4264,7 +4264,7 @@ void WorldMap::changeInfo()
mScreenInfo->search(getSerialTagName('Pcave_00', i))->setMsgID('8419_01'); // "???"
mScreenInfo->search(floTags[i])->hide();
} else {
- if (!(Game::playData->mStoryFlags & Game::STORY_DebtPaid) && mCaveOtaMax[i] != mCaveOtaNum[i]) {
+ if (!Game::playData->isStoryFlag(Game::STORY_DebtPaid) && mCaveOtaMax[i] != mCaveOtaNum[i]) {
f32 x = msVal._68;
if (mCaveOtaMax[i] >= 10) {
x += 12.5f;
@@ -5048,11 +5048,10 @@ void WorldMap::effectFirstTime()
!= Game::playData->isCaveFirstTime_Old(mCurrentCourseIndex, caveID)) {
JGeometry::TVec3f pos1 = mScreenInfo->search(getSerialTagName('Pcave_00', i))->getGlbVtx(GLBVTX_BtmLeft);
JGeometry::TVec3f pos2 = mScreenInfo->search(getSerialTagName('Pcave_00', i))->getGlbVtx(GLBVTX_TopRight);
- f32 x = (pos1.y + pos2.y) / 2;
+ f32 y = (pos1.y + pos2.y) * 0.5f;
for (int j = 0; j < 5; j++) {
- int k = 4 - j;
- Vector2f pos(x, ((pos1.z * k) + (pos2.z * j)) / 4);
- efx2d::Arg arg(pos);
+ f32 x = (pos1.x * (4 - j) + pos2.x * j) * 0.25f;
+ efx2d::Arg arg(Vector2f(x, y));
efx2d::T2DChangesmoke efx;
efx.create(&arg);
}
@@ -5090,378 +5089,6 @@ void WorldMap::effectFirstTime()
PSSystem::spSysIF->playSystemSe(soundID, 0);
}
resetFlag(WMAPFLAG_IsFirstTimeEffect);
- /*
-stwu r1, -0x1b0(r1)
-mflr r0
-stw r0, 0x1b4(r1)
-stfd f31, 0x1a0(r1)
-psq_st f31, 424(r1), 0, qr0
-stfd f30, 0x190(r1)
-psq_st f30, 408(r1), 0, qr0
-stfd f29, 0x180(r1)
-psq_st f29, 392(r1), 0, qr0
-stfd f28, 0x170(r1)
-psq_st f28, 376(r1), 0, qr0
-stfd f27, 0x160(r1)
-psq_st f27, 360(r1), 0, qr0
-stmw r15, 0x11c(r1)
-mr r29, r3
-lis r3, lbl_80497C70@ha
-lwz r0, 0x17c(r29)
-addi r7, r3, lbl_80497C70@l
-rlwinm. r0, r0, 0, 0x1d, 0x1d
-beq lbl_803F79C8
-lfd f29, 0x588(r7)
-addi r6, r1, 0xe0
-lfd f28, 0x590(r7)
-addi r5, r1, 0xc0
-lfd f13, 0x598(r7)
-addi r4, r1, 0xa0
-lfd f12, 0x5a0(r7)
-addi r0, r1, 0x80
-lfd f11, 0x5a8(r7)
-li r22, 0
-lfd f10, 0x5b0(r7)
-li r31, 0
-lfd f9, 0x5b8(r7)
-li r30, 0
-lfd f8, 0x5c0(r7)
-li r17, 0
-lfd f7, 0x5c8(r7)
-lfd f6, 0x5d0(r7)
-lfd f5, 0x5d8(r7)
-lfd f4, 0x5e0(r7)
-lfd f3, 0x5e8(r7)
-lfd f2, 0x5f0(r7)
-lfd f1, 0x5f8(r7)
-lfd f0, 0x600(r7)
-lwz r3, 0x608(r7)
-lwz r9, 0x60c(r7)
-lwz r8, 0x610(r7)
-stw r3, 0x70(r1)
-lwz r7, 0x614(r7)
-stw r9, 0x74(r1)
-lwz r3, playData__4Game@sda21(r13)
-stw r8, 0x78(r1)
-stw r7, 0x7c(r1)
-stfd f29, 0xe0(r1)
-stfd f28, 0xe8(r1)
-stfd f13, 0xf0(r1)
-stfd f12, 0xf8(r1)
-stfd f11, 0xc0(r1)
-stfd f10, 0xc8(r1)
-stfd f9, 0xd0(r1)
-stfd f8, 0xd8(r1)
-stfd f7, 0xa0(r1)
-stfd f6, 0xa8(r1)
-stfd f5, 0xb0(r1)
-stfd f4, 0xb8(r1)
-stfd f3, 0x80(r1)
-stfd f2, 0x88(r1)
-stfd f1, 0x90(r1)
-stfd f0, 0x98(r1)
-stw r6, 0x70(r1)
-lwz r15, 0xe8(r3)
-stw r5, 0x74(r1)
-stw r4, 0x78(r1)
-stw r0, 0x7c(r1)
-bl getMoney_Old__Q24Game8PlayDataFv
-cmpw r15, r3
-beq lbl_803F75F8
-lwz r3, 0x100(r29)
-lfs f1, lbl_8051FEF0@sda21(r2)
-bl startPuyoUp__Q32og6Screen18CallBack_CounterRVFf
-li r22, 1
-
-lbl_803F75F8:
-lwz r3, playData__4Game@sda21(r13)
-lwz r4, 0xf8(r29)
-bl getGroundOtakaraNum_Old__Q24Game8PlayDataFi
-mr r15, r3
-lwz r3, playData__4Game@sda21(r13)
-lwz r4, 0xf8(r29)
-bl getGroundOtakaraNum__Q24Game8PlayDataFi
-cmpw r3, r15
-beq lbl_803F7654
-lwz r3, 0x104(r29)
-lfs f1, lbl_8051FEF0@sda21(r2)
-bl startPuyoUp__Q32og6Screen18CallBack_CounterRVFf
-lwz r3, playData__4Game@sda21(r13)
-li r31, 1
-lwz r4, 0xf8(r29)
-bl getGroundOtakaraMax__Q24Game8PlayDataFi
-mr r15, r3
-lwz r3, playData__4Game@sda21(r13)
-lwz r4, 0xf8(r29)
-bl getGroundOtakaraNum__Q24Game8PlayDataFi
-cmpw r3, r15
-bne lbl_803F7654
-li r30, 1
-
-lbl_803F7654:
-lis r4, 0x64617461@ha
-lis r3, 0x006E6F5F@ha
-mr r24, r29
-addi r26, r1, 0x70
-addi r27, r4, 0x64617461@l
-addi r28, r3, 0x006E6F5F@l
-li r23, 0
-li r25, 0
-
-lbl_803F7674:
-lwz r4, 0xf8(r29)
-slwi r0, r4, 2
-lwzx r0, r26, r0
-add r3, r0, r25
-lwz r0, 0(r3)
-lwz r3, 4(r3)
-xor r0, r0, r28
-xor r3, r3, r27
-or. r0, r3, r0
-beq lbl_803F7908
-lwz r3, 0x1c(r29)
-bl getCourseInfo__Q24Game6StagesFi
-mr r4, r23
-bl getCaveID_FromIndex__Q24Game10CourseInfoFi
-mr r4, r3
-addi r3, r1, 0x64
-bl __ct__4ID32FUl
-lwz r3, playData__4Game@sda21(r13)
-addi r5, r1, 0x64
-lwz r4, 0xf8(r29)
-bl isCaveFirstTime_Old__Q24Game8PlayDataFiR4ID32
-clrlwi r15, r3, 0x18
-lwz r3, playData__4Game@sda21(r13)
-lwz r4, 0xf8(r29)
-addi r5, r1, 0x64
-bl isCaveFirstTime__Q24Game8PlayDataFiR4ID32
-clrlwi r0, r3, 0x18
-cmplw r0, r15
-beq lbl_803F789C
-lis r4, 0x655F3030@ha
-lis r3, 0x50636176@ha
-mr r5, r23
-addi r4, r4, 0x655F3030@l
-addi r3, r3, 0x50636176@l
-bl getSerialTagName__Q22kh6ScreenFUxi
-mr r5, r3
-lwz r3, 0x54(r29)
-mr r6, r4
-lwz r12, 0(r3)
-lwz r12, 0x3c(r12)
-mtctr r12
-bctrl
-mr r4, r3
-addi r3, r1, 0x24
-li r5, 0
-bl getGlbVtx__7J2DPaneCFUc
-lwz r7, 0x24(r1)
-lis r4, 0x655F3030@ha
-lwz r6, 0x28(r1)
-lis r3, 0x50636176@ha
-lwz r0, 0x2c(r1)
-mr r5, r23
-stw r7, 0x58(r1)
-addi r4, r4, 0x655F3030@l
-addi r3, r3, 0x50636176@l
-stw r6, 0x5c(r1)
-stw r0, 0x60(r1)
-bl getSerialTagName__Q22kh6ScreenFUxi
-mr r5, r3
-lwz r3, 0x54(r29)
-mr r6, r4
-lwz r12, 0(r3)
-lwz r12, 0x3c(r12)
-mtctr r12
-bctrl
-mr r4, r3
-addi r3, r1, 0x18
-li r5, 3
-bl getGlbVtx__7J2DPaneCFUc
-lwz r0, 0x1c(r1)
-lis r7, __vt__Q25efx2d3Arg@ha
-lwz r8, 0x18(r1)
-lis r6, __vt__Q25efx2d7TBaseIF@ha
-stw r0, 0x50(r1)
-lis r5, __vt__Q25efx2d5TBase@ha
-lwz r0, 0x20(r1)
-lis r4, __vt__Q25efx2d8TSimple1@ha
-lfs f1, 0x5c(r1)
-lis r3, __vt__Q25efx2d14T2DChangesmoke@ha
-lfs f0, 0x50(r1)
-addi r18, r7, __vt__Q25efx2d3Arg@l
-stw r8, 0x4c(r1)
-addi r19, r6, __vt__Q25efx2d7TBaseIF@l
-fadds f0, f1, f0
-lfs f1, lbl_8051FF14@sda21(r2)
-stw r0, 0x54(r1)
-addi r20, r5, __vt__Q25efx2d5TBase@l
-lfs f28, lbl_8051FF70@sda21(r2)
-addi r21, r4, __vt__Q25efx2d8TSimple1@l
-fmuls f27, f1, f0
-lfs f29, 0x58(r1)
-lfd f30, lbl_8051FF40@sda21(r2)
-addi r15, r3, __vt__Q25efx2d14T2DChangesmoke@l
-lfs f31, 0x4c(r1)
-li r16, 0
-lis r17, 0x4330
-
-lbl_803F77F4:
-xoris r0, r16, 0x8000
-li r5, 0
-stw r0, 0x10c(r1)
-subfic r0, r16, 4
-xoris r6, r0, 0x8000
-li r0, 7
-stw r17, 0x108(r1)
-addi r3, r1, 0x30
-addi r4, r1, 0x40
-lfd f0, 0x108(r1)
-stw r6, 0x104(r1)
-fsubs f0, f0, f30
-stw r17, 0x100(r1)
-lfd f1, 0x100(r1)
-fmuls f0, f31, f0
-stfs f27, 0xc(r1)
-fsubs f1, f1, f30
-stw r19, 0x30(r1)
-lwz r6, 0xc(r1)
-fmadds f0, f29, f1, f0
-stw r20, 0x30(r1)
-stw r6, 0x14(r1)
-fmuls f1, f28, f0
-stw r21, 0x30(r1)
-lfs f0, 0x14(r1)
-stfs f1, 8(r1)
-lwz r6, 8(r1)
-stw r18, 0x48(r1)
-stw r6, 0x10(r1)
-lfs f1, 0x10(r1)
-stfs f0, 0x44(r1)
-stfs f1, 0x40(r1)
-stb r5, 0x34(r1)
-stb r5, 0x35(r1)
-sth r0, 0x38(r1)
-stw r5, 0x3c(r1)
-stw r15, 0x30(r1)
-bl create__Q25efx2d8TSimple1FPQ25efx2d3Arg
-addi r16, r16, 1
-cmpwi r16, 5
-blt lbl_803F77F4
-li r17, 1
-
-lbl_803F789C:
-lwz r3, playData__4Game@sda21(r13)
-addi r5, r1, 0x64
-lwz r4, 0xf8(r29)
-bl getOtakaraNum_Course_CaveID_Old__Q24Game8PlayDataFiR4ID32
-mr r16, r3
-lwz r3, playData__4Game@sda21(r13)
-lwz r4, 0xf8(r29)
-addi r5, r1, 0x64
-bl getOtakaraNum_Course_CaveID__Q24Game8PlayDataFiR4ID32
-cmpw r3, r16
-beq lbl_803F7908
-lwz r3, 0x10c(r24)
-lfs f1, lbl_8051FEF0@sda21(r2)
-bl startPuyoUp__Q32og6Screen18CallBack_CounterRVFf
-lwz r3, playData__4Game@sda21(r13)
-addi r5, r1, 0x64
-lwz r4, 0xf8(r29)
-li r31, 1
-bl getOtakaraMax_Course_CaveID__Q24Game8PlayDataFiR4ID32
-mr r16, r3
-lwz r3, playData__4Game@sda21(r13)
-lwz r4, 0xf8(r29)
-addi r5, r1, 0x64
-bl getOtakaraNum_Course_CaveID__Q24Game8PlayDataFiR4ID32
-cmpw r3, r16
-bne lbl_803F7908
-li r30, 1
-
-lbl_803F7908:
-addi r23, r23, 1
-addi r24, r24, 4
-cmpwi r23, 4
-addi r25, r25, 8
-blt lbl_803F7674
-clrlwi. r0, r17, 0x18
-li r4, -1
-beq lbl_803F7938
-clrlwi. r0, r30, 0x18
-beq lbl_803F7938
-li r4, 0x1843
-b lbl_803F79A4
-
-lbl_803F7938:
-clrlwi. r0, r17, 0x18
-beq lbl_803F7950
-clrlwi. r0, r31, 0x18
-beq lbl_803F7950
-li r4, 0x1842
-b lbl_803F79A4
-
-lbl_803F7950:
-clrlwi. r0, r17, 0x18
-beq lbl_803F7968
-clrlwi. r0, r22, 0x18
-beq lbl_803F7968
-li r4, 0x1841
-b lbl_803F79A4
-
-lbl_803F7968:
-clrlwi. r0, r17, 0x18
-beq lbl_803F7978
-li r4, 0x1840
-b lbl_803F79A4
-
-lbl_803F7978:
-clrlwi. r0, r30, 0x18
-beq lbl_803F7988
-li r4, 0x183f
-b lbl_803F79A4
-
-lbl_803F7988:
-clrlwi. r0, r31, 0x18
-beq lbl_803F7998
-li r4, 0x183e
-b lbl_803F79A4
-
-lbl_803F7998:
-clrlwi. r0, r22, 0x18
-beq lbl_803F79A4
-li r4, 0x183d
-
-lbl_803F79A4:
-addis r0, r4, 1
-cmplwi r0, 0xffff
-beq lbl_803F79BC
-lwz r3, spSysIF__8PSSystem@sda21(r13)
-li r5, 0
-bl playSystemSe__Q28PSSystem5SysIFFUlUl
-
-lbl_803F79BC:
-lwz r0, 0x17c(r29)
-rlwinm r0, r0, 0, 0x1e, 0x1c
-stw r0, 0x17c(r29)
-
-lbl_803F79C8:
-psq_l f31, 424(r1), 0, qr0
-lfd f31, 0x1a0(r1)
-psq_l f30, 408(r1), 0, qr0
-lfd f30, 0x190(r1)
-psq_l f29, 392(r1), 0, qr0
-lfd f29, 0x180(r1)
-psq_l f28, 376(r1), 0, qr0
-lfd f28, 0x170(r1)
-psq_l f27, 360(r1), 0, qr0
-lfd f27, 0x160(r1)
-lmw r15, 0x11c(r1)
-lwz r0, 0x1b4(r1)
-mtlr r0
-addi r1, r1, 0x1b0
-blr
- */
}
/**
@@ -5530,9 +5157,9 @@ Vector2f WorldMap::OnyonDynamics::move(WorldMap* wmap, const JGeometry::TVec2f&
}
mAngle.set(pikmin2_sinf(calc2), -pikmin2_cosf(calc2));
if (prevAngle < -0x4000 && mRotateAngle > -0x4000) {
- mOnyonPane->getParentPane()->prependChild(mOnyonPane);
- } else if (prevAngle < 0x4000 && mRotateAngle > 0x4000) {
mOnyonPane->getParentPane()->appendChild(mOnyonPane);
+ } else if (prevAngle < 0x4000 && mRotateAngle > 0x4000) {
+ mOnyonPane->getParentPane()->prependChild(mOnyonPane);
}
} else {
posDiff.normalize();
diff --git a/src/plugProjectKonoU/newGame2DMgr.cpp b/src/plugProjectKonoU/newGame2DMgr.cpp
index 47dea2e24..fcfed6c2a 100644
--- a/src/plugProjectKonoU/newGame2DMgr.cpp
+++ b/src/plugProjectKonoU/newGame2DMgr.cpp
@@ -107,7 +107,7 @@ void Game2DMgr::setToumeiBG() { mScreenMgr->mBackupScene->setColorBG(0, 0, 0, 0)
*/
bool Game2DMgr::open_GameGround(og::Screen::DispMemberGround& disp)
{
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
disp.mPayDebt = true;
}
disp.mDataGame.mPokoCount = Game::playData->mPokoCount;
@@ -138,7 +138,7 @@ bool Game2DMgr::is_GameGround()
*/
bool Game2DMgr::open_GameCave(og::Screen::DispMemberCave& disp, int type)
{
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
disp.mPayDebt = true;
}
disp.mDataGame.mPokoCount = Game::playData->mCavePokoCount;
diff --git a/src/plugProjectMorimuraU/zukan2D.cpp b/src/plugProjectMorimuraU/zukan2D.cpp
index b0fd1ba71..5652250e2 100644
--- a/src/plugProjectMorimuraU/zukan2D.cpp
+++ b/src/plugProjectMorimuraU/zukan2D.cpp
@@ -1648,7 +1648,7 @@ void TEnemyZukan::doCreate(JKRArchive* arc)
mIsPreDebt = false;
}
- if (Game::playData && Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData && Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
mIsPreDebt = false;
}
@@ -3265,7 +3265,7 @@ void TItemZukan::doCreate(JKRArchive* arc)
mIsPreDebt = false;
}
- if (Game::playData && Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData && Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
mIsPreDebt = false;
}
mCanComplete = true;
@@ -3485,7 +3485,7 @@ void TItemZukan::doCreate(JKRArchive* arc)
mYajiScreen = new TScreenBase(arc, 0);
mYajiScreen->create("new_otakarazukan_yajirusi.blo", 0x20000);
- if (mShowAllObjects || (Game::playData && Game::playData->mStoryFlags & Game::STORY_DebtPaid)) {
+ if (mShowAllObjects || (Game::playData && Game::playData->isStoryFlag(Game::STORY_DebtPaid))) {
mCurrCharacterIconID = 0;
mWindow->setWindowColor(mMessageWindowColor[1]);
mWindow->onIcon(1);
diff --git a/src/plugProjectOgawaU/ogAnime.cpp b/src/plugProjectOgawaU/ogAnime.cpp
index 0844046d6..ffd3adfbd 100644
--- a/src/plugProjectOgawaU/ogAnime.cpp
+++ b/src/plugProjectOgawaU/ogAnime.cpp
@@ -66,7 +66,7 @@ void AnimBaseBase::init(JKRArchive* archive, char* resourcePath)
JUT_ASSERTLINE(87, resource, "no name resource (%s) \n", resourcePath);
mAnm = J2DAnmLoaderDataBase::load(resource);
- mLastFrame = mAnm->mTotalFrameCount - 1;
+ mLastFrame = mAnm->getFrameMax() - 1;
mMinFrame = 0.0f;
mArea = mLastFrame;
mLength = mArea - mMinFrame;
@@ -216,7 +216,7 @@ void AnimScreen::start()
*/
void AnimScreen::moveAnim()
{
- mAnm->mCurrentFrame = mCurrentFrame;
+ mAnm->setFrame(mCurrentFrame);
mScreen->animation();
if (mDoSetAlpha != 0) {
mScreen->setAlpha(mAlpha);
@@ -271,7 +271,7 @@ void AnimPane::start()
*/
void AnimPane::moveAnim()
{
- mAnm->mCurrentFrame = mCurrentFrame;
+ mAnm->setFrame(mCurrentFrame);
mPane->animationTransform();
if (mDoSetAlpha != 0) {
mPane->setAlpha(mAlpha);
diff --git a/src/sysGCU/movieMessage.cpp b/src/sysGCU/movieMessage.cpp
index 37199f034..9d4d38092 100644
--- a/src/sysGCU/movieMessage.cpp
+++ b/src/sysGCU/movieMessage.cpp
@@ -211,7 +211,7 @@ PodIconScreen::PodIconScreen()
*/
void PodIconScreen::setTrans()
{
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
setXY(mInitialPos.x - 250.0f, mInitialPos.y - 25.0f);
} else {
setXY(mInitialPos.x - 250.0f, mInitialPos.y - 10.0f);
@@ -266,22 +266,22 @@ void PodIconScreen::update()
{
if (mState != -1) {
mAnmTexPatternTimer += 1.0f;
- if (mAnmTexPatternTimer >= mAnmTexPattern->mTotalFrameCount) {
- mAnmTexPatternTimer -= mAnmTexPattern->mTotalFrameCount;
+ if (mAnmTexPatternTimer >= mAnmTexPattern->getFrameMax()) {
+ mAnmTexPatternTimer -= mAnmTexPattern->getFrameMax();
}
- mAnmTexPattern->mCurrentFrame = mAnmTexPatternTimer;
+ mAnmTexPattern->setFrame(mAnmTexPatternTimer);
mAnmTransTimer += 1.0f;
- if (mAnmTransTimer >= mAnmTrans->mTotalFrameCount) {
- mAnmTransTimer -= mAnmTrans->mTotalFrameCount;
+ if (mAnmTransTimer >= mAnmTrans->getFrameMax()) {
+ mAnmTransTimer -= mAnmTrans->getFrameMax();
}
- mAnmTrans->mCurrentFrame = mAnmTransTimer;
+ mAnmTrans->setFrame(mAnmTransTimer);
mAnmColorTimer += 1.0f;
- if (mAnmColorTimer >= mAnmColor->mTotalFrameCount) {
- mAnmColorTimer -= mAnmColor->mTotalFrameCount;
+ if (mAnmColorTimer >= mAnmColor->getFrameMax()) {
+ mAnmColorTimer -= mAnmColor->getFrameMax();
}
- mAnmColor->mCurrentFrame = mAnmColorTimer;
+ mAnmColor->setFrame(mAnmColorTimer);
animation();
@@ -709,7 +709,7 @@ bool TControl::onInit()
sys->heapStatusStart("podIcon", nullptr);
char* path = "new_screen/cmn/pod_for_message_window.szs";
- if (Game::playData->mStoryFlags & Game::STORY_DebtPaid) {
+ if (Game::playData->isStoryFlag(Game::STORY_DebtPaid)) {
path = "new_screen/cmn/gold_pod_for_message_window.szs";
}
arc = JKRMountArchive(path, JKRArchive::EMM_Mem, nullptr, JKRArchive::EMD_Head);
diff --git a/src/utilityU/PSMainSide_ObjSound.cpp b/src/utilityU/PSMainSide_ObjSound.cpp
index 713d4ecef..01eec7081 100644
--- a/src/utilityU/PSMainSide_ObjSound.cpp
+++ b/src/utilityU/PSMainSide_ObjSound.cpp
@@ -315,7 +315,7 @@ JAISound* Creature::startSoundInner(PSM::StartSoundArg& arg)
JAIBasic::msBasic->startSoundActorT(sound, temp, &actor, unk, players);
onPlayingSe(sound, *temp);
if (*temp) {
- (*temp)->_1A = true;
+ (*temp)->mIsPlayingWithActor = true;
}
return *temp;
} else {
@@ -339,7 +339,7 @@ JAISound* Creature::startSoundInner(PSM::StartSoundArg& arg)
onPlayingSe(sound, *getHandleArea(id));
JAISound* se = jai->mSounds[id];
if (se) {
- (se)->_1A = true;
+ se->mIsPlayingWithActor = true;
}
return se;
}
diff --git a/src/utilityU/PSMainSide_Se.cpp b/src/utilityU/PSMainSide_Se.cpp
index 7141e3133..933aeaff6 100644
--- a/src/utilityU/PSMainSide_Se.cpp
+++ b/src/utilityU/PSMainSide_Se.cpp
@@ -21,31 +21,31 @@ namespace PSM {
* @note Address: 0x8046D144
* @note Size: 0x21C
*/
-PSSystem::ClusterSe::PartInitArg ClusterFactory::partInit(u8 unknownID)
+PSSystem::ClusterSe::PartInitArg ClusterFactory::partInit(u8 groupType)
{
PSSystem::ClusterSe::PartInitArg arg;
switch (mType) {
case 0: {
- switch (unknownID) {
+ switch (groupType) {
case 0:
- arg.mMaxEnemyCount = 0x19;
- arg.mVolumeDecreaseThreshold = 0x19;
- arg.mVolumeIncreaseThreshold = 0x16;
- arg.mMinEnemyCount = 0x10;
+ arg.mMaxEnemyCount = 25;
+ arg.mVolumeDecreaseThreshold = 25;
+ arg.mVolumeIncreaseThreshold = 22;
+ arg.mMinEnemyCount = 16;
arg.mSoundID = PSSE_EN_BUTTERFLY_L;
break;
case 1:
- arg.mMaxEnemyCount = 0x16;
- arg.mVolumeDecreaseThreshold = 0x10;
- arg.mVolumeIncreaseThreshold = 0x0e;
- arg.mMinEnemyCount = 0x08;
+ arg.mMaxEnemyCount = 22;
+ arg.mVolumeDecreaseThreshold = 16;
+ arg.mVolumeIncreaseThreshold = 14;
+ arg.mMinEnemyCount = 8;
arg.mSoundID = PSSE_EN_BUTTERFLY_M;
break;
case 2:
- arg.mMaxEnemyCount = 0x0e;
- arg.mVolumeDecreaseThreshold = 0x08;
- arg.mVolumeIncreaseThreshold = 0x05;
- arg.mMinEnemyCount = 0x00;
+ arg.mMaxEnemyCount = 14;
+ arg.mVolumeDecreaseThreshold = 8;
+ arg.mVolumeIncreaseThreshold = 5;
+ arg.mMinEnemyCount = 0;
arg.mSoundID = PSSE_EN_BUTTERFLY_S;
break;
default:
@@ -54,23 +54,23 @@ PSSystem::ClusterSe::PartInitArg ClusterFactory::partInit(u8 unknownID)
break;
}
case 1: {
- switch (unknownID) {
+ switch (groupType) {
case 0:
- arg.mMaxEnemyCount = 0x64;
- arg.mVolumeIncreaseThreshold = 0x46;
- arg.mMinEnemyCount = 0x3c;
+ arg.mMaxEnemyCount = 100;
+ arg.mVolumeIncreaseThreshold = 70;
+ arg.mMinEnemyCount = 60;
break;
case 1:
- arg.mMaxEnemyCount = 0x46;
- arg.mVolumeDecreaseThreshold = 0x3c;
- arg.mVolumeIncreaseThreshold = 0x28;
- arg.mMinEnemyCount = 0x1e;
+ arg.mMaxEnemyCount = 70;
+ arg.mVolumeDecreaseThreshold = 60;
+ arg.mVolumeIncreaseThreshold = 40;
+ arg.mMinEnemyCount = 30;
break;
case 2:
- arg.mMaxEnemyCount = 0x28;
- arg.mVolumeDecreaseThreshold = 0x1e;
- arg.mVolumeIncreaseThreshold = 0x0a;
- arg.mMinEnemyCount = 0x00;
+ arg.mMaxEnemyCount = 40;
+ arg.mVolumeDecreaseThreshold = 30;
+ arg.mVolumeIncreaseThreshold = 10;
+ arg.mMinEnemyCount = 0;
break;
default:
P2ASSERTLINE(95, false);
diff --git a/src/utilityU/PSMainSide_Sound.cpp b/src/utilityU/PSMainSide_Sound.cpp
index 649854610..60d2bd262 100644
--- a/src/utilityU/PSMainSide_Sound.cpp
+++ b/src/utilityU/PSMainSide_Sound.cpp
@@ -19,7 +19,7 @@ f32 SeSound::cDol_FullRad = 2.1099999;
f32 SeSound::cPan_MaxAmp = 0.98;
f32 SeSound::cCenterRad = 1.57;
-const f32 SeSound::smACosPrm[] = {
+const f32 SeSound::smACosPrm[101] = {
3.141592f, 2.941258f, 2.857799f, 2.793427f, 2.738877f, 2.690566f, 2.6466579f, 2.606066f, 2.568079f, 2.532207f,
2.4980919f, 2.465462f, 2.434109f, 2.403867f, 2.374599f, 2.346194f, 2.3185589f, 2.291615f, 2.265295f, 2.2395389f,
2.214298f, 2.1895249f, 2.165182f, 2.141233f, 2.1176469f, 2.0943949f, 2.0714509f, 2.0487909f, 2.026395f, 2.004241f,
@@ -66,7 +66,7 @@ void SeSound::onGet() { }
*/
void SeSound::onRelease()
{
- if (_1A == 0) {
+ if (mIsPlayingWithActor == false) {
return;
}
if (mCreatureObj == nullptr) {
@@ -90,7 +90,7 @@ void SeSound::initParameter(void* mainSoundPtr, JAInter::Actor* actor, u32 id, u
{
JAISound::initParameter(mainSoundPtr, actor, id, a2, a3, info);
mPerspInfo.mIsSpecialSound = false;
- if (_1A) {
+ if (mIsPlayingWithActor) {
if (mCreatureObj) {
Creature* creature = static_cast(mCreatureObj);
P2ASSERTLINE(208, creature);
@@ -105,10 +105,10 @@ void SeSound::initParameter(void* mainSoundPtr, JAInter::Actor* actor, u32 id, u
u32 num = (u32)info->mFlag >> 0x1c;
if (num) {
- _4A0 = (num / 15.0f) * JALCalc::getRandom_0_1();
- _4A0 = _4A0 < 0.0f ? 0.0f : _4A0 > 1.0f ? 1.0f : _4A0;
+ mDistanceModifier = (num / 15.0f) * JALCalc::getRandom_0_1();
+ mDistanceModifier = mDistanceModifier < 0.0f ? 0.0f : mDistanceModifier > 1.0f ? 1.0f : mDistanceModifier;
} else {
- _4A0 = 0.0f;
+ mDistanceModifier = 0.0f;
}
}
@@ -128,8 +128,8 @@ f32 SeSound::setDistanceVolumeCommon(f32, u8 flag)
} else {
dist2 = calcVolume(dist, flag, test);
}
- dist2 -= _4A0;
- if (!_1A || mCreatureObj) {
+ dist2 -= mDistanceModifier;
+ if (!mIsPlayingWithActor || mCreatureObj) {
PSM::SceneBase* scene = static_cast(PSMGetSceneMgrCheck()->getEndScene());
P2ASSERTLINE(261, scene);
f32 calc = scene->getCamDistVol(mPlayerNum);
@@ -404,7 +404,7 @@ void SeSound::setSeDistancePan(u8 flag)
{
f32 calc = 0.5f;
- if (!_1A) {
+ if (!mIsPlayingWithActor) {
calc = calcPan(mSoundObj->mPosition, mSoundObj->mDistance);
} else if (mCreatureObj) {
Creature* creature = static_cast(mCreatureObj);
@@ -423,18 +423,10 @@ f32 SeSound::calcPan(const Vec& pos, f32 modifier)
{
f32 calc = (modifier <= 0.0f) ? cCenterRad : psACos(-pos.x / modifier);
- static f32 panRatio;
- static s8 init;
- if (!init) {
- init = true;
- panRatio = cPan_MaxAmp / 3.1415f;
- }
+ static f32 panRatio = cPan_MaxAmp / 3.1415f;
f32 ret = panRatio * calc;
- if (ret > 1.0f) {
- return 1.0f;
- }
- return ret;
+ return (ret > 1.0f) ? 1.0f : ret;
}
/**
@@ -444,13 +436,11 @@ f32 SeSound::calcPan(const Vec& pos, f32 modifier)
void SeSound::setSeDistanceDolby(u8 flag)
{
f32 calc = 0.0f;
- if (!_1A) {
+ if (!mIsPlayingWithActor) {
calc = calcDolby(mSoundObj->mPosition, mSoundObj->mDistance);
- } else {
- if (mCreatureObj) {
- Creature* creature = static_cast(mCreatureObj);
- calc = creature->getJAIObject()->mDolby;
- }
+ } else if (mCreatureObj) {
+ Creature* creature = static_cast(mCreatureObj);
+ calc = creature->getJAIObject()->mDolby;
}
setSeInterDolby(4, calc, flag, 0);
}