diff options
author | Treeki <treeki@gmail.com> | 2012-09-24 05:38:14 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-24 05:38:14 +0200 |
commit | 4f567256d015cf7a835ac03b9e5abb8a2a7eb12a (patch) | |
tree | cc867fff5d78f08f6bd47ea272e8b4406048a725 /src | |
parent | ec8ad32b054e7680aec1536b36a02f6aaf154c0b (diff) | |
download | kamek-4f567256d015cf7a835ac03b9e5abb8a2a7eb12a.tar.gz kamek-4f567256d015cf7a835ac03b9e5abb8a2a7eb12a.zip |
various changes and bugfixes
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.h | 2 | ||||
-rw-r--r-- | src/koopatlas/hud.cpp | 4 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.cpp | 53 | ||||
-rw-r--r-- | src/koopatlas/pathmanager.h | 7 | ||||
-rw-r--r-- | src/koopatlas/player.cpp | 3 |
5 files changed, 42 insertions, 27 deletions
diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 2a69927..41fba45 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -18,7 +18,7 @@ #include "koopatlas/pathmanager.h" #define WM_DEBUGGING -// #define WM_SPAMMY_DEBUGGING +#define WM_SPAMMY_DEBUGGING #ifdef WM_DEBUGGING #define MapReport OSReport diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index 3989a1c..44b0fce 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -200,7 +200,7 @@ void dWMHud_c::setLevelText(const wchar_t *str, int length) { tw.tagProcessorMaybe = box->tagProc; float width = tw.CalcStringWidth(str, length); - SpammyReport("Text width: %f\n", width); + //SpammyReport("Text width: %f\n", width); layout.findWindowByName("W_levelname")->size.x = width + 22; layout.findPictureByName("P_topleftboxbg")->size.x = width; @@ -370,7 +370,7 @@ void dWMHud_c::setWorldText(const wchar_t *str, int length) { tw.tagProcessorMaybe = box->tagProc; float width = tw.CalcStringWidth(str, length); - SpammyReport("Text width: %f\n", width); + //SpammyReport("Text width: %f\n", width); box->SetString(str); } diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 733c5e2..e1d7993 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -63,7 +63,7 @@ void dWMPathManager_c::setup() { //OSReport("Path: %p nodes %p to %p\n", path, srcNode, destNode); int ct = destNode->getAvailableExitCount(); //OSReport("Dest Node available exits: %d; type: %d\n", ct, destNode->type); - if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL) { + if (destNode == node || ct > 2 || destNode->type == dKPNode_s::LEVEL || destNode->type == dKPNode_s::CHANGE) { exitTo = candidateExit; //OSReport("Accepting this node\n"); break; @@ -153,36 +153,36 @@ void dWMPathManager_c::unlockPaths() { int cmdID = 0; while (*in != 0) { - SpammyReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID); + UnlockCmdReport("[%p] Cmd %d: Evaluating condition\n", in, cmdID); // begin processing a block bool value = evaluateUnlockCondition(in, save, 0); - SpammyReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value); - //SpammyReport("Unlock condition: %d\n", value); + UnlockCmdReport("[%p] Cmd %d: Condition evaluated, result: %d\n", in, cmdID, value); + //UnlockCmdReport("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++); - SpammyReport("[%p] Cmd %d: Affects %d path(s)\n", in, cmdID, affectedCount); + UnlockCmdReport("[%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; - SpammyReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID); + UnlockCmdReport("[%p] Cmd %d: Affected %d: PathID: %d\n", in, cmdID, i, pathID); dKPPath_s *path = pathLayer->paths[pathID]; - SpammyReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path); + UnlockCmdReport("[%p] Cmd %d: Affected %d: Path: %p\n", in, cmdID, i, path); path->isAvailable = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE; - SpammyReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i); + UnlockCmdReport("[%p] Cmd %d: Affected %d: IsAvailable written\n", in, cmdID, i); PathAvailabilityData[pathID] = value ? dKPPath_s::AVAILABLE : dKPPath_s::NOT_AVAILABLE; - SpammyReport("[%p] Cmd %d: Affected %d: AvailabilityData written\n", in, cmdID, i); + UnlockCmdReport("[%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); - SpammyReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i); + UnlockCmdReport("[%p] Cmd %d: Affected %d: Layer alpha applied\n", in, cmdID, i); } - SpammyReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount); + UnlockCmdReport("[%p] Cmd %d: %d affected path(s) processed\n", in, cmdID, affectedCount); cmdID++; } @@ -232,14 +232,14 @@ void dWMPathManager_c::unlockPaths() { } bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int stack) { - SpammyReport("[%p] CondStk:%d begin\n", in, stack); + UnlockCmdReport("[%p] CondStk:%d begin\n", in, stack); u8 controlByte = *(in++); u8 conditionType = (controlByte >> 6); - SpammyReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType); + UnlockCmdReport("[%p] CondStk:%d control byte: %d; condition type: %d\n", in, stack, controlByte, conditionType); if (conditionType == 0) { - SpammyReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack); + UnlockCmdReport("[%p] CondStk:%d end, returning CONSTANT 1\n", in, stack); return true; } @@ -249,10 +249,10 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta bool isSecret = (controlByte & 0x10); u8 worldNumber = controlByte & 0xF; u8 levelNumber = *(in++); - SpammyReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret); + UnlockCmdReport("[%p] CondStk:%d level, w:%d l:%d secret:%d\n", in, stack, worldNumber, levelNumber, isSecret); u32 conds = save->GetLevelCondition(worldNumber, levelNumber); - SpammyReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds); + UnlockCmdReport("[%p] CondStk:%d returning for level conditions: %d / %x\n", in, stack, conds, conds); if (isSecret) return (conds & COND_SECRET) != 0; @@ -267,7 +267,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta bool value = isOr ? false : true; u8 termCount = (controlByte & 0x3F) + 1; - SpammyReport("[%p] CondStk:%d and:%d or:%d startValue:%d termCount:%d\n", in, stack, isAnd, isOr, value, termCount); + UnlockCmdReport("[%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); @@ -278,7 +278,7 @@ bool dWMPathManager_c::evaluateUnlockCondition(u8 *&in, SaveBlock *save, int sta value &= what; } - SpammyReport("[%p] CondStk:%d end, returning %d\n", in, stack, value); + UnlockCmdReport("[%p] CondStk:%d end, returning %d\n", in, stack, value); return value; } @@ -365,7 +365,7 @@ void dWMPathManager_c::execute() { void dWMPathManager_c::startMovementTo(dKPPath_s *path) { - SpammyReport("moving to path %p\n", path); + SpammyReport("moving to path %p [%d,%d to %d,%d]\n", path, path->start->x, path->start->y, path->end->x, path->end->y); dWMHud_c::instance->hidePointBar(); SpammyReport("point bar hidden\n"); @@ -435,7 +435,7 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { // Run {b_dash2,3.0f,10.0f, -1,5.0f, SE_PLY_FOOTNOTE_DIRT,SE_NULL, 0,0}, // Pipe - {wait,2.0f,10.0f, -0x7FFF,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, + {wait,2.0f,10.0f, 0,1.0f, SE_NULL,SE_PLY_DOKAN_IN_OUT, 0,0}, // Door {wait,2.0f,10.0f, -0x7FFF,0.2f, SE_NULL,SE_OBJ_DOOR_OPEN, 0,0}, @@ -452,16 +452,19 @@ void dWMPathManager_c::startMovementTo(dKPPath_s *path) { isJumping = (path->animation >= dKPPath_s::JUMP && path->animation <= dKPPath_s::JUMP_WATER); + float playerScale = 1.6f; + if (path->animation == dKPPath_s::ENTER_CAVE_UP) { scaleAnimProgress = 60; // what direction does this path go in? isScalingUp = (deltaY < 0) ^ reverseThroughPath; if (!isScalingUp) - player->scale = (Vec){0.0f,0.0f,0.0f}; + playerScale = 0.0f; } player->visible = (path->animation != dKPPath_s::INVISIBLE); + player->scale.x = player->scale.y = player->scale.z = playerScale; int id = (path->animation >= dKPPath_s::MAX_ANIM) ? 0 : (int)path->animation; @@ -505,7 +508,6 @@ void dWMPathManager_c::moveThroughPath() { player->scale.x = player->scale.y = player->scale.z = sc; scaleAnimProgress--; - return; } @@ -537,8 +539,10 @@ void dWMPathManager_c::moveThroughPath() { // Check if we've reached the end yet if ( - ((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) && - ((move.y > 0) ? (-player->pos.y >= to->y) : (-player->pos.y <= to->y)) + (((move.x > 0) ? (player->pos.x >= to->x) : (player->pos.x <= to->x)) && + ((move.y > 0) ? (-player->pos.y >= to->y) : (-player->pos.y <= to->y))) + || + (from->x == to->x && from->y == to->y) ) { currentNode = to; @@ -590,6 +594,7 @@ void dWMPathManager_c::moveThroughPath() { SpammyReport("Change to map ID %d (%s), entrance ID %d\n", save->current_world, to->destMap, to->foreignID); + ActivateWipe(to->transition); DoSceneChange(WORLD_MAP, 0x10000000 | (to->foreignID << 20), 0); } else if (reallyStop) { diff --git a/src/koopatlas/pathmanager.h b/src/koopatlas/pathmanager.h index 3c3ae1f..4604fc7 100644 --- a/src/koopatlas/pathmanager.h +++ b/src/koopatlas/pathmanager.h @@ -1,6 +1,13 @@ #ifndef __KOOPATLAS_PATH_MANAGER_H #define __KOOPATLAS_PATH_MANAGER_H +//#define WM_UNLOCK_DEBUGGING +#ifdef WM_UNLOCK_DEBUGGING +#define UnlockCmdReport OSReport +#else +#define UnlockCmdReport(...) +#endif + #include "koopatlas/mapdata.h" extern "C" void *SoundRelatedClass; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index ed2aa5b..3f791b6 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -68,6 +68,9 @@ int daWMPlayer_c::onExecute() { } int daWMPlayer_c::onDraw() { + if (!visible) + return true; + this->modelHandler->draw(); hammerSuit.draw(); |