Library/Obj: Implement EffectObj, EffectObjCameraEmit, EffectObjFollowCamera, EffectObjFollowCameraLimit, EffectObjFunction and EffectObjInterval (#128)

This commit is contained in:
Fuzzy2319 2024-07-09 21:26:34 +02:00 committed by GitHub
parent ca26b4c32e
commit 678c58a41f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 823 additions and 89 deletions

View File

@ -60497,73 +60497,73 @@ Address,Quality,Size,Name
0x0000007100967ab4,U,000096,_ZNK2al17DynamicMeshDrawer15isExistDrawMeshEv
0x0000007100967b14,U,000204,_ZN2al17DynamicMeshDrawer7addMeshEPKN2nn3g3d8ModelObjEPKNS2_8ShapeObjEPNS_9ModelCtrlE
0x0000007100967be0,U,000164,_ZN2al17DynamicMeshDrawer10removeMeshEPKN2nn3g3d8ModelObjEPKNS2_8ShapeObjE
0x0000007100967c84,U,000156,_ZN2al9EffectObjC2EPKc
0x0000007100967d20,U,000168,_ZN2al9EffectObjC1EPKc
0x0000007100967dc8,U,000340,_ZN2al9EffectObj4initERKNS_13ActorInitInfoE
0x0000007100967f1c,U,000028,_ZN2al9EffectObj18initAfterPlacementEv
0x0000007100967f38,U,000224,_ZN2al9EffectObj7controlEv
0x0000007100968018,U,000008,_ZN2al9EffectObj6appearEv
0x0000007100968020,U,000008,_ZN2al9EffectObj4killEv
0x0000007100968028,U,000144,_ZN2al9EffectObj12tryEmitStartEv
0x00000071009680b8,U,000028,_ZNK2al10FunctorV0MIPNS_9EffectObjEMS1_FvvEEclEv
0x00000071009680d4,U,000076,_ZNK2al10FunctorV0MIPNS_9EffectObjEMS1_FvvEE5cloneEv
0x0000007100968120,U,000004,_ZN2al10FunctorV0MIPNS_9EffectObjEMS1_FvvEED0Ev
0x0000007100968124,U,000148,_ZN2al19EffectObjCameraEmitC2EPKc
0x00000071009681b8,U,000160,_ZN2al19EffectObjCameraEmitC1EPKc
0x0000007100968258,U,000244,_ZN2al19EffectObjCameraEmit4initERKNS_13ActorInitInfoE
0x000000710096834c,U,000024,_ZN2al19EffectObjCameraEmit12switchOnKillEv
0x0000007100968364,U,000028,_ZN2al19EffectObjCameraEmit18initAfterPlacementEv
0x0000007100968380,U,000188,_ZN2al19EffectObjCameraEmit7controlEv
0x000000710096843c,U,000112,_ZN2al19EffectObjCameraEmit12tryEmitStartEv
0x00000071009684ac,U,000008,_ZN2al19EffectObjCameraEmit6appearEv
0x00000071009684b4,U,000008,_ZN2al19EffectObjCameraEmit4killEv
0x00000071009684bc,U,000008,_ZNK2al19EffectObjCameraEmit10getBaseMtxEv
0x00000071009684c4,U,000028,_ZNK2al10FunctorV0MIPNS_19EffectObjCameraEmitEMS1_FvvEEclEv
0x00000071009684e0,U,000076,_ZNK2al10FunctorV0MIPNS_19EffectObjCameraEmitEMS1_FvvEE5cloneEv
0x000000710096852c,U,000004,_ZN2al10FunctorV0MIPNS_19EffectObjCameraEmitEMS1_FvvEED0Ev
0x0000007100968530,U,000136,_ZN2al21EffectObjFollowCameraC2EPKc
0x00000071009685b8,U,000148,_ZN2al21EffectObjFollowCameraC1EPKc
0x000000710096864c,U,000216,_ZN2al21EffectObjFollowCamera4initERKNS_13ActorInitInfoE
0x0000007100968724,U,000064,_ZN2al21EffectObjFollowCamera11startAppearEv
0x0000007100968764,U,000012,_ZN2al21EffectObjFollowCamera14startDisappearEv
0x0000007100968770,U,000048,_ZN2al21EffectObjFollowCamera7controlEv
0x00000071009687a0,U,000096,_ZN2al21EffectObjFollowCamera7exeWaitEv
0x0000007100968800,U,000092,_ZN2al21EffectObjFollowCamera12exeDisappearEv
0x000000710096885c,U,000100,
0x00000071009688c0,U,000096,
0x0000007100968920,U,000028,_ZNK2al10FunctorV0MIPNS_21EffectObjFollowCameraEMS1_FvvEEclEv
0x000000710096893c,U,000076,_ZNK2al10FunctorV0MIPNS_21EffectObjFollowCameraEMS1_FvvEE5cloneEv
0x0000007100968988,U,000004,_ZN2al10FunctorV0MIPNS_21EffectObjFollowCameraEMS1_FvvEED0Ev
0x000000710096898c,U,000148,_ZN2al26EffectObjFollowCameraLimitC2EPKc
0x0000007100968a20,U,000160,_ZN2al26EffectObjFollowCameraLimitC1EPKc
0x0000007100968ac0,U,000352,_ZN2al26EffectObjFollowCameraLimit4initERKNS_13ActorInitInfoE
0x0000007100968c20,U,000064,_ZN2al26EffectObjFollowCameraLimit11startAppearEv
0x0000007100968c60,U,000012,_ZN2al26EffectObjFollowCameraLimit14startDisappearEv
0x0000007100968c6c,U,000208,_ZN2al26EffectObjFollowCameraLimit7controlEv
0x0000007100968d3c,U,000004,_ZN2al26EffectObjFollowCameraLimit4killEv
0x0000007100968d40,U,000004,_ZN2al26EffectObjFollowCameraLimit6appearEv
0x0000007100968d44,U,000096,_ZN2al26EffectObjFollowCameraLimit7exeWaitEv
0x0000007100968da4,U,000092,_ZN2al26EffectObjFollowCameraLimit12exeDisappearEv
0x0000007100968e00,U,000100,
0x0000007100968e64,U,000096,
0x0000007100968ec4,U,000028,_ZNK2al10FunctorV0MIPNS_26EffectObjFollowCameraLimitEMS1_FvvEEclEv
0x0000007100968ee0,U,000076,_ZNK2al10FunctorV0MIPNS_26EffectObjFollowCameraLimitEMS1_FvvEE5cloneEv
0x0000007100968f2c,U,000004,_ZN2al10FunctorV0MIPNS_26EffectObjFollowCameraLimitEMS1_FvvEED0Ev
0x0000007100968f30,U,000180,_ZN2al17EffectObjFunction18initActorEffectObjEPNS_9LiveActorERKNS_13ActorInitInfoE
0x0000007100968fe4,U,000148,_ZN2al17EffectObjFunction18initActorEffectObjEPNS_9LiveActorERKNS_13ActorInitInfoEPKc
0x0000007100969078,U,000180,
0x000000710096912c,U,000060,_ZN2al17EffectObjFunction27initActorEffectObjNoArchiveEPNS_9LiveActorERKNS_13ActorInitInfoEPKc
0x0000007100969168,U,000160,_ZN2al17EffectObjIntervalC2EPKc
0x0000007100969208,U,000172,_ZN2al17EffectObjIntervalC1EPKc
0x00000071009692b4,U,000216,_ZN2al17EffectObjInterval4initERKNS_13ActorInitInfoE
0x000000710096938c,U,000028,_ZN2al17EffectObjInterval18initAfterPlacementEv
0x00000071009693a8,U,000188,_ZN2al17EffectObjInterval7controlEv
0x0000007100969464,U,000008,_ZN2al17EffectObjInterval6appearEv
0x000000710096946c,U,000008,_ZN2al17EffectObjInterval4killEv
0x0000007100969474,U,000008,_ZNK2al17EffectObjInterval10getBaseMtxEv
0x000000710096947c,U,000028,_ZNK2al10FunctorV0MIPNS_17EffectObjIntervalEMS1_FvvEEclEv
0x0000007100969498,U,000076,_ZNK2al10FunctorV0MIPNS_17EffectObjIntervalEMS1_FvvEE5cloneEv
0x00000071009694e4,U,000004,_ZN2al10FunctorV0MIPNS_17EffectObjIntervalEMS1_FvvEED0Ev
0x0000007100967c84,O,000156,_ZN2al9EffectObjC2EPKc
0x0000007100967d20,O,000168,_ZN2al9EffectObjC1EPKc
0x0000007100967dc8,O,000340,_ZN2al9EffectObj4initERKNS_13ActorInitInfoE
0x0000007100967f1c,O,000028,_ZN2al9EffectObj18initAfterPlacementEv
0x0000007100967f38,O,000224,_ZN2al9EffectObj7controlEv
0x0000007100968018,O,000008,_ZN2al9EffectObj6appearEv
0x0000007100968020,O,000008,_ZN2al9EffectObj4killEv
0x0000007100968028,O,000144,_ZN2al9EffectObj12tryEmitStartEv
0x00000071009680b8,O,000028,_ZNK2al10FunctorV0MIPNS_9EffectObjEMS1_FvvEEclEv
0x00000071009680d4,O,000076,_ZNK2al10FunctorV0MIPNS_9EffectObjEMS1_FvvEE5cloneEv
0x0000007100968120,O,000004,_ZN2al10FunctorV0MIPNS_9EffectObjEMS1_FvvEED0Ev
0x0000007100968124,O,000148,_ZN2al19EffectObjCameraEmitC2EPKc
0x00000071009681b8,O,000160,_ZN2al19EffectObjCameraEmitC1EPKc
0x0000007100968258,O,000244,_ZN2al19EffectObjCameraEmit4initERKNS_13ActorInitInfoE
0x000000710096834c,O,000024,_ZN2al19EffectObjCameraEmit12switchOnKillEv
0x0000007100968364,O,000028,_ZN2al19EffectObjCameraEmit18initAfterPlacementEv
0x0000007100968380,O,000188,_ZN2al19EffectObjCameraEmit7controlEv
0x000000710096843c,O,000112,_ZN2al19EffectObjCameraEmit12tryEmitStartEv
0x00000071009684ac,O,000008,_ZN2al19EffectObjCameraEmit6appearEv
0x00000071009684b4,O,000008,_ZN2al19EffectObjCameraEmit4killEv
0x00000071009684bc,O,000008,_ZNK2al19EffectObjCameraEmit10getBaseMtxEv
0x00000071009684c4,O,000028,_ZNK2al10FunctorV0MIPNS_19EffectObjCameraEmitEMS1_FvvEEclEv
0x00000071009684e0,O,000076,_ZNK2al10FunctorV0MIPNS_19EffectObjCameraEmitEMS1_FvvEE5cloneEv
0x000000710096852c,O,000004,_ZN2al10FunctorV0MIPNS_19EffectObjCameraEmitEMS1_FvvEED0Ev
0x0000007100968530,O,000136,_ZN2al21EffectObjFollowCameraC2EPKc
0x00000071009685b8,O,000148,_ZN2al21EffectObjFollowCameraC1EPKc
0x000000710096864c,O,000216,_ZN2al21EffectObjFollowCamera4initERKNS_13ActorInitInfoE
0x0000007100968724,O,000064,_ZN2al21EffectObjFollowCamera11startAppearEv
0x0000007100968764,O,000012,_ZN2al21EffectObjFollowCamera14startDisappearEv
0x0000007100968770,O,000048,_ZN2al21EffectObjFollowCamera7controlEv
0x00000071009687a0,O,000096,_ZN2al21EffectObjFollowCamera7exeWaitEv
0x0000007100968800,O,000092,_ZN2al21EffectObjFollowCamera12exeDisappearEv
0x000000710096885c,O,000100,_ZNK12_GLOBAL__N_128EffectObjFollowCameraNrvWait7executeEPN2al11NerveKeeperE
0x00000071009688c0,O,000096,_ZNK12_GLOBAL__N_133EffectObjFollowCameraNrvDisappear7executeEPN2al11NerveKeeperE
0x0000007100968920,O,000028,_ZNK2al10FunctorV0MIPNS_21EffectObjFollowCameraEMS1_FvvEEclEv
0x000000710096893c,O,000076,_ZNK2al10FunctorV0MIPNS_21EffectObjFollowCameraEMS1_FvvEE5cloneEv
0x0000007100968988,O,000004,_ZN2al10FunctorV0MIPNS_21EffectObjFollowCameraEMS1_FvvEED0Ev
0x000000710096898c,O,000148,_ZN2al26EffectObjFollowCameraLimitC2EPKc
0x0000007100968a20,O,000160,_ZN2al26EffectObjFollowCameraLimitC1EPKc
0x0000007100968ac0,O,000352,_ZN2al26EffectObjFollowCameraLimit4initERKNS_13ActorInitInfoE
0x0000007100968c20,O,000064,_ZN2al26EffectObjFollowCameraLimit11startAppearEv
0x0000007100968c60,O,000012,_ZN2al26EffectObjFollowCameraLimit14startDisappearEv
0x0000007100968c6c,O,000208,_ZN2al26EffectObjFollowCameraLimit7controlEv
0x0000007100968d3c,O,000004,_ZN2al26EffectObjFollowCameraLimit4killEv
0x0000007100968d40,O,000004,_ZN2al26EffectObjFollowCameraLimit6appearEv
0x0000007100968d44,O,000096,_ZN2al26EffectObjFollowCameraLimit7exeWaitEv
0x0000007100968da4,O,000092,_ZN2al26EffectObjFollowCameraLimit12exeDisappearEv
0x0000007100968e00,O,000100,_ZNK12_GLOBAL__N_133EffectObjFollowCameraLimitNrvWait7executeEPN2al11NerveKeeperE
0x0000007100968e64,O,000096,_ZNK12_GLOBAL__N_138EffectObjFollowCameraLimitNrvDisappear7executeEPN2al11NerveKeeperE
0x0000007100968ec4,O,000028,_ZNK2al10FunctorV0MIPNS_26EffectObjFollowCameraLimitEMS1_FvvEEclEv
0x0000007100968ee0,O,000076,_ZNK2al10FunctorV0MIPNS_26EffectObjFollowCameraLimitEMS1_FvvEE5cloneEv
0x0000007100968f2c,O,000004,_ZN2al10FunctorV0MIPNS_26EffectObjFollowCameraLimitEMS1_FvvEED0Ev
0x0000007100968f30,O,000180,_ZN2al17EffectObjFunction18initActorEffectObjEPNS_9LiveActorERKNS_13ActorInitInfoE
0x0000007100968fe4,O,000148,_ZN2al17EffectObjFunction18initActorEffectObjEPNS_9LiveActorERKNS_13ActorInitInfoEPKc
0x0000007100969078,O,000180,_ZN2al17EffectObjFunction27initActorEffectObjNoArchiveEPNS_9LiveActorERKNS_13ActorInitInfoE
0x000000710096912c,O,000060,_ZN2al17EffectObjFunction27initActorEffectObjNoArchiveEPNS_9LiveActorERKNS_13ActorInitInfoEPKc
0x0000007100969168,O,000160,_ZN2al17EffectObjIntervalC2EPKc
0x0000007100969208,O,000172,_ZN2al17EffectObjIntervalC1EPKc
0x00000071009692b4,O,000216,_ZN2al17EffectObjInterval4initERKNS_13ActorInitInfoE
0x000000710096938c,O,000028,_ZN2al17EffectObjInterval18initAfterPlacementEv
0x00000071009693a8,O,000188,_ZN2al17EffectObjInterval7controlEv
0x0000007100969464,O,000008,_ZN2al17EffectObjInterval6appearEv
0x000000710096946c,O,000008,_ZN2al17EffectObjInterval4killEv
0x0000007100969474,O,000008,_ZNK2al17EffectObjInterval10getBaseMtxEv
0x000000710096947c,O,000028,_ZNK2al10FunctorV0MIPNS_17EffectObjIntervalEMS1_FvvEEclEv
0x0000007100969498,O,000076,_ZNK2al10FunctorV0MIPNS_17EffectObjIntervalEMS1_FvvEE5cloneEv
0x00000071009694e4,O,000004,_ZN2al10FunctorV0MIPNS_17EffectObjIntervalEMS1_FvvEED0Ev
0x00000071009694e8,U,000304,_ZN2al25FarDistanceDitherAnimator9tryCreateEPNS_9LiveActorEPKNS_8ResourceEPKc
0x0000007100969618,U,000100,_ZN2al25FarDistanceDitherAnimator9loadParamERKNS_9ByamlIterE
0x000000710096967c,U,000140,_ZN2al25FarDistanceDitherAnimatorC1EPNS_9LiveActorE

Can't render this file because it is too large.

View File

@ -12,7 +12,7 @@ class LiveActor;
Projection getProjection(const IUseCamera* cameraHolder, s32 cameraNum);
sead::Vector3f* getCameraPos(const IUseCamera* cameraHolder, s32 cameraNum);
const sead::Vector3f& getCameraPos(const IUseCamera* cameraHolder, s32 cameraNum);
void calcCameraUpDir(sead::Vector3f* out, const IUseCamera* cameraHolder, s32 cameraNum);
s32 getViewNumMax(const IUseCamera* cameraHolder);
CameraSubTargetBase* createActorCameraSubTarget(const LiveActor* actor, const sead::Vector3f*);
@ -20,4 +20,6 @@ void initCameraSubTargetTurnParam(CameraSubTargetBase* cameraSubTarget,
const CameraSubTargetTurnParam* params);
void setCameraPlacementSubTarget(IUseCamera* cameraHolder, CameraSubTargetBase* cameraSubTarget);
void resetCameraPlacementSubTarget(IUseCamera* cameraHolder, CameraSubTargetBase* cameraSubTarget);
const sead::Matrix34f& getViewMtx(const IUseCamera* cameraHolder, s32 cameraNum);
void calcCameraFront(sead::Vector3f* out, const IUseCamera* cameraHolder, s32 cameraNum);
} // namespace al

