From b5c29919c928e55e10b82d9de2dd9879b5e1a32b Mon Sep 17 00:00:00 2001 From: Treeki Date: Tue, 30 Apr 2013 17:34:29 +0200 Subject: move automatically after beating castles/fortresses --- src/koopatlas/pathmanager.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/koopatlas/pathmanager.h | 3 +++ 2 files changed, 39 insertions(+) (limited to 'src/koopatlas') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 697b9fb..9741c4b 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -909,6 +909,42 @@ void dWMPathManager_c::execute() { return; } + if (shouldRequestSave && !checkedForMoveAfterEndLevel) { + checkedForMoveAfterEndLevel = true; + + static const int endLevels[11][3] = { + {1, 38, 1}, // W1 right + {2, 38, 2}, // W2 up + {3, 38, 0}, // W3 left + {4, 38, 1}, // W4 right + {5, 38, 1}, // W5 right + {6, 38, 2}, // W6 up + {7, 38, 1}, // W7 right + {10, 5, 2}, // GW up + {10, 10, 0}, // MM left + {10, 15, 3}, // CC down + {10, 25, 1}, // SC right + }; + + int w = LastLevelPlayed[0] + 1; + int l = LastLevelPlayed[1] + 1; + + for (int i = 0; i < 11; i++) { + if (endLevels[i][0] == w && endLevels[i][1] == l) { + afterFortressMode = true; + startMovementTo(currentNode->exits[endLevels[i][2]]); + return; + } + } + } + + if (afterFortressMode) { + if (isMoving) + moveThroughPath(-1); + else + afterFortressMode = false; + } + if (shouldRequestSave) { dScKoopatlas_c::instance->showSaveWindow(); shouldRequestSave = false; diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index afd8103..42d94ba 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -108,6 +108,9 @@ class dWMPathManager_c { int waitAfterInitialPlayerAnim; bool initialLoading; + bool checkedForMoveAfterEndLevel; + bool afterFortressMode; + bool doingThings(); dLevelInfo_c::entry_s *enteredLevel; -- cgit v1.2.3