Mercurial > mm7
diff Game/Game.cpp @ 2549:3121fb54a110
Rest & Spelbook refactored into class
author | a.parshin |
---|---|
date | Tue, 12 May 2015 11:07:32 +0200 |
parents | 87e5590d034b |
children | f2a8ed07e921 |
line wrap: on
line diff
--- a/Game/Game.cpp Tue May 12 03:24:19 2015 +0200 +++ b/Game/Game.cpp Tue May 12 11:07:32 2015 +0200 @@ -41,6 +41,8 @@ #include "GUI/UI/UIQuickReference.h" #include "GUI/UI/UISaveLoad.h" #include "GUI/UI/UIModal.h" +#include "GUI/UI/UIRest.h" +#include "GUI/UI/Spellbook.h" #include "GUI/UI/UIBooks.h" #include "GUI/UI/Books/LloydsBook.h" #include "GUI/UI/Books/TownPortalBook.h" @@ -2149,9 +2151,7 @@ case UIMSG_RentRoom: _506F14_resting_stage = 2; - PrepareToLoadRestUI(); - current_screen_type = SCREEN_REST; - pGUIWindow_CurrentMenu = RestUI_Load(); + pGUIWindow_CurrentMenu = new GUIWindow_Rest(); v86 = 60 * (_494820_training_time(pParty->uCurrentHour) + 1) - pParty->uCurrentMinute; _506F18_num_minutes_to_sleep = v86; @@ -2192,9 +2192,7 @@ } if (!(pParty->uFlags & 0x88)) { - PrepareToLoadRestUI(); - current_screen_type = SCREEN_REST; - pGUIWindow_CurrentMenu = RestUI_Load(); + pGUIWindow_CurrentMenu = new GUIWindow_Rest(); continue; } if (pParty->bTurnBasedModeOn == 1) @@ -2368,20 +2366,14 @@ if (uAction >= skill_count) uAction = 0; } - OnCloseSpellBookPage(); - pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]); - pGUIWindow_CurrentMenu->OpenSpellBook(); - pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0); + ((GUIWindow_Spellbook *)pGUIWindow_CurrentMenu)->OpenSpellbookPage(v217[uAction]); } continue; } case UIMSG_OpenSpellbookPage: if (pTurnEngine->turn_stage == TE_MOVEMENT || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage) continue; - OnCloseSpellBookPage(); - pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam; - pGUIWindow_CurrentMenu->OpenSpellBook(); - pAudioPlayer->PlaySound((SoundID)(rand() % 2 + SOUND_TurnPageU), 0, 0, -1, 0, 0, 0, 0); + ((GUIWindow_Spellbook *)pGUIWindow_CurrentMenu)->OpenSpellbookPage(uMessageParam); continue; case UIMSG_SelectSpell: { @@ -2448,11 +2440,7 @@ if (current_screen_type == SCREEN_GAME) { new OnButtonClick2(476, 450, 0, 0, (int)pBtn_CastSpell, 0); - current_screen_type = SCREEN_SPELL_BOOK; - pEventTimer->Pause(); - pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); - pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0); - viewparams->field_48 = 1; + pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(); continue; } if (current_screen_type != SCREEN_REST && current_screen_type != SCREEN_CHARACTERS @@ -2460,11 +2448,7 @@ { pGUIWindow_CurrentMenu->Release(); new OnButtonClick2(476, 450, 0, 0, (int)pBtn_CastSpell, 0); - current_screen_type = SCREEN_SPELL_BOOK; - pEventTimer->Pause(); - pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(0, 0, window->GetWidth(), window->GetHeight(), 0, 0); - pAudioPlayer->PlaySound(SOUND_48, 0, 0, -1, 0, 0, 0, 0); - viewparams->field_48 = 1; + pGUIWindow_CurrentMenu = new GUIWindow_Spellbook(); continue; } }