diff options
Diffstat (limited to '')
| -rwxr-xr-x | include/game.h | 31 | ||||
| -rw-r--r-- | src/koopatlas/core.cpp | 114 | ||||
| -rw-r--r-- | src/koopatlas/core.h | 2 | 
3 files changed, 84 insertions, 63 deletions
| diff --git a/include/game.h b/include/game.h index 67a9906..d90ce0f 100755 --- a/include/game.h +++ b/include/game.h @@ -3821,6 +3821,37 @@ class dStockItem_c : public dBase_c {  	int getIconPictureIDforPlayer(int i);
  };
 +class dYesNoWindow_c : public dBase_c {
 +	public:
 +		int onCreate();
 +		int onDelete();
 +		int onExecute();
 +		int onDraw();
 +
 +		dYesNoWindow_c();
 +		~dYesNoWindow_c();
 +
 +		m2d::EmbedLayout_c layout;
 +		dStateWrapper_c<dYesNoWindow_c> state;
 +
 +		nw4r::lyt::Pane *rootPane;
 +
 +		nw4r::lyt::Picture
 +			*P_yesBase_00, *P_noBase_00, *P_centerBase_00;
 +
 +		nw4r::lyt::TextBox
 +			*T_questionS_00, *T_question_00,
 +			*T_otehonTextS_01, *T_otehonText_01,
 +			*T_needCoinX_00, *T_needcoin_00,
 +			*T_yes_00, *T_yes_01,
 +			*T_no_00, *T_no_01;
 +
 +		nw4r::lyt::Pane *N_otehonText_00, *N_saveIcon_00;
 +
 +		int current, previous, type, starCoinRequiredCount;
 +		bool layoutLoaded, visible, close, animationActive, keepOpen, cancelled, hasBG;
 +};
 +
  class StageE4 {
  	public:
 diff --git a/src/koopatlas/core.cpp b/src/koopatlas/core.cpp index d4130c4..32576d2 100644 --- a/src/koopatlas/core.cpp +++ b/src/koopatlas/core.cpp @@ -89,16 +89,6 @@ dScKoopatlas_c::dScKoopatlas_c() : state(this) {  #define CSMENU_UNK(csm) (*((bool*)(((u32)(csm))+0x273)))  #define CSMENU_CURRENT(csm) (*((int*)(((u32)(csm))+0x268))) -#define YESNO_SETUP_DONE(ynw) (*((bool*)(((u32)(ynw))+0x294))) -#define YESNO_VISIBLE(ynw) (*((bool*)(((u32)(ynw))+0x295))) -#define YESNO_CLOSE(ynw) (*((bool*)(((u32)(ynw))+0x296))) -#define YESNO_OPENING(ynw) (*((bool*)(((u32)(ynw))+0x297))) -#define YESNO_REFUSED(ynw) (*((bool*)(((u32)(ynw))+0x298))) -#define YESNO_CANCELLED(ynw) (*((bool*)(((u32)(ynw))+0x299))) -#define YESNO_CANCELLED2(ynw) (*((bool*)(((u32)(ynw))+0x29A))) -#define YESNO_CURRENT(ynw) (*((int*)(((u32)(ynw))+0x284))) -#define YESNO_TYPE(ynw) (*((int*)(((u32)(ynw))+0x28C))) -  #define NPCHG_SETUP_DONE(npc) (*((bool*)(((u32)(npc))+0x67C)))  #define NPCHG_ACTIVE(npc) (*((bool*)(((u32)(npc))+0x67E)))  #define NPCHG_HIDE_FOR_EASYP(npc) (*((bool*)(((u32)(npc))+0x67F))) @@ -206,7 +196,7 @@ bool WMInit_SetupWait(void *ptr) {  	success &= CSMENU_SETUP_DONE(wm->csMenu);  	success &= SELC_SETUP_DONE(wm->selectCursor);  	success &= NPCHG_SETUP_DONE(wm->numPeopleChange); -	success &= YESNO_SETUP_DONE(wm->yesNoWindow); +	success &= wm->yesNoWindow->layoutLoaded;  	success &= CONT_SETUP_DONE(wm->continueObj);  	success &= wm->stockItem->layoutLoaded;  	success &= wm->stockItemShadow->layoutLoaded; @@ -362,7 +352,7 @@ int dScKoopatlas_c::onCreate() {  	this->csMenu = CreateParentedObject(COURSE_SELECT_MENU, this, 0, 0);  	SpammyReport("yes no window\n"); -	this->yesNoWindow = CreateParentedObject(YES_NO_WINDOW, this, 0, 0); +	this->yesNoWindow = (dYesNoWindow_c*)CreateParentedObject(YES_NO_WINDOW, this, 0, 0);  	SpammyReport("number of people change\n");  	this->numPeopleChange = CreateParentedObject(NUMBER_OF_PEOPLE_CHANGE, this, 0, 0); @@ -567,13 +557,13 @@ void dScKoopatlas_c::executeState_CSMenu() {  					MapReport("Save or Quick Save was pressed\n");  					if (GetSaveFile()->GetBlock(-1)->bitfield & 2) {  						state.setState(&StateID_SaveOpen); -						YESNO_TYPE(this->yesNoWindow) = 1; -						YESNO_VISIBLE(this->yesNoWindow) = 1; +						yesNoWindow->type = 1; +						yesNoWindow->visible = true;  					} else {  						state.setState(&StateID_QuickSaveOpen); -						YESNO_TYPE(this->yesNoWindow) = 15; -						YESNO_VISIBLE(this->yesNoWindow) = 1; +						yesNoWindow->type = 15; +						yesNoWindow->visible = 1;  					} @@ -583,8 +573,8 @@ void dScKoopatlas_c::executeState_CSMenu() {  					// Title Screen  					MapReport("Title Screen was pressed\n");  					state.setState(&StateID_TitleConfirmOpenWait); -					YESNO_VISIBLE(this->yesNoWindow) = true; -					YESNO_TYPE(this->yesNoWindow) = 10; +					yesNoWindow->visible = true; +					yesNoWindow->type = 10;  					break;  			} @@ -599,7 +589,7 @@ void dScKoopatlas_c::executeState_CSMenu() {  void dScKoopatlas_c::executeState_TitleConfirmOpenWait() {  	// Waiting for the "Go to Title Screen" YesNoWindow to finish opening -	if (!YESNO_OPENING(this->yesNoWindow)) { +	if (!yesNoWindow->animationActive) {  		state.setState(&StateID_TitleConfirmSelect);  	} @@ -613,24 +603,24 @@ void dScKoopatlas_c::executeState_TitleConfirmSelect() {  	if (nowPressed & WPAD_LEFT) {  		// Select "OK!" -		YESNO_CURRENT(this->yesNoWindow) = 1; +		yesNoWindow->current = 1;  	} else if (nowPressed & WPAD_RIGHT) {  		// Select "Cancel" -		YESNO_CURRENT(this->yesNoWindow) = 0; +		yesNoWindow->current = 0;  	} else if (Wiimote_TestButtons(GetActiveWiimote(), WPAD_A | WPAD_TWO)) {  		// Pick the current option -		YESNO_CLOSE(this->yesNoWindow) = true; -		if (YESNO_CURRENT(this->yesNoWindow) != 1) -			YESNO_REFUSED(this->yesNoWindow) = true; +		yesNoWindow->close = true; +		if (yesNoWindow->current != 1) +			yesNoWindow->keepOpen = true;  		state.setState(&StateID_TitleConfirmHitWait);  	} else {  		// Cancel using B or 1  		if (CheckIfMenuShouldBeCancelledForSpecifiedWiimote(0)) { -			YESNO_CANCELLED(this->yesNoWindow) = true; -			YESNO_CURRENT(this->yesNoWindow) = true; +			yesNoWindow->cancelled = true; +			yesNoWindow->current = true;  			state.setState(&StateID_TitleConfirmHitWait);  		}  	} @@ -643,8 +633,8 @@ void dScKoopatlas_c::executeState_TitleConfirmSelect() {  //  animation to be complete.  void dScKoopatlas_c::executeState_TitleConfirmHitWait() { -	if (!YESNO_OPENING(this->yesNoWindow)) { -		if (YESNO_CURRENT(this->yesNoWindow) == 1) { +	if (!yesNoWindow->animationActive) { +		if (yesNoWindow->current == 1) {  			state.setState(&StateID_Normal);  			hud->unhideAll();  		} else { @@ -761,7 +751,7 @@ void dScKoopatlas_c::executeState_CoinsWait() {  // STATE_SaveOpen : Waiting for the "Save?" YesNoWindow to open  void dScKoopatlas_c::executeState_SaveOpen() { -	if (!YESNO_OPENING(this->yesNoWindow)) { +	if (!yesNoWindow->animationActive) {  		state.setState(&StateID_SaveSelect);  	} @@ -775,25 +765,25 @@ void dScKoopatlas_c::executeState_SaveSelect() {  	if (nowPressed & WPAD_LEFT) {  		// Select "OK!" -		YESNO_CURRENT(this->yesNoWindow) = 1; +		yesNoWindow->current = 1;  	} else if (nowPressed & WPAD_RIGHT) {  		// Select "Cancel" -		YESNO_CURRENT(this->yesNoWindow) = 0; +		yesNoWindow->current = 0;  	} else if (Wiimote_TestButtons(GetActiveWiimote(), WPAD_A | WPAD_TWO)) {  		// Pick the current option -		YESNO_CLOSE(this->yesNoWindow) = true; +		yesNoWindow->close = true; -		if (YESNO_CURRENT(this->yesNoWindow) != 1) -			YESNO_CANCELLED2(this->yesNoWindow) = true; +		if (yesNoWindow->current != 1) +			yesNoWindow->hasBG = true;  		state.setState(&StateID_SaveWindowClose);  	} else {  		// Cancel using B or 1  		if (CheckIfMenuShouldBeCancelledForSpecifiedWiimote(0)) { -			YESNO_CANCELLED(this->yesNoWindow) = true; -			YESNO_CURRENT(this->yesNoWindow) = 1; +			yesNoWindow->cancelled = true; +			yesNoWindow->current = 1;  			state.setState(&StateID_SaveWindowClose);  		}  	} @@ -805,8 +795,8 @@ void dScKoopatlas_c::executeState_SaveSelect() {  // 	"Save?" YesNoWindow. Also, wait for the animation to be complete.  void dScKoopatlas_c::executeState_SaveWindowClose() { -	if (!YESNO_VISIBLE(this->yesNoWindow)) { -		if (YESNO_CURRENT(this->yesNoWindow) == 1) { +	if (!yesNoWindow->visible) { +		if (yesNoWindow->current == 1) {  			state.setState(&StateID_Normal);  			hud->unhideAll();  		} else { @@ -823,8 +813,8 @@ void dScKoopatlas_c::executeState_SaveDo() {  	if (!GetSaveFile()->CheckIfWriting()) {  		if (GetSaveHandler()->CurrentError == 0) { -			YESNO_TYPE(this->yesNoWindow) = 2; -			YESNO_VISIBLE(this->yesNoWindow) = true; +			yesNoWindow->type = 2; +			yesNoWindow->visible = true;  			state.setState(&StateID_SaveEndWindow);  		} else {  			state.setState(&StateID_SaveError); @@ -837,9 +827,9 @@ void dScKoopatlas_c::executeState_SaveDo() {  // STATE_SaveEndWindow : Handle the Save End window.  void dScKoopatlas_c::executeState_SaveEndWindow() { -	if (!YESNO_OPENING(this->yesNoWindow)) { +	if (!yesNoWindow->animationActive) {  		if (Wiimote_TestButtons(GetActiveWiimote(), WPAD_A | WPAD_TWO)) { -			YESNO_CLOSE(this->yesNoWindow) = true; +			yesNoWindow->close = true;  			state.setState(&StateID_SaveEndCloseWait);  		}  	} @@ -850,7 +840,7 @@ void dScKoopatlas_c::executeState_SaveEndWindow() {  // STATE_SaveEndCloseWait : Wait for the Save End window to close.  void dScKoopatlas_c::executeState_SaveEndCloseWait() { -	if (!YESNO_OPENING(this->yesNoWindow)) { +	if (!yesNoWindow->animationActive) {  		state.setState(&StateID_Normal);  		hud->unhideAll();  	} @@ -861,7 +851,7 @@ void dScKoopatlas_c::executeState_SaveEndCloseWait() {  // STATE_QuickSaveOpen : Waiting for the "Save?" YesNoWindow to open  void dScKoopatlas_c::executeState_QuickSaveOpen() { -	if (!YESNO_OPENING(this->yesNoWindow)) { +	if (!yesNoWindow->animationActive) {  		state.setState(&StateID_QuickSaveSelect);  	} @@ -875,25 +865,25 @@ void dScKoopatlas_c::executeState_QuickSaveSelect() {  	if (nowPressed & WPAD_LEFT) {  		// Select "OK!" -		YESNO_CURRENT(this->yesNoWindow) = 1; +		yesNoWindow->current = 1;  	} else if (nowPressed & WPAD_RIGHT) {  		// Select "Cancel" -		YESNO_CURRENT(this->yesNoWindow) = 0; +		yesNoWindow->current = 0;  	} else if (Wiimote_TestButtons(GetActiveWiimote(), WPAD_A | WPAD_TWO)) {  		// Pick the current option -		YESNO_CLOSE(this->yesNoWindow) = true; +		yesNoWindow->close = true; -		if (YESNO_CURRENT(this->yesNoWindow) != 1) -			YESNO_CANCELLED2(this->yesNoWindow) = true; +		if (yesNoWindow->current != 1) +			yesNoWindow->hasBG = true;  		state.setState(&StateID_QuickSaveWindowClose);  	} else {  		// Cancel using B or 1  		if (CheckIfMenuShouldBeCancelledForSpecifiedWiimote(0)) { -			YESNO_CANCELLED(this->yesNoWindow) = true; -			YESNO_CURRENT(this->yesNoWindow) = 1; +			yesNoWindow->cancelled = true; +			yesNoWindow->current = 1;  			state.setState(&StateID_QuickSaveWindowClose);  		}  	} @@ -905,8 +895,8 @@ void dScKoopatlas_c::executeState_QuickSaveSelect() {  // 	the "Save?" YesNoWindow. Also, wait for the animation to be complete  void dScKoopatlas_c::executeState_QuickSaveWindowClose() { -	if (!YESNO_VISIBLE(this->yesNoWindow)) { -		if (YESNO_CURRENT(this->yesNoWindow) == 1) { +	if (!yesNoWindow->visible) { +		if (yesNoWindow->current == 1) {  			state.setState(&StateID_Normal);  			hud->unhideAll();  		} else { @@ -923,8 +913,8 @@ void dScKoopatlas_c::executeState_QuickSaveDo() {  	if (!GetSaveFile()->CheckIfWriting()) {  		if (GetSaveHandler()->CurrentError == 0) { -			YESNO_TYPE(this->yesNoWindow) = 16; -			YESNO_VISIBLE(this->yesNoWindow) = true; +			yesNoWindow->type = 16; +			yesNoWindow->visible = true;  			state.setState(&StateID_QuickSaveEndWindow);  		} else {  			state.setState(&StateID_SaveError); @@ -936,10 +926,10 @@ void dScKoopatlas_c::executeState_QuickSaveDo() {  // STATE_QuickSaveEndWindow : Handle the Save End window.  void dScKoopatlas_c::executeState_QuickSaveEndWindow() { -	if (!YESNO_OPENING(this->yesNoWindow)) { +	if (!yesNoWindow->animationActive) {  		if (Wiimote_TestButtons(GetActiveWiimote(), WPAD_A | WPAD_TWO)) { -			YESNO_CLOSE(this->yesNoWindow) = true; -			YESNO_REFUSED(this->yesNoWindow) = true; +			yesNoWindow->close = true; +			yesNoWindow->keepOpen = true;  			state.setState(&StateID_QuickSaveEndCloseWait);  		}  	} @@ -949,8 +939,8 @@ void dScKoopatlas_c::executeState_QuickSaveEndWindow() {  void dScKoopatlas_c::executeState_QuickSaveEndCloseWait() {  	// Wait for Save End window to close -	if (!YESNO_OPENING(this->yesNoWindow)) { -		if (YESNO_CURRENT(this->yesNoWindow) == 1) { +	if (!yesNoWindow->animationActive) { +		if (yesNoWindow->current == 1) {  			state.setState(&StateID_Normal);  			hud->unhideAll();  		} else { @@ -1057,8 +1047,8 @@ int dScKoopatlas_c::getIndexForMapName(const char *name) {  void dScKoopatlas_c::showSaveWindow() {  	hud->hideAll();  	state.setState(&StateID_SaveOpen); -	YESNO_TYPE(yesNoWindow) = 1; -	YESNO_VISIBLE(yesNoWindow) = 1; +	yesNoWindow->type = 1; +	yesNoWindow->visible = true;  } diff --git a/src/koopatlas/core.h b/src/koopatlas/core.h index ce72d64..58030b7 100644 --- a/src/koopatlas/core.h +++ b/src/koopatlas/core.h @@ -84,7 +84,7 @@ class dScKoopatlas_c : public dScene_c {  		void *csMenu;  		void *selectCursor;  		void *numPeopleChange; -		void *yesNoWindow; +		dYesNoWindow_c *yesNoWindow;  		void *continueObj;  		dStockItem_c *stockItem;  		dStockItemShadow_c *stockItemShadow; | 
