changeset 1546:9a6567c6c76c

stru141 & misc cleaning
author Nomad
date Sat, 07 Sep 2013 21:55:02 +0200
parents c4ab816fcc5e
children e303d8a9bcdc e668660457dc
files Actor.cpp Indoor.cpp Indoor_stuff.h Party.cpp Party.h SpriteObject.cpp Sprites.cpp TurnEngine.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.h stru298.h
diffstat 15 files changed, 281 insertions(+), 322 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/Actor.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -3967,12 +3967,12 @@
         v9 = v6 - stru_721530.normal.y,
         v10 = stru_721530.prolly_normal_d + v4,
         v17 = stru_721530.prolly_normal_d + v4,
-        v11 = (v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16,
+        v11 = (v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16,
         v18 = v8,
         v19 = v9,
-        abs((v8 * stru_721530.field_58.y - v9 * stru_721530.field_58.x) >> 16) > v10)
-    || (v12 = (v18 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16, v12 <= 0)
-    || (signed int)(((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z )
+        abs((v8 * stru_721530.direction.y - v9 * stru_721530.direction.x) >> 16) > v10)
+    || (v12 = (v18 * stru_721530.direction.x + v19 * stru_721530.direction.y) >> 16, v12 <= 0)
+    || (signed int)(((unsigned __int64)(stru_721530.direction.z * (signed __int64)v12) >> 16) + stru_721530.normal.z) < v2->vPosition.z )
   {
 LABEL_25:
     result = 0;
--- a/Indoor.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/Indoor.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -62,7 +62,7 @@
 stru337 stru_F81018;
 BspRenderer_PortalViewportData stru_F8A590;
 BspRenderer *pBspRenderer = new BspRenderer; // idb
-stru141 stru_721530;
+stru141_actor_collision_object stru_721530;
 std::array<stru352, 480> stru_F83B80;
 
 
@@ -3183,7 +3183,7 @@
   int v18; // ecx@33
   BLVFace *v19; // eax@34
   int v20; // ecx@46
-  int v21; // eax@46
+  //int v21; // eax@46
   int v22; // edi@46
   int v23; // eax@48
   unsigned int v24; // eax@51
@@ -3208,9 +3208,9 @@
   __int16 v43; // dx@96
   int v44; // ecx@96
   int v45; // edi@101
-  int v46; // edi@101
-  int v47; // eax@101
-  unsigned __int64 v48; // qax@101
+  //int v46; // edi@101
+  //int v47; // eax@101
+  //unsigned __int64 v48; // qax@101
   unsigned __int8 v49; // zf@103
   unsigned __int8 v50; // sf@103
   unsigned __int8 v51; // of@103
@@ -3359,29 +3359,28 @@
         return;
     }
     v20 = v0->uActorRadius;
-    v21 = v0->uActorHeight;
     stru_721530.field_84 = -1;
     stru_721530.field_70 = 0;
     uSectorID = 0;
     stru_721530.field_0 = 1;
-    stru_721530.field_8 = v20;
+    stru_721530.field_8_radius = v20;
     stru_721530.prolly_normal_d = v20;
-    stru_721530.field_C = v21;
+    stru_721530.height = v0->uActorHeight;
     v22 = 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;
       v23 = v0->vPosition.z;
       stru_721530.normal.z = v23 + v20 + 1;
-      stru_721530.field_34.z = v23 - v20 + stru_721530.field_C - 1;
-      if ( stru_721530.field_34.z < stru_721530.normal.z )
-        stru_721530.field_34.z = v23 + v20 + 1;
-      stru_721530.field_1C = v0->vVelocity.x;
-      stru_721530.field_20 = v0->vVelocity.y;
-      stru_721530.field_24 = v0->vVelocity.z;
+      stru_721530.position.z = v23 - v20 + stru_721530.height - 1;
+      if ( stru_721530.position.z < stru_721530.normal.z )
+        stru_721530.position.z = v23 + v20 + 1;
+      stru_721530.velocity.x = v0->vVelocity.x;
+      stru_721530.velocity.y = v0->vVelocity.y;
+      stru_721530.velocity.z = v0->vVelocity.z;
       stru_721530.uSectorID = v0->uSectorID;
       if ( !stru_721530._47050A(v22) )
       {
@@ -3432,12 +3431,9 @@
         }
         else
         {
-          v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-          v30 = v58 + v0->vPosition.x;
-          v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-          v31 = v58 + v0->vPosition.y;
-          v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-          v32 = v58 + v0->vPosition.z;
+          v30 = v0->vPosition.x + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+          v31 = v0->vPosition.y + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+          v32 = v0->vPosition.z + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
         }
         v33 = collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID);
         v34 = pIndoor->pFaces[uFaceID].uAttributes;
@@ -3461,13 +3457,13 @@
               v0->uSectorID = LOWORD(stru_721530.uSectorID);
               goto LABEL_123;
             }
