From 65d670dc85d636308f558a1a6d7fcc2713810a2a Mon Sep 17 00:00:00 2001 From: guymakinggames <66076221+guymakinggames@users.noreply.github.com> Date: Mon, 30 Mar 2026 10:18:58 +0100 Subject: [PATCH] Enemy: Implement `WanwanHole` (#987) --- data/file_list.yml | 18 ++++++------- src/Enemy/WanwanHole.cpp | 56 ++++++++++++++++++++++++++++++++++++++++ src/Enemy/WanwanHole.h | 16 ++++++++++++ 3 files changed, 81 insertions(+), 9 deletions(-) create mode 100644 src/Enemy/WanwanHole.cpp create mode 100644 src/Enemy/WanwanHole.h diff --git a/data/file_list.yml b/data/file_list.yml index 74c77336..5ebfad2d 100644 --- a/data/file_list.yml +++ b/data/file_list.yml @@ -44474,40 +44474,40 @@ Enemy/WanwanHole.o: - offset: 0x1ac7d4 size: 120 label: _ZN10WanwanHoleC2EPKc - status: NotDecompiled + status: Matching - offset: 0x1ac84c size: 132 label: _ZN10WanwanHoleC1EPKc - status: NotDecompiled + status: Matching - offset: 0x1ac8d0 size: 116 label: _ZN10WanwanHole4initERKN2al13ActorInitInfoE - status: NotDecompiled + status: Matching - offset: 0x1ac944 size: 112 label: _ZN10WanwanHole12attackSensorEPN2al9HitSensorES2_ - status: NotDecompiled + status: Matching - offset: 0x1ac9b4 size: 8 label: _ZN10WanwanHole10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_ - status: NotDecompiled + status: Matching - offset: 0x1ac9bc size: 52 label: _ZN10WanwanHole7exeWaitEv - status: NotDecompiled + status: Matching - offset: 0x1ac9f0 size: 96 label: _ZN10WanwanHole5exeInEv - status: NotDecompiled + status: Matching - offset: 0x1aca50 size: 56 label: _ZNK12_GLOBAL__N_117WanwanHoleNrvWait7executeEPN2al11NerveKeeperE - status: NotDecompiled + status: Matching guess: true - offset: 0x1aca88 size: 100 label: _ZNK12_GLOBAL__N_115WanwanHoleNrvIn7executeEPN2al11NerveKeeperE - status: NotDecompiled + status: Matching guess: true Enemy/WanwanStateHack.o: '.text': diff --git a/src/Enemy/WanwanHole.cpp b/src/Enemy/WanwanHole.cpp new file mode 100644 index 00000000..68e86d59 --- /dev/null +++ b/src/Enemy/WanwanHole.cpp @@ -0,0 +1,56 @@ +#include "Enemy/WanwanHole.h" + +#include "Library/LiveActor/ActorClippingFunction.h" +#include "Library/LiveActor/ActorInitUtil.h" +#include "Library/LiveActor/ActorSensorUtil.h" +#include "Library/Nerve/NerveSetupUtil.h" +#include "Library/Nerve/NerveUtil.h" +#include "Library/Placement/PlacementFunction.h" +#include "Library/Stage/StageSwitchUtil.h" + +#include "Util/SensorMsgFunction.h" + +namespace { +NERVE_IMPL(WanwanHole, Wait); +NERVE_IMPL(WanwanHole, In); +NERVES_MAKE_NOSTRUCT(WanwanHole, Wait, In); +} // namespace + +WanwanHole::WanwanHole(const char* name) : al::LiveActor(name) {} + +void WanwanHole::init(const al::ActorInitInfo& initInfo) { + al::initActor(this, initInfo); + al::initNerve(this, &Wait, 0); + f32 addHoleRadius = 0.0f; + al::tryGetArg(&addHoleRadius, initInfo, "AddHoleRadius"); + al::setSensorRadius(this, addHoleRadius); + makeActorAlive(); +} + +void WanwanHole::attackSensor(al::HitSensor* self, al::HitSensor* other) { + if (al::isNerve(this, &Wait)) { + if (rs::sendMsgWanwanHoleIn(other, self)) { + al::invalidateClipping(this); + al::setNerve(this, &In); + } + } +} + +bool WanwanHole::receiveMsg(const al::SensorMsg* message, al::HitSensor* other, + al::HitSensor* self) { + if (rs::isMsgPlayerDisregardHomingAttack(message)) + return true; + return false; +} + +void WanwanHole::exeWait() { + if (al::isFirstStep(this)) + al::validateClipping(this); +} + +void WanwanHole::exeIn() { + if (al::isGreaterEqualStep(this, 60)) + al::tryOnStageSwitch(this, "SwitchWanwanInOn"); + if (al::isGreaterEqualStep(this, 100)) + al::setNerve(this, &Wait); +} diff --git a/src/Enemy/WanwanHole.h b/src/Enemy/WanwanHole.h new file mode 100644 index 00000000..6782e65b --- /dev/null +++ b/src/Enemy/WanwanHole.h @@ -0,0 +1,16 @@ +#pragma once + +#include "Library/LiveActor/LiveActor.h" + +class WanwanHole : public al::LiveActor { +public: + WanwanHole(const char* name); + void init(const al::ActorInitInfo& initInfo) override; + void attackSensor(al::HitSensor* self, al::HitSensor* other) override; + bool receiveMsg(const al::SensorMsg* message, al::HitSensor* other, + al::HitSensor* self) override; + void exeWait(); + void exeIn(); +}; + +static_assert(sizeof(WanwanHole) == 0x108);