comparison 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
comparison
equal deleted inserted replaced
2548:87e5590d034b 2549:3121fb54a110
214 _41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); 214 _41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1);
215 } 215 }
216 } 216 }
217 217
218 218
219 GUIWindow_Spellbook::GUIWindow_Spellbook(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
220 GUIWindow(x, y, width, height, button, hint)
221 {
222 InitializeSpellBookTextures();
223 OpenSpellBook();
224 }
225
226 GUIWindow_GenericDialogue::GUIWindow_GenericDialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) : 219 GUIWindow_GenericDialogue::GUIWindow_GenericDialogue(unsigned int x, unsigned int y, unsigned int width, unsigned int height, int button, const char *hint) :
227 GUIWindow(x, y, width, height, button, hint) 220 GUIWindow(x, y, width, height, button, hint)
228 { 221 {
229 prev_screen_type = current_screen_type; 222 prev_screen_type = current_screen_type;
230 pKeyActionMap->EnterText(0, 15, this); 223 pKeyActionMap->EnterText(0, 15, this);
399 392
400 393
401 394
402 void GUIWindow_Dialogue::Release() 395 void GUIWindow_Dialogue::Release()
403 { 396 {
397 // -----------------------------------------
398 // 0041C26A void GUIWindow::Release --- part
404 if (!dword_591084) 399 if (!dword_591084)
405 pDialogueNPCPortraits[0]->Release(); 400 pDialogueNPCPortraits[0]->Release();
406 uNumDialogueNPCPortraits = 0; 401 uNumDialogueNPCPortraits = 0;
407 pTexture_Dialogue_Background->Release(); 402 pTexture_Dialogue_Background->Release();
408 403
410 current_screen_type = prev_screen_type; 405 current_screen_type = prev_screen_type;
411 406
412 GUIWindow::Release(); 407 GUIWindow::Release();
413 } 408 }
414 409
415 void GUIWindow_Spellbook::Release()
416 {
417 OnCloseSpellBookPage();
418 OnCloseSpellBook();
419
420 GUIWindow::Release();
421 }
422
423 void GUIWindow_GenericDialogue::Release() 410 void GUIWindow_GenericDialogue::Release()
424 { 411 {
412 // -----------------------------------------
413 // 0041C26A void GUIWindow::Release --- part
425 pIcons_LOD->SyncLoadedFilesCount(); 414 pIcons_LOD->SyncLoadedFilesCount();
426 current_screen_type = prev_screen_type; 415 current_screen_type = prev_screen_type;
427 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED); 416 pKeyActionMap->SetWindowInputStatus(WINDOW_INPUT_CANCELLED);
428 417
429 GUIWindow::Release(); 418 GUIWindow::Release();
430 } 419 }
431 420
432 void GUIWindow_House::Release() 421 void GUIWindow_House::Release()
433 { 422 {
423 // -----------------------------------------
424 // 0041C26A void GUIWindow::Release --- part
434 for (int i = 0; i < uNumDialogueNPCPortraits; ++i) 425 for (int i = 0; i < uNumDialogueNPCPortraits; ++i)
435 pDialogueNPCPortraits[i]->Release(); 426 pDialogueNPCPortraits[i]->Release();
436 uNumDialogueNPCPortraits = 0; 427 uNumDialogueNPCPortraits = 0;
437 pTexture_Dialogue_Background->Release(); 428 pTexture_Dialogue_Background->Release();
438 429
604 else 595 else
605 *((int *)&pSavegameThumbnails.data()->pPixels + 10 * uSlot) = 0; 596 *((int *)&pSavegameThumbnails.data()->pPixels + 10 * uSlot) = 0;
606 } 597 }
607 } 598 }
608 599
609
610 //----- (00411621) --------------------------------------------------------
611 void GUIWindow::OpenSpellBook()
612 {
613 Player *pPlayer; // edi@1
614 //GUIWindow *pWindow; // esi@1
615 //unsigned int v3; // ebp@1
616 int v4; // eax@3
617 ///GUIButton *result; // eax@25
618 int a2; // [sp+10h] [bp-8h]@1
619 //int v7; // [sp+14h] [bp-4h]@1
620
621 pPlayer = pPlayers[uActiveCharacter];
622 //pWindow = this;
623 LoadSpellbook(pPlayer->lastOpenedSpellbookPage);
624 //v3 = 0;
625 a2 = 0;
626
627 PlayerSpellbookChapter* chapter = &pPlayer->spellbook.pChapters[pPlayer->lastOpenedSpellbookPage];
628 for (uint i = 0; i < 11; ++i)
629 {
630 if (!chapter->bIsSpellAvailable[i])
631 continue;
632 v4= pPlayer->lastOpenedSpellbookPage;
633 //v4 = (12 * pPlayer->lastOpenedSpellbookPage + pSpellbookSpellIndices[pPlayer->lastOpenedSpellbookPage][i + 1]);
634 CreateButton(pViewport->uViewportTL_X + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Xpos,
635 pViewport->uViewportTL_Y + pIconPos[v4][pSpellbookSpellIndices[v4][i+1]].Ypos, //dword_4E20D0
636 SBPageSSpellsTextureList[i + 1]->uTextureWidth,
637 SBPageSSpellsTextureList[i + 1]->uTextureHeight,
638 1, 79, UIMSG_SelectSpell, i, 0, "", 0);
639 ++a2;
640 //++v3;
641 }
642 //while ( (signed int)v3 < 11 );
643
644 CreateButton(0, 0, 0, 0, 1, 0, UIMSG_SpellBook_PressTab, 0, '\t', "", 0);
645 if ( a2 )
646 _41D08F_set_keyboard_control_group(a2, 0, 0, 0);
647
648 if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) CreateButton(399, 10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0);
649 if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) CreateButton(399, 46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0);
650 if (pPlayer->pActiveSkills[PLAYER_SKILL_WATER]) CreateButton(399, 83, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 2, 0, aSpellSchoolNames[2], 0);
651 if (pPlayer->pActiveSkills[PLAYER_SKILL_EARTH]) CreateButton(399, 121, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 3, 0, aSpellSchoolNames[3], 0);
652 if (pPlayer->pActiveSkills[PLAYER_SKILL_SPIRIT]) CreateButton(399, 158, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 4, 0, aSpellSchoolNames[4], 0);
653 if (pPlayer->pActiveSkills[PLAYER_SKILL_MIND]) CreateButton(400, 196, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 5, 0, aSpellSchoolNames[5], 0);
654 if (pPlayer->pActiveSkills[PLAYER_SKILL_BODY]) CreateButton(400, 234, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 6, 0, aSpellSchoolNames[6], 0);
655 if (pPlayer->pActiveSkills[PLAYER_SKILL_LIGHT]) CreateButton(400, 271, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 7, 0, aSpellSchoolNames[7], 0);
656 if (pPlayer->pActiveSkills[PLAYER_SKILL_DARK]) CreateButton(400, 307, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 8, 0, aSpellSchoolNames[8], 0);
657
658 CreateButton(476, 450, pSBClickQuickSpellBtnTextr->uTextureWidth, pSBClickQuickSpellBtnTextr->uTextureHeight, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", 0);
659 pBtn_InstallRemoveSpell = CreateButton(476, 450, 48, 32, 1, 78, UIMSG_ClickInstallRemoveQuickSpellBtn, 0, 0, "", pSBClickQuickSpellBtnTextr, 0);
660 CreateButton(561, 450, pSpellBookClickCloseBtnTextr->uTextureWidth, pSpellBookClickCloseBtnTextr->uTextureHeight, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], 0);
661 pBtn_CloseBook = CreateButton(561, 450, 48, 32, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pSpellBookClickCloseBtnTextr, 0);
662 }
663 // 50640C: using guessed type int dword_50640C[];
664 600
665 //----- (004B3157) -------------------------------------------------------- 601 //----- (004B3157) --------------------------------------------------------
666 void GUIWindow::HouseDialogManager() 602 void GUIWindow::HouseDialogManager()
667 { 603 {
668 unsigned __int16 pWhiteColor; // di@2 604 unsigned __int16 pWhiteColor; // di@2
1374 void GUIWindow_GenericDialogue::Update() 1310 void GUIWindow_GenericDialogue::Update()
1375 { 1311 {
1376 // ----------------------------------- 1312 // -----------------------------------
1377 // 004156F0 GUI_UpdateWindows --- part 1313 // 004156F0 GUI_UpdateWindows --- part
1378 GameUI_DrawBranchlessDialogue(); 1314 GameUI_DrawBranchlessDialogue();
1379 }
1380
1381 void GUIWindow_Spellbook::Update()
1382 {
1383 // -----------------------------------
1384 // 004156F0 GUI_UpdateWindows --- part
1385 DrawSpellBookContent(pPlayers[uActiveCharacter]);
1386 } 1315 }
1387 1316
1388 void GUIWindow_Chest::Update() 1317 void GUIWindow_Chest::Update()
1389 { 1318 {
1390 // ----------------------------------- 1319 // -----------------------------------