View File

@ -0,0 +1,11 @@
#pragma once
namespace al {
class MtxConnector;
class LiveActor;
class ActorInitInfo;
MtxConnector* tryCreateMtxConnector(const LiveActor* actor, const ActorInitInfo& info);
void attachMtxConnectorToCollision(MtxConnector* mtxConnector, const LiveActor* actor, bool);
void connectPoseQT(LiveActor* actor, const MtxConnector* mtxConnector);
} // namespace al

View File

@ -10,6 +10,8 @@ class EffectUserInfo;
class MtxPtrHolder;
class EffectSystemInfo;
class EffectPrefixType;
class EffectSystemInfo;
class EffectResourceInfo;
class EffectKeeper {
public:
@ -53,3 +55,11 @@ private:
MtxPtrHolder* mMtxPtrHolder;
};
} // namespace al
namespace alEffectFunction {
bool tryFindEffectUser(const al::EffectSystemInfo*, const char*);
void initResourceInfo(const al::EffectSystemInfo*, al::EffectResourceInfo*);
bool tryFindEffectResouceInfo(const al::EffectSystemInfo*, const char*);
void emitEffectIfExist(al::IUseEffectKeeper* effectKeeperHolder, const char* effectName,
const sead::Vector3f* pos);
} // namespace alEffectFunction

