changeset 2151:92511cd8fcdb

Cleaned some variables.
author Nomad
date Wed, 08 Jan 2014 22:29:11 +0200
parents 701dc2f4956b
children d44b7775fc06
files Game.cpp Indoor.cpp LOD.cpp NPC.cpp ObjectList.h Party.h Player.cpp Render.cpp UI/UiGame.cpp VideoPlayer.cpp Viewport.cpp Viewport.h _deleted.cpp mm7_2.cpp mm7_7.cpp mm7_data.cpp mm7_data.h
diffstat 17 files changed, 107 insertions(+), 239 deletions(-) [+]
line wrap: on
line diff
--- a/Game.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/Game.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -1960,8 +1960,9 @@
             pParty->sRotationY = uMessageParam * pParty->sRotationY / uMessageParam;
           uTurnSpeed = uMessageParam;
           continue;
+
         case UIMSG_SetGraphicsMode:
-          if ( !bUseLoResSprites )
+          /*if ( !bUseLoResSprites )
           {
             byte_6BE388_graphicsmode = uMessageParam;
             MM7Initialization();
@@ -1981,9 +1982,11 @@
             }
             MM7Initialization();
             continue;
-          }
+          }*/
           ModalWindow(pNPCTopics[453].pText, UIMSG_0);
+          __debugbreak(); // Nomad: graphicsmode as it was now removed
           continue;
+
         case UIMSG_GameMenu_ReturnToGame:
           pGUIWindow_CurrentMenu->Release();
           pEventTimer->Resume();
@@ -2234,7 +2237,7 @@
                       WriteWindowsRegistryInt("CharVoices", (char)uVoicesVolumeMultiplier);
                       WriteWindowsRegistryInt("WalkSound", bWalkSound);
                       WriteWindowsRegistryInt("ShowDamage", bShowDamage);
-                      WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
+                      //WriteWindowsRegistryInt("graphicsmode", (unsigned __int8)byte_6BE388_graphicsmode);
                       WriteWindowsRegistryInt("valAlwaysRun", bAlwaysRun);
                       WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit);
                       if ( !uTurnSpeed )
--- a/Indoor.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/Indoor.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -237,7 +237,7 @@
     //this->fSineY = sin((3.141592653589793 + 3.141592653589793) * (double)pGame->pIndoorCameraD3D->sRotationY * 0.00048828125);
     //this->fCosineNegX = cos((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125);
     //this->fSineNegX = sin((3.141592653589793 + 3.141592653589793) * (double)-pGame->pIndoorCameraD3D->sRotationX * 0.00048828125);
-    this->field_64 = pViewport->field_30;
+    this->field_64 = pViewport->field_of_view;
     
     this->uViewportX = pViewport->uScreen_TL_X;
     this->uViewportY = pViewport->uScreen_TL_Y;
@@ -3325,16 +3325,10 @@
     }
   }
 }
-// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
-// 4F75D8: using guessed type int ai_arrays_size;
-
-
-
-
 
 
 //----- (00460A78) --------------------------------------------------------
-void  PrepareToLoadBLV(unsigned int bLoading)
+void PrepareToLoadBLV(unsigned int bLoading)
 {
   unsigned int v1; // ebx@1
   unsigned int v2; // eax@8
@@ -6719,6 +6713,8 @@
   blv_prev_party_y = pParty->vPosition.z;
   if (!pParty->bTurnBasedModeOn)
   {
+    static int dword_720CDC = 0;
+
     int v67 = GetTickCount() / 500;
     if (dword_720CDC != v67 )
     {
@@ -6727,8 +6723,9 @@
       dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z;
       if ( dword_4F8580[0] > 60 )
         dword_4F8580[0] = 1;
+
+      dword_720CDC = v67;
     }
-    dword_720CDC = v67;
   }
 
   uint fall_start;
--- a/LOD.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/LOD.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -2650,7 +2650,7 @@
     zlib::MemUnzip((void *)pContainer, &v8->uDecompressedSize, v19, v8->uTextureSize);
     v8->uTextureSize = *v16;
     free(v19);
-    if ( bUseLoResSprites && v8->pBits & 2 )
+    if ( /*bUseLoResSprites*/false && v8->pBits & 2 )
     {
       pOutTex = (Texture *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2)
                           + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4)
--- a/NPC.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/NPC.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -922,7 +922,6 @@
         return false;
 
     }
-// 6BE3C5: using guessed type char bNoNPCHiring;
 
 //----- (004763E0) --------------------------------------------------------
 void  InitializeAwards()
--- a/ObjectList.h	Wed Jan 08 17:25:34 2014 +0600
+++ b/ObjectList.h	Wed Jan 08 22:29:11 2014 +0200
@@ -56,9 +56,9 @@
   __int16 uLifetime;
   unsigned int uParticleTrailColor;
   __int16 uSpeed;
