Skip to content

Commit

Permalink
item: Implement CoinCollectDummy
Browse files Browse the repository at this point in the history
  • Loading branch information
german77 committed Jan 3, 2025
1 parent d692c63 commit bd9b269
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 9 deletions.
18 changes: 9 additions & 9 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10861,15 +10861,15 @@ Address,Quality,Size,Name
0x00000071001c0cf0,U,000072,_ZNK12_GLOBAL__N_120CoinCollect2DNrvWait7executeEPN2al11NerveKeeperE
0x00000071001c0d38,U,000080,_ZNK12_GLOBAL__N_124CoinCollect2DNrvWaitHint7executeEPN2al11NerveKeeperE
0x00000071001c0d88,U,000008,_ZNK12_GLOBAL__N_119CoinCollect2DNrvGot7executeEPN2al11NerveKeeperE
0x00000071001c0d90,U,000124,_ZN16CoinCollectDummyC2EPKc
0x00000071001c0e0c,U,000136,_ZN16CoinCollectDummyC1EPKc
0x00000071001c0e94,U,000184,_ZN16CoinCollectDummy4initERKN2al13ActorInitInfoE
0x00000071001c0f4c,U,000044,_ZN16CoinCollectDummy6appearEv
0x00000071001c0f78,U,000084,_ZN16CoinCollectDummy10appearHintERKN4sead7Vector3IfEE
0x00000071001c0fcc,U,000008,_ZN16CoinCollectDummy12reappearHintEv
0x00000071001c0fd4,U,000008,_ZN16CoinCollectDummy10deleteHintEv
0x00000071001c0fdc,U,000060,_ZN16CoinCollectDummy7exeHintEv
0x00000071001c1018,U,000064,_ZNK12_GLOBAL__N_123CoinCollectDummyNrvHint7executeEPN2al11NerveKeeperE
0x00000071001c0d90,O,000124,_ZN16CoinCollectDummyC2EPKc
0x00000071001c0e0c,O,000136,_ZN16CoinCollectDummyC1EPKc
0x00000071001c0e94,O,000184,_ZN16CoinCollectDummy4initERKN2al13ActorInitInfoE
0x00000071001c0f4c,O,000044,_ZN16CoinCollectDummy6appearEv
0x00000071001c0f78,O,000084,_ZN16CoinCollectDummy10appearHintERKN4sead7Vector3IfEE
0x00000071001c0fcc,O,000008,_ZN16CoinCollectDummy12reappearHintEv
0x00000071001c0fd4,O,000008,_ZN16CoinCollectDummy10deleteHintEv
0x00000071001c0fdc,O,000060,_ZN16CoinCollectDummy7exeHintEv
0x00000071001c1018,O,000064,_ZNK12_GLOBAL__N_123CoinCollectDummyNrvHint7executeEPN2al11NerveKeeperE
0x00000071001c1058,U,000168,_ZN16CoinCollectEmptyC2EPKcS1_
0x00000071001c1100,U,000172,_ZN16CoinCollectEmptyC1EPKcS1_
0x00000071001c11ac,U,000352,_ZN16CoinCollectEmpty4initERKN2al13ActorInitInfoE
Expand Down
58 changes: 58 additions & 0 deletions src/Item/CoinCollectDummy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#include "Item/CoinCollectDummy.h"

#include "Library/LiveActor/ActorActionFunction.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorMovementFunction.h"
#include "Library/LiveActor/LiveActorUtil.h"
#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Nerve/NerveUtil.h"

#include "Item/CoinCollectHintState.h"
#include "Util/ItemUtil.h"

namespace {
NERVE_IMPL(CoinCollectDummy, Hint);

struct {
NERVE_MAKE(CoinCollectDummy, Hint);
} NrvCoinCollectDummy;

} // namespace

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

void CoinCollectDummy::init(const al::ActorInitInfo& initInfo) {
al::initActorSceneInfo(this, initInfo);
al::initActorWithArchiveName(this, initInfo, rs::getStageCoinCollectArchiveName(this), nullptr);
al::initNerve(this, &NrvCoinCollectDummy.Hint, 1);
mHintState = new CoinCollectHintState(this);
al::initNerveState(this, mHintState, &NrvCoinCollectDummy.Hint, "ヒント");
makeActorDead();
}

void CoinCollectDummy::appear() {
al::LiveActor::appear();
al::setNerve(this, &NrvCoinCollectDummy.Hint);
}

void CoinCollectDummy::appearHint(const sead::Vector3f& position) {
appear();
al::resetPosition(this, position);
al::hideModelIfShow(this);
al::invalidateClipping(this);
al::startHitReaction(this, "発光");
}

void CoinCollectDummy::reappearHint() {
mHintState->appearHintEffect();
}

void CoinCollectDummy::deleteHint() {
mHintState->deleteHintEffect();
}

void CoinCollectDummy::exeHint() {
if (al::updateNerveState(this))
makeActorDead();
}
23 changes: 23 additions & 0 deletions src/Item/CoinCollectDummy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include <math/seadVector.h>

#include "Library/LiveActor/LiveActor.h"

class CoinCollectHintState;

class CoinCollectDummy : public al::LiveActor {
public:
CoinCollectDummy(const char*);

void init(const al::ActorInitInfo&) override;
void appear() override;

void appearHint(const sead::Vector3f&);
void reappearHint();
void deleteHint();
void exeHint();

private:
CoinCollectHintState* mHintState = nullptr;
};
41 changes: 41 additions & 0 deletions src/Item/CoinCollectHintState.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "Item/CoinCollectHintState.h"

#include "Library/Nerve/NerveSetupUtil.h"
#include "Library/Nerve/NerveUtil.h"

namespace {
NERVE_IMPL(CoinCollectHintState, Hint);

struct {
NERVE_MAKE(CoinCollectHintState, Hint);
} NrvCoinCollectHintState;

} // namespace

CoinCollectHintState::CoinCollectHintState(al::LiveActor* actor)
: al::ActorStateBase("ヒント状態", actor) {}

CoinCollectHintState::~CoinCollectHintState() = default;

void CoinCollectHintState::init() {
initNerve(this, , 0);
}

void CoinCollectHintState::appear() {
al::setNerve(this, &NrvCoinCollectHintState.Hint);
al::emitEffect(this, "Emission", nullptr);
}

void CoinCollectHintState::kill() {
al::deleteEffect(this, "Emission");
}

void CoinCollectHintState::deleteHintEffect() {
al::tryKillEmitterAndParticleAll(this);
}

void CoinCollectHintState::appearHintEffect() {
al::emitEffect(this, "Emission", nullptr);
}

void CoinCollectHintState::exeHint() {}
22 changes: 22 additions & 0 deletions src/Item/CoinCollectHintState.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#pragma once

#include "Library/Nerve/NerveStateBase.h"

namespace al {
class LiveActor;
} // namespace al

class CoinCollectHintState : public al::ActorStateBase {
public:
CoinCollectHintState(al::LiveActor*);
~CoinCollectHintState();

void init() override;
void appear() override;
void kill() override;

void deleteHintEffect();
void appearHintEffect();

void exeWait();
};

0 comments on commit bd9b269

Please sign in to comment.