diff GUI/GUIWindow.cpp @ 2572:d87bfbd3bb3b

Step towards unification of Texture and RGBTexture (class Image)
author a.parshin
date Sat, 05 Mar 2016 01:51:54 +0200
parents 5d6fb8eb023c
children 0c67be4ec900
line wrap: on
line diff
--- a/GUI/GUIWindow.cpp	Mon Oct 05 00:19:13 2015 +0200
+++ b/GUI/GUIWindow.cpp	Sat Mar 05 01:51:54 2016 +0200
@@ -25,8 +25,11 @@
 #include "Engine/Graphics/Outdoor.h"
 #include "Engine/Tables/IconFrameTable.h"
 #include "Engine/Objects/Actor.h"
+#include "Engine/AssetsManager.h"
 
 #include "GUI\UI\UIArena.h"
+#include "GUI/UI/UIPopup.h"
+#include "GUI/UI/UIGame.h"
 #include "Engine/Events.h"
 #include "Engine/Graphics/Level\Decoration.h"
 
@@ -494,56 +497,55 @@
 
 
 //----- (00415551) --------------------------------------------------------
-void GUIWindow::DrawMessageBox(int arg0)
+void GUIWindow::DrawMessageBox(bool inside_game_viewport)
 {
-  unsigned int v2; // edi@1
-  signed int v4; // esi@2
-  unsigned int v5; // eax@2
   unsigned int v16; // esi@19
   GUIWindow current_window; // [sp+Ch] [bp-60h]@18
   POINT cursor; // [sp+60h] [bp-Ch]@8
   unsigned int v22; // [sp+74h] [bp+8h]@2
 
-  v2 = 0;
-  if ( arg0 )
+  int x = 0;
+  int y = 0;
+  int z, w;
+  if (inside_game_viewport)
   {
-    v4 = pViewport->uViewportTL_X;
-    v5 = pViewport->uViewportBR_X;
-    v2 = pViewport->uViewportTL_Y;
-    v22 = pViewport->uViewportBR_Y;
+    x = pViewport->uViewportTL_X;
+    z = pViewport->uViewportBR_X;
+    y = pViewport->uViewportTL_Y;
+    w = pViewport->uViewportBR_Y;
   }
   else
   {
-    v4 = 0;
-    v5 = window->GetWidth();
-    v22 = window->GetHeight();
+    z = window->GetWidth();
+    w = window->GetHeight();
   }
+
   pMouse->GetCursorPos(&cursor);
-  if ( (signed int)this->uFrameX >= v4 )
+  if ( (signed int)this->uFrameX >= x )
   {
-    if ( (signed int)(this->uFrameWidth + this->uFrameX) > (signed int)v5 )
+    if ( (signed int)(this->uFrameWidth + this->uFrameX) > z )
     {
-      this->uFrameX = v5 - this->uFrameWidth;
+      this->uFrameX = z - this->uFrameWidth;
       this->uFrameY = cursor.y + 30;
     }
   }
   else
   {
-    this->uFrameX = v4;
+    this->uFrameX = x;
     this->uFrameY = cursor.y + 30;
   }
 
-  if ( (signed int)this->uFrameY >= (signed int)v2 )
+  if ( (signed int)this->uFrameY >= y )
   {
-    if ( (signed int)(this->uFrameY + this->uFrameHeight) > (signed int)v22 )
+    if ( (signed int)(this->uFrameY + this->uFrameHeight) > w)
       this->uFrameY = cursor.y - this->uFrameHeight - 30;
   }
   else
     this->uFrameY = cursor.y + 30;
-  if ( (signed int)this->uFrameY < (signed int)v2 )
-    this->uFrameY = v2;
-  if ( (signed int)this->uFrameX < v4 )
-    this->uFrameX = v4;
+  if ( (signed int)this->uFrameY < y )
+    this->uFrameY = y;
+  if ( (signed int)this->uFrameX < x )
+    this->uFrameX = x;
   this->uFrameZ = this->uFrameWidth + this->uFrameX - 1;
   this->uFrameW = this->uFrameHeight + this->uFrameY - 1;
   memcpy(&current_window, this, sizeof(current_window));
@@ -567,19 +569,32 @@
 }
 
 //----- (00411B59) --------------------------------------------------------
