changeset 2168:7cd99cb12911

Слияние
author Ritor1
date Fri, 17 Jan 2014 22:44:57 +0600
parents 1497ca65a525 (diff) 00bd098f6435 (current diff)
children 5b27c035a241
files Outdoor.cpp
diffstat 1 files changed, 108 insertions(+), 110 deletions(-) [+]
line wrap: on
line diff
--- a/Outdoor.cpp	Fri Jan 17 17:58:48 2014 +0600
+++ b/Outdoor.cpp	Fri Jan 17 22:44:57 2014 +0600
@@ -3506,7 +3506,7 @@
   int floor_level; // eax@14
   int v6; // esi@45
   ODMFace *face; // ecx@45
-  signed int v33; // eax@143
+  //signed int v33; // eax@143
   int v34; // esi@143
   int v35; // esi@147
   int v36; // eax@155
@@ -3519,6 +3519,7 @@
   signed int v44; // edx@184
   int v45; // ecx@200
   BSPModel *pModel; // eax@203
+  bool pModel_;
   ODMFace *pODMFace; // esi@203
   int v48; // eax@203
   int v54; // eax@215
@@ -3591,7 +3592,7 @@
   party_running_flag = false;
   party_walking_flag = false;
   v102 = 0;
-  pModel = 0;
+  pModel_ = false;
   bWaterWalk = false;
 
   if (!pParty->FeatherFallActive())//  
@@ -3720,38 +3721,38 @@
         if (bUnderwater ||
             pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 ||
             pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )
+        {
+          extern int max_flight_height;
+          if ( pParty->vPosition.z < max_flight_height || hovering )
           {
-            extern int max_flight_height;
-            if ( pParty->vPosition.z < max_flight_height || hovering )
+            pZ += 30;
+            v113 += 30;
+            pParty->bFlying = true;
+            if ( pZ > max_flight_height )
             {
-              pZ += 30;
-              v113 += 30;
-              pParty->bFlying = true;
-              if ( pZ > max_flight_height )
-              {
-                pZ = max_flight_height;
-                v113 = max_flight_height;
-              }
-              v1 = 0;
-              v2 = 0;
-              fall_speed = 0;
-              *(float *)&v128 = 0.0;
-              if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//  
-              {
-                pParty->field_6E0 = 0;
-                pParty->field_6E4 = 0;
-                pPartyActionQueue->uNumActions = 0;
-                pParty->uFlags |= PARTY_FLAGS_1_LANDING;
-                pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31;
-                pParty->field_6F0 = pZ;
-                pParty->bFlying = false;
-                pZ = ceiling_height - pParty->uPartyHeight - 31;
-                v113 = pParty->field_6F0;
-              }
-              pParty->uFallSpeed = 0;
-              pModel = (BSPModel *)1;
+              pZ = max_flight_height;
+              v113 = max_flight_height;
             }
+            v1 = 0;
+            v2 = 0;
+            fall_speed = 0;
+            *(float *)&v128 = 0.0;
+            if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//  
+            {
+              pParty->field_6E0 = 0;
+              pParty->field_6E4 = 0;
+              pPartyActionQueue->uNumActions = 0;
+              pParty->uFlags |= PARTY_FLAGS_1_LANDING;
+              pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31;
+              pParty->field_6F0 = pZ;
+              pParty->bFlying = false;
+              pZ = ceiling_height - pParty->uPartyHeight - 31;
+              v113 = pParty->field_6F0;
+            }
+            pParty->uFallSpeed = 0;
+            pModel_ = true;
           }
+        }
       }
       break;
 
@@ -3768,7 +3769,7 @@
             pParty->uFallSpeed = 0;
             fall_speed = 0;
             pParty->bFlying = true;