View File

@ -1,17 +1,12 @@
#pragma once
#include "Library/Movement/MoveType.h"
namespace al {
class ActorInitInfo;
class PlacementInfo;
class KeyPose;
enum class MoveType : u32 {
Loop,
Turn,
Stop,
Restart,
};
class KeyPoseKeeper {
public:
KeyPoseKeeper();

View File

@ -4,6 +4,7 @@ namespace al {
class LiveActor;
bool isAlive(const LiveActor* actor);
bool isDead(const LiveActor* actor);
void initActorSceneInfo(LiveActor* actor, const ActorInitInfo& info);
void initStageSwitch(LiveActor* actor, const ActorInitInfo& info);
void initExecutorWatchObj(LiveActor* actor, const ActorInitInfo& info);

View File

@ -1,10 +1,12 @@
#pragma once
#include <math/seadMatrix.h>
#include <prim/seadSafeString.h>
namespace al {
class LiveActor;
class Resource;
class HitSensor;
LiveActor* createLinksActorFromFactory(const ActorInitInfo& info, const char* linkName,
s32 linkNum);
@ -21,4 +23,10 @@ void initExecutorDraw(LiveActor* actor, const ActorInitInfo& info, const char* e
void initChildActorWithArchiveNameWithPlacementInfo(LiveActor* actor, const ActorInitInfo& info,
const sead::SafeString& archiveName,
const char* suffix);
bool tryListenStageSwitchKill(LiveActor* actor);
void initActorWithArchiveName(LiveActor* actor, const ActorInitInfo& info,
const sead::SafeString& archiveName, const char* suffix);
void initActorEffectKeeper(LiveActor* actor, const ActorInitInfo& info, const char* name);
void initActorPoseTQSV(LiveActor* actor);
void initExecutorUpdate(LiveActor* actor, const ActorInitInfo& info, const char* name);
} // namespace al

View File

@ -72,7 +72,7 @@ public:
virtual bool receiveMsg(const SensorMsg* message, HitSensor* source, HitSensor* target);
virtual bool receiveMsgScreenPoint(const SensorMsg*, ScreenPointer*, ScreenPointTarget*);
virtual const char* getName() const override;
virtual sead::Matrix34f* getBaseMtx() const;
virtual const sead::Matrix34f* getBaseMtx() const;
virtual EffectKeeper* getEffectKeeper() const override;
virtual AudioKeeper* getAudioKeeper() const override;
virtual StageSwitchKeeper* getStageSwitchKeeper() const override;

View File

@ -18,6 +18,7 @@ bool isExistNearZeroVal(const sead::Vector3f&, f32);
bool isNormalize(const sead::Vector3f&, f32);
bool isNormalize(const sead::Matrix34f&);
bool isParallelDirection(const sead::Vector2f&, const sead::Vector2f&, f32);
bool isParallelDirection(const sead::Vector3f&, const sead::Vector3f&, f32);
bool isReverseDirection(const sead::Vector3f&, const sead::Vector3f&, f32);
bool isNearDirection(const sead::Vector2f&, const sead::Vector2f&, f32);
bool isInRange(s32, s32, s32);

View File

@ -0,0 +1,12 @@
#pragma once
#include <basis/seadTypes.h>
namespace al {
enum class MoveType : s32 {
Loop,
Turn,
Stop,
Restart,
};
}

View File

@ -0,0 +1,113 @@
#include "Library/Obj/EffectObj.h"
#include "Library/Base/StringUtil.h"
#include "Library/Collision/PartsConnector.h"
#include "Library/Effect/EffectKeeper.h"
#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/Matrix/MatrixUtil.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Obj/EffectObjFunction.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Rail/RailUtil.h"
#include "Library/Se/SeFunction.h"
#include "Library/Stage/StageSwitchKeeper.h"
#include "Library/Thread/FunctorV0M.h"
namespace al {
EffectObj::EffectObj(const char* name) : LiveActor(name) {}
void EffectObj::init(const ActorInitInfo& info) {
using EffectObjFunctor = FunctorV0M<EffectObj*, void (EffectObj::*)()>;
EffectObjFunction::initActorEffectObj(this, info);
const char* className = nullptr;
getClassName(&className, info);
if (isEqualString("EffectObjScale", className)) {
mIsEffectObjScale = true;
setEffectEmitterVolumeScale(this, "Wait", getScale(this));
}
trySyncStageSwitchAppear(this);
tryListenStageSwitchKill(this);
listenStageSwitchOnOff(this, "OnKillOffAppearSwitch", EffectObjFunctor(this, &EffectObj::kill),
EffectObjFunctor(this, &EffectObj::appear));
if (isExistRail(info, "Rail")) {
tryGetArg((s32*)&mMoveType, info, "MoveType");
tryGetArg(&mRailMoveSpeed, info, "RailMoveSpeed");
setRailPosToStart(this);
setRailClippingInfo(&mRailPos, this, 100.0f, 100.0f);
tryGetArg(&mIsSyncRailPose, info, "IsSyncRailPose");
}
mMtxConnector = tryCreateMtxConnector(this, info);
}
void EffectObj::initAfterPlacement() {
if (mMtxConnector == nullptr)
return;
attachMtxConnectorToCollision(mMtxConnector, this, false);
}
void EffectObj::control() {
if (isExistRail(this)) {
switch (mMoveType) {
case MoveType::Turn:
moveSyncRailTurn(this, mRailMoveSpeed);
break;
case MoveType::Loop:
moveSyncRailLoop(this, mRailMoveSpeed);
break;
default:
moveSyncRail(this, mRailMoveSpeed);
break;
}
if (mIsSyncRailPose) {
sead::Vector3f railUp;
sead::Matrix34f poseMtx;
const sead::Vector3f& railDir = getRailDir(this);
calcRailUp(&railUp, this);
const sead::Vector3f& railTrans = getTrans(this);
makeMtxFrontUpPos(&poseMtx, railDir, railUp, railTrans);
updatePoseMtx(this, &poseMtx);
}
} else if (mMtxConnector != nullptr)
connectPoseQT(this, mMtxConnector);
makeMtxRT(&mBaseMtx, this);
tryEmitStart();
}
void EffectObj::appear() {
mIsStarted = false;
LiveActor::appear();
}
void EffectObj::kill() {
mIsStarted = false;
LiveActor::kill();
}
bool EffectObj::tryEmitStart() {
if (mIsStarted)
return false;
emitEffect(this, "Wait", nullptr);
alEffectFunction::emitEffectIfExist(this, "Wait2", nullptr);
tryStartSe(this, "Wait");
mIsStarted = true;
return true;
}
} // namespace al

View File

@ -0,0 +1,32 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
#include "Library/Movement/MoveType.h"
namespace al {
class MtxConnector;
class EffectObj : public LiveActor {
public:
EffectObj(const char* name);
void init(const ActorInitInfo& info) override;
void initAfterPlacement() override;
void control() override;
void appear() override;
void kill() override;
virtual bool tryEmitStart();
private:
sead::Matrix34f mBaseMtx = sead::Matrix34f::ident;
MtxConnector* mMtxConnector = nullptr;
MoveType mMoveType = MoveType::Loop;
f32 mRailMoveSpeed = 0;
sead::Vector3f mRailPos = {0, 0, 0};
bool mIsSyncRailPose = false;
bool mIsStarted = false;
bool mIsEffectObjScale = false;
};
static_assert(sizeof(EffectObj) == 0x158);
} // namespace al

View File

@ -0,0 +1,91 @@
#include "Library/Obj/EffectObjCameraEmit.h"
#include "Library/Collision/PartsConnector.h"
#include "Library/Effect/EffectKeeper.h"
#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Obj/EffectObjFunction.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Se/SeFunction.h"
#include "Library/Stage/StageSwitchKeeper.h"
#include "Library/Thread/FunctorV0M.h"
namespace al {
EffectObjCameraEmit::EffectObjCameraEmit(const char* name) : LiveActor(name) {}
void EffectObjCameraEmit::init(const ActorInitInfo& info) {
using EffectObjCameraEmitFunctor =
FunctorV0M<EffectObjCameraEmit*, void (EffectObjCameraEmit::*)()>;
EffectObjFunction::initActorEffectObj(this, info);
listenStageSwitchOnOffAppear(
this, EffectObjCameraEmitFunctor(this, &EffectObjCameraEmit::appear),
EffectObjCameraEmitFunctor(this, &EffectObjCameraEmit::switchOnKill)) ?
makeActorDead() :
makeActorAlive();
listenStageSwitchOnKill(this,
EffectObjCameraEmitFunctor(this, &EffectObjCameraEmit::switchOnKill));
listenStageSwitchOnOff(this, "OnKillOffAppearSwitch",
EffectObjCameraEmitFunctor(this, &EffectObjCameraEmit::switchOnKill),
EffectObjCameraEmitFunctor(this, &EffectObjCameraEmit::appear));
mMtxConnector = tryCreateMtxConnector(this, info);
}
void EffectObjCameraEmit::switchOnKill() {
mIsStopFollowCamera = true;
tryDeleteEffect(this, "Wait");
}
void EffectObjCameraEmit::initAfterPlacement() {
if (mMtxConnector == nullptr)
return;
attachMtxConnectorToCollision(mMtxConnector, this, false);
}
void EffectObjCameraEmit::control() {
if (mMtxConnector != nullptr)
connectPoseQT(this, mMtxConnector);
makeMtxRT(&mBaseMtx, this);
if (!mIsStarted)
tryEmitStart();
if (mIsStopFollowCamera && !isEffectEmitting(this, "Wait"))
kill();
}
bool EffectObjCameraEmit::tryEmitStart() {
if (mIsStarted)
return false;
emitEffect(this, "Wait", nullptr);
tryStartSe(this, "Wait");
mIsStarted = true;
return true;
}
void EffectObjCameraEmit::appear() {
mIsStarted = false;
mIsStopFollowCamera = false;
LiveActor::appear();
}
void EffectObjCameraEmit::kill() {
mIsStarted = false;
mIsStopFollowCamera = false;
LiveActor::kill();
}
const sead::Matrix34f* EffectObjCameraEmit::getBaseMtx() const {
return &mBaseMtx;
}
} // namespace al

View File

@ -0,0 +1,29 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
namespace al {
class MtxConnector;
class EffectObjCameraEmit : public LiveActor {
public:
EffectObjCameraEmit(const char* name);
void init(const ActorInitInfo& info) override;
void switchOnKill();
void initAfterPlacement() override;
void control() override;
bool tryEmitStart();
void appear() override;
void kill() override;
const sead::Matrix34f* getBaseMtx() const override;
private:
sead::Matrix34f mBaseMtx = sead::Matrix34f::ident;
MtxConnector* mMtxConnector = nullptr;
bool mIsStarted = false;
bool mIsStopFollowCamera = false;
};
static_assert(sizeof(EffectObjCameraEmit) == 0x148);
} // namespace al

View File

@ -0,0 +1,76 @@
#include "Library/Obj/EffectObjFollowCamera.h"
#include "Library/Camera/CameraUtil.h"
#include "Library/Effect/EffectKeeper.h"
#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorDrawFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Obj/EffectObjFunction.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Se/SeFunction.h"
#include "Library/Stage/StageSwitchKeeper.h"
#include "Library/Thread/FunctorV0M.h"
namespace {
using namespace al;
NERVE_IMPL(EffectObjFollowCamera, Wait)
NERVE_IMPL(EffectObjFollowCamera, Disappear)
NERVES_MAKE_NOSTRUCT(EffectObjFollowCamera, Wait, Disappear)
} // namespace
namespace al {
EffectObjFollowCamera::EffectObjFollowCamera(const char* name) : LiveActor(name) {}
void EffectObjFollowCamera::init(const ActorInitInfo& info) {
using EffectObjFollowCameraFunctor =
FunctorV0M<EffectObjFollowCamera*, void (EffectObjFollowCamera::*)()>;
EffectObjFunction::initActorEffectObj(this, info);
invalidateClipping(this);
setEffectNamedMtxPtr(this, "Wait", &mBaseMtx);
initNerve(this, &Wait, 0);
listenStageSwitchOnOffAppear(
this, EffectObjFollowCameraFunctor(this, &EffectObjFollowCamera::startAppear),
EffectObjFollowCameraFunctor(this, &EffectObjFollowCamera::startDisappear)) ?
makeActorDead() :
makeActorAlive();
listenStageSwitchOnKill(
this, EffectObjFollowCameraFunctor(this, &EffectObjFollowCamera::startDisappear));
}
void EffectObjFollowCamera::startAppear() {
if (isDead(this))
appear();
setNerve(this, &Wait);
}
void EffectObjFollowCamera::startDisappear() {
setNerve(this, &Disappear);
}
void EffectObjFollowCamera::control() {
mBaseMtx.setInverse(getViewMtx(this, 0));
}
void EffectObjFollowCamera::exeWait() {
if (isFirstStep(this)) {
tryEmitEffect(this, "Wait", nullptr);
tryStartSe(this, "Wait");
}
}
void EffectObjFollowCamera::exeDisappear() {
if (isFirstStep(this))
deleteEffect(this, "Wait");
if (isStep(this, 180))
kill();
}
} // namespace al

View File

@ -0,0 +1,22 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
namespace al {
class EffectObjFollowCamera : public LiveActor {
public:
EffectObjFollowCamera(const char* name);
void init(const ActorInitInfo& info) override;
void startAppear();
void startDisappear();
void control() override;
void exeWait();
void exeDisappear();
private:
sead::Matrix34f mBaseMtx = sead::Matrix34f::ident;
};
static_assert(sizeof(EffectObjFollowCamera) == 0x138);
} // namespace al

View File

@ -0,0 +1,110 @@
#include "Library/Obj/EffectObjFollowCameraLimit.h"
#include "Library/Camera/CameraUtil.h"
#include "Library/Effect/EffectKeeper.h"
#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorDrawFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/Math/MathLengthUtil.h"
#include "Library/Matrix/MatrixUtil.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Obj/EffectObjFunction.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Se/SeFunction.h"
#include "Library/Stage/StageSwitchKeeper.h"
#include "Library/Thread/FunctorV0M.h"
namespace {
using namespace al;
NERVE_IMPL(EffectObjFollowCameraLimit, Wait)
NERVE_IMPL(EffectObjFollowCameraLimit, Disappear)
NERVES_MAKE_NOSTRUCT(EffectObjFollowCameraLimit, Wait, Disappear)
} // namespace
namespace al {
EffectObjFollowCameraLimit::EffectObjFollowCameraLimit(const char* name) : LiveActor(name) {}
void EffectObjFollowCameraLimit::init(const ActorInitInfo& info) {
using EffectObjFollowCameraLimitFunctor =
FunctorV0M<EffectObjFollowCameraLimit*, void (EffectObjFollowCameraLimit::*)()>;
EffectObjFunction::initActorEffectObj(this, info);
invalidateClipping(this);
setEffectNamedMtxPtr(this, "Wait", &mBaseMtx);
initNerve(this, &Wait, 0);
listenStageSwitchOnOffAppear(
this, EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::startAppear),
EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::startDisappear)) ?
makeActorDead() :
makeActorAlive();
tryGetArg(&mLimitBottom, info, "LimitBottom");
tryGetArg(&mLimitTop, info, "LimitTop");
listenStageSwitchOnOffAppear(
this, EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::startAppear),
EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::startDisappear));
listenStageSwitchOnOff(
this, "OnKillOffAppearSwitch",
EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::kill),
EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::startAppear));
listenStageSwitchOnKill(
this, EffectObjFollowCameraLimitFunctor(this, &EffectObjFollowCameraLimit::startDisappear));
}
void EffectObjFollowCameraLimit::startAppear() {
if (isDead(this))
appear();
setNerve(this, &Wait);
}
void EffectObjFollowCameraLimit::startDisappear() {
setNerve(this, &Disappear);
}
void EffectObjFollowCameraLimit::control() {
sead::Vector3f front;
sead::Vector3f pos;
calcCameraFront(&front, this, 0);
pos.set(getCameraPos(this, 0));
pos.y = sead::Mathf::max(pos.y, mLimitBottom);
if (!isNearZero(mLimitTop + 1, 0.001f))
pos.y = sead::Mathf::min(pos.y, mLimitTop);
if (!isParallelDirection(sead::Vector3f::ey, front, 0.01f))
makeMtxUpFrontPos(&mBaseMtx, sead::Vector3f::ey, front, pos);
}
void EffectObjFollowCameraLimit::kill() {
LiveActor::kill();
}
void EffectObjFollowCameraLimit::appear() {
LiveActor::appear();
}
void EffectObjFollowCameraLimit::exeWait() {
if (isFirstStep(this)) {
tryEmitEffect(this, "Wait", nullptr);
tryStartSe(this, "Wait");
}
}
void EffectObjFollowCameraLimit::exeDisappear() {
if (isFirstStep(this))
deleteEffect(this, "Wait");
if (isStep(this, 180))
kill();
}
} // namespace al

