summaryrefslogtreecommitdiff
path: root/src/koopatlas
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-08-30 13:26:24 -0500
committerColin Noga <Tempus@chronometry.ca>2012-08-30 13:26:24 -0500
commit463e256e6a239facb902da4566502a14684e1b94 (patch)
treee23cfab94ddf70e33d29640823fc2857493466fe /src/koopatlas
parent5d5eb65d2dc63f4fe4297972b4259cf5ab08ecaa (diff)
downloadkamek-463e256e6a239facb902da4566502a14684e1b94.tar.gz
kamek-463e256e6a239facb902da4566502a14684e1b94.zip
some path fixes
Diffstat (limited to 'src/koopatlas')
-rw-r--r--src/koopatlas/pathmanager.cpp56
1 files changed, 31 insertions, 25 deletions
diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp
index fa618b0..f8a1854 100644
--- a/src/koopatlas/pathmanager.cpp
+++ b/src/koopatlas/pathmanager.cpp
@@ -91,7 +91,7 @@ void dWMPathManager_c::unlockPaths() {
u8 *oldNodeAvData = NodeAvailabilityData;
NodeAvailabilityData = new u8[pathLayer->nodeCount];
- OSReport("Unlocking paths\n");
+ SpammyReport("Unlocking paths\n");
// unlock all needed paths
for (int i = 0; i < pathLayer->pathCount; i++) {
@@ -99,7 +99,7 @@ void dWMPathManager_c::unlockPaths() {
PathAvailabilityData[i] = path->isAvailable;
- //OSReport("Path %d: %d\n", i, path->isAvailable);
+ //SpammyReport("Path %d: %d\n", i, path->isAvailable);
// if this path is not "always available", then nuke its alpha
path->setLayerAlpha((path->isAvailable == dKPPath_s::ALWAYS_AVAILABLE) ? 255 : 0);
}
@@ -110,46 +110,46 @@ void dWMPathManager_c::unlockPaths() {
SaveBlock *save = GetSaveFile()->GetBlock(-1);
u8 *in = (u8*)dScKoopatlas_c::instance->mapData.data->unlockData;
- OSReport("UNLOCKING PATHS: Unlock data @ %p\n", in);
+ SpammyReport("UNLOCKING PATHS: Unlock data @ %p\n", in);
int cmdID = 0;
while (*in != 0) {
- OSReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID);
+ SpammyReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID);
// begin processing a block
bool value = evaluateUnlockCondition(in, save, 0);
- OSReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value);
- //OSReport("Unlock condition: %d\n", value);
+ SpammyReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value);
+ //SpammyReport("Unlock condition: %d\n", value);
// get what it's supposed to affect
// for now we'll assume that it affects one or more paths
u8 affectedCount = *(in++);
- OSReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount);
+ SpammyReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount);
for (int i = 0; i < affectedCount; i++) {
u8 one = *(in++);
u8 two = *(in++);
u16 pathID = (one << 8) | two;
- OSReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID);
+ SpammyReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID);
dKPPath_s *path = pathLayer->paths[pathID];
- OSReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path);
+ SpammyReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path);
path->isAvailable = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE;
- OSReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i);
+ SpammyReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i);
PathAvailabilityData[pathID] = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE;
- OSReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i);
+ SpammyReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i);
// NEWLY_AVAILABLE is set later, when that stuff is figured out
path->setLayerAlpha(value ? 255 : 0);
- OSReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i);
+ SpammyReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i);
}
- OSReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount);
+ SpammyReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount);
cmdID++;
}
- OSReport("UNLOCKING PATHS: All complete @ %p\n", in);
+ SpammyReport("UNLOCKING PATHS: All complete @ %p\n", in);
// did anything become newly available?!
newlyAvailablePaths = 0;
@@ -194,14 +194,14 @@ void dWMPathManager_c::unlockPaths() {
}
bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack) {
- OSReport("[%p] CondStk:%d begin\n", in, stack);
+ SpammyReport("[%p] CondStk:%d begin\n", in, stack);
u8 controlByte = *(in++);
u8 conditionType = (controlByte >> 6);
- OSReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType);
+ SpammyReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType);
if (conditionType == 0) {
- OSReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack);
+ SpammyReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack);
return true;
}
@@ -211,10 +211,10 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
bool isSecret = (controlByte & 0x10);
u8 worldNumber = controlByte & 0xF;
u8 levelNumber = *(in++);
- OSReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret);
+ SpammyReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret);
u32 conds = save->GetLevelCondition(worldNumber, levelNumber);
- OSReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds);
+ SpammyReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds);
if (isSecret)
return (conds & COND_SECRET) != 0;
@@ -229,7 +229,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
bool value = isOr ? false : true;
u8 termCount = (controlByte & 0x3F) + 1;
- OSReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount);
+ SpammyReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount);
for (int i = 0; i < termCount; i++) {
bool what = evaluateUnlockCondition(in, save, stack+1);
@@ -240,7 +240,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta
value &= what;
}
- OSReport("[%p] CondStk:%d end, returning %d\n", in, stack, value);
+ SpammyReport("[%p] CondStk:%d end, returning %d\n", in, stack, value);
return value;
}
@@ -454,7 +454,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) {
moveSpeed = 0.2f;
break;
default:
- OSReport("No animtaion?!");
+ SpammyReport("No animtaion?!");
player->startAnimation(run, 2.0, 10.0, 0.0);
player->hasSound = true;
player->soundName = SE_PLY_FOOTNOTE_DIRT;
@@ -515,7 +515,13 @@ void dWMPathManager_c::moveThroughPath() {
bool reallyStop = false;
- if (to->type == dKPNode_s::PASS_THROUGH) {
+ if (to->type == dKPNode_s::LEVEL) {
+ // Always stop on levels
+ reallyStop = true;
+ } else if (to->type == dKPNode_s::CHANGE) {
+ // Never stop on entrances
+ reallyStop = false;
+ } else if (to->type == dKPNode_s::PASS_THROUGH) {
// If there's only one exit here, then stop even though
// it's a passthrough node
reallyStop = (to->getAvailableExitCount() == 1);
@@ -534,10 +540,10 @@ void dWMPathManager_c::moveThroughPath() {
isMoving = false;
SaveBlock *save = GetSaveFile()->GetBlock(-1);
- OSReport("node: %x, %s", to->destMap, to->destMap);
+ SpammyReport("node: %x, %s", to->destMap, to->destMap);
save->current_world = dScKoopatlas_c::instance->getIndexForMapName(to->destMap);
- OSReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID);
+ SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID);
DoSceneChange(WORLD_MAP, 0x10000000 | to->foreignID, 0);