-            pModel = (BSPModel *)1;
+            pModel_ = true;
             if ( pZ <= v111 )
             {
               pParty->bFlying = false;
@@ -4009,31 +4010,27 @@
 
   pParty->sRotationY = _angle_y;
   pParty->sRotationX = _angle_x;
-  if ( pZ < v111 || pParty->bFlying)
+  //-------------------------------------------
+  if ( pParty->bFlying )
   {
-    if ( pParty->bFlying )
-    {
-      //v126 = stru_5C6E00->Cos(GetTickCount());
-      v129 = fixpoint_mul(4, cosf(GetTickCount()));
-      v129 = (unsigned __int64)(4i64 * stru_5C6E00->Cos(GetTickCount())) >> 16;
-      pZ = v113 + v129;
-      if ( pModel )
-        pZ = v113;
-      if (pParty->FlyActive())
-        stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE;
-      pParty->uFallStartY = pZ;
-    }
-    else
-    {
-      if ( is_on_water && fall_speed )
-        sub_42F960_create_object(pX, pY, v111);
-      fall_speed = 0;
-      pZ = v111;
-      pParty->uFallStartY = v111;
-      v113 = pZ;
-      if (pParty->FlyActive())
-        stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
-    }
+    v129 = fixpoint_mul(4, stru_5C6E00->Cos(GetTickCount()));
+    pZ = v113 + v129;
+    if ( pModel_ )
+      pZ = v113; // 
+    if (pParty->FlyActive())
+      stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE;
+    pParty->uFallStartY = pZ;
+  }
+  else if ( pZ < v111 )//   
+  {
+    if ( is_on_water && fall_speed )
+      sub_42F960_create_object(pX, pY, v111);
+    fall_speed = 0;
+    pZ = v111;
+    pParty->uFallStartY = v111;
+    v113 = pZ;
+    if (pParty->FlyActive())
+      stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
   }
   else
   {
@@ -4041,12 +4038,12 @@
     if (pParty->FlyActive())
       stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1;
   }
-
+  //------------------------------------------
   if (hovering && !pParty->bFlying)//  
   {
-    v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
-    v34 = fall_speed + 2 * v33;
-    fall_speed += 2 * v33;
+    //v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
+    v34 = fall_speed + 2 * -(pEventTimer->uTimeElapsed * GetGravityStrength());
+    fall_speed += 2 * -(pEventTimer->uTimeElapsed * GetGravityStrength());
   }
   else if (!partyAtHighSlope)
     v34 = fall_speed;
@@ -4054,36 +4051,38 @@
   {
     if ( !bmodel_standing_on_pid )
     {
-		// rolling down the hill
-		// how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
-		// and falling to the gravity, gradually sliding downwards. nice trick
-		pZ = v111;
-		ODM_GetTerrainNormalAt(pX, pY, &v98);
-		v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength()));
-		v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16;
-        v2 += fixpoint_mul(v129, (int)v98.x);
-        v1 += fixpoint_mul(v129, (int)v98.y);
-        v34 = v35 + fixpoint_mul(v129, (int)v98.z);
-		v128 = v1;
-		fall_speed = v34;
+      // rolling down the hill
+      // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air
+      // and falling to the gravity, gradually sliding downwards. nice trick
+      pZ = v111;
+      ODM_GetTerrainNormalAt(pX, pY, &v98);
+      v35 = fall_speed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength()));
+      v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16;
+      v2 += fixpoint_mul(v129, v98.x);
+      v1 += fixpoint_mul(v129, v98.y);
+      v34 = v35 + fixpoint_mul(v129, v98.z);
+      v128 = v1;
+      fall_speed = v34;
     }
   }
   else
     v34 = fall_speed;
 
-  if ( hovering )
+  if ( hovering )//   
   {
-	  if ( !bUnderwater && v34 <= 0)
-	  {
-		if ( v34 < -500 && !pParty->bFlying && pParty->vPosition.z - v111 > 1000 && !pParty->FeatherFallActive())
-		{ // falling scream
-		  for (int i = 0; i < 4; ++i)
-		  {
-            if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) && pParty->pPlayers[i].CanAct())
-              pParty->pPlayers[i].PlaySound(SPEECH_Falling_scream, 0);// 
-		  }
-		}
-	  }
+    if ( !bUnderwater && v34 <= 0)
+    {
+      if ( v34 < -500 && !pParty->bFlying && pParty->vPosition.z - v111 > 1000 && !pParty->FeatherFallActive())
+      { // falling scream
+        for (int i = 0; i < 4; ++i)
+        {
+          if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72)
+           && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS)
+           && pParty->pPlayers[i].CanAct())
+            pParty->pPlayers[i].PlaySound(SPEECH_Falling_scream, 0);// 
+        }
+      }
+    }
   }
   else
     pParty->uFallStartY = pZ;
@@ -4093,7 +4092,7 @@
     *(float *)&v128 = 0.0;
     v2 = 0;
   }
-//---------------------------------------------------------------------
+//--()-------------------------------------------------------------------
   stru_721530.field_84 = -1;
   stru_721530.field_70 = 0;
   stru_721530.prolly_normal_d = pParty->field_14_radius;
@@ -4137,14 +4136,14 @@
     {
       _angle_x = pX + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x);
       _angle_y = pY + fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y);
-      pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
+      //pModel = (BSPModel *)fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z);
       v40 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z) + pZ;
     }
     v122 = v40;
     ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
     v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0);
     int v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0);
-    pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
+    bool v42_ = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY);
     v42 = IsTerrainSlopeTooHigh(pX, _angle_y);
     is_not_on_bmodel = false;
     //v118 = v42;
