diff mm7_2.cpp @ 951:840b78f6c2d3

Слияние
author Ritor1
date Wed, 01 May 2013 23:36:54 +0600
parents c0d0656aa662
children a92a34f9aef5
line wrap: on
line diff
--- a/mm7_2.cpp	Wed May 01 23:36:40 2013 +0600
+++ b/mm7_2.cpp	Wed May 01 23:36:54 2013 +0600
@@ -290,7 +290,7 @@
   pDialogueWindow->Release();
   pDialogueWindow = GUIWindow::Create(0, 0, 640, 350, WINDOW_MainMenu, 0, 0);
   pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
-                 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
+                 pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
   pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0);
   pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0);
   pDialogueWindow->_41D08F(1, 1, 0, 2);
@@ -433,7 +433,7 @@
     pDialogueWindow->pControlsTail = 0;
     pDialogueWindow->uNumControls = 0;
     pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],
-                   (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
+                   pIcons_LOD->GetTexture(uExitCancelTextureId), 0);
     pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x55u, 0, "", 0);
     pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0);
     pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0);
@@ -578,12 +578,8 @@
       pViewport->uViewportBR_Y - pViewport->uViewportTL_Y + 1,
       pRenderer->uTargetGMask | pRenderer->uTargetBMask);
 
-  auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr);
-  pRenderer->_4A6A68(
-    8u,
-    352 - v0,
-    pTex,
-    (pTex ? pTex->uTextureHeight : 26) - v0);
+  auto pTex = pIcons_LOD->GetTexture(uTextureID_Leather);
+  pRenderer->_4A6A68(8, 352 - v0, pTex, pTex->uTextureHeight - v0);
 
   pRenderer->DrawTextureIndexed(8u, 347 - v0, pTexture_591428);
   v1 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[575], pFontArrus, &window, 0xDu, 0);
@@ -770,7 +766,7 @@
     item_spellbook->Reset();
     pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum;
     pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified();
-    ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE)];
+    ItemsInShopTexture[i] = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE);
   }
   return;
 }
@@ -5529,7 +5525,7 @@
               v4 = 255;
               v1 = 15;
               v2 = 235;
-              return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4);
+              return TargetColor(v2, v1, v4);
             }
             goto LABEL_21;
           }
@@ -5549,7 +5545,7 @@
           v4 = v2;
 LABEL_30:
           v1 = v2;
-          return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4);
+          return TargetColor(v2, v1, v4);
         }
         goto LABEL_15;
       }
@@ -5560,7 +5556,7 @@
         v1 = 128;
 LABEL_32:
         v2 = 0;
-        return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4);
+        return TargetColor(v2, v1, v4);
       }
       goto LABEL_11;
     }
@@ -5573,7 +5569,7 @@
       v1 = 85;
 LABEL_23:
       v2 = 255;
-      return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4);
+      return TargetColor(v2, v1, v4);
     }
   }
   if ( a1 >= 23 )
@@ -5581,7 +5577,7 @@
   v4 = 255;
   v1 = 212;
   v2 = 150;
-  return GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v2, v1, v4);
+  return TargetColor(v2, v1, v4);
 }
 
 //----- (004583B0) --------------------------------------------------------
@@ -6650,17 +6646,15 @@
 
   pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
   auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, 
-                                                    UIMSG_MainMenu_ShowPartyCreationWnd, 0, 78, "", pNew, 0);
   auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnLoad = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth, pLoad->uTextureHeight, 1, 0, 
-                                                     UIMSG_MainMenu_ShowLoadWindow, 1, 76, "", pLoad, 0);
   auto pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, 
-                                                         UIMSG_ShowCredits, 2, 67, "", pCredits, 0);
   auto pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE);
-  pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, 
-                                                        UIMSG_ExitToWindows, 3, 0, "", pExit, 0);
+
+  pMainMenu_BtnNew     = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth,     pNew->uTextureHeight,     1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 'N', "", pNew, 0);
+  pMainMenu_BtnLoad    = pWindow_MainMenu->CreateButton(495, 227, pLoad->uTextureWidth,    pLoad->uTextureHeight,    1, 0, UIMSG_MainMenu_ShowLoadWindow,       1, 'L', "", pLoad, 0);
+  pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits,                   2, 'C', "", pCredits, 0);
+  pMainMenu_BtnExit    = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth,    pExit->uTextureHeight,    1, 0, UIMSG_ExitToWindows,                 3, 0, "", pExit, 0);
+
   pTexture_PCX.Release();
   pTexture_PCX.Load("title.pcx", 0);
   SetCurrentMenuID(MENU_MAIN);
