diff mm7_5.cpp @ 1026:6afa77761a00

Слияние
author Ritor1
date Tue, 21 May 2013 12:43:08 +0600
parents 8b492d4722d4 3413ad40cc88
children c94d6a37d298
line wrap: on
line diff
--- a/mm7_5.cpp	Tue May 21 12:42:57 2013 +0600
+++ b/mm7_5.cpp	Tue May 21 12:43:08 2013 +0600
@@ -1,7 +1,19 @@
 #include <assert.h>
 
+#include "VideoPlayer.h"
+#include "Sprites.h"
+#include "MapInfo.h"
+#include "BSPModel.h"
+#include "OutdoorCamera.h"
+#include "LightmapBuilder.h"
+#include "DecalBuilder.h"
+#include "Mouse.h"
+#include "Keyboard.h"
+#include "GammaControl.h"
+#include "stru11.h"
+
+#include "Vis.h"
 #include "mm7.h"
-#include "MapInfo.h"
 #include "Game.h"
 #include "GUIWindow.h"
 #include "GUIFont.h"
@@ -9,13 +21,9 @@
 #include "Party.h"
 #include "AudioPlayer.h"
 #include "Outdoor.h"
-#include "IndoorCamera.h"
-#include "Overlays.h"
-#include "Monsters.h"
 #include "Arcomage.h"
 #include "LOD.h"
 #include "Actor.h"
-#include "Allocator.h"
 #include "Events.h"
 #include "Viewport.h"
 #include "FrameTableInc.h"
@@ -24,19 +32,11 @@
 #include "ObjectList.h"
 #include "Chest.h"
 #include "PaletteManager.h"
-#include "DecorationList.h"
 #include "SaveLoad.h"
-#include "stru123.h"
 #include "Time.h"
-#include "IconFrameTable.h"
-#include "Awards.h"
-#include "Autonotes.h"
-#include "stru160.h"
 #include "TurnEngine.h"
 #include "CastSpellInfo.h"
-#include "Weather.h"
 #include "stru298.h"
-#include "StorylineTextTable.h"
 #include "Events2D.h"
 #include "texts.h"
 #include "Log.h"
@@ -382,7 +382,7 @@
         case UIMSG_StartNewGame:
           if ( dword_6BE138 == 124 || uMessageParam )
           {
-            pIcons_LOD->_40F9C5();
+            pIcons_LOD->SyncLoadedFilesCount();
             pIcons_LOD->_4114F2();
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -400,7 +400,7 @@
           stru_506E40.Release();
           continue;
         case UIMSG_Game_OpenLoadGameDialog:
-          pIcons_LOD->_40F9C5();
+          pIcons_LOD->SyncLoadedFilesCount();
           pIcons_LOD->_4114F2();
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -411,7 +411,7 @@
         case UIMSG_Quit:
           if ( dword_6BE138 == 132 || uMessageParam )
           {
-            pIcons_LOD->_40F9C5();
+            pIcons_LOD->SyncLoadedFilesCount();
             pIcons_LOD->_4114F2();
             if ( pMessageQueue_50CBD0->uNumMessages )
               pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -432,7 +432,7 @@
           continue;
         case UIMSG_80:
 			__debugbreak();
-          pIcons_LOD->_40F9C5();
+          pIcons_LOD->SyncLoadedFilesCount();
           pIcons_LOD->_4114F2();
           pGUIWindow_CurrentMenu->Release();
           pCurrentScreen = SCREEN_OPTIONS;
@@ -1146,7 +1146,7 @@
                       continue;
                     case SCREEN_OPTIONS://Close
                       options_menu_skin.Relaease();
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier);
                       WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier);
                       WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
@@ -1176,9 +1176,9 @@
                       stru_506E40.Release();
                       break;
                     case SCREEN_MENU:
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
                       stru_506E40.Release();
                       break;
@@ -1216,7 +1216,7 @@
                           }
                           while ( thisb < (signed int)&dword_507C08 );
                           memset(&uTextureID_Optkb, 0, 0x14u);
-                          pIcons_LOD->_40F9C5();
+                          pIcons_LOD->SyncLoadedFilesCount();
                           uAction = 0;
                           do
                           {
@@ -1262,7 +1262,7 @@
                       pTexture_RestUI_CurrentHourglassFrame->Release();
                       pTexture_RestUI_CurrentHourglassFrame = 0;
                       pTexture_RestUI_CurrentSkyFrame = 0;
-                      pIcons_LOD->_40F9C5();
+                      pIcons_LOD->SyncLoadedFilesCount();
                       pIcons_LOD->_4114F2();
                       _506F18_num_hours_to_sleep = 0;
                       dword_506F14 = 0;
@@ -2765,7 +2765,8 @@
                     dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1;
                     ++dword_50C9E8;
                   }*/
