diff options
Diffstat (limited to '')
-rw-r--r-- | src/bossBombDrop.cpp | 250 | ||||
-rw-r--r-- | src/bossBridgeBowser.cpp | 53 |
2 files changed, 303 insertions, 0 deletions
diff --git a/src/bossBombDrop.cpp b/src/bossBombDrop.cpp new file mode 100644 index 0000000..0852501 --- /dev/null +++ b/src/bossBombDrop.cpp @@ -0,0 +1,250 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> +#include "boss.h" + + +const char* BDarcNameList [] = { + "koopa_clown_bomb", + NULL +}; + + +class dDroppedBomb : public dEn_c { + int onCreate(); + int onExecute(); + int onDelete(); + int onDraw(); + + void kill(); + + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + + u32 cmgr_returnValue; + + static dDroppedBomb *build(); + + void updateModelMatrices(); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + // void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); + bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); +}; + +void dDroppedBomb::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + DamagePlayer(this, apThis, apOther); + this->kill(); +} + +dDroppedBomb *dDroppedBomb::build() { + void *buffer = AllocFromGameHeap1(sizeof(dDroppedBomb)); + return new(buffer) dDroppedBomb; +} + +// void dDroppedBomb::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->kill(); } +void dDroppedBomb::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { } +bool dDroppedBomb::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } +void dDroppedBomb::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {} +void dDroppedBomb::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {} +void dDroppedBomb::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) {} +void dDroppedBomb::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) {} + +void dDroppedBomb::kill() { + PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); + + SpawnEffect("Wm_en_explosion", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.25, 1.25, 1.25}); + this->Delete(1); +} + +int dDroppedBomb::onCreate() { + + allocator.link(-1, GameHeaps[0], 0, 0x20); + + nw4r::g3d::ResFile rf(getResource("koopa_clown_bomb", "g3d/koopa_clown_bomb.brres")); + bodyModel.setup(rf.GetResMdl("koopa_clown_bomb"), &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&bodyModel, 0); + + allocator.unlink(); + + + ActivePhysics::Info KoopaJunk; + + KoopaJunk.xDistToCenter = -20.0f; + KoopaJunk.yDistToCenter = 0.0; + KoopaJunk.xDistToEdge = 20.0f; + KoopaJunk.yDistToEdge = 20.0f; + + this->scale.x = 1.0; + this->scale.y = 1.0; + this->scale.z = 1.0; + + KoopaJunk.category1 = 0x3; + KoopaJunk.category2 = 0x0; + KoopaJunk.bitfield1 = 0x4F; + KoopaJunk.bitfield2 = 0xFFFFFFFF; + KoopaJunk.unkShort1C = 0; + KoopaJunk.callback = &dEn_c::collisionCallback; + + this->aPhysics.initWithStruct(this, &KoopaJunk); + this->aPhysics.addToList(); + + + spriteSomeRectX = 20.f; + spriteSomeRectY = 20.f; + _320 = 0.0f; + _324 = 20.f; + + // These structs tell stupid collider what to collide with - these are from koopa troopa + static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; + static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; + static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + + collMgr.Init(this, one, two, three); + collMgr.execute(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + + + pos.z = 3300.0; + speed.y = -1.5f; + + PlaySound(this, SE_EMY_ELCJ_THROW); + return true; +} + + +int dDroppedBomb::onDelete() { + return true; +} + +int dDroppedBomb::onDraw() { + bodyModel.scheduleForDrawing(); + return true; +} + + +void dDroppedBomb::updateModelMatrices() { + matrix.translation(pos.x, pos.y, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); +} + + +int dDroppedBomb::onExecute() { + // acState.execute(); + updateModelMatrices(); + + rot.x += 0x200; + rot.y += 0x400; + rot.z += 0x600; + + float rect[] = {this->_320, this->_324, this->spriteSomeRectX, this->spriteSomeRectY}; + int ret = this->outOfZone(this->pos, (float*)&rect, this->currentZoneID); + if(ret) { + this->Delete(1); + } + + speed.y = speed.y - 0.01875; + + HandleXSpeed(); + HandleYSpeed(); + doSpriteMovement(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + collMgr.execute(); + + if (collMgr.CollidedWithTile() || (collMgr.bitfield_for_checks & (0x15 << direction))) { + this->kill(); + } + + return true; +} + + + + + +// ========================================================================================================= +// ================================================ CONTROLLER ============================================= +// ========================================================================================================= + +class dBombDrop : public dStageActor_c { + int onCreate(); + int onExecute(); + int onDelete(); + int onDraw(); + + int timer; + dStageActor_c * target; + int eventA; + int eventB; + + static dBombDrop *build(); +}; + +dBombDrop *dBombDrop::build() { + void *buffer = AllocFromGameHeap1(sizeof(dBombDrop)); + return new(buffer) dBombDrop; +} + + +int dBombDrop::onCreate() { + + int t = this->settings & 0xF; + this->eventA = (this->settings >> 16) & 0xFF; + this->eventB = (this->settings >> 24) & 0xFF; + + + if (t == 0) { + target = (dStageActor_c*)FindActorByType(EN_BOSS_KOOPA, 0); + } + else { + target = GetSpecificPlayerActor(t - 1); + } + + dFlagMgr_c::instance->set(eventA, 0, false, false, false); + dFlagMgr_c::instance->set(eventB, 0, false, false, false); + + return true; +} + + +int dBombDrop::onDelete() { return true; } +int dBombDrop::onDraw() { return true; } + +int dBombDrop::onExecute() { + pos.x = target->pos.x; + + bool active; + active = dFlagMgr_c::instance->active(eventA); + if (active) { + create(WM_SMALLCLOUD, 0, &pos, &rot, 0); + dFlagMgr_c::instance->set(eventA, 0, false, false, false); + dFlagMgr_c::instance->set(eventA+1, 0, true, false, false); + } + + active = dFlagMgr_c::instance->active(eventB); + if (active) { + create(WM_SMALLCLOUD, 0, &pos, &rot, 0); + dFlagMgr_c::instance->set(eventB, 0, false, false, false); + dFlagMgr_c::instance->set(eventB+1, 0, true, false, false); + } + + return true; +} + + + + + diff --git a/src/bossBridgeBowser.cpp b/src/bossBridgeBowser.cpp new file mode 100644 index 0000000..cafcc98 --- /dev/null +++ b/src/bossBridgeBowser.cpp @@ -0,0 +1,53 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> +#include <stage.h> +#include "boss.h" + +extern "C" void *BowserExitDemoState(void *, unsigned int); +extern "C" void *ForceMarioExitDemoMode(void *, unsigned int); +extern "C" void *BowserFireballCollision(dEn_c *, ActivePhysics *, ActivePhysics *); +extern "C" void *BowserDamageAnmClr(dEn_c *); +extern "C" void *BowserDamageStepTwo(dEn_c *); +extern "C" void *BowserDamageStepThree(dEn_c *); + + +void BowserDoomSpriteCollision(dEn_c *bowser, ActivePhysics *apThis, ActivePhysics *apOther) { + // If you collide with something or other, call the fireball collision + + if (apOther->owner->name == 674) { + OSReport("AnmClr"); + BowserDamageAnmClr(bowser); + OSReport("Damage Step 2"); + BowserDamageStepTwo(bowser); + OSReport("Damage Step 3"); + BowserDamageStepThree(bowser); + OSReport("Damage Done"); + dEn_c * bomb = (dEn_c*)apOther->owner; + bomb->kill(); + } + + return; +} + +void BowserDoomStart(dStageActor_c *Controller) { + OSReport("Here we go!"); + + dEn_c *Bowser = (dEn_c*)FindActorByType(EN_BOSS_KOOPA, (Actor*)Controller); + Bowser->Delete(1); +} + +void BowserDoomExecute(dStageActor_c *Controller) { + dFlagMgr_c::instance->set(2, 0, true, false, false); + Controller->Delete(1); +} + +void BowserDoomEnd(dStageActor_c *Controller) { + OSReport("Bai bai everybody"); + Controller->Delete(1); +} + +void BowserStartEnd(dStageActor_c *Controller) { + dFlagMgr_c::instance->set(1, 0, true, false, false); +}
\ No newline at end of file |