diff mm7_3.cpp @ 1546:9a6567c6c76c

stru141 & misc cleaning
author Nomad
date Sat, 07 Sep 2013 21:55:02 +0200
parents c4ab816fcc5e
children 0311debb684c
line wrap: on
line diff
--- a/mm7_3.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/mm7_3.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -158,14 +158,14 @@
           {
             a3 = stru_721530.field_6C;
             if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
-                   stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
+                   stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) )
             {
               v17 = a3;
             }
             else
             {
               a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
-              if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) )
+              if ( !sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, pFace) )
                 goto LABEL_34;
               v17 = a3 - stru_721530.prolly_normal_d;
               a3 -= stru_721530.prolly_normal_d;
@@ -185,8 +185,8 @@
         || (v19 = pFace->pFacePlane_old.vNormal.x,
             v20 = pFace->pFacePlane_old.vNormal.y,
             v30 = v19,
-            v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20
-                 + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16,
+            v21 = (stru_721530.position.x * v19 + pFace->pFacePlane_old.dist + stru_721530.position.y * v20
+                 + stru_721530.position.z * pFace->pFacePlane_old.vNormal.z) >> 16,
             v21 <= 0)
         || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20
                  + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16,
@@ -195,14 +195,14 @@
         || v22 > v21 )
         goto LABEL_45;
       a3 = stru_721530.field_6C;
-      if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z,
-             stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
+      if ( sub_47531C(stru_721530.field_8_radius, &a3, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z,
+             stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) )
       {
         v23 = a3;
         goto LABEL_43;
       }
-      a3 = stru_721530.field_6C + stru_721530.field_8;
-      if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) )
+      a3 = stru_721530.field_6C + stru_721530.field_8_radius;
+      if ( sub_475D85(&stru_721530.position, &stru_721530.direction, &a3, pFace) )
       {
         v23 = a3 - stru_721530.prolly_normal_d;
         a3 -= stru_721530.prolly_normal_d;
@@ -371,9 +371,9 @@
                  stru_721530.normal.x,
                  stru_721530.normal.y,
                  stru_721530.normal.z,
-                 stru_721530.field_58.x,
-                 stru_721530.field_58.y,
-                 stru_721530.field_58.z,
+                 stru_721530.direction.x,
+                 stru_721530.direction.y,
+                 stru_721530.direction.z,
                  &f,
                  a10,
                  a11) )
