Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions data/file_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50844,23 +50844,23 @@ Item/YoshiFruitShineHolder.o:
- offset: 0x1d7b28
size: 128
label: _ZN21YoshiFruitShineHolderC2EPKc
status: NotDecompiled
status: Matching
- offset: 0x1d7ba8
size: 140
label: _ZN21YoshiFruitShineHolderC1EPKc
status: NotDecompiled
status: Matching
- offset: 0x1d7c34
size: 228
label: _ZN21YoshiFruitShineHolder4initERKN2al13ActorInitInfoE
status: NotDecompiled
status: Matching
- offset: 0x1d7d18
size: 72
label: _ZN21YoshiFruitShineHolder13updateHintPosERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
- offset: 0x1d7d60
size: 92
label: _ZN21YoshiFruitShineHolder20appearShineFromFruitERKN4sead7Vector3IfEE
status: NotDecompiled
status: Matching
Item/YoshiFruitWatcher.o:
'.text':
- offset: 0x1d7dbc
Expand Down
42 changes: 42 additions & 0 deletions src/Item/YoshiFruitShineHolder.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include "Item/YoshiFruitShineHolder.h"

#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorMovementFunction.h"
#include "Library/Placement/PlacementFunction.h"

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

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

void YoshiFruitShineHolder::init(const al::ActorInitInfo& info) {
al::initActorSceneInfo(this, info);

s32 shineNum = al::calcLinkChildNum(info, "ShineFromFruit");
mAppearedCount = 0;
mShines.allocBuffer(shineNum, nullptr);

for (s32 i = 0; i < shineNum; i++) {
Shine* shine = rs::initLinkShine(info, "ShineFromFruit", i);
mShines.pushBack(shine);
if (shine->isGot())
mAppearedCount++;
}

rs::registerFruitShineHolder(this);
makeActorAlive();
}

void YoshiFruitShineHolder::updateHintPos(const sead::Vector3f& pos) {
for (Shine& shine : mShines)
rs::updateHintTrans(&shine, pos);
}

Shine* YoshiFruitShineHolder::appearShineFromFruit(const sead::Vector3f& pos) {
Shine* shine = mShines[mAppearedCount];

al::resetPosition(shine, pos);
shine->appearStatic();
mAppearedCount++;
return shine;
}
28 changes: 28 additions & 0 deletions src/Item/YoshiFruitShineHolder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once

#include <basis/seadTypes.h>
#include <container/seadPtrArray.h>
#include <math/seadVector.h>

#include "Library/LiveActor/LiveActor.h"

namespace al {
struct ActorInitInfo;
} // namespace al

class Shine;

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

void init(const al::ActorInitInfo& info) override;
void updateHintPos(const sead::Vector3f& pos);
Shine* appearShineFromFruit(const sead::Vector3f& pos);

private:
sead::PtrArray<Shine> mShines;
s32 mAppearedCount = 0;
};

static_assert(sizeof(YoshiFruitShineHolder) == 0x120);
2 changes: 2 additions & 0 deletions src/Util/ItemUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class HitSensor;
class SensorMsg;
} // namespace al
class Shine;
class YoshiFruitShineHolder;

namespace rs {
// TODO: Replace this with SEAD_ENUM_EX when its ValueArray constructor matches
Expand Down Expand Up @@ -61,6 +62,7 @@ bool isAliveShine(const Shine* shine);
bool isMainShine(const Shine* shine);

void updateHintTrans(const Shine* shine, const sead::Vector3f& trans);
void registerFruitShineHolder(YoshiFruitShineHolder* holder);
void appearShineAndJoinBossDemo(Shine* shine, const char* name, const sead::Quatf& quat,
const sead::Vector3f& trans);
void endShineBossDemo(Shine* shine);
Expand Down
Loading