summaryrefslogtreecommitdiff
path: root/src/shyguy.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-02-20 15:01:44 -0600
committerColin Noga <Tempus@chronometry.ca>2012-02-20 15:01:44 -0600
commit2a5a88dfe5556e89afa33eda37309944cd8b0c01 (patch)
treee299b0343fb7e5af2675cc0af4d709b55aca3bf8 /src/shyguy.cpp
parentd776ce7cec5028eeed881f70979a5444e1cc0e65 (diff)
downloadkamek-2a5a88dfe5556e89afa33eda37309944cd8b0c01.tar.gz
kamek-2a5a88dfe5556e89afa33eda37309944cd8b0c01.zip
More shy guy updates : prototypes complete
Diffstat (limited to '')
-rw-r--r--src/shyguy.cpp221
1 files changed, 199 insertions, 22 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index c4a50a2..87c7749 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -29,12 +29,14 @@
//
// Nybble 7: Balloon Colour
// 0 - Red
-// 1 - Blue
+// 1 - Blue (not working)
//
// Nybble 8: Ballooneer Carries
// 0 - Nothing
// 1 - ???
//
+// I_kinoko, I_fireflower, I_propeller_model, I_iceflower, I_star, I_penguin - model names
+// anmChr - wait2
class daShyGuy : public dEn_c {
int onCreate();
@@ -52,12 +54,6 @@ class daShyGuy : public dEn_c {
m3d::mdl_c balloonModelB;
m3d::anmChr_c chrAnimation;
- // m3d::anmChr_c animateWalk;
- // m3d::anmChr_c animateJump;
- // m3d::anmChr_c animateSpinJump;
- // m3d::anmChr_c animateIdle;
- // m3d::anmChr_c animateSleep;
- // m3d::anmChr_c animateHover;
int timer;
int jumpCounter;
@@ -79,6 +75,8 @@ class daShyGuy : public dEn_c {
DECLARE_STATE(Balloon_H);
DECLARE_STATE(Balloon_V);
DECLARE_STATE(Balloon_C);
+ DECLARE_STATE(Judo);
+ DECLARE_STATE(Spike);
};
daShyGuy *daShyGuy::build() {
@@ -100,6 +98,8 @@ CREATE_STATE(daShyGuy, Sleep);
CREATE_STATE(daShyGuy, Balloon_H);
CREATE_STATE(daShyGuy, Balloon_V);
CREATE_STATE(daShyGuy, Balloon_C);
+CREATE_STATE(daShyGuy, Judo);
+CREATE_STATE(daShyGuy, Spike);
void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) {
@@ -117,7 +117,6 @@ int daShyGuy::onCreate() {
int baln = this->settings >> 20 & 0xF;
if (type == 3) {this->renderBalloon = 1;}
- else if (type == 0) {this->renderBalloon = 1;}
else if (type == 4) {this->renderBalloon = 1;}
else if (type == 5) {this->renderBalloon = 1;}
else {this->renderBalloon = 0;}
@@ -164,11 +163,24 @@ int daShyGuy::onCreate() {
OSReport("Creating ShyGuy's Physics Struct\n");
ActivePhysics::Info HitMeBaby;
- HitMeBaby.xDistToCenter = 0.0;
- HitMeBaby.yDistToCenter = 12.0;
- HitMeBaby.xDistToEdge = 14.0;
- HitMeBaby.yDistToEdge = 12.0;
+ if (type == 8) {
+ this->scale = (Vec){40.0, 40.0, 40.0};
+
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 24.0;
+
+ HitMeBaby.xDistToEdge = 28.0;
+ HitMeBaby.yDistToEdge = 24.0;
+ }
+
+ else {
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 12.0;
+
+ HitMeBaby.xDistToEdge = 14.0;
+ HitMeBaby.yDistToEdge = 12.0;
+ }
HitMeBaby.category1 = 0x3;
HitMeBaby.category2 = 0x0;
@@ -187,13 +199,14 @@ int daShyGuy::onCreate() {
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->Baseline = this->pos.y;
if (type == 0) {
- doStateChange(&StateID_Sleep);
+ doStateChange(&StateID_Walk);
}
else if (type == 1) {
doStateChange(&StateID_Sleep);
@@ -211,13 +224,13 @@ int daShyGuy::onCreate() {
doStateChange(&StateID_Balloon_C);
}
else if (type == 6) {
- doStateChange(&StateID_Sleep);
+ doStateChange(&StateID_Judo);
}
else if (type == 7) {
- doStateChange(&StateID_Sleep);
+ doStateChange(&StateID_Spike);
}
else if (type == 8) {
- doStateChange(&StateID_Sleep);
+ doStateChange(&StateID_Walk);
}
OSReport("Going to Execute ShyGuy\n");
@@ -279,24 +292,53 @@ void daShyGuy::updateModelMatrices() {
void daShyGuy::beginState_Walk() {
- bindAnimChr_and_setUpdateRate("c18_EV_WIN_2_R", 1, 0.0, 1.0);
+ 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->chrAnimation.isAnimationDone())
- this->chrAnimation.setCurrentFrame(0.0);
+ if (this->direction == 1) { this->pos.x -= 0.5; }
+ else { this->pos.x += 0.5; }
- this->pos.x = this->pos.x - 0.4;
+ 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() {
}
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;
+
+ if (this->direction == 1) { this->rot.y = 0xD800 + modifier; }
+ else { this->rot.y = 0x2800 - modifier; }
+
+ 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; }
}
void daShyGuy::beginState_Jump() {
@@ -362,7 +404,7 @@ void daShyGuy::executeState_Jump() {
// While he's jumping, it's time for gravity.
else {
- this->speed.y = this->speed.y - 0.12;
+ this->speed.y = this->speed.y - 0.15;
if (this->jumpCounter == 3) {
if(this->chrAnimation.isAnimationDone())
@@ -467,3 +509,138 @@ void daShyGuy::executeState_Balloon_C() {
void daShyGuy::endState_Balloon_C() {
}
+void daShyGuy::beginState_Judo() {
+ this->timer = 0;
+}
+void daShyGuy::executeState_Judo() {
+
+
+ if (this->timer == 0) { bindAnimChr_and_setUpdateRate("c18_OB_IDLE_R", 1, 0.0, 1.0); }
+
+ 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;
+ }
+ }
+
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+
+ else if (this->timer == 120) {
+ bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 1.0);
+
+ }
+
+ 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);
+ }
+
+ else {
+
+ 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 = 0;
+ PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
+ changeActivePhysicsRect(this, 0.0, 12.0, 14.0, 12.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); }
+
+ 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;
+ }
+ }
+
+ if(this->chrAnimation.isAnimationDone())
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+
+ else if (this->timer == 120) {
+ bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0);
+
+ }
+
+ else if (this->timer == 160) {
+ PlaySound(this, SE_EMY_KANIBO_THROW);
+
+ 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;
+ }
+ 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;
+ }
+ }
+
+ else {
+
+ if(this->chrAnimation.isAnimationDone()) {
+ this->timer = 0;
+ }
+ }
+}
+void daShyGuy::endState_Spike() {
+}
+