View File

@ -0,0 +1,26 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
namespace al {
class EffectObjFollowCameraLimit : public LiveActor {
public:
EffectObjFollowCameraLimit(const char* name);
void init(const ActorInitInfo& info) override;
void startAppear();
void startDisappear();
void control() override;
void kill() override;
void appear() override;
void exeWait();
void exeDisappear();
private:
sead::Matrix34f mBaseMtx = sead::Matrix34f::ident;
f32 mLimitBottom = 0;
f32 mLimitTop = -1;
};
static_assert(sizeof(EffectObjFollowCameraLimit) == 0x140);
} // namespace al

View File

@ -0,0 +1,49 @@
#include "Library/Obj/EffectObjFunction.h"
#include "Library/Base/StringUtil.h"
#include "Library/File/FileUtil.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorDrawFunction.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/LiveActor.h"
#include "Library/Placement/PlacementFunction.h"
namespace al::EffectObjFunction {
void initActorEffectObj(LiveActor* actor, const ActorInitInfo& info) {
const char* modelName = nullptr;
if (!alPlacementFunction::tryGetModelName(&modelName, info))
getObjectName(&modelName, info);
initActorEffectObj(actor, info, modelName);
}
void initActorEffectObj(LiveActor* actor, const ActorInitInfo& info, const char* archiveName) {
if (isExistArchive(StringTmp<128>("ObjectData/%s", archiveName)))
initActorWithArchiveName(actor, info, archiveName, nullptr);
else
initActorEffectObjNoArchive(actor, info);
initActorEffectKeeper(actor, info, archiveName);
}
void initActorEffectObjNoArchive(LiveActor* actor, const ActorInitInfo& info) {
initActorSceneInfo(actor, info);
initActorPoseTQSV(actor);
initActorSRT(actor, info);
initActorClipping(actor, info);
initGroupClipping(actor, info);
setClippingInfo(actor, 1000.0f, nullptr);
initStageSwitch(actor, info);
initExecutorUpdate(actor, info, "エフェクトオブジェ");
if (isExistRail(info, "Rail"))
actor->initRailKeeper(info, "Rail");
}
void initActorEffectObjNoArchive(LiveActor* actor, const ActorInitInfo& info,
const char* effectKeeperName) {
initActorEffectObjNoArchive(actor, info);
initActorEffectKeeper(actor, info, effectKeeperName);
}
} // namespace al::EffectObjFunction

