diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-09-18 15:51:03 -0500 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-09-18 15:51:03 -0500 |
commit | 952e3fcab796c97f9a9f77128485d72994b69a86 (patch) | |
tree | 886ad3789d119abe6f7c2f74139c7659cc88a812 | |
parent | f2c523cb5182d4b03398d2e84b40690f47ad93fd (diff) | |
download | kamek-952e3fcab796c97f9a9f77128485d72994b69a86.tar.gz kamek-952e3fcab796c97f9a9f77128485d72994b69a86.zip |
Mrsun with proper model
-rwxr-xr-x | src/mrsun.cpp | 82 |
1 files changed, 49 insertions, 33 deletions
diff --git a/src/mrsun.cpp b/src/mrsun.cpp index 7e45902..0b2c798 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -65,22 +65,23 @@ int daMrSun_c::onCreate() { OSReport("Creating the Mr.Sun Model"); allocator.link(-1, GameHeaps[0], 0, 0x20); - nw4r::g3d::ResFile rf(getResource("bubble", "g3d/t00.brres")); - model.setup(rf.GetResMdl("bubble"), &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&model, 0); + nw4r::g3d::ResFile rf(getResource("bilikyu", "g3d/sun.brres")); + model.setup(rf.GetResMdl("Sun"), &allocator, 0x224, 1, 0); +// SetupTextures_Enemy(&model, 0); + SetupTextures_Map(&model, 0); allocator.unlink(); OSReport("Setting Mr.Sun's Size to 4.0"); - this->scale = (Vec){4.0, 4.0, 4.0}; + this->scale = (Vec){0.5, 0.5, 0.5}; OSReport("Creating Mr.Sun's Physics Struct"); ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; HitMeBaby.yDistToCenter = 0.0; - HitMeBaby.xDistToEdge = 32.0; - HitMeBaby.yDistToEdge = 32.0; + HitMeBaby.xDistToEdge = 16.0; + HitMeBaby.yDistToEdge = 16.0; HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; @@ -145,8 +146,9 @@ void daMrSun_c::updateModelMatrix() { void daMrSun_c::beginState_Follow() { OSReport("Mr.Sun is following youuuuu."); this->timer = 0; - this->rot.x = 0; + this->rot.x = 11000; this->rot.y = 0; +// this->rot.z = 11000; } void daMrSun_c::executeState_Follow() { @@ -165,7 +167,7 @@ void daMrSun_c::executeState_Follow() { float yDiff; - yDiff = (this->Baseline - this->pos.y) / 4; + yDiff = (this->Baseline - this->pos.y) / 8; this->speed.y = yDiff; @@ -195,6 +197,7 @@ void daMrSun_c::beginState_Swoop() { if (Player == 0) { doStateChange(&StateID_Follow); } this->swoopTarget = Player->pos; + this->swoopTarget.y = this->swoopTarget.y - 24; float relativeSunX = this->swoopTarget.x - this->pos.x; float relativeSunY = this->swoopTarget.y - this->pos.y; @@ -205,19 +208,27 @@ void daMrSun_c::executeState_Swoop() { if (this->slope < 0.0) { this->speed.x = this->speed.x + 0.3; - this->speed.y = this->speed.y + (0.2 * -slope); + this->speed.y = this->speed.y - (0.2 * -slope); } else if (this->slope > 0.0) { this->speed.x = this->speed.x - 0.3; - this->speed.y = this->speed.y + (0.2 * slope); + this->speed.y = this->speed.y - (0.2 * slope); + } + + float yDiff; + + if (this->pos.y < this->swoopTarget.y) { + this->speed.x = this->speed.x * 0.2; + this->speed.y = this->speed.y * 0.2; } HandleXSpeed(this); HandleYSpeed(this); UpdateObjectPosBasedOnSpeedValues_real(this); - if (this->pos.y > this->swoopTarget.y) { doStateChange(&StateID_Follow); } + if (this->pos.y < this->swoopTarget.y) { + if (this->speed.y < 0.1) { doStateChange(&StateID_Follow); } } } void daMrSun_c::endState_Swoop() { @@ -231,6 +242,7 @@ void daMrSun_c::endState_Swoop() { void daMrSun_c::beginState_Spiral() { OSReport("Super Spiral Sunspot!"); + this->SpiralLoop = 0; this->xSpiralOffset = this->pos.x; this->ySpiralOffset = this->pos.y; } @@ -240,12 +252,13 @@ void daMrSun_c::executeState_Spiral() { float Period; float Magnitude; - Loops = 1.0; - Period = 0.1; - Magnitude = 1.0; + Loops = 6.0; + // Use a period of 0.1 for the moon + Period = 0.075; + Magnitude = 11.0; - this->pos.x = Magnitude*(this->xSpiralOffset + (this->SpiralLoop * cos(this->SpiralLoop))); - this->pos.y = Magnitude*(this->ySpiralOffset + (this->SpiralLoop * sin(this->SpiralLoop))); + this->pos.x = this->xSpiralOffset + Magnitude*((this->SpiralLoop * cos(this->SpiralLoop))); + this->pos.y = this->ySpiralOffset + Magnitude*((this->SpiralLoop * sin(this->SpiralLoop))); this->SpiralLoop = this->SpiralLoop + Period; @@ -321,7 +334,7 @@ void daMrSun_c::executeState_Spin() { this->rot.y = this->rot.y + (50 * rotBonus); int randomBall; - randomBall = GenerateRandomNumber(5); + randomBall = GenerateRandomNumber(6); if (randomBall == 1) { int direction; direction = GenerateRandomNumber(8); @@ -330,29 +343,29 @@ void daMrSun_c::executeState_Spin() { float ylaunch; if (direction == 0) { - xlaunch = 10.0; + xlaunch = 7.5; ylaunch = 0.0; } else if (direction == 1) { // SE - xlaunch = 10.0; - ylaunch = 10.0; } + xlaunch = 7.5; + ylaunch = 7.5; } else if (direction == 2) { // S xlaunch = 0.0; - ylaunch = 10.0; } + ylaunch = 7.5; } else if (direction == 3) { // SW - xlaunch = -10.0; - ylaunch = 10.0; } + xlaunch = -7.5; + ylaunch = 7.5; } else if (direction == 4) { // W - xlaunch = -10.0; + xlaunch = -7.5; ylaunch = 0.0; } else if (direction == 5) { // NW - xlaunch = -10.0; - ylaunch = -10.0; } + xlaunch = -7.5; + ylaunch = -7.5; } else if (direction == 6) { // N xlaunch = 0.0; - ylaunch = -10.0; } + ylaunch = -7.5; } else if (direction == 7) { // NE - xlaunch = 10.0; - ylaunch = -10.0; } + xlaunch = 7.5; + ylaunch = -7.5; } dStageActor_c *spawner = CreateActor(106, 0, this->pos, 0, 0); @@ -369,8 +382,9 @@ void daMrSun_c::executeState_Spin() { void daMrSun_c::endState_Spin() { OSReport("K, I is dizzy now."); - this->rot.x = 0; + this->rot.x = 11000; this->rot.y = 0; +// this->rot.z = 11000; } @@ -384,8 +398,9 @@ void daMrSun_c::beginState_Wait() { this->timer = 0; this->speed.x = 0.0; - this->rot.x = 0; + this->rot.x = 11000; this->rot.y = 0; +// this->rot.z = 11000; } void daMrSun_c::executeState_Wait() { int Choice; @@ -397,7 +412,7 @@ void daMrSun_c::executeState_Wait() { OSReport("Choice: %d", Choice); - if (Choice == 0) { doStateChange(&StateID_Spin); } + if (Choice == 0) { doStateChange(&StateID_Swoop); } // else if (Choice == 1) { doStateChange(&StateID_Spin); } // else if (Choice == 2) { doStateChange(&StateID_Swoop); } // else if (Choice == 3) { doStateChange(&StateID_Spiral); } @@ -409,8 +424,9 @@ void daMrSun_c::executeState_Wait() { void daMrSun_c::endState_Wait() { OSReport("Mr.Sun Cometh!"); this->timer = 0; - this->rot.x = 0; + this->rot.x = 11000; this->rot.y = 0; +// this->rot.z = 11000; } |