diff options
author | Colin Noga <Tempus@chronometry.ca> | 2013-05-09 15:50:17 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2013-05-09 15:50:17 -0500 |
commit | 91d74e0e07f041c53a3d31beaaf1ed26ceb0195a (patch) | |
tree | c63b01a27f4080d6131f22334ecea42afd48109c /src | |
parent | fdf2ccd77bbb6e5e035f8b5e6fd041af9d28c95d (diff) | |
download | kamek-91d74e0e07f041c53a3d31beaaf1ed26ceb0195a.tar.gz kamek-91d74e0e07f041c53a3d31beaaf1ed26ceb0195a.zip |
shy guy stuff potentially
Diffstat (limited to '')
-rw-r--r-- | src/prolog.S | 2 | ||||
-rw-r--r-- | src/shyguy.cpp | 40 |
2 files changed, 38 insertions, 4 deletions
diff --git a/src/prolog.S b/src/prolog.S index c7b5a70..09aaa78 100644 --- a/src/prolog.S +++ b/src/prolog.S @@ -61,7 +61,7 @@ startLoop: .data PMsg: - .string "Newer Super Mario Bros. Wii - Hacks by Treeki and Tempus 2009-2013\nNewer Release Candidate 02 - v1011\n.ctors: %p - %p\n" + .string "Newer Super Mario Bros. Wii - Hacks by Treeki and Tempus 2009-2013\nNewer Release Candidate 04 - v1011\n.ctors: %p - %p\n" PMsg2: .string "%d inits called\n" diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 192ac7d..354f2f6 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); @@ -1195,6 +1199,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; @@ -1206,6 +1233,13 @@ void daShyGuy::updateModelMatrices() { } void daShyGuy::executeState_RealWalk() { + 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); @@ -1253,8 +1287,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; |