-void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer)
+void LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer)
 {
   //unsigned int v2; // esi@1
   //unsigned int v3; // edi@1
   FILE *v4; // ebx@1
   FILE *v5; // eax@2
-  char pContainerName[64]; // [sp+Ch] [bp-44h]@1
+  //char pContainerName[64]; // [sp+Ch] [bp-44h]@1
   //unsigned int v7; // [sp+4Ch] [bp-4h]@1
 
-  //v2 = uSlot;
-  //v7 = uPlayer;
-  //v3 = uSlot + 1;
-  sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1);
+  if (pSavegameThumbnails[uSlot])
+  {
+      pSavegameThumbnails[uSlot]->Release();
+      pSavegameThumbnails[uSlot] = nullptr;
+  }
+
+
+  wchar_t filename[1024];
+  swprintf(filename, L"data\\lloyd%d%d.pcx", uPlayer, uSlot + 1);
+  pSavegameThumbnails[uSlot] = assets->GetImage_PCXFromFile(filename);
+
+  if (!pSavegameThumbnails[uSlot])
+  {
+      swprintf(filename, L"lloyd%d%d.pcx", uPlayer, uSlot + 1);
+      pSavegameThumbnails[uSlot] = assets->GetImage_PCXFromNewLOD(filename);
+  }
+  /*sprintf(pContainerName, "data\\lloyd%d%d.pcx", uPlayer, uSlot + 1);
   v4 = fopen(pContainerName, "rb");
   if ( v4 )
   {
@@ -594,7 +609,7 @@
       pSavegameThumbnails[uSlot].LoadFromFILE(v5, 0, 0);
     else
       *((int *)&pSavegameThumbnails.data()->pPixels + 10 * uSlot) = 0;
-  }
+  }*/
 }
 
 
@@ -624,7 +639,7 @@
   pWhiteColor = Color16(0xFFu, 0xFFu, 0xFFu);
   pColor2 = Color16(0x15u, 0x99u, 0xE9u);
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
-  pRenderer->DrawTextureIndexedAlpha(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_right_panel_loop]);
+  pRenderer->DrawTextureIndexedAlpha(0x1D4u, 0, right_panel_loop);
   if ( pDialogueNPCCount != uNumDialogueNPCPortraits || !uHouse_ExitPic )
   {
     pDialogWindow.uFrameWidth = 130;
@@ -891,7 +906,7 @@
     Stra = strtok(0, "\n");
   }
 }
-// 5C6DB4: using guessed type int ui_current_text_color;
+
 
 //----- (0044CE08) --------------------------------------------------------
 void GUIWindow::DrawText(GUIFont *font, signed int uX, int uY, unsigned short uFontColor, const char *Str, bool present_time_transparency, int max_text_height, signed int uFontShadowColor )
@@ -1197,6 +1212,19 @@
   return pButton;
 }
 
+
+void GUIWindow::InitializeGUI()
+{
+    SetUserInterface(PartyAlignment_Neutral, false);
+
+    for (uint i = 0; i < 20; ++i)
+        pWindowList[i] = nullptr;
+    uNumVisibleWindows = -1;
+    memset(pVisibleWindowsIdxs.data(), 0, sizeof(pVisibleWindowsIdxs));
+
+    MainMenuUI_LoadFontsAndSomeStuff();
+}
+
 //----- (00459C2B) --------------------------------------------------------
 void GUIWindow::DrawFlashingInputCursor( signed int uX, int uY, struct GUIFont *a2 )
 {
@@ -1537,7 +1565,7 @@
     pWindow = pWindowList[pVisibleWindowsIdxs[i] - 1];
 
     pWindow->Update();
-    switch (pWindow->eWindowType)
+    /*switch (pWindow->eWindowType)
     {
       case WINDOW_50:
       {
@@ -1614,7 +1642,7 @@
       default:
           __debugbreak();
         continue;
-    }
+    }*/
   }
   if ( GetCurrentMenuID() == -1 )
     GameUI_DrawFoodAndGold();
