diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/map.cpp | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index 4d2bc1d..2486d34 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -45,7 +45,6 @@ int dWMMap_c::onCreate() { renderer.allocator.setup(GameHeaps[0], 0x20); bool result = renderer.setup(&renderer.allocator); - bgMatrix.identity(); bgMatrix.translation(0.0f, 0.0f, -500.0f); allocator.link(-1, GameHeaps[0], 0, 0x20); @@ -112,34 +111,21 @@ void dWMMap_c::renderer_c::drawLayers() { beginRendering(); - bool cont = false; for (int iLayer = data->layerCount - 1; iLayer >= 0; iLayer--) { dKPLayer_s *layer = data->layers[iLayer]; renderMtx[2][3] += 2.0f; - cont = false; - for (int iNodes = dataCls->pathLayer->nodeCount - 1; iNodes >= 0; iNodes--) { - dKPNode_s *node = dataCls->pathLayer->nodes[iNodes]; - bool unlock = node->isUnlocked(); - if (!unlock) { - if (node->tileLayer == layer) { cont = true; break; } - if (node->doodadLayer == layer) { cont = true; break; } - } - } - for (int iPaths = dataCls->pathLayer->pathCount - 1; iPaths >= 0; iPaths--) { - dKPPath_s *path = dataCls->pathLayer->paths[iPaths]; - if (!path->isAvailable) { - if (path->tileLayer == layer) { cont = true; break; } - if (path->doodadLayer == layer) { cont = true; break; } - } - } + if (layer->alpha == 0) + continue; // invisible - if (cont) { continue; } TileReport("Checking layer %d with type %d\n", iLayer, layer->type); + + GXSetTevColor(GX_TEVREG0, (GXColor){255,255,255,layer->alpha}); + if (layer->type == dKPLayer_s::OBJECTS) - renderTileLayer(layer, data->sectors, 255); + renderTileLayer(layer, data->sectors); else if (layer->type == dKPLayer_s::DOODADS) - renderDoodadLayer(layer, 255); + renderDoodadLayer(layer); } endRendering(); @@ -209,7 +195,7 @@ void dWMMap_c::renderer_c::beginRendering() { GXSetTevColor(GX_TEVREG1, (GXColor){0,0,0,255}); } -void dWMMap_c::renderer_c::renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector_s *sectors, int alpha) { +void dWMMap_c::renderer_c::renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector_s *sectors) { //TileReport("Rendering layer %p\n", layer); // don't render it if we don't need to @@ -288,8 +274,6 @@ void dWMMap_c::renderer_c::renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector float coordY2 = yMult * (tileY + 26.0f); - GXSetTevColor(GX_TEVREG0, (GXColor){255,255,255,alpha}); - GXBegin(GX_QUADS, GX_VTXFMT0, 4); GXPosition2s16(worldX + 24, worldY - 24); GXTexCoord2f32(coordX2, coordY2); @@ -310,7 +294,7 @@ void dWMMap_c::renderer_c::renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector //TileReport("Layer complete\n"); } -void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer, int alpha) { +void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer) { for (int i = 0; i < layer->doodadCount; i++) { dKPDoodad_s *doodad = layer->doodads[i]; DoodadReport("Doodad @ %f,%f sized %f,%f with angle %f\n", doodad->x, doodad->y, doodad->width, doodad->height, doodad->angle); @@ -430,7 +414,6 @@ void dWMMap_c::renderer_c::renderDoodadLayer(dKPLayer_s *layer, int alpha) { loadCamera(doodadMtx); loadTexture(doodad->texObj); - GXSetTevColor(GX_TEVREG0, (GXColor){255,255,255,alpha}); GXBegin(GX_QUADS, GX_VTXFMT1, 4); GXPosition2f32(halfW, -halfH); GXTexCoord2u8(255, 255); |