diff GUIWindow.cpp @ 1297:5450af4f57ef

moving files mm7_x ending
author Ritor1
date Wed, 19 Jun 2013 17:06:58 +0600
parents 86a83e12d795
children 8c2f689b5f0b
line wrap: on
line diff
--- a/GUIWindow.cpp	Tue Jun 18 17:28:11 2013 +0600
+++ b/GUIWindow.cpp	Wed Jun 19 17:06:58 2013 +0600
@@ -25,6 +25,7 @@
 #include "texts.h"
 #include "Autonotes.h"
 #include "Awards.h"
+#include "Chest.h"
 
 
 #include "mm7_data.h"
@@ -1883,4 +1884,702 @@
   pDialogueWindow = 0;
   pMiscTimer->Resume();
   pEventTimer->Resume();
+}
+//----- (004156F0) --------------------------------------------------------
+void GUI_UpdateWindows() 
+{
+  GUIWindow *pWindow; // esi@4
+  //unsigned int pWindowType; // eax@4
+  const char *pHint; // edx@66
+  GUIButton *pButtonPtr_1C; // ebp@79
+  char *pHint1; // edx@80
+  int v26; // eax@98
+  unsigned int v27; // ebp@106
+  GUIWindow *pGUIWindow2; // ecx@109
+  GUIFont *pGUIFont; // ST1C_4@115
+  int v31; // eax@115
+  GUIButton *pButton; // ebp@118
+  int v39; // eax@129
+  unsigned int pNumMessages; // eax@142
+  GUIButton *pGUIButton; // ebp@146
+  //unsigned int pX; // [sp-1Ch] [bp-124h]@17
+  //unsigned int pY; // [sp-18h] [bp-120h]@17
+  //Texture *pTexture; // [sp-14h] [bp-11Ch]@17
+  //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86
+  int i; // [sp+0h] [bp-108h]@3
+  ItemGen pItemGen; // [sp+4h] [bp-104h]@98
+  GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133
+  ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129
+
+  if (GetCurrentMenuID() != MENU_CREATEPARTY)
+    UI_OnKeyDown(VK_NEXT);
+
+  for ( i = 1; i <= uNumVisibleWindows; ++i )
+  {
+    pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1];
+    switch (pWindow->eWindowType)
+    {
+      case WINDOW_OptionsButtons:
+      {
+        pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y,
+                                      pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options));
+        viewparams->bRedrawGameUI = 1;
+        continue;
+      }
+      case WINDOW_CharacterRecord:
+      {
+        CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]);
+        continue;
+      }
+      case WINDOW_Options:
+      {
+        GameMenuUI_Options_Draw();
+        continue;
+      }
+      case WINDOW_Book:
+      {
+        BookUI_Draw((WindowType)(int)pWindow->ptr_1C);
+        continue;
+      }
+      case WINDOW_Dialogue:
+      {
+        GameUI_DrawDialogue();
+        continue;
+      }
+      case WINDOW_QuickReference:
+      {
+        GameUI_QuickRef_Draw();
+        continue;
+      }
+      case WINDOW_Rest:
+      {
+        RestUI_Draw();
+        continue;
+      }
+      case WINDOW_ChangeLocation:
+      {
+        TravelUI_Draw();
+        continue;
+      }
+      case WINDOW_SpellBook:
+      {
+        DrawSpellBookContent(pPlayers[uActiveCharacter]);
+        continue;
+      }
+      case WINDOW_GreetingNPC:
+      {
+        GameUI_DrawBranchlessDialogue();
+        continue;
+      }
+      case WINDOW_Chest:
+      {
+        if ( pCurrentScreen == SCREEN_CHEST )
+        {
+          Chest::DrawChestUI((unsigned int)pWindow->ptr_1C);
+        }
+        else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY )
+        {
+          pRenderer->ClearZBuffer(0, 479);
+          draw_leather();
+          CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
+          pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId));
+        }
+        continue;
+      }
+      case WINDOW_SaveLoadButtons:
+      {
+        SaveUI_Draw();
+        continue;
+      }
+      case WINDOW_MainMenu_Load:
+      {
+        LoadUI_Draw();
+        continue;
+      }
+      case WINDOW_HouseInterior:
+      {
+        pWindowList[pVisibleWindowsIdxs[i] - 1].HouseDialogManager();
+        if ( !window_SpeakInHouse )
+          continue;
+        if ( (signed int)window_SpeakInHouse->ptr_1C >= 53 )
+          continue;
+        if ( pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] <=pParty->uTimePlayed )
+        {
+          if ( (signed int)window_SpeakInHouse->ptr_1C < 53 )
+          {
+            pParty->field_3C._shop_ban_times[(signed int)window_SpeakInHouse->ptr_1C] = 0;
+          }
+          continue;
+        }
+        pNumMessages = pMessageQueue_50CBD0->uNumMessages;
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_Transition:
+      {
+        TransitionUI_Draw();
+        continue;
+      }
+      case WINDOW_Scroll:
+      {
+        CreateScrollWindow();
+        continue;
+      }
+      case WINDOW_CastSpell_InInventory:
+      {
+        pRenderer->ClearZBuffer(0, 479);
+        draw_leather();
+        CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true);
+        CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]);
+        pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u));
+        continue;
+      }
+      case WINDOW_FinalWindow:
+      {
+        sub_41420D_press_esc();
+        continue;
+      }
+      case WINDOW_50:
+      {
+        v27 = TargetColor(255, 255, 255);
+        if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
+        {
+          ptr_507BD0->DrawMessageBox(0);
+          ptr_507BD0->DrawText(pFontCreate, 30, 40, v27, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+          v31 = pFontCreate->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
+          ptr_507BD0->DrawFlashingInputCursor(v31 + 30, 40, pFontCreate);
+          continue;
+        }
+        if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
+        {
+          pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
+          pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BD0->ptr_1C, 0, 0);
+          pEventTimer->Resume();
+          ptr_507BD0->Release();
+          pCurrentScreen = SCREEN_GAME;
+          viewparams->bRedrawGameUI = true;
+          continue;
+        }
+        if ( ptr_507BD0->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
+        {
+          pWindow->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
+          pEventTimer->Resume();
+          ptr_507BD0->Release();
+          continue;
+        }
+      }
+      case WINDOW_59:
+      {
+        pWindow->DrawMessageBox(0);
+        pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
+        pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+        if ( !pKeyActionMap->field_204 )
+        {
+          ItemGen2.Reset();
+          pWindow->Release();
+          pEventTimer->Resume();
+          pCurrentScreen = 0;
+          viewparams->bRedrawGameUI = true;
+          v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+          if ( v26 > 0 )
+          {
+            if ( v26 < 800 )
+            {
+              ItemGen2.uAttributes |= 1u;
+              ItemGen2.uItemID = v26;
+              if ( pItemsTable->pItems[v26].uEquipType == 12 )
+              {
+                ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1;
+                ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges);
+              }
+              else
+              {
+                if ( v26 >= 221 && v26 < 271 )
+                  ItemGen2.uEnchantmentType = rand() % 10 + 1;
+              }
+              pItemsTable->SetSpecialBonus(&ItemGen2);
+              pParty->SetHoldingItem(&ItemGen2);
+            }
+          }
+        }
+        continue;
+      }
+      case WINDOW_PressedButton2:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        if ( pButton->uX >= 0 && pButton->uX <= 640 )
+        {
+          if ( pButton->uY >= 0 && pButton->uY <= 480 )
+          {
+            pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+            viewparams->bRedrawGameUI = 1;
+            if ( pWindow->Hint )
+            {
+              if ( pWindow->Hint != (char *)1 )
+                pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+            }
+            pWindow->Release();
+            continue;
+          }
+        }
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint )
+        {
+          if ( pWindow->Hint != (char *)1 )
+            pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        }
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_CharactersPressedButton:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint )
+        {
+          if ( pWindow->Hint != (char *)1 )
+            pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        }
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_PressedButton:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint )
+        {
+          if ( pWindow->Hint != (char *)1 )
+            pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        }
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_5D:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
+        viewparams->bRedrawGameUI = 1;
+        pWindow->Release();
+        continue;
+      }
+      case WINDOW_SaveLoadBtn:
+      {
+        if (pWindow->Hint != (char *)1)
+          pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+        pHint = pWindow->Hint;
+        viewparams->bRedrawGameUI = 1;
+        if ( pHint && pHint != (char *)1 )
+          pButton->DrawLabel(pHint, pFontCreate, 0, 0);
+        pWindow->Release();
+        if (pCurrentScreen == SCREEN_SAVEGAME)
+          pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
+        else
+          pMessageQueue_50CBD0->AddMessage(UIMSG_LoadGame, 0, 0);
+        continue;
+      }
+      case WINDOW_LoadGame_CancelBtn:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[0]);
+        viewparams->bRedrawGameUI = 1;
+        if ( pWindow->Hint && pWindow->Hint != (char *)1 )
+          pButton->DrawLabel(pWindow->Hint, pFontCreate, 0, 0);
+        pWindow->Release();
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_CloseRestWindowBtn:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pGUIButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pGUIButton->pTextures[0]);
+        pHint = pWindow->Hint;
+        viewparams->bRedrawGameUI = 1;
+        if ( pHint && pHint != (char *)1 )
+          pGUIButton->DrawLabel(pHint, pFontCreate, 0, 0);
+        pWindow->Release();
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_ExitCharacterWindow:
+      {
+        if ( pWindow->Hint != (char *)1 )
+          pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, pButton->pTextures[1]);
+        pHint = pWindow->Hint;
+        viewparams->bRedrawGameUI = 1;
+        if ( pHint && pHint != (char *)1 )
+          pButton->DrawLabel(pHint, pFontCreate, 0, 0);
+        pWindow->Release();
+        pNumMessages = pMessageQueue_50CBD0->uNumMessages;
+        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
+        continue;
+      }
+      case WINDOW_RestWindow:
+      {
+        memset(&GUIButton2, 0, 0xBCu);
+        GUIButton2.uZ = 197;
+        GUIButton2.uW = 197;
+        GUIButton2.uX = 27;
+        GUIButton2.uY = 161;
+        GUIButton2.uWidth = 171;
+        GUIButton2.uHeight = 37;
+        GUIButton2.pParent = pButton_RestUI_WaitUntilDawn->pParent;
+        pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0);
+        pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15));
+        viewparams->bRedrawGameUI = 1;
+        GUIButton2.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0);//Отдых и лечение 8 часов
+        GUIButton2.pParent = 0;
+        pGUIWindow2 = pWindow;
+        pGUIWindow2->Release();
+        continue;
+      }
+      case WINDOW_BooksWindow:
+      {
+        pButton = (GUIButton *)pWindow->ptr_1C;
+        pRenderer->DrawTextureIndexed(pWindow->uFrameY,
+                                      pWindow->uFrameX, pButton->pTextures[0]);
+        viewparams->bRedrawGameUI = true;
+        continue;
+      }
+      case WINDOW_CharacterWindow_Inventory:
+      {
+        pWindow->DrawMessageBox(0);
+        pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0);
+        pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0);
+        if ( !pKeyActionMap->field_204 )
+        {
+          ItemGen2.Reset();
+          pWindow->Release();
+          pEventTimer->Resume();
+          pCurrentScreen = SCREEN_GAME;
+          viewparams->bRedrawGameUI = 1;
+          v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
+          if ( v39 > 0 )
+          {
+            if ( v39 < 800 )
+              SpawnActor(v39);
+          }
+        }
+        continue;
+      }
+      case WINDOW_KeyMappingOptions:
+      {
+        GameMenuUI_DrawKeyBindings();
+        continue;
+      }
+      case WINDOW_VideoOptions:
+      {
+        GameMenuUI_DrawVideoOptions();
+        continue;
+      }
+      default:
+      {
+        continue;
+      }
+    }
+  }
+  if ( GetCurrentMenuID() == -1 )
+    GameUI_DrawFoodAndGold();
+  if ( sub_4637E0_is_there_popup_onscreen() )
+    sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(0);
+}
+//----- (00415485) --------------------------------------------------------
+void DrawCopyrightWindow()
+{
+  GUIWindow Dst; // [sp+8h] [bp-54h]@1
+
+  memset(&Dst, 0, 0x54u);
+  Dst.uFrameWidth = 624;
+  Dst.uFrameHeight = 256;
+  Dst.uFrameX = 8;
+  Dst.uFrameY = 30;                             // c 1999 The 3DO Company.
+  Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(pGlobalTXT_LocalizationStrings[157], &Dst, 24, 0)
+                   + 2 * LOBYTE(pFontSmallnum->uFontHeight)
+                   + 24;
+  Dst.uFrameY = 470 - Dst.uFrameHeight;
+  Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
+  Dst.uFrameW = 469;
+  //Dst.Hint = "abcagfdsgsg ljsrengvlkjesnfkjwnef";
+  Dst.DrawMessageBox(0);
+
+  Dst.uFrameWidth -= 24;
+  Dst.uFrameX += 12;
+  Dst.uFrameY += 12;
+  Dst.uFrameHeight -= 12;
+  Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1;
+  Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1;
+  Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
+}
+//----- (0041420D) --------------------------------------------------------
+void __cdecl sub_41420D_press_esc()
+{
+  GUIWindow pWindow; // [sp+4h] [bp-54h]@1
+
+  sprintf(pTmpBuf2.data(), "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape
+  pWindow.Hint = pTmpBuf2.data();
+  pWindow.uFrameWidth = 400;
+  pWindow.uFrameHeight = 100;
+  pWindow.uFrameX = 120;
+  pWindow.uFrameY = 140;
+  pWindow.uFrameZ = 519;
+  pWindow.uFrameW = 239;
+  pWindow.DrawMessageBox(0);
+}
+
+//----- (0041426F) --------------------------------------------------------
+void __cdecl sub_41426F()
+{
+  GUIWindow *pWindow; // ecx@1
+
+  pWindow = ptr_507BDC;
+  pMessageQueue_50CBD0->AddMessage((UIMessageType)(int)ptr_507BDC->ptr_1C, 0, 0);
+
+  pWindow->Release();
+  ptr_507BDC = 0;
+  pCurrentScreen = dword_506F0C[0];
+  pEventTimer->Resume();
+}
+//----- (00410DEC) --------------------------------------------------------
+unsigned int __cdecl DrawLloydBeaconsScreen()
+{
+  Player *pPlayer; // esi@1
+  char *v1; // eax@1
+  unsigned __int16 v2; // ax@6
+  unsigned int result; // eax@11
+  unsigned int v4; // esi@13
+  unsigned int v5; // ecx@13
+  char v6; // zf@13
+  LloydBeacon *v7; // esi@14
+  int v8; // eax@14
+  unsigned __int64 v9; // kr08_8@14
+  unsigned int v10; // esi@14
+  unsigned int v11; // eax@14
+  char *v12; // eax@19
+  char *v13; // ecx@22
+  int v14; // eax@27
+  Texture *v19; // [sp-4h] [bp-8Ch]@4
+  GUIWindow pWindow; // [sp+Ch] [bp-7Ch]@1
+  unsigned int v23; // [sp+64h] [bp-24h]@14
+  __int64 v24; // [sp+68h] [bp-20h]@14
+  unsigned int v25; // [sp+70h] [bp-18h]@13
+  char *Str; // [sp+74h] [bp-14h]@14
+  int v27; // [sp+78h] [bp-10h]@11
+  LloydBeacon *v28; // [sp+7Ch] [bp-Ch]@12
+  RGBTexture *v29; // [sp+80h] [bp-8h]@12
+  int uNumMaxBeacons; // [sp+84h] [bp-4h]@6
+
+  pPlayer = &pParty->pPlayers[_506348_current_lloyd_playerid];
+  pRenderer->DrawTextureIndexed(8u, 8u, pTexture_LloydBeacons[(unsigned __int8)bRecallingBeacon]);
+  v1 = pGlobalTXT_LocalizationStrings[523];     // Recall Beacon
+  pWindow.uFrameX = game_viewport_x;
+  pWindow.uFrameY = game_viewport_y;
+  pWindow.uFrameWidth = 428;
+  pWindow.uFrameHeight = game_viewport_height;
+  pWindow.uFrameZ = 435;
+  pWindow.uFrameW = game_viewport_w;
+  if ( !bRecallingBeacon )
+    v1 = pGlobalTXT_LocalizationStrings[375];   // Set Beacon
+  sprintf(pTmpBuf.data(), "%s", v1);
+  pWindow.DrawTitleText(pBook2Font, 0, 22u, 0, pTmpBuf.data(), 3u);
+  if ( bRecallingBeacon )
+  {
+    pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6b__zoom_on);
+    v19 = pTex_tab_an_6a__zoom_off;
+  }
+  else
+  {
+    pRenderer->DrawTextureTransparent(pBtn_Book_1->uX, pBtn_Book_1->uY, pTex_tab_an_6a__zoom_off);
+    v19 = pTex_tab_an_6b__zoom_on;
+  }
+  pRenderer->DrawTextureTransparent(pBtn_Book_2->uX, pBtn_Book_2->uY, v19);
+  v2 = pPlayer->pActiveSkills[14];
+  uNumMaxBeacons = 1;
+  if ( HIBYTE(v2) & 1 || (v2 & 0x80u) != 0 )
+  {
+    uNumMaxBeacons = 5;
+  }
+  else
+  {
+    if ( v2 & 0x40 )
+      uNumMaxBeacons = 3;
+  }
+  result = 0;
+  v27 = 0;
+  if ( uNumMaxBeacons > 0 )
+  {
+    v29 = pSavegameThumbnails.data();
+    v28 = pPlayer->pInstalledBeacons;
+    while ( 1 )
+    {
+      pWindow.uFrameWidth = 92;
+      v4 = result;
+      pWindow.uFrameHeight = 68;
+      v5 = pLloydsBeaconsPreviewXs[result];
+      pWindow.uFrameY = pLloydsBeaconsPreviewYs[result];
+      v25 = pWindow.uFrameY;
+      pWindow.uFrameX = v5;
+      pWindow.uFrameW = pWindow.uFrameY + 67;
+      v6 = v29->pPixels == 0;
+      pWindow.uFrameZ = v5 + 91;
+      if ( !v6 )
+        break;
+      if ( !bRecallingBeacon )
+      {
+        pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
+        v14 = pSpellFont->CalcTextHeight(pGlobalTXT_LocalizationStrings[19], &pWindow, 0, 0);
+        pWindow.DrawTitleText(pSpellFont, 0, (signed int)pWindow.uFrameHeight / 2 - v14 / 2, 1, pGlobalTXT_LocalizationStrings[19], 3);
+      }
+LABEL_29:
+      ++v29;
+      ++v28;
+      result = v27++ + 1;
+      if ( v27 >= uNumMaxBeacons )
+        goto LABEL_30;
+    }
+    pRenderer->DrawTextureTransparent(pLloydsBeacons_SomeXs[v4], pLloydsBeacons_SomeYs[v4], pTexture_CurrentBook);
+    pRenderer->DrawTextureRGB(pLloydsBeaconsPreviewXs[v4], pLloydsBeaconsPreviewYs[v4], v29);
+    v7 = v28;
+    Str = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(v28->field_18))].pName;
+    v8 = pSpellFont->CalcTextHeight(Str, &pWindow, 0, 0);
+    pWindow.uFrameY += -6 - v8;
+    pWindow.DrawTitleText(pSpellFont, 0, 0, 1u, Str, 3u);
+    v9 = v7->uBeaconTime - pParty->uTimePlayed;
+    LODWORD(v24) = LODWORD(v7->uBeaconTime) - LODWORD(pParty->uTimePlayed);
+    HIDWORD(v24) = HIDWORD(v9);
+    v23 = (unsigned __int64)((signed __int64)((double)v24 * 0.234375) / 60 / 60) >> 32;
+    v10 = (signed __int64)((double)v24 * 0.234375) / 60 / 60;
+    v11 = v10 / 0x18;
+    if ( (unsigned int)((signed __int64)((double)v24 * 0.234375) / 60 / 60) / 0x18 )
+    {
+      v13 = pGlobalTXT_LocalizationStrings[57]; // Days
+      if ( v11 > 1 )
+      {
+        sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
+        pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+        goto LABEL_29;
+      }
+    }
+    else
+    {
+      if ( (signed __int64)(__PAIR__(v23, v10) + 1) <= 23 )
+      {
+        if ( (v23 & 0x80000000u) != 0 || (signed int)v23 <= 0 && v10 <= 1 )
+          v12 = pGlobalTXT_LocalizationStrings[109];// Hour
+        else
+          v12 = pGlobalTXT_LocalizationStrings[110];// Hours
+        sprintf(pTmpBuf.data(), "%lu %s", v10 + 1, v12);
+        pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
+        pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+        goto LABEL_29;
+      }
+    }
+    v13 = pGlobalTXT_LocalizationStrings[56];   // Day
+    sprintf(pTmpBuf.data(), "%lu %s", v11 + 1, v13);
+    pWindow.uFrameY = v25 + pWindow.uFrameHeight + 4;
+    pWindow.DrawTitleText(pSpellFont, 0, 0, 1, pTmpBuf.data(), 3);
+    goto LABEL_29;
+  }
+LABEL_30:
+  if ( byte_506360 )
+  {
+    /*result = pMessageQueue_50CBD0->uNumMessages;
+    if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
+    {
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseAfterInstallBeacon;
+      pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
+      result = 3 * pMessageQueue_50CBD0->uNumMessages + 3;
+      *(&pMessageQueue_50CBD0->uNumMessages + result) = 0;
+      ++pMessageQueue_50CBD0->uNumMessages;
+    }*/
+    pMessageQueue_50CBD0->AddMessage(UIMSG_CloseAfterInstallBeacon, 0, 0);
+  }
+  return result;
+}
+//----- (00467FB6) --------------------------------------------------------
+void CreateScrollWindow()
+    {
+  unsigned int v0; // eax@1
+  char *v1; // ST18_4@3
+  unsigned int v2; // eax@3
+  GUIWindow a1; // [sp+Ch] [bp-54h]@1
+
+  memcpy(&a1, pGUIWindow_ScrollWindow, sizeof(a1));
+  a1.Hint = 0;
+  a1.uFrameX = 1;
+  a1.uFrameY = 1;
+  a1.uFrameWidth = 468;
+  v0 = pFontSmallnum->CalcTextHeight(pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C], &a1, 0, 0)
+     + 2 * LOBYTE(pFontCreate->uFontHeight)
+     + 24;
+  a1.uFrameHeight = v0;
+  if ( (signed int)(v0 + a1.uFrameY) > 479 )
+  {
+    v0 = 479 - a1.uFrameY;
+    a1.uFrameHeight = 479 - a1.uFrameY;
+  }
+  a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
+  a1.uFrameW = v0 + a1.uFrameY - 1;
+  a1.DrawMessageBox(0);
+  a1.uFrameX += 12;
+  a1.uFrameWidth -= 24;
+  a1.uFrameY += 12;
+  a1.uFrameHeight -= 12;
+  a1.uFrameZ = a1.uFrameWidth + a1.uFrameX - 1;
+  a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
+  v1 = pItemsTable->pItems[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C + 700].pName;
+  v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
+  sprintf(pTmpBuf.data(), format_4E2D80, v2, v1);
+  a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf.data(), 3u);
+  a1.DrawText(
+           pFontSmallnum,
+           1,
+           LOBYTE(pFontCreate->uFontHeight) - 3,
+           0,
+           pScrolls[(unsigned int)pGUIWindow_ScrollWindow->ptr_1C],
+           0,
+           0,
+           0);
+}
+//----- (00467F48) --------------------------------------------------------
+void CreateMsgScrollWindow( signed int mscroll_id )
+    {
+  signed int v1; // esi@1
+
+  v1 = mscroll_id;
+  if ( !pGUIWindow_ScrollWindow && mscroll_id >= 700 )
+  {
+    if ( mscroll_id <= 782 )
+    {
+      uTextureID_720980 = pIcons_LOD->LoadTexture("leather", TEXTURE_16BIT_PALETTE);
+      pGUIWindow_ScrollWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Scroll, v1 - 700, 0);
+    }
+  }
+}
+//----- (00467F9F) --------------------------------------------------------
+void __cdecl free_book_subwindow()
+{
+  if ( pGUIWindow_ScrollWindow )
+  {
+    pGUIWindow_ScrollWindow->Release();
+    pGUIWindow_ScrollWindow = 0;
+  }
 }
\ No newline at end of file