From fb2694aec8d0744ad3e407eb67b62e56c3b8cdd2 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Sat, 1 Jun 2013 16:49:34 -0500 Subject: Minor shy guy fix for ice block detection --- src/shyguy.cpp | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 32928c0..140501a 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -657,7 +657,7 @@ int daShyGuy::onCreate() { _324 = 16.0f; // These structs tell stupid collider what to collide with - these are from koopa troopa - static const lineSensor_s below(-6<<12, 6<<12, 0<<12); + static const lineSensor_s below(-5<<12, 5<<12, 0<<12); static const pointSensor_s above(0<<12, 12<<12); static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); @@ -1227,17 +1227,36 @@ bool daShyGuy::willWalkOntoSuitableGround() { void daShyGuy::executeState_RealWalk() { chrAnimation.setUpdateRate(1.5f); + // if (distance) { + // // What the fuck. Somehow, having this code makes the shyguy not + // // fall through solid-on-top platforms... + // bool turn = collMgr.isOnTopOfTile(); + // if (!turn) { + // if (!stillFalling) { + // stillFalling = true; + // pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; + // doStateChange(&StateID_RealTurn); + // } + // } else + // } + + if (distance) { - // What the fuck. Somehow, having this code makes the shyguy not - // fall through solid-on-top platforms... - bool turn = collMgr.isOnTopOfTile(); - if (!turn) { + if (collMgr.isOnTopOfTile()) { + stillFalling = false; + + if (!willWalkOntoSuitableGround()) { + pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; + doStateChange(&StateID_RealTurn); + } + } + else { if (!stillFalling) { stillFalling = true; pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; doStateChange(&StateID_RealTurn); } - } else stillFalling = false; + } } bool ret = calculateTileCollisions(); @@ -1245,15 +1264,6 @@ bool daShyGuy::willWalkOntoSuitableGround() { doStateChange(&StateID_RealTurn); } - if (distance) { - if (collMgr.isOnTopOfTile()) { - if (!willWalkOntoSuitableGround()) { - pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; - doStateChange(&StateID_RealTurn); - } - } - } - if(this->chrAnimation.isAnimationDone()) { this->chrAnimation.setCurrentFrame(0.0); } -- cgit v1.2.3