changeset 1219:85bdbaa539f4

Merge
author Gloval
date Sun, 09 Jun 2013 21:42:01 +0400
parents eb687c8529ee (current diff) b237a61e61d3 (diff)
children 7f4d7597fa2d ae812777b1d4
files Arcomage.cpp mm7_data.cpp mm7_data.h
diffstat 15 files changed, 40 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/Arcomage.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/Arcomage.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -108,7 +108,6 @@
 
 ArcomagePlayer am_Players[2];
 Acromage_st1 shown_cards[10]; //amuint_4FAA78; // weak
-
 stru272 array_4FABD0[10];
 
 
--- a/Game.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/Game.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -550,7 +550,7 @@
     dword_6BE340 = 0;
     pEventTimer->Pause();
     ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
-    if ( uGameState == GAME_STATE_3 )
+    if ( uGameState == GAME_STATE_LOADING_GAME )
     {
       sub_491E3A();
       LoadPlayerPortraintsAndVoices();
--- a/Game.h	Sun Jun 09 21:40:17 2013 +0400
+++ b/Game.h	Sun Jun 09 21:42:01 2013 +0400
@@ -16,7 +16,7 @@
   GAME_STATE_PLAYING = 0,
   GAME_FINISHED = 1,
   GAME_STATE_2 = 2,
-  GAME_STATE_3 = 3,
+  GAME_STATE_LOADING_GAME = 3,
   GAME_STATE_NEWGAME_OUT_GAMEMENU = 4,
   GAME_STATE_5 = 5,
   GAME_STATE_STARTING_NEW_GAME = 6,
--- a/Math.h	Sun Jun 09 21:40:17 2013 +0400
+++ b/Math.h	Sun Jun 09 21:42:01 2013 +0400
@@ -16,12 +16,12 @@
   int pTanTable[520];
   int pCosTable[520];
   int pInvCosTable[520];
-  unsigned int uIntegerPi;
-  unsigned int uIntegerHalfPi;
-  unsigned int uIntegerDoublePi;
-  unsigned int uDoublePiMask;
-  unsigned int uPiMask;
-  unsigned int uHalfPiMask;
+  static const unsigned int uIntegerPi = 1024;
+  static const unsigned int uIntegerHalfPi = 512;
+  static const unsigned int uIntegerDoublePi = 2048;
+  static const unsigned int uDoublePiMask = 2047;
+  static const unsigned int uPiMask = 1023;
+  static const unsigned int uHalfPiMask = 511;
 };
 #pragma pack(pop)
 
--- a/Monsters.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/Monsters.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -1124,7 +1124,7 @@
                                     pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf.data()) + 1;
                                     if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
                                         {
-                                        sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf);
+                                        sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf.data());
                                         MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
                                         }
                                     }
--- a/Player.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/Player.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -564,7 +564,7 @@
   //v4 = a2;//102
   v5 = 0;
   pSoundId = 0;
-  v6 = SoundSetAction[speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ???
+  v6 = SoundSetAction[speech].data();//byte_4ED280 &byte_4ED3D8[4 * v4] ???
   if (uVoicesVolumeMultiplier)
   {
     v7 = 0;
--- a/UIHouses.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/UIHouses.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -1828,8 +1828,8 @@
         v46 = &v50;
         v45 = (unsigned int)&v49;
         v44 = &v48;
-        v43 = pTmpBuf2;*/
-        sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2, v48[0], v48[1], v48[2], v48[3], v48[4]);
+        v43 = pTmpBuf2.data();*/
+        sprintf(pTmpBuf.data(), "%s\n \n%s%s%s%s%s", pTmpBuf2.data(), v48[0], v48[1], v48[2], v48[3], v48[4]);
         v53.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf.data(), 3u);
       }
       else
@@ -2062,7 +2062,7 @@
 		v7 = v5->pName;
 		v8 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
 		sprintf(pTmpBuf.data(), "\f%05d%s\f%05d", v8, v7, v6);
-		sprintf(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
+		sprintf(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * v5->uLevel);
 		current_npc_text = pTmpBuf2.data();
 		memcpy(&a1, pDialogueWindow, sizeof(a1));
 		w.uFrameWidth = 458;
--- a/UIPopup.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/UIPopup.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -1694,7 +1694,7 @@
       sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[538], v16, v15 + 1);
       strcat(pTmpBuf.data(), "\n");
       strcat(pTmpBuf.data(), pTmpBuf2.data());
