changeset 1061:89422dd58318

ODM_ProcessPartyActions cleaned of labels
author zipi
date Thu, 23 May 2013 22:07:17 +0100
parents b79139c3b5c8
children e23a79658fc5 e86b4951da70
files mm7_2.cpp mm7_3.cpp
diffstat 2 files changed, 419 insertions(+), 229 deletions(-) [+]
line wrap: on
line diff
--- a/mm7_2.cpp	Thu May 23 20:51:27 2013 +0100
+++ b/mm7_2.cpp	Thu May 23 22:07:17 2013 +0100
@@ -6815,7 +6815,13 @@
 
         case 101:  // Quit game
         case 40001:
-          SendMessageA(::hWnd, WM_DESTROY, 0, 0);
+        {
+          v38 = 0;
+          v37 = 0;
+          v36 = 2;
+          v35 = ::hWnd;
+          SendMessageA(::hWnd, WM_DESTROY, v37, v38);
+        }
         return 0;
 
 
@@ -7186,46 +7192,45 @@
     {
       if ( pVideoPlayer->pVideoFrame.pPixels )
         pVideoPlayer->bStopBeforeSchedule = 1;
-      if ( wParam == VK_RETURN )
-      {
-        if ( !viewparams->field_4C )
-          UI_OnKeyDown(wParam);
-        return 0;
-      }
-      if ( wParam == VK_CONTROL )
-      {
-        dword_507B98_ctrl_pressed = 1;
-        return 0;
-      }
-      if ( wParam == VK_ESCAPE )
-      {
-        pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0);
-        return 0;
-      }
-      if ( wParam <= VK_HOME )
-        return 0;
-      if ( wParam > VK_DOWN )
-      {
-        if ( wParam != VK_F4 || pVideoPlayer->AnyMovieLoaded() )
+      if ( wParam != VK_RETURN )
+      {
+        if ( wParam == VK_CONTROL )
+        {
+          dword_507B98_ctrl_pressed = 1;
+          return 0;
+        }
+        if ( wParam == VK_ESCAPE )
+        {
+          pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0);
+          return 0;
+        }
+        if ( wParam <= VK_HOME )
           return 0;
-        SendMessageA(hWnd, WM_COMMAND, 104, 0);
-        return 0;
-      }
-      if ( wParam >= VK_LEFT && wParam <= VK_DOWN )
-      {
-        if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
-        {
-          if ( !viewparams->field_4C )
-            UI_OnKeyDown(wParam);
+        if ( wParam > VK_DOWN )
+        {
+          if ( wParam != VK_F4 || pVideoPlayer->AnyMovieLoaded() )
+            return 0;
+          v38 = 0;
+          v37 = 104;
+//LABEL_126:
+          v36 = 273;
+          v35 = hWnd;
+          SendMessageA(hWnd, WM_COMMAND, v37, v38);
           return 0;
         }
-      }
-      if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
-        return 0;
+        if ( pCurrentScreen != SCREEN_GAME
+          && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
+          return 0;
+      }
+      if ( !viewparams->field_4C )
+        UI_OnKeyDown(wParam);
+      return 0;
     }
     pArcomageGame->stru1.field_0 = 1;
     if ( (unsigned __int16)GetAsyncKeyState(VK_SHIFT) >> 8 >= 0 )
