diff options
author | Colin Noga <Tempus@chronometry.ca> | 2013-05-09 16:41:00 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2013-05-09 16:41:00 -0500 |
commit | d5670457aa3e07e4fe2c2b9e668fb13fa13bd106 (patch) | |
tree | 3d06bfaf6868faf1a197dd68a7be7879e4148bb8 | |
parent | c739499b42c335bed7e37807c99a5c53ae9e1598 (diff) | |
download | kamek-d5670457aa3e07e4fe2c2b9e668fb13fa13bd106.tar.gz kamek-d5670457aa3e07e4fe2c2b9e668fb13fa13bd106.zip |
Shy guy improvments
-rw-r--r-- | src/shyguy.cpp | 57 |
1 files changed, 20 insertions, 37 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 2ebb3bb..0cd0608 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -89,7 +89,6 @@ 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); @@ -471,7 +470,7 @@ int daShyGuy::onCreate() { this->type = this->settings >> 28 & 0xF; int baln = this->settings >> 24 & 0xF; - this->distance = this->settings >> 12 & 0xF; + // this->distance = this->settings >> 12 & 0xF; allocator.link(-1, GameHeaps[0], 0, 0x20); @@ -558,6 +557,7 @@ int daShyGuy::onCreate() { // Shy Guy Colours if (type == 1 || type == 8 || type == 10) { this->resFile.data = getResource("shyguy", "g3d/ShyGuyBlue.brres"); + distance = 1; } else if (type == 5) { this->resFile.data = getResource("shyguy", "g3d/ShyGuyGreen.brres"); @@ -586,7 +586,7 @@ int daShyGuy::onCreate() { this->scale = (Vec){20.0, 20.0, 20.0}; - this->pos.y += 32.0; + this->pos.y += 36.0; this->rot.x = 0; // X is vertical axis this->rot.y = 0xD800; // Y is horizontal axis this->rot.z = 0; // Z is ... an axis >.> @@ -594,7 +594,7 @@ int daShyGuy::onCreate() { this->speed.x = 0.0; this->speed.y = 0.0; - this->max_speed.x = 0.8; + this->max_speed.x = 0.6; this->x_speed_inc = 0.2; this->Baseline = this->pos.y; this->XSpeed = 0.6; @@ -634,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, 12<<12, 0<<12); + static const lineSensor_s below(-0<<12, 0<<12, 0<<12); static const pointSensor_s above(0<<12, 12<<12); static const lineSensor_s adjacent(6<<12, 9<<12, 6<<12); @@ -657,7 +657,7 @@ int daShyGuy::onCreate() { } else if (type == 1) { bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5); - doStateChange(&StateID_Walk); + doStateChange(&StateID_RealWalk); } else if (type == 2) { doStateChange(&StateID_Sleep); @@ -1200,29 +1200,6 @@ 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; @@ -1235,12 +1212,13 @@ bool daShyGuy::willWalkOntoSuitableGround() { 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); - } + // if (distance) { + bool turn = collMgr.isOnTopOfTile(); + if (!turn) { + pos.x = direction ? pos.x + 1.5 : pos.x - 1.5; + doStateChange(&StateID_RealTurn); + } + // } bool ret = calculateTileCollisions(); if (ret) { @@ -1452,8 +1430,13 @@ bool daShyGuy::willWalkOntoSuitableGround() { calculateTileCollisions(); if(this->chrAnimation.isAnimationDone()) { - bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5); - doStateChange(&StateID_RealWalk); + if (type == 3) { + doStateChange(&StateID_Jump); + } + else { + bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5); + doStateChange(&StateID_RealWalk); + } } } void daShyGuy::endState_Recover() { |