diff mm7_3.cpp @ 29:e62134245ab0

On BLV loading.
author Nomad
date Thu, 18 Oct 2012 03:18:04 +0200
parents 18f7a1b94448
children f4450ff595fe
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Oct 16 19:31:34 2012 +0200
+++ b/mm7_3.cpp	Thu Oct 18 03:18:04 2012 +0200
@@ -784,893 +784,6 @@
   return result;
 }
 
-//----- (0046F228) --------------------------------------------------------
-void __cdecl BLV_UpdateDoors()
-{
-  int v0; // ebx@1
-  int v1; // edi@1
-  BLVDoor *v2; // esi@3
-  unsigned __int16 v3; // ax@3
-  unsigned int v4; // ecx@5
-  int v5; // eax@8
-  int v6; // ecx@8
-  int v7; // eax@12
-  int v8; // eax@16
-  unsigned __int8 v9; // zf@18
-  char v10; // sf@18
-  unsigned __int8 v11; // of@18
-  int v12; // edi@19
-  int v13; // ecx@19
-  __int16 v14; // ax@19
-  BLVFace *v15; // ebx@24
-  unsigned __int16 *v16; // ecx@24
-  Vec3_short_ *v17; // esi@24
-  int v18; // eax@24
-  int v19; // edx@24
-  signed int v20; // eax@24
-  Vec3_short_ *v21; // ecx@24
-  double v22; // st7@24
-  double v23; // st6@24
-  int v24; // esi@25
-  int v25; // eax@25
-  BLVDoor *v26; // edi@25
-  signed __int64 v27; // qtt@27
-  BLVFaceExtra *v28; // esi@32
-  int v29; // ecx@34
-  int v30; // edx@34
-  unsigned __int64 v31; // qax@34
-  int v32; // eax@34
-  unsigned __int16 *v33; // eax@35
-  Vec3_short_ *v34; // eax@35
-  int v35; // ecx@35
-  int v36; // edx@35
-  signed int v37; // eax@35
-  signed int v38; // edx@35
-  int v39; // eax@35
-  int v40; // edx@35
-  unsigned __int8 v41; // cf@35
-  unsigned __int16 *v42; // edi@36
-  Vec3_short_ *v43; // edi@36
-  int v44; // ecx@36
-  int v45; // edi@36
-  int v46; // ecx@36
-  unsigned __int16 *v47; // edx@44
-  int v48; // ecx@44
-  unsigned int v49; // ecx@46
-  unsigned __int16 v50; // ax@48
-  unsigned int v51; // eax@51
-  unsigned __int16 v52; // ax@54
-  int v53; // ecx@57
-  int v54; // edx@57
-  unsigned __int64 v55; // qax@57
-  int v56; // ecx@58
-  int v57; // eax@58
-  int v58; // eax@59
-  SoundID v59; // [sp-24h] [bp-88h]@12
-  signed int v60; // [sp-20h] [bp-84h]@12
-  unsigned int v61; // [sp-1Ch] [bp-80h]@12
-  signed int v62; // [sp-18h] [bp-7Ch]@12
-  signed int v63; // [sp-14h] [bp-78h]@12
-  int v64; // [sp-10h] [bp-74h]@12
-  unsigned int v65; // [sp-Ch] [bp-70h]@12
-  int v66; // [sp-8h] [bp-6Ch]@12
-  int v67; // [sp+8h] [bp-5Ch]@31
-  int v68; // [sp+Ch] [bp-58h]@34
-  int v69; // [sp+10h] [bp-54h]@34
-  int v70; // [sp+14h] [bp-50h]@31
-  int v71; // [sp+18h] [bp-4Ch]@34
-  int v72; // [sp+1Ch] [bp-48h]@34
-  int v73; // [sp+20h] [bp-44h]@24
-  __int16 v74; // [sp+24h] [bp-40h]@24
-  int v75; // [sp+28h] [bp-3Ch]@36
-  int v76; // [sp+2Ch] [bp-38h]@36
-  int v77; // [sp+30h] [bp-34h]@36
-  int v78; // [sp+34h] [bp-30h]@36
-  int v79; // [sp+38h] [bp-2Ch]@19
-  unsigned int v80; // [sp+3Ch] [bp-28h]@2
-  int v81; // [sp+40h] [bp-24h]@1
-  int v82; // [sp+44h] [bp-20h]@35
-  int v83; // [sp+48h] [bp-1Ch]@34
-  int v84; // [sp+4Ch] [bp-18h]@34
-  int v85; // [sp+50h] [bp-14h]@19
-  SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1
-  BLVDoor *v87; // [sp+58h] [bp-Ch]@3
-  int v88; // [sp+5Ch] [bp-8h]@18
-  int v89; // [sp+60h] [bp-4h]@6
-
-  v0 = 0;
-  v1 = 0;
-  eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID];
-  v81 = 0;
-  if ( pIndoor->uNumDoors > 0 )
-  {
-    v80 = 0;
-    do
-    {
-      v2 = &pIndoor->pDoors[v80 / 0x50];
-      v87 = &pIndoor->pDoors[v80 / 0x50];
-      v3 = pIndoor->pDoors[v80 / 0x50].uState;
-      if ( v3 == (short)v0 || v3 == 2 )
-      {
-        v2->uAttributes &= 0xFFFFFFFDu;
-        goto LABEL_62;
-      }
-      v2->uTimeSinceTriggered += pEventTimer->uTimeElapsed;
-      v4 = v2->uTimeSinceTriggered;
-      if ( v2->uState == 1 )
-      {
-        v89 = (signed int)(v4 * v2->uCloseSpeed) / 128;
-        if ( v89 >= v2->uMoveLength )
-        {
-          v89 = v2->uMoveLength;
-          v2->uState = 2;
-LABEL_10:
-          if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 )
-          {
-            v66 = v0;
-            v65 = v0;
-            v64 = v0;
-            v7 = 8 * v1;
-            v63 = v0;
-            v62 = -1;
-            LOBYTE(v7) = 8 * v1 | 1;
-            v61 = v0;
-            v60 = v7;
-            v59 = (SoundID)((int)eDoorSoundID + 1);
-LABEL_17:
-            pAudioPlayer->PlaySound(v59, v60, v61, v62, v63, v64, v65, v66);
-            goto LABEL_18;
-          }
-          goto LABEL_18;
-        }
-      }
-      else
-      {
-        v5 = (signed int)(v4 * v2->uOpenSpeed) / 128;
-        v6 = v2->uMoveLength;
-        if ( v5 >= v6 )
-        {
-          v89 = v0;
-          v2->uState = v0;
-          goto LABEL_10;
-        }
-        v89 = v6 - v5;
-      }
-      if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 )
-      {
-        v66 = v0;
-        v65 = v0;
-        v64 = v0;
-        v8 = 8 * v1;
-        v63 = v0;
-        v62 = -1;
-        LOBYTE(v8) = 8 * v1 | 1;
-        v61 = 1;
-        v60 = v8;
-        v59 = eDoorSoundID;
-        goto LABEL_17;
-      }
-LABEL_18:
-      v11 = __OFSUB__(v2->uNumVertices, (short)v0);
-      v9 = v2->uNumVertices == (short)v0;
-      v10 = (signed __int16)(v2->uNumVertices - v0) < 0;
-      v88 = v0;
-      if ( !((unsigned __int8)(v10 ^ v11) | v9) )
-      {
-        do
-        {
-          v12 = v88;
-          v13 = v2->pVertexIDs[v88];
-          v85 = v89;
-          v79 = v2->vDirection.x;
-          v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16;
-          v13 *= 6;
-          *(__int16 *)((char *)&pIndoor->pVertices->x + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pXOffsets[v88];
-          v85 = v89;
-          v79 = v2->vDirection.y;
-          v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16;
-          *(__int16 *)((char *)&pIndoor->pVertices->y + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pYOffsets[v12];
-          v85 = v89;
-          v79 = v2->vDirection.z;
-          v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16;
-          v14 = ((unsigned int)(v79 * v89) >> 16) + v2->pZOffsets[v12];
-          ++v88;
-          *(__int16 *)((char *)&pIndoor->pVertices->z + v13) = v14;
-        }
-        while ( v88 < v2->uNumVertices );
-        v1 = v81;
-      }
-      v11 = __OFSUB__(v2->uNumFaces, (short)v0);
-      v9 = v2->uNumFaces == (short)v0;
-      v10 = (signed __int16)(v2->uNumFaces - v0) < 0;
-      v88 = v0;
-      if ( !((unsigned __int8)(v10 ^ v11) | v9) )
-      {
-        while ( 1 )
-        {
-          v15 = &pIndoor->pFaces[v2->pFaceIDs[v88]];
-          v16 = v15->pVertexIDs;
-          v17 = &pIndoor->pVertices[*v16];
-          v18 = v15->pFacePlane_old.vNormal.y;
-          v73 = *(int *)&v17->x;
-          v74 = v17->z;
-          v19 = v15->pFacePlane_old.vNormal.z;
-          v20 = -(v19 * v74 + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18);
-          v15->pFacePlane_old.dist = v20;
-          v21 = &pIndoor->pVertices[*v16];
-          v79 = v21->x;
-          v22 = (double)v79;
-          v23 = (double)v21->y;
-          v79 = v21->z;
-          v15->pFacePlane.dist = -((double)v79 * v15->pFacePlane.vNormal.z
-                                 + v23 * v15->pFacePlane.vNormal.y
-                                 + v22 * v15->pFacePlane.vNormal.x);
-          if ( v19 )
-          {
-            v24 = abs(v20 >> 15);
-            v25 = abs(v15->pFacePlane_old.vNormal.z);
-            v26 = v87;
-            if ( v24 > v25 )
-              Abortf(
-                "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]",
-                v87->uDoorID,
-                v87->pFaceIDs[v88],
-                v15->pFacePlane_old.dist,
-                v15->pFacePlane_old.vNormal.z);
-            v79 = v15->pFacePlane_old.vNormal.z;
-            v85 = v15->pFacePlane_old.dist;
-            LODWORD(v27) = v85 << 16;
-            HIDWORD(v27) = v85 >> 16;
-            v85 = v27 / v79;
-            v15->zCalc3 = -(v27 / v79);
-          }
-          else
-          {
-            v26 = v87;
-          }
-          if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D )
-            v15->_get_normals((Vec3_int_ *)&v70, (Vec3_int_ *)&v67);
-          v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID];
-          if ( !pRenderer->pRenderD3D )
-          {
-            if ( !(BYTE2(v15->uAttributes) & 4) )
-              goto LABEL_59;
-            v79 = v26->vDirection.x;
-            v83 = (unsigned __int64)(v79 * (signed __int64)v70) >> 16;
-            v85 = v71;
-            v79 = v26->vDirection.y;
-            v85 = (unsigned __int64)(v79 * (signed __int64)v71) >> 16;
-            v84 = v72;
-            v79 = v26->vDirection.z;
-            v84 = (unsigned __int64)(v79 * (signed __int64)v72) >> 16;
-            v79 = v83 + v85 + ((unsigned __int64)(v79 * (signed __int64)v72) >> 16);
-            v29 = v89;
-            v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16;
-            v28->sTextureDeltaU = -((unsigned int)(v79 * v89) >> 16);
-            v79 = v26->vDirection.x;
-            v85 = (unsigned __int64)(v79 * (signed __int64)v67) >> 16;
-            v83 = v68;
-            v79 = v26->vDirection.y;
-            v83 = (unsigned __int64)(v79 * (signed __int64)v68) >> 16;
-            v84 = v69;
-            v79 = v26->vDirection.z;
-            v84 = (unsigned __int64)(v79 * (signed __int64)v69) >> 16;
-            v30 = v83 + ((unsigned __int64)(v79 * (signed __int64)v69) >> 16);
-            v79 = v85 + v30;
-            v31 = (v85 + v30) * (signed __int64)v29;
-            v83 = v31 >> 16;
-            v32 = v31 >> 16;
-            goto LABEL_58;
-          }
-          v28->sTextureDeltaU = 0;
-          v28->sTextureDeltaV = 0;
-          v33 = v15->pVertexIDs;
-          v85 = 1;
-          v34 = &pIndoor->pVertices[*v33];
-          v35 = v34->z;
-          v36 = v34->y;
-          v82 = v34->x;
-          v79 = v36;
-          v37 = v70 * v82 + v71 * v36 + v72 * v35;
-          v38 = v67 * v82 + v68 * v36 + v35 * v69;
-          v39 = v37 >> 16;
-          *v15->pVertexUIDs = v39;
-          v40 = v38 >> 16;
-          *v15->pVertexVIDs = v40;
-          v41 = v15->uNumVertices < 1u;
-          v9 = v15->uNumVertices == 1;
-          v83 = v40;
-          v84 = v39;
-          v82 = v40;
-          if ( !(v41 | v9) )
-          {
-            do
-            {
-              v42 = v15->pVertexIDs;
-              v75 = 2 * v85;
-              v43 = &pIndoor->pVertices[v42[v85]];
-              v79 = v43->z;
-              v44 = v43->y;
-              v45 = v43->x;
-              v78 = v44;
-              v76 = (v72 * v79 + v70 * v45 + v71 * v44) >> 16;
-              v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16;
-              v77 = v46;
-              if ( v76 < v39 )
-                v39 = v76;
-              if ( v46 < v40 )
-                v83 = v46;
-              if ( v76 > v84 )
-                v84 = v76;
-              if ( v46 > v82 )
-                v82 = v46;
-              v47 = v15->pVertexUIDs;
-              v48 = v75;
-              ++v85;
-              *(unsigned __int16 *)((char *)v47 + v75) = v76;
-              *(unsigned __int16 *)((char *)v15->pVertexVIDs + v48) = v77;
-              v40 = v83;
-            }
-            while ( v85 < v15->uNumVertices );
-            v26 = v87;
-          }
-          v49 = v15->uAttributes;
-          if ( BYTE1(v49) & 0x10 )
-            goto LABEL_50;
-          if ( SBYTE1(v49) < 0 )
-          {
-            v50 = v15->uBitmapID;
-            if ( v50 != -1 )
-              break;
-          }
-LABEL_51:
-          v51 = v15->uAttributes;
-          if ( v51 & 8 )
-          {
-            v28->sTextureDeltaV -= v40;
-          }
-          else
-          {
-            if ( v51 & 0x20000 )
-            {
-              v52 = v15->uBitmapID;
-              if ( v52 != -1 )
-                v28->sTextureDeltaV -= v82
-                                     + *(short *)((signed __int16)v52 != -1 ? 72 * (signed __int16)v52 + 7278780 + 0x1A : 26);
-            }
-          }
-          if ( BYTE2(v15->uAttributes) & 4 )
-          {
-            v75 = v26->vDirection.x;
-            v84 = (unsigned __int64)(v75 * (signed __int64)v70) >> 16;
-            v82 = v71;
-            v75 = v26->vDirection.y;
-            v82 = (unsigned __int64)(v75 * (signed __int64)v71) >> 16;
-            v83 = v72;
-            v75 = v26->vDirection.z;
-            v83 = (unsigned __int64)(v75 * (signed __int64)v72) >> 16;
-            v75 = v84 + v82 + ((unsigned __int64)(v75 * (signed __int64)v72) >> 16);
-            v53 = v89;
-            v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16;
-            v28->sTextureDeltaU = -((unsigned int)(v75 * v89) >> 16);
-            v75 = v26->vDirection.x;
-            v84 = (unsigned __int64)(v75 * (signed __int64)v67) >> 16;
-            v82 = v68;
-            v75 = v26->vDirection.y;
-            v82 = (unsigned __int64)(v75 * (signed __int64)v68) >> 16;
-            v83 = v69;
-            v75 = v26->vDirection.z;
-            v83 = (unsigned __int64)(v75 * (signed __int64)v69) >> 16;
-            v54 = v82 + ((unsigned __int64)(v75 * (signed __int64)v69) >> 16);
-            v75 = v84 + v54;
-            v55 = (v84 + v54) * (signed __int64)v53;
-            v82 = v55 >> 16;
-            v32 = v55 >> 16;
-LABEL_58:
-            v56 = v88;
-            v57 = -v32;
-            v28->sTextureDeltaV = v57;
-            v28->sTextureDeltaU += v26->pDeltaUs[v56];
-            v28->sTextureDeltaV = v57 + v26->pDeltaVs[v56];
-          }
-LABEL_59:
-          v58 = v26->uNumFaces;
-          ++v88;
-          if ( v88 >= v58 )
-          {
-            v1 = v81;
-            v0 = 0;
-            goto LABEL_62;
-          }
-          v2 = v87;
-        }
-        LOWORD(v39) = v84
-                    + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24);
-LABEL_50:
-        v28->sTextureDeltaU -= v39;
-        goto LABEL_51;
-      }
-LABEL_62:
-      v80 += 80;
-      ++v1;
-      v81 = v1;
-    }
-    while ( v1 < pIndoor->uNumDoors );
-  }
-}
-// 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID;
-
-//----- (0046F90C) --------------------------------------------------------
-void __cdecl UpdateActors_BLV()
-{
-  Actor *v0; // esi@2
-  unsigned __int16 v1; // ax@2
-  int v2; // edi@6
-  int v3; // eax@6
-  int v4; // eax@8
-  __int16 v5; // ax@11
-  signed int v6; // ebx@14
-  unsigned __int8 v7; // zf@14
-  unsigned __int8 v8; // sf@14
-  signed __int16 v9; // ax@17
-  signed __int64 v10; // qax@18
-  unsigned __int16 v11; // ax@21
-  int v12; // eax@29
-  unsigned __int64 v13; // qax@29
-  int v14; // eax@30
-  unsigned __int64 v15; // qax@30
-  int v16; // ecx@33
-  BLVFace *v17; // edx@33
-  int v18; // ecx@33
-  BLVFace *v19; // eax@34
-  int v20; // ecx@46
-  int v21; // eax@46
-  int v22; // edi@46
-  int v23; // eax@48
-  unsigned int v24; // eax@51
-  int v25; // eax@52
-  int v26; // ebx@54
-  int v27; // ST08_4@54
-  int v28; // edi@54
-  int v29; // eax@54
-  int v30; // ecx@62
-  int v31; // ebx@62
-  int v32; // eax@62
-  int v33; // eax@64
-  unsigned int v34; // ecx@64
-  int v35; // ecx@64
-  signed int v36; // edx@85
-  signed int v37; // ebx@85
-  BLVFace *v38; // edi@89
-  int v39; // ecx@90
-  int v40; // ebx@90
-  PolygonType v41; // al@94
-  int v42; // eax@96
-  __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
-  unsigned __int8 v49; // zf@103
-  unsigned __int8 v50; // sf@103
-  unsigned __int8 v51; // of@103
-  AIDirection v52; // [sp+0h] [bp-60h]@75
-  AIDirection v53; // [sp+1Ch] [bp-44h]@116
-  int v54; // [sp+38h] [bp-28h]@53
-  int v55; // [sp+3Ch] [bp-24h]@6
-  int v56; // [sp+40h] [bp-20h]@6
-  unsigned int _this; // [sp+44h] [bp-1Ch]@51
-  int v58; // [sp+48h] [bp-18h]@51
-  int v59; // [sp+4Ch] [bp-14h]@8
-  int v60; // [sp+50h] [bp-10h]@6
-  int v61; // [sp+54h] [bp-Ch]@14
-  int v62; // [sp+58h] [bp-8h]@6
-  unsigned int v63; // [sp+5Ch] [bp-4h]@1
-
-  v63 = 0;
-  if ( (signed int)uNumActors > 0 )
-  {
-    while ( 1 )
-    {
-      v0 = &pActors[v63];
-      v1 = v0->uAIState;
-      if ( v1 == 11 || v1 == 19 || v1 == 17 || !v0->uMovementSpeed )
-        goto LABEL_123;
-      v55 = v0->uSectorID;
-      v2 = _46ED1B_collide_against_floor(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, (unsigned int *)&v55, &v60);
-      v0->uSectorID = v55;
-      v3 = v0->pMonsterInfo.uFlying;
-      v56 = v2;
-      v62 = v3;
-      if ( !v0->CanAct() )
-        v62 = 0;
-      v4 = v0->vPosition.z;
-      v59 = 0;
-      if ( v4 > v2 + 1 )
-        v59 = 1;
-      if ( v2 <= -30000 )
-      {
-        v5 = pIndoor->GetSector(v0->vPosition.x, v0->vPosition.y, v4);
-        v0->uSectorID = v5;
-        if ( !v5
-          || (v56 = _46CEC3_get_floor_level(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &v60), v56 == -30000) )
-          goto LABEL_123;
-      }
-      if ( v0->uCurrentActionAnimation == 1 )
-      {
-        v6 = v0->uMovementSpeed;
-        v7 = HIDWORD(v0->pActorBuffs[7].uExpireTime) == 0;
-        v8 = SHIDWORD(v0->pActorBuffs[7].uExpireTime) < 0;
-        v61 = v0->uMovementSpeed;
-        if ( !v8 && (!(v8 | v7) || LODWORD(v0->pActorBuffs[7].uExpireTime)) )
-        {
-          v9 = v0->pActorBuffs[7].uPower;
-          if ( v9 )
-            LODWORD(v10) = v6 / (unsigned __int16)v9;
-          else
-            v10 = (signed __int64)((double)v61 * 0.5);
-          v6 = v10;
-          v61 = v10;
-        }
-        v11 = v0->uAIState;
-        if ( v11 == 6 || v11 == 7 )
-        {
-          v6 *= 2;
-          v61 = v6;
-        }
-        if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 1 )
-          v6 = (signed __int64)((double)v61 * flt_6BE3AC_debug_recmod1_x_1_6);
-        if ( v6 > 1000 )
-          v6 = 1000;
-        v12 = stru_5C6E00->SinCos(v0->uYawAngle);
-        v55 = v12;
-        v13 = v12 * (signed __int64)v6;
-        v61 = v13 >> 16;
-        v0->vVelocity.x = WORD1(v13);
-        v55 = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi);
-        v61 = (unsigned __int64)(v55 * (signed __int64)v6) >> 16;
-        v7 = v62 == 0;
-        v0->vVelocity.y = (unsigned int)(v55 * v6) >> 16;
-        if ( !v7 )
-        {
-          v14 = stru_5C6E00->SinCos(v0->uPitchAngle - stru_5C6E00->uIntegerHalfPi);
-          v55 = v14;
-          v15 = v14 * (signed __int64)v6;
-          v61 = v15 >> 16;
-          v0->vVelocity.z = WORD1(v15);
-        }
-      }
-      else
-      {
-        v61 = v0->vVelocity.x;
-        v55 = 55000;
-        v61 = (unsigned __int64)(55000i64 * v61) >> 16;
-        v0->vVelocity.x = v61;
-        v61 = v0->vVelocity.y;
-        v61 = (unsigned __int64)(v55 * (signed __int64)v61) >> 16;
-        v7 = v62 == 0;
-        v0->vVelocity.y = v61;
-        if ( !v7 )
-        {
-          v55 = 55000;
-          v61 = v0->vVelocity.z;
-          v61 = (unsigned __int64)(55000i64 * v61) >> 16;
-          v0->vVelocity.z = v61;
-        }
-      }
-      v16 = v0->vPosition.z;
-      v17 = pIndoor->pFaces;
-      v51 = __OFSUB__(v16, v56);
-      v8 = v16 - v56 < 0;
-      v18 = v60;
-      if ( v8 ^ v51 )
-      {
-        v0->vPosition.z = v56 + 1;
-        v19 = &v17[v18];
-        if ( v19->uPolygonType == 3 )
-        {
-          if ( v0->vVelocity.z < 0 )
-            v0->vVelocity.z = 0;
-        }
-        else
-        {
-          if ( v19->pFacePlane_old.vNormal.z < 45000 )
-            v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
-        }
-      }
-      else
-      {
-        if ( v59 && !v62 )
-          v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength();
-      }
-      if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y + v0->vVelocity.z * v0->vVelocity.z >= 400 )
-        break;
-      v0->vVelocity.z = 0;
-      v0->vVelocity.y = 0;
-      v0->vVelocity.x = 0;
-      if ( BYTE2(v17[v18].uAttributes) & 0x40 )
-      {
-        if ( v0->uAIState == 5 )
-          v0->uAIState = 11;
-      }
-LABEL_123:
-      ++v63;
-      if ( (signed int)v63 >= (signed int)uNumActors )
-        return;
-    }
-    v20 = v0->uActorRadius;
-    v21 = v0->uActorHeight;
-    stru_721530.field_84 = -1;
-    stru_721530.field_70 = 0;
-    v55 = 0;
-    stru_721530.field_0 = 1;
-    stru_721530.field_8 = v20;
-    stru_721530.prolly_normal_d = v20;
-    stru_721530.field_C = v21;
-    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;
-      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.uSectorID = v0->uSectorID;
-      if ( !stru_721530._47050A(v22) )
-      {
-        v58 = v22;
-        v24 = 8 * v63;
-        LOBYTE(v24) = 8 * v63 | 3;
-        v61 = v22;
-        _this = v24;
-        do
-        {
-          _46E44E_collide_against_faces_and_portals(1u);
-          _46E0B2_collide_against_decorations();
-          _46EF01_collision_chech_player(0);
-          _46ED8A_collide_against_layingItems(_this);
-          v25 = 0;
-          v56 = 0;
-          if ( ai_arrays_size > v22 )
-          {
-            do
-            {
-              v54 = ai_array_4F7DB0_actor_ids[v25];
-              if ( v54 != v63 )
-              {
-                v26 = v54;
-                v27 = abs(pActors[v54].vPosition.z - v0->vPosition.z);
-                v28 = abs(pActors[v26].vPosition.y - v0->vPosition.y);
-                v29 = abs(pActors[v26].vPosition.x - v0->vPosition.x);
-                if ( sub_4621DA(v29, v28, v27) >= v0->uActorRadius + (signed int)pActors[v26].uActorRadius
-                  && _46DF1A_collide_against_actor(v54, 40) )
-                  ++v58;
-                v22 = 0;
-              }
-              v25 = v56++ + 1;
-            }
-            while ( v56 < ai_arrays_size );
-          }
-          if ( _46F04E_collide_against_portals() )
-            break;
-          ++v61;
-        }
-        while ( v61 < 100 );
-        v56 = v58 > 1;
-        if ( stru_721530.field_7C >= stru_721530.field_6C )
-        {
-          v30 = stru_721530.normal2.x;
-          v31 = stru_721530.normal2.y;
-          v32 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
-        }
-        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;
-        }
-        v33 = _46ED1B_collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &v60);
-        v34 = pIndoor->pFaces[v60].uAttributes;
-        v35 = v34 & 0x400000;
-        if ( v35 && v0->uAIState == 5 )
-        {
-          v0->uAIState = 11;
-          goto LABEL_120;
-        }
-        if ( v59 != v22 || v62 != v22 || v35 == v22 )
-        {
-          if ( v33 == -30000 )
-            goto LABEL_120;
-          if ( v0->uCurrentActionAnimation != 1 || v33 >= v0->vPosition.z - 100 || v59 != v22 || v62 != v22 )
-          {
-            if ( stru_721530.field_7C >= stru_721530.field_6C )
-            {
-              v0->vPosition.x = LOWORD(stru_721530.normal2.x);
-              v0->vPosition.y = LOWORD(stru_721530.normal2.y);
-              v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1;
-              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;
-            v36 = stru_721530.uFaceID;
-            v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16;
-            v0->uSectorID = LOWORD(stru_721530.uSectorID);
-            stru_721530.field_70 += stru_721530.field_7C;
-            v37 = v36 >> 3;
-            if ( (v36 & 7) != 3 )
-            {
-              if ( (v36 & 7) != 4 )
-              {
-                if ( (v36 & 7) == 5 )
-                {
-                  _this = sub_452A9E(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y);
-                  v45 = stru_5C6E00->Atan2(
-                          v0->vPosition.x - pLevelDecorations[v37].vPosition.x,
-                          v0->vPosition.y - pLevelDecorations[v37].vPosition.y);
-                  v54 = stru_5C6E00->SinCos(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->SinCos(v46);
-                  v54 = v47;
-                  v48 = v47 * (signed __int64)(signed int)_this;
-                  v56 = v48 >> 16;
-                  v0->vVelocity.y = WORD1(v48);
-                  goto LABEL_119;
-                }
-                if ( (v36 & 7) == 6 )
-                {
-                  stru_721530.field_84 = v36 >> 3;
-                  v38 = &pIndoor->pFaces[v37];
-                  if ( v38->uPolygonType == 3 )
-                  {
-                    v39 = v0->vVelocity.x;
-                    v40 = v0->vVelocity.y * v0->vVelocity.y;
-                    v0->vVelocity.z = 0;
-                    v0->vPosition.z = pIndoor->pVertices[*v38->pVertexIDs].z + 1;
-                    if ( v39 * v39 + v40 < 400 )
-                    {
-                      v0->vVelocity.y = 0;
-                      v0->vVelocity.x = 0;
-                      goto LABEL_119;
-                    }
-                  }
-                  else
-                  {
-                    v61 = abs(v38->pFacePlane_old.vNormal.x * v0->vVelocity.x + v38->pFacePlane_old.vNormal.y
-                                                                              * 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;
-                    v41 = v38->uPolygonType;
-                    if ( v41 != 4 && v41 != 3 )
-                    {
-                      v42 = v38->pFacePlane_old.vNormal.x;
-                      v43 = v0->vPosition.z;
-                      v44 = stru_721530.prolly_normal_d
-                          - ((v38->pFacePlane_old.dist
-                            + v38->pFacePlane_old.vNormal.z * v0->vPosition.z
-                            + v38->pFacePlane_old.vNormal.y * v0->vPosition.y
-                            + v42 * v0->vPosition.x) >> 16);
-                      if ( v44 > 0 )
-                      {
-                        v0->vPosition.x += (unsigned int)(v44 * v42) >> 16;
-                        v0->vPosition.y += (unsigned int)(v44 * v38->pFacePlane_old.vNormal.y) >> 16;
-                        v0->vPosition.z = v43 + ((unsigned int)(v44 * v38->pFacePlane_old.vNormal.z) >> 16);
-                      }
-                      v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y);
-                    }
-                  }
-                  if ( BYTE3(v38->uAttributes) & 8 )
-                    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;
-                v22 = 0;
-                v0->vVelocity.z = v56;
-                goto LABEL_120;
-              }
-              if ( v0->GetActorsRelation(0) )
-              {
-                v51 = __OFSUB__(HIDWORD(pParty->pPartyBuffs[11].uExpireTime), v22);
-                v49 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) == v22;
-                v50 = HIDWORD(pParty->pPartyBuffs[11].uExpireTime) - v22 < 0;
-                v0->vVelocity.y = v22;
-                v0->vVelocity.x = v22;
-                if ( !(v50 ^ v51)
-                  && (!((unsigned __int8)(v50 ^ v51) | v49) || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > v22) )
-                  pParty->pPartyBuffs[11].Reset();
-                viewparams->bRedrawGameUI = 1;
-                goto LABEL_119;
-              }
-              v36 = stru_721530.uFaceID;
-LABEL_118:
-              Actor::FaceObject(v63, v36, v22, (AIDirection *)v22);
-              goto LABEL_119;
-            }
-            if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) )
-              goto LABEL_119;
-            if ( v0->pMonsterInfo.uHostilityType )
-            {
-              if ( v56 == v22 )
-                goto LABEL_114;
-            }
-            else
-            {
-              if ( v56 == v22 )
-              {
-                if ( !pActors[v37].pMonsterInfo.uHostilityType )
-                  goto LABEL_118;
-LABEL_114:
-                Actor::_402968(v63, v36, v22, (AIDirection *)v22);
-                goto LABEL_119;
-              }
-            }
-            Actor::_403F58(v63, 4, v22, &v53);
-            goto LABEL_119;
-          }
-          if ( v0->vPosition.x & 1 )
-            v0->uYawAngle += 100;
-          else
-            v0->uYawAngle -= 100;
-        }
-        else
-        {
-          if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->field_4 == 2 || pTurnEngine->field_4 == 3) )
-            goto LABEL_123;
-          if ( !v0->pMonsterInfo.uHostilityType || v56 != v22 )
-          {
-            Actor::_403F58(v63, 4, v22, &v52);
-            goto LABEL_123;
-          }
-        }
-      }
-LABEL_120:
-      ++v55;
-      if ( v55 >= 100 )
-        goto LABEL_123;
-      v20 = stru_721530.prolly_normal_d;
-    }
-  }
-}
-// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int);
-// 4F75D8: using guessed type int ai_arrays_size;
-
-
 
 //----- (0047050A) --------------------------------------------------------
 int stru141::_47050A(int a2)