-      sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf);
+      sprintf(pTmpBuf2.data(), "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf.data());
       if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2.data() )
         sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2.data());
       break;
--- a/UISaveLoad.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/UISaveLoad.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -179,7 +179,7 @@
     auto day = aDayNames[HIDWORD(pOurHour) % 7];
     auto ampm = aAMPMNames[HIDWORD(pAMPM2)];
     auto month = aMonthNames[pMonthNum];
-    //sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
+    //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
     sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear);
     pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u);
     v1 = 255;
--- a/VideoPlayer.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/VideoPlayer.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -485,7 +485,7 @@
   hMightVid = CreateFileW(L"anims\\might7.vid", GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
   if ( hMightVid == INVALID_HANDLE_VALUE )
   {
-    sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf);
+    sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf.data());
     MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
     return;
   }
@@ -495,15 +495,15 @@
   {
     if ( !bCanLoadFromCD )
       {
-       sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf);
+       sprintf(pTmpBuf2.data(), "Can't open file - anims\\%s.smk", pTmpBuf.data());
        MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
        return;
 	  }
-    sprintf(pTmpBuf2.data(), "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf);
+    sprintf(pTmpBuf2.data(), "%c:\\%s", (unsigned __int8)cMM7GameCDDriveLetter, pTmpBuf.data());
     hMagicVid = CreateFileA(pTmpBuf2.data(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0x8000080u, 0);
     if ( hMagicVid == (HANDLE)INVALID_HANDLE_VALUE )
     {
-	  sprintf(pTmpBuf2.data(), "Can't open file - %s", pTmpBuf);
+	  sprintf(pTmpBuf2.data(), "Can't open file - %s", pTmpBuf.data());
       MessageBoxA(0, pTmpBuf2.data(), "Video File Error", 0);
       return;
     }
--- a/mm7_2.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/mm7_2.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -3769,50 +3769,23 @@
 //----- (00452969) --------------------------------------------------------
 stru193_math::stru193_math()
 {
-  stru193_math *v1; // esi@1
-  char *v2; // edi@1
   double v3; // ST18_8@2
-  signed int v4; // edx@3
-  int v5; // eax@4
-  int v6; // ecx@4
-  signed int v7; // [sp+20h] [bp-4h]@1
-
-  v1 = this;
-  this->uIntegerDoublePi = 2048;
-  this->uIntegerPi = 1024;
-  this->uIntegerHalfPi = 512;
-  this->uDoublePiMask = 2047;
-  this->uPiMask = 1023;
-  this->uHalfPiMask = 511;
+
   this->pTanTable[0] = 0;
   this->pCosTable[0] = 65536;
   this->pInvCosTable[0] = 65536;
-  v7 = 1;
-  v2 = (char *)&this->pInvCosTable[1];
-  do
-  {
-    v3 = (double)v7 * 3.141592653589793 * 0.0009765625;
-    *((int *)v2 - 1040) = (signed __int64)(tan(v3) * (double)v1->pCosTable[0] + 0.5);
-    *((int *)v2 - 520) = (signed __int64)(cos(v3) * (double)v1->pCosTable[0] + 0.5);
-    ++v7;
-    *(int *)v2 = (signed __int64)(1.0 / cos(v3) * (double)v1->pCosTable[0] + 0.5);
-    v2 += 4;
-  }
-  while ( v7 < (signed int)v1->uIntegerHalfPi );
-  v4 = v1->uIntegerHalfPi;
-  if ( v4 < 520 )
-  {
-    v5 = (int)&v1->pCosTable[v4];
-    v6 = 520 - v4;
-    do
-    {
-      *(int *)v5 = 0;
-      *(int *)(v5 + 2080) = 0xEFFFFFFFu;
-      *(int *)(v5 - 2080) = 0xEFFFFFFFu;
-      v5 += 4;
-      --v6;
-    }
-    while ( v6 );
+  for(int i = 1; i < (signed int)this->uIntegerHalfPi; i++)
+  {
+    v3 = (double)i * 3.141592653589793 / (double)uIntegerPi;
+    pTanTable[i] = (signed __int64)(tan(v3) * (double)this->pCosTable[0] + 0.5);
+    pCosTable[i] = (signed __int64)(cos(v3) * (double)this->pCosTable[0] + 0.5);
+    pInvCosTable[i] = (signed __int64)(1.0 / cos(v3) * (double)this->pCosTable[0] + 0.5);
+  }
+  for(int i = this->uIntegerHalfPi; i < 520; i++)
+  {
+    this->pTanTable[i] = 0xEFFFFFFFu;
+    this->pCosTable[i] = 0;
+    this->pInvCosTable[i] = 0xEFFFFFFFu;
   }
 }
 
@@ -8218,7 +8191,7 @@
 //LABEL_48:
         pGame->Loop();
 LABEL_49:
-        if ( uGameState == GAME_STATE_3 )
+        if ( uGameState == GAME_STATE_LOADING_GAME )
         {
           SetCurrentMenuID(MENU_5);
           uGameState = GAME_STATE_PLAYING;
--- a/mm7_4.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/mm7_4.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -7293,7 +7293,7 @@
           v31 = *(int *)v29;
           v32 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
           sprintfex(pTmpBuf.data(), "\f%05d%s\f%05d", v32, v31, v30);
-          sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf, 100 * (unsigned __int8)v29[8]);
+          sprintfex(pTmpBuf2.data(), dword_F8B1A4, pTmpBuf.data(), 100 * (unsigned __int8)v29[8]);
           current_npc_text = pTmpBuf2.data();
           v15 = "";
           goto LABEL_45;
@@ -7336,7 +7336,7 @@
             if ( uDialogueType != 84 )
               goto LABEL_49;
             sprintf(pTmpBuf.data(), format_4E2D80, v55, pItemsTable->pItems[contract_approved].pUnidentifiedName);
-            sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf);
+            sprintf(pTmpBuf2.data(), current_npc_text, pTmpBuf.data());
             current_npc_text = pTmpBuf2.data();
             goto LABEL_45;
           }
--- a/mm7_5.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/mm7_5.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -486,7 +486,7 @@
           if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
           {
             LoadGame(uLoadGameUI_SelectedSlot);
-            uGameState = GAME_STATE_3;
+            uGameState = GAME_STATE_LOADING_GAME;
           }
           stru_506E40.Release();
           continue;
--- a/mm7_data.cpp	Sun Jun 09 21:40:17 2013 +0400
+++ b/mm7_data.cpp	Sun Jun 09 21:42:01 2013 +0400
@@ -643,8 +643,8 @@
   {1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1},//47
   {1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1},//48
 }};