@@ -382,8 +382,8 @@
           }
           else
           {
-            v11 = stru_721530.field_58.y;
-            v12 = stru_721530.field_58.z;
+            v11 = stru_721530.direction.y;
+            v12 = stru_721530.direction.z;
             v13 = stru_721530.normal.y;
             a2 = stru_721530.prolly_normal_d + stru_721530.field_6C;
             if ( !sub_475F30(
@@ -392,7 +392,7 @@
                     stru_721530.normal.x,
                     v13,
                     stru_721530.normal.z,
-                    stru_721530.field_58.x,
+                    stru_721530.direction.x,
                     v11,
                     v12,
                     a10) )
@@ -413,10 +413,10 @@
 LABEL_29:
     if ( stru_721530.field_0 & 1 )
     {
-      v15 = (f.pFacePlane_old.vNormal.z * stru_721530.field_34.z
+      v15 = (f.pFacePlane_old.vNormal.z * stru_721530.position.z
            + f.pFacePlane_old.dist
-           + f.pFacePlane_old.vNormal.y * stru_721530.field_34.y
-           + f.pFacePlane_old.vNormal.x * stru_721530.field_34.x) >> 16;
+           + f.pFacePlane_old.vNormal.y * stru_721530.position.y
+           + f.pFacePlane_old.vNormal.x * stru_721530.position.x) >> 16;
       if ( v15 > 0 )
       {
         v16 = (f.pFacePlane_old.vNormal.z * stru_721530.field_54
@@ -428,15 +428,14 @@
           if ( v16 <= v15 )
           {
             a2 = stru_721530.field_6C;
-            if ( sub_4754BF(
-                   stru_721530.field_8,
+            if ( sub_4754BF(stru_721530.field_8_radius,
                    &a2,
-                   stru_721530.field_34.x,
-                   stru_721530.field_34.y,
-                   stru_721530.field_34.z,
-                   stru_721530.field_58.x,
-                   stru_721530.field_58.y,
-                   stru_721530.field_58.z,
+                   stru_721530.position.x,
+                   stru_721530.position.y,
+                   stru_721530.position.z,
+                   stru_721530.direction.x,
+                   stru_721530.direction.y,
+                   stru_721530.direction.z,
                    &f,
                    a10,
                    a11) )
@@ -451,17 +450,16 @@
             }
             else
             {
-              v18 = stru_721530.field_58.y;
-              v19 = stru_721530.field_58.z;
-              v20 = stru_721530.field_34.y;
-              a2 = stru_721530.field_6C + stru_721530.field_8;
-              if ( sub_475F30(
-                     &a2,
+              v18 = stru_721530.direction.y;
+              v19 = stru_721530.direction.z;
+              v20 = stru_721530.position.y;
+              a2 = stru_721530.field_6C + stru_721530.field_8_radius;
+              if ( sub_475F30(&a2,
                      &f,
-                     stru_721530.field_34.x,
+                     stru_721530.position.x,
                      v20,
-                     stru_721530.field_34.z,
-                     stru_721530.field_58.x,
+                     stru_721530.position.z,
+                     stru_721530.direction.x,
                      v18,
                      v19,
                      a10) )
@@ -562,15 +560,15 @@
                     {
                       v8 = v4 - stru_721530.normal.x;
                       v9 = v5 - stru_721530.normal.y;
-                      if ( abs(((v4 - stru_721530.normal.x) * stru_721530.field_58.y
-                              - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16) <= v3
+                      if ( abs(((v4 - stru_721530.normal.x) * stru_721530.direction.y
+                              - (v5 - stru_721530.normal.y) * stru_721530.direction.x) >> 16) <= v3
                                                                                               + stru_721530.prolly_normal_d )
                       {
-                        v10 = (v8 * stru_721530.field_58.x + v9 * stru_721530.field_58.y) >> 16;
+                        v10 = (v8 * stru_721530.direction.x + v9 * stru_721530.direction.y) >> 16;
                         if ( v10 > 0 )
                         {
                           v11 = stru_721530.normal.z
-                              + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v10) >> 16);
+                              + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v10) >> 16);
                           if ( v11 >= *(int *)(v14 + 10) - stru_721530.prolly_normal_d )
                           {
                             if ( v11 <= v13 + stru_721530.prolly_normal_d + *(int *)(v14 + 10) )
@@ -598,7 +596,7 @@
 }
 
 //----- (0046EF01) --------------------------------------------------------
-int  _46EF01_collision_chech_player(int a1)
+int _46EF01_collision_chech_player(int a1)
 {
   int v1; // edx@1
   int result; // eax@1
@@ -613,10 +611,10 @@
   int v11; // [sp+18h] [bp-4h]@7
 
   v8 = a1;
-  v1 = 2 * pParty->field_14;
+  v1 = 2 * pParty->field_14_radius;
   result = pParty->vPosition.x;
   v9 = pParty->uPartyHeight;
-  if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14 )
+  if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14_radius )
   {
     if ( stru_721530.sMinX >= pParty->vPosition.x - v1 )
     {
@@ -630,18 +628,18 @@
             {
               v3 = stru_721530.prolly_normal_d + v1;
               v11 = pParty->vPosition.x - stru_721530.normal.x;
-              v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y
-                  - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
+              v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
+                  - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16;
               v10 = pParty->vPosition.y - stru_721530.normal.y;
-              result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y
-                          - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16);
+              result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y
+                          - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16);
               if ( result <= v3 )
               {
-                result = v10 * stru_721530.field_58.y;
-                v5 = (v10 * stru_721530.field_58.y + v11 * stru_721530.field_58.x) >> 16;
+                result = v10 * stru_721530.direction.y;
+                v5 = (v10 * stru_721530.direction.y + v11 * stru_721530.direction.x) >> 16;
                 if ( v5 > 0 )
                 {
-                  v6 = ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v5) >> 16) + stru_721530.normal.z;
+                  v6 = ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v5) >> 16) + stru_721530.normal.z;
                   result = pParty->vPosition.z;
                   if ( v6 >= pParty->vPosition.z )
                   {
@@ -708,17 +706,15 @@
             && stru_721530.sMaxZ <= v3->pBounding.z2
             && stru_721530.sMinZ >= v3->pBounding.z1 )
           {
-            v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x
-                + v3->pFacePlane_old.dist
+            v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x + v3->pFacePlane_old.dist
                 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y
                 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16;
-            v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z
-                + v3->pFacePlane_old.dist
+            v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z + v3->pFacePlane_old.dist
                 + stru_721530.normal2.x * v3->pFacePlane_old.vNormal.x
                 + stru_721530.normal2.y * v3->pFacePlane_old.vNormal.y) >> 16;
             if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d)
               && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d)
-              && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v3))
+              && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, v3))
               && a3 < (signed int)v10 )
             {
               v0 = v9;
@@ -756,13 +752,13 @@
 }
 
 //----- (0047050A) --------------------------------------------------------
-int stru141::_47050A(int a2)
+int stru141_actor_collision_object::_47050A(int dt)
 {
-  stru141 *v2; // esi@1
-  signed int v3; // eax@1
-  int v4; // ecx@1
-  int v5; // edx@1
-  int v6; // edx@1
+  stru141_actor_collision_object *v2; // esi@1
+  //signed int v3; // eax@1
+  //int v4; // ecx@1
+  //int v5; // edx@1
+  //int v6; // edx@1
   int v7; // eax@1
   int v8; // eax@3
   signed int result; // eax@4
@@ -787,34 +783,36 @@
   int v28; // [sp+14h] [bp+8h]@5
 
   v2 = this;
-  v3 = integer_sqrt(this->field_24 * this->field_24 + this->field_20 * this->field_20 + this->field_1C * this->field_1C);
-  v4 = v3 | 1;
-  v5 = v2->field_1C;
-  v2->field_64 = v3 | 1;
-  v2->field_58.x = 65536 / (v3 | 1) * v5;
-  v2->field_58.y = 65536 / (v3 | 1) * v2->field_20;
-  v6 = 65536 / (v3 | 1) * v2->field_24;
-  v2->field_68 = 65536 / (v3 | 1);
-  v7 = a2;
-  v2->field_58.z = v6;
-  if ( !a2 )
+  int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x);
+
+  v2->direction.x = 65536 / speed * v2->velocity.x;
+  v2->direction.y = 65536 / speed * v2->velocity.y;
+  v2->direction.z = 65536 / speed * v2->velocity.z;
+
+  v2->speed = speed;
+  v2->inv_speed = 65536 / speed;
+
+  if (dt)
+    v7 = dt;
+  else
     v7 = pEventTimer->dt_in_some_format;
-  v8 = fixpoint_sub0(v7, v4) - v2->field_70;
+
+  v8 = fixpoint_sub0(v7, speed) - v2->field_70; // speed * dt - something
   v2->field_6C = v8;
   if ( v8 > 0 )
   {
-    v10 = fixpoint_sub0(v8, v2->field_58.x) + v2->normal.x;
+    v10 = fixpoint_sub0(v8, v2->direction.x) + v2->normal.x;
     v2->field_4C = v10;
     v2->normal2.x = v10;
-    v11 = fixpoint_sub0(v2->field_6C, v2->field_58.y) + v2->normal.y;
+    v11 = fixpoint_sub0(v2->field_6C, v2->direction.y) + v2->normal.y;
     v2->field_50 = v11;
     v2->normal2.y = v11;
-    v2->normal2.z = fixpoint_sub0(v2->field_6C, v2->field_58.z) + v2->normal.z;
-    v12 = v2->field_34.z;
+    v2->normal2.z = fixpoint_sub0(v2->field_6C, v2->direction.z) + v2->normal.z;
+    v12 = v2->position.z;
     v13 = v2->normal.x;
     v14 = v2->normal2.x;
     v15 = v2->prolly_normal_d;
-    v16 = v12 + fixpoint_sub0(v2->field_6C, v2->field_58.z);
+    v16 = v12 + fixpoint_sub0(v2->field_6C, v2->direction.z);
     v28 = v16;
     v2->field_54 = v16;
     v17 = v13;
@@ -842,7 +840,7 @@
     else
       v25 = v24 - v15;
     v2->sMaxZ = v25;
-    v26 = v2->field_8;
+    v26 = v2->field_8_radius;
     if ( v12 <= v28 )
       v27 = v28 + v26;
     else
@@ -891,7 +889,7 @@
   //__int16 v24; // ax@42
   int v25; // eax@45
   signed int v26; // ecx@50
-  int v27; // eax@52
+  //int v27; // eax@52
   int v28; // eax@54
   signed int v29; // ebx@57
   signed int v30; // eax@57
@@ -1063,28 +1061,28 @@
       v26 = 40;
     else
       v26 = v0->uActorRadius;
-    v27 = v0->uActorHeight;
+
     stru_721530.field_84 = -1;
-    stru_721530.field_8 = v26;
+    stru_721530.field_8_radius = v26;
     stru_721530.prolly_normal_d = v26;
-    stru_721530.field_C = v27;
+    stru_721530.height = v0->uActorHeight;
     stru_721530.field_70 = 0;
     v69 = 0;
     while ( 1 )
     {
-      stru_721530.field_34.x = v0->vPosition.x;
-      stru_721530.normal.x = stru_721530.field_34.x;
-      stru_721530.field_34.y = v0->vPosition.y;
-      stru_721530.normal.y = stru_721530.field_34.y;
+      stru_721530.position.x = v0->vPosition.x;
+      stru_721530.normal.x = stru_721530.position.x;
+      stru_721530.position.y = v0->vPosition.y;
+      stru_721530.normal.y = stru_721530.position.y;
       v28 = v0->vPosition.z;
       stru_721530.normal.z = v28 + v26 + 1;
-      stru_721530.field_34.z = v28 - v26 + stru_721530.field_C - 1;
-      if ( stru_721530.field_34.z < stru_721530.normal.z )
-        stru_721530.field_34.z = v28 + v26 + 1;
-      stru_721530.field_1C = v0->vVelocity.x;
+      stru_721530.position.z = v28 - v26 + stru_721530.height - 1;
+      if ( stru_721530.position.z < stru_721530.normal.z )
+        stru_721530.position.z = v28 + v26 + 1;
+      stru_721530.velocity.x = v0->vVelocity.x;
       stru_721530.uSectorID = 0;
-      stru_721530.field_20 = v0->vVelocity.y;
-      stru_721530.field_24 = v0->vVelocity.z;
+      stru_721530.velocity.y = v0->vVelocity.y;
+      stru_721530.velocity.z = v0->vVelocity.z;
       if ( stru_721530._47050A(0) )
         break;
       _46E889_collide_against_bmodels(1u);
@@ -1102,7 +1100,7 @@
       }
       v71 = i > 1;
       if ( stru_721530.field_7C < stru_721530.field_6C )
-        v70 = fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.z);
+        v70 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
       //v34 = 0;
       v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
       v36 = ODM_GetFloorLevel(stru_721530.normal2.x,
@@ -1136,11 +1134,11 @@
         break;
       }
       //v72b = fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.x);
-      v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.x);
+      v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
       //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.y);
