diff options
author | Treeki <treeki@gmail.com> | 2012-10-14 06:10:56 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-10-14 06:10:56 +0200 |
commit | 8135ce4837c702c73460ecb7e8b7511c902a01bf (patch) | |
tree | 73bfae3d9a98ccfb5e039037febbaebddfcbe3e0 /src | |
parent | d1434fecca2252b9581ff6a43ed0c761bbc73f3c (diff) | |
download | kamek-8135ce4837c702c73460ecb7e8b7511c902a01bf.tar.gz kamek-8135ce4837c702c73460ecb7e8b7511c902a01bf.zip |
hammer suit on wm2dplayer
Diffstat (limited to 'src')
-rw-r--r-- | src/poweruphax.S | 99 | ||||
-rw-r--r-- | src/poweruphax.cpp | 44 | ||||
-rw-r--r-- | src/poweruphax.h | 3 |
3 files changed, 131 insertions, 15 deletions
diff --git a/src/poweruphax.S b/src/poweruphax.S index 7181b4d..43480c3 100644 --- a/src/poweruphax.S +++ b/src/poweruphax.S @@ -691,11 +691,11 @@ AcPyDtorHS: mr r30, r3 cmpwi r3, 0 - beq oops + beq oops2 lwz r3, 0x2D08(r30) li r4, 1 bl __dt__21dHammerSuitRenderer_cFv -oops: +oops2: mr r3, r30 mr r4, r31 @@ -737,11 +737,106 @@ AcPyDrawHS: addi r1, r1, 0x10 blr + + +# DO IT AGAIN +.global Wm2dPlayerCtorHS +Wm2dPlayerCtorHS: + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xC(r1) + mr r31, r3 + + bl build__21dHammerSuitRenderer_cFv + stw r3, 0x384(r31) + + mr r3, r31 + lwz r31, 0xC(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + +.global Wm2dPlayerDtorHS +Wm2dPlayerDtorHS: + 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, 0x384(r30) + li r4, 1 + bl __dt__21dHammerSuitRenderer_cFv +oops: + + mr r3, r30 + mr r4, r31 + bl RealWm2dPlayerDtor + + lwz r30, 8(r1) + lwz r31, 0xC(r1) + lwz r0, 0x14(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + +.global Wm2dPlayerSetMeUpHS +Wm2dPlayerSetMeUpHS: + # partway in: r27 = this + lwz r3, 0x384(r27) + lwz r4, 0x128(r27) + li r5, 1 + bl setup__21dHammerSuitRenderer_cFP21dPlayerModelHandler_ci + + # epilogue + addi r11, r1, 0x20 + bl _restgpr_27 + lwz r0, 0x24(r1) + mtlr r0 + addi r1, r1, 0x20 + blr + +.global Wm2dPlayerDrawHS +Wm2dPlayerDrawHS: + # dicks (a very insightful comment) + lbz r0, 0x261(r3) + cmpwi r0, 0 + beqlr + + stwu r1, -0x10(r1) + mflr r0 + stw r0, 0x14(r1) + stw r31, 0xC(r1) + mr r31, r3 + + lwz r3, 0x384(r31) + bl draw__21dHammerSuitRenderer_cFv + + lwz r3, 0x128(r31) + bl draw__21dPlayerModelHandler_cFv + + lwz r0, 0x14(r1) + lwz r31, 0xC(r1) + mtlr r0 + addi r1, r1, 0x10 + blr + +.extern _restgpr_27 .extern RealAcPyDtor +.extern RealWm2dPlayerDtor .extern build__21dHammerSuitRenderer_cFv .extern __dt__21dHammerSuitRenderer_cFv +.extern setup__21dHammerSuitRenderer_cFP21dPlayerModelHandler_ci .extern setup__21dHammerSuitRenderer_cFP21dPlayerModelHandler_c .extern draw__21dHammerSuitRenderer_cFv +.extern draw__21dPlayerModelHandler_cFv .data 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(); } diff --git a/src/poweruphax.h b/src/poweruphax.h index 3736987..b58b59e 100644 --- a/src/poweruphax.h +++ b/src/poweruphax.h @@ -12,9 +12,12 @@ class dHammerSuitRenderer_c { dPlayerModel_c *victim; + s16 thing; + dHammerSuitRenderer_c(); ~dHammerSuitRenderer_c(); void setup(dPlayerModelHandler_c *handler); + void setup(dPlayerModelHandler_c *handler, int sceneID); void draw(); static dHammerSuitRenderer_c *build(); |