Skip to content

Commit 7542878

Browse files
committed
some kando stuff / change vscode to utf8
1 parent 53e9128 commit 7542878

13 files changed

+48
-82
lines changed

.vscode/settings.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"[c]": {
3-
"files.encoding": "shiftjis",
3+
"files.encoding": "utf8",
44
"editor.defaultFormatter": "ms-vscode.cpptools"
55
},
66
"[cpp]": {
7-
"files.encoding": "shiftjis",
7+
"files.encoding": "utf8",
88
"editor.defaultFormatter": "ms-vscode.cpptools"
99
},
1010
"editor.tabSize": 4,

include/Game/Creature.h

-2
Original file line numberDiff line numberDiff line change
@@ -353,8 +353,6 @@ struct Creature : public CellObject {
353353

354354
inline bool isCreatureFlag(u32 flag) const { return mFlags.typeView & flag; }
355355

356-
inline void killInline(CreatureKillArg* arg);
357-
358356
/**
359357
* Calculates the angular distance between this creature and another creature.
360358
*

include/Game/GameSystem.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct GameSystem : public NodeObjectMgr<GenericObjectMgr> {
5959
void detachObjectMgr(GenericObjectMgr*);
6060
GameLightMgr* getLightMgr();
6161
void init();
62-
bool isZukanMode() { return mMode == GSM_PIKLOPEDIA; }
6362
bool paused_soft();
6463
bool paused();
6564
void setDrawBuffer(int);
@@ -73,6 +72,7 @@ struct GameSystem : public NodeObjectMgr<GenericObjectMgr> {
7372
inline bool isMultiplayerMode() { return (mMode == GSM_VERSUS_MODE || mMode == GSM_TWO_PLAYER_CHALLENGE); }
7473
inline bool isChallengeMode() { return (mMode == GSM_ONE_PLAYER_CHALLENGE || mMode == GSM_TWO_PLAYER_CHALLENGE); }
7574
inline bool isTwoPlayerMode() { return mMode == GSM_TWO_PLAYER_CHALLENGE; }
75+
bool isZukanMode() { return mMode == GSM_PIKLOPEDIA; }
7676

7777
inline void setFlag(u32 flag) { mFlags.typeView |= flag; }
7878
inline void resetFlag(u32 flag) { mFlags.typeView &= ~flag; }

include/Game/VsGame.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum VsCaveInfoType {
4545
};
4646

4747
enum LoseReasonFlags {
48-
VSLOSE_Unk1 = 0x1,
48+
VSLOSE_NaviDown = 0x1,
4949
VSLOSE_Extinction = 0x2,
5050
VSLOSE_Finished = 0x4,
5151
VSLOSE_Marble = 0x80,

include/Game/VsGameSection.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ struct VsGameSection : public BaseGameSection {
107107
struct ItemHole::Item* mHole; // _1FC
108108
struct ItemBigFountain::Item* mFountain; // _200
109109
bool mIsMenuRunning; // _204
110-
bool _205; // _205
110+
bool mIsChallengePerfect; // _205
111111
int mDeadPikiCount; // _208 - pikmin spawn queue
112112
ChallengeGame::StageList* mChallengeStageList; // _20C
113113
VsGame::StageList* mVsStageList; // _210

src/plugProjectKandoU/creature.cpp

+18-23
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,6 @@ namespace Game {
2222
Creature* Creature::currOp;
2323
bool Creature::usePacketCulling = true;
2424

25-
/**
26-
* @brief Kills the creature and performs cleanup actions.
27-
*/
28-
inline void Creature::killInline(Game::CreatureKillArg* arg)
29-
{
30-
endStick();
31-
setAlive(false);
32-
Cell::sCurrCellMgr = cellMgr;
33-
exitCell();
34-
Cell::sCurrCellMgr = nullptr;
35-
mUpdateContext.exit();
36-
releaseAllStickers();
37-
clearCapture();
38-
onKill(arg);
39-
40-
if (mGenerator) {
41-
mGenerator->informDeath(this);
42-
mGenerator = nullptr;
43-
}
44-
}
45-
4625
/**
4726
* @note Address: 0x8013AE84
4827
* @note Size: 0x12C
@@ -99,7 +78,23 @@ void Creature::init(CreatureInitArg* arg)
9978
* @note Address: 0x8013B0F0
10079
* @note Size: 0xB4
10180
*/
102-
void Creature::kill(CreatureKillArg* arg) { killInline(arg); }
81+
void Creature::kill(CreatureKillArg* arg)
82+
{
83+
endStick();
84+
setAlive(false);
85+
Cell::sCurrCellMgr = cellMgr;
86+
exitCell();
87+
Cell::sCurrCellMgr = nullptr;
88+
mUpdateContext.exit();
89+
releaseAllStickers();
90+
clearCapture();
91+
onKill(arg);
92+
93+
if (mGenerator) {
94+
mGenerator->informDeath(this);
95+
mGenerator = nullptr;
96+
}
97+
}
10398

10499
/**
105100
* Sets the position of the Creature.
@@ -512,7 +507,7 @@ int Creature::checkHell(Creature::CheckHellArg& hellArg)
512507
}
513508

514509
if (hellArg.mIsKillPiki) {
515-
killInline(nullptr);
510+
kill(nullptr);
516511
}
517512

518513
return CREATURE_HELL_DEATH;

src/plugProjectKandoU/creatureStick.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ void Creature::updateStick(Vector3f& pos)
275275
// Get direction from creature to slot, then calculate the angle on the Y axis
276276
Vector3f direction = mSticker->getPosition() - position;
277277
_normaliseXZ(direction);
278-
f32 angleBetween = JMath::atanTable_.atan2_(direction.x, direction.z);
278+
f32 angleBetween = JMAAtan2Radian(direction.x, direction.z);
279279

280280
setPosition(position, true);
281281

src/plugProjectKandoU/singleGS_WorldMap.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,7 @@ void SelectState::draw(SingleGameSection* game, Graphics& gfx)
312312
*/
313313
void SelectState::cleanup(SingleGameSection* game)
314314
{
315-
PSSystem::SceneMgr* mgr = PSSystem::getSceneMgr();
316-
PSSystem::validateSceneMgr(mgr);
317-
mgr->deleteCurrentScene();
315+
PSMGetSceneMgrCheck()->deleteCurrentScene();
318316

319317
playData->doneWorldMapEffect();
320318
particle2dMgr->killAll();

src/plugProjectKandoU/vsGS_Game.cpp

+5-13
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ void GameState::exec(VsGameSection* section)
348348
if (isLoseCause(VSPLAYER_Red, VSLOSE_Finished)) {
349349
blueReason = 3;
350350

351-
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_Unk1)) {
351+
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_NaviDown)) {
352352
redReason = 1;
353353

354354
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_Extinction)) {
@@ -360,7 +360,7 @@ void GameState::exec(VsGameSection* section)
360360
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Finished)) {
361361
redReason = 3;
362362

363-
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Unk1)) {
363+
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_NaviDown)) {
364364
blueReason = 1;
365365

366366
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Extinction)) {
@@ -702,23 +702,15 @@ void GameState::onMovieDone(VsGameSection* section, MovieConfig* config, u32 unu
702702
if (gameSystem->isChallengeMode() && Radar::Mgr::getNumOtakaraItems() == 0
703703
&& (config->is("g2F_appear_hole") || config->is("g30_appear_fountain"))) {
704704

705-
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
706-
validateSceneMgr(sceneMgr);
707-
PSM::Scene_Cave* scene = static_cast<PSM::Scene_Cave*>(sceneMgr->getChildScene());
705+
PSM::Scene_Cave* scene = static_cast<PSM::Scene_Cave*>(PSMGetSceneMgrCheck()->getChildScene());
708706
checkGameScene(scene);
709707
if (scene->isCave()) {
710708
scene->startPollutUpSe();
711709
}
712710
}
713711

714712
if (config->is("x19_vs_bedama") && (isLoseCause(VSPLAYER_Red, VSLOSE_Marble) || isLoseCause(VSPLAYER_Blue, VSLOSE_Marble))) {
715-
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
716-
validateSceneMgr(sceneMgr);
717-
PSM::SceneBase* scene = static_cast<PSM::SceneBase*>(sceneMgr->getChildScene());
718-
719-
scene = (scene->isGameScene()) ? scene : nullptr;
720-
721-
scene->mSeqMgr.stopAllSound(15);
713+
PSMGetGameScene()->mSeqMgr.stopAllSound(15);
722714
}
723715

724716
if (config->is("e00_E3_cavestart")) {
@@ -870,7 +862,7 @@ void GameState::onOrimaDown(VsGameSection* section, int naviIdx)
870862

871863
if (gameSystem->isVersusMode()) {
872864
if (!mSubState) {
873-
setLoseCause(naviIdx, VSLOSE_Unk1);
865+
setLoseCause(naviIdx, VSLOSE_NaviDown);
874866
}
875867
return;
876868
}

src/plugProjectKandoU/vsGS_Result.cpp

+6-13
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void ResultState::prepareMorimuraInfo(VsGameSection* section)
8989

9090
if (isNormalEnd()) {
9191
mResultInfo->setDisplayFlag(CHAL2D_SuccessEnd);
92-
if (section->_205) {
92+
if (section->mIsChallengePerfect) {
9393
mResultInfo->setDisplayFlag(CHAL2D_PerfectEnd);
9494
}
9595
}
@@ -117,7 +117,7 @@ void ResultState::prepareMorimuraInfo(VsGameSection* section)
117117
sys->getPlayCommonData()->challenge_setClear(stageIndex);
118118
}
119119

120-
if (section->_205) {
120+
if (section->mIsChallengePerfect) {
121121
sys->getPlayCommonData()->challenge_setKunsho(stageIndex);
122122
}
123123
}
@@ -132,15 +132,10 @@ void ResultState::dvdload()
132132
PSGame::SceneInfo scene;
133133
scene.mSceneType = PSGame::SceneInfo::CHALLENGE_RESULTS;
134134
scene.mCameras = 0;
135-
static_cast<PSGame::PikSceneMgr*>(PSSystem::getSceneMgr())->newAndSetCurrentScene(scene);
136-
137-
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
138-
sceneMgr->checkScene();
139135

140-
sceneMgr->mScenes->mChild->scene1stLoadSync();
141-
sceneMgr = PSSystem::getSceneMgr();
142-
sceneMgr->checkScene();
143-
sceneMgr->mScenes->mChild->startMainSeq();
136+
static_cast<PSGame::PikSceneMgr*>(PSSystem::getSceneMgr())->newAndSetCurrentScene(scene);
137+
PSSystem::getSceneMgr()->doFirstLoad();
138+
PSSystem::getSceneMgr()->doStartMainSeq();
144139
}
145140

146141
/**
@@ -213,9 +208,7 @@ void ResultState::draw(VsGameSection* section, Graphics& gfx)
213208
*/
214209
void ResultState::cleanup(VsGameSection* section)
215210
{
216-
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
217-
PSSystem::validateSceneMgr(sceneMgr);
218-
sceneMgr->deleteCurrentScene();
211+
PSMGetSceneMgrCheck()->deleteCurrentScene();
219212

220213
particle2dMgr->killAll();
221214

src/plugProjectKandoU/vsGS_Title.cpp

+8-15
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void TitleState::init(VsGameSection* section, StateArg* arg)
5959
section->clearHeap();
6060
}
6161

62-
section->_205 = true;
63-
section->mDeadPikiCount = false;
64-
mHeap = nullptr;
65-
mExpHeap = nullptr;
62+
section->mIsChallengePerfect = true;
63+
section->mDeadPikiCount = false;
64+
mHeap = nullptr;
65+
mExpHeap = nullptr;
6666

6767
mTitleStage = VSTITLE_PrepareInfo;
6868
_2C = 0;
@@ -96,15 +96,10 @@ void TitleState::dvdload()
9696
scene.mSceneType = PSGame::SceneInfo::VERSUS_MENU;
9797
}
9898
scene.mCameras = 0;
99-
static_cast<PSGame::PikSceneMgr*>(PSSystem::getSceneMgr())->newAndSetCurrentScene(scene);
100-
101-
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
102-
sceneMgr->checkScene();
103-
sceneMgr->mScenes->mChild->scene1stLoadSync();
10499

105-
sceneMgr = PSSystem::getSceneMgr();
106-
sceneMgr->checkScene();
107-
sceneMgr->mScenes->mChild->startMainSeq();
100+
static_cast<PSGame::PikSceneMgr*>(PSSystem::getSceneMgr())->newAndSetCurrentScene(scene);
101+
PSSystem::getSceneMgr()->doFirstLoad();
102+
PSSystem::getSceneMgr()->doStartMainSeq();
108103

109104
mChallengeTitleInfo = new Challenge2D_TitleInfo(getChallengeStageNum());
110105
mVsTitleInfo = new Vs2D_TitleInfo(getVsStageNum());
@@ -391,9 +386,7 @@ void TitleState::draw(VsGameSection* section, Graphics& gfx)
391386
*/
392387
void TitleState::cleanup(VsGameSection* section)
393388
{
394-
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
395-
PSSystem::validateSceneMgr(sceneMgr);
396-
sceneMgr->deleteCurrentScene();
389+
PSMGetSceneMgrCheck()->deleteCurrentScene();
397390

398391
particle2dMgr->killAll();
399392

src/plugProjectKandoU/vsGS_VSGame.cpp

+2-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace VsGame {
1717
* @note Address: 0x8022EA94
1818
* @note Size: 0x44
1919
*/
20-
VSState::VSState() { mId = 3; }
20+
VSState::VSState() { mId = VGS_VS; }
2121

2222
/**
2323
* @note Address: 0x8022EAD8
@@ -30,10 +30,7 @@ void VSState::do_init(VsGameSection* gameSection)
3030
gameSection->setPlayerMode(NAVIID_Multiplayer);
3131
gameSection->setCamController();
3232

33-
PSSystem::SceneMgr* mgr = PSSystem::getSceneMgr();
34-
mgr->checkScene();
35-
36-
mgr->mScenes->mChild->startMainSeq();
33+
PSSystem::getSceneMgr()->doStartMainSeq();
3734

3835
gameSection->createFallPikmins(gameSection->mContainer1, 0);
3936
}

src/plugProjectKandoU/vsGameSection.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ VsGameSection::VsGameSection(JKRHeap* heap, bool gameMode)
7878
, mMenuFlags(0)
7979
{
8080
mIsVersusMode = gameMode;
81-
_205 = true;
81+
mIsChallengePerfect = true;
8282
mChallengeStageNum = 0;
8383
mVsStageNum = 0;
8484
mVsWinner = -1;
@@ -959,7 +959,7 @@ bool GameMessageVsBirthTekiTreasure::actVs(VsGameSection* section)
959959
*/
960960
bool GameMessageVsPikminDead::actVs(VsGameSection* section)
961961
{
962-
section->_205 = false;
962+
section->mIsChallengePerfect = false;
963963
section->mDeadPikiCount++;
964964
return true;
965965
}

0 commit comments

Comments
 (0)