mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
Event: Implement EventActorMovementRailTraffic
This commit is contained in:
parent
b6f947c559
commit
2de273d5f3
|
|
@ -44786,76 +44786,76 @@ Event/EventActorMovementRailTraffic.o:
|
|||
label:
|
||||
- _ZN29EventActorMovementRailTrafficC1EPKcPN2al9LiveActorE
|
||||
- _ZN29EventActorMovementRailTrafficC2EPKcPN2al9LiveActorE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x1aec98
|
||||
size: 156
|
||||
label: _ZN29EventActorMovementRailTraffic4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x1aed34
|
||||
size: 52
|
||||
label: _ZN29EventActorMovementRailTraffic6appearEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x1aed68
|
||||
size: 68
|
||||
label: _ZN29EventActorMovementRailTraffic7exeMoveEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x1aedac
|
||||
size: 100
|
||||
label: _ZN29EventActorMovementRailTraffic17exeStopByOtherNpcEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x1aee10
|
||||
size: 20
|
||||
label: _ZN29EventActorMovementRailTraffic12exeStopAfterEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x1aee24
|
||||
size: 8
|
||||
label: _ZNK2al17EventFlowMovement22getEventFlowDataHolderEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee2c
|
||||
size: 4
|
||||
label: _ZN2al17EventFlowMovement4killEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee30
|
||||
size: 4
|
||||
label: _ZN2al17EventFlowMovement7controlEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee34
|
||||
size: 8
|
||||
label: _ZNK2al17EventFlowMovement14getNerveKeeperEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee3c
|
||||
size: 8
|
||||
label: _ZNK2al17EventFlowMovement14isTurnMovementEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee44
|
||||
size: 8
|
||||
label: _ZNK2al17EventFlowMovement21isWaitAtPointMovementEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee4c
|
||||
size: 8
|
||||
label: _ZThn8_NK2al17EventFlowMovement14getNerveKeeperEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
lazy: true
|
||||
- offset: 0x1aee54
|
||||
size: 80
|
||||
label: _ZNK12_GLOBAL__N_136EventActorMovementRailTrafficNrvMove7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x1aeea4
|
||||
size: 112
|
||||
label: _ZNK12_GLOBAL__N_146EventActorMovementRailTrafficNrvStopByOtherNpc7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x1aef14
|
||||
size: 36
|
||||
label: _ZNK12_GLOBAL__N_141EventActorMovementRailTrafficNrvStopAfter7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
Event/EventActorMovementTurn.o:
|
||||
'.text':
|
||||
|
|
|
|||
27
lib/al/Library/Event/EventFlowActorStateRail.h
Normal file
27
lib/al/Library/Event/EventFlowActorStateRail.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadVector.h>
|
||||
|
||||
#include "Project/Event/EventFlowActorStateBase.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class EventFlowMovement;
|
||||
|
||||
class EventFlowActorStateRail : public EventFlowActorStateBase {
|
||||
public:
|
||||
EventFlowActorStateRail(const char* name, EventFlowMovement* movement);
|
||||
|
||||
void initByPlacementInfo(const ActorInitInfo& info);
|
||||
void appear() override;
|
||||
void exeWalk();
|
||||
void exeTurn();
|
||||
|
||||
private:
|
||||
sead::Vector3f mRailOffset = sead::Vector3f::zero;
|
||||
s32 mRailMoveType = -1;
|
||||
};
|
||||
|
||||
static_assert(sizeof(EventFlowActorStateRail) == 0x38);
|
||||
} // namespace al
|
||||
46
lib/al/Library/Event/EventFlowMovement.h
Normal file
46
lib/al/Library/Event/EventFlowMovement.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
#include "Library/Event/IUseEventFlowData.h"
|
||||
#include "Library/Nerve/IUseNerve.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class EventFlowDataHolder;
|
||||
class LiveActor;
|
||||
class Nerve;
|
||||
class NerveKeeper;
|
||||
|
||||
class EventFlowMovement : public IUseEventFlowData, public IUseNerve {
|
||||
public:
|
||||
EventFlowMovement(const char* name, LiveActor* actor);
|
||||
|
||||
void movement();
|
||||
void initNerve(const Nerve* nerve, s32 stateCount);
|
||||
|
||||
virtual void init(const ActorInitInfo& info) = 0;
|
||||
|
||||
virtual void kill() {}
|
||||
|
||||
virtual void appear() {}
|
||||
|
||||
virtual void control() {}
|
||||
|
||||
NerveKeeper* getNerveKeeper() const override { return mNerveKeeper; }
|
||||
|
||||
virtual bool isTurnMovement() const { return false; }
|
||||
|
||||
virtual bool isWaitAtPointMovement() const { return false; }
|
||||
|
||||
EventFlowDataHolder* getEventFlowDataHolder() const override { return mEventFlowDataHolder; }
|
||||
|
||||
protected:
|
||||
const char* mName = nullptr;
|
||||
LiveActor* mActor = nullptr;
|
||||
NerveKeeper* mNerveKeeper = nullptr;
|
||||
EventFlowDataHolder* mEventFlowDataHolder = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(EventFlowMovement) == 0x30);
|
||||
} // namespace al
|
||||
52
src/Event/EventActorMovementRailTraffic.cpp
Normal file
52
src/Event/EventActorMovementRailTraffic.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
#include "Event/EventActorMovementRailTraffic.h"
|
||||
|
||||
#include "Library/Event/EventFlowActorStateRail.h"
|
||||
#include "Library/Event/EventFlowUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
|
||||
#include "Npc/TrafficRailWatcherDirector.h"
|
||||
|
||||
namespace {
|
||||
NERVE_IMPL(EventActorMovementRailTraffic, Move);
|
||||
NERVE_IMPL(EventActorMovementRailTraffic, StopByOtherNpc);
|
||||
NERVE_IMPL(EventActorMovementRailTraffic, StopAfter);
|
||||
|
||||
NERVES_MAKE_NOSTRUCT(EventActorMovementRailTraffic, Move, StopByOtherNpc, StopAfter);
|
||||
} // namespace
|
||||
|
||||
EventActorMovementRailTraffic::EventActorMovementRailTraffic(const char* name, al::LiveActor* actor)
|
||||
: al::EventFlowMovement(name, actor) {}
|
||||
|
||||
void EventActorMovementRailTraffic::init(const al::ActorInitInfo& info) {
|
||||
initNerve(&Move, 1);
|
||||
|
||||
al::EventFlowActorStateRail* railState = new al::EventFlowActorStateRail("", this);
|
||||
railState->initByPlacementInfo(info);
|
||||
al::initNerveState(this, railState, &Move, "");
|
||||
rs::registerTrafficRailWatcher(mActor, info);
|
||||
appear();
|
||||
}
|
||||
|
||||
void EventActorMovementRailTraffic::appear() {
|
||||
al::setNerve(this, getNerveKeeper()->getCurrentNerve());
|
||||
}
|
||||
|
||||
void EventActorMovementRailTraffic::exeMove() {
|
||||
if (rs::tryStopTrafficRailByOtherNpc(mActor))
|
||||
al::setNerve(this, &StopByOtherNpc);
|
||||
else
|
||||
al::updateNerveState(this);
|
||||
}
|
||||
|
||||
void EventActorMovementRailTraffic::exeStopByOtherNpc() {
|
||||
if (al::isFirstStep(this))
|
||||
al::tryStartEventActionIfNotPlaying(mActor, this, "Wait");
|
||||
|
||||
if (rs::tryRestartTrafficRailByOtherNpc(mActor))
|
||||
al::setNerve(this, &StopAfter);
|
||||
}
|
||||
|
||||
void EventActorMovementRailTraffic::exeStopAfter() {
|
||||
al::setNerveAtGreaterEqualStep(this, &Move, 20);
|
||||
}
|
||||
22
src/Event/EventActorMovementRailTraffic.h
Normal file
22
src/Event/EventActorMovementRailTraffic.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
|
||||
#include "Library/Event/EventFlowMovement.h"
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class LiveActor;
|
||||
} // namespace al
|
||||
|
||||
class EventActorMovementRailTraffic : public al::EventFlowMovement {
|
||||
public:
|
||||
EventActorMovementRailTraffic(const char* name, al::LiveActor* actor);
|
||||
|
||||
void init(const al::ActorInitInfo& info) override;
|
||||
void appear() override;
|
||||
|
||||
void exeMove();
|
||||
void exeStopByOtherNpc();
|
||||
void exeStopAfter();
|
||||
};
|
||||
|
||||
static_assert(sizeof(EventActorMovementRailTraffic) == 0x30);
|
||||
36
src/Npc/TrafficRailWatcherDirector.h
Normal file
36
src/Npc/TrafficRailWatcherDirector.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
|
||||
#include "Library/HostIO/HioNode.h"
|
||||
#include "Library/Scene/ISceneObj.h"
|
||||
|
||||
class TrafficRailWatcher;
|
||||
|
||||
namespace al {
|
||||
struct ActorInitInfo;
|
||||
class LiveActor;
|
||||
} // namespace al
|
||||
|
||||
class TrafficRailWatcherDirector : public al::HioNode, public al::ISceneObj {
|
||||
public:
|
||||
TrafficRailWatcherDirector();
|
||||
|
||||
void* registerActor(const al::LiveActor* actor, const al::ActorInitInfo& info);
|
||||
TrafficRailWatcher* findActorRailWatcher(const al::LiveActor* actor) const;
|
||||
const char* getSceneObjName() const override;
|
||||
|
||||
private:
|
||||
s32 mWatcherCount = 0;
|
||||
TrafficRailWatcher** mWatchers = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(TrafficRailWatcherDirector) == 0x18);
|
||||
|
||||
namespace rs {
|
||||
void* registerTrafficRailWatcher(const al::LiveActor* actor, const al::ActorInitInfo& info);
|
||||
void stopTrafficRailByTraffic(const al::LiveActor* actor);
|
||||
void restartTrafficRailByTraffic(const al::LiveActor* actor);
|
||||
bool tryStopTrafficRailByOtherNpc(const al::LiveActor* actor);
|
||||
bool tryRestartTrafficRailByOtherNpc(const al::LiveActor* actor);
|
||||
} // namespace rs
|
||||
23
src/Project/Event/EventFlowActorStateBase.h
Normal file
23
src/Project/Event/EventFlowActorStateBase.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "Library/Event/IUseEventFlowData.h"
|
||||
#include "Library/Nerve/NerveStateBase.h"
|
||||
|
||||
namespace al {
|
||||
class EventFlowDataHolder;
|
||||
class EventFlowMovement;
|
||||
class LiveActor;
|
||||
|
||||
class EventFlowActorStateBase : public NerveStateBase, public IUseEventFlowData {
|
||||
public:
|
||||
EventFlowActorStateBase(const char* name, EventFlowMovement* movement);
|
||||
|
||||
LiveActor* getActor() const;
|
||||
EventFlowDataHolder* getEventFlowDataHolder() const override;
|
||||
|
||||
protected:
|
||||
EventFlowMovement* mMovement = nullptr;
|
||||
};
|
||||
|
||||
static_assert(sizeof(EventFlowActorStateBase) == 0x28);
|
||||
} // namespace al
|
||||
Loading…
Reference in a new issue