From 481585f8747707bb1aee196672edc7a926ae0611 Mon Sep 17 00:00:00 2001
From: Colin Noga <Tempus@Spectrum-Song.local>
Date: Sat, 22 Oct 2011 03:28:23 -0500
Subject: Lots of boss updates

---
 src/bossBalboaWrench.cpp | 86 ++++++++++++++++++++++++++++++++++++++----------
 src/bossFuzzyBear.cpp    | 13 ++++----
 src/bossRamboo.cpp       | 68 ++++++++++++++++++++++----------------
 src/fakeStarCoin.cpp     | 52 ++++++++++++++++++++++++++++-
 src/soundPlayer.S        |  4 +--
 5 files changed, 168 insertions(+), 55 deletions(-)

diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp
index efb3abe..02742e7 100644
--- a/src/bossBalboaWrench.cpp
+++ b/src/bossBalboaWrench.cpp
@@ -37,6 +37,7 @@ class daBalboa_c : public dEn_c {
 	int homingWrenchLifeSpan;
 	float homingWrenchDirection;
 	char throwCount;
+	char upsideDown;
 	
 	static daBalboa_c *build();
 
@@ -192,11 +193,11 @@ int daBalboa_c::onCreate() {
 	OSReport("Creating Balboa's Physics Struct");
 
 	ActivePhysics::Info HitMeBaby;
-	HitMeBaby.xDistToCenter = 0.0;
+	HitMeBaby.xDistToCenter = 24.0;
 	HitMeBaby.yDistToCenter = 36.0;
 
 	HitMeBaby.xDistToEdge = 24.0;
-	HitMeBaby.yDistToEdge = 30.0;
+	HitMeBaby.yDistToEdge = 32.0;
 
 	HitMeBaby.category1 = 0x3;
 	HitMeBaby.category2 = 0x0;
@@ -217,11 +218,13 @@ int daBalboa_c::onCreate() {
 	this->rot.z = 0; // Z is ... an axis >.>
 	this->direction = 0; // Heading left.
 	this->pos.z = -800.0;
+	this->pos.y -= 8.0;
 
-	this->PopUp[0] = (Vec){this->pos.x, this->pos.y + 120.0, this->pos.z};
-	this->PopUp[1] = (Vec){this->pos.x - 320.0, this->pos.y - 60.0, this->pos.z};
-	this->PopUp[2] = (Vec){this->pos.x, this->pos.y + 120.0, this->pos.z};
-	this->PopUp[3] = (Vec){this->pos.x - 320.0, this->pos.y - 60.0, this->pos.z};
+	this->PopUp[0] = (Vec){this->pos.x, this->pos.y - 72.0, this->pos.z};
+	this->PopUp[1] = (Vec){this->pos.x - 224.0, this->pos.y - 72.0, this->pos.z};
+	this->PopUp[2] = (Vec){this->pos.x, this->pos.y + 248.0, this->pos.z};
+	this->PopUp[3] = (Vec){this->pos.x - 224.0, this->pos.y + 248.0, this->pos.z};
+	this->PopUp[4] = (Vec){this->pos.x - 112.0, this->pos.y - 40.0, this->pos.z};
 
 
 	OSReport("Setting the State");
@@ -304,7 +307,7 @@ void daBalboa_c::executeState_Grow() {
 	
 		float modifier;
 
-		modifier = 2.0 + ((this->timer - 60) * scaleSpeed);
+		modifier = 1.0 + ((this->timer - 60) * scaleSpeed);
 		
 		this->scale = (Vec){modifier, modifier, modifier};
 //		this->pos.y = this->pos.y + (yPosScaling/80);
@@ -338,17 +341,48 @@ void daBalboa_c::beginState_ManholeUp() {
 	this->timer = 0;
 		
 	int randChoice;
-	randChoice = GenerateRandomNumber(4);
+	randChoice = GenerateRandomNumber(5);
 	
 	this->pos = this->PopUp[randChoice];
 	
-	if (randChoice < 2) { // On the left side!
+	if 		(randChoice == 0) { // On the left side!
 		this->rot.y = 0xE000; 
+		this->rot.z = 0;
+		this->upsideDown = 0;
 		this->direction = 0; }
-	else {	// On the right side!
+
+	else if (randChoice == 1) {	// On the right side!
+		this->rot.y = 0x2000; 
+		this->rot.z = 0;
+		this->upsideDown = 0;
+		this->direction = 1; }
+
+	else if (randChoice == 2) {	// On the right ceiling!
+		this->rot.y = 0xE000; 
+		this->rot.z = 0x8000;
+		this->upsideDown = 1;
+		this->direction = 0; }
+
+	else if (randChoice == 3) {	// On the left ceiling!
 		this->rot.y = 0x2000; 
+		this->rot.z = 0x8000;
+		this->upsideDown = 1;
 		this->direction = 1; }
 
+	else if (randChoice == 4) {	// In the Center!
+		char PlayerID = NearestPlayer(this);
+		dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
+
+		this->upsideDown = 0;
+		this->rot.z = 0;
+		if (Player->pos.x < this->pos.x) {
+			this->rot.y = 0xE000; 
+			this->direction = 0; }
+		else {
+			this->rot.y = 0x2000; 
+			this->direction = 1; }
+	}
+
 	PlaySound(this, 0x21F);
 }
 
@@ -357,9 +391,13 @@ void daBalboa_c::executeState_ManholeUp() {
 	this->bodyModel._vf1C();
 	
 	if (this->timer < 30) {
-		this->pos.y += 0.5; } // Height is 80 pixels, move up 15 pixels.
+		if (this->upsideDown == 0) {
+			this->pos.y += 0.6; } // Height is 72 pixels, move up 18 pixels.
+		else {
+			this->pos.y -= 0.6; } // Height is 72 pixels, move down 18 pixels.
+	}
 		
-	if (this->timer > 90) {
+	if (this->timer > 60) {
 		doStateChange(&StateID_HeadPoke); }
 		
 	this->timer += 1;
@@ -385,8 +423,12 @@ void daBalboa_c::beginState_HeadPoke() {
 void daBalboa_c::executeState_HeadPoke() { 
 
 	if (this->timer < 30) {
-		this->pos.y += 1.0; } // Height is 80 pixels, move up another 30 pixels.
-		
+		if (this->upsideDown == 0) {
+			this->pos.y += 0.6; } // Height is 72 pixels, move up 20 pixels.
+		else {
+			this->pos.y -= 0.6; } // Height is 72 pixels, move down 20 pixels.
+	}
+	
 	if (this->timer > 90) {
 		doStateChange(&StateID_AllOut); }
 		
@@ -406,7 +448,7 @@ void daBalboa_c::beginState_AllOut() {
 
 	nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_3");
 	this->anmThrow_3.bind(&this->bodyModel, anmChr, 1);
-	this->bodyModel.bindAnim(&this->anmThrow_1, 0.0);
+	this->bodyModel.bindAnim(&this->anmThrow_3, 0.0);
 	this->anmThrow_3.setUpdateRate(1.0);
 
 	this->timer = 0;
@@ -419,9 +461,13 @@ void daBalboa_c::executeState_AllOut() {
 	this->bodyModel._vf1C();
 
 	if (this->timer < 30) {
-		this->pos.y += 1.2; } // Height is 80 pixels, move up another 35 pixels.
+		if (this->upsideDown == 0) {
+			this->pos.y += 1.2; } // Height is 72 pixels, move up last 36 pixels.
+		else {
+			this->pos.y -= 1.2; } // Height is 72 pixels, move down last 36 pixels.
+	}
 		
-	if (this->timer > 90) {
+	if (this->timer > 45) {
 		int randChoice;
 		randChoice = GenerateRandomNumber(2);
 	
@@ -611,7 +657,11 @@ void daBalboa_c::beginState_BackDown() {
 void daBalboa_c::executeState_BackDown() { 
 
 	if (this->timer < 60) {
-		this->pos.y -= 2.6667; } // Height is 80 pixels, move down 80 pixels.
+		if (this->upsideDown == 0) {
+			this->pos.y -= 1.2; } // Height is 72 pixels, move down 
+		else {
+			this->pos.y += 1.2; } // Height is 72 pixels, move up
+	}
 		
 	if (this->timer > 90) {
 		doStateChange(&StateID_ManholeUp); }
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp
index 0c16d42..463d063 100644
--- a/src/bossFuzzyBear.cpp
+++ b/src/bossFuzzyBear.cpp
@@ -25,7 +25,7 @@ class daFuzzyBear_c : public dEn_c {
 	float AreaWidthRight;
 	float LaunchSpeedShort;
 	float LaunchSpeedHigh;
-	u8 dying;
+	char dying;
 	float storeSpeed;
 	Vec initialPos;
 	char RolyBounces;
@@ -70,7 +70,7 @@ extern "C" void *HandleYSpeed(daFuzzyBear_c *);
 extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daFuzzyBear_c *);
 extern "C" void *doSpriteMovement(dEn_c *);
 extern "C" void *PlaySound(daFuzzyBear_c *, int soundID);
-extern "C" void *StopSound(int soundID, int thing=0);
+extern "C" void *StopSound(int soundID);
 
 extern "C" u32 GenerateRandomNumber(int max);
 extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
@@ -248,6 +248,7 @@ int daFuzzyBear_c::onCreate() {
 	this->roly = 0;
 	this->damage = 0;
 	this->isInvulnerable = 0;
+	this->dying = 0;
 
 
 	bindAnimChr_and_setUpdateRate("run", 1, 0.0, 1.0);
@@ -384,12 +385,12 @@ void daFuzzyBear_c::executeState_Bounce() {
 	
 	// Check for walls
 	
-	if (this->pos.x <= this->initialPos.x - ((15 * 24.0) + wallDistance))  { // Hit left wall, head right.
+	if (this->pos.x <= this->initialPos.x - ((17 * 16.0) + wallDistance))  { // Hit left wall, head right.
 		this->speed.x = -this->speed.x;
 		this->direction = 1;
 		this->pos.x = this->pos.x + 1.0; }
 		
-	if (this->pos.x >= this->initialPos.x + ((5 * 24.0) - wallDistance))  { // Hit right wall, head left.
+	if (this->pos.x >= this->initialPos.x + ((7.5 * 16.0) - wallDistance))  { // Hit right wall, head left.
 		this->speed.x = -this->speed.x;
 		this->direction = 0;
 		this->pos.x = this->pos.x - 1.0; }
@@ -650,14 +651,14 @@ void daFuzzyBear_c::executeState_RolyPoly() {
 	
 	this->timer += 1;
 
-	if (this->pos.x <= this->initialPos.x - ((15 * 24.0) + wallDistance))  { // Hit left wall, head right.
+	if (this->pos.x <= this->initialPos.x - ((17 * 16.0) + wallDistance))  { // Hit left wall, head right.
 		this->speed.x = -this->speed.x;
 		this->direction = 1;
 		this->pos.x = this->pos.x + 1.0; 
 		this->RolyBounces = this->RolyBounces + 1;
 		}
 		
-	if (this->pos.x >= this->initialPos.x + ((5 * 24.0) - wallDistance))  { // Hit right wall, head left.
+	if (this->pos.x >= this->initialPos.x + ((7.5 * 16.0) - wallDistance))  { // Hit right wall, head left.
 		this->speed.x = -this->speed.x;
 		this->direction = 0;
 		this->pos.x = this->pos.x - 1.0; 
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp
index d37baf6..284855b 100644
--- a/src/bossRamboo.cpp
+++ b/src/bossRamboo.cpp
@@ -30,8 +30,8 @@ class daRamboo_c : public dEn_c {
 	int timer;
 	int ytimer;
 	char Hiding;
+	char dying;
 	float Baseline;
-	float dying;
 
 	u64 eventFlag;
 
@@ -147,7 +147,7 @@ void daRamboo_c::setupModels() {
 
 	nw4r::g3d::ResMdl mdlC = this->resFile.GetResMdl("teresaB");
 	this->hideModel.setup(mdlC, &allocator, 0x224, 1, 0);
-	SetupTextures_Enemy(&this->bodyModel, 0);
+	SetupTextures_Enemy(&this->hideModel, 0);
 
 	nw4r::g3d::ResAnmChr anmChrE = this->resFile.GetResAnmChr("shay_teresaB");
 	ret = this->anmShayB.setup(mdlC, anmChrE, &this->allocator, 0);
@@ -182,8 +182,8 @@ int daRamboo_c::onCreate() {
 	HitMeBaby.xDistToCenter = 160.0;
 	HitMeBaby.yDistToCenter = -80.0;
 
-	HitMeBaby.xDistToEdge = 154.0;
-	HitMeBaby.yDistToEdge = 154.0;
+	HitMeBaby.xDistToEdge = 148.0;
+	HitMeBaby.yDistToEdge = 148.0;
 
 	HitMeBaby.category1 = 0x3;
 	HitMeBaby.category2 = 0x0;
@@ -205,6 +205,7 @@ int daRamboo_c::onCreate() {
 	this->rot.z = 0; // Z is ... an axis >.>
 	this->direction = 0; // Heading left.
 	this->Hiding = 0;
+	this->dying = 0;
 	
 	this->speed.x = 0.0;
 	this->ytimer = 0;
@@ -354,14 +355,21 @@ void daRamboo_c::beginState_Advance() {
 	this->speed.z = 0;
 	this->timer = 0;
 
+	nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait");
+	this->anmWaitA.bind(&this->bodyModel, anmChr, 1);
+	this->bodyModel.bindAnim(&this->anmWaitA, 0.0);
+	this->anmWaitA.setUpdateRate(1.0);
 
 }
 void daRamboo_c::executeState_Advance() { 
 
 	this->bodyModel._vf1C();
 
-	this->pos.x -= this->timer / 32;
-	this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 48;
+	if (this->anmWaitA.isAnimationDone()) {
+		this->anmWaitA.setCurrentFrame(0.0); }
+
+	this->pos.x -= this->timer / 48.0;
+	this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 36;
 	
 		
 	if (this->timer >= 48) { this->timer = 47; }
@@ -390,22 +398,37 @@ void daRamboo_c::beginState_Wait() {
 }
 void daRamboo_c::executeState_Wait() { 
 
+	if (this->timer < 90) {
+		this->hideModel._vf1C(); }
 
-	if (this->timer == 55) {
+	if (this->timer > 55) {
+		this->bodyModel._vf1C(); }
+	
+	
+	if (this->timer == 70)  {
+		this->Hiding = 0;
+	
+		nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaA");
+		this->anmShayA.bind(&this->bodyModel, anmChr, 1);
+		this->bodyModel.bindAnim(&this->anmShayA, 0.0);
+		this->anmShayA.setUpdateRate(1.0);
+	}
+			
+
+	if (this->timer == 55)  {
 		nw4r::g3d::ResAnmChr anmChrB = this->resFile.GetResAnmChr("shay_teresaB");
 		this->anmShayB.bind(&this->hideModel, anmChrB, 1);
 		this->hideModel.bindAnim(&this->anmShayB, 0.0);
 		this->anmShayB.setUpdateRate(1.0);
 	}		
 
-	if (this->timer > 60) { 
+
+
+	if (this->anmShayB.isAnimationDone()) { 
 		PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU);
 		doStateChange(&StateID_Advance); 
 	}
 
-
-	this->hideModel._vf1C();
-	
 	this->timer += 1;
 
 }
@@ -429,21 +452,15 @@ void daRamboo_c::endState_Wait() {
 
 void daRamboo_c::beginState_Flee() { 
 
-//	bindAnimChr_and_setUpdateRates("shay_teresaA", this->animationChrC, this->bodyModel, 1.0);
-
-	nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait");
-	this->anmWaitA.bind(&this->bodyModel, anmChr, 1);
-	this->bodyModel.bindAnim(&this->anmWaitA, 0.0);
-	this->anmWaitA.setUpdateRate(1.0);
-
 	OSReport("Damnit that hurt."); 
 	this->timer = 0;
 
-
 }
 void daRamboo_c::executeState_Flee() { 
 	
-	if (timer == 10) {
+	this->hideModel._vf1C(); 
+
+	if (this->timer == 10) {
 		this->Hiding = 1;
 	
 		nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaB_wait");
@@ -452,15 +469,10 @@ void daRamboo_c::executeState_Flee() {
 		this->anmWaitB.setUpdateRate(1.0);
 	}
 	
-	this->pos.x += (60 - this->timer) / 8;
+	this->pos.x += (60 - this->timer) / 6;
 	
-	if (timer < 10) {
-		this->bodyModel._vf1C(); }
-	else {
-		this->hideModel._vf1C(); }
-
 
-	if (this->timer > 60) { 
+	if ((this->timer > 60) && (this->anmWaitB.isAnimationDone())) { 
 		doStateChange(&StateID_Wait); 
 	}
 	
@@ -518,7 +530,7 @@ void daRamboo_c::executeState_Outro() {
 		return; 
 	}	
 
-	if (this->scale.x > 0.1) {
+	if (this->timer < 81) {
 
 		PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST);
 		PlaySound(this, SE_EMY_BIG_TERESA_DEAD);
diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp
index fb0df72..a845e45 100644
--- a/src/fakeStarCoin.cpp
+++ b/src/fakeStarCoin.cpp
@@ -30,6 +30,12 @@ class daFakeStarCoin : public dEn_c {
 	void updateModelMatrices();
 	void playerCollision(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);
+
 };
 
 
@@ -41,6 +47,50 @@ void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
 	this->Delete();
 }
 
+void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 342); 
+
+	PlaySound(this, SE_EMY_FIRE_SNAKE_BIGGER);
+
+	this->Delete();
+}
+bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 44); 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 231); 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 235); 
+
+	PlaySound(this, SE_OBJ_PNGN_ICE_BREAK);
+
+	this->Delete();
+	return false; 
+}
+void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 378); 
+
+	PlaySound(this, SE_BOSS_JR_FLOOR_BREAK);
+
+	this->Delete();
+}
+void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 378); 
+
+	PlaySound(this, SE_BOSS_JR_FLOOR_BREAK);
+
+	this->Delete();
+}
+void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) {
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); 
+	CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 342); 
+
+	PlaySound(this, SE_EMY_FIRE_SNAKE_BIGGER);
+
+	this->Delete();
+}
+
+
 
 
 daFakeStarCoin *daFakeStarCoin::build() {
@@ -67,7 +117,7 @@ int daFakeStarCoin::onCreate() {
 	HitMeBaby.category1 = 0x5;
 	HitMeBaby.category2 = 0x0;
 	HitMeBaby.bitfield1 = 0x4F;
-	HitMeBaby.bitfield2 = 0x200;
+	HitMeBaby.bitfield2 = 0xFFFFFFFF;
 	HitMeBaby.unkShort1C = 0;
 	HitMeBaby.callback = &dEn_c::collisionCallback;
 
diff --git a/src/soundPlayer.S b/src/soundPlayer.S
index 645af31..e132849 100644
--- a/src/soundPlayer.S
+++ b/src/soundPlayer.S
@@ -87,7 +87,7 @@ GoAwaySoundGuy:
 StopSound:
 
 	stwu      r1, -0x10(r1)
-	mtlr      r0
+	mflr      r0
 	stw       r0, 0x14(r1)
 
 	mr        r4, r3
@@ -95,6 +95,6 @@ StopSound:
 	bl        StopSoundBasic
 	
 	lwz       r0, 0x14(r1)
-	mflr      r0
+	mtlr      r0
 	
 	blr
-- 
cgit v1.2.3