@@ -6827,7 +6821,9 @@
     {
       switch (wParam)
       {
-        case 101:
+        case 103:  pRenderer->SavePCXScreenshot();  return 0;
+
+        case 101:  // Quit game
         case 40001:
         {
           v38 = 0;
@@ -6838,9 +6834,6 @@
         }
         return 0;
 
-        case 103:
-          pRenderer->SavePCXScreenshot();
-        return 0;
 
         case 104:
           pRenderer->ChangeBetweenWinFullscreenModes();
@@ -6848,95 +6841,33 @@
             pArcomageGame->field_F6 = 1;
         return 0;
 
-        case 40007:
-          pParty->SetGold(pParty->uNumGold + 10000);
-        return 0;
-
-        case 40008:
-          GivePartyExp(20000);
-        return 0;
-
-        case 40013:
-          pParty->SetGold(0);
-        return 0;
+        case 40007:  pParty->SetGold(pParty->uNumGold + 10000); return 0;
+        case 40008:  GivePartyExp(20000);  return 0;
+        case 40013:  pParty->SetGold(0);   return 0;
 
         case 40059:
           for (uint i = 0; i < 4; ++i)
             pParty->pPlayers[i].uSkillPoints = 50;
         return 0;
-
-        case 40044://condition Afraid/fear
-          pPlayers[uActiveCharacter]->pConditions[3] = 1;
-        return 0;
-
-        case 40043://condition Asleep
-          pPlayers[uActiveCharacter]->pConditions[2] = 1;
-        return 0;
-
-        case 40037://condition Curse
-          pPlayers[uActiveCharacter]->pConditions[0] = 1;
-        return 0;
-
-        case 40036://condition Disease1
-          pPlayers[uActiveCharacter]->pConditions[7] = 1;
-        return 0;
-
-        case 40035://condition Disease2
-          pPlayers[uActiveCharacter]->pConditions[9] = 1;
-        return 0;
-
-        case 40034://condition Disease3
-          pPlayers[uActiveCharacter]->pConditions[11] = 1;
-        return 0;
-
-        case 40041://condition Dead
-          pPlayers[uActiveCharacter]->pConditions[14] = 1;
-        return 0;
-
-        case 40039://condition Drunk
-          pPlayers[uActiveCharacter]->pConditions[4] = 1;
-        return 0;
-
-        case 40042://condition Eradicated
-          pPlayers[uActiveCharacter]->pConditions[16] = 1;
-        return 0;
-
-        case 40038://condition Isane
-          pPlayers[uActiveCharacter]->pConditions[5] = 1;
-        return 0;
-
-        case 40045://condition Paralized
-          pPlayers[uActiveCharacter]->pConditions[12] = 1;
-        return 0;
-
-        case 40033://condition Poison1
-          pPlayers[uActiveCharacter]->pConditions[6] = 1;
-        return 0;
-
-        case 40032://condition Poison2
-          pPlayers[uActiveCharacter]->pConditions[8] = 1;
-        return 0;
-
-        case 40031://condition Poison3
-          pPlayers[uActiveCharacter]->pConditions[10] = 1;
-        return 0;
-
-        case 40029://condition Stone
-          pPlayers[uActiveCharacter]->pConditions[15] = 1;
-        return 0;
-
-        case 40040://condition Unconscious
-          pPlayers[uActiveCharacter]->pConditions[13] = 1;
-        return 0;
-
-        case 40030://condition Weak
-          pPlayers[uActiveCharacter]->pConditions[1] = 1;
-        return 0;
-
-        case 40073://condition Zombie
-          pPlayers[uActiveCharacter]->pConditions[17] = 1;
-        return 0;
-
+        
+        case 40029:  pPlayers[uActiveCharacter]->SetPertified(true);  return 0;
+        case 40030:  pPlayers[uActiveCharacter]->SetWeak(true);       return 0;
+        case 40031:  pPlayers[uActiveCharacter]->SetPoison3(true);    return 0;
+        case 40032:  pPlayers[uActiveCharacter]->SetPoison2(true);    return 0;
+        case 40033:  pPlayers[uActiveCharacter]->SetPoison1(true);    return 0;
+        case 40034:  pPlayers[uActiveCharacter]->SetDisease3(true);   return 0;
+        case 40035:  pPlayers[uActiveCharacter]->SetDisease2(true);   return 0;
+        case 40036:  pPlayers[uActiveCharacter]->SetDisease1(true);   return 0;
+        case 40037:  pPlayers[uActiveCharacter]->SetCursed(true);     return 0;
+        case 40038:  pPlayers[uActiveCharacter]->SetInsane(true);     return 0;
+        case 40039:  pPlayers[uActiveCharacter]->SetDrunk(true);      return 0;
+        case 40040:  pPlayers[uActiveCharacter]->SetUnconcious(true); return 0;
+        case 40041:  pPlayers[uActiveCharacter]->SetDead(true);       return 0;
+        case 40042:  pPlayers[uActiveCharacter]->SetEradicated(true); return 0;
+        case 40043:  pPlayers[uActiveCharacter]->SetAsleep(true);     return 0;
+        case 40044:  pPlayers[uActiveCharacter]->SetAfraid(true);     return 0;
+        case 40045:  pPlayers[uActiveCharacter]->SetParalyzed(true);  return 0;
+        case 40073:  pPlayers[uActiveCharacter]->SetZombie(true);     return 0;
       }
     }
     return DefWindowProcA(hWnd, Msg, wParam, lParam);
@@ -9944,7 +9875,7 @@
   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 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
+  v2 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, format_4E2D80, v2, v1);
   a1.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
   return a1.DrawText(