diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-02-18 22:17:34 -0600 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-02-18 22:17:34 -0600 |
commit | 377aadd44659d0f051eec0360485c65a81d43646 (patch) | |
tree | ea28670f4d286b131e36eea76ae00e172ae06392 /src | |
parent | b778836efa61a521af06552004ff879692158043 (diff) | |
download | kamek-377aadd44659d0f051eec0360485c65a81d43646.tar.gz kamek-377aadd44659d0f051eec0360485c65a81d43646.zip |
ShyGuy update
Diffstat (limited to '')
-rw-r--r-- | src/shyguy.cpp | 131 |
1 files changed, 37 insertions, 94 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 0e4024a..67c04b2 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -15,18 +15,15 @@ class daShyGuy : public dEn_c { mHeapAllocator_c allocator; nw4r::g3d::ResFile resFile; + nw4r::g3d::ResFile anmFile; - m3d::mdl_c body_h; - m3d::mdl_c body_m; - m3d::mdl_c body_l; - m3d::mdl_c body_s; + m3d::mdl_c bodyModel; - // m3d::anmChr_c animationChr; + m3d::anmChr_c animationChr; static daShyGuy *build(); - // void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); - void setupBodyModel(); + void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); void updateModelMatrices(); // USING_STATES(daShyGuy); @@ -51,61 +48,39 @@ extern "C" dStageActor_c *GetSpecificPlayerActor(int number); // CREATE_STATE(daShyGuy, Grow); -// void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) { -// nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name); -// this->animationChr.bind(&this->bodyModel, anmChr, unk); -// this->bodyModel.bindAnim(&this->animationChr, unk2); -// this->animationChr.setUpdateRate(rate); -// } +void daShyGuy::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) { + nw4r::g3d::ResAnmChr anmChr = this->anmFile.GetResAnmChr(name); + this->animationChr.bind(&this->bodyModel, anmChr, unk); + this->bodyModel.bindAnim(&this->animationChr, unk2); + this->animationChr.setUpdateRate(rate); +} -void daShyGuy::setupBodyModel() { - allocator.link(-1, GameHeaps[0], 0, 0x20); +int daShyGuy::onCreate() { - // body_h # Maybe Head and body - // body_m # Same as h - // body_l # Just head - // body_s # A shadow? + static const char *anmNames[197] = {"DUMMY_R", "IDLE_R", "NO_SKATE_MOVE_R", "SKATE_R", "R_SKATE_R", "L_SKATE_R", "DASH_LKICK_R", "DASH_RKICK_R", "R_DASH_LKICK_R", "R_DASH_RKICK_R", "L_DASH_LKICK_R", "L_DASH_RKICK_R", "BACK_SKATE_R", "R_BACK_SKATE_R", "L_BACK_SKATE_R", "R180_SKATE_TURN_R", "L180_SKATE_TURN_R", "R_BRAKE_1_R", "R_BRAKE_2_R", "R_BRAKE_3_R", "L_BRAKE_1_R", "L_BRAKE_2_R", "L_BRAKE_3_R", "BACK_BRAKE_1_R", "BACK_BRAKE_2_R", "BACK_BRAKE_3_R", "TACKLE_M_DASH_LKICK_R", "TACKLE_M_DASH_RKICK_R", "TACKLE_M_R_DASH_LKICK_R", "TACKLE_M_R_DASH_RKICK_R", "TACKLE_M_L_DASH_LKICK_R", "TACKLE_M_L_DASH_RKICK_R", "TACKLE_R", "TACKLE_END_R", "TACKLE_STEAL_R", "TACKLE_R_CLASH_R", "TACKLE_L_CLASH_R", "TACKLE_BACK_CLASH_R", "PACK_CATCH_FRONT_R", "PACK_CATCH_RIGHT_R", "PACK_CATCH_LEFT_R", "PACK_CATCH_BACK_R", "NORMAL_STEAL_R", "DIVING_STEAL_R", "DIVING_STEAL_CATCH_R", "DIVING_STEAL_MISS_R", "FACEOFF_SET_START_R", "FACEOFF_SET_IDLE_R", "FACEOFF_R", "FACEOFF_BATTLE_R", "FACEOFF_PUSH_R", "FACEOFF_WIN_R", "FACEOFF_MISS_R", "T_ATK01_START_R", "T_ATK01_END_R", "T_ATK02_START_R", "T_ATK02_END_R", "T_ATK03_START_R", "T_ATK03_LOOP_R", "T_ATK03_END_R", "FIGHTING_R", "OB_IDLE_R", "OB_NO_SKATE_MOVE_R", "OB_SKATE_R", "OB_R_SKATE_R", "OB_L_SKATE_R", "OB_DASH_LKICK_R", "OB_DASH_RKICK_R", "OB_R_DASH_LKICK_R", "OB_R_DASH_RKICK_R", "OB_L_DASH_LKICK_R", "OB_L_DASH_RKICK_R", "OB_BACK_SKATE_R", "OB_R_BACK_SKATE_R", "OB_L_BACK_SKATE_R", "OB_R180_SKATE_TURN_R", "OB_L180_SKATE_TURN_R", "OB_R_BRAKE_1_R", "OB_R_BRAKE_2_R", "OB_R_BRAKE_3_R", "OB_L_BRAKE_1_R", "OB_L_BRAKE_2_R", "OB_L_BRAKE_3_R", "OB_BACK_BRAKE_1_R", "OB_BACK_BRAKE_2_R", "OB_BACK_BRAKE_3_R", "OB_TACKLE_RS_CLASH_R", "OB_TACKLE_LS_CLASH_R", "OB_TACKLE_BACK_CLASH_R", "F_SHOOT_POSE_R", "F_SHOOT_CHARGE_R", "F_SHOOT_R", "F_SHOOT_FEINT_R", "C_SHOOT_POSE_R", "C_SHOOT_LOOP_R", "C_SHOOT_R", "C_SHOOT_FEINT_R", "GUARD_F_START_R", "GUARD_F_IDLE_R", "GUARD_F_THROUGH_R", "GUARD_F_THROUGH_POSE_R", "GUARD_F_THROUGH_MISS_R", "GUARD_B_START_R", "GUARD_B_IDLE_R", "GUARD_B_THROUGH_R", "GUARD_B_THROUGH_POSE_R", "GUARD_B_THROUGH_MISS_R", "OB_R_TRICK_MOVE_1_R", "OB_R_TRICK_MOVE_2_R", "OB_R_TRICK_MOVE_3_R", "OB_R_TRICK_MOVE_4_R", "OB_R_TRICK_MOVE_5_R", "OB_L_TRICK_MOVE_1_R", "OB_L_TRICK_MOVE_2_R", "OB_L_TRICK_MOVE_3_R", "OB_L_TRICK_MOVE_4_R", "OB_L_TRICK_MOVE_5_R", "L_DMG_F_1_R", "L_DMG_F_2_R", "L_DMG_F_3_R", "L_DMG_F_4_R", "M_DMG_F_1_R", "M_DMG_F_2_R", "M_DMG_F_3_R", "M_DMG_F_4_R", "R_HIT_DMG_F_1_R", "R_HIT_DMG_F_2_R", "WALL_HIT_DMG_F_3_R", "WALL_HIT_DMG_F_4_R", "L_HIT_DMG_F_1_R", "L_HIT_DMG_F_2_R", "WALL_HIT_DMG_B_3_R", "WALL_HIT_DMG_B_4_R", "WALL_DMG_F_R", "WALL_DMG_B_R", "FIRE_DMG_1_R", "FIRE_DMG_2_R", "FIRE_DMG_RUN_R", "SPIN_DMG_R", "SPIN_DMG_FRAFRA_R", "MEROMERO_DMG_R", "ONARA_DMG_R", "FRAFRA_DMG_1_R", "BIRIBIRI_DMG_R", "TURUTURU_DMG_R", "TURUTURU_DMG_LOOP_R", "TURUTURU_DMG_UP_R", "OTTOTTO_DMG_R", "TURURIN_DMG_ST_R", "TURURIN_DMG_LOOP_R", "TURURIN_DMG_ED_R", "EV_WIN_1_R", "EV_WIN_2_R", "EV_LOSE_1_R", "EV_LOSE_2_R", "SP_START_R", "SP_1_A_R", "SP_1_B_R", "SP_1_C_R", "SP_1_D_R", "SP_1_E_R", "SP_2_A_R", "SP_2_B_R", "SP_2_C_R", "SP_2_D_R", "SP_2_E_R", "SP_3_R", "SP_LOOP_R", "R_SLIDE_R", "L_SLIDE_R", "R_BLOCK_R", "R_BLOCK_UP_R", "R_BLOCK_BREAK_R", "L_BLOCK_R", "L_BLOCK_UP_R", "L_BLOCK_BREAK_R", "C_BLOCK_R", "C_BLOCK_UP_R", "C_BLOCK_BREAK_R", "H_SHOT_R", "SP_BLOCK_R", "SP_BLOCK_UP_R", "H_CUT_R", "DIVING_STEAL_R_CATCH_R", "DIVING_STEAL_L_CATCH_R", "DOWN_UP_R", "RESULT_R", "DM_IDLE_R", "DM_JUMP_R", "DM_VS_IN_R", "DM_VS_IDLE_R", "DM_CAP_IN_R", "DM_CAP_IDLE_R", "SL_EV_WIN_1_R", "SL_EV_WIN_2_R", "SL_EV_LOSE_1_R", "SL_EV_LOSE_2_R"}; + int anm = this->settings >> 24; - this->resFile.data = getResource("block_snake", "g3d/ShyGuyRed.brres"); + OSReport("Creating the ShyGuy Model\n"); + allocator.link(-1, GameHeaps[0], 0, 0x20); + this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyRed.brres"); nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("body_h"); - body_h.setup(mdl, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&body_h, 0); - - nw4r::g3d::ResMdl mdlb = this->resFile.GetResMdl("body_m"); - body_m.setup(mdlb, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&body_m, 0); - - nw4r::g3d::ResMdl mdlc = this->resFile.GetResMdl("body_l"); - body_l.setup(mdlc, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&body_l, 0); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); - nw4r::g3d::ResMdl mdld = this->resFile.GetResMdl("body_s"); - body_s.setup(mdld, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&body_s, 0); - - - //Animations start here - // nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("run"); - // ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0); + // Animations start here + bool ret; + this->anmFile.data = getResource("lemmy_ball", "g3d/ShyGuyAnimations.brres"); + nw4r::g3d::ResAnmChr anmChr = this->anmFile.GetResAnmChr(anmNames[anm]); + ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0); allocator.unlink(); -} - - -int daShyGuy::onCreate() { - OSReport("Creating the ShyGuy Model"); - setupBodyModel(); - int tscale = this->settings >> 28; - float scale = (float)tscale * 2.0; + OSReport("Setting ShyGuy's Size to 1.0\n"); + this->scale = (Vec){20.0, 20.0, 20.0}; - OSReport("Setting ShyGuy's Size to 1.0"); - this->scale = (Vec){scale, scale, scale}; - - OSReport("Creating ShyGuy's Physics Struct"); + OSReport("Creating ShyGuy's Physics Struct\n"); ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; @@ -121,11 +96,12 @@ int daShyGuy::onCreate() { HitMeBaby.unkShort1C = 0; HitMeBaby.callback = &dEn_c::collisionCallback; - OSReport("Making the Physics Class and adding to the list"); + OSReport("Making the Physics Class and adding to the list\n"); this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); - OSReport("Setting up ShyGuy's Box of Goodies"); + OSReport("Setting up ShyGuy's Box of Goodies\n"); + this->pos.y = 32.0; // X is vertical axis this->rot.x = 0; // X is vertical axis this->rot.y = 0; // Y is horizontal axis this->rot.z = 0; // Z is ... an axis >.> @@ -133,12 +109,12 @@ int daShyGuy::onCreate() { this->speed.x = 0; - // bindAnimChr_and_setUpdateRate("run", 1, 0.0, 1.0); + bindAnimChr_and_setUpdateRate(anmNames[anm], 1, 0.0, 1.0); // OSReport("Setting ShyGuy's State"); // doStateChange(&StateID_Grow); - OSReport("Going to Execute ShyGuy"); + OSReport("Going to Execute ShyGuy\n"); this->onExecute(); return true; } @@ -148,15 +124,10 @@ int daShyGuy::onDelete() { } int daShyGuy::onExecute() { - acState.execute(); updateModelMatrices(); - this->rot.x = this->rot.x + 10; - this->rot.y = this->rot.y + 5; - this->rot.z = this->rot.z + 15; - - // if(this->animationChr.isAnimationDone()) - // this->animationChr.setCurrentFrame(0.0); + if(this->animationChr.isAnimationDone()) + this->animationChr.setCurrentFrame(0.0); // if (this->aPhysics.result1 == 1) { // char PlayerID = NearestPlayer(this); @@ -170,17 +141,8 @@ int daShyGuy::onExecute() { int daShyGuy::onDraw() { - body_h.scheduleForDrawing(); - body_h._vf1C(); - - body_m.scheduleForDrawing(); - body_m._vf1C(); - - body_l.scheduleForDrawing(); - body_l._vf1C(); - - body_s.scheduleForDrawing(); - body_s._vf1C(); + bodyModel.scheduleForDrawing(); + bodyModel._vf1C(); return true; } @@ -190,28 +152,9 @@ void daShyGuy::updateModelMatrices() { matrix.translation(pos.x, pos.y, pos.z); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); - body_h.setDrawMatrix(matrix); - body_h.setScale(&scale); - body_h.calcWorld(false); - - matrix.translation(pos.x+40.0, pos.y, pos.z); - - body_m.setDrawMatrix(matrix); - body_m.setScale(&scale); - body_m.calcWorld(false); - - matrix.translation(pos.x+80.0, pos.y, pos.z); - - body_l.setDrawMatrix(matrix); - body_l.setScale(&scale); - body_l.calcWorld(false); - - matrix.translation(pos.x+120.0, pos.y, pos.z); - - body_s.setDrawMatrix(matrix); - body_s.setScale(&scale); - body_s.calcWorld(false); - + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); } |