From 48ffeacbebb2da2fee3bff600f4218ad7f24c9cc Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 21 Sep 2012 19:08:05 +0200 Subject: file select level looping fixed --- src/fileselect.S | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/fileselect.S b/src/fileselect.S index 75f3130..19710ef 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -102,13 +102,11 @@ gotName: li r21, 0 li r22, 0 + addi r23, r31, 0x6C li r24, 0 li r25, 0 # Loop through ALL levels - addi r23, r31, 0x6C - li r4, 420 - mtctr r4 levelLoop: lwz r4, 0(r23) @@ -133,24 +131,24 @@ noCoin3: beq noNormalExit addi r22, r22, 1 - lis r3, NormalExitStr@h - ori r3, r3, NormalExitStr@l - mr r4, r24 - mr r5, r25 - crclr 4*cr1+eq - bl OSReport +# lis r3, NormalExitStr@h +# ori r3, r3, NormalExitStr@l +# addi r4, r24, 1 +# addi r5, r25, 1 +# crclr 4*cr1+eq +# bl OSReport noNormalExit: lwz r4, 0(r23) extrwi. r0, r4, 1,26 beq noSecretExit addi r22, r22, 1 - lis r3, SecretExitStr@h - ori r3, r3, SecretExitStr@l - mr r4, r24 - mr r5, r25 - crclr 4*cr1+eq - bl OSReport +# lis r3, SecretExitStr@h +# ori r3, r3, SecretExitStr@l +# addi r4, r24, 1 +# addi r5, r25, 1 +# crclr 4*cr1+eq +# bl OSReport noSecretExit: ignoreStartPoint: @@ -158,11 +156,12 @@ ignoreStartPoint: addi r23, r23, 4 addi r25, r25, 1 cmpwi r25, 42 - blt dontGoNextWorld + blt levelLoop + # next world addi r24, r24, 1 li r25, 0 -dontGoNextWorld: - bdnz levelLoop + cmpwi r24, 10 + blt levelLoop # Now, subtract the paid star coins lhz r3, 0x66(r31) -- cgit v1.2.3 From 8103666b9c6120cae9eb3551a6f1f8b3283a5876 Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 21 Sep 2012 22:10:54 +0200 Subject: fixed KP pipe/door/etc animations --- src/koopatlas/pathmanager.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 49ee728..2b817a4 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -433,26 +433,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); -- cgit v1.2.3 From 81740b6a0ec2815495751e5875f492b6dbd8ab0b Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 21 Sep 2012 23:03:23 +0200 Subject: a failed attempt at better changes, pushed so I can test at home --- src/koopatlas/pathmanager.cpp | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 2b817a4..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; } } -- cgit v1.2.3 From 5654d5c0a056f9cfc99ac608d16aa0a601b997f5 Mon Sep 17 00:00:00 2001 From: Treeki Date: Fri, 21 Sep 2012 23:03:33 +0200 Subject: updated map data format --- src/koopatlas/mapdata.cpp | 4 +++- src/koopatlas/mapdata.h | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') 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 { -- cgit v1.2.3 From 8d0a306f0a526a76182c8d2b513d7a0441d6f466 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Fri, 21 Sep 2012 20:43:16 -0500 Subject: pumpkin goomba shiz --- src/pumpkinGoomba.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/pumpkinGoomba.cpp b/src/pumpkinGoomba.cpp index 64d98fc..7b46af9 100644 --- a/src/pumpkinGoomba.cpp +++ b/src/pumpkinGoomba.cpp @@ -179,7 +179,7 @@ int dGoombaPie::onCreate() { // Other shit isBursting = false; - this->scale = (Vec){0.375, 0.375, 0.375}; + this->scale = (Vec){0.39, 0.39, 0.39}; ActivePhysics::Info HitMeBaby; -- cgit v1.2.3 From 224cecc27eedc20e4397eb5b196a6555990fd594 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 22 Sep 2012 03:56:04 +0200 Subject: fixed moving after change nodes --- src/koopatlas/core.cpp | 9 +++++++-- src/koopatlas/core.h | 1 + src/koopatlas/pathmanager.cpp | 20 +++++++++++++++++--- src/koopatlas/player.cpp | 5 +++++ 4 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index 7435103..164ea89 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -429,6 +429,13 @@ bool dScKoopatlas_c::canDoStuff() { return true; } +bool dScKoopatlas_c::mapIsRunning() { + if (QueryGlobal5758(0xFFFFFFFF)) return false; + if (CheckIfWeCantDoStuff()) return false; + if (state.getCurrentState() != &StateID_Normal) return false; + return true; +} + int dScKoopatlas_c::onExecute() { if (!canDoStuff()) return true; @@ -503,8 +510,6 @@ void dScKoopatlas_c::executeState_Normal() { } else if (nowPressed & WPAD_A) { pathManager.unlockAllPaths(0); } - - pathManager.execute(); } void dScKoopatlas_c::executeState_CSMenu() { diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 2674977..2a69927 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -123,6 +123,7 @@ class dScKoopatlas_c : public dScene_c { void startLevel(dLevelInfo_c::entry_s *level); bool canDoStuff(); + bool mapIsRunning(); }; #endif diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index a9cd003..d329c6d 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -41,11 +41,14 @@ void dWMPathManager_c::setup() { found = true; currentNode = node; + //OSReport("Found CHANGE node: %d %p\n", changeID, node); + // figure out where we should move to dKPPath_s *exitTo = 0; for (int i = 0; i < 4; i++) { dKPPath_s *candidateExit = node->exits[i]; + //OSReport("Candidate exit: %p\n", candidateExit); if (!candidateExit) continue; @@ -55,9 +58,12 @@ void dWMPathManager_c::setup() { while (true) { dKPNode_s *destNode = (path->start == srcNode) ? path->end : path->start; + //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) { - exitTo = path; + exitTo = candidateExit; + //OSReport("Accepting this node\n"); break; } @@ -84,7 +90,7 @@ void dWMPathManager_c::setup() { currentNode = pathLayer->nodes[0]; mustComplainToMapCreator = true; } - + } else { SpammyReport("saved path node: %d\n", save->current_path_node); if (save->current_path_node >= pathLayer->nodeCount) { @@ -567,7 +573,15 @@ void dWMPathManager_c::moveThroughPath() { if (to->type == dKPNode_s::CHANGE) { // Go to another map - isMoving = false; + + // should we continue moving? + if (to->getAvailableExitCount() == 1) { + OSReport("Stopping"); + isMoving = false; + } else { + OSReport("Continuing"); + startMovementTo(to->getOppositeAvailableExitTo(currentPath)); + } SaveBlock *save = GetSaveFile()->GetBlock(-1); SpammyReport("node: %x, %s", to->destMap, to->destMap); diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index 51470da..ebd0124 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -38,6 +38,11 @@ int daWMPlayer_c::onDelete() { int daWMPlayer_c::onExecute() { + if (!dScKoopatlas_c::instance->mapIsRunning()) + return true; + + dScKoopatlas_c::instance->pathManager.execute(); + this->modelHandler->update(); Vec modifiedPos = {pos.x, pos.y + jumpOffset, pos.z}; this->modelHandler->setSRT(modifiedPos, this->rot, this->scale); -- cgit v1.2.3 From 2d516c7c77158eb2125ff4f53d5051762df5959d Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 22 Sep 2012 04:55:08 +0200 Subject: file select should be fixed now --- src/fileselect.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/fileselect.S b/src/fileselect.S index 19710ef..9f7f396 100644 --- a/src/fileselect.S +++ b/src/fileselect.S @@ -74,7 +74,7 @@ DFNiceWorldName: # get Newer map number lbz r6, 0x6FC(r31) lis r8, NewerWorldCount@h - ori r8, r8, NewerWorldCount@h + ori r8, r8, NewerWorldCount@l lwz r8, 0(r8) cmpw r6, r8 bge invalidThing @@ -82,7 +82,6 @@ DFNiceWorldName: lis r7, NewerWorldNames@h ori r7, r7, NewerWorldNames@l lwzx r4, r7, r6 - li r5, 0 b gotName invalidThing: lis r4, InvalidWorld@h @@ -90,6 +89,7 @@ invalidThing: gotName: mr r3, r20 + li r5, 0 lwz r12, 0(r3) lwz r12, 0x7C(r12) mtctr r12 -- cgit v1.2.3