diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-09-21 20:43:21 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-09-21 20:43:21 -0500 |
commit | d47a9ed57a826d60c37bfa8a4ae00ccaba0ed806 (patch) | |
tree | c3f6657118d71abcd1ce3b4584b3e0472841e53f /src/koopatlas | |
parent | 8d0a306f0a526a76182c8d2b513d7a0441d6f466 (diff) | |
parent | 5654d5c0a056f9cfc99ac608d16aa0a601b997f5 (diff) | |
download | kamek-d47a9ed57a826d60c37bfa8a4ae00ccaba0ed806.tar.gz kamek-d47a9ed57a826d60c37bfa8a4ae00ccaba0ed806.zip |
Merge branch 'level-select' of ssh://treeki.rustedlogic.net:30000/Kamek into level-select
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.h | 2 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 67 | ||||
-rw-r--r-- | src/koopatlas/map.cpp | 8 | ||||
-rw-r--r-- | src/koopatlas/mapdata.cpp | 4 | ||||
-rw-r--r-- | src/koopatlas/mapdata.h | 7 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 57 |
6 files changed, 66 insertions, 79 deletions
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index d2d9454..2674977 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -36,7 +36,7 @@ void NewerMapDrawFunc(); #define WM_HUD WM_DANCE_PAKKUN #define WM_SHOP WM_TOGEZO -#define WM_SHOPITEM WM_PUKU +#define WM_SHOPITEM WM_BOARD #define WM_STARCOIN WM_GHOST class daWMPlayer_c; diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 8f4b778..3989a1c 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -383,72 +383,7 @@ void dWMHud_c::setWorldName() { int world = node->levelNumber[0]; int level = node->levelNumber[1]; - switch (world) { - case 1: - setWorldText("Yoshi's\nIsland"); - break; - - case 2: - if (((level > 1) && (level < 5)) || (level == 15) || (level == 33) || (level == 34)) - setWorldText("Soggy\nSewers"); - else - setWorldText("Rubble\nRuins"); - break; - - case 3: - setWorldText("Mushroom\nPeaks"); - break; - - case 4: - setWorldText("Sakura\nVillage"); - break; - - case 5: - if ((level < 6) || (level == 15) || (level == 33) || (level == 34)) - setWorldText("FreezeFlame\nValley"); - else - setWorldText("FreezeFlame\nVolcano"); - break; - - case 6: - setWorldText("Pumpkin\nBoneyard"); - break; - - case 7: - if (level < 4) - setWorldText("Sky\nMountain"); - else - setWorldText("Starry\nSkies"); - break; - - case 8: - if ((level < 6) || (level == 15) || (level == 25) || (level == 33) || (level == 34)) - setWorldText("Koopa\nPlanet"); - else - setWorldText("Koopa\nCore"); - break; - - case 9: - setWorldText("Bonus\nLand"); - break; - - case 10: - if ((level < 6) || (level == 30) || (level == 41) ) - setWorldText("Goldwood\nForest"); - else if ((level < 11) || (level == 32)) - setWorldText("Mini-Mega\nIsland"); - else if ((level < 16) || (level == 33) || (level == 34) || (level == 31) ) - setWorldText("Crystal\nCaves"); - else if (level < 19) - setWorldText("Bombard\nCliffs"); - else - setWorldText("Sky\nCity"); - break; - - default: - setWorldText("Unknown\nWorld"); - break; - } + setWorldText(NewerWorldName(NewerWorldForLevelID(world, level))); } } diff --git a/src/koopatlas/map.cpp b/src/koopatlas/map.cpp index 65d71b8..316c001 100644 --- a/src/koopatlas/map.cpp +++ b/src/koopatlas/map.cpp @@ -115,6 +115,14 @@ void dWMMap_c::renderer_c::drawLayers() { dKPLayer_s *layer = data->layers[iLayer]; renderMtx[2][3] += 2.0f; + if (layer->type == dKPLayer_s::PATHS) { + // rebase the camera matrix + baseZ = 3500.0f; + nw4r::g3d::Camera cam3d(GetCameraByID(0)); + cam3d.GetCameraMtx(&renderMtx); + MTXTransApply(renderMtx, renderMtx, 0, 0, baseZ); + } + if (layer->alpha == 0) continue; // invisible diff --git a/src/koopatlas/mapdata.cpp b/src/koopatlas/mapdata.cpp index ab8ef3a..52a7937 100644 --- a/src/koopatlas/mapdata.cpp +++ b/src/koopatlas/mapdata.cpp @@ -152,7 +152,7 @@ bool dKPMapData_c::load(const char *filename) { fixup(); bool didLoadTilesets = loadTilesets(); - bool didLoadBG = (bgLoader.load("/Maps/Water.brres") != 0); + bool didLoadBG = (bgLoader.load(data->backgroundName) != 0); return didLoadTilesets && didLoadBG; } @@ -203,6 +203,8 @@ void dKPMapData_c::fixup() { fixRef(data->layers); fixRef(data->tilesets); fixRef(data->unlockData); + fixRef(data->sectors); + fixRef(data->backgroundName); for (int iLayer = 0; iLayer < data->layerCount; iLayer++) { dKPLayer_s *layer = fixRef(data->layers[iLayer]); diff --git a/src/koopatlas/mapdata.h b/src/koopatlas/mapdata.h index 40e1a43..70c31ee 100644 --- a/src/koopatlas/mapdata.h +++ b/src/koopatlas/mapdata.h @@ -179,6 +179,9 @@ struct dKPLayer_s { }; struct dKPMapFile_s { + u32 magic; + int version; + int layerCount; dKPLayer_s **layers; @@ -187,7 +190,9 @@ struct dKPMapFile_s { u8 *unlockData; - dKPLayer_s::sector_s sectors[1]; // variable size + dKPLayer_s::sector_s *sectors; + + const char *backgroundName; }; class dKPMapData_c { diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index ffc4dfd..a9cd003 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -41,11 +41,41 @@ void dWMPathManager_c::setup() { found = true; currentNode = node; - SpammyReport("a1 Node: %p\n", node); - dKPPath_s *exit = node->getAnyExit(); - SpammyReport("a2 Exit: %p\n", exit); - startMovementTo(exit); - SpammyReport("a3\n"); + // figure out where we should move to + dKPPath_s *exitTo = 0; + + for (int i = 0; i < 4; i++) { + dKPPath_s *candidateExit = node->exits[i]; + if (!candidateExit) + continue; + + // find out if this path is a candidate + dKPNode_s *srcNode = node; + dKPPath_s *path = candidateExit; + + while (true) { + dKPNode_s *destNode = (path->start == srcNode) ? path->end : path->start; + int ct = destNode->getAvailableExitCount(); + if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL) { + exitTo = path; + break; + } + + if (ct == 1) + break; + + // where to next? + path = destNode->getOppositeAvailableExitTo(path); + srcNode = destNode; + } + + if (exitTo) + break; + } + + if (!exitTo) + exitTo = node->getAnyExit(); + startMovementTo(exitTo); break; } } @@ -433,26 +463,26 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { moveSpeed = 2.0f; break; case 13: - player->startAnimation(Tjumped, 2.0, 0.0, 0.0); - break; - case 14: player->startAnimation(b_dash2, 3.0, 10.0, 0.0); player->hasSound = true; player->soundName = SE_PLY_FOOTNOTE_DIRT; moveSpeed = 5.0f; break; - case 15: + case 14: player->startAnimation(wait, 2.0, 10.0, 0.0); player->rot.y = 0x0000; MapSoundPlayer(SoundRelatedClass, SE_PLY_DOKAN_IN_OUT, 1); moveSpeed = 1.0f; break; - case 16: + case 15: player->startAnimation(wait, 2.0, 10.0, 0.0); player->rot.y = 0x8000; MapSoundPlayer(SoundRelatedClass, SE_OBJ_DOOR_OPEN, 1); moveSpeed = 0.2f; break; + case 16: + player->startAnimation(Tjumped, 2.0, 0.0, 0.0); + break; default: SpammyReport("No animtaion?!"); player->startAnimation(run, 2.0, 10.0, 0.0); @@ -560,6 +590,13 @@ void dWMPathManager_c::moveThroughPath() { SaveBlock *save = GetSaveFile()->GetBlock(-1); save->current_path_node = pathLayer->findNodeID(to); + if (to->type == dKPNode_s::LEVEL) { + NWRWorld nWorld = NewerWorldForLevelID(to->levelNumber[0], to->levelNumber[1]); + if (nWorld != UNKNOWN_WORLD) { + save->currentNewerWorld = (u8)nWorld; + } + } + dWMHud_c::instance->showPointBar(); SpammyReport("Point bar shown\n"); } else { |