-            v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-            v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16;
-            v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-            v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16;
-            v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
+            //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
+            v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+            //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
+            v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+            //v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
             v36 = stru_721530.uFaceID;
-            v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16;
+            v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
             v0->uSectorID = LOWORD(stru_721530.uSectorID);
             stru_721530.field_70 += stru_721530.field_7C;
             v37 = PID_ID(v36);
@@ -3481,15 +3477,8 @@
                   v45 = stru_5C6E00->Atan2(
                           v0->vPosition.x - pLevelDecorations[v37].vPosition.x,
                           v0->vPosition.y - pLevelDecorations[v37].vPosition.y);
-                  v54 = stru_5C6E00->Cos(v45);
-                  v56 = (unsigned __int64)(v54 * (signed __int64)(signed int)_this) >> 16;
-                  v46 = v45 - stru_5C6E00->uIntegerHalfPi;
-                  v0->vVelocity.x = v54 * _this >> 16;
-                  v47 = stru_5C6E00->Sin(v45);
-                  v54 = v47;
-                  v48 = v47 * (signed __int64)(signed int)_this;
-                  v56 = v48 >> 16;
-                  v0->vVelocity.y = WORD1(v48);
+                  v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v45), _this);
+                  v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v45), _this);
                   goto LABEL_119;
                 }
                 if ( PID_TYPE(v36) == OBJECT_BModel)
@@ -3515,17 +3504,12 @@
                                                                               * v0->vVelocity.y
                                                                               + v38->pFacePlane_old.vNormal.z
                                                                               * v0->vVelocity.z) >> 16;
-                    if ( stru_721530.field_64 >> 3 > v61 )
-                      v61 = stru_721530.field_64 >> 3;
-                    v58 = v38->pFacePlane_old.vNormal.x;
-                    v58 = (unsigned __int64)(v61 * (signed __int64)v58) >> 16;
-                    _this = v38->pFacePlane_old.vNormal.y;
-                    _this = (unsigned __int64)(v61 * (signed __int64)(signed int)_this) >> 16;
-                    v56 = v38->pFacePlane_old.vNormal.z;
-                    v56 = (unsigned __int64)(v61 * (signed __int64)v56) >> 16;
-                    v0->vVelocity.x += v58;
-                    v0->vVelocity.y += _this;
-                    v0->vVelocity.z += v56;
+                    if ( (stru_721530.speed >> 3) > v61 )
+                      v61 = stru_721530.speed >> 3;
+
+                    v0->vVelocity.x += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.x);
+                    v0->vVelocity.y += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.y);
+                    v0->vVelocity.z += fixpoint_sub0(v61, v38->pFacePlane_old.vNormal.z);
                     v41 = v38->uPolygonType;
                     if ( v41 != 4 && v41 != 3 )
                     {
@@ -3549,18 +3533,10 @@
                     EventProcessor(pIndoor->pFaceExtras[v38->uFaceExtraID].uEventID, 0, 1);
                 }
 LABEL_119:
-                v56 = v0->vVelocity.x;
-                v54 = 58500;
-                v56 = (unsigned __int64)(58500i64 * v56) >> 16;
-                v0->vVelocity.x = v56;
-                v56 = v0->vVelocity.y;
-                v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16;
-                v54 = 58500;
-                v0->vVelocity.y = v56;
-                v56 = v0->vVelocity.z;
-                v56 = (unsigned __int64)(v54 * (signed __int64)v56) >> 16;
+                v0->vVelocity.x = fixpoint_sub0(58500, v0->vVelocity.x);
+                v0->vVelocity.y = fixpoint_sub0(58500, v0->vVelocity.y);
+                v0->vVelocity.z = fixpoint_sub0(58500, v0->vVelocity.z);
                 v22 = 0;