+    {
       v27 = MapVirtualKeyA((unsigned __int16)wParam, 2u);
+    }
     else
     {
       v13 = (unsigned __int16)MapVirtualKeyA((unsigned __int16)wParam, 2u);
@@ -7233,7 +7238,8 @@
       {
         if ( v13 > 61 )
         {
-          if ( v13 == 91 )
+          v24 = v13 - 91;
+          if ( !v24 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 123;
             //goto LABEL_181;
@@ -7253,10 +7259,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 92 )
+          v25 = v24 - 1;
+          if ( !v25 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 124;
             //goto LABEL_181;
@@ -7276,10 +7288,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 93 )
+          v26 = v25 - 1;
+          if ( !v26 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 125;
             //goto LABEL_181;
@@ -7299,10 +7317,15 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 96 )
+          if ( v26 == 3 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 126;
             //goto LABEL_181;
@@ -7322,7 +7345,12 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
         }
@@ -7348,10 +7376,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 55 )
+          v21 = v13 - 55;
+          if ( !v21 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 38;
             //goto LABEL_181;
@@ -7371,10 +7405,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 56 )
+          v22 = v21 - 1;
+          if ( !v22 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 42;
             //goto LABEL_181;
@@ -7394,10 +7434,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 57 )
+          v23 = v22 - 1;
+          if ( !v23 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 40;
             //goto LABEL_181;
@@ -7417,10 +7463,15 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 59 )
+          if ( v23 == 2 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 58;
             //goto LABEL_181;
@@ -7440,7 +7491,12 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
         }
@@ -7467,12 +7523,18 @@
             //goto _def_wnd_proc;
             return DefWindowProcA(hWnd, Msg, wParam, lParam);
           }
-          SendMessageA(hWnd, WM_COMMAND, 103, 0);
+          v38 = 0;
+          v37 = 103;
+          //goto LABEL_126;
+          v36 = 273;
+          v35 = hWnd;
+          SendMessageA(hWnd, WM_COMMAND, v37, v38);
           return 0;
         }
         if ( v13 > 49 )
         {
-          if ( v13 == 50 )
+          v18 = v13 - 50;
+          if ( !v18 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 64;
             //goto LABEL_181;
@@ -7492,10 +7554,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 51 )
+          v19 = v18 - 1;
+          if ( !v19 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 35;
             //goto LABEL_181;
@@ -7515,10 +7583,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 52 )
+          v20 = v19 - 1;
+          if ( !v20 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 36;
             //goto LABEL_181;
@@ -7538,10 +7612,15 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 53 )
+          if ( v20 == 1 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 37;
             //goto LABEL_181;
@@ -7561,7 +7640,12 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
         }
@@ -7587,10 +7671,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 39 )
+          v14 = v13 - 39;
+          if ( !v14 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 34;
             //goto LABEL_181;
@@ -7610,10 +7700,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 44 )
+          v15 = v14 - 5;
+          if ( !v15 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 60;
             //goto LABEL_181;
@@ -7633,10 +7729,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 46 )
+          v16 = v15 - 2;
+          if ( !v16 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 62;
             //goto LABEL_181;
@@ -7656,10 +7758,16 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 47 )
+          v17 = v16 - 1;
+          if ( !v17 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 63;
             //goto LABEL_181;
@@ -7679,10 +7787,15 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
-          if ( v13 == 48 )
+          if ( v17 == 1 )
           {
             LOBYTE(pArcomageGame->stru1.field_8) = 41;
 //LABEL_181:
@@ -7702,7 +7815,12 @@
               //goto _def_wnd_proc;
               return DefWindowProcA(hWnd, Msg, wParam, lParam);
             }
-            SendMessageA(hWnd, WM_COMMAND, 103, 0);
+            v38 = 0;
+            v37 = 103;
+            //goto LABEL_126;
+            v36 = 273;
+            v35 = hWnd;
+            SendMessageA(hWnd, WM_COMMAND, v37, v38);
             return 0;
           }
         }
@@ -7727,7 +7845,12 @@
       //goto _def_wnd_proc;
       return DefWindowProcA(hWnd, Msg, wParam, lParam);
     }
-    SendMessageA(hWnd, WM_COMMAND, 103, 0);
+    v38 = 0;
+    v37 = 103;
+    //goto LABEL_126;
+    v36 = 273;
+    v35 = hWnd;
+    SendMessageA(hWnd, WM_COMMAND, v37, v38);
     return 0;
   }
   if ( Msg == WM_ACTIVATEAPP )
@@ -8917,7 +9040,7 @@
     switch ( uTurnSpeed )
     {
       case 0: // undefined turn option
-        __debugbreak(); // really shouldn't use this mode
+        //__debugbreak(); // really shouldn't use this mode
         uTurnSpeed = (unsigned int)uCPUSpeed < 199 ? 128 : 64; // adjust turn speed to estimated fps
       break;
 
--- a/mm7_3.cpp	Thu May 23 20:51:27 2013 +0100
+++ b/mm7_3.cpp	Thu May 23 22:07:17 2013 +0100
@@ -2230,7 +2230,9 @@
   v1 = 0;
   v103 = 0;
   v2 = 0;
-  *(float *)&v128 = 0.0;
+  //*(float *)&v128 = 0.0;
+  v128 = 0;
+  v129 = 0;
   pX = pParty->vPosition.x;
   pY = pParty->vPosition.y;
   v113 = pParty->field_6F0;
@@ -2648,14 +2650,14 @@
     }
   }
 
