summaryrefslogtreecommitdiff
path: root/src/bossPodouble.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bossPodouble.cpp57
1 files changed, 34 insertions, 23 deletions
diff --git a/src/bossPodouble.cpp b/src/bossPodouble.cpp
index dd47463..260ca9d 100644
--- a/src/bossPodouble.cpp
+++ b/src/bossPodouble.cpp
@@ -19,6 +19,8 @@ class daPodouble : public daBoss {
int onExecute();
int onDraw();
+ void updateHitboxSize();
+
mHeapAllocator_c allocator;
nw4r::g3d::ResFile resFile;
@@ -26,6 +28,7 @@ class daPodouble : public daBoss {
m3d::mdl_c fogModel;
m3d::mdl_c fog2Model;
+ m3d::anmChr_c fleeAnimation;
m3d::anmTexSrt_c body;
m3d::anmChr_c fogChr;
@@ -118,12 +121,6 @@ daPodouble *daPodouble::build() {
bool daPodouble::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
apOther->owner->kill();
- if (this->isInvulnerable) { return true; }
-
- this->damage += 2;
-
- if (this->damage < 12) { doStateChange(&StateID_Damage); }
- else { doStateChange(&StateID_Outro); }
return true;
}
@@ -132,7 +129,7 @@ daPodouble *daPodouble::build() {
if (this->isInvulnerable) { return true; }
if (this->isFire == 0) {
- this->damage += 3;
+ this->damage += 4;
if (this->damage < 12) { doStateChange(&StateID_Damage); }
else { doStateChange(&StateID_Outro); }
@@ -158,7 +155,7 @@ daPodouble *daPodouble::build() {
if (this->isFire == 1) {
if (apOther->owner->name == 104) { this->damage += 2; }
- else { this->damage += 3; }
+ else { this->damage += 4; }
if (this->damage < 12) { doStateChange(&StateID_Damage); }
else { doStateChange(&StateID_Outro); }
@@ -169,6 +166,12 @@ daPodouble *daPodouble::build() {
}
+void daPodouble::updateHitboxSize() {
+ aPhysics.info.xDistToEdge = 11.429f * scale.x;
+ aPhysics.info.yDistToEdge = 11.429f * scale.y;
+}
+
+
int daPodouble::onCreate() {
this->isFire = this->settings >> 28;
@@ -187,7 +190,9 @@ int daPodouble::onCreate() {
// Body and anms
nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("bubble");
+ nw4r::g3d::ResAnmChr shit = resFile.GetResAnmChr(isFire ? "RedFlee" : "BlueFlee");
bodyModel.setup(mdl, &allocator, 0x224, 1, 0);
+ fleeAnimation.setup(mdl, shit, &allocator, 0);
nw4r::g3d::ResAnmTexSrt anmRes = this->resFile.GetResAnmTexSrt("bubble");
this->body.setup(mdl, anmRes, &this->allocator, 0, 1);
@@ -325,7 +330,10 @@ int daPodouble::onDraw() {
bodyModel.calcWorld(false);
bodyModel.scheduleForDrawing();
+ bodyModel._vf1C();
this->body.process();
+ if (acState.getCurrentState() == &StateID_SyncDie)
+ fleeAnimation.process();
return true;
}
@@ -538,6 +546,14 @@ int daPodouble::onDraw() {
this->rot.y = amt;
this->rot.y += (direction) ? 0xD800 : 0x2800;
+ float targetScale = 3.5f - (damage * 0.175f);
+ if (scale.x > targetScale) {
+ float newScale = scale.x - 0.006f;
+ if (newScale < targetScale)
+ newScale = targetScale;
+ scale.x = scale.y = scale.z = newScale;
+ updateHitboxSize();
+ }
if (this->timer > 180) {
doStateChange(&StateID_Bounce);
@@ -571,8 +587,8 @@ int daPodouble::onDraw() {
daPodouble *other = (daPodouble*)FindActorByType(SHIP_WINDOW, 0);
if (other->id == this->id) {
other = (daPodouble*)FindActorByType(SHIP_WINDOW, (Actor*)this);
- other->doStateChange(&StateID_SyncDie);
}
+ other->doStateChange(&StateID_SyncDie);
OutroSetup(this);
this->timer = 0;
@@ -612,21 +628,16 @@ int daPodouble::onDraw() {
this->removeMyActivePhysics();
this->timer = 0;
- }
- void daPodouble::executeState_SyncDie() {
- if (this->dying == 1) { return; }
-
- bool ret;
- ret = ShrinkBoss(this, &this->pos, 3.5, this->timer);
-
- if (ret == true) {
- BossExplode(this, &this->pos);
- this->dying = 1;
- this->timer = 0;
- }
- else { PlaySound(this, SE_EMY_BUBBLE_EXTINCT); }
- this->timer += 1;
+ nw4r::g3d::ResAnmChr anmChr = resFile.GetResAnmChr(isFire ? "RedFlee" : "BlueFlee");
+ fleeAnimation.bind(&bodyModel, anmChr, 1);
+ bodyModel.bindAnim(&fleeAnimation, 0.0);
+ fleeAnimation.setUpdateRate(0.5f);
+ PlaySound(this, SE_EMY_GABON_ROCK_THROW);
+ }
+ void daPodouble::executeState_SyncDie() {
+ if (fleeAnimation.isAnimationDone())
+ Delete(0);
}
void daPodouble::endState_SyncDie() { }