changeset 694:52329962fcdb

monster table init rework started
author Gloval
date Sun, 17 Mar 2013 12:47:19 +0400
parents e0a1fccc89b1
children af0332a32034 b097497f07e2
files Actor.cpp Monsters.cpp Monsters.h mm7_2.cpp
diffstat 4 files changed, 585 insertions(+), 153 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Sun Mar 17 01:50:34 2013 +0400
+++ b/Actor.cpp	Sun Mar 17 12:47:19 2013 +0400
@@ -3933,20 +3933,10 @@
 //----- (0045959A) --------------------------------------------------------
 void Actor::PrepareSprites(char load_sounds_if_bit1_set)
 {
-  //Actor *v2; // edi@1
-  MonsterDesc *v3; // esi@1
-  //__int16 v4; // ax@2
-  unsigned __int16 *v5; // ecx@4
-  unsigned __int16 *v6; // eax@4
-  signed int v7; // edx@4
-  //char pSpriteName[120]; // [sp+Ch] [bp-88h]@2
+  
+  MonsterDesc *v3; // esi@1 
   MonsterInfo *v9; // [sp+84h] [bp-10h]@1
-  //int v10; // [sp+88h] [bp-Ch]@1
-  //char *Source; // [sp+8Ch] [bp-8h]@1
-  //unsigned __int16 *v12; // [sp+90h] [bp-4h]@1
-
-  //v2 = this;
-  //v10 = 8;
+ 
   v3 = &pMonsterList->pMonsters[pMonsterInfo.uID - 1];
   v9 = &pMonsterStats->pInfos[pMonsterInfo.uID - 1 + 1];
   //v12 = pSpriteIDs;
@@ -3956,29 +3946,15 @@
   {
     //strcpy(pSpriteName, v3->pSpriteNames[i]);
     pSpriteIDs[i] = pSpriteFrameTable->FastFindSprite(v3->pSpriteNames[i]);
-    //*v12 = v4;
     pSpriteFrameTable->InitializeSprite(pSpriteIDs[i]);
-    //++v12;
-    //Source += 10;
-    //--v10;
   }
-  //while ( v10 );
   uActorHeight = v3->uMonsterHeight;
   uActorRadius = v3->uMonsterRadius;
   uMovementSpeed = v9->uBaseSpeed;
   if ( !(load_sounds_if_bit1_set & 1) )
   {
-    v5 = pSoundSampleIDs;
-    v6 = v3->pSoundSampleIDs;
-    v7 = 4;
-    do
-    {
-      *v5 = *v6;
-      ++v6;
-      ++v5;
-      --v7;
-    }
-    while ( v7 );
+    for (int i=0;i<4;++i )
+       pSoundSampleIDs[i]=v3->pSoundSampleIDs[i];
   }
 }
 
--- a/Monsters.cpp	Sun Mar 17 01:50:34 2013 +0400
+++ b/Monsters.cpp	Sun Mar 17 12:47:19 2013 +0400
@@ -182,13 +182,20 @@
 
 
 //----- (004563FF) --------------------------------------------------------