-LABEL_123:
+//LABEL_123:
   pParty->sRotationY = _angle_y;
   pParty->sRotationX = _angle_x;
-  if ( pZ < v111 )
+  if ( pZ < v111 || pParty->bFlying)
   {
     if ( pParty->bFlying )
     {
-LABEL_130:
+//LABEL_130:
       v31 = GetTickCount();
       v126 = stru_5C6E00->Cos(v31);
       v129 = (unsigned __int64)(4i64 * v126) >> 16;
@@ -2665,60 +2667,61 @@
       if (pParty->FlyActive())
         stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu;
       pParty->uFallStartY = pZ;
-      goto LABEL_141;
-    }
-    if ( v130 && v121 )
-      sub_42F960_create_object(pX, pY, v111);
-    v121 = 0;
-    pZ = v111;
-    pParty->uFallStartY = v111;
-  }
-  if ( pParty->bFlying )
-    goto LABEL_130;
-  v113 = pZ;
-  if (pParty->FlyActive())
-    stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
-
-LABEL_141:
+      //goto LABEL_141;
+    }
+	else
+	{
+		if ( v130 && v121 )
+		  sub_42F960_create_object(pX, pY, v111);
+		v121 = 0;
+		pZ = v111;
+		pParty->uFallStartY = v111;
+	    v113 = pZ;
+	    if (pParty->FlyActive())
+		  stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
+
+	}
+  }
+  else
+  {
+	  v113 = pZ;
+	  if (pParty->FlyActive())
+		stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
+  }
+//LABEL_141:
   if (bJumping && !pParty->bFlying)
   {
     v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
     v34 = v121 + 2 * v33;
     v121 += 2 * v33;
-    goto LABEL_164;
-  }
-  if (!partyAtHighSlope)
+  }
+  else if (!partyAtHighSlope)
   {
     v34 = v121;
-    if (!bJumping)
-      goto LABEL_150;
-    goto LABEL_164;
-  }
-  if (!bJumping)
-  {
-    if ( v108 )
-      goto LABEL_150;
-
-    // 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 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
-    v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
-    v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
-    v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
-    v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
-    v128 = v1;
-    v121 = v34;
-    if (!bJumping)
-      goto LABEL_150;
-    goto LABEL_164;
-  }
-  v34 = v121;
-
-LABEL_164:
-  if ( !bUnderwater && v34 <= 0)
+  }
+  else if (!bJumping)
+  {
+    if ( !v108 )
+	{
+		// 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 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
+		v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
+		v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
+		v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
+		v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
+		v128 = v1;
+		v121 = v34;
+	}
+  }
+  else
+	  v34 = v121;
+
+//LABEL_164:
+  if ( !bUnderwater && v34 <= 0 && bJumping)
   {
     if ( v34 < -500
       && !pParty->bFlying
@@ -2735,7 +2738,7 @@
   }
   else
   {
-LABEL_150:
+//LABEL_150:
   pParty->uFallStartY = pZ;
   }
 
@@ -2801,27 +2804,37 @@
     v43 = 1;
     v44 = 1;
     if ( bUnderwater || !v107 )
-      goto LABEL_197;
-    if ( v127 && v129 > pZ )
-      v44 = 0;
-    if ( v118 && v119 > pZ )
-      v43 = 0;
-    if ( v44 )
-      goto LABEL_197;
-    if ( v43 )
-      goto LABEL_198;
-    v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
-    if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ )
-    {
-      v43 = 1;
-LABEL_197:
-      pX = _angle_x;
-      if ( !v43 )
-        goto LABEL_199;
-LABEL_198:
-      pY = _angle_y;
-    }
-LABEL_199:
+	{
+		  pX = _angle_x;
+		  if ( v43 )
+			  pY = _angle_y;
+	}
+	else
+	{
+		if ( v127 && v129 > pZ )
+		  v44 = 0;
+		if ( v118 && v119 > pZ )
+		  v43 = 0;
+		if ( v44 )
+		{
+			  pX = _angle_x;
+			  if ( v43 )
+				  pY = _angle_y;
+		}
+		else if ( v43 )
+		  pY = _angle_y;
+		else
+		{
+			v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0);
+			if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ )
+			{
+			  v43 = 1;
+			  pX = _angle_x;
+			  if ( v43 )
+				  pY = _angle_y;
+			}
+		}
+	}
     if ( stru_721530.field_7C >= stru_721530.field_6C )
     {
       if ( !v107 )
@@ -2843,8 +2856,14 @@
         pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
 
       viewparams->bRedrawGameUI = 1;
-      goto LABEL_234;
-    }
+		v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+		v127 = (BSPModel *)58500;
+		v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+		v122 = (unsigned __int64)(58500i64 * v121) >> 16;
+		++v126;
+		v121 = (unsigned __int64)(58500i64 * v121) >> 16;
+		continue;
+	}
     if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
     {
       v56 = integer_sqrt(v2 * v2 + v128 * v128);
@@ -2884,15 +2903,26 @@
         v53 = v47->uPolygonType;
         if ( v53 == 3 )
         {
-          if ( v121 < 0 )
-            v121 = 0;
-          pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1;
-          if ( v2 * v2 + v128 * v128 < 400 )
-          {
-            v2 = 0;
-            *(float *)&v128 = 0.0;
-          }
-          goto LABEL_221;
+			if ( v121 < 0 )
+				v121 = 0;
+			pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1;
+			if ( v2 * v2 + v128 * v128 < 400 )
+			{
+				v2 = 0;
+				*(float *)&v128 = 0.0;
+			}
+			if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
+			{
+				pParty->floor_face_pid = v45;
+				v103 = v47->sCogTriggeredID;
+			}
+			v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+			v127 = (BSPModel *)58500;
+			v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+			v122 = (unsigned __int64)(58500i64 * v121) >> 16;
+			++v126;
+			v121 = (unsigned __int64)(58500i64 * v121) >> 16;
+			continue;
         }
         if ( !v129 && (v53 != 4 || v119) )
         {
@@ -2925,15 +2955,20 @@
             if ( !v119 )
               pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16);
           }
