summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-02-25 16:32:04 -0600
committerColin Noga <Tempus@chronometry.ca>2012-02-25 16:32:04 -0600
commitbd84055f01015239ad297fec687565976f592edd (patch)
treed4778fe78648b20fc0cd128a1646eb35cfce36d4 /src
parent19f953a58e91cf6b46257a8c05c1082378917a22 (diff)
downloadkamek-bd84055f01015239ad297fec687565976f592edd.tar.gz
kamek-bd84055f01015239ad297fec687565976f592edd.zip
Shy guys almost there
Diffstat (limited to '')
-rw-r--r--src/shyguy.cpp330
1 files changed, 261 insertions, 69 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp
index 378a220..9955404 100644
--- a/src/shyguy.cpp
+++ b/src/shyguy.cpp
@@ -22,28 +22,16 @@
// 9 - Walking Giant
// 10 - Pacing Giant
//
-// Nybble 6: Colour
-// 0 - Red
-// 1 - Blue
-// 2 - Green
-// 3 - Cyan
-// 4 - Purple
-//
-// Nybble 7: Balloon Colour
-// 0 - Red
-// 1 - Blue (not working)
-//
-// Nybble 8: Ballooneer Carries
-// 0 - Nothing
-// 1 - ???
-//
// Nybble 9: Distance Moved
// # - Distance for Pacing Walker, Pacing Giants, and Ballooneers
//
+// If I add items in the balloons....
// I_kinoko, I_fireflower, I_propeller_model, I_iceflower, I_star, I_penguin - model names
// anmChr - wait2
void shyCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther);
+void ChucklesAndKnuckles(ActivePhysics *apThis, ActivePhysics *apOther);
+void balloonSmack(ActivePhysics *apThis, ActivePhysics *apOther);
class daShyGuy : public dEn_c {
int onCreate();
@@ -55,16 +43,20 @@ class daShyGuy : public dEn_c {
nw4r::g3d::ResFile resFile;
nw4r::g3d::ResFile anmFile;
nw4r::g3d::ResFile balloonFile;
+ // nw4r::g3d::ResFile carryFile;
m3d::mdl_c bodyModel;
m3d::mdl_c balloonModel;
m3d::mdl_c balloonModelB;
+ // m3d::mdl_c carryModel;
m3d::anmChr_c chrAnimation;
+ // m3d::anmChr_c carryAnm;
int type;
int timer;
int jumpCounter;
+ int baln;
float dying;
float Baseline;
char damage;
@@ -76,16 +68,21 @@ class daShyGuy : public dEn_c {
u32 cmgr_returnValue;
bool isBouncing;
float balloonSize;
+ char spikeTurn;
+ dStageActor_c *spikeA;
+ dStageActor_c *spikeB;
RideableActorCollider giantRider;
-
+ ActivePhysics Chuckles;
+ ActivePhysics Knuckles;
+ ActivePhysics balloonPhysics;
static daShyGuy *build();
void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate);
void updateModelMatrices();
bool calculateTileCollisions();
-
+
// void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther);
void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -99,7 +96,10 @@ class daShyGuy : public dEn_c {
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);
+ void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther);
+ void _vf148();
+ void _vf14C();
USING_STATES(daShyGuy);
DECLARE_STATE(Walk);
@@ -121,6 +121,8 @@ class daShyGuy : public dEn_c {
DECLARE_STATE(Recover);
DECLARE_STATE(Die);
+
+ public: void popBalloon();
};
daShyGuy *daShyGuy::build() {
@@ -131,7 +133,7 @@ daShyGuy *daShyGuy::build() {
///////////////////////
// Externs and States
///////////////////////
- extern "C" void *PlaySound(daShyGuy *, int soundID);
+ extern "C" void *PlaySound(dStageActor_c *, 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);
@@ -176,11 +178,25 @@ daShyGuy *daShyGuy::build() {
}
}
+ void ChucklesAndKnuckles(ActivePhysics *apThis, ActivePhysics *apOther) {
+ ((dEn_c*)apThis->owner)->_vf220(apOther->owner);
+ }
+
+ void balloonSmack(ActivePhysics *apThis, ActivePhysics *apOther) {
+ if (((daShyGuy*)apThis->owner)->frzMgr._mstate == 0) {
+ ((daShyGuy*)apThis->owner)->popBalloon();
+ }
+ }
+
// 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::popBalloon() {
+ doStateChange(&StateID_BalloonDrop);
+ }
+
void daShyGuy::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
dStateBase_c *stateVar;
@@ -265,6 +281,10 @@ daShyGuy *daShyGuy::build() {
doStateChange(&StateID_Die);
}
+ void daShyGuy::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){
+ doStateChange(&StateID_Die);
+ }
+
void daShyGuy::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther){
doStateChange(&StateID_DieSmoke);
}
@@ -297,6 +317,16 @@ daShyGuy *daShyGuy::build() {
// doStateChange(&StateID_DieFall);
// }
+ // These handle the ice crap
+ void daShyGuy::_vf148() {
+ dEn_c::_vf148();
+ doStateChange(&StateID_Die);
+ }
+ void daShyGuy::_vf14C() {
+ dEn_c::_vf14C();
+ doStateChange(&StateID_Die);
+ }
+
void daShyGuy::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
doStateChange(&StateID_Die);
}
@@ -381,43 +411,110 @@ void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float un
int daShyGuy::onCreate() {
this->type = this->settings >> 28 & 0xF;
- int anim = this->settings >> 24 & 0xF;
- int baln = this->settings >> 20 & 0xF;
+ int baln = this->settings >> 24 & 0xF;
this->distance = this->settings >> 12 & 0xF;
- if (type == 6) {this->renderBalloon = 1;}
- else if (type == 7) {this->renderBalloon = 1;}
- else if (type == 8) {this->renderBalloon = 1;}
- else {this->renderBalloon = 0;}
-
OSReport("Creating the ShyGuy Model\n");
allocator.link(-1, GameHeaps[0], 0, 0x20);
- // Shy Guy Colours
- if (anim == 0) {
- this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyRed.brres");
+
+ // Balloon Specifics
+ if (type == 6 || type == 7 || type == 8) {
+ this->renderBalloon = 1;
+
+ this->balloonFile.data = getResource("lemmy_ball", "g3d/balloon.brres");
+ nw4r::g3d::ResMdl mdlB = this->balloonFile.GetResMdl("ballon");
+ balloonModel.setup(mdlB, &allocator, 0x224, 1, 0);
+ balloonModelB.setup(mdlB, &allocator, 0x224, 1, 0);
+
+ ActivePhysics::Info iballoonPhysics;
+
+ iballoonPhysics.xDistToCenter = 0.0;
+ iballoonPhysics.yDistToCenter = -24.0;
+ iballoonPhysics.xDistToEdge = 20.0;
+ iballoonPhysics.yDistToEdge = 12.0;
+
+ iballoonPhysics.category1 = 0x3;
+ iballoonPhysics.category2 = 0x0;
+ iballoonPhysics.bitfield1 = 0x4f;
+ iballoonPhysics.bitfield2 = 0xffbafffe;
+ iballoonPhysics.unkShort1C = 0x0;
+ iballoonPhysics.callback = balloonSmack;
+
+ balloonPhysics.initWithStruct(this, &iballoonPhysics);
+ balloonPhysics.addToList();
+
+
+ // if (baln != 0) {
+ // char *itemArc;
+ // char *itemBrres;
+ // char *itemMdl;
+
+ // if (baln == 1) {
+ // itemArc = "I_kinoko";
+ // itemBrres = "g3d/I_kinoko.brres";
+ // itemMdl = "I_kinoko";
+ // }
+ // else if (baln == 2) {
+ // itemArc = "I_fireflower";
+ // itemBrres = "g3d/I_fireflower.brres";
+ // itemMdl = "I_fireflower";
+ // }
+ // else if (baln == 3) {
+ // itemArc = "I_propeller";
+ // itemBrres = "g3d/I_propeller.brres";
+ // itemMdl = "I_propeller_model";
+ // }
+ // else if (baln == 4) {
+ // itemArc = "I_iceflower";
+ // itemBrres = "g3d/I_iceflower.brres";
+ // itemMdl = "I_iceflower";
+ // }
+ // else if (baln == 5) {
+ // itemArc = "I_star";
+ // itemBrres = "g3d/I_star.brres";
+ // itemMdl = "I_star";
+ // }
+ // else if (baln == 6) {
+ // itemArc = "I_penguin";
+ // itemBrres = "g3d/I_penguin.brres";
+ // itemMdl = "I_penguin";
+ // }
+
+ // this->carryFile.data = getResource(itemArc, itemBrres);
+ // nw4r::g3d::ResMdl mdlC = this->carryFile.GetResMdl(itemMdl);
+ // carryModel.setup(mdlC, &allocator, 0x224, 1, 0);
+
+ // nw4r::g3d::ResAnmChr anmChrC = this->carryFile.GetResAnmChr("wait2");
+ // this->carryAnm.setup(mdlC, anmChrC, &this->allocator, 0);
+
+ // this->carryAnm.bind(&this->carryModel, anmChrC, 1);
+ // this->carryModel.bindAnim(&this->carryAnm, 0.0);
+ // this->carryAnm.setUpdateRate(1.0);
+ // }
}
- else if (anim == 1) {
+ else {this->renderBalloon = 0;}
+
+
+ // Shy Guy Colours
+ if (type == 1 || type == 8 || type == 10) {
this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyBlue.brres");
}
- else if (anim == 2) {
+ else if (type == 5) {
this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyGreen.brres");
}
- else if (anim == 3) {
+ else if (type == 3) {
this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyCyan.brres");
}
- else if (anim == 4) {
+ else if (type == 4) {
this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyPurple.brres");
}
+ else {
+ this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyRed.brres");
+ }
nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("body_h");
bodyModel.setup(mdl, &allocator, 0x224, 1, 0);
- // Balloon Model
- this->balloonFile.data = getResource("lemmy_ball", "g3d/balloon.brres");
- nw4r::g3d::ResMdl mdlB = this->balloonFile.GetResMdl("ballon");
- balloonModel.setup(mdlB, &allocator, 0x224, 1, 0);
- balloonModelB.setup(mdlB, &allocator, 0x224, 1, 0);
-
// Animations start here
this->anmFile.data = getResource("lemmy_ball", "g3d/ShyGuyAnimations.brres");
@@ -476,7 +573,7 @@ int daShyGuy::onCreate() {
HitMeBaby.category1 = 0x3;
HitMeBaby.category2 = 0x0;
HitMeBaby.bitfield1 = 0x4F;
- HitMeBaby.bitfield2 = 0x8828E;
+ HitMeBaby.bitfield2 = 0xffbafffe;
HitMeBaby.unkShort1C = 0;
HitMeBaby.callback = &shyCollisionCallback;
@@ -525,6 +622,30 @@ int daShyGuy::onCreate() {
doStateChange(&StateID_Jump);
}
else if (type == 4) {
+ // Chuckles is left, Knuckles is Right
+ ActivePhysics::Info iChuckles;
+ ActivePhysics::Info iKnuckles;
+
+ iChuckles.xDistToCenter = -27.0;
+ iChuckles.yDistToCenter = 12.0;
+ iChuckles.xDistToEdge = 27.0;
+ iChuckles.yDistToEdge = 10.0;
+
+ iKnuckles.xDistToCenter = 27.0;
+ iKnuckles.yDistToCenter = 12.0;
+ iKnuckles.xDistToEdge = 27.0;
+ iKnuckles.yDistToEdge = 10.0;
+
+ iKnuckles.category1 = iChuckles.category1 = 0x3;
+ iKnuckles.category2 = iChuckles.category2 = 0x0;
+ iKnuckles.bitfield1 = iChuckles.bitfield1 = 0x4F;
+ iKnuckles.bitfield2 = iChuckles.bitfield2 = 0x6;
+ iKnuckles.unkShort1C = iChuckles.unkShort1C = 0x0;
+ iKnuckles.callback = iChuckles.callback = ChucklesAndKnuckles;
+
+ Chuckles.initWithStruct(this, &iChuckles);
+ Knuckles.initWithStruct(this, &iKnuckles);
+
doStateChange(&StateID_Judo);
}
else if (type == 5) {
@@ -559,12 +680,9 @@ int daShyGuy::onExecute() {
acState.execute();
updateModelMatrices();
- // if (this->aPhysics.result1 == 1) {
- // char PlayerID = NearestPlayer(this);
- // dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
-
- // this->_vf220(Player);
- // }
+ if (type > 8) {
+ giantRider.update();
+ }
return true;
}
@@ -578,9 +696,13 @@ int daShyGuy::onDraw() {
balloonModelB.scheduleForDrawing();
}
- if (type > 8) {
- giantRider.update();
- }
+ // if (this->baln > 0) {
+ // carryModel.scheduleForDrawing();
+ // carryModel._vf1C();
+
+ // if(this->carryAnm.isAnimationDone())
+ // this->carryAnm.setCurrentFrame(0.0);
+ // }
return true;
}
@@ -605,6 +727,16 @@ void daShyGuy::updateModelMatrices() {
balloonModelB.setScale(balloonSize, balloonSize, balloonSize);
balloonModelB.calcWorld(false);
}
+
+ // if (this->baln > 0) {
+ // matrix.applyRotationYXZ(0,0,0);
+ // matrix.translation(pos.x+40.0, pos.y - 28.0, pos.z + 1000.0);
+
+ // carryModel.setDrawMatrix(matrix);
+ // carryModel.setScale(21.0, 21.0, 21.0);
+ // carryModel.calcWorld(false);
+ // }
+
}
///////////////
@@ -650,7 +782,7 @@ void daShyGuy::updateModelMatrices() {
int done = SmoothRotation(&this->rot.y, amt, 0x800);
if(done) {
- this->doStateChange(&StateID_RealWalk);
+ this->doStateChange(&StateID_Walk);
}
}
void daShyGuy::endState_Turn() {
@@ -882,11 +1014,11 @@ void daShyGuy::updateModelMatrices() {
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);
+ Chuckles.addToList();
}
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);
+ Knuckles.addToList();
}
}
@@ -895,14 +1027,15 @@ void daShyGuy::updateModelMatrices() {
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);
+ Chuckles.removeFromList();
}
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);
+ Knuckles.removeFromList();
}
this->timer = 0;
PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
- changeActivePhysicsRect(this, 0.0, 12.0, 14.0, 12.0);
}
}
}
@@ -914,6 +1047,7 @@ void daShyGuy::updateModelMatrices() {
///////////////
void daShyGuy::beginState_Spike() {
this->timer = 0;
+ spikeTurn = 0;
}
void daShyGuy::executeState_Spike() {
@@ -940,8 +1074,7 @@ void daShyGuy::updateModelMatrices() {
}
else if (this->timer == 120) {
- bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0);
-
+ bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0);
}
else if (this->timer == 160) {
@@ -955,33 +1088,67 @@ void daShyGuy::updateModelMatrices() {
if (this->direction == 1) {
spawned = CreateActor(89, 0x2, pos, 0, 0);
- spawned->scale.x = 0.5;
- spawned->scale.y = 0.5;
- spawned->scale.z = 0.5;
+ spawned->scale.x = 0.75;
+ spawned->scale.y = 0.75;
+ spawned->scale.z = 0.75;
spawned->speed.x = -2.0;
spawned->speed.y = 2.0;
}
else {
spawned = CreateActor(89, 0x12, pos, 0, 0);
- spawned->scale.x = 0.5;
- spawned->scale.y = 0.5;
- spawned->scale.z = 0.5;
+ spawned->scale.x = 0.75;
+ spawned->scale.y = 0.75;
+ spawned->scale.z = 0.75;
spawned->speed.x = 2.0;
spawned->speed.y = 2.0;
}
- spawned->_320 = 0.0f;
- spawned->_324 = 8.0f;
- spawned->spriteSomeRectX = 8.0f;
- spawned->spriteSomeRectY = 8.0f;
+ if (spikeTurn == 0) {
+ if (this->spikeA != 0) {
+ PlaySound(spikeA, SE_OBJ_ROCK_S_CRASH);
+ CreateEffect(&(Vec){this->spikeA->pos.x, this->spikeA->pos.y, 5500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 9);
+ this->spikeA->Delete(this->spikeA->_390);
+ }
+ this->spikeA = spawned;
+ spikeTurn = 1;
+ }
+ else {
+ if (this->spikeB != 0) {
+ PlaySound(spikeB, SE_OBJ_ROCK_S_CRASH);
+ CreateEffect(&(Vec){this->spikeB->pos.x, this->spikeB->pos.y, 5500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 9);
+ this->spikeB->Delete(this->spikeB->_390);
+ }
+ this->spikeB = spawned;
+ spikeTurn = 0;
+ }
- // TODO: Figure these out
- spawned->_338 = 128.0f;
- spawned->_33C = 128.0f;
- spawned->_340 = 128.0f + 40.0f;
- spawned->_344 = 128.0f + 40.0f;
+ // spawned->_320 = 0.0f;
+ // spawned->_324 = 8.0f;
+ // spawned->spriteSomeRectX = 8.0f;
+ // spawned->spriteSomeRectY = 8.0f;
+
+ // spawned->_338 = 128.0f;
+ // spawned->_33C = 128.0f;
+ // spawned->_340 = 128.0f + 40.0f;
+ // spawned->_344 = 128.0f + 40.0f;
+
+ // spawned->aPhysics.info.xDistToCenter = spawned->aPhysics.info.xDistToCenter / 2.0;
+ // spawned->aPhysics.info.yDistToCenter = spawned->aPhysics.info.yDistToCenter / 2.0;
+ // spawned->aPhysics.info.xDistToEdge = spawned->aPhysics.info.xDistToEdge / 2.0;
+ // spawned->aPhysics.info.yDistToEdge = spawned->aPhysics.info.yDistToEdge / 2.0;
+
+ // static const u8 one[16] = {
+ // 0x01,0x80,0x41,0x01, 0xFF,0xFF,0x80,0x00, 0x00,0x00,0x70,0x00, 0x00,0x00,0xF0,0x00
+ // };
+ // static const u8 two[16] = {
+ // 0x00,0x00,0x00,0x01, 0xFF,0xFF,0x80,0x00, 0x00,0x00,0x70,0x00, 0xFF,0xFF,0x10,0x00
+ // };
+ // static const u8 three[16] = {
+ // 0x01,0x80,0x41,0x01, 0xFF,0xFF,0x90,0x00, 0x00,0x00,0x80,0x00, 0x00,0x00,0xEF0,0x00
+ // };
+ // spawned->collMgr.Init(spawned, two, one, three);
}
@@ -1108,6 +1275,31 @@ void daShyGuy::updateModelMatrices() {
this->isDown = 1;
this->renderBalloon = 0;
+
+ // char powerup;
+
+ // if (baln == 1) {
+ // powerup = 0x0B000007;
+ // }
+ // else if (baln == 2) {
+ // powerup = 0x0B000009;
+ // }
+ // else if (baln == 3) {
+ // powerup = 0x0B000001;
+ // }
+ // else if (baln == 4) {
+ // powerup = 0x0C00000E;
+ // }
+ // else if (baln == 5) {
+ // powerup = 0x0C000015;
+ // }
+ // else if (baln == 6) {
+ // powerup = 0x0C000011;
+ // }
+ // CreateActor(60, powerup, (Vec){pos.x, pos.y - 28.0, pos.z}, 0, 0);
+ // this->baln = 0;
+
+ balloonPhysics.removeFromList();
CreateEffect(&(Vec){this->pos.x, this->pos.y - 32.0, 0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 337);
type = 0;