diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/koopatlas/camera.cpp | 25 | ||||
-rw-r--r-- | src/koopatlas/map.cpp | 36 | ||||
-rw-r--r-- | src/koopatlas/map.h | 6 | ||||
-rw-r--r-- | src/koopatlas/mapdata.cpp | 7 | ||||
-rw-r--r-- | src/koopatlas/mapdata.h | 2 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 2 | ||||
-rw-r--r-- | src/koopatlas/player.cpp | 2 |
7 files changed, 61 insertions, 19 deletions
diff --git a/src/koopatlas/camera.cpp b/src/koopatlas/camera.cpp index 9efbcd6..87547d9 100644 --- a/src/koopatlas/camera.cpp +++ b/src/koopatlas/camera.cpp @@ -70,30 +70,29 @@ int dWorldCamera_c::onDelete() { int dWorldCamera_c::onExecute() { int heldButtons = Remocon_GetButtons(GetActiveRemocon()); if (heldButtons & WPAD_MINUS) { - int nowPressed = Remocon_GetPressed(GetActiveRemocon()); bool change = false; - if (nowPressed & WPAD_LEFT) { - currentX -= 16; + if (heldButtons & WPAD_LEFT) { + currentX -= 8.0f; change = true; } - if (nowPressed & WPAD_RIGHT) { - currentX += 16; + if (heldButtons & WPAD_RIGHT) { + currentX += 8.0f; change = true; } - if (nowPressed & WPAD_UP) { - currentY += 16; + if (heldButtons & WPAD_UP) { + currentY += 8.0f; change = true; } - if (nowPressed & WPAD_DOWN) { - currentY -= 16; + if (heldButtons & WPAD_DOWN) { + currentY -= 8.0f; change = true; } - if (nowPressed & WPAD_B) { - zoomLevel -= 0.02; + if (heldButtons & WPAD_B) { + zoomLevel -= 0.10f; change = true; } - if (nowPressed & WPAD_A) { - zoomLevel += 0.02; + if (heldButtons & WPAD_A) { + zoomLevel += 0.10f; change = true; } if (change) { 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) diff --git a/src/koopatlas/map.h b/src/koopatlas/map.h index c74384f..72dd2d5 100644 --- a/src/koopatlas/map.h +++ b/src/koopatlas/map.h @@ -59,6 +59,12 @@ class dWMMap_c : public dBase_c { renderer_c renderer; + mHeapAllocator_c allocator; + m3d::mdl_c bgModel; + m3d::anmTexSrt_c bgSrtAnm; + mMtx bgMatrix; + S16Vec thing; + static dWMMap_c *build(); static dWMMap_c *instance; }; diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index fb09f1b..5b38126 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -50,7 +50,10 @@ bool dKPMapData_c::load(const char *filename) { if (!fixedUp) fixup(); - return loadTilesets(); + bool didLoadTilesets = loadTilesets(); + bool didLoadBG = (bgLoader.load("/Maps/Water.brres") != 0); + + return didLoadTilesets && didLoadBG; } bool dKPMapData_c::loadTilesets() { @@ -88,6 +91,8 @@ void dKPMapData_c::unloadTilesets() { delete[] tilesetLoaders; } + + bgLoader.unload(); } void dKPMapData_c::fixup() { diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h index f9aa545..e75925d 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -193,6 +193,8 @@ class dKPMapData_c { dKPMapFile_s *data; dKPLayer_s *pathLayer; + dDvdLoader_c bgLoader; + dKPMapData_c(); bool load(const char *filename); ~dKPMapData_c(); diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 30f4920..609b3a2 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -83,7 +83,7 @@ void dWMPathManager_c::moveThroughPath() { Vec move = (Vec){to->x - from->x, to->y - from->y, 0}; VECNormalize(&move, &move); - VECScale(&move, &move, 1.5); + VECScale(&move, &move, 3.0f); daWMPlayer_c *player = daWMPlayer_c::instance; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index 2255eb7..c89535f 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -15,7 +15,7 @@ int daWMPlayer_c::onCreate() { pos = (Vec){0.0f,0.0f,3000.0f}; rot = (S16Vec){0,0,0}; - scale = (Vec){1.0f,1.0f,1.0f}; + scale = (Vec){1.6f,1.6f,1.6f}; current_param = 0; |