diff options
-rw-r--r-- | include/g3dhax.h | 9 | ||||
-rw-r--r-- | kamek_ntsc.x | 15 | ||||
-rw-r--r-- | kamek_ntsc2.x | 15 | ||||
-rw-r--r-- | kamek_pal.x | 15 | ||||
-rw-r--r-- | kamek_pal2.x | 15 | ||||
-rw-r--r-- | src/wm_map.cpp | 94 | ||||
-rw-r--r-- | src/wm_map.h | 8 |
7 files changed, 168 insertions, 3 deletions
diff --git a/include/g3dhax.h b/include/g3dhax.h index 39872a2..125a93f 100644 --- a/include/g3dhax.h +++ b/include/g3dhax.h @@ -139,6 +139,9 @@ public: namespace m3d { + // random, just dumped it here because I dunno where else + void DisableIndirectTexturing(); + // I need to do scnLeaf_c some time... class proc_c { @@ -150,8 +153,8 @@ namespace m3d { virtual int returnUnknown(); virtual void free(); virtual bool scheduleForDrawing(); - virtual void draw1() = 0; - virtual void draw2() = 0; + virtual void drawOpa(); + virtual void drawXlu(); void setScnObjOption(ulong, ulong); bool getScnObjOption(ulong, ulong*); @@ -167,6 +170,8 @@ namespace m3d { void calcView(bool); void setDrawPriorities(int opa, int xlu); + + void *scnObj; }; class mdl_c { diff --git a/kamek_ntsc.x b/kamek_ntsc.x index c2c8861..6e9b201 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -223,6 +223,18 @@ SECTIONS { __ScnMdlSimple__Construct__Q24nw4r3g3dFPvPUiPvi = 0x8025A380; InsertIntoScene__Q24nw4r3g3dFPv = 0x80164E50; + DisableIndirectTexturing__3m3dFv = 0x80164F50; + + /* This is preliminary and kinda strange, most of these just point to ScnLeaf for now */ + setup__Q23m3d6proc_cFPvPUi = 0x80164FD0; + __ct__Q23m3d6proc_cFv = 0x8016A010; + __dt__Q23m3d6proc_cFv = 0x8016A030; + free__Q23m3d6proc_cFv = 0x8016A090; + scheduleForDrawing__Q23m3d6proc_cFv = 0x8016A0E0; + getViewMatrix__Q23m3d6proc_cFPA3_A4_f = 0x8016A190; + returnUnknown__Q23m3d6proc_cFv = 0x8000F720; + /* End preliminary section */ + __ct__Q23m3d5mdl_cFv = 0x80169CD0; __dt__Q23m3d5mdl_cFv = 0x80169D20; setup__Q23m3d5mdl_cFPvPvUiiPUi = 0x80169D90; @@ -598,12 +610,15 @@ SECTIONS { GXSetTevKAlphaSel = 0x801C85B0; GXSetTevSwapMode = 0x801C8600; GXSetTevSwapModeTable = 0x801C8640; + GXSetAlphaCompare = 0x801C86C0; GXSetTevOrder = 0x801C8790; GXSetNumTevStages = 0x801C88F0; GXSetFog = 0x801C8920; + GXSetFogRangeAdj = 0x801C8CB0; GXSetBlendMode = 0x801C8DC0; GXSetZMode = 0x801C8E70; GXSetZCompLoc = 0x801C8EB0; + GXSetDither = 0x801C8F90; GXCallDisplayList = 0x801C95E0; GXSetProjection = 0x801C9840; GXLoadPosMtxImm = 0x801C9940; diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index f6d2727..1d3822d 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -223,6 +223,18 @@ SECTIONS { __ScnMdlSimple__Construct__Q24nw4r3g3dFPvPUiPvi = 0x8025A380; InsertIntoScene__Q24nw4r3g3dFPv = 0x80164E50; + DisableIndirectTexturing__3m3dFv = 0x80164F50; + + /* This is preliminary and kinda strange, most of these just point to ScnLeaf for now */ + setup__Q23m3d6proc_cFPvPUi = 0x80164FD0; + __ct__Q23m3d6proc_cFv = 0x8016A010; + __dt__Q23m3d6proc_cFv = 0x8016A030; + free__Q23m3d6proc_cFv = 0x8016A090; + scheduleForDrawing__Q23m3d6proc_cFv = 0x8016A0E0; + getViewMatrix__Q23m3d6proc_cFPA3_A4_f = 0x8016A190; + returnUnknown__Q23m3d6proc_cFv = 0x8000F720; + /* End preliminary section */ + __ct__Q23m3d5mdl_cFv = 0x80169CD0; __dt__Q23m3d5mdl_cFv = 0x80169D20; setup__Q23m3d5mdl_cFPvPvUiiPUi = 0x80169D90; @@ -598,12 +610,15 @@ SECTIONS { GXSetTevKAlphaSel = 0x801C85B0; GXSetTevSwapMode = 0x801C8600; GXSetTevSwapModeTable = 0x801C8640; + GXSetAlphaCompare = 0x801C86C0; GXSetTevOrder = 0x801C8790; GXSetNumTevStages = 0x801C88F0; GXSetFog = 0x801C8920; + GXSetFogRangeAdj = 0x801C8CB0; GXSetBlendMode = 0x801C8DC0; GXSetZMode = 0x801C8E70; GXSetZCompLoc = 0x801C8EB0; + GXSetDither = 0x801C8F90; GXCallDisplayList = 0x801C95E0; GXSetProjection = 0x801C9840; GXLoadPosMtxImm = 0x801C9940; diff --git a/kamek_pal.x b/kamek_pal.x index fad6640..c70729d 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -223,6 +223,18 @@ SECTIONS { __ScnMdlSimple__Construct__Q24nw4r3g3dFPvPUiPvi = 0x8025A4C0;
InsertIntoScene__Q24nw4r3g3dFPv = 0x80164F90;
+ DisableIndirectTexturing__3m3dFv = 0x80165090;
+
+ /* This is preliminary and kinda strange, most of these just point to ScnLeaf for now */
+ setup__Q23m3d6proc_cFPvPUi = 0x80165110;
+ __ct__Q23m3d6proc_cFv = 0x8016A150;
+ __dt__Q23m3d6proc_cFv = 0x8016A170;
+ free__Q23m3d6proc_cFv = 0x8016A1D0;
+ scheduleForDrawing__Q23m3d6proc_cFv = 0x8016A220;
+ getViewMatrix__Q23m3d6proc_cFPA3_A4_f = 0x8016A2D0;
+ returnUnknown__Q23m3d6proc_cFv = 0x8000F720;
+ /* End preliminary section */
+
__ct__Q23m3d5mdl_cFv = 0x80169E10;
__dt__Q23m3d5mdl_cFv = 0x80169E60;
setup__Q23m3d5mdl_cFPvPvUiiPUi = 0x80169ED0;
@@ -598,12 +610,15 @@ SECTIONS { GXSetTevKAlphaSel = 0x801C86F0;
GXSetTevSwapMode = 0x801C8740;
GXSetTevSwapModeTable = 0x801C8780;
+ GXSetAlphaCompare = 0x801C8800;
GXSetTevOrder = 0x801C88D0;
GXSetNumTevStages = 0x801C8A30;
GXSetFog = 0x801C8A60;
+ GXSetFogRangeAdj = 0x801C8DF0;
GXSetBlendMode = 0x801C8F00;
GXSetZMode = 0x801C8FB0;
GXSetZCompLoc = 0x801C8FF0;
+ GXSetDither = 0x801C90D0;
GXCallDisplayList = 0x801C9720;
GXSetProjection = 0x801C9980;
GXLoadPosMtxImm = 0x801C9A80;
diff --git a/kamek_pal2.x b/kamek_pal2.x index 6c151ed..66bf7a0 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -223,6 +223,18 @@ SECTIONS { __ScnMdlSimple__Construct__Q24nw4r3g3dFPvPUiPvi = 0xDEADBEEF; InsertIntoScene__Q24nw4r3g3dFPv = 0xDEADBEEF; + DisableIndirectTexturing__3m3dFv = 0xDEADBEEF; + + /* This is preliminary and kinda strange, most of these just point to ScnLeaf for now */ + setup__Q23m3d6proc_cFPvPUi = 0xDEADBEEF; + __ct__Q23m3d6proc_cFv = 0xDEADBEEF; + __dt__Q23m3d6proc_cFv = 0xDEADBEEF; + free__Q23m3d6proc_cFv = 0xDEADBEEF; + scheduleForDrawing__Q23m3d6proc_cFv = 0xDEADBEEF; + getViewMatrix__Q23m3d6proc_cFPA3_A4_f = 0xDEADBEEF; + returnUnknown__Q23m3d6proc_cFv = 0xDEADBEEF; + /* End preliminary section */ + __ct__Q23m3d5mdl_cFv = 0xDEADBEEF; __dt__Q23m3d5mdl_cFv = 0xDEADBEEF; setup__Q23m3d5mdl_cFPvPvUiiPUi = 0xDEADBEEF; @@ -598,12 +610,15 @@ SECTIONS { GXSetTevKAlphaSel = 0xDEADBEEF; GXSetTevSwapMode = 0xDEADBEEF; GXSetTevSwapModeTable = 0xDEADBEEF; + GXSetAlphaCompare = 0xDEADBEEF; GXSetTevOrder = 0xDEADBEEF; GXSetNumTevStages = 0xDEADBEEF; GXSetFog = 0xDEADBEEF; + GXSetFogRangeAdj = 0xDEADBEEF; GXSetBlendMode = 0xDEADBEEF; GXSetZMode = 0xDEADBEEF; GXSetZCompLoc = 0xDEADBEEF; + GXSetDither = 0xDEADBEEF; GXCallDisplayList = 0xDEADBEEF; GXSetProjection = 0xDEADBEEF; GXLoadPosMtxImm = 0xDEADBEEF; diff --git a/src/wm_map.cpp b/src/wm_map.cpp index 4520a00..a4b8a48 100644 --- a/src/wm_map.cpp +++ b/src/wm_map.cpp @@ -1,4 +1,89 @@ #include "worldmap.h" +#include <rvl/PPCWGPipe.h> +#include <rvl/GXEnum.h> +#include <rvl/GXCull.h> +#include <rvl/GXVert.h> +#include <rvl/GXTev.h> +#include <rvl/GXGeometry.h> +#include <rvl/GXTexture.h> +#include <rvl/GXLighting.h> +#include <rvl/GXPixel.h> +#include <rvl/GXTransform.h> + + +void dPathTest_c::drawOpa() { + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + + m3d::DisableIndirectTexturing(); + + GXSetNumChans(0); + + GXSetNumTexGens(1); + GXSetTexCoordGen2(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_NRM, GX_IDENTITY, GX_FALSE, GX_PTIDENTITY); + + GXSetNumTevStages(0); + GXSetTevSwapModeTable(GX_TEV_SWAP0, GX_CH_RED, GX_CH_GREEN, GX_CH_BLUE, GX_CH_ALPHA); + + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C1, GX_CC_C0, GX_CC_TEXC, GX_CC_ZERO); + GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C1, GX_CC_C0, GX_CC_C0, GX_CC_ZERO); + GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_TEXA, GX_CA_ZERO); + GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_A0, GX_CA_A1, GX_CA_ZERO); + GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); + //GXSetTevOp(GX_TEVSTAGE0, GX_PASSCLR); + + GXSetZCompLoc(0); + GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_SET); + GXSetZMode(GX_TRUE, GX_LEQUAL, GX_FALSE); + GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0); + + GXSetFog(GX_FOG_NONE, 0.0f, 0.0f, 0.0f, 0.0f, (GXColor){0,0,0,0}); + GXSetFogRangeAdj(0, 0, 0); + + GXSetCullMode(GX_CULL_NONE); + GXSetDither(GX_TRUE); + + GXSetTevColor(GX_TEVREG0, (GXColor){128,128,128,128}); + GXSetTevColor(GX_TEVREG1, (GXColor){128,128,128,128}); + + nw4r::g3d::Camera cam(GetCameraByID(GetCurrentCameraID())); + Mtx camMtx; + cam.GetCameraMtx(&camMtx); + //MTXInverse(camMtx, camMtx); + + Mtx viewMatrix; + getViewMatrix(&viewMatrix); + + //camMtx[0][3] = 0.0f; + //camMtx[1][3] = 0.0f; + //camMtx[2][3] = 0.0f; + + //MTXConcat(viewMatrix, camMtx, viewMatrix); + + GXLoadPosMtxImm(camMtx, GX_PNMTX0); + GXSetCurrentMtx(GX_PNMTX0); + + GXBegin(GX_QUADS, GX_VTXFMT0, 4); + GXPosition3f32(-400, 0, -400); + GXTexCoord2f32(0, 0); + GXPosition3f32(400, 0, -400); + GXTexCoord2f32(1, 0); + GXPosition3f32(400, 0, 400); + GXTexCoord2f32(1, 1); + GXPosition3f32(-400, 0, 400); + GXTexCoord2f32(0, 1); + GXEnd(); +} + +void dPathTest_c::drawXlu() { +} + + dWMMap_c *dWMMap_c::instance = 0; @@ -45,6 +130,9 @@ int dWMMap_c::onCreate() { node->loadFrom(nodeData, &allocator); } + SpammyReport("Making path test\n"); + pathTest.setup(&allocator); + SpammyReport("Unlinking allocator\n"); allocator.unlink(); @@ -56,6 +144,8 @@ int dWMMap_c::onCreate() { int dWMMap_c::onDelete() { delete[] nodes; + pathTest.free(); + return true; } @@ -73,6 +163,8 @@ int dWMMap_c::onDraw() { nodes[i].draw(); } + pathTest.scheduleForDrawing(); + SpammyReport("dWMMap_c::onDraw() completed\n"); return true; } @@ -113,6 +205,6 @@ void WMSceneNode::loadFrom(WMSceneDataNode *data, mHeapAllocator_c *allocator) { void WMSceneNode::draw() { - model.scheduleForDrawing(); + //model.scheduleForDrawing(); } diff --git a/src/wm_map.h b/src/wm_map.h index 2ca55a0..9fd269c 100644 --- a/src/wm_map.h +++ b/src/wm_map.h @@ -28,6 +28,12 @@ public: void draw(); }; +class dPathTest_c : public m3d::proc_c { +public: + void drawOpa(); + void drawXlu(); +}; + class dWMMap_c : public dBase_c { public: @@ -38,6 +44,8 @@ public: mHeapAllocator_c allocator; + dPathTest_c pathTest; + WMSceneDataHeader *data; WMSceneNode *nodes; |