@@ -4160,7 +4159,7 @@
     }
     else
     {
-      if ( pModel && v129 > pZ )
+      if ( v42_ && v129 > pZ )
         v44 = 0;
       if ( v42 && v119 > pZ )
         v43 = 0;
@@ -4174,8 +4173,8 @@
         pY = _angle_y;
       else
       {
-        pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
-        if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ )
+        int new_ = ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
+        if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && new_ <= pZ )
         {
           v43 = 1;
           pX = _angle_x;
@@ -4294,10 +4293,10 @@
         }
       }
     }
-    v2 = fixpoint_mul(58500, (int)v2);
-    v128 = fixpoint_mul(58500, (int)v128);
-    v122 = fixpoint_mul(58500, (int)v122);
-    fall_speed = fixpoint_mul(58500, (int)fall_speed);
+    v2 = fixpoint_mul(58500, v2);
+    v128 = fixpoint_mul(58500, v128);
+    v122 = fixpoint_mul(58500, v122);
+    fall_speed = fixpoint_mul(58500, fall_speed);
   }
 
   //  /------------------------
@@ -4347,13 +4346,15 @@
   int pMap_Y = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
   unsigned int v114_a = WorldPosToGridCellX(pX);
   v66 = WorldPosToGridCellZ(pY) - 1;
-  pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) >> 1) & 1);
-  v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) >> 1) & 1;
+  unsigned int v122_a = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) / 2) & 1;
+  v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) / 2) & 1;
+  v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) / 2) & 1;
+
+  //-(  )---------------------------------------
   v68 = 0;
-  v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) >> 1) & 1;
   if ( v114_a == pMap_X && v66 == pMap_Y && v122 && v69 )
     v68 = 1;
-  if ( !is_not_on_bmodel )
+  if ( !is_not_on_bmodel ) //  bmodel,
     v68 = 1;
   if ( v68 )
   {
@@ -4362,12 +4363,13 @@
     pParty->vPosition.z = pZ;
     pParty->field_6F0 = v113;
     pParty->uFallSpeed = fall_speed;
-    if ( pZ > 8160 )
+    if ( pZ > 8160 ) // 
     {
       pZ = 8160;
       pParty->uFallStartY = 8160;
       pParty->vPosition.z = 8160;
     }
+
     if ( !trigger_id //  
       || (EventProcessor(trigger_id, 0, 1),
          pParty->vPosition.x == pX)
@@ -4382,14 +4384,11 @@
         if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the ground(    )
         {
           if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
-          {
             pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
-          }
           else
           {
             for ( uint i = 1; i <= 4; ++i )
             {
-              //v110 = pPlayers[i]->GetMaxHealth();
               pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)pPlayers[i]->GetMaxHealth() * 0.1)) / 256,
                 DMGT_PHISYCAL);
               v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance());
@@ -4412,19 +4411,20 @@
     }
     return;
   }
+//-----------------------------------------------------------------
   //v76 = pParty->bFlying;
-  if ( pParty->bFlying || !high_fall_flag || bWaterWalk || !pModel )
+  if ( pParty->bFlying || !high_fall_flag || bWaterWalk || !v122_a )
     v77 = 1;
   else
     v77 = v122 != 0;
   bool party_drowning_flag = false;
-  if ( !pParty->bFlying && high_fall_flag && !bWaterWalk )
+  if ( !pParty->bFlying && high_fall_flag && !bWaterWalk ) // ,  ,    
   {
-    if ( pModel )
+    if ( v122_a )
       v78 = v69 != 0;
     else
     {
-      party_drowning_flag = true;
+      party_drowning_flag = true;//
       v78 = true;
     }
   }
@@ -4444,7 +4444,7 @@
       //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178;
       //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u;
       v79 = (int)&stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119];
-      *(short *)v79 |= 1u;
+      *(short *)v79 |= 1;
       if ( !v122 || !v69 )
       {
         if ( !pParty->bFlying )
@@ -4465,7 +4465,7 @@
   //v81 = pZ;
   //v82 = pZ;
   pParty->vPosition.z = pZ;
-  if ( pZ > 8160 )
+  if ( pZ > 8160 )//  
   {
     //v82 = 8160;
     pParty->uFallStartY = 8160;
@@ -4474,7 +4474,7 @@
   LOWORD(pParty->uFlags) &= 0xFDFBu;
   pParty->uFallSpeed = fall_speed;
   pParty->field_6F0 = v113;
-  if ( party_drowning_flag )
+  if ( party_drowning_flag )// 
   {
     pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1);
     if ( pParty->vPosition.z <= pTerrainHeight + 1 )//   +1
@@ -4495,9 +4495,7 @@
       if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the water(    )
       {
         if ( pParty->uFlags & PARTY_FLAGS_1_LANDING )
-        {
           pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
-        }
         else
         {
           for ( uint i = 1; i <= 4; ++i )