mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Library/Obj: Implement HostSyncTowerCamera (#886)
This commit is contained in:
parent
875e4ec961
commit
b92c17a0b9
|
|
@ -294787,48 +294787,48 @@ Project/Obj/HostSyncTowerCamera.o:
|
|||
label:
|
||||
- _ZN2al19HostSyncTowerCameraC1EPNS_9LiveActorEPNS_12AreaObjGroupERKNS_13ActorInitInfoE
|
||||
- _ZN2al19HostSyncTowerCameraC2EPNS_9LiveActorEPNS_12AreaObjGroupERKNS_13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa72590
|
||||
size: 4
|
||||
label: _ZN2al19HostSyncTowerCamera6updateEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa72594
|
||||
size: 84
|
||||
label: _ZN2al19HostSyncTowerCamera8activateEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa725e8
|
||||
size: 112
|
||||
label: _ZN2al19HostSyncTowerCamera10deactivateEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa72658
|
||||
size: 80
|
||||
label: _ZN2al19HostSyncTowerCamera12tryEndCameraEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa726a8
|
||||
size: 164
|
||||
label: _ZN2al19HostSyncTowerCamera9exeActiveEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa7274c
|
||||
size: 76
|
||||
label: _ZN2al19HostSyncTowerCamera14tryStartCameraEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa72798
|
||||
size: 4
|
||||
label: _ZN2al19HostSyncTowerCamera11exeDeactiveEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0xa7279c
|
||||
size: 36
|
||||
label: _ZN2al19HostSyncTowerCameraD0Ev
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0xa727c0
|
||||
size: 4
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _ZNK12_GLOBAL__N_130HostSyncTowerCameraNrvDeactive7executeEPN2al11NerveKeeperE
|
||||
status: Matching
|
||||
- offset: 0xa727c4
|
||||
size: 8
|
||||
label: ''
|
||||
status: NotDecompiled
|
||||
label: _ZNK12_GLOBAL__N_128HostSyncTowerCameraNrvActive7executeEPN2al11NerveKeeperE
|
||||
status: Matching
|
||||
Project/Obj/TraceActor.o:
|
||||
'.text':
|
||||
- offset: 0xa727cc
|
||||
|
|
|
|||
64
lib/al/Library/Obj/HostSyncTowerCamera.cpp
Normal file
64
lib/al/Library/Obj/HostSyncTowerCamera.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include "Library/Obj/HostSyncTowerCamera.h"
|
||||
|
||||
#include "Library/Area/AreaObjUtil.h"
|
||||
#include "Library/Camera/CameraUtil.h"
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/LiveActor/LiveActor.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
#include "Library/Player/PlayerUtil.h"
|
||||
|
||||
namespace {
|
||||
using namespace al;
|
||||
NERVE_IMPL(HostSyncTowerCamera, Deactive);
|
||||
NERVE_IMPL(HostSyncTowerCamera, Active);
|
||||
NERVES_MAKE_NOSTRUCT(HostSyncTowerCamera, Deactive, Active);
|
||||
} // namespace
|
||||
|
||||
namespace al {
|
||||
HostSyncTowerCamera::HostSyncTowerCamera(LiveActor* actor, AreaObjGroup* activationArea,
|
||||
const ActorInitInfo& info)
|
||||
: NerveExecutor("ホスト同期タワーカメラ制御"), mActor(actor), mActivationArea(activationArea) {
|
||||
initNerve(&Deactive);
|
||||
mTowerCamera =
|
||||
initTowerCameraWithSave(mActor, getTransPtr(mActor), info, "アクター追従塔カメラ");
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::update() {
|
||||
updateNerve();
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::activate() {
|
||||
if (!isNerve(this, &Active) && mTowerCamera && mActivationArea)
|
||||
setNerve(this, &Active);
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::deactivate() {
|
||||
if (!isNerve(this, &Deactive)) {
|
||||
tryEndCamera();
|
||||
setNerve(this, &Deactive);
|
||||
}
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::tryEndCamera() {
|
||||
if (mTowerCamera && isActiveCamera(mTowerCamera))
|
||||
endCamera(mActor, mTowerCamera, -1, false);
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::exeActive() {
|
||||
AreaObjGroup* areaObjGroup = mActivationArea;
|
||||
LiveActor* playerActor = tryFindNearestPlayerActor(mActor);
|
||||
if (playerActor && isInAreaObj(areaObjGroup, getTrans(playerActor)))
|
||||
tryStartCamera();
|
||||
else
|
||||
tryEndCamera();
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::tryStartCamera() {
|
||||
if (mTowerCamera && !isActiveCamera(mTowerCamera))
|
||||
startCamera(mActor, mTowerCamera);
|
||||
}
|
||||
|
||||
void HostSyncTowerCamera::exeDeactive() {}
|
||||
|
||||
} // namespace al
|
||||
|
|
@ -10,7 +10,7 @@ class LiveActor;
|
|||
|
||||
class HostSyncTowerCamera : public NerveExecutor {
|
||||
public:
|
||||
HostSyncTowerCamera(LiveActor*, AreaObjGroup*, const ActorInitInfo&);
|
||||
HostSyncTowerCamera(LiveActor* actor, AreaObjGroup* activationArea, const ActorInitInfo& info);
|
||||
void update();
|
||||
void activate();
|
||||
void deactivate();
|
||||
|
|
@ -20,9 +20,9 @@ public:
|
|||
void exeDeactive();
|
||||
|
||||
private:
|
||||
LiveActor* _10;
|
||||
CameraTicket* _18;
|
||||
AreaObjGroup* _20;
|
||||
LiveActor* mActor = nullptr;
|
||||
CameraTicket* mTowerCamera = nullptr;
|
||||
AreaObjGroup* mActivationArea = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(HostSyncTowerCamera) == 0x28);
|
||||
|
|
|
|||
Loading…
Reference in a new issue