diff options
Diffstat (limited to 'src/shyguy.cpp')
-rw-r--r-- | src/shyguy.cpp | 467 |
1 files changed, 318 insertions, 149 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 89f92d0..15bf0d6 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -10,17 +10,17 @@ // 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 -// 10 - Walking Giatn -// 8 - Pacing Giant +// 0 - Walker +// 1 - Pacing Walker +// 2 - Sleeper +// 3 - Jumper +// 4 - Judo Master +// 5 - Spike Thrower +// 6 - Ballooneer Horizontal +// 7 - Ballooneer Vertical +// 8 - Ballooneer Circular +// 9 - Walking Giant +// 10 - Pacing Giant // // Nybble 6: Colour // 0 - Red @@ -65,6 +65,7 @@ class daShyGuy : public dEn_c { int type; int timer; int jumpCounter; + float dying; float Baseline; char damage; char isDown; @@ -74,21 +75,23 @@ class daShyGuy : public dEn_c { float XSpeed; u32 cmgr_returnValue; bool isBouncing; + float balloonSize; 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); + void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat14_YoshiFire(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 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); @@ -113,6 +116,8 @@ class daShyGuy : public dEn_c { DECLARE_STATE(FireKnockBack); DECLARE_STATE(FlameHit); DECLARE_STATE(Recover); + + DECLARE_STATE(Die); }; daShyGuy *daShyGuy::build() { @@ -153,6 +158,8 @@ daShyGuy *daShyGuy::build() { CREATE_STATE(daShyGuy, FlameHit); CREATE_STATE(daShyGuy, Recover); + CREATE_STATE(daShyGuy, Die); + //////////////////////// // Collision Functions //////////////////////// @@ -161,7 +168,7 @@ daShyGuy *daShyGuy::build() { void shyCollisionCallback(ActivePhysics *apThis, ActivePhysics *apOther) { if (apOther->owner->name != 89) { - apThis->owner->collisionCallback(apThis, apOther); + dEn_c::collisionCallback(apThis, apOther); } } @@ -177,15 +184,14 @@ daShyGuy *daShyGuy::build() { if (this->type < 6) { // Regular Shy Guys stateVar = &StateID_GoDizzy; - deathState = &StateID_DieFall; + deathState = &StateID_Die; } else if (this->type > 8) { // Giants - stateVar = &StateID_DieFall; - deathState = &StateID_DieFall; + return; } else { // Ballooneers stateVar = &StateID_BalloonDrop; - deathState = &StateID_DieFumi; + deathState = &StateID_Die; } char hitType; @@ -236,11 +242,27 @@ daShyGuy *daShyGuy::build() { } void daShyGuy::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { - doStateChange(&StateID_DieFall); + doStateChange(&StateID_Die); + } + + void daShyGuy::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); + } + + void daShyGuy::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { + doStateChange(&StateID_Die); } void daShyGuy::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { - doStateChange(&StateID_DieFall); + doStateChange(&StateID_Die); + } + + void daShyGuy::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther){ + doStateChange(&StateID_Die); + } + + void daShyGuy::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther){ + doStateChange(&StateID_DieSmoke); } void daShyGuy::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -248,10 +270,7 @@ daShyGuy *daShyGuy::build() { dStateBase_c *stateVar; - if (this->type > 3) { // Jumpers - stateVar = &StateID_DieSmoke; - } - else if (this->type < 6) { // Regular Shy Guys Except Jumper + if (this->type < 6) { // Regular Shy Guys Except Jumper stateVar = &StateID_FireKnockBack; } else if (this->type > 8) { // Giants @@ -274,9 +293,80 @@ daShyGuy *daShyGuy::build() { // } void daShyGuy::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { - doStateChange(&StateID_DieFall); + doStateChange(&StateID_Die); + } + +bool daShyGuy::calculateTileCollisions() { + // Returns true if sprite should turn, false if not. + + HandleXSpeed(); + HandleYSpeed(); + doSpriteMovement(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + collMgr.execute(); + + if (isBouncing) { + stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); + if (speed.y != 0.0f) + isBouncing = false; + } + + float xDelta = pos.x - last_pos.x; + if (xDelta >= 0.0f) + direction = 0; + else + direction = 1; + + if (collMgr.CollidedWithTile()) { + // Walking into a tile branch + + if (cmgr_returnValue == 0) + isBouncing = true; + + if (speed.x != 0.0f) { + //playWmEnIronEffect(); + } + + speed.y = 0.0f; + + // u32 blah = collMgr.s_80070760(); + // u8 one = (blah & 0xFF); + // static const float incs[5] = {0.00390625f, 0.0078125f, 0.015625f, 0.0234375f, 0.03125f}; + // x_speed_inc = incs[one]; + max_speed.x = (direction == 1) ? -1.0f : 1.0f; + } else { + x_speed_inc = 0.0f; + } + + // Bouncing checks + if (_34A & 4) { + Vec v = (Vec){0.0f, 1.0f, 0.0f}; + collMgr.parent_speed_ptr = &v; + + if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + speed.y = 0.0f; + + collMgr.parent_speed_ptr = &speed; + + } else { + if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + speed.y = 0.0f; } + collMgr.s_8006FA40(0); + + // Switch Direction + if (collMgr.bitfield_for_checks & (0x15 << direction)) { + if (collMgr.CollidedWithTile()) { + isBouncing = true; + } + return true; + } + return false; +} + + void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) { nw4r::g3d::ResAnmChr anmChr = this->anmFile.GetResAnmChr(name); @@ -292,9 +382,9 @@ int daShyGuy::onCreate() { 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;} - else if (type == 5) {this->renderBalloon = 1;} + 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"); @@ -333,14 +423,31 @@ int daShyGuy::onCreate() { allocator.unlink(); + // Stuff I do understand + OSReport("Setting up ShyGuy's Box of Goodies\n"); + OSReport("Setting ShyGuy's Size to 1.0\n"); this->scale = (Vec){20.0, 20.0, 20.0}; + 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->speed.x = 0.0; + this->speed.y = 0.0; + this->max_speed.x = 1.0; + this->x_speed_inc = 0.2; + this->Baseline = this->pos.y; + this->XSpeed = 1.0; + this->balloonSize = 1.5; + OSReport("Creating ShyGuy's Physics Struct\n"); ActivePhysics::Info HitMeBaby; - if (type == 8 || type == 10) { + if (type > 8) { this->scale = (Vec){40.0, 40.0, 40.0}; HitMeBaby.xDistToCenter = 0.0; @@ -372,22 +479,18 @@ int daShyGuy::onCreate() { // Tile collider OSReport("Making the Tile collider Class\n"); + // These fucking rects do something for the tile rect + spriteSomeRectX = 28.0f; + spriteSomeRectY = 32.0f; _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; + // These structs tell stupid collider what to collide with - these are from koopa troopa + static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; + static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; + static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,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}; - - collMgr.Init(this, two, one, three); + collMgr.Init(this, one, two, three); collMgr.execute(); cmgr_returnValue = collMgr.CollidedWithTile(); @@ -398,53 +501,40 @@ int daShyGuy::onCreate() { isBouncing = true; - // 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->speed.x = 0; - this->speed.y = 0.0; - this->x_speed_inc = 0.1; - this->Baseline = this->pos.y; - this->XSpeed = 1.0; - + // State Changers if (type == 0) { - doStateChange(&StateID_Walk); + doStateChange(&StateID_RealWalk); } else if (type == 1) { - doStateChange(&StateID_Sleep); + doStateChange(&StateID_Walk); } else if (type == 2) { - doStateChange(&StateID_Jump); + doStateChange(&StateID_Sleep); } else if (type == 3) { - doStateChange(&StateID_Balloon_H); + doStateChange(&StateID_Jump); } else if (type == 4) { - doStateChange(&StateID_Balloon_V); + doStateChange(&StateID_Judo); } else if (type == 5) { - doStateChange(&StateID_Balloon_C); + doStateChange(&StateID_Spike); } else if (type == 6) { - doStateChange(&StateID_Judo); + doStateChange(&StateID_Balloon_H); } else if (type == 7) { - doStateChange(&StateID_Spike); + doStateChange(&StateID_Balloon_V); } else if (type == 8) { - doStateChange(&StateID_Walk); + doStateChange(&StateID_Balloon_C); } else if (type == 9) { doStateChange(&StateID_RealWalk); } else if (type == 10) { - doStateChange(&StateID_RealWalk); + doStateChange(&StateID_Walk); } OSReport("Going to Execute ShyGuy\n"); @@ -474,15 +564,17 @@ int daShyGuy::onDraw() { bodyModel.scheduleForDrawing(); bodyModel._vf1C(); - balloonModel.scheduleForDrawing(); - balloonModelB.scheduleForDrawing(); + if (this->renderBalloon == 1) { + balloonModel.scheduleForDrawing(); + balloonModelB.scheduleForDrawing(); + } return true; } void daShyGuy::updateModelMatrices() { // This won't work with wrap because I'm lazy. - matrix.translation(pos.x, pos.y, pos.z); + matrix.translation(pos.x, pos.y - 2.0, pos.z); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); bodyModel.setDrawMatrix(matrix); @@ -490,16 +582,15 @@ void daShyGuy::updateModelMatrices() { bodyModel.calcWorld(false); if (this->renderBalloon == 1) { - matrix.translation(pos.x, pos.y - 30.0, pos.z); + matrix.translation(pos.x, pos.y - 32.0, pos.z); balloonModel.setDrawMatrix(matrix); - balloonModel.setScale(1.5, 1.5, 1.5); + balloonModel.setScale(balloonSize, balloonSize, balloonSize); balloonModel.calcWorld(false); balloonModelB.setDrawMatrix(matrix); - balloonModelB.setScale(1.5, 1.5, 1.5); + balloonModelB.setScale(balloonSize, balloonSize, balloonSize); balloonModelB.calcWorld(false); - } } @@ -509,13 +600,11 @@ void daShyGuy::updateModelMatrices() { 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; } + this->rot.y = (direction) ? 0xD800 : 0x2800; } void daShyGuy::executeState_Walk() { - if (this->direction == 1) { this->pos.x -= 0.5; } - else { this->pos.x += 0.5; } + this->pos.x += (direction) ? -0.5 : 0.5; if(this->chrAnimation.isAnimationDone()) if (this->timer > (this->distance * 32)) { @@ -535,34 +624,29 @@ void daShyGuy::updateModelMatrices() { /////////////// void daShyGuy::beginState_Turn() { bindAnimChr_and_setUpdateRate("c18_IDLE_R", 1, 0.0, 1.0); - this->timer = 0; + this->direction ^= 1; + this->speed.x = 0.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); - } + u16 amt = (this->direction == 0) ? 0x2800 : 0xD800; + int done = SmoothRotation(&this->rot.y, amt, 0x800); - if(this->chrAnimation.isAnimationDone()) { - this->chrAnimation.setCurrentFrame(0.0); + if(done) { + this->doStateChange(&StateID_RealWalk); } - - this->timer += 1; } void daShyGuy::endState_Turn() { - if (this->direction == 1) { this->direction = 0; } - else { this->direction = 1; } } /////////////// // Jump State /////////////// void daShyGuy::beginState_Jump() { + this->max_speed.x = 0.0; + this->speed.x = 0.0; + this->x_speed_inc = 0.0; + this->timer = 0; this->jumpCounter = 0; } @@ -573,12 +657,7 @@ void daShyGuy::updateModelMatrices() { if (facing != this->direction) { this->direction = facing; - if (this->direction == 1) { - this->rot.y = 0xD800; - } - else { - this->rot.y = 0x2800; - } + this->rot.y = (direction) ? 0xD800 : 0x2800; } // Shy Guy is on ground @@ -892,39 +971,20 @@ void daShyGuy::updateModelMatrices() { 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.x = (direction) ? -1.0f : 1.0f; + + this->max_speed.y = -4.0; 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); - } - - // 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); + bool ret = calculateTileCollisions(); + if (ret) { + doStateChange(&StateID_RealTurn); } - DoStuffAndMarkDead(this, this->pos, 1.0); - if(this->chrAnimation.isAnimationDone()) { this->chrAnimation.setCurrentFrame(0.0); } @@ -946,26 +1006,14 @@ void daShyGuy::updateModelMatrices() { 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); + int done = SmoothRotation(&this->rot.y, amt, 0x800); if(done) { this->doStateChange(&StateID_RealWalk); } } void daShyGuy::endState_RealTurn() { - this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; } /////////////// @@ -974,9 +1022,11 @@ void daShyGuy::updateModelMatrices() { void daShyGuy::beginState_GoDizzy() { bindAnimChr_and_setUpdateRate("c18_L_DMG_F_1_R", 1, 0.0, 1.0); - this->max_speed.y = -4.0; + CreateEffect(318, &(Vec){this->pos.x, this->pos.y + 24.0, 0}, 0); + + this->max_speed.y = -2.0; this->speed.x = 0; - this->speed.y = -4.0; + this->speed.y = -2.0; this->y_speed_inc = -0.1875; this->timer = 0; @@ -984,8 +1034,7 @@ void daShyGuy::updateModelMatrices() { this->isDown = 1; } void daShyGuy::executeState_GoDizzy() { - this->HandleYSpeed(); - this->doSpriteMovement(); + calculateTileCollisions(); // Needs tile collision shit here, because jumpers can get hit and fall downwards. @@ -1014,38 +1063,99 @@ void daShyGuy::updateModelMatrices() { // BalloonDrop State /////////////// void daShyGuy::beginState_BalloonDrop() { + bindAnimChr_and_setUpdateRate("c18_C_BLOCK_BREAK_R", 1, 0.0, 2.0); + + this->max_speed.x = 0.0; + this->speed.x = 0.0; + this->x_speed_inc = 0.0; + + this->max_speed.y = -2.0; + this->speed.y = -2.0; + this->y_speed_inc = -0.1875; + this->isDown = 1; + this->renderBalloon = 0; + 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; } void daShyGuy::executeState_BalloonDrop() { + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + + bool ret = calculateTileCollisions(); + + if (speed.y == 0.0) { + CreateEffect(&(Vec){this->pos.x, this->pos.y, 0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 6); + doStateChange(&StateID_GoDizzy); + } + } + void daShyGuy::endState_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; + this->direction ^= 1; + this->speed.x = (this->direction) ? -this->XSpeed / 6.0f : this->XSpeed / 6.0f; } void daShyGuy::executeState_FireKnockBack() { + + calculateTileCollisions(); // move backwards here if(this->chrAnimation.isAnimationDone()) { - // set state according to type + if (type == 0) { + doStateChange(&StateID_RealWalk); + } + else if (type == 1) { + doStateChange(&StateID_Walk); + } + else if (type == 2) { + doStateChange(&StateID_RealWalk); + } + else if (type == 3) { + doStateChange(&StateID_Jump); + } + else if (type == 4) { + doStateChange(&StateID_Judo); + } + else if (type == 5) { + doStateChange(&StateID_Spike); + } + else { + doStateChange(&StateID_RealWalk); + } } } - void daShyGuy::endState_FireKnockBack() {} + void daShyGuy::endState_FireKnockBack() { + this->direction ^= 1; + speed.x = (direction) ? -1.0f : 1.0f; + this->max_speed.x = (direction) ? -this->XSpeed : this->XSpeed; + } /////////////// // FlameHit State /////////////// void daShyGuy::beginState_FlameHit() { - bindAnimChr_and_setUpdateRate("c18_L_DMG_F_4_R", 1, 0.0, 1.0); + bindAnimChr_and_setUpdateRate("c18_C_BLOCK_BREAK_R", 1, 0.0, 1.0); } void daShyGuy::executeState_FlameHit() { + if(this->chrAnimation.isAnimationDone()) { - // set state according to type + if (type == 6) { + doStateChange(&StateID_Balloon_H); + } + else if (type == 7) { + doStateChange(&StateID_Balloon_V); + } + else if (type == 8) { + doStateChange(&StateID_Balloon_C); + } } } void daShyGuy::endState_FlameHit() {} @@ -1058,13 +1168,72 @@ void daShyGuy::updateModelMatrices() { } void daShyGuy::executeState_Recover() { - // Don't forget the tile collision shiz + calculateTileCollisions(); if(this->chrAnimation.isAnimationDone()) { - // set state according to type + if (type == 0) { + doStateChange(&StateID_RealWalk); + } + else if (type == 1) { + doStateChange(&StateID_Walk); + } + else if (type == 2) { + doStateChange(&StateID_RealWalk); + } + else if (type == 3) { + doStateChange(&StateID_Jump); + } + else if (type == 4) { + doStateChange(&StateID_Judo); + } + else if (type == 5) { + doStateChange(&StateID_Spike); + } + else { + doStateChange(&StateID_RealWalk); + } } } void daShyGuy::endState_Recover() { this->isDown = 0; + this->rot.y = (direction) ? 0xD800 : 0x2800; + } + +/////////////// +// Die State +/////////////// + void daShyGuy::beginState_Die() { + dEn_c::dieFall_Begin(); + + bindAnimChr_and_setUpdateRate("c18_C_BLOCK_BREAK_R", 1, 0.0, 2.0); + this->timer = 0; + this->dying = -10.0; + this->Baseline = this->pos.y; + } + void daShyGuy::executeState_Die() { + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + + this->timer += 1; + + this->pos.x += 0.5; + this->pos.y = Baseline + (-0.2 * dying * dying) + 20.0; + + this->dying += 0.5; + + this->dEn_c::dieFall_Execute(); + + if (this->timer > 450) { + this->kill(); + return; + } + + dEn_c::dieFall_Execute(); + + } + void daShyGuy::endState_Die() { + dEn_c::dieFall_End(); } |