diff mm7_3.cpp @ 122:48bea61a12a5

Camera rotation fixed (even more!)
author Nomad
date Mon, 11 Feb 2013 18:22:21 +0200
parents fe0e317c0de0
children 1c471f3629fb
line wrap: on
line diff
--- a/mm7_3.cpp	Mon Feb 11 17:29:51 2013 +0200
+++ b/mm7_3.cpp	Mon Feb 11 18:22:21 2013 +0200
@@ -2553,7 +2553,7 @@
   angle = pParty->sRotationY;
   _view_angle = pParty->sRotationX;
   v82 = (unsigned __int64)(pEventTimer->dt_in_some_format
-                         * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed * stru_5C6E00->uIntegerPi)
+                         * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
                                           / 180)) >> 16;
 LABEL_87:
   while ( pPartyActionQueue->uNumActions )
@@ -3002,9 +3002,9 @@
   int v5; // eax@24
   int v6; // esi@45
   ODMFace *v7; // ecx@45
-  unsigned int v8; // eax@71
+  //unsigned int v8; // eax@71
   double v9; // st7@72
-  signed __int64 v10; // qax@74
+  //signed __int64 v10; // qax@74
   double v11; // st7@75
   int v12; // ecx@77
   int v13; // eax@84
@@ -3113,7 +3113,7 @@
   int v116; // [sp+58h] [bp-3Ch]@1
   int v117; // [sp+5Ch] [bp-38h]@1
   int v118; // [sp+60h] [bp-34h]@1
-  Player **v119; // [sp+64h] [bp-30h]@4
+  //Player **v119; // [sp+64h] [bp-30h]@4
   int _angle_x; // [sp+68h] [bp-2Ch]@48
   int v121; // [sp+6Ch] [bp-28h]@1
   unsigned int v122; // [sp+70h] [bp-24h]@180
@@ -3144,31 +3144,35 @@
   v102 = 0;
   v127 = 0;
   bWaterWalk = 0;
-  if ( SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0
-    || SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 )
+  if (!pParty->FeatherFallActive())
+      //SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0
+      //|| SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 )
   {
     bFeatherFall = 0;
-    v119 = &pPlayers[1];
+    /*v119 = &pPlayers[1];
     while ( !(*v119)->WearsItem(536, 16) )
     {
       ++v119;
       if ( (signed int)v119 > (signed int)&pPlayers[4] )
         goto LABEL_9;
-    }
-  }
-  bFeatherFall = 1;
-LABEL_9:
-  if ( (signed __int64)pParty->pPartyBuffs[18].uExpireTime <= 0 )
-  {
-    LOBYTE(pParty->uFlags) &= 0x7Fu;
-  }
-  else
-  {
-    LOBYTE(pParty->uFlags) &= 0x7Fu;
+    }*/
+    for (int i = 0; i < 4; ++i)
+      if (pParty->pPlayers[i].WearsItem(536, 16))  // seems like flying boots
+      {
+        bFeatherFall = 1;
+        break;
+      }
+  }
+//  bFeatherFall = 1;
+//LABEL_9:
+  LOBYTE(pParty->uFlags) &= 0x7Fu;
+  if (pParty->WaterWalkActive())
+  {
+    //LOBYTE(pParty->uFlags) &= 0x7Fu;
     bWaterWalk = 1;
     *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[18].uOverlayID + 119] |= 1u;
-    if ( !(pParty->pPartyBuffs[18].uFlags & 1)
-		&& pParty->pPlayers[pParty->pPartyBuffs[18].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
+    if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) &&
+		pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 )
       bWaterWalk = 0;
   }
   v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk);
@@ -3254,10 +3258,11 @@
   _angle_y = pParty->sRotationY;
   _angle_x = pParty->sRotationX;
   v126 = pEventTimer->dt_in_some_format;
-  v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
+  /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format
                                       * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed
                                                                     * stru_5C6E00->uIntegerPi)
-                                                       / 180)) >> 16);
+                                                       / 180)) >> 16);*/
+  __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16;
 LABEL_118:
   while ( pPartyActionQueue->uNumActions )
   {
@@ -3326,44 +3331,61 @@
         }
         goto LABEL_118;
       case PARTY_TurnLeft:
