diff options
Diffstat (limited to '')
-rw-r--r-- | src/koopatlas/core.cpp | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index fb1e865..03b64dc 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -158,10 +158,9 @@ bool WMInit_LoadResources(void *ptr) { SpammyReport("WMInit_LoadResources returning true\n"); dScKoopatlas_c *wm = (dScKoopatlas_c*)ptr; - return wm->mapData.load("/Maps/yat.kpbin"); - //TODO - //return wm->resMng.loadSet("MMFullWorld"); - //return true; + return + wm->mapData.load("/Maps/yat.kpbin") && + wm->levelInfoLoader.load("/NewerRes/LevelInfo.bin"); } bool WMInit_SetupWait(void *ptr) { @@ -203,21 +202,24 @@ bool WMInit_SetupExtra(void *ptr) { } // since we've got all the resources, set up the path data too - //wm->pathManager->setup(); - //wm->pathManager->computeEvents(); + SpammyReport("preparing level info\n"); + wm->levelInfo.load(wm->levelInfoLoader.buffer); + wm->pathManager.setup(); // and now Player setup wm->player = (daWMPlayer_c*)CreateParentedObject(WM_PLAYER, wm, 0, 2); wm->player->modelHandler->mdlClass->setPowerup(2); wm->player->modelHandler->mdlClass->startAnimation(0, 1.2f, 10.0f, 0.0f); - //wm->player->pos = wm->pathManager->currentPoint->position; + + dKPNode_s *cNode = wm->pathManager.currentNode; + wm->player->pos = (Vec){cNode->x, -cNode->y, wm->player->pos.y}; // is last param correct? must check :/ wm->map = (dWMMap_c*)CreateParentedObject(WM_MAP, wm, 0, 0); wm->hud = (dWMHud_c*)CreateParentedObject(WM_HUD, wm, 0, 0); - // note: world_camera and wm_path_manager are not created here - // because we require them earlier - // they are created in dScKoopatlas_c::onCreate + // note: world_camera is not created here + // because we require it earlier + // it is created in dScKoopatlas_c::onCreate return true; } @@ -334,8 +336,6 @@ int dScKoopatlas_c::onCreate() { SpammyReport("world camera\n"); CreateParentedObject(WORLD_CAMERA, this, 0, 0); - /*pathManager = (dWMPathManager_c*)CreateParentedObject(WM_PATH_MANAGER, this, 0, 0);*/ - SpammyReport("setting NewerMapDrawFunc\n"); *CurrentDrawFunc = NewerMapDrawFunc; @@ -411,6 +411,8 @@ void dScKoopatlas_c::executeState_Normal() { CSMENU_ACTIVE(this->csMenu) = true; state.setState(&StateID_CSMenu); } + + pathManager.execute(); } void dScKoopatlas_c::executeState_CSMenu() { @@ -798,6 +800,35 @@ void dScKoopatlas_c::executeState_QuickSaveEndCloseWait() { void dScKoopatlas_c::executeState_SaveError() { } +void dScKoopatlas_c::startLevel(dLevelInfo_c::entry_s *entry) { + for (int i = 0; i < 4; i++) { + bool isThere = QueryPlayerAvailability(i); + int id = Player_ID[i]; + Player_Active[i] = isThere ? 1 : 0; + if (!isThere) Player_Flags[i] = 0; + } + + StartLevelInfo sl; + sl.unk1 = 0; + sl.unk2 = 0xFF; + sl.unk3 = 0; + sl.unk4 = 0; + sl.purpose = 0; + + sl.world1 = entry->world; + sl.world2 = entry->world; + sl.level1 = entry->level; + sl.level2 = entry->level; + + // hopefully this will fix the Star Coin issues + SetSomeConditionShit(entry->world, entry->level, 2); + + ActivateWipe(WIPE_MARIO); + + DoStartLevel(GetGameMgr(), &sl); +} + + void NewerMapDrawFunc() { Reset3DState(); SetCurrentCameraID(0); |