+      v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
       //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-      v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.z);
+      v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
       v38 = stru_721530.uFaceID;
       stru_721530.field_70 += stru_721530.field_7C;
 	  v39 = PID_ID(v38);
@@ -1223,8 +1221,8 @@
             {
               v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z
                                                                     + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16;
-              if ( stru_721530.field_64 >> 3 > v72b )
-                v72b = stru_721530.field_64 >> 3;
+              if ( (stru_721530.speed >> 3) > v72b )
+                v72b = stru_721530.speed >> 3;
 
               v0->vVelocity.x += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.x);
               v0->vVelocity.y += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.y);
@@ -1701,37 +1699,37 @@
         break;
 
       case PARTY_StrafeLeft:
-        v2 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        v1 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
+        v2 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
+        v1 += fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
         v78 = 1;
         break;
       case PARTY_StrafeRight:
-        v2 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        v1 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16;
+        v2 += fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
+        v1 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
         v78 = 1;
         break;
       case PARTY_WalkForward:
-        v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16;
-        v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16;
+        v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier);
+        v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier);
         v78 = 1;
         break;
       case PARTY_WalkBackward:
-        v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
-        v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
+        v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
+        v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
         v78 = 1;
         break;
       case PARTY_RunForward:
-        v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
-        v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16;
+        v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier);
+        v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier);
         v72 = 1;
         break;
       case PARTY_RunBackward:
         //v32 = stru_5C6E00->SinCos(angle);
         //v33 = (double)v81;
         //v88 = (double)v81;