@@ -20428,7 +19541,7 @@
       LOWORD(v2) = v6->uState;
       if ( (short)v2 && (short)v2 != 3 )
       {
-        v6->uState = 3;
+        v6->uState = BLVDoor::Closing;
         if ( (short)v2 == 2 )
         {
 LABEL_17:
@@ -20455,7 +19568,7 @@
   LOWORD(v2) = v6->uState;
   if ( (short)v2 != 2 && (short)v2 != 1 )
   {
-    v6->uState = 1;
+    v6->uState = BLVDoor::Opening;
     if ( !(short)v2 )
       goto LABEL_17;
     v7 = v6->uTimeSinceTriggered;
@@ -21459,7 +20572,7 @@
         pActor->uActorHeight = pMonsterList->pMonsters[pActor->pMonsterInfo.uID - 1].uMonsterHeight;
       if ( v82 != v12 )
       {
-        pActor->pMonsterInfo.uHostilityType = 0;
+        pActor->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
         if ( SHIDWORD(pActor->pActorBuffs[1].uExpireTime) <= (signed int)v12 )
         {
           if ( SHIDWORD(pActor->pActorBuffs[1].uExpireTime) < (signed int)v12
@@ -21517,7 +20630,7 @@
       v21 = &pActors[uActorID];
       Actor::_401221(uActorID, &dword_4F6E08[uActorID], 1u);
       if ( v21->pMonsterInfo.uHostilityType && !*v20 )
-        v21->pMonsterInfo.uHostilityType = 0;
+        v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
       a2 = *v20;
       v76 = a2 & 7;
       if ( (a2 & 7) == 3 )
@@ -21568,7 +20681,7 @@
         v21->uActorHeight = pMonsterList->pMonsters[v21->pMonsterInfo.uID - 1].uMonsterHeight;
       if ( v82 != v24 )
       {
-        v21->pMonsterInfo.uHostilityType = 0;
+        v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
         if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) <= (signed int)v24 )
         {
           if ( SHIDWORD(v21->pActorBuffs[1].uExpireTime) < (signed int)v24
@@ -21691,7 +20804,7 @@
       }
       if ( v38 ^ v39 )
 LABEL_257:
-        v21->pMonsterInfo.uHostilityType = 4;
+      v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long;
 LABEL_165:
       if ( (signed __int64)v21->pActorBuffs[4].uExpireTime > 0 )
       {