summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/shyguy.cpp3
-rw-r--r--src/topman.cpp28
2 files changed, 15 insertions, 16 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index c2193c7..bbae18b 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -308,8 +308,7 @@ daShyGuy *daShyGuy::build() {
if (this->type < 6) { // Regular Shy Guys Except Jumper
- if (this->pos.x < apOther->owner->pos.x) { this->backFire = 0; OSReport("Fire is to the right"); } // Fire is to the right
- else { this->backFire = 1; OSReport("Fire is to the left"); } // Fire is to the left
+ backFire = apOther->owner->direction;
if (this->isDown == 0) {
stateVar = &StateID_FireKnockBack;
diff --git a/src/topman.cpp b/src/topman.cpp
index ba784c7..66b4454 100644
--- a/src/topman.cpp
+++ b/src/topman.cpp
@@ -30,6 +30,8 @@ class daTopman : public dEn_c {
char isInSpace;
char fromBehind;
char isWaiting;
+ char backFire;
+ int directionStore;
static daTopman *build();
@@ -116,10 +118,10 @@ daTopman *daTopman::build() {
else if(hitType == 0) {
EN_LandbarrelPlayerCollision(this, apThis, apOther);
if (this->pos.x > apOther->owner->pos.x) {
- this->direction = 1;
+ this->backFire = 1;
}
else {
- this->direction = 0;
+ this->backFire = 0;
}
doStateChange(&StateID_KnockBack);
}
@@ -152,6 +154,7 @@ daTopman *daTopman::build() {
}
void daTopman::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
+ backFire = apOther->owner->direction ^ 1;
doStateChange(&StateID_KnockBack);
}
@@ -164,15 +167,17 @@ daTopman *daTopman::build() {
}
void daTopman::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){
+ backFire = apOther->owner->direction ^ 1;
doStateChange(&StateID_KnockBack);
}
void daTopman::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther){
+ backFire = apOther->owner->direction ^ 1;
doStateChange(&StateID_KnockBack);
}
void daTopman::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
- direction = apOther->owner->direction ^ 1;
+ backFire = apOther->owner->direction ^ 1;
doStateChange(&StateID_KnockBack);
}
@@ -508,8 +513,9 @@ void daTopman::updateModelMatrices() {
void daTopman::beginState_KnockBack() {
bindAnimChr_and_setUpdateRate("begoman_damage", 1, 0.0, 0.75);
- this->max_speed.x = (this->direction) ? this->XSpeed*5.0 : -this->XSpeed*5.0;
- this->speed.x = (this->direction) ? 4.0f : -4.0f;
+ directionStore = direction;
+ speed.x = (backFire) ? XSpeed*5.0f : XSpeed*-5.0f;
+ max_speed.x = speed.x;
}
void daTopman::executeState_KnockBack() {
@@ -519,22 +525,16 @@ void daTopman::updateModelMatrices() {
bodyModel._vf1C();
if(this->chrAnimation.isAnimationDone()) {
if (this->isWaiting == 0) {
+ OSReport("Done being knocked back, going back to Walk state\n");
doStateChange(&StateID_Walk); }
else {
+ OSReport("Done being knocked back, going back to Wait state\n");
doStateChange(&StateID_Wait); }
}
}
void daTopman::endState_KnockBack() {
- if (this->rot.y == 0x2800) {
-
- this->direction = 0;
- }
- else {
-
- this->direction = 1;
- }
- // this->direction ^= 1;
+ direction = directionStore;
bindAnimChr_and_setUpdateRate("begoman_wait2", 1, 0.0, 1.0);
}