Skip to content

Commit ae76c74

Browse files
authored
Item: Implement DotCharacterRare and ItemAppearanceController (#914)
1 parent 5e04000 commit ae76c74

File tree

5 files changed

+141
-15
lines changed

5 files changed

+141
-15
lines changed

data/file_list.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48980,27 +48980,27 @@ Item/DotCharacterRare.o:
4898048980
- offset: 0x1c7478
4898148981
size: 120
4898248982
label: _ZN16DotCharacterRareC2EPKc
48983-
status: NotDecompiled
48983+
status: Matching
4898448984
- offset: 0x1c74f0
4898548985
size: 132
4898648986
label: _ZN16DotCharacterRareC1EPKc
48987-
status: NotDecompiled
48987+
status: Matching
4898848988
- offset: 0x1c7574
4898948989
size: 112
4899048990
label: _ZN16DotCharacterRare4initERKN2al13ActorInitInfoE
48991-
status: NotDecompiled
48991+
status: Matching
4899248992
- offset: 0x1c75e4
4899348993
size: 84
4899448994
label: _ZN16DotCharacterRare11appearPopUpEv
48995-
status: NotDecompiled
48995+
status: Matching
4899648996
- offset: 0x1c7638
4899748997
size: 60
4899848998
label: _ZN16DotCharacterRare8exePopUpEv
48999-
status: NotDecompiled
48999+
status: Matching
4900049000
- offset: 0x1c7674
4900149001
size: 64
4900249002
label: _ZNK12_GLOBAL__N_124DotCharacterRareNrvPopUp7executeEPN2al11NerveKeeperE
49003-
status: NotDecompiled
49003+
status: Matching
4900449004
guess: true
4900549005
Item/ItemAppearanceController.o:
4900649006
'.text':
@@ -49009,41 +49009,41 @@ Item/ItemAppearanceController.o:
4900949009
label:
4901049010
- _ZN24ItemAppearanceControllerC1EPN2al9LiveActorEi
4901149011
- _ZN24ItemAppearanceControllerC2EPN2al9LiveActorEi
49012-
status: NotDecompiled
49012+
status: Matching
4901349013
- offset: 0x1c7714
4901449014
size: 104
4901549015
label: _ZN24ItemAppearanceController13requestAppearEPKN2al9SensorMsgEPKNS0_9HitSensorE
49016-
status: NotDecompiled
49016+
status: Matching
4901749017
- offset: 0x1c777c
4901849018
size: 64
4901949019
label: _ZN24ItemAppearanceController8exeCountEv
49020-
status: NotDecompiled
49020+
status: Matching
4902149021
- offset: 0x1c77bc
4902249022
size: 48
4902349023
label: _ZN24ItemAppearanceController9exeAppearEv
49024-
status: NotDecompiled
49024+
status: Matching
4902549025
- offset: 0x1c77ec
4902649026
size: 36
4902749027
label: _ZN24ItemAppearanceControllerD0Ev
49028-
status: NotDecompiled
49028+
status: Matching
4902949029
lazy: true
4903049030
- offset: 0x1c7810
4903149031
size: 4
49032-
label: ''
49032+
label: '#_ZNK12_GLOBAL__N_115HostTypeNrvWait7executeEPN2al11NerveKeeperE'
4903349033
status: NotDecompiled
4903449034
- offset: 0x1c7814
4903549035
size: 68
4903649036
label: _ZNK12_GLOBAL__N_116HostTypeNrvCount7executeEPN2al11NerveKeeperE
49037-
status: NotDecompiled
49037+
status: Matching
4903849038
guess: true
4903949039
- offset: 0x1c7858
4904049040
size: 48
49041-
label: ''
49041+
label: '#_ZNK12_GLOBAL__N_117HostTypeNrvAppear7executeEPN2al11NerveKeeperE'
4904249042
status: NotDecompiled
4904349043
- offset: 0x1c7888
4904449044
size: 4
4904549045
label: _ZNK12_GLOBAL__N_115HostTypeNrvDone7executeEPN2al11NerveKeeperE
49046-
status: NotDecompiled
49046+
status: Matching
4904749047
guess: true
4904849048
Item/LifeMaxUpItem.o:
4904949049
'.text':

src/Item/DotCharacterRare.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#include "Item/DotCharacterRare.h"
2+
3+
#include "Library/LiveActor/ActorActionFunction.h"
4+
#include "Library/LiveActor/ActorInitUtil.h"
5+
#include "Library/Nerve/NerveSetupUtil.h"
6+
#include "Library/Nerve/NerveUtil.h"
7+
8+
namespace {
9+
NERVE_IMPL(DotCharacterRare, PopUp)
10+
11+
NERVES_MAKE_STRUCT(DotCharacterRare, PopUp)
12+
} // namespace
13+
14+
DotCharacterRare::DotCharacterRare(const char* name) : al::LiveActor(name) {}
15+
16+
void DotCharacterRare::init(const al::ActorInitInfo& info) {
17+
al::initActorWithArchiveName(this, info, "DotMarioCatRare", nullptr);
18+
al::initNerve(this, &NrvDotCharacterRare.PopUp, 0);
19+
makeActorAlive();
20+
}
21+
22+
void DotCharacterRare::appearPopUp() {
23+
al::startAction(this, "DotMarioCatRareReactionSmall");
24+
al::setNerve(this, &NrvDotCharacterRare.PopUp);
25+
appear();
26+
al::startHitReaction(this, "飛出し出現");
27+
}
28+
29+
void DotCharacterRare::exePopUp() {
30+
if (al::isActionEnd(this))
31+
kill();
32+
}

src/Item/DotCharacterRare.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#pragma once
2+
3+
#include "Library/LiveActor/LiveActor.h"
4+
5+
namespace al {
6+
struct ActorInitInfo;
7+
} // namespace al
8+
9+
class DotCharacterRare : public al::LiveActor {
10+
public:
11+
DotCharacterRare(const char* name);
12+
13+
void init(const al::ActorInitInfo& info) override;
14+
void appearPopUp();
15+
16+
void exePopUp();
17+
};
18+
19+
static_assert(sizeof(DotCharacterRare) == 0x108);
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#include "Item/ItemAppearanceController.h"
2+
3+
#include "Library/Item/ItemUtil.h"
4+
#include "Library/LiveActor/ActorActionFunction.h"
5+
#include "Library/LiveActor/ActorInitUtil.h"
6+
#include "Library/Nerve/NerveSetupUtil.h"
7+
#include "Library/Nerve/NerveUtil.h"
8+
9+
#include "Util/ItemUtil.h"
10+
11+
namespace {
12+
NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Wait)
13+
NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Appear)
14+
NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Count)
15+
NERVE_HOST_TYPE_IMPL(ItemAppearanceController, Done)
16+
17+
NERVES_MAKE_STRUCT(HostType, Wait, Count)
18+
NERVES_MAKE_NOSTRUCT(HostType, Appear, Done)
19+
} // namespace
20+
21+
ItemAppearanceController::ItemAppearanceController(al::LiveActor* actor, s32 appearTime)
22+
: al::NerveExecutor("アイテム出現制御"), mActor(actor), mAppearTime(appearTime) {
23+
initNerve(&NrvHostType.Wait, 0);
24+
}
25+
26+
bool ItemAppearanceController::requestAppear(const al::SensorMsg* message,
27+
const al::HitSensor* hitSensor) {
28+
if (al::isNerve(this, &NrvHostType.Wait)) {
29+
rs::setAppearItemFactorAndOffsetByMsg(mActor, message, hitSensor);
30+
al::setNerve(this, &NrvHostType.Count);
31+
return true;
32+
}
33+
return false;
34+
}
35+
36+
void ItemAppearanceController::exeWait() {}
37+
38+
void ItemAppearanceController::exeCount() {
39+
if (al::isGreaterEqualStep(this, mAppearTime))
40+
al::setNerve(this, &Appear);
41+
}
42+
43+
void ItemAppearanceController::exeAppear() {
44+
al::appearItem(mActor);
45+
al::setNerve(this, &Done);
46+
}
47+
48+
void ItemAppearanceController::exeDone() {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include "Library/Nerve/NerveExecutor.h"
4+
5+
namespace al {
6+
class HitSensor;
7+
class LiveActor;
8+
class SensorMsg;
9+
} // namespace al
10+
11+
class ItemAppearanceController : public al::NerveExecutor {
12+
public:
13+
ItemAppearanceController(al::LiveActor* actor, s32 appearTime);
14+
15+
bool requestAppear(const al::SensorMsg* message, const al::HitSensor* hitSensor);
16+
17+
void exeWait();
18+
void exeCount();
19+
void exeAppear();
20+
void exeDone();
21+
22+
private:
23+
al::LiveActor* mActor;
24+
s32 mAppearTime;
25+
};
26+
27+
static_assert(sizeof(ItemAppearanceController) == 0x20);

0 commit comments

Comments
 (0)