Skip to content

Commit

Permalink
Update Queen and CellIterator variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Sep 11, 2023
1 parent ddc23dd commit 6ff7925
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 181 deletions.
16 changes: 8 additions & 8 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiTeki.cpp">aiTeki.cpp</a> | 5890 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePelletList.cpp">gamePelletList.cpp</a> | 8282 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellIterator.cpp">cellIterator.cpp</a> | 8953 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/mapMgrTraceMove.cpp">mapMgrTraceMove.cpp</a> | 9030 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/mapMgrTraceMove.cpp">mapMgrTraceMove.cpp</a> | 9030 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/cellIterator.cpp">cellIterator.cpp</a> | 9254 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemBarrel.cpp">itemBarrel.cpp</a> | 11148 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBreakGate.cpp">aiBreakGate.cpp</a> | 13918 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/flockMgr.cpp">flockMgr.cpp</a> | 13955 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemTreasure.cpp">itemTreasure.cpp</a> | 14296 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 16714 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBattle.cpp">aiBattle.cpp</a> | 17374 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 16714 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBattle.cpp">aiBattle.cpp</a> | 17389 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureLOD.cpp">creatureLOD.cpp</a> | 18468 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/texCaster.cpp">texCaster.cpp</a> | 20776 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiRescue.cpp">aiRescue.cpp</a> | 21024 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameResultTexMgr.cpp">gameResultTexMgr.cpp</a> | 21442 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 22846 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiCrop.cpp">aiCrop.cpp</a> | 26982 |
Expand Down Expand Up @@ -137,17 +137,17 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/nslibmath.cpp">nslibmath.cpp</a> | 4592 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/TyreShadow.cpp">TyreShadow.cpp</a> | 7234 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/MaroFrog.cpp">MaroFrog.cpp</a> | 7314 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/UmimushiShadow.cpp">UmimushiShadow.cpp</a> | 7565 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ContRumble.cpp">ContRumble.cpp</a> | 9005 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeJointMgr.cpp">SnakeJointMgr.cpp</a> | 10097 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/KumaChappy.cpp">KumaChappy.cpp</a> | 11401 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Kabuto.cpp">Kabuto.cpp</a> | 12265 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BabyState.cpp">BabyState.cpp</a> | 12869 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Tank.cpp">Tank.cpp</a> | 13313 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/KumaChappy.cpp">KumaChappy.cpp</a> | 11401 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Kabuto.cpp">Kabuto.cpp</a> | 12279 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BabyState.cpp">BabyState.cpp</a> | 12869 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Tank.cpp">Tank.cpp</a> | 13327 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Kogane.cpp">Kogane.cpp</a> | 14614 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/JointShadowBase.cpp">JointShadowBase.cpp</a> | 14958 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecBugState.cpp">ElecBugState.cpp</a> | 15715 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RandMapMgr.cpp">RandMapMgr.cpp</a> | 17083 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/TadpoleState.cpp">TadpoleState.cpp</a> | 17593 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeWholeShadow.cpp">SnakeWholeShadow.cpp</a> | 19376 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeCrowShadow.cpp">SnakeCrowShadow.cpp</a> | 19385 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ImomushiState.cpp">ImomushiState.cpp</a> | 19863 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/UjiaState.cpp">UjiaState.cpp</a> | 20924 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RumbleMgr.cpp">RumbleMgr.cpp</a> | 21534 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Rock.cpp">Rock.cpp</a> | 21671 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecHiba.cpp">ElecHiba.cpp</a> | 21823 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Frog.cpp">Frog.cpp</a> | 22143 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/QueenState.cpp">QueenState.cpp</a> | 22521 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Ujia.cpp">Ujia.cpp</a> | 22966 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Queen.cpp">Queen.cpp</a> | 23496 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Ujib.cpp">Ujib.cpp</a> | 23602 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecBug.cpp">ElecBug.cpp</a> | 24345 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Rock.cpp">Rock.cpp</a> | 21671 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecHiba.cpp">ElecHiba.cpp</a> | 21837 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Frog.cpp">Frog.cpp</a> | 22143 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/QueenState.cpp">QueenState.cpp</a> | 22713 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Ujia.cpp">Ujia.cpp</a> | 22966 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Ujib.cpp">Ujib.cpp</a> | 23602 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Queen.cpp">Queen.cpp</a> | 23612 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ElecBug.cpp">ElecBug.cpp</a> | 24345 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/ArmorState.cpp">ArmorState.cpp</a> | 24714 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SaraiState.cpp">SaraiState.cpp</a> | 24923 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/TobiState.cpp">TobiState.cpp</a> | 24962 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/UjibState.cpp">UjibState.cpp</a> | 25505 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Armor.cpp">Armor.cpp</a> | 25780 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Tobi.cpp">Tobi.cpp</a> | 25937 |
Expand Down
10 changes: 5 additions & 5 deletions include/Game/Entities/Queen.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ struct Obj : public EnemyBase {
FSM* mFsm; // _2BC
bool mCanCreateLarva; // _2C0
bool mIsRoomForLarva; // _2C1, have not hit max capacity yet
u8 _2C2; // _2C2
u8 _2C3; // _2C3
u8 _2C4; // _2C4
u8 _2C5; // _2C5
bool mIsRolling; // _2C2
bool mDoEasyRoll; // _2C3, first roll will avoid active captain (only HoB)
bool mIsAppearBGM; // _2C4, has BGM started
bool mIsAttackLoopBGM; // _2C5, is the attack loop BGM playing
f32 mWaitTimer; // _2C8
f32 mBirthTimer; // _2CC
f32 _2D0; // _2D0
f32 _2D0; // _2D0, related to hit counter?
StateID mNextState; // _2D4
QueenShadowMgr* mShadowMgr; // _2D8
Sys::MatLoopAnimator* mMatLoopAnimator; // _2DC
Expand Down
46 changes: 23 additions & 23 deletions include/Game/cellPyramid.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ struct Cell {
void exit(CellLeg*, bool);
void entry(CellLeg*, bool);

Cell* _00[4]; // _00
Cell* _10; // _10
u16 _14; // _14
u16 _16; // _16
u16 _18; // _18
u8 _1A[2]; // _1A
CellLeg* _1C; // _1C
Cell* _20; // _20
Cell* _24; // _24
short _28; // _28
u8 _2A[2]; // _2A
Cell* _00[4]; // _00
Cell* _10; // _10
u16 _14; // _14
u16 _16; // _16
u16 _18; // _18
u8 _1A[2]; // _1A
CellLeg* mLeg; // _1C
Cell* _20; // _20
Cell* _24; // _24
short _28; // _28
u8 _2A[2]; // _2A

static CellPyramid* sCurrCellMgr;
};
Expand Down Expand Up @@ -223,10 +223,10 @@ struct CellIteratorArg {

Sys::Sphere mSphere; // _00
CellIteratorCondition* mCondition; // _10, this is a ptr to something with a vtable, and 0x8 of vtable returns a bool ._.
int _14; // _14
int _14; // _14, set to 0 and unused
CellPyramid* mCellMgr; // _18
u8 _1C; // _1C
u8 _1D; // _1D
bool mIgnoreOverlap; // _1C, if false, will calc overlapping bounding spheres rather than just "in cell or no"
u8 _1D; // _1D, set to 0 and unused
};

#define CI_LOOP(it) for (it.first(); !it.isDone(); it.next())
Expand All @@ -245,17 +245,17 @@ struct CellIterator {
bool satisfy();
bool step();

CellLeg* _00; // _00
int _04; // _04
int _08; // _08
int _0C; // _0C
int _10; // _10
int _14; // _14
int _18; // _18
int _1C; // _1C
CellLeg* mCurrLeg; // _00
int mCurrX; // _04
int mCurrY; // _08
int mCurrLayerIdx; // _0C
int mMinX; // _10
int mMinY; // _14
int mMaxX; // _18
int mMaxY; // _1C
u32 mPassID; // _20
CellIteratorArg mArg; // _24
u32 _44; // _44
u32 _44; // _44, unused
};

extern CellPyramid* cellMgr;
Expand Down
2 changes: 1 addition & 1 deletion src/plugProjectKandoU/aiBattle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void ActBattle::init(PikiAI::ActionArg* arg)
Vector3f midPoint = (mParent->getPosition() + mOther->getPosition()) * 0.5f;
Sys::Sphere itSphere(midPoint, 10.0f);
Game::CellIteratorArg citArg(itSphere);
citArg._1C = 0;
citArg.mIgnoreOverlap = false;

Game::CellIterator cellIt(citArg);
CI_LOOP(cellIt)
Expand Down
92 changes: 46 additions & 46 deletions src/plugProjectKandoU/cellIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ CellIteratorArg::CellIteratorArg()

mCellMgr = cellMgr;

_1D = 0;
_1C = 0;
_1D = 0;
mIgnoreOverlap = false;
}

