Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actor: BarrierField #90

Merged
merged 8 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -385,24 +385,24 @@ Address,Quality,Size,Name
0x0000007100009cb8,U,000096,_ZNK12_GLOBAL__N_128ShopBgmPlayerNrvWaitOnSwitch7executeEPN2al11NerveKeeperE
0x0000007100009d18,U,000008,_ZNK12_GLOBAL__N_120ShopBgmPlayerNrvPlay7executeEPN2al11NerveKeeperE
0x0000007100009d20,U,000128,
0x0000007100009da0,U,000124,_ZN12BarrierFieldC2EPKc
0x0000007100009e1c,U,000136,_ZN12BarrierFieldC1EPKc
0x0000007100009ea4,U,000164,_ZN12BarrierField4initERKN2al13ActorInitInfoE
0x0000007100009f48,U,000116,_ZN12BarrierField6appearEv
0x0000007100009fbc,U,000056,_ZN12BarrierField4killEv
0x0000007100009ff4,U,000064,_ZN12BarrierField19disappearByShineGetEv
0x000000710000a034,U,000004,_ZN12BarrierField9exeAppearEv
0x000000710000a038,U,000004,_ZN12BarrierField24exeAppearBreedaMoonWorldEv
0x000000710000a03c,U,000004,_ZN12BarrierField7exeHideEv
0x000000710000a040,U,000012,_ZN12BarrierField12exeDisappearEv
0x000000710000a04c,U,000004,_ZNK12_GLOBAL__N_119BarrierFieldNrvHide7executeEPN2al11NerveKeeperE
0x000000710000a050,U,000012,_ZNK12_GLOBAL__N_119BarrierFieldNrvHide13getActionNameEv
0x000000710000a05c,U,000004,_ZNK12_GLOBAL__N_121BarrierFieldNrvAppear7executeEPN2al11NerveKeeperE
0x000000710000a060,U,000012,_ZNK12_GLOBAL__N_121BarrierFieldNrvAppear13getActionNameEv
0x000000710000a06c,U,000004,_ZNK12_GLOBAL__N_136BarrierFieldNrvAppearBreedaMoonWorld7executeEPN2al11NerveKeeperE
0x000000710000a070,U,000012,_ZNK12_GLOBAL__N_136BarrierFieldNrvAppearBreedaMoonWorld13getActionNameEv
0x000000710000a07c,U,000016,_ZNK12_GLOBAL__N_124BarrierFieldNrvDisappear7executeEPN2al11NerveKeeperE
0x000000710000a08c,U,000012,_ZNK12_GLOBAL__N_124BarrierFieldNrvDisappear13getActionNameEv
0x0000007100009da0,O,000124,_ZN12BarrierFieldC2EPKc
0x0000007100009e1c,O,000136,_ZN12BarrierFieldC1EPKc
0x0000007100009ea4,O,000164,_ZN12BarrierField4initERKN2al13ActorInitInfoE
0x0000007100009f48,O,000116,_ZN12BarrierField6appearEv
0x0000007100009fbc,O,000056,_ZN12BarrierField4killEv
0x0000007100009ff4,O,000064,_ZN12BarrierField19disappearByShineGetEv
0x000000710000a034,O,000004,_ZN12BarrierField9exeAppearEv
0x000000710000a038,O,000004,_ZN12BarrierField24exeAppearBreedaMoonWorldEv
0x000000710000a03c,O,000004,_ZN12BarrierField7exeHideEv
0x000000710000a040,O,000012,_ZN12BarrierField12exeDisappearEv
0x000000710000a04c,O,000004,_ZNK12_GLOBAL__N_119BarrierFieldNrvHide7executeEPN2al11NerveKeeperE
0x000000710000a050,O,000012,_ZNK12_GLOBAL__N_119BarrierFieldNrvHide13getActionNameEv
0x000000710000a05c,O,000004,_ZNK12_GLOBAL__N_121BarrierFieldNrvAppear7executeEPN2al11NerveKeeperE
0x000000710000a060,O,000012,_ZNK12_GLOBAL__N_121BarrierFieldNrvAppear13getActionNameEv
0x000000710000a06c,O,000004,_ZNK12_GLOBAL__N_136BarrierFieldNrvAppearBreedaMoonWorld7executeEPN2al11NerveKeeperE
0x000000710000a070,O,000012,_ZNK12_GLOBAL__N_136BarrierFieldNrvAppearBreedaMoonWorld13getActionNameEv
0x000000710000a07c,O,000016,_ZNK12_GLOBAL__N_124BarrierFieldNrvDisappear7executeEPN2al11NerveKeeperE
0x000000710000a08c,O,000012,_ZNK12_GLOBAL__N_124BarrierFieldNrvDisappear13getActionNameEv
0x000000710000a098,U,000140,
0x000000710000a124,U,000244,_ZN8BombTailC2EPKcP22MultiGateKeeperWatcher
0x000000710000a218,U,000256,_ZN8BombTailC1EPKcP22MultiGateKeeperWatcher
Expand Down
3 changes: 3 additions & 0 deletions lib/al/Library/Stage/StageSwitchKeeper.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class StageSwitchAccesser;
class StageSwitchDirector;
class StageSwitchListener;
class PlacementInfo;
class IUseStageSwitch;

