diff GUI/GUIWindow.cpp @ 2549:3121fb54a110

Rest & Spelbook refactored into class
author a.parshin
date Tue, 12 May 2015 11:07:32 +0200
parents 87e5590d034b
children fb42e2662c38
line wrap: on
line diff
--- a/GUI/GUIWindow.cpp	Tue May 12 03:24:19 2015 +0200
+++ b/GUI/GUIWindow.cpp	Tue May 12 11:07:32 2015 +0200
@@ -216,13 +216,6 @@
 }
 
 
-GUIWindow_Spellbook::GUIWindow_Spellbook(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
-    GUIWindow(x, y, width, height, button, hint)
-{
-    InitializeSpellBookTextures();
-    OpenSpellBook();
-}
-
 GUIWindow_GenericDialogue::GUIWindow_GenericDialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
     GUIWindow(x, y, width, height, button, hint)
 {
@@ -401,6 +394,8 @@
 
 void GUIWindow_Dialogue::Release()
 {
+// -----------------------------------------
+// 0041C26A void GUIWindow::Release --- part
     if (!dword_591084)
         pDialogueNPCPortraits[0]->Release();
     uNumDialogueNPCPortraits = 0;
@@ -412,16 +407,10 @@
     GUIWindow::Release();
 }
 
-void GUIWindow_Spellbook::Release()
-{
-    OnCloseSpellBookPage();
-    OnCloseSpellBook();
-
-    GUIWindow::Release();
-}
-
 void GUIWindow_GenericDialogue::Release()
 {
+// -----------------------------------------
+// 0041C26A void GUIWindow::Release --- part
     pIcons_LOD->SyncLoadedFilesCount();
     current_screen_type = prev_screen_type;
     pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
@@ -431,6 +420,8 @@
 
 void GUIWindow_House::Release()
 {
+// -----------------------------------------
+// 0041C26A void GUIWindow::Release --- part
     for (int i = 0; i < uNumDialogueNPCPortraits; ++i)
         pDialogueNPCPortraits[i]->Release();
     uNumDialogueNPCPortraits = 0;
@@ -607,61 +598,6 @@
 }
 
 
-//----- (00411621) --------------------------------------------------------
-void GUIWindow::OpenSpellBook()
-{
-  Player *pPlayer; // edi@1
-  //GUIWindow *pWindow; // esi@1
-  //unsigned int v3; // ebp@1
-  int v4; // eax@3
-  ///GUIButton *result; // eax@25
-  int a2; // [sp+10h] [bp-8h]@1
-  //int v7; // [sp+14h] [bp-4h]@1
-
-  pPlayer = pPlayers[uActiveCharacter];
-  //pWindow = this;
-  LoadSpellbook(pPlayer->lastOpenedSpellbookPage);
-  //v3 = 0;
-  a2 = 0;
-
-  PlayerSpellbookChapter* chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage];
-  for (uint i = 0; i < 11; ++i)
-  {
-    if (!chapter->bIsSpellAvailable[i])
-      continue;
-		v4= pPlayer->lastOpenedSpellbookPage;
-      //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]);
-      CreateButton(pViewport->uViewportTL_X +  pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos,
-                   pViewport->uViewportTL_Y +  pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos,  //dword_4E20D0
-                   SBPageSSpellsTextureList[i + 1]->uTextureWidth,
-                   SBPageSSpellsTextureList[i + 1]->uTextureHeight,
-                   1, 79, UIMSG_SelectSpell, i, 0, "", 0);
-      ++a2;
-    //++v3;
-  }
-  //while ( (signed int)v3 < 11 );
-
-  CreateButton(0, 0, 0, 0, 1, 0, UIMSG_SpellBook_PressTab, 0, '\t', "", 0);
-  if ( a2 )
-    _41D08F_set_keyboard_control_group(a2, 0, 0, 0);
-
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE])   CreateButton(399,  10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR])    CreateButton(399,  46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER])  CreateButton(399,  83, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 2, 0, aSpellSchoolNames[2], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH])  CreateButton(399, 121, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 3, 0, aSpellSchoolNames[3], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) CreateButton(399, 158, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 4, 0, aSpellSchoolNames[4], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND])   CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY])   CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT])  CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0);
-  if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK])   CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0);
-
-                            CreateButton(476, 450, pSBClickQuickSpellBtnTextr->uTextureWidth, pSBClickQuickSpellBtnTextr->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0);
-  pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pSBClickQuickSpellBtnTextr, 0);
-                            CreateButton(561, 450, pSpellBookClickCloseBtnTextr->uTextureWidth, pSpellBookClickCloseBtnTextr->uTextureHeight, 1,  0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0);
-  pBtn_CloseBook          = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pSpellBookClickCloseBtnTextr, 0);
-}
-// 50640C: using guessed type int dword_50640C[];
-
 //----- (004B3157) --------------------------------------------------------
 void GUIWindow::HouseDialogManager()
 {
@@ -1378,13 +1314,6 @@
     GameUI_DrawBranchlessDialogue();
 }
 
-void GUIWindow_Spellbook::Update()
-{
-// -----------------------------------
-// 004156F0 GUI_UpdateWindows --- part
-    DrawSpellBookContent(pPlayers[uActiveCharacter]);
-}
-
 void GUIWindow_Chest::Update()
 {
 // -----------------------------------