-  char uParticleTrailColorR;
-  char uParticleTrailColorG;
-  char uParticleTrailColorB;
+  unsigned char uParticleTrailColorR;
+  unsigned char uParticleTrailColorG;
+  unsigned char uParticleTrailColorB;
   char field_35_clr;
   char field_36_clr;
   char field_37_clr;
--- a/Party.h	Wed Jan 08 17:25:34 2014 +0600
+++ b/Party.h	Wed Jan 08 22:29:11 2014 +0200
@@ -124,6 +124,10 @@
 #pragma pack(push, 1)
 struct ActionQueue
 {
+  inline ActionQueue():
+    uNumActions(0)
+  {}
+
   void Add(PartyAction action);
   void Reset();
   PartyAction Next();
--- a/Player.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/Player.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -4698,7 +4698,6 @@
     }
     else
     {
-      _720984_unused = pParty->pPickedItem.uItemID;
       pMouse->RemoveHoldingItem();
       pMessageQueue_50C9E8->AddMessage(UIMSG_SpellScrollUse, scroll_id, player_num - 1);
       if ( pCurrentScreen && pGUIWindow_CurrentMenu
--- a/Render.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/Render.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -3225,8 +3225,7 @@
   //}
   bWindowMode = 0;
   pParty->uFlags |= 2u;
-  flt_6BE3A0 = 0.55000001f;
-  pViewport->_4C02F8(36044);
+  pViewport->SetFOV(flt_6BE3A0 * 65536.0f);
   return v15 != 0;
 }
 
@@ -3262,9 +3261,7 @@
   int v29; // [sp+308h] [bp-4h]@2
 
   pParty->uFlags |= PARTY_FLAGS_1_0002;
-  //v2 = this;
-  flt_6BE3A0 = 0.55000001f;
-  pViewport->_4C02F8(36044);
+  pViewport->SetFOV(flt_6BE3A0 * 65536.0f);
   using_software_screen_buffer = 0;
   Release();
   pColorKeySurface4 = 0;
--- a/UI/UiGame.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/UI/UiGame.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -2220,7 +2220,6 @@
     }
   }
 }
-// 6BE3C5: using guessed type char bNoNPCHiring;
 
 //----- (004178FE) --------------------------------------------------------
 unsigned int UI_GetHealthManaAndOtherQualitiesStringColor(signed int current_pos, signed int base_pos)
--- a/VideoPlayer.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/VideoPlayer.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -110,7 +110,7 @@
     v11.dwHeight = uHeight;
     *(_QWORD *)&v11.ddpfPixelFormat.dwSize = 0x400000020ui64;// DDPF_FOURCC
     v11.ddpfPixelFormat.dwFourCC = 0x32595559u;
-    if ( dword_6BE384_2dacceloff || pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0) )
+    if (FAILED(pRenderer->pDirectDraw4->CreateSurface(&v11, &v15, 0)))
     {
       memset(&v11.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT));
 
@@ -153,8 +153,7 @@
     Dst.ddpfPixelFormat.dwSize = 32;
     Dst.ddpfPixelFormat.dwFlags = 4;
     Dst.ddpfPixelFormat.dwFourCC = 844715353;
-    if ( dword_6BE384_2dacceloff
-      || pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0) )
+    if (FAILED(pRenderer->pDirectDraw2->CreateSurface(&Dst, (LPDIRECTDRAWSURFACE *)&a2, 0)))
     {
       memset(&Dst.ddpfPixelFormat, 0, sizeof(DDPIXELFORMAT));
 
--- a/Viewport.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/Viewport.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -62,10 +62,10 @@
     }
 
 //----- (004C02F8) --------------------------------------------------------
-void Viewport::_4C02F8(int a2)
+void Viewport::SetFOV(int field_of_view)
 {
-    this->field_30 = a2;
-    SetScreen(this->uScreen_TL_X, this->uScreen_TL_Y, this->uScreen_BR_X, this->uScreen_BR_Y);
+  this->field_of_view = field_of_view;
+  SetScreen(uScreen_TL_X, uScreen_TL_Y, uScreen_BR_X, uScreen_BR_Y);
 }
 
 //----- (004C0312) --------------------------------------------------------
--- a/Viewport.h	Wed Jan 08 17:25:34 2014 +0600
+++ b/Viewport.h	Wed Jan 08 22:29:11 2014 +0200
@@ -4,8 +4,14 @@
 #pragma pack(push, 1)
 struct Viewport
 {
+  inline Viewport()
+  {
+    field_of_view = 65536 / 2;
+    SetScreen(0, 0, 639, 479);
+  }
+
   void SetScreen(signed int uX, signed int uY, signed int uZ, signed int uW);
-  void _4C02F8(int a2);
+  void SetFOV(int a2);
   void SetViewport(signed int uX, signed int uY, signed int uZ, signed int uW);
 
 
@@ -21,7 +27,7 @@
   int uScreenHeight;
   int uScreenCenterX;
   int uScreenCenterY;
-  int field_30;
+  int field_of_view;
 };
 #pragma pack(pop)
 