-        v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
+        v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
         //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
-        v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
+        v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
         v72 = 1;
         break;
       case PARTY_LookUp:
@@ -1808,23 +1806,23 @@
   }
   stru_721530.field_84 = -1;
   stru_721530.field_70 = 0;
-  stru_721530.prolly_normal_d = pParty->field_14;
-  stru_721530.field_8 = pParty->field_14 >> 1;
+  stru_721530.prolly_normal_d = pParty->field_14_radius;
+  stru_721530.field_8_radius = pParty->field_14_radius / 2;
   auto v83 = 0;
   stru_721530.field_0 = 1;
-  stru_721530.field_C = pParty->uPartyHeight - 32;
+  stru_721530.height = pParty->uPartyHeight - 32;
   while ( 1 )
   {
     new_party_z = party_z;
-    stru_721530.field_34.x = new_party_x;
+    stru_721530.position.x = new_party_x;
     stru_721530.normal.x = new_party_x;
-    stru_721530.field_1C = v2;
-    stru_721530.field_34.y = new_party_y;
+    stru_721530.velocity.x = v2;
+    stru_721530.position.y = new_party_y;
     stru_721530.normal.y = new_party_y;
-    stru_721530.field_20 = v1;
+    stru_721530.velocity.y = v1;
     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 = pParty->uFallSpeed;
+    stru_721530.position.z = stru_721530.height + party_z + 1;
+    stru_721530.velocity.z = pParty->uFallSpeed;
     stru_721530.uSectorID = uSectorID;
     v38 = 0;
     if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
@@ -1851,9 +1849,9 @@
     }
     else
     {
-      v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + new_party_x;
-      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);
+      v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x;
+      uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
+      v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
     }
     v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
     if ( v42 == -30000 || v42 - new_party_z > 128 )
