diff UiGame.cpp @ 995:5876a9cafa3e

Various UIs, autonotes title fixed
author Nomad
date Tue, 14 May 2013 14:03:07 +0200
parents 3431f6abc786
children eac5af72b614 c45d51b3f4f4
line wrap: on
line diff
--- a/UiGame.cpp	Tue May 14 12:35:06 2013 +0200
+++ b/UiGame.cpp	Tue May 14 14:03:07 2013 +0200
@@ -48,6 +48,8 @@
 
 
 
+int uTextureID_GameUI_CharSelectionFrame; // 50C98C
+
 
 //----- (0041A57E) --------------------------------------------------------
 void GameUI_QuickRef_Draw()
@@ -116,14 +118,14 @@
             v44 = 94 * v43 + 89;
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name
-            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_color_text_header, player->pName, 84, 0);
+            pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_character_header_text_color, player->pName, 84, 0);
             if ( v43 == 0 )
                 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Óðîâ.
             sprintf(pTmpBuf, "%lu", player->GetActualLevel());
             if ( player->GetActualLevel() <= player->GetBaseLevel())
                 v5 = player->GetExperienceDisplayColor();
             else
-              v5 = ui_color_text_bonus;
+              v5 = ui_character_bonus_text_color;
             pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, 0);
             v6 = v45 + 47;
             if ( v43 == 0 )
@@ -187,7 +189,7 @@
                 if ( !v43 )
                     pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Î÷êè
                 sprintf(pTmpBuf, "%lu", player->uSkillPoints);
-                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_color_text_bonus : ui_color_text_default, pTmpBuf, 84, 0);
+                pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf, 84, 0);
                 v32 = v45 + v31;
                 v48 = player->GetMajorConditionIdx();
                 if ( !v43 )
@@ -211,12 +213,12 @@
             if ( v38 >= 0 )
                 {
                 if ( v38 <= 5 )
-                  v39 = ui_color_text_default;
+                  v39 = ui_character_default_text_color;
                 else
-                  v39 = ui_color_text_bonus_neg;
+                  v39 = ui_character_bonus_text_color_neg;
                 }
             else
-              v39 = ui_color_text_bonus;
+              v39 = ui_character_bonus_text_color;
 
             sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation
             pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
@@ -1097,30 +1099,18 @@
 
 
 //----- (0044158F) --------------------------------------------------------
-void __cdecl GameUI_DrawCharacterSelectionFrame()
+void GameUI_DrawCharacterSelectionFrame()
 {
   if ( uActiveCharacter )
-    pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9,
-        380, &pIcons_LOD->pTextures[dword_50C98C]);
+    pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380,
+                                      pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame));
 }
 
-//----- (004415C5) --------------------------------------------------------
-void LoadPartyBuffIcons()
-    {
-    for (uint i = 0; i < 14; ++i)
-        {
-        char filename[200];
-        sprintf(filename, "isn-%02d", i + 1);
-        pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE);
-        }
 
-    uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21");
-    uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27");
-    }
 
 //----- (0044162D) --------------------------------------------------------
-void __cdecl GameUI_DrawPartySpells()
-    {
+void GameUI_DrawPartySpells()
+{
     unsigned int v0; // ebp@1
     //signed int v1; // edi@1
     //int v2; // eax@2
@@ -1142,7 +1132,6 @@
             {
             auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]);
             //v3 = pTextureIDs_PartyBuffIcons[i];
-            if (tex)
                 pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0],
                 pPartySpellbuffsUI_XYs[i][1], tex, tex,
                 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63);
@@ -1156,20 +1145,20 @@
         if (pParty->FlyActive())
             {
             if ( pParty->bFlying )
-                v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID];
+                v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID);
             else
-                v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID];
+                v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID);
             if ( pRenderer->pRenderD3D )
-                pRenderer->DrawTextureIndexed(8u, 8u, v7);
+                pRenderer->DrawTextureIndexed(8, 8, v7);
             else