--- a/_deleted.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/_deleted.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -8759,9 +8759,9 @@
           array_50AC10[3]._rhw = 1.0 / (v101->vWorldViewPosition.x + 0.0000001000000011686097);
           array_50AC10[3].u = 1.0;
           array_50AC10[3].v = 0.0;
-          if ( !(byte_76D5C0 & 1) )
-          {
-            byte_76D5C0 |= 1u;
+          if ( !(_76D5C0_static_init_flag & 1) )
+          {
+            _76D5C0_static_init_flag |= 1u;
             stru154(stru_76D5A8);
             atexit(loc_481199);
           }
@@ -8901,9 +8901,9 @@
         __init_flag2 = true;
         stru154::stru154(&static_sub_0048034E_stru_76D590);
       }
-      if ( !(byte_76D5C0 & 2) )
-      {
-        byte_76D5C0 |= 2;
+      if ( !(_76D5C0_static_init_flag & 2) )
+      {
+        _76D5C0_static_init_flag |= 2;
         Polygon(stru_76D590);
         atexit(loc_48118F);
       }
@@ -8944,7 +8944,7 @@
       v55 = uNumVertices;
       //v35 = byte_4D864C == 0;
       v40->uNumVertices = uNumVertices;
-      if ( !byte_76D5C0 || !(pGame->uFlags & 0x80) )
+      if ( !_76D5C0_static_init_flag || !(pGame->uFlags & 0x80) )
       {
         if ( this_3a )
         {
--- a/mm7_2.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/mm7_2.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -3149,7 +3149,7 @@
 void FinalInitialization()
 {
   pViewport->SetScreen(viewparams->uSomeX, viewparams->uSomeY, viewparams->uSomeZ, viewparams->uSomeW);
-  pViewport->_4C02F8((signed __int64)(flt_6BE3A0 * 65536.0));
+  pViewport->SetFOV(flt_6BE3A0 * 65536.0f);
 
   //pIndoorCamera = new IndoorCamera;
   //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1,
@@ -3623,8 +3623,10 @@
     bCanLoadFromCD = false;
   if (bCanLoadFromCD)
   {
+    Log::Warning(L"Checking for CD...");
     if (!FindMM7CD(nullptr, &cMM7GameCDDriveLetter))
       return false;
+    Log::Warning(L"...done.");
   }
 
 
@@ -3662,8 +3664,7 @@
   pParty->sEyelevel = pParty->uDefaultEyelevel;
   pParty->uDefaultPartyHeight = GetPrivateProfileIntW(L"party", L"height", 192, pMM6IniFile);
   pParty->uPartyHeight = pParty->uDefaultPartyHeight;
-  
-  bUseRegistry = GetPrivateProfileIntW(L"settings", L"registry", 1, pMM6IniFile);
+
   MM6_Initialize(pMM6IniFile);
 
   pKeyActionMap = new KeyboardActionMapping;
@@ -3680,9 +3681,8 @@
   pIcons_LOD = new LODFile_IconsBitmaps;
   if (!pIcons_LOD->Load("data\\icons.lod", "icons"))
   {
-    MessageBoxW(nullptr,
-                L"Some files are missing\n\nPlease Reinstall.",
-                L"Files Missing", MB_ICONEXCLAMATION);
+    MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.",
+                         L"Files Missing", MB_ICONEXCLAMATION);
     return false;
   }
   pIcons_LOD->dword_011BA4 = 0;
@@ -3690,9 +3690,8 @@
   pEvents_LOD = new LODFile_IconsBitmaps;
   if (!pEvents_LOD->Load("data\\events.lod", "icons"))
   {
-    MessageBoxW(nullptr,
-                L"Some files are missing\n\nPlease Reinstall.",
-                L"Files Missing", MB_ICONEXCLAMATION);
+    MessageBoxW(nullptr, L"Some files are missing\n\nPlease Reinstall.",
+                         L"Files Missing", MB_ICONEXCLAMATION);
     return false;
   }
 
@@ -3701,25 +3700,13 @@
   pBitmaps_LOD = new LODFile_IconsBitmaps;
   if (!pBitmaps_LOD->Load("data\\bitmaps.lod", "bitmaps"))
   {
-    MessageBoxA(nullptr,
-                pGlobalTXT_LocalizationStrings[63],
-                pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION);
+    MessageBoxA(nullptr, pGlobalTXT_LocalizationStrings[63],
+                         pGlobalTXT_LocalizationStrings[184], MB_ICONEXCLAMATION);
     return false;
   }
 
-  if (bUseRegistry)
-    bUseLoResSprites = ReadWindowsRegistryInt("resolution", 0);
-  else
-    bUseLoResSprites = GetPrivateProfileIntW(L"settings", L"resolution", 0, pMM6IniFile);
-
-  const char *pSpritesFile = nullptr;
-  if (bUseLoResSprites)
-    pSpritesFile = "data\\spriteLO.lod";
-  else
-    pSpritesFile = "data\\sprites.lod";
-
   pSprites_LOD = new LODFile_Sprites;
-  if (!pSprites_LOD->LoadSprites(pSpritesFile))
+  if (!pSprites_LOD->LoadSprites("data\\sprites.lod"))
   {
     MessageBoxA(nullptr,
                 pGlobalTXT_LocalizationStrings[63],
@@ -3816,7 +3803,7 @@
   {
     void *sft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsft.bin", 1) : nullptr,
          *sft_mm8 = nullptr;
-    void*  sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1);
+    void *sft_mm7 = pEvents_LOD->LoadRaw("dsft.bin", 1);
     pSpriteFrameTable = new SpriteFrameTable;
     pSpriteFrameTable->FromFile(sft_mm6, sft_mm7, sft_mm8);
     free(sft_mm6);
@@ -3825,7 +3812,7 @@
     
     void *tft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtft.bin", 1) : nullptr,
          *tft_mm8 = nullptr;
-    void*  tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1);
+    void *tft_mm7 = pEvents_LOD->LoadRaw("dtft.bin", 1);
     pTextureFrameTable = new TextureFrameTable;
     pTextureFrameTable->FromFile(tft_mm6, tft_mm7, tft_mm8);
     free(tft_mm6);
@@ -3834,7 +3821,7 @@
 
     void *tiles_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dtile.bin", 1) : nullptr,
          *tiles_mm8 = nullptr;
-    void*  tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1);
+    void *tiles_mm7 = pEvents_LOD->LoadRaw("dtile.bin", 1);
     pTileTable = new TileTable;
     pTileTable->FromFile(tiles_mm6, tiles_mm7, tiles_mm8);
     free(tiles_mm6);
@@ -3843,7 +3830,7 @@
     
     void *pft_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dpft.bin", 1) : nullptr,
          *pft_mm8 = nullptr;
-    void*  pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1);
+    void *pft_mm7 = pEvents_LOD->LoadRaw("dpft.bin", 1);
     pPlayerFrameTable = new PlayerFrameTable;
     pPlayerFrameTable->FromFile(pft_mm6, pft_mm7, pft_mm8);
     free(pft_mm6);
@@ -3852,7 +3839,7 @@
 
     void *ift_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dift.bin", 1) : nullptr,
          *ift_mm8 = nullptr;
-    void*  ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1);
+    void *ift_mm7 = pEvents_LOD->LoadRaw("dift.bin", 1);
     pIconsFrameTable = new IconFrameTable;
     pIconsFrameTable->FromFile(ift_mm6, ift_mm7, ift_mm8);
     free(ift_mm6);
@@ -3861,7 +3848,7 @@
 
     void *decs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("ddeclist.bin", 1) : nullptr,
          *decs_mm8 = nullptr;
-    void*  decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1);
+    void *decs_mm7 = pEvents_LOD->LoadRaw("ddeclist.bin", 1);
     pDecorationList = new DecorationList;
     pDecorationList->FromFile(decs_mm6, decs_mm7, decs_mm8);
     free(decs_mm6);
