summaryrefslogtreecommitdiff
path: root/src/koopatlas/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/koopatlas/core.cpp')
-rw-r--r--src/koopatlas/core.cpp26
1 files changed, 23 insertions, 3 deletions
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() {