mirror of
https://github.com/MonsterDruide1/OdysseyDecomp.git
synced 2024-11-26 23:00:25 +00:00
Library/MapObj: Implement RollingCubeMapParts
(#194)
Some checks failed
Compile and verify functions / compile_verify (push) Has been cancelled
Copy headers to separate repo / copy_headers (push) Has been cancelled
lint / clang-format (push) Has been cancelled
lint / custom-lint (push) Has been cancelled
progress / publish_progress (push) Has been cancelled
testcompile / test_compile (push) Has been cancelled
Some checks failed
Compile and verify functions / compile_verify (push) Has been cancelled
Copy headers to separate repo / copy_headers (push) Has been cancelled
lint / clang-format (push) Has been cancelled
lint / custom-lint (push) Has been cancelled
progress / publish_progress (push) Has been cancelled
testcompile / test_compile (push) Has been cancelled
This commit is contained in:
parent
b93bfe231e
commit
ba93c13e20
@ -30472,7 +30472,7 @@ Address,Quality,Size,Name
|
||||
0x00000071004bd118,U,000052,_ZN2al19createActorFunctionI16ReactionMapPartsEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd14c,U,000052,_ZN2al19createActorFunctionI18RiseMapPartsHolderEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd180,U,000052,_ZN2al19createActorFunctionI12RocketFlowerEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd1b4,U,000052,_ZN2al19createActorFunctionINS_19RollingCubeMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd1b4,O,000052,_ZN2al19createActorFunctionINS_19RollingCubeMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd1e8,U,000052,_ZN2al19createActorFunctionINS_14RotateMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd21c,U,000052,_ZN2al19createActorFunctionINS_14SeesawMapPartsEEEPNS_9LiveActorEPKc
|
||||
0x00000071004bd250,U,000052,_ZN2al19createActorFunctionINS_13SlideMapPartsEEEPNS_9LiveActorEPKc
|
||||
@ -58365,58 +58365,58 @@ Address,Quality,Size,Name
|
||||
0x0000007100916b5c,U,000076,_ZNK2al10FunctorV0MIPNS_16RailMoveMapPartsEMS1_FvvEE5cloneEv
|
||||
0x0000007100916ba8,U,000004,_ZN2al10FunctorV0MIPNS_16RailMoveMapPartsEMS1_FvvEED0Ev
|
||||
0x0000007100916bac,U,000116,
|
||||
0x0000007100916c20,U,000264,_ZN2al19RollingCubeMapPartsC2EPKc
|
||||
0x0000007100916d28,U,000276,_ZN2al19RollingCubeMapPartsC1EPKc
|
||||
0x0000007100916e3c,U,000896,_ZN2al19RollingCubeMapParts4initERKNS_13ActorInitInfoE
|
||||
0x00000071009171bc,U,000044,_ZN2al19RollingCubeMapParts4killEv
|
||||
0x00000071009171e8,U,000088,_ZN2al19RollingCubeMapParts10receiveMsgEPKNS_9SensorMsgEPNS_9HitSensorES5_
|
||||
0x0000007100917240,U,000272,_ZN2al19RollingCubeMapParts7controlEv
|
||||
0x0000007100917350,U,000128,_ZN2al19RollingCubeMapParts17appearAndSetStartEv
|
||||
0x00000071009173d0,U,000184,_ZN2al19RollingCubeMapParts20setNerveNextMovementEb
|
||||
0x0000007100917488,U,000060,_ZNK2al19RollingCubeMapParts13isNextFallKeyEv
|
||||
0x00000071009174c4,U,000004,_ZN2al19RollingCubeMapParts7exeWaitEv
|
||||
0x00000071009174c8,U,000084,_ZN2al19RollingCubeMapParts8exeStartEv
|
||||
0x000000710091751c,U,000528,_ZN2al19RollingCubeMapParts9exeRotateEv
|
||||
0x000000710091772c,U,000064,_ZNK2al19RollingCubeMapParts15getMovementTimeEv
|
||||
0x000000710091776c,U,000136,_ZN2al19RollingCubeMapParts16setNerveNextLandEv
|
||||
0x00000071009177f4,U,000252,_ZN2al19RollingCubeMapParts8exeSlideEv
|
||||
0x00000071009178f0,U,000316,_ZN2al19RollingCubeMapParts11updateSlideEv
|
||||
0x0000007100917a2c,U,000252,_ZN2al19RollingCubeMapParts7exeFallEv
|
||||
0x0000007100917b28,U,000136,_ZN2al19RollingCubeMapParts20setNerveNextFallLandEv
|
||||
0x0000007100917bb0,U,000096,_ZN2al19RollingCubeMapParts7exeLandEv
|
||||
0x0000007100917c10,U,000064,_ZNK2al19RollingCubeMapParts11getLandTimeEv
|
||||
0x0000007100917c50,U,000092,_ZN2al19RollingCubeMapParts11exeFallLandEv
|
||||
0x0000007100917cac,U,000136,_ZN2al19RollingCubeMapParts7exeStopEv
|
||||
0x0000007100917d34,U,000016,_ZNK2al19RollingCubeMapParts6isStopEv
|
||||
0x0000007100917d44,U,000004,
|
||||
0x0000007100917d48,U,000012,
|
||||
0x0000007100917d54,U,000088,
|
||||
0x0000007100917dac,U,000012,
|
||||
0x0000007100917db8,U,000008,
|
||||
0x0000007100917dc0,U,000012,
|
||||
0x0000007100917dcc,U,000008,
|
||||
0x0000007100917dd4,U,000012,
|
||||
0x0000007100917de0,U,000008,
|
||||
0x0000007100917de8,U,000012,
|
||||
0x0000007100917df4,U,000008,
|
||||
0x0000007100917dfc,U,000012,
|
||||
0x0000007100917e08,U,000008,
|
||||
0x0000007100917e10,U,000012,
|
||||
0x0000007100917e1c,U,000096,
|
||||
0x0000007100917e7c,U,000012,
|
||||
0x0000007100917e88,U,000096,
|
||||
0x0000007100917ee8,U,000012,
|
||||
0x0000007100917ef4,U,000096,
|
||||
0x0000007100917f54,U,000012,
|
||||
0x0000007100917f60,U,000092,
|
||||
0x0000007100917fbc,U,000012,
|
||||
0x0000007100917fc8,U,000092,
|
||||
0x0000007100918024,U,000012,
|
||||
0x0000007100918030,U,000092,
|
||||
0x000000710091808c,U,000012,
|
||||
0x0000007100918098,U,000136,
|
||||
0x0000007100918120,U,000012,
|
||||
0x000000710091812c,U,000380,
|
||||
0x0000007100916c20,O,000264,_ZN2al19RollingCubeMapPartsC2EPKc
|
||||
0x0000007100916d28,O,000276,_ZN2al19RollingCubeMapPartsC1EPKc
|
||||
0x0000007100916e3c,O,000896,_ZN2al19RollingCubeMapParts4initERKNS_13ActorInitInfoE
|
||||
0x00000071009171bc,O,000044,_ZN2al19RollingCubeMapParts4killEv
|
||||
0x00000071009171e8,O,000088,_ZN2al19RollingCubeMapParts10receiveMsgEPKNS_9SensorMsgEPNS_9HitSensorES5_
|
||||
0x0000007100917240,O,000272,_ZN2al19RollingCubeMapParts7controlEv
|
||||
0x0000007100917350,O,000128,_ZN2al19RollingCubeMapParts17appearAndSetStartEv
|
||||
0x00000071009173d0,O,000184,_ZN2al19RollingCubeMapParts20setNerveNextMovementEb
|
||||
0x0000007100917488,O,000060,_ZNK2al19RollingCubeMapParts13isNextFallKeyEv
|
||||
0x00000071009174c4,O,000004,_ZN2al19RollingCubeMapParts7exeWaitEv
|
||||
0x00000071009174c8,O,000084,_ZN2al19RollingCubeMapParts8exeStartEv
|
||||
0x000000710091751c,O,000528,_ZN2al19RollingCubeMapParts9exeRotateEv
|
||||
0x000000710091772c,O,000064,_ZNK2al19RollingCubeMapParts15getMovementTimeEv
|
||||
0x000000710091776c,O,000136,_ZN2al19RollingCubeMapParts16setNerveNextLandEv
|
||||
0x00000071009177f4,O,000252,_ZN2al19RollingCubeMapParts8exeSlideEv
|
||||
0x00000071009178f0,O,000316,_ZN2al19RollingCubeMapParts11updateSlideEv
|
||||
0x0000007100917a2c,O,000252,_ZN2al19RollingCubeMapParts7exeFallEv
|
||||
0x0000007100917b28,O,000136,_ZN2al19RollingCubeMapParts20setNerveNextFallLandEv
|
||||
0x0000007100917bb0,O,000096,_ZN2al19RollingCubeMapParts7exeLandEv
|
||||
0x0000007100917c10,O,000064,_ZNK2al19RollingCubeMapParts11getLandTimeEv
|
||||
0x0000007100917c50,O,000092,_ZN2al19RollingCubeMapParts11exeFallLandEv
|
||||
0x0000007100917cac,O,000136,_ZN2al19RollingCubeMapParts7exeStopEv
|
||||
0x0000007100917d34,O,000016,_ZNK2al19RollingCubeMapParts6isStopEv
|
||||
0x0000007100917d44,O,000004,_ZNK12_GLOBAL__N_126RollingCubeMapPartsNrvWait7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917d48,O,000012,_ZNK12_GLOBAL__N_126RollingCubeMapPartsNrvWait13getActionNameEv
|
||||
0x0000007100917d54,O,000088,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvStart7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917dac,O,000012,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvStart13getActionNameEv
|
||||
0x0000007100917db8,O,000008,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvRotate7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917dc0,O,000012,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvRotate13getActionNameEv
|
||||
0x0000007100917dcc,O,000008,_ZNK12_GLOBAL__N_126RollingCubeMapPartsNrvFall7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917dd4,O,000012,_ZNK12_GLOBAL__N_126RollingCubeMapPartsNrvFall13getActionNameEv
|
||||
0x0000007100917de0,O,000008,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvSlideX7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917de8,O,000012,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvSlideX13getActionNameEv
|
||||
0x0000007100917df4,O,000008,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvSlideY7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917dfc,O,000012,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvSlideY13getActionNameEv
|
||||
0x0000007100917e08,O,000008,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvSlideZ7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917e10,O,000012,_ZNK12_GLOBAL__N_128RollingCubeMapPartsNrvSlideZ13getActionNameEv
|
||||
0x0000007100917e1c,O,000096,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvLandX7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917e7c,O,000012,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvLandX13getActionNameEv
|
||||
0x0000007100917e88,O,000096,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvLandY7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917ee8,O,000012,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvLandY13getActionNameEv
|
||||
0x0000007100917ef4,O,000096,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvLandZ7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917f54,O,000012,_ZNK12_GLOBAL__N_127RollingCubeMapPartsNrvLandZ13getActionNameEv
|
||||
0x0000007100917f60,O,000092,_ZNK12_GLOBAL__N_131RollingCubeMapPartsNrvFallLandX7executeEPN2al11NerveKeeperE
|
||||
0x0000007100917fbc,O,000012,_ZNK12_GLOBAL__N_131RollingCubeMapPartsNrvFallLandX13getActionNameEv
|
||||
0x0000007100917fc8,O,000092,_ZNK12_GLOBAL__N_131RollingCubeMapPartsNrvFallLandY7executeEPN2al11NerveKeeperE
|
||||
0x0000007100918024,O,000012,_ZNK12_GLOBAL__N_131RollingCubeMapPartsNrvFallLandY13getActionNameEv
|
||||
0x0000007100918030,O,000092,_ZNK12_GLOBAL__N_131RollingCubeMapPartsNrvFallLandZ7executeEPN2al11NerveKeeperE
|
||||
0x000000710091808c,O,000012,_ZNK12_GLOBAL__N_131RollingCubeMapPartsNrvFallLandZ13getActionNameEv
|
||||
0x0000007100918098,O,000136,_ZNK12_GLOBAL__N_126RollingCubeMapPartsNrvStop7executeEPN2al11NerveKeeperE
|
||||
0x0000007100918120,O,000012,_ZNK12_GLOBAL__N_126RollingCubeMapPartsNrvStop13getActionNameEv
|
||||
0x000000710091812c,O,000380,_GLOBAL__sub_I_RollingCubeMapParts.cpp
|
||||
0x00000071009182a8,U,000160,_ZN2al14RotateMapPartsC2EPKc
|
||||
0x0000007100918348,U,000172,_ZN2al14RotateMapPartsC1EPKc
|
||||
0x00000071009183f4,U,000276,_ZN2al14RotateMapParts4initERKNS_13ActorInitInfoE
|
||||
|
Can't render this file because it is too large.
|
@ -12,6 +12,7 @@ class LiveActor;
|
||||
class Resource;
|
||||
class HitSensor;
|
||||
class ActorInitInfo;
|
||||
class PlacementInfo;
|
||||
class Nerve;
|
||||
|
||||
bool trySyncStageSwitchAppear(LiveActor* actor);
|
||||
@ -42,4 +43,8 @@ void initMapPartsActorWithArchiveName(LiveActor* actor, const ActorInitInfo& inf
|
||||
bool trySyncStageSwitchKill(LiveActor* actor);
|
||||
void initLinksActor(LiveActor* actor, const ActorInitInfo& info, const char* linkName, s32 linkNum);
|
||||
void initMaterialCode(LiveActor* actor, const ActorInitInfo& info);
|
||||
void makeMapPartsModelName(sead::BufferedSafeString*, sead::BufferedSafeString*,
|
||||
const PlacementInfo& info);
|
||||
void makeMapPartsModelName(sead::BufferedSafeString*, sead::BufferedSafeString*,
|
||||
const ActorInitInfo& info);
|
||||
} // namespace al
|
||||
|
320
lib/al/Library/MapObj/RollingCubeMapParts.cpp
Normal file
320
lib/al/Library/MapObj/RollingCubeMapParts.cpp
Normal file
@ -0,0 +1,320 @@
|
||||
#include "Library/MapObj/RollingCubeMapParts.h"
|
||||
|
||||
#include "Library/Effect/EffectSystemInfo.h"
|
||||
#include "Library/LiveActor/ActorActionFunction.h"
|
||||
#include "Library/LiveActor/ActorClippingFunction.h"
|
||||
#include "Library/LiveActor/ActorInitFunction.h"
|
||||
#include "Library/LiveActor/ActorMovementFunction.h"
|
||||
#include "Library/LiveActor/ActorPoseKeeper.h"
|
||||
#include "Library/LiveActor/ActorResourceFunction.h"
|
||||
#include "Library/LiveActor/ActorSensorMsgFunction.h"
|
||||
#include "Library/Math/MathAngleUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Obj/PartsModel.h"
|
||||
#include "Library/Placement/PlacementFunction.h"
|
||||
#include "Library/Yaml/ByamlIter.h"
|
||||
#include "Library/Yaml/ByamlUtil.h"
|
||||
#include "Project/Joint/RollingCubePoseKeeper.h"
|
||||
|
||||
namespace {
|
||||
using namespace al;
|
||||
|
||||
NERVE_ACTION_IMPL(RollingCubeMapParts, Wait)
|
||||
NERVE_ACTION_IMPL(RollingCubeMapParts, Start)
|
||||
NERVE_ACTION_IMPL(RollingCubeMapParts, Rotate)
|
||||
NERVE_ACTION_IMPL(RollingCubeMapParts, Fall)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, SlideX, Slide)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, SlideY, Slide)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, SlideZ, Slide)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, LandX, Land)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, LandY, Land)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, LandZ, Land)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, FallLandX, FallLand)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, FallLandY, FallLand)
|
||||
NERVE_ACTION_IMPL_(RollingCubeMapParts, FallLandZ, FallLand)
|
||||
NERVE_ACTION_IMPL(RollingCubeMapParts, Stop)
|
||||
|
||||
NERVE_ACTIONS_MAKE_STRUCT(RollingCubeMapParts, Wait, Start, Rotate, Fall, SlideX, SlideY, SlideZ,
|
||||
LandX, LandY, LandZ, FallLandX, FallLandY, FallLandZ, Stop)
|
||||
} // namespace
|
||||
|
||||
namespace al {
|
||||
RollingCubeMapParts::RollingCubeMapParts(const char* name) : LiveActor(name) {}
|
||||
|
||||
void RollingCubeMapParts::init(const ActorInitInfo& info) {
|
||||
initNerveAction(this, "Wait", &NrvRollingCubeMapParts.mCollector, 0);
|
||||
initMapPartsActor(this, info, nullptr);
|
||||
tryGetQuatPtr(this);
|
||||
|
||||
mInitialPoseQuat = getQuat(this);
|
||||
mInitialPoseTrans = getTrans(this);
|
||||
|
||||
bool isUseMoveLimit = false;
|
||||
tryGetArg(&isUseMoveLimit, info, "IsUseMoveLimit");
|
||||
if (isUseMoveLimit) {
|
||||
mMoveLimitMtx = new sead::Matrix34f();
|
||||
mMoveLimitMtx->makeQT(mInitialPoseQuat, mInitialPoseTrans);
|
||||
|
||||
mMoveLimitPartsModel = new PartsModel("");
|
||||
sead::FixedSafeString<256> model;
|
||||
sead::FixedSafeString<256> archive;
|
||||
makeMapPartsModelName(&model, &archive, info);
|
||||
mMoveLimitPartsModel->initPartsSuffix(this, info, model.cstr(), "MoveLimit", mMoveLimitMtx,
|
||||
false);
|
||||
}
|
||||
|
||||
sead::BoundBox3f boundBox;
|
||||
if (isExistModelResourceYaml(this, "BoxInfo", nullptr) &&
|
||||
tryGetByamlBox3f(&boundBox, ByamlIter(getModelResourceYaml(this, "BoxInfo", nullptr))))
|
||||
mRollingCubePoseKeeper = createRollingCubePoseKeeper(boundBox, info);
|
||||
else
|
||||
mRollingCubePoseKeeper = createRollingCubePoseKeeper(this, info);
|
||||
|
||||
bool isFloorTouchStart = true;
|
||||
tryGetArg(&isFloorTouchStart, info, "IsFloorTouchStart");
|
||||
if (!isFloorTouchStart)
|
||||
startNerveAction(this, "Start");
|
||||
|
||||
trySetEffectNamedMtxPtr(this, "Land", &mLandEffectMtx);
|
||||
initMaterialCode(this, info);
|
||||
|
||||
f32 clippingRadius = 0.0f;
|
||||
calcRollingCubeClippingInfo(&mClippingTrans, &clippingRadius, mRollingCubePoseKeeper, 0.0f);
|
||||
setClippingInfo(this, clippingRadius, &mClippingTrans);
|
||||
|
||||
tryListenStageSwitchKill(this);
|
||||
makeActorAlive();
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::kill() {
|
||||
startHitReaction(this, "消滅");
|
||||
|
||||
LiveActor::kill();
|
||||
}
|
||||
|
||||
bool RollingCubeMapParts::receiveMsg(const SensorMsg* message, HitSensor* source,
|
||||
HitSensor* target) {
|
||||
if (isMsgPlayerFloorTouch(message) && isNerve(this, NrvRollingCubeMapParts.Wait.data())) {
|
||||
startNerveAction(this, "Start");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::control() {
|
||||
if (mMoveLimitMtx != nullptr)
|
||||
mMoveLimitMtx->makeQT(mInitialPoseQuat, getTrans(this));
|
||||
|
||||
calcMtxLandEffect(&mLandEffectMtx, mRollingCubePoseKeeper, getQuat(this), getTrans(this));
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::appearAndSetStart() {
|
||||
mRollingCubePoseKeeper->setStart();
|
||||
setQuat(this, mInitialPoseQuat);
|
||||
setTrans(this, mInitialPoseTrans);
|
||||
resetPosition(this);
|
||||
setNerveNextMovement(isNextFallKey());
|
||||
|
||||
appear();
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::setNerveNextMovement(bool isNextFallKey) {
|
||||
if (isMovementCurrentKeyRotate(mRollingCubePoseKeeper)) {
|
||||
startNerveAction(this, "Rotate");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (isNextFallKey) {
|
||||
startNerveAction(this, "Fall");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
s32 axis = sead::Mathi::abs(calcNearVecFromAxis3(nullptr, sead::Vector3f::ey, getQuat(this)));
|
||||
switch (axis) {
|
||||
default:
|
||||
return;
|
||||
case 1:
|
||||
startNerveAction(this, "SlideX");
|
||||
|
||||
return;
|
||||
case 2:
|
||||
startNerveAction(this, "SlideY");
|
||||
|
||||
return;
|
||||
case 3:
|
||||
startNerveAction(this, "SlideZ");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool RollingCubeMapParts::isNextFallKey() const {
|
||||
bool isNextFall = false;
|
||||
tryGetArg(&isNextFall, getCurrentKeyPlacementInfo(mRollingCubePoseKeeper), "isNextFall");
|
||||
|
||||
return isNextFall;
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeWait() {}
|
||||
|
||||
void RollingCubeMapParts::exeStart() {
|
||||
if (isGreaterEqualStep(this, 40))
|
||||
setNerveNextMovement(isNextFallKey());
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeRotate() {
|
||||
if (isFirstStep(this)) {
|
||||
fittingToCurrentKeyBoundingBox(getQuatPtr(this), getTransPtr(this), mRollingCubePoseKeeper);
|
||||
mCurrentPoseQuat = getQuat(this);
|
||||
mCurrentPoseTrans = getTrans(this);
|
||||
mMovementTime = getMovementTime() - 1;
|
||||
}
|
||||
|
||||
calcCurrentKeyQT(getQuatPtr(this), getTransPtr(this), mRollingCubePoseKeeper, mCurrentPoseQuat,
|
||||
mCurrentPoseTrans, calcNerveSquareInRate(this, mMovementTime));
|
||||
|
||||
if (isGreaterEqualStep(this, mMovementTime)) {
|
||||
if (nextRollingCubeKey(mRollingCubePoseKeeper)) {
|
||||
if (!isNextFallKey())
|
||||
setNerveNextLand();
|
||||
else if (isMovementCurrentKeyRotate(mRollingCubePoseKeeper))
|
||||
startNerveAction(this, "Rotate");
|
||||
else
|
||||
startNerveAction(this, "Fall");
|
||||
} else {
|
||||
startNerveAction(this, "Stop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 RollingCubeMapParts::getMovementTime() const {
|
||||
s32 movementTime = 40;
|
||||
tryGetArg(&movementTime, getCurrentKeyPlacementInfo(mRollingCubePoseKeeper), "MovementTime");
|
||||
|
||||
return movementTime;
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::setNerveNextLand() {
|
||||
s32 axis = sead::Mathi::abs(calcNearVecFromAxis3(nullptr, sead::Vector3f::ey, getQuat(this)));
|
||||
switch (axis) {
|
||||
default:
|
||||
return;
|
||||
case 1:
|
||||
startNerveAction(this, "LandX");
|
||||
|
||||
return;
|
||||
case 2:
|
||||
startNerveAction(this, "LandY");
|
||||
|
||||
return;
|
||||
case 3:
|
||||
startNerveAction(this, "LandZ");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeSlide() {
|
||||
if (updateSlide()) {
|
||||
if (nextRollingCubeKey(mRollingCubePoseKeeper)) {
|
||||
if (!isNextFallKey())
|
||||
setNerveNextLand();
|
||||
else if (isMovementCurrentKeyRotate(mRollingCubePoseKeeper))
|
||||
startNerveAction(this, "Rotate");
|
||||
else
|
||||
startNerveAction(this, "Fall");
|
||||
} else {
|
||||
startNerveAction(this, "Stop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool RollingCubeMapParts::updateSlide() {
|
||||
if (isFirstStep(this)) {
|
||||
fittingToCurrentKeyBoundingBox(getQuatPtr(this), getTransPtr(this), mRollingCubePoseKeeper);
|
||||
mCurrentPoseQuat = getQuat(this);
|
||||
mCurrentPoseTrans = getTrans(this);
|
||||
mMovementTime = getMovementTime() - 1;
|
||||
}
|
||||
|
||||
calcCurrentKeyQT(getQuatPtr(this), getTransPtr(this), mRollingCubePoseKeeper, mCurrentPoseQuat,
|
||||
mCurrentPoseTrans, calcNerveSquareInRate(this, mMovementTime));
|
||||
|
||||
return isGreaterEqualStep(this, mMovementTime);
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeFall() {
|
||||
if (updateSlide()) {
|
||||
if (nextRollingCubeKey(mRollingCubePoseKeeper)) {
|
||||
if (!isNextFallKey())
|
||||
setNerveNextFallLand();
|
||||
else if (isMovementCurrentKeyRotate(mRollingCubePoseKeeper))
|
||||
startNerveAction(this, "Rotate");
|
||||
else
|
||||
startNerveAction(this, "Fall");
|
||||
} else {
|
||||
startNerveAction(this, "Stop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::setNerveNextFallLand() {
|
||||
s32 axis = sead::Mathi::abs(calcNearVecFromAxis3(nullptr, sead::Vector3f::ey, getQuat(this)));
|
||||
switch (axis) {
|
||||
default:
|
||||
return;
|
||||
case 1:
|
||||
startNerveAction(this, "FallLandX");
|
||||
|
||||
return;
|
||||
case 2:
|
||||
startNerveAction(this, "FallLandY");
|
||||
|
||||
return;
|
||||
case 3:
|
||||
startNerveAction(this, "FallLandZ");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeLand() {
|
||||
if (isGreaterEqualStep(this, getLandTime() - 1))
|
||||
setNerveNextMovement(false);
|
||||
}
|
||||
|
||||
s32 RollingCubeMapParts::getLandTime() const {
|
||||
s32 landTime = 40;
|
||||
tryGetArg(&landTime, getCurrentKeyPlacementInfo(mRollingCubePoseKeeper), "LandTime");
|
||||
|
||||
return landTime;
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeFallLand() {
|
||||
if (isGreaterEqualStep(this, getLandTime()))
|
||||
setNerveNextMovement(false);
|
||||
}
|
||||
|
||||
void RollingCubeMapParts::exeStop() {
|
||||
if (mIsStoppable) {
|
||||
if (isFirstStep(this))
|
||||
startHitReaction(this, "消滅");
|
||||
|
||||
if (isStep(this, 1)) {
|
||||
setQuat(this, mInitialPoseQuat);
|
||||
setTrans(this, mInitialPoseTrans);
|
||||
resetPosition(this);
|
||||
|
||||
makeActorDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool RollingCubeMapParts::isStop() const {
|
||||
return isNerve(this, NrvRollingCubeMapParts.Stop.data());
|
||||
}
|
||||
} // namespace al
|
50
lib/al/Library/MapObj/RollingCubeMapParts.h
Normal file
50
lib/al/Library/MapObj/RollingCubeMapParts.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
|
||||
namespace al {
|
||||
class RollingCubePoseKeeper;
|
||||
class PartsModel;
|
||||
|
||||
class RollingCubeMapParts : public LiveActor {
|
||||
public:
|
||||
RollingCubeMapParts(const char* name);
|
||||
|
||||
void init(const ActorInitInfo& info) override;
|
||||
void kill() override;
|
||||
bool receiveMsg(const SensorMsg* message, HitSensor* source, HitSensor* target) override;
|
||||
void control() override;
|
||||
void appearAndSetStart();
|
||||
void setNerveNextMovement(bool isNextFallKey);
|
||||
bool isNextFallKey() const;
|
||||
void exeWait();
|
||||
void exeStart();
|
||||
void exeRotate();
|
||||
s32 getMovementTime() const;
|
||||
void setNerveNextLand();
|
||||
void exeSlide();
|
||||
bool updateSlide();
|
||||
void exeFall();
|
||||
void setNerveNextFallLand();
|
||||
void exeLand();
|
||||
s32 getLandTime() const;
|
||||
void exeFallLand();
|
||||
void exeStop();
|
||||
bool isStop() const;
|
||||
|
||||
private:
|
||||
RollingCubePoseKeeper* mRollingCubePoseKeeper = nullptr;
|
||||
sead::Matrix34f* mMoveLimitMtx = nullptr;
|
||||
PartsModel* mMoveLimitPartsModel = nullptr;
|
||||
sead::Matrix34f mLandEffectMtx = sead::Matrix34f::ident;
|
||||
sead::Quatf mInitialPoseQuat = sead::Quatf::unit;
|
||||
sead::Vector3f mInitialPoseTrans = sead::Vector3f::zero;
|
||||
sead::Quatf mCurrentPoseQuat = sead::Quatf::unit;
|
||||
sead::Vector3f mCurrentPoseTrans = sead::Vector3f::zero;
|
||||
sead::Vector3f mClippingTrans = sead::Vector3f::zero;
|
||||
s32 mMovementTime = 0;
|
||||
bool mIsStoppable = false;
|
||||
};
|
||||
|
||||
static_assert(sizeof(RollingCubeMapParts) == 0x1a0);
|
||||
} // namespace al
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <math/seadQuat.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
namespace al {
|
||||
@ -42,4 +43,7 @@ bool tryNormalizeOrZero(sead::Vector3f*);
|
||||
void alongVectorNormalH(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&,
|
||||
const sead::Vector3f&);
|
||||
|
||||
s32 calcNearVecFromAxis3(sead::Vector3f*, const sead::Vector3f&, const sead::Vector3f&,
|
||||
const sead::Vector3f&, const sead::Vector3f&);
|
||||
s32 calcNearVecFromAxis3(sead::Vector3f*, const sead::Vector3f&, const sead::Quatf&);
|
||||
} // namespace al
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "Library/LiveActor/SubActorFunction.h"
|
||||
#include "Library/LiveActor/SubActorKeeper.h"
|
||||
#include "Library/Math/MathAngleUtil.h"
|
||||
#include "Library/Math/MathLengthUtil.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Matrix/MatrixUtil.h"
|
||||
#include "Library/Yaml/ByamlUtil.h"
|
||||
|
54
lib/al/Project/Joint/RollingCubePoseKeeper.h
Normal file
54
lib/al/Project/Joint/RollingCubePoseKeeper.h
Normal file
@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include <math/seadBoundBox.h>
|
||||
#include <math/seadMatrix.h>
|
||||
#include <math/seadQuat.h>
|
||||
|
||||
namespace al {
|
||||
class RollingCubePose;
|
||||
class PlacementInfo;
|
||||
class LiveActor;
|
||||
class ActorInitInfo;
|
||||
|
||||
// TODO: Complete RollingCubePoseKeeper
|
||||
class RollingCubePoseKeeper {
|
||||
public:
|
||||
RollingCubePoseKeeper();
|
||||
|
||||
void setCubeSize(const sead::BoundBox3f& cubeSize);
|
||||
bool isMoveTypeTurn() const;
|
||||
bool isMoveTypeLoop() const;
|
||||
void init(const ActorInitInfo& info);
|
||||
bool nextKey();
|
||||
void setStart();
|
||||
void setKeyIndex(s32 index);
|
||||
RollingCubePose* getCurrentPose() const;
|
||||
RollingCubePose* getPose(s32 index) const;
|
||||
void calcBoundingBoxCenter(sead::Vector3f*, const sead::Quatf&, const sead::Vector3f&) const;
|
||||
|
||||
private:
|
||||
RollingCubePose** mRollingCubePoses;
|
||||
s32 mRollingCubePoseCount;
|
||||
s32 mCurrentKey;
|
||||
sead::BoundBox3f mCubeSize;
|
||||
u32 mMoveType;
|
||||
};
|
||||
|
||||
void fittingToCurrentKeyBoundingBox(sead::Quatf* quat, sead::Vector3f* trans,
|
||||
const RollingCubePoseKeeper* rollingCubePoseKeeper);
|
||||
void calcCurrentKeyQT(sead::Quatf* outQuat, sead::Vector3f* outTrans,
|
||||
const RollingCubePoseKeeper* rollingCubePoseKeeper, const sead::Quatf& quat,
|
||||
const sead::Vector3f& trans, f32 rate);
|
||||
bool nextRollingCubeKey(RollingCubePoseKeeper* rollingCubePoseKeeper);
|
||||
bool isMovementCurrentKeyRotate(const RollingCubePoseKeeper* rollingCubePoseKeeper);
|
||||
const PlacementInfo& getCurrentKeyPlacementInfo(const RollingCubePoseKeeper* rollingCubePoseKeeper);
|
||||
void calcMtxLandEffect(sead::Matrix34f* effectMtx,
|
||||
const RollingCubePoseKeeper* rollingCubePoseKeeper, const sead::Quatf& quat,
|
||||
const sead::Vector3f& trans);
|
||||
void calcRollingCubeClippingInfo(sead::Vector3f* clippingTrans, f32* clippingRadius,
|
||||
const RollingCubePoseKeeper* rollingCubePoseKeeper, f32 offset);
|
||||
RollingCubePoseKeeper* createRollingCubePoseKeeper(const LiveActor* actor,
|
||||
const ActorInitInfo& info);
|
||||
RollingCubePoseKeeper* createRollingCubePoseKeeper(const sead::BoundBox3f& boundBox,
|
||||
const ActorInitInfo& info);
|
||||
} // namespace al
|
@ -7,6 +7,7 @@
|
||||
#include "Library/MapObj/FloaterMapParts.h"
|
||||
#include "Library/MapObj/GateMapParts.h"
|
||||
#include "Library/MapObj/OneMeshFixMapParts.h"
|
||||
#include "Library/MapObj/RollingCubeMapParts.h"
|
||||
#include "Library/Obj/AllDeadWatcher.h"
|
||||
|
||||
#include "MapObj/AnagramAlphabet.h"
|
||||
@ -567,7 +568,7 @@ static al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
|
||||
{"ReactionMapParts", nullptr},
|
||||
{"RiseMapPartsHolder", nullptr},
|
||||
{"RocketFlower", nullptr},
|
||||
{"RollingCubeMapParts", nullptr},
|
||||
{"RollingCubeMapParts", al::createActorFunction<al::RollingCubeMapParts>},
|
||||
{"RippleFixMapParts", nullptr},
|
||||
{"RotateMapParts", nullptr},
|
||||
{"SeesawMapParts", nullptr},
|
||||
|
Loading…
Reference in New Issue
Block a user