From 24eda6f87c4ce6f30fb9ef5cdaec8e1093513df3 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Fri, 27 Jul 2012 02:37:22 -0500 Subject: BROKEN - something wrong with includes, possibly related to the order =| --- koopatlas.yaml | 6 ++++++ src/koopatlas/core.cpp | 26 +++++++++++++++++++++++--- src/koopatlas/core.h | 4 ++++ src/koopatlas/hud.cpp | 2 +- src/koopatlas/pathmanager.cpp | 2 +- src/koopatlas/player.cpp | 4 +++- src/koopatlas/shop.cpp | 18 +----------------- 7 files changed, 39 insertions(+), 23 deletions(-) diff --git a/koopatlas.yaml b/koopatlas.yaml index 1bc3466..0457fe0 100644 --- a/koopatlas.yaml +++ b/koopatlas.yaml @@ -13,6 +13,7 @@ source_files: - ../src/koopatlas/mapdata.cpp - ../src/koopatlas/pathmanager.cpp - ../src/koopatlas/shop.cpp + - ../src/koopatlas/starcoin.cpp hooks: - name: BuildWorldMap @@ -50,6 +51,11 @@ hooks: src_addr_pal: 0x809894B4 target_func: 'dShopItem::build(void)' + - name: BuildWMdStarCoin + type: add_func_pointer + src_addr_pal: 0x80982D1C + target_func: 'dWMStarCoin::build(void)' + # fix the STOCK_ITEM references - name: StockItemFix diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index b550f07..8dd6a5b 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -2,6 +2,7 @@ #include "koopatlas/camera.h" #include "koopatlas/player.h" #include "koopatlas/hud.h" +#include "koopatlas/starcoin.h" extern "C" void LoadMapScene(); @@ -18,6 +19,7 @@ CREATE_STATE_E(dScKoopatlas_c, PlayerChangeWait); CREATE_STATE_E(dScKoopatlas_c, EasyPairingWait); CREATE_STATE_E(dScKoopatlas_c, PowerupsWait); CREATE_STATE_E(dScKoopatlas_c, ShopWait); +CREATE_STATE_E(dScKoopatlas_c, CoinsWait); CREATE_STATE_E(dScKoopatlas_c, SaveOpen); CREATE_STATE_E(dScKoopatlas_c, SaveSelect); CREATE_STATE_E(dScKoopatlas_c, SaveWindowClose); @@ -259,6 +261,9 @@ bool WMInit_SetupExtra(void *ptr) { SpammyReport("creating SHOP\n"); wm->shop = (dWMShop_c*)CreateParentedObject(WM_SHOP, wm, 0, 2); + SpammyReport("creating Star Coin Menu\n"); + wm->coins = (dWMStarCoin*)CreateParentedObject(WM_STARCOIN, wm, 0, 2); + SpammyReport("SetupExtra done\n"); @@ -466,9 +471,11 @@ void dScKoopatlas_c::executeState_Normal() { CSMENU_ACTIVE(this->csMenu) = true; state.setState(&StateID_CSMenu); } else if (nowPressed & WPAD_A) { - pathManager.unlockAllPaths(2); + SaveBlock *save = GetSaveFile()->GetBlock(-1); + coins->LoadCoinsForWorld(save->current_world); + state.setState(&StateID_CoinsWait); } else if (nowPressed & WPAD_B) { - pathManager.unlockAllPaths(0); + pathManager.unlockAllPaths(2); } pathManager.execute(); @@ -482,12 +489,14 @@ void dScKoopatlas_c::executeState_CSMenu() { // That means something happened if (CSMENU_CHOICE_OK(this->csMenu)) { // Player pressed a button + SaveBlock *save = GetSaveFile()->GetBlock(-1); switch (CSMENU_CURRENT(this->csMenu)) { case 0: // Star Coins MapReport("Star Coins was pressed\n"); - state.setState(&StateID_Normal); + coins->LoadCoinsForWorld(save->current_world); + state.setState(&StateID_CoinsWait); break; case 1: @@ -676,6 +685,17 @@ void dScKoopatlas_c::executeState_ShopWait() { } + +/**********************************************************************/ +// STATE_StarCoin : Wait for the user to exit the Star Coin screen. +void dScKoopatlas_c::executeState_CoinsWait() { + + if (coins->isHidden) { + state.setState(&StateID_Normal); + } + +} + /**********************************************************************/ // STATE_SaveOpen : Waiting for the "Save?" YesNoWindow to open void dScKoopatlas_c::executeState_SaveOpen() { diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index 760de19..160c54f 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -35,11 +35,13 @@ void NewerMapDrawFunc(); #define WM_HUD WM_DANCE_PAKKUN #define WM_SHOP WM_TOGEZO #define WM_SHOPITEM WM_PUKU +#define WM_STARCOIN WM_GHOST class daWMPlayer_c; class dWMHud_c; class dWMMap_c; class dWMShop_c; +class dWMStarCoin; class dWorldCamera_c; class dScKoopatlas_c : public dScene_c { @@ -62,6 +64,7 @@ class dScKoopatlas_c : public dScene_c { DECLARE_STATE(EasyPairingWait); DECLARE_STATE(PowerupsWait); DECLARE_STATE(ShopWait); + DECLARE_STATE(CoinsWait); DECLARE_STATE(SaveOpen); DECLARE_STATE(SaveSelect); DECLARE_STATE(SaveWindowClose); @@ -98,6 +101,7 @@ class dScKoopatlas_c : public dScene_c { dWMHud_c *hud; dWMMap_c *map; dWMShop_c *shop; + dWMStarCoin *coins; int currentMapID; const char *mapPath; diff --git a/src/koopatlas/hud.cpp b/src/koopatlas/hud.cpp index cbd7ef6..df4bb1e 100644 --- a/src/koopatlas/hud.cpp +++ b/src/koopatlas/hud.cpp @@ -411,7 +411,7 @@ void dWMHud_c::setWorldName() { break; case 6: - setWorldText("Ghost\nRealm"); + setWorldText("Pumpkin\nBoneyard"); break; case 7: diff --git a/src/koopatlas/pathmanager.cpp b/src/koopatlas/pathmanager.cpp index 762ba03..2d4d836 100644 --- a/src/koopatlas/pathmanager.cpp +++ b/src/koopatlas/pathmanager.cpp @@ -537,7 +537,7 @@ void dWMPathManager_c::activatePoint() { int w = currentNode->levelNumber[0] - 1; int l = currentNode->levelNumber[1] - 1; - if (l == 40) { + if (l == 0) { dWMShop_c::instance->LoadShopForWorld(w); dScKoopatlas_c::instance->state.setState(&dScKoopatlas_c::instance->StateID_ShopWait); return; diff --git a/src/koopatlas/player.cpp b/src/koopatlas/player.cpp index 4a15f94..5531301 100644 --- a/src/koopatlas/player.cpp +++ b/src/koopatlas/player.cpp @@ -40,7 +40,9 @@ int daWMPlayer_c::onExecute() { Vec modifiedPos = {pos.x, pos.y + jumpOffset, pos.z}; this->modelHandler->setSRT(modifiedPos, this->rot, this->scale); - if (hasEffect) { effect.spawn(effectName, 0, &pos, &rot, &scale); } + if (hasEffect) { + Vec effPos = {pos.x, pos.y, -1000.0}; + effect.spawn(effectName, 0, &effPos, &rot, &scale); } if (hasSound) { timer++; diff --git a/src/koopatlas/shop.cpp b/src/koopatlas/shop.cpp index 0a93f44..cd30bfa 100644 --- a/src/koopatlas/shop.cpp +++ b/src/koopatlas/shop.cpp @@ -236,30 +236,14 @@ int dWMShop_c::onDraw() { if (!isHidden) { layout.scheduleForDrawing(); - - /*Vec pos = {layout.posX, layout.posY, 10000.0}; - S16Vec rot = {0,0,0}; - Vec scale = {1.0, 1.0, 1.0}; - matrix.translation(pos.x, pos.y, pos.z); - matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); - - shopkeep.setDrawMatrix(matrix); - shopkeep.setScale(&scale); - shopkeep.calcWorld(false); - shopkeep.scheduleForDrawing(); - shopkeep._vf1C(); - - if(this->ska.isAnimationDone()) - this->ska.setCurrentFrame(0.0);*/ } return true; } void dWMShop_c::specialDraw1() { - OSReport("Lakionnnne...."); if (!isHidden) { - Vec pos = {250.0f, 170.0f, 1000.0f}; + Vec pos = {250.0f, 170.0f, -1000.0f}; S16Vec rot = {0,0,0}; Vec scale = {1.0f, 1.0f, 1.0f}; matrix.translation(pos.x, pos.y, pos.z); -- cgit v1.2.3