View File

@ -0,0 +1,14 @@
#pragma once
namespace al {
class LiveActor;
class ActorInitInfo;
namespace EffectObjFunction {
void initActorEffectObj(LiveActor* actor, const ActorInitInfo& info);
void initActorEffectObj(LiveActor* actor, const ActorInitInfo& info, const char* archiveName);
void initActorEffectObjNoArchive(LiveActor* actor, const ActorInitInfo& info);
void initActorEffectObjNoArchive(LiveActor* actor, const ActorInitInfo& info,
const char* effectKeeperName);
} // namespace EffectObjFunction
} // namespace al

View File

@ -0,0 +1,80 @@
#include "Library/Obj/EffectObjInterval.h"
#include "Library/Collision/PartsConnector.h"
#include "Library/Effect/EffectKeeper.h"
#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/Obj/EffectObjFunction.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Se/SeFunction.h"
#include "Library/Stage/StageSwitchKeeper.h"
#include "Library/Thread/FunctorV0M.h"
namespace al {
EffectObjInterval::EffectObjInterval(const char* name) : LiveActor(name) {}
void EffectObjInterval::init(const ActorInitInfo& info) {
using EffectObjIntervalFunctor = FunctorV0M<EffectObjInterval*, void (EffectObjInterval::*)()>;
EffectObjFunction::initActorEffectObj(this, info);
trySyncStageSwitchAppear(this);
tryListenStageSwitchKill(this);
listenStageSwitchOnOff(this, "OnKillOffAppearSwitch",
EffectObjIntervalFunctor(this, &EffectObjInterval::kill),
EffectObjIntervalFunctor(this, &EffectObjInterval::appear));
mMtxConnector = tryCreateMtxConnector(this, info);
tryGetArg(&mEmitInterval, info, "EmitInterval");
if (tryGetArg(&mFirstEmitFrame, info, "FirstEmitFrame"))
mTimer = mFirstEmitFrame;
else
mTimer = 0;
}
void EffectObjInterval::initAfterPlacement() {
if (mMtxConnector == nullptr)
return;
attachMtxConnectorToCollision(mMtxConnector, this, false);
}
void EffectObjInterval::control() {
if (mMtxConnector != nullptr)
connectPoseQT(this, mMtxConnector);
makeMtxRT(&mBaseMtx, this);
if (mTimer <= 0) {
mIsStarted = false;
emitEffect(this, "Wait", nullptr);
alEffectFunction::emitEffectIfExist(this, "Wait2", nullptr);
tryStartSe(this, "Wait");
mIsStarted = true;
mTimer = mEmitInterval;
return;
}
mTimer--;
}
void EffectObjInterval::appear() {
mIsStarted = false;
LiveActor::appear();
}
void EffectObjInterval::kill() {
mIsStarted = false;
LiveActor::kill();
}
const sead::Matrix34f* EffectObjInterval::getBaseMtx() const {
return &mBaseMtx;
}
} // namespace al

