diff options
author | Stephen Simpson <megazig@gmail.com> | 2011-10-10 22:31:20 -0500 |
---|---|---|
committer | Stephen Simpson <megazig@gmail.com> | 2011-10-10 22:31:20 -0500 |
commit | 18b416a0468ee30cebcb6d93cb07c77d99703371 (patch) | |
tree | a8ba415bd54a7824311ab3677b6bef1531805a20 /src/bossMegaGoomba.cpp | |
parent | 5f3eca3f6074605272b7bdde4a685d2f0934d6a7 (diff) | |
parent | 1bf7f8a471746eef9badf5f37031da6f8d88e9a2 (diff) | |
download | kamek-18b416a0468ee30cebcb6d93cb07c77d99703371.tar.gz kamek-18b416a0468ee30cebcb6d93cb07c77d99703371.zip |
Merge branch 'megaTestBoss' into level-select
Diffstat (limited to 'src/bossMegaGoomba.cpp')
-rw-r--r-- | src/bossMegaGoomba.cpp | 141 |
1 files changed, 110 insertions, 31 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 65bbdb2..e6c2b0b 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -14,7 +14,6 @@ class daMegaGoomba_c : public dEn_c { m3d::mdl_c bodyModel; float timer; - nw4r::ut::Rect Bounding; float dying; HermiteKey keysX[0x10]; @@ -25,6 +24,35 @@ class daMegaGoomba_c : public dEn_c { // unsigned int Zkey_count; char life; + + //TODO use these for MegaGecko testing of params + u32 marker1_start; + nw4r::ut::Rect Bounding; + u32 marker1_end; + u32 marker2_start; + int pickedChoice; + u32 marker2_end; + u32 marker3_start; + float XSpeed; + u32 marker3_end; + u32 marker4_start; + float JumpHeight; + u32 marker4_end; + u32 marker5_start; + float JumpDist; + u32 marker5_end; + u32 marker6_start; + float JumpTime; + u32 marker6_end; + u32 marker7_start; + int playIt; + u32 marker7_end; + u32 marker8_start; + int toPlay; + u32 marker8_end; + u32 marker9_start; + u32 marker9_end; + bool takeHit(char count); void dieFall_Execute(); @@ -192,18 +220,45 @@ int daMegaGoomba_c::onCreate() { this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); - pos.y -= 20.0; + pos.y -= 16.0; pos.z = 3000.0; rot.x = rot.y = rot.z = speed.x = dying = 0.0; direction = 0; life = 3; //TODO 1) allow setting bounding rect with settings //TODO 2) don't use bounding rect. use wall/floor/ceiling detection - Bounding.left = pos.x - 350.0; + Bounding.left = pos.x - 212.0; Bounding.top = pos.y + 500.0; - Bounding.right = pos.x + 350.0; + Bounding.right = pos.x + 212.0; Bounding.bottom = pos.y; + //TODO for tests + this->marker1_start = 0xaabbcc11; + this->marker1_end = 0xaabbff11; + this->marker2_start = 0xaabbcc12; + this->marker2_end = 0xaabbff12; + this->marker3_start = 0xaabbcc13; + this->marker3_end = 0xaabbff13; + this->marker4_start = 0xaabbcc14; + this->marker4_end = 0xaabbff14; + this->marker5_start = 0xaabbcc15; + this->marker5_end = 0xaabbff15; + this->marker6_start = 0xaabbcc16; + this->marker6_end = 0xaabbff16; + this->marker7_start = 0xaabbcc17; + this->marker7_end = 0xaabbff17; + this->marker8_start = 0xaabbcc18; + this->marker8_end = 0xaabbff18; + this->marker9_start = 0xaabbcc19; + this->marker9_end = 0xaabbff19; + this->pickedChoice = -1; + this->XSpeed = 2.0; // GOOD FOR FINAL SPEED? + this->JumpHeight = 48.0; + this->JumpDist = 64.0; + this->JumpTime = 50.0; + this->playIt = 0; + this->toPlay = 0; + OSReport("Setting MegaGoomba's State\n"); doStateChange(&StateID_Grow); @@ -241,21 +296,23 @@ int daMegaGoomba_c::onDraw() { void daMegaGoomba_c::updateModelMatrices() { // Bounds checking // TODO possibly change to a state change - if(this->pos.x < this->Bounding.left) { - this->direction = !this->direction; - this->speed.x = -this->speed.x; - this->pos.x = this->Bounding.left; - } else if (this->pos.x > this->Bounding.right) { - this->direction = !this->direction; - this->speed.x = -this->speed.x; - this->pos.x = this->Bounding.right; - } - if(this->pos.y < this->Bounding.bottom) { - this->speed.y = 0.0; - this->pos.y = this->Bounding.bottom; - } else if (this->pos.y > this->Bounding.top) { - this->speed.y = 0.0; - this->pos.y = this->Bounding.bottom; + if(this->life > 0) { + if(this->pos.x < this->Bounding.left) { + this->direction = !this->direction; + this->speed.x = -this->speed.x; + this->pos.x = this->Bounding.left; + } else if (this->pos.x > this->Bounding.right) { + this->direction = !this->direction; + this->speed.x = -this->speed.x; + this->pos.x = this->Bounding.right; + } + if(this->pos.y < this->Bounding.bottom) { + this->speed.y = 0.0; + this->pos.y = this->Bounding.bottom; + } else if (this->pos.y > this->Bounding.top) { + this->speed.y = 0.0; + this->pos.y = this->Bounding.bottom; + } } // This won't work with wrap because I'm lazy. @@ -345,22 +402,34 @@ void daMegaGoomba_c::executeState_Launch() { this->rot.y = sin(this->timer * 3.14 / 5) * 4000; dStageActor_c *spawner = NULL; - // 120ticks / 40numbers * 2cases = 6avg kuribo - int randChoice = GenerateRandomNumber(40); + // 120ticks / 80numbers * 4cases = 6avg kuribo + int randChoice = GenerateRandomNumber(80); int randChoiceX = GenerateRandomNumber(12); - int randChoiceY = GenerateRandomNumber(12); + int randChoiceY = GenerateRandomNumber(7); switch(randChoice) { case 0: case 1: spawner = CreateActor(EN_KURIBO, 0, this->pos, 0, 0); spawner->speed.x = randChoiceX - 6.0; - spawner->speed.y = randChoiceY * 1.0; + spawner->speed.y = randChoiceY + 3.0; spawner->scale = (Vec){1.0, 1.0, 1.0}; break; case 2: spawner = CreateActor(EN_BEANS_KURIBO, 0, this->pos, 0, 0); - spawner->speed.x = randChoiceX - 12.0; - spawner->speed.y = randChoiceY * 1.0; + spawner->speed.x = randChoiceX - 6.0; + spawner->speed.y = randChoiceY + 3.0; + spawner->scale = (Vec){1.0, 1.0, 1.0}; + break; + case 3: + spawner = CreateActor(EN_PATA_KURIBO, 0, this->pos, 0, 0); + spawner->speed.x = randChoiceX - 6.0; + spawner->speed.y = randChoiceY + 3.0; + spawner->scale = (Vec){1.0, 1.0, 1.0}; + break; + case 4: + spawner = CreateActor(EN_MAME_KURIBO, 0, this->pos, 0, 0); + spawner->speed.x = randChoiceX - 6.0; + spawner->speed.y = randChoiceY + 3.0; spawner->scale = (Vec){1.0, 1.0, 1.0}; break; default: @@ -380,9 +449,9 @@ void daMegaGoomba_c::beginState_Jump() { this->timer = 1.0; //Variables for choosing a curve - float jump_height = 36.0; - float delta = (this->direction) ? -24.0 : 24.0; - float fullTime = 90.0; + float jump_height = this->JumpHeight; + float delta = (this->direction) ? -JumpDist : JumpDist; + float fullTime = this->JumpTime; //Key count Xkey_count = 2; Ykey_count = 3; @@ -404,7 +473,7 @@ void daMegaGoomba_c::executeState_Jump() { this->pos.x = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count); this->pos.y = GetHermiteCurveValue(this->timer, this->keysY, Ykey_count); - float TimerMax = 91.0; + float TimerMax = JumpTime + 1.0; if (this->timer > TimerMax) { doStateChange(&StateID_Walk); } @@ -423,14 +492,24 @@ void daMegaGoomba_c::beginState_Walk() { } void daMegaGoomba_c::executeState_Walk() { - float delta = (this->direction) ? -0.5 : 0.5; + float delta = (this->direction) ? -this->XSpeed : this->XSpeed; this->pos.x += delta; int Choice; float TimerMax = 150.0; if (this->timer > TimerMax) { - Choice = GenerateRandomNumber(4); + if(this->pickedChoice != -1) { + Choice = this->pickedChoice; + /* + if(this->playIt = 1) { + playSound(this->toPlay); + this->playIt = 0; + } + */ + } else { + Choice = GenerateRandomNumber(4); + } switch(Choice) { case 0: doStateChange(&StateID_Jump); |