-                  pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
+                  pMessageQueue_50C9E8->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
+                //  pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1);
                 }
                 else
                 {
@@ -2781,7 +2782,7 @@
             _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 0, 0, 0);
         continue;
 
-        case UIMSG_92:
+        case UIMSG_SpellScrollUse:
 			__debugbreak();
           if ( pTurnEngine->field_4 != 3 )
             _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0);
@@ -3223,9 +3224,13 @@
       }
     }
   }
-  pMessageQueue_50CBD0->uNumMessages = dword_50C9E8;
-  memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8);
-  dword_50C9E8 = 0;
+  pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50C9E8->uNumMessages;//dword_50C9E8;
+  memcpy(pMessageQueue_50CBD0->pMessages, pMessageQueue_50C9E8->pMessages, sizeof(GUIMessage) * pMessageQueue_50C9E8->uNumMessages);
+  //memcpy(pMessageQueue_50CBD0->pMessages, dword_50C9EC, 12 * dword_50C9E8);
+  //dword_50C9E8 = 0;
+
+
+   pMessageQueue_50C9E8->uNumMessages=0;
   if ( dword_50C9DC )
   {
     /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
@@ -3357,11 +3362,11 @@
           break;
         case UIMSG_PlayerCreation_FacePrev:
           pPlayer = &pParty->pPlayers[pParam];
-          if (!pPlayer->uFace)
-            pPlayer->uFace = 19;
+          if (!pPlayer->uCurrentFace)
+            pPlayer->uCurrentFace = 19;
           else
-            pPlayer->uFace -= 1;
-          pPlayer->uVoiceID = pPlayer->uFace;
+            pPlayer->uCurrentFace -= 1;
+          pPlayer->uVoiceID = pPlayer->uCurrentFace;
           pPlayer->SetInitialStats();
           pPlayer->SetSexByVoice();
           pPlayer->RandomizeName();
@@ -3375,8 +3380,8 @@
           break;
         case UIMSG_PlayerCreation_FaceNext:
           pPlayer = &pParty->pPlayers[pParam];
-          v20 = (char)((int)pPlayer->uFace + 1) % 20;
-          pPlayer->uFace = v20;
+          v20 = (char)((int)pPlayer->uCurrentFace + 1) % 20;
+          pPlayer->uCurrentFace = v20;
           pPlayer->uVoiceID = v20;
           pPlayer->SetInitialStats();
           pPlayer->SetSexByVoice();
@@ -6002,10 +6007,10 @@
     papredoll_dlhs[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     wsprintfA(pContainer, "pc23v%dlhu", v9);
     papredoll_dlhus[v1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    v6 = pPlayers[v1 + 1]->uFace;
+    v6 = pPlayers[v1 + 1]->uCurrentFace;
     if ( v6 == 12 || v6 == 13 )
-      papredoll_dbrds[pPlayers[v8]->uFace] = 0;
-    papredoll_flying_feet[pPlayers[v8]->uFace] = 0;
+      papredoll_dbrds[pPlayers[v8]->uCurrentFace] = 0;
+    papredoll_flying_feet[pPlayers[v8]->uCurrentFace] = 0;
     IsPlayerWearingWatersuit[v8] = 1;
   }
 }
@@ -6027,22 +6032,22 @@
   {
     v2 = &pPlayers[uPlayerID];
     v3 = uPlayerID - 1;
-    papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uFace], TEXTURE_16BIT_PALETTE);
-    v4 = (int)&(*v2)->uFace;
+    papredoll_dbods[v3] = pIcons_LOD->LoadTexture(dbod_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlads[v3] = pIcons_LOD->LoadTexture(dlad_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlaus[v3] = pIcons_LOD->LoadTexture(dlau_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_drhs[v3] = pIcons_LOD->LoadTexture(drh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlhs[v3] = pIcons_LOD->LoadTexture(dlh_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    papredoll_dlhus[v3] = pIcons_LOD->LoadTexture(dlhu_texnames_by_face[(*v2)->uCurrentFace], TEXTURE_16BIT_PALETTE);
+    v4 = (int)&(*v2)->uCurrentFace;
     v5 = *(char *)v4;
     if ( *(char *)v4 == 12 || v5 == 13 )
     {
       wsprintfA(pContainer, "pc%02dbrd", v5 + 1);
-      v4 = (int)&(*v2)->uFace;
+      v4 = (int)&(*v2)->uCurrentFace;
       papredoll_dbrds[*(char *)v4] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     }
     wsprintfA(pContainer, "item281pc%02d", *(char *)v4 + 1);
-    papredoll_flying_feet[(*v2)->uFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
+    papredoll_flying_feet[(*v2)->uCurrentFace] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     result = v7;
     IsPlayerWearingWatersuit[v7] = 0;
   }
@@ -9112,14 +9117,14 @@
 
 
 //----- (0040D75D) --------------------------------------------------------
-char __fastcall pPrimaryWindow_draws_text(int a1, const char *pText, int *pXY)
-{
+void pPrimaryWindow_draws_text( int a1, const char *pText, int *pXY )
+    {
   const char *v3; // ST0C_4@1
   __int64 v4; // qax@1
 
   v3 = pText;
   v4 = LOBYTE(pFontComic->uFontHeight) - 3;
-  return pPrimaryWindow->DrawText(
+  pPrimaryWindow->DrawText(
            pFontComic,
            *pXY,
            pXY[1] - (((signed int)v4 - HIDWORD(v4)) >> 1) + 3,
@@ -9903,21 +9908,6 @@
 // 4E1D3A: using guessed type __int16 word_4E1D3A[];
 
 
-//----- (00413D3C) --------------------------------------------------------
-char *__cdecl GetDayPart()
-{
-  if ( pParty->uCurrentHour > 4 )
-  {
-    if ( pParty->uCurrentHour == 5 )
-      return pGlobalTXT_LocalizationStrings[55];
-    if ( pParty->uCurrentHour == 20 )
-      return pGlobalTXT_LocalizationStrings[566];
-    if ( pParty->uCurrentHour <= 0x14 || pParty->uCurrentHour > 0x17 )
-      return pGlobalTXT_LocalizationStrings[56];
-  }
-  return pGlobalTXT_LocalizationStrings[567];
-}
-
 //----- (00413FF1) --------------------------------------------------------
 void SetMonthNames()
 {
@@ -10060,14 +10050,16 @@
   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, 0, pGlobalTXT_LocalizationStrings[157], 3u);
+  Dst.DrawTitleText(pFontSmallnum, 0, 0xCu, ui_mainmenu_copyright_color, pGlobalTXT_LocalizationStrings[157], 3);
 }
 
 
@@ -10151,7 +10143,7 @@
       }
       case WINDOW_SpellBook:
       {
-        DrawSpellBookContent();
+        DrawSpellBookContent(pPlayers[uActiveCharacter]);
         continue;
       }
       case WINDOW_GreetingNPC:
@@ -10815,9 +10807,10 @@
           {
             if ( v51 != 5 )
             {
-              v19 = v0->AddItem(0xFFFFFFFFu, 0xDCu);
+              v19 = v0->AddItem(-1, 0xDCu);
               if ( v19 )
-                *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
+               // *(int *)&v0->field_1F5[36 * v19 + 15] = 1;
+                 v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED;
               v20 = v47 + 50 * v15;
               v0->pInventoryItems[pOut.z].uItemID = v51;
               v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType
@@ -10839,9 +10832,10 @@
                 *(int *)(a2.y + 532) = pParty->pPickedItem.uItemID;
               else
                 *(int *)(a2.y + 536) = pParty->pPickedItem.uEnchantmentType;
-              v21 = v0->AddItem(0xFFFFFFFFu, 0xDCu);
+              v21 = v0->AddItem(-1, 0xDCu);
               if ( v21 )
-                *(int *)&v0->field_1F5[36 * v21 + 15] = 1;
+                //*(int *)&v0->field_1F5[36 * v21 + 15] = 1;
+                v0->pOwnItems[v21-1].uAttributes=ITEM_IDENTIFIED;
               goto LABEL_74;
             }
             goto LABEL_115;
@@ -10851,7 +10845,7 @@
           v23 = 0;
         }
       }
-      v0->_4160CA(v23);
+      v0->ItemsEnchant(v23);
       pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0);
 
       pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
@@ -11314,8 +11308,8 @@
 }
 
 //----- (004179BC) --------------------------------------------------------
-char __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2)
-{
+void __fastcall sub_4179BC_draw_tooltip( const char *a1, const char *a2 )
+    {
   const char *v2; // ebx@1
   const char *v3; // edi@1
   unsigned int v4; // eax@1
@@ -11342,7 +11336,7 @@
   v4 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
   sprintf(pTmpBuf, format_4E2D80, v4, v3);
   Dst.DrawTitleText(pFontCreate, 0, 0, 0, pTmpBuf, 3u);
-  return Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
+  Dst.DrawText(pFontSmallnum, 1, LOBYTE(pFontLucida->uFontHeight), 0, v2, 0, 0, 0);
 }
 
 //----- (00417AD4) --------------------------------------------------------