mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Compare commits
11 commits
ea5d44eb1b
...
8e13c083bb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e13c083bb | ||
|
|
0f550e5aae | ||
|
|
129691c069 | ||
|
|
9090655294 | ||
|
|
572c2d6736 | ||
|
|
b847fd4117 | ||
|
|
6b310ab521 | ||
|
|
3081776453 | ||
|
|
93d43731f4 | ||
|
|
e0b44fc799 | ||
|
|
e11b2b3bc9 |
|
|
@ -59551,45 +59551,45 @@ MapObj/BossKnuckleFix.o:
|
|||
- offset: 0x222ee4
|
||||
size: 128
|
||||
label: _ZN14BossKnuckleFixC2EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x222f64
|
||||
size: 140
|
||||
label: _ZN14BossKnuckleFixC1EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x222ff0
|
||||
size: 336
|
||||
label: _ZN14BossKnuckleFix4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x223140
|
||||
size: 208
|
||||
label: _ZN14BossKnuckleFix10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x223210
|
||||
size: 60
|
||||
label: _ZN14BossKnuckleFix7exeWaitEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x22324c
|
||||
size: 88
|
||||
label: _ZN14BossKnuckleFix11exeReactionEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2232a4
|
||||
size: 104
|
||||
label: _ZN14BossKnuckleFix16exeReactionLargeEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x22330c
|
||||
size: 64
|
||||
label: _ZNK12_GLOBAL__N_121BossKnuckleFixNrvWait7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x22334c
|
||||
size: 108
|
||||
label: _ZNK12_GLOBAL__N_130BossKnuckleFixNrvReactionLarge7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2233b8
|
||||
size: 92
|
||||
label: _ZNK12_GLOBAL__N_125BossKnuckleFixNrvReaction7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
MapObj/BreakablePole.o:
|
||||
'.text':
|
||||
|
|
@ -76398,101 +76398,101 @@ MapObj/MoonBasementFloor.o:
|
|||
- offset: 0x2c17dc
|
||||
size: 128
|
||||
label: _ZN17MoonBasementFloorC2EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c185c
|
||||
size: 140
|
||||
label: _ZN17MoonBasementFloorC1EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c18e8
|
||||
size: 216
|
||||
label: _ZN17MoonBasementFloor4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c19c0
|
||||
size: 132
|
||||
label: _ZN17MoonBasementFloor17startFallBySwitchEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1a44
|
||||
size: 52
|
||||
label: _ZN17MoonBasementFloor8movementEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1a78
|
||||
size: 148
|
||||
label: _ZN17MoonBasementFloor10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1b0c
|
||||
size: 60
|
||||
label: _ZN17MoonBasementFloor7exeWaitEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1b48
|
||||
size: 140
|
||||
label: _ZN17MoonBasementFloor16exeFallSignStartEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1bd4
|
||||
size: 68
|
||||
label: _ZN17MoonBasementFloor11exeFallSignEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1c18
|
||||
size: 84
|
||||
label: _ZN17MoonBasementFloor19exeFallSignBySwitchEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1c6c
|
||||
size: 220
|
||||
label: _ZN17MoonBasementFloor7exeFallEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2c1d48
|
||||
size: 64
|
||||
label: _ZNK12_GLOBAL__N_124MoonBasementFloorNrvWait7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1d88
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_133MoonBasementFloorNrvFallSignStart7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1d90
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_141MoonBasementFloorNrvFallSignStartByMeteor7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1d98
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_141MoonBasementFloorNrvFallSignStartBySwitch7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1da0
|
||||
size: 88
|
||||
label: _ZNK12_GLOBAL__N_136MoonBasementFloorNrvFallSignBySwitch7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1df8
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_132MoonBasementFloorNrvFallByMeteor7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1e00
|
||||
size: 72
|
||||
label: _ZNK12_GLOBAL__N_128MoonBasementFloorNrvFallSign7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1e48
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_124MoonBasementFloorNrvFall7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2c1e50
|
||||
size: 28
|
||||
label: _ZNK2al10FunctorV0MIP17MoonBasementFloorMS1_FvvEEclEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2c1e6c
|
||||
size: 76
|
||||
label: _ZNK2al10FunctorV0MIP17MoonBasementFloorMS1_FvvEE5cloneEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x2c1eb8
|
||||
size: 4
|
||||
label: _ZN2al10FunctorV0MIP17MoonBasementFloorMS1_FvvEED0Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
MapObj/MoonBasementGate.o:
|
||||
'.text':
|
||||
|
|
@ -82302,103 +82302,103 @@ MapObj/RocketFlower.o:
|
|||
- offset: 0x2fd628
|
||||
size: 128
|
||||
label: _ZN12RocketFlowerC2EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fd6a8
|
||||
size: 140
|
||||
label: _ZN12RocketFlowerC1EPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fd734
|
||||
size: 268
|
||||
label: _ZN12RocketFlower4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fd840
|
||||
size: 28
|
||||
label: _ZN12RocketFlower18initAfterPlacementEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fd85c
|
||||
size: 156
|
||||
label: _ZN12RocketFlower12attackSensorEPN2al9HitSensorES2_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fd8f8
|
||||
size: 84
|
||||
label: _ZNK12RocketFlower13isEnableEquipEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fd94c
|
||||
size: 664
|
||||
label: _ZN12RocketFlower10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fdbe4
|
||||
size: 116
|
||||
label: _ZN12RocketFlower15terminateFollowEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fdc58
|
||||
size: 76
|
||||
label: _ZN12RocketFlower7exeWaitEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fdca4
|
||||
size: 100
|
||||
label: _ZN12RocketFlower13exeWaitFollowEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fdd08
|
||||
size: 412
|
||||
label: _ZN12RocketFlower19trySyncFlyingCapPosEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fdea4
|
||||
size: 324
|
||||
label: _ZN12RocketFlower9exeFollowEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fdfe8
|
||||
size: 108
|
||||
label: _ZN12RocketFlower15appearFlowerSubEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe054
|
||||
size: 164
|
||||
label: _ZN12RocketFlower13exeWaitAttachEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe0f8
|
||||
size: 60
|
||||
label: _ZN12RocketFlower9exeAttachEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe134
|
||||
size: 48
|
||||
label: _ZN12RocketFlower19setFollowFlowerPoseERKN4sead4QuatIfEERKNS0_7Vector3IfEE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe164
|
||||
size: 16
|
||||
label: _ZN12RocketFlower9disappearEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe174
|
||||
size: 124
|
||||
label: _ZN12RocketFlower14disappearForceEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe1f0
|
||||
size: 104
|
||||
label: _ZN12RocketFlower7controlEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x2fe258
|
||||
size: 80
|
||||
label: _ZNK12_GLOBAL__N_119RocketFlowerNrvWait7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2fe2a8
|
||||
size: 64
|
||||
label: _ZNK12_GLOBAL__N_121RocketFlowerNrvAttach7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2fe2e8
|
||||
size: 104
|
||||
label: _ZNK12_GLOBAL__N_125RocketFlowerNrvWaitFollow7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2fe350
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_121RocketFlowerNrvFollow7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x2fe358
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_125RocketFlowerNrvWaitAttach7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
MapObj/RocketFlowerEquipWatcher.o:
|
||||
'.text':
|
||||
|
|
@ -111352,39 +111352,40 @@ Npc/TrafficRailWatcher.o:
|
|||
label:
|
||||
- _ZN18TrafficRailWatcherC1ERKN2al13PlacementInfoE
|
||||
- _ZN18TrafficRailWatcherC2ERKN2al13PlacementInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea188
|
||||
size: 76
|
||||
label: _ZNK18TrafficRailWatcher7isEqualERKN2al13PlacementInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea1d4
|
||||
size: 72
|
||||
label: _ZN18TrafficRailWatcher13registerActorEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea21c
|
||||
size: 72
|
||||
label: _ZNK18TrafficRailWatcher7isExistEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea264
|
||||
size: 32
|
||||
label: _ZN18TrafficRailWatcher13stopByTrafficEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea284
|
||||
size: 28
|
||||
label: _ZN18TrafficRailWatcher16restartByTrafficEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea2a0
|
||||
size: 172
|
||||
label: _ZN18TrafficRailWatcher17tryStopByOtherNpcEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x3ea34c
|
||||
size: 280
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _Z19isNearOnTrafficRailPKN2al9LiveActorEPKN18TrafficRailWatcher9ActorInfoE
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x3ea464
|
||||
size: 160
|
||||
label: _ZN18TrafficRailWatcher20tryRestartByOtherNpcEPKN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
Npc/TrafficRailWatcherDirector.o:
|
||||
'.text':
|
||||
- offset: 0x3ea504
|
||||
|
|
@ -133676,7 +133677,7 @@ Scene/ProjectActorFactory.o:
|
|||
- offset: 0x4b66dc
|
||||
size: 52
|
||||
label: _ZN2al19createActorFunctionI14BossKnuckleFixEEPNS_9LiveActorEPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x4b6710
|
||||
size: 52
|
||||
|
|
@ -134846,7 +134847,7 @@ Scene/ProjectActorFactory.o:
|
|||
- offset: 0x4b99d4
|
||||
size: 52
|
||||
label: _ZN2al19createActorFunctionI17MoonBasementFloorEEPNS_9LiveActorEPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x4b9a08
|
||||
size: 52
|
||||
|
|
@ -135906,7 +135907,7 @@ Scene/ProjectActorFactory.o:
|
|||
- offset: 0x4bd180
|
||||
size: 52
|
||||
label: _ZN2al19createActorFunctionI12RocketFlowerEEPNS_9LiveActorEPKc
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x4bd1b4
|
||||
size: 52
|
||||
|
|
@ -264305,60 +264306,60 @@ Library/Movement/ClockMovement.o:
|
|||
label:
|
||||
- _ZN2al13ClockMovementC1ERKNS_13ActorInitInfoE
|
||||
- _ZN2al13ClockMovementC2ERKNS_13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952a1c
|
||||
size: 100
|
||||
label: _ZN2al13ClockMovement8exeDelayEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952a80
|
||||
size: 204
|
||||
label: _ZN2al13ClockMovement13exeRotateSignEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952b4c
|
||||
size: 156
|
||||
label: _ZN2al13ClockMovement9exeRotateEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952be8
|
||||
size: 96
|
||||
label: _ZN2al13ClockMovement7exeWaitEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952c48
|
||||
size: 64
|
||||
label: _ZNK2al13ClockMovement16isFirstStepDelayEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952c88
|
||||
size: 68
|
||||
label: _ZNK2al13ClockMovement21isFirstStepRotateSignEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952ccc
|
||||
size: 68
|
||||
label: _ZNK2al13ClockMovement17isFirstStepRotateEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952d10
|
||||
size: 64
|
||||
label: _ZNK2al13ClockMovement15isFirstStepWaitEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x952d50
|
||||
size: 36
|
||||
label: _ZN2al13ClockMovementD0Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x952d74
|
||||
size: 104
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _ZNK12_GLOBAL__N_121ClockMovementNrvDelay7executeEPN2al11NerveKeeperE
|
||||
status: Matching
|
||||
- offset: 0x952ddc
|
||||
size: 8
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _ZNK12_GLOBAL__N_126ClockMovementNrvRotateSign7executeEPN2al11NerveKeeperE
|
||||
status: Matching
|
||||
- offset: 0x952de4
|
||||
size: 8
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _ZNK12_GLOBAL__N_122ClockMovementNrvRotate7executeEPN2al11NerveKeeperE
|
||||
status: Matching
|
||||
- offset: 0x952dec
|
||||
size: 100
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _ZNK12_GLOBAL__N_120ClockMovementNrvWait7executeEPN2al11NerveKeeperE
|
||||
status: Matching
|
||||
Library/Movement/EnemyStateBlowDown.o:
|
||||
'.text':
|
||||
- offset: 0x952e50
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ void ClockMapParts::exeRotate() {
|
|||
|
||||
mTimer++;
|
||||
if (mTimer >= mRotateTimer) {
|
||||
mCurrentStep = modi(mCurrentStep + mTurnStepCount + 1, mTurnStepCount);
|
||||
mCurrentStep = wrapValue(mCurrentStep + 1, mTurnStepCount);
|
||||
startNerveAction(this, "Wait");
|
||||
tryStartSe(this, "RotateEnd");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,6 +205,10 @@ void makeBoxMullerRandomGauss(sead::Vector2f* outBox, f32 randA, f32 randB);
|
|||
f32 modf(f32 a, f32 b);
|
||||
s32 modi(s32 a, s32 b);
|
||||
|
||||
inline s32 wrapValue(s32 value, s32 maxRange) {
|
||||
return modi(value + maxRange, maxRange);
|
||||
}
|
||||
|
||||
inline f32 wrapValue(f32 value, f32 maxRange) {
|
||||
return modf(value + maxRange, maxRange) + 0.0f;
|
||||
}
|
||||
|
|
|
|||
101
lib/al/Library/Movement/ClockMovement.cpp
Normal file
101
lib/al/Library/Movement/ClockMovement.cpp
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
#include "Library/Movement/ClockMovement.h"
|
||||
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
|
||||
namespace {
|
||||
using namespace al;
|
||||
|
||||
NERVE_IMPL(ClockMovement, Delay);
|
||||
NERVE_IMPL(ClockMovement, RotateSign);
|
||||
NERVE_IMPL(ClockMovement, Rotate);
|
||||
NERVE_IMPL(ClockMovement, Wait);
|
||||
|
||||
NERVES_MAKE_STRUCT(ClockMovement, Delay, RotateSign, Rotate);
|
||||
NERVES_MAKE_NOSTRUCT(ClockMovement, Wait);
|
||||
} // namespace
|
||||
|
||||
namespace al {
|
||||
|
||||
ClockMovement::ClockMovement(const ActorInitInfo& info) : NerveExecutor("クロックパーツ動作") {
|
||||
getQuat(&mInitialQuat, info);
|
||||
mCurrentQuat = mInitialQuat;
|
||||
tryGetArg(&mClockAngleDegree, info, "ClockAngleDegree");
|
||||
tryGetArg(&mRotateAxis, info, "RotateAxis");
|
||||
tryGetArg(&mDelayTime, info, "DelayTime");
|
||||
tryGetArg(&mRotateSignTime, info, "RotateSignTime");
|
||||
tryGetArg(&mRotateTime, info, "RotateTime");
|
||||
tryGetArg(&mWaitTime, info, "WaitTime");
|
||||
|
||||
if (mDelayTime == 0)
|
||||
initNerve(&NrvClockMovement.RotateSign, 0);
|
||||
else
|
||||
initNerve(&NrvClockMovement.Delay, 0);
|
||||
|
||||
s32 stepsPerCycle = 1;
|
||||
if (mClockAngleDegree != 0) {
|
||||
stepsPerCycle = sead::Mathi::lcm(sead::Mathi::abs(mClockAngleDegree), 360) /
|
||||
sead::Mathi::abs(mClockAngleDegree);
|
||||
}
|
||||
mMaxStepIndex = stepsPerCycle;
|
||||
}
|
||||
|
||||
void ClockMovement::exeDelay() {
|
||||
if (isGreaterEqualStep(this, mDelayTime - 1)) {
|
||||
if (mRotateSignTime > 0)
|
||||
setNerve(this, &NrvClockMovement.RotateSign);
|
||||
else
|
||||
setNerve(this, &NrvClockMovement.Rotate);
|
||||
}
|
||||
}
|
||||
|
||||
void ClockMovement::exeRotateSign() {
|
||||
f32 rotateAngle = wrapValue(static_cast<f32>(mCurrentStepIndex * mClockAngleDegree), 360.0f);
|
||||
|
||||
rotateQuatLocalDirDegree(&mCurrentQuat, mInitialQuat, mRotateAxis,
|
||||
rotateAngle +
|
||||
sead::Mathf::sin(getNerveStep(this) * sead::Mathf::pi2() / 18.0f));
|
||||
|
||||
if (isGreaterEqualStep(this, mRotateSignTime - 1))
|
||||
setNerve(this, &NrvClockMovement.Rotate);
|
||||
}
|
||||
|
||||
void ClockMovement::exeRotate() {
|
||||
f32 rotateAngle = wrapValue(
|
||||
(calcNerveRate(this, mRotateTime) + mCurrentStepIndex) * mClockAngleDegree, 360.0f);
|
||||
rotateQuatLocalDirDegree(&mCurrentQuat, mInitialQuat, mRotateAxis, rotateAngle);
|
||||
|
||||
if (isGreaterEqualStep(this, mRotateTime)) {
|
||||
mCurrentStepIndex = wrapValue(mCurrentStepIndex + 1, mMaxStepIndex);
|
||||
setNerve(this, &Wait);
|
||||
}
|
||||
}
|
||||
|
||||
void ClockMovement::exeWait() {
|
||||
if (isGreaterEqualStep(this, mWaitTime)) {
|
||||
if (mRotateSignTime > 0)
|
||||
setNerve(this, &NrvClockMovement.RotateSign);
|
||||
else
|
||||
setNerve(this, &NrvClockMovement.Rotate);
|
||||
}
|
||||
}
|
||||
|
||||
bool ClockMovement::isFirstStepDelay() const {
|
||||
return isNerve(this, &NrvClockMovement.Delay) && isFirstStep(this);
|
||||
}
|
||||
|
||||
bool ClockMovement::isFirstStepRotateSign() const {
|
||||
return isNerve(this, &NrvClockMovement.RotateSign) && isFirstStep(this);
|
||||
}
|
||||
|
||||
bool ClockMovement::isFirstStepRotate() const {
|
||||
return isNerve(this, &NrvClockMovement.Rotate) && isFirstStep(this);
|
||||
}
|
||||
|
||||
bool ClockMovement::isFirstStepWait() const {
|
||||
return isNerve(this, &Wait) && isFirstStep(this);
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
36
lib/al/Library/Movement/ClockMovement.h
Normal file
36
lib/al/Library/Movement/ClockMovement.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <math/seadQuat.h>
|
||||
|
||||
#include "Library/Nerve/NerveExecutor.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
|
||||
class ClockMovement : public NerveExecutor {
|
||||
public:
|
||||
ClockMovement(const ActorInitInfo& info);
|
||||
void exeDelay();
|
||||
void exeRotateSign();
|
||||
void exeRotate();
|
||||
void exeWait();
|
||||
bool isFirstStepDelay() const;
|
||||
bool isFirstStepRotateSign() const;
|
||||
bool isFirstStepRotate() const;
|
||||
bool isFirstStepWait() const;
|
||||
|
||||
private:
|
||||
sead::Quatf mCurrentQuat = sead::Quatf::unit;
|
||||
sead::Quatf mInitialQuat = sead::Quatf::unit;
|
||||
s32 mRotateAxis = 0;
|
||||
s32 mClockAngleDegree = 90;
|
||||
s32 mCurrentStepIndex = 0;
|
||||
s32 mMaxStepIndex = 4;
|
||||
s32 mDelayTime = 0;
|
||||
s32 mRotateSignTime = 36;
|
||||
s32 mRotateTime = 60;
|
||||
s32 mWaitTime = 0;
|
||||
};
|
||||
|
||||
static_assert(sizeof(ClockMovement) == 0x50);
|
||||
} // namespace al
|
||||
|
|
@ -59,7 +59,7 @@ void SwingMovement::exeMove() {
|
|||
if (updateRotate())
|
||||
setNerve(this, &Stop);
|
||||
|
||||
mFrameInCycle = modi((mFrameInCycle + 1) + mSwingCycle, mSwingCycle);
|
||||
mFrameInCycle = wrapValue(mFrameInCycle + 1, mSwingCycle);
|
||||
}
|
||||
|
||||
void SwingMovement::exeStop() {
|
||||
|
|
|
|||
|
|
@ -323,11 +323,8 @@ s32 getNextRailPointNo(const IUseRail* railHolder) {
|
|||
s32 newIndex = getRailPointNo(railHolder) + modifier;
|
||||
s32 railPointNum = getRailPointNum(railHolder);
|
||||
|
||||
if (isLoop) {
|
||||
s32 sum = railPointNum + newIndex;
|
||||
s32 railPointNumAgain = getRailPointNum(railHolder);
|
||||
return modi(sum + railPointNumAgain, railPointNumAgain);
|
||||
}
|
||||
if (isLoop)
|
||||
return wrapValue(railPointNum + newIndex, getRailPointNum(railHolder));
|
||||
|
||||
return sead::Mathi::clamp2(0, newIndex, railPointNum - 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ public:
|
|||
virtual void drawMain() const;
|
||||
virtual void drawSub() const;
|
||||
|
||||
AudioKeeper* getAudioKeeper() const override { return mAudioKeeper; }
|
||||
|
||||
virtual bool isDisposable() const;
|
||||
|
||||
virtual Scene* getCurrentScene() const { return nullptr; }
|
||||
|
|
@ -34,8 +36,6 @@ public:
|
|||
|
||||
void setSceneCreator(SceneCreator* sceneCreator) override { mSceneCreator = sceneCreator; }
|
||||
|
||||
AudioKeeper* getAudioKeeper() const override { return mAudioKeeper; }
|
||||
|
||||
void initAudio(const GameSystemInfo&, const char*, s32, s32, s32, const char*);
|
||||
void initAudioKeeper(const char*);
|
||||
void initDrawSystemInfo(const SequenceInitInfo&);
|
||||
|
|
|
|||
|
|
@ -17,8 +17,7 @@ void FlowMapCtrl::update() {
|
|||
flowParameters.y =
|
||||
calcRate01(halfInterval - sead::Mathi::abs(halfInterval - mFlowStep), 0.0f, halfInterval);
|
||||
flowParameters.z = calcRate01(mFlowStep, 0.0f, mInterval);
|
||||
flowParameters.w =
|
||||
calcRate01(modi(mFlowStep + halfInterval + mInterval, mInterval), 0.0f, mInterval);
|
||||
flowParameters.w = calcRate01(wrapValue(mFlowStep + halfInterval, mInterval), 0.0f, mInterval);
|
||||
|
||||
s32 materialCount = getMaterialCount(mParent);
|
||||
for (s32 i = 0; i < materialCount; i++) {
|
||||
|
|
@ -27,7 +26,7 @@ void FlowMapCtrl::update() {
|
|||
}
|
||||
|
||||
mFlowStep++;
|
||||
mFlowStep = modi(mFlowStep + mInterval, mInterval);
|
||||
mFlowStep = wrapValue(mFlowStep, mInterval);
|
||||
}
|
||||
|
||||
} // namespace al
|
||||
|
|
|
|||
48
src/Boss/Koopa/KoopaHackStopCtrl.h
Normal file
48
src/Boss/Koopa/KoopaHackStopCtrl.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadQuat.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
#include "Library/Scene/ISceneObj.h"
|
||||
|
||||
#include "Scene/SceneObjFactory.h"
|
||||
|
||||
namespace al {
|
||||
class LiveActor;
|
||||
}
|
||||
|
||||
class KoopaHackStopCtrl : public al::ISceneObj {
|
||||
public:
|
||||
static constexpr s32 sSceneObjId = SceneObjID_KoopaStopHackCtrl;
|
||||
|
||||
KoopaHackStopCtrl();
|
||||
|
||||
const char* getSceneObjName() const override { return "崩落クッパの停止制御"; }
|
||||
|
||||
void startStop(const al::LiveActor* actor);
|
||||
void endStop(const al::LiveActor* actor);
|
||||
void resetPosture(const al::LiveActor* actor, const sead::Quatf& quat,
|
||||
const sead::Vector3f& trans);
|
||||
bool tryResetPosture(al::LiveActor* actor);
|
||||
|
||||
private:
|
||||
const al::LiveActor* mStopActor = nullptr;
|
||||
bool mIsNeedResetPosture = false;
|
||||
sead::Quatf mResetQuat = sead::Quatf::unit;
|
||||
sead::Vector3f mResetTrans = sead::Vector3f::zero;
|
||||
bool mIsStatusDemoForSceneKoopaHack = false;
|
||||
};
|
||||
|
||||
static_assert(sizeof(KoopaHackStopCtrl) == 0x38, "KoopaHackStopCtrl");
|
||||
|
||||
namespace KoopaHackFunction {
|
||||
void startStopKoopaHack(al::LiveActor* actor);
|
||||
void endStopKoopaHack(al::LiveActor* actor);
|
||||
void resetPostureKoopaHack(al::LiveActor* actor, const sead::Quatf& quat,
|
||||
const sead::Vector3f& trans);
|
||||
bool isStopKoopaHack(const al::LiveActor* actor);
|
||||
bool isStatusDemoForSceneKoopaHack(const al::LiveActor* actor);
|
||||
void setStatusDemoForSceneKoopaHack(const al::LiveActor* actor);
|
||||
void resetStatusDemoForSceneKoopaHack(const al::LiveActor* actor);
|
||||
} // namespace KoopaHackFunction
|
||||
|
|
@ -65,8 +65,8 @@ void KoopaLandPointHolder::decidePointEitherFarSide(const sead::Vector3f& pos) {
|
|||
}
|
||||
|
||||
mInvalidPoints[mCurrentLandPoint] = false;
|
||||
s32 prevPoint = al::modi(mCurrentLandPoint - 1 + mLandPoints, mLandPoints);
|
||||
s32 nextPoint = al::modi(mCurrentLandPoint + 1 + mLandPoints, mLandPoints);
|
||||
s32 prevPoint = al::wrapValue(mCurrentLandPoint - 1, mLandPoints);
|
||||
s32 nextPoint = al::wrapValue(mCurrentLandPoint + 1, mLandPoints);
|
||||
|
||||
f32 prevDist = getKoopaLandPointDistance(mPointsTrans[prevPoint], pos);
|
||||
f32 nextDist = getKoopaLandPointDistance(mPointsTrans[nextPoint], pos);
|
||||
|
|
|
|||
|
|
@ -638,7 +638,8 @@ void Bubble::control() {
|
|||
if (!al::isNerve(this, &NrvBubble.StandBy) && !al::isNerve(this, &NrvBubble.Delay) &&
|
||||
(!isHack() || !rs::isActiveHackStartDemo(mPlayerHack)) &&
|
||||
!al::isClipped(mClippingProbeActor) && !mIsClipped) {
|
||||
mReviveDelayCount = al::modi(mReviveDelayCount + 1 + mReviveDelayTime, mReviveDelayTime);
|
||||
mReviveDelayCount =
|
||||
al::wrapValue(static_cast<s32>(mReviveDelayCount + 1), mReviveDelayTime);
|
||||
}
|
||||
|
||||
mIsClipped = al::isClipped(mClippingProbeActor);
|
||||
|
|
|
|||
|
|
@ -505,7 +505,8 @@ void Gamane::exeHack() {
|
|||
mCoinsLeft--;
|
||||
}
|
||||
|
||||
mHackCoinAppearCounter = al::modi((mHackCoinAppearCounter++ + 1) + 6, 6);
|
||||
// NOTE: this is only one increment, as post-incrementing is used
|
||||
mHackCoinAppearCounter = al::wrapValue(mHackCoinAppearCounter++ + 1, 6);
|
||||
}
|
||||
|
||||
void Gamane::exeTrampled() {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ HosuiTrailKeeper::HosuiTrailKeeper(const al::ActorInitInfo& initInfo) {
|
|||
void HosuiTrailKeeper::appearTrail(const sead::Vector3f& pos, const sead::Vector3f& dir) {
|
||||
s32 count = mTrails.size();
|
||||
|
||||
s32 prevIdx = al::modi(mIndex + count - 1 + count, count);
|
||||
s32 prevIdx = al::wrapValue(mIndex + count - 1, count);
|
||||
HosuiTrail* prevTrail = mTrails[prevIdx];
|
||||
|
||||
if (al::isAlive(prevTrail) && (pos - al::getTrans(prevTrail)).length() < 120.0f)
|
||||
|
|
@ -56,12 +56,12 @@ void HosuiTrailKeeper::appearTrail(const sead::Vector3f& pos, const sead::Vector
|
|||
trail->setFollowCollisionParts(triangle.getCollisionParts());
|
||||
}
|
||||
|
||||
s32 disappearIdx = al::modi(mIndex + 5 + count, count);
|
||||
s32 disappearIdx = al::wrapValue(mIndex + 5, count);
|
||||
HosuiTrail* disappearTrail = mTrails[disappearIdx];
|
||||
if (al::isAlive(disappearTrail))
|
||||
disappearTrail->disappear();
|
||||
|
||||
mIndex = al::modi(mIndex + 1 + count, count);
|
||||
mIndex = al::wrapValue(mIndex + 1, count);
|
||||
}
|
||||
|
||||
void HosuiTrailKeeper::forceKillAll() {
|
||||
|
|
|
|||
|
|
@ -243,8 +243,7 @@ void MenuSelectParts::exeSelect() {
|
|||
s32 direction = mKeyRepeatCtrl->isUp() ? -1 : 1;
|
||||
|
||||
al::startAction(mLayoutArray[calcPartsIndex(mCursorItemIndex)], "Wait");
|
||||
mCursorItemIndex =
|
||||
al::modi(mCursorItemIndex + direction + mMenuItemAmount, mMenuItemAmount);
|
||||
mCursorItemIndex = al::wrapValue(mCursorItemIndex + direction, mMenuItemAmount);
|
||||
|
||||
f32 pitch = ((1.0f - (f32)mCursorItemIndex / (mMenuItemAmount - 1)) * 0.375f) + 1.0f;
|
||||
al::PadRumbleParam param;
|
||||
|
|
|
|||
|
|
@ -161,15 +161,15 @@ void WindowConfirmData::exeWait() {
|
|||
|
||||
if (rs::isRepeatUiDown(mWindowConfirmLayout)) {
|
||||
if (mSelectionCooldown == 0)
|
||||
changeSelectingIdx(al::modi((mSelectionIndex + 1) + 2, 2));
|
||||
mSelectionCooldown = al::modi((mSelectionCooldown + 1) + 10, 10);
|
||||
changeSelectingIdx(al::wrapValue(mSelectionIndex + 1, 2));
|
||||
mSelectionCooldown = al::wrapValue(mSelectionCooldown + 1, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
if (rs::isRepeatUiUp(mWindowConfirmLayout)) {
|
||||
if (mSelectionCooldown == 0)
|
||||
changeSelectingIdx(al::modi((mSelectionIndex - 1) + 2, 2));
|
||||
mSelectionCooldown = al::modi((mSelectionCooldown + 1) + 10, 10);
|
||||
changeSelectingIdx(al::wrapValue(mSelectionIndex - 1, 2));
|
||||
mSelectionCooldown = al::wrapValue(mSelectionCooldown + 1, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
89
src/MapObj/BossKnuckleFix.cpp
Normal file
89
src/MapObj/BossKnuckleFix.cpp
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
#include "MapObj/BossKnuckleFix.h"
|
||||
|
||||
#include <math/seadVector.h>
|
||||
|
||||
#include "Library/LiveActor/ActorActionFunction.h"
|
||||
#include "Library/LiveActor/ActorAnimFunction.h"
|
||||
#include "Library/LiveActor/ActorCollisionFunction.h"
|
||||
#include "Library/LiveActor/ActorInitUtil.h"
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/LiveActor/ActorResourceFunction.h"
|
||||
#include "Library/LiveActor/ActorSensorUtil.h"
|
||||
#include "Library/LiveActor/LiveActorFunction.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
#include "Library/Obj/CollisionObj.h"
|
||||
#include "Library/Stage/StageSwitchUtil.h"
|
||||
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
namespace {
|
||||
NERVE_IMPL(BossKnuckleFix, Wait);
|
||||
NERVE_IMPL(BossKnuckleFix, ReactionLarge);
|
||||
NERVE_IMPL(BossKnuckleFix, Reaction);
|
||||
|
||||
NERVES_MAKE_STRUCT(BossKnuckleFix, Wait, ReactionLarge, Reaction);
|
||||
} // namespace
|
||||
|
||||
BossKnuckleFix::BossKnuckleFix(const char* name) : al::LiveActor(name) {}
|
||||
|
||||
void BossKnuckleFix::init(const al::ActorInitInfo& info) {
|
||||
al::initActorWithArchiveName(this, info, "BossKnuckleBody", "Fix");
|
||||
al::initNerve(this, &NrvBossKnuckleFix.Wait, 0);
|
||||
// NOTE: color of embedded grand shine is hardcoded to 5 (Sand)
|
||||
al::startMclAnimAndSetFrameAndStop(al::getSubActor(this, "グランドシャイン"), "Color", 5.0f);
|
||||
al::trySyncStageSwitchKill(this);
|
||||
makeActorAlive();
|
||||
|
||||
mCollisionObj = new al::CollisionObj(info, al::getModelResource(this), "MoveLimit",
|
||||
al::getHitSensor(this, "Body"), nullptr, nullptr);
|
||||
al::setCollisionPartsSpecialPurposeName(mCollisionObj, "MoveLimit");
|
||||
al::setTrans(mCollisionObj, al::getTrans(this));
|
||||
al::setRotate(mCollisionObj, {0.0f, 90.0f, 0.0f});
|
||||
mCollisionObj->makeActorAlive();
|
||||
}
|
||||
|
||||
bool BossKnuckleFix::receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) {
|
||||
if (rs::isMsgPlayerDisregardHomingAttack(message))
|
||||
return true;
|
||||
|
||||
if (al::isNerve(this, &NrvBossKnuckleFix.Wait) &&
|
||||
(rs::isMsgSphinxRideAttackTouch(message) || rs::isMsgPlayerAndCapHipDropAll(message))) {
|
||||
rs::requestHitReactionToAttacker(message, self, other);
|
||||
|
||||
mReactionCount++;
|
||||
if (mReactionCount >= 3) {
|
||||
mReactionCount = 0;
|
||||
al::setNerve(this, &NrvBossKnuckleFix.ReactionLarge);
|
||||
} else
|
||||
al::setNerve(this, &NrvBossKnuckleFix.Reaction);
|
||||
|
||||
return !rs::isMsgPlayerAndCapHipDropAll(message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void BossKnuckleFix::exeWait() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "MapWait");
|
||||
}
|
||||
|
||||
void BossKnuckleFix::exeReaction() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "MapReaction");
|
||||
|
||||
if (al::isActionEnd(this))
|
||||
al::setNerve(this, &NrvBossKnuckleFix.Wait);
|
||||
}
|
||||
|
||||
void BossKnuckleFix::exeReactionLarge() {
|
||||
if (al::isFirstStep(this)) {
|
||||
al::startAction(this, "MapReactionLarge");
|
||||
al::tryOnStageSwitch(this, "ReactionOn");
|
||||
}
|
||||
|
||||
if (al::isActionEnd(this))
|
||||
al::setNerve(this, &NrvBossKnuckleFix.Wait);
|
||||
}
|
||||
31
src/MapObj/BossKnuckleFix.h
Normal file
31
src/MapObj/BossKnuckleFix.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class CollisionObj;
|
||||
class HitSensor;
|
||||
class SensorMsg;
|
||||
} // namespace al
|
||||
|
||||
class BossKnuckleFix : public al::LiveActor {
|
||||
public:
|
||||
BossKnuckleFix(const char* name);
|
||||
|
||||
void init(const al::ActorInitInfo& info) override;
|
||||
bool receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) override;
|
||||
|
||||
void exeWait();
|
||||
void exeReaction();
|
||||
void exeReactionLarge();
|
||||
|
||||
private:
|
||||
al::CollisionObj* mCollisionObj = nullptr;
|
||||
s32 mReactionCount = 0;
|
||||
};
|
||||
|
||||
static_assert(sizeof(BossKnuckleFix) == 0x118);
|
||||
165
src/MapObj/MoonBasementFloor.cpp
Normal file
165
src/MapObj/MoonBasementFloor.cpp
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
#include "MapObj/MoonBasementFloor.h"
|
||||
|
||||
#include "Library/LiveActor/ActorActionFunction.h"
|
||||
#include "Library/LiveActor/ActorClippingFunction.h"
|
||||
#include "Library/LiveActor/ActorFlagFunction.h"
|
||||
#include "Library/LiveActor/ActorInitFunction.h"
|
||||
#include "Library/LiveActor/ActorInitUtil.h"
|
||||
#include "Library/LiveActor/ActorMovementFunction.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
#include "Library/Stage/StageSwitchUtil.h"
|
||||
#include "Library/Thread/FunctorV0M.h"
|
||||
|
||||
#include "Boss/Koopa/KoopaHackStopCtrl.h"
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
namespace {
|
||||
NERVE_IMPL(MoonBasementFloor, Wait)
|
||||
NERVE_IMPL(MoonBasementFloor, FallSignStart)
|
||||
NERVE_IMPL_(MoonBasementFloor, FallSignStartByMeteor, FallSignStart)
|
||||
NERVE_IMPL_(MoonBasementFloor, FallSignStartBySwitch, FallSignStart)
|
||||
NERVE_IMPL(MoonBasementFloor, FallSignBySwitch)
|
||||
NERVE_IMPL_(MoonBasementFloor, FallByMeteor, Fall)
|
||||
NERVE_IMPL(MoonBasementFloor, FallSign)
|
||||
NERVE_IMPL(MoonBasementFloor, Fall)
|
||||
|
||||
NERVES_MAKE_STRUCT(MoonBasementFloor, Wait, FallSignStart, FallSignStartByMeteor,
|
||||
FallSignStartBySwitch, FallSignBySwitch, FallByMeteor, FallSign, Fall)
|
||||
|
||||
const f32 sFallGravity = 0.2f;
|
||||
const f32 sFallScale = 0.95f;
|
||||
const f32 sFallGravityByMeteor = 0.2f;
|
||||
const f32 sFallScaleByMeteor = 0.95f;
|
||||
|
||||
struct MoonFallParams {
|
||||
const f32* gravity;
|
||||
const f32* scale;
|
||||
};
|
||||
|
||||
const MoonFallParams sFallParams{&sFallGravity, &sFallScale};
|
||||
const MoonFallParams sFallParamsByMeteor{&sFallGravityByMeteor, &sFallScaleByMeteor};
|
||||
|
||||
inline const MoonFallParams& getMoonFallParams(al::LiveActor* actor) {
|
||||
return al::isNerve(actor, &NrvMoonBasementFloor.FallByMeteor) ? sFallParamsByMeteor :
|
||||
sFallParams;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
MoonBasementFloor::MoonBasementFloor(const char* name) : al::LiveActor(name) {}
|
||||
|
||||
void MoonBasementFloor::init(const al::ActorInitInfo& info) {
|
||||
using MoonBasementFloorFunctor =
|
||||
al::FunctorV0M<MoonBasementFloor*, void (MoonBasementFloor::*)()>;
|
||||
|
||||
al::initActorChangeModel(this, info);
|
||||
al::initNerve(this, &NrvMoonBasementFloor.Wait, 0);
|
||||
|
||||
f32 rotate = sead::Mathf::floor(al::getRandom(0.0f, 3.99f));
|
||||
al::addRotateAndRepeatY(this, rotate * 90.0);
|
||||
|
||||
if (al::listenStageSwitchOn(
|
||||
this, "SwitchFallStart",
|
||||
MoonBasementFloorFunctor(this, &MoonBasementFloor::startFallBySwitch))) {
|
||||
al::tryGetArg(&mFallSignStepBySwitch, info, "FallSignStepBySwitch");
|
||||
}
|
||||
|
||||
al::trySyncStageSwitchKill(this);
|
||||
}
|
||||
|
||||
void MoonBasementFloor::startFallBySwitch() {
|
||||
if (!al::isAlive(this))
|
||||
return;
|
||||
|
||||
if (al::isNerve(this, &NrvMoonBasementFloor.Fall))
|
||||
return;
|
||||
|
||||
if (al::isNerve(this, &NrvMoonBasementFloor.FallByMeteor))
|
||||
return;
|
||||
|
||||
s32 fallSignStepBySwitch = mFallSignStepBySwitch;
|
||||
al::invalidateClipping(this);
|
||||
|
||||
if (fallSignStepBySwitch == 0)
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallSignStart);
|
||||
else
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallSignStartBySwitch);
|
||||
}
|
||||
|
||||
void MoonBasementFloor::movement() {
|
||||
if (!KoopaHackFunction::isStopKoopaHack(this))
|
||||
al::LiveActor::movement();
|
||||
}
|
||||
|
||||
bool MoonBasementFloor::receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) {
|
||||
if (!al::isNerve(this, &NrvMoonBasementFloor.Wait))
|
||||
return false;
|
||||
|
||||
if (rs::isMsgKoopaTouchFloor(message)) {
|
||||
al::startHitReaction(this, "クッパ着地");
|
||||
al::invalidateClipping(this);
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallSignStart);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rs::isMsgMoonBasementAttackMeteor(message)) {
|
||||
al::invalidateClipping(this);
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallSignStartByMeteor);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void MoonBasementFloor::exeWait() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "Wait");
|
||||
}
|
||||
|
||||
void MoonBasementFloor::exeFallSignStart() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "FallSignStart");
|
||||
|
||||
if (al::isActionEnd(this)) {
|
||||
if (al::isNerve(this, &NrvMoonBasementFloor.FallSignStartBySwitch))
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallSignBySwitch);
|
||||
else if (al::isNerve(this, &NrvMoonBasementFloor.FallSignStartByMeteor))
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallByMeteor);
|
||||
else
|
||||
al::setNerve(this, &NrvMoonBasementFloor.FallSign);
|
||||
}
|
||||
}
|
||||
|
||||
void MoonBasementFloor::exeFallSign() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "FallSign");
|
||||
|
||||
al::setNerveAtActionEnd(this, &NrvMoonBasementFloor.Fall);
|
||||
}
|
||||
|
||||
void MoonBasementFloor::exeFallSignBySwitch() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "FallSignBySwitch");
|
||||
|
||||
s32 fallSignStep = mFallSignStepBySwitch;
|
||||
if (fallSignStep < 0)
|
||||
fallSignStep = 30;
|
||||
|
||||
al::setNerveAtGreaterEqualStep(this, &NrvMoonBasementFloor.Fall, fallSignStep);
|
||||
}
|
||||
|
||||
void MoonBasementFloor::exeFall() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(this, "Fall");
|
||||
|
||||
al::addVelocityToGravity(this, *getMoonFallParams(this).gravity);
|
||||
al::scaleVelocity(this, *getMoonFallParams(this).scale);
|
||||
|
||||
if (al::isGreaterEqualStep(this, 300)) {
|
||||
al::startHitReaction(this, "消滅");
|
||||
kill();
|
||||
}
|
||||
}
|
||||
34
src/MapObj/MoonBasementFloor.h
Normal file
34
src/MapObj/MoonBasementFloor.h
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class HitSensor;
|
||||
class SensorMsg;
|
||||
} // namespace al
|
||||
|
||||
class MoonBasementFloor : public al::LiveActor {
|
||||
public:
|
||||
MoonBasementFloor(const char* name);
|
||||
|
||||
void init(const al::ActorInitInfo& info) override;
|
||||
void movement() override;
|
||||
bool receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) override;
|
||||
|
||||
void startFallBySwitch();
|
||||
|
||||
void exeWait();
|
||||
void exeFallSignStart();
|
||||
void exeFallSign();
|
||||
void exeFallSignBySwitch();
|
||||
void exeFall();
|
||||
|
||||
private:
|
||||
s32 mFallSignStepBySwitch = -1;
|
||||
};
|
||||
|
||||
static_assert(sizeof(MoonBasementFloor) == 0x110);
|
||||
237
src/MapObj/RocketFlower.cpp
Normal file
237
src/MapObj/RocketFlower.cpp
Normal file
|
|
@ -0,0 +1,237 @@
|
|||
#include "MapObj/RocketFlower.h"
|
||||
|
||||
#include "Library/Collision/PartsConnectorUtil.h"
|
||||
#include "Library/Effect/EffectSystemInfo.h"
|
||||
#include "Library/LiveActor/ActorActionFunction.h"
|
||||
#include "Library/LiveActor/ActorAnimFunction.h"
|
||||
#include "Library/LiveActor/ActorClippingFunction.h"
|
||||
#include "Library/LiveActor/ActorInitUtil.h"
|
||||
#include "Library/LiveActor/ActorMovementFunction.h"
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/LiveActor/ActorSensorUtil.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
|
||||
#include "MapObj/RocketFlowerFunction.h"
|
||||
#include "Util/PlayerUtil.h"
|
||||
#include "Util/SensorMsgFunction.h"
|
||||
|
||||
namespace {
|
||||
NERVE_IMPL(RocketFlower, Wait);
|
||||
NERVE_IMPL(RocketFlower, Attach);
|
||||
NERVE_IMPL(RocketFlower, WaitFollow);
|
||||
NERVE_IMPL(RocketFlower, Follow);
|
||||
NERVE_IMPL(RocketFlower, WaitAttach);
|
||||
|
||||
NERVES_MAKE_STRUCT(RocketFlower, Wait, Attach, WaitFollow, Follow, WaitAttach);
|
||||
} // namespace
|
||||
|
||||
RocketFlower::RocketFlower(const char* name) : al::LiveActor(name) {}
|
||||
|
||||
void RocketFlower::init(const al::ActorInitInfo& info) {
|
||||
al::initActor(this, info);
|
||||
al::initNerve(this, &NrvRocketFlower.Wait, 0);
|
||||
makeActorAlive();
|
||||
|
||||
mMtxConnector = al::tryCreateMtxConnector(this, info);
|
||||
|
||||
mFlowerSub = new al::LiveActor("ロケットフラワーの花");
|
||||
al::initChildActorWithArchiveNameNoPlacementInfo(mFlowerSub, info, "RocketFlowerDash", nullptr);
|
||||
al::startAction(mFlowerSub, "Wait");
|
||||
mFlowerSub->makeActorDead();
|
||||
|
||||
RocketFlowerFunction::createRocketFlowerEquipWatcherIfNotExist(this, info);
|
||||
al::setHitSensorPosPtr(this, "Equip", al::getTransPtr(mFlowerSub));
|
||||
al::startAction(this, "Wait");
|
||||
}
|
||||
|
||||
void RocketFlower::initAfterPlacement() {
|
||||
if (mMtxConnector)
|
||||
al::attachMtxConnectorToCollision(mMtxConnector, this, false);
|
||||
}
|
||||
|
||||
void RocketFlower::attackSensor(al::HitSensor* self, al::HitSensor* other) {
|
||||
if (!al::isSensorName(self, "Equip"))
|
||||
return;
|
||||
|
||||
if (isEnableEquip()) {
|
||||
if (rs::sendMsgRocketFlowerExtension(other, self))
|
||||
al::setNerve(this, &NrvRocketFlower.Attach);
|
||||
}
|
||||
}
|
||||
|
||||
bool RocketFlower::isEnableEquip() const {
|
||||
if (al::isNerve(this, &NrvRocketFlower.Follow) && !al::isNewNerve(this))
|
||||
return true;
|
||||
|
||||
return al::isNerve(this, &NrvRocketFlower.WaitAttach);
|
||||
}
|
||||
|
||||
bool RocketFlower::receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) {
|
||||
if (al::isMsgPlayerSpinAttack(message)) {
|
||||
if (al::isNerve(this, &NrvRocketFlower.Wait)) {
|
||||
al::invalidateClipping(this);
|
||||
al::setNerve(this, &NrvRocketFlower.WaitFollow);
|
||||
}
|
||||
} else if (rs::isMsgCapItemGet(message)) {
|
||||
if (al::isNerve(this, &NrvRocketFlower.Wait)) {
|
||||
al::invalidateClipping(this);
|
||||
al::setNerve(this, &NrvRocketFlower.Follow);
|
||||
return true;
|
||||
}
|
||||
} else if (al::isMsgPlayerObjTouch(message) || rs::isMsgBlowObjAttack(message) ||
|
||||
rs::isMsgFireDamageAll(message) || rs::isMsgHammerBrosHammerEnemyAttack(message) ||
|
||||
rs::isMsgHammerBrosHammerHackAttack(message) || rs::isMsgHosuiAttack(message) ||
|
||||
al::isMsgEnemyAttack(message) || al::isMsgKickStoneAttack(message) ||
|
||||
rs::isMsgRadishAttack(message) || rs::isMsgSeedAttack(message) ||
|
||||
rs::isMsgTankBullet(message) || rs::isMsgGamaneBulletThrough(message) ||
|
||||
rs::isMsgHackAttackPoison(message) || rs::isMsgYoshiTongueAttack(message)) {
|
||||
if (al::isSensorMapObj(self)) {
|
||||
if (mReactionFrame == 0)
|
||||
al::startAction(this, "Reaction");
|
||||
|
||||
mReactionFrame = 30;
|
||||
}
|
||||
} else if (rs::isMsgCapAttack(message)) {
|
||||
if (al::isSensorMapObj(self) && !al::isNerve(this, &NrvRocketFlower.Wait) &&
|
||||
!al::isNerve(this, &NrvRocketFlower.WaitFollow)) {
|
||||
if (mReactionFrame == 0)
|
||||
al::startAction(this, "Reaction");
|
||||
|
||||
mReactionFrame = 30;
|
||||
}
|
||||
} else if (al::isMsgPlayerPutOnEquipment(message) && al::isSensorName(self, "Equip") &&
|
||||
isEnableEquip()) {
|
||||
if (RocketFlowerFunction::requestEquipRocketFlower(this, other)) {
|
||||
al::setNerve(this, &NrvRocketFlower.Attach);
|
||||
return true;
|
||||
}
|
||||
|
||||
terminateFollow();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RocketFlower::terminateFollow() {
|
||||
al::invalidateHitSensor(this, "Equip");
|
||||
al::validateClipping(this);
|
||||
mFlowerSub->kill();
|
||||
al::startAction(this, "Appear");
|
||||
mReactionFrame = 30;
|
||||
al::startHitReaction(this, "復帰");
|
||||
al::setNerve(this, &NrvRocketFlower.Wait);
|
||||
}
|
||||
|
||||
void RocketFlower::exeWait() {
|
||||
if (al::isFirstStep(this)) {
|
||||
al::startVisAnim(this, "Show");
|
||||
al::invalidateHitSensor(this, "Equip");
|
||||
}
|
||||
}
|
||||
|
||||
void RocketFlower::exeWaitFollow() {
|
||||
if (trySyncFlyingCapPos()) {
|
||||
al::setNerve(this, &NrvRocketFlower.Follow);
|
||||
return;
|
||||
}
|
||||
|
||||
if (al::isGreaterEqualStep(this, 30)) {
|
||||
al::validateClipping(this);
|
||||
al::setNerve(this, &NrvRocketFlower.Wait);
|
||||
}
|
||||
}
|
||||
|
||||
bool RocketFlower::trySyncFlyingCapPos() {
|
||||
sead::Vector3f flyingCapPos;
|
||||
if (!rs::tryGetFlyingCapPos(&flyingCapPos, this))
|
||||
return false;
|
||||
|
||||
flyingCapPos += 50.0f * sead::Vector3f::ey;
|
||||
al::resetPosition(mFlowerSub, flyingCapPos);
|
||||
|
||||
sead::Vector3f toPlayerHead = rs::getPlayerHeadPos(this) - flyingCapPos;
|
||||
if (al::tryNormalizeOrZero(&toPlayerHead)) {
|
||||
sead::Quatf quat;
|
||||
quat.makeVectorRotation(sead::Vector3f::ez, toPlayerHead);
|
||||
al::setQuat(mFlowerSub, quat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RocketFlower::exeFollow() {
|
||||
if (al::isFirstStep(this)) {
|
||||
appearFlowerSub();
|
||||
mFollowLostFrame = 0;
|
||||
}
|
||||
|
||||
if (trySyncFlyingCapPos()) {
|
||||
mFollowLostFrame = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (rs::isEquipCapCatched(this)) {
|
||||
al::validateHitSensor(this, "Equip");
|
||||
al::setNerve(this, &NrvRocketFlower.WaitAttach);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFollowLostFrame >= 16)
|
||||
terminateFollow();
|
||||
|
||||
mFollowLostFrame++;
|
||||
}
|
||||
|
||||
void RocketFlower::appearFlowerSub() {
|
||||
al::startVisAnim(this, "Hide");
|
||||
mFlowerSub->appear();
|
||||
al::startAction(mFlowerSub, "Wait");
|
||||
al::startAction(this, "ReactionCap");
|
||||
mReactionFrame = 30;
|
||||
al::startHitReaction(this, "花が取れた");
|
||||
}
|
||||
|
||||
void RocketFlower::exeWaitAttach() {
|
||||
rs::tryCalcPlayerModelHeadJointPos(al::getTransPtr(mFlowerSub), this);
|
||||
|
||||
if (al::isGreaterEqualStep(this, 20))
|
||||
terminateFollow();
|
||||
}
|
||||
|
||||
void RocketFlower::exeAttach() {
|
||||
if (al::isFirstStep(this))
|
||||
al::startAction(mFlowerSub, "Dash");
|
||||
}
|
||||
|
||||
void RocketFlower::setFollowFlowerPose(const sead::Quatf& quat, const sead::Vector3f& trans) {
|
||||
al::setQuat(mFlowerSub, quat);
|
||||
al::resetPosition(mFlowerSub, trans);
|
||||
}
|
||||
|
||||
void RocketFlower::disappear() {
|
||||
al::startHitReaction(mFlowerSub, "消滅");
|
||||
}
|
||||
|
||||
void RocketFlower::disappearForce() {
|
||||
al::tryKillEmitterAndParticleAll(mFlowerSub);
|
||||
al::invalidateHitSensor(this, "Equip");
|
||||
al::validateClipping(this);
|
||||
mFlowerSub->kill();
|
||||
al::startAction(this, "Wait");
|
||||
mReactionFrame = 30;
|
||||
al::setNerve(this, &NrvRocketFlower.Wait);
|
||||
}
|
||||
|
||||
void RocketFlower::control() {
|
||||
if (al::isActionOneTime(this) && al::isActionEnd(this))
|
||||
al::startAction(this, "Wait");
|
||||
|
||||
if (mReactionFrame != 0)
|
||||
mReactionFrame--;
|
||||
|
||||
if (mMtxConnector)
|
||||
al::connectPoseQT(this, mMtxConnector);
|
||||
}
|
||||
48
src/MapObj/RocketFlower.h
Normal file
48
src/MapObj/RocketFlower.h
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#pragma once
|
||||
|
||||
#include <math/seadQuat.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class HitSensor;
|
||||
class MtxConnector;
|
||||
class SensorMsg;
|
||||
} // namespace al
|
||||
|
||||
class RocketFlower : public al::LiveActor {
|
||||
public:
|
||||
RocketFlower(const char* name);
|
||||
|
||||
void init(const al::ActorInitInfo& info) override;
|
||||
void initAfterPlacement() override;
|
||||
void attackSensor(al::HitSensor* self, al::HitSensor* other) override;
|
||||
bool receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) override;
|
||||
void control() override;
|
||||
|
||||
bool isEnableEquip() const;
|
||||
void terminateFollow();
|
||||
|
||||
void exeWait();
|
||||
void exeWaitFollow();
|
||||
bool trySyncFlyingCapPos();
|
||||
void exeFollow();
|
||||
void appearFlowerSub();
|
||||
void exeWaitAttach();
|
||||
void exeAttach();
|
||||
|
||||
void setFollowFlowerPose(const sead::Quatf& quat, const sead::Vector3f& trans);
|
||||
void disappear();
|
||||
void disappearForce();
|
||||
|
||||
private:
|
||||
al::MtxConnector* mMtxConnector = nullptr;
|
||||
al::LiveActor* mFlowerSub = nullptr;
|
||||
s32 mReactionFrame = 0;
|
||||
u32 mFollowLostFrame = 0;
|
||||
};
|
||||
|
||||
static_assert(sizeof(RocketFlower) == 0x120);
|
||||
17
src/MapObj/RocketFlowerFunction.h
Normal file
17
src/MapObj/RocketFlowerFunction.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class HitSensor;
|
||||
class LiveActor;
|
||||
} // namespace al
|
||||
|
||||
class RocketFlower;
|
||||
|
||||
namespace RocketFlowerFunction {
|
||||
|
||||
void createRocketFlowerEquipWatcherIfNotExist(const al::LiveActor* actor,
|
||||
const al::ActorInitInfo& info);
|
||||
bool requestEquipRocketFlower(RocketFlower* flower, al::HitSensor* sensor);
|
||||
|
||||
} // namespace RocketFlowerFunction
|
||||
|
|
@ -82,18 +82,18 @@ void SmallBirdStateFlyAway::exeFlyAway() {
|
|||
mIsColliding = false;
|
||||
startActionAtRandomFrameIfNotPlaying(mActor, "Fly");
|
||||
if (rs::isModeE3MovieRom()) {
|
||||
gVerticalAccelIndex = al::modi(gVerticalAccelIndex + 7, 6);
|
||||
gVerticalAccelIndex = al::wrapValue(gVerticalAccelIndex + 1, 6);
|
||||
mVerticalAccel = gE3MovieVerticalAccel[gVerticalAccelIndex];
|
||||
gHorizontalAccelIndex = al::modi(gHorizontalAccelIndex + 5, 4);
|
||||
gHorizontalAccelIndex = al::wrapValue(gHorizontalAccelIndex + 1, 4);
|
||||
mHorizontalAccel = gE3MovieHorizontalAccel[gHorizontalAccelIndex];
|
||||
} else {
|
||||
gVerticalAccelIndex = al::modi(gVerticalAccelIndex + 5, 4);
|
||||
gVerticalAccelIndex = al::wrapValue(gVerticalAccelIndex + 1, 4);
|
||||
mVerticalAccel = gVerticalAccel[gVerticalAccelIndex];
|
||||
mHorizontalAccel = gHorizontalAccel;
|
||||
}
|
||||
mTargetAccelDir = {0, mVerticalAccel, mHorizontalAccel};
|
||||
al::normalize(&mTargetAccelDir);
|
||||
gCollisionCheckOffsetStep = al::modi(gCollisionCheckOffsetStep + 11, 10);
|
||||
gCollisionCheckOffsetStep = al::wrapValue(gCollisionCheckOffsetStep + 1, 10);
|
||||
mCollisionCheckOffsetStep = gCollisionCheckOffsetStep;
|
||||
}
|
||||
|
||||
|
|
|
|||
128
src/Npc/TrafficRailWatcher.cpp
Normal file
128
src/Npc/TrafficRailWatcher.cpp
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
#include "Npc/TrafficRailWatcher.h"
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
#include "Library/Placement/PlacementId.h"
|
||||
#include "Library/Placement/PlacementInfo.h"
|
||||
#include "Library/Rail/RailUtil.h"
|
||||
|
||||
TrafficRailWatcher::TrafficRailWatcher(const al::PlacementInfo& placementInfo) {
|
||||
mPlacementId = al::createPlacementId(placementInfo);
|
||||
mActors = new ActorInfo*[32];
|
||||
for (s32 i = 0; i < 32; i++)
|
||||
mActors[i] = nullptr;
|
||||
}
|
||||
|
||||
void TrafficRailWatcher::registerActor(const al::LiveActor* actor) {
|
||||
mActors[mActorCount] = new ActorInfo(actor);
|
||||
mActorCount++;
|
||||
}
|
||||
|
||||
inline TrafficRailWatcher::ActorInfo* getActor(TrafficRailWatcher::ActorInfo** actorList,
|
||||
const al::LiveActor* actor) {
|
||||
// BUG: No bounds checking. Requesting an actor that is not in the actor list will softlock the
|
||||
// thread
|
||||
for (s32 i = 0; true; i++) {
|
||||
TrafficRailWatcher::ActorInfo* info = actorList[i];
|
||||
if (info->actor == actor)
|
||||
return info;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void TrafficRailWatcher::stopByTraffic(const al::LiveActor* actor) {
|
||||
getActor(mActors, actor)->status = ActorStatus::StoppedByTraffic;
|
||||
}
|
||||
|
||||
void TrafficRailWatcher::restartByTraffic(const al::LiveActor* actor) {
|
||||
getActor(mActors, actor)->status = ActorStatus::Normal;
|
||||
}
|
||||
|
||||
bool TrafficRailWatcher::isEqual(const al::PlacementInfo& placementInfo) const {
|
||||
al::PlacementId placementId;
|
||||
al::getPlacementId(&placementId, placementInfo);
|
||||
return al::isEqualPlacementId(*mPlacementId, placementId);
|
||||
}
|
||||
|
||||
bool TrafficRailWatcher::isExist(const al::LiveActor* actor) const {
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (mActors[i]->actor == actor)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Add to sead as a math util
|
||||
inline f32 modLength(f32 value, f32 length) {
|
||||
return al::modf(value + length, length) + 0.0f;
|
||||
}
|
||||
|
||||
bool isNearOnTrafficRail(const al::LiveActor* actor,
|
||||
const TrafficRailWatcher::ActorInfo* otherInfo) {
|
||||
if (otherInfo->status != TrafficRailWatcher::ActorStatus::StoppedByTraffic &&
|
||||
otherInfo->status != TrafficRailWatcher::ActorStatus::StoppedByNpc)
|
||||
return false;
|
||||
|
||||
const al::LiveActor* other = otherInfo->actor;
|
||||
|
||||
if (!al::isRailGoingToEnd(actor) && al::isRailGoingToEnd(other))
|
||||
return false;
|
||||
|
||||
f32 actorCoord = al::getRailCoord(actor);
|
||||
f32 nextRailCoord = modLength(al::getRailCoord(actor) + 150.0f, al::getRailTotalLength(actor));
|
||||
|
||||
f32 startCoord = actorCoord;
|
||||
f32 endCoord = nextRailCoord;
|
||||
if (!al::isRailGoingToEnd(actor)) {
|
||||
// We are going backwards, revert direction
|
||||
endCoord = actorCoord;
|
||||
startCoord = nextRailCoord;
|
||||
}
|
||||
|
||||
if (al::isLoopRail(actor) && endCoord < startCoord) {
|
||||
if (startCoord < al::getRailCoord(other))
|
||||
return true;
|
||||
return al::getRailCoord(other) < endCoord;
|
||||
}
|
||||
|
||||
if (startCoord < al::getRailCoord(other))
|
||||
return al::getRailCoord(other) < endCoord;
|
||||
return false;
|
||||
|
||||
return al::getRailCoord(other) < endCoord;
|
||||
}
|
||||
|
||||
bool TrafficRailWatcher::tryStopByOtherNpc(const al::LiveActor* actor) {
|
||||
ActorInfo* actorInfo = nullptr;
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (mActors[i]->actor == actor) {
|
||||
actorInfo = mActors[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 j = 0; j < mActorCount; j++) {
|
||||
if (mActors[j] != actorInfo && isNearOnTrafficRail(actor, mActors[j])) {
|
||||
actorInfo->status = ActorStatus::StoppedByNpc;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TrafficRailWatcher::tryRestartByOtherNpc(const al::LiveActor* actor) {
|
||||
ActorInfo* actorInfo = nullptr;
|
||||
for (s32 i = 0; i < mActorCount; i++) {
|
||||
if (mActors[i]->actor == actor) {
|
||||
actorInfo = mActors[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < mActorCount; i++)
|
||||
if (mActors[i] != actorInfo && isNearOnTrafficRail(actor, mActors[i]))
|
||||
return false;
|
||||
|
||||
actorInfo->status = ActorStatus::Normal;
|
||||
return true;
|
||||
}
|
||||
41
src/Npc/TrafficRailWatcher.h
Normal file
41
src/Npc/TrafficRailWatcher.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
namespace al {
|
||||
class LiveActor;
|
||||
class PlacementId;
|
||||
class PlacementInfo;
|
||||
} // namespace al
|
||||
|
||||
class TrafficRailWatcher {
|
||||
public:
|
||||
enum class ActorStatus { Normal, StoppedByTraffic, StoppedByNpc };
|
||||
|
||||
struct ActorInfo {
|
||||
ActorInfo(const al::LiveActor* liveActor) {
|
||||
actor = liveActor;
|
||||
status = ActorStatus::Normal;
|
||||
}
|
||||
|
||||
const al::LiveActor* actor;
|
||||
ActorStatus status;
|
||||
};
|
||||
|
||||
TrafficRailWatcher(const al::PlacementInfo& placementInfo);
|
||||
|
||||
void registerActor(const al::LiveActor* actor);
|
||||
void stopByTraffic(const al::LiveActor* actor);
|
||||
void restartByTraffic(const al::LiveActor* actor);
|
||||
bool isEqual(const al::PlacementInfo& placementInfo) const;
|
||||
bool isExist(const al::LiveActor* actor) const;
|
||||
bool tryStopByOtherNpc(const al::LiveActor* actor);
|
||||
bool tryRestartByOtherNpc(const al::LiveActor* actor);
|
||||
|
||||
private:
|
||||
al::PlacementId* mPlacementId = nullptr;
|
||||
s32 mActorCount = 0;
|
||||
ActorInfo** mActors = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TrafficRailWatcher) == 0x18);
|
||||
|
|
@ -69,6 +69,7 @@
|
|||
#include "MapObj/AllDeadWatcherWithShine.h"
|
||||
#include "MapObj/AnagramAlphabet.h"
|
||||
#include "MapObj/BlockEmpty2D.h"
|
||||
#include "MapObj/BossKnuckleFix.h"
|
||||
#include "MapObj/CapBomb.h"
|
||||
#include "MapObj/CapHanger.h"
|
||||
#include "MapObj/CapSwitch.h"
|
||||
|
|
@ -87,12 +88,14 @@
|
|||
#include "MapObj/LavaPan.h"
|
||||
#include "MapObj/MeganeMapParts.h"
|
||||
#include "MapObj/MoonBasementBreakParts.h"
|
||||
#include "MapObj/MoonBasementFloor.h"
|
||||
#include "MapObj/MoonBasementSlideObj.h"
|
||||
#include "MapObj/MoonWorldCaptureParadeLift.h"
|
||||
#include "MapObj/PeachWorldTree.h"
|
||||
#include "MapObj/PoleGrabCeil.h"
|
||||
#include "MapObj/ReactionMapParts.h"
|
||||
#include "MapObj/RiseMapPartsHolder.h"
|
||||
#include "MapObj/RocketFlower.h"
|
||||
#include "MapObj/RouletteSwitch.h"
|
||||
#include "MapObj/SaveFlagCheckObj.h"
|
||||
#include "MapObj/ShineTowerRocket.h"
|
||||
|
|
@ -164,7 +167,7 @@ const al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
|
|||
{"BossForestWander", al::createActorFunction<BossForestWander>},
|
||||
{"BossKnuckle", nullptr},
|
||||
{"BossKnuckleCounterGround", nullptr},
|
||||
{"BossKnuckleFix", nullptr},
|
||||
{"BossKnuckleFix", al::createActorFunction<BossKnuckleFix>},
|
||||
{"BossMagma", nullptr},
|
||||
{"BossRaid", nullptr},
|
||||
{"BossRaidNpc", nullptr},
|
||||
|
|
@ -411,7 +414,7 @@ const al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
|
|||
{"MoonBasementFallObj", nullptr},
|
||||
{"MoonBasementFinalGate", nullptr},
|
||||
{"MoonBasementFallObjDecoration", nullptr},
|
||||
{"MoonBasementFloor", nullptr},
|
||||
{"MoonBasementFloor", al::createActorFunction<MoonBasementFloor>},
|
||||
{"MoonBasementGate", nullptr},
|
||||
{"MoonBasementMeteorAreaObj", nullptr},
|
||||
{"MoonBasementPillar", nullptr},
|
||||
|
|
@ -670,7 +673,7 @@ const al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
|
|||
{"RiseMapParts", nullptr},
|
||||
{"ReactionMapParts", al::createActorFunction<ReactionMapParts>},
|
||||
{"RiseMapPartsHolder", al::createActorFunction<RiseMapPartsHolder>},
|
||||
{"RocketFlower", nullptr},
|
||||
{"RocketFlower", al::createActorFunction<RocketFlower>},
|
||||
{"RollingCubeMapParts", al::createActorFunction<al::RollingCubeMapParts>},
|
||||
{"RippleFixMapParts", nullptr},
|
||||
{"RotateMapParts", al::createActorFunction<al::RotateMapParts>},
|
||||
|
|
|
|||
Loading…
Reference in a new issue