1#include "ObjectPakkunF.hh"
7 : ObjectCollidable(params), m_attackFrames(0), m_currAttackFrame(0),
8 m_waitDuration(static_cast<s32>(m_mapObj->setting(0))) {}
11ObjectPakkunF::~ObjectPakkunF() =
default;
14void ObjectPakkunF::init() {
15 m_state = State::Wait;
16 m_waitFrames = m_waitDuration;
22void ObjectPakkunF::calc() {
34 calcCollisionTransform();
38void ObjectPakkunF::loadAnims() {
39 std::array<const char *, 3> names = {{
45 std::array<Render::AnmType, 3> types = {{
51 linkAnims(names, types);
55void ObjectPakkunF::calcCollisionTransform() {
65 if (m_state == State::Attack) {
66 if (m_currAttackFrame <= 10) {
67 posOffset = INIT_POS * m_scale.x;
68 }
else if (m_currAttackFrame <= 20) {
69 f32 fVar1 = 0.1f *
static_cast<f32
>(m_currAttackFrame - 10);
70 posOffset = FINAL_POS * m_scale.x * fVar1 + INIT_POS * m_scale.x * (1.0f - fVar1);
71 }
else if (m_currAttackFrame <= 30) {
72 f32 fVar1 = 0.1f *
static_cast<f32
>(m_currAttackFrame - 20);
73 posOffset = INIT_POS * m_scale.x * fVar1 + FINAL_POS * m_scale.x * (1.0f - fVar1);
75 posOffset = INIT_POS * m_scale.x;
78 posOffset = INIT_POS * m_scale.x;
91 m_collision->transform(transformMat, m_scale);
95void ObjectPakkunF::calcWait() {
96 if (--m_waitFrames == 0) {
102void ObjectPakkunF::calcAttack() {
105 if (--m_attackFrames == 0) {
106 m_state = State::Wait;
107 m_waitFrames = m_waitDuration;
112void ObjectPakkunF::enterAttack() {
113 constexpr s32 LINGERING_FRAMES = 60;
115 m_state = State::Attack;
116 auto *anmMgr = m_drawMdl->anmMgr();
117 anmMgr->playAnim(0.0f, 1.0f, 0);
118 m_currAttackFrame = 0;
119 auto *attackAnm = anmMgr->activeAnim(Render::AnmType::Chr);
120 m_attackFrames =
static_cast<s32
>(attackAnm->frameCount()) + LINGERING_FRAMES;
Matrix34f multiplyTo(const Matrix34f &rhs) const
Multiplies two matrices.
void setAxisRotation(f32 angle, const Vector3f &axis)
Rotates the matrix about an axis.
void makeR(const Vector3f &r)
Sets 3x3 rotation matrix from a vector of Euler angles.
Vector3f ps_multVector(const Vector3f &vec) const
Paired-singles impl. of multVector.