-                v0->vVelocity.z = v56;
                 goto LABEL_120;
               }
               if ( v0->GetActorsRelation(0) )
--- a/Indoor_stuff.h	Sat Sep 07 20:05:20 2013 +0200
+++ b/Indoor_stuff.h	Sat Sep 07 21:55:02 2013 +0200
@@ -247,29 +247,27 @@
 
 /*  134 */
 #pragma pack(push, 1)
-struct stru141
+struct stru141_actor_collision_object
 {
   int _47050A(int a2);
 
   int field_0;
   int prolly_normal_d;
-  int field_8;
-  int field_C;
+  int field_8_radius;
+  int height;
   int field_10;
   int field_14;
   int field_18;
-  int field_1C;
-  int field_20;
-  int field_24;
+  Vec3_int_ velocity;
   Vec3_int_ normal;
-  Vec3_int_ field_34;
+  Vec3_int_ position;
   Vec3_int_ normal2;
   int field_4C;
   int field_50;
   int field_54;
-  Vec3_int_ field_58;
-  int field_64;
-  int field_68;
+  Vec3_int_ direction; // velocity's unit vector
+  int speed;
+  int inv_speed;
   int field_6C;
   int field_70;
   unsigned int uSectorID;
@@ -287,7 +285,7 @@
   int field_A4;
 };
 #pragma pack(pop)
-extern stru141 stru_721530;
+extern stru141_actor_collision_object stru_721530;
 
 
 
--- a/Party.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/Party.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -80,7 +80,7 @@
     uFallSpeed = 0;
     field_28 = 0;
     uDefaultPartyHeight = 120;
-    field_14 = 37;
+    field_14_radius = 37;
     y_rotation_granularity = 25;
     y_rotation_speed = 90;
 
@@ -893,7 +893,7 @@
   this->uFallSpeed = 0;
   this->field_28 = 0;
   this->uDefaultPartyHeight = 120;
-  this->field_14 = 37;
+  this->field_14_radius = 37;
   this->y_rotation_granularity = 25;
   this->uWalkSpeed = 384;
   this->y_rotation_speed = 90;
--- a/Party.h	Sat Sep 07 20:05:20 2013 +0200
+++ b/Party.h	Sat Sep 07 21:55:02 2013 +0200
@@ -219,7 +219,7 @@
   unsigned int uDefaultPartyHeight;
   int sEyelevel;
   unsigned int uDefaultEyelevel;
-  int field_14;
+  int field_14_radius;
   int y_rotation_granularity;
   unsigned int uWalkSpeed;
   int y_rotation_speed;  // deg/s
--- a/SpriteObject.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/SpriteObject.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -310,12 +310,12 @@
       ODM_GetTerrainNormalAt(v12, v11, &v51);
       v1->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
       v56 = abs(v51.y * v1->vVelocity.y + v51.z * v1->vVelocity.z + v51.x * v1->vVelocity.x) >> 16;
-      v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
-      v1->vVelocity.x += (unsigned int)(v56 * v51.x) >> 16;
-      v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
-      v1->vVelocity.y += (unsigned int)(v56 * v51.y) >> 16;
-      v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
-      v1->vVelocity.z += (unsigned int)(v56 * v51.z) >> 16;
+      //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.x) >> 16);
+      v1->vVelocity.x += fixpoint_sub0(v56, v51.x);
+      //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.y) >> 16);
+      v1->vVelocity.y += fixpoint_sub0(v56, v51.y);
+      //v60 = ((unsigned __int64)(v56 * (signed __int64)v51.z) >> 16);
+      v1->vVelocity.z += fixpoint_sub0(v56, v51.z);
 LABEL_12:
       v7 = v54;
       goto LABEL_13;
@@ -395,22 +395,22 @@
     stru_721530.field_0 = 0;
     v55 = 0;
     stru_721530.prolly_normal_d = v2->uRadius;
