Enemy cleanup (#222)

* match Game::BlackMan::doUpdate

* hanachirashi vector math purgatory

* more hanachirashinanigans

* further cleanup Mar and Hanachirashi

* forgot Mar::Obj::isAttackable

* bring shijimiChou closer

* ShijimiChou::checkRestOn equivalency

---------

Co-authored-by: HeartPiece <deancsouthwood@gmail.com>
This commit is contained in:
Mateo 2024-11-11 18:35:15 -05:00 committed by GitHub
parent 87b87f0b88
commit 3de42eaa31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 192 additions and 440 deletions

View File

@ -92,7 +92,7 @@
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKonoU/khFinalResult.cpp">khFinalResult.cpp</a> | 60103 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKonoU/khDayEndResult.cpp">khDayEndResult.cpp</a> | 81751 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKonoU/khWorldMap.cpp">khWorldMap.cpp</a> | 119406 | | |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKonoU/khWorldMap.cpp">khWorldMap.cpp</a> | 119408 | | |
### <section id="plugProjectMorimuraU">plugProjectMorimuraU</section>
| File | Size (bytes) | File | Size (bytes) |
@ -102,7 +102,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/jigumo.cpp">jigumo.cpp</a> | 42368 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/shijimiChou.cpp">shijimiChou.cpp</a> | 43362 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/panModoki.cpp">panModoki.cpp</a> | 45170 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/kingChappyState.cpp">kingChappyState.cpp</a> | 50819 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/umiMushi.cpp">umiMushi.cpp</a> | 60146 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/kingChappy.cpp">kingChappy.cpp</a> | 64498 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/hiScore2D.cpp">hiScore2D.cpp</a> | 76289 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/blackMan.cpp">blackMan.cpp</a> | 121950 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/hiScore2D.cpp">hiScore2D.cpp</a> | 76289 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/blackMan.cpp">blackMan.cpp</a> | 121297 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/zukan2D.cpp">zukan2D.cpp</a> | 134332 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/challengeResult2D.cpp">challengeResult2D.cpp</a> | 142165 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/challengeSelect2D.cpp">challengeSelect2D.cpp</a> | 186008 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectMorimuraU/vsSelect2D.cpp">vsSelect2D.cpp</a> | 196329 |
@ -126,9 +126,9 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/MarState.cpp">MarState.cpp</a> | 28356 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/FrogState.cpp">FrogState.cpp</a> | 30811 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeCrowState.cpp">SnakeCrowState.cpp</a> | 32065 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/HanachirashiState.cpp">HanachirashiState.cpp</a> | 32837 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/KabutoState.cpp">KabutoState.cpp</a> | 32923 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/TankState.cpp">TankState.cpp</a> | 33069 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/playCamera.cpp">playCamera.cpp</a> | 33865 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BombSaraiState.cpp">BombSaraiState.cpp</a> | 36432 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/DangoMushi.cpp">DangoMushi.cpp</a> | 36921 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RandMapScore.cpp">RandMapScore.cpp</a> | 37057 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Hanachirashi.cpp">Hanachirashi.cpp</a> | 39550 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeCrow.cpp">SnakeCrow.cpp</a> | 39772 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/playCamera.cpp">playCamera.cpp</a> | 33865 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Hanachirashi.cpp">Hanachirashi.cpp</a> | 35305 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/BombSaraiState.cpp">BombSaraiState.cpp</a> | 36432 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/DangoMushi.cpp">DangoMushi.cpp</a> | 36921 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RandMapScore.cpp">RandMapScore.cpp</a> | 37057 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeCrow.cpp">SnakeCrow.cpp</a> | 39772 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Mar.cpp">Mar.cpp</a> | 41685 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/DangoMushiState.cpp">DangoMushiState.cpp</a> | 42130 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/HoudaiShotGun.cpp">HoudaiShotGun.cpp</a> | 44137 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/OniKurage.cpp">OniKurage.cpp</a> | 45364 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/SnakeWhole.cpp">SnakeWhole.cpp</a> | 49329 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/MiniHoudaiShotGun.cpp">MiniHoudaiShotGun.cpp</a> | 49861 |

View File

@ -117,7 +117,7 @@ struct Obj : public EnemyBase {
Vector3f mEfxPosition; // _2E8
Vector3f mFaceDirection; // _2F4
Vector3f mAttackPosition; // _300
f32 mCurrentAttackRadius; // _30C
f32 mWindScaleTimer; // _30C
bool mIsWindAttackActive; // _310
f32 mPitchRatio; // _314
efx::TFusenDead* mEfxDead; // _318

View File

@ -316,7 +316,7 @@ Obj::Obj()
* @note Address: 0x803A6C48
* @note Size: 0x6C4
*/
void BlackMan::Obj::doUpdate()
void Obj::doUpdate()
{
getStateID();
isStopMotion();
@ -359,8 +359,8 @@ void BlackMan::Obj::doUpdate()
Navi* activeNavi = naviMgr->getActiveNavi();
if (!mIsFallStart && activeNavi && activeNavi->isAlive()) {
// regswaps here
Vector3f pos = Vector3f(mPosition.x, 0.0f, mPosition.z);
Vector3f pos;
getPosition2D(pos);
Vector3f naviPos = Vector3f(activeNavi->getPosition().x, 0.0f, activeNavi->getPosition().z);
f32 sqrDist = sqrDistanceXZ(naviPos, pos);
@ -903,19 +903,19 @@ lbl_803A72D0:
* @note Address: 0x803A730C
* @note Size: 0x4
*/
void BlackMan::Obj::doDirectDraw(Graphics&) { }
void Obj::doDirectDraw(Graphics&) { }
/**
* @note Address: 0x803A7310
* @note Size: 0x20
*/
void BlackMan::Obj::doDebugDraw(Graphics& gfx) { EnemyBase::doDebugDraw(gfx); }
void Obj::doDebugDraw(Graphics& gfx) { EnemyBase::doDebugDraw(gfx); }
/**
* @note Address: 0x803A7330
* @note Size: 0x174
*/
void BlackMan::Obj::doSimulation(f32 speed)
void Obj::doSimulation(f32 speed)
{
if (mTyre) {
mTyre->mWraithPosition = mPosition;
@ -951,7 +951,7 @@ void BlackMan::Obj::doSimulation(f32 speed)
* @note Address: 0x803A74A4
* @note Size: 0x238
*/
void BlackMan::Obj::doAnimationCullingOff()
void Obj::doAnimationCullingOff()
{
Color4 efxColor(0xff, 0xff, 0xff, 0xff);
@ -998,7 +998,7 @@ void BlackMan::Obj::doAnimationCullingOff()
* @note Address: 0x803A76DC
* @note Size: 0x3C
*/
void BlackMan::Obj::onKill(Game::CreatureKillArg* arg)
void Obj::onKill(Game::CreatureKillArg* arg)
{
EnemyBase::onKill(arg);
releasePathFinder();
@ -1009,7 +1009,7 @@ void BlackMan::Obj::onKill(Game::CreatureKillArg* arg)
* @note Address: 0x803A7718
* @note Size: 0xDC
*/
void BlackMan::Obj::doStartStoneState()
void Obj::doStartStoneState()
{
EnemyBase::doStartStoneState();
if (getStateID() != WRAITH_Fall) {
@ -1034,7 +1034,7 @@ void BlackMan::Obj::doStartStoneState()
* @note Address: 0x803A77F4
* @note Size: 0xBC
*/
void BlackMan::Obj::doFinishStoneState()
void Obj::doFinishStoneState()
{
EnemyBase::doFinishStoneState();
@ -1053,7 +1053,7 @@ void BlackMan::Obj::doFinishStoneState()
* @note Address: 0x803A78B0
* @note Size: 0x58
*/
bool BlackMan::Obj::isUnderground()
bool Obj::isUnderground()
{
// (u32)stateID - 2 <= 1 || stateID == WRAITH_Tired || isEvent(0, EB_IsBittered)
@ -1069,7 +1069,7 @@ bool BlackMan::Obj::isUnderground()
* @note Address: 0x803A7908
* @note Size: 0xA4
*/
void BlackMan::Obj::doGetLifeGaugeParam(Game::LifeGaugeParam& param)
void Obj::doGetLifeGaugeParam(Game::LifeGaugeParam& param)
{
EnemyBase::doGetLifeGaugeParam(param);
@ -1087,7 +1087,7 @@ void BlackMan::Obj::doGetLifeGaugeParam(Game::LifeGaugeParam& param)
* @note Address: 0x803A79AC
* @note Size: 0x1B8
*/
void BlackMan::Obj::collisionCallback(Game::CollEvent& collEvent)
void Obj::collisionCallback(Game::CollEvent& collEvent)
{
Creature* collCreature = collEvent.mCollidingCreature;
int stateID = getStateID();
@ -1123,7 +1123,7 @@ void BlackMan::Obj::collisionCallback(Game::CollEvent& collEvent)
* @note Address: 0x803A7B64
* @note Size: 0x16C
*/
bool BlackMan::Obj::damageCallBack(Game::Creature* creature, f32 damage, CollPart* part)
bool Obj::damageCallBack(Game::Creature* creature, f32 damage, CollPart* part)
{
int stateID = getStateID();
if (stateID == WRAITH_Tired && creature->isPiki()) {
@ -1152,7 +1152,7 @@ bool BlackMan::Obj::damageCallBack(Game::Creature* creature, f32 damage, CollPar
* @note Address: 0x803A7CD0
* @note Size: 0x134
*/
bool BlackMan::Obj::hipdropCallBack(Game::Creature* creature, f32 damage, CollPart* part)
bool Obj::hipdropCallBack(Game::Creature* creature, f32 damage, CollPart* part)
{
int stateID = getStateID();
if (stateID == WRAITH_Tired) {
@ -1183,7 +1183,7 @@ bool BlackMan::Obj::hipdropCallBack(Game::Creature* creature, f32 damage, CollPa
* @note Address: 0x803A7E04
* @note Size: 0xDC
*/
bool BlackMan::Obj::earthquakeCallBack(Game::Creature* creature, f32 bounceFactor)
bool Obj::earthquakeCallBack(Game::Creature* creature, f32 bounceFactor)
{
if (mTyre) {
mTyre->earthquakeCallBack(creature, bounceFactor);
@ -1202,7 +1202,7 @@ bool BlackMan::Obj::earthquakeCallBack(Game::Creature* creature, f32 bounceFacto
* @note Address: 0x803A7EE0
* @note Size: 0x68
*/
void BlackMan::Obj::doEntry()
void Obj::doEntry()
{
if (C_PARMS->mUseDrawBuffer8) {
gameSystem->setDrawBuffer(DB_ObjectLastLayer);
@ -1217,7 +1217,7 @@ void BlackMan::Obj::doEntry()
* @note Address: 0x803A7F48
* @note Size: 0x31C
*/
void BlackMan::Obj::changeMaterial()
void Obj::changeMaterial()
{
// not matching due to regswaps
@ -1474,7 +1474,7 @@ lbl_803A8234:
* @note Address: 0x803A8264
* @note Size: 0x50
*/
void BlackMan::Obj::getShadowParam(ShadowParam& shadowParam)
void Obj::getShadowParam(ShadowParam& shadowParam)
{
shadowParam.mPosition = mChestJointPosition;
shadowParam.mPosition.y = mPosition.y + 2.0f;
@ -1487,7 +1487,7 @@ void BlackMan::Obj::getShadowParam(ShadowParam& shadowParam)
* @note Address: 0x803A82B4
* @note Size: 0x64
*/
void BlackMan::Obj::initWalkSmokeEffect()
void Obj::initWalkSmokeEffect()
{
mWalkSmokeMgr.alloc(2);
mWalkSmokeMgr.setup(0, mModel, "footR", 10.0f);
@ -1498,7 +1498,7 @@ void BlackMan::Obj::initWalkSmokeEffect()
* @note Address: 0x803A8318
* @note Size: 0x1C
*/
WalkSmokeEffect::Mgr* BlackMan::Obj::getWalkSmokeEffectMgr()
WalkSmokeEffect::Mgr* Obj::getWalkSmokeEffectMgr()
{
if (mTyre) {
return nullptr;
@ -1510,7 +1510,7 @@ WalkSmokeEffect::Mgr* BlackMan::Obj::getWalkSmokeEffectMgr()
* @note Address: 0x803A8334
* @note Size: 0x848
*/
void BlackMan::Obj::walkFunc()
void Obj::walkFunc()
{
if (mTyre && mTyre->isEvent(0, EB_Bittered)) {
return;
@ -2343,13 +2343,13 @@ lbl_803A8B4C:
* @note Address: 0x803A8B7C
* @note Size: 0x34
*/
bool BlackMan::Obj::isReachToGoal(f32 rad) { return (u8)(sqrDistanceXZ(mPosition, mTargetPosition) < SQUARE(rad)); }
bool Obj::isReachToGoal(f32 rad) { return (u8)(sqrDistanceXZ(mPosition, mTargetPosition) < SQUARE(rad)); }
/**
* @note Address: 0x803A8BB0
* @note Size: 0xED0
*/
void BlackMan::Obj::findNextRoutePoint()
void Obj::findNextRoutePoint()
{
if (mFoundPath || mEscapePhase == 4) {
findNextTraceRoutePoint();
@ -2412,10 +2412,10 @@ void BlackMan::Obj::findNextRoutePoint()
WayPointIterator wpIter(currWP, true);
CI_LOOP(wpIter)
{
s16 index = *wpIter;
WayPoint* wp = routeMgr->getWayPoint(index);
Vector3f pos = wp->mPosition;
Vector3f* posPtr = &pos;
s16 index = *wpIter;
WayPoint* wp = routeMgr->getWayPoint(index);
Vector3f* posPtr = &wp->getPosition();
if (wp && !wp->isFlag(WPF_Closed) && wp->mNumToLinks + wp->mNumFromLinks > 1) {
indices[counter] = index;
@ -2464,11 +2464,9 @@ void BlackMan::Obj::findNextRoutePoint()
{
Piki* piki = *iter;
if (piki->isAlive() && piki->isStickTo()) {
Vector3f wpPos = Vector3f(wp->mPosition);
Vector3f wpPos1 = wpPos;
Vector3f* wpPosPtr = &wpPos1;
Vector3f wpPos2 = wpPos;
Vector3f* wpPosPtr2 = &wpPos2;
Vector3f wpPos = wp->mPosition;
Vector3f* wpPosPtr = &wp->getPosition();
Vector3f* wpPosPtr2 = &wp->getPosition();
Vector3f pikiPos = Vector3f(piki->getPosition().x, 0.0f, piki->getPosition().z);
f32 sqrDist = sqrDistanceXZ(pikiPos, wpPos);
@ -3704,7 +3702,7 @@ lbl_803A9A3C:
* @note Address: 0x803A9A80
* @note Size: 0xD0
*/
void BlackMan::Obj::findNextTraceRoutePoint()
void Obj::findNextTraceRoutePoint()
{
if (!mPath) {
return;
@ -3735,7 +3733,7 @@ void BlackMan::Obj::findNextTraceRoutePoint()
* @note Address: 0x803A9B50
* @note Size: 0x114
*/
bool BlackMan::Obj::isEndPathFinder()
bool Obj::isEndPathFinder()
{
if (mFoundPath) {
return true;
@ -3771,7 +3769,7 @@ bool BlackMan::Obj::isEndPathFinder()
* @note Address: 0x803A9C64
* @note Size: 0x1D8
*/
bool BlackMan::Obj::setPathFinder(bool check)
bool Obj::setPathFinder(bool check)
{
releasePathFinder();
WPEdgeSearchArg edgeArg(mPosition);
@ -3951,7 +3949,7 @@ lbl_803A9E28:
* @note Address: 0x803A9E3C
* @note Size: 0x44
*/
void BlackMan::Obj::releasePathFinder()
void Obj::releasePathFinder()
{
mFoundPath = 0;
if (testPathfinder && mPathFindingHandle) {
@ -3963,7 +3961,7 @@ void BlackMan::Obj::releasePathFinder()
* @note Address: 0x803A9E80
* @note Size: 0x590
*/
void BlackMan::Obj::jointMtxCalc(int jointIdx)
void Obj::jointMtxCalc(int jointIdx)
{
int stateID = getStateID();
if (jointIdx < 2 && (stateID == WRAITH_Flick || stateID == WRAITH_Recover)) {
@ -4468,7 +4466,7 @@ lbl_803AA39C:
* @note Address: 0x803AA410
* @note Size: 0x28C
*/
void BlackMan::Obj::bodyMtxCalc()
void Obj::bodyMtxCalc()
{
if (!C_PARMS->mUseTyreForJointCalc) {
return;
@ -4694,7 +4692,7 @@ lbl_803AA684:
* @note Address: 0x803AA69C
* @note Size: 0x40
*/
bool BlackMan::Obj::isTyreFreeze()
bool Obj::isTyreFreeze()
{
if (mTyre && mTyre->isFreeze()) {
return true;
@ -4707,7 +4705,7 @@ bool BlackMan::Obj::isTyreFreeze()
* @note Address: 0x803AA6DC
* @note Size: 0x9C
*/
bool BlackMan::Obj::isTyreDead()
bool Obj::isTyreDead()
{
if (mTyre && mTyre->mHealth <= 0.0f) {
if (mAnimator->getAnimator().isFlag(SysShape::Animator::AnimCompleted)) {
@ -4727,7 +4725,7 @@ bool BlackMan::Obj::isTyreDead()
* @note Address: 0x803AA778
* @note Size: 0x74
*/
bool BlackMan::Obj::isFallEnd()
bool Obj::isFallEnd()
{
bool result = false;
if (mFloorTriangle) {
@ -4745,7 +4743,7 @@ bool BlackMan::Obj::isFallEnd()
* @note Address: 0x803AA7EC
* @note Size: 0x1D4
*/
void BlackMan::Obj::moveRestart()
void Obj::moveRestart()
{
if (!mTyre) {
return;
@ -4775,25 +4773,25 @@ void BlackMan::Obj::moveRestart()
* @note Address: 0x803AA9C0
* @note Size: 0x4
*/
void BlackMan::Obj::escape() { }
void Obj::escape() { }
/**
* @note Address: 0x803AA9C4
* @note Size: 0x8
*/
void BlackMan::Obj::setTimer(f32 time) { mWraithFallTimer = time; }
void Obj::setTimer(f32 time) { mWraithFallTimer = time; }
/**
* @note Address: 0x803AA9CC
* @note Size: 0x8
*/
f32 BlackMan::Obj::getTimer() { return mWraithFallTimer; }
f32 Obj::getTimer() { return mWraithFallTimer; }
/**
* @note Address: 0x803AA9D4
* @note Size: 0xA0
*/
void BlackMan::Obj::collisionStOn()
void Obj::collisionStOn()
{
mCollTree->getCollPart('kosi')->mSpecialID = 'st__';
mCollTree->getCollPart('mune')->mSpecialID = 'st__';
@ -4808,7 +4806,7 @@ void BlackMan::Obj::collisionStOn()
* @note Address: 0x803AAA74
* @note Size: 0x98
*/
void BlackMan::Obj::collisionStOff()
void Obj::collisionStOff()
{
mCollTree->getCollPart('kosi')->mSpecialID = '____';
mCollTree->getCollPart('mune')->mSpecialID = '____';
@ -4822,7 +4820,7 @@ void BlackMan::Obj::collisionStOff()
* @note Address: 0x803AAB0C
* @note Size: 0x4C
*/
void BlackMan::Obj::flick()
void Obj::flick()
{
EnemyFunc::flickStickPikmin(this, C_GENERALPARMS.mShakeChance(), C_GENERALPARMS.mShakeKnockback(), C_GENERALPARMS.mShakeDamage(),
FLICK_BACKWARD_ANGLE, nullptr);
@ -4833,7 +4831,7 @@ void BlackMan::Obj::flick()
* @note Address: 0x803AAB58
* @note Size: 0x150
*/
void BlackMan::Obj::recover()
void Obj::recover()
{
if (!mTyre) {
return;
@ -4871,7 +4869,7 @@ void BlackMan::Obj::recover()
* @note Address: 0x803AACA8
* @note Size: 0xF8
*/
void BlackMan::Obj::recoverFlick()
void Obj::recoverFlick()
{
f32 chance = C_GENERALPARMS.mShakeChance();
f32 knockback = C_GENERALPARMS.mShakeKnockback();
@ -4891,7 +4889,7 @@ void BlackMan::Obj::recoverFlick()
* @note Address: 0x803AADA0
* @note Size: 0x2C
*/
void BlackMan::Obj::tyreFlick()
void Obj::tyreFlick()
{
if (mTyre) {
mTyre->flick();
@ -4902,7 +4900,7 @@ void BlackMan::Obj::tyreFlick()
* @note Address: 0x803AADCC
* @note Size: 0xD0
*/
void BlackMan::Obj::deadEffect()
void Obj::deadEffect()
{
EnemyBase::createDeadBombEffect();
throwupItem();
@ -4916,13 +4914,13 @@ void BlackMan::Obj::deadEffect()
* @note Address: 0x803AAE9C
* @note Size: 0x34
*/
void BlackMan::Obj::deadTraceEffect() { mEfxDead->create(nullptr); }
void Obj::deadTraceEffect() { mEfxDead->create(nullptr); }
/**
* @note Address: 0x803AAED0
* @note Size: 0x74
*/
void BlackMan::Obj::tyreUpEffect()
void Obj::tyreUpEffect()
{
if (mTyre && (isEvent(0, EB_Bittered) || !mTyre->isEvent(0, EB_Bittered))) {
mTyre->fadeEfxHamon();
@ -4934,7 +4932,7 @@ void BlackMan::Obj::tyreUpEffect()
* @note Address: 0x803AAF44
* @note Size: 0x50
*/
void BlackMan::Obj::tyreDownEffect()
void Obj::tyreDownEffect()
{
if (mTyre) {
mTyre->landEffect(mLandPosition);
@ -4946,7 +4944,7 @@ void BlackMan::Obj::tyreDownEffect()
* @note Address: 0x803AAF94
* @note Size: 0x94
*/
void BlackMan::Obj::bendEffect()
void Obj::bendEffect()
{
if (mTyre) {
efx::TKageBend1 bendFX(mModel->getJoint("head")->getWorldMatrix());
@ -4958,7 +4956,7 @@ void BlackMan::Obj::bendEffect()
* @note Address: 0x803AB028
* @note Size: 0x5C
*/
void BlackMan::Obj::createTraceEffect()
void Obj::createTraceEffect()
{
if (mTyre) {
mEfxMove->create(nullptr);
@ -4971,7 +4969,7 @@ void BlackMan::Obj::createTraceEffect()
* @note Address: 0x803AB084
* @note Size: 0x50
*/
void BlackMan::Obj::fadeTraceEffect()
void Obj::fadeTraceEffect()
{
mEfxMove->fade();
mEfxRun->fade();
@ -4981,7 +4979,7 @@ void BlackMan::Obj::fadeTraceEffect()
* @note Address: 0x803AB0D4
* @note Size: 0x58
*/
void BlackMan::Obj::createFlickEffect()
void Obj::createFlickEffect()
{
mEfxFrontFlick->create(nullptr);
mEfxBackFlick->create(nullptr);
@ -4991,7 +4989,7 @@ void BlackMan::Obj::createFlickEffect()
* @note Address: 0x803AB12C
* @note Size: 0x50
*/
void BlackMan::Obj::fadeFlickEffect()
void Obj::fadeFlickEffect()
{
mEfxFrontFlick->fade();
mEfxBackFlick->fade();
@ -5001,7 +4999,7 @@ void BlackMan::Obj::fadeFlickEffect()
* @note Address: 0x803AB17C
* @note Size: 0xC4
*/
bool BlackMan::Obj::isFinalFloor()
bool Obj::isFinalFloor()
{
if (gameSystem && gameSystem->isZukanMode()) {
return false;
@ -5023,7 +5021,7 @@ bool BlackMan::Obj::isFinalFloor()
* @note Address: 0x803AB240
* @note Size: 0x1C0
*/
void BlackMan::Obj::appearFanfare()
void Obj::appearFanfare()
{
if (!moviePlayer->isFlag(MVP_IsActive)) {
return;

View File

@ -376,9 +376,10 @@ void Obj::wallCallback(const MoveInfo& moveInfo)
if (getStateID() == SHIJIMICHOU_Fall) {
mIsFallVertical = true;
} else {
mGoalPosition.x = 100.0f * moveInfo.mWallNormal.x + mPosition.x;
mGoalPosition.y = mPosition.y;
mGoalPosition.z = 100.0f * moveInfo.mWallNormal.z + mPosition.z;
Vector3f pos = mPosition;
mGoalPosition.x = 100.0f * moveInfo.mWallNormal.x + pos.x;
mGoalPosition.y = pos.y;
mGoalPosition.z = 100.0f * moveInfo.mWallNormal.z + pos.z;
}
}
/*
@ -924,18 +925,16 @@ bool Obj::checkRestOn()
Sys::Sphere collSphere;
static_cast<CollPart*>(mSpawningEnemy->mCollTree->mPart->mChild)->getSphere(collSphere);
f32 rad = collSphere.mRadius;
Vector3f positionSep = mPosition;
positionSep.sub(collSphere.mPosition);
f32 dist = positionSep.sqrMagnitude();
mRestEnemyCollSphere = collSphere;
f32 rad = collSphere.mRadius;
f32 adjRad = 1.2f * rad;
adjRad *= adjRad;
f32 dist = Vector3f(mPosition - collSphere.mPosition).sqrMagnitude();
if (dist < adjRad) {
mTargetVelocity.x *= 0.0f;
mTargetVelocity.y *= 0.0f;
mTargetVelocity.z *= 0.0f;
mCurrentVelocity.x *= 0.0f;
mCurrentVelocity.y *= 0.0f;
mCurrentVelocity.z *= 0.0f;
if (dist < SQUARE(1.2f * rad)) {
mTargetVelocity *= 0.0f;
mCurrentVelocity *= 0.0f;
hardConstraintOn();
if (dist > SQUARE(rad)) {
@ -944,6 +943,28 @@ bool Obj::checkRestOn()
mPosition += collSphere.mPosition;
// more float math
}
f32 xRotVelocity = PI * ((collSphere.mPosition.y + collSphere.mRadius) - mPosition.y) / (-collSphere.mRadius * 2.0f);
if (collSphere.mPosition.y + collSphere.mRadius < mPosition.y) {
xRotVelocity = 0.0f;
}
if (collSphere.mPosition.y - collSphere.mRadius > mPosition.y) {
xRotVelocity = PI;
}
mRotation.x += 0.3f * (xRotVelocity - mRotation.x);
if (dist < SQUARE(rad) && FABS(xRotVelocity - mRotation.x) < 0.01f) {
if (mRotation.x > TAU) {
mRotation.x -= TAU;
}
if (mRotation.x < 0.0f) {
mRotation.x += TAU;
}
return true;
}

View File

@ -48,7 +48,7 @@ void Obj::onInit(CreatureInitArg* initArg)
mEfxMatrix = mModel->getJoint("hana3")->getWorldMatrix();
setupEffect();
mCurrentAttackRadius = 0.0f;
mWindScaleTimer = 0.0f;
mFsm->start(this, HANACHIRASHI_Wait, nullptr);
@ -431,19 +431,13 @@ bool Obj::isTargetLost()
{
Creature* target = mTargetCreature;
if (target && target->isAlive() && !target->isStickToMouth() && target->mSticker != this) {
f32 viewAngle = C_GENERALPARMS.mViewAngle.mValue;
f32 viewAngle = C_GENERALPARMS.mViewAngle();
if (mStuckPikminCount) {
viewAngle = 180.0f;
}
f32 sightRad = C_GENERALPARMS.mSightRadius.mValue;
f32 privRad = C_GENERALPARMS.mPrivateRadius.mValue;
f32 sightDiff = getCreatureViewAngle(target);
bool checkDist = isTargetAttackable(target, sightDiff, privRad, sightRad);
if (!checkDist && !(FABS(sightDiff) <= viewAngle * DEG2RAD * PI)) {
return false;
}
return isTargetWithinRange(target, getCreatureViewAngle(target), C_GENERALPARMS.mPrivateRadius(), C_GENERALPARMS.mSightRadius(),
12800.0f, viewAngle);
}
return true;
@ -656,11 +650,9 @@ lbl_802A2E34:
Creature* Obj::isAttackable()
{
const f32 faceDir = getFaceDir();
Parms* parms = C_PARMS;
Vector3f vec
= Vector3f(parms->mGeneral.mMaxAttackRange.mValue * sinf(faceDir), 0.0f, parms->mGeneral.mMaxAttackRange.mValue * cosf(faceDir));
Vector3f vec = Vector3f(C_PARMS->mGeneral.mMaxAttackRange() * sinf(faceDir), 0.0f, C_PARMS->mGeneral.mMaxAttackRange() * cosf(faceDir));
vec += getPosition();
f32 radius = SQUARE(C_GENERALPARMS.mMaxAttackAngle.mValue);
f32 radius = SQUARE(C_GENERALPARMS.mMaxAttackAngle());
Iterator<Piki> iter(pikiMgr);
CI_LOOP(iter)
@ -675,261 +667,6 @@ Creature* Obj::isAttackable()
}
return nullptr;
/*
stwu r1, -0x80(r1)
mflr r0
stw r0, 0x84(r1)
stfd f31, 0x70(r1)
psq_st f31, 120(r1), 0, qr0
stfd f30, 0x60(r1)
psq_st f30, 104(r1), 0, qr0
stfd f29, 0x50(r1)
psq_st f29, 88(r1), 0, qr0
stw r31, 0x4c(r1)
stw r30, 0x48(r1)
lwz r12, 0(r3)
mr r31, r3
lwz r12, 0x64(r12)
mtctr r12
bctrl
fmr f2, f1
lfs f0, lbl_8051BDB8@sda21(r2)
lwz r5, 0xc0(r31)
fcmpo cr0, f2, f0
bge lbl_802A2EDC
fneg f2, f2
lbl_802A2EDC:
lfs f3, lbl_8051BDF4@sda21(r2)
lis r3, sincosTable___5JMath@ha
lfs f0, lbl_8051BDB8@sda21(r2)
addi r4, r3, sincosTable___5JMath@l
fmuls f2, f2, f3
lfs f4, 0x564(r5)
fcmpo cr0, f1, f0
fctiwz f0, f2
stfd f0, 0x30(r1)
lwz r0, 0x34(r1)
rlwinm r0, r0, 3, 0x12, 0x1c
add r3, r4, r0
lfs f0, 4(r3)
fmuls f31, f4, f0
bge lbl_802A2F3C
lfs f0, lbl_8051BDF0@sda21(r2)
fmuls f0, f1, f0
fctiwz f0, f0
stfd f0, 0x38(r1)
lwz r0, 0x3c(r1)
rlwinm r0, r0, 3, 0x12, 0x1c
lfsx f0, r4, r0
fneg f0, f0
b lbl_802A2F54
lbl_802A2F3C:
fmuls f0, f1, f3
fctiwz f0, f0
stfd f0, 0x40(r1)
lwz r0, 0x44(r1)
rlwinm r0, r0, 3, 0x12, 0x1c
lfsx f0, r4, r0
lbl_802A2F54:
mr r4, r31
fmuls f30, f4, f0
lwz r12, 0(r31)
addi r3, r1, 0x14
lwz r12, 8(r12)
mtctr r12
bctrl
lwz r4, 0xc0(r31)
lis r3, "__vt__22Iterator<Q24Game4Piki>"@ha
lfs f2, 0x14(r1)
li r0, 0
lfs f0, 0x58c(r4)
addi r4, r3, "__vt__22Iterator<Q24Game4Piki>"@l
lfs f1, 0x1c(r1)
cmplwi r0, 0
lwz r3, pikiMgr__4Game@sda21(r13)
fadds f30, f30, f2
fadds f31, f31, f1
stw r4, 0x20(r1)
fmuls f29, f0, f0
stw r0, 0x2c(r1)
stw r0, 0x24(r1)
stw r3, 0x28(r1)
bne lbl_802A2FCC
lwz r12, 0(r3)
lwz r12, 0x18(r12)
mtctr r12
bctrl
stw r3, 0x24(r1)
b lbl_802A31BC
lbl_802A2FCC:
lwz r12, 0(r3)
lwz r12, 0x18(r12)
mtctr r12
bctrl
stw r3, 0x24(r1)
b lbl_802A3038
lbl_802A2FE4:
lwz r3, 0x28(r1)
lwz r4, 0x24(r1)
lwz r12, 0(r3)
lwz r12, 0x20(r12)
mtctr r12
bctrl
mr r4, r3
lwz r3, 0x2c(r1)
lwz r12, 0(r3)
lwz r12, 8(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
bne lbl_802A31BC
lwz r3, 0x28(r1)
lwz r4, 0x24(r1)
lwz r12, 0(r3)
lwz r12, 0x14(r12)
mtctr r12
bctrl
stw r3, 0x24(r1)
lbl_802A3038:
lwz r12, 0x20(r1)
addi r3, r1, 0x20
lwz r12, 0x10(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
beq lbl_802A2FE4
b lbl_802A31BC
lbl_802A3058:
lwz r3, 0x28(r1)
lwz r12, 0(r3)
lwz r12, 0x20(r12)
mtctr r12
bctrl
lwz r12, 0(r3)
mr r30, r3
lwz r12, 0xa8(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
beq lbl_802A3100
mr r3, r30
lwz r12, 0(r30)
lwz r12, 0x1c0(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
beq lbl_802A3100
mr r3, r30
bl isStickToMouth__Q24Game8CreatureFv
clrlwi. r0, r3, 0x18
bne lbl_802A3100
lwz r0, 0xf4(r30)
cmplw r0, r31
beq lbl_802A3100
mr r4, r30
addi r3, r1, 8
lwz r12, 0(r30)
lwz r12, 8(r12)
mtctr r12
bctrl
lfs f0, 0x10(r1)
lfs f1, 8(r1)
fsubs f0, f0, f31
fsubs f1, f1, f30
fmuls f0, f0, f0
fmadds f0, f1, f1, f0
fcmpo cr0, f0, f29
bge lbl_802A3100
mr r3, r30
b lbl_802A31E0
lbl_802A3100:
lwz r0, 0x2c(r1)
cmplwi r0, 0
bne lbl_802A312C
lwz r3, 0x28(r1)
lwz r4, 0x24(r1)
lwz r12, 0(r3)
lwz r12, 0x14(r12)
mtctr r12
bctrl
stw r3, 0x24(r1)
b lbl_802A31BC
lbl_802A312C:
lwz r3, 0x28(r1)
lwz r4, 0x24(r1)
lwz r12, 0(r3)
lwz r12, 0x14(r12)
mtctr r12
bctrl
stw r3, 0x24(r1)
b lbl_802A31A0
lbl_802A314C:
lwz r3, 0x28(r1)
lwz r4, 0x24(r1)
lwz r12, 0(r3)
lwz r12, 0x20(r12)
mtctr r12
bctrl
mr r4, r3
lwz r3, 0x2c(r1)
lwz r12, 0(r3)
lwz r12, 8(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
bne lbl_802A31BC
lwz r3, 0x28(r1)
lwz r4, 0x24(r1)
lwz r12, 0(r3)
lwz r12, 0x14(r12)
mtctr r12
bctrl
stw r3, 0x24(r1)
lbl_802A31A0:
lwz r12, 0x20(r1)
addi r3, r1, 0x20
lwz r12, 0x10(r12)
mtctr r12
bctrl
clrlwi. r0, r3, 0x18
beq lbl_802A314C
lbl_802A31BC:
lwz r3, 0x28(r1)
lwz r12, 0(r3)
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lwz r4, 0x24(r1)
cmplw r4, r3
bne lbl_802A3058
li r3, 0
lbl_802A31E0:
psq_l f31, 120(r1), 0, qr0
lfd f31, 0x70(r1)
psq_l f30, 104(r1), 0, qr0
lfd f30, 0x60(r1)
psq_l f29, 88(r1), 0, qr0
lfd f29, 0x50(r1)
lwz r31, 0x4c(r1)
lwz r0, 0x84(r1)
lwz r30, 0x48(r1)
mtlr r0
addi r1, r1, 0x80
blr
*/
}
/**
@ -990,37 +727,50 @@ Vector3f Obj::getAttackPosition()
bool Obj::windTarget()
{
bool isHitPiki = false;
if (mCurrentAttackRadius < 1.0f) {
mCurrentAttackRadius += 3.0f * sys->mDeltaTime;
if (mCurrentAttackRadius > 1.0f) {
mCurrentAttackRadius = 1.0f;
if (mWindScaleTimer < 1.0f) {
mWindScaleTimer += 3.0f * sys->mDeltaTime;
if (mWindScaleTimer > 1.0f) {
mWindScaleTimer = 1.0f;
}
}
f32 radius = mCurrentAttackRadius * C_GENERALPARMS.mAttackRadius.mValue;
Vector3f vec1 = mEfxPosition; // f16
Vector3f vec2 = mFaceDirection; // f29
f32 slope = (f32)tan(PI * (DEG2RAD * C_GENERALPARMS.mAttackHitAngle.mValue)); // f20
f32 radius = mWindScaleTimer * C_GENERALPARMS.mAttackRadius();
Vector3f attackStartPos = mEfxPosition; // f16
Vector3f faceDirection = mFaceDirection; // f29
f32 slope = tan(TORADIANS(C_GENERALPARMS.mAttackHitAngle())); // f20
// this is probably a new vector
vec2.z = -vec2.z;
Vector3f attackNormal = Vector3f(-faceDirection.z, 0.0f, faceDirection.x);
attackNormal.normalise();
f32 len2 = _normalise2(vec2);
Vector3f crossDir = attackNormal.cross(faceDirection);
crossDir.normalise();
// more vector manip.
Vector3f attackDirection2D = faceDirection;
attackDirection2D.toFlatDirection();
Iterator<Navi> iterNavi(naviMgr);
CI_LOOP(iterNavi)
{
Navi* navi = *iterNavi;
if (navi->isAlive()) {
Vector3f naviPos = navi->getPosition();
Vector3f sep = naviPos - vec1;
f32 dotProd = sep.dot(vec2);
if (dotProd < radius && dotProd > 0.0f) {
// more vector math here.
InteractWind wind(this, 0.0f, &vec2); // not vec2
navi->stimulate(wind);
Vector3f naviPosition = navi->getPosition();
Vector3f separationVec = naviPosition - attackStartPos;
f32 dotProduct = faceDirection.dot(separationVec);
if (dotProduct < radius && dotProduct > 0.0f) {
f32 attackRadius = dotProduct * slope;
Vector2f dots = Vector2f(attackNormal.dot(separationVec), crossDir.dot(separationVec));
if (dots.sqrMagnitude() < SQUARE(attackRadius)) {
f32 slideFactor = dots.length() / attackRadius;
f32 windStrength = slideFactor * 0.2f + (1.0f - slideFactor);
Vector3f direction(windStrength * (attackDirection2D.x * dots.y + attackNormal.x * dots.x), 0.0f,
windStrength * (attackDirection2D.z * dots.y + attackNormal.z * dots.x));
InteractWind wind(this, C_GENERALPARMS.mAttackDamage(), &direction); // not vec2
navi->stimulate(wind);
}
}
}
}
@ -1029,14 +779,26 @@ bool Obj::windTarget()
CI_LOOP(iterPiki)
{
Piki* piki = *iterPiki;
if (piki->isAlive()) {
Vector3f pikiPos = piki->getPosition();
Vector3f sep = pikiPos - vec1;
f32 dotProd = sep.dot(vec2);
if (dotProd < radius && dotProd > 0.0f) {
// more vector math here.
InteractWind wind(this, 0.0f, &vec2); // not vec2
isHitPiki = piki->stimulate(wind);
if (piki->isAlive() && piki->isPikmin()) {
Vector3f pikiPos = piki->getPosition();
Vector3f separationVec = pikiPos - attackStartPos;
f32 dotProduct = faceDirection.dot(separationVec);
if (dotProduct < radius && dotProduct > 0.0f) {
f32 attackRadius = dotProduct * slope;
Vector2f dots = Vector2f(attackNormal.dot(separationVec), crossDir.dot(separationVec));
if (dots.sqrMagnitude() < SQUARE(attackRadius)) {
f32 slideFactor = dots.length() / attackRadius;
f32 windStrength = (1.0f - slideFactor) * 5.0f + slideFactor;
Vector3f direction(windStrength * (attackDirection2D.x * dots.y + attackNormal.x * dots.x),
(1.0f - slideFactor) * 50.0f + slideFactor * 10.0f,
windStrength * (attackDirection2D.z * dots.y + attackNormal.z * dots.x));
InteractHanaChirashi wind(this, C_GENERALPARMS.mAttackDamage(), &direction); // not vec2
isHitPiki = piki->stimulate(wind);
}
}
}
}

View File

@ -854,7 +854,7 @@ void StateAttack::init(EnemyBase* enemy, StateArg* stateArg)
hanachirashi->startMotion(HANACHIANIM_Attack, nullptr);
hanachirashi->mNextState = HANACHIRASHI_NULL;
hanachirashi->mIsWindAttackActive = false;
hanachirashi->mCurrentAttackRadius = 0.0f;
hanachirashi->mWindScaleTimer = 0.0f;
hanachirashi->createSuckEffect();
}
@ -901,7 +901,7 @@ void StateAttack::cleanup(EnemyBase* enemy)
hanachirashi->enableEvent(0, EB_Cullable);
hanachirashi->setEmotionCaution();
hanachirashi->mIsWindAttackActive = false;
hanachirashi->mCurrentAttackRadius = 0.0f;
hanachirashi->mWindScaleTimer = 0.0f;
hanachirashi->finishWindEffect();
}

View File

@ -429,16 +429,13 @@ bool Obj::isTargetLost()
{
Creature* target = mTargetCreature;
if (target && target->isAlive() && !target->isStickToMouth() && target->mSticker != this) {
f32 viewAngle = C_GENERALPARMS.mViewAngle.mValue;
f32 viewAngle = C_GENERALPARMS.mViewAngle();
if (mStuckPikminCount) {
viewAngle = 180.0f;
}
f32 sightRad = C_GENERALPARMS.mSightRadius.mValue;
f32 privRad = C_GENERALPARMS.mPrivateRadius.mValue;
f32 sightDiff = getCreatureViewAngle(target);
return isTargetWithinRange(target, sightDiff, privRad, sightRad, 12800.0f, viewAngle);
return isTargetWithinRange(target, getCreatureViewAngle(target), C_GENERALPARMS.mPrivateRadius(), C_GENERALPARMS.mSightRadius(),
12800.0f, viewAngle);
}
return true;
@ -652,10 +649,9 @@ Creature* Obj::isAttackable()
{
const f32 faceDir = getFaceDir();
Parms* parms = C_PARMS;
Vector3f vec
= Vector3f(parms->mGeneral.mMaxAttackRange.mValue * sinf(faceDir), 0.0f, parms->mGeneral.mMaxAttackRange.mValue * cosf(faceDir));
Vector3f vec = Vector3f(parms->mGeneral.mMaxAttackRange() * sinf(faceDir), 0.0f, parms->mGeneral.mMaxAttackRange() * cosf(faceDir));
vec += getPosition();
f32 radius = SQUARE(C_GENERALPARMS.mMaxAttackAngle.mValue);
f32 radius = SQUARE(C_GENERALPARMS.mMaxAttackAngle());
Iterator<Piki> iter(pikiMgr);
CI_LOOP(iter)
@ -991,24 +987,20 @@ void Obj::windTarget()
}
}
f32 radius = mWindScaleTimer * C_GENERALPARMS.mAttackRadius.mValue;
Vector3f attackStartPosition = mAttackStartPos; // f16
Vector3f attackDirection = mAttackDirection; // f29
f32 slope = (f32)tan(PI * (DEG2RAD * C_GENERALPARMS.mAttackHitAngle.mValue)); // f20
f32 radius = mWindScaleTimer * C_GENERALPARMS.mAttackRadius();
Vector3f attackStartPosition = mAttackStartPos; // f16
Vector3f attackDirection = mAttackDirection; // f29
f32 slope = tan(TORADIANS(C_GENERALPARMS.mAttackHitAngle())); // f20
// this is probably a new vector
Vector3f attackNormal(-attackDirection.z, 0.0f, attackDirection.x);
attackNormal.normalise();
Vector3f crossVec = attackNormal.cross(attackStartPosition);
Vector3f crossVec = attackNormal.cross(attackDirection);
crossVec.normalise();
Vector2f direction2D(attackDirection.x, attackDirection.z);
f32 directionLength = direction2D.normalise();
if (directionLength > 0.0f) {
direction2D.x = (attackDirection.x * (1.0f / directionLength));
direction2D.y = (attackDirection.z * (1.0f / directionLength));
}
Vector3f attackDirection2D = attackDirection;
attackDirection2D.toFlatDirection();
Iterator<Navi> iterNavi(naviMgr);
CI_LOOP(iterNavi)
@ -1020,28 +1012,17 @@ void Obj::windTarget()
f32 dotProduct = separationVector.dot(attackDirection);
if (dotProduct < radius && dotProduct > 0.0f) {
f32 slopeAffectedDotProduct = dotProduct * slope;
f32 crossVectorDotSeparation = crossVec.dot(separationVector);
f32 attackNormalDotSeparation = attackNormal.dot(separationVector);
f32 attackRadius = dotProduct * slope;
f32 combinedDotProduct = SQUARE(attackNormalDotSeparation) * SQUARE(crossVectorDotSeparation);
if (combinedDotProduct < SQUARE(slopeAffectedDotProduct)) {
f32 slideFactor = 0.0f;
if (dotProduct > 0.0f) {
slideFactor = 1.0f / sqrtf(dotProduct) * dotProduct;
}
Vector2f dots = Vector2f(attackNormal.dot(separationVector), crossVec.dot(separationVector));
if (dots.sqrMagnitude() < SQUARE(attackRadius)) {
f32 slideFactor = dots.length() / attackRadius;
f32 windStrength = (1.0f - slideFactor) * 10.0f + slideFactor;
f32 slideFactorRatio = slideFactor / slopeAffectedDotProduct;
f32 inverseSlideFactorRatio = 1.0f - slideFactor / slopeAffectedDotProduct;
f32 attackDamage = C_GENERALPARMS.mAttackDamage.mValue;
f32 windStrength = 10.0f * inverseSlideFactorRatio + slideFactorRatio;
Vector3f windDirection(windStrength * (attackDirection2D.x * dots.y + attackNormal.x * dots.x), 0.0f,
windStrength * (attackDirection2D.z * dots.y + attackNormal.z * dots.x));
Vector3f windDirection;
windDirection.x = windStrength * (separationVector.dot(attackNormal) + separationVector.dot(crossVec));
windDirection.y = 0.0f;
windDirection.z = windStrength * (separationVector.dot(attackNormal) + separationVector.dot(crossVec));
InteractWind wind(this, attackDamage, &windDirection);
InteractWind wind(this, C_GENERALPARMS.mAttackDamage(), &windDirection);
navi->stimulate(wind);
}
}
@ -1052,34 +1033,24 @@ void Obj::windTarget()
CI_LOOP(iterPiki)
{
Piki* piki = *iterPiki;
if (piki->isAlive()) {
if (piki->isAlive() && piki->isPikmin()) {
Vector3f pikiPosition = piki->getPosition();
Vector3f separationVector = pikiPosition - attackStartPosition;
f32 dotProduct = separationVector.dot(attackDirection);
if (dotProduct < radius && dotProduct > 0.0f) {
f32 slopeAffectedDotProduct = dotProduct * slope;
f32 crossVectorDotSeparation = crossVec.dot(separationVector);
f32 attackNormalDotSeparation = attackNormal.dot(separationVector);
f32 attackRadius = dotProduct * slope;
f32 combinedDotProduct = SQUARE(attackNormalDotSeparation) * SQUARE(crossVectorDotSeparation);
if (combinedDotProduct < SQUARE(slopeAffectedDotProduct)) {
f32 slideFactor = 0.0f;
if (dotProduct > 0.0f) {
slideFactor = 1.0f / sqrtf(dotProduct) * dotProduct;
}
Vector2f dots = Vector2f(attackNormal.dot(separationVector), crossVec.dot(separationVector));
if (dots.sqrMagnitude() < SQUARE(attackRadius)) {
f32 slideFactor = dots.length() / attackRadius;
f32 slideFactorRatio = slideFactor / slopeAffectedDotProduct;
f32 inverseSlideFactorRatio = 1.0f - slideFactor / slopeAffectedDotProduct;
f32 attackDamage = C_GENERALPARMS.mAttackDamage.mValue;
f32 windStrength = 10.0f * inverseSlideFactorRatio + slideFactorRatio;
f32 windStrength = (1.0f - slideFactor) * 15.0f + slideFactor * 1.5f;
Vector3f windDirection(windStrength * (attackDirection2D.x * dots.y + attackNormal.x * dots.x),
(1.0f - slideFactor) * 500.0f + slideFactor * 50.0f,
windStrength * (attackDirection2D.z * dots.y + attackNormal.z * dots.x));
Vector3f windDirection;
windDirection.x = windStrength * (separationVector.dot(attackNormal) + separationVector.dot(crossVec));
windDirection.y = 0.0f;
windDirection.z = windStrength * (separationVector.dot(attackNormal) + separationVector.dot(crossVec));
InteractWind wind(this, attackDamage, &windDirection);
InteractWind wind(this, C_GENERALPARMS.mAttackDamage(), &windDirection);
piki->stimulate(wind);
}
}