diff mm7_2.cpp @ 26:93bf1d5f6a6d

Game loading.
author Nomad
date Tue, 16 Oct 2012 00:05:53 +0200
parents 509744251c8e
children be2066176d89
line wrap: on
line diff
--- a/mm7_2.cpp	Mon Oct 15 18:45:11 2012 +0200
+++ b/mm7_2.cpp	Tue Oct 16 00:05:53 2012 +0200
@@ -11446,760 +11446,6 @@
 
 
 
-
-//----- (0045EE8A) --------------------------------------------------------
-void __fastcall LoadGame(unsigned int uSlot)
-{
-  unsigned int v1; // ebx@1
-  char v2; // zf@1
-  signed int v3; // esi@3
-  signed int v4; // esi@8
-  char *v5; // eax@9
-  unsigned int v6; // eax@12
-  unsigned int v7; // esi@13
-  char *v8; // ecx@14
-  FILE *v9; // eax@22
-  FILE *v10; // eax@26
-  FILE *v11; // eax@29
-  FILE *v12; // eax@32
-  FILE *v13; // eax@35
-  FILE *v14; // eax@38
-  unsigned int v15; // edi@41
-  Player *v16; // esi@41
-  int *v17; // esi@46
-  int v18; // edi@46
-  int v19; // ebx@46
-  int v20; // ecx@49
-  int v21; // eax@51
-  int v22; // ecx@56
-  bool v23; // edx@56
-  AudioPlayer *v24; // ebx@60
-  bool v25; // esi@62
-  bool v26; // eax@62
-  signed int v27; // esi@66
-  RGBTexture *v28; // edi@67
-  std::string v29; // [sp-18h] [bp-108h]@25
-  int v30; // [sp-Ch] [bp-FCh]@65
-  int v31; // [sp-8h] [bp-F8h]@4
-  signed int v32; // [sp-4h] [bp-F4h]@4
-  char DstBuf; // [sp+Ch] [bp-E4h]@23
-  char pContainer; // [sp+20h] [bp-D0h]@62
-  char Str[123]; // [sp+70h] [bp-80h]@25
-  char a3[5]; // [sp+EBh] [bp-5h]@2
-
-  v1 = uSlot;
-  v2 = pSavegameUsedSlots[uSlot] == 0;
-  dword_5B65C8 = 0;
-  if ( v2 )
-  {
-    v24 = pAudioPlayer;
-    pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
-  }
-  else
-  {
-    *(int *)&a3[1] = 1;
-    do
-    {
-      v3 = 1;
-      do
-      {
-        v32 = v3;
-        v31 = *(int *)&a3[1];
-        sprintfex(pTmpBuf, "data\\lloyd%d%d.pcx", *(int *)&a3[1], v3);
-        remove(pTmpBuf);
-        ++v3;
-      }
-      while ( v3 < 6 );
-      ++*(int *)&a3[1];
-    }
-    while ( *(int *)&a3[1] < 5 );
-    *(int *)&a3[1] = (int)(char *)&pParty + 2508;
-    do
-    {
-      if ( byte_4ED498 )
-      {
-        v4 = 0;
-        if ( (signed int)pSoundList->uNumSounds <= 0 )
-        {
-LABEL_12:
-          v6 = 0;
-        }
-        else
-        {
-          v5 = (char *)&pSoundList->pSounds->uSoundID;
-          while ( *(int *)v5 != 2 * ((unsigned __int8)byte_4ED498 + 50 * *(int *)(*(int *)&a3[1] + 6432))
-                                 + 4998 )
-          {
-            ++v4;
-            v5 += 120;
-            if ( v4 >= (signed int)pSoundList->uNumSounds )
-              goto LABEL_12;
-          }
-          v6 = v4;
-        }
-        pSoundList->_4A9DCD(v6, 1);
-        v7 = 0;
-        if ( (signed int)pSoundList->uNumSounds <= 0 )
-        {
-LABEL_17:
-          v7 = 0;
-        }
-        else
-        {
-          v8 = (char *)&pSoundList->pSounds->uSoundID;
-          while ( *(int *)v8 != 2 * ((unsigned __int8)byte_4ED498 + 50 * *(int *)(*(int *)&a3[1] + 6432))
-                                 + 4999 )
-          {
-            ++v7;
-            v8 += 120;
-            if ( (signed int)v7 >= (signed int)pSoundList->uNumSounds )
-              goto LABEL_17;
-          }
-        }
-        pSoundList->_4A9DCD(v7, 1);
-      }
-      *(int *)&a3[1] += 6972;
-    }
-    while ( *(int *)&a3[1] < (signed int)pParty->pHirelings );
-    sprintfex(pTmpBuf, "saves\\%s", pSavegameList->pSavesNames[v1]);
-    pNew_LOD->CloseWriteFile();
-    if ( !CopyFileA(pTmpBuf, "data\\new.lod", 0) )
-      GetLastError();
-    pNew_LOD->LoadFile("data\\new.lod", 0);
-    v9 = pNew_LOD->FindContainer("header.bin", 1);
-    if ( v9 )
-    {
-      fread(&DstBuf, 0x64u, 1u, v9);
-    }
-    else
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 100);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:549", 0);
-    }
-    v10 = pNew_LOD->FindContainer("party.bin", 1);
-    if ( v10 )
-    {
-      fread(&pParty, 0x16238u, 1u, v10);
-    }
-    else
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 101);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:559", 0);
-    }
-    v11 = pNew_LOD->FindContainer("Timer.bin", 1);
-    if ( v11 )
-    {
-      fread(&pEventTimer, 0x28u, 1u, v11);
-    }
-    else
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 102);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:569", 0);
-    }
-    v12 = pNew_LOD->FindContainer("overlay.bin", 1);
-    if ( v12 )
-    {
-      fread(&pOtherOverlayList, 0x3F0u, 1u, v12);
-    }
-    else
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 103);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:579", 0);
-    }
-    v13 = pNew_LOD->FindContainer("npcdata.bin", 0);
-    if ( v13 )
-    {
-      fread(pNPCStats->pNewNPCData, 0x94BCu, 1u, v13);
-      pNPCStats->_476C60();
-    }
-    else
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 104);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:590", 0);
-    }
-    v14 = pNew_LOD->FindContainer("npcgroup.bin", 0);
-    if ( v14 )
-    {
-      fread(pNPCStats->pGroups_copy, 0x66u, 1u, v14);
-    }
-    else
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 105);
-      MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:600", 0);
-    }
-    v15 = 0;
-    v16 = pParty->pPlayers;
-    while ( 1 )
-    {
-      ++v15;
-      if ( v16->CanAct() )
-        break;
-      ++v16;
-      if ( (signed int)v16 >= (signed int)pParty->pHirelings )
-        goto LABEL_46;
-    }
-    uActiveCharacter = v15;
-LABEL_46:
-    v17 = (int *)&pParty->pPlayers[0].uQuickSpell;
-    v18 = 9;
-    v19 = 0;
-    do
-    {
-      if ( *(char *)v17 )
-        stru_AA1058[v19]._494836(*(char *)v17, v18 - 8);
-      *(int *)&a3[1] = 0;
-      v20 = (int)((char *)v17 - 263);
-      while ( 1 )
-      {
-        if ( *(int *)v20 )
-        {
-          v21 = *(int *)((char *)&v17[9 * *(int *)v20 - 1559] - 3);
-          if ( pItemsTable->pItems[v21].uEquipType == 12 )
-            break;
-        }
-        ++*(int *)&a3[1];
-        v20 += 4;
-        if ( *(int *)&a3[1] > 1 )
-          goto LABEL_55;
-      }
-      v32 = v18;
-      v31 = *((int *)&pSpellDatas[66].field_8 + v21);
-      stru_A750F8[v19]._494836(v31, v18);
-LABEL_55:
-      v17 += 1743;
-      ++v18;
-      ++v19;
-    }
-    while ( v18 - 9 < 4 );
-    pGUIWindow_CurrentMenu->Release();
-    uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
-    v22 = 1;
-    viewparams->bRedrawGameUI = 1;
-    LOBYTE(v23) = 1;
-    if ( pParty->uAlignment )
-    {
-      if ( pParty->uAlignment == 2 )
-        v22 = 2;
-    }
-    else
-    {
-      v22 = 0;
-    }
-    SetUserInterface(v22, v23);
-    pEventTimer->Resume();
-    pEventTimer->StopGameTime();
-    v24 = pAudioPlayer;
-  }
-  v25 = pGames_LOD->DoesContainerExist((const char *)&pContainer);
-  v32 = (signed int)&pContainer;
-  sprintfex(pTmpBuf, "levels\\%s", &pContainer);
-  v26 = _access(pTmpBuf, 4) != -1;
-  if ( !v25 && !v26 )
-  {
-    v32 = (signed int)&pContainer;
-    sprintfex(pTmpBuf, "Unable to find: %s!", &pContainer);
-    Abortf(pTmpBuf, v30, v31, v32);
-  }
-  strcpy(pCurrentMapName, &pContainer);
-  dword_6BE364_game_settings_1 |= 0x2001;
-  v27 = 0;
-  if ( (signed int)uNumSavegameFiles > 0 )
-  {
-    v28 = pSavegameThumbnails;
-    do
-    {
-      v28->Release();
-      ++v27;
-      ++v28;
-    }
-    while ( v27 < (signed int)uNumSavegameFiles );
-  }
-  pIcons_LOD->_4114F2();
-  v32 = (signed __int64)(pSoundVolumeLevels[uMusicVolimeMultiplier] * 64.0);
-  v24->SetMusicVolume(v32);
-  v32 = (signed __int64)(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0);
-  v24->SetMasterVolume(v32);
-  if ( uTurnSpeed )
-    pParty->sRotationY = uTurnSpeed * pParty->sRotationY / (signed int)uTurnSpeed;
-  MM7Initialization();
-  bFlashQuestBook = 0;
-  viewparams->bRedrawGameUI = 1;
-}
-
-
-//----- (0045F469) --------------------------------------------------------
-int __fastcall SaveGame(int a1, __int16 *a2)
-{
-  int result; // eax@1
-  void *v3; // edi@5
-  int v4; // eax@6
-  int v5; // eax@6
-  int v6; // eax@6
-  const char *v7; // edi@8
-  FILE *v8; // edi@24
-  int v9; // edi@30
-  void *v10; // esi@31
-  void *v11; // esi@31
-  void *v12; // esi@37
-  void *v13; // esi@37
-  void *v14; // esi@37
-  void *v15; // esi@37
-  void *v16; // esi@37
-  int v17; // esi@37
-  unsigned int v18; // ecx@38
-  unsigned int v19; // esi@39
-  char *v20; // edx@39
-  void *v21; // esi@41
-  void *v22; // esi@41
-  BSPModel *v23; // eax@42
-  signed int v24; // edi@42
-  unsigned __int8 v25; // zf@43
-  unsigned __int8 v26; // sf@43
-  signed int v27; // edi@47
-  void *v28; // esi@50
-  void *v29; // esi@50
-  void *v30; // esi@50
-  void *v31; // esi@50
-  int v32; // esi@51
-  int v33; // eax@51
-  DWORD v34; // eax@59
-  std::string v35; // [sp-18h] [bp-288h]@8
-  const char *v36; // [sp-10h] [bp-280h]@6
-  const char *v37; // [sp-Ch] [bp-27Ch]@6
-  const char *v38; // [sp-8h] [bp-278h]@8
-  int v39; // [sp-4h] [bp-274h]@8
-  CHAR Buffer; // [sp+Ch] [bp-264h]@59
-  char Dir; // [sp+8Ch] [bp-1E4h]@51
-  char Drive; // [sp+ACh] [bp-1C4h]@51
-  int v43; // [sp+CCh] [bp-1A4h]@10
-  char Dest[20]; // [sp+E0h] [bp-190h]@10
-  unsigned __int64 v45; // [sp+F4h] [bp-17Ch]@10
-  char Filename; // [sp+130h] [bp-140h]@51
-  char Ext; // [sp+150h] [bp-120h]@51
-  char v48; // [sp+151h] [bp-11Fh]@51
-  char Source[32]; // [sp+170h] [bp-100h]@51
-  char Str[120]; // [sp+190h] [bp-E0h]@8
-  int v51; // [sp+208h] [bp-68h]@2
-  int v52; // [sp+20Ch] [bp-64h]@2
-  int v53; // [sp+210h] [bp-60h]@2
-  int v54; // [sp+214h] [bp-5Ch]@2
-  int Src; // [sp+218h] [bp-58h]@30
-  char v56; // [sp+21Ch] [bp-54h]@30
-  char v57; // [sp+21Dh] [bp-53h]@30
-  char v58; // [sp+21Eh] [bp-52h]@30
-  char v59; // [sp+21Fh] [bp-51h]@30
-  int v60; // [sp+220h] [bp-50h]@30
-  int v61; // [sp+224h] [bp-4Ch]@30
-  int v62; // [sp+228h] [bp-48h]@2
-  LOD::Directory pDir; // [sp+22Ch] [bp-44h]@2
-  std::string *v64; // [sp+24Ch] [bp-24h]@1
-  size_t Size; // [sp+250h] [bp-20h]@26
-  __int16 *v66; // [sp+254h] [bp-1Ch]@1
-  void *DstBuf; // [sp+258h] [bp-18h]@2
-  __int16 *v68; // [sp+25Ch] [bp-14h]@32
-  unsigned int v69; // [sp+260h] [bp-10h]@23
-  int v70; // [sp+264h] [bp-Ch]@22
-  std::string *v71; // [sp+268h] [bp-8h]@8
-  int a3; // [sp+26Fh] [bp-1h]@8
-
-  v66 = a2;
-  v64 = (std::string *)a1;
-  strcpy(byte_6BE3B0, pCurrentMapName);
-  result = _strcmpi(pCurrentMapName, "d05.blv");
-  if ( result )
-  {
-    DstBuf = operator new(0xF4240u);
-    pDir.Reset();
-    v52 = pParty->vPosition.x;
-    v51 = pParty->vPosition.z;
-    v62 = pParty->vPosition.y;
-    v53 = pParty->sRotationY;
-    v54 = pParty->sRotationX;
-    pParty->vPosition.x = pParty->vPrevPosition.x;
-    pParty->vPosition.z = pParty->vPrevPosition.z;
-    pParty->vPosition.y = pParty->vPrevPosition.y;
-    pParty->uFallStartY = pParty->vPrevPosition.y;
-    pParty->sRotationY = pParty->sPrevRotationY;
-    pParty->sRotationX = pParty->sPrevRotationX;
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-      pIndoor->uLastVisitDay = pParty->uTimePlayed;
-    else
-      pOutdoor->uLastVisitDay = pParty->uTimePlayed;
-    v3 = MakeScreenshot(150, 112);
-    strcpy((char *)&pDir, "image.pcx");
-    pRenderer->_49F5A2((int)v3, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
-    free(v3);
-    if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 11 )
-    {
-      pRenderer->DrawTextureIndexed(
-        8u,
-        8u,
-        (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
-      pRenderer->DrawTextureIndexed(
-        0x12u,
-        0x8Du,
-        (Texture *)(uTextureID_save_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_save_up] : 0));
-      v36 = pGlobalTXT_LocalizationStrings[190];
-      v4 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[190]);
-      pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v4 + 25, 219, 0, v36, 0, 0, 0);
-      v37 = (const char *)(&pSavegameHeader + uLoadGameUI_SelectedSlot);
-      v5 = pFontSmallnum->AlignText_Center(0xBAu,
-             (const char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
-      pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v5 + 25, 0x103u, 0, v37, 185, 0);
-      v36 = pGlobalTXT_LocalizationStrings[165];
-      v6 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]);
-      pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v6 + 25, 299, 0, v36, 0, 0, 0);
-      pRenderer->Present();
-    }
-    if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
-    {
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 200);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:773", 0);
-    }
-    else
-    {
-      v7 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp";
-    }
-    strcpy(Dest, pCurrentMapName);
-    v45 = pParty->uTimePlayed;
-    strcpy((char *)&pDir, "header.bin");
-    pDir.uDataSize = 100;
-    if ( pNew_LOD->Write(&pDir, &v43, 0) )
-    {
-      v39 = 201;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 201);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:784", 0);
-    }
-    strcpy((char *)&pDir, "party.bin");
-    pDir.uDataSize = 90680;
-    if ( pNew_LOD->Write(&pDir, &pParty, 0) )
-    {
-      v39 = 202;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 202);
-    MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:793", 0);
-    }
-    strcpy((char *)&pDir, "Timer.bin");
-    pDir.uDataSize = 40;
-    if ( pNew_LOD->Write(&pDir, &pEventTimer, 0) )
-    {
-      v39 = 203;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 203);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:802", 0);
-    }
-    strcpy((char *)&pDir, "overlay.bin");
-    pDir.uDataSize = 1008;
-    if ( pNew_LOD->Write(&pDir, &pOtherOverlayList, 0) )
-    {
-      v39 = 204;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 204);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:811", 0);
-    }
-    strcpy((char *)&pDir, "npcdata.bin");
-    pDir.uDataSize = 38076;
-    if ( pNew_LOD->Write(&pDir, pNPCStats->pNewNPCData, 0) )
-    {
-      v39 = 205;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 205);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:820", 0);
-    }
-    strcpy((char *)&pDir, "npcgroup.bin");
-    pDir.uDataSize = 102;
-    if ( pNew_LOD->Write(&pDir, pNPCStats->pGroups_copy, 0) )
-    {
-      v39 = 206;
-      sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 206);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:829", 0);
-    }
-    v70 = 1;
-    do
-    {
-      v69 = 1;
-      do
-      {
-        v39 = v69;
-        v38 = (const char *)v70;
-        sprintfex(Str, "data\\lloyd%d%d.pcx", v70, v69);
-        v8 = fopen(Str, "rb");
-        if ( v8 )
-        {
-          v39 = v69;
-          v38 = (const char *)v70;
-          sprintfex(Str, "lloyd%d%d.pcx", v70, v69);
-          fseek(v8, 0, 2);
-          pDir.uDataSize = ftell(v8);
-          rewind(v8);
-          fread(DstBuf, pDir.uDataSize, 1u, v8);
-          strcpy((char *)&pDir, Str);
-          fclose(v8);
-          remove(Str);
-          if ( pNew_LOD->Write(&pDir, DstBuf, 0) )
-          {
-            v39 = 207;
-            sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 207);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:857", 0);
-            Size = 5080748;
-          }
-        }
-        ++v69;
-      }
-      while ( (signed int)v69 <= 5 );
-      ++v70;
-    }
-    while ( v70 <= 4 );
-    if ( !v66 )
-    {
-      sub_42FA22_mess_with_laying_item_list();
-      v9 = (int)malloc(0xF4240u);
-      v71 = (std::string *)v9;
-      Src = 91969;
-      v56 = 109;
-      v57 = 118;
-      v58 = 105;
-      v59 = 105;
-      v60 = 0;
-      v61 = 0;
-      memcpy((void *)v9, &Src, 0x10u);
-      if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-      {
-        v10 = DstBuf;
-        pIndoor->dlv.uNumFacesInBModels = pIndoor->uNumFaces;
-        pIndoor->dlv.uNumBModels = 0;
-        pIndoor->dlv.uNumDecorations = uNumLevelDecorations;
-        memcpy(DstBuf, &pIndoor->dlv, 0x28u);
-        v10 = (char *)v10 + 40;
-        memcpy(v10, pIndoor->_visible_outlines, 0x36Bu);
-        v11 = (char *)v10 + 875;
-        v70 = 0;
-        if ( (signed int)pIndoor->uNumFaces > 0 )
-        {
-          v68 = 0;
-          do
-          {
-            v38 = (char *)v68 + (unsigned int)pIndoor->pFaces + 44;
-            memcpy(v11, v38, 4u);
-            v68 += 48;
-            v11 = (char *)v11 + 4;
-            ++v70;
-          }
-          while ( v70 < (signed int)pIndoor->uNumFaces );
-        }
-        v70 = 0;
-        if ( (signed int)uNumLevelDecorations > 0 )
-        {
-          v68 = &pLevelDecorations[0].field_2;
-          do
-          {
-            memcpy(v11, v68, 2u);
-            v68 += 16;
-            v11 = (char *)v11 + 2;
-            ++v70;
-          }
-          while ( v70 < (signed int)uNumLevelDecorations );
-        }
-        memcpy(v11, &uNumActors, 4u);
-        v12 = (char *)v11 + 4;
-        memcpy(v12, pActors, 836 * uNumActors);
-        v13 = (char *)v12 + 836 * uNumActors;
-        memcpy(v13, &uNumLayingItems, 4u);
-        v13 = (char *)v13 + 4;
-        memcpy(v13, pLayingItems, 112 * uNumLayingItems);
-        v14 = (char *)v13 + 112 * uNumLayingItems;
-        memcpy(v14, &uNumChests, 4u);
-        v14 = (char *)v14 + 4;
-        memcpy(v14, pChests, 5324 * uNumChests);
-        v15 = (char *)v14 + 5324 * uNumChests;
-        memcpy(v15, pIndoor->pDoors, 0x3E80u);
-        v15 = (char *)v15 + 16000;
-        memcpy(v15, pIndoor->ptr_0002B4_doors_ddata, pIndoor->blv.uDoors_ddata_Size);
-        v16 = (char *)v15 + pIndoor->blv.uDoors_ddata_Size;
-        memcpy(v16, &stru_5E4C90, 0xC8u);
-        v17 = (int)((char *)v16 + 200);
-        memcpy((void *)v17, &pIndoor->uLastVisitDay, 0x38u);
-      }
-      else
-      {
-        v18 = 0;
-        pOutdoor->ddm.uNumFacesInBModels = 0;
-        if ( (signed int)pOutdoor->uNumBModels > 0 )
-        {
-          v19 = pOutdoor->uNumBModels;
-          v20 = (char *)&pOutdoor->pBModels->uNumFaces;
-          do
-          {
-            v18 += *(int *)v20;
-            v20 += 188;
-            --v19;
-            pOutdoor->ddm.uNumFacesInBModels = v18;
-          }
-          while ( v19 );
-        }
-        v21 = DstBuf;
-        pOutdoor->ddm.uNumBModels = pOutdoor->uNumBModels;
-        pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
-        memcpy(DstBuf, &pOutdoor->ddm, 0x28u);
-        v21 = (char *)v21 + 40;
-        memcpy(v21, pOutdoor->array_528, 0x3C8u);
-        v21 = (char *)v21 + 968;
-        memcpy(v21, pOutdoor->array_8F0, 0x3C8u);
-        v22 = (char *)v21 + 968;
-        v70 = 0;
-        if ( (signed int)pOutdoor->uNumBModels > 0 )
-        {
-          v23 = pOutdoor->pBModels;
-          v24 = 76;
-          do
-          {
-            v25 = *(int *)&v23->pModelName[v24] == 0;
-            v26 = *(int *)&v23->pModelName[v24] < 0;
-            v66 = 0;
-            if ( !(v26 | v25) )
-            {
-              v68 = 0;
-              do
-              {
-                v38 = (char *)v68 + *(int *)&v23->pModelName[v24 + 8] + 28;
-                memcpy(v22, v38, 4u);
-                v23 = pOutdoor->pBModels;
-                v68 += 154;
-                v22 = (char *)v22 + 4;
-                v66 = (__int16 *)((char *)v66 + 1);
-              }
-              while ( (signed int)v66 < *(int *)&pOutdoor->pBModels->pModelName[v24] );
-            }
-            ++v70;
-            v24 += 188;
-          }
-          while ( v70 < (signed int)pOutdoor->uNumBModels );
-        }
-        v27 = 0;
-        if ( (signed int)uNumLevelDecorations > 0 )
-        {
-          v66 = &pLevelDecorations[0].field_2;
-          do
-          {
-            memcpy(v22, v66, 2u);
-            v66 += 16;
-            v22 = (char *)v22 + 2;
-            ++v27;
-          }
-          while ( v27 < (signed int)uNumLevelDecorations );
-        }
-        memcpy(v22, &uNumActors, 4u);
-        v28 = (char *)v22 + 4;
-        memcpy(v28, pActors, 836 * uNumActors);
-        v29 = (char *)v28 + 836 * uNumActors;
-        memcpy(v29, &uNumLayingItems, 4u);
-        v29 = (char *)v29 + 4;
-        memcpy(v29, pLayingItems, 112 * uNumLayingItems);
-        v30 = (char *)v29 + 112 * uNumLayingItems;
-        memcpy(v30, &uNumChests, 4u);
-        v30 = (char *)v30 + 4;
-        memcpy(v30, pChests, 5324 * uNumChests);
-        v31 = (char *)v30 + 5324 * uNumChests;
-        memcpy(v31, &stru_5E4C90, 0xC8u);
-        v17 = (int)((char *)v31 + 200);
-        memcpy((void *)v17, &pOutdoor->uLastVisitDay, 0x38u);
-        v9 = (int)v71;
-      }
-      v32 = v17 + 56;
-      strcpy(Source, pCurrentMapName);
-      _splitpath(Source, &Drive, &Dir, &Filename, &Ext);
-      v48 = 100;
-      Size = v32 - (int)DstBuf;
-      v69 = 999984;
-      LOBYTE(v33) = zlib::MemZip((char *)v9 + 16, (unsigned int *)&v69, DstBuf, v32 - (int)DstBuf);
-      if ( v33 || (signed int)v69 > (signed int)Size )
-      {
-        memcpy((void *)(v9 + 16), DstBuf, Size);
-        v69 = Size;
-      }
-      v69 += 16;
-      memcpy((void *)(v9 + 8), &v69, 4u);
-      memcpy((void *)(v9 + 12), &Size, 4u);
-      sprintfex(Source, "%s%s", &Filename, &Ext);
-      strcpy((char *)&pDir, Source);
-      pDir.uDataSize = v69;
-      if ( pNew_LOD->Write(&pDir, (const void *)v9, 0) )
-      {
-        v39 = 208;
-        sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 208);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1071", 0);
-      }
-      free((void *)v9);
-    }
-    free(DstBuf);
-    if ( v64 )
-    {
-      if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
-      {
-        v34 = GetLastError();
-        FormatMessageA(0x1000u, 0, v34, 0x400u, &Buffer, 0x80u, 0);
-        v39 = 300;
-        sprintfex(Str, pGlobalTXT_LocalizationStrings[612], 300);
-          MessageBoxA(nullptr, Str, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\LoadSave.cpp:1097", 0);
-      }
-    }
-    pParty->vPosition.x = v52;
-    pParty->vPosition.z = v51;
-    pParty->vPosition.y = v62;
-    pParty->uFallStartY = v62;
-    pParty->sRotationY = v53;
-    result = v54;
-    pParty->sRotationX = v54;
-  }
-  return result;
-}
-// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
-
-//----- (00460078) --------------------------------------------------------
-void __fastcall DoSavegame(unsigned int uSlot)
-{
-  unsigned int v1; // esi@1
-  int v2; // esi@2
-  RGBTexture *v3; // ebx@3
-  int bNotArena; // [sp+2Ch] [bp-8h]@1
-  unsigned int v6; // [sp+30h] [bp-4h]@1
-
-  v1 = uSlot;
-  v6 = uSlot;
-  bNotArena = _strcmpi(pCurrentMapName, "d05.blv");
-  if ( bNotArena )
-  {
-    LOD::Directory pDir; // [sp+Ch] [bp-28h]@2
-    SaveGame(0, 0);
-    v2 = 100 * v1;
-    strcpy(&pSavegameHeader->pLocationName[v2], pCurrentMapName);
-    *(int *)((char *)&pSavegameHeader->uWordTime + v2) = LODWORD(pParty->uTimePlayed);
-    *(int *)((char *)&pSavegameHeader->uWordTime + v2 + 4) = HIDWORD(pParty->uTimePlayed);
-    strcpy((char *)&pDir, "header.bin");
-    pDir.uDataSize = 100;
-    pNew_LOD->Write(&pDir, (char *)&pSavegameHeader + v2, 0);
-    sprintfex(pTmpBuf, "saves\\save%03d.mm7", v6);
-    pNew_LOD->CloseWriteFile();
-    CopyFileA("data\\new.lod", pTmpBuf, 0);
-  }
-  GUI_UpdateWindows();
-  pGUIWindow_CurrentMenu->Release();
-  uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
-  v3 = pSavegameThumbnails;
-  viewparams->bRedrawGameUI = 1;
-  do
-  {
-    v3->Release();
-    ++v3;
-  }
-  while ( (signed int)v3 < (signed int)&unk_6A0758 );
-  if ( bNotArena )
-    pNew_LOD->_4621A7();
-  else
-    ShowStatusBarString(pGlobalTXT_LocalizationStrings[583], 2u);// "No saving in the Arena"
-  pIcons_LOD->_4355F7();
-  pEventTimer->Resume();
-  ShowStatusBarString(pGlobalTXT_LocalizationStrings[656], 2u);// "Game Saved!"
-  viewparams->bRedrawGameUI = 1;
-}
-// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
-
 //----- (004601B7) --------------------------------------------------------
 void GameUI_MainMenu_DoDrawLoad(int a1)
 {
@@ -13305,7 +12551,7 @@
   stru_506F20.Load("title.pcx", 0);
   SetCurrentMenuID(MENU_MAIN);
   SetForegroundWindow(hWnd);
-  SendMessageA(hWnd, WM_ACTIVATEAPP, 1, 0);
+  SendMessageW(hWnd, WM_ACTIVATEAPP, 1, 0);
   while (GetCurrentMenuID() == MENU_MAIN ||
          GetCurrentMenuID() == MENU_SAVELOAD)
   {
@@ -13355,7 +12601,6 @@
         if (GetCurrentMenuID() == MENU_LOAD)
         {
           pIcons_LOD->_4114F2();
-          crt_deconstruct_ptr_6A0118();
           pGUIWindow_CurrentMenu->Release();
           pGUIWindow_CurrentMenu = 0;
           uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0;
@@ -15598,7 +14843,6 @@
   viewparams->uSomeZ = viewparams->uScreenZ;
   viewparams->uSomeW = viewparams->uScreenW;
 
-  pViewport = new Viewport;
   pViewport->SetScreen(viewparams->uScreenX, viewparams->uScreenY, viewparams->uScreenZ, viewparams->uScreenW);
   if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
     pOutdoorCamera->_485F64();
@@ -17000,9 +16244,9 @@
         sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], v24);
         ShowStatusBarString(pTmpBuf2, 2u);
         if ( v19->uItemID == 506 )
-          _449B7E_toggle_bit((char *)pParty->_award_bits, 184, 1u);
+          _449B7E_toggle_bit(pParty->_award_bits, 184, 1u);
         if ( v19->uItemID == 455 )
-          _449B7E_toggle_bit((char *)pParty->_award_bits, 185, 1u);
+          _449B7E_toggle_bit(pParty->_award_bits, 185, 1u);
         if ( !pParty->AddItem(v19) )
           pParty->SetHoldingItem(v19);
         v21 = v26;