summaryrefslogtreecommitdiff
path: root/src/poweruphax.cpp
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2012-10-14 06:10:56 +0200
committerTreeki <treeki@gmail.com>2012-10-14 06:10:56 +0200
commit8135ce4837c702c73460ecb7e8b7511c902a01bf (patch)
tree73bfae3d9a98ccfb5e039037febbaebddfcbe3e0 /src/poweruphax.cpp
parentd1434fecca2252b9581ff6a43ed0c761bbc73f3c (diff)
downloadkamek-8135ce4837c702c73460ecb7e8b7511c902a01bf.tar.gz
kamek-8135ce4837c702c73460ecb7e8b7511c902a01bf.zip
hammer suit on wm2dplayer
Diffstat (limited to 'src/poweruphax.cpp')
-rw-r--r--src/poweruphax.cpp44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/poweruphax.cpp b/src/poweruphax.cpp
index 91481af..42f42ae 100644
--- a/src/poweruphax.cpp
+++ b/src/poweruphax.cpp
@@ -35,17 +35,26 @@ 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"));
- helmet.setup(rf.GetResMdl("helmet"), &allocator, 0, 1, 0);
- SetupTextures_MapObj(&helmet, 0);
+ 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);
+ }
- shell.setup(rf.GetResMdl("shell"), &allocator, 0, 1, 0);
- SetupTextures_MapObj(&shell, 0);
+ 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();
@@ -55,23 +64,33 @@ void dHammerSuitRenderer_c::setup(dPlayerModelHandler_c *handler) {
(nw4r::g3d::ResMdl*)(((u32)victimModel->scnObj) + 0xE8);
//headNodeID = playerResMdl->GetResNode("player_head").GetID();
- headNodeID = playerResMdl->GetResNode("face_1").GetID();
+ if (victim->player_id_1 <= 1)
+ headNodeID = playerResMdl->GetResNode("face_1").GetID();
rootNodeID = playerResMdl->GetResNode("skl_root").GetID();
+
+ thing = 0;
}
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);
+ if (victim->player_id_1 <= 1) {
+ // Materials: 2=hair 3=hat; Modes: BACK=visible ALL=invisible
+ SetCullModeForMaterial(&victim->getCurrentModel()->head, 3, GX_CULL_ALL);
+ thing += 80;
+
+ Mtx headMtx;
+ victimModel->getMatrixForNode(headNodeID, headMtx);
+ mMtx *thing2 = (mMtx*)(&headMtx);
+ thing2->applyRotationZ(&thing);
- Mtx headMtx;
- victimModel->getMatrixForNode(headNodeID, headMtx);
+ helmet.setDrawMatrix(headMtx);
+ helmet.setScale(1.0f, 1.0f, 1.0f);
+ helmet.calcWorld(false);
- helmet.setDrawMatrix(headMtx);
- helmet.setScale(1.0f, 1.0f, 1.0f);
- helmet.calcWorld(false);
+ helmet.scheduleForDrawing();
+ }
Mtx rootMtx;
victimModel->getMatrixForNode(rootNodeID, rootMtx);
@@ -80,7 +99,6 @@ void dHammerSuitRenderer_c::draw() {
shell.setScale(1.0f, 1.0f, 1.0f);
shell.calcWorld(false);
- helmet.scheduleForDrawing();
shell.scheduleForDrawing();
}