@@ -1622,34 +1650,6 @@
     UI_OnMouseRightClick(0);
 }
 
-//----- (00415485) --------------------------------------------------------
-void DrawMM7CopyrightWindow()
-{
-  GUIWindow Dst; // [sp+8h] [bp-54h]@1
-
-  memset(&Dst, 0, sizeof(Dst));
-  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);
-}
-
 
 //----- (00467FB6) --------------------------------------------------------
 void CreateScrollWindow()
@@ -1713,21 +1713,27 @@
   extern void set_default_ui_skin();
   set_default_ui_skin();
 
+
+  if (!parchment)
+      parchment = assets->GetImage_16BitColorKey(L"parchment", 0x7FF);
+
   if (align == PartyAlignment_Evil)
   {
     if ( bReplace )
     {
-      pTexture_RightFrame->Reload("ib-r-C.pcx");
-      pTexture_BottomFrame->Reload("ib-b-C.pcx");
-      pTexture_TopFrame->Reload("ib-t-C.pcx");
-      pTexture_LeftFrame->Reload("ib-l-C.pcx");
-      pTexture_StatusBar->Reload("IB-Foot-c.pcx");
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-C", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2);
+        game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-C.pcx");
+        game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-C.pcx");
+        game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-C.pcx");
+        game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-C.pcx");
+        game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-c.pcx");
+
+      right_panel = assets->GetTexture("ib-mb-C");
+      minimap_loop = assets->GetTexture("ib-autmask-c");
+      _5079B4_compass = assets->GetTexture("IB-COMP-C");
+      _5079D0_init_g = assets->GetTexture("IB-InitG-c");
+      _5079C8_init_y = assets->GetTexture("IB-InitY-c");
+      _5079CC_init_r = assets->GetTexture("IB-InitR-c");
+
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2);
@@ -1751,30 +1757,31 @@
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2);
+      messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll-c");
+      messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr-c");
+      messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul-c");
+      messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur-c"); 
+      messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm-c");
+      messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf-c");
+      messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt-c");
+      messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top-c");
       pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2);
     }
     else
     {
-      pTexture_RightFrame->Load("ib-r-C.pcx", 0);
-      pTexture_BottomFrame->Load("ib-b-c.pcx", 0);
-      pTexture_TopFrame->Load("ib-t-C.pcx", 0);
-      pTexture_LeftFrame->Load("ib-l-C.pcx", 0);
-      pTexture_StatusBar->Load("IB-Foot-c.pcx", 0);
-      uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE);
-      uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE);
-      uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE);
-      dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE);
-      dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE);
-      dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE);
+        game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-C.pcx");
+        game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-c.pcx");
+        game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-C.pcx");
+        game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-C.pcx");
+      game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-c.pcx");
+
+      right_panel = assets->GetTexture("ib-mb-C");
+      minimap_loop = assets->GetTexture("ib-autmask-c");
+      _5079B4_compass = assets->GetTexture("IB-COMP-C");
+      _5079D0_init_g = assets->GetTexture("IB-InitG-c");
+      _5079C8_init_y = assets->GetTexture("IB-InitY-c");
+      _5079CC_init_r = assets->GetTexture("IB-InitR-c");
+
       uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE);
       uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE);
       uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE);
