summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shyguy.cpp51
1 files changed, 33 insertions, 18 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index 0cd0608..cd412b9 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -58,7 +58,6 @@ class daShyGuy : public dEn_c {
mEf::es2 effect;
-
int timer;
int jumpCounter;
int baln;
@@ -78,6 +77,7 @@ class daShyGuy : public dEn_c {
int directionStore;
dStageActor_c *spikeA;
dStageActor_c *spikeB;
+ bool stillFalling;
StandOnTopCollider giantRider;
ActivePhysics Chuckles;
@@ -90,7 +90,7 @@ class daShyGuy : public dEn_c {
void updateModelMatrices();
bool calculateTileCollisions();
- // void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+ void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);
void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -181,12 +181,12 @@ daShyGuy *daShyGuy::build() {
// Collision Functions
////////////////////////
-bool actorCanPopBalloon(dStageActor_c *ac) {
- int n = ac->name;
- return n == PLAYER || n == YOSHI ||
- n == PL_FIREBALL || n == ICEBALL ||
- n == YOSHI_FIRE || n == HAMMER;
-}
+ bool actorCanPopBalloon(dStageActor_c *ac) {
+ int n = ac->name;
+ return n == PLAYER || n == YOSHI ||
+ n == PL_FIREBALL || n == ICEBALL ||
+ n == YOSHI_FIRE || n == HAMMER;
+ }
// Collision callback to help shy guy not die at inappropriate times and ruin the dinner
void shyCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther) {
@@ -214,10 +214,18 @@ bool actorCanPopBalloon(dStageActor_c *ac) {
}
}
- // spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
- // if (apThis->owner->shyGuyState == #notPickupable) { Do Normal Things; }
- // else { Shy Guy is in throwy mode, and should kill enemies instead; }
- // }
+ void daShyGuy::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
+ if (acState.getCurrentState() == &StateID_RealWalk) {
+ pos.x = direction ? pos.x + 1.5 : pos.x - 1.5;
+ doStateChange(&StateID_RealTurn); }
+
+ if (acState.getCurrentState() == &StateID_FireKnockBack) {
+ float distance = pos.x - ((dEn_c*)apOther->owner)->pos.x;
+ pos.x = pos.x + (distance / 4.0);
+ }
+
+ dEn_c::spriteCollision(apThis, apOther);
+ }
void daShyGuy::popBalloon() {
doStateChange(&StateID_BalloonDrop);
@@ -472,6 +480,8 @@ int daShyGuy::onCreate() {
int baln = this->settings >> 24 & 0xF;
// this->distance = this->settings >> 12 & 0xF;
+ stillFalling = 0;
+
allocator.link(-1, GameHeaps[0], 0, 0x20);
this->deleteForever = 1;
@@ -1212,13 +1222,16 @@ void daShyGuy::updateModelMatrices() {
void daShyGuy::executeState_RealWalk() {
chrAnimation.setUpdateRate(1.5f);
- // if (distance) {
+ if (distance) {
bool turn = collMgr.isOnTopOfTile();
if (!turn) {
- pos.x = direction ? pos.x + 1.5 : pos.x - 1.5;
- doStateChange(&StateID_RealTurn);
+ if (!stillFalling) {
+ stillFalling = 1;
+ pos.x = direction ? pos.x + 1.5 : pos.x - 1.5;
+ doStateChange(&StateID_RealTurn); }
}
- // }
+ else { stillFalling = 0; }
+ }
bool ret = calculateTileCollisions();
if (ret) {
@@ -1389,8 +1402,10 @@ void daShyGuy::updateModelMatrices() {
this->speed.x = this->speed.x / 1.02f;
if(this->chrAnimation.isAnimationDone()) {
- bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5);
- doStateChange(&StateID_RealWalk);
+ if (aPhysics.result1 == 0 && aPhysics.result2 == 0 && aPhysics.result3 == 0) {
+ bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5);
+ doStateChange(&StateID_RealWalk);
+ }
}
}
void daShyGuy::endState_FireKnockBack() {