summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shyguy.cpp711
1 files changed, 435 insertions, 276 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index 87c7749..69d0827 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -10,15 +10,15 @@
// Shy Guy Settings
//
// Nybble 5: Shy Guy Types
-// 0 - Walker
+// 0 - Pacing Walker
// 1 - Sleeper
// 2 - Jumper
// 3 - Ballooneer Horizontal
// 4 - Ballooneer Vertical
-// 6 - Ballooneer Circular
-// 7 - Judo Master
-// 8 - Spike Thrower
-// 9 - Giant
+// 5 - Ballooneer Circular
+// 6 - Judo Master
+// 7 - Spike Thrower
+// 8 - Pacing Giant
//
// Nybble 6: Colour
// 0 - Red
@@ -35,6 +35,9 @@
// 0 - Nothing
// 1 - ???
//
+// Nybble 9: Distance Moved
+// # - Distance for Pacing Walker, Pacing Giants, and Ballooneers
+//
// I_kinoko, I_fireflower, I_propeller_model, I_iceflower, I_star, I_penguin - model names
// anmChr - wait2
@@ -61,6 +64,8 @@ class daShyGuy : public dEn_c {
char damage;
char renderBalloon;
Vec initialPos;
+ int distance;
+ float XSpeed;
static daShyGuy *build();
@@ -70,6 +75,8 @@ class daShyGuy : public dEn_c {
USING_STATES(daShyGuy);
DECLARE_STATE(Walk);
DECLARE_STATE(Turn);
+ DECLARE_STATE(RealWalk);
+ DECLARE_STATE(RealTurn);
DECLARE_STATE(Jump);
DECLARE_STATE(Sleep);
DECLARE_STATE(Balloon_H);
@@ -84,15 +91,22 @@ daShyGuy *daShyGuy::build() {
return new(buffer) daShyGuy;
}
-
extern "C" void *PlaySound(daShyGuy *, int soundID);
extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daShyGuy *, Vec pos);
+//FIXME make this dEn_c->used...
+extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1);
+extern "C" int SomeStrangeModification(dStageActor_c* actor);
+extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk);
+extern "C" int SmoothRotation(short* rot, u16 amt, int unk2);
+
CREATE_STATE(daShyGuy, Walk);
CREATE_STATE(daShyGuy, Turn);
+CREATE_STATE(daShyGuy, RealWalk);
+CREATE_STATE(daShyGuy, RealTurn);
CREATE_STATE(daShyGuy, Jump);
CREATE_STATE(daShyGuy, Sleep);
CREATE_STATE(daShyGuy, Balloon_H);
@@ -109,12 +123,12 @@ void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float un
this->chrAnimation.setUpdateRate(rate);
}
-
int daShyGuy::onCreate() {
int type = this->settings >> 28 & 0xF;
int anim = this->settings >> 24 & 0xF;
int baln = this->settings >> 20 & 0xF;
+ this->distance = this->settings >> 12 & 0xF;
if (type == 3) {this->renderBalloon = 1;}
else if (type == 4) {this->renderBalloon = 1;}
@@ -164,7 +178,7 @@ int daShyGuy::onCreate() {
ActivePhysics::Info HitMeBaby;
- if (type == 8) {
+ if (type == 8 || type == 10) {
this->scale = (Vec){40.0, 40.0, 40.0};
HitMeBaby.xDistToCenter = 0.0;
@@ -193,17 +207,46 @@ int daShyGuy::onCreate() {
this->aPhysics.initWithStruct(this, &HitMeBaby);
this->aPhysics.addToList();
+ // Tile collider
+ OSReport("Making the Tile collider Class\n");
+ this->collMgr.Init(this, struct_1, 0, struct_3);
+
+ // // A bunch of things that I don't understand? Megazig used em. None seem to do anything
+ // char foo = this->_391;
+ // this->pos_delta2.x = 0.0;
+ // this->pos_delta2.y = 16.0;
+ // this->pos_delta2.z = 0.0;
+
+ // this->spriteSomeRectX = 32.0;
+ // this->spriteSomeRectY = 32.0;
+ // this->_320 = 0.0;
+ // this->_324 = 16.0;
+ // this->_328 = 80.0;
+ // this->_32C = 256.0;
+
+ // this->pos.z = (foo == 0) ? 1500.0 : -2500.0;
+
+ // this->_518 = 2;
+
+ // this->_120 |= 0x200;
+ // this->_36D = 0;
+ // this->_518 = 2;
+
+
+ // Stuff I do understand
OSReport("Setting up ShyGuy's Box of Goodies\n");
this->pos.y = this->pos.y + 30.0; // X is vertical axis
this->rot.x = 0; // X is vertical axis
this->rot.y = 0xD800; // Y is horizontal axis
this->rot.z = 0; // Z is ... an axis >.>
this->direction = 1; // Heading left.
- this->currentLayerID = 1;
-
+
this->speed.x = 0;
+ this->speed.y = 0.0;
+ this->x_speed_inc = 0.1;
this->Baseline = this->pos.y;
-
+ this->XSpeed = 1.0;
+
if (type == 0) {
doStateChange(&StateID_Walk);
@@ -232,6 +275,12 @@ int daShyGuy::onCreate() {
else if (type == 8) {
doStateChange(&StateID_Walk);
}
+ else if (type == 9) {
+ doStateChange(&StateID_RealWalk);
+ }
+ else if (type == 10) {
+ doStateChange(&StateID_RealWalk);
+ }
OSReport("Going to Execute ShyGuy\n");
this->onExecute();
@@ -256,7 +305,6 @@ int daShyGuy::onExecute() {
return true;
}
-
int daShyGuy::onDraw() {
bodyModel.scheduleForDrawing();
bodyModel._vf1C();
@@ -274,373 +322,484 @@ void daShyGuy::updateModelMatrices() {
bodyModel.setDrawMatrix(matrix);
bodyModel.setScale(&scale);
- bodyModel.calcWorld(true);
+ bodyModel.calcWorld(false);
if (this->renderBalloon == 1) {
matrix.translation(pos.x, pos.y - 30.0, pos.z);
balloonModel.setDrawMatrix(matrix);
balloonModel.setScale(1.5, 1.5, 1.5);
- balloonModel.calcWorld(true);
+ balloonModel.calcWorld(false);
balloonModelB.setDrawMatrix(matrix);
balloonModelB.setScale(1.5, 1.5, 1.5);
- balloonModelB.calcWorld(true);
+ balloonModelB.calcWorld(false);
}
}
+///////////////
+// Walk State
+///////////////
+ void daShyGuy::beginState_Walk() {
+ bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5);
+ this->timer = 0;
+ if (this->direction == 1) { this->rot.y = 0xD800; }
+ else { this->rot.y = 0x2800; }
+ }
+ void daShyGuy::executeState_Walk() {
-void daShyGuy::beginState_Walk() {
- bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5);
- this->timer = 0;
- if (this->direction == 1) { this->rot.y = 0xD800; }
- else { this->rot.y = 0x2800; }
-}
-void daShyGuy::executeState_Walk() {
+ if (this->direction == 1) { this->pos.x -= 0.5; }
+ else { this->pos.x += 0.5; }
- if (this->direction == 1) { this->pos.x -= 0.5; }
- else { this->pos.x += 0.5; }
+ if(this->chrAnimation.isAnimationDone())
+ if (this->timer > (this->distance * 32)) {
+ doStateChange(&StateID_Turn);
+ }
+ else {
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
- if(this->chrAnimation.isAnimationDone())
- if (this->timer > 200) {
- doStateChange(&StateID_Turn);
- }
- else {
- this->chrAnimation.setCurrentFrame(0.0);
- }
+ this->timer = this->timer + 1;
+ }
+ void daShyGuy::endState_Walk() {
+ }
- this->timer = this->timer + 1;
-}
-void daShyGuy::endState_Walk() {
-}
+///////////////
+// Turn State
+///////////////
+ void daShyGuy::beginState_Turn() {
+ bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0);
+ this->timer = 0;
+ }
+ void daShyGuy::executeState_Turn() {
-void daShyGuy::beginState_Turn() {
- bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0);
- this->timer = 0;
-}
-void daShyGuy::executeState_Turn() {
+ int modifier = sin(this->timer * 3.14 / 30.0) * 0x5000;
- int modifier = sin(this->timer * 3.14 / 30.0) * 0x5000;
+ if (this->direction == 1) { this->rot.y = 0xD800 + modifier; }
+ else { this->rot.y = 0x2800 - modifier; }
- if (this->direction == 1) { this->rot.y = 0xD800 + modifier; }
- else { this->rot.y = 0x2800 - modifier; }
+ if (this->timer >= 15) {
+ doStateChange(&StateID_Walk);
+ }
- if (this->timer >= 15) {
- doStateChange(&StateID_Walk);
+ if(this->chrAnimation.isAnimationDone()) {
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+
+ this->timer += 1;
+ }
+ void daShyGuy::endState_Turn() {
+ if (this->direction == 1) { this->direction = 0; }
+ else { this->direction = 1; }
}
- if(this->chrAnimation.isAnimationDone()) {
- this->chrAnimation.setCurrentFrame(0.0);
+///////////////
+// Jump State
+///////////////
+ void daShyGuy::beginState_Jump() {
+ this->timer = 0;
+ this->jumpCounter = 0;
}
+ void daShyGuy::executeState_Jump() {
- this->timer += 1;
-}
-void daShyGuy::endState_Turn() {
- if (this->direction == 1) { this->direction = 0; }
- else { this->direction = 1; }
-}
+ // Always face Mario
+ u8 facing = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
-void daShyGuy::beginState_Jump() {
- this->timer = 0;
- this->jumpCounter = 0;
-}
-void daShyGuy::executeState_Jump() {
+ if (facing != this->direction) {
+ this->direction = facing;
+ if (this->direction == 1) {
+ this->rot.y = 0xD800;
+ }
+ else {
+ this->rot.y = 0x2800;
+ }
+ }
- // Always face Mario
- u8 facing = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
+ // Shy Guy is on ground
+ if (this->pos.y < this->Baseline) {
- if (facing != this->direction) {
- this->direction = facing;
- if (this->direction == 1) {
- this->rot.y = 0xD800;
- }
- else {
- this->rot.y = 0x2800;
- }
- }
+ bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0);
+
+ this->timer = this->timer + 1;
- // Shy Guy is on ground
- if (this->pos.y < this->Baseline) {
+ // Make him wait for 0.5 seconds
+ if (this->timer > 30) {
- bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0);
-
- this->timer = this->timer + 1;
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
- // Make him wait for 0.5 seconds
- if (this->timer > 30) {
+ this->speed.x = 0;
+ this->speed.y = 0;
+ }
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
+ // Then Jump!
+ else {
+ if (this->jumpCounter == 3) { this->jumpCounter = 0; }
- this->speed.x = 0;
- this->speed.y = 0;
+ this->pos.y = this->Baseline + 1;
+ this->timer = 0;
+ this->jumpCounter = this->jumpCounter + 1;
+
+
+ if (this->jumpCounter == 3) {
+ bindAnimChr_and_setUpdateRate("c18_NORMAL_STEAL_R", 1, 0.0, 1.0);
+ this->speed.y = 8.0;
+ PlaySound(this, SE_PLY_JUMPDAI_HIGH);
+ }
+ else {
+ bindAnimChr_and_setUpdateRate("c18_EV_WIN_1_R", 1, 0.0, 1.0);
+ this->speed.y = 6.0;
+ PlaySound(this, SE_PLY_JUMPDAI);
+ }
+
+ OSReport("Takeoff Initiated");
+ }
}
- // Then Jump!
+ // While he's jumping, it's time for gravity.
else {
- if (this->jumpCounter == 3) { this->jumpCounter = 0; }
-
- this->pos.y = this->Baseline + 1;
- this->timer = 0;
- this->jumpCounter = this->jumpCounter + 1;
+ this->speed.y = this->speed.y - 0.15;
if (this->jumpCounter == 3) {
- bindAnimChr_and_setUpdateRate("c18_NORMAL_STEAL_R", 1, 0.0, 1.0);
- this->speed.y = 8.0;
- PlaySound(this, SE_PLY_JUMPDAI_HIGH);
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
}
else {
- bindAnimChr_and_setUpdateRate("c18_EV_WIN_1_R", 1, 0.0, 1.0);
- this->speed.y = 6.0;
- PlaySound(this, SE_PLY_JUMPDAI);
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
}
-
- OSReport("Takeoff Initiated");
}
- }
- // While he's jumping, it's time for gravity.
- else {
-
- this->speed.y = this->speed.y - 0.15;
-
- if (this->jumpCounter == 3) {
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
- }
- else {
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
- }
+ this->HandleXSpeed();
+ this->HandleYSpeed();
+ this->UpdateObjectPosBasedOnSpeedValuesReal();
+ }
+ void daShyGuy::endState_Jump() {
}
- this->HandleXSpeed();
- this->HandleYSpeed();
- this->UpdateObjectPosBasedOnSpeedValuesReal();
-}
-void daShyGuy::endState_Jump() {
-}
-
-
-void daShyGuy::beginState_Sleep() {
- bindAnimChr_and_setUpdateRate("c18_EV_LOSE_2_R", 1, 0.0, 1.0);
- this->rot.y = 0x0000;
-}
-void daShyGuy::executeState_Sleep() {
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
-}
-void daShyGuy::endState_Sleep() {
-}
-
-
+///////////////
+// Sleep State
+///////////////
+ void daShyGuy::beginState_Sleep() {
+ bindAnimChr_and_setUpdateRate("c18_EV_LOSE_2_R", 1, 0.0, 1.0);
+ this->rot.y = 0x0000;
+ }
+ void daShyGuy::executeState_Sleep() {
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+ void daShyGuy::endState_Sleep() {
+ }
-void daShyGuy::beginState_Balloon_H() {
- bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
- this->timer = 0;
- this->initialPos = this->pos;
- this->rot.x = 0xFE00;
- this->rot.y = 0;
-}
-void daShyGuy::executeState_Balloon_H() {
+///////////////
+// Balloon H State
+///////////////
+ void daShyGuy::beginState_Balloon_H() {
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
+ this->timer = 0;
+ this->initialPos = this->pos;
+ this->rot.x = 0xFE00;
+ this->rot.y = 0;
+ }
+ void daShyGuy::executeState_Balloon_H() {
- // Makes him bob up and down
- this->pos.y = this->initialPos.y + ( sin(this->timer * 3.14 / 60.0) * 6.0 );
+ // Makes him bob up and down
+ this->pos.y = this->initialPos.y + ( sin(this->timer * 3.14 / 60.0) * 6.0 );
- // Makes him move side to side
- this->pos.x = this->initialPos.x + ( sin(this->timer * 3.14 / 600.0) * 64.0 );
+ // Makes him move side to side
+ this->pos.x = this->initialPos.x + ( sin(this->timer * 3.14 / 600.0) * (float)this->distance * 8.0);
- this->timer = this->timer + 1;
+ this->timer = this->timer + 1;
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
-}
-void daShyGuy::endState_Balloon_H() {
-}
+ }
+ void daShyGuy::endState_Balloon_H() {
+ }
+///////////////
+// Balloon V State
+///////////////
+ void daShyGuy::beginState_Balloon_V() {
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
+ this->timer = 0;
+ this->initialPos = this->pos;
+ this->rot.x = 0xFE00;
+ this->rot.y = 0;
+ }
+ void daShyGuy::executeState_Balloon_V() {
+ // Makes him bob up and down
+ this->pos.x = this->initialPos.x + ( sin(this->timer * 3.14 / 60.0) * 6.0 );
+ // Makes him move side to side
+ this->pos.y = this->initialPos.y + ( sin(this->timer * 3.14 / 600.0) * (float)this->distance * 8.0 );
-void daShyGuy::beginState_Balloon_V() {
- bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
- this->timer = 0;
- this->initialPos = this->pos;
- this->rot.x = 0xFE00;
- this->rot.y = 0;
-}
-void daShyGuy::executeState_Balloon_V() {
- // Makes him bob up and down
- this->pos.x = this->initialPos.x + ( sin(this->timer * 3.14 / 60.0) * 6.0 );
+ this->timer = this->timer + 1;
- // Makes him move side to side
- this->pos.y = this->initialPos.y + ( sin(this->timer * 3.14 / 600.0) * 64.0 );
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+ void daShyGuy::endState_Balloon_V() {
+ }
- this->timer = this->timer + 1;
+///////////////
+// Balloon C State
+///////////////
+ void daShyGuy::beginState_Balloon_C() {
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
+ this->timer = 0;
+ this->initialPos = this->pos;
+ this->rot.x = 0xFE00;
+ this->rot.y = 0;
+ }
+ void daShyGuy::executeState_Balloon_C() {
+ // Makes him bob up and down
+ this->pos.x = this->initialPos.x + ( sin(this->timer * 3.14 / 600.0) * (float)this->distance * 8.0 );
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
-}
-void daShyGuy::endState_Balloon_V() {
-}
+ // Makes him move side to side
+ this->pos.y = this->initialPos.y + ( cos(this->timer * 3.14 / 600.0) * (float)this->distance * 8.0 );
+ this->timer = this->timer + 1;
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+ void daShyGuy::endState_Balloon_C() {
+ }
-void daShyGuy::beginState_Balloon_C() {
- bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
- this->timer = 0;
- this->initialPos = this->pos;
- this->rot.x = 0xFE00;
- this->rot.y = 0;
-}
-void daShyGuy::executeState_Balloon_C() {
- // Makes him bob up and down
- this->pos.x = this->initialPos.x + ( sin(this->timer * 3.14 / 600.0) * 64.0 );
+///////////////
+// Judo State
+///////////////
+ void daShyGuy::beginState_Judo() {
+ this->timer = 0;
+ }
+ void daShyGuy::executeState_Judo() {
- // Makes him move side to side
- this->pos.y = this->initialPos.y + ( cos(this->timer * 3.14 / 600.0) * 64.0 );
+ // chargin 476? 673? 760? 768? 808? 966?
+ if (this->timer == 0) { bindAnimChr_and_setUpdateRate("c18_OB_IDLE_R", 1, 0.0, 1.0); }
- this->timer = this->timer + 1;
+ this->timer = this->timer + 1;
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
-}
-void daShyGuy::endState_Balloon_C() {
-}
+ if (this->timer == 80) {
+ if (this->direction == 1) {
+ CreateEffect(&(Vec){this->pos.x + 7.0, this->pos.y + 14.0, this->pos.z + 5600.0}, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}, 966);
+ }
+ else {
+ CreateEffect(&(Vec){this->pos.x - 7.0, this->pos.y + 14.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}, 966);
+ }
+ }
-void daShyGuy::beginState_Judo() {
- this->timer = 0;
-}
-void daShyGuy::executeState_Judo() {
+ if (this->timer < 120) {
+ // Always face Mario
+ u8 facing = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
+
+ if (facing != this->direction) {
+ this->direction = facing;
+ if (this->direction == 1) {
+ this->rot.y = 0xD800;
+ }
+ else {
+ this->rot.y = 0x2800;
+ }
+ }
- if (this->timer == 0) { bindAnimChr_and_setUpdateRate("c18_OB_IDLE_R", 1, 0.0, 1.0); }
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
- this->timer = this->timer + 1;
+ else if (this->timer == 120) {
+ bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 1.0);
+
+ }
- if (this->timer < 120) {
- // Always face Mario
- u8 facing = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
+ else if (this->timer == 132) {
+ PlaySound(this, SE_EMY_CRASHER_PUNCH);
- if (facing != this->direction) {
- this->direction = facing;
- if (this->direction == 1) {
- this->rot.y = 0xD800;
+ if (this->direction == 1) {
+ CreateEffect(&(Vec){this->pos.x - 18.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 123);
+ changeActivePhysicsRect(this, 0.0, 12.0, 54.0, 12.0);
}
else {
- this->rot.y = 0x2800;
- }
+ CreateEffect(&(Vec){this->pos.x + 18.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 124);
+ changeActivePhysicsRect(this, 20.0, 12.0, 34.0, 12.0);
+ }
}
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
- }
+ else {
- else if (this->timer == 120) {
- bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 1.0);
-
+ if(this->chrAnimation.isAnimationDone()) {
+ if (this->direction == 1) {
+ CreateEffect(&(Vec){this->pos.x - 38.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 171);
+ }
+ else {
+ CreateEffect(&(Vec){this->pos.x + 38.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 171);
+ }
+
+ this->timer = 0;
+ PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
+ changeActivePhysicsRect(this, 0.0, 12.0, 14.0, 12.0);
+ }
+ }
+ }
+ void daShyGuy::endState_Judo() {
}
- else if (this->timer == 132) {
- PlaySound(this, SE_EMY_CRASHER_PUNCH);
-
- if (this->direction == 1) {
- CreateEffect(&(Vec){this->pos.x - 18.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 123);
- }
- else {
- CreateEffect(&(Vec){this->pos.x + 18.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 124);
- }
-
- changeActivePhysicsRect(this, 20.0, 12.0, 34.0, 12.0);
+///////////////
+// Spike State
+///////////////
+ void daShyGuy::beginState_Spike() {
+ this->timer = 0;
}
+ void daShyGuy::executeState_Spike() {
- else {
+ if (this->timer == 0) { bindAnimChr_and_setUpdateRate("c18_OB_IDLE_R", 1, 0.0, 1.0); }
- if(this->chrAnimation.isAnimationDone()) {
- if (this->direction == 1) {
- CreateEffect(&(Vec){this->pos.x - 38.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}, 157);
- }
- else {
- CreateEffect(&(Vec){this->pos.x + 38.0, this->pos.y + 16.0, this->pos.z}, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}, 157);
+ this->timer = this->timer + 1;
+
+ if (this->timer < 120) {
+ // Always face Mario
+ u8 facing = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
+
+ if (facing != this->direction) {
+ this->direction = facing;
+ if (this->direction == 1) {
+ this->rot.y = 0xD800;
+ }
+ else {
+ this->rot.y = 0x2800;
+ }
}
- this->timer = 0;
- PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
- changeActivePhysicsRect(this, 0.0, 12.0, 14.0, 12.0);
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
}
- }
-}
-void daShyGuy::endState_Judo() {
-}
-void daShyGuy::beginState_Spike() {
- this->timer = 0;
-}
-void daShyGuy::executeState_Spike() {
-
- if (this->timer == 0) { bindAnimChr_and_setUpdateRate("c18_OB_IDLE_R", 1, 0.0, 1.0); }
+ else if (this->timer == 120) {
+ bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0);
+
+ }
- this->timer = this->timer + 1;
+ else if (this->timer == 160) {
+ PlaySound(this, SE_EMY_KANIBO_THROW);
- if (this->timer < 120) {
- // Always face Mario
- u8 facing = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos);
+ Vec pos;
+ pos.x = this->pos.x;
+ pos.y = this->pos.y;
+ pos.z = this->pos.z;
+
+ if (this->direction == 1) {
+ dStageActor_c *spawned = CreateActor(89, 0x2, pos, 0, 0);
+ spawned->scale.x = 0.5;
+ spawned->scale.y = 0.5;
+ spawned->scale.z = 0.5;
- if (facing != this->direction) {
- this->direction = facing;
- if (this->direction == 1) {
- this->rot.y = 0xD800;
+ spawned->speed.x = -2.0;
+ spawned->speed.y = 2.0;
}
else {
- this->rot.y = 0x2800;
+ dStageActor_c *spawned = CreateActor(89, 0x12, pos, 0, 0);
+ spawned->scale.x = 0.5;
+ spawned->scale.y = 0.5;
+ spawned->scale.z = 0.5;
+
+ spawned->speed.x = 2.0;
+ spawned->speed.y = 2.0;
}
}
- if(this->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
- }
+ else {
- else if (this->timer == 120) {
- bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0);
-
+ if(this->chrAnimation.isAnimationDone()) {
+ this->timer = 0;
+ }
+ }
+ }
+ void daShyGuy::endState_Spike() {
}
- else if (this->timer == 160) {
- PlaySound(this, SE_EMY_KANIBO_THROW);
+///////////////
+// Real Walk State
+///////////////
+ void daShyGuy::beginState_RealWalk() {
+ //inline this piece of code
+ bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.5);
+ this->max_speed.y = -4.0;
+ this->speed.x = this->speed.z = 0.0;
+ this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed;
+ this->speed.y = -4.0;
+ this->y_speed_inc = -0.1875;
+ }
+ void daShyGuy::executeState_RealWalk() {
+ this->HandleXSpeed();
+ this->HandleYSpeed();
+ this->doSpriteMovement();
+
+ u16 amt = (this->direction == 0) ? 0x2800 : 0xD800;
+ SmoothRotation(&this->rot.y, amt, 0x200);
+
+ int ret = SomeStrangeModification(this);
+ if(ret & 1)
+ this->speed.y = 0.0;
+
+ u32 bitfield = this->collMgr.bitfield_for_checks;
+ if(bitfield & (0x15<<this->direction)) {
+ this->pos.x = this->last_pos.x;
+ this->doStateChange(&StateID_RealTurn);
+ }
- Vec pos;
- pos.x = this->pos.x;
- pos.y = this->pos.y;
- pos.z = this->pos.z;
-
- if (this->direction == 1) {
- dStageActor_c *spawned = CreateActor(89, 0x2, pos, 0, 0);
- spawned->scale.x = 0.5;
- spawned->scale.y = 0.5;
- spawned->scale.z = 0.5;
-
- spawned->speed.x = -2.0;
- spawned->speed.y = 2.0;
+ // collisionMgr_c ??? Seems like a useful function, not sure if it's mapped in game.h as something else, though
+
+ u32 bitfield2 = this->collMgr.directional_bitfields[this->direction];
+ if(bitfield2) {
+ this->doStateChange(&StateID_RealTurn);
}
- else {
- dStageActor_c *spawned = CreateActor(89, 0x12, pos, 0, 0);
- spawned->scale.x = 0.5;
- spawned->scale.y = 0.5;
- spawned->scale.z = 0.5;
- spawned->speed.x = 2.0;
- spawned->speed.y = 2.0;
+ DoStuffAndMarkDead(this, this->pos, 1.0);
+
+ if(this->chrAnimation.isAnimationDone()) {
+ this->chrAnimation.setCurrentFrame(0.0);
}
}
+ void daShyGuy::endState_RealWalk() { }
- else {
+///////////////
+// Real Turn State
+///////////////
+ void daShyGuy::beginState_RealTurn() {
+ bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0);
+
+ this->direction ^= 1;
+ this->speed.x = 0.0;
+ }
+ void daShyGuy::executeState_RealTurn() {
if(this->chrAnimation.isAnimationDone()) {
- this->timer = 0;
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+
+ this->HandleYSpeed();
+ this->doSpriteMovement();
+
+ int ret = SomeStrangeModification(this);
+
+ if(ret & 1)
+ this->speed.y = 0.0;
+ if(ret & 4)
+ this->pos.x = this->last_pos.x;
+ DoStuffAndMarkDead(this, this->pos, 1.0);
+
+ u16 amt = (this->direction == 0) ? 0x2800 : 0xD800;
+ int done = SmoothRotation(&this->rot.y, amt, 0x200);
+
+ if(done) {
+ this->doStateChange(&StateID_RealWalk);
}
}
-}
-void daShyGuy::endState_Spike() {
-}
+ void daShyGuy::endState_RealTurn() {
+ this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed;
+ }