-        v8 = uTurnSpeed;
-        if ( uTurnSpeed )
-          goto LABEL_80;
-        v9 = (double)(signed int)v119 * fTurnSpeedMultiplier;
-        goto LABEL_73;
-      case PARTY_TurnRight:
-        LODWORD(v10) = uTurnSpeed;
+        //v8 = uTurnSpeed;
         if ( uTurnSpeed )
-          goto LABEL_77;
-        v11 = (double)(signed int)v119 * fTurnSpeedMultiplier;
-        goto LABEL_76;
-      case PARTY_FastTurnLeft:
-        v8 = uTurnSpeed;
+        {
+          v12 = uTurnSpeed + _angle_y;
+          _angle_y = stru_5C6E00->uDoublePiMask & v12;
+        }
+        else
+        {
+          v9 = (double)dturn * fTurnSpeedMultiplier;
+          _angle_y = stru_5C6E00->uDoublePiMask & (_angle_y + (unsigned __int64)(signed __int64)v9);
+        }
+        break;
+
+      case PARTY_TurnRight:
+        //LODWORD(v10) = uTurnSpeed;
         if ( uTurnSpeed )
         {
-LABEL_80:
-          v12 = v8 + _angle_y;
-LABEL_78:
+          v12 = _angle_y - uTurnSpeed;
+          _angle_y = stru_5C6E00->uDoublePiMask & v12;
+        }
+        else
+        {
+          v11 = (double)dturn * fTurnSpeedMultiplier;
+          v12 = _angle_y - (signed __int64)v11;
           _angle_y = stru_5C6E00->uDoublePiMask & v12;
         }
-        else
-        {
-          v9 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)(signed int)v119;
-LABEL_73:
+        break;
+
+      case PARTY_FastTurnLeft:
+        if ( uTurnSpeed )
+        {
+          v12 = uTurnSpeed + _angle_y;
+          _angle_y = stru_5C6E00->uDoublePiMask & v12;
+        }
+        else
+        {
+          v9 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)dturn;
           _angle_y = stru_5C6E00->uDoublePiMask & (_angle_y + (unsigned __int64)(signed __int64)v9);
         }
-        goto LABEL_118;
+        break;
+
       case PARTY_FastTurnRight:
-        LODWORD(v10) = uTurnSpeed;
         if ( !uTurnSpeed )
         {
-          v11 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)(signed int)v119;
-LABEL_76:
-          v10 = (signed __int64)v11;
-        }
-LABEL_77:
-        v12 = _angle_y - v10;
-        goto LABEL_78;
+          v11 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)dturn;
+          v12 = _angle_y - (signed __int64)v11;
+          _angle_y = stru_5C6E00->uDoublePiMask & v12;
+        }
+        else
+        {
+          v12 = _angle_y - uTurnSpeed;
+          _angle_y = stru_5C6E00->uDoublePiMask & v12;
+        }
+        break;
+
       case PARTY_StrafeLeft:
         v13 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
         v14 = (double)_walk_speed;
@@ -3690,7 +3712,7 @@
     v122 = v40;
     sub_46D49E_prolly_get_world_y_under_party(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
     v129 = sub_46D49E_prolly_get_world_y_under_party(_angle_x, v117, v40, pParty->uPartyHeight, &v130, &v97, 0);
-    v119 = (Player **)sub_46D49E_prolly_get_world_y_under_party(
+    auto v119 = sub_46D49E_prolly_get_world_y_under_party(
                         v116,
                         _angle_y,
                         v40,
@@ -3710,7 +3732,7 @@
       goto LABEL_197;
     if ( v127 && v129 > v123 )
       v44 = 0;
-    if ( v118 && (signed int)v119 > v123 )
+    if ( v118 && v119 > v123 )
       v43 = 0;
     if ( v44 )
       goto LABEL_197;
@@ -3791,7 +3813,7 @@
         v50 = v48 - 32 < 0;
         v52 = v47->pFacePlane.vNormal.z;
         v129 = (unsigned __int8)(v50 ^ v51 | v49);
-        v119 = (Player **)(v52 < 46378);
+        v119 = v52 < 46378;
         if ( bUnderwater == 1 )
           v119 = 0;
         v53 = v47->uPolygonType;