class StageSwitchKeeper {
public:
Expand Down Expand Up @@ -44,5 +45,7 @@ class StageSwitchDirector : public HioNode, public IUseExecutor {
};
static_assert(sizeof(StageSwitchDirector) == 0x20);

bool tryOnStageSwitch(IUseStageSwitch*, const char*);
bool tryOffStageSwitch(IUseStageSwitch*, const char*);
bool tryOnSwitchDeadOn(IUseStageSwitch* stageSwitch);
} // namespace al
74 changes: 74 additions & 0 deletions src/MapObj/BarrierField.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#include "MapObj/BarrierField.h"

#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorActionFunction.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorInitInfo.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Stage/StageSwitchKeeper.h"

#include "System/GameDataFunction.h"
#include "System/GameDataHolderAccessor.h"
#include "Util/DemoUtil.h"

namespace alNerveFunction {
class NerveActionCollector;
}

namespace {
NERVE_ACTION_IMPL(BarrierField, Appear);
NERVE_ACTION_IMPL(BarrierField, AppearBreedaMoonWorld);
NERVE_ACTION_IMPL(BarrierField, Hide);
NERVE_ACTION_IMPL(BarrierField, Disappear);

NERVE_ACTIONS_MAKE_STRUCT(BarrierField, Appear, AppearBreedaMoonWorld, Hide, Disappear);

} // namespace

BarrierField::BarrierField(const char* name) : al::LiveActor(name) {}

void BarrierField::init(const al::ActorInitInfo& initInfo) {
al::initNerveAction(this, "Hide", &NrvBarrierField.mCollector, 0);
al::initMapPartsActor(this, initInfo, nullptr);
al::tryGetArg(&mIsDisappearByShineGet, initInfo, "IsDisappearByShineGet");
if (al::isObjectName(initInfo, "WaterfallWorldHomeBarrier")) {
if (GameDataFunction::isWorldMoon(this))
mIsMoon = true;
}
al::trySyncStageSwitchAppearAndKill(this);
}

void BarrierField::appear() {
LiveActor::appear();

if (mIsMoon)
al::startNerveAction(this, "AppearBreedaMoonWorld");
else
al::startNerveAction(this, "Appear");

al::tryOnStageSwitch(this, "SwitchExistOnOff");
al::invalidateClipping(this);
if (mIsDisappearByShineGet)
rs::setBossBarrierField(this);
}

void BarrierField::kill() {
al::tryOffStageSwitch(this, "SwitchExistOnOff");
al::validateClipping(this);
al::LiveActor::kill();
}

void BarrierField::disappearByShineGet() {
if (getEffectKeeper())
al::tryKillEmitterAndParticleAll(this);
kill();
}

void BarrierField::exeAppear() {}
void BarrierField::exeAppearBreedaMoonWorld() {}
void BarrierField::exeHide() {}

void BarrierField::exeDisappear() {
kill();
}
26 changes: 26 additions & 0 deletions src/MapObj/BarrierField.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include "Library/LiveActor/LiveActor.h"

namespace al {
class LiveActor;
class ActorInitInfo;
} // namespace al

class BarrierField : public al::LiveActor {
public:
BarrierField(const char*);
void init(const al::ActorInitInfo&) override;
void appear() override;
void kill() override;
void disappearByShineGet();

void exeAppear();
void exeAppearBreedaMoonWorld();
void exeHide();
void exeDisappear();

private:
bool mIsDisappearByShineGet = false;
bool mIsMoon = false;
};
7 changes: 7 additions & 0 deletions src/Util/DemoUtil.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

class BarrierField;

namespace rs {
void setBossBarrierField(BarrierField*);
}
Loading