summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-09-23 02:22:37 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-09-23 02:22:37 -0500
commit8f0baae495ade1b065d73875092a3bb479787ada (patch)
tree9799fb18ae512d4a71150352c8c048d8d9748c52
parent9b1df8223e713762897d4a8a8508d0c4843570ee (diff)
downloadkamek-8f0baae495ade1b065d73875092a3bb479787ada.tar.gz
kamek-8f0baae495ade1b065d73875092a3bb479787ada.zip
Added FuzzyBear and some fixes to Mr.sun
Diffstat (limited to '')
-rw-r--r--NewerProject.yaml1
-rw-r--r--bossFuzzyBear.yaml10
-rw-r--r--src/bossFuzzyBear.cpp297
-rwxr-xr-xsrc/mrsun.cpp7
4 files changed, 312 insertions, 3 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml
index af9ab90..0ab5037 100644
--- a/NewerProject.yaml
+++ b/NewerProject.yaml
@@ -8,6 +8,7 @@ modules:
- processed/animtiles.yaml
- processed/levelspecial.yaml
- processed/mrsun.yaml
+ - processed/bossFuzzyBear.yaml
- processed/spritetex.yaml
# - processed/gakenoko.yaml
- processed/poweruphax.yaml
diff --git a/bossFuzzyBear.yaml b/bossFuzzyBear.yaml
new file mode 100644
index 0000000..3b608d3
--- /dev/null
+++ b/bossFuzzyBear.yaml
@@ -0,0 +1,10 @@
+---
+# Replaces EN_WALLINSECT
+
+source_files: [../src/bossFuzzyBear.cpp]
+hooks:
+ - name: FuzzyBearBuild
+ type: add_func_pointer
+ src_addr_pal: 0x8097F730
+ target_func: 'daFuzzyBear_c::build(void)'
+
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp
new file mode 100644
index 0000000..b206299
--- /dev/null
+++ b/src/bossFuzzyBear.cpp
@@ -0,0 +1,297 @@
+#include <common.h>
+#include <game.h>
+#include <g3dhax.h>
+
+class daFuzzyBear_c : public dEn_c {
+ int onCreate();
+ int onDelete();
+ int onExecute();
+ int onDraw();
+
+ mHeapAllocator_c allocator;
+ m3d::mdl_c bodyModel;
+
+ int timer;
+ float Baseline;
+ float AreaWidthLeft;
+ float AreaWidthRight;
+ float LaunchSpeedShort;
+ float LaunchSpeedHigh;
+ float dying;
+ Vec initialPos;
+
+ void dieBigFall_Execute();
+ static daFuzzyBear_c *build();
+
+ void updateModelMatrices();
+
+// void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+// void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther);
+
+ USING_STATES(daFuzzyBear_c);
+ DECLARE_STATE(Grow);
+ DECLARE_STATE(Bounce);
+};
+
+daFuzzyBear_c *daFuzzyBear_c::build() {
+ void *buffer = AllocFromGameHeap1(sizeof(daFuzzyBear_c));
+ return new(buffer) daFuzzyBear_c;
+}
+
+
+extern "C" void *HandleXSpeed(daFuzzyBear_c *);
+extern "C" void *HandleYSpeed(daFuzzyBear_c *);
+extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daFuzzyBear_c *);
+extern "C" u32 GenerateRandomNumber(int max);
+extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daFuzzyBear_c *, Vec pos);
+extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
+
+
+
+CREATE_STATE(daFuzzyBear_c, Grow);
+CREATE_STATE(daFuzzyBear_c, Bounce);
+
+
+#define ACTIVATE 1
+#define DEACTIVATE 0
+
+
+void daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Fireball"); }
+void daFuzzyBear_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); }
+void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
+ OSReport("Hit Rolling Object");
+ this->timer = 0;
+ doStateChange(&StateID_DieBigFall); }
+void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
+ OSReport("Hit Hammer");
+ this->timer = 0;
+ doStateChange(&StateID_DieBigFall); }
+void daFuzzyBear_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Yoshi Fire"); }
+
+
+void daFuzzyBear_c::dieBigFall_Execute() {
+
+ this->timer = this->timer + 1;
+
+ this->dying = this->dying + 0.15;
+
+ this->pos.x = this->pos.x + 0.15;
+ this->pos.y = this->pos.y + ((-0.2 * (this->dying*this->dying)) + 5);
+
+ this->dEn_c::dieBigFall_Execute();
+}
+
+
+int daFuzzyBear_c::onCreate() {
+
+ OSReport("Creating the Fuzzy Bear Model");
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
+
+ nw4r::g3d::ResFile rf(getResource("chorobon", "g3d/chorobon.brres"));
+ bodyModel.setup(rf.GetResMdl("chorobon"), &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&bodyModel, 0);
+
+ allocator.unlink();
+
+ OSReport("Setting Fuzzy Bear's Size to 1.0");
+ this->scale = (Vec){1.0, 1.0, 1.0};
+
+ OSReport("Creating Fuzzy Bear's Physics Struct");
+
+ ActivePhysics::Info HitMeBaby;
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 0.0;
+ HitMeBaby.xDistToEdge = 38.0;
+ HitMeBaby.yDistToEdge = 38.0;
+ HitMeBaby.category1 = 0x3;
+ HitMeBaby.category2 = 0x0;
+ HitMeBaby.bitfield1 = 0x4F;
+ HitMeBaby.bitfield2 = 0x828E;
+ HitMeBaby.unkShort1C = 0;
+ HitMeBaby.callback = &dEn_c::collisionCallback;
+
+
+ OSReport("Making the Physics Class and adding to the list");
+ this->aPhysics.initWithStruct(this, &HitMeBaby);
+ this->aPhysics.addToList();
+
+ OSReport("Setting up Fuzzy Bear's Box of Goodies");
+
+ this->pos.y = this->pos.y + 6;
+ this->rot.x = 0; // X is vertical axis
+ this->rot.y = 0; // Y is horizontal axis
+ this->rot.z = 0; // Z is ... an axis >.>
+ this->direction = 0; // Heading left.
+
+ this->speed.x = 0;
+ this->LaunchSpeedShort = ((this->settings >> 20) && 0xF) * 10.0;
+ this->LaunchSpeedHigh = ((this->settings >> 24) && 0xF) * 10.0;
+
+ this->AreaWidthRight = this->settings && 0xFF;
+ this->AreaWidthLeft = (this->settings >> 8) && 0xFF;
+
+ this->initialPos = this->pos;
+
+ OSReport("Setting Fuzzy Bear's State");
+ doStateChange(&StateID_Grow);
+
+ OSReport("Going to Execute Fuzzy Bear");
+ this->onExecute();
+ return true;
+}
+
+int daFuzzyBear_c::onDelete() {
+ return true;
+}
+
+int daFuzzyBear_c::onExecute() {
+ // OSReport("Fuzzy Bear was Executed.");
+ acState.execute();
+ updateModelMatrices();
+
+// this->speed.y = this->speed.y - 0.2; // Gravity
+
+ return true;
+}
+
+int daFuzzyBear_c::onDraw() {
+ bodyModel.scheduleForDrawing();
+ return true;
+}
+
+
+void daFuzzyBear_c::updateModelMatrices() {
+ // This won't work with wrap because I'm lazy.
+ 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);
+}
+
+
+// Grow State
+
+void daFuzzyBear_c::beginState_Grow() {
+ OSReport("Growing when Kameck Tells me to.");
+ this->timer = 0;
+}
+
+void daFuzzyBear_c::executeState_Grow() {
+
+ this->timer = this->timer + 1;
+
+ if ((this->timer > 60) && (this->timer < 140)) {
+
+ float modifier;
+ modifier = 1.0 + ((this->timer - 60) * 0.025);
+
+ this->scale = (Vec){modifier, modifier, modifier};
+ this->pos.y = this->pos.y + (25/80);
+ }
+
+ if (this->timer > 170) { doStateChange(&StateID_Bounce); }
+
+}
+void daFuzzyBear_c::endState_Grow() {
+ this->Baseline = this->pos.y;
+ OSReport("OK. All grown up now.");
+}
+
+
+
+
+
+// Bounce State
+
+void daFuzzyBear_c::beginState_Bounce() {
+
+ if (this->direction = 0) { this->speed.x = ((this->settings >> 16) && 0xF) * 0.5; }
+ else { this->speed.x = ((this->settings >> 16) && 0xF) * -0.5; }
+
+ this->pos.y = this->Baseline - 1.0;
+
+ this->timer = 20;
+}
+void daFuzzyBear_c::executeState_Bounce() {
+
+ // Check for walls
+
+ if (this->pos.x <= this->initialPos.x - ((AreaWidthLeft * 24.0) + 38.0)) { // Hit left wall, head right.
+ this->speed.x = -this->speed.x;
+ this->direction = 0;
+ this->pos.x = this->pos.x + 1.0; }
+
+ if (this->pos.x >= this->initialPos.x + ((AreaWidthRight * 24.0) - 38.0)) { // Hit right wall, head left.
+ this->speed.x = -this->speed.x;
+ this->direction = 1;
+ this->pos.x = this->pos.x - 1.0; }
+
+
+ // Check if we're on the ground.
+
+ if (this->pos.y < this->Baseline) {
+
+ OSReport("Prepare for Landing.");
+
+ this->timer = this->timer + 1;
+ this->speed.x = 0;
+ this->speed.y = 0;
+
+
+ if (this->timer < 10) {
+ float modifier;
+ modifier = 3.0 - (this->timer * 0.05);
+
+ this->scale.y = modifier;
+ this->pos.y = this->pos.y + (6/15);
+ if (this->pos.y > this->Baseline) { this->pos.y = this->Baseline - 1.0; }
+ }
+ else {
+ float modifier;
+ modifier = 2.0 + ((this->timer - 20) * 0.05);
+
+ this->scale.y = modifier;
+ this->pos.y = this->pos.y + (24/15);
+ if (this->pos.y > this->Baseline) { this->pos.y = this->Baseline - 1.0; }
+ }
+
+ if (this->timer >= 20) {
+ int randChoice;
+ randChoice = GenerateRandomNumber(5);
+
+ if (randChoice == 0) { this->speed.y = LaunchSpeedHigh; }
+ else { this->speed.y = LaunchSpeedShort; }
+
+ this->timer = 0;
+ this->pos.y = this->Baseline + 1;
+ OSReport("Takeoff Initiated");
+
+ if (this->direction = 0) { this->speed.x = ((this->settings >> 16) && 0xF) * 0.5; }
+ else { this->speed.x = ((this->settings >> 16) && 0xF) * -0.5; }
+ }
+ }
+
+ else { this->speed.y = this->speed.y - 0.1; } // Gravity
+
+
+
+ HandleXSpeed(this);
+ HandleYSpeed(this);
+
+ UpdateObjectPosBasedOnSpeedValues_real(this);
+
+}
+
+void daFuzzyBear_c::endState_Bounce() {
+
+}
+
+
+
diff --git a/src/mrsun.cpp b/src/mrsun.cpp
index 88dd7fd..19b5902 100755
--- a/src/mrsun.cpp
+++ b/src/mrsun.cpp
@@ -88,6 +88,7 @@ void daMrSun_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActiveP
OSReport("Hit Iceball");
if (this->settings == 0) { // It's a sun
if (this->sunDying == 5) {
+ this->isDead = 1;
doStateChange(&StateID_DieIceVanish); }
else {
this->sunDying = this->sunDying + 1; }
@@ -111,7 +112,7 @@ void daMrSun_c::dieFall_Execute() {
this->dying = this->dying + 0.15;
this->pos.x = this->pos.x + 0.15;
- this->pos.y = this->pos.y + ((-0.2 * (this->dying*this->dying)) + 5);
+ this->pos.y = this->pos.y - ((-0.2 * (this->dying*this->dying)) + 5);
this->dEn_c::dieFall_Execute();
@@ -202,7 +203,7 @@ int daMrSun_c::onCreate() {
this->timer = 0;
this->xSpiralOffset = 0.0;
this->ySpiralOffset = 0.0;
- this->dying = -15;
+ this->dying = -5;
this->sunDying = 0;
this->pos.z = 3300.00;
@@ -272,7 +273,7 @@ void daMrSun_c::beginState_Follow() {
this->timer = 0;
this->rot.x = 18000;
this->rot.y = 0;
-// this->rot.z = 18000;
+ this->rot.z = 0;
}
void daMrSun_c::executeState_Follow() {