summaryrefslogtreecommitdiff
path: root/src/bossMegaGoomba.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/bossMegaGoomba.cpp198
1 files changed, 153 insertions, 45 deletions
diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp
index 0214f60..cd20c4d 100644
--- a/src/bossMegaGoomba.cpp
+++ b/src/bossMegaGoomba.cpp
@@ -12,37 +12,8 @@ const char* MGarcNameList [] = {
NULL
};
-//Enable this if you're fixing it
-void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) {
- float amtX = scale->x;
- float amtY = scale->y;
-
- // 0, 20.0, 18.0, 20.0
- ActivePhysics::Info info;
- // info.xDistToCenter = 0.0;
- // info.yDistToCenter = 7.65 * amtY;
- // info.xDistToEdge = 8.0 * amtX;
- // info.yDistToEdge = 8.7 * amtY;
-
- info.xDistToCenter = 0.0;
- info.yDistToCenter = 22.0 * amtY;
- info.xDistToEdge = 18.0 * amtX;
- info.yDistToEdge = 24.0 * amtY;
-
- info.category1 = actor->aPhysics.info.category1;
- info.category2 = actor->aPhysics.info.category2;
- info.bitfield1 = actor->aPhysics.info.bitfield1;
- info.bitfield2 = actor->aPhysics.info.bitfield2;
- info.unkShort1C = actor->aPhysics.info.unkShort1C;
- info.callback = actor->aPhysics.info.callback;
-
- //OSReport("Making new Physics Class and adding to the list\n");
- actor->aPhysics.removeFromList();
- actor->aPhysics.initWithStruct(actor, &info);
- actor->aPhysics.addToList();
-}
-
class daMegaGoomba_c : public dEn_c {
+ public:
int onCreate();
int onDelete();
int onExecute();
@@ -55,7 +26,13 @@ class daMegaGoomba_c : public dEn_c {
float timer;
float dying;
-
+
+ lineSensor_s belowSensor;
+ pointSensor_s adjacentSensor;
+
+ ActivePhysics leftTrapAPhysics, rightTrapAPhysics;
+ ActivePhysics stalkAPhysics;
+
HermiteKey keysX[0x10];
unsigned int Xkey_count;
HermiteKey keysY[0x10];
@@ -90,6 +67,9 @@ class daMegaGoomba_c : public dEn_c {
bool playerStunned[4];
+ void removeMyActivePhysics();
+ void addMyActivePhysics();
+
// bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);
// bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
// bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -115,6 +95,10 @@ class daMegaGoomba_c : public dEn_c {
void _vf110(ActivePhysics *apThis, ActivePhysics *apOther);
void _vf108(ActivePhysics *apThis, ActivePhysics *apOther);
+ void dieOther_Begin();
+ void dieOther_Execute();
+ void dieOther_End();
+
USING_STATES(daMegaGoomba_c);
// DECLARE_STATE(Grow);
DECLARE_STATE(Shrink);
@@ -134,6 +118,89 @@ daMegaGoomba_c *daMegaGoomba_c::build() {
}
+void daMegaGoomba_c::removeMyActivePhysics() {
+ aPhysics.removeFromList();
+ stalkAPhysics.removeFromList();
+ leftTrapAPhysics.removeFromList();
+ rightTrapAPhysics.removeFromList();
+}
+
+void daMegaGoomba_c::addMyActivePhysics() {
+ aPhysics.addToList();
+ stalkAPhysics.addToList();
+ leftTrapAPhysics.addToList();
+ rightTrapAPhysics.addToList();
+}
+
+
+void setNewActivePhysicsRect(daMegaGoomba_c *actor, Vec *scale) {
+ float amtX = scale->x * 0.5f;
+ float amtY = scale->y * 0.5f;
+
+ actor->belowSensor.flags = SENSOR_LINE;
+ actor->belowSensor.lineA = s32((amtX * -28.0f) * 4096.0f);
+ actor->belowSensor.lineB = s32((amtX * 28.0f) * 4096.0f);
+ actor->belowSensor.distanceFromCenter = s32((amtY * 4) * 4096.0f);
+
+ actor->adjacentSensor.flags = SENSOR_POINT;
+ actor->adjacentSensor.x = s32((amtX * 32.0f) * 4096.0f);
+ actor->adjacentSensor.y = s32((amtY * 22.0f) * 4096.0f);
+
+ // 0, 20.0, 18.0, 20.0
+ ActivePhysics::Info info;
+ // info.xDistToCenter = 0.0;
+ // info.yDistToCenter = 7.65 * amtY;
+ // info.xDistToEdge = 8.0 * amtX;
+ // info.yDistToEdge = 8.7 * amtY;
+
+ info.xDistToCenter = 0.0f;
+ info.yDistToCenter = 57.0f * amtY;
+ info.xDistToEdge = 14.0f * amtX;
+ info.yDistToEdge = 32.0f * amtY;
+
+ info.category1 = actor->aPhysics.info.category1;
+ info.category2 = actor->aPhysics.info.category2;
+ info.bitfield1 = actor->aPhysics.info.bitfield1;
+ info.bitfield2 = actor->aPhysics.info.bitfield2;
+ info.unkShort1C = actor->aPhysics.info.unkShort1C;
+ info.callback = actor->aPhysics.info.callback;
+
+ /*actor->aPhysics.trpValue0 = amtX * -12.0f;
+ actor->aPhysics.trpValue1 = amtX * 12.0f;
+ actor->aPhysics.trpValue2 = amtX * -48.0f;
+ actor->aPhysics.trpValue3 = amtX * 48.0f;*/
+
+ actor->aPhysics.initWithStruct(actor, &info);
+
+ // Original trapezium was -12,12 to -48,48
+ ActivePhysics::Info left = {
+ amtX*-28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f,
+ 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback};
+ actor->leftTrapAPhysics.initWithStruct(actor, &left);
+ actor->leftTrapAPhysics.trpValue0 = amtX * 14.0f;
+ actor->leftTrapAPhysics.trpValue1 = amtX * 14.0f;
+ actor->leftTrapAPhysics.trpValue2 = amtX * -14.0f;
+ actor->leftTrapAPhysics.trpValue3 = amtX * 14.0f;
+ actor->leftTrapAPhysics.collisionCheckType = 3;
+
+ ActivePhysics::Info right = {
+ amtX*28.0f, amtY*56.0f, amtX*14.0f, amtY*31.0f,
+ 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback};
+ actor->rightTrapAPhysics.initWithStruct(actor, &right);
+ actor->rightTrapAPhysics.trpValue0 = amtX * -14.0f;
+ actor->rightTrapAPhysics.trpValue1 = amtX * -14.0f;
+ actor->rightTrapAPhysics.trpValue2 = amtX * -14.0f;
+ actor->rightTrapAPhysics.trpValue3 = amtX * 14.0f;
+ actor->rightTrapAPhysics.collisionCheckType = 3;
+
+ ActivePhysics::Info stalk = {
+ 0.0f, amtY*12.0f, amtX*28.0f, amtY*12.0f,
+ 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback};
+ actor->stalkAPhysics.initWithStruct(actor, &stalk);
+
+}
+
+
//FIXME make this dEn_c->used...
extern "C" int SomeStrangeModification(dStageActor_c* actor);
extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk);
@@ -151,6 +218,7 @@ CREATE_STATE(daMegaGoomba_c, Turn);
//TODO better fix for possible bug with sign (ex. life=120; count=-9;)
bool daMegaGoomba_c::takeHit(char count) {
+ OSReport("Taking a hit!\n");
if(!this->already_hit) {
int c = count;
int l = this->life;
@@ -188,6 +256,10 @@ void daMegaGoomba_c::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOth
#endif
}
void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
+ if (apThis == &stalkAPhysics) {
+ dEn_c::playerCollision(apThis, apOther);
+ return;
+ }
/* * * * * * * * * * * * * * * * * * * * *
* 0=normal??,1=dontHit,2=dontKill
@@ -209,10 +281,17 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
//char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);
char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2);
+// OSReport("I hate my life: %d\n", ret);
if(ret == 1) { // regular jump
apOther->someFlagByte |= 2;
- if(this->takeHit(1))
- doStateChange(&StateID_DieFall);
+ if(this->takeHit(1)) {
+ // kill me
+ VEC2 eSpeed = {speed.x, speed.y};
+ OSReport("I'M DYING\n");
+ OSReport("State: %s\n", acState.getCurrentState()->getName());
+ killWithSpecifiedState(apOther->owner, &eSpeed, &dEn_c::StateID_DieOther);
+ OSReport("State: %s\n", acState.getCurrentState()->getName());
+ }
} else if(ret == 3) { // spinning
apOther->someFlagByte |= 2;
if(this->takeHit(1))
@@ -224,10 +303,7 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth
} else {
}
- //FIXME hack to make multiple playerCollisions work
- this->isDead = 0;
- this->flags_4FC |= (1<<(31-7));
- this->counter_504[apOther->owner->which_player] = 0;
+ //this->flags_4FC |= (1<<(31-7));
}
void daMegaGoomba_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) {
OSReport("Ground Pounded");
@@ -242,10 +318,7 @@ void daMegaGoomba_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePh
// EN_LandbarrelPlayerCollision(this, apThis, apOther);
// mario->speed.x += 16.0;
-
- this->isDead = 0;
- this->flags_4FC |= (1<<(31-7));
- this->counter_504[apOther->owner->which_player] = 0;
+ //this->flags_4FC |= (1<<(31-7));
}
void daMegaGoomba_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {}
bool daMegaGoomba_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; }
@@ -313,9 +386,7 @@ void daMegaGoomba_c::setupCollision() {
//POINTLESS WITH GROWTH
this->scale.x = this->scale.y = this->scale.z = 0.666;
- static const lineSensor_s below(-12 << 12, 12 << 12, 0);
- static const pointSensor_s adjacent(16 << 12, 16 << 12);
- this->collMgr.init(this, &below, 0, &adjacent);
+ this->collMgr.init(this, &belowSensor, 0, &adjacentSensor);
char foo = this->_391;
this->pos_delta2.x = 0.0;
@@ -360,13 +431,25 @@ int daMegaGoomba_c::onCreate() {
hm.yDistToEdge = 12.0;
hm.category1 = 0x3;
hm.category2 = 0x0;
- hm.bitfield1 = 0x4f;
+ hm.bitfield1 = 0x6f;
hm.bitfield2 = 0xffbafffe;
hm.unkShort1C = 0;
hm.callback = &dEn_c::collisionCallback;
this->aPhysics.initWithStruct(this, &hm);
this->aPhysics.addToList();
+ ActivePhysics::Info stalk = {
+ 0.0f, 24.0f, 32.0f, 22.0f,
+ 3, 0, 0x6f, 0xffbafffe, 0, &dEn_c::collisionCallback};
+ stalkAPhysics.initWithStruct(this, &stalk);
+ stalkAPhysics.addToList();
+
+ // for dummy purposes, we'll replace the info later
+ leftTrapAPhysics.initWithStruct(this, &stalk);
+ leftTrapAPhysics.addToList();
+ rightTrapAPhysics.initWithStruct(this, &stalk);
+ rightTrapAPhysics.addToList();
+
this->_120 |= 0x200;
this->_36D = 0;
@@ -404,6 +487,8 @@ int daMegaGoomba_c::onDelete() {
}
int daMegaGoomba_c::onExecute() {
+ // what state am I in?
+// OSReport("State for %p: %s\n", this, acState.getCurrentState()->getName());
//80033450
acState.execute();
//if(CheckSomethingEnemyRelated()) // checks class1EC bitfield
@@ -411,6 +496,7 @@ int daMegaGoomba_c::onExecute() {
//else
// dStageActor_c__checkZoneBoundaries(this, 0);
//// dont do updateModelMatrices ////
+ checkZoneBoundaries(0);
updateModelMatrices();
@@ -799,3 +885,25 @@ void daMegaGoomba_c::unstunPlayers() {
}
}
+
+
+void daMegaGoomba_c::dieOther_Begin() {
+ animationChr.bind(&bodyModel, resFile.GetResAnmChr("damage"), true);
+ bodyModel.bindAnim(&animationChr, 2.0f);
+ speed.x = speed.y = speed.z = 0.0f;
+ removeMyActivePhysics();
+
+ rot.y = 0;
+ counter_500 = 60;
+}
+
+void daMegaGoomba_c::dieOther_End() {
+ dEn_c::dieOther_End();
+}
+
+void daMegaGoomba_c::dieOther_Execute() {
+ bodyModel._vf1C();
+ if (counter_500 == 0)
+ Delete(1);
+}
+