diff UiGame.cpp @ 951:840b78f6c2d3

Слияние
author Ritor1
date Wed, 01 May 2013 23:36:54 +0600
parents c0d0656aa662
children 9a5db2cf999a
line wrap: on
line diff
--- a/UiGame.cpp	Wed May 01 23:36:40 2013 +0600
+++ b/UiGame.cpp	Wed May 01 23:36:54 2013 +0600
@@ -131,26 +131,15 @@
     }
   }
   v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2;
+
   pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52);
-  pRenderer->DrawTextureIndexed(
-    v8,
-    v3->uFrameY + 32,
-    (Texture *)(uTextureID_mhp_bd != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_bd] : 0));
+  pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd));
   pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52);
-  pRenderer->DrawTextureIndexed(
-    v8,
-    v3->uFrameY + 34,
-    (Texture *)(v9 != -1 ? (int)&pIcons_LOD->pTextures[v9] : 0));
-  pRenderer->ResetTextureClipRect();
+  pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 34, pIcons_LOD->GetTexture(v9));
 
-  pRenderer->DrawTextureIndexed(
-    v8 - 5,
-    v3->uFrameY + 32,
-    (Texture *)(uTextureID_mhp_capl != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capl] : 0));
-  pRenderer->DrawTextureIndexed(
-    v8 + v4,
-    v3->uFrameY + 32,
-    (Texture *)(uTextureID_mhp_capr != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capr] : 0));
+  pRenderer->ResetTextureClipRect();
+  pRenderer->DrawTextureIndexed(v8 - 5, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl));
+  pRenderer->DrawTextureIndexed(v8 + v4, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr));
 }
 
 //----- (0041B0C9) --------------------------------------------------------
@@ -175,12 +164,12 @@
   signed int v16; // [sp+24h] [bp-8h]@1
   signed int v17; // [sp+28h] [bp-4h]@8
 
-  v0 = (Texture *)(uTextureID_BarGreen != -1 ? &pIcons_LOD->pTextures[uTextureID_BarGreen] : 0);
-  v14 = (Texture *)(uTextureID_BarYellow != -1 ? &pIcons_LOD->pTextures[uTextureID_BarYellow] : 0);
-  v13 = (Texture *)(uTextureID_BarRed != -1 ? &pIcons_LOD->pTextures[uTextureID_BarRed] : 0);
+  v0 = pIcons_LOD->GetTexture(uTextureID_BarGreen);
+  v14 = pIcons_LOD->GetTexture(uTextureID_BarYellow);
+  v13 = pIcons_LOD->GetTexture(uTextureID_BarRed);
   v16 = 0;
-  v10 = (Texture *)(uTextureID_BarBlue != -1 ? &pIcons_LOD->pTextures[uTextureID_BarBlue] : 0);
-  v15 = (double)(uTextureID_BarGreen != -1 ? pIcons_LOD->pTextures[uTextureID_BarGreen].uTextureHeight : 26);
+  v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue);
+  v15 = v0->uTextureHeight;
   do
   {
     v1 = &pParty->pPlayers[v16];
@@ -263,8 +252,7 @@
 //----- (0041B3B6) --------------------------------------------------------
 void __cdecl draw_right_panel()
 {
-  pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0,
-    (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0));
+  pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, pIcons_LOD->GetTexture(uTextureID_right_panel));
 }
 
 //----- (0041B3E2) --------------------------------------------------------
@@ -1238,45 +1226,46 @@
   bRingsShownInCharScreen = 0;
   CharacterUI_LoadPaperdollTextures();
   pCurrentScreen = v1;
+
   pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0);
   pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308,
-                                (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24),
-                                (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26),
-                                1, 0, UIMSG_73, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats
-                                (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0),
-                                papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0);
+                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth,
+                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight,
+                                1, 0, UIMSG_73, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats
+                                pIcons_LOD->GetTexture(papredoll_dbrds[10]),
+                                pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0);
   pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308,
-                                 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24),
-                                 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26),
-                                 1, 0, UIMSG_72, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills
-                                 (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0),
-                                 papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0);
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth,
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight,
+                                 1, 0, UIMSG_72, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[8]),
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0);
   pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308,
