diff Texture.cpp @ 1297:5450af4f57ef

moving files mm7_x ending
author Ritor1
date Wed, 19 Jun 2013 17:06:58 +0600
parents 0aeac0b9ca30
children 13b7be8b06a0
line wrap: on
line diff
--- a/Texture.cpp	Tue Jun 18 17:28:11 2013 +0600
+++ b/Texture.cpp	Wed Jun 19 17:06:58 2013 +0600
@@ -1636,4 +1636,121 @@
   field_18 = 0;
   field_20 = 0;
   field_22 = 0;
-}
\ No newline at end of file
+}
+//----- (0044E1EC) --------------------------------------------------------
+int TextureFrameTable::FromFileTxt(const char *Args)
+{
+  TextureFrameTable *v2; // ebx@1
+  FILE *v3; // eax@1
+  int v4; // esi@3
+  const void *v5; // ST0C_4@10
+  void *v6; // eax@10
+  FILE *v7; // ST0C_4@12
+  char *i; // eax@12
+  signed int v9; // esi@15
+  int v10; // eax@17
+  int v11; // edx@22
+  int v12; // ecx@23
+  int v13; // eax@24
+  signed int j; // eax@27
+  TextureFrame *v15; // edx@28
+  int v16; // esi@28
+  int k; // ecx@29
+  char Buf; // [sp+Ch] [bp-2F8h]@3
+  FrameTableTxtLine v20; // [sp+200h] [bp-104h]@4
+  int v21; // [sp+27Ch] [bp-88h]@4
+  char *Str1; // [sp+280h] [bp-84h]@5
+  char *Str; // [sp+284h] [bp-80h]@15
+  int v24; // [sp+2F8h] [bp-Ch]@3
+  int v25; // [sp+2FCh] [bp-8h]@3
+  FILE *File; // [sp+300h] [bp-4h]@1
+  int Argsa; // [sp+30Ch] [bp+8h]@28
+
+  v2 = this;
+  v3 = fopen(Args, "r");
+  File = v3;
+  if ( !v3 )
+    Abortf("CTextureFrameTable::load - Unable to open file: %s.", Args);
+  v4 = 0;
+  v24 = 0;
+  v25 = 1;
+  if ( fgets(&Buf, 490, v3) )
+  {
+    do
+    {
+      *strchr(&Buf, 10) = 0;
+      memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu);
+      if ( v21 && *Str1 != 47 )
+      {
+        if ( v21 < 2 )
+          Abortf("CTextureFrameTable::load, too few arguments, %s line %i.", Args, v25);
+        ++v24;
+      }
+      ++v25;
+    }
+    while ( fgets(&Buf, 490, File) );
+    v4 = v24;
+  }
+  v5 = v2->pTextures;
+  v2->sNumTextures = v4;
+  v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames");
+  v2->pTextures = (TextureFrame *)v6;
+  if ( !v6 )
+    Abortf("CTextureFrameTable::load - Out of Memory!");
+  v7 = File;
+  v2->sNumTextures = 0;
+  fseek(v7, 0, 0);
+  for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
+  {
+    *strchr(&Buf, 10) = 0;
+    memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu);
+    if ( v21 && *Str1 != 47 )
+    {
+      strcpy(v2->pTextures[v2->sNumTextures].pTextureName, Str1);
+      v2->pTextures[v2->sNumTextures].uAnimTime = atoi(Str);
+      v9 = 2;
+      for ( v2->pTextures[v2->sNumTextures].uFlags = 0; v9 < v21; ++v9 )
+      {
+        if ( !_stricmp((&Str1)[4 * v9], "New") )
+        {
+          v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags;
+          *(char *)v10 |= 2u;
+        }
+      }
+      ++v2->sNumTextures;
+    }
+  }
+  fclose(File);
+  v11 = 0;
+  if ( (signed int)(v2->sNumTextures - 1) > 0 )
+  {
+    v12 = 0;
+    do
+    {
+      v13 = (int)&v2->pTextures[v12];
+      if ( !(*(char *)(v13 + 38) & 2) )
+        *(char *)(v13 + 18) |= 1u;
+      ++v11;
+      ++v12;
+    }
+    while ( v11 < (signed int)(v2->sNumTextures - 1) );
+  }
+  for ( j = 0; j < (signed int)v2->sNumTextures; *(short *)(Argsa + 16) = v16 )
+  {
+    v15 = v2->pTextures;
+    Argsa = (int)&v15[j];
+    v16 = *(short *)(Argsa + 14);
+    if ( *(char *)(Argsa + 18) & 1 )
+    {
+      ++j;
+      for ( k = (int)&v15[j]; *(char *)(k + 18) & 1; k += 20 )
+      {
+        v16 += *(short *)(k + 14);
+        ++j;
+      }
+      LOWORD(v16) = v15[j].uAnimTime + v16;
+    }
+    ++j;
+  }
+  return 1;
+}