diff options
Diffstat (limited to '')
-rwxr-xr-x | include/game.h | 3 | ||||
-rw-r--r-- | kamek_pal.x | 1 | ||||
-rw-r--r-- | src/prolog.S | 2 | ||||
-rw-r--r-- | src/shyguy.cpp | 40 |
4 files changed, 42 insertions, 4 deletions
diff --git a/include/game.h b/include/game.h index 0058319..7035850 100755 --- a/include/game.h +++ b/include/game.h @@ -1892,6 +1892,9 @@ class collisionMgr_c { static bool s_80075750(VEC2 *pVec);
static bool s_80075780(s16 *pAngle);
+ static bool sub_800757B0(VEC3 *vec, float *what, u8 layer, int p6, char p7);
+
+
enum SlopeTypes {
SLOPE_EDGE = 10,
SLOPE_TYPE_COUNT = 19
diff --git a/kamek_pal.x b/kamek_pal.x index 9627596..f25905d 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -1810,6 +1810,7 @@ SECTIONS { ClownDemoWaitState = 0x803580DC; spawnCoinJump__7StageE4FRC7Point3diii = 0x80066630; + sub_800757B0__14collisionMgr_cFP7Point3dPfUcic = 0x800757B0; .text : { 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; |