diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-09-19 16:54:56 -0500 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-09-19 16:54:56 -0500 |
commit | fd0dd24cb30961a8f7ee9c672ebdea742b8140d4 (patch) | |
tree | 09d9ce16f65c4d2eb49e3d2d92fee19c07b067fa /src | |
parent | 2ce313d6b162fcb6e9e3790316848c72ff0bf012 (diff) | |
download | kamek-fd0dd24cb30961a8f7ee9c672ebdea742b8140d4.tar.gz kamek-fd0dd24cb30961a8f7ee9c672ebdea742b8140d4.zip |
Mr.Sun, nearly finished!
Diffstat (limited to 'src')
-rwxr-xr-x | src/mrsun.cpp | 81 |
1 files changed, 59 insertions, 22 deletions
diff --git a/src/mrsun.cpp b/src/mrsun.cpp index a5fa121..a62c723 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -27,6 +27,9 @@ class daMrSun_c : public dEn_c { float swoopB; float swoopC; float swoopSpeed; + float glowPos; + float spinReduce; + float spinStateOn; static daMrSun_c *build(); @@ -166,10 +169,25 @@ void daMrSun_c::updateModelMatrices() { if (hasGlow) { mMtx glowMatrix; + short rotZ; + float scaleX; + + glowPos += 0.01666666666666; + if (glowPos > 1) { glowPos = 0; } + + if (this->spinStateOn = 0) { rotZ = (2000 * sin(glowPos * 3.14)) + 1000; } + else { rotZ = (0xFFFF * sin(glowPos * 3.14)) + 0x7FFF; } + + scaleX = (0.2 * sin(glowPos * 3.14)) + 0.5; + + Vec glowscale = (Vec){scaleX, scaleX, 0.5}; + glowMatrix.translation(pos.x, pos.y, pos.z); + glowMatrix.applyRotationX(&rot.x); + glowMatrix.applyRotationZ(&rotZ); glowModel.setDrawMatrix(glowMatrix); - glowModel.setScale(&scale); + glowModel.setScale(&glowscale); glowModel.calcWorld(false); } } @@ -180,9 +198,9 @@ void daMrSun_c::updateModelMatrices() { void daMrSun_c::beginState_Follow() { OSReport("Mr.Sun is following youuuuu."); this->timer = 0; - this->rot.x = 11000; + this->rot.x = 14000; this->rot.y = 0; -// this->rot.z = 11000; +// this->rot.z = 14000; } void daMrSun_c::executeState_Follow() { @@ -198,13 +216,13 @@ void daMrSun_c::executeState_Follow() { this->speed.x = this->speed.x + speedDelta; if (this->speed.x < 0) { this->speed.x = this->speed.x + (speedDelta / 2); } - if (this->speed.x < 10.0) { this->speed.x = this->speed.x + (speedDelta); } + if (this->speed.x < 50.0) { this->speed.x = this->speed.x + (speedDelta * 2); } } else { this->speed.x = this->speed.x - speedDelta; if (this->speed.x > 0) { this->speed.x = this->speed.x - (speedDelta / 2); } - if (this->speed.x > 10.0) { this->speed.x = this->speed.x + (speedDelta); } + if (this->speed.x < 50.0) { this->speed.x = this->speed.x - (speedDelta * 2); } } HandleXSpeed(this); @@ -236,7 +254,7 @@ void daMrSun_c::beginState_Swoop() { // Not enough space to swoop, spit instead. if (this->swoopTarget.y < (this->pos.y - 50)) { doStateChange(&StateID_Spit); } - if ((this->pos.x - 64) < this->swoopTarget.x < (this->pos.x + 64)) { doStateChange(&StateID_Spit); } + if (((this->pos.x - 96) < this->swoopTarget.x) && (this->swoopTarget.x < (this->pos.x + 96))) { doStateChange(&StateID_Spit); } if (this->settings == 0) { this->swoopTarget.y = this->swoopTarget.y - 16; @@ -323,7 +341,7 @@ void daMrSun_c::beginState_Spit() { OSReport("Goodness Gracious Great Balls of Fire!"); this->timer = 0; - + this->spinStateOn = 1; } void daMrSun_c::executeState_Spit() { @@ -338,14 +356,17 @@ void daMrSun_c::executeState_Spit() { dStageActor_c *spawner = CreateActor(106, 0, this->pos, 0, 0); spawner->speed.x = 6.0 * neg; spawner->speed.y = -2.5; + spawner->pos.z = 3350.0; spawner = CreateActor(106, 0, this->pos, 0, 0); spawner->speed.x = 0.0 * neg; spawner->speed.y = -6.0; + spawner->pos.z = 3350.0; spawner = CreateActor(106, 0, this->pos, 0, 0); spawner->speed.x = 3.5 * neg; spawner->speed.y = -6.0; + spawner->pos.z = 3350.0; } // It's a sun @@ -353,14 +374,17 @@ void daMrSun_c::executeState_Spit() { dStageActor_c *spawner = CreateActor(118, 0, this->pos, 0, 0); spawner->speed.x = 6.0 * neg; spawner->speed.y = -2.5; + spawner->pos.z = 3350.0; spawner = CreateActor(118, 0, this->pos, 0, 0); spawner->speed.x = 0.0 * neg; spawner->speed.y = -6.0; + spawner->pos.z = 3350.0; spawner = CreateActor(118, 0, this->pos, 0, 0); spawner->speed.x = 3.5 * neg; spawner->speed.y = -6.0; + spawner->pos.z = 3350.0; } // It's a moon } @@ -370,22 +394,34 @@ void daMrSun_c::executeState_Spit() { if (this->timer > 30) { doStateChange(&StateID_Follow); } } -void daMrSun_c::endState_Spit() { OSReport("Armageddon complete."); } +void daMrSun_c::endState_Spit() { + this->spinStateOn = 0; + OSReport("Armageddon complete."); +} // Spin State -void daMrSun_c::beginState_Spin() { OSReport("Hoola hoola hoola hoop."); } +void daMrSun_c::beginState_Spin() { + OSReport("Hoola hoola hoola hoop."); + this->spinReduce = 0; +} void daMrSun_c::executeState_Spin() { this->direction = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); if (this->direction == 0) { this->speed.x = this->speed.x + 0.2; + + if (this->speed.x < 0) { this->speed.x = this->speed.x + (0.2 / 2); } + if (this->speed.x < 80.0) { this->speed.x = this->speed.x + (0.2 * 2); } } else { this->speed.x = this->speed.x - 0.2; + + if (this->speed.x > 0) { this->speed.x = this->speed.x - (0.2 / 2); } + if (this->speed.x > 80.0) { this->speed.x = this->speed.x - (0.2 * 2); } } HandleXSpeed(this); @@ -397,9 +433,17 @@ void daMrSun_c::executeState_Spin() { if (this->timer < 60) { rotBonus = this->timer; } else { rotBonus = 120 - this->timer; } -// this->rot.x = this->rot.x + (50 * rotBonus); + this->rot.z = this->rot.z + (50 * rotBonus); this->rot.y = this->rot.y + (50 * rotBonus); + if ((this->spinReduce = 0) && (this->timer < 100)) { + this->spinReduce = this->rot.z / 20; } + + if (this->timer < 100) { + this->rot.z = this->rot.z - this->spinReduce; + this->rot.y = this->rot.y - this->spinReduce; } + + int randomBall; randomBall = GenerateRandomNumber(6); if (randomBall == 1) { @@ -439,27 +483,26 @@ void daMrSun_c::executeState_Spin() { dStageActor_c *spawner = CreateActor(106, 0, this->pos, 0, 0); spawner->speed.x = xlaunch; spawner->speed.y = ylaunch; + spawner->pos.z = 3350.0; } // It's a sun else { dStageActor_c *spawner = CreateActor(118, 0, this->pos, 0, 0); spawner->speed.x = xlaunch; spawner->speed.y = ylaunch; + spawner->pos.z = 3350.0; } // It's a moon } - if (this->timer > 120) { -// this->rot.x = this->rot.x / 2; -// this->rot.y = this->rot.y / 2; - this->doStateChange(&StateID_Follow); } + if (this->timer > 120) { this->doStateChange(&StateID_Follow); } } void daMrSun_c::endState_Spin() { OSReport("K, I is dizzy now."); - this->rot.x = 11000; + this->rot.x = 14000; this->rot.y = 0; -// this->rot.z = 11000; + this->rot.z = 0; this->speed.x = 0; } @@ -474,9 +517,6 @@ void daMrSun_c::beginState_Wait() { this->timer = 0; this->speed.x = 0.0; - this->rot.x = 11000; - this->rot.y = 0; -// this->rot.z = 11000; dStageActor_c *Player = GetSpecificPlayerActor(0); if (Player == 0) { Player = GetSpecificPlayerActor(1); } @@ -513,9 +553,6 @@ void daMrSun_c::executeState_Wait() { void daMrSun_c::endState_Wait() { OSReport("Mr.Sun Cometh!"); this->timer = 0; - this->rot.x = 11000; - this->rot.y = 0; -// this->rot.z = 11000; } |