/*
Expand All @@ -29,12 +29,12 @@ CellIteratorArg::CellIteratorArg()
*/
CellIteratorArg::CellIteratorArg(Sys::Sphere& sphere)
{
mSphere = sphere;
mCondition = nullptr;
_14 = 0;
mCellMgr = Game::cellMgr;
_1D = 0;
_1C = 0;
mSphere = sphere;
mCondition = nullptr;
_14 = 0;
mCellMgr = Game::cellMgr;
_1D = 0;
mIgnoreOverlap = false;
}

/*
Expand All @@ -60,14 +60,14 @@ void CellIterator::first()

mPassID = cellMgr->mPassID;

_00 = 0;
_0C = 0;
mCurrLeg = nullptr;
mCurrLayerIdx = 0;

calcExtent();

Cell* foundCell = mArg.mCellMgr->mLayers[_0C](_04, _08);
Cell* foundCell = mArg.mCellMgr->mLayers[mCurrLayerIdx](mCurrX, mCurrY);
if (foundCell) {
_00 = foundCell->_1C;
mCurrLeg = foundCell->mLeg;
}
find();
}
Expand All @@ -90,7 +90,7 @@ bool CellIterator::next()
* Size: 000010
* Matches
*/
bool CellIterator::isDone() { return _00 == nullptr; }
bool CellIterator::isDone() { return mCurrLeg == nullptr; }