View File

@ -0,0 +1,29 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
namespace al {
class MtxConnector;
class EffectObjInterval : public LiveActor {
public:
EffectObjInterval(const char* name);
void init(const ActorInitInfo& info) override;
void initAfterPlacement() override;
void control() override;
void appear() override;
void kill() override;
const sead::Matrix34f* getBaseMtx() const override;
private:
sead::Matrix34f mBaseMtx = sead::Matrix34f::ident;
MtxConnector* mMtxConnector = nullptr;
bool mIsStarted = false;
s32 mEmitInterval = 0;
s32 mTimer = 0;
s32 mFirstEmitFrame = 0;
};
static_assert(sizeof(EffectObjInterval) == 0x150);
} // namespace al

View File

@ -240,17 +240,17 @@ bool tryGetDisplayScale(sead::Vector3f* scale, const ActorInitInfo& initInfo);
class alPlacementFunction {
public:
s32 getCameraId(const al::ActorInitInfo& initInfo);
void getLinkGroupId(al::PlacementId* groupId, const al::ActorInitInfo& initInfo,
static s32 getCameraId(const al::ActorInitInfo& initInfo);
static void getLinkGroupId(al::PlacementId* groupId, const al::ActorInitInfo& initInfo,
const char* linkName);
bool isEnableLinkGroupId(const al::ActorInitInfo& initInfo, const char* linkName);
bool isEnableGroupClipping(const al::ActorInitInfo& initInfo);
void getClippingGroupId(al::PlacementId* groupId, const al::ActorInitInfo& initInfo);
void createClippingViewId(const al::PlacementInfo& placementInfo);
void getClippingViewId(al::PlacementId* viewId, const al::PlacementInfo& placementInfo);
void getClippingViewId(al::PlacementId* viewId, const al::ActorInitInfo& initInfo);
void getModelName(const char** modelName, const al::ActorInitInfo& initInfo);
void getModelName(const char** modelName, const al::PlacementInfo& placementInfo);
bool tryGetModelName(const char** modelName, const al::PlacementInfo& placementInfo);
bool tryGetModelName(const char** modelName, const al::ActorInitInfo& initInfo);
static bool isEnableLinkGroupId(const al::ActorInitInfo& initInfo, const char* linkName);
static bool isEnableGroupClipping(const al::ActorInitInfo& initInfo);
static void getClippingGroupId(al::PlacementId* groupId, const al::ActorInitInfo& initInfo);
static void createClippingViewId(const al::PlacementInfo& placementInfo);
static void getClippingViewId(al::PlacementId* viewId, const al::PlacementInfo& placementInfo);
static void getClippingViewId(al::PlacementId* viewId, const al::ActorInitInfo& initInfo);
static void getModelName(const char** modelName, const al::ActorInitInfo& initInfo);
static void getModelName(const char** modelName, const al::PlacementInfo& placementInfo);
static bool tryGetModelName(const char** modelName, const al::PlacementInfo& placementInfo);
static bool tryGetModelName(const char** modelName, const al::ActorInitInfo& initInfo);
};

View File

@ -0,0 +1,17 @@
#pragma once
#include <math/seadVector.h>
namespace al {
class IUseRail;
class LiveActor;
void setRailPosToStart(IUseRail* railHolder);
void moveSyncRail(LiveActor* actor, f32 speed);
void moveSyncRailLoop(LiveActor* actor, f32 speed);
void moveSyncRailTurn(LiveActor* actor, f32 speed);
void calcRailUp(sead::Vector3f* out, IUseRail* railHolder);
const sead::Vector3f& getRailDir(IUseRail* railHolder);
bool isExistRail(IUseRail* railHolder);
void setRailClippingInfo(sead::Vector3f*, LiveActor* actor, f32, f32);
} // namespace al

View File

@ -14,6 +14,7 @@ class StageSwitchDirector;
class StageSwitchListener;
class PlacementInfo;
class IUseStageSwitch;
class FunctorBase;
class StageSwitchKeeper {
public:
@ -48,4 +49,9 @@ static_assert(sizeof(StageSwitchDirector) == 0x20);
bool tryOnStageSwitch(IUseStageSwitch*, const char*);
bool tryOffStageSwitch(IUseStageSwitch*, const char*);
bool tryOnSwitchDeadOn(IUseStageSwitch* stageSwitch);
bool listenStageSwitchOnOff(IUseStageSwitch* stageSwitchHolder, const char* eventName,
const FunctorBase& actionOnOn, const FunctorBase& actionOnOff);
bool listenStageSwitchOnOffAppear(IUseStageSwitch* stageSwitchHolder, const FunctorBase& actionOnOn,
const FunctorBase& actionOnOff);
bool listenStageSwitchOnKill(IUseStageSwitch* stageSwitchHolder, const FunctorBase& actionOnOn);
} // namespace al