diff options
Diffstat (limited to '')
-rw-r--r-- | include/g3dhax.h | 5 | ||||
-rw-r--r-- | kamek_pal.x | 52 | ||||
-rw-r--r-- | src/bossMegaGoomba.cpp | 103 | ||||
-rw-r--r-- | src/effects.cpp | 9 | ||||
-rw-r--r-- | src/effects.h | 8 |
5 files changed, 157 insertions, 20 deletions
diff --git a/include/g3dhax.h b/include/g3dhax.h index ddeb3ee..f2cdd29 100644 --- a/include/g3dhax.h +++ b/include/g3dhax.h @@ -231,6 +231,9 @@ namespace m3d { void sub_80064BF0(); void setDrawMatrix(const Mtx matrix); + void setScale(float x, float y, float z); + void setScale(Vec *scale); + void calcWorld(bool unk); void bindAnim(banm_c *animation, float unk); @@ -309,7 +312,7 @@ namespace m3d { bool setup(nw4r::g3d::ResMdl modelRes, nw4r::g3d::ResAnmTexPat anmRes, mAllocator_c *allocator, u32 *sizeOutPtr, int count); - void bindEntry(/*b*/mdl_c *model, nw4r::g3d::ResAnmTexPat resource, + void bindEntry(/*b*/mdl_c *model, nw4r::g3d::ResAnmTexPat *resource, int entryNumber, int _param4); float getFrameForEntry(int number); diff --git a/kamek_pal.x b/kamek_pal.x index 2a6e3e4..702f857 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -545,6 +545,7 @@ SECTIONS { setScale__Q23m3d5mdl_cFfff = 0x8016A270; setScale__Q23m3d5mdl_cFP7Point3d = 0x8016A290; calcWorld__Q23m3d5mdl_cFb = 0x8016A2E0; + bindAnim__Q23m3d5mdl_cFPQ23m3d6banm_cf = 0x8016a0c0; SetupTextures_Player__FPQ23m3d5mdl_ci = 0x800B3E50; SetupTextures_Map__FPQ23m3d5mdl_ci = 0x800B3F50; @@ -982,6 +983,57 @@ SECTIONS { GetResAnmChr = 0x8023A1F0; GetResAnmTexPat = 0x8023A340; + GetResAnmChr__Q34nw4r3g3d7ResFileCFPCc = 0x8023a1f0; + GetResAnmTexPat__Q34nw4r3g3d7ResFileCFPCc = 0x8023a340; + + __ct__12mAllocator_cFv = 0x8016a720; + __vt__12mAllocator_cFv = 0x80329a04; + __dt__12mAllocator_cFv = 0x8016a770; + + __vt__Q23m3d6banm_c = 0x80329920; + __dt__Q23m3d6banm_cFv = 0x80168000; + detach__Q23m3d6banm_cFv = 0x80168070; + process__Q23m3d6banm_cFv = 0x8002a1f0; + setupHeap__Q23m3d6banm_cFv = 0x801680e0; + testAnmFlag__Q23m3d6banm_cFv = 0x801681a0; + getFrameFromObj__Q23m3d6banm_cFv = 0x801681c0; + setFrameOnObj__Q23m3d6banm_cFv = 0x801681e0; + getUpdateRate__Q23m3d6banm_cFv = 0x80168200; + setUpdateRate__Q23m3d6banm_cFv = 0x80168220; + __ct__Q23m3d6fanm_cFv = 0x80168e50; + __vt__Q23m3d6fanm_c = 0x80329968; + __dt__Q23m3d6fanm_cFv = 0x80168ec0; + process__Q23m3d6fanm_cFv = 0x80168f20; + setFrame__Q23m3d6fanm_cFv = 0x80169120; + isAnimationDone__Q23m3d6fanm_cFv = 0x80169160; + querySomething__Q23m3d6fanm_cFv = 0x80169220; + + /*FIXME not right dtor ?*/ + __vt__Q23m3d8anmChr_c = 0x80303708; + __dt__Q23m3d8anmChr_cFv = 0x800260c0; + vf0C__Q23m3d8anmChr_cFv = 0x8002a210; + setup__Q23m3d8anmChr_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d9ResAnmChrP12mAllocator_cPUi = 0x80165210; + bind__Q23m3d8anmChr_cFPQ23m3d5mdl_cQ34nw4r3g3d9ResAnmChri = 0x80165330; + internalBind__Q23m3d8anmChr_cFv = 0x801653c0; + + __vt__Q23m3d11anmTexPat_c = 0x80329890; + __dt__Q23m3d11anmTexPat_cFv = 0x80166bb0; + detach__Q23m3d11anmTexPat_cFv = 0x80166c20; + setup__Q23m3d11anmTexPat_cFQ34nw4r3g3d6ResMdlQ34nw4r3g3d12ResAnmTexPatP12mAllocator_cPUii = 0x80166970; + bindEntry__Q23m3d11anmTexPat_cFv = 0x80166d10; + bindEntry__Q23m3d11anmTexPat_cFPQ23m3d5mdl_cPQ34nw4r3g3d12ResAnmTexPatii = 0x80166d10; + process__Q23m3d11anmTexPat_cFv = 0x80166f10; + processOneEntry__Q23m3d11anmTexPat_cFv = 0x80166fc0; + getFrameForEntry__Q23m3d11anmTexPat_cFv = 0x80167020; + setFrameForEntry__Q23m3d11anmTexPat_cFv = 0x80167020; + getUpdateForEntry__Q23m3d11anmTexPat_cFv = 0x80167040; + setUpdateForEntry__Q23m3d11anmTexPat_cFv = 0x80167050; + isEntryAnimationDone__Q23m3d11anmTexPat_cFv = 0x80167060; + queryEntrySomething__Q23m3d11anmTexPat_cFv = 0x80167070; + setEntryByte34__Q23m3d11anmTexPat_cFv = 0x80167080; + getEntryField28__Q23m3d11anmTexPat_cFv = 0x801670a0; + vf0C__Q23m3d11anmTexPat_cFv = 0x801670c0; + m3d__mdl_c__DoStuff = 0x80169ED0; __ashldi3 = 0x802DD4DC; diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 9817a02..8d4d19a 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -11,7 +11,14 @@ class daMegaGoomba_c : public dEn_c { int onDraw(); mHeapAllocator_c allocator; + nw4r::g3d::ResFile resFile; m3d::mdl_c bodyModel; + m3d::anmChr_c animationChr; + nw4r::g3d::ResAnmTexPat resTexPat; + m3d::anmTexPat_c animationPat; + //mAllocator_c allocator2; + //FIXME add this back in ? + //EGG::Effect effect; float timer; float dying; @@ -59,6 +66,7 @@ class daMegaGoomba_c : public dEn_c { void dieFall_Execute(); static daMegaGoomba_c *build(); + void setupBodyModel(); void updateModelMatrices(); // bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); @@ -92,9 +100,7 @@ class daMegaGoomba_c : public dEn_c { DECLARE_STATE(Launch); }; -extern "C" void *PlaySound(dStageActor_c *, int soundID); -extern void * HandleXSpeed(daMegaGoomba_c*); -//extern void * HandleYSpeed(daMegaGoomba_c*); +//extern "C" void *PlaySound(dStageActor_c *, int soundID); daMegaGoomba_c *daMegaGoomba_c::build() { void *buffer = AllocFromGameHeap1(sizeof(daMegaGoomba_c)); @@ -102,6 +108,7 @@ daMegaGoomba_c *daMegaGoomba_c::build() { } +//FIXME makes these dEn_c::HandleXSpeed(); extern "C" void *HandleXSpeed(daMegaGoomba_c *); extern "C" void *HandleYSpeed(daMegaGoomba_c *); extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daMegaGoomba_c *); @@ -189,27 +196,77 @@ void daMegaGoomba_c::dieFall_Execute() { this->dEn_c::dieFall_Execute(); } -int daMegaGoomba_c::onCreate() { +void HexDump(char* address, u32 length) { + length = (length + 0x1f) & ~0x1f; + char line[0x11] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; + for(u32 ii=0; ii < length; ii += 0x10) { + for(u32 jj=0; jj < 0x10; jj++) { + line[jj] = address[ii+jj]; + } + OSReport("%08x: %04x %04x %04x %04x %04x %04x %04x %04x |%s|\n", + (u32)(address+ii), + *(u16*)(address+ii+0x00), + *(u16*)(address+ii+0x02), + *(u16*)(address+ii+0x04), + *(u16*)(address+ii+0x06), + *(u16*)(address+ii+0x08), + *(u16*)(address+ii+0x0a), + *(u16*)(address+ii+0x0c), + *(u16*)(address+ii+0x0e), + line); + for(u32 jj=0; jj<0x10; jj++) line[jj] = 0; + } +} - OSReport("Creating the MegaGoomba Model\n"); +void daMegaGoomba_c::setupBodyModel() { + OSReport("Here 0\n"); allocator.link(-1, GameHeaps[0], 0, 0x20); - nw4r::g3d::ResFile rf(getResource("kuribo", "g3d/t02.brres")); - bodyModel.setup(rf.GetResMdl("kuribo"), &allocator, 0x224, 1, 0); + OSReport("Here 1\n"); + this->resFile.data = getResource("kuribo", "g3d/t02.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("kuribo"); + HexDump((char*)&mdl, 0x10); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); SetupTextures_Enemy(&bodyModel, 0); + bool ret; + OSReport("Here 2\n"); + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("walk"); + HexDump((char*)&anmChr, 0x10); + + OSReport("Here 3\n"); + ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0); + + OSReport("Here 4\n"); + nw4r::g3d::ResAnmTexPat anmPat = this->resFile.GetResAnmTexPat("walk"); + HexDump((char*)&anmPat, 0x10); + + OSReport("Here 5\n"); + this->resTexPat = anmPat; + + OSReport("Here 6\n"); + ret = this->animationPat.setup(mdl, anmPat, &this->allocator, 0, 1); + + OSReport("Here 7\n"); + this->animationPat.bindEntry(&this->bodyModel, &anmPat, 0, 0); + + + OSReport("Here 8\n"); allocator.unlink(); +} - OSReport("Creating MegaGoomba's Physics Struct\n"); +int daMegaGoomba_c::onCreate() { - // Keeping naming + OSReport("Creating MG's body model\n"); + setupBodyModel(); + + OSReport("Creating MegaGoomba's Physics Struct\n"); + //TODO find data for a fun, yet challenging, battle ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; HitMeBaby.yDistToCenter = 18.0; HitMeBaby.xDistToEdge = 24.0; HitMeBaby.yDistToEdge = 24.0; - - //TODO find data for a fun, yet challenging, battle HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4f; @@ -217,11 +274,12 @@ int daMegaGoomba_c::onCreate() { HitMeBaby.unkShort1C = 0; HitMeBaby.callback = &dEn_c::collisionCallback; - - OSReport("Making the Physics Class and adding to the list\n"); this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); + //sub_80034060(); + + //FIXME move this stuff elsewhere pos.y -= 16.0; pos.z = 3000.0; rot.x = rot.y = rot.z = speed.x = dying = 0.0; @@ -486,12 +544,21 @@ void daMegaGoomba_c::beginState_Walk() { this->timer = 1.0; this->direction = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, this->pos); //TODO add rot.changing on switching directions until animations added + + // DO SOMETHING COOL // + OSReport("Here11\n"); + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("walk"); + OSReport("Here12\n"); + this->animationChr.bind(&this->bodyModel, anmChr, 0); + OSReport("Here13\n"); + this->bodyModel.bindAnim(&this->animationChr, 1.0); + OSReport("Here14\n"); } void daMegaGoomba_c::executeState_Walk() { - //HandleAcceleration(); - HandleXSpeed(); - UpdateObjectPosBasedOnSpeedValues_real(); + //HandleAcceleration(this); + HandleXSpeed(this); + UpdateObjectPosBasedOnSpeedValues_real(this); //DoGravityMaybe(); int Choice; @@ -514,9 +581,9 @@ void daMegaGoomba_c::executeState_Walk() { break; //FIXME test case for sound effects case 3: - OSReport("PlaySound(this, %d)\n", this->toPlay); + //OSReport("PlaySound(this, %d)\n", this->toPlay); if(this->timeToPlay) { - PlaySound(this, this->toPlay); + //PlaySound(this, this->toPlay); this->timeToPlay = false; this->toPlay++; if(this->toPlay > 1977) diff --git a/src/effects.cpp b/src/effects.cpp index 40f08a2..3b2d5c7 100644 --- a/src/effects.cpp +++ b/src/effects.cpp @@ -1041,6 +1041,15 @@ bool CreateEffect(const char* name, Vec* pos) { return SpawnEffect(name, 0, pos, 0, 0); } +bool CreateEffect(int effect_num, Vec* pos, S16Vec* rot, Vec* scale) { + if (effect_num > 1000) + return false; + if (effect_num < 0) + return false; + const char* effect_name = effects_name_list[effect_num]; + return SpawnEffect(effect_name, 0, pos, rot, scale); +} + /* void* CustomEffectSpawn(const char* name) { // FILL ME IN diff --git a/src/effects.h b/src/effects.h index ea4ba2a..ceda53f 100644 --- a/src/effects.h +++ b/src/effects.h @@ -4,9 +4,15 @@ #include <common.h> #include <game.h> +/* +S16Vec* tRot = &(S16Vec){ 0, 0, 0}; +Vec* tScale = &(Vec){0.0, 0.0, 0.0}; +*/ + bool CreateEffect(dEn_c* enemy, int effect_num); bool CreateEffect(Vec* pos, S16Vec* rot, Vec* scale, int effect_num); -bool CreateEffect(const char* name, Vec* pos); +bool CreateEffect(Vec* pos, S16Vec* rot, Vec* scale, int effect_num); +bool CreateEffect(int effect_num, Vec* pos, S16Vec* rot = 0, Vec* scale = 0); // Actually will return an EGG::Effect instance //void* CustomEffectSpawn(const char* name); |