MapObj: Implement DoorCity (#1019)

This commit is contained in:
guymakinggames 2026-04-21 21:07:21 +01:00 committed by GitHub
parent 8f46da6630
commit 24464f3b81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 112 additions and 16 deletions

View file

@ -66674,64 +66674,64 @@ MapObj/DoorCity.o:
- offset: 0x25fe38
size: 120
label: _ZN8DoorCityC2EPKc
status: NotDecompiled
status: Matching
- offset: 0x25feb0
size: 132
label: _ZN8DoorCityC1EPKc
status: NotDecompiled
status: Matching
- offset: 0x25ff34
size: 304
label: _ZN8DoorCity4initERKN2al13ActorInitInfoE
status: NotDecompiled
status: Matching
- offset: 0x260064
size: 12
label: _ZN8DoorCity13onStageSwitchEv
status: NotDecompiled
status: Matching
- offset: 0x260070
size: 4
label: _ZN8DoorCity15listenSwitchOffEv
status: NotDecompiled
status: Matching
- offset: 0x260074
size: 60
label: _ZN8DoorCity11exeWaitOpenEv
status: NotDecompiled
status: Matching
- offset: 0x2600b0
size: 96
label: _ZN8DoorCity7exeOpenEv
status: NotDecompiled
status: Matching
- offset: 0x260110
size: 88
label: _ZN8DoorCity12exeWaitCloseEv
status: NotDecompiled
status: Matching
- offset: 0x260168
size: 64
label: _ZNK12_GLOBAL__N_119DoorCityNrvWaitOpen7executeEPN2al11NerveKeeperE
status: NotDecompiled
status: Matching
guess: true
- offset: 0x2601a8
size: 92
label: _ZNK12_GLOBAL__N_120DoorCityNrvWaitClose7executeEPN2al11NerveKeeperE
status: NotDecompiled
status: Matching
guess: true
- offset: 0x260204
size: 100
label: _ZNK12_GLOBAL__N_115DoorCityNrvOpen7executeEPN2al11NerveKeeperE
status: NotDecompiled
status: Matching
guess: true
- offset: 0x260268
size: 28
label: _ZNK2al10FunctorV0MIP8DoorCityMS1_FvvEEclEv
status: NotDecompiled
status: Matching
lazy: true
- offset: 0x260284
size: 76
label: _ZNK2al10FunctorV0MIP8DoorCityMS1_FvvEE5cloneEv
status: NotDecompiled
status: Matching
lazy: true
- offset: 0x2602d0
size: 4
label: _ZN2al10FunctorV0MIP8DoorCityMS1_FvvEED0Ev
status: NotDecompiled
status: Matching
lazy: true
MapObj/DoorSnow.o:
'.text':
@ -134196,7 +134196,7 @@ Scene/ProjectActorFactory.o:
- offset: 0x4b7dbc
size: 52
label: _ZN2al19createActorFunctionI8DoorCityEEPNS_9LiveActorEPKc
status: NotDecompiled
status: Matching
lazy: true
- offset: 0x4b7df0
size: 52

77
src/MapObj/DoorCity.cpp Normal file
View file

@ -0,0 +1,77 @@
#include "MapObj/DoorCity.h"
#include "Library/Base/StringUtil.h"
#include "Library/LiveActor/ActorActionFunction.h"
#include "Library/LiveActor/ActorCollisionFunction.h"
#include "Library/LiveActor/ActorInitUtil.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Nerve/NerveUtil.h"
#include "Library/Placement/PlacementFunction.h"
#include "Library/Stage/StageSwitchUtil.h"
#include "Library/Thread/FunctorV0M.h"
#include "System/GameDataFunction.h"
namespace {
NERVE_IMPL(DoorCity, Open);
NERVE_IMPL(DoorCity, WaitOpen);
NERVE_IMPL(DoorCity, WaitClose);
NERVES_MAKE_NOSTRUCT(DoorCity, Open, WaitOpen, WaitClose);
} // namespace
DoorCity::DoorCity(const char* name) : al::LiveActor(name) {}
void DoorCity::init(const al::ActorInitInfo& info) {
using DoorCityFunctor = al::FunctorV0M<DoorCity*, void (DoorCity::*)()>;
al::initActor(this, info);
const char* initState = nullptr;
al::getStringArg(&initState, info, "InitState");
if (al::isEqualString(initState, "Open")) {
al::initNerve(this, &WaitOpen, 0);
al::invalidateCollisionParts(this);
} else if (al::isEqualString(initState, "Close")) {
al::initNerve(this, &WaitClose, 0);
al::listenStageSwitchOnStart(this, DoorCityFunctor(this, &DoorCity::onStageSwitch));
} else {
kill();
return;
}
makeActorAlive();
al::listenStageSwitchOn(this, "SwitchLightOff",
DoorCityFunctor(this, &DoorCity::listenSwitchOff));
}
void DoorCity::onStageSwitch() {
al::setNerve(this, &Open);
}
void DoorCity::listenSwitchOff() {}
void DoorCity::exeWaitOpen() {
if (al::isFirstStep(this))
al::startAction(this, "OpenWait");
}
void DoorCity::exeOpen() {
if (al::isFirstStep(this))
al::startAction(this, "Open");
if (al::isActionEnd(this)) {
al::invalidateCollisionParts(this);
al::setNerve(this, &WaitOpen);
}
}
void DoorCity::exeWaitClose() {
if (al::isFirstStep(this)) {
if (GameDataFunction::getScenarioNo(this) == 1)
al::tryStartAction(this, "Blink");
else
al::tryStartAction(this, "CloseWait");
}
}

18
src/MapObj/DoorCity.h Normal file
View file

@ -0,0 +1,18 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
class DoorCity : public al::LiveActor {
public:
DoorCity(const char* name);
void init(const al::ActorInitInfo& info) override;
void onStageSwitch();
void listenSwitchOff();
void exeWaitOpen();
void exeOpen();
void exeWaitClose();
};
static_assert(sizeof(DoorCity) == 0x108);

View file

@ -76,6 +76,7 @@
#include "MapObj/ChurchDoor.h"
#include "MapObj/CitySignal.h"
#include "MapObj/CoinCollectHintObj.h"
#include "MapObj/DoorCity.h"
#include "MapObj/Doshi.h"
#include "MapObj/ElectricWire/ElectricWire.h"
#include "MapObj/FireDrum2D.h"
@ -275,7 +276,7 @@ const al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
{"Doshi", al::createActorFunction<Doshi>},
{"DoorAreaChange", nullptr},
{"DoorAreaChangeCap", nullptr},
{"DoorCity", nullptr},
{"DoorCity", al::createActorFunction<DoorCity>},
{"DoorSnow", nullptr},
{"DoorWarp", nullptr},
{"DoorWarpStageChange", nullptr},