changeset 79:2fd44e5cbe89

Слияние
author Ritor1
date Sun, 28 Oct 2012 09:20:28 +0600
parents e49e6d3042f2 (current diff) 75994455e457 (diff)
children a84fb3752681
files mm7_4.cpp
diffstat 6 files changed, 70 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Sun Oct 28 09:20:13 2012 +0600
+++ b/Render.cpp	Sun Oct 28 09:20:28 2012 +0600
@@ -5114,7 +5114,7 @@
   int result; // eax@21
   char v18; // [sp+Ch] [bp-ACh]@3
   __int16 v19; // [sp+44h] [bp-74h]@3
-  char v20; // [sp+48h] [bp-70h]@3
+  char v20[48]; // [sp+48h] [bp-70h]@3
   char *v21; // [sp+78h] [bp-40h]@7
   char *v22; // [sp+7Ch] [bp-3Ch]@7
   int v23; // [sp+80h] [bp-38h]@4
--- a/SaveLoad.cpp	Sun Oct 28 09:20:13 2012 +0600
+++ b/SaveLoad.cpp	Sun Oct 28 09:20:28 2012 +0600
@@ -289,7 +289,7 @@
   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
+  //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
@@ -300,42 +300,49 @@
   int a3; // [sp+26Fh] [bp-1h]@8
 
   v66 = a2;
-  v64 = (std::string *)a1;
+  //v64 = (std::string *)a1;
+
   strcpy(byte_6BE3B0, pCurrentMapName);