@@ -3870,7 +3857,7 @@
 
     void *objs_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dobjlist.bin", 1) : nullptr,
          *objs_mm8 = nullptr;
-    void*  objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1);
+    void *objs_mm7 = pEvents_LOD->LoadRaw("dobjlist.bin", 1);
     pObjectList = new ObjectList;
     pObjectList->FromFile(objs_mm6, objs_mm7, objs_mm8);
     free(objs_mm6);
@@ -3879,7 +3866,7 @@
 
     void *mons_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dmonlist.bin", 1) : nullptr,
          *mons_mm8 = nullptr;
-    void*  mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1);
+    void *mons_mm7 = pEvents_LOD->LoadRaw("dmonlist.bin", 1);
     pMonsterList = new MonsterList;
     pMonsterList->FromFile(mons_mm6, mons_mm7, mons_mm8);
     free(mons_mm6);
@@ -3888,7 +3875,7 @@
     
     void *chests_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dchest.bin", 1) : nullptr,
          *chests_mm8 = nullptr;
-    void*  chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1);
+    void *chests_mm7 = pEvents_LOD->LoadRaw("dchest.bin", 1);
     pChestList = new ChestList;
     pChestList->FromFile(chests_mm6, chests_mm7, chests_mm8);
     free(chests_mm6);
@@ -3897,7 +3884,7 @@
 
     void *overlays_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("doverlay.bin", 1) : nullptr,
          *overlays_mm8 = nullptr;
-    void*  overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1);
+    void *overlays_mm7 = pEvents_LOD->LoadRaw("doverlay.bin", 1);
     pOverlayList = new OverlayList;
     pOverlayList->FromFile(overlays_mm6, overlays_mm7, overlays_mm8);
     free(overlays_mm6);
