#include #include #include void ThwompHammer(dEn_c *thwomp, ActivePhysics *apThis, ActivePhysics *apOther) { if (thwomp->name == 0x51) { thwomp->dEn_c::collisionCat13_Hammer(apThis, apOther); } return; } void BooHammer(dEn_c *boo, ActivePhysics *apThis, ActivePhysics *apOther) { if (boo->name == 0xB0) { boo->dEn_c::collisionCat13_Hammer(apThis, apOther); } return; } void UrchinHammer(dEn_c *urchin, ActivePhysics *apThis, ActivePhysics *apOther) { return; } #include "poweruphax.h" void SetCullModeForMaterial(m3d::mdl_c *model, int materialID, GXCullMode mode); dHammerSuitRenderer_c *dHammerSuitRenderer_c::build() { return new dHammerSuitRenderer_c; } dHammerSuitRenderer_c::dHammerSuitRenderer_c() { } dHammerSuitRenderer_c::~dHammerSuitRenderer_c() { } void dHammerSuitRenderer_c::setup(dPlayerModelHandler_c *handler) { setup(handler, 0); } void dHammerSuitRenderer_c::setup(dPlayerModelHandler_c *handler, int sceneID) { victim = (dPlayerModel_c*)handler->mdlClass; allocator.link(-1, GameHeaps[0], 0, 0x20); nw4r::g3d::ResFile rf(getResource("hammerM", "g3d/suit.brres")); if (victim->player_id_1 <= 1) { helmet.setup(rf.GetResMdl((victim->player_id_1 == 0) ? "marioHelmet" : "luigiHelmet"), &allocator, 0, 1, 0); SetupTextures_MapObj(&helmet, sceneID); } const char *shellNames[] = { "shell", "shell", "shell", "shell", "shell" }; shell.setup(rf.GetResMdl(shellNames[victim->player_id_1]), &allocator, 0, 1, 0); SetupTextures_MapObj(&shell, sceneID); allocator.unlink(); victimModel = &victim->models[0].body; nw4r::g3d::ResMdl *playerResMdl = (nw4r::g3d::ResMdl*)(((u32)victimModel->scnObj) + 0xE8); //headNodeID = playerResMdl->GetResNode("player_head").GetID(); if (victim->player_id_1 <= 1) headNodeID = playerResMdl->GetResNode("face_1").GetID(); rootNodeID = playerResMdl->GetResNode("skl_root").GetID(); } void dHammerSuitRenderer_c::draw() { if (victim->powerup_id != 7) return; if (victim->player_id_1 <= 1) { // Materials: 2=hair 3=hat; Modes: BACK=visible ALL=invisible SetCullModeForMaterial(&victim->getCurrentModel()->head, 3, GX_CULL_ALL); Mtx headMtx; victimModel->getMatrixForNode(headNodeID, headMtx); helmet.setDrawMatrix(headMtx); helmet.setScale(1.0f, 1.0f, 1.0f); helmet.calcWorld(false); helmet.scheduleForDrawing(); } Mtx rootMtx; victimModel->getMatrixForNode(rootNodeID, rootMtx); shell.setDrawMatrix(rootMtx); shell.setScale(1.0f, 1.0f, 1.0f); shell.calcWorld(false); shell.scheduleForDrawing(); }