-  result = _strcmpi(pCurrentMapName, "d05.blv");
-  if ( result )
-  {
-    DstBuf = operator new(0xF4240u);
-    pDir.Reset();
+  if (!_strcmpi(pCurrentMapName, "d05.blv"))
+    return false;
+
+  DstBuf = malloc(0xF4240u);
+  pDir.Reset();
     v52 = pParty->vPosition.x;
     v51 = pParty->vPosition.y;
     v62 = pParty->vPosition.z;
     v53 = pParty->sRotationY;
     v54 = pParty->sRotationX;
-    pParty->vPosition.x = pParty->vPrevPosition.x;
-    pParty->vPosition.y = pParty->vPrevPosition.z;
-    pParty->vPosition.z = pParty->vPrevPosition.y;
-    pParty->uFallStartY = pParty->vPrevPosition.y;
-    pParty->sRotationY = pParty->sPrevRotationY;
-    pParty->sRotationX = pParty->sPrevRotationX;
-    if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
-      pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
-    else
-      pOutdoor->uLastVisitDay = pParty->uTimePlayed;
-    v3 = MakeScreenshot(150, 112);
-    strcpy((char *)&pDir, "image.pcx");
+  pParty->vPosition.x = pParty->vPrevPosition.x;
+  pParty->vPosition.y = pParty->vPrevPosition.z;
+  pParty->vPosition.z = pParty->vPrevPosition.y;
+  pParty->uFallStartY = pParty->vPrevPosition.y;
+  pParty->sRotationY = pParty->sPrevRotationY;
+  pParty->sRotationX = pParty->sPrevRotationX;
+
+  if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
+    pIndoor->stru1.uLastVisitDay = pParty->uTimePlayed;
+  else
+    pOutdoor->uLastVisitDay = pParty->uTimePlayed;
+
+  v3 = MakeScreenshot(150, 112);
+  {
+    strcpy(pDir.pFilename, "image.pcx");
+
     pRenderer->_49F5A2((int)v3, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize);
-    free(v3);
+  }
+  free(v3);
+
     if ( pCurrentScreen == 11 )
     {
       pRenderer->DrawTextureIndexed(
         8u,
         8u,
-        (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
+        (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0));
       pRenderer->DrawTextureIndexed(
         0x12u,
         0x8Du,
-        (Texture *)(uTextureID_save_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_save_up] : 0));
+        (Texture *)(uTextureID_save_up != -1 ? &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);
@@ -443,7 +450,7 @@
       ++v70;
     }
     while ( v70 <= 4 );
-    if ( !v66 )
+    if ( !a2 )
     {
       sub_42FA22_mess_with_laying_item_list();
       v9 = (int)malloc(0xF4240u);
@@ -625,7 +632,7 @@
       free((void *)v9);
     }
     free(DstBuf);
-    if ( v64 )
+    if ( a1 )
     {
       if ( !CopyFileA("data\\new.lod", "saves\\autosave.mm7", 0) )
       {
@@ -643,7 +650,7 @@
     pParty->sRotationY = v53;
     result = v54;
     pParty->sRotationX = v54;
-  }
+
   return result;
 }
 
--- a/mm7_2.cpp	Sun Oct 28 09:20:13 2012 +0600
+++ b/mm7_2.cpp	Sun Oct 28 09:20:28 2012 +0600
@@ -11718,7 +11718,7 @@
 
 
 //----- (0046086A) --------------------------------------------------------
-int __cdecl MaybeDoAutosave()
+bool Autosave()
 {
   int v0; // esi@3
   int v1; // eax@4
@@ -11735,7 +11735,7 @@
   if ( pVideoPlayer->AnyMovieLoaded() )
     pVideoPlayer->Unload();
   v0 = 0;
-  pSave = pAllocator->AllocNamedChunk(0, 0xF4240u, 0);
+  pSave = pAllocator->AllocNamedChunk(0, 0xF4240, 0);
   pNew_LOD->CloseWriteFile();
   remove("data\\new.lod");
   this_.Reset();
@@ -11745,7 +11745,7 @@
   this_.dword_0000A8 = 0;
   a3.dword_000018 = 0;
   a3.word_00001E = 0;
-  strcpy((char *)&a3, "current");
+  strcpy(a3.pFilename, "current");
   pNew_LOD->_461492(&this_, &a3, "data\\new.lod");
   if ( pNew_LOD->LoadFile("data\\new.lod", 0) )
   {
@@ -14155,9 +14155,9 @@
             goto LABEL_53;
           }
           DeleteCCharFont();
-          bFlashQuestBook = 1;
+          bFlashQuestBook = true;
           pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
-          MaybeDoAutosave();
+          Autosave();
           goto LABEL_48;
         }
         if (GetCurrentMenuID() == MENU_CREDITS)
--- a/mm7_3.cpp	Sun Oct 28 09:20:13 2012 +0600
+++ b/mm7_3.cpp	Sun Oct 28 09:20:28 2012 +0600
@@ -518,27 +518,25 @@
 
 
 //----- (0046ED1B) --------------------------------------------------------
-int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, unsigned int *pFaceID)
-{
-  unsigned int *v5; // edi@1
-  int result; // eax@1
-  int v7; // eax@3
-  int v8; // [sp+Ch] [bp-8h]@1
-  int v9; // [sp+10h] [bp-4h]@1
-
-  __debugbreak();
-  uint _pSectorID;
-  v5 = pSectorID;
-  v9 = a2;
-  v8 = a1;
-  result = _46CEC3_get_floor_level(a1, a2, a3, *pSectorID, &_pSectorID);
-  if ( result != -30000 && result <= a3 + 50
-    || (v7 = pIndoor->GetSector(v8, v9, a3), (*v5 = v7) != 0)
-    && (result = _46CEC3_get_floor_level(v8, v9, a3, v7, &_pSectorID), result != -30000) )
-    *pFaceID = _pSectorID;
-  else
-    result = -30000;
-  return result;
+int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
+{
+  uint uFaceID = -1;
+  int floor_level = _46CEC3_get_floor_level(x, y, z, *pSectorID, &uFaceID);
+
+  if (floor_level != -30000 && floor_level <= z + 50)
+  {
+    *pFaceID = uFaceID;
+    return floor_level;
+  }
+
+  uint uSectorID = pIndoor->GetSector(x, y, z);
+  *pSectorID = uSectorID;
+
+  floor_level = _46CEC3_get_floor_level(x, y, z, uSectorID, &uFaceID);
+  if (uSectorID && floor_level != -30000)
+    *pFaceID = uFaceID;
+  else return -30000;
+  return floor_level;
 }
 
 //----- (0046ED8A) --------------------------------------------------------
@@ -2354,18 +2352,12 @@
 //----- (00472866) --------------------------------------------------------
 void BLV_ProcessPartyActions()
 {
-  int v0; // esi@1
   int v1; // ebx@1
   int v2; // edi@1
-  int v3; // esi@1
-  //float v4; // ST40_4@8
-  //Player **v5; // esi@15
   int v6; // eax@18
-  //Player **v7; // esi@24
   signed __int64 v8; // qax@27
   int v9; // eax@27
   double v10; // st7@27
-  //BLVFace *v11; // edx@41
   unsigned int v12; // eax@49
   double v13; // st7@50
   int v14; // eax@51
@@ -2383,12 +2375,6 @@
   int v26; // eax@67
   double v27; // st7@67
   int v28; // ST40_4@67
-  //int v29; // eax@69
-  //double v30; // st7@69
-  //int v31; // ST3C_4@69
-  //int v32; // eax@71
-  //double v33; // st7@71
-  //int v34; // ST3C_4@71
   unsigned int v35; // eax@74
   int v36; // ecx@88
   int new_party_z; // esi@96
@@ -2421,7 +2407,6 @@
   unsigned int v64; // [sp-8h] [bp-68h]@161
   int v65; // [sp-4h] [bp-64h]@75
   int v66; // [sp-4h] [bp-64h]@161
-  //double v67; // [sp+Ch] [bp-54h]@8
   int v68; // [sp+10h] [bp-50h]@45
   int v69; // [sp+10h] [bp-50h]@140
   unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
@@ -2430,8 +2415,7 @@
   signed int v73; // [sp+20h] [bp-40h]@100
   int v74; // [sp+20h] [bp-40h]@140
   bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
-  //bool bFeatherFalla; // [sp+24h] [bp-3Ch]@33
-  unsigned int v77; // [sp+28h] [bp-38h]@1
+  unsigned int uSectorID; // [sp+28h] [bp-38h]@1
   int v78; // [sp+2Ch] [bp-34h]@1
   unsigned int uFaceID; // [sp+30h] [bp-30h]@1
   int v80; // [sp+34h] [bp-2Ch]@1
@@ -2442,24 +2426,21 @@
   int new_party_y; // [sp+48h] [bp-18h]@1
   int new_party_x; // [sp+4Ch] [bp-14h]@1
   int party_z; // [sp+50h] [bp-10h]@1
-  //float v88; // [sp+54h] [bp-Ch]@62
   int v89; // [sp+58h] [bp-8h]@1
   int angle; // [sp+5Ch] [bp-4h]@47
 
-  v0 = pParty->vPosition.z;
   v89 = pParty->uFallSpeed;
   v1 = 0;
   new_party_y = pParty->vPosition.y;
   v2 = 0;
   new_party_x = pParty->vPosition.x;
   party_z = pParty->vPosition.z;
-  v77 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
+  uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   v72 = 0;
   v78 = 0;
   v71 = 0;
   bJumping = 0;
-  v3 = v0 + 40;
-  v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, v3, &v77, &uFaceID);
+  v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
   if ( pParty->bFlying )
   {
     pParty->bFlying = 0;
@@ -2469,7 +2450,7 @@
   }
   if ( v80 == -30000 )
   {
-    v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, v3, &v77, &uFaceID);
+    v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
     if ( v80 == -30000 )
     {
       pParty->vPosition.x = blv_prev_party_x;
@@ -2789,7 +2770,7 @@
     stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
     stru_721530.field_34.z = stru_721530.field_C + party_z + 1;
     stru_721530.field_24 = v89;
-    stru_721530.uSectorID = v77;
+    stru_721530.uSectorID = uSectorID;
     v38 = 0;
     if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
       v38 = 13312;
@@ -2810,16 +2791,16 @@
     if ( stru_721530.field_7C >= stru_721530.field_6C )
     {
       v39 = stru_721530.normal2.x;
-      v77 = stru_721530.normal2.y;
+      uSectorID = stru_721530.normal2.y;
       v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
     }
     else
     {
       v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + new_party_x;
-      v77 = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
+      uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
       v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
     }
-    v42 = _46ED1B_collide_against_floor(v39, v77, v40 + 40, &stru_721530.uSectorID, &uFaceID);
+    v42 = _46ED1B_collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
     if ( v42 == -30000 || v42 - new_party_z > 128 )
       return;
     if ( stru_721530.field_7C >= stru_721530.field_6C )
@@ -2832,7 +2813,7 @@
     new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
     new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
     v43 = stru_721530.uFaceID;
-    v77 = stru_721530.uSectorID;
+    uSectorID = stru_721530.uSectorID;
     stru_721530.field_70 += stru_721530.field_7C;
     auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z;
     if ( (stru_721530.uFaceID & 7) == 3 )
--- a/mm7_4.cpp	Sun Oct 28 09:20:13 2012 +0600
+++ b/mm7_4.cpp	Sun Oct 28 09:20:28 2012 +0600
@@ -292,6 +292,8 @@
   int uSectorIDa; // [sp+4Ch] [bp+Ch]@1
   signed int uSectorIDb; // [sp+4Ch] [bp+Ch]@32
 
+  __debugbreak();
+
   v5 = &pIndoor->pSectors[uSectorID];
   v57 = a2;
   v56 = a1;
@@ -5427,7 +5429,6 @@
   uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem);
 
   uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25;
-  Log::Warning(L"%u",uPlayerCreationUI_ArrowAnim);
   pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]);
   pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]);
   //if (uPlayerCreationUI_ArrowAnim < 0)
--- a/mm7_data.h	Sun Oct 28 09:20:13 2012 +0600
+++ b/mm7_data.h	Sun Oct 28 09:20:28 2012 +0600
@@ -2880,7 +2880,7 @@
 void __cdecl TryLoadLevelFromLOD();
 void __cdecl sub_46080D();
 bool __cdecl Initialize_GamesLOD_NewLOD();
-int __cdecl MaybeDoAutosave();
+bool Autosave();
 void __thiscall PrepareToLoadBLV(unsigned int bLoading);
 void __fastcall PrepareToLoadODM(unsigned int bLoading, struct OutdoorCamera *a2);
 void __cdecl sub_461103();
@@ -2949,7 +2949,7 @@
 void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2);
 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1); // idb
 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0);
-int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, unsigned int *pFaceID); // idb
+int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb
 void __fastcall _46ED8A_collide_against_layingItems(unsigned int _this);
 int __thiscall _46EF01_collision_chech_player(int a1); // idb
 signed int __cdecl _46F04E_collide_against_portals();