Skip to content

Commit

Permalink
link FuefukiState.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
EpochFlame committed Sep 8, 2023
1 parent eaafafc commit 8379594
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 2,065 deletions.
1,730 changes: 0 additions & 1,730 deletions asm/plugProjectNishimuraU/FuefukiState.s

This file was deleted.

2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@
["plugProjectNishimuraU/KumaChappyAnimator", True],
["plugProjectNishimuraU/KumaChappyMgr", True],
"plugProjectNishimuraU/KumaChappy",
"plugProjectNishimuraU/FuefukiState",
["plugProjectNishimuraU/FuefukiState", True],
["plugProjectNishimuraU/FuefukiAnimator", True],
["plugProjectNishimuraU/FuefukiMgr", True],
["plugProjectNishimuraU/Fuefuki", True],
Expand Down
28 changes: 14 additions & 14 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,19 @@
| <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> | 12955 |
| <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/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/OtakaraBase.cpp">OtakaraBase.cpp</a> | 18373 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/FuefukiState.cpp">FuefukiState.cpp</a> | 19009 |
| <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> | 22514 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Ujia.cpp">Ujia.cpp</a> | 22940 |
| <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/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> | 25767 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Tobi.cpp">Tobi.cpp</a> | 25937 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/TankState.cpp">TankState.cpp</a> | 29293 |
| <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/OtakaraBase.cpp">OtakaraBase.cpp</a> | 15635 |
| <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> | 22514 |
| <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/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> | 25767 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/Tobi.cpp">Tobi.cpp</a> | 25937 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/TankState.cpp">TankState.cpp</a> | 29293 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectNishimuraU/RandItemUnit.cpp">RandItemUnit.cpp</a> | 29622 |

### <section id="plugProjectOgawaU">plugProjectOgawaU</section>
| File | Size (bytes) | File | Size (bytes) |
Expand Down Expand Up @@ -188,7 +188,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/captionMessage.cpp">captionMessage.cpp</a> | 3528 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageObj.cpp">messageObj.cpp</a> | 4504 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/aramMgr.cpp">aramMgr.cpp</a> | 4920 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/gameflow.cpp">gameflow.cpp</a> | 5333 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/messageMgr.cpp">messageMgr.cpp</a> | 6825 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/section.cpp">section.cpp</a> | 7138 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPRead.c">THPRead.c</a> | 7147 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPAudioDecode.c">THPAudioDecode.c</a> | 7342 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPRead.c">THPRead.c</a> | 7147 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPAudioDecode.c">THPAudioDecode.c</a> | 7366 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/moviePlayerPauseAndDraw.cpp">moviePlayerPauseAndDraw.cpp</a> | 8587 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/screenScene.cpp">screenScene.cpp</a> | 9274 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/THPVideoDecode.c">THPVideoDecode.c</a> | 10029 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/JSTObjectParticleActor.cpp">JSTObjectParticleActor.cpp</a> | 11032 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/loadResource.cpp">loadResource.cpp</a> | 11781 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/sysGCU/heapStatus.cpp">heapStatus.cpp</a> | 12405 |
Expand Down
12 changes: 6 additions & 6 deletions include/Game/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,12 @@ struct Creature : public CellObject {
return angDist(angBetween, getFaceDir());
}

inline f32 getAngDist(Vector3f& targetPos)
{
Vector3f pos = getPosition();
f32 angBetween = angXZ(targetPos.x, targetPos.z, pos);
return angDist(angBetween, getFaceDir());
}
inline f32 getAngDist(Vector3f& targetPos)
{
Vector3f pos = getPosition();
f32 angBetween = angXZ(targetPos.x, targetPos.z, pos);
return angDist(angBetween, getFaceDir());
}

void applyAirDrag(f32, f32, f32);
f32 calcSphereDistance(Creature*);
Expand Down
35 changes: 17 additions & 18 deletions include/Game/EnemyBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -535,28 +535,27 @@ struct EnemyBase : public Creature, public SysShape::MotionListener, virtual pub
return angleDist;
}