-                                    (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24),
-                                    (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26),
-                                    1, 0, UIMSG_74, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory
-                                    (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0),
-                                    papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0);
+                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth,
+                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight,
+                                    1, 0, UIMSG_74, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory
+                                    pIcons_LOD->GetTexture(papredoll_dbrds[6]),
+                                    pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0);
   pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308,
-                                 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24),
-                                 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26),
-                                 1, 0, UIMSG_75, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards
-                                 (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0),
-                                 papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0);
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth,
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight,
+                                 1, 0, UIMSG_75, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[4]),
+                                 pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0);
   pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308,
-                 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24),
-                 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26),
+                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth,
+                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight,
                  1, 0, UIMSG_A8, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
-                 (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0),
-                 papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0);
+                 pIcons_LOD->GetTexture(papredoll_dbrds[2]),
+                 pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0);
   pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0);
   pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0);
   pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0);
-  pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0);
-  pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0);
-  pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0);
-  pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0);
-  pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0);
+  pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
+  pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
+  pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
+  pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
+  pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0);
   FillAwardsData();
   return pWindow;
 }
@@ -1415,8 +1404,7 @@
                             if ( pParty->uFlags & 0x20 )
                                 v16 = dword_5079C8;
                             }
-                        pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pElem->uPackedID)] - 4,
-                            0x181u, (Texture *)(v16 != -1 ? &pIcons_LOD->pTextures[v16] : 0));
+                        pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pElem->uPackedID)] - 4, 0x181u, pIcons_LOD->GetTexture(v16));
                         }
                     }
                 }
@@ -1439,8 +1427,7 @@
                     if ( pParty->uFlags & 0x20 )
                         v19 = dword_5079C8;
                     }
-                pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4,
-                    0x181u, (Texture *)(v19 != -1 ? &pIcons_LOD->pTextures[v19] : 0));
+                pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 0x181u, pIcons_LOD->GetTexture(v19));
                 }
             }
         }
@@ -1521,8 +1508,8 @@
   uCenterX = (uX + uZ) / 2;
   uCenterY = (uY + uW) / 2;
   lPitch = pRenderer->uTargetSurfacePitch;
-  GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0);
-  uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu);
+  TargetColor(0, 0, 0);
+  uBlue = TargetColor(0, 0, 0xFFu);
   auto bWizardEyeActive = pParty->WizardEyeActive();
   auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel();
   if (CheckHiredNPCSpeciality(Cartographer))
@@ -1703,8 +1690,8 @@
   uint arrow_idx = floorf(0.5f + 7 * angle);
   pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));
 
-  flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 255);
-  v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0);
+  flagsb = TargetColor(0, 0, 255);
+  v60 = TargetColor(255, 0, 0);
   if (bWizardEyeActive)
   {
     //uZe = 0;
@@ -1763,9 +1750,9 @@
 
 
 LABEL_85:
-    v63 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0);
-    v61 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 255, 0);
-    v65 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0);
+    v63 = TargetColor(255, 0, 0);
+    v61 = TargetColor(0, 255, 0);
+    v65 = TargetColor(255, 255, 0);
     uZf = 0;
     if ( (signed int)uNumActors > 0 )
     {
@@ -1825,7 +1812,7 @@
   }
 
 
-  flagsd = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255);
+  flagsd = TargetColor(255, 255, 255);
   uZg = 0;
   if ( (signed int)uNumLevelDecorations > 0 )
   {
@@ -1865,11 +1852,11 @@
     }
     while ( uZg < (signed int)uNumLevelDecorations );
   }
-  pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0));
+  pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(dword_5079D8));
   uZooma = (double)pParty->sRotationY * 0.1171875;
   //v50 = uZooma + 6.7553994e15;
   pRenderer->SetTextureClipRect(541, 0, 567, 480);
-  pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0));
+  pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, pIcons_LOD->GetTexture(dword_5079B4));
   pRenderer->ResetTextureClipRect();
 }
 
@@ -1959,14 +1946,14 @@
       {
         sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID);
         v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-        pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], (Texture *)(v15 != -1 ? &pIcons_LOD->pTextures[v15] : 0));
+        pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], pIcons_LOD->GetTexture(v15));
       }
       else
       {
         sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID);
         v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
         v9 = v23;
-        pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0));
+        pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], pIcons_LOD->GetTexture(v8));
         v10 = (unsigned __int8)pTmpBuf[i];
         if ( pParty->pHirelings[v10].evt_A == 1 )
         {