-LABEL_220:
-          v45 = stru_721530.uFaceID;
-LABEL_221:
-          if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
-          {
-            pParty->floor_face_pid = v45;
-            v103 = v47->sCogTriggeredID;
-          }
-          goto LABEL_234;
+//LABEL_220:
+			v45 = stru_721530.uFaceID;
+			if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
+			{
+				pParty->floor_face_pid = v45;
+				v103 = v47->sCogTriggeredID;
+			}
+			v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+			v127 = (BSPModel *)58500;
+			v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+			v122 = (unsigned __int64)(58500i64 * v121) >> 16;
+			++v126;
+			v121 = (unsigned __int64)(58500i64 * v121) >> 16;
+			continue;
         }
         v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16;
         if ( stru_721530.field_64 >> 3 > v118 )
@@ -2948,13 +2983,27 @@
         v2 += v122;
         v128 += (int)v127;
         if ( v2 * v2 + v128 * v128 >= 400 )
-          goto LABEL_220;
+		{
+			v45 = stru_721530.uFaceID;
+			if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 )
+			{
+				pParty->floor_face_pid = v45;
+				v103 = v47->sCogTriggeredID;
+			}
+			v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+			v127 = (BSPModel *)58500;
+			v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+			v122 = (unsigned __int64)(58500i64 * v121) >> 16;
+			++v126;
+			v121 = (unsigned __int64)(58500i64 * v121) >> 16;
+			continue;
+		}
         v2 = 0;
         v121 = 0;
         *(float *)&v128 = 0.0;
       }
     }
-LABEL_234:
+//LABEL_234:
     v2 = (unsigned __int64)(58500i64 * v2) >> 16;
     v127 = (BSPModel *)58500;
     v128 = (unsigned __int64)(58500i64 * v128) >> 16;
