summaryrefslogtreecommitdiff
path: root/src/shyguy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/shyguy.cpp')
-rw-r--r--src/shyguy.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index ae1bc03..2ebb3bb 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -89,6 +89,7 @@ class daShyGuy : public dEn_c {
void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate);
void updateModelMatrices();
bool calculateTileCollisions();
+ bool willWalkOntoSuitableGround();
// void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);
void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -154,6 +155,9 @@ daShyGuy *daShyGuy::build() {
extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
// extern "C" void addToList(StandOnTopCollider *self);
+ extern "C" bool HandlesEdgeTurns(dEn_c* actor);
+
+
CREATE_STATE(daShyGuy, Walk);
CREATE_STATE(daShyGuy, Turn);
CREATE_STATE(daShyGuy, RealWalk);
@@ -630,7 +634,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(12<<12, 4<<12, 0<<12);
+ static const lineSensor_s below(-12<<12, 12<<12, 0<<12);
static const pointSensor_s above(0<<12, 12<<12);
static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12);
@@ -1196,6 +1200,29 @@ void daShyGuy::updateModelMatrices() {
///////////////
// Real Walk State
///////////////
+bool daShyGuy::willWalkOntoSuitableGround() {
+ static const float deltas[] = {2.5f, -2.5f};
+ VEC3 checkWhere = {
+ pos.x + deltas[direction],
+ 2.0f + pos.y,
+ pos.z};
+
+ u32 props = collMgr.getTileBehaviour2At(checkWhere.x, checkWhere.y, currentLayerID);
+
+ //if (getSubType(props) == B_SUB_LEDGE)
+ if (((props >> 16) & 0xFF) == 8)
+ return false;
+
+ float someFloat = 0.0f;
+ if (collMgr.sub_800757B0(&checkWhere, &someFloat, currentLayerID, 1, -1)) {
+ if (someFloat < checkWhere.y && someFloat > (pos.y - 2.0f))
+ return true;
+ }
+
+ return false;
+}
+
+
void daShyGuy::beginState_RealWalk() {
//inline this piece of code
this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed;
@@ -1208,6 +1235,13 @@ void daShyGuy::updateModelMatrices() {
void daShyGuy::executeState_RealWalk() {
chrAnimation.setUpdateRate(1.5f);
+ bool turne = this->willWalkOntoSuitableGround();
+ // bool turne = collMgr.isOnTopOfTile();
+ if (!turne) {
+ // pos.x = direction ? pos.x + 1.5 : pos.x - 1.5;
+ doStateChange(&StateID_RealTurn);
+ }
+
bool ret = calculateTileCollisions();
if (ret) {
doStateChange(&StateID_RealTurn);
@@ -1255,8 +1289,8 @@ void daShyGuy::updateModelMatrices() {
this->speed.x = 0;
this->x_speed_inc = 0;
- this->max_speed.y = -2.0;
- this->speed.y = -2.0;
+ this->max_speed.y = -4.0;
+ this->speed.y = -4.0;
this->y_speed_inc = -0.1875;
this->timer = 0;