changeset 2032:b9e11e88b157

Merge
author Ritor1
date Mon, 18 Nov 2013 20:17:37 +0600
parents e21db9518295 (current diff) 47ab41698f9d (diff)
children e78fa9082174
files mm7_2.cpp
diffstat 3 files changed, 83 insertions(+), 54 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Mon Nov 18 20:17:24 2013 +0600
+++ b/mm7_2.cpp	Mon Nov 18 20:17:37 2013 +0600
@@ -4303,6 +4303,7 @@
 bool debug_information = false;
 bool show_picked_face = false;
 bool draw_debug_line = false;
+bool new_speed = true;
 
 //----- (00462C94) --------------------------------------------------------
 bool MM_Main(const wchar_t *pCmdLine)
@@ -4360,7 +4361,7 @@
   uCPUSpeed = Rect.bottom;*/
   uCPUSpeed = 2048; // about 2GHz
 
-  constructors();
+  //constructors();
 
   if (!MM7_Initialize(640, 480))
   {
--- a/mm7_3.cpp	Mon Nov 18 20:17:24 2013 +0600
+++ b/mm7_3.cpp	Mon Nov 18 20:17:37 2013 +0600
@@ -2063,7 +2063,7 @@
   int v2; // ebx@1
   int v3; // eax@14
   int v6; // esi@45
-  ODMFace *v7; // ecx@45
+  ODMFace *face; // ecx@45
   signed int v33; // eax@143
   int v34; // esi@143
   int v35; // esi@147
@@ -2123,9 +2123,9 @@
   bool high_fall_flag; // [sp+1Ch] [bp-78h]@33
   int v102; // [sp+20h] [bp-74h]@1
   int v103; // [sp+24h] [bp-70h]@1
-  int bFeatherFall; // [sp+28h] [bp-6Ch]@4
+  bool bFeatherFall; // [sp+28h] [bp-6Ch]@4
   int v105; // [sp+2Ch] [bp-68h]@24
-  int bWaterWalk; // [sp+30h] [bp-64h]@1
+  bool bWaterWalk; // [sp+30h] [bp-64h]@1
   int v109; // [sp+3Ch] [bp-58h]@28
   int v110; // [sp+40h] [bp-54h]@180
   int v111; // [sp+44h] [bp-50h]@14
@@ -2145,7 +2145,6 @@
   int v128; // [sp+88h] [bp-Ch]@1
   int v129; // [sp+8Ch] [bp-8h]@92
 
-  pZ = pParty->vPosition.z;
   v1 = 0;
   v103 = 0;
   v2 = 0;
@@ -2154,6 +2153,7 @@
   v129 = 0;
   pX = pParty->vPosition.x;
   pY = pParty->vPosition.y;
+  pZ = pParty->vPosition.z;
   v113 = pParty->field_6F0;
   hovering = false;
   bool partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y);
@@ -2161,32 +2161,32 @@
   party_walking_flag = false;
   v102 = 0;
   pModel = 0;
-  bWaterWalk = 0;
-  if (!pParty->FeatherFallActive())
+  bWaterWalk = false;
+
+  if (!pParty->FeatherFallActive())//Проверка падение пера
   {
-    bFeatherFall = 0;
+    bFeatherFall = false;
     for (int i = 0; i < 4; ++i)
       if (pParty->pPlayers[i].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT))  // seems like flying boots
       {
-        bFeatherFall = 1;
+        bFeatherFall = true;
         break;
       }
   }
   else
-  {
-	bFeatherFall = 1;
-  }
-//LABEL_9:
+    bFeatherFall = true;
+
   pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
-  if (pParty->WaterWalkActive())
+  if (pParty->WaterWalkActive())//Проверка хождения по воде
   {
     //LOBYTE(pParty->uFlags) &= 0x7Fu;
-    bWaterWalk = 1;
+    bWaterWalk = true;
     *(short *)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
     if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
-		pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
-      bWaterWalk = 0;
+          pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 )
+      bWaterWalk = false;
   }
+
   int bmodel_standing_on_pid;
   int is_on_water = false;
   v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk);
@@ -2203,14 +2203,14 @@
     {
       pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
     }
