diff options
author | Treeki <treeki@gmail.com> | 2012-07-25 19:01:07 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-07-25 19:01:07 +0200 |
commit | c01d2d5df5c0bca7b8714f54e8efbd3456b1182e (patch) | |
tree | 32e300afd926ba181a8a0b1c5a2199d075e0e258 /src/koopatlas/map.cpp | |
parent | aea689a23e1390d62896ba96667631add5c33018 (diff) | |
parent | 6895c831ad320c14b01ccabe1c8adcec354e3f9f (diff) | |
download | kamek-c01d2d5df5c0bca7b8714f54e8efbd3456b1182e.tar.gz kamek-c01d2d5df5c0bca7b8714f54e8efbd3456b1182e.zip |
Merge branch 'freeform-unlocks' into level-select
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 1c2de26..e37ee4b 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); @@ -434,7 +418,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); |