@@ -3906,7 +3893,7 @@
 
     void *sounds_mm6 = pIcons_LOD_mm6 ? pIcons_LOD_mm6->LoadRaw("dsounds.bin", 1) : nullptr,
          *sounds_mm8 = nullptr;
-    void*  sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1);
+    void *sounds_mm7 = pEvents_LOD->LoadRaw("dsounds.bin", 1);
     pSoundList = new SoundList;
     pSoundList->FromFile(sounds_mm6, sounds_mm7, sounds_mm8);
     free(sounds_mm6);
@@ -3928,24 +3915,13 @@
     window->SetFullscreenMode();
     pRenderer->InitializeFullscreen();
   }
-  sub_4C023F();
-  uSoundVolumeMultiplier = ReadWindowsRegistryInt("soundflag", 9);
-  if (uSoundVolumeMultiplier > 9)
-    uSoundVolumeMultiplier = 9;
-  uMusicVolimeMultiplier = ReadWindowsRegistryInt("musicflag", 9);
-  if (uMusicVolimeMultiplier > 9)
-    uMusicVolimeMultiplier = 9;
-  uVoicesVolumeMultiplier = ReadWindowsRegistryInt("CharVoices", 9);
-  if (uVoicesVolumeMultiplier > 9)
-    uVoicesVolumeMultiplier = 9;
+
+  uSoundVolumeMultiplier = min(9, ReadWindowsRegistryInt("soundflag", 9));
+  uMusicVolimeMultiplier = min(9, ReadWindowsRegistryInt("musicflag", 9));
+  uVoicesVolumeMultiplier = min(9, ReadWindowsRegistryInt("CharVoices", 9));
   bShowDamage = ReadWindowsRegistryInt("ShowDamage", 1) != 0;
-  byte_6BE388_graphicsmode = ReadWindowsRegistryInt("graphicsmode", 1);
-  if (byte_6BE388_graphicsmode < 0 || byte_6BE388_graphicsmode > 2)
-    byte_6BE388_graphicsmode = 0;
-
-  uGammaPos = ReadWindowsRegistryInt("GammaPos", 4);
-  if (uGammaPos > 9)
-    uGammaPos = 4;
+
+  uGammaPos = min(4, ReadWindowsRegistryInt("GammaPos", 4));
   pGame->pGammaController->Initialize(uGammaPos * 0.1 + 0.6);
 
   if ( ReadWindowsRegistryInt("Bloodsplats", 1) )
@@ -3954,7 +3930,6 @@
     pGame->uFlags2 &= ~GAME_FLAGS_2_DRAW_BLOODSPLATS;
 
   uTurnSpeed = ReadWindowsRegistryInt("TurnDelta", 0);
-  dword_6BE384_2dacceloff = ReadWindowsRegistryInt("2dacceloff", 0);
 
   if (!bNoSound)
     pAudioPlayer->Initialize();
@@ -3992,12 +3967,12 @@
 //----- (00465D0B) --------------------------------------------------------
 void SecondaryInitialization()
 {
-  __int16 v4; // ax@4
-  signed int v5; // esi@5
-  int v6; // ecx@6
-  int v7; // edx@7
-  ObjectDesc *v8; // eax@7
-  char pContainer[32]; // [sp+10h] [bp-Ch]@9
+  //__int16 v4; // ax@4
+  //signed int v5; // esi@5
+  //int v6; // ecx@6
+  //int v7; // edx@7
+  //ObjectDesc *v8; // eax@7
+  //char pContainer[32]; // [sp+10h] [bp-Ch]@9
 
   pMouse->Initialize(window);
 
@@ -4020,22 +3995,22 @@
   if (!bNoSound)
     pSoundList->Initialize();
 
-  static const char *pUIAnimNames[4] =
-  {
-    "glow03", "glow05",
-    "torchA", "wizeyeA"
-  };
-  static unsigned short _4E98D0[4][4] =
-  {
-    {479, 0, 329, 0},
-    {585, 0, 332, 0},
-    {468, 0,   0, 0},
-    {606, 0,   0, 0}
-  };
-
 
   for (uint i = 0; i < 4; ++i)
   {
+    static const char *pUIAnimNames[4] =
+    {
+      "glow03", "glow05",
+      "torchA", "wizeyeA"
+    };
+    static unsigned short _4E98D0[4][4] =
+    {
+      {479, 0, 329, 0},
+      {585, 0, 332, 0},
+      {468, 0,   0, 0},
+      {606, 0,   0, 0}
+    };
+
     pUIAnims[i]->uIconID = pIconsFrameTable->FindIcon(pUIAnimNames[i]);
     pIconsFrameTable->InitializeAnimation(pUIAnims[i]->uIconID);
 
@@ -4045,21 +4020,21 @@
     pUIAnims[i]->y = _4E98D0[i][2];
   }
 
-  for ( v5 = 0; v5 < (signed int)pObjectList->uNumObjects; ++v5 )
+  for (unsigned int i = 0; i < pObjectList->uNumObjects; ++i)
   {
-    BYTE3(v7) = 0;
-    *(short *)((char *)&v7 + 1) = pObjectList->pObjects[v5].uParticleTrailColorR;
-    LOBYTE(v7) = pObjectList->pObjects[v5].uParticleTrailColorG;
-    pObjectList->pObjects[v5].uParticleTrailColor = pObjectList->pObjects[v5].uParticleTrailColorB | (v7 << 8);
+    pObjectList->pObjects[i].uParticleTrailColor = pObjectList->pObjects[i].uParticleTrailColorB |
+                                                   ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorG << 8) |
+                                                   ((unsigned int)pObjectList->pObjects[i].uParticleTrailColorR << 16);
   }
