Skip to content

Commit

Permalink
Add KuromadoMagicBall
Browse files Browse the repository at this point in the history
  • Loading branch information
GRAnimated committed Jun 5, 2024
1 parent ce4f31b commit 4b4748e
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 110 deletions.
12 changes: 6 additions & 6 deletions data/odyssey_functions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8461,12 +8461,12 @@ Address,Quality,Size,Name
0x000000710015e128,U,000008,_ZNK12_GLOBAL__N_126KuriboWingHackStateNrvLand7executeEPN2al11NerveKeeperE
0x000000710015e130,U,000008,_ZNK12_GLOBAL__N_126KuriboWingHackStateNrvFall7executeEPN2al11NerveKeeperE
0x000000710015e138,U,000008,_ZNK12_GLOBAL__N_135KuriboWingHackStateNrvAttackTrample7executeEPN2al11NerveKeeperE
0x000000710015e140,U,000124,_ZN17KuromadoMagicBallC2EPKc
0x000000710015e1bc,U,000136,_ZN17KuromadoMagicBallC1EPKc
0x000000710015e244,U,000188,_ZN17KuromadoMagicBall4initERKN2al13ActorInitInfoE
0x000000710015e300,U,000116,_ZN17KuromadoMagicBall6appearEv
0x000000710015e374,U,000092,_ZN17KuromadoMagicBall7controlEv
0x000000710015e3d0,U,000140,_ZN17KuromadoMagicBall12attackSensorEPN2al9HitSensorES2_
0x000000710015e140,O,000124,_ZN17KuromadoMagicBallC2EPKc
0x000000710015e1bc,O,000136,_ZN17KuromadoMagicBallC1EPKc
0x000000710015e244,O,000188,_ZN17KuromadoMagicBall4initERKN2al13ActorInitInfoE
0x000000710015e300,O,000116,_ZN17KuromadoMagicBall6appearEv
0x000000710015e374,O,000092,_ZN17KuromadoMagicBall7controlEv
0x000000710015e3d0,O,000140,_ZN17KuromadoMagicBall12attackSensorEPN2al9HitSensorES2_
0x000000710015e45c,U,000212,_ZN4LongC2EPKcb
0x000000710015e530,U,000216,_ZN4LongC1EPKcb
0x000000710015e608,U,000312,_ZN4Long4initERKN2al13ActorInitInfoE
Expand Down
131 changes: 129 additions & 2 deletions lib/al/include/Library/LiveActor/ActorInitFunction.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,136 @@
#pragma once

#include <basis/seadTypes.h>
#include <gfx/seadDrawContext.h>
#include <math/seadBoundBox.h>
#include <math/seadMatrix.h>
#include <math/seadVector.h>
#include <prim/seadSafeString.h>

#include "Library/Nerve/NerveUtil.h"

