summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-07-07 23:37:27 -0500
committerColin Noga <Tempus@chronometry.ca>2012-07-07 23:37:27 -0500
commitc4d21117dda370659a8e8d15703b3b435276b919 (patch)
treecacb4f758d9286710eca6948d18aa6fafcf4a1b5
parent13d1b791d14695dab43033d171bb6f161bd04fc5 (diff)
downloadkamek-c4d21117dda370659a8e8d15703b3b435276b919.tar.gz
kamek-c4d21117dda370659a8e8d15703b3b435276b919.zip
Added bowser bridge battle
-rw-r--r--bossBridgeBowser.yaml96
-rw-r--r--src/bossBombDrop.cpp250
-rw-r--r--src/bossBridgeBowser.cpp53
3 files changed, 399 insertions, 0 deletions
diff --git a/bossBridgeBowser.yaml b/bossBridgeBowser.yaml
new file mode 100644
index 0000000..eed2625
--- /dev/null
+++ b/bossBridgeBowser.yaml
@@ -0,0 +1,96 @@
+---
+# BombDrop = WM_Cloud (673)
+# DropedBomb = WM_SmallCloud (674)
+
+source_files: [../src/bossBridgeBowser.cpp, ../src/bossBombDrop.cpp]
+
+hooks:
+
+ ################################################
+ # HOOKS FOR Dropped Bomb
+ ################################################
+ - name: dDroppedBombBuild
+ type: add_func_pointer
+ src_addr_pal: 0x8098550C
+ target_func: 'dDroppedBomb::build(void)'
+
+
+
+ ################################################
+ # HOOKS FOR Bomb Drop
+ ################################################
+ - name: BombDropBuild
+ type: add_func_pointer
+ src_addr_pal: 0x80982530
+ target_func: 'dBombDrop::build(void)'
+
+ - name: UpdatedBombDropSpriteInfo
+ type: patch
+ addr_pal: 0x8030A5C0
+ data: '02A1 0000 00000010 00000010 00000000 00000000 00000200 00000200 0000 0000 0200 0200 0000 0000'
+ # 0x8030A340 + sprite num * 0x28 == offset
+
+ - name: dBombDropSpriteFileInfo
+ type: add_func_pointer
+ src_addr_pal: 0x8031AB8C
+ target_func: 'BDarcNameList'
+
+ # 0x8031AB4C + sprite num * 0x4 == offset
+ # That offset stores a pointer to a table of pointers to strings, followed by four bytes of padding
+ # Each string is an arcname to load
+
+
+ ################################################
+ # HOOKS FOR BRIDGE BOWSER
+ ################################################
+
+ - name: BowserBridgeCollision
+ type: add_func_pointer
+ src_addr_pal: 0x80B7E804
+ target_func: 'BowserDoomSpriteCollision(dEn_c *, ActivePhysics *, ActivePhysics *)'
+
+ # - name: SetBowserBridgeHP
+ # type: patch
+ # addr_pal: 0x80B3E478
+ # data: '38000003'
+
+ - name: BowserBridgeHammerCollision
+ type: add_func_pointer
+ src_addr_pal: 0x80B7E848
+ target_func: 'Return'
+
+ - name: PatchMagicStart
+ type: add_func_pointer
+ src_addr_pal: 0x80954BF0
+ target_func: 'BowserDoomStart(dStageActor_c *)'
+
+ - name: PatchMagicExecute
+ type: add_func_pointer
+ src_addr_pal: 0x80954BF4
+ target_func: 'BowserDoomExecute(dStageActor_c *)'
+
+ - name: PatchMagicEnd
+ type: add_func_pointer
+ src_addr_pal: 0x80954BF8
+ target_func: 'BowserDoomEnd(dStageActor_c *)'
+
+ - name: PatchBattleStartEnd
+ type: add_func_pointer
+ src_addr_pal: 0x80954BD4
+ target_func: 'BowserStartEnd(dStageActor_c *)'
+
+
+ ################################################
+ # HOOKS FOR FIREBALL PATCHING
+ ################################################
+
+ - name: BowserFireballPatchA
+ type: patch
+ addr_pal: 0x800991B8
+ data: '600000006000000060000000600000006000000060000000600000006000000060000000600000006000000060000000'
+
+ - name: BowserFireballPatchB
+ type: patch
+ addr_pal: 0x80099264
+ data: '600000006000000060000000600000006000000060000000'
+
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