-unsigned char SoundSetAction[110][8] = // 4ED3D8
-{
+std::array<std::array<unsigned char, 8>, 110> SoundSetAction = // 4ED3D8
+{{
   { 0,  0,  0,  0,  0,  0,  0,  0},
   {38,  0,  0, 37, 38, 45,  0,  0},
   {37,  0,  0, 47, 53,  0,  0,  0},
@@ -755,7 +755,7 @@
   {39,  0,  0, 48,  0,  0,  0,  0},
   {14,  0,  0, 48,  0,  0,  0,  0},
   {17,  0,  0,  0,  0,  0,  0,  0}
-};
+}};
 std::array<__int16, 4> pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing = {34, 149, 264, 379};
 std::array< std::array<char, 37>, 36> byte_4ED970_skill_learn_ability_by_class_table = 
 {{
--- a/mm7_data.h	Sun Jun 09 21:40:17 2013 +0400
+++ b/mm7_data.h	Sun Jun 09 21:42:01 2013 +0400
@@ -482,7 +482,7 @@
 extern std::array<const char*, 25> pPlayerPortraitsNames;
 
 extern std::array< std::array<unsigned char, 25>, 48> byte_4ECF08;
-extern unsigned char SoundSetAction[110][8]; // weak
+extern std::array<std::array<unsigned char, 8>, 110> SoundSetAction; // weak
 extern std::array<__int16, 4> pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing;
 extern std::array< std::array<char, 37>, 36> byte_4ED970_skill_learn_ability_by_class_table;
 extern std::array<int, 777> dword_4EDEA0; // weak