diff options
author | Treeki <treeki@gmail.com> | 2013-02-12 02:17:35 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2013-02-12 02:17:35 +0100 |
commit | 25c7c042247619006dd6b6c6c12cf08502e0829b (patch) | |
tree | 51f62082025d71706ec29c676869362e2067e680 /src | |
parent | 7473d7d5fb491404b9c8b38c4c2bde844f0a8687 (diff) | |
download | kamek-25c7c042247619006dd6b6c6c12cf08502e0829b.tar.gz kamek-25c7c042247619006dd6b6c6c12cf08502e0829b.zip |
clean up Ramboo's code a bit, and add animations and stuff
Diffstat (limited to '')
-rw-r--r-- | src/bossRamboo.cpp | 84 |
1 files changed, 35 insertions, 49 deletions
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index a096e14..ea62a9e 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -19,10 +19,8 @@ class daRamboo_c : public daBoss { nw4r::g3d::ResFile resFile; m3d::anmChr_c anmFog; - m3d::anmChr_c anmWaitA; - m3d::anmChr_c anmShayA; - m3d::anmChr_c anmWaitB; - m3d::anmChr_c anmShayB; + m3d::anmChr_c anmA; + m3d::anmChr_c anmB; nw4r::g3d::ResAnmTexSrt resTexSrt; m3d::anmTexSrt_c fogSrt; @@ -32,12 +30,13 @@ class daRamboo_c : public daBoss { char Hiding; char dying; float Baseline; + bool fleeFast; u64 eventFlag; static daRamboo_c *build(); - void bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate); + void bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c &animationChr, m3d::mdl_c &model, float rate); void setupModels(); void updateModelMatrices(); @@ -75,6 +74,9 @@ extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, A void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { EN_LandbarrelPlayerCollision(this, apThis, apOther); DamagePlayer(this, apThis, apOther); + + fleeFast = false; + doStateChange(&StateID_Flee); } bool daRamboo_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_en_obakedoor_sm", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}); @@ -89,6 +91,7 @@ bool daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic SpawnEffect("Wm_en_obakedoor_sm", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); SpawnEffect("Wm_mr_yoshistep", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + fleeFast = true; doStateChange(&StateID_Flee); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) apOther->owner->Delete(1); @@ -111,8 +114,8 @@ bool daRamboo_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics -void daRamboo_c::bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate) { - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name); +void daRamboo_c::bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c &animationChr, m3d::mdl_c &model, float rate) { + nw4r::g3d::ResAnmChr anmChr = resFile.GetResAnmChr(name); animationChr.bind(&model, anmChr, 1); model.bindAnim(&animationChr, 0.0); animationChr.setUpdateRate(rate); @@ -138,10 +141,7 @@ void daRamboo_c::setupModels() { SetupTextures_Enemy(&this->bodyModel, 0); nw4r::g3d::ResAnmChr anmChrC = this->resFile.GetResAnmChr("shay_teresaA"); - ret = this->anmShayA.setup(mdlB, anmChrC, &this->allocator, 0); - - nw4r::g3d::ResAnmChr anmChrD = this->resFile.GetResAnmChr("wait"); - ret = this->anmWaitA.setup(mdlB, anmChrD, &this->allocator, 0); + ret = this->anmA.setup(mdlB, anmChrC, &this->allocator, 0); nw4r::g3d::ResMdl mdlC = this->resFile.GetResMdl("teresaB"); @@ -149,10 +149,7 @@ void daRamboo_c::setupModels() { SetupTextures_Enemy(&this->hideModel, 0); nw4r::g3d::ResAnmChr anmChrE = this->resFile.GetResAnmChr("shay_teresaB"); - ret = this->anmShayB.setup(mdlC, anmChrE, &this->allocator, 0); - - nw4r::g3d::ResAnmChr anmChrF = this->resFile.GetResAnmChr("shay_teresaB_wait"); - ret = this->anmWaitB.setup(mdlC, anmChrF, &this->allocator, 0); + ret = this->anmB.setup(mdlC, anmChrE, &this->allocator, 0); nw4r::g3d::ResAnmTexSrt anmSrt = this->resFile.GetResAnmTexSrt("fog"); this->resTexSrt = anmSrt; @@ -198,7 +195,7 @@ int daRamboo_c::onCreate() { this->rot.y = 0xE000; // Y is horizontal axis this->rot.z = 0; // Z is ... an axis >.> this->direction = 0; // Heading left. - this->Hiding = 0; + this->Hiding = 1; this->dying = 0; this->speed.x = 0.0; @@ -300,10 +297,17 @@ void daRamboo_c::executeState_Grow() { bool ret; ret = GrowBoss(this, Kameck, 1.0, 15.0, 0, this->timer); - if (ret) { + if (timer == 421) { + bindAnimChr_and_setUpdateRates("begin_boss_b", anmB, hideModel, 1.0f); + } + + if (ret) + hideModel._vf1C(); + if (ret && anmB.isAnimationDone()) { PlaySound(this, SE_EMY_CS_TERESA_BRING_IT); + Hiding = 0; doStateChange(&StateID_Advance); - } + } } void daRamboo_c::endState_Grow() { this->Baseline = this->pos.y; @@ -339,18 +343,15 @@ void daRamboo_c::beginState_Advance() { this->speed.z = 0; this->timer = 0; - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait"); - this->anmWaitA.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmWaitA, 0.0); - this->anmWaitA.setUpdateRate(1.0); + bindAnimChr_and_setUpdateRates("wait", anmA, bodyModel, 1.0f); } void daRamboo_c::executeState_Advance() { this->bodyModel._vf1C(); - if (this->anmWaitA.isAnimationDone()) { - this->anmWaitA.setCurrentFrame(0.0); } + if (this->anmA.isAnimationDone()) { + this->anmA.setCurrentFrame(0.0); } float px = RightmostPlayerPos(); @@ -397,23 +398,17 @@ void daRamboo_c::executeState_Wait() { if (this->timer == 70) { this->Hiding = 0; - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaA"); - this->anmShayA.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmShayA, 0.0); - this->anmShayA.setUpdateRate(1.0); + bindAnimChr_and_setUpdateRates("shay_teresaA", anmA, bodyModel, 1.0f); } if (this->timer == 55) { - nw4r::g3d::ResAnmChr anmChrB = this->resFile.GetResAnmChr("shay_teresaB"); - this->anmShayB.bind(&this->hideModel, anmChrB, 1); - this->hideModel.bindAnim(&this->anmShayB, 0.0); - this->anmShayB.setUpdateRate(1.0); + bindAnimChr_and_setUpdateRates("shay_teresaB", anmB, hideModel, 1.0f); } - if (this->anmShayB.isAnimationDone()) { + if (this->anmB.isAnimationDone()) { PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU); doStateChange(&StateID_Advance); } @@ -426,10 +421,7 @@ void daRamboo_c::endState_Wait() { this->Hiding = 0; - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaA"); - this->anmShayA.bind(&this->bodyModel, anmChr, 1); - this->bodyModel.bindAnim(&this->anmShayA, 0.0); - this->anmShayA.setUpdateRate(1.0); + bindAnimChr_and_setUpdateRates("shay_teresaA", anmA, bodyModel, 1.0f); } @@ -450,16 +442,13 @@ void daRamboo_c::executeState_Flee() { if (this->timer == 10) { this->Hiding = 1; - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaB_wait"); - this->anmWaitB.bind(&this->hideModel, anmChr, 1); - this->hideModel.bindAnim(&this->anmWaitB, 0.0); - this->anmWaitB.setUpdateRate(1.0); + bindAnimChr_and_setUpdateRates("shay_teresaB_wait", anmB, hideModel, 1.0f); } - this->pos.x += (60 - this->timer) / 8; + this->pos.x += (60 - this->timer) / (fleeFast ? 8 : 25); - if ((this->timer > 60) && (this->anmWaitB.isAnimationDone())) { + if ((this->timer > 60) && (this->anmB.isAnimationDone())) { doStateChange(&StateID_Wait); } @@ -474,10 +463,7 @@ void daRamboo_c::endState_Flee() { void daRamboo_c::beginState_Outro() { - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaB_wait"); - this->anmWaitB.bind(&this->hideModel, anmChr, 1); - this->hideModel.bindAnim(&this->anmWaitB, 0.0); - this->anmWaitB.setUpdateRate(1.0); + bindAnimChr_and_setUpdateRates("shay_teresaB_wait", anmB, hideModel, 1.0f); this->timer = 0; this->rot.x = 0x0; // X is vertical axis @@ -487,8 +473,8 @@ void daRamboo_c::beginState_Outro() { OutroSetup(this); } void daRamboo_c::executeState_Outro() { - if (this->anmWaitB.isAnimationDone()) - this->anmWaitB.setCurrentFrame(0.0); + if (this->anmB.isAnimationDone()) + this->anmB.setCurrentFrame(0.0); if (this->dying == 1) { if (this->timer > 180) { |