summaryrefslogtreecommitdiff
path: root/src/poweruphax.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-08-28 04:44:49 +0200
committerTreeki <treeki@gmail.com>2012-08-28 04:44:49 +0200
commit2dc6dc90e21d12186bb1a88b81fd8f74baea4fbe (patch)
tree5edd508799edeeb02993f0b9f7bf38aa0291954b /src/poweruphax.cpp
parent80a9d3f3ab5a08447bbbde669e7a077ffc3f1178 (diff)
downloadkamek-2dc6dc90e21d12186bb1a88b81fd8f74baea4fbe.tar.gz
kamek-2dc6dc90e21d12186bb1a88b81fd8f74baea4fbe.zip
hammer suit model
Diffstat (limited to '')
-rw-r--r--src/poweruphax.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/poweruphax.cpp b/src/poweruphax.cpp
index 787e88f..91481af 100644
--- a/src/poweruphax.cpp
+++ b/src/poweruphax.cpp
@@ -1,5 +1,6 @@
#include <common.h>
#include <game.h>
+#include <g3dhax.h>
void ThwompHammer(dEn_c *thwomp, ActivePhysics *apThis, ActivePhysics *apOther) {
@@ -19,3 +20,67 @@ void BooHammer(dEn_c *boo, ActivePhysics *apThis, ActivePhysics *apOther) {
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) {
+ victim = (dPlayerModel_c*)handler->mdlClass;
+
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
+
+ nw4r::g3d::ResFile rf(getResource("hammerM", "g3d/suit.brres"));
+
+ helmet.setup(rf.GetResMdl("helmet"), &allocator, 0, 1, 0);
+ SetupTextures_MapObj(&helmet, 0);
+
+ shell.setup(rf.GetResMdl("shell"), &allocator, 0, 1, 0);
+ SetupTextures_MapObj(&shell, 0);
+
+ allocator.unlink();
+
+
+ victimModel = &victim->models[0].body;
+ nw4r::g3d::ResMdl *playerResMdl =
+ (nw4r::g3d::ResMdl*)(((u32)victimModel->scnObj) + 0xE8);
+
+ //headNodeID = playerResMdl->GetResNode("player_head").GetID();
+ headNodeID = playerResMdl->GetResNode("face_1").GetID();
+ rootNodeID = playerResMdl->GetResNode("skl_root").GetID();
+}
+
+void dHammerSuitRenderer_c::draw() {
+ if (victim->powerup_id != 7)
+ return;
+
+ // 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);
+
+ Mtx rootMtx;
+ victimModel->getMatrixForNode(rootNodeID, rootMtx);
+
+ shell.setDrawMatrix(rootMtx);
+ shell.setScale(1.0f, 1.0f, 1.0f);
+ shell.calcWorld(false);
+
+ helmet.scheduleForDrawing();
+ shell.scheduleForDrawing();
+}
+