MapObj: Implement CitySignal (#146)

This commit is contained in:
MonsterDruide1 2024-09-03 22:45:20 +02:00 committed by GitHub
parent e388ee7ce2
commit 3c23d9b0c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 105 additions and 17 deletions

View File

@ -459,7 +459,7 @@ Address,Quality,Size,Name
0x000000710000e598,U,000008,_ZN8BombTail9throwBombERKN4sead7Vector3IfEES4_
0x000000710000e5a0,U,000148,_ZN8BombTail12throwBombRunEv
0x000000710000e634,U,000008,_ZN8BombTail18popFromDamageArrayEv
0x000000710000e63c,U,000224,_ZN2al9StringTmpILi64EEC2EPKcz
0x000000710000e63c,O,000224,_ZN2al9StringTmpILi64EEC2EPKcz
0x000000710000e71c,U,000224,_ZN8BombTail21decideTailThrowTargetEiRKN4sead7Vector3IfEE
0x000000710000e7fc,U,000008,_ZNK12_GLOBAL__N_115BombTailNrvWait7executeEPN2al11NerveKeeperE
0x000000710000e804,U,000008,_ZNK12_GLOBAL__N_126BombTailNrvBattleStartDemo7executeEPN2al11NerveKeeperE
@ -493,7 +493,7 @@ Address,Quality,Size,Name
0x000000710000ea1c,U,000076,_ZNK2al10FunctorV0MIP8BombTailMS1_FvvEE5cloneEv
0x000000710000ea68,U,000004,_ZN2al10FunctorV0MIP8BombTailMS1_FvvEED0Ev
0x000000710000ea6c,O,000004,_ZN2al11FunctorBaseD2Ev
0x000000710000ea70,U,000004,_ZN2al9StringTmpILi64EED0Ev
0x000000710000ea70,O,000004,_ZN2al9StringTmpILi64EED0Ev
0x000000710000ea74,U,000160,
0x000000710000eb14,U,000240,_ZN12BombTailBombC2EPKcPKN2al9LiveActorE
0x000000710000ec04,U,000252,_ZN12BombTailBombC1EPKcPKN2al9LiveActorE
@ -14571,18 +14571,18 @@ Address,Quality,Size,Name
0x000000710024c4a4,U,000004,_ZN8CitySign11exeLightOffEv
0x000000710024c4a8,U,000004,_ZNK12_GLOBAL__N_115CitySignNrvWait7executeEPN2al11NerveKeeperE
0x000000710024c4ac,U,000004,_ZNK12_GLOBAL__N_119CitySignNrvLightOff7executeEPN2al11NerveKeeperE
0x000000710024c4b0,U,000120,_ZN10CitySignalC2EPKc
0x000000710024c528,U,000132,_ZN10CitySignalC1EPKc
0x000000710024c5ac,U,000152,_ZN10CitySignal4initERKN2al13ActorInitInfoE
0x000000710024c644,U,000004,_ZN10CitySignal8movementEv
0x000000710024c648,U,000084,_ZN10CitySignal8calcAnimEv
0x000000710024c69c,U,000120,_ZN10CitySignal10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
0x000000710024c714,U,000004,_ZN10CitySignal10exeWaitRedEv
0x000000710024c718,U,000004,_ZN10CitySignal11exeWaitBlueEv
0x000000710024c71c,U,000060,_ZN10CitySignal10exeWaitOffEv
0x000000710024c758,U,000004,_ZNK12_GLOBAL__N_120CitySignalNrvWaitRed7executeEPN2al11NerveKeeperE
0x000000710024c75c,U,000004,_ZNK12_GLOBAL__N_121CitySignalNrvWaitBlue7executeEPN2al11NerveKeeperE
0x000000710024c760,U,000064,_ZNK12_GLOBAL__N_120CitySignalNrvWaitOff7executeEPN2al11NerveKeeperE
0x000000710024c4b0,O,000120,_ZN10CitySignalC2EPKc
0x000000710024c528,O,000132,_ZN10CitySignalC1EPKc
0x000000710024c5ac,O,000152,_ZN10CitySignal4initERKN2al13ActorInitInfoE
0x000000710024c644,O,000004,_ZN10CitySignal8movementEv
0x000000710024c648,O,000084,_ZN10CitySignal8calcAnimEv
0x000000710024c69c,O,000120,_ZN10CitySignal10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
0x000000710024c714,O,000004,_ZN10CitySignal10exeWaitRedEv
0x000000710024c718,O,000004,_ZN10CitySignal11exeWaitBlueEv
0x000000710024c71c,O,000060,_ZN10CitySignal10exeWaitOffEv
0x000000710024c758,O,000004,_ZNK12_GLOBAL__N_120CitySignalNrvWaitRed7executeEPN2al11NerveKeeperE
0x000000710024c75c,O,000004,_ZNK12_GLOBAL__N_121CitySignalNrvWaitBlue7executeEPN2al11NerveKeeperE
0x000000710024c760,O,000064,_ZNK12_GLOBAL__N_120CitySignalNrvWaitOff7executeEPN2al11NerveKeeperE
0x000000710024c7a0,U,000120,_ZN15CityStreetlightC2EPKc
0x000000710024c818,U,000132,_ZN15CityStreetlightC1EPKc
0x000000710024c89c,U,000088,_ZN15CityStreetlight4initERKN2al13ActorInitInfoE
@ -30081,7 +30081,7 @@ Address,Quality,Size,Name
0x00000071004b72f4,U,000052,_ZN2al19createActorFunctionI13CityWorldSignEEPNS_9LiveActorEPKc
0x00000071004b7328,U,000052,_ZN2al19createActorFunctionI27CityWorldUndergroundMachineEEPNS_9LiveActorEPKc
0x00000071004b735c,U,000052,_ZN2al19createActorFunctionI8CitySignEEPNS_9LiveActorEPKc
0x00000071004b7390,U,000052,_ZN2al19createActorFunctionI10CitySignalEEPNS_9LiveActorEPKc
0x00000071004b7390,O,000052,_ZN2al19createActorFunctionI10CitySignalEEPNS_9LiveActorEPKc
0x00000071004b73c4,U,000052,_ZN2al19createActorFunctionI14ReactionObjectEEPNS_9LiveActorEPKc
0x00000071004b73f8,U,000052,_ZN2al19createActorFunctionI6ClosetEEPNS_9LiveActorEPKc
0x00000071004b742c,U,000052,_ZN2al19createActorFunctionI9CloudStepEEPNS_9LiveActorEPKc

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

67
src/MapObj/CitySignal.cpp Normal file
View File

@ -0,0 +1,67 @@
#include "MapObj/CitySignal.h"
#include "Library/Base/StringUtil.h"
#include "Library/LiveActor/ActorActionFunction.h"
#include "Library/LiveActor/ActorInitInfo.h"
#include "Library/LiveActor/ActorModelFunction.h"
#include "Library/LiveActor/ActorSensorFunction.h"
#include "Library/LiveActor/ActorSensorMsgFunction.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "System/GameDataFunction.h"
namespace {
NERVE_IMPL(CitySignal, WaitRed);
NERVE_IMPL(CitySignal, WaitBlue);
NERVE_IMPL(CitySignal, WaitOff);
NERVES_MAKE_STRUCT(CitySignal, WaitRed, WaitBlue, WaitOff);
} // namespace
CitySignal::CitySignal(const char* name) : al::LiveActor(name) {}
void CitySignal::init(const al::ActorInitInfo& info) {
al::initActor(this, info);
s32 scenarioNo = GameDataFunction::getScenarioNo(this);
al::tryStartAction(this, al::StringTmp<64>("Scenario%d", scenarioNo).cstr());
if (scenarioNo == 1)
al::initNerve(this, &NrvCitySignal.WaitRed, 0);
else
al::initNerve(this, &NrvCitySignal.WaitBlue, 0);
al::trySyncStageSwitchAppearAndKill(this);
}
void CitySignal::movement() {
// this being empty results in the animation not playing (blinking for Red)
// and the signal not turning off when hit by an explosion
}
void CitySignal::calcAnim() {
if (al::isNerve(this, &NrvCitySignal.WaitRed) || al::isNerve(this, &NrvCitySignal.WaitOff))
al::LiveActor::calcAnim();
else
al::calcViewModel(this);
}
bool CitySignal::receiveMsg(const al::SensorMsg* message, al::HitSensor* source,
al::HitSensor* target) {
if (al::isMsgExplosion(message) && al::isSensorMapObj(target) &&
(al::isNerve(this, &NrvCitySignal.WaitRed) || al::isNerve(this, &NrvCitySignal.WaitBlue))) {
al::setNerve(this, &NrvCitySignal.WaitOff);
return true;
}
return false;
}
void CitySignal::exeWaitRed() {}
void CitySignal::exeWaitBlue() {}
void CitySignal::exeWaitOff() {
if (al::isFirstStep(this))
al::startAction(this, "LightOff");
}

20
src/MapObj/CitySignal.h Normal file
View File

@ -0,0 +1,20 @@
#pragma once
#include "Library/LiveActor/LiveActor.h"
class CitySignal : public al::LiveActor {
public:
CitySignal(const char* name);
void init(const al::ActorInitInfo& info) override;
void movement() override;
void calcAnim() override;
bool receiveMsg(const al::SensorMsg* message, al::HitSensor* source,
al::HitSensor* target) override;
void exeWaitRed();
void exeWaitBlue();
void exeWaitOff();
};
static_assert(sizeof(CitySignal) == 0x108);

View File

@ -8,6 +8,7 @@
#include "Library/Obj/AllDeadWatcher.h"
#include "MapObj/AnagramAlphabet.h"
#include "MapObj/CitySignal.h"
#include "MapObj/FireDrum2D.h"
#include "MapObj/WorldMapEarth.h"
@ -118,7 +119,7 @@ static al::NameToCreator<al::ActorCreatorFunction> sProjectActorFactoryEntries[]
{"CityWorldSign", nullptr},
{"CityWorldUndergroundMachine", nullptr},
{"CitySign", nullptr},
{"CitySignal", nullptr},
{"CitySignal", al::createActorFunction<CitySignal>},
{"CityWorldTable", nullptr},
{"Closet", nullptr},
{"CloudStep", nullptr},

View File

@ -149,7 +149,7 @@ public:
static bool isFirstTimeNextWorld(GameDataHolderAccessor);
static void checkIsNewWorldInAlreadyGoWorld(GameDataHolderAccessor);
static void getCurrentWorldIdNoDevelop(GameDataHolderAccessor);
static void getScenarioNo(const al::LiveActor*);
static s32 getScenarioNo(const al::LiveActor*);
static void getScenarioNo(const al::LayoutActor*);
static void getScenarioNoPlacement(GameDataHolderAccessor);
static bool isEqualScenario(const RiseMapPartsHolder*, s32);