diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/map.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index ac7cc51..4600556 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -52,14 +52,44 @@ int dWMMap_c::onCreate() { else OSReport(":(\n"); + bgMatrix.translation(1140.0f, -2910.0f, -500.0f); + s16 rot = 0x4000; + bgMatrix.applyRotationX(&rot); + + allocator.link(-1, GameHeaps[0], 0, 0x20); + nw4r::g3d::ResFile rf(dScKoopatlas_c::instance->mapData.bgLoader.buffer); + rf.CheckRevision(); + rf.Init(); + rf.Bind(rf); + + // Todo: Check flags. 0x32C definitely supports texsrt + nw4r::g3d::ResMdl modelRes = rf.GetResMdl("KpBG"); + nw4r::g3d::ResAnmTexSrt anmRes = rf.GetResAnmTexSrt("KpBG"); + + bgModel.setup(modelRes, &allocator, 0x32C, 1, 0); + bgSrtAnm.setup(modelRes, anmRes, &allocator, 0, 1); + bgSrtAnm.bindEntry(&bgModel, anmRes, 0, 0); + bgModel.bindAnim(&bgSrtAnm, 0.0f); + + allocator.unlink(); + return true; } int dWMMap_c::onDelete() { return true; } -int dWMMap_c::onExecute() { return true; } +int dWMMap_c::onExecute() { + bgSrtAnm.process(); + + bgModel.setDrawMatrix(bgMatrix); + bgModel.setScale(1.0f, 1.0f, 1.0f); + bgModel.calcWorld(false); + + return true; +} int dWMMap_c::onDraw() { renderer.scheduleForDrawing(); + bgModel.scheduleForDrawing(); return true; } @@ -81,13 +111,13 @@ void dWMMap_c::renderer_c::drawLayers() { dKPMapData_c *dataCls = &dScKoopatlas_c::instance->mapData; dKPMapFile_s *data = dataCls->data; - baseZ = -100 - (2 * data->layerCount); + baseZ = -100.0f - (2 * data->layerCount); beginRendering(); for (int iLayer = data->layerCount - 1; iLayer >= 0; iLayer--) { dKPLayer_s *layer = data->layers[iLayer]; - renderMtx[2][3] += 2; + renderMtx[2][3] += 2.0f; TileReport("Checking layer %d with type %d\n", iLayer, layer->type); if (layer->type == dKPLayer_s::OBJECTS) |