summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-02-22 22:13:41 -0600
committerColin Noga <Tempus@chronometry.ca>2012-02-22 22:13:41 -0600
commite2bb29c4bbf36a4e45a7312943fa50c319b8bc26 (patch)
tree94398545b312561bf040baa91731cbdde2ae409b /src
parent81e992698ee5ff68b569c795d316f99ab7c1ec87 (diff)
downloadkamek-e2bb29c4bbf36a4e45a7312943fa50c319b8bc26.tar.gz
kamek-e2bb29c4bbf36a4e45a7312943fa50c319b8bc26.zip
Broken Shy Guy Commit
Diffstat (limited to 'src')
-rw-r--r--src/shyguy.cpp348
1 files changed, 305 insertions, 43 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index a81143f..f524cb9 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -10,16 +10,18 @@
// Shy Guy Settings
//
// Nybble 5: Shy Guy Types
+// 9 - Walker
// 0 - Pacing Walker
// 1 - Sleeper
// 2 - Jumper
+// 6 - Judo Master
+// 7 - Spike Thrower
// 3 - Ballooneer Horizontal
// 4 - Ballooneer Vertical
// 5 - Ballooneer Circular
-// 6 - Judo Master
-// 7 - Spike Thrower
+// 10 - Walking Giatn
// 8 - Pacing Giant
-//
+//
// Nybble 6: Colour
// 0 - Red
// 1 - Blue
@@ -58,20 +60,40 @@ class daShyGuy : public dEn_c {
m3d::anmChr_c chrAnimation;
+ int type;
int timer;
int jumpCounter;
float Baseline;
char damage;
+ char isDown;
char renderBalloon;
Vec initialPos;
int distance;
float XSpeed;
+ u32 cmgr_returnValue;
+ bool isBouncing;
static daShyGuy *build();
void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate);
void updateModelMatrices();
+ void shyCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther);
+
+
+ // void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+ void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+ void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+
+ void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther);
+ // void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther);
+ // void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther);
+ // bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther);
+
+
USING_STATES(daShyGuy);
DECLARE_STATE(Walk);
DECLARE_STATE(Turn);
@@ -84,6 +106,12 @@ class daShyGuy : public dEn_c {
DECLARE_STATE(Balloon_C);
DECLARE_STATE(Judo);
DECLARE_STATE(Spike);
+
+ DECLARE_STATE(GoDizzy);
+ DECLARE_STATE(BalloonDrop);
+ DECLARE_STATE(FireKnockBack);
+ DECLARE_STATE(FlameHit);
+ DECLARE_STATE(Recover);
};
daShyGuy *daShyGuy::build() {
@@ -91,29 +119,162 @@ daShyGuy *daShyGuy::build() {
return new(buffer) daShyGuy;
}
-extern "C" void *PlaySound(daShyGuy *, int soundID);
+///////////////////////
+// Externs and States
+///////////////////////
+ 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);
+ CREATE_STATE(daShyGuy, Balloon_V);
+ CREATE_STATE(daShyGuy, Balloon_C);
+ CREATE_STATE(daShyGuy, Judo);
+ CREATE_STATE(daShyGuy, Spike);
+
+ CREATE_STATE(daShyGuy, GoDizzy);
+ CREATE_STATE(daShyGuy, BalloonDrop);
+ CREATE_STATE(daShyGuy, FireKnockBack);
+ CREATE_STATE(daShyGuy, FlameHit);
+ CREATE_STATE(daShyGuy, Recover);
+
+////////////////////////
+// Collision Functions
+////////////////////////
+
+ // Collision callback to help shy guy not die at inappropriate times and ruin the dinner
+
+ void daShyGuy::shyCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther) {
+ if (apOther->owner->name != 89) {
+ this->collisionCallback(apThis, apOther);
+ }
+ }
+
+ // 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::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
+
+ dStateBase_c *stateVar;
+ dStateBase_c *deathState;
+
+ if (this->type < 6) { // Regular Shy Guys
+ stateVar = &StateID_GoDizzy;
+ deathState = &StateID_DieFall;
+ }
+ else if (this->type > 8) { // Giants
+ stateVar = &StateID_DieFall;
+ deathState = &StateID_DieFall;
+ }
+ else { // Ballooneers
+ stateVar = &StateID_BalloonDrop;
+ deathState = &StateID_DieFumi;
+ }
+
+ char hitType;
+ if (this->isDown == 0) {
+ hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2);
+ }
+ else { // Shy Guy is in throwy mode
+ hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0);
+ }
+
+ if(hitType == 1) { // regular jump
+ apOther->someFlagByte |= 2;
+ if (this->isDown == 0) {
+ doStateChange(stateVar);
+ }
+ else { // Shy Guy is in throwy mode - kill it with fire
+ doStateChange(deathState);
+ }
+ }
+ else if(hitType == 3) { // spinning jump or whatever?
+ apOther->someFlagByte |= 2;
+ if (this->isDown == 0) {
+ doStateChange(stateVar);
+ }
+ else { // Shy Guy is in throwy mode - kill it with fire
+ doStateChange(deathState);
+ }
+ }
+ else if(hitType == 0) {
+ this->dEn_c::playerCollision(apThis, apOther);
+ this->_vf220(apOther->owner);
+ }
+ // else if(hitType == 2) { \\ Minimario? }
+
+
+ // fix multiple player collisions via megazig
+ this->isDead = 0;
+ this->flags_4FC |= (1<<(31-7));
+ if(apOther->owner->which_player > 3) {
+ OSReport("!!!ATTENTION!!!\napOther->owner->which_player > 3\n");
+ }else{
+ this->counter_504[apOther->owner->which_player] = 0;
+ }
+ }
+
+ void daShyGuy::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
+ this->playerCollision(apThis, apOther);
+ }
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
-extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daShyGuy *, Vec pos);
+ void daShyGuy::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) {
+ doStateChange(&StateID_DieFall);
+ }
-//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);
+ void daShyGuy::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
+ doStateChange(&StateID_DieFall);
+ }
+ void daShyGuy::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
+ this->damage += 1;
-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);
-CREATE_STATE(daShyGuy, Balloon_V);
-CREATE_STATE(daShyGuy, Balloon_C);
-CREATE_STATE(daShyGuy, Judo);
-CREATE_STATE(daShyGuy, Spike);
+ dStateBase_c *stateVar;
+
+ if (this->type > 3) { // Jumpers
+ stateVar = &StateID_DieSmoke;
+ }
+ else if (this->type < 6) { // Regular Shy Guys Except Jumper
+ stateVar = &StateID_FireKnockBack;
+ }
+ else if (this->type > 8) { // Giants
+ return;
+ }
+ else { // Ballooneers
+ stateVar = &StateID_FlameHit;
+ }
+
+ if (this->damage > 2) {
+ doStateChange(&StateID_DieSmoke);
+ }
+ else {
+ doStateChange(stateVar);
+ }
+ }
+
+ // void daShyGuy::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) {
+ // doStateChange(&StateID_DieFall);
+ // }
+
+ void daShyGuy::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
+ doStateChange(&StateID_DieFall);
+ }
void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) {
@@ -125,7 +286,7 @@ void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float un
int daShyGuy::onCreate() {
- int type = this->settings >> 28 & 0xF;
+ this->type = this->settings >> 28 & 0xF;
int anim = this->settings >> 24 & 0xF;
int baln = this->settings >> 20 & 0xF;
this->distance = this->settings >> 12 & 0xF;
@@ -201,7 +362,7 @@ int daShyGuy::onCreate() {
HitMeBaby.bitfield1 = 0x4F;
HitMeBaby.bitfield2 = 0x8828E;
HitMeBaby.unkShort1C = 0;
- HitMeBaby.callback = &dEn_c::collisionCallback;
+ HitMeBaby.callback = shyCollisionCallback;
OSReport("Making the Physics Class and adding to the list\n");
this->aPhysics.initWithStruct(this, &HitMeBaby);
@@ -209,30 +370,31 @@ int daShyGuy::onCreate() {
// Tile collider
OSReport("Making the Tile collider Class\n");
- u8 struct_1[] = { 0, 0, 0, 1, 0xff, 0xff, 0x40, 0, 0, 0, 0xc0, 0, 0, 0, 0, 0 };
- u8 struct_3[] = { 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0x3f, 0x2a, 0x7e, 0xfa };
- 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;
+ _320 = 0.0f;
+ _324 = 16.0f;
+ spriteSomeRectX = 16.0f;
+ spriteSomeRectY = 16.0f;
+
+ _338 = 256.0f;
+ _33C = 256.0f;
+ _340 = 256.0f + 80.0f;
+ _344 = 256.0f + 80.0f;
- // 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;
+ static const u8 one[16] = {0x01,0x80,0x41,0x01, 0xFF,0xFF,0x80,0x00, 0x00,0x00,0x70,0x00, 0x00,0x00,0xE0,0x00};
+ static const u8 two[16] = {0x00,0x00,0x00,0x01, 0xFF,0xFF,0x80,0x00, 0x00,0x00,0x70,0x00, 0xFF,0xFF,0x20,0x00};
+ static const u8 three[16] = {0x01,0x80,0x41,0x01, 0xFF,0xFF,0x90,0x00, 0x00,0x00,0x80,0x00, 0x00,0x00,0xE0,0x00};
- // this->_518 = 2;
+ collMgr.Init(this, two, one, three);
+ collMgr.execute();
- // this->_120 |= 0x200;
- // this->_36D = 0;
- // this->_518 = 2;
+ cmgr_returnValue = collMgr.CollidedWithTile();
+
+ if (collMgr.CollidedWithTile())
+ isBouncing = false;
+ else
+ isBouncing = true;
// Stuff I do understand
@@ -805,3 +967,103 @@ void daShyGuy::updateModelMatrices() {
this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed;
}
+///////////////
+// GoDizzy State
+///////////////
+ void daShyGuy::beginState_GoDizzy() {
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_1_R", 1, 0.0, 1.0);
+
+ this->max_speed.y = -4.0;
+ this->speed.x = 0;
+ this->speed.y = -4.0;
+ this->y_speed_inc = -0.1875;
+
+ this->timer = 0;
+ this->jumpCounter = 0;
+ this->isDown = 1;
+ }
+ void daShyGuy::executeState_GoDizzy() {
+ this->HandleYSpeed();
+ this->doSpriteMovement();
+
+ // Needs tile collision shit here, because jumpers can get hit and fall downwards.
+
+ if (this->jumpCounter == 0) {
+ if(this->chrAnimation.isAnimationDone()) {
+ this->jumpCounter = 1;
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 1.0);
+ }
+ }
+
+ else {
+ if(this->chrAnimation.isAnimationDone()) {
+ this->chrAnimation.setCurrentFrame(0.0);
+ }
+
+ if (this->timer > 600) {
+ doStateChange(&StateID_Recover)
+ }
+
+ this->timer += 1;
+ }
+ }
+ void daShyGuy::endState_GoDizzy() {}
+
+///////////////
+// BalloonDrop State
+///////////////
+ void daShyGuy::beginState_BalloonDrop() {
+ this->isDown = 1;
+ }
+ void daShyGuy::executeState_BalloonDrop() {
+
+ }
+ void daShyGuy::endState_BalloonDrop() {}
+
+///////////////
+// FireKnockBack State
+///////////////
+ void daShyGuy::beginState_FireKnockBack() {
+ bindAnimChr_and_setUpdateRate("c18_C_BLOCK_BREAK_R", 1, 0.0, 1.0);
+ // this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed;
+ }
+ void daShyGuy::executeState_FireKnockBack() {
+ // move backwards here
+
+ if(this->chrAnimation.isAnimationDone()) {
+ // set state according to type
+ }
+ }
+ void daShyGuy::endState_FireKnockBack() {}
+
+///////////////
+// FlameHit State
+///////////////
+ void daShyGuy::beginState_FlameHit() {
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_4_R", 1, 0.0, 1.0);
+ }
+ void daShyGuy::executeState_FlameHit() {
+ if(this->chrAnimation.isAnimationDone()) {
+ // set state according to type
+ }
+ }
+ void daShyGuy::endState_FlameHit() {}
+
+///////////////
+// Recover State
+///////////////
+ void daShyGuy::beginState_Recover() {
+ bindAnimChr_and_setUpdateRate("c18_L_DMG_F_4_R", 1, 0.0, 1.0);
+ }
+ void daShyGuy::executeState_Recover() {
+
+ // Don't forget the tile collision shiz
+
+ if(this->chrAnimation.isAnimationDone()) {
+ // set state according to type
+ }
+ }
+ void daShyGuy::endState_Recover() {
+ this->isDown = 0;
+ }
+