-    stru_721530.field_C = v2->uHeight;
-    stru_721530.field_8 = 0;
+    stru_721530.height = v2->uHeight;
+    stru_721530.field_8_radius = 0;
     stru_721530.field_70 = 0;
     while ( 1 )
     {
-      stru_721530.field_34.x = v1->vPosition.x;
-      stru_721530.normal.x = stru_721530.field_34.x;
+      stru_721530.position.x = v1->vPosition.x;
+      stru_721530.normal.x = stru_721530.position.x;
       v15 = v1->vPosition.y;
       stru_721530.uSectorID = 0;
-      stru_721530.field_34.y = v15;
+      stru_721530.position.y = v15;
       stru_721530.normal.y = v15;
-      stru_721530.field_34.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
-      stru_721530.normal.z = stru_721530.field_34.z;
-      stru_721530.field_1C = v1->vVelocity.x;
-      stru_721530.field_20 = v1->vVelocity.y;
-      stru_721530.field_24 = v1->vVelocity.z;
+      stru_721530.position.z = v1->vPosition.z + stru_721530.prolly_normal_d + 1;
+      stru_721530.normal.z = stru_721530.position.z;
+      stru_721530.velocity.x = v1->vVelocity.x;
+      stru_721530.velocity.y = v1->vVelocity.y;
+      stru_721530.velocity.z = v1->vVelocity.z;
       if ( stru_721530._47050A(0) )
         return;
       _46E889_collide_against_bmodels(0);
@@ -502,13 +502,13 @@
             }
         return;
       }
-      v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16);
-      v1->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
-      v1->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
+      //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16);
+      v1->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+      //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
+      v1->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+      //v60 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
       v28 = LOWORD(stru_721530.uSectorID);
-      v1->vPosition.z += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
+      v1->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
       v29 = v1->vPosition.z;
       v1->uSectorID = v28;
       stru_721530.field_70 += stru_721530.field_7C;
@@ -530,14 +530,13 @@
         {
           v56 = abs(v32->pFacePlane.vNormal.z * v1->vVelocity.z + v32->pFacePlane.vNormal.y * v1->vVelocity.y
                                                                 + v32->pFacePlane.vNormal.x * v1->vVelocity.x) >> 16;
-          if ( stru_721530.field_64 >> 3 > v56 )
-            v56 = stru_721530.field_64 >> 3;
+          if ( (stru_721530.speed >> 3) > v56 )
+            v56 = stru_721530.speed >> 3;
           v57 = v32->pFacePlane.vNormal.x;
           v57 = (unsigned __int64)(v56 * (signed __int64)v57) >> 16;
           v58 = v32->pFacePlane.vNormal.y;
           v58 = (unsigned __int64)(v56 * (signed __int64)v58) >> 16;
-          v60 = v32->pFacePlane.vNormal.z;
-          v60 = ((unsigned __int64)(v56 * (signed __int64)(signed int)v60) >> 16);
+          v60 = ((unsigned __int64)(v56 * (signed __int64)v32->pFacePlane.vNormal.z) >> 16);
           v1->vVelocity.x += 2 * v57;
           v1->vVelocity.y += 2 * v58;
           if ( v32->pFacePlane.vNormal.z <= 32000 )
@@ -612,7 +611,7 @@
   int v9; // ecx@16
   __int16 v10; // di@18
   char v11; // al@19
-  int v12; // eax@25
+  //int v12; // eax@25
   int v13; // eax@31
   int v14; // ebx@34
   signed int v15; // ebx@46
@@ -671,22 +670,22 @@
     stru_721530.field_0 = v8;
     uFaceID = v8;
     stru_721530.prolly_normal_d = pObject->uRadius;
-    v12 = pObject->uHeight;
+
     stru_721530.field_84 = -1;
-    stru_721530.field_C = v12;
-    stru_721530.field_8 = v8;
+    stru_721530.height = pObject->uHeight;
+    stru_721530.field_8_radius = v8;
     stru_721530.field_70 = v8;
     while ( 1 )
     {
-      stru_721530.field_34.x = pSpriteObject->vPosition.x;
-      stru_721530.normal.x = stru_721530.field_34.x;
-      stru_721530.field_34.y = pSpriteObject->vPosition.y;
-      stru_721530.normal.y = stru_721530.field_34.y;
-      stru_721530.field_34.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
-      stru_721530.normal.z = stru_721530.field_34.z;
-      stru_721530.field_1C = pSpriteObject->vVelocity.x;
-      stru_721530.field_20 = pSpriteObject->vVelocity.y;
-      stru_721530.field_24 = pSpriteObject->vVelocity.z;
+      stru_721530.position.x = pSpriteObject->vPosition.x;
+      stru_721530.normal.x = stru_721530.position.x;
+      stru_721530.position.y = pSpriteObject->vPosition.y;
+      stru_721530.normal.y = stru_721530.position.y;
+      stru_721530.position.z = stru_721530.prolly_normal_d + pSpriteObject->vPosition.z + 1;
+      stru_721530.normal.z = stru_721530.position.z;
+      stru_721530.velocity.x = pSpriteObject->vVelocity.x;
+      stru_721530.velocity.y = pSpriteObject->vVelocity.y;
+      stru_721530.velocity.z = pSpriteObject->vVelocity.z;
       stru_721530.uSectorID = pSpriteObject->uSectorID;
       if ( stru_721530._47050A(v8) )
         return;
@@ -786,12 +785,12 @@
         pGame->pParticleEngine->AddParticle(&Dst);
         return;
       }
-      v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      pSpriteObject->vPosition.x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16;
-      v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      pSpriteObject->vPosition.y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16;
-      v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16;
-      pSpriteObject->vPosition.z += (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.direction.x) >> 16;
+      pSpriteObject->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x);
+      //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
+      pSpriteObject->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y);
+      //v40 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16;
+      pSpriteObject->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z);
       pSpriteObject->uSectorID = LOWORD(stru_721530.uSectorID);
       stru_721530.field_70 += stru_721530.field_7C;
       if ( pObject->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID, stru_721530.uFaceID) )
