summaryrefslogtreecommitdiff
path: root/src/bossPodouble.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-03-09 01:40:14 -0600
committerColin Noga <Tempus@chronometry.ca>2012-03-09 01:40:14 -0600
commit59624313e01ef4269f2ca27babe522d407e200b0 (patch)
tree3ef69879f19f4eded72a310a94736e151a108cc7 /src/bossPodouble.cpp
parent05d99e2cf552024116356591be0a88bf862b89c9 (diff)
downloadkamek-59624313e01ef4269f2ca27babe522d407e200b0.tar.gz
kamek-59624313e01ef4269f2ca27babe522d407e200b0.zip
Redid all the boss and custom sprite junk, effect list, saved 25 kb - but bosses break
Diffstat (limited to 'src/bossPodouble.cpp')
-rw-r--r--src/bossPodouble.cpp204
1 files changed, 28 insertions, 176 deletions
diff --git a/src/bossPodouble.cpp b/src/bossPodouble.cpp
index 77dae1a..e79f20a 100644
--- a/src/bossPodouble.cpp
+++ b/src/bossPodouble.cpp
@@ -3,8 +3,7 @@
#include <g3dhax.h>
#include <sfx.h>
#include <stage.h>
-#include "effects.h"
-#include "player.h"
+#include "boss.h"
void poodleCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -14,7 +13,7 @@ void poodleCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther) {
else { dEn_c::collisionCallback(apThis, apOther); }
}
-class daPodouble : public dEn_c {
+class daPodouble : public daBoss {
int onCreate();
int onDelete();
int onExecute();
@@ -45,7 +44,7 @@ class daPodouble : public dEn_c {
char isInvulnerable;
int countdown;
- dEn_c *Kameck;
+ daKameckDemo *Kameck;
static daPodouble *build();
@@ -84,21 +83,10 @@ daPodouble *daPodouble::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(dStageActor_c *, int soundID);
- extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID);
-
- extern "C" u32 GenerateRandomNumber(int max);
- extern "C" dStageActor_c *GetSpecificPlayerActor(int num);
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
extern "C" void* WaterManager;
extern "C" u32 CheckforLiquid(void*, Vec, int, int, int, int layer);
- extern "C" void *StopBGMMusic();
- extern "C" void *StartBGMMusic();
-
- extern "C" void *MakeMarioEnterDemoMode();
- extern "C" void *MakeMarioExitDemoMode();
- extern "C" void *UpdateGameMgr();
CREATE_STATE(daPodouble, Bounce);
@@ -114,17 +102,7 @@ daPodouble *daPodouble::build() {
// Collision Functions
////////////////////////
- void daPodouble::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
- this->dEn_c::playerCollision(apThis, apOther);
- this->_vf220(apOther->owner);
-
- // fix multiple player collisions via megazig
- this->isDead = 0;
- this->flags_4FC |= (1<<(31-7));
- if(apOther->owner->which_player < 3) {
- this->counter_504[apOther->owner->which_player] = 0;
- }
- }
+ void daPodouble::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
void daPodouble::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
void daPodouble::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); }
@@ -359,79 +337,27 @@ int daPodouble::onDraw() {
this->timer = 0;
if (isFire) { return; }
- // Stop the BGM Music
- StopBGMMusic();
-
- // Set the necessary Flags and make Mario enter Demo Mode
- dStage32C_c::instance->freezeMarioBossFlag = 1;
- WLClass::instance->_4 = 4;
- WLClass::instance->_8 = 0;
-
- MakeMarioEnterDemoMode();
-
- // Make sure to use the correct position
- Vec pos = (Vec){this->pos.x - 124.0, this->pos.y + 104.0, 3564.0};
- S16Vec rot = (S16Vec){0, 0, 0};
-
- // Create And use Kameck
- Kameck = (daKameckDemo*)createChild(KAMECK_FOR_CASTLE_DEMO, (dStageActor_c*)this, 0, &pos, &rot, 0);
- Kameck->doStateChange(&daKameckDemo::StateID_DemoWait);
-
+ SetupKameck(this, Kameck);
this->scale = (Vec){1.0, 1.0, 1.0};
}
void daPodouble::executeState_Grow() {
- this->timer = this->timer + 1;
-
- float scaleSpeed, yPosScaling;
-
-
- if ((this->timer > 150) && (this->timer < 230)) {
-
- scaleSpeed = 0.03125;
- yPosScaling = 18;
+ this->timer += 1;
- float modifier;
+ bool ret;
+ ret = GrowBoss(this, Kameck, 1.0, 3.5, 18, this->timer);
- modifier = 1.0 + ((this->timer - 150) * scaleSpeed);
-
- this->scale = (Vec){modifier, modifier, modifier};
- this->pos.y = this->pos.y + (yPosScaling/80);
-
- }
- if (this->timer > 420) {
+ if (ret) {
PlaySound(this, SE_EMY_CS_MOVE_W8_BUBBLE_APP);
doStateChange(&StateID_Bounce);
}
-
- if (isFire) { return; }
- if (this->timer == 130) { Kameck->doStateChange(&daKameckDemo::StateID_DemoSt); }
- if (this->timer == 150) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); }
- if (this->timer == 400) { Kameck->doStateChange(&daKameckDemo::StateID_DemoSt2); }
- if (this->timer == 360) {
- Vec tempPos = (Vec){this->pos.x - 40.0, this->pos.y + 120.0, 3564.0};
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 175); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 400); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 401); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 564); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 583); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 754); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 958); // 400 & 401 // 564 // 583 // 754 // 958
- }
}
void daPodouble::endState_Grow() {
this->Baseline = this->pos.y;
if (isFire) { return; }
- // Clean up the flags and Kameck
- dStage32C_c::instance->freezeMarioBossFlag = 0;
- WLClass::instance->_8 = 1;
-
- MakeMarioExitDemoMode();
- StartBGMMusic();
-
- Kameck->Delete(1);
+ CleanupKameck(this, Kameck);
}
@@ -474,11 +400,11 @@ int daPodouble::onDraw() {
OSReport("Liquid type %d", liquid);
if (liquid == 1) {
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 415);
+ SpawnEffect("Wm_mr_magmawave", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0});
PlaySoundAsync(this, SE_EMY_BUBBLE_SPLASH);
}
if (liquid == 0) {
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 422);
+ SpawnEffect("Wm_mr_waterwave_in", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0});
PlaySoundAsync(this, SE_OBJ_CMN_SPLASH);
}
@@ -534,10 +460,10 @@ int daPodouble::onDraw() {
if (this->isFire == 0) {
PlaySoundAsync(this, SE_OBJ_PNGN_ICE_THAW);
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 243); }
+ SpawnEffect("Wm_ob_iceevaporate", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); }
else {
PlaySoundAsync(this, SE_EMY_FIRE_SNAKE_EXTINCT);
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 252); }
+ SpawnEffect("Wm_en_firesnk_icehitsmk_b", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}); }
}
void daPodouble::executeState_Damage() {
@@ -580,82 +506,28 @@ int daPodouble::onDraw() {
daPodouble *other = (daPodouble*)FindActorByType(SHIP_WINDOW, (Actor*)this);
if (other != 0) { other->doStateChange(&StateID_SyncDie); }
- WLClass::instance->_4 = 5;
- WLClass::instance->_8 = 0;
-
- this->removeMyActivePhysics();
+ OutroSetup(this);
this->timer = 0;
- StopBGMMusic();
-
- dStage32C_c::instance->freezeMarioBossFlag = 1;
}
void daPodouble::executeState_Outro() {
if (this->dying == 1) {
- if (this->timer > 180) {
- ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE);
- }
-
- if (this->timer == 60) {
-
- UpdateGameMgr();
-
- if (GetSpecificPlayerActor(0) != 0) {
- PlaySound(this, SE_VOC_MA_CLEAR_BOSS);
- // Send PlBase into DemoGoal State here, kthxbai
- }
-
- if (GetSpecificPlayerActor(1) != 0) {
- PlaySound(this, SE_VOC_LU_CLEAR_BOSS);
- // Send PlBase into DemoGoal State here, kthxbai
- }
-
- if (GetSpecificPlayerActor(2) != 0) {
- PlaySound(this, SE_VOC_KO_CLEAR_BOSS);
- // Send PlBase into DemoGoal State here, kthxbai
- }
-
- if (GetSpecificPlayerActor(3) != 0) {
- PlaySound(this, SE_VOC_KO2_CLEAR_BOSS);
- // Send PlBase into DemoGoal State here, kthxbai
- }
- }
+ if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); }
+ if (this->timer == 60) { PlayerVictoryCries(this); }
this->timer += 1;
return;
}
- if (this->scale.x > 0.1) {
-
- PlaySound(this, SE_EMY_BUBBLE_EXTINCT);
-
- // Adjust this to equal the scale of your boss / 80.
- this->scale.x -= 0.04375;
- this->scale.y -= 0.04375;
- this->scale.z -= 0.04375;
+ bool ret;
+ ret = ShrinkBoss(this, &this->pos, 3.5, this->timer);
- if (this->timer == 30) {
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756);
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801);
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 957);
- this->timer = 0;
- }
-
- this->timer += 1;
- }
- else {
- this->scale.x = 0.0;
- this->scale.y = 0.0;
- this->scale.z = 0.0;
-
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588);
- this->dying = 1;
- this->timer = 0;
+ if (ret) { BossExplode(this, &this->pos); }
+ else { PlaySound(this, SE_EMY_BUBBLE_EXTINCT); }
+
+ this->timer += 1;
- PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR);
- MakeMarioEnterDemoMode();
- }
}
void daPodouble::endState_Outro() { }
@@ -673,32 +545,12 @@ int daPodouble::onDraw() {
if (this->dying == 1) { return; }
- if (this->scale.x > 0.1) {
+ bool ret;
+ ret = ShrinkBoss(this, &this->pos, 3.5, this->timer);
- PlaySound(this, SE_EMY_BUBBLE_EXTINCT);
-
- // Adjust this to equal the scale of your boss / 80.
- this->scale.x -= 0.04375;
- this->scale.y -= 0.04375;
- this->scale.z -= 0.04375;
-
- if (this->timer == 30) {
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756);
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801);
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 957);
- this->timer = 0;
- }
+ if (ret) { BossExplode(this, &this->pos); }
+ else { PlaySound(this, SE_EMY_BUBBLE_EXTINCT); }
+ this->timer += 1;
- this->timer += 1;
- }
- else {
- this->scale.x = 0.0;
- this->scale.y = 0.0;
- this->scale.z = 0.0;
-
- CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588);
- this->dying = 1;
- this->timer = 0;
- }
}
void daPodouble::endState_SyncDie() { }