summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/koopatlas/player.cpp3
-rw-r--r--src/koopatlas/player.h2
-rw-r--r--src/poweruphax.S82
-rw-r--r--src/poweruphax.cpp65
-rw-r--r--src/poweruphax.h23
5 files changed, 175 insertions, 0 deletions
diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp
index 5531301..51470da 100644
--- a/src/koopatlas/player.cpp
+++ b/src/koopatlas/player.cpp
@@ -11,6 +11,8 @@ int daWMPlayer_c::onCreate() {
this->modelHandler->setSRT((Vec){0.0,100.0,-100.0}, (S16Vec){0,0,0}, (Vec){2.0,2.0,2.0});
this->modelHandler->draw();
+ hammerSuit.setup(this->modelHandler);
+
pos = (Vec){0.0f,0.0f,3000.0f};
rot = (S16Vec){0,0,0};
scale = (Vec){1.6f,1.6f,1.6f};
@@ -61,6 +63,7 @@ int daWMPlayer_c::onExecute() {
int daWMPlayer_c::onDraw() {
this->modelHandler->draw();
+ hammerSuit.draw();
return true;
}
diff --git a/src/koopatlas/player.h b/src/koopatlas/player.h
index 6e98e4e..6fbbf5a 100644
--- a/src/koopatlas/player.h
+++ b/src/koopatlas/player.h
@@ -2,6 +2,7 @@
#define __KOOPATLAS_PLAYER_H
#include "koopatlas/core.h"
+#include "poweruphax.h"
enum PlayerAnim {
wait = 0,
@@ -211,6 +212,7 @@ class daWMPlayer_c : public dActor_c {
float jumpOffset;
mEf::es2 effect;
+ dHammerSuitRenderer_c hammerSuit;
void startAnimation(int id, float frame, float unk, float updateRate);
diff --git a/src/poweruphax.S b/src/poweruphax.S
index 899b5e4..34cca4b 100644
--- a/src/poweruphax.S
+++ b/src/poweruphax.S
@@ -647,6 +647,88 @@ CheckExistingPowerup:
+.global AcPyCtorHS
+AcPyCtorHS:
+ stwu r1, -0x10(r1)
+ mflr r0
+ stw r0, 0x14(r1)
+ stw r31, 0xC(r1)
+ mr r31, r3
+
+ bl build__21dHammerSuitRenderer_cFv
+ stw r3, 0x2D08(r31)
+
+ mr r3, r31
+ lwz r31, 0xC(r1)
+ lwz r0, 0x14(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+.global AcPyDtorHS
+AcPyDtorHS:
+ stwu r1, -0x10(r1)
+ mflr r0
+ stw r0, 0x14(r1)
+ stw r31, 0xC(r1)
+ stw r30, 8(r1)
+
+ mr r31, r4
+ mr r30, r3
+
+ cmpwi r3, 0
+ beq oops
+ lwz r3, 0x2D08(r30)
+ li r4, 1
+ bl __dt__21dHammerSuitRenderer_cFv
+oops:
+
+ mr r3, r30
+ mr r4, r31
+ bl RealAcPyDtor
+
+ lwz r30, 8(r1)
+ lwz r31, 0xC(r1)
+ lwz r0, 0x14(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+.global AcPySetMeUpHS
+AcPySetMeUpHS:
+ # partway in: r31 = this
+ lwz r3, 0x2D08(r31)
+ addi r4, r31, 0x2A60
+ bl setup__21dHammerSuitRenderer_cFP21dPlayerModelHandler_c
+
+ # epilogue
+ li r3, 1
+ lwz r31, 0xC(r1)
+ lwz r0, 0x14(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+.global AcPyDrawHS
+AcPyDrawHS:
+ # partway in: r31 = this
+ lwz r3, 0x2D08(r31)
+ bl draw__21dHammerSuitRenderer_cFv
+
+ # epilogue
+ li r3, 1
+ lwz r0, 0x14(r1)
+ lwz r31, 0xC(r1)
+ mtlr r0
+ addi r1, r1, 0x10
+ blr
+
+.extern RealAcPyDtor
+.extern build__21dHammerSuitRenderer_cFv
+.extern __dt__21dHammerSuitRenderer_cFv
+.extern setup__21dHammerSuitRenderer_cFP21dPlayerModelHandler_c
+.extern draw__21dHammerSuitRenderer_cFv
+
.data
PowerupSounds:
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();
+}
+
diff --git a/src/poweruphax.h b/src/poweruphax.h
new file mode 100644
index 0000000..3736987
--- /dev/null
+++ b/src/poweruphax.h
@@ -0,0 +1,23 @@
+#ifndef POWERUPHAX_H
+#define POWERUPHAX_H
+
+class dHammerSuitRenderer_c {
+ public:
+ mHeapAllocator_c allocator;
+
+ m3d::mdl_c helmet, shell;
+
+ m3d::mdl_c *victimModel;
+ u32 headNodeID, rootNodeID;
+
+ dPlayerModel_c *victim;
+
+ dHammerSuitRenderer_c();
+ ~dHammerSuitRenderer_c();
+ void setup(dPlayerModelHandler_c *handler);
+ void draw();
+
+ static dHammerSuitRenderer_c *build();
+};
+
+#endif /* POWERUPHAX_H */