namespace al {
class ActorInitInfo;
class ActorResource;
class AudioDirector;
class ByamlIter;
class CollisionDirector;
class GraphicsSystemInfo;
class LayoutInitInfo;
class LiveActor;
class LiveActorGroup;
class Resource;
class PlacementInfo;
class SceneCameraInfo;

void initActorSceneInfo(LiveActor*, const ActorInitInfo&);
void initExecutorUpdate(LiveActor*, const ActorInitInfo&, const char*);
void initExecutorDraw(LiveActor*, const ActorInitInfo&, const char*);
void initExecutorPlayer(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerPreMovement(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerMovement(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerModel(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorEnemy(LiveActor*, const ActorInitInfo&);
void initExecutorEnemyMovement(LiveActor*, const ActorInitInfo&);
void initExecutorEnemyDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorEnemyDecorationMovement(LiveActor*, const ActorInitInfo&);
void initExecutorMapObj(LiveActor*, const ActorInitInfo&);
void initExecutorMapObjMovement(LiveActor*, const ActorInitInfo&);
void initExecutorMapObjDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorNpcDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorShadowVolume(LiveActor*, const ActorInitInfo&);
void initExecutorShadowVolumeFillStencil(LiveActor*, const ActorInitInfo&);
void initExecutorCollisionMapObjDecorationMovement(LiveActor*, const ActorInitInfo&);
void initExecutorWatchObj(LiveActor*, const ActorInitInfo&);
void initExecutorDebugMovement(LiveActor*, const ActorInitInfo&);
void initExecutorModelUpdate(LiveActor*, const ActorInitInfo&);
void initExecutorDrcAssistMovement(LiveActor*, const ActorInitInfo&);
void initActorPoseTRSV(LiveActor*);
void initActorPoseTRMSV(LiveActor*);
void initActorPoseTRGMSV(LiveActor*);
void initActorPoseTFSV(LiveActor*);
void initActorPoseTFUSV(LiveActor*);
void initActorPoseTFGSV(LiveActor*);
void initActorPoseTQSV(LiveActor*);
void initActorPoseTQGSV(LiveActor*);
void initActorPoseTQGMSV(LiveActor*);
void initActorSRT(LiveActor*, const ActorInitInfo&);
void initActorModelKeeper(LiveActor*, const ActorInitInfo&, const ActorResource*, s32);
void initActorModelKeeper(LiveActor*, const ActorInitInfo&, const char*, s32, const char*);
void initActorModelKeeperByHost(LiveActor*, const LiveActor*);
void initActorModelForceCubeMap(LiveActor*, const ActorInitInfo&);
void initActorActionKeeper(LiveActor*, const ActorInitInfo&, const char*, const char*);
void initActorActionKeeper(LiveActor*, const ActorResource*, const char*, const char*);
void initActorEffectKeeper(LiveActor*, const ActorInitInfo&, const char*);
void initActorSeKeeper(LiveActor*, const ActorInitInfo&, const char*, const sead::Vector3f*,
const sead::Matrix34f*);
void initActorSeKeeper(LiveActor*, const ActorInitInfo&, const char*);
void initActorSeKeeperWithout3D(LiveActor*, const ActorInitInfo&, const char*);
void initActorBgmKeeper(LiveActor*, const ActorInitInfo&, const char*);
void isInitializedBgmKeeper(LiveActor*);
void initHitReactionKeeper(LiveActor*, const char*);
void initHitReactionKeeper(LiveActor*, const Resource*, const char*);
void initActorParamHolder(LiveActor*, const char*);
void initActorParamHolder(LiveActor*, const Resource*, const char*);
void initDepthShadowMapCtrl(LiveActor*, const Resource*, const ActorInitInfo&, const char*);
void initDepthShadowMapCtrlWithoutIter(LiveActor*, s32, bool);
void addDepthShadowMapInfo(const LiveActor*, const char*, s32, s32, s32, f32, bool,
const sead::Vector3f&, bool, const sead::Vector3f&,
const sead::Vector3f&, bool, const char*, s32, bool, f32, f32, f32, bool,
bool, f32, s32, bool);
void declareUseDepthShadowMap(const LiveActor*, s32);
void createDepthShadowMap(const LiveActor*, const char*, s32, s32, s32);
void initShadowMaskCtrl(LiveActor*, const ActorInitInfo&, const ByamlIter&, const char*);
void initShadowMaskCtrlWithoutInitFile(LiveActor*, const ActorInitInfo&, s32);

void initCreateActorWithPlacementInfo(LiveActor*, const ActorInitInfo&);
void initCreateActorWithPlacementInfo(LiveActor*, const ActorInitInfo&, const PlacementInfo&);
void initCreateActorNoPlacementInfo(LiveActor*, const ActorInitInfo&);
void initCreateActorNoPlacementInfoNoViewId(LiveActor*, const ActorInitInfo&);
void createPlacementActorFromFactory(const ActorInitInfo&, const PlacementInfo*);
LiveActor* createLinksActorFromFactory(const ActorInitInfo&, const char*, s32);
void createLinksActorGroupFromFactory(const ActorInitInfo&, const char*, const char*);
void tryCreateLinksActorGroupFromFactory(const ActorInitInfo&, const char*, const char*);
void tryCreateLinksActorFromFactorySingle(const ActorInitInfo&, const char*);
void createAndRegisterLinksActorFromFactory(LiveActorGroup*, const ActorInitInfo&, const char*);
void makeMapPartsModelName(sead::BufferedSafeString*, sead::BufferedSafeString*,
const PlacementInfo&);
void makeMapPartsModelName(sead::BufferedSafeString*, sead::BufferedSafeString*,
const ActorInitInfo&);

void initNerve(LiveActor* actor, const Nerve* nerve, s32 maxStates);
void initNerveAction(LiveActor* actor, const char* actionName,
alNerveFunction::NerveActionCollector* collector, s32 maxStates);

LiveActor* createLinksActorFromFactory(const ActorInitInfo& info, const char* linkName,
s32 linkNum);
bool trySyncStageSwitchAppear(LiveActor* actor);
bool trySyncStageSwitchKill(LiveActor* actor);
bool trySyncStageSwitchAppearAndKill(LiveActor* actor);
bool tryListenStageSwitchAppear(LiveActor* actor);
bool tryListenStageSwitchKill(LiveActor* actor);

void syncSensorScaleY(LiveActor* actor);
void syncSensorAndColliderScaleY(LiveActor* actor);

void setMaterialCode(LiveActor* actor, const char*);
void initMaterialCode(LiveActor* actor, const ActorInitInfo& initInfo);

bool tryAddDisplayRotate(LiveActor* actor, const ActorInitInfo& initInfo);
bool tryAddDisplayOffset(LiveActor* actor, const ActorInitInfo& initInfo);
bool tryAddDisplayScale(LiveActor* actor, const ActorInitInfo& initInfo);

PlacementInfo* getPlacementInfo(const ActorInitInfo& initInfo);
const LayoutInitInfo* getLayoutInitInfo(const ActorInitInfo& initInfo);
AudioDirector* getAudioDirector(const ActorInitInfo& initInfo);
CollisionDirector* getCollisionDirectorFromInfo(const ActorInitInfo& initInfo);
const SceneCameraInfo* getSceneCameraInfoFromInfo(const ActorInitInfo& initInfo);
GraphicsSystemInfo* getGraphicsSystemInfo(const ActorInitInfo& initInfo);
sead::DrawContext* getDrawContext(const ActorInitInfo& initInfo);

void getActorRecourseDataF32(f32*, LiveActor*, const char*, const char*);
void getActorRecourseDataString(const char**, LiveActor*, const char*, const char*);
void getActorRecourseDataV3f(sead::Vector3f*, LiveActor* actor, const char*, const char*);
void getActorRecourseDataBox3f(sead::BoundBox3f* box, LiveActor* actor, const char*, const char*);

void createPartsEffectGroup(LiveActor* actor, const ActorInitInfo& initInfo, s32);
} // namespace al
102 changes: 0 additions & 102 deletions lib/al/include/Library/LiveActor/ActorInitInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,106 +151,4 @@ void setSubActorOffSyncClipping(LiveActor*);
void initScreenPointKeeper(LiveActor*, const Resource*, const ActorInitInfo&, const char*);
void initScreenPointKeeperNoYaml(LiveActor*, s32);
void initActorMaterialCategory(LiveActor*, const ActorInitInfo&, const char*);

// TODO: move these
void initActorSceneInfo(LiveActor*, const ActorInitInfo&);
void initExecutorUpdate(LiveActor*, const ActorInitInfo&, const char*);
void initExecutorDraw(LiveActor*, const ActorInitInfo&, const char*);
void initExecutorPlayer(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerPreMovement(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerMovement(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerModel(LiveActor*, const ActorInitInfo&);
void initExecutorPlayerDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorEnemy(LiveActor*, const ActorInitInfo&);
void initExecutorEnemyMovement(LiveActor*, const ActorInitInfo&);
void initExecutorEnemyDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorEnemyDecorationMovement(LiveActor*, const ActorInitInfo&);
void initExecutorMapObj(LiveActor*, const ActorInitInfo&);
void initExecutorMapObjMovement(LiveActor*, const ActorInitInfo&);
void initExecutorMapObjDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorNpcDecoration(LiveActor*, const ActorInitInfo&);
void initExecutorShadowVolume(LiveActor*, const ActorInitInfo&);
void initExecutorShadowVolumeFillStencil(LiveActor*, const ActorInitInfo&);
void initExecutorCollisionMapObjDecorationMovement(LiveActor*, const ActorInitInfo&);
void initExecutorWatchObj(LiveActor*, const ActorInitInfo&);
void initExecutorDebugMovement(LiveActor*, const ActorInitInfo&);
void initExecutorModelUpdate(LiveActor*, const ActorInitInfo&);
void initExecutorDrcAssistMovement(LiveActor*, const ActorInitInfo&);
void initActorModelKeeper(LiveActor*, const ActorInitInfo&, const ActorResource*, s32);
void initActorModelKeeper(LiveActor*, const ActorInitInfo&, const char*, s32, const char*);
void initActorModelKeeperByHost(LiveActor*, const LiveActor*);
void initActorModelForceCubeMap(LiveActor*, const ActorInitInfo&);
void initActorActionKeeper(LiveActor*, const ActorInitInfo&, const char*, const char*);
void initActorActionKeeper(LiveActor*, const ActorResource*, const char*, const char*);
void initActorEffectKeeper(LiveActor*, const ActorInitInfo&, const char*);
void initActorSeKeeper(LiveActor*, const ActorInitInfo&, const char*, const sead::Vector3f*,
const sead::Matrix34f*);
void initActorSeKeeper(LiveActor*, const ActorInitInfo&, const char*);
void initActorSeKeeperWithout3D(LiveActor*, const ActorInitInfo&, const char*);
void initActorBgmKeeper(LiveActor*, const ActorInitInfo&, const char*);
void isInitializedBgmKeeper(LiveActor*);
void initHitReactionKeeper(LiveActor*, const char*);
void initHitReactionKeeper(LiveActor*, const Resource*, const char*);
void initActorParamHolder(LiveActor*, const char*);
void initActorParamHolder(LiveActor*, const Resource*, const char*);
void initDepthShadowMapCtrl(LiveActor*, const Resource*, const ActorInitInfo&, const char*);
void initDepthShadowMapCtrlWithoutIter(LiveActor*, s32, bool);
void addDepthShadowMapInfo(const LiveActor*, const char*, s32, s32, s32, f32, bool,
const sead::Vector3f&, bool, const sead::Vector3f&,
const sead::Vector3f&, bool, const char*, s32, bool, f32, f32, f32, bool,
bool, f32, s32, bool);
void declareUseDepthShadowMap(const LiveActor*, s32);
void createDepthShadowMap(const LiveActor*, const char*, s32, s32, s32);
void initShadowMaskCtrl(LiveActor*, const ActorInitInfo&, const ByamlIter&, const char*);
void initShadowMaskCtrlWithoutInitFile(LiveActor*, const ActorInitInfo&, s32);

void initCreateActorWithPlacementInfo(LiveActor*, const ActorInitInfo&);
void initCreateActorWithPlacementInfo(LiveActor*, const ActorInitInfo&, const PlacementInfo&);
void initCreateActorNoPlacementInfo(LiveActor*, const ActorInitInfo&);
void initCreateActorNoPlacementInfoNoViewId(LiveActor*, const ActorInitInfo&);
void createPlacementActorFromFactory(const ActorInitInfo&, const PlacementInfo*);
void createLinksActorFromFactory(const ActorInitInfo&, const char*, s32);
void createLinksActorGroupFromFactory(const ActorInitInfo&, const char*, const char*);
void tryCreateLinksActorGroupFromFactory(const ActorInitInfo&, const char*, const char*);
void tryCreateLinksActorFromFactorySingle(const ActorInitInfo&, const char*);
void createAndRegisterLinksActorFromFactory(LiveActorGroup*, const ActorInitInfo&, const char*);
void makeMapPartsModelName(sead::BufferedSafeString*, sead::BufferedSafeString*,
const PlacementInfo&);
void makeMapPartsModelName(sead::BufferedSafeString*, sead::BufferedSafeString*,
const ActorInitInfo&);

void initNerve(LiveActor* actor, const Nerve* nerve, s32 maxStates);
void initNerveAction(LiveActor* actor, const char* actionName,
alNerveFunction::NerveActionCollector* collector, s32 maxStates);

bool trySyncStageSwitchAppear(LiveActor* actor);
bool trySyncStageSwitchKill(LiveActor* actor);
bool trySyncStageSwitchAppearAndKill(LiveActor* actor);
bool tryListenStageSwitchAppear(LiveActor* actor);
bool tryListenStageSwitchKill(LiveActor* actor);

void syncSensorScaleY(LiveActor* actor);
void syncSensorAndColliderScaleY(LiveActor* actor);

void setMaterialCode(LiveActor* actor, const char*);
void initMaterialCode(LiveActor* actor, const ActorInitInfo& initInfo);

bool tryAddDisplayRotate(LiveActor* actor, const ActorInitInfo& initInfo);
bool tryAddDisplayOffset(LiveActor* actor, const ActorInitInfo& initInfo);
bool tryAddDisplayScale(LiveActor* actor, const ActorInitInfo& initInfo);

PlacementInfo* getPlacementInfo(const ActorInitInfo& initInfo);
const LayoutInitInfo* getLayoutInitInfo(const ActorInitInfo& initInfo);
AudioDirector* getAudioDirector(const ActorInitInfo& initInfo);
CollisionDirector* getCollisionDirectorFromInfo(const ActorInitInfo& initInfo);
const SceneCameraInfo* getSceneCameraInfoFromInfo(const ActorInitInfo& initInfo);
GraphicsSystemInfo* getGraphicsSystemInfo(const ActorInitInfo& initInfo);
sead::DrawContext* getDrawContext(const ActorInitInfo& initInfo);

void getActorRecourseDataF32(f32*, LiveActor*, const char*, const char*);
void getActorRecourseDataString(const char**, LiveActor*, const char*, const char*);
void getActorRecourseDataV3f(sead::Vector3f*, LiveActor* actor, const char*, const char*);
void getActorRecourseDataBox3f(sead::BoundBox3f* box, LiveActor* actor, const char*, const char*);

void createPartsEffectGroup(LiveActor* actor, const ActorInitInfo& initInfo, s32);
} // namespace al
1 change: 1 addition & 0 deletions lib/al/src/Library/LiveActor/SubActorKeeper.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Library/LiveActor/SubActorKeeper.h"

#include "Library/Base/StringUtil.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorModelFunction.h"
#include "Library/LiveActor/ActorResourceFunction.h"
#include "Library/LiveActor/ActorSensorFunction.h"
Expand Down
1 change: 1 addition & 0 deletions lib/al/src/Library/MapObj/FixMapParts.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Library/MapObj/FixMapParts.h"

#include "Library/LiveActor/ActorActionFunction.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorInitInfo.h"
#include "Library/LiveActor/ActorSensorMsgFunction.h"
#include "Library/LiveActor/LiveActorUtil.h"
Expand Down
1 change: 1 addition & 0 deletions lib/al/src/Library/Obj/SilhouetteModel.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Library/Obj/SilhouetteModel.h"

#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorInitInfo.h"

namespace al {
Expand Down
51 changes: 51 additions & 0 deletions src/Enemy/KuromadoMagicBall.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "Enemy/KuromadoMagicBall.h"

#include "Library/Effect/EffectSystemInfo.h"
#include "Library/LiveActor/ActorClippingFunction.h"
#include "Library/LiveActor/ActorDrawFunction.h"
#include "Library/LiveActor/ActorInitFunction.h"
#include "Library/LiveActor/ActorMovementFunction.h"
#include "Library/LiveActor/ActorPoseKeeper.h"
#include "Library/LiveActor/ActorSensorFunction.h"
#include "Library/LiveActor/ActorSensorMsgFunction.h"

#include "Util/Sensor.h"

KuromadoMagicBall::KuromadoMagicBall(const char* actorName) : al::LiveActor(actorName) {}

void KuromadoMagicBall::init(const al::ActorInitInfo& info) {
al::initActorSceneInfo(this, info);
al::initActorPoseTFSV(this);
al::initActorSRT(this, info);
al::initActorClipping(this, info);
al::invalidateClipping(this);
al::initActorEffectKeeper(this, info, "KuromadoMagicBall");
al::initExecutorEnemyMovement(this, info);
initHitSensor(1);
al::addHitSensorEnemyAttack(this, info, "Attack", 120.0f, 8, sead::Vector3f(0.0f, 0.0f, 0.0f));
makeActorDead();
}

void KuromadoMagicBall::appear() {
al::LiveActor::appear();
al::emitEffect(this, "Core", nullptr);
al::setVelocity(this, al::getFront(this) * 20.0f);
mAliveTimer = 0;
}

void KuromadoMagicBall::control() {
mAliveTimer += 1;
if (mAliveTimer >= 300) {
al::emitEffect(this, "Disappear", nullptr);
kill();
}
}

void KuromadoMagicBall::attackSensor(al::HitSensor* target, al::HitSensor* source) {
if (al::sendMsgEnemyAttackFire(source, target, nullptr) ||
rs::sendMsgEnemyAttackStrong(source, target) ||
rs::sendMsgEnemyAttackDash(source, target)) {
al::emitEffect(this, "Hit", nullptr);
kill();
}
}
16 changes: 16 additions & 0 deletions src/Enemy/KuromadoMagicBall.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include "Library/LiveActor/LiveActor.h"

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

void init(const al::ActorInitInfo& info) override;
void appear() override;
void control() override;
void attackSensor(al::HitSensor* target, al::HitSensor* source) override;

private:
s32 mAliveTimer = 0;
};
3 changes: 3 additions & 0 deletions src/Util/Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class SensorMsg;
namespace rs {

bool sendMsgEnemyAttack2D(al::HitSensor* source, al::HitSensor* target);
bool sendMsgEnemyAttackStrong(al::HitSensor* source, al::HitSensor* target);
bool sendMsgEnemyAttackDash(al::HitSensor* source, al::HitSensor* target);

bool sendMsgNoticePlayerDamage(al::HitSensor* source, al::HitSensor* target);
bool sendMsgTouchFireDrum2D(al::HitSensor* source, al::HitSensor* target);
bool sendMsgItemAmiiboKoopa(al::HitSensor* source, al::HitSensor* target);
Expand Down

0 comments on commit 4b4748e

Please sign in to comment.