summaryrefslogtreecommitdiff
path: root/src/mrsun.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mrsun.cpp')
-rwxr-xr-xsrc/mrsun.cpp64
1 files changed, 45 insertions, 19 deletions
diff --git a/src/mrsun.cpp b/src/mrsun.cpp
index 3036a6b..df4d1ac 100755
--- a/src/mrsun.cpp
+++ b/src/mrsun.cpp
@@ -73,6 +73,7 @@ extern "C" u32 GenerateRandomNumber(int max);
extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daMrSun_c *, Vec pos);
extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
+extern "C" void *PlaySound(daMrSun_c *, int soundID);
int NearestPlayer(daMrSun_c *Sprite);
@@ -135,6 +136,8 @@ void daMrSun_c::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *
void daMrSun_c::dieFall_Execute() {
+ if (this->killFlag == 1) { return; }
+
this->timer = this->timer + 1;
this->dying = this->dying + 0.15;
@@ -143,26 +146,35 @@ void daMrSun_c::dieFall_Execute() {
this->pos.y = this->pos.y - ((-0.2 * (this->dying*this->dying)) + 5);
this->dEn_c::dieFall_Execute();
-
-
+
if (this->timer > 450) {
+
+ if ((this->settings >> 28) > 0) {
+ this->kill();
+ this->pos.y = this->pos.y + 800.0;
+ this->killFlag = 1;
+ return;
+ }
+
dStageActor_c *Player = GetSpecificPlayerActor(0);
if (Player == 0) { Player = GetSpecificPlayerActor(1); }
if (Player == 0) { Player = GetSpecificPlayerActor(2); }
if (Player == 0) { Player = GetSpecificPlayerActor(3); }
- Player->pos;
- this->pos.x = Player->pos.x - 300;
-
if (Player == 0) {
this->pos.x = 0;
doStateChange(&StateID_Follow); }
+ else {
+ Player->pos;
+ this->pos.x = Player->pos.x - 300;
+ }
+
this->pos.y = this->Baseline;
this->aPhysics.addToList();
doStateChange(&StateID_Follow);
- }
+ }
}
@@ -235,7 +247,7 @@ int daMrSun_c::onCreate() {
this->sunDying = 0;
this->killFlag = 0;
- this->pos.z = 3300.00;
+ this->pos.z = 5500.00;
char eventNum = (this->settings >> 16) & 0xFF;
@@ -272,7 +284,9 @@ int daMrSun_c::onExecute() {
if (this->killFlag == 0) {
this->kill();
this->pos.y = this->pos.y + 800.0;
- this->killFlag = 1; }
+ this->killFlag = 1;
+ doStateChange(&StateID_DieFall);
+ }
}
return true;
@@ -453,6 +467,9 @@ void daMrSun_c::beginState_Swoop() {
this->swoopSpeed = x3 * 2 / 75;
+
+ PlaySound(this, 284);
+
}
void daMrSun_c::executeState_Swoop() {
@@ -480,6 +497,8 @@ void daMrSun_c::beginState_Spiral() {
this->SpiralLoop = 0;
this->xSpiralOffset = this->pos.x;
this->ySpiralOffset = this->pos.y;
+
+ PlaySound(this, 284);
}
void daMrSun_c::executeState_Spiral() {
@@ -513,10 +532,14 @@ void daMrSun_c::beginState_Spit() {
OSReport("Goodness Gracious Great Balls of Fire!");
this->timer = 0;
this->spinStateOn = 1;
+
}
void daMrSun_c::executeState_Spit() {
if (this->timer == 10) {
+
+ PlaySound(this, 431);
+
this->direction = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
float neg = -1.0;
@@ -527,17 +550,17 @@ void daMrSun_c::executeState_Spit() {
dStageActor_c *spawner = CreateActor(106, 0, this->pos, 0, 0);
spawner->speed.x = 6.0 * neg;
spawner->speed.y = -2.5;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
spawner = CreateActor(106, 0, this->pos, 0, 0);
spawner->speed.x = 0.0 * neg;
spawner->speed.y = -6.0;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
spawner = CreateActor(106, 0, this->pos, 0, 0);
spawner->speed.x = 3.5 * neg;
spawner->speed.y = -6.0;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
} // It's a sun
@@ -545,19 +568,19 @@ void daMrSun_c::executeState_Spit() {
dStageActor_c *spawner = CreateActor(118, 0, this->pos, 0, 0);
spawner->speed.x = 6.0 * neg;
spawner->speed.y = -2.5;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
*((u32 *) (((char *) spawner) + 0x3DC)) = this->id;
spawner = CreateActor(118, 0, this->pos, 0, 0);
spawner->speed.x = 0.0 * neg;
spawner->speed.y = -6.0;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
*((u32 *) (((char *) spawner) + 0x3DC)) = this->id;
spawner = CreateActor(118, 0, this->pos, 0, 0);
spawner->speed.x = 3.5 * neg;
spawner->speed.y = -6.0;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
*((u32 *) (((char *) spawner) + 0x3DC)) = this->id;
} // It's a moon
@@ -584,6 +607,8 @@ void daMrSun_c::beginState_Spin() {
}
void daMrSun_c::executeState_Spin() {
+ PlaySound(this, 282);
+
this->direction = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
if (this->direction == 0) {
@@ -626,10 +651,10 @@ void daMrSun_c::executeState_Spin() {
float spitspeed;
if ((this->settings & 0xF) == 0) { spitspeed = 3.0; } // It's a sun
- else { spitspeed = 5.0; } // It's a moon
+ else { spitspeed = 4.0; } // It's a moon
int randomBall;
- randomBall = GenerateRandomNumber(6);
+ randomBall = GenerateRandomNumber(8);
if (randomBall == 1) {
int direction;
direction = GenerateRandomNumber(8);
@@ -662,19 +687,20 @@ void daMrSun_c::executeState_Spin() {
xlaunch = spitspeed;
ylaunch = -spitspeed; }
-
+ PlaySound(this, 431);
+
if ((this->settings & 0xF) == 0) {
dStageActor_c *spawner = CreateActor(106, 0, this->pos, 0, 0);
spawner->speed.x = xlaunch;
spawner->speed.y = ylaunch;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
} // It's a sun
else {
dStageActor_c *spawner = CreateActor(118, 0, this->pos, 0, 0);
spawner->speed.x = xlaunch;
spawner->speed.y = ylaunch;
- spawner->pos.z = 3350.0;
+ spawner->pos.z = 5550.0;
*((u32 *) (((char *) spawner) + 0x3DC)) = this->id;
} // It's a moon