inline f32 limitting(f32 val, f32 limit)
{
if (FABS(val) > limit) {
val = (val > 0.0f) ? limit : -limit;
}
return val;
}

inline f32 turnToTarget(Vector3f& targetPos)
{
EnemyParmsBase* parms = static_cast<EnemyParmsBase*>(mParms);
f32 maxTurnSpeed = parms->mGeneral.mRotationalSpeed.mValue;
f32 turnFactor = parms->mGeneral.mRotationalAccel.mValue;
inline f32 limitting(f32 val, f32 limit)
{
if (FABS(val) > limit) {
val = (val > 0.0f) ? limit : -limit;
}
return val;
}

f32 angleDist = getAngDist(targetPos);
f32 turnSpeed = limitting(angleDist * turnFactor, PI * (DEG2RAD * maxTurnSpeed));
inline f32 turnToTarget(Vector3f& targetPos)
{
EnemyParmsBase* parms = static_cast<EnemyParmsBase*>(mParms);
f32 maxTurnSpeed = parms->mGeneral.mRotationalSpeed.mValue;
f32 turnFactor = parms->mGeneral.mRotationalAccel.mValue;

f32 angleDist = getAngDist(targetPos);
f32 turnSpeed = limitting(angleDist * turnFactor, PI * (DEG2RAD * maxTurnSpeed));

updateFaceDir(roundAng(turnSpeed + getFaceDir()));
updateFaceDir(roundAng(turnSpeed + getFaceDir()));

return angleDist;
}
return angleDist;
}