@@ -1803,17 +1810,19 @@
   {
     if ( bReplace )
     {
-      pTexture_RightFrame->Reload("ib-r-a.pcx");
-      pTexture_BottomFrame->Reload("ib-b-a.pcx");
-      pTexture_TopFrame->Reload("ib-t-a.pcx");
-      pTexture_LeftFrame->Reload("ib-l-a.pcx");
-      pTexture_StatusBar->Reload("IB-Foot-a.pcx");
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-a", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-a", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2);
+        game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-a.pcx");
+        game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-a.pcx");
+        game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-a.pcx");
+        game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-a.pcx");
+      game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-a.pcx");
+
+      right_panel = assets->GetTexture("ib-mb-a");
+      minimap_loop = assets->GetTexture("ib-autmask-a");
+      _5079B4_compass = assets->GetTexture("IB-COMP-a");
+      _5079D0_init_g = assets->GetTexture("IB-InitG-a");
+      _5079C8_init_y = assets->GetTexture("IB-InitY-a");
+      _5079CC_init_r = assets->GetTexture("IB-InitR-a");
+
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2);
@@ -1834,30 +1843,31 @@
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2);
+      messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll");
+      messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr");
+      messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul");
+      messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur");
+      messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm");
+      messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf");
+      messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt");
+      messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top");
       pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2);
     }
     else
     {
-      pTexture_RightFrame->Load("ib-r-A.pcx", 0);
-      pTexture_BottomFrame->Load("ib-b-A.pcx", 0);
-      pTexture_TopFrame->Load("ib-t-A.pcx", 0);
-      pTexture_LeftFrame->Load("ib-l-A.pcx", 0);
-      pTexture_StatusBar->Load("IB-Foot-a.pcx", 0);
-      uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE);
-      uTextureID_Minimap_Loop = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE);
-      uTextureID_Compas = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE);
-      dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE);
-      dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE);
-      dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE);
+        game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-A.pcx");
+        game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-A.pcx");
+        game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-A.pcx");
+        game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-A.pcx");
+      game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-a.pcx");
+
+      right_panel = assets->GetTexture("ib-mb-A");
+      minimap_loop = assets->GetTexture("ib-autmask-a");
+      _5079B4_compass = assets->GetTexture("IB-COMP-A");
+      _5079D0_init_g = assets->GetTexture("IB-InitG-a");
+      _5079C8_init_y = assets->GetTexture("IB-InitY-a");
+      _5079CC_init_r = assets->GetTexture("IB-InitR-a");
+
       uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE);
       uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE);
       uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE);
@@ -1878,15 +1888,14 @@
       pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID);
       pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA");
       pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID);
-      uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE);
-      uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE);
-      uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE);
-      uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE);
-      uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE);
-      uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE);
-      uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE);
-      uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE);
-      uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE);
+      messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll");
+      messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr");
+      messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul");
+      messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur");
+      messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm");
+      messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf");
+      messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt");
+      messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top");
       pTexture_591428 = pIcons_LOD->LoadTexturePtr("endcap", TEXTURE_16BIT_PALETTE);
     }
     uGameUIFontMain = Color16(0xAu, 0, 0);
@@ -1896,17 +1905,19 @@
   {
     if ( bReplace )
     {
-      pTexture_RightFrame->Reload("ib-r-B.pcx");
-      pTexture_BottomFrame->Reload("ib-b-B.pcx");
-      pTexture_TopFrame->Reload("ib-t-B.pcx");
-      pTexture_LeftFrame->Reload("ib-l-B.pcx");
-      pTexture_StatusBar->Reload("IB-Foot-b.pcx");
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Minimap_Loop], "ib-autmask-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Compas], "IB-COMP-B", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2);
+        game_ui_rightframe = assets->GetImage_PCXFromIconsLOD(L"ib-r-B.pcx");
+        game_ui_bottomframe = assets->GetImage_PCXFromIconsLOD(L"ib-b-B.pcx");
+        game_ui_topframe = assets->GetImage_PCXFromIconsLOD(L"ib-t-B.pcx");
+        game_ui_leftframe = assets->GetImage_PCXFromIconsLOD(L"ib-l-B.pcx");
+      game_ui_statusbar = assets->GetImage_PCXFromIconsLOD(L"IB-Foot-b.pcx");
+
+      right_panel = assets->GetTexture("ib-mb-B");
+      minimap_loop = assets->GetTexture("ib-autmask-b");
+      _5079B4_compass = assets->GetTexture("IB-COMP-B");
+      _5079D0_init_g = assets->GetTexture("IB-InitG-b");
+      _5079C8_init_y = assets->GetTexture("IB-InitY-b");
+      _5079CC_init_r = assets->GetTexture("IB-InitR-b");
+
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-B", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2);
@@ -1927,15 +1938,14 @@
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2);
       pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2);