-                pRenderer->DrawTextureTransparent(8u, 8u, v7);
+                pRenderer->DrawTextureTransparent(8, 8, v7);
             }
         if (pParty->WaterWalkActive())
             {
             if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER)
-                v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID];
+                v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID);
             else
-                v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID];
+                v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID);
             if ( pRenderer->pRenderD3D )
                 pRenderer->DrawTextureIndexed(396u, 8u, v9);
             else
@@ -1193,65 +1182,6 @@
     }
 
 
-//----- (00421626) --------------------------------------------------------
-GUIWindow *GameUI_InitializeCharacterWindow(unsigned int _this)
-{
-  unsigned int v1; // edi@1
-  GUIWindow *pWindow; // edi@3
-
-  ++pIcons_LOD->uTexturePacksCount;
-  v1 = _this;
-  if ( !pIcons_LOD->uNumPrevLoadedFiles )
-    pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-  pEventTimer->Pause();
-  pAudioPlayer->StopChannels(-1, -1);
-  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,
-                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth,
-                                pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight,
-                                1, 0, UIMSG_ClickStatsBtn, 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,
-                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth,
-                                 pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight,
-                                 1, 0, UIMSG_ClickSkillsBtn, 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,
-                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth,
-                                    pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight,
-                                    1, 0, UIMSG_ClickInventoryBtn, 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,
-                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth,
-                                 pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight,
-                                 1, 0, UIMSG_ClickAwardsBtn, 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,
-                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth,
-                 pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight,
-                 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
-                 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, 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;
-}
-
 
 //----- (004921C1) --------------------------------------------------------
 void GameUI_DrawPortraits(unsigned int _this)
@@ -1457,16 +1387,16 @@
   //signed int v57; // [sp-4h] [bp-58h]@54
   //unsigned __int16 v58; // [sp-4h] [bp-58h]@77
   unsigned __int16 v59; // [sp-4h] [bp-58h]@100
-  unsigned __int16 v60; // [sp+10h] [bp-44h]@66
-  unsigned int v61; // [sp+10h] [bp-44h]@85
-  unsigned int v63; // [sp+14h] [bp-40h]@85
-  unsigned int v65; // [sp+18h] [bp-3Ch]@85
+  //unsigned __int16 v60; // [sp+10h] [bp-44h]@66
+  //unsigned int v61; // [sp+10h] [bp-44h]@85
+  //unsigned int v63; // [sp+14h] [bp-40h]@85
+  //unsigned int v65; // [sp+18h] [bp-3Ch]@85
   unsigned int lPitch; // [sp+20h] [bp-34h]@1
   unsigned int lPitcha; // [sp+20h] [bp-34h]@23
   char *lPitchb; // [sp+20h] [bp-34h]@106
   unsigned int v69; // [sp+24h] [bp-30h]@23
   signed int v70; // [sp+24h] [bp-30h]@37
-  unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1
+  //unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1
   signed int uBluea; // [sp+28h] [bp-2Ch]@37
   int v73; // [sp+2Ch] [bp-28h]@30
   int v76; // [sp+34h] [bp-20h]@91
@@ -1483,15 +1413,15 @@
   float uWb; // [sp+60h] [bp+Ch]@30
   unsigned int uWd; // [sp+60h] [bp+Ch]@95
   float uZooma; // [sp+64h] [bp+10h]@117
-  unsigned int flagsb; // [sp+68h] [bp+14h]@66
+  //unsigned int flagsb; // [sp+68h] [bp+14h]@66
   Actor *flagsc; // [sp+68h] [bp+14h]@86
-  unsigned int flagsd; // [sp+68h] [bp+14h]@105
+  //unsigned int flagsd; // [sp+68h] [bp+14h]@105
 
   uCenterX = (uX + uZ) / 2;
   uCenterY = (uY + uW) / 2;
   lPitch = pRenderer->uTargetSurfacePitch;