-  flt_6BE3A0 = 0.55000001f;
+
   MainMenuUI_Create();
   pGame->pStru6Instance->LoadAnimations();
 
   for (uint i = 0; i < 7; ++i)
   {
-    sprintf(pContainer, "HDWTR%03u", i);
-    pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(pContainer);
+    char container_name[64];
+    sprintf(container_name, "HDWTR%03u", i);
+    pRenderer->pHDWaterBitmapIDs[i] = pBitmaps_LOD->LoadTexture(container_name);
   }
 
   pNPCStats = new NPCStats;
@@ -4436,7 +4411,7 @@
 void MM6_Initialize(const wchar_t *pIniFilename)
 {
   //int v0; // eax@1
-  UINT v1; // eax@18
+  //UINT v1; // eax@18
   size_t v2; // eax@31
   size_t v3; // ebx@32
   size_t v4; // edi@36
@@ -4465,11 +4440,7 @@
 
   if (GetPrivateProfileIntW(L"debug", L"nomonster", 0, pIniFilename))
     dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_NO_ACTORS;
-  if (bUseRegistry)
-    v1 = ReadWindowsRegistryInt("startinwindow", 0);
-  else
-    v1 = GetPrivateProfileIntW(L"debug", L"startinwindow", 0, pIniFilename);
-  if (v1)
+  if (ReadWindowsRegistryInt("startinwindow", 0))
     dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_RUN_IN_WIDOW;
   if (GetPrivateProfileIntW(L"debug", L"showFR", 0, pIniFilename))
     dword_6BE368_debug_settings_2 |= DEBUG_SETTINGS_0002_SHOW_FR;
@@ -4581,11 +4552,11 @@
 }
 
 //----- (004666D5) --------------------------------------------------------
