1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#include <common.h>
#include <game.h>
#include <g3dhax.h>
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) {
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();
}
|