@@ -822,8 +821,8 @@
         {
           v42 = abs(v16->pFacePlane_old.vNormal.x * pSpriteObject->vVelocity.x + v16->pFacePlane_old.vNormal.z * pSpriteObject->vVelocity.z
                                                                     + v16->pFacePlane_old.vNormal.y * pSpriteObject->vVelocity.y) >> 16;
-          if ( stru_721530.field_64 >> 3 > v42 )
-            v42 = stru_721530.field_64 >> 3;
+          if ( (stru_721530.speed >> 3) > v42 )
+            v42 = stru_721530.speed >> 3;
           v40 = v16->pFacePlane_old.vNormal.x;
           v40 = (unsigned __int64)(v42 * (signed __int64)v40) >> 16;
           v41 = v16->pFacePlane_old.vNormal.y;
--- a/Sprites.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/Sprites.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -779,16 +779,16 @@
                                 v12 = v8 - stru_721530.normal.x;
                                 v19 = v9 - stru_721530.normal.y;
                                 v13 = stru_721530.prolly_normal_d + v7;
-                                v21 = ((v8 - stru_721530.normal.x) * stru_721530.field_58.y
-                                     - (v9 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
+                                v21 = ((v8 - stru_721530.normal.x) * stru_721530.direction.y
+                                     - (v9 - stru_721530.normal.y) * stru_721530.direction.x) >> 16;
                                 if ( abs(v21) <= stru_721530.prolly_normal_d + v7 )
                                 {
-                                  v14 = (v12 * stru_721530.field_58.x + v19 * stru_721530.field_58.y) >> 16;
+                                  v14 = (v12 * stru_721530.direction.x + v19 * stru_721530.direction.y) >> 16;
                                   if ( v14 > 0 )
                                   {
                                     v15 = v5->vPosition.z;
                                     v16 = stru_721530.normal.z
-                                        + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v14) >> 16);
+                                        + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v14) >> 16);
                                     if ( v16 >= v15 )
                                     {
                                       if ( v16 <= v22 + v15 )
--- a/TurnEngine.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/TurnEngine.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -697,7 +697,7 @@
 
 //----- (00406648) --------------------------------------------------------
 void stru262_TurnBased::AIAttacks( unsigned int queue_index )
-    {
+{
     TurnBased_QueueElem *v1; // ecx@1
     int v3; // eax@1
     unsigned int v4; // ebx@2
--- a/mm7_2.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/mm7_2.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -5068,7 +5068,7 @@
   assert(sizeof(MobileLight) == 0x12);
   assert(sizeof(LightsStack_MobileLight_) == 0x1C28);
   assert(sizeof(Game) == 0xE78);
-  assert(sizeof(stru141) == 0xA8);
+  assert(sizeof(stru141_actor_collision_object) == 0xA8);
   assert(sizeof(ActionQueue) == 0x7C);
   assert(sizeof(NPCData) == 0x4C);
   assert(sizeof(NPCStats) == 0x17FFC);
--- 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) --------------------------------------------------------
--- a/mm7_4.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/mm7_4.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -358,16 +358,15 @@
                     v16 = v4 - stru_721530.normal.x;
                     v15 = v5 - stru_721530.normal.y;
                     v8 = stru_721530.prolly_normal_d + v3;
-                    v17 = ((v4 - stru_721530.normal.x) * stru_721530.field_58.y
-                         - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16;
+                    v17 = ((v4 - stru_721530.normal.x) * stru_721530.direction.y
+                         - (v5 - stru_721530.normal.y) * stru_721530.direction.x) >> 16;
                     if ( abs(v17) <= stru_721530.prolly_normal_d + v3 )
                     {
-                      v9 = (v16 * stru_721530.field_58.x + v15 * stru_721530.field_58.y) >> 16;
+                      v9 = (v16 * stru_721530.direction.x + v15 * stru_721530.direction.y) >> 16;
                       if ( v9 > 0 )
                       {
                         v10 = v1->vPosition.z;
-                        v11 = stru_721530.normal.z
-                            + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v9) >> 16);
+                        v11 = stru_721530.normal.z + fixpoint_sub0(stru_721530.direction.z, v9);
                         if ( v11 >= v10 )
                         {
                           if ( v11 <= v18 + v10 )
--- a/mm7_5.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/mm7_5.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -3835,9 +3835,7 @@
   }
   stru_50FE08.count = 0;
 }
-// 50FE08: using guessed type stru298 stru_50FE08;
 
-// 4D864C: using guessed type char byte_4D864C;
 
 //----- (0043A97E) --------------------------------------------------------
 void __fastcall sub_43A97E(unsigned int uLayingItemID, signed int a2)
--- a/mm7_6.cpp	Sat Sep 07 20:05:20 2013 +0200
+++ b/mm7_6.cpp	Sat Sep 07 21:55:02 2013 +0200
@@ -1675,14 +1675,14 @@
 
 
 //----- (0042FA66) --------------------------------------------------------
-int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
+void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6)
 {
   int v6; // edi@1
   int v7; // esi@1
   char *v8; // ecx@2
   unsigned __int16 v9; // ax@5
   //int v10; // eax@10
-  signed int result; // eax@11
+  //signed int result; // eax@11
   //__int16 v12; // ax@12
   //SpriteObject a1a; // [sp+Ch] [bp-74h]@1
   int v14; // [sp+7Ch] [bp-4h]@1
@@ -1734,18 +1734,16 @@
   {
     a1a.spell_caster_pid = 0;
   }
-  result = a1a.Create(0, 0, 0, 0);
-  if ( result != -1 )
-  {
-    result = stru_50FE08.Add(PID(OBJECT_Item, result),
+
+  int id = a1a.Create(0, 0, 0, 0);
+  if (id != -1)
+    stru_50FE08.Add(PID(OBJECT_Item, id),
                a5,
                SLOWORD(a1a.vPosition.x),
                SLOWORD(a1a.vPosition.y),
                SLOWORD(a1a.vPosition.z),
                0,
                0);
-  }
-  return result;
 }
 
 //----- (0042FB5C) --------------------------------------------------------
--- a/mm7_data.h	Sat Sep 07 20:05:20 2013 +0200
+++ b/mm7_data.h	Sat Sep 07 21:55:02 2013 +0200
@@ -1133,7 +1133,7 @@
 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9);
 void __fastcall sub_42F960_create_object(int x, int y, int z); // idb
 void CompactLayingItemsList();
-int __fastcall _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6);
+void _42FA66_do_explosive_impact(int a1, int a2, int a3, int a4, __int16 a5, signed int a6);
 bool _42FB5C_check_spell(signed int a1);
 void sub_42FBDD();
 void CloseWindowBackground();
--- a/stru298.h	Sat Sep 07 20:05:20 2013 +0200
+++ b/stru298.h	Sat Sep 07 21:55:02 2013 +0200
@@ -4,7 +4,7 @@
 #pragma pack(push, 1)
 struct stru298
 {
-  int Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8);
+  void Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8);
 
   int count;
   __int16 pIDs[100];