From 2aa6c935e2996c001079922863bcc4e62b6b0f61 Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Fri, 14 Oct 2011 17:02:24 -0500 Subject: moved setNewCollisionRect to player.h so multiple actors can call it updated MG with attempted fixes for anmChr changed banm_c's _setUpdateRate and others to public for anmChr --- include/g3dhax.h | 8 ++++---- include/game.h | 23 ----------------------- kamek_pal.x | 8 ++++---- src/bossMegaGoomba.cpp | 26 ++++++++++++++++++++++---- src/player.cpp | 24 ++++++++++++++++++++++++ src/player.h | 1 + 6 files changed, 55 insertions(+), 35 deletions(-) diff --git a/include/g3dhax.h b/include/g3dhax.h index f2cdd29..d4aa9a0 100644 --- a/include/g3dhax.h +++ b/include/g3dhax.h @@ -257,12 +257,12 @@ namespace m3d { void *frameHeap; // should be a frame heap mAllocator_c allocator; + float getCurrentFrame(); + float setCurrentFrame(float value); + float getUpdateRate(); + float setUpdateRate(float value); private: void setupHeap(mAllocator_c *allocator, u32 *sizeOutput); - float _getCurrentFrame(); - float _setCurrentFrame(float value); - float _getUpdateRate(); - float _setUpdateRate(float value); }; class fanm_c : public banm_c { diff --git a/include/game.h b/include/game.h index b6b07dd..bbb7de0 100755 --- a/include/game.h +++ b/include/game.h @@ -2201,28 +2201,5 @@ inline u8 *getResource(const char *arcName, const char *fileName) { inline void scaleDown(Vec* scale, float amt) { scale->x -= amt; scale->y -= amt; scale->z -= amt; } inline void scaleUp(Vec* scale, float amt) { scale->x -= amt; scale->y -= amt; scale->z -= amt; } -inline void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { - float amtX = scale->x; - float amtY = scale->y; - - ActivePhysics::Info info; - info.xDistToCenter = 0.0; - info.yDistToCenter = 3.0 * amtY; - info.xDistToEdge = 4.0 * amtX; - info.yDistToEdge = 4.0 * amtY; - - 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(); -} - #endif diff --git a/kamek_pal.x b/kamek_pal.x index 8030c51..67233c8 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -996,15 +996,15 @@ SECTIONS { process__Q23m3d6banm_cFv = 0x8002a1f0; setupHeap__Q23m3d6banm_cFv = 0x801680e0; testAnmFlag__Q23m3d6banm_cFv = 0x801681a0; - getFrameFromObj__Q23m3d6banm_cFv = 0x801681c0; - setFrameOnObj__Q23m3d6banm_cFv = 0x801681e0; + getCurrentFrame__Q23m3d6banm_cFv = 0x801681c0; + setCurrentFrame__Q23m3d6banm_cFf = 0x801681e0; getUpdateRate__Q23m3d6banm_cFv = 0x80168200; - setUpdateRate__Q23m3d6banm_cFv = 0x80168220; + setUpdateRate__Q23m3d6banm_cFf = 0x80168220; __ct__Q23m3d6fanm_cFv = 0x80168e50; __vt__Q23m3d6fanm_c = 0x80329968; __dt__Q23m3d6fanm_cFv = 0x80168ec0; process__Q23m3d6fanm_cFv = 0x80168f20; - setFrame__Q23m3d6fanm_cFv = 0x80169120; + setCurrentFrame__Q23m3d6fanm_cFf = 0x80169120; isAnimationDone__Q23m3d6fanm_cFv = 0x80169160; querySomething__Q23m3d6fanm_cFv = 0x80169220; diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index e836afb..da66d16 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -44,7 +44,10 @@ class daMegaGoomba_c : public dEn_c { float JumpTime; bool takeHit(char count); + + void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2); + void dieFall_Begin(); void dieFall_Execute(); static daMegaGoomba_c *build(); @@ -167,8 +170,17 @@ void daMegaGoomba_c::_vf120(ActivePhysics *apThis, ActivePhysics *apOther) { OSR void daMegaGoomba_c::_vf110(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("_vf110:\n"); } void daMegaGoomba_c::_vf108(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("_vf108:\n"); } +void daMegaGoomba_c::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2) { + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name); + this->animationChr.bind(&this->bodyModel, anmChr, unk); + this->bodyModel.bindAnim(&this->animationChr, unk2); + this->animationChr.setUpdateRate(1.0); +} - +void daMegaGoomba_c::dieFall_Begin() { + this->bindAnimChr_and_setUpdateRate("split", 0, 0.0); + dSprite_c::dieFall_Begin(); +} //TODO make this real perty like void daMegaGoomba_c::dieFall_Execute() { @@ -215,6 +227,7 @@ void daMegaGoomba_c::setupBodyModel() { bool ret; nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("walk"); ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0); + this->bodyModel.bindAnim(&this->animationChr, 0.0); nw4r::g3d::ResAnmTexPat anmPat = this->resFile.GetResAnmTexPat("walk"); this->resTexPat = anmPat; @@ -508,9 +521,11 @@ void daMegaGoomba_c::beginState_Walk() { //SETUP WALK ANIMATION// nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("walk"); - this->animationChr.bind(&this->bodyModel, anmChr, 0); - this->bodyModel.bindAnim(&this->animationChr, 2.0); - /*this->animationChr._setUpdateRate(2.0); FIXME*/ + this->animationChr.bind(&this->bodyModel, anmChr, 1); + this->bodyModel.bindAnim(&this->animationChr, 0.0); + this->animationChr.setUpdateRate(1.0); + //OSReport("Current anmChr frame: %f\n", this->animationChr.getCurrentFrame()); + //OSReport("Is animation done? %d\n", this->animationChr.isAnimationDone()); this->bodyModel.bindAnim(&this->animationPat, 0.0); this->animationPat.setUpdateRateForEntry(1.0, 0); this->animationPat.setEntryByte34(0, 0); @@ -527,6 +542,9 @@ void daMegaGoomba_c::executeState_Walk() { Vec vctr; ConvertMatrixToTranslationVector(&mtx, &vctr); */ + this->animationChr.setCurrentFrame( this->animationChr.getCurrentFrame() + 1.0 ); + if(this->animationChr.getCurrentFrame() > 400.0) + this->animationChr.setCurrentFrame(1.0); //HandleAcceleration(this); //HandleXSpeed(this); diff --git a/src/player.cpp b/src/player.cpp index 75224b9..d70c19c 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -33,3 +33,27 @@ char NearestPlayer(dStageActor_c* actor) { return nearest; } +void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { + float amtX = scale->x; + float amtY = scale->y; + + ActivePhysics::Info info; + info.xDistToCenter = 0.0; + info.yDistToCenter = 3.0 * amtY; + info.xDistToEdge = 4.0 * amtX; + info.yDistToEdge = 4.0 * amtY; + + 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 d225083..4e036ae 100644 --- a/src/player.h +++ b/src/player.h @@ -6,6 +6,7 @@ extern "C" dStageActor_c* GetSpecificPlayerActor(int number); char NearestPlayer(dStageActor_c* actor); +void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale); #endif -- cgit v1.2.3 From c624775bf5f5c57757fdc5b24891dca83d7f81fd Mon Sep 17 00:00:00 2001 From: Stephen Simpson Date: Fri, 14 Oct 2011 18:03:07 -0500 Subject: anmChr working --- kamek_pal.x | 1 + src/bossMegaGoomba.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/kamek_pal.x b/kamek_pal.x index 67233c8..d804d25 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -546,6 +546,7 @@ SECTIONS { setScale__Q23m3d5mdl_cFP7Point3d = 0x8016A290; calcWorld__Q23m3d5mdl_cFb = 0x8016A2E0; bindAnim__Q23m3d5mdl_cFPQ23m3d6banm_cf = 0x8016a0c0; + vf1C__Q3m3d5mdl_cFv = 0x8016a080; SetupTextures_Player__FPQ23m3d5mdl_ci = 0x800B3E50; SetupTextures_Map__FPQ23m3d5mdl_ci = 0x800B3F50; diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index da66d16..032cfa8 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -178,8 +178,8 @@ void daMegaGoomba_c::bindAnimChr_and_setUpdateRate(const char* name, int unk, fl } void daMegaGoomba_c::dieFall_Begin() { - this->bindAnimChr_and_setUpdateRate("split", 0, 0.0); - dSprite_c::dieFall_Begin(); + //this->bindAnimChr_and_setUpdateRate("split", 0, 0.0); + //dSprite_c::dieFall_Begin(); } //TODO make this real perty like void daMegaGoomba_c::dieFall_Execute() { @@ -322,7 +322,8 @@ int daMegaGoomba_c::onExecute() { int daMegaGoomba_c::onDraw() { bodyModel.scheduleForDrawing(); - animationChr.process(); + bodyModel._vf1C(); + //animationChr.process(); animationPat.process(); return true; } @@ -542,9 +543,8 @@ void daMegaGoomba_c::executeState_Walk() { Vec vctr; ConvertMatrixToTranslationVector(&mtx, &vctr); */ - this->animationChr.setCurrentFrame( this->animationChr.getCurrentFrame() + 1.0 ); - if(this->animationChr.getCurrentFrame() > 400.0) - this->animationChr.setCurrentFrame(1.0); + if(this->animationChr.isAnimationDone()) + this->animationChr.setCurrentFrame(0.0); //HandleAcceleration(this); //HandleXSpeed(this); -- cgit v1.2.3