MORE CLEANUP!!!!!!

This commit is contained in:
intns 2023-10-27 04:15:16 +01:00
parent 3b962c80ca
commit 76885067ad
20 changed files with 197 additions and 209 deletions

View File

@ -20,12 +20,12 @@ struct Footmarks {
Footmark* get(int index);
Footmark* findNearest2(Vector3f&, int);
Footmark* mMarks; // _00
int _04; // _04
int _08; // _08
int mCount; // _0C
int _10; // _10
Vector3f mPosition; // _14
Footmark* mMarks; // _00
int mCurrentIndex; // _04
int mCapacity; // _08
int mCount; // _0C
int mLastUpdateTime; // _10
Vector3f mPosition; // _14
};
} // namespace Game

View File

@ -304,8 +304,8 @@ struct ActBattle : public Action, virtual SysShape::MotionListener {
Game::Piki* mOther; // _10, vs battle piki attack
u8 mState; // _14
ActApproachPos* mApproachPos; // _18
s8 _1C; // _1C
s8 _1D; // _1D
s8 mFlags; // _1C
s8 mHitCount; // _1D
};
struct ActBoreBase : public Action, virtual SysShape::MotionListener {
@ -386,7 +386,7 @@ struct ActBreakGate : public Action, virtual SysShape::MotionListener {
ActStickAttack* mStickAttack; // _18
ActGotoPos* mGotoPos; // _1C
ActFollowVectorField* mFollowField; // _20
u8 _24; // _24
bool mResetStateAfter; // _24
u8 _25[0x3]; // _25, unknown/probably padding
u8 _28[0xC]; // _28, unknown
// _34 = MotionListener
@ -464,7 +464,7 @@ struct ActBridge : public Action, virtual SysShape::MotionListener {
u32 _24; // _24
u32 _28; // _28
u32 _2C; // _2C
u8 _30; // _30
u8 mCollPartType; // _30
// _34 = MotionListener
};
@ -550,7 +550,7 @@ struct ActCrop : public Action, virtual SysShape::MotionListener {
ActGotoPos* mGotoPos; // _30
u32 _34; // _34, unknown
f32 mAttackDir; // _38
bool _3C; // _3C
bool mIsDirectionReversed; // _3C
// _40 = MotionListener
};
@ -592,7 +592,7 @@ struct ActEnter : public Action, virtual SysShape::MotionListener {
f32 mTimer; // _40, timer for pikis entering ship, reused by stay and suck
f32 mVertSuckDist; // _44, distance left to travel before entering ship, Y
f32 mHorizSuckDist; // _48, distance left to travel before entering ship, XZ
u8 _4C; // _4C
u8 mInsideOnyon; // _4C
Vector3f mSuckPos; // _50, current suck position
f32 mBaseScale; // _54
// _58 = MotionListener
@ -752,30 +752,30 @@ struct ActFormation : public Action, virtual Game::SlotChangeListener, virtual S
// _00-_0C = Action
// _0C-_10 = SlotChangeListener*
// _10-_14 = MotionListener*
Game::Navi* mNavi; // _14
ActFormationInitArg mInitArg; // _18
int mNextAIType; // _24
u16 mSortState; // _28, use FORMATION_SORT_ enum
u16 _2A; // _2A
u16 _2C; // _2C
u16 _2E; // _2E
u8 _30; // _30
u8 _31; // _31
int mSlotID; // _34
u8 _38; // _38
Game::Footmark* mFootmark; // _3C
u8 _40; // _40
int mFrameTimer; // _44
int _48; // _48
int _4C; // _4C
f32 _50; // _50
u8 _54; // _54
f32 _58; // _58, timer?
Game::CPlate* mCPlate; // _5C
bool _60; // _60
bool _61; // _61
// _64 = SlotChangeListener
// _6C = MotionListener
Game::Navi* mNavi; // _14
ActFormationInitArg mInitArg; // _18
int mNextAIType; // _24
u16 mSortState; // _28, use FORMATION_SORT_ enum
u16 mDistanceType; // _2A
u16 mOldDistanceType; // _2C
u16 mDistanceCounter; // _2E
u8 _30; // _30
u8 _31; // _31
int mSlotID; // _34
u8 mTouchingNaviCooldownTimer; // _38
Game::Footmark* mFootmark; // _3C
u8 mTouchingWallTimer; // _40
int mFrameTimer; // _44
int mFootmarkFlags; // _48
int mAnimationTimer; // _4C
f32 _50; // _50
u8 mIsAnimating; // _54
f32 mLostPikiTimer; // _58, timer?
Game::CPlate* mCPlate; // _5C
bool _60; // _60
bool _61; // _61
// _64 = SlotChangeListener
// _6C = MotionListener
};
struct ActFreeArg : public ActionArg {

View File

@ -59,7 +59,7 @@ struct MgrCommand : public CNode, JKRDisposer {
// CNode _00 - _18
// JKRDisposer _18 - _30
s32 _30; // _30
s32 mMode; // _30
u8 _34; // _34
Node* mNode1; // _38
DvdThreadCommand mDvdThread; // _3C
@ -92,8 +92,8 @@ struct Mgr {
// _00 = VTBL
JKRHeap* mHeap; // _04
u32 _08; // _08
u32 _0C; // _0C
u32 mHeapSize; // _08
u32 mRemainingSize; // _0C, guessed name
CNode mNodes; // _10
CNode mLoadingNodes; // _28
BitFlag<u32> mFlags; // _40

View File

@ -15,7 +15,7 @@ struct MenuSection : public Section {
// _00 = VTBL
// _00-_3C = Section
bool _3C; // _3C
bool mIsDone; // _3C
u8 _3D; // _3D
u8 _3E; // _3E
u8 _3F; // _3F

View File

@ -34,8 +34,8 @@ struct World {
struct ResolveArg {
Callback* mCallback;
u32 _04;
u32 _08;
u32 mComparisonCount;
u32 mCollisionCount;
};
World();

View File

@ -25,7 +25,7 @@ static const char unusedAiBattleName[] = "aiBattle";
ActBattle::ActBattle(Game::Piki* p)
: Action(p)
{
_1C = 0;
mFlags = 0;
mName = "Battle";
mApproachPos = new ActApproachPos(p);
}
@ -66,14 +66,14 @@ void ActBattle::init(PikiAI::ActionArg* arg)
Game::InteractBattle battle(mParent);
mOther->stimulate(battle);
if (battleArg->mIsAttackStart) {
SET_FLAG(_1C, 2);
SET_FLAG(mFlags, 2);
} else if (mOther == mOther->getVsBattlePiki()) {
SET_FLAG(_1C, 2);
SET_FLAG(mFlags, 2);
} else {
RESET_FLAG(_1C, 2);
RESET_FLAG(mFlags, 2);
}
initApproach();
_1D = 0;
mHitCount = 0;
Vector3f midPoint = (mParent->getPosition() + mOther->getPosition());
midPoint *= 0.5f;
@ -111,7 +111,7 @@ int ActBattle::exec()
return 0;
}
if (!(_1C & 2)) {
if (!(mFlags & 2)) {
return 2;
}
@ -195,7 +195,7 @@ void ActBattle::onKeyEvent(SysShape::KeyEvent const& event)
initApproach();
f32 rngChance = randFloat() * 2.2f;
u8 old = ++_1D;
u8 old = ++mHitCount;
if (old >= (int)rngChance + 6) {
if (mOther && mOther->getVsBattlePiki() == mParent) {
f32 oh = 0.5f * mOther->mHappaKind + 1.0f;
@ -217,7 +217,7 @@ void ActBattle::onKeyEvent(SysShape::KeyEvent const& event)
mOther->mFsm->transit(mOther, Game::PIKISTATE_Dying, &arg);
}
} else {
RESET_FLAG(_1C, 2);
RESET_FLAG(mFlags, 2);
}
return;
}

View File

@ -42,8 +42,8 @@ void ActBreakGate::init(ActionArg* actionArg)
Game::GameStat::workPikis.inc(mParent);
mGate = static_cast<ActBreakGateArg*>(actionArg)->mGate;
_24 = 0;
mGate = static_cast<ActBreakGateArg*>(actionArg)->mGate;
mResetStateAfter = 0;
initFollow();
}
@ -87,7 +87,7 @@ void ActBreakGate::initStickAttack()
type = STICKATK_ElecGate;
}
if (_24 == 0) {
if (mResetStateAfter == 0) {
f32 attackDamage = mParent->getAttackDamage();
StickAttackActionArg stickAttackArg(attackDamage, mGate, Game::IPikiAnims::NULLANIM, type);
mStickAttack->init(&stickAttackArg);
@ -523,10 +523,10 @@ void ActBreakGate::emotion_success()
*/
void ActBreakGate::platCallback(Game::Piki* p, Game::PlatEvent& platEvent)
{
if (platEvent._08 > 0.7f) {
_24 = 1;
if (platEvent.mPosition.y > 0.7f) {
mResetStateAfter = 1;
} else {
_24 = 0;
mResetStateAfter = 0;
}
if (mState == 1) {

View File

@ -21,7 +21,7 @@ static const char aiBridgeName[] = "actBridge";
ActBridge::ActBridge(Game::Piki* parent)
: Action(parent)
{
_30 = 0;
mCollPartType = 0;
mStickAttack = new ActStickAttack(parent);
mGotoPos = new ActGotoPos(parent);
@ -49,8 +49,8 @@ void ActBridge::init(ActionArg* actionArg)
Game::GameStat::workPikis.inc(mParent);
mBridge = static_cast<ActBridgeArg*>(actionArg)->mBridge;
_30 = 0;
mBridge = static_cast<ActBridgeArg*>(actionArg)->mBridge;
mCollPartType = 0;
initFollow();
}
@ -91,7 +91,7 @@ void ActBridge::initStickAttack()
StickAttackActionArg stickAttackArg(attackDamage, mBridge, Game::IPikiAnims::NULLANIM, STICKATK_Bridge);
bool check = false;
if ((_30 & 1) && mParent->mCollisionPosition.y > 0.5f) {
if ((mCollPartType & 1) && mParent->mCollisionPosition.y > 0.5f) {
check = true;
}
@ -112,7 +112,7 @@ void ActBridge::initStickAttack()
int ActBridge::exec()
{
if (!mBridge->isAlive()) {
_30 = 0;
mCollPartType = 0;
return 0;
}
@ -131,7 +131,7 @@ int ActBridge::exec()
if (stickResult == 0 || stickResult == 2) {
initStickAttack();
} else {
_30 = 0;
mCollPartType = 0;
return stickResult;
}
break;
@ -141,7 +141,7 @@ int ActBridge::exec()
if (followResult == 0) {
initStickAttack();
} else {
_30 = 0;
mCollPartType = 0;
return followResult;
}
break;
@ -151,13 +151,13 @@ int ActBridge::exec()
if (gotoResult == 0) {
initStickAttack();
} else {
_30 = 0;
mCollPartType = 0;
return gotoResult;
}
break;
}
_30 = 0;
mCollPartType = 0;
return 1;
}
@ -187,9 +187,9 @@ void ActBridge::platCallback(Game::Piki* p, Game::PlatEvent& platEvent)
Game::PlatInstance* instance = platEvent.mInstance;
if (platEvent.mObj == mBridge) {
if (instance->mId.getID() == 'brbk') {
_30 |= 0x1;
mCollPartType |= 0x1;
} else if (instance->mId.getID() == 'br__') {
_30 |= 0x2;
mCollPartType |= 0x2;
}
}

View File

@ -145,8 +145,8 @@ void ActCrop::initAttack()
f32 damage = mParent->getAttackDamage();
StickAttackActionArg stickAttackArg(damage, mCreature, Game::IPikiAnims::NULLANIM, 0);
mStickAttack->init(&stickAttackArg);
mState = CROP_Attack;
_3C = true;
mState = CROP_Attack;
mIsDirectionReversed = true;
}
/*
@ -176,13 +176,13 @@ int ActCrop::exec()
f32 negYComp = -yComp;
mParent->endStick();
if (_3C) {
if (mIsDirectionReversed) {
if (yComp > 0.9f) {
_3C = false;
mIsDirectionReversed = false;
}
} else {
if (yComp < -0.9f) {
_3C = true;
mIsDirectionReversed = true;
}
horizComp = -horizComp;
}

View File

@ -197,9 +197,9 @@ void ActEnter::initSuck()
mSuckGoalPos.y = pikiPos.y;
mTimer = -mHorizSuckDist;
_4C = 0;
mBaseScale = 1.0f;
mTimer = -mHorizSuckDist;
mInsideOnyon = 0;
mBaseScale = 1.0f;
mParent->startSound(PSSE_PK_VC_JUMP_INTO_UFO, true);
mParent->startMotion(Game::IPikiAnims::ROLLJUMP, Game::IPikiAnims::ROLLJUMP, nullptr, nullptr);
@ -326,7 +326,7 @@ lbl_801A2FD0:
*/
int ActEnter::execSuck()
{
if (_4C) {
if (mInsideOnyon) {
mParent->setPosition(mSuckPos, false);
return ACTEXEC_Success;
}
@ -339,8 +339,8 @@ int ActEnter::execSuck()
mParent->mScale = Vector3f(mBaseScale);
mTimer += sys->mDeltaTime * 110.0f;
if (mTimer >= 0.0f) {
_4C = 1;
mSuckPos = newPos;
mInsideOnyon = 1;
mSuckPos = newPos;
mParent->startSound(PSSE_PK_SE_ONY_ENTER, true);
return ACTEXEC_Success;
}

View File

@ -72,9 +72,9 @@ void ActFormation::init(ActionArg* initArg)
mInitArg._09 = formationArg->_09;
if (mInitArg._09) {
_38 = 45;
mTouchingNaviCooldownTimer = 45;
} else {
_38 = 0;
mTouchingNaviCooldownTimer = 0;
}
Game::Navi* initNavi = static_cast<Game::Navi*>(formationArg->mCreature);
@ -85,11 +85,11 @@ void ActFormation::init(ActionArg* initArg)
return;
}
_2A = 5;
_2C = 5;
_2E = 0;
_60 = false;
_61 = false;
mDistanceType = 5;
mOldDistanceType = 5;
mDistanceCounter = 0;
_60 = false;
_61 = false;
mCPlate = initNavi->mCPlateMgr;
mSlotID = mCPlate->getSlot(mParent, this, initCheck);
@ -99,17 +99,17 @@ void ActFormation::init(ActionArg* initArg)
mParent->startMotion(Game::IPikiAnims::RUN2, Game::IPikiAnims::RUN2, nullptr, nullptr);
_30 = 0;
_31 = 0;
mSortState = 0;
_4C = 0;
_50 = 0.0f;
_54 = 0;
mFootmark = nullptr;
_30 = 0;
_31 = 0;
mSortState = 0;
mAnimationTimer = 0;
_50 = 0.0f;
mIsAnimating = 0;
mFootmark = nullptr;
mParent->setPastel(false);
_40 = 0;
_48 = -1;
mTouchingWallTimer = 0;
mFootmarkFlags = -1;
mParent->setFreeLightEffect(false);
}
@ -121,16 +121,16 @@ void ActFormation::init(ActionArg* initArg)
void ActFormation::wallCallback(Vector3f&)
{
mFrameTimer = Game::gameSystem->mFrameTimer;
if (_40 < 30) {
_40++;
if (mTouchingWallTimer < 30) {
mTouchingWallTimer++;
}
if (_40 > 8 && mSortState != 1) {
_40 = 0;
if (mTouchingWallTimer > 8 && mSortState != 1) {
mTouchingWallTimer = 0;
}
if (_40 > 20) {
_40 = 0;
if (mTouchingWallTimer > 20) {
mTouchingWallTimer = 0;
}
}
@ -216,16 +216,16 @@ void ActFormation::onKeyEvent(SysShape::KeyEvent const& keyEvent)
{
switch (keyEvent.mType) {
case KEYEVENT_2:
if (_54) {
if (mIsAnimating) {
mParent->mSimVelocity = Vector3f(0.0f);
mParent->mVelocity = Vector3f(0.0f);
}
break;
case KEYEVENT_1:
if (_54) {
_4C--;
if (_4C <= 0) {
if (mIsAnimating) {
mAnimationTimer--;
if (mAnimationTimer <= 0) {
mParent->mAnimator.mSelfAnimator.mFlags |= EANIM_FLAG_FINISHED;
mParent->mAnimator.mBoundAnimator.mFlags |= EANIM_FLAG_FINISHED;
}
@ -233,8 +233,8 @@ void ActFormation::onKeyEvent(SysShape::KeyEvent const& keyEvent)
break;
case KEYEVENT_END:
if (_54) {
_54 = 0;
if (mIsAnimating) {
mIsAnimating = 0;
mParent->startMotion(Game::IPikiAnims::WALK, Game::IPikiAnims::WALK, nullptr, nullptr);
}
break;
@ -272,8 +272,8 @@ void ActFormation::cleanup()
*/
int PikiAI::ActFormation::exec()
{
if (_38) {
_38--;
if (mTouchingNaviCooldownTimer) {
mTouchingNaviCooldownTimer--;
}
if (mSlotID == -1) {
@ -296,9 +296,9 @@ int PikiAI::ActFormation::exec()
}
mParent->setMoveRotation(true);
_2C = _2A;
_2A = 5;
if (_54) {
mOldDistanceType = mDistanceType;
mDistanceType = 5;
if (mIsAnimating) {
int animId;
if (mParent->mAnimator.mSelfAnimator.mAnimInfo) {
animId = mParent->mAnimator.mSelfAnimator.mAnimInfo->mId;
@ -307,7 +307,7 @@ int PikiAI::ActFormation::exec()
}
if (animId != Game::IPikiAnims::KOROBU) {
_54 = 0;
mIsAnimating = 0;
mParent->startMotion(Game::IPikiAnims::WALK, Game::IPikiAnims::WALK, nullptr, nullptr);
}
@ -331,12 +331,12 @@ int PikiAI::ActFormation::exec()
f32 dist = sep.length(); // f26
Vector3f pikiPos = mParent->getPosition(); // 0x120
if ((Game::gameSystem->mFrameTimer - mFrameTimer) < 0x32 && dist > 60.0f) {
if (_40 > 3) {
mFootmark = mParent->mNavi->mFootmarks->findNearest2(pikiPos, _48);
if (mTouchingWallTimer > 3) {
mFootmark = mParent->mNavi->mFootmarks->findNearest2(pikiPos, mFootmarkFlags);
if (mFootmark) {
sep = mFootmark->mPosition - pikiPos;
if (sep.normalise() < 20.0f) {
_48 = mFootmark->mFlags;
mFootmarkFlags = mFootmark->mFlags;
}
mParent->setSpeed(1.0f, sep);
@ -344,12 +344,12 @@ int PikiAI::ActFormation::exec()
}
}
} else {
_40 = 0;
_48 = -1;
mTouchingWallTimer = 0;
mFootmarkFlags = -1;
}
} else {
_40 = 0;
_48 = -1;
mTouchingWallTimer = 0;
mFootmarkFlags = -1;
}
Vector3f movieSep = mParent->mPositionBeforeMovie - mParent->getPosition();
@ -381,7 +381,7 @@ int PikiAI::ActFormation::exec()
}
if (mSortState == FORMATION_SORT_NONE) {
_2A = 0;
mDistanceType = 0;
Iterator<Game::Creature> iter(mParent->mNavi->mCPlateMgr);
CI_LOOP(iter)
{
@ -408,7 +408,7 @@ int PikiAI::ActFormation::exec()
return ACTEXEC_Continue;
}
_2A = 1;
mDistanceType = 1;
mParent->mVelocity = Vector3f(0.0f);
Vector3f naviPikiSep = mParent->mNavi->getPosition() - mParent->getPosition();
f32 angle = JMAAtan2Radian(naviPikiSep.x, naviPikiSep.z); // f26
@ -418,22 +418,22 @@ int PikiAI::ActFormation::exec()
}
if (dist <= 7.0f) {
_2E = 0;
mDistanceCounter = 0;
} else if (dist < 15.0f) {
_2E++;
if (_2C == 2 && mParent->mNavi->mSceneAnimationTimer > 0.1f) {
_2E = 0;
mDistanceCounter++;
if (mOldDistanceType == 2 && mParent->mNavi->mSceneAnimationTimer > 0.1f) {
mDistanceCounter = 0;
}
if (_2E >= 6) {
_2E = 6;
if (mDistanceCounter >= 6) {
mDistanceCounter = 6;
}
} else {
_2E = 0;
mDistanceCounter = 0;
}
if (dist <= 7.0f || (_2E < 6 && dist <= 15.0f)) {
_2A = 2;
if (dist <= 7.0f || (mDistanceCounter < 6 && dist <= 15.0f)) {
mDistanceType = 2;
mParent->mVelocity = Vector3f(0.0f);
sep = mParent->mNavi->getPosition() - mParent->getPosition(); // 0x114
@ -446,7 +446,7 @@ int PikiAI::ActFormation::exec()
}
} else if (dist < 15.0f) {
_2A = 3;
mDistanceType = 3;
mParent->setMoveRotation(false);
if (_60 && dist < 10.0f) {
@ -497,7 +497,7 @@ int PikiAI::ActFormation::exec()
mParent->mVelocity *= currSpeed;
}
} else {
_2A = 4;
mDistanceType = 4;
mParent->setSpeed(1.0f, sep);
Vector3f naviPikiSep = mParent->getPosition() - mParent->mNavi->getPosition(); // f30, f29, f28
@ -525,10 +525,10 @@ int PikiAI::ActFormation::exec()
}
if (dist < static_cast<Game::PikiParms*>(mParent->mParms)->mPikiParms.mWhiteDistance.mValue) {
_58 = 0.0f;
_30 = 0;
mLostPikiTimer = 0.0f;
_30 = 0;
} else if (dist < static_cast<Game::PikiParms*>(mParent->mParms)->mPikiParms.mGrayDistance.mValue) {
_58 += sys->mDeltaTime;
mLostPikiTimer += sys->mDeltaTime;
if (!_30) {
if (mSlotID != -1) {
mCPlate->releaseSlot(mParent, mSlotID);
@ -536,7 +536,8 @@ int PikiAI::ActFormation::exec()
}
_30 = 1;
}
if ((!mInitArg._08 && mSlotID == -1) || _58 > static_cast<Game::PikiParms*>(mParent->mParms)->mPikiParms.mLostChildTime.mValue) {
if ((!mInitArg._08 && mSlotID == -1)
|| mLostPikiTimer > static_cast<Game::PikiParms*>(mParent->mParms)->mPikiParms.mLostChildTime.mValue) {
return ACTEXEC_Fail;
}
@ -2237,7 +2238,7 @@ void ActFormation::collisionCallback(Game::Piki* p, Game::CollEvent& collEvent)
Game::Navi* navi = p->mNavi;
if (navi) {
isBeingCommanded = navi->commandOn();
if (_38) {
if (mTouchingNaviCooldownTimer) {
isBeingCommanded = false;
}
}

View File

@ -142,7 +142,7 @@ void ActTeki::makeTarget()
}
mFollowMark = fm->get(0);
for (int i = fm->_08 - 1; i >= 0; i--) {
for (int i = fm->mCapacity - 1; i >= 0; i--) {
Game::Footmark* curMark = fm->get(i);
Vector3f sep3 = curMark->mPosition - sourcePos;

View File

@ -22,11 +22,11 @@ Footmark::Footmark()
*/
Footmarks::Footmarks()
{
mMarks = nullptr;
mCount = 0;
_08 = 0;
_04 = 0;
_10 = 0;
mMarks = nullptr;
mCount = 0;
mCapacity = 0;
mCurrentIndex = 0;
mLastUpdateTime = 0;
}
/*
@ -36,10 +36,10 @@ Footmarks::Footmarks()
*/
void Footmarks::alloc(int amt)
{
mMarks = new Footmark[amt];
mCount = amt;
_08 = 0;
_04 = 0;
mMarks = new Footmark[amt];
mCount = amt;
mCapacity = 0;
mCurrentIndex = 0;
}
/*
@ -50,8 +50,8 @@ void Footmarks::alloc(int amt)
void Footmarks::add(Footmark& mark)
{
mPosition = mark.mPosition;
if (_08 >= 2) {
int adjIndex = ((_04 + mCount) - 1) % mCount; // (_04 + (mCount - 1) % mCount);
if (mCapacity >= 2) {
int adjIndex = ((mCurrentIndex + mCount) - 1) % mCount; // (_04 + (mCount - 1) % mCount);
Footmark* currMark = &mMarks[adjIndex];
f32 dist = _distanceBetween(currMark->mPosition, mark.mPosition);
@ -60,16 +60,16 @@ void Footmarks::add(Footmark& mark)
}
}
u32 timer = gameSystem->mFrameTimer;
Footmark* testMark = &mMarks[_04];
testMark->mPosition = mark.mPosition;
testMark->mFlags = mark.mFlags;
mMarks[_04].mFlags = timer;
_04 = (_04 + 1) % mCount;
if (_08 < mCount) {
_08++;
u32 timer = gameSystem->mFrameTimer;
Footmark* testMark = &mMarks[mCurrentIndex];
testMark->mPosition = mark.mPosition;
testMark->mFlags = mark.mFlags;
mMarks[mCurrentIndex].mFlags = timer;
mCurrentIndex = (mCurrentIndex + 1) % mCount;
if (mCapacity < mCount) {
mCapacity++;
}
_10 = timer;
mLastUpdateTime = timer;
}
/*
@ -79,11 +79,11 @@ void Footmarks::add(Footmark& mark)
*/
Footmark* Footmarks::get(int index)
{
if (index < 0 || index >= _08) {
if (index < 0 || index >= mCapacity) {
return nullptr;
}
return &mMarks[(((mCount + _04) - (index + 1)) % mCount)];
return &mMarks[(((mCount + mCurrentIndex) - (index + 1)) % mCount)];
}
/*
@ -91,13 +91,13 @@ Footmark* Footmarks::get(int index)
* Address: 801B49B8
* Size: 0000C8
*/
Footmark* Footmarks::findNearest2(Vector3f& position, int idx)
Footmark* Footmarks::findNearest2(Vector3f& position, int minFlagValue)
{
int minIndex = -1;
f32 minDist = 1280000.0f;
for (int i = 0; i < _08 - 1; i++) {
int adjIndex = (_04 + i) % mCount;
if (idx == -1 || (int)mMarks[adjIndex].mFlags > idx) {
for (int i = 0; i < mCapacity - 1; i++) {
int adjIndex = (mCurrentIndex + i) % mCount;
if (minFlagValue == -1 || (int)mMarks[adjIndex].mFlags > minFlagValue) {
Footmark* mark = &mMarks[adjIndex];
Vector3f diff = position - mark->mPosition;

View File

@ -75,29 +75,11 @@ void SweepPrune::Node::insertSort(SweepPrune::Node& chain)
}
}
return;
// Interesting differences between the above loop and this one:
// Node* iNode = mNext;
// while (true) {
// if (iNode == nullptr) {
// return;
// }
// if (iNode->mRadius <= mRadius) break;
// iNode = iNode->mNext;
// }
// if (mNext ) {
// mNext->mPrev = mPrev;
// }
// if (mPrev ) {
// mPrev->mNext = mNext;
// }
// mNext = nullptr;
// mPrev = nullptr;
// insertAfter(iNode);
// return;
}
if (mPrev == nullptr) {
return;
}
if (mPrev->mRadius < mRadius) {
for (Node* iNode = mPrev; iNode != nullptr; iNode = iNode->mPrev) {
if (iNode->mRadius >= mRadius) {
@ -114,12 +96,15 @@ void SweepPrune::Node::insertSort(SweepPrune::Node& chain)
}
}
}
return;
}
if (chain.mPrev == nullptr) {
insertAfter(&chain);
return;
}
Node* next = nullptr;
for (Node* prev = chain.mPrev; prev != nullptr; prev = prev->mPrev) {
next = prev;
@ -128,9 +113,11 @@ void SweepPrune::Node::insertSort(SweepPrune::Node& chain)
return;
}
}
if (next == nullptr) {
return;
}
insertAfter(next);
}
@ -205,8 +192,8 @@ SweepPrune::World::~World()
*/
void SweepPrune::World::resolve(SweepPrune::World::ResolveArg& arg)
{
arg._08 = 0;
arg._04 = 0;
arg.mCollisionCount = 0;
arg.mComparisonCount = 0;
Object* o1;
Node* n1 = mXNode.mPrev;
@ -216,7 +203,7 @@ void SweepPrune::World::resolve(SweepPrune::World::ResolveArg& arg)
prev = nullptr;
o1 = n1->mObject;
for (Node* n2 = n1->mPrev; n2 != nullptr; n2 = n2->mPrev) {
arg._04++;
arg.mComparisonCount++;
Object* o2 = n2->mObject;
if ((o1 == o2) && (n2->mFlags == 1))
break;
@ -231,7 +218,7 @@ void SweepPrune::World::resolve(SweepPrune::World::ResolveArg& arg)
if (((((min1 <= min2) && (min2 <= max1)) || ((min1 <= max2 && (max2 <= max1)))) || ((min2 <= min1 && (min1 <= max2))))
|| ((min2 <= max1 && (max1 <= max2)))) {
arg.mCallback->invoke(o1, o2);
arg._08++;
arg.mCollisionCount++;
}
}
}

View File

@ -527,7 +527,7 @@ void Obj::createFootmarks()
*/
void Obj::updateFootmarks()
{
f32 timer = (mFootmarks->_10 - (int)gameSystem->mFrameTimer);
f32 timer = (mFootmarks->mLastUpdateTime - (int)gameSystem->mFrameTimer);
timer = (timer > 0.0f) ? timer : -timer;

View File

@ -24,7 +24,7 @@ Obj::Obj() { createFootmarks(); }
void Obj::doUpdate()
{
KumaChappy::Obj::doUpdate();
f32 timer = (mFootmarks->_10 - (int)gameSystem->mFrameTimer);
f32 timer = (mFootmarks->mLastUpdateTime - (int)gameSystem->mFrameTimer);
timer = (timer > 0.0f) ? timer : -timer;

View File

@ -11,7 +11,7 @@ MenuSection::MenuSection(JFWDisplay* display, JKRHeap* heap, bool b)
: Section(display, heap, b)
{
mCurrentSection = nullptr;
_3C = false;
mIsDone = false;
}
/*
@ -21,11 +21,11 @@ MenuSection::MenuSection(JFWDisplay* display, JKRHeap* heap, bool b)
*/
void MenuSection::run()
{
_3C = false;
mIsDone = false;
do {
mIsMainActive = true;
MenuSection::runChildSection();
} while (!_3C);
} while (!mIsDone);
}
/*

View File

@ -178,7 +178,7 @@ lbl_80433388:
*/
void MgrCommand::becomeCurrentHeap()
{
P2ASSERTLINE(187, _30 != -1);
P2ASSERTLINE(187, mMode != -1);
mActiveHeap = JKRHeap::sCurrentHeap;
mNode1->becomeCurrentHeap();
}
@ -190,7 +190,7 @@ void MgrCommand::becomeCurrentHeap()
*/
void MgrCommand::releaseCurrentHeap()
{
P2ASSERTLINE(199, _30 != -1);
P2ASSERTLINE(199, mMode != -1);
P2ASSERTLINE(201, mActiveHeap);
mActiveHeap->becomeCurrentHeap();
mActiveHeap = nullptr;
@ -250,7 +250,7 @@ void MgrCommand::setModeDvd(Node*)
*/
void MgrCommand::setModeInvalid()
{
_30 = -1;
mMode = -1;
mNode1 = nullptr;
_34 = 0;
mUserCallback = nullptr;
@ -334,10 +334,10 @@ bool MgrCommand::destroy()
{
// UNUSED FUNCTION
bool result = false;
if (_30 != -1) {
if (mMode != -1) {
if (mNode1) {
Node::destroy(mNode1);
_30 = -1;
mMode = -1;
result = true;
mNode1 = nullptr;
_34 = 0;
@ -355,8 +355,8 @@ bool MgrCommand::destroy()
*/
Mgr::Mgr(JKRHeap* parentHeap, u32 size)
: mHeap(nullptr)
, _08(0)
, _0C(0)
, mHeapSize(0)
, mRemainingSize(0)
, mNodes()
, mLoadingNodes()
{
@ -366,8 +366,8 @@ Mgr::Mgr(JKRHeap* parentHeap, u32 size)
}
mHeap = JKRExpHeap::create(size, parentHeap, true);
P2ASSERTLINE(487, mHeap != nullptr);
_08 = size;
_0C = _08;
mHeapSize = size;
mRemainingSize = mHeapSize;
mFlags.clear();
mFlags.typeView &= -2;
existingCurrentHeap->becomeCurrentHeap();
@ -577,7 +577,7 @@ lbl_80433964:
*/
void Mgr::loadResource(MgrCommand* command, char const* path, bool)
{
if (command->_30 == -1) {
if (command->mMode == -1) {
delFinishCommand();
P2ASSERTLINE(674, searchCommand(command));
@ -590,7 +590,7 @@ void Mgr::loadResource(MgrCommand* command, char const* path, bool)
}
if (node) {
command->_30 = 0;
command->mMode = 0;
command->mNode1 = nullptr;
command->_34 = true;
sys->dvdLoadUseCallBack(&command->mDvdThread, &command->mDelegateMemory);
@ -599,9 +599,9 @@ void Mgr::loadResource(MgrCommand* command, char const* path, bool)
ARAM::Node* aram = gAramMgr->search(path);
if (aram) {
node = createNewNode(path);
command->_30 = 1;
command->mMode = 1;
command->mNode1 = node;
command->_34 = 1;
command->_34 = true;
command->mNode2 = node;
sys->dvdLoadUseCallBack(&command->mDvdThread, &command->mDelegateMemory);
mLoadingNodes.add(command);
@ -610,7 +610,7 @@ void Mgr::loadResource(MgrCommand* command, char const* path, bool)
if (!node) {
node = createNewNode(path);
command->_30 = 0;
command->mMode = 0;
command->mNode1 = nullptr;
command->_34 = true;
sys->dvdLoadUseCallBack(&command->mDvdThread, &command->mDelegateMemory);

View File

@ -49,7 +49,7 @@ IObjBase* SceneBase::searchObj(char* name) { return mObjMgr->search(this, name);
*/
void SceneBase::destroy()
{
if (mCommand._30 != -1) {
if (mCommand.mMode != -1) {
gResMgr2D->destroy(&mCommand);
}
}
@ -61,7 +61,7 @@ void SceneBase::destroy()
*/
void SceneBase::create()
{
if (mCommand._30 == -1) {
if (mCommand.mMode == -1) {
mSomeTime = sys->getTime();
mCommand.mUserCallback = &_10C;
if (getResName()[0] != '\0') {

View File

@ -687,7 +687,7 @@ void System::createSoundSystem()
resHeap->destroy();
sys->heapStatusEnd("SoundSystem");
gResMgr2D->_0C = gResMgr2D->_08;
gResMgr2D->mRemainingSize = gResMgr2D->mHeapSize;
/*
stwu r1, -0x20(r1)