inline bool checkDistAndAngle(Creature* target, f32 angle, f32 distRange, f32 angRange)
{
Expand Down
163 changes: 0 additions & 163 deletions src/plugProjectNishimuraU/FuefukiState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ void StateJump::exec(EnemyBase* enemy)
return;
}
} else {
// regswap here
f32 sinTheta = (f32)sin(fuefuki->getFaceDir());
f32 y = fuefuki->getTargetVelocity().y;
f32 cosTheta = (f32)cos(fuefuki->getFaceDir());
Expand Down Expand Up @@ -387,168 +386,6 @@ void StateTurn::exec(EnemyBase* enemy)
if (fuefuki->mCurAnim->mIsPlaying && fuefuki->mCurAnim->mType == KEYEVENT_END) {
transit(fuefuki, fuefuki->mNextState, nullptr);
}
/*
stwu r1, -0x70(r1)
mflr r0
stw r0, 0x74(r1)
stfd f31, 0x60(r1)
psq_st f31, 104(r1), 0, qr0
stfd f30, 0x50(r1)
psq_st f30, 88(r1), 0, qr0
stfd f29, 0x40(r1)
psq_st f29, 72(r1), 0, qr0
stfd f28, 0x30(r1)
psq_st f28, 56(r1), 0, qr0
stw r31, 0x2c(r1)
stw r30, 0x28(r1)
lwz r12, 0(r4)
mr r30, r3
lwz r5, 0xc0(r4)
mr r31, r4
lwz r12, 8(r12)
addi r3, r1, 0x14
lfs f31, 0x2dc(r4)
lfs f28, 0x2e4(r4)
lfs f29, 0x334(r5)
lfs f30, 0x30c(r5)
mtctr r12
bctrl
lfs f4, 0x14(r1)
lis r3, atanTable___5JMath@ha
lfs f0, 0x1c(r1)
addi r3, r3, atanTable___5JMath@l
lfs f3, 0x18(r1)
fsubs f1, f31, f4
fsubs f2, f28, f0
stfs f4, 8(r1)
stfs f3, 0xc(r1)
stfs f0, 0x10(r1)
bl "atan2___Q25JMath18TAtanTable<1024,f>CFff"
bl roundAng__Ff
lwz r12, 0(r31)
fmr f31, f1
mr r3, r31
lwz r12, 0x64(r12)
mtctr r12
bctrl
fmr f2, f1
fmr f1, f31
bl angDist__Fff
fmr f31, f1
lfs f0, lbl_8051BC5C@sda21(r2)
lfs f1, lbl_8051BC58@sda21(r2)
fmuls f0, f0, f29
fmuls f29, f31, f30
fmuls f1, f1, f0
fabs f0, f29
frsp f0, f0
fcmpo cr0, f0, f1
ble lbl_8029B474
lfs f0, lbl_8051BC30@sda21(r2)
fcmpo cr0, f29, f0
ble lbl_8029B470
fmr f29, f1
b lbl_8029B474
lbl_8029B470:
fneg f29, f1
lbl_8029B474:
mr r3, r31
lwz r12, 0(r31)
lwz r12, 0x64(r12)
mtctr r12
bctrl
fadds f1, f29, f1
bl roundAng__Ff
fabs f3, f31
stfs f1, 0x1fc(r31)
lfs f0, lbl_8051BC60@sda21(r2)
lfs f2, 0x1fc(r31)
frsp f1, f3
stfs f2, 0x1a8(r31)
fcmpo cr0, f1, f0
cror 2, 0, 2
bne lbl_8029B4C4
li r0, 6
mr r3, r31
stw r0, 0x2d8(r31)
bl finishMotion__Q24Game9EnemyBaseFv
lbl_8029B4C4:
mr r3, r31
bl isWhisleTimeMax__Q34Game7Fuefuki3ObjFv
clrlwi. r0, r3, 0x18
beq lbl_8029B4E4
li r0, 7
mr r3, r31
stw r0, 0x2d8(r31)
bl finishMotion__Q24Game9EnemyBaseFv
lbl_8029B4E4:
mr r3, r31
bl isJumpAway__Q34Game7Fuefuki3ObjFv
clrlwi. r0, r3, 0x18
beq lbl_8029B504
li r0, 3
mr r3, r31
stw r0, 0x2d8(r31)
bl finishMotion__Q24Game9EnemyBaseFv
lbl_8029B504:
lfs f1, 0x200(r31)
lfs f0, lbl_8051BC30@sda21(r2)
fcmpo cr0, f1, f0
cror 2, 0, 2
bne lbl_8029B528
li r0, 0
mr r3, r31
stw r0, 0x2d8(r31)
bl finishMotion__Q24Game9EnemyBaseFv
lbl_8029B528:
lwz r3, sys@sda21(r13)
lfs f1, 0x2c8(r31)
lfs f0, 0x54(r3)
fadds f0, f1, f0
stfs f0, 0x2c8(r31)
lwz r3, sys@sda21(r13)
lfs f1, 0x2cc(r31)
lfs f0, 0x54(r3)
fadds f0, f1, f0
stfs f0, 0x2cc(r31)
lwz r3, 0x188(r31)
lbz r0, 0x24(r3)
cmplwi r0, 0
beq lbl_8029B58C
lwz r0, 0x1c(r3)
cmplwi r0, 0x3e8
bne lbl_8029B58C
mr r3, r30
mr r4, r31
lwz r12, 0(r30)
li r6, 0
lwz r5, 0x2d8(r31)
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lbl_8029B58C:
psq_l f31, 104(r1), 0, qr0
lfd f31, 0x60(r1)
psq_l f30, 88(r1), 0, qr0
lfd f30, 0x50(r1)
psq_l f29, 72(r1), 0, qr0
lfd f29, 0x40(r1)
psq_l f28, 56(r1), 0, qr0
lfd f28, 0x30(r1)
lwz r31, 0x2c(r1)
lwz r0, 0x74(r1)
lwz r30, 0x28(r1)
mtlr r0
addi r1, r1, 0x70
blr
*/
}

/*
Expand Down
2 changes: 1 addition & 1 deletion src/plugProjectNishimuraU/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ NISHIMURA_FILES:=\
$(BUILD_DIR)/src/plugProjectNishimuraU/KumaChappyAnimator.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/KumaChappyMgr.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/KumaChappy.o\
$(BUILD_DIR)/asm/plugProjectNishimuraU/FuefukiState.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/FuefukiState.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/FuefukiAnimator.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/FuefukiMgr.o\
$(BUILD_DIR)/src/plugProjectNishimuraU/Fuefuki.o\
Expand Down
Loading

0 comments on commit 8379594

Please sign in to comment.