summaryrefslogtreecommitdiff
path: root/src/bossMegaGoomba.cpp
diff options
context:
space:
mode:
authorStephen Simpson <megazig@gmail.com>2011-10-22 17:37:45 -0500
committerStephen Simpson <megazig@gmail.com>2011-10-22 17:37:45 -0500
commit0405d27af505da506ffa9daaeaf6d32d9be56958 (patch)
treec5d2390b2bbbfbd29bafa110beccc3c5c268dfe6 /src/bossMegaGoomba.cpp
parent6c1a8f456a41e03f94811937f1fc62013b91cb54 (diff)
downloadkamek-0405d27af505da506ffa9daaeaf6d32d9be56958.tar.gz
kamek-0405d27af505da506ffa9daaeaf6d32d9be56958.zip
fixups for launching goombas and changed function naming
Diffstat (limited to 'src/bossMegaGoomba.cpp')
-rw-r--r--src/bossMegaGoomba.cpp90
1 files changed, 59 insertions, 31 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp
index d70f6cd..6ef0edd 100644
--- a/src/bossMegaGoomba.cpp
+++ b/src/bossMegaGoomba.cpp
@@ -34,6 +34,9 @@ class daMegaGoomba_c : public dEn_c {
float JumpDist;
float JumpTime;
+ float launchTimer;
+ char launchCounter;
+
bool takeHit(char count);
void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate);
@@ -83,6 +86,13 @@ u8 struct_1[] = { 0, 0, 0, 1, 0xff, 0xff, 0x40, 0, 0, 0, 0xc0, 0, 0, 0, 0, 0 };
u8 struct_3[] = { 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0x3f, 0x2a, 0x7e, 0xfa };
// last 4 bytes not needed. float for scale
+// {-6, -3, 3, 6} xspeed
+// {10, 12, 12, 10} yspeed
+float launchX[] = {-4.0, -2.0, 2.0, 4.0};
+float launchY[] = {6.0, 7.0, 7.0, 6.0};
+// {-scale.x*8, -scale.x*4, scale.x*4, scale.x*8}
+float launchPosX[] = {-8.0, -4.0, 4.0, 8.0};
+
daMegaGoomba_c *daMegaGoomba_c::build() {
void *buffer = AllocFromGameHeap1(sizeof(daMegaGoomba_c));
return new(buffer) daMegaGoomba_c;
@@ -127,9 +137,9 @@ extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char r
extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
//FIXME make this dEn_c->used...
-extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
+extern "C" char handlePlayerCollisionType(dEn_c* t, ActivePhysics *apT, ActivePhysics *apO, int unk);
extern "C" void doSpriteMovement(dStageActor_c* actor);
-extern "C" int SomeStrangeModification(dStageActor_c* actor);
+extern "C" int handleTileCollision(dStageActor_c* actor);
extern "C" int CollidedWithTile(u8* c_1EC);
extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk);
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
@@ -195,8 +205,9 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
OSReport("Mario collision.\n");
//FIXME rename and make part of dStageActor_c
- char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);
+ char ret = handlePlayerCollisionType(this, apThis, apOther, 0);
if(ret == 1) { // regular jump
+ PlaySound(this, SE_EMY_KURIBO_L_SPLIT);
apOther->someFlagByte |= 2;
OSReport("ret == 1; regular jump;\n");
if(this->takeHit(1))
@@ -488,7 +499,7 @@ void daMegaGoomba_c::executeState_Shrink() {
this->scale = (Vec){modifier, modifier, modifier};
if(this->timer == 2.0)
- PlaySound(this, SE_EMY_KURIBO_L_DAMAGE_02);
+ PlaySound(this, SE_EMY_KURIBO_L_DAMAGE_03);
if (this->timer > 60.0) { doStateChange(&StateID_Walk); }
}
@@ -503,49 +514,55 @@ void daMegaGoomba_c::endState_Shrink() {
// Launch State - Launches some small goombas up in arcs
void daMegaGoomba_c::beginState_Launch() {
this->timer = 0.0;
- rot.y = 0x0;
+ this->launchTimer = 0.0;
+ this->launchCounter = 0;
+ this->rot.y = 0x0;
}
void daMegaGoomba_c::executeState_Launch() {
- if (this->timer < 120.0) {
- // 3 shakes per second, exactly 24 shakes overall
- this->rot.y = sin(this->timer * 3.14 / 5) * 4000;
-
- dStageActor_c *spawner = NULL;
- // 120ticks / 120numbers * 3cases = 3avg kuribo
- int randChoice = GenerateRandomNumber(120);
- int randChoiceX = GenerateRandomNumber(10);
- int randChoiceY = GenerateRandomNumber(7);
+ // 3 shakes per second, exactly 24 shakes overall
+ this->rot.y = sin(this->timer * 3.14 / 5) * 4000;
+
+ // {-4, -2, 2, 4} xspeed
+ // {6, 7, 7, 6}
+ //
+ // {-scale.x*8, -scale.x*4, scale.x*4, scale.x*8}
+ // {scale.y*16, scale.y*16, scale.y*16, scale.y*16}
+
+ if (launchTimer >= 39.0) {
+ PlaySound(this, SE_EMY_GESSO_JUMPOUT);
+ int randChoice = GenerateRandomNumber(4);
+ float lXSpeed = launchX[this->launchCounter];
+ float lYSpeed = launchY[this->launchCounter];
+ float xpos = this->scale.x * launchPosX[this->launchCounter] + this->pos.x;
+ float ypos = this->scale.y * 16.0 + this->pos.y;
+ Vec position = (Vec){ xpos, ypos, this->pos.z };
+ dStageActor_c* spawner;
switch(randChoice) {
case 0:
case 1:
- spawner = CreateActor(EN_KURIBO, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 5.0;
- spawner->speed.y = randChoiceY + 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
+ spawner = CreateActor(EN_KURIBO, 0, position, 0, 0);
break;
case 2:
- spawner = CreateActor(EN_BEANS_KURIBO, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 5.0;
- spawner->speed.y = randChoiceY + 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
+ spawner = CreateActor(EN_BEANS_KURIBO, 0, position, 0, 0);
break;
case 3:
- spawner = CreateActor(EN_PATA_KURIBO, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 5.0;
- spawner->speed.y = randChoiceY + 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
+ spawner = CreateActor(EN_PATA_KURIBO, 0, position, 0, 0);
break;
default:
break;
};
+ spawner->speed.x = lXSpeed;
+ spawner->speed.y = lYSpeed;
+ spawner->scale = (Vec){1.0, 1.0, 1.0};
+ launchTimer = 0.0;
+ launchCounter++;
}
-
+ launchTimer = launchTimer + 1.0;
if (this->timer > 150.0) { doStateChange(&StateID_Walk); }
this->timer = this->timer + 1.0;
}
void daMegaGoomba_c::endState_Launch() {
- //rot.y = (this->direction) ? 0xe000 : 0x2000;
}
// Jump State
@@ -603,7 +620,7 @@ void daMegaGoomba_c::executeState_Turn() {
doSpriteMovement(this);
/*this->_vf2D0(); //nullsub();*/
- int ret = SomeStrangeModification(this);
+ int ret = handleTileCollision(this);
if(ret & 1)
this->speed.y = 0.0;
@@ -630,6 +647,8 @@ void daMegaGoomba_c::beginState_Walk() {
this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed;
this->speed.y = -4.0;
this->y_speed_inc = -0.1875;
+
+ this->timer = 0.0;
}
void daMegaGoomba_c::executeState_Walk() {
/* 800345e0 - daEnLkuribo_c::executeState_Walk() */
@@ -642,9 +661,12 @@ void daMegaGoomba_c::executeState_Walk() {
u16 amt = (this->direction == 0) ? 0x2000 : 0xE000;
SmoothRotation(&this->rot.y, amt, 0x200);
/*this->_vf2D0(); //nullsub();*/
- int ret = SomeStrangeModification(this);
- if(ret & 1)
+ int ret = handleTileCollision(this);
+ if(ret & 1) {
+ if(this->speed.y != 0.0)
+ PlaySound(this, SE_PLY_LAND_YOSHI);
this->speed.y = 0.0;
+ }
u32 bitfield = *(u32*)(this->classAt1EC+0x88);
if(bitfield & (0x15<<this->direction)) {
this->pos.x = this->last_pos.x;
@@ -666,6 +688,7 @@ void daMegaGoomba_c::executeState_Walk() {
case 0:
//doStateChange(&StateID_Jump);
this->speed.y = 5.0 + (1.0 * (life - 2));
+ PlaySound(this, SE_EMY_KURIBO_M_SPLIT);
break;
case 1:
doStateChange(&StateID_Launch);
@@ -678,6 +701,11 @@ void daMegaGoomba_c::executeState_Walk() {
};
}
+ this->timer += 1.0;
+ if(this->timer == 15.0) {
+ this->timer = 0.0;
+ PlaySound(this, SE_EMY_BIG_KURIBO_WALK);
+ }
#if 0
if(CollidedWithTile(this->classAt1EC)) {
OSReport("CollidedWithTile() : true [%08x]\n", *(u32*)(this->classAt1EC+0x88));