From 15af665eac26f9a29b864617d571ef539a6c42b0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 2 Dec 2012 02:33:34 +0100 Subject: collisionMgr_c updated --- src/bossBombDrop.cpp | 18 +++++++++--------- src/bossKoopaThrow.cpp | 18 +++++++++--------- src/bossMegaGoomba.cpp | 13 ++++++------- src/bossPlayerClown.cpp | 12 ++++++------ src/bossSamurshai.cpp | 34 +++++++++++++++++----------------- src/bossThwompaDomp.cpp | 29 ++++++++++++++++------------- src/bossTopman.cpp | 34 +++++++++++++++++----------------- src/bossWrenchThrow.cpp | 28 ++++++++++++++-------------- src/penguin.cpp | 34 +++++++++++++++++----------------- src/shyguy.cpp | 36 ++++++++++++++++++------------------ src/topman.cpp | 35 +++++++++++++++++------------------ 11 files changed, 146 insertions(+), 145 deletions(-) (limited to 'src') diff --git a/src/bossBombDrop.cpp b/src/bossBombDrop.cpp index c12d144..da12c34 100644 --- a/src/bossBombDrop.cpp +++ b/src/bossBombDrop.cpp @@ -103,14 +103,14 @@ int dDroppedBomb::onCreate() { _324 = 20.f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); pos.z = 3300.0; @@ -161,10 +161,10 @@ int dDroppedBomb::onExecute() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); - if (collMgr.CollidedWithTile() || (collMgr.bitfield_for_checks & (0x15 << direction))) { + if (collMgr.isOnTopOfTile() || (collMgr.outputMaybe & (0x15 << direction))) { this->kill(); } diff --git a/src/bossKoopaThrow.cpp b/src/bossKoopaThrow.cpp index 85c96ca..3efcc82 100644 --- a/src/bossKoopaThrow.cpp +++ b/src/bossKoopaThrow.cpp @@ -207,14 +207,14 @@ int daKoopaThrow::onCreate() { _324 = currentInfo->size; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); if (this->direction == 0) { // Ground Facing Left @@ -297,10 +297,10 @@ void daKoopaThrow::executeState_Straight() { HandleYSpeed(); doSpriteMovement(); - // cmgr_returnValue = collMgr.CollidedWithTile(); - // collMgr.execute(); + // cmgr_returnValue = collMgr.isOnTopOfTile(); + // collMgr.calculateBelowCollisionWithSmokeEffect(); - // if (collMgr.CollidedWithTile() || (collMgr.bitfield_for_checks & (0x15 << direction))) { + // if (collMgr.isOnTopOfTile() || (collMgr.outputMaybe & (0x15 << direction))) { // // hit the ground or wall // PlaySoundAsync(this, currentInfo->breakSound); diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index a6758f4..0214f60 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -127,9 +127,6 @@ class daMegaGoomba_c : public dEn_c { // DECLARE_STATE(Outro); }; -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 daMegaGoomba_c *daMegaGoomba_c::build() { void *buffer = AllocFromGameHeap1(sizeof(daMegaGoomba_c)); @@ -316,7 +313,9 @@ void daMegaGoomba_c::setupCollision() { //POINTLESS WITH GROWTH this->scale.x = this->scale.y = this->scale.z = 0.666; - this->collMgr.Init(this, struct_1, 0, struct_3); + 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); char foo = this->_391; this->pos_delta2.x = 0.0; @@ -696,13 +695,13 @@ void daMegaGoomba_c::executeState_Walk() { int ret = SomeStrangeModification(this); if(ret & 1) this->speed.y = 0.0; - u32 bitfield = this->collMgr.bitfield_for_checks; + u32 bitfield = this->collMgr.outputMaybe; if(bitfield & (0x15<direction)) { this->pos.x = this->last_pos.x; this->doStateChange(&StateID_Turn); //this->acState.setField10ToOne(); } - u32 bitfield2 = this->collMgr.directional_bitfields[this->direction]; + u32 bitfield2 = this->collMgr.adjacentTileProps[this->direction]; if(bitfield2) { this->doStateChange(&StateID_Turn); } @@ -783,7 +782,7 @@ void daMegaGoomba_c::stunPlayers() { dStageActor_c *player = GetSpecificPlayerActor(i); if (player) { - if (player->collMgr.CollidedWithTile() && player->currentZoneID == currentZoneID) { + if (player->collMgr.isOnTopOfTile() && player->currentZoneID == currentZoneID) { stunPlayer(player, 1); playerStunned[i] = true; } diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp index 6fccee6..c760214 100644 --- a/src/bossPlayerClown.cpp +++ b/src/bossPlayerClown.cpp @@ -213,12 +213,12 @@ int daClownShot::onCreate() { _324 = 0.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); this->speed.y = 4.0; @@ -246,7 +246,7 @@ int daClownShot::onExecute() { HandleXSpeed(); HandleYSpeed(); doSpriteMovement(); - collMgr.execute(); + collMgr.calculateBelowCollisionWithSmokeEffect(); effect.spawn("Wm_en_killersmoke", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){0.7, 0.7, 0.7}); diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp index 24c8615..9ed5b9a 100644 --- a/src/bossSamurshai.cpp +++ b/src/bossSamurshai.cpp @@ -202,8 +202,8 @@ daSamurshai *daSamurshai::build() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); if (isBouncing) { stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); @@ -211,7 +211,7 @@ daSamurshai *daSamurshai::build() { isBouncing = false; } - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // Walking into a tile branch if (cmgr_returnValue == 0) @@ -223,23 +223,23 @@ daSamurshai *daSamurshai::build() { // Bouncing checks if (_34A & 4) { Vec v = (Vec){0.0f, 1.0f, 0.0f}; - collMgr.parent_speed_ptr = &v; + collMgr.pSpeed = &v; - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; - collMgr.parent_speed_ptr = &speed; + collMgr.pSpeed = &speed; } else { - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; } - collMgr.s_8006FA40(0); + collMgr.calculateAdjacentCollision(0); // Switch Direction - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - if (collMgr.CollidedWithTile()) { + if (collMgr.outputMaybe & (0x15 << direction)) { + if (collMgr.isOnTopOfTile()) { isBouncing = true; } return true; @@ -316,16 +316,16 @@ int daSamurshai::onCreate() { _324 = 18.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); - if (collMgr.CollidedWithTile()) + if (collMgr.isOnTopOfTile()) isBouncing = false; else isBouncing = true; diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp index 860fb90..1d94744 100644 --- a/src/bossThwompaDomp.cpp +++ b/src/bossThwompaDomp.cpp @@ -29,7 +29,7 @@ class daEnMegaDosun_c : public daBoss { m3d::mdl_c bodyModel; // _544 m3d::anmVis_c anmVis; // _584 - u32 collision_struct[4]; // _5BC + lineSensor_s belowSensor; float shakePosXoffset; // _5CC shakePosXoffset u16 puruMoveCounter; // _5D8 u16 shakeIndex; // _5DA 0=shake,1=normal @@ -122,10 +122,12 @@ int daEnMegaDosun_c::onCreate() { this->pos.y -= 21.0; this->pos.z = -280.0; // behind layer1 (hides spikes) - this->collision_struct[0] = 0x11804101; - this->collision_struct[1] = 0xFFFE1000; - this->collision_struct[2] = 0x0001F000; - this->collision_struct[3] = 0x00005000; + belowSensor.flags = + SENSOR_10000000 | SENSOR_1000000 | SENSOR_BREAK_BRICK | + SENSOR_BREAK_BLOCK | SENSOR_100 | SENSOR_LINE; + belowSensor.lineA = -31 << 12; + belowSensor.lineB = 31 << 12; + belowSensor.distanceFromCenter = 5 << 12; ActivePhysics::Info hm; hm.xDistToCenter = 0.0; @@ -140,9 +142,8 @@ int daEnMegaDosun_c::onCreate() { hm.callback = &dEn_c::collisionCallback; this->aPhysics.initWithStruct(this, &hm); - //u8 s3[] = {0,0,0,1,0xff,0xfe,0x10,0,0,1,0xf0,0,0,5,0x50,0}; - u8 s3[] = {0,0,0,1,0xff,0xfe,0x10,0,0,1,0xf0,0,0xff,0xfe,0x10,0}; - this->collMgr.Init(this,(u8*)&this->collision_struct,(u8*)&s3,0); + lineSensor_s aboveSensor(-31 << 12, 31 << 12, -31 << 12); + this->collMgr.init(this, &belowSensor, &aboveSensor, 0); this->pos_delta2.x = 0.0; this->pos_delta2.y = 36.0; @@ -247,7 +248,9 @@ int daEnMegaDosun_c::onDelete() { // StateID_UpWait void daEnMegaDosun_c::beginState_UpWait() { - this->collision_struct[0] = 0x11804101; + belowSensor.flags = + SENSOR_10000000 | SENSOR_1000000 | SENSOR_BREAK_BRICK | + SENSOR_BREAK_BLOCK | SENSOR_100 | SENSOR_LINE; this->timer = 0; } void daEnMegaDosun_c::executeState_UpWait() { @@ -337,7 +340,7 @@ int daEnMegaDosun_c::onDelete() { this->UpdateObjectPosBasedOnSpeedValuesReal(); //FIXME what do I do? - bottom detection - int ret = this->collMgr.execute(); + int ret = this->collMgr.calculateBelowCollisionWithSmokeEffect(); if(!ret) return; @@ -349,10 +352,10 @@ int daEnMegaDosun_c::onDelete() { PlaySoundAsync(this, SE_EMY_BIG_DOSSUN); } else { - this->collision_struct[0] = 0x00000001; + belowSensor.flags = SENSOR_LINE; this->speed.y = 0.0; ShakeScreen(ScreenPositionClass, 0, 1, 0, 0); - this->collMgr.Clear2(); + this->collMgr.clear2(); PlaySoundAsync(this, SE_EMY_BIG_DOSSUN); } @@ -388,7 +391,7 @@ int daEnMegaDosun_c::onDelete() { // StateID_UpMove void daEnMegaDosun_c::beginState_UpMove() { - this->collMgr.Clear2(); + this->collMgr.clear2(); } void daEnMegaDosun_c::executeState_UpMove() { // this->speed.y = 0.0; diff --git a/src/bossTopman.cpp b/src/bossTopman.cpp index d014d57..427682a 100644 --- a/src/bossTopman.cpp +++ b/src/bossTopman.cpp @@ -234,8 +234,8 @@ bool daDreidel::calculateTileCollisions() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); if (isBouncing) { stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); @@ -249,7 +249,7 @@ bool daDreidel::calculateTileCollisions() { else direction = 1; - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // Walking into a tile branch if (cmgr_returnValue == 0) @@ -273,23 +273,23 @@ bool daDreidel::calculateTileCollisions() { // Bouncing checks if (_34A & 4) { Vec v = (Vec){0.0f, 1.0f, 0.0f}; - collMgr.parent_speed_ptr = &v; + collMgr.pSpeed = &v; - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; - collMgr.parent_speed_ptr = &speed; + collMgr.pSpeed = &speed; } else { - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; } - collMgr.s_8006FA40(0); + collMgr.calculateAdjacentCollision(0); // Switch Direction - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - if (collMgr.CollidedWithTile()) { + if (collMgr.outputMaybe & (0x15 << direction)) { + if (collMgr.isOnTopOfTile()) { isBouncing = true; } return true; @@ -369,16 +369,16 @@ int daDreidel::onCreate() { _324 = 16.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); - if (collMgr.CollidedWithTile()) + if (collMgr.isOnTopOfTile()) isBouncing = false; else isBouncing = true; diff --git a/src/bossWrenchThrow.cpp b/src/bossWrenchThrow.cpp index 5247c62..338e3ec 100644 --- a/src/bossWrenchThrow.cpp +++ b/src/bossWrenchThrow.cpp @@ -134,14 +134,14 @@ int daWrench::onCreate() { _324 = 5.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); if (this->direction == 0) { // Ground Facing Left @@ -222,10 +222,10 @@ void daWrench::executeState_Kaboom() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // hit the ground PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); @@ -233,7 +233,7 @@ void daWrench::executeState_Kaboom() { SpawnEffect("Wm_mr_wirehit", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.25, 1.25, 1.25}); this->Delete(1); } - if (collMgr.bitfield_for_checks & (0x15 << direction)) { + if (collMgr.outputMaybe & (0x15 << direction)) { // hit the wall PlaySoundAsync(this, SE_BOSS_JR_BOMB_BURST); @@ -281,17 +281,17 @@ void daWrench::executeState_Straight() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // hit the ground PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); SpawnEffect("Wm_en_burst_s", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}); this->Delete(1); } - if (collMgr.bitfield_for_checks & (0x15 << direction)) { + if (collMgr.outputMaybe & (0x15 << direction)) { // hit the wall PlaySoundAsync(this, SE_BOSS_JR_FLOOR_BREAK); diff --git a/src/penguin.cpp b/src/penguin.cpp index 6112285..6febbae 100644 --- a/src/penguin.cpp +++ b/src/penguin.cpp @@ -166,8 +166,8 @@ bool daPengi::calculateTileCollisions() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); if (isBouncing) { stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); @@ -181,7 +181,7 @@ bool daPengi::calculateTileCollisions() { else direction = 1; - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // Walking into a tile branch if (cmgr_returnValue == 0) @@ -205,23 +205,23 @@ bool daPengi::calculateTileCollisions() { // Bouncing checks if (_34A & 4) { Vec v = (Vec){0.0f, 1.0f, 0.0f}; - collMgr.parent_speed_ptr = &v; + collMgr.pSpeed = &v; - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; - collMgr.parent_speed_ptr = &speed; + collMgr.pSpeed = &speed; } else { - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; } - collMgr.s_8006FA40(0); + collMgr.calculateAdjacentCollision(0); // Switch Direction - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - if (collMgr.CollidedWithTile()) { + if (collMgr.outputMaybe & (0x15 << direction)) { + if (collMgr.isOnTopOfTile()) { isBouncing = true; } return true; @@ -299,16 +299,16 @@ int daPengi::onCreate() { _324 = 16.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); - if (collMgr.CollidedWithTile()) + if (collMgr.isOnTopOfTile()) isBouncing = false; else isBouncing = true; diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 5a21e6c..b2eef75 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -380,8 +380,8 @@ bool daShyGuy::calculateTileCollisions() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); if (isBouncing) { stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); @@ -395,7 +395,7 @@ bool daShyGuy::calculateTileCollisions() { else direction = 1; - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // Walking into a tile branch if (cmgr_returnValue == 0) @@ -419,23 +419,23 @@ bool daShyGuy::calculateTileCollisions() { // Bouncing checks if (_34A & 4) { Vec v = (Vec){0.0f, 1.0f, 0.0f}; - collMgr.parent_speed_ptr = &v; + collMgr.pSpeed = &v; - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; - collMgr.parent_speed_ptr = &speed; + collMgr.pSpeed = &speed; } else { - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; } - collMgr.s_8006FA40(0); + collMgr.calculateAdjacentCollision(0); // Switch Direction - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - if (collMgr.CollidedWithTile()) { + if (collMgr.outputMaybe & (0x15 << direction)) { + if (collMgr.isOnTopOfTile()) { isBouncing = true; } return true; @@ -631,16 +631,16 @@ int daShyGuy::onCreate() { _324 = 16.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); - if (collMgr.CollidedWithTile()) + if (collMgr.isOnTopOfTile()) isBouncing = false; else isBouncing = true; @@ -1188,7 +1188,7 @@ void daShyGuy::updateModelMatrices() { // static const u8 three[16] = { // 0x01,0x80,0x41,0x01, 0xFF,0xFF,0x90,0x00, 0x00,0x00,0x80,0x00, 0x00,0x00,0xEF0,0x00 // }; - // spawned->collMgr.Init(spawned, two, one, three); + // spawned->collMgr.init(spawned, two, one, three); } diff --git a/src/topman.cpp b/src/topman.cpp index 56493da..0c2865a 100644 --- a/src/topman.cpp +++ b/src/topman.cpp @@ -213,8 +213,8 @@ bool daTopman::calculateTileCollisions() { HandleYSpeed(); doSpriteMovement(); - cmgr_returnValue = collMgr.CollidedWithTile(); - collMgr.execute(); + cmgr_returnValue = collMgr.isOnTopOfTile(); + collMgr.calculateBelowCollisionWithSmokeEffect(); if (isBouncing) { stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); @@ -228,7 +228,7 @@ bool daTopman::calculateTileCollisions() { else direction = 1; - if (collMgr.CollidedWithTile()) { + if (collMgr.isOnTopOfTile()) { // Walking into a tile branch if (cmgr_returnValue == 0) @@ -252,23 +252,23 @@ bool daTopman::calculateTileCollisions() { // Bouncing checks if (_34A & 4) { Vec v = (Vec){0.0f, 1.0f, 0.0f}; - collMgr.parent_speed_ptr = &v; + collMgr.pSpeed = &v; - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; - collMgr.parent_speed_ptr = &speed; + collMgr.pSpeed = &speed; } else { - if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + if (collMgr.calculateAboveCollision(collMgr.outputMaybe)) speed.y = 0.0f; } - collMgr.s_8006FA40(0); + collMgr.calculateAdjacentCollision(0); // Switch Direction - if (collMgr.bitfield_for_checks & (0x15 << direction)) { - if (collMgr.CollidedWithTile()) { + if (collMgr.outputMaybe & (0x15 << direction)) { + if (collMgr.isOnTopOfTile()) { isBouncing = true; } return true; @@ -346,17 +346,16 @@ int daTopman::onCreate() { _320 = 0.0f; _324 = 16.0f; - // These structs tell stupid collider what to collide with - these are from koopa troopa - static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; - static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; - static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0xE0,0}; + static const lineSensor_s below(12<<12, 4<<12, 0<<12); + static const pointSensor_s above(0<<12, 12<<12); + static const lineSensor_s adjacent(6<<12, 9<<12, 14<<12); - collMgr.Init(this, one, two, three); - collMgr.execute(); + collMgr.init(this, &below, &above, &adjacent); + collMgr.calculateBelowCollisionWithSmokeEffect(); - cmgr_returnValue = collMgr.CollidedWithTile(); + cmgr_returnValue = collMgr.isOnTopOfTile(); - if (collMgr.CollidedWithTile()) + if (collMgr.isOnTopOfTile()) isBouncing = false; else isBouncing = true; -- cgit v1.2.3