| 1 | #include "Library/MapObj/ChildStep.h" |
| 2 | |
| 3 | #include "Library/LiveActor/ActorClippingFunction.h" |
| 4 | #include "Library/LiveActor/ActorInitFunction.h" |
| 5 | #include "Library/LiveActor/ActorInitUtil.h" |
| 6 | #include "Library/LiveActor/ActorPoseUtil.h" |
| 7 | #include "Library/Nerve/NerveSetupUtil.h" |
| 8 | #include "Library/Placement/PlacementFunction.h" |
| 9 | |
| 10 | namespace al { |
| 11 | namespace { |
| 12 | NERVE_IMPL(ChildStep, Wait) |
| 13 | |
| 14 | NERVES_MAKE_STRUCT(ChildStep, Wait) |
| 15 | } // namespace |
| 16 | |
| 17 | ChildStep::ChildStep(const char* name, LiveActor* parent) : LiveActor(name), mParent(parent) {} |
| 18 | |
| 19 | void ChildStep::init(const ActorInitInfo& info) { |
| 20 | initMapPartsActor(actor: this, initInfo: info, suffix: nullptr); |
| 21 | initNerve(actor: this, nerve: &NrvChildStep.Wait, maxStates: 0); |
| 22 | |
| 23 | multVecInvQuat(posOut: &mPos, actor: mParent, posIn: getTrans(actor: this)); |
| 24 | |
| 25 | makeActorAlive(); |
| 26 | } |
| 27 | |
| 28 | bool ChildStep::receiveMsg(const SensorMsg* message, HitSensor* other, HitSensor* self) { |
| 29 | return mParent->receiveMsg(message, other, self); |
| 30 | } |
| 31 | |
| 32 | void ChildStep::exeWait() { |
| 33 | multVecPose(posOut: getTransPtr(actor: this), actor: mParent, posIn: mPos); |
| 34 | } |
| 35 | |
| 36 | s32 calcChildStepCount(const ActorInitInfo& info) { |
| 37 | return calcLinkChildNum(initInfo: info, linkName: "ChildStep" ); |
| 38 | } |
| 39 | |
| 40 | void tryInitSubActorKeeperChildStep(LiveActor* actor, const ActorInitInfo& info) { |
| 41 | s32 childStepCount = calcChildStepCount(info); |
| 42 | |
| 43 | if (childStepCount <= 0) |
| 44 | return; |
| 45 | |
| 46 | initSubActorKeeperNoFile(actor, info, childStepCount); |
| 47 | } |
| 48 | |
| 49 | void createChildStep(const ActorInitInfo& info, LiveActor* parent, bool isSyncClipping) { |
| 50 | s32 childStepCount = calcChildStepCount(info); |
| 51 | |
| 52 | for (s32 i = 0; i < childStepCount; i++) { |
| 53 | ChildStep* childStep = new ChildStep("子供足場" , parent); |
| 54 | |
| 55 | initLinksActor(actor: childStep, initInfo: info, suffix: "ChildStep" , linkIndex: i); |
| 56 | |
| 57 | if (isSyncClipping) { |
| 58 | invalidateClipping(actor: childStep); |
| 59 | registerSubActorSyncClipping(parent, childStep); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 | } // namespace al |
| 64 | |