From ca0c9bcb0ff52cb1a9dbeb66a9065b855f1c365f Mon Sep 17 00:00:00 2001
From: Treeki <treeki@gmail.com>
Date: Sun, 7 Oct 2012 03:44:34 +0200
Subject: fixed Continue on the world map

---
 src/koopatlas/core.cpp | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

(limited to 'src')

diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp
index c1f7a43..b43b62a 100644
--- a/src/koopatlas/core.cpp
+++ b/src/koopatlas/core.cpp
@@ -7,7 +7,7 @@ extern "C" void LoadMapScene();
 dScKoopatlas_c *dScKoopatlas_c::instance = 0;
 
 CREATE_STATE_E(dScKoopatlas_c, Limbo);
-CREATE_STATE_E(dScKoopatlas_c, ContinueWait);
+CREATE_STATE(dScKoopatlas_c, ContinueWait);
 CREATE_STATE_E(dScKoopatlas_c, Normal);
 CREATE_STATE_E(dScKoopatlas_c, CSMenu);
 CREATE_STATE_E(dScKoopatlas_c, TitleConfirmOpenWait);
@@ -221,6 +221,15 @@ bool WMInit_SetupExtra(void *ptr) {
 	// ok, now we can set up other required shit
 	dScKoopatlas_c *wm = (dScKoopatlas_c*)ptr;
 
+	// check if we need to handle Continue
+	if (CheckIfContinueShouldBeActivated()) {
+		SpammyReport("continue is activated\n");
+		wm->state.setState(&wm->StateID_ContinueWait);
+	} else {
+		SpammyReport("continue is not activated\n");
+		wm->state.setState(&wm->StateID_Normal);
+	}
+
 	// first up: player models for Stocked Items
 	for (int i = 0; i < 4; i++) {
 		void *obj = CreateChildObject(WM_2D_PLAYER, wm, i, 0, 0);
@@ -371,18 +380,6 @@ int dScKoopatlas_c::onCreate() {
 	SpammyReport("continue\n");
 	this->continueObj = CreateParentedObject(CONTINUE, this, 0, 0);
 
-	// check if we need to handle Continue
-	if (CheckIfContinueShouldBeActivated()) {
-		SpammyReport("continue is activated\n");
-		state.setState(&StateID_ContinueWait);
-		CONT_UNK1(this->continueObj) = true;
-		CONT_UNK2(this->continueObj) = true;
-		CONT_UNK3(this->continueObj) = false;
-	} else {
-		SpammyReport("continue is not activated\n");
-		state.setState(&StateID_Normal);
-	}
-
 	SpammyReport("stock item\n");
 	this->stockItem = CreateParentedObject(STOCK_ITEM, this, 0, 0);
 	SpammyReport("stock item shadow\n");
@@ -459,6 +456,12 @@ int dScKoopatlas_c::onExecute() {
 void dScKoopatlas_c::executeState_Limbo() { }
 
 
+void dScKoopatlas_c::beginState_ContinueWait() {
+	GameMgrP->_AFC = 1;
+	CONT_UNK1(this->continueObj) = true;
+	CONT_UNK2(this->continueObj) = true;
+	CONT_UNK3(this->continueObj) = false;
+}
 void dScKoopatlas_c::executeState_ContinueWait() {
 	// Waiting for the Continue anim to finish
 	if (CONT_DONE(this->continueObj)) {
@@ -474,6 +477,10 @@ void dScKoopatlas_c::executeState_ContinueWait() {
 		state.setState(&StateID_Normal);
 	}
 }
+void dScKoopatlas_c::endState_ContinueWait() {
+	GameMgrP->_AFC = 0;
+}
+
 
 void dScKoopatlas_c::executeState_Normal() {
 	int nowPressed = Remocon_GetPressed(GetActiveRemocon());
-- 
cgit v1.2.3