diff options
author | Treeki <treeki@gmail.com> | 2011-06-17 04:33:54 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-06-17 04:33:54 +0200 |
commit | 2c119d1027bd81b53e2685988d10e95f6b666038 (patch) | |
tree | cfd556816b1b8caf2109720bcacdc80031360f31 | |
parent | 6e72f2c302a4ff0658afb29d9b7799768ca4baf6 (diff) | |
download | kamek-2c119d1027bd81b53e2685988d10e95f6b666038.tar.gz kamek-2c119d1027bd81b53e2685988d10e95f6b666038.zip |
you can now only travel through paths you've unlocked
Diffstat (limited to '')
-rw-r--r-- | src/wm_path_manager.cpp | 25 | ||||
-rw-r--r-- | src/worldmap.h | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/wm_path_manager.cpp b/src/wm_path_manager.cpp index 03c11d4..1f0b460 100644 --- a/src/wm_path_manager.cpp +++ b/src/wm_path_manager.cpp @@ -39,13 +39,13 @@ int dWMPathManager_c::onExecute() { if (isMoving) { moveThroughPath(); } else { - if (nowPressed & WPAD_LEFT && currentPoint->exits.asDirection.left.isValid()) + if (nowPressed & WPAD_LEFT && canUseEntrance(currentPoint->exits.asDirection.left)) startMovementTo(LEFT); - else if (nowPressed & WPAD_RIGHT && currentPoint->exits.asDirection.right.isValid()) + else if (nowPressed & WPAD_RIGHT && canUseEntrance(currentPoint->exits.asDirection.right)) startMovementTo(RIGHT); - else if (nowPressed & WPAD_UP && currentPoint->exits.asDirection.up.isValid()) + else if (nowPressed & WPAD_UP && canUseEntrance(currentPoint->exits.asDirection.up)) startMovementTo(UP); - else if (nowPressed & WPAD_DOWN && currentPoint->exits.asDirection.down.isValid()) + else if (nowPressed & WPAD_DOWN && canUseEntrance(currentPoint->exits.asDirection.down)) startMovementTo(DOWN); else if (nowPressed & WPAD_TWO) activatePoint(); @@ -55,6 +55,19 @@ int dWMPathManager_c::onExecute() { } +bool dWMPathManager_c::canUseEntrance(WMPathEntrance &entrance) { + if (!entrance.isValid()) + return false; + + if (entrance.path->eventRequired != 0xFFFF) { + if (!events[entrance.path->eventRequired]) + return false; + } + + return true; +} + + void dWMPathManager_c::moveThroughPath() { // figure out how much to move on each step Vec from, to; @@ -219,7 +232,7 @@ void dWMPathManager_c::setInitialPathVisibility() { u8 alphaToUse = 255; if (path->eventRequired != 0xFFFF) { if (!events[path->eventRequired]) - alphaToUse = 128; + alphaToUse = 92; } for (int j = 0; j < path->materialCount; j++) { @@ -243,7 +256,7 @@ void dWMPathManager_c::computeEvents() { if (point->type == WMPathPoint::LEVEL_TYPE) { // TODO: check if the world/level need to be -1 or not - u32 conds = save->GetLevelCondition(point->params[0], point->params[1]); + u32 conds = save->GetLevelCondition(point->params[0] - 1, point->params[1] - 1); if (conds & COND_NORMAL && point->params[2] != -1) events[point->params[2]] = true; diff --git a/src/worldmap.h b/src/worldmap.h index b356bac..304b08d 100644 --- a/src/worldmap.h +++ b/src/worldmap.h @@ -119,6 +119,8 @@ class dWMPathManager_c : public dBase_c { void moveThroughPath();
+ bool canUseEntrance(WMPathEntrance &entrance);
+
/* Other Methods */
void setup();
|