-signed int MonsterStats::_4563FF(const char *Str2)
+signed int MonsterStats::FindMonsterByName(const char *Str2)
 {
   MonsterStats *v2; // esi@1
   signed int v3; // ebx@1
   MonsterInfo *v4; // edi@2
   signed int result; // eax@6
-
+/*
+  for (int i=1; i<=uNumMonsters; ++i)
+      {
+        if()
+            return i;
+      }
+  return -1;
+  */
   v2 = this;
   v3 = 1;
   if ( (signed int)this->uNumMonsters <= 1 )
@@ -199,7 +206,7 @@
   else
   {
     v4 = &this->pInfos[1];
-    while ( !v4->pName || _strcmpi(v4->pTexture, Str2) )
+    while ( !v4->pName || _strcmpi(v4->pPictureName, Str2) )
     {
       ++v3;
       ++v4;
@@ -262,126 +269,574 @@
 
 //----- (0045501E) --------------------------------------------------------
 void MonsterStats::Initialize()
-{
-  MonsterStats *v1; // ebx@1
-  int v2; // ebx@4
-  char v3; // cl@5
-  int v4; // eax@5
-  size_t v5; // eax@19
-  signed int v6; // edi@19
-  MonsterStats *v7; // ecx@23
-  int v8; // eax@23
-  unsigned int *pHP; // esi@23
-  size_t v10; // eax@29
-  signed int v11; // edi@29
-  MonsterStats *v12; // ecx@33
-  int v13; // eax@33
-  unsigned int *pExp; // esi@33
-  signed int v15; // edi@36
-  size_t v16; // esi@36
-  int v17; // eax@37
-  MonsterInfo *v18; // esi@45
-  size_t v19; // edi@50
-  int v20; // eax@51
-  unsigned __int8 v21; // al@55
-  size_t v22; // edi@59
-  char v23; // cl@63
-  const char *v24; // edi@63
-  unsigned __int16 *v25; // esi@114
-  int v26; // eax@118
-  size_t v27; // eax@136
-  int v28; // edi@137
-  MonsterStats *v29; // esi@137
-  int v30; // eax@138
-  int v31; // eax@142
-  int v32; // eax@143
-  int v33; // eax@144
-  int v34; // eax@151
-  int v35; // eax@152
-  int v36; // eax@153
-  int v37; // eax@162
-  int v38; // eax@163
-  int v39; // eax@164
-  int v40; // eax@171
-  int v41; // eax@172
-  size_t v42; // eax@180
-  int v43; // edi@180
-  MonsterInfo *v44; // esi@180
-  int v45; // edi@184
-  MonsterInfo *v46; // eax@232
-  char *v47; // edx@232
-  char *v48; // ecx@232
-  MonsterInfo *v49; // eax@236
-  FrameTableTxtLine *v50; // esi@240
-  int v51; // eax@240
-  int v52; // eax@241
-  int v53; // esi@242
-  int v54; // edi@242
-  char v55; // al@242
-  char *v56; // edi@242
-  FrameTableTxtLine *v57; // esi@249
-  int v58; // eax@249
-  MonsterInfo *v59; // eax@250
-  MonsterInfo *v60; // esi@251
-  int v61; // edi@251
-  char v62; // al@251
-  char *v63; // edi@251
-  char v64; // al@258
-  char v65; // al@262
-  char v66; // al@266
-  char v67; // al@270
-  char v68; // al@274
-  char v69; // al@278
-  char v70; // al@282
-  char v71; // al@286
-  char v72; // al@290
-  unsigned __int8 v73; // al@294
-  int v74; // edi@298
-  MonsterInfo *v75; // esi@300
-  MonsterInfo *v76; // esi@302
-  char **v77; // edi@306
-  __int16 v78; // ax@316
-  MonsterInfo *v79; // esi@323
-  const char *v80; // ecx@323
-  std::string v81; // [sp-14h] [bp-46Ch]@317
-  const char *v82; // [sp-8h] [bp-460h]@306
-  char *v83; // [sp-4h] [bp-45Ch]@23
-  char *v84; // [sp+0h] [bp-458h]@37
-  FrameTableTxtLine v85; // [sp+10h] [bp-448h]@297
-  FrameTableTxtLine v86; // [sp+8Ch] [bp-3CCh]@249
-  FrameTableTxtLine v87; // [sp+108h] [bp-350h]@240
-  char Src[120]; // [sp+184h] [bp-2D4h]@317
-  FrameTableTxtLine v89; // [sp+1FCh] [bp-25Ch]@249
-  FrameTableTxtLine v90; // [sp+278h] [bp-1E0h]@240
-  char Str[64]; // [sp+2F4h] [bp-164h]@240
-  char Dest[64]; // [sp+334h] [bp-124h]@249
-  char v93[64]; // [sp+374h] [bp-E4h]@297
-  FrameTableTxtLine v94; // [sp+3B4h] [bp-A4h]@297
-  int v95; // [sp+430h] [bp-28h]@317
-  int v96; // [sp+434h] [bp-24h]@9
-  int v97; // [sp+438h] [bp-20h]@4
-  char a3[5]; // [sp+43Fh] [bp-19h]@4
-  int a2; // [sp+444h] [bp-14h]@36
-  int v100; // [sp+448h] [bp-10h]@36
-  size_t v101; // [sp+44Ch] [bp-Ch]@19
-  MonsterStats *v102; // [sp+450h] [bp-8h]@1
-  int v103; // [sp+454h] [bp-4h]@3
+    {
+    MonsterStats *v1; // ebx@1
+    int v2; // ebx@4
+    char v3; // cl@5
+    int v4; // eax@5
+    size_t v5; // eax@19
+    signed int v6; // edi@19
+    MonsterStats *v7; // ecx@23
+    int v8; // eax@23
+    unsigned int *pHP; // esi@23
+    size_t v10; // eax@29
+    signed int v11; // edi@29
+    MonsterStats *v12; // ecx@33
+    int v13; // eax@33
+    unsigned int *pExp; // esi@33
+    signed int v15; // edi@36
+    size_t v16; // esi@36
+    int v17; // eax@37
+    MonsterInfo *v18; // esi@45
+    size_t v19; // edi@50
+    int v20; // eax@51
+    unsigned __int8 v21; // al@55
+    size_t v22; // edi@59
+    char v23; // cl@63
+    const char *v24; // edi@63
+    unsigned __int16 *v25; // esi@114
+    int v26; // eax@118
+    size_t v27; // eax@136
+    int v28; // edi@137
+    MonsterStats *v29; // esi@137
+    int v30; // eax@138
+    int v31; // eax@142
+    int v32; // eax@143
+    int v33; // eax@144
+    int v34; // eax@151
+    int v35; // eax@152
+    int v36; // eax@153
+    int v37; // eax@162
+    int v38; // eax@163
+    int v39; // eax@164
+    int v40; // eax@171
+    int v41; // eax@172
+    size_t v42; // eax@180
+    int v43; // edi@180
+    MonsterInfo *v44; // esi@180
+    int v45; // edi@184
+    MonsterInfo *v46; // eax@232
+    char *v47; // edx@232
+    char *v48; // ecx@232
+    MonsterInfo *v49; // eax@236
+    FrameTableTxtLine *v50; // esi@240
+    int v51; // eax@240
+    int v52; // eax@241
+    int v53; // esi@242
+    int v54; // edi@242
+    char v55; // al@242
+    char *v56; // edi@242
+    FrameTableTxtLine *v57; // esi@249
+    int v58; // eax@249
+    MonsterInfo *v59; // eax@250
+    MonsterInfo *v60; // esi@251
+    int v61; // edi@251
+    char v62; // al@251
+    char *v63; // edi@251
+    char v64; // al@258
+    char v65; // al@262
+    char v66; // al@266
+    char v67; // al@270
+    char v68; // al@274
+    char v69; // al@278
+    char v70; // al@282
+    char v71; // al@286
+    char v72; // al@290
+    unsigned __int8 v73; // al@294
+    int v74; // edi@298
+    MonsterInfo *v75; // esi@300
+    MonsterInfo *v76; // esi@302
+    char **v77; // edi@306
+    __int16 v78; // ax@316
+    MonsterInfo *v79; // esi@323
+    const char *v80; // ecx@323
+    std::string v81; // [sp-14h] [bp-46Ch]@317
+    const char *v82; // [sp-8h] [bp-460h]@306
+    char *v83; // [sp-4h] [bp-45Ch]@23
+    char *v84; // [sp+0h] [bp-458h]@37
+    FrameTableTxtLine v85; // [sp+10h] [bp-448h]@297
+    FrameTableTxtLine v86; // [sp+8Ch] [bp-3CCh]@249
+    FrameTableTxtLine v87; // [sp+108h] [bp-350h]@240
+    char Src[120]; // [sp+184h] [bp-2D4h]@317
+    FrameTableTxtLine v89; // [sp+1FCh] [bp-25Ch]@249
+    FrameTableTxtLine v90; // [sp+278h] [bp-1E0h]@240
+    char Str[64]; // [sp+2F4h] [bp-164h]@240
+    char Dest[64]; // [sp+334h] [bp-124h]@249
+    char v93[64]; // [sp+374h] [bp-E4h]@297
+    FrameTableTxtLine v94; // [sp+3B4h] [bp-A4h]@297
+    int v95; // [sp+430h] [bp-28h]@317
+    int v96; // [sp+434h] [bp-24h]@9
+    int v97; // [sp+438h] [bp-20h]@4
+    char a3[5]; // [sp+43Fh] [bp-19h]@4
+    int a2; // [sp+444h] [bp-14h]@36
+    int v100; // [sp+448h] [bp-10h]@36
+    size_t v101; // [sp+44Ch] [bp-Ch]@19
+    MonsterStats *v102; // [sp+450h] [bp-8h]@1
+    int v103; // [sp+454h] [bp-4h]@3
+
+    int i,j;
+    char* test_string;
+    unsigned char c;
+    bool break_loop;
+    unsigned int temp_str_len;
+    char* tmp_pos;
+    int decode_step;
+    int item_counter;
+    int curr_rec_num;
+
+    v1 = this;
+    v102 = this;
+    if ( pMonstersTXT_Raw )
+        pAllocator->FreeChunk(pMonstersTXT_Raw);
+    pMonstersTXT_Raw = NULL;
+    pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0);
+    strtok(pMonstersTXT_Raw, "\r");
+    strtok(NULL, "\r");
+    strtok(NULL, "\r");
+    strtok(NULL, "\r");
+    uNumMonsters = 265;
+    curr_rec_num=0;
+    for (i=0;i<uNumMonsters-1;++i)
+        {
+        test_string = strtok(NULL, "\r") + 1;
+        break_loop = false;
+        decode_step=0;
+        do 
+            {
+            c = *(unsigned char*)test_string;
+            temp_str_len = 0;
+            while((c!='\t')&&(c>0))
+                {
+                ++temp_str_len;
+                c=test_string[temp_str_len];
+                }		
+            tmp_pos=test_string+temp_str_len;
+            if (*tmp_pos == 0)
+                break_loop = true;
+            *tmp_pos = 0;
+            if (temp_str_len)
+                {
+                switch (decode_step)
+                    {
+                case 0: 
+                    curr_rec_num=atoi(test_string);
+                    pInfos[curr_rec_num].uID=curr_rec_num;
+                    break;
+                case 1:
+                    pInfos[curr_rec_num].pName=RemoveQuotes(test_string);
+                    break;
+                case 2:
+                    pInfos[curr_rec_num].pPictureName=RemoveQuotes(test_string);
+                    break;
+                case 3:
+                    {
+                    pInfos[curr_rec_num].uLevel=atoi(test_string);
+                    }
+                    break;
+                case 4:
+                    {
+                    int str_len=0;
+                    int str_pos=0;
+                    pInfos[curr_rec_num].uHP=0;
+                    if (test_string[0]=='"')
+                        test_string[0]=' ';
+                    str_len=strlen(test_string);
+                    if (str_len==0)
+                        break;
+                    while ((test_string[str_pos]!=',')&&(str_pos<str_len))
+                        ++str_pos;
+                    if (str_len==str_pos)
+                        pInfos[curr_rec_num].uHP=atoi(test_string);
+                    else
+                        {
+                        test_string[str_pos]='\0';
+                        pInfos[curr_rec_num].uHP=1000*atoi(test_string);
+                        pInfos[curr_rec_num].uHP+=atoi(&test_string[str_pos+1]);
+                        test_string[str_pos]=',';
+                        }
+                    }
+                    break;
+                case 5:
+                    {
+                    pInfos[curr_rec_num].uAC=atoi(test_string);
+                    }
+                    break;
+                case 6:
+                    {
+                    int str_len=0;
+                    int str_pos=0;
+                    pInfos[curr_rec_num].uExp=0;
+                    if (test_string[0]=='"')
+                        test_string[0]=' ';
+                    str_len=strlen(test_string);
+                    if (str_len==0)
+                        break;
+                    while ((test_string[str_pos]!=',')&&(str_pos<str_len))
+                        ++str_pos;
+                    if (str_len==str_pos)
+                        pInfos[curr_rec_num].uExp=atoi(test_string);
+                    else
+                        {
+                        test_string[str_pos]='\0';
+                        pInfos[curr_rec_num].uExp=1000*atoi(test_string);
+                        pInfos[curr_rec_num].uExp+=atoi(&test_string[str_pos+1]);
+                        test_string[str_pos]=',';
+                        }
+                    }
+                    break;
+                case 7:
+                    {
+                    int str_len=0;
+                    int str_pos=0;
+                    bool chance_flag=false;
+                    bool dice_flag=false;
+                    bool item_type_flag=false;
+                    char* item_name;
+                    pInfos[curr_rec_num].uTreasureDropChance=0;
+                    pInfos[curr_rec_num].uTreasureDiceRolls=0;
+                    pInfos[curr_rec_num].uTreasureDiceSides=0;
+                    if (test_string[0]=='"')
+                        test_string[0]=' ';
+                    str_len=strlen(test_string);
+                    do
+                        {
+                        switch(tolower(test_string[str_pos]))
+                            {
+                        case '%': chance_flag=true; break;
+                        case 'd': dice_flag=true; break;
+                        case 'l': item_type_flag=true; break;
+                            }
+                        ++str_pos;
+                        }
+                        while(str_pos<str_len);
+                        if (chance_flag)
+                            {
+                            pInfos[curr_rec_num].uTreasureDropChance=atoi(test_string);
+                            }
+                        else
+                            {
+                            if ((!dice_flag)&&(!item_type_flag))
+                                break;
+                            pInfos[curr_rec_num].uTreasureDropChance=100;
+                            }
+                        if (dice_flag)
+                            {
+                            str_pos=0;
+                            dice_flag=false;
+                            do
+                                {
+                                switch(tolower(test_string[str_pos]))
+                                    {
+                                case '%': 
+                                    pInfos[curr_rec_num].uTreasureDiceRolls=atoi(&test_string[str_pos+1]);
+                                    dice_flag=true;
+                                    break;
+                                case 'd':
+                                    if(!dice_flag)
+                                        pInfos[curr_rec_num].uTreasureDiceRolls=atoi(test_string);
+                                    pInfos[curr_rec_num].uTreasureDiceSides=atoi(&test_string[str_pos+1]);
+                                    str_pos=str_len;
+                                    break;
 
-  v1 = this;
-  v102 = this;
-  if ( pMonstersTXT_Raw )
-    pAllocator->FreeChunk(pMonstersTXT_Raw);
-  pMonstersTXT_Raw = 0;
-  pMonstersTXT_Raw = (char *)pEvents_LOD->LoadRaw("monsters.txt", 0);
-  strtok(pMonstersTXT_Raw, "\r");
-  strtok(0, "\r");
-  strtok(0, "\r");
-  strtok(0, "\r");
+                                    }
+                                ++str_pos;
+                                }
+                                while(str_pos<str_len);
+                            }
+                        if (item_type_flag)
+                            {
+                            str_pos=0;
+                            do
+                                {
+                                if (tolower(test_string[str_pos])=='l')
+                                    break;
+                                ++str_pos;
+                                }
+                                while(str_pos<str_len);
+                                pInfos[curr_rec_num].uTreasureType=0;
+                                pInfos[curr_rec_num].uTreasureLevel=test_string[str_pos+1]-'0';
+                                item_name=&test_string[str_pos+2];
+                                if (*item_name)
+                                    {
+                                    if ( !_strcmpi(item_name, "WEAPON"))
+                                        pInfos[curr_rec_num].uTreasureType= 20;
+                                    else if ( !_strcmpi(item_name, "ARMOR"))
+                                        pInfos[curr_rec_num].uTreasureType= 21;
+                                    else if ( !_strcmpi(item_name, "MISC"))
+                                        pInfos[curr_rec_num].uTreasureType= 22;
+                                    else if ( !_strcmpi(item_name, "SWORD"))
+                                        pInfos[curr_rec_num].uTreasureType= 23;
+                                    else if ( !_strcmpi(item_name, "DAGGER"))
+                                        pInfos[curr_rec_num].uTreasureType= 24;
+                                    else if ( !_strcmpi(item_name, "AXE"))
+                                        pInfos[curr_rec_num].uTreasureType= 25;
+                                    else if ( !_strcmpi(item_name, "SPEAR"))
+                                        pInfos[curr_rec_num].uTreasureType= 26;
+                                    else if ( !_strcmpi(item_name, "BOW"))
+                                        pInfos[curr_rec_num].uTreasureType= 27;
+                                    else if ( !_strcmpi(item_name, "MACE"))
+                                        pInfos[curr_rec_num].uTreasureType= 28;
+                                    else if ( !_strcmpi(item_name, "CLUB"))
+                                        pInfos[curr_rec_num].uTreasureType= 29;
+                                    else if ( !_strcmpi(item_name, "STAFF"))
+                                        pInfos[curr_rec_num].uTreasureType= 30;
+                                    else if ( !_strcmpi(item_name, "LEATHER"))
+                                        pInfos[curr_rec_num].uTreasureType= 31;
+                                    else if ( !_strcmpi(item_name, "CHAIN"))
+                                        pInfos[curr_rec_num].uTreasureType= 32;
+                                    else if ( !_strcmpi(item_name, "PLATE"))
+                                        pInfos[curr_rec_num].uTreasureType= 33;
+                                    else if ( !_strcmpi(item_name, "SHIELD"))
+                                        pInfos[curr_rec_num].uTreasureType= 34;
+                                    else if ( !_strcmpi(item_name, "HELM"))
+                                        pInfos[curr_rec_num].uTreasureType= 35;
+                                    else if ( !_strcmpi(item_name, "BELT"))
+                                        pInfos[curr_rec_num].uTreasureType= 36;
+                                    else if ( !_strcmpi(item_name, "CAPE"))
+                                        pInfos[curr_rec_num].uTreasureType= 37;
+                                    else if ( !_strcmpi(item_name, "GAUNTLETS"))
+                                        pInfos[curr_rec_num].uTreasureType= 38;
+                                    else if ( !_strcmpi(item_name, "BOOTS"))
+                                        pInfos[curr_rec_num].uTreasureType= 39;
+                                    else if ( !_strcmpi(item_name, "RING"))
+                                        pInfos[curr_rec_num].uTreasureType= 40;
+                                    else if ( !_strcmpi(item_name, "AMULET"))
+                                        pInfos[curr_rec_num].uTreasureType= 41;
+                                    else if ( !_strcmpi(item_name, "WAND"))
+                                        pInfos[curr_rec_num].uTreasureType= 42;
+                                    else if ( !_strcmpi(item_name, "SCROLL"))
+                                        pInfos[curr_rec_num].uTreasureType= 43;
+                                    else if ( !_strcmpi(item_name, "GEM"))
+                                        pInfos[curr_rec_num].uTreasureType= 46;
+                                    }
+                            }
+
+                    }
+                    break;
+                case 8:
+                    {
+                    pInfos[curr_rec_num].bQuestMonster=0;
+                    if (atoi(test_string))
+                        pInfos[curr_rec_num].bQuestMonster=1;
+                    }
+                    break;
+                case 9:
+                    {
+                    pInfos[curr_rec_num].uFlying=false;
+                    if (_strnicmp(test_string, "n",1))
+                        pInfos[curr_rec_num].uFlying=true;
+                    }
+                    break;
+                case 10:
+                    {
+                    switch(tolower(test_string[0]))
+                        {
+                    case 's': pInfos[curr_rec_num].uMovementType=0;// short
+                        if (tolower(test_string[1])!='h')
+                            pInfos[curr_rec_num].uMovementType=5; //??
+                        break;  //short
+                    case 'l': pInfos[curr_rec_num].uMovementType=2;  break; //long
+                    case 'm': pInfos[curr_rec_num].uMovementType=1; break; //med
+                    case 'g': pInfos[curr_rec_num].uMovementType=3; break; //???     
+                    default:
+                        pInfos[curr_rec_num].uMovementType=4; //free
+                        }       
+                    }
+                    break;
+                case 11:
+                    {
+                    switch(tolower(test_string[0]))
+                        {
+                    case 's': pInfos[curr_rec_num].uAIType=0; break; // suicide
+                    case 'w': pInfos[curr_rec_num].uAIType=1;  break; //wimp
+                    case 'n': pInfos[curr_rec_num].uAIType=2; break; //normal 
+                    default:
+                        pInfos[curr_rec_num].uAIType=3; //Agress
+                        }       
+                    }
+                    break;
+                case 12:
+                    {
+                    pInfos[curr_rec_num].uHostilityType=(MonsterInfo::HostilityRadius)atoi(test_string);
+                    }
+                    break;
+                case 13:
+                    {
+                    pInfos[curr_rec_num].uBaseSpeed=atoi(test_string);
+                    }
+                    break;
+                case 14:
+                    {
+                    pInfos[curr_rec_num].uRecoveryTime=atoi(test_string);
+                    }
+                    break;
+                case 15:
+                    {
+                    int str_len=0;
+                    int str_pos=0;
+                    pInfos[curr_rec_num].uAttackPreference=0;
+                    pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=0;
+                    str_len=strlen(test_string);
+                    for (str_pos=0;str_pos<str_len;++str_pos )
+                        {
+                        switch(tolower(test_string[str_pos]))
+                            {
+                        case '0': pInfos[curr_rec_num].uAttackPreference|=0x0004; break;
+                        case '2': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=2; break;
+                        case '3': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=3; break;
+                        case '4': pInfos[curr_rec_num].uNumCharactersAttackedPerSpecialAbility=4; break;
+                        case 'c': pInfos[curr_rec_num].uAttackPreference|=0x0010; break;
+                        case 'd': pInfos[curr_rec_num].uAttackPreference|=0x0008; break;
+                        case 'e': pInfos[curr_rec_num].uAttackPreference|=0x0100; break;
+                        case 'f': pInfos[curr_rec_num].uAttackPreference|=0x0400; break;
+                        case 'h': pInfos[curr_rec_num].uAttackPreference|=0x0800; break;
+                        case 'k': pInfos[curr_rec_num].uAttackPreference|=0x0001; break;
+                        case 'm': pInfos[curr_rec_num].uAttackPreference|=0x0100; break;
+                        case 'o': pInfos[curr_rec_num].uAttackPreference|=0x0400; break;
+                        case 'p': pInfos[curr_rec_num].uAttackPreference|=0x0002; break;
+                        case 'r': pInfos[curr_rec_num].uAttackPreference|=0x0040; break;
+                        case 's': pInfos[curr_rec_num].uAttackPreference|=0x0020; break;
+                        case 't': pInfos[curr_rec_num].uAttackPreference|=0x0080; break;
+                        case 'w': pInfos[curr_rec_num].uAttackPreference|=0x2000; break;
+                        case 'x': pInfos[curr_rec_num].uAttackPreference|=0x0200; break;
+                        case 'l':  break;
+                            }
+                        }
+                    }
+                    break;
+                    /*    case 16:
+                    {
+
+                    }
+                    break;
+                    case 17:
+                    {
+
+                    }
+                    break;
+                    case 18:
+                    {
+
+                    }
+                    break;
+                    case 19:
+                    {
+
+                    }
+                    break;
+                    case 20:
+                    {
+
+                    }
+                    break;
+                    case 21:
+                    {
+
+                    }
+                    break;
+                    case 22:
+                    {
+
+                    }
+                    break;
+                    case 23:
+                    {
+
+                    }
+                    break;
+                    case 24:
+                    {
+
+                    }
+                    break;
+                    case 25:
+                    {
+
+                    }
+                    break;
+                    case 26:
+                    {
+
+                    }
+                    break;
+                    case 27:
+                    {
+
+                    }
+                    break;
+                    case 28:
+                    {
+
+                    }
+                    break;
+                    case 29:
+                    {
+
+                    }
+                    break;
+                    case 30:
+                    {
+
+                    }
+                    break;
+                    case 31:
+                    {
+
+                    }
+                    break;
+                    case 32:
+                    {
+
+                    }
+                    break;
+                    case 33:
+                    {
+
+                    }
+                    break;
+                    case 34:
+                    {
+
+                    }
+                    break;
+                    case 35:
+                    {
+
+                    }
+                    break;
+                    case 36:
+                    {
+
+                    }
+                    break;
+                    case 37:
+                    {
+
+                    }
+                    break;
+                    case 38:
+                    {
+
+                    }
+                    break;   */  
+                    }
+                }
+            else
+                { 
+                break_loop = true;
+                }
+            ++decode_step;
+            test_string=tmp_pos+1;
+            } while ((decode_step<39)&&!break_loop);
+        }
+    uNumMonsters = i;
+
+/*
   v103 = 0;
   v1->uNumMonsters = 265;
   do
   {
-    v2 = (int)(strtok(0, "\r") + 1);
+    v2 = (int)(strtok(NULL, "\r") + 1);
     *(_DWORD *)&a3[1] = 0;
     v97 = 0;
     do
@@ -401,12 +856,12 @@
       {
         switch ( *(_DWORD *)&a3[1] )
         {
-          case 0:
+       /*   case 0:
             v103 = atoi((const char *)v2);
             v102->pInfos[v103].uID = v103;
             goto LABEL_325;
           case 2:
-            v102->pInfos[v103].pTexture = RemoveQuotes((char *)v2);
+            v102->pInfos[v103].pPictureName = RemoveQuotes((char *)v2);
             goto LABEL_325;
           case 1:
             v102->pInfos[v103].pName = RemoveQuotes((char *)v2);
@@ -1459,6 +1914,7 @@
   }
   while ( v103 < 265 );
   v102->uNumMonsters = v103;
+  */
 }
 
 
--- a/Monsters.h	Sun Mar 17 01:50:34 2013 +0400
+++ b/Monsters.h	Sun Mar 17 12:47:19 2013 +0400
@@ -87,7 +87,7 @@
   };
 
   char *pName;
-  char *pTexture;
+  char *pPictureName;
   unsigned __int8 uLevel;
   unsigned __int8 uTreasureDropChance;
   unsigned __int8 uTreasureDiceRolls;
@@ -155,12 +155,12 @@
 {
   void Initialize();
   void InitializePlacements();
-  signed int _4563FF(const char *Str2);
+  signed int FindMonsterByName(const char *Str2);
 
   static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype);
 
   MonsterInfo pInfos[265];  //0 - 5b18h
-  char *pPlaceStrings[31];; //5B18h placement counts from 1
+  char *pPlaceStrings[31]; //5B18h placement counts from 1
   unsigned int uNumMonsters;  //5B94h
   unsigned int uNumPlacements; //5B98h
   int field_5B9C;
--- a/mm7_2.cpp	Sun Mar 17 01:50:34 2013 +0400
+++ b/mm7_2.cpp	Sun Mar 17 12:47:19 2013 +0400
@@ -5255,7 +5255,7 @@
         ExitProcess(0);
       }
       v27 = &pMonsterList->pMonsters[(signed __int16)v26];
-      v28 = pMonsterStats->_4563FF(pTexture);
+      v28 = pMonsterStats->FindMonsterByName(pTexture);
       if ( !v28 )
         v28 = 1;
       Src = &pMonsterStats->pInfos[v28];