@@ -1865,12 +1863,12 @@
       new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
       break;
     }
-    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;
+    new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
+    new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
     v43 = stru_721530.uFaceID;
     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;
+    auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z;
     if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
     {
       if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
@@ -1917,8 +1915,8 @@
 			if ( !v47 )
 			{
 			  v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
-			  if ( stru_721530.field_64 >> 3 > v80 )
-				v80 = stru_721530.field_64 >> 3;
+			  if ((stru_721530.speed >> 3) > v80 )
+				v80 = stru_721530.speed >> 3;
 			  v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
 			  v81 = v44->pFacePlane_old.vNormal.y;
 			  v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
@@ -1945,8 +1943,8 @@
 			else
 			{
 				v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
-				if ( stru_721530.field_64 >> 3 > v80 )
-				  v80 = stru_721530.field_64 >> 3;
+				if ((stru_721530.speed >> 3) > v80 )
+				  v80 = stru_721530.speed >> 3;
 				v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
 				v81 = v44->pFacePlane_old.vNormal.y;
 				v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
@@ -2661,22 +2659,22 @@
   }
   stru_721530.field_84 = -1;
   stru_721530.field_70 = 0;
-  stru_721530.prolly_normal_d = pParty->field_14;
-  stru_721530.field_8 = pParty->field_14 >> 1;
+  stru_721530.prolly_normal_d = pParty->field_14_radius;
+  stru_721530.field_8_radius = pParty->field_14_radius >> 1;
   v126 = 0;
   stru_721530.field_0 = 1;
-  stru_721530.field_C = pParty->uPartyHeight - 32;
+  stru_721530.height = pParty->uPartyHeight - 32;
   do
   {
-    stru_721530.field_34.x = pX;
+    stru_721530.position.x = pX;
     stru_721530.normal.x = pX;
-    stru_721530.field_1C = v2;
-    stru_721530.field_34.y = pY;
+    stru_721530.velocity.x = v2;
+    stru_721530.position.y = pY;
     stru_721530.normal.y = pY;
     stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1;
-    stru_721530.field_34.z = stru_721530.field_C + pZ + 1;
-    stru_721530.field_20 = v128;
-    stru_721530.field_24 = pParty->uFallSpeed;
+    stru_721530.position.z = stru_721530.height + pZ + 1;
+    stru_721530.velocity.y = v128;
+    stru_721530.velocity.z = pParty->uFallSpeed;
     v36 = 0;
     stru_721530.uSectorID = 0;
     if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
@@ -2698,10 +2696,10 @@
     }
     else
     {
-      _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
-      _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
-      pModel = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
-      v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ;
+      _angle_x = pX + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+      _angle_y = pY + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+      pModel = (BSPModel *)fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
+      v40 = fixpoint_sub0(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);
@@ -2837,8 +2835,8 @@
         if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб
         {
           v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
-          if ( stru_721530.field_64 >> 3 > v118 )
-            v118 = stru_721530.field_64 >> 3;
+          if ((stru_721530.speed >> 3) > v118 )
+            v118 = stru_721530.speed >> 3;
           v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16;
           _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16;
           v54 = 0;
@@ -2879,8 +2877,8 @@
 			continue;
         }
         v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
-        if ( stru_721530.field_64 >> 3 > v118 )
-          v118 = stru_721530.field_64 >> 3;
+        if ((stru_721530.speed >> 3) > v118 )
+          v118 = stru_721530.speed >> 3;
         v122 = pODMFace->pFacePlane.vNormal.x;
         v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16;
         pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y;
@@ -6838,7 +6836,7 @@
             v12 = v11->sCogTriggeredID;
             if ( v12 )
             {
-              if ( !(BYTE2(v11->uAttributes) & 0x10) )
+              if ( !(v11->uAttributes & 0x100000) )
               {
                 v13 = GetEventHintString(v12);
                 v14 = v13;
@@ -6905,7 +6903,7 @@
 }
 
 //----- (004452BB) --------------------------------------------------------
-void  sub_4452BB()
+void sub_4452BB()
 {
   pGUIWindow2->Release();
   pGUIWindow2 = 0;
@@ -7386,7 +7384,7 @@
   if ( v10 )
   {
     v11 = uNumActors;
-    SpawnEncounter((MapInfo *)&pMapStats->pInfos[v10], &v16, 0, count, 0);
+    SpawnEncounter(&pMapStats->pInfos[v10], &v16, 0, count, 0);
     memcpy(&v15, Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &a3, 1), sizeof(v15));
     v12 = v11;
     if ( (signed int)v11 < (signed int)uNumActors )
@@ -7402,7 +7400,6 @@
   }
 }
 
-// 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
 
 //----- (0044987B) --------------------------------------------------------
 void sub_44987B(const char *pMapName, MapStartPoint start_point)
@@ -7443,6 +7440,8 @@
     case MapStartPoint_South: v10 = "South Start"; break;
     case MapStartPoint_East: v10 = "East Start";  break;
     case MapStartPoint_West: v10 = "West Start";  break;
+    default:
+      Error("Invalid enum value: %u", point);
   }
 
   strcpy(pName, v10);
@@ -7618,14 +7617,11 @@
 
 //----- (0044C175) --------------------------------------------------------
 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds )
-    {
-  unsigned int v2; // esi@1
-  int i; // eax@1
-
-  v2 = uNumSeconds;
+{
   strcpy(GameUI_Footer_TimedString.data(), pString);
-  GameUI_Footer_TimeLeft = 1000 * v2 + GetTickCount();
-  for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
+  GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount();
+
+  for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
         i > 450;
         i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
     GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0;
@@ -7635,7 +7631,7 @@
 void ShowNothingHereStatus()
 {
   if ( !GameUI_Footer_TimeLeft )
-    ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
+    ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here
 }
 
 //----- (0044C28B) --------------------------------------------------------
@@ -7685,23 +7681,18 @@
 }
 
 //----- (0040261D) --------------------------------------------------------
-int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
+void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8)
 {
-  int result; // eax@1
-
-  result = this->count;
-  if ( this->count < 100 )
-  {
-    this->pIDs[result] = uID;
-    this->pXs[this->count] = x;
-    this->pYs[this->count] = y;
-    this->pZs[this->count] = z;
-    this->field_324[this->count] = a3;
-    this->field_3EC[this->count] = a8;
-    result = this->count;
-    this->field_450[this->count++] = a7;
-  }
-  return result;
+  if (count < 100)
+  {
+    pIDs[count] = uID;
+    pXs[count] = x;
+    pYs[count] = y;
+    pZs[count] = z;
+    field_324[count] = a3;
+    field_3EC[count] = a8;
+    field_450[count++] = a7;
+  }
 }
 
 //----- (00402CAE) --------------------------------------------------------