-      pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2);
+      messagebox_corner_y = assets->GetImage_16BitAlpha(L"cornr_ll-b");
+      messagebox_corner_w = assets->GetImage_16BitAlpha(L"cornr_lr-b");
+      messagebox_corner_x = assets->GetImage_16BitAlpha(L"cornr_ul-b");
+      messagebox_corner_z = assets->GetImage_16BitAlpha(L"cornr_ur-b");
+      messagebox_border_bottom = assets->GetImage_16BitAlpha(L"edge_btm-b");
+      messagebox_border_left = assets->GetImage_16BitAlpha(L"edge_lf-b");
+      messagebox_border_right = assets->GetImage_16BitAlpha(L"edge_rt-b");
+      messagebox_border_top = assets->GetImage_16BitAlpha(L"edge_top-b");
       pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2);
     }
     uGameUIFontMain = Color16(0, 0, 0xC8u);
@@ -2072,10 +2082,10 @@
 	//  int v6; // ecx@6
 	//  int v9; // [sp+18h] [bp-4h]@1
 
-	if (pIcons_LOD->dword_011BA4 && a2->uDecompressedSize)
+	if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed && a2->uDecompressedSize)
 		v4 = a2->UnzipPalette();
 	else
-		v4 = a2->pLevelOfDetail0_prolly_alpha_mask;
+		v4 = a2->paletted_pixels;
 	//v5 = pZBuffer;
 	for (uint i = 0; i < a2->uTextureHeight; i++)
 	{
@@ -2086,7 +2096,7 @@
 		}
 		pZBuffer += window->GetWidth() - a2->uTextureWidth;
 	}
-	if (pIcons_LOD->dword_011BA4)
+	if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed)
 	{
 		if (a2->uDecompressedSize)
 			free(v4);
@@ -2114,10 +2124,10 @@
 	//  int v11; // [sp+18h] [bp-8h]@1
 	//void *v12; // [sp+1Ch] [bp-4h]@5
 
-	if (pIcons_LOD->dword_011BA4 && pTex->uDecompressedSize)
+	if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed && pTex->uDecompressedSize)
 		v3 = pTex->UnzipPalette();
 	else
-		v3 = pTex->pLevelOfDetail0_prolly_alpha_mask;
+		v3 = pTex->paletted_pixels;
 	//v12 = v3;
 	//v4 = v3;
 	//v5 = pZBuffer;
@@ -2134,7 +2144,7 @@
 		}
 		pZBuffer += window->GetWidth() - pTex->uTextureWidth;
 	}
-	if (pIcons_LOD->dword_011BA4)
+	if (pIcons_LOD->_011BA4_debug_paletted_pixels_uncompressed)
 	{
 		if (pTex->uDecompressedSize)
 			free(v3);
@@ -2730,7 +2740,7 @@
 //----- (004B46A5) --------------------------------------------------------
 void __fastcall DrawTextAtStatusBar(const char *Str, int a5)
 {
-	pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
+	pRenderer->DrawTextureNew(0, 352/480.0f, game_ui_statusbar);
 	pPrimaryWindow->DrawText(pFontLucida, pFontLucida->AlignText_Center(450, Str) + 11, 357, a5, Str, 0, 0, 0);
 }