/*
* --INFO--
Expand All @@ -99,8 +99,8 @@ bool CellIterator::isDone() { return _00 == nullptr; }
*/
CellObject* CellIterator::operator*()
{
if (_00) {
return _00->mObject;
if (mCurrLeg) {
return mCurrLeg->mObject;
}
return nullptr;
}
Expand All @@ -119,28 +119,28 @@ CellObject* CellIterator::getCellObject() { return *(*this); }
*/
bool CellIterator::step()
{
if (_00) {
_00 = _00->mNext;
if (mCurrLeg) {
mCurrLeg = mCurrLeg->mNext;
}

if (!_00) {
_08++;
if (_08 > _1C) {
_08 = _14;
_04++;
if (_04 > _18) {
_0C++;
if (_0C >= mArg.mCellMgr->mLayerCount) {
if (!mCurrLeg) {
mCurrY++;
if (mCurrY > mMaxY) {
mCurrY = mMinY;
mCurrX++;
if (mCurrX > mMaxX) {
mCurrLayerIdx++;
if (mCurrLayerIdx >= mArg.mCellMgr->mLayerCount) {
return false;
}

calcExtent();
}
}

Cell* foundCell = mArg.mCellMgr->mLayers[_0C](_04, _08);
Cell* foundCell = mArg.mCellMgr->mLayers[mCurrLayerIdx](mCurrX, mCurrY);
if (foundCell) {
_00 = foundCell->_1C;
mCurrLeg = foundCell->mLeg;
}
}

Expand Down Expand Up @@ -170,25 +170,25 @@ bool CellIterator::find()
*/
bool CellIterator::satisfy()
{
if (!_00) {
if (!mCurrLeg) {
return false;
}

if (!_00 || _00->mObject->mPassID == mPassID) {
if (!mCurrLeg || mCurrLeg->mObject->mPassID == mPassID) {
return false;
}

if (mArg.mCondition && !mArg.mCondition->satisfy(_00->mObject)) {
if (mArg.mCondition && !mArg.mCondition->satisfy(mCurrLeg->mObject)) {
return false;
}

CellObject* obj = _00->mObject;
CellObject* obj = mCurrLeg->mObject;
Vector3f objPos = obj->getPosition();

Sys::Sphere sphere;
obj->getBoundingSphere(sphere);

if (!mArg._1C) {
if (!mArg.mIgnoreOverlap) {
if (!mArg._14) {
f32 radius = mArg.mSphere.mRadius + sphere.mRadius;
radius *= radius;
Expand All @@ -204,7 +204,7 @@ bool CellIterator::satisfy()
}
}

_00->mObject->mPassID = mPassID;
mCurrLeg->mObject->mPassID = mPassID;
return true;
/*
stwu r1, -0x50(r1)
Expand Down Expand Up @@ -338,27 +338,27 @@ void CellIterator::calcExtent()
f32 a = mArg.mCellMgr->_40;
f32 b = mArg.mCellMgr->_3C;

f32 norm = 1.0f / (mgr->_34 * mgr->mLayers[_0C]._04);
f32 norm = 1.0f / (mgr->_34 * mgr->mLayers[mCurrLayerIdx]._04);

_10 = (x - r - a) * norm;
_14 = (z - r - b) * norm;
_18 = (x + r - a) * norm;
_1C = (z + r - b) * norm;
mMinX = (x - r - a) * norm;
mMinY = (z - r - b) * norm;
mMaxX = (x + r - a) * norm;
mMaxY = (z + r - b) * norm;

if (_10 > _18) {
JUT_PANICLINE(249, "x %f>%f", _10, _18);
if (mMinX > mMaxX) {
JUT_PANICLINE(249, "x %f>%f", mMinX, mMaxX);
}

if (_14 > _1C) {
JUT_PANICLINE(252, "y %f>%f", _14, _1C);
if (mMinY > mMaxY) {
JUT_PANICLINE(252, "y %f>%f", mMinY, mMaxY);
}

if ((_18 - _10) * (_1C - _14) >= 10000) {
JUT_PANICLINE(259, "xy %f %f\n%f %f\n", _10, _14, _18, _1C);
if ((mMaxX - mMinX) * (mMaxY - mMinY) >= 10000) {
JUT_PANICLINE(259, "xy %f %f\n%f %f\n", mMinX, mMinY, mMaxX, mMaxY);
}

_04 = _10;
_08 = _14;
mCurrX = mMinX;
mCurrY = mMinY;
/*
stwu r1, -0x40(r1)
mflr r0
Expand Down
Loading

0 comments on commit 6ff7925

Please sign in to comment.