Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
35 changes: 35 additions & 0 deletions include/Game/Enemy/BegomanSpringHead.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "Game/LiveActor/PartsModel.hpp"

class BegomanHead : public PartsModel {
public:
BegomanHead(LiveActor*, const char*, const char*, MtxPtr, int, bool);
virtual ~BegomanHead();
virtual void calcAndSetBaseMtx();

private:
TVec3f* _9C;
};

class BegomanSpringHead : public BegomanHead {
public:
BegomanSpringHead(LiveActor*, MtxPtr);
virtual ~BegomanSpringHead();
virtual void init(const JMapInfoIter&);

bool isSpringHop();
void getHopEndBckFrameMax();
void tryHopStart();
void tryHopEnd();
void tryHopJump();
void forceWaitImmediately();
void exeWait();
void exeHopStart();
void exeHopWait();
void exeHopEnd();
void exeHopJump();

private:
TVec3f* _9C;
};
105 changes: 105 additions & 0 deletions src/Game/Enemy/BegomanSpringHead.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#include "Game/Enemy/BegomanSpringHead.hpp"

namespace NrvBegomanSpringHead {
NEW_NERVE(HostTypeNrvWait, BegomanSpringHead, Wait);
NEW_NERVE(HostTypeNrvHopStart, BegomanSpringHead, HopStart);
NEW_NERVE(HostTypeNrvHopWait, BegomanSpringHead, HopWait);
NEW_NERVE(HostTypeNrvHopEnd, BegomanSpringHead, HopEnd);
NEW_NERVE(HostTypeNrvHopJump, BegomanSpringHead, HopJump);
} // namespace NrvBegomanSpringHead

void BegomanHead::calcAndSetBaseMtx() {
PartsModel::calcAndSetBaseMtx();
TVec3f v7;
JMathInlineVEC::PSVECMultiply(_9C, mScale, v7);
MR::setBaseScale(this, v7);
}

BegomanSpringHead::BegomanSpringHead(LiveActor* pActor, MtxPtr pMtx)
: BegomanHead(pActor, "バネ頭", "BegomanSpringHead", pMtx, 10, false), _9C(nullptr) {
}

BegomanHead::~BegomanHead() {
}

void BegomanSpringHead::init(const JMapInfoIter& rIter) {
initNerve(&NrvBegomanSpringHead::HostTypeNrvWait::sInstance);
MR::initLightCtrl(this);
initHitSensor(1);
MR::addHitSensorAtJoint(this, "head", "SpringJoint5", ATYPE_MAP_OBJ_SIMPLE, 8, 100.0f, TVec3f(0.0f, 100.0f, 0.0f));
PartsModel::init(rIter);
}

bool BegomanSpringHead::isSpringHop() {
return !LiveActor::isNerve(&NrvBegomanSpringHead::HostTypeNrvWait::sInstance);
}

void BegomanSpringHead::getHopEndBckFrameMax() {
MR::getBckFrameMax(this, "HopEnd");
}

void BegomanSpringHead::tryHopStart() {
if (!isNerve(&NrvBegomanSpringHead::HostTypeNrvHopStart::sInstance)) {
setNerve(&NrvBegomanSpringHead::HostTypeNrvHopStart::sInstance);
}
}

void BegomanSpringHead::tryHopEnd() {
if (isNerve(&NrvBegomanSpringHead::HostTypeNrvHopEnd::sInstance) || isNerve(&NrvBegomanSpringHead::HostTypeNrvWait::sInstance)) {
return;
}
setNerve(&NrvBegomanSpringHead::HostTypeNrvHopEnd::sInstance);
}

void BegomanSpringHead::tryHopJump() {
if (!isNerve(&NrvBegomanSpringHead::HostTypeNrvHopJump::sInstance)) {
setNerve(&NrvBegomanSpringHead::HostTypeNrvHopJump::sInstance);
}
}

void BegomanSpringHead::forceWaitImmediately() {
MR::startBck(this, "Wait", nullptr);
MR::startBrk(this, "Green");
setNerve(&NrvBegomanSpringHead::HostTypeNrvWait::sInstance);
}

void BegomanSpringHead::exeWait() {
if (MR::isFirstStep(this)) {
MR::startBck(this, "Wait", nullptr);
MR::startBrk(this, "Green");
}
}

void BegomanSpringHead::exeHopStart() {
if (MR::isFirstStep(this)) {
MR::startBck(this, "HopStart", nullptr);
MR::startBrk(this, "OnAndOff");
MR::setNerveAtBckStopped(this, &NrvBegomanSpringHead::HostTypeNrvHopWait::sInstance);
}
}

void BegomanSpringHead::exeHopWait() {
if (MR::isFirstStep(this)) {
MR::startBck(this, "HopWait", nullptr);
MR::startBrk(this, "OnAndOff");
}
}

void BegomanSpringHead::exeHopEnd() {
if (MR::isFirstStep(this)) {
MR::startSound(this, "SE_EM_BEGOMAN_CLOSE_SPRING", -1, -1);
}
MR::startBckAtFirstStep(this, "HopEnd");
MR::setNerveAtBckStopped(this, &NrvBegomanSpringHead::HostTypeNrvWait::sInstance);
}

void BegomanSpringHead::exeHopJump() {
if (MR::isFirstStep(this)) {
MR::startBck(this, "HopJump", nullptr);
MR::startBrk(this, "OnAndOff");
}
MR::setNerveAtBckStopped(this, &NrvBegomanSpringHead::HostTypeNrvHopWait::sInstance);
}

BegomanSpringHead::~BegomanSpringHead() {
}
Loading