diff Indoor.cpp @ 2338:1e865e8690ba

Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
author Grumpy7
date Sat, 05 Apr 2014 20:27:09 +0200
parents d6887ee81068
children 4100fb5c4913
line wrap: on
line diff
--- a/Indoor.cpp	Sat Apr 05 20:14:15 2014 +0200
+++ b/Indoor.cpp	Sat Apr 05 20:27:09 2014 +0200
@@ -3130,8 +3130,8 @@
     Error("Out of memory loading indoor level");
   if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) )
   {
-    InitializeActors();
-    InitializeSpriteObjects();
+    Actor::InitializeActors();
+    SpriteObject::InitializeSpriteObjects();
   }
   dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000;
   if ( !map_id )
@@ -3544,186 +3544,6 @@
 
   return result;
 }
-//----- (004016FA) --------------------------------------------------------
-int  MakeActorAIList_BLV()
-{
-  //Actor *v0; // esi@2
-  int v1; // eax@4
-//  int v2; // ebx@4
-//  unsigned int v3; // ecx@4
-//  int v4; // edx@5
-//  int v5; // edx@7
-//  unsigned int v6; // edx@9
-  unsigned int v7; // ST24_4@10
-//  int v8; // eax@10
-  int v9; // edi@10
-//  int v10; // ebx@14
-//  char v11; // zf@16
-  int v12; // eax@22
-  int v13; // edx@24
-//  int v14; // ecx@25
-  int v15; // ebx@26
-//  unsigned int *v16; // ecx@27
-  unsigned int v17; // esi@27
-  int v18; // ecx@31
-  signed int v19; // edi@31
-//  Actor *v20; // esi@32
-//  bool v21; // eax@33
-//  int v22; // eax@34
-//  signed int v23; // ebx@36
-//  Actor *v24; // esi@37
-  signed int v25; // eax@40
-//  int v26; // eax@43
-  int v27; // ebx@45
-  int j; // edi@45
-//  unsigned int v29; // eax@46
-  int v30; // eax@48
-//  int v31; // ecx@51
-//  int v32; // eax@51
-//  signed int v33; // eax@53
-//  __int64 v34; // qax@55
-//  char *v35; // ecx@56
-  int v37; // [sp+Ch] [bp-18h]@1
-  int v38; // [sp+10h] [bp-14h]@4
-  int v39; // [sp+14h] [bp-10h]@4
-  //int v40; // [sp+18h] [bp-Ch]@10
-//  int v41; // [sp+18h] [bp-Ch]@29
-  int i; // [sp+18h] [bp-Ch]@31
-  //signed int v43; // [sp+1Ch] [bp-8h]@1
-//  signed int v44; // [sp+1Ch] [bp-8h]@25
-  int v45; // [sp+20h] [bp-4h]@1
-
-//  __debugbreak(); // refactor for blv ai
-  pParty->uFlags &= 0xFFFFFFCFu;
-  v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
-  v45 = 0;
-  for ( uint i = 0; i < (signed int)uNumActors; ++i )
-  {
-    pActors[i].uAttributes &= 0xFB00;
-    if ( !pActors[i].CanAct() )
-    {
-      pActors[i].uAttributes &= 0xBF00;
-      continue;
-    }
-    v39 = abs(pParty->vPosition.z - pActors[i].vPosition.z);
-    v38 = abs(pParty->vPosition.y - pActors[i].vPosition.y);
-    v1 = abs(pParty->vPosition.x - pActors[i].vPosition.x);
-    v7 = int_get_vector_length(v39, v38, v1);
-    v9 = v7 - pActors[i].uActorRadius;
-    if ( v9 < 0 )
-      v9 = 0;
-    if ( v9 < 10240 )
-    {
-      pActors[i].uAttributes &= 0xFEFFFFFF;
-      if ( pActors[i].uAttributes & 0x80000 || pActors[i].GetActorsRelation(0) )
-      {
-        pActors[i].uAttributes |= 0x1000000;
-        if ( !(pParty->uFlags & 0x10) && (double)v9 < 307.2 )
-          pParty->uFlags |= 0x10;
-        if ( !(pParty->uFlags & 0x20) && v9 < 5120 )
-          pParty->uFlags |= 0x20;
-      }
-      v12 = v45++;
-      ai_near_actors_distances[v12] = v9;
-      ai_near_actors_ids[v12] = i;
-    }
-    else
-      pActors[i].uAttributes &= 0xBF00;
-  }
-  v13 = 0;
-  if ( v45 > 0 )
-  {
-    for ( uint i = 1; i < v45; i++ )
-    {
-      for ( uint j = 1; j < v45; ++j )
-      {
-        v15 = ai_near_actors_distances[v13];
-        if ( ai_near_actors_distances[v13] > ai_near_actors_distances[j] )
-        {
-          v17 = ai_near_actors_ids[v13];
-          ai_near_actors_ids[v13] = ai_near_actors_ids[j];
-          ai_near_actors_ids[j] = v17;
-          ai_near_actors_distances[v13] = ai_near_actors_distances[j];
-          ai_near_actors_distances[j] = v15;
-        }
-      }
-      ++v13;
-    }
-  }
-  v18 = 0;
-  v19 = 0;
-  for ( i = 0; i < v45; i++ )
-  {
-    if ( pActors[ai_near_actors_ids[i]].uAttributes & 0x8000
-      || sub_4070EF_prolly_detect_player(PID(OBJECT_Actor,ai_near_actors_ids[i]), 4) )
-    {
-      pActors[ai_near_actors_ids[i]].uAttributes |= 0x8000;
-      ai_array_4F6638_actor_ids[v19] = ai_near_actors_ids[i];
-      ai_array_4F5E68[v19++] = ai_near_actors_distances[i];
-      if ( v19 >= 30 )
-        break;
-    }
-  }
-  ai_arrays_size = v19;
-  if ( (signed int)uNumActors > 0 )
-  {
-    for ( uint i = 0; i < (signed int)uNumActors; ++i )
-    {
-      if ( pActors[i].CanAct() && pActors[i].uSectorID == v37 )
-      {
-        v25 = 0;
-        if ( v19 <= 0 )
-        {
-          pActors[i].uAttributes |= 0x4000;
-          ai_array_4F6638_actor_ids[ai_arrays_size++] = i;
-        }
-        else
-        {
-          while ( ai_array_4F6638_actor_ids[v25] != i )
-          {
-            ++v25;
-            if ( v25 >= v19 )
-            {
-              pActors[i].uAttributes |= 0x4000;
-              ai_array_4F6638_actor_ids[ai_arrays_size++] = i;
-			  break;
-            }
-          }
-        }
-      }
-    }
-  }
-  v27 = ai_arrays_size;
-  for ( j = 0; j < v45; ++j )
-  {
-    //v29 = ai_near_actors_ids[j];
-    if ( pActors[ai_near_actors_ids[j]].uAttributes & 0xC000 && pActors[ai_near_actors_ids[j]].CanAct() )
-    {
-      v30 = 0;
-      if ( v27 <= 0 )
-        ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j];
-      else
-      {
-        while ( ai_array_4F6638_actor_ids[v30] != ai_near_actors_ids[j] )
-        {
-          ++v30;
-          if ( v30 >= v27 )
-		  {
-            ai_array_4F6638_actor_ids[ai_arrays_size++] = ai_near_actors_ids[j];
-			break;
-		  }
-        }
-      }
-    }
-  }
-  if ( ai_arrays_size > 30 )
-    ai_arrays_size = 30;
-  memcpy(ai_near_actors_ids.data(), ai_array_4F6638_actor_ids.data(), 4 * ai_arrays_size);
-  memcpy(ai_near_actors_distances.data(), ai_array_4F5E68.data(), 4 * ai_arrays_size);
-  for ( uint i = 0; i < ai_arrays_size; i++ )
-    pActors[ai_near_actors_ids[i]].uAttributes |= 0x400;
-  return ai_arrays_size;
-}
 //----- (0043FDED) --------------------------------------------------------
 void PrepareActorRenderList_BLV()
 {