mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
MapObj: Implement SignBoardBlow (#863)
This commit is contained in:
parent
147f1548df
commit
d53ede9dad
|
|
@ -85586,40 +85586,40 @@ MapObj/SignBoardBlow.o:
|
|||
- offset: 0x31b030
|
||||
size: 136
|
||||
label: _ZN13SignBoardBlowC2EPKcS1_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b0b8
|
||||
size: 140
|
||||
label: _ZN13SignBoardBlowC1EPKcS1_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b144
|
||||
size: 104
|
||||
label: _ZN13SignBoardBlow4initERKN2al13ActorInitInfoE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b1ac
|
||||
size: 8
|
||||
label: _ZN13SignBoardBlow10receiveMsgEPKN2al9SensorMsgEPNS0_9HitSensorES5_
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b1b4
|
||||
size: 204
|
||||
label: _ZN13SignBoardBlow9startBlowERKN4sead7Vector3IfEE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b280
|
||||
size: 4
|
||||
label: _ZN13SignBoardBlow7exeWaitEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b284
|
||||
size: 304
|
||||
label: _ZN13SignBoardBlow7exeBlowEv
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
- offset: 0x31b3b4
|
||||
size: 4
|
||||
label: _ZNK12_GLOBAL__N_120SignBoardBlowNrvWait7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
- offset: 0x31b3b8
|
||||
size: 8
|
||||
label: _ZNK12_GLOBAL__N_120SignBoardBlowNrvBlow7executeEPN2al11NerveKeeperE
|
||||
status: NotDecompiled
|
||||
status: Matching
|
||||
guess: true
|
||||
MapObj/SignBoardDanger.o:
|
||||
'.text':
|
||||
|
|
|
|||
74
src/MapObj/SignBoardBlow.cpp
Normal file
74
src/MapObj/SignBoardBlow.cpp
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#include "MapObj/SignBoardBlow.h"
|
||||
|
||||
#include <basis/seadTypes.h>
|
||||
#include <math/seadQuat.h>
|
||||
|
||||
#include "Library/Collision/CollisionPartsKeeperUtil.h"
|
||||
#include "Library/LiveActor/ActorActionFunction.h"
|
||||
#include "Library/LiveActor/ActorInitUtil.h"
|
||||
#include "Library/LiveActor/ActorMovementFunction.h"
|
||||
#include "Library/LiveActor/ActorPoseUtil.h"
|
||||
#include "Library/Math/MathUtil.h"
|
||||
#include "Library/Nerve/NerveSetupUtil.h"
|
||||
#include "Library/Nerve/NerveUtil.h"
|
||||
|
||||
namespace {
|
||||
NERVE_IMPL(SignBoardBlow, Wait);
|
||||
NERVE_IMPL(SignBoardBlow, Blow);
|
||||
|
||||
NERVES_MAKE_NOSTRUCT(SignBoardBlow, Wait, Blow);
|
||||
} // namespace
|
||||
|
||||
SignBoardBlow::SignBoardBlow(const char* actorName, const char* signBoardBlowName)
|
||||
: al::LiveActor(actorName), mArchiveName(signBoardBlowName) {}
|
||||
|
||||
void SignBoardBlow::init(const al::ActorInitInfo& info) {
|
||||
al::initActorWithArchiveName(this, info, mArchiveName, nullptr);
|
||||
al::initNerve(this, &Wait, 0);
|
||||
makeActorDead();
|
||||
}
|
||||
|
||||
bool SignBoardBlow::receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void SignBoardBlow::startBlow(const sead::Vector3f& attackerPos) {
|
||||
appear();
|
||||
al::startHitReaction(this, "出現");
|
||||
al::setVelocityBlowAttack(this, attackerPos, 18.0f, 38.0f);
|
||||
al::setNerve(this, &Blow);
|
||||
sead::Vector3f attackDir = al::getTrans(this) - attackerPos;
|
||||
attackDir.y = 0.0f;
|
||||
mRotationAxis = sead::Vector3f::ey.cross(attackDir);
|
||||
al::tryNormalizeOrDirZ(&mRotationAxis);
|
||||
}
|
||||
|
||||
void SignBoardBlow::exeWait() {}
|
||||
|
||||
void SignBoardBlow::exeBlow() {
|
||||
al::addVelocityToGravity(this, 1.8f);
|
||||
f32 nerveRate = al::calcNerveRate(this, 0, 30);
|
||||
f32 expValue = al::lerpExponentValueEaseOut(0.0f, 400.0f, nerveRate, 2.0f);
|
||||
sead::Quatf rotatedQuat;
|
||||
al::makeQuatRotateDegree(&rotatedQuat, mRotationAxis, expValue);
|
||||
sead::Vector3f rotateDegree;
|
||||
al::calcQuatRotateDegree(&rotateDegree, rotatedQuat);
|
||||
al::setRotate(this, rotateDegree);
|
||||
|
||||
if (al::isGreaterEqualStep(this, 2)) {
|
||||
sead::Vector3f upDir;
|
||||
al::calcUpDir(&upDir, this);
|
||||
if (alCollisionUtil::checkStrikeSphere(this, al::getTrans(this) + upDir * 0.0f, 80.0f,
|
||||
nullptr, nullptr)) {
|
||||
al::startHitReaction(this, "消滅");
|
||||
kill();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (al::isGreaterEqualStep(this, 30)) {
|
||||
al::startHitReaction(this, "消滅");
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
@ -16,13 +16,13 @@ public:
|
|||
void init(const al::ActorInitInfo& info) override;
|
||||
bool receiveMsg(const al::SensorMsg* message, al::HitSensor* other,
|
||||
al::HitSensor* self) override;
|
||||
void startBlow(const sead::Vector3f&);
|
||||
void startBlow(const sead::Vector3f& attackerPos);
|
||||
void exeWait();
|
||||
void exeBlow();
|
||||
|
||||
private:
|
||||
const char* mName = nullptr;
|
||||
sead::Vector3f _110;
|
||||
const char* mArchiveName = nullptr;
|
||||
sead::Vector3f mRotationAxis;
|
||||
};
|
||||
|
||||
static_assert(sizeof(SignBoardBlow) == 0x120);
|
||||
|
|
|
|||
Loading…
Reference in a new issue