-    else for (int _i = 0; _i < 4; ++_i)     // receive falling damage
+    else for (int i = 0; i < 4; ++i)     // receive falling damage
     {
-      if ( !pParty->pPlayers[_i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[_i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
+      if ( !pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) )
       {
-        pParty->pPlayers[_i].ReceiveDamage(
-            (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[_i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL);
-        v105 = 20 - pParty->pPlayers[_i].GetParameterBonus(pParty->pPlayers[_i].GetActualEndurance());
-        pParty->pPlayers[_i].SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
+        pParty->pPlayers[i].ReceiveDamage(
+            (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL);
+        v105 = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance());
+        pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
       }
       //}
       //while ( (signed int)v4 <= (signed int)&pPlayers[4] );
@@ -2228,7 +2228,7 @@
   }
   else
     hovering = true;
-  high_fall_flag = pZ - v111 > 32;
+  high_fall_flag = pZ - v111 <= 32;
 
   if ( bWalkSound && pParty->walk_sound_timer)//timer update
   {
@@ -2247,17 +2247,17 @@
       {
         if ( (bmodel_standing_on_pid >> 6) < pOutdoor->uNumBModels )
         {
-          v7 = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces;
+          face = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces;
           v6 = bmodel_standing_on_pid & 0x3F;
           /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 )
           {
             pParty->field_6F4_packedid = PID(OBJECT_BModel,v108);
             v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292);
           }*/
-		  if ( BYTE3(v7[v6].uAttributes) & 4 )
+		  if ( BYTE3(face[v6].uAttributes) & 4 )
           {
             pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
-            v103 = v7[v6].sCogTriggeredID;
+            v103 = face[v6].sCogTriggeredID;
           }
         }
       }
@@ -2421,10 +2421,19 @@
               cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0);
 
         int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
-        v2 += dx;// * 12;
-        
         int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
-        v1 += dy;// * 12;
+
+        extern bool new_speed;
+        if ( new_speed )
+        {
+          v2 += dx * 12;
+          v1 += dy * 12;
+        }
+        else
+        {
+          v2 += dx;
+          v1 += dy;
+        }
 
         v128 = v1;
         party_walking_flag = true;
@@ -2541,9 +2550,6 @@
         }
       break;
 
-      default:
-        assert(false);
-
       case PARTY_Land:
         if (pParty->bFlying)
         {
@@ -2553,6 +2559,11 @@
         pParty->bFlying = false;
         pPartyActionQueue->uNumActions = 0;
       break;
+
+      default:
+        assert(false);
+
+
     }
   }
 
@@ -2759,7 +2770,7 @@
       if (pParty->Invisible())
         pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
 
-      viewparams->bRedrawGameUI = 1;
+      viewparams->bRedrawGameUI = true;
 		v2 = (unsigned __int64)(58500i64 * v2) >> 16;
 		pModel = (BSPModel *)58500;
 		v128 = (unsigned __int64)(58500i64 * v128) >> 16;
@@ -3027,7 +3038,7 @@
     }
     return;
   }
-  v76 = pParty->bFlying;
+  //v76 = pParty->bFlying;
   if ( pParty->bFlying || !high_fall_flag || bWaterWalk || !pModel )
     v77 = 1;
   else
@@ -3067,7 +3078,7 @@
       *(short *)v79 |= 1u;
       if ( !v122 || !v69 )
       {
-        if ( !v76 )
+        if ( !pParty->bFlying )
         {
           v80 = *(short *)v79;
           pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER;
--- a/mm7_4.cpp	Mon Nov 18 20:17:24 2013 +0600
+++ b/mm7_4.cpp	Mon Nov 18 20:17:37 2013 +0600
@@ -547,7 +547,7 @@
   int result; // eax@1
   int v4; // eax@2
   int v5; // edi@5
-  int *v6; // ecx@5
+  bool cursed_flag; // ecx@5
   char v7; // sf@5
   int *v8; // ecx@10
   int v9; // edi@15
@@ -607,17 +607,15 @@
       if ( pParty->bFlying )
       {
         if ( !(pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1) )
-        { // colliding with something in the air - fall down
+        {
           v5 = v4 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uPower;
-          //__debugbreak();
-		  v6 = (int *)&pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[0];//&stru_AA1058[4].pSounds[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 2000];
-          v7 = *v6 < v5;
-          *v6 -= v5;
-          if ( v7 )
+          cursed_flag = pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].pConditions[0];//cursed
+          v7 = cursed_flag < v5;
+          //cursed_flag -= v5;
+          if ( !v7 )
           {
-            *v6 = 0;
             pParty->uFlags &= 0xFFFFFFBFu;
-            pParty->bFlying = 0;
+            pParty->bFlying = false;
             v51 = 1;
           }
         }
@@ -732,9 +730,16 @@
         if ( v24 > 134 )
         {
           if ( v24 == 529 )
-            goto LABEL_43;
+          {
+            v20 = 1;
+            v50 = 1;
+            goto LABEL_51;
+          }
           if ( v24 == 535 )
-            goto LABEL_44;
+          {
+            v20 = 1;
+            goto LABEL_51;
+          }
           if ( v24 == 515 )
           {
             v47 = 1;
@@ -742,7 +747,10 @@
           else
           {
             if ( v24 == 532 )
-              goto LABEL_50;
+            {
+              v50 = 1;
+              goto LABEL_51;
+            }
           }
         }
         else
@@ -757,31 +765,40 @@
               {
                 v27 = v26 - 1;
                 if ( !v27 )
-                  goto LABEL_50;
+                {
+                  v50 = 1;
+                  goto LABEL_51;
+                }
                 v28 = v27 - 6;
                 if ( v28 )
                 {
                   if ( v28 != 3 )
                     goto LABEL_51;
-LABEL_50:
+//LABEL_50:
                   v50 = 1;
                   goto LABEL_51;
                 }
               }
             }
-LABEL_44:
+//LABEL_44:
             v20 = 1;
             goto LABEL_51;
           }
           v29 = v25 - 54;
           if ( !v29 )
-            goto LABEL_44;
+          {
+            v20 = 1;
+            goto LABEL_51;
+          }
           v30 = v29 - 1;
           if ( !v30 )
-            goto LABEL_50;
+          {
+            v50 = 1;
+            goto LABEL_51;
+          }
           if ( v30 == 11 )
           {
-LABEL_43:
+//LABEL_43:
             v20 = 1;
             v50 = 1;
             goto LABEL_51;