diff options
author | Treeki <treeki@gmail.com> | 2013-02-12 02:18:40 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-02-12 02:18:40 +0100 |
commit | dee5287a0ee6978f0c4783ae1fe139f7e885d0e6 (patch) | |
tree | 6cc0dfa8ac32dcc24eefd52486c05b97ca664ffb | |
parent | 10a3cd4df5e3b57b2e29cdc7ffa8bba611885625 (diff) | |
download | kamek-dee5287a0ee6978f0c4783ae1fe139f7e885d0e6.tar.gz kamek-dee5287a0ee6978f0c4783ae1fe139f7e885d0e6.zip |
add spike model to Balboa
Diffstat (limited to '')
-rw-r--r-- | src/bossBalboaWrench.cpp | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp index fe53a17..e53505c 100644 --- a/src/bossBalboaWrench.cpp +++ b/src/bossBalboaWrench.cpp @@ -13,6 +13,7 @@ class daBalboa_c : public daBoss { mHeapAllocator_c allocator; m3d::mdl_c bodyModel; + m3d::mdl_c spikesModel; nw4r::g3d::ResFile resFile; m3d::anmChr_c animationChr; @@ -29,6 +30,10 @@ class daBalboa_c : public daBoss { int isBigBoss; char isRevenging; int spinner; + + ActivePhysics spikeCollision; + float spikeOffset; + bool spikeGoingUp, spikeGoingDown; static daBalboa_c *build(); @@ -132,7 +137,9 @@ bool daBalboa_c::prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOthe mario->doSpriteMovement(); mario->doSpriteMovement(); - if (!isRevenging) { + if (isRevenging) { + _vf220(apOther->owner); + } else { this->damage -= 1; apOther->someFlagByte |= 2; @@ -181,6 +188,11 @@ void daBalboa_c::setupModels() { anmChr = this->resFile.GetResAnmChr("throw_1"); // 11 this->animationChr.setup(mdl, anmChr, &this->allocator, 0); + nw4r::g3d::ResFile togeRes; + togeRes.data = getResource("lift_zen", "g3d/lift_zen.brres"); + mdl = togeRes.GetResMdl("lift_togeU"); + spikesModel.setup(mdl, &allocator, 0, 1, 0); + // throw_1 // 11 // throw_2 // 75 // throw_3 // 33 @@ -231,7 +243,16 @@ int daBalboa_c::onCreate() { this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); - + ActivePhysics::Info spikeInfo = { + 0.0f, 0.0f, 16.0f, 16.0f, + 3, 0, 0x4F, 0xFFBAFFFE, 0, &dEn_c::collisionCallback}; + spikeCollision.initWithStruct(this, &spikeInfo); + spikeCollision.trpValue0 = 0.0f; + spikeCollision.trpValue1 = 0.0f; + spikeCollision.trpValue2 = -16.0f; + spikeCollision.trpValue3 = 16.0f; + spikeCollision.collisionCheckType = 3; + this->rot.x = 0; // X is vertical axis this->rot.y = 0xE000; // Y is horizontal axis this->rot.z = 0; // Z is ... an axis >.> @@ -261,6 +282,21 @@ int daBalboa_c::onDelete() { int daBalboa_c::onExecute() { acState.execute(); updateModelMatrices(); + + if (spikeGoingUp) { + spikeOffset += 2.5f; + if (spikeOffset >= 48.0f) { + spikeOffset = 48.0f; + spikeGoingUp = false; + } + } else if (spikeGoingDown) { + spikeOffset -= 2.5f; + if (spikeOffset <= 0.0f) { + spikeOffset = 0.0f; + spikeGoingDown = false; + } + } + spikeCollision.info.yDistToCenter = 16.0f + spikeOffset; bodyModel._vf1C(); @@ -270,6 +306,8 @@ int daBalboa_c::onExecute() { int daBalboa_c::onDraw() { bodyModel.scheduleForDrawing(); + if (spikeOffset > 0.0f) + spikesModel.scheduleForDrawing(); return true; } @@ -283,6 +321,12 @@ void daBalboa_c::updateModelMatrices() { bodyModel.setScale(&scale); bodyModel.calcWorld(false); + mMtx spikeMatrix; + VEC3 spikeScale = {2.0f,1.8f,2.0f}; + spikeMatrix.translation(pos.x, pos.y + spikeOffset, pos.z); + spikesModel.setDrawMatrix(spikeMatrix); + spikesModel.setScale(&spikeScale); + spikesModel.calcWorld(false); } // Grow State @@ -292,7 +336,7 @@ void daBalboa_c::updateModelMatrices() { SetupKameck(this, Kameck); - bindAnimChr_and_setUpdateRate("throw_2", 1, 0.0, 0.6); + bindAnimChr_and_setUpdateRate("begin_boss", 1, 0.0, 0.6); } void daBalboa_c::executeState_Grow() { @@ -604,6 +648,8 @@ void daBalboa_c::updateModelMatrices() { isRevenging = 1; bindAnimChr_and_setUpdateRate("throw_3", 1, 0.0, 1.0); + spikeGoingUp = true; + spikeCollision.addToList(); PlaySound(this, 0x220); } @@ -677,4 +723,6 @@ void daBalboa_c::updateModelMatrices() { } void daBalboa_c::endState_Revenge() { isRevenging = 0; + spikeGoingDown = true; + spikeCollision.removeFromList(); } |