summaryrefslogtreecommitdiff
path: root/src
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
parentd776ce7cec5028eeed881f70979a5444e1cc0e65 (diff)
downloadkamek-2a5a88dfe5556e89afa33eda37309944cd8b0c01.tar.gz
kamek-2a5a88dfe5556e89afa33eda37309944cd8b0c01.zip
More shy guy updates : prototypes complete
Diffstat (limited to 'src')
-rw-r--r--src/player.cpp19
-rw-r--r--src/player.h1
-rw-r--r--src/shyguy.cpp221
3 files changed, 219 insertions, 22 deletions
diff --git a/src/player.cpp b/src/player.cpp
index d5c54aa..58960cc 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -56,4 +56,23 @@ void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) {
actor->aPhysics.addToList();
}
+void changeActivePhysicsRect(dStageActor_c* actor, float xc, float yc, float xe, float ye) {
+ ActivePhysics::Info info;
+ info.xDistToCenter = xc;
+ info.yDistToCenter = yc;
+ info.xDistToEdge = xe;
+ info.yDistToEdge = ye;
+
+ info.category1 = actor->aPhysics.info.category1;
+ info.category2 = actor->aPhysics.info.category2;
+ info.bitfield1 = actor->aPhysics.info.bitfield1;
+ info.bitfield2 = actor->aPhysics.info.bitfield2;
+ info.unkShort1C = actor->aPhysics.info.unkShort1C;
+ info.callback = actor->aPhysics.info.callback;
+
+ //OSReport("Making new Physics Class and adding to the list\n");
+ actor->aPhysics.removeFromList();
+ actor->aPhysics.initWithStruct(actor, &info);
+ actor->aPhysics.addToList();
+}
diff --git a/src/player.h b/src/player.h
index 4e036ae..267729f 100644
--- a/src/player.h
+++ b/src/player.h
@@ -7,6 +7,7 @@
extern "C" dStageActor_c* GetSpecificPlayerActor(int number);
char NearestPlayer(dStageActor_c* actor);
void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale);
+void changeActivePhysicsRect(dStageActor_c* actor, float xc, float yc, float xe, float ye);
#endif
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() {
+}
+