some kando stuff / change vscode to utf8

This commit is contained in:
PikHacker 2024-08-17 15:42:02 -04:00
parent 53e9128700
commit 7542878e18
13 changed files with 48 additions and 82 deletions

View File

@ -1,10 +1,10 @@
{
"[c]": {
"files.encoding": "shiftjis",
"files.encoding": "utf8",
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"[cpp]": {
"files.encoding": "shiftjis",
"files.encoding": "utf8",
"editor.defaultFormatter": "ms-vscode.cpptools"
},
"editor.tabSize": 4,

View File

@ -353,8 +353,6 @@ struct Creature : public CellObject {
inline bool isCreatureFlag(u32 flag) const { return mFlags.typeView & flag; }
inline void killInline(CreatureKillArg* arg);
/**
* Calculates the angular distance between this creature and another creature.
*

View File

@ -59,7 +59,6 @@ struct GameSystem : public NodeObjectMgr<GenericObjectMgr> {
void detachObjectMgr(GenericObjectMgr*);
GameLightMgr* getLightMgr();
void init();
bool isZukanMode() { return mMode == GSM_PIKLOPEDIA; }
bool paused_soft();
bool paused();
void setDrawBuffer(int);
@ -73,6 +72,7 @@ struct GameSystem : public NodeObjectMgr<GenericObjectMgr> {
inline bool isMultiplayerMode() { return (mMode == GSM_VERSUS_MODE || mMode == GSM_TWO_PLAYER_CHALLENGE); }
inline bool isChallengeMode() { return (mMode == GSM_ONE_PLAYER_CHALLENGE || mMode == GSM_TWO_PLAYER_CHALLENGE); }
inline bool isTwoPlayerMode() { return mMode == GSM_TWO_PLAYER_CHALLENGE; }
bool isZukanMode() { return mMode == GSM_PIKLOPEDIA; }
inline void setFlag(u32 flag) { mFlags.typeView |= flag; }
inline void resetFlag(u32 flag) { mFlags.typeView &= ~flag; }

View File

@ -45,7 +45,7 @@ enum VsCaveInfoType {
};
enum LoseReasonFlags {
VSLOSE_Unk1 = 0x1,
VSLOSE_NaviDown = 0x1,
VSLOSE_Extinction = 0x2,
VSLOSE_Finished = 0x4,
VSLOSE_Marble = 0x80,

View File

@ -107,7 +107,7 @@ struct VsGameSection : public BaseGameSection {
struct ItemHole::Item* mHole; // _1FC
struct ItemBigFountain::Item* mFountain; // _200
bool mIsMenuRunning; // _204
bool _205; // _205
bool mIsChallengePerfect; // _205
int mDeadPikiCount; // _208 - pikmin spawn queue
ChallengeGame::StageList* mChallengeStageList; // _20C
VsGame::StageList* mVsStageList; // _210

View File

@ -22,27 +22,6 @@ namespace Game {
Creature* Creature::currOp;
bool Creature::usePacketCulling = true;
/**
* @brief Kills the creature and performs cleanup actions.
*/
inline void Creature::killInline(Game::CreatureKillArg* arg)
{
endStick();
setAlive(false);
Cell::sCurrCellMgr = cellMgr;
exitCell();
Cell::sCurrCellMgr = nullptr;
mUpdateContext.exit();
releaseAllStickers();
clearCapture();
onKill(arg);
if (mGenerator) {
mGenerator->informDeath(this);
mGenerator = nullptr;
}
}
/**
* @note Address: 0x8013AE84
* @note Size: 0x12C
@ -99,7 +78,23 @@ void Creature::init(CreatureInitArg* arg)
* @note Address: 0x8013B0F0
* @note Size: 0xB4
*/
void Creature::kill(CreatureKillArg* arg) { killInline(arg); }
void Creature::kill(CreatureKillArg* arg)
{
endStick();
setAlive(false);
Cell::sCurrCellMgr = cellMgr;
exitCell();
Cell::sCurrCellMgr = nullptr;
mUpdateContext.exit();
releaseAllStickers();
clearCapture();
onKill(arg);
if (mGenerator) {
mGenerator->informDeath(this);
mGenerator = nullptr;
}
}
/**
* Sets the position of the Creature.
@ -512,7 +507,7 @@ int Creature::checkHell(Creature::CheckHellArg& hellArg)
}
if (hellArg.mIsKillPiki) {
killInline(nullptr);
kill(nullptr);
}
return CREATURE_HELL_DEATH;

View File

@ -275,7 +275,7 @@ void Creature::updateStick(Vector3f& pos)
// Get direction from creature to slot, then calculate the angle on the Y axis
Vector3f direction = mSticker->getPosition() - position;
_normaliseXZ(direction);
f32 angleBetween = JMath::atanTable_.atan2_(direction.x, direction.z);
f32 angleBetween = JMAAtan2Radian(direction.x, direction.z);
setPosition(position, true);

View File

@ -312,9 +312,7 @@ void SelectState::draw(SingleGameSection* game, Graphics& gfx)
*/
void SelectState::cleanup(SingleGameSection* game)
{
PSSystem::SceneMgr* mgr = PSSystem::getSceneMgr();
PSSystem::validateSceneMgr(mgr);
mgr->deleteCurrentScene();
PSMGetSceneMgrCheck()->deleteCurrentScene();
playData->doneWorldMapEffect();
particle2dMgr->killAll();

View File

@ -348,7 +348,7 @@ void GameState::exec(VsGameSection* section)
if (isLoseCause(VSPLAYER_Red, VSLOSE_Finished)) {
blueReason = 3;
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_Unk1)) {
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_NaviDown)) {
redReason = 1;
} else if (isLoseCause(VSPLAYER_Red, VSLOSE_Extinction)) {
@ -360,7 +360,7 @@ void GameState::exec(VsGameSection* section)
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Finished)) {
redReason = 3;
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Unk1)) {
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_NaviDown)) {
blueReason = 1;
} else if (isLoseCause(VSPLAYER_Blue, VSLOSE_Extinction)) {
@ -702,9 +702,7 @@ void GameState::onMovieDone(VsGameSection* section, MovieConfig* config, u32 unu
if (gameSystem->isChallengeMode() && Radar::Mgr::getNumOtakaraItems() == 0
&& (config->is("g2F_appear_hole") || config->is("g30_appear_fountain"))) {
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
validateSceneMgr(sceneMgr);
PSM::Scene_Cave* scene = static_cast<PSM::Scene_Cave*>(sceneMgr->getChildScene());
PSM::Scene_Cave* scene = static_cast<PSM::Scene_Cave*>(PSMGetSceneMgrCheck()->getChildScene());
checkGameScene(scene);
if (scene->isCave()) {
scene->startPollutUpSe();
@ -712,13 +710,7 @@ void GameState::onMovieDone(VsGameSection* section, MovieConfig* config, u32 unu
}
if (config->is("x19_vs_bedama") && (isLoseCause(VSPLAYER_Red, VSLOSE_Marble) || isLoseCause(VSPLAYER_Blue, VSLOSE_Marble))) {
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
validateSceneMgr(sceneMgr);
PSM::SceneBase* scene = static_cast<PSM::SceneBase*>(sceneMgr->getChildScene());
scene = (scene->isGameScene()) ? scene : nullptr;
scene->mSeqMgr.stopAllSound(15);
PSMGetGameScene()->mSeqMgr.stopAllSound(15);
}
if (config->is("e00_E3_cavestart")) {
@ -870,7 +862,7 @@ void GameState::onOrimaDown(VsGameSection* section, int naviIdx)
if (gameSystem->isVersusMode()) {
if (!mSubState) {
setLoseCause(naviIdx, VSLOSE_Unk1);
setLoseCause(naviIdx, VSLOSE_NaviDown);
}
return;
}

View File

@ -89,7 +89,7 @@ void ResultState::prepareMorimuraInfo(VsGameSection* section)
if (isNormalEnd()) {
mResultInfo->setDisplayFlag(CHAL2D_SuccessEnd);
if (section->_205) {
if (section->mIsChallengePerfect) {
mResultInfo->setDisplayFlag(CHAL2D_PerfectEnd);
}
}
@ -117,7 +117,7 @@ void ResultState::prepareMorimuraInfo(VsGameSection* section)
sys->getPlayCommonData()->challenge_setClear(stageIndex);
}
if (section->_205) {
if (section->mIsChallengePerfect) {
sys->getPlayCommonData()->challenge_setKunsho(stageIndex);
}
}
@ -132,15 +132,10 @@ void ResultState::dvdload()
PSGame::SceneInfo scene;
scene.mSceneType = PSGame::SceneInfo::CHALLENGE_RESULTS;
scene.mCameras = 0;
static_cast<PSGame::PikSceneMgr*>(PSSystem::getSceneMgr())->newAndSetCurrentScene(scene);
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
sceneMgr->checkScene();
sceneMgr->mScenes->mChild->scene1stLoadSync();
sceneMgr = PSSystem::getSceneMgr();
sceneMgr->checkScene();
sceneMgr->mScenes->mChild->startMainSeq();
PSSystem::getSceneMgr()->doFirstLoad();
PSSystem::getSceneMgr()->doStartMainSeq();
}
/**
@ -213,9 +208,7 @@ void ResultState::draw(VsGameSection* section, Graphics& gfx)
*/
void ResultState::cleanup(VsGameSection* section)
{
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
PSSystem::validateSceneMgr(sceneMgr);
sceneMgr->deleteCurrentScene();
PSMGetSceneMgrCheck()->deleteCurrentScene();
particle2dMgr->killAll();

View File

@ -59,10 +59,10 @@ void TitleState::init(VsGameSection* section, StateArg* arg)
section->clearHeap();
}
section->_205 = true;
section->mDeadPikiCount = false;
mHeap = nullptr;
mExpHeap = nullptr;
section->mIsChallengePerfect = true;
section->mDeadPikiCount = false;
mHeap = nullptr;
mExpHeap = nullptr;
mTitleStage = VSTITLE_PrepareInfo;
_2C = 0;
@ -96,15 +96,10 @@ void TitleState::dvdload()
scene.mSceneType = PSGame::SceneInfo::VERSUS_MENU;
}
scene.mCameras = 0;
static_cast<PSGame::PikSceneMgr*>(PSSystem::getSceneMgr())->newAndSetCurrentScene(scene);
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
sceneMgr->checkScene();
sceneMgr->mScenes->mChild->scene1stLoadSync();
sceneMgr = PSSystem::getSceneMgr();
sceneMgr->checkScene();
sceneMgr->mScenes->mChild->startMainSeq();
PSSystem::getSceneMgr()->doFirstLoad();
PSSystem::getSceneMgr()->doStartMainSeq();
mChallengeTitleInfo = new Challenge2D_TitleInfo(getChallengeStageNum());
mVsTitleInfo = new Vs2D_TitleInfo(getVsStageNum());
@ -391,9 +386,7 @@ void TitleState::draw(VsGameSection* section, Graphics& gfx)
*/
void TitleState::cleanup(VsGameSection* section)
{
PSSystem::SceneMgr* sceneMgr = PSSystem::getSceneMgr();
PSSystem::validateSceneMgr(sceneMgr);
sceneMgr->deleteCurrentScene();
PSMGetSceneMgrCheck()->deleteCurrentScene();
particle2dMgr->killAll();

View File

@ -17,7 +17,7 @@ namespace VsGame {
* @note Address: 0x8022EA94
* @note Size: 0x44
*/
VSState::VSState() { mId = 3; }
VSState::VSState() { mId = VGS_VS; }
/**
* @note Address: 0x8022EAD8
@ -30,10 +30,7 @@ void VSState::do_init(VsGameSection* gameSection)
gameSection->setPlayerMode(NAVIID_Multiplayer);
gameSection->setCamController();
PSSystem::SceneMgr* mgr = PSSystem::getSceneMgr();
mgr->checkScene();
mgr->mScenes->mChild->startMainSeq();
PSSystem::getSceneMgr()->doStartMainSeq();
gameSection->createFallPikmins(gameSection->mContainer1, 0);
}

View File

@ -78,7 +78,7 @@ VsGameSection::VsGameSection(JKRHeap* heap, bool gameMode)
, mMenuFlags(0)
{
mIsVersusMode = gameMode;
_205 = true;
mIsChallengePerfect = true;
mChallengeStageNum = 0;
mVsStageNum = 0;
mVsWinner = -1;
@ -959,7 +959,7 @@ bool GameMessageVsBirthTekiTreasure::actVs(VsGameSection* section)
*/
bool GameMessageVsPikminDead::actVs(VsGameSection* section)
{
section->_205 = false;
section->mIsChallengePerfect = false;
section->mDeadPikiCount++;
return true;
}