diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-03-13 01:24:31 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-03-13 01:24:31 -0500 |
commit | 3d6a66b86fe5ba0b57f194fa8f80737e95aa6f42 (patch) | |
tree | b82ea481f61bf85ce181e6d274b98d881a68a6ff /src/bossTopman.cpp | |
parent | d3a5dc12e3b3d8295d8389e4ab5ff7888f492378 (diff) | |
download | kamek-3d6a66b86fe5ba0b57f194fa8f80737e95aa6f42.tar.gz kamek-3d6a66b86fe5ba0b57f194fa8f80737e95aa6f42.zip |
Finished up Topman boss
Diffstat (limited to '')
-rw-r--r-- | src/bossTopman.cpp | 182 |
1 files changed, 156 insertions, 26 deletions
diff --git a/src/bossTopman.cpp b/src/bossTopman.cpp index 67052f3..41aac4d 100644 --- a/src/bossTopman.cpp +++ b/src/bossTopman.cpp @@ -25,6 +25,14 @@ public: bool isBouncing; char isInSpace; char fromBehind; + char isInvulnerable; + int isInvulnerableCountdown; + int isTurningCountdown; + char charging; + int pOneHit; + int pTwoHit; + int pThreeHit; + int pFourHit; float dying; @@ -49,6 +57,7 @@ public: void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + void addScoreWhenHit(void *other); USING_STATES(daDreidel); DECLARE_STATE(Walk); @@ -118,13 +127,17 @@ daDreidel *daDreidel::build() { // if (actor->damage > 2) { actor->doStateChange(&daDreidel::StateID_Outro); } // } // } + void daDreidel::addScoreWhenHit(void *other) { }; void daDreidel::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { if (apOther->owner->name == 390) { //time to get hurt + if (this->isInvulnerable) { + return; + } this->damage += 1; doStateChange(&StateID_Damage); - if (this->damage > 2) { doStateChange(&StateID_Outro); } + if (this->damage > 3) { doStateChange(&StateID_Outro); } } else { dEn_c::spriteCollision(apThis, apOther); } } @@ -136,27 +149,57 @@ daDreidel *daDreidel::build() { if(hitType == 1) { // regular jump this->_vf220(apOther->owner); + this->counter_504[apOther->owner->which_player] = 0; } else if(hitType == 3) { // spinning jump or whatever? this->_vf220(apOther->owner); + this->counter_504[apOther->owner->which_player] = 0; } else if(hitType == 0) { - EN_LandbarrelPlayerCollision(this, apThis, apOther); - if (this->pos.x > apOther->owner->pos.x) { - this->direction = 1; + + if (this->charging == 1) { + + char MarioPos; + + if (this->pos.x < apOther->owner->pos.x) { MarioPos = 0; } // Mario is to the right + else { MarioPos = 1; } // Mario is to the left + + + if (this->direction != MarioPos) { // Mario is stnading behind the boss + EN_LandbarrelPlayerCollision(this, apThis, apOther); + if (MarioPos == 1) { this->direction = 1; } + else { this->direction = 0; } + + doStateChange(&StateID_KnockBack); + } + + else { // Mario is standing in front of the boss + this->_vf220(apOther->owner); + EN_LandbarrelPlayerCollision(this, apThis, apOther); + } + } + + else if (this->isInvulnerable == 0) { + + if (this->pos.x > apOther->owner->pos.x) { + this->direction = 1; + } + else { + this->direction = 0; + } + + this->counter_504[apOther->owner->which_player] = 0; + EN_LandbarrelPlayerCollision(this, apThis, apOther); + doStateChange(&StateID_KnockBack); } else { - this->direction = 0; + this->counter_504[apOther->owner->which_player] = 0; + EN_LandbarrelPlayerCollision(this, apThis, apOther); } - doStateChange(&StateID_KnockBack); } - // fix multiple player collisions via megazig this->isDead = 0; this->flags_4FC |= (1<<(31-7)); - if(apOther->owner->which_player < 4) { - this->counter_504[apOther->owner->which_player] = 0; - } } void daDreidel::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -167,8 +210,17 @@ daDreidel *daDreidel::build() { void daDreidel::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } void daDreidel::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } - void daDreidel::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_KnockBack); } - void daDreidel::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ doStateChange(&StateID_KnockBack); } + void daDreidel::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { + if (this->isInvulnerable == 0) { + doStateChange(&StateID_KnockBack); + } + } + void daDreidel::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ + if (this->isInvulnerable == 0) { + doStateChange(&StateID_KnockBack); + } + } + void daDreidel::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther){ } void daDreidel::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { } @@ -399,6 +451,7 @@ void daDreidel::updateModelMatrices() { } } void daDreidel::endState_Grow() { + this->chrAnimation.setUpdateRate(1.0); CleanupKameck(this, Kameck); } @@ -413,9 +466,18 @@ void daDreidel::updateModelMatrices() { this->max_speed.y = (this->isInSpace) ? -2.0 : -4.0; this->speed.y = (this->isInSpace) ? -2.0 : -4.0; this->y_speed_inc = (this->isInSpace) ? -0.09375 : -0.1875; + + this->isTurningCountdown = 0; } void daDreidel::executeState_Walk() { + if (this->isInvulnerableCountdown > 0) { + this->isInvulnerableCountdown--; + } + else { + this->isInvulnerable = 0; + } + PlaySound(this, SE_BOSS_JR_CROWN_JR_RIDE); // 5 bool ret = calculateTileCollisions(); @@ -423,6 +485,13 @@ void daDreidel::updateModelMatrices() { doStateChange(&StateID_Turn); } + u8 dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); + if (dir != this->direction) { + this->isTurningCountdown++; + } + + if (this->isTurningCountdown > 90) { doStateChange(&StateID_Turn); } + if(this->chrAnimation.isAnimationDone()) { this->chrAnimation.setCurrentFrame(0.0); } @@ -447,20 +516,21 @@ void daDreidel::updateModelMatrices() { int done = SmoothRotation(&this->rot.y, amt, 0x800); if(done) { - this->doStateChange(&StateID_Walk); + if (this->damage > 1) { doStateChange(&StateID_ChargePrep); } + else { doStateChange(&StateID_Walk); } } } - void daDreidel::endState_Turn() { } + void daDreidel::endState_Turn() { this->rot.y = (this->direction) ? 0xD800 : 0x2800; } /////////////// // Knockback State /////////////// void daDreidel::beginState_KnockBack() { - bindAnimChr_and_setUpdateRate("begoman_damage", 1, 0.0, 0.75); + bindAnimChr_and_setUpdateRate("begoman_damage", 1, 0.0, 0.65); - this->max_speed.x = (this->direction) ? this->XSpeed*5.0 : -this->XSpeed*5.0; - this->speed.x = (this->direction) ? 4.0f : -4.0f; + this->max_speed.x = (this->direction) ? 5.5f : -5.5f; + this->speed.x = (this->direction) ? 5.5f : -5.5f; } void daDreidel::executeState_KnockBack() { @@ -469,7 +539,8 @@ void daDreidel::updateModelMatrices() { bodyModel._vf1C(); if(this->chrAnimation.isAnimationDone()) { - doStateChange(&StateID_Damage); + if (this->damage > 1) { doStateChange(&StateID_ChargePrep); } + else { doStateChange(&StateID_Walk); } } } @@ -509,30 +580,62 @@ void daDreidel::updateModelMatrices() { void daDreidel::beginState_Charge() { bindAnimChr_and_setUpdateRate("begoman_attack3", 1, 0.0, 1.0); this->timer = 0; + this->isTurningCountdown = 0; + + this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; + this->speed.x = (direction) ? -2.2f : 2.2f; + + this->max_speed.y = (this->isInSpace) ? -2.0 : -4.0; + this->speed.y = (this->isInSpace) ? -2.0 : -4.0; + this->y_speed_inc = (this->isInSpace) ? -0.09375 : -0.1875; + + this->charging = 1; } void daDreidel::executeState_Charge() { + + if (this->isInvulnerableCountdown > 0) { + this->isInvulnerableCountdown--; + } + else { + this->isInvulnerable = 0; + } + if(this->chrAnimation.isAnimationDone()) { this->chrAnimation.setCurrentFrame(0.0); } - this->timer += 1; - if (this->timer == 120) { - doStateChange(&StateID_ChargePrep); + bool ret = calculateTileCollisions(); + if (ret) { + doStateChange(&StateID_ChargeRecover); + } + + u8 dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); + if (dir != this->direction) { + this->isTurningCountdown++; + this->speed.x = this->speed.x / 1.04; } + if (this->isTurningCountdown > 90) { doStateChange(&StateID_Turn); } + } + void daDreidel::endState_Charge() { + this->charging = 0; + + this->counter_504[0] = 0; + this->counter_504[1] = 0; + this->counter_504[2] = 0; + this->counter_504[3] = 0; } - void daDreidel::endState_Charge() { } /////////////// // ChargeRecover State /////////////// void daDreidel::beginState_ChargeRecover() { - bindAnimChr_and_setUpdateRate("begoman_stand", 1, 0.0, 1.0); + bindAnimChr_and_setUpdateRate("begoman_stand", 1, 0.0, 0.5); } void daDreidel::executeState_ChargeRecover() { if(this->chrAnimation.isAnimationDone()) { - doStateChange(&StateID_ChargePrep); + doStateChange(&StateID_Turn); } } void daDreidel::endState_ChargeRecover() { } @@ -542,19 +645,46 @@ void daDreidel::updateModelMatrices() { // Damage State /////////////// void daDreidel::beginState_Damage() { + this->isInvulnerable = 1; bindAnimChr_and_setUpdateRate("begoman_wait", 1, 0.0, 1.0); this->timer = 0; + + PlaySound(this, SE_PLY_TOUCH_BIRI); + PlaySound(this, SE_BOSS_JR_ELEC_SPARK); + PlaySound(this, SE_EMY_BIRIKYU_SPARK); + + Vec front = {this->pos.x-4.0, this->pos.y+8.0, 5500.0}; + Vec back = {this->pos.x-4.0, this->pos.y+8.0, -5500.0}; + + SpawnEffect("Wm_ob_cmnspark", 0, &front, 0, &(Vec){2.5, 2.5, 1.5}); + SpawnEffect("Wm_mr_wirehit_line", 0, &front, 0, &(Vec){1.5, 1.5, 1.5}); + SpawnEffect("Wm_mr_kick_grain", 0, &front, 0, &(Vec){1.5, 1.5, 1.5}); + SpawnEffect("Wm_mr_wirehit_glow", 0, &back, 0, &(Vec){2.5, 2.5, 2.5}); } void daDreidel::executeState_Damage() { + if(this->chrAnimation.isAnimationDone()) { this->timer += 1; if (this->timer == 3) { - doStateChange(&StateID_ChargePrep); + + u8 dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); + if (dir != this->direction) { + doStateChange(&StateID_Turn); + } + else { + if (this->damage > 1) { doStateChange(&StateID_ChargePrep); } + else { doStateChange(&StateID_Walk); } + } + } + else { } this->chrAnimation.setCurrentFrame(0.0); } } - void daDreidel::endState_Damage() { } + void daDreidel::endState_Damage() { + bindAnimChr_and_setUpdateRate("begoman_wait2", 1, 0.0, 1.0); + this->isInvulnerableCountdown = 90; + } /////////////// |