diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md
index 41eff2620..056aaba7e 100644
--- a/docs/recommended_todo.md
+++ b/docs/recommended_todo.md
@@ -112,7 +112,7 @@
| TyreShadow.cpp | 7271 | nslibmath.cpp | 7593 |
| UmimushiShadow.cpp | 7675 | SnakeJointMgr.cpp | 7850 |
| KumaChappy.cpp | 10290 | SnakeWholeShadow.cpp | 11928 |
-| SnakeCrowShadow.cpp | 12091 | BabyState.cpp | 12837 |
+| SnakeCrowShadow.cpp | 12091 | BabyState.cpp | 12331 |
| Kogane.cpp | 14498 | RandMapMgr.cpp | 15237 |
| Rock.cpp | 17638 | Ujia.cpp | 18104 |
| JointShadowBase.cpp | 18414 | Ujib.cpp | 18626 |
@@ -128,10 +128,10 @@
| KabutoState.cpp | 32923 | TankState.cpp | 33069 |
| playCamera.cpp | 33865 | BombSaraiState.cpp | 36432 |
| DangoMushi.cpp | 36921 | RandMapScore.cpp | 37057 |
-| Hanachirashi.cpp | 39550 | SnakeCrow.cpp | 39754 |
+| Hanachirashi.cpp | 39550 | SnakeCrow.cpp | 39772 |
| Mar.cpp | 41685 | DangoMushiState.cpp | 42130 |
| HoudaiShotGun.cpp | 44137 | OniKurage.cpp | 45364 |
-| SnakeWhole.cpp | 49311 | MiniHoudaiShotGun.cpp | 49861 |
+| SnakeWhole.cpp | 49329 | MiniHoudaiShotGun.cpp | 49861 |
| KumaKochappyState.cpp | 50172 | MiniHoudaiState.cpp | 52248 |
| RandMapUnit.cpp | 62255 | RandEnemyUnit.cpp | 75806 |
| BigTreasureAttack.cpp | 77444 | KumaChappyState.cpp | 89900 |
@@ -170,7 +170,7 @@
| sysShapeModel.cpp | 15503 | titleSection.cpp | 19706 |
| JSTObjectActor.cpp | 20176 | JSTObjectSystem.cpp | 22652 |
| matMath.cpp | 26236 | moviePlayer.cpp | 26415 |
-| windowMessage.cpp | 29714 | system.cpp | 29894 |
+| windowMessage.cpp | 29714 | system.cpp | 29897 |
| memoryCard.cpp | 31280 | bootSection.cpp | 38584 |
| movieMessage.cpp | 44348 | pikmin2MemoryCardMgr.cpp | 51733 |
| graphics.cpp | 76138 | messageRendering.cpp | 89561 |
@@ -181,6 +181,6 @@
| PSMainSide_CreaturePrm.cpp | 2600 | PSMainSide_ObjCalc.cpp | 7695 |
| PSMainSide_Sound.cpp | 11860 | PSMainSide_Director.cpp | 29610 |
| PSMainSide_Se.cpp | 45016 | PSMainSide_Scene.cpp | 49638 |
-| PSMainSide_ObjSound.cpp | 74737 | PSMainSide_Factory.cpp | 88161 |
+| PSMainSide_ObjSound.cpp | 74785 | PSMainSide_Factory.cpp | 88161 |
diff --git a/include/Game/EnemyBase.h b/include/Game/EnemyBase.h
index dbafe458e..4cbbc9aea 100644
--- a/include/Game/EnemyBase.h
+++ b/include/Game/EnemyBase.h
@@ -76,10 +76,10 @@ enum EnemyEvent {
EB_NoInterrupt = 0x200000, // cannot currently interrupt anim/action - cannot be stunned, bitters will be queued
EB_BitterImmune = 0x400000, // cannot be bittered
EB_24 = 0x800000, // unknown
- EB_PS1 = 0x1000000, // sound-related
- EB_PS2 = 0x2000000, // sound-related
- EB_PS3 = 0x4000000, // sound-related
- EB_PS4 = 0x8000000, // sound-related
+ EB_IsAnimated = 0x1000000, // set when an enemy (non-blended) animation is playing, needed for .bas based sounds to work
+ EB_PS2 = 0x2000000, // disabled on animation start, never enabled, has similar purpose to EB_IsBlendAnimated
+ EB_IsBlendAnimated = 0x4000000, // set when an enemy blended animation is playing
+ EB_PS4 = 0x8000000, // disabled on animation start, never enabled
EB_Alive = 0x10000000, //
EB_CollisionActive = 0x20000000, //
EB_ModelHidden = 0x40000000, //
@@ -283,45 +283,10 @@ struct EnemyBase : public Creature, public SysShape::MotionListener, virtual pub
animator->mNormalizedTime = 1.0f;
animator->getAnimator(0).startAnim(0, listener);
- disableEvent(0, EB_PS1 + EB_PS2 + EB_PS3 + EB_PS4);
- enableEvent(0, EB_PS1);
+ disableEvent(0, EB_IsAnimated + EB_PS2 + EB_IsBlendAnimated + EB_PS4);
+ enableEvent(0, EB_IsAnimated);
- if (isEvent(0, EB_PS1)) {
- int idx = getCurrAnimIndex();
- SysShape::AnimInfo* info
- = static_cast(mAnimator->getAnimator(0).mAnimMgr->mAnimInfo.mChild)->getInfoByID(idx);
- JAIAnimeFrameSoundData* file = info->mBasFile;
-
- if (file) {
- SysShape::KeyEvent* event1 = info->getAnimKeyByType(0);
- SysShape::KeyEvent* event2 = info->getAnimKeyByType(1);
-
- if (event1 != nullptr && event2) {
- f32 val1 = (f32)event1->mFrame;
- f32 val2 = (f32)event2->mFrame;
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, val1, val2);
- return;
- }
-
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, 0.0f, 0.0f);
- return;
- }
-
- mSoundObj->setAnime(nullptr, 1, 0.0f, 0.0f);
- return;
- }
-
- if (isEvent(0, EB_PS2)) {
- mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
- return;
- }
-
- if (isEvent(0, EB_PS3)) {
- mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
- return;
- }
-
- mSoundObj->setAnime(nullptr, 1, 0.0f, 0.0f);
+ setPSEnemyBaseAnime();
}
virtual void setCarcassArg(PelletViewArg& settings); // _2C8
virtual f32 getCarcassArgHeight() { return mBoundingSphere.mRadius; } // _2CC (weak)
diff --git a/include/PSM/CreatureAnime.h b/include/PSM/CreatureAnime.h
index 509926732..a7a9315cf 100644
--- a/include/PSM/CreatureAnime.h
+++ b/include/PSM/CreatureAnime.h
@@ -35,7 +35,7 @@ struct CreatureAnime : public Creature, public JAIAnimeSound {
virtual void onCalcTurnOn(); // _9C
virtual void onCalcTurnOff(); // _A0
- void setAnime(JAIAnimeSoundData*, u32, f32, f32);
+ void setAnime(JAIAnimeSoundData* data, u32 flag, f32 loopStartFrame, f32 loopEndFrame);
// _10 = VTBL 1
// _28 = VTBL 2
diff --git a/include/SysShape/AnimInfo.h b/include/SysShape/AnimInfo.h
index e7f3e61dd..995cb29d1 100644
--- a/include/SysShape/AnimInfo.h
+++ b/include/SysShape/AnimInfo.h
@@ -7,7 +7,7 @@ struct J3DAnmBase;
struct J3DAnmTransform;
struct J3DMtxCalc;
struct J3DModelData;
-struct JAIAnimeFrameSoundData;
+struct JAIAnimeSoundData;
struct Stream;
namespace SysShape {
@@ -61,13 +61,15 @@ struct AnimInfo : public CNode {
void dump();
void getLastLoopStart(f32);
- J3DAnmTransform* mAnm; // _18
- J3DMtxCalc* mCalc; // _1C
- s16 mId; // _20, anim ID
- JAIAnimeFrameSoundData* mBasFile; // _24
- KeyEvent mKeyEvent; // _28
- char* mDevelopPath; // _4C
- AnimMgr* mMgr; // _50
+ inline JAIAnimeSoundData* getData() const { return mBasFile; }
+
+ J3DAnmTransform* mAnm; // _18
+ J3DMtxCalc* mCalc; // _1C
+ s16 mId; // _20, anim ID
+ JAIAnimeSoundData* mBasFile; // _24
+ KeyEvent mKeyEvent; // _28
+ char* mDevelopPath; // _4C
+ AnimMgr* mMgr; // _50
};
} // namespace SysShape
diff --git a/src/plugProjectNishimuraU/BabyState.cpp b/src/plugProjectNishimuraU/BabyState.cpp
index 7d6ee9dfa..3296b4427 100644
--- a/src/plugProjectNishimuraU/BabyState.cpp
+++ b/src/plugProjectNishimuraU/BabyState.cpp
@@ -159,28 +159,16 @@ void StateMove::exec(EnemyBase* enemy)
// Vector3f targetPos = creature->getPosition();
f32 angleDist = baby->turnToTarget(creature, CG_GENERALPARMS(baby).mTurnSpeed(), CG_GENERALPARMS(baby).mMaxTurnAngle());
- f32 limit = PI * (DEG2RAD * CG_GENERALPARMS(baby).mMaxAttackAngle());
- f32 absDist = FABS(angleDist);
-
- if (absDist <= limit) {
- f32 speed = baby->getMoveSpeed();
- f32 sintheta = dolsinf(baby->getFaceDir());
- f32 y = baby->getTargetVelocity().y;
- f32 costheta = dolcosf(baby->getFaceDir());
-
- baby->mTargetVelocity = Vector3f(speed * sintheta, y, speed * costheta);
+ f32 limit = PI * (DEG2RAD * CG_GENERALPARMS(baby).mMaxAttackAngle());
+ if (FABS(angleDist) <= limit) {
+ baby->setTargetVelocity();
} else {
- f32 speed = baby->getMoveSpeed(0.25f);
- f32 sintheta = dolsinf(baby->getFaceDir());
- f32 y = baby->getTargetVelocity().y;
- f32 costheta = dolcosf(baby->getFaceDir());
-
- baby->mTargetVelocity = Vector3f(speed * sintheta, y, speed * costheta);
+ baby->setTargetVelocity(0.25f);
}
- if (baby->isTargetAttackable(creature, angleDist, CG_GENERALPARMS(baby).mMaxAttackRange.mValue,
- CG_GENERALPARMS(baby).mMaxAttackAngle.mValue)) {
+ if (baby->isTargetAttackable(creature, angleDist, CG_GENERALPARMS(baby).mMaxAttackRange(),
+ CG_GENERALPARMS(baby).mMaxAttackAngle())) {
transit(baby, BABY_Attack, nullptr);
}
diff --git a/src/plugProjectNishimuraU/SnakeCrow.cpp b/src/plugProjectNishimuraU/SnakeCrow.cpp
index 97e47483c..33f80e3d8 100644
--- a/src/plugProjectNishimuraU/SnakeCrow.cpp
+++ b/src/plugProjectNishimuraU/SnakeCrow.cpp
@@ -1465,7 +1465,7 @@ void Obj::finishAnimationJointCallBack() { mSnakeJointMgr->finishAnimation(); }
void Obj::startJointCallBack()
{
f32 y = mAttackPositions[mAttackAnimIdx].y - mPosition.y;
- SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(3);
+ SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(KEYEVENT_3);
f32 frame = getMotionFrame();
mSnakeJointMgr->startModify(y, (f32)event->mFrame - frame);
}
@@ -1476,7 +1476,7 @@ void Obj::startJointCallBack()
*/
void Obj::returnJointCallBack()
{
- SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(4);
+ SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(KEYEVENT_4);
f32 frame = getMotionFrame();
mSnakeJointMgr->returnModify((f32)event->mFrame - frame);
}
diff --git a/src/plugProjectNishimuraU/SnakeWhole.cpp b/src/plugProjectNishimuraU/SnakeWhole.cpp
index f4024036f..991f1c979 100644
--- a/src/plugProjectNishimuraU/SnakeWhole.cpp
+++ b/src/plugProjectNishimuraU/SnakeWhole.cpp
@@ -1886,7 +1886,7 @@ void Obj::finishAnimationJointCallBack() { mSnakeJointMgr->finishAnimation(); }
void Obj::startJointCallBack()
{
f32 y = mAttackPositions[mAttackAnimIdx].y - mPosition.y;
- SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(3);
+ SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(KEYEVENT_3);
f32 frame = getMotionFrame();
mSnakeJointMgr->startModify(y, (f32)event->mFrame - frame);
}
@@ -1897,7 +1897,7 @@ void Obj::startJointCallBack()
*/
void Obj::returnJointCallBack()
{
- SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(4);
+ SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(KEYEVENT_4);
f32 frame = getMotionFrame();
mSnakeJointMgr->returnModify((f32)event->mFrame - frame);
}
diff --git a/src/plugProjectYamashitaU/enemyBase.cpp b/src/plugProjectYamashitaU/enemyBase.cpp
index 45de6d2dc..ef7854985 100644
--- a/src/plugProjectYamashitaU/enemyBase.cpp
+++ b/src/plugProjectYamashitaU/enemyBase.cpp
@@ -724,7 +724,7 @@ void StoneState::cleanup(EnemyBase* enemy)
enemy->startMotion();
enemy->doFinishStoneState();
- if ((enemy->mSfxEmotion == EMOTE_Excitement) && PSGetDirectedMainBgm()) {
+ if (enemy->mSfxEmotion == EMOTE_Excitement && PSGetDirectedMainBgm()) {
enemy->mSoundObj->battleOn();
}
}
@@ -863,7 +863,7 @@ EnemyBase::EnemyBase()
mDamageAnimTimer = 0.0f;
mTargetCreature = nullptr;
mFloorTriangle = nullptr;
- mLifecycleFSM = new EnemyBaseFSM::StateMachine();
+ mLifecycleFSM = new EnemyBaseFSM::StateMachine;
mLifecycleFSM->init(this);
clearStick();
mCurAnim->mIsPlaying = false;
@@ -1322,7 +1322,7 @@ void EnemyBase::onKill(CreatureKillArg* inputArg)
getBoundingSphere(ball);
ItemHoney::InitArg honeyArg(honeyKind, false);
- ItemHoney::Item* drop = static_cast(ItemHoney::mgr->birth());
+ ItemHoney::Item* drop = ItemHoney::mgr->birth();
if (drop != nullptr) {
drop->init((CreatureInitArg*)&honeyArg);
@@ -1511,7 +1511,7 @@ void EnemyBase::update() { static_cast(mLifecycleFS
*/
bool EnemyBase::isFinishableWaitingBirthTypeDrop()
{
- Sys::Sphere sphere(mPosition, static_cast(mParms)->mGeneral.mPrivateRadius.mValue);
+ Sys::Sphere sphere(mPosition, getParms().mPrivateRadius.mValue);
bool result = false;
CellIteratorArg ciArg(sphere);
@@ -1525,7 +1525,7 @@ bool EnemyBase::isFinishableWaitingBirthTypeDrop()
// Is creature Pikmin or Navi?
if (creature->isNavi() || (creature->isPiki() && static_cast(creature)->isPikmin())) {
- f32 privateRadius = static_cast(mParms)->mGeneral.mPrivateRadius.mValue;
+ f32 privateRadius = getParms().mPrivateRadius.mValue;
Vector2f delta;
getDistanceTo(creature, delta);
@@ -1589,7 +1589,7 @@ void EnemyBase::doUpdateCommon()
scaleDamageAnim();
resetCollEvent();
- if ((mLod.isFlag(AILOD_IsVisible)) && isAlive()) {
+ if (mLod.isFlag(AILOD_IsVisible) && isAlive()) {
updateEffects();
}
}
@@ -1744,7 +1744,7 @@ void EnemyBase::doEntryLiving()
hide();
}
- if (!(isEvent(0, EB_ModelHidden))) {
+ if (!isEvent(0, EB_ModelHidden)) {
mModel->mJ3dModel->entry();
}
}
@@ -2115,7 +2115,7 @@ void EnemyBase::doSimulation(f32 frameRate) { mLifecycleFSM->simulation(this, fr
*/
void EnemyBase::doSimulationConstraint(f32 frameRate)
{
- if (!(isEvent(0, EB_HardConstrained))) {
+ if (!isEvent(0, EB_HardConstrained)) {
// If we're moving somewhere, enable checking collision
if (mAcceleration.x != 0.0f || mAcceleration.z != 0.0f) {
enableEvent(0, EB_CollisionActive);
@@ -2166,24 +2166,23 @@ void EnemyBase::setAnimMgr(SysShape::AnimMgr* mgr) { mAnimator->setAnimMgr(mgr);
*/
void EnemyBase::setPSEnemyBaseAnime()
{
- if (isEvent(0, EB_PS1)) {
- int idx = getCurrAnimIndex();
-
- SysShape::AnimInfo* info = static_cast(mAnimator->getAnimator(0).mAnimMgr->mAnimInfo.mChild)->getInfoByID(idx);
+ if (isEvent(0, EB_IsAnimated)) {
+ SysShape::AnimInfo* info
+ = static_cast(mAnimator->getAnimator(0).mAnimMgr->mAnimInfo.mChild)->getInfoByID(getCurrAnimIndex());
- JAIAnimeFrameSoundData* file = info->mBasFile;
+ JAIAnimeSoundData* file = info->getData();
if (file) {
- SysShape::KeyEvent* event1 = info->getAnimKeyByType(0);
- SysShape::KeyEvent* event2 = info->getAnimKeyByType(1);
+ SysShape::KeyEvent* event1 = info->getAnimKeyByType(KEYEVENT_LOOP_START);
+ SysShape::KeyEvent* event2 = info->getAnimKeyByType(KEYEVENT_LOOP_END);
if (event1 && event2) {
- f32 val1 = (f32)event1->mFrame;
- f32 val2 = (f32)event2->mFrame;
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, val1, val2);
+ f32 loopStart = (f32)event1->mFrame;
+ f32 loopEnd = (f32)event2->mFrame;
+ mSoundObj->setAnime(file, 1, loopStart, loopEnd);
return;
}
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, 0.0f, 0.0f);
+ mSoundObj->setAnime(file, 1, 0.0f, 0.0f);
return;
}
@@ -2196,7 +2195,7 @@ void EnemyBase::setPSEnemyBaseAnime()
return;
}
- if (isEvent(0, EB_PS3)) {
+ if (isEvent(0, EB_IsBlendAnimated)) {
mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
return;
}
@@ -2220,49 +2219,15 @@ void EnemyBase::startBlend(int start, int end, SysShape::BlendFunction* blendFun
{
SysShape::MotionListener* listener = inputListener;
if (!listener) {
- listener = static_cast(this);
+ listener = this;
}
static_cast(mAnimator)->startBlend(start, end, blendFunc, framerate, listener);
- disableEvent(0, EB_PS1 + EB_PS2 + EB_PS3 + EB_PS4);
- enableEvent(0, EB_PS3);
-
- if (isEvent(0, EB_PS1)) {
- int idx = getCurrAnimIndex();
- SysShape::AnimInfo* info = static_cast(mAnimator->getAnimator(0).mAnimMgr->mAnimInfo.mChild)->getInfoByID(idx);
- JAIAnimeFrameSoundData* file = info->mBasFile;
-
- if (file) {
- SysShape::KeyEvent* event1 = info->getAnimKeyByType(0);
- SysShape::KeyEvent* event2 = info->getAnimKeyByType(1);
-
- if (event1 && event2) {
- f32 val1 = (f32)event1->mFrame;
- f32 val2 = (f32)event2->mFrame;
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, val1, val2);
- return;
- }
+ disableEvent(0, EB_IsAnimated + EB_PS2 + EB_IsBlendAnimated + EB_PS4);
+ enableEvent(0, EB_IsBlendAnimated);
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, 0.0f, 0.0f);
- return;
- }
-
- mSoundObj->setAnime(nullptr, 1, 0.0f, 0.0f);
- return;
- }
-
- if (isEvent(0, EB_PS2)) {
- mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
- return;
- }
-
- if (isEvent(0, EB_PS3)) {
- mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
- return;
- }
-
- mSoundObj->setAnime(nullptr, 1, 0.0f, 0.0f);
+ setPSEnemyBaseAnime();
}
/**
@@ -2282,9 +2247,9 @@ void EnemyBase::endBlend()
*/
void EnemyBase::startMotion(int id, SysShape::MotionListener* inputListener)
{
- SysShape::MotionListener* listener;
- if (!(listener = inputListener)) {
- inputListener = static_cast(this);
+ SysShape::MotionListener* listener = inputListener;
+ if (!listener) {
+ inputListener = this;
}
EnemyAnimatorBase* animator = mAnimator;
@@ -2293,44 +2258,10 @@ void EnemyBase::startMotion(int id, SysShape::MotionListener* inputListener)
animator->getAnimator(0).startAnim(id, inputListener);
- disableEvent(0, EB_PS1 + EB_PS2 + EB_PS3 + EB_PS4);
- enableEvent(0, EB_PS1);
-
- if (isEvent(0, EB_PS1)) {
- int idx = getCurrAnimIndex();
- SysShape::AnimInfo* info = static_cast(mAnimator->getAnimator(0).mAnimMgr->mAnimInfo.mChild)->getInfoByID(idx);
- JAIAnimeFrameSoundData* file = info->mBasFile;
+ disableEvent(0, EB_IsAnimated + EB_PS2 + EB_IsBlendAnimated + EB_PS4);
+ enableEvent(0, EB_IsAnimated);
- if (file) {
- SysShape::KeyEvent* event1 = info->getAnimKeyByType(0);
- SysShape::KeyEvent* event2 = info->getAnimKeyByType(1);
-
- if (event1 && event2) {
- f32 val1 = (f32)event1->mFrame;
- f32 val2 = (f32)event2->mFrame;
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, val1, val2);
- return;
- }
-
- mSoundObj->setAnime((JAIAnimeSoundData*)file, 1, 0.0f, 0.0f);
- return;
- }
-
- mSoundObj->setAnime(nullptr, 1, 0.0f, 0.0f);
- return;
- }
-
- if (isEvent(0, EB_PS2)) {
- mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
- return;
- }
-
- if (isEvent(0, EB_PS3)) {
- mSoundObj->setAnime((JAIAnimeSoundData*)-1, 1, 0.0f, 0.0f);
- return;
- }
-
- mSoundObj->setAnime(nullptr, 1, 0.0f, 0.0f);
+ setPSEnemyBaseAnime();
}
/**
@@ -2599,16 +2530,9 @@ void EnemyBase::throwupItem()
return;
}
- f32 range = (mPelletInfo.mMaxPellets - mPelletInfo.mMinPellets) * randFloat();
-
- f32 roundRange;
- if (range >= 0.0f) {
- roundRange = range + 0.5f;
- } else {
- roundRange = range - 0.5f;
- }
-
- int pelletAmount = mPelletInfo.mMinPellets + (int)roundRange;
+ f32 range = (mPelletInfo.mMaxPellets - mPelletInfo.mMinPellets) * randFloat();
+ range = (range >= 0.0f) ? range + 0.5f : range - 0.5f;
+ int pelletAmount = mPelletInfo.mMinPellets + (int)range;
f32 velocity = 0.0f;
switch (mPelletInfo.mSize) {
@@ -2674,11 +2598,9 @@ void EnemyBase::getLifeGaugeParam(LifeGaugeParam& param)
*/
void EnemyBase::doGetLifeGaugeParam(LifeGaugeParam& param)
{
- f32 heightOffset = mPosition.y + getParms().mLifeMeterHeight.mValue;
- f32 z = mPosition.z;
- f32 x = mPosition.x;
+ f32 y = mPosition.y + getParms().mLifeMeterHeight();
+ param.mPosition = Vector3f(mPosition.x, y, mPosition.z);
- param.mPosition = Vector3f(x, heightOffset, z);
param.mCurrHealthRatio = mHealth / mMaxHealth;
param.mRadius = 10.0f;
}
@@ -2752,16 +2674,7 @@ void EnemyBase::addDamage(f32 damageAmt, f32 flickSpeed)
*/
bool EnemyBase::damageCallBack(Creature* sourceCreature, f32 damage, CollPart* p3)
{
- if (isEvent(0, EB_Invulnerable) == false) {
- mInstantDamage += damage;
-
- if (isEvent(0, EB_FlickEnabled)) {
- mFlickTimer += 1.0f;
- }
-
- enableEvent(0, EB_TakingDamage);
- }
-
+ addDamage(damage, 1.0f);
return true;
}
@@ -2783,18 +2696,7 @@ bool EnemyBase::flyCollisionCallBack(Creature*, f32, CollPart*) { return false;
*/
bool EnemyBase::hipdropCallBack(Creature* sourceCreature, f32 damage, CollPart* p3)
{
- f32 purpleDamage = getParms().mPurplePikiStunDamage;
-
- if (isEvent(0, EB_Invulnerable) == false) {
- mInstantDamage += purpleDamage;
-
- if (isEvent(0, EB_FlickEnabled)) {
- mFlickTimer += 1.0f;
- }
-
- enableEvent(0, EB_TakingDamage);
- }
-
+ addDamage(getParms().mPurplePikiStunDamage, 1.0f);
enableEvent(0, EB_SquashOnDamageAnim);
if (mFloorTriangle) {
@@ -2885,16 +2787,7 @@ bool EnemyBase::farmCallBack(Creature*, f32 power) { return false; }
*/
bool EnemyBase::bombCallBack(Creature* creature, Vector3f& direction, f32 damage)
{
- if (!(isEvent(0, EB_Invulnerable))) {
- mInstantDamage += damage;
-
- if (isEvent(0, EB_FlickEnabled)) {
- mFlickTimer += 1.0f;
- }
-
- enableEvent(0, EB_TakingDamage);
- }
-
+ addDamage(damage, 1.0f);
return true;
}
@@ -3141,8 +3034,8 @@ f32 EnemyBase::getFirstKeyFrame()
void EnemyBase::stopMotion()
{
EnemyAnimatorBase* animator = mAnimator;
- RESET_FLAG(animator->mFlags.typeView, SysShape::Animator::AnimInProgress);
- SET_FLAG(animator->mFlags.typeView, SysShape::Animator::AnimCompleted);
+ animator->mFlags.unset(SysShape::Animator::AnimInProgress);
+ animator->mFlags.set(SysShape::Animator::AnimCompleted);
}
/**
diff --git a/src/sysGCU/sysShapeAnimation.cpp b/src/sysGCU/sysShapeAnimation.cpp
index eb8c9fb13..0bb32895b 100644
--- a/src/sysGCU/sysShapeAnimation.cpp
+++ b/src/sysGCU/sysShapeAnimation.cpp
@@ -126,7 +126,7 @@ void AnimMgr::connectBasArc(char* a2, char* a3, JKRFileLoader* a4)
void* basFile = a4->getResource(path);
if (basFile) {
- c->mBasFile = (JAIAnimeFrameSoundData*)basFile;
+ c->mBasFile = (JAIAnimeSoundData*)basFile;
}
}
}
diff --git a/src/sysGCU/system.cpp b/src/sysGCU/system.cpp
index 824cb4dde..2ccb4ea95 100644
--- a/src/sysGCU/system.cpp
+++ b/src/sysGCU/system.cpp
@@ -606,10 +606,10 @@ void System::loadSoundResource()
newheap->becomeCurrentHeap();
// something in these inlines is doing bad regalloc things. or not enough bad regalloc things. not sure.
- PSSystem::Scene* scene = PSMGetSceneMgrCheck()->mScenes;
+ PSSystem::Scene* scene = PSMGetPikSceneMgrCheck()->mScenes;
P2ASSERTLINE(1245, scene);
-
scene->scene1stLoadSync();
+
newheap->adjustSize();
old->becomeCurrentHeap();
/*
diff --git a/src/utilityU/PSMainSide_ObjSound.cpp b/src/utilityU/PSMainSide_ObjSound.cpp
index 01eec7081..43f9bc02c 100644
--- a/src/utilityU/PSMainSide_ObjSound.cpp
+++ b/src/utilityU/PSMainSide_ObjSound.cpp
@@ -690,14 +690,14 @@ void CreatureAnime::startSound(JAISound** se, u32 soundID, u32 a3)
* @note Address: 0x8045DDE0
* @note Size: 0x40
*/
-void CreatureAnime::setAnime(JAIAnimeSoundData* data, u32 a1, f32 a2, f32 a3)
+void CreatureAnime::setAnime(JAIAnimeSoundData* data, u32 flag, f32 loopStartFrame, f32 loopEndFrame)
{
if (data != mSoundData) {
if ((int)data == 0xffffffff) {
data = nullptr;
}
- initActorAnimSound(data, a1, a2, a3);
+ initActorAnimSound(data, flag, loopStartFrame, loopEndFrame);
}
}