@@ -2969,54 +3018,71 @@
     v126 = abs(pParty->vPosition.y - pY);
     v62 = abs(pParty->vPosition.z - pZ);
     if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )
-      goto LABEL_344;
-    if ( v114 && (!bJumping || v101) )
-    {
-      if ( !v107
-        && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
-      {
+	{
+		  pAudioPlayer->_4AA258(804);
+		  pParty->walk_sound_timer = 64;
+	}
+	else
+	{
+		if ( v114 && (!bJumping || v101) )
+		{
+		  if ( !v107
+			&& !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) )
+		  {
         
-        v90 = -1;
-        v89 = 1;
-        v88 = 804;
-        v87 = 64;
-        goto LABEL_257;
-      }
-     
-      v90 = -1;
-      v89 = 1;
-      v88 = 804;
-      v86 = 1;
-LABEL_255:
-      v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
-      v64 = WorldPosToGridCellX(pParty->vPosition.x);
-      v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86);
-      goto LABEL_257;
-    }
-    if ( v124 && (!bJumping || v101) )
-    {
-      if ( v107
-        || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
-      {
+			v90 = -1;
+			v89 = 1;
+			v88 = 804;
+			v87 = 64;
+			pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
+		  }
+		  else
+		  {
+			v90 = -1;
+			v89 = 1;
+			v88 = 804;
+			v86 = 1;
+		//LABEL_255:
+			v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
+			v64 = WorldPosToGridCellX(pParty->vPosition.x);
+			v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86);
+			pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
+		  }
+		}
+		else
+		{
+			if ( v124 && (!bJumping || v101) )
+			{
+			  if ( v107
+				|| BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 )
+			  {
         
-        v90 = -1;
-        v89 = 1;
-        v88 = 804;
-        v86 = 0;
-        goto LABEL_255;
-      }
-      v90 = -1;
-      v89 = 1;
-      v88 = 804;
-      v87 = 103;
-LABEL_257:
-      pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
-    }
-    else
-    {
-LABEL_344:
-      pAudioPlayer->_4AA258(804);
-      pParty->walk_sound_timer = 64;
+				v90 = -1;
+				v89 = 1;
+				v88 = 804;
+				v86 = 0;
+				v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1;
+				v64 = WorldPosToGridCellX(pParty->vPosition.x);
+				v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86);
+				pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
+			  }
+			  else
+			  {
+				  v90 = -1;
+				  v89 = 1;
+				  v88 = 804;
+				  v87 = 103;
+			//LABEL_257:
+				  pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0);
+			  }
+			}
+			else
+			{
+		//LABEL_344:
+			  pAudioPlayer->_4AA258(804);
+			  pParty->walk_sound_timer = 64;
+			}
+		}
     }
   }
   if ( !bJumping || v101 )
@@ -3113,24 +3179,26 @@
     if ( v127 )
     {
       v78 = v69 != 0;
-      goto LABEL_306;
-    }
-    v114 = 1;
-  }
-  v78 = 1;
-LABEL_306:
+    }
+	else
+	{
+		v114 = 1;
+		v78 = 1;
+	}
+  }
+  else
+	v78 = 1;
+//LABEL_306:
   if ( v77 )
   {
     pParty->vPosition.x = pX;
-    if ( !v78 )
-      goto LABEL_313;
-    goto LABEL_312;
   }
   if ( v78 )
   {
-LABEL_312:
     pParty->vPosition.y = pY;
-LABEL_313:
+  }
+  if ( v78 || v77)
+  {
     if ( bWaterWalk )
     {
       pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER;
@@ -3148,14 +3216,13 @@
         }
       }
     }
-    goto LABEL_318;
-  }
-  if ( bWalkSound && pParty->walk_sound_timer <= 0 )
+  }
+  else if ( bWalkSound && pParty->walk_sound_timer <= 0 )
   {
     pAudioPlayer->_4AA258(804);
     pParty->walk_sound_timer = 64;
   }
-LABEL_318:
+//LABEL_318:
   v81 = pZ;
   v82 = pZ;
   pParty->vPosition.z = pZ;