-void  MM7Initialization()
+void MM7Initialization()
 {
   if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
   {
-    if ( !byte_6BE388_graphicsmode )
+    /*if (byte_6BE388_graphicsmode == 0)
     {
       outdoor_grid_band_1 = 10;
       outdoor_grid_band_2 = 15;
@@ -4593,7 +4564,7 @@
       pODMRenderParams->shading_dist_mist = 8192;
       pODMRenderParams->bNoSky = false;
       LOBYTE(viewparams->field_20) = 0;
-    }
+    }*/
     mipmapping_terrain_mm1 = 1024;
     mipmapping_terrain_mm2 = 2048;
     mipmapping_building_mm1 = 1024;
--- a/mm7_7.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/mm7_7.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -77,22 +77,10 @@
 }
 */
 
-void __cdecl crt_init_globals_46BD9F()
-{
-  pPartyActionQueue->uNumActions = 0;
-}
-
-void __cdecl sub_4C023F()
-{
-  pViewport->field_30 = 32768;
-  pViewport->SetScreen(0, 0, 639u, 479u);
-}
-
 void constructors()
 {
 	sub_401022();
 	sub_423B4A();
-	crt_init_globals_46BD9F();
 
 	//no call to these anywhere
 	uGameUIFontMain_initialize();
--- a/mm7_data.cpp	Wed Jan 08 17:25:34 2014 +0600
+++ b/mm7_data.cpp	Wed Jan 08 22:29:11 2014 +0200
@@ -1218,25 +1218,18 @@
 unsigned int uLevelMapStatsID;
 int dword_6BE364_game_settings_1 = 0;
 int dword_6BE368_debug_settings_2 = 0;
-unsigned __int8 bUseLoResSprites = false;
-unsigned __int8 bUseRegistry = true;
 unsigned __int8 bCanLoadFromCD = false;
 int bShowDamage; // idb
 unsigned int bAlwaysRun;
 unsigned int bFlipOnExit;
-int dword_6BE384_2dacceloff; // weak
-char byte_6BE388_graphicsmode; // weak
 unsigned int uTurnSpeed;
-float flt_6BE3A0; // weak
+float flt_6BE3A0 = 0.55000001f; // weak
 float flt_6BE3A4_debug_recmod1;
 float flt_6BE3A8_debug_recmod2;
 float flt_6BE3AC_debug_recmod1_x_1_6;
 std::array<char, 20> byte_6BE3B0; // idb
 char bUnderwater = false; // weak
 char bNoNPCHiring = false; // weak
-int _702AC0_unused = 0; // weak
-int _702AC4_unused = 0; // weak
-char _702ACC_unused = 0; // weak
 unsigned int bNoVideo = false;
 bool bNoIntro = false;
 bool bNoLogo = false;
@@ -1245,13 +1238,10 @@
 std::array<int, 100> dword_720020_zvalues;
 std::array<int, 299> dword_7201B0_zvalues;
 int uTextureID_720980; // weak
-int _720984_unused; // weak
-char _72098C_unused; // weak
 std::array<__int16, 104> word_7209A0_intercepts_ys_plus_ys;
 std::array<__int16, 104> word_720A70_intercepts_xs_plus_xs;
 std::array<__int16, 104> word_720B40_intercepts_zs;
 std::array<__int16, 102> word_720C10_intercepts_xs;
-int dword_720CDC;
 std::array<__int16, 777> word_720CE0_ys; // idb
 std::array<__int16, 777> word_720DB0_xs; // idb
 std::array<int, 20> dword_720E80;
@@ -1265,20 +1255,11 @@
 int blv_prev_party_x; // weak
 int blv_prev_party_z; // weak
 int blv_prev_party_y; // weak
-char *dword_721660; // idb
-char *dword_721664; // idb
 std::array<NPCTopic, 789> pNPCTopics;
-char *dword_722F10; // idb
 std::array<const char *, 513> pQuestTable;
-_UNKNOWN unk_723714; // weak
 char *dword_723718_autonote_related; // idb
-int dword_72371C[777]; // weak
 std::array<const char *, 82> pScrolls;
-int dword_723E80_award_related[777]; // weak
-int dword_723E84[777]; // weak
 int dword_7241C8; // weak
-struct unk_F7B60C stru_73C834; // struct @ MM7.exe::0073C834
-
 std::array<const char *, 59> aNPCProfessionNames;
 char *pAwardsTXT_Raw;
 char *pScrollsTXT_Raw;
@@ -1290,33 +1271,10 @@
 char *pTransitionsTXT_Raw;
 char *pAutonoteTXT_Raw;
 char *pQuestsTXT_Raw;
- unsigned int    uNumTerrainNormals;
- struct Vec3_float_ *pTerrainNormals;
- std::array<unsigned short, 128 * 128 * 2>  pTerrainNormalIndices;
- std::array<unsigned int, 128 * 128 * 2>    pTerrainSomeOtherData;
-struct unk_F7B60C stru_76D578; // struct @ MM7.exe::0076D578
-struct unk_F7B60C stru_76D590; // struct @ MM7.exe::0076D590
-struct unk_F7B60C stru_76D5A8; // struct @ MM7.exe::0076D5A8
-char byte_76D5C0; // weak
-std::array<int, 128> terrain_76D5C8;
-std::array<int, 128> terrain_76D7C8;
-std::array<int, 128> terrain_76D9C8;
-std::array<int, 128> terrain_76DBC8;
-std::array<int, 128> terrain_76DDC8;
-std::array<int, 128> terrain_76DFC8;
-std::array<int, 128> terrain_76E1C8;
-std::array<int, 128> terrain_76E3C8;
-
-_UNKNOWN unk_801A00; // weak
-_UNKNOWN unk_801A0C; // weak
-char byte_80AA10; // weak
-int dword_80AA14; // weak
-int dword_80AA18; // weak
-int dword_80AA1C; // weak
-int dword_80AA20; // weak
-unsigned int uNumElementsIn80AA28;
-std::array<struct Polygon *, 2000> ptr_80AA28;
-_UNKNOWN unk_80D190; // weak
+unsigned int    uNumTerrainNormals;
+struct Vec3_float_ *pTerrainNormals;
+std::array<unsigned short, 128 * 128 * 2>  pTerrainNormalIndices;
+std::array<unsigned int, 128 * 128 * 2>    pTerrainSomeOtherData;
 int dword_A74C88; // weak
 unsigned int uPlayerCreationUI_SkySliderPos;
 int uPlayerCreationUI_ArrowAnim;
--- a/mm7_data.h	Wed Jan 08 17:25:34 2014 +0600
+++ b/mm7_data.h	Wed Jan 08 22:29:11 2014 +0200
@@ -866,14 +866,10 @@
 #define DEBUG_SETTINGS_NO_DAMAGE        0x0010
 extern int dword_6BE368_debug_settings_2; // DEBUG_SETTINGS_*
 
-extern unsigned __int8 bUseLoResSprites;
-extern unsigned __int8 bUseRegistry;
 extern unsigned __int8 bCanLoadFromCD;
 extern int bShowDamage; // idb
 extern unsigned int bAlwaysRun;
 extern unsigned int bFlipOnExit;
-extern int dword_6BE384_2dacceloff; // weak
-extern char byte_6BE388_graphicsmode; // weak
 extern unsigned int uTurnSpeed;
 extern float flt_6BE3A0; // weak
 extern float flt_6BE3A4_debug_recmod1;
@@ -882,9 +878,6 @@
 extern std::array<char, 20> byte_6BE3B0; // idb
 extern char bUnderwater; // weak
 extern char bNoNPCHiring; // weak
-extern int _702AC0_unused; // weak
-extern int _702AC4_unused; // weak
-extern char _702ACC_unused; // weak
 extern unsigned int bNoVideo;
 extern bool bNoIntro;
 extern bool bNoLogo;
@@ -892,15 +885,11 @@
 extern bool bNoSound;
 extern std::array<int, 100> dword_720020_zvalues;
 extern std::array<int, 299> dword_7201B0_zvalues;
-extern int dword_7207F0[]; // idb
 extern int uTextureID_720980; // weak
-extern int _720984_unused; // weak
-extern char _72098C_unused; // weak
 extern std::array<__int16, 104> word_7209A0_intercepts_ys_plus_ys;
 extern std::array<__int16, 104> word_720A70_intercepts_xs_plus_xs;
 extern std::array<__int16, 104> word_720B40_intercepts_zs;
 extern std::array<__int16, 102> word_720C10_intercepts_xs;
-extern int dword_720CDC;
 extern std::array<__int16, 777> word_720CE0_ys; // idb
 extern std::array<__int16, 777> word_720DB0_xs; // idb
 extern std::array<int, 20> dword_720E80;
@@ -914,16 +903,10 @@
 extern int blv_prev_party_x; // weak
 extern int blv_prev_party_z; // weak
 extern int blv_prev_party_y; // weak
-extern char *dword_721660; // idb
-extern char *dword_721664; // idb
 extern char *dword_722F10; // idb
 extern std::array<const char *, 513> pQuestTable;
-extern _UNKNOWN unk_723714; // weak
 extern char *dword_723718_autonote_related; // idb
-extern int dword_72371C[]; // weak
 extern std::array<const char *, 82> pScrolls;
-extern int dword_723E80_award_related[]; // weak
-extern int dword_723E84[]; // weak
 extern int dword_7241C8; // weak
 
 extern std::array<const char *, 59> aNPCProfessionNames;
@@ -941,38 +924,6 @@
 extern struct Vec3_float_ *pTerrainNormals;
 extern std::array<unsigned short, 128 * 128 * 2>  pTerrainNormalIndices;
 extern std::array<unsigned int, 128 * 128 * 2>    pTerrainSomeOtherData;
-extern char byte_76D5C0;
-extern struct unk_F7B60C stru_76D578;
-extern struct unk_F7B60C stru_76D590;
-extern struct unk_F7B60C stru_76D5A8;
-extern std::array<int, 128> terrain_76D5C8;
-extern std::array<int, 128> terrain_76D7C8;
-extern std::array<int, 128> terrain_76D9C8;
-extern std::array<int, 128> terrain_76DBC8;
-extern std::array<int, 128> terrain_76DDC8;
-extern std::array<int, 128> terrain_76DFC8;
-extern std::array<int, 128> terrain_76E1C8;
-extern std::array<int, 128> terrain_76E3C8;
-struct unk_F7B60C
-{
- int   some_data_ptr;  // dword @ 000000
- float flt_000004;
- float flt_000008;
- float flt_00000C;
- float flt_000010;
- char  byte_000014;
- char  unk_000015[3];
-};
-extern _UNKNOWN unk_801A00; // weak
-extern _UNKNOWN unk_801A0C; // weak
-extern char byte_80AA10; // weak
-extern int dword_80AA14; // weak
-extern int dword_80AA18; // weak
-extern int dword_80AA1C; // weak
-extern int dword_80AA20; // weak
-extern unsigned int uNumElementsIn80AA28;
-extern std::array<struct Polygon *, 2000> ptr_80AA28;
-extern _UNKNOWN unk_80D190; // weak
 extern int dword_A74C88; // weak
 extern unsigned int uPlayerCreationUI_SkySliderPos;
 extern int uPlayerCreationUI_ArrowAnim;
@@ -982,7 +933,6 @@
 extern struct Texture *pTexture_PlayerFaceEradicated;
 extern struct Texture *pTexture_PlayerFaceDead;
 extern std::array< std::array<struct Texture *, 56>, 4> pTextures_PlayerFaces;
-extern int dword_A75070; // weak
 extern __int64 qword_A750D8; // weak
 extern enum PlayerSpeech PlayerSpeechID;
 extern int uSpeakingCharacter; // weak
@@ -1358,8 +1308,6 @@
   for ( int i=0; i < count; i++ )
     *p++ = value;
 }
-//inline void __fastcall j_memset32(int a2, void *a1, unsigned int a3) {memset32(a1, a2, a3);}
-void __cdecl sub_4C023F();
 #define ErrD3D(hr) do {extern void ErrHR(HRESULT, const char *, const char *, const char *, int); ErrHR(hr, "Direct3D", __FUNCTION__, __FILE__, __LINE__);} while(0)