-  TargetColor(0, 0, 0);
-  uBlue = TargetColor(0, 0, 0xFFu);
+  //TargetColor(0, 0, 0);
+  //uBlue = TargetColor(0, 0, 0xFFu);
   auto bWizardEyeActive = pParty->WizardEyeActive();
   auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel();
   if (CheckHiredNPCSpeciality(Cartographer))
@@ -1660,7 +1590,7 @@
     - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
                                                      * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16)
                   - uZoom * pParty->vPosition.y) >> 16),
-      uBlue);
+      ui_game_minimap_outline_color);
   }
   }
 
@@ -1672,8 +1602,8 @@
   uint arrow_idx = floorf(0.5f + 7 * angle);
   pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));
 
-  flagsb = TargetColor(0, 0, 255);
-  v60 = TargetColor(255, 0, 0);
+  //flagsb = TargetColor(0, 0, 255);
+  //v60 = TargetColor(255, 0, 0);
   if (bWizardEyeActive)
   {
     //uZe = 0;
@@ -1700,24 +1630,23 @@
       assert(uZoom >= 512);
       if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE)
       {
-        pRenderer->RasterLine2D(v37, v38,
-                                v37, v38, v60);
+        pRenderer->RasterLine2D(v37, v38, v37, v38, ui_game_minimap_projectile_color);
       }
       else if (uZoom > 512)
       {
-        pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb);
-        pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, flagsb);
-        pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb);
-        pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb);
+        pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, ui_game_minimap_treasure_color);
+        pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, ui_game_minimap_treasure_color);
+        pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, ui_game_minimap_treasure_color);
+        pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, ui_game_minimap_treasure_color);
         pRenderer->RasterLine2D(v37 + 2, v38,
-                                v37 + 2, v38 + 1, flagsb);
+                                v37 + 2, v38 + 1, ui_game_minimap_treasure_color);
       }
       else
       {
         pRenderer->RasterLine2D(v37 - 1, v38 - 1,
-                                v37 - 1, v38, flagsb);
+                                v37 - 1, v38, ui_game_minimap_treasure_color);
         pRenderer->RasterLine2D(v37, v38 - 1,
-                                v37, v38, flagsb);
+                                v37, v38, ui_game_minimap_treasure_color);
       }
 //LABEL_82:
 //LABEL_83:
@@ -1732,9 +1661,9 @@
 
 
 LABEL_85:
-    v63 = TargetColor(255, 0, 0);
-    v61 = TargetColor(0, 255, 0);
-    v65 = TargetColor(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 )
     {
@@ -1754,11 +1683,11 @@
           {
             if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w )
             {
-              uWd = v61;
+              uWd = ui_game_minimap_actor_friendly_color;
 			  if ( BYTE3(flagsc->uAttributes) & 1 )
-                uWd = v63;
-              if ( flagsc->uAIState == 5 )
-                uWd = v65;
+                uWd = ui_game_minimap_actor_hostile_color;
+              if ( flagsc->uAIState == Dead)
+                uWd = ui_game_minimap_actor_corpse_color;
               if ( (signed int)uZoom > 1024 )
               {
                 pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd);
@@ -1794,7 +1723,7 @@
   }
 
 
-  flagsd = TargetColor(255, 255, 255);
+  //flagsd = TargetColor(255, 255, 255);
   uZg = 0;
   if ( (signed int)uNumLevelDecorations > 0 )
   {
@@ -1816,14 +1745,14 @@
             {
               v48 = v47 + 1;
               v49 = v47 - 1;
-              pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd);
-              pRenderer->RasterLine2D(v46, v49, v46, v48, flagsd);
-              pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, flagsd);
+              pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, ui_game_minimap_decoration_color_1);
+              pRenderer->RasterLine2D(v46, v49, v46, v48, ui_game_minimap_decoration_color_1);
+              pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, ui_game_minimap_decoration_color_1);
               v45 = lPitchb;
             }
             else
             {
-              pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd);
+              pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, ui_game_minimap_decoration_color_1);
             }
           }
         }