Library/Obj and Project/Camera: Implement CameraWatchPoint and CameraSubTargetTurnParam (#121)

This commit is contained in:
Fuzzy2319 2024-06-28 11:33:43 +02:00 committed by GitHub
parent 5d38d38af4
commit 0326bbbeb6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 134 additions and 9 deletions

View File

@ -60413,11 +60413,11 @@ Address,Quality,Size,Name
0x0000007100963bf0,O,000128,_ZN2al16CameraRailHolderC2EPKc
0x0000007100963c70,O,000140,_ZN2al16CameraRailHolderC1EPKc
0x0000007100963cfc,O,000292,_ZN2al16CameraRailHolder4initERKNS_13ActorInitInfoE
0x0000007100963e20,U,000124,_ZN2al16CameraWatchPointC2EPKc
0x0000007100963e9c,U,000136,_ZN2al16CameraWatchPointC1EPKc
0x0000007100963f24,U,000216,_ZN2al16CameraWatchPoint4initERKNS_13ActorInitInfoE
0x0000007100963ffc,U,000040,_ZN2al16CameraWatchPoint14makeActorAliveEv
0x0000007100964024,U,000040,_ZN2al16CameraWatchPoint4killEv
0x0000007100963e20,O,000124,_ZN2al16CameraWatchPointC2EPKc
0x0000007100963e9c,O,000136,_ZN2al16CameraWatchPointC1EPKc
0x0000007100963f24,O,000216,_ZN2al16CameraWatchPoint4initERKNS_13ActorInitInfoE
0x0000007100963ffc,O,000040,_ZN2al16CameraWatchPoint14makeActorAliveEv
0x0000007100964024,O,000040,_ZN2al16CameraWatchPoint4killEv
0x000000710096404c,U,000280,_ZN2al12CollisionObjC2ERKNS_13ActorInitInfoEPNS_8ResourceEPKcPNS_9HitSensorEPKN4sead8Matrix34IfEES7_
0x0000007100964164,U,000284,_ZN2al12CollisionObjC1ERKNS_13ActorInitInfoEPNS_8ResourceEPKcPNS_9HitSensorEPKN4sead8Matrix34IfEES7_
0x0000007100964280,U,000308,_ZN2al16DepthShadowModelC2EPNS_9LiveActorERKNS_13ActorInitInfoEPKcb
@ -65936,7 +65936,7 @@ Address,Quality,Size,Name
0x0000007100a4c174,U,000124,_ZN2al20CameraParamMoveLimitC2Ev
0x0000007100a4c1f0,U,000056,_ZN2al15CameraStateBaseC1EPKcPNS_11CameraPoserE
0x0000007100a4c228,U,000036,_ZN2al15CameraStateBaseD0Ev
0x0000007100a4c24c,U,000284,_ZN2al24CameraSubTargetTurnParam4initERKNS_13ActorInitInfoE
0x0000007100a4c24c,O,000284,_ZN2al24CameraSubTargetTurnParam4initERKNS_13ActorInitInfoE
0x0000007100a4c368,U,000248,_ZN2al19SimpleCameraShooterC2EPKc
0x0000007100a4c460,U,000020,_ZN2al19SimpleCameraShooter27calcAspectRatioByScreenSizeEii
0x0000007100a4c474,U,000200,_ZNK2al19SimpleCameraShooter13calcCameraPosEPN4sead7Vector3IfEEPKNS_13IUseCollisionE

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

View File

@ -6,10 +6,18 @@ namespace al {
// TODO: Add functions.
class IUseCamera;
class Projection;
class CameraSubTargetBase;
class CameraSubTargetTurnParam;
class LiveActor;
Projection getProjection(const IUseCamera*, s32);
Projection getProjection(const IUseCamera* cameraHolder, s32 cameraNum);
sead::Vector3f* getCameraPos(const IUseCamera*, s32);
void calcCameraUpDir(sead::Vector3f*, const IUseCamera*, s32);
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*);
void initCameraSubTargetTurnParam(CameraSubTargetBase* cameraSubTarget,
const CameraSubTargetTurnParam* params);
void setCameraPlacementSubTarget(IUseCamera* cameraHolder, CameraSubTargetBase* cameraSubTarget);
void resetCameraPlacementSubTarget(IUseCamera* cameraHolder, CameraSubTargetBase* cameraSubTarget);
} // namespace al

View File

@ -6,4 +6,7 @@ class LiveActor;
LiveActor* createLinksActorFromFactory(const ActorInitInfo& info, const char* linkName,
s32 linkNum);
bool trySyncStageSwitchAppear(LiveActor* actor);
void initActorPoseTRSV(LiveActor* actor);
void initActorSRT(LiveActor* actor, const ActorInitInfo& info);
bool trySyncStageSwitchAppearAndKill(LiveActor* actor);
} // namespace al

View File

@ -0,0 +1,41 @@
#include "Library/Obj/CameraWatchPoint.h"
#include "Library/Camera/CameraUtil.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorDrawFunction.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Project/Camera/CameraSubTargetTurnParam.h"
namespace al {
CameraWatchPoint::CameraWatchPoint(const char* name) : LiveActor(name) {}
void CameraWatchPoint::init(const ActorInitInfo& info) {
initActorSceneInfo(this, info);
initActorPoseTRSV(this);
initActorSRT(this, info);
initActorClipping(this, info);
invalidateClipping(this);
initExecutorWatchObj(this, info);
initStageSwitch(this, info);
mCameraSubTarget = createActorCameraSubTarget(this, nullptr);
CameraSubTargetTurnParam* params = new CameraSubTargetTurnParam();
params->init(info);
initCameraSubTargetTurnParam(mCameraSubTarget, params);
trySyncStageSwitchAppearAndKill(this);
}
void CameraWatchPoint::makeActorAlive() {
LiveActor::makeActorAlive();
setCameraPlacementSubTarget(this, mCameraSubTarget);
}
void CameraWatchPoint::kill() {
LiveActor::kill();
resetCameraPlacementSubTarget(this, mCameraSubTarget);
}
} // namespace al

View File

@ -0,0 +1,21 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
namespace al {
class CameraSubTargetBase;
class CameraWatchPoint : public LiveActor {
public:
CameraWatchPoint(const char* name);
void init(const ActorInitInfo& info) override;
void makeActorAlive() override;
void kill() override;
private:
CameraSubTargetBase* mCameraSubTarget = nullptr;
};
static_assert(sizeof(CameraWatchPoint) == 0x110);
} // namespace al

View File

@ -0,0 +1,23 @@
#include "Project/Camera/CameraSubTargetTurnParam.h"
#include "Library/Placement/PlacementFunction.h"
namespace al {
void CameraSubTargetTurnParam::init(const ActorInitInfo& info) {
tryGetArg(&mTurnSpeedRate1, info, "TurnSpeedRate1");
tryGetArg(&mTurnSpeedRate2, info, "TurnSpeedRate2");
tryGetArg(&mTurnBrakeEndDistance, info, "TurnBrakeEndDistance");
tryGetArg(&mTurnBrakeStartDistance, info, "TurnBrakeStartDistance");
tryGetArg(&mTurnStopStartDistance, info, "TurnStopStartDistance");
tryGetArg(&mTurnStopEndDistance, info, "TurnStopEndDistance");
if (tryGetArg(&mIsTurnV, info, "IsTurnV") && mIsTurnV) {
tryGetArg(&mIsResetAfterTurnV, info, "IsResetAfterTurnV");
tryGetArg(&mMinTurnDegreeV, info, "MinTurnDegreeV");
tryGetArg(&mMaxTurnDegreeV, info, "MaxTurnDegreeV");
}
tryGetArg(&mValidTurnDegreeRangeH, info, "ValidTurnDegreeRangeH");
tryGetArg(&mValidFaceDegreeRangeH, info, "ValidFaceDegreeRangeH");
}
} // namespace al

View File

@ -0,0 +1,29 @@
#pragma once
#include <basis/seadTypes.h>
namespace al {
class ActorInitInfo;
class CameraSubTargetTurnParam {
public:
CameraSubTargetTurnParam() {}
void init(const ActorInitInfo& info);
private:
f32 mTurnSpeedRate1 = 0.3f;
f32 mTurnSpeedRate2 = 0.1f;
f32 mTurnBrakeEndDistance = -1.0f;
f32 mTurnBrakeStartDistance = -1.0f;
f32 mTurnStopStartDistance = -1.0f;
f32 mTurnStopEndDistance = -1.0f;
s32 _18 = 30;
bool mIsTurnV = false;
bool mIsResetAfterTurnV = false;
f32 mMinTurnDegreeV = 0.0f;
f32 mMaxTurnDegreeV = 0.0f;
f32 mValidTurnDegreeRangeH = -1.0f;
f32 mValidFaceDegreeRangeH = -1.0f;
};
} // namespace al