From 2c48652f74512e371b19ce2a8fbc4038742bced0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 7 Feb 2013 03:48:19 +0100 Subject: a bunch of sprite fixes mixed into one commit, in traditional Newer fashion --- src/bossBalboaWrench.cpp | 34 +++++++++++++++-------------- src/bossMegaGoomba.cpp | 7 ++---- src/bossPodouble.cpp | 57 +++++++++++++++++++++++++++++------------------- src/bossRamboo.cpp | 5 ++--- src/bossSamurshai.cpp | 13 +++++------ src/bossTopman.cpp | 12 +++++----- src/shyguyGiants.cpp | 37 +++++++++++-------------------- 7 files changed, 80 insertions(+), 85 deletions(-) (limited to 'src') diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp index 1cea253..fe53a17 100644 --- a/src/bossBalboaWrench.cpp +++ b/src/bossBalboaWrench.cpp @@ -36,6 +36,7 @@ class daBalboa_c : public daBoss { void updateModelMatrices(); void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); + bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); @@ -43,6 +44,7 @@ class daBalboa_c : public daBoss { bool collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + bool collisionCatD_Drill(ActivePhysics *apThis, ActivePhysics *apOther); void addScoreWhenHit(void *other); @@ -88,28 +90,24 @@ daBalboa_c *daBalboa_c::build() { void daBalboa_c::addScoreWhenHit(void *other) {} - void daBalboa_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - - char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); - - if(ret == 1) { // regular jump - - apOther->someFlagByte |= 0; - - } else if(ret == 3) { // spinning +bool daBalboa_c::prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + if (apOther->owner->stageActorType == 1) { + if (apOther->info.category2 == 7) { + if (collisionCat7_GroundPound(apThis, apOther)) + return true; + } + } - apOther->someFlagByte |= 0; + return dEn_c::prePlayerCollision(apThis, apOther); +} - } else if(ret == 0) { + void daBalboa_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - this->dEn_c::playerCollision(apThis, apOther); - this->_vf220(apOther->owner); + char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); - } else if(ret == 2) { // mini Mario + if(ret == 0) { this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); - - } else { } //FIXME hack to make multiple playerCollisions work @@ -146,6 +144,9 @@ daBalboa_c *daBalboa_c::build() { return true; } + bool daBalboa_c::collisionCatD_Drill(ActivePhysics *apThis, ActivePhysics *apOther) { + return collisionCat7_GroundPound(apThis, apOther); + } bool daBalboa_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { return true; @@ -160,6 +161,7 @@ daBalboa_c *daBalboa_c::build() { return true; } bool daBalboa_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { + dAcPy_vf3F8(apOther->owner, this, 3); return true; } diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 9ea7197..51ee044 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -270,17 +270,13 @@ int daMegaGoomba_c::tryHandleJumpedOn(ActivePhysics *apThis, ActivePhysics *apOt EnemyBounceValue = saveBounce; - if(ret == 1) { // regular jump + if(ret == 1 || ret == 3) { apOther->someFlagByte |= 2; if(this->takeHit(1)) { // kill me VEC2 eSpeed = {speed.x, speed.y}; killWithSpecifiedState(apOther->owner, &eSpeed, &dEn_c::StateID_DieOther); } - } else if(ret == 3) { // spinning - apOther->someFlagByte |= 2; - if(this->takeHit(1)) - doStateChange(&StateID_DieFall); } return ret; @@ -451,6 +447,7 @@ int daMegaGoomba_c::onCreate() { } int daMegaGoomba_c::onDelete() { + unstunPlayers(); return true; } 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() { } diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index f2af942..a2b34f0 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -78,7 +78,6 @@ void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) } 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}); - this->pos.x += 6.0; return true; } bool daRamboo_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -98,7 +97,7 @@ bool daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic return false; } bool daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { - return true; + return collisionCat1_Fireball_E_Explosion(apThis, apOther); } bool daRamboo_c::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); @@ -186,7 +185,7 @@ int daRamboo_c::onCreate() { HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; - HitMeBaby.bitfield2 = 0x222; + HitMeBaby.bitfield2 = 0x80222; HitMeBaby.unkShort1C = 0; HitMeBaby.callback = &dEn_c::collisionCallback; diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp index e385a41..1f0906a 100644 --- a/src/bossSamurshai.cpp +++ b/src/bossSamurshai.cpp @@ -113,7 +113,10 @@ daSamurshai *daSamurshai::build() { char hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); - if ((hitType == 1) || (hitType == 3)) { + if (hitType == 2) { + // Mini jump + apOther->someFlagByte |= 2; + } else if (hitType > 0) { apOther->someFlagByte |= 2; if (this->isDown == 0) { this->playEnemyDownSound1(); @@ -140,7 +143,7 @@ daSamurshai *daSamurshai::build() { apOther->someFlagByte |= 2; if (this->isDown == 0) { - damage += 10; + damage += 5; if (damage >= 15) { doStateChange(&StateID_Outro); } else { doStateChange(&StateID_Damage); } } @@ -166,11 +169,7 @@ daSamurshai *daSamurshai::build() { return true; } bool daSamurshai::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ - if (this->isDown == 0) { - damage += 3; - if (damage >= 15) { doStateChange(&StateID_Outro); } - else { doStateChange(&StateID_Damage); } - } + dAcPy_vf3F8(apOther->owner, this, 3); deathInfo.isDead = 0; this->flags_4FC |= (1<<(31-7)); diff --git a/src/bossTopman.cpp b/src/bossTopman.cpp index ddc37b6..77593a3 100644 --- a/src/bossTopman.cpp +++ b/src/bossTopman.cpp @@ -130,10 +130,13 @@ daDreidel *daDreidel::build() { void daDreidel::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { if (apOther->owner->name == 390) { //time to get hurt + OSReport("YO SUP I'M A TOPMAN AND I'M COLLIDING WITH A FUCKING WALL [%d]\n", damage); if (this->isInvulnerable) { + OSReport("I'm invulnerable so I'm ignoring it\n"); return; } this->damage += 1; + OSReport("I'm increasing my damage to %d\n", damage); doStateChange(&StateID_Damage); if (this->damage == 3) { doStateChange(&StateID_Outro); } @@ -147,15 +150,10 @@ daDreidel *daDreidel::build() { char hitType; hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); - if(hitType == 1) { // regular jump + if(hitType > 0) { 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) { + } else { if (this->charging == 1) { diff --git a/src/shyguyGiants.cpp b/src/shyguyGiants.cpp index b9415aa..dc474f6 100644 --- a/src/shyguyGiants.cpp +++ b/src/shyguyGiants.cpp @@ -139,37 +139,26 @@ daShyGuyGiant *daShyGuyGiant::build() { dStageActor_c *player = apOther->owner; - if (Player_VF3D4(player)) { - // WE'VE GOT A STAR, FOLKS - if (apThis->_18 == 1 && !player->collMgr.isOnTopOfTile() && player->pos.y > apThis->bottom()) { - bouncePlayer(player, 3.0f); - PlaySound(this, SE_EMY_CMN_STEP); - } else { - dAcPy_vf3F8(player, this, 3); - } - this->counter_504[apOther->owner->which_player] = 0xA; - - return; - } - char hitType; hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); - if (hitType == 1) { // regular jump + if (hitType > 0) { PlaySound(this, SE_EMY_CMN_STEP); this->counter_504[apOther->owner->which_player] = 0xA; - } - else if(hitType == 3){ - PlaySound(this, SE_EMY_CMN_STEP); - this->counter_504[apOther->owner->which_player] = 0xA; - } - else if(hitType == 0) { + } else { this->dEn_c::playerCollision(apThis, apOther); this->_vf220(apOther->owner); + if (Player_VF3D4(player)) { + // WE'VE GOT A STAR, FOLKS + if (apThis->_18 == 1 && !player->collMgr.isOnTopOfTile() && player->pos.y > apThis->bottom()) { + bouncePlayer(player, 3.0f); + PlaySound(this, SE_EMY_CMN_STEP); + } else { + dAcPy_vf3F8(player, this, 3); + } + this->counter_504[apOther->owner->which_player] = 0xA; + + } } - else { - OSReport("Some other hit type"); - } - return; } void daShyGuyGiant::bouncePlayerWhenJumpedOn(void *player) { -- cgit v1.2.3