changeset 756:3523c3b581e5

Merge
author Nomad
date Sat, 23 Mar 2013 00:18:02 +0200
parents e0914a9bc424 (current diff) 5ba796adbf5e (diff)
children 0b3f4b854652 9f7db515a8d7 7f1487b74571 02bfc82f429c
files
diffstat 6 files changed, 143 insertions(+), 1299 deletions(-) [+]
line wrap: on
line diff
--- a/Monsters.cpp	Sat Mar 23 00:16:17 2013 +0200
+++ b/Monsters.cpp	Sat Mar 23 00:18:02 2013 +0200
@@ -478,40 +478,14 @@
 
 
 //----- (004563FF) --------------------------------------------------------
-signed int MonsterStats::FindMonsterByName(const char *Str2)
+signed int MonsterStats::FindMonsterByTextureName(const char *monster_textr_name)
 {
-  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)
+  for (int i=1; i<uNumMonsters; ++i)
       {
-        if()
+        if((pInfos[i].pName )&& (!_strcmpi(pInfos[i].pPictureName, monster_textr_name)))
             return i;
       }
   return -1;
-  */
-  v2 = this;
-  v3 = 1;
-  if ( (signed int)this->uNumMonsters <= 1 )
-  {
-LABEL_6:
-    result = -1;
-  }
-  else
-  {
-    v4 = &this->pInfos[1];
-    while ( !v4->pName || _strcmpi(v4->pPictureName, Str2) )
-    {
-      ++v3;
-      ++v4;
-      if ( v3 >= (signed int)v2->uNumMonsters )
-        goto LABEL_6;
-    }
-    result = v3;
-  }
-  return result;
 }
 
 
@@ -566,110 +540,6 @@
 //----- (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 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;
@@ -680,9 +550,9 @@
     int item_counter;
     int curr_rec_num;
     char parse_str[64]; 
+    char Src[120];
+    FrameTableTxtLine parsed_field;
 
-    v1 = this;
-    v102 = this;
     if ( pMonstersTXT_Raw )
         pAllocator->FreeChunk(pMonstersTXT_Raw);
     pMonstersTXT_Raw = NULL;
@@ -1054,13 +924,13 @@
                     strcpy(parse_str,test_string);
                     parse_str[0]=' ';
                     parse_str[strlen(parse_str)-1]=' ';
-                    frame_table_txt_parser(parse_str,&v85);
-                    if (v85.uPropCount>2)
+                    frame_table_txt_parser(parse_str,&parsed_field);
+                    if (parsed_field.uPropCount>2)
                         {
                         param_num=1;
-                        pInfos[curr_rec_num].uSpell1ID=ParseSpellType(&v85,&param_num);
-                        type_flag=*v85.pProperties[param_num];
-                        pInfos[curr_rec_num].uSpellSkillAndMastery1=atoi(v85.pProperties[param_num+1])&0x003F;
+                        pInfos[curr_rec_num].uSpell1ID=ParseSpellType(&parsed_field,&param_num);
+                        type_flag=*parsed_field.pProperties[param_num];
+                        pInfos[curr_rec_num].uSpellSkillAndMastery1=atoi(parsed_field.pProperties[param_num+1])&0x003F;
                         switch(type_flag)
                             {
                         case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery1|=0x0040; break;
@@ -1086,13 +956,13 @@
                     strcpy(parse_str,test_string);
                     parse_str[0]=' ';
                     parse_str[strlen(parse_str)-1]=' ';
-                    frame_table_txt_parser(parse_str,&v85);
-                    if (v85.uPropCount>2)
+                    frame_table_txt_parser(parse_str,&parsed_field);
+                    if (parsed_field.uPropCount>2)
                         {
                         param_num=1;
-                        pInfos[curr_rec_num].uSpell2ID=ParseSpellType(&v85,&param_num);
-                        type_flag=*v85.pProperties[param_num];
-                        pInfos[curr_rec_num].uSpellSkillAndMastery2=atoi(v85.pProperties[param_num+1])&0x003F;
+                        pInfos[curr_rec_num].uSpell2ID=ParseSpellType(&parsed_field,&param_num);
+                        type_flag=*parsed_field.pProperties[param_num];
+                        pInfos[curr_rec_num].uSpellSkillAndMastery2=atoi(parsed_field.pProperties[param_num+1])&0x003F;
                         switch(type_flag)
                             {
                         case 'E': pInfos[curr_rec_num].uSpellSkillAndMastery2|=0x0040; break;
@@ -1189,7 +1059,88 @@
                     break;
                     case 38:
                     {
-
+                    int param_num;
+                    char type_flag;
+                    pInfos[curr_rec_num].uSpecialAbilityType=0;
+                    pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=0;
+                    strcpy(parse_str,test_string);
+                    parse_str[0]=' ';
+                    parse_str[strlen(parse_str)-1]=' ';
+                    frame_table_txt_parser(parse_str,&parsed_field);
+                    if ( parsed_field.uPropCount )
+                        {
+                  //      v74 = v94.field_0;
+                        if ( parsed_field.uPropCount < 10 )
+                            {
+                            if (! _strcmpi(parsed_field.pProperties[0], "shot") )
+                                {
+                                pInfos[curr_rec_num].uSpecialAbilityType=1;
+                                pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus=atoi((char *)(parsed_field.pProperties[1] + 1));
+                                }
+                            else  if (!_strcmpi(parsed_field.pProperties[0], "summon") )
+                            {
+                            pInfos[curr_rec_num].uSpecialAbilityType=2;
+                            if ( parsed_field.uPropCount  > 1 )
+                                {
+                                pTmpBuf[0] = 0;
+                                strcpy(pTmpBuf, parsed_field.pProperties[2]);
+                                if ( parsed_field.uPropCount  > 2 )
+                                    {
+                                    int prop_cnt = 3;
+                                    if ( parsed_field.uPropCount  > 3 )
+                                        {
+                                        do
+                                            {
+                                            strcat(pTmpBuf, " ");
+                                            char test_char = parsed_field.pProperties[prop_cnt][0];
+                                            strcat(pTmpBuf, parsed_field.pProperties[prop_cnt]);
+                                            if ( prop_cnt == (parsed_field.uPropCount - 1) )
+                                                {
+                                                switch (tolower(test_char))
+                                                {
+                                                case 'a': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 1; break;
+                                                case 'b': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 2; break;
+                                                case 'c': pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 3; break;
+                                                default:
+                                                    pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0;
+                                                }
+                                                
+                                                }
+                                            ++prop_cnt;
+                                            }
+                                        while ( prop_cnt < parsed_field.uPropCount );
+                                        }
+                                    }
+                                else
+                                    {
+                                    pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls = 0;
+                                    }
+                                if ( pMonsterList->uNumMonsters )
+                                    {
+                                    pInfos[curr_rec_num].field_3C_some_special_attack = pMonsterList->GetMonsterIDByName(pTmpBuf) + 1;
+                                    if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
+                                        {
+                                        sprintf(Src, "Can't create random monster: '%s' See MapStats!", pTmpBuf);
+                                        MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
+                                        }
+                                    }
+                                pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 0;
+                                if ( !_strcmpi(parsed_field.pProperties[1], "ground") )
+                                    pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides = 1;
+                                if ( pInfos[curr_rec_num].field_3C_some_special_attack == -1 )
+                                    pInfos[curr_rec_num].uSpecialAbilityType = 0;
+                                }
+                            }
+                            else  if (!_strcmpi(parsed_field.pProperties[0], "explode") )
+                                {
+                                pInfos[curr_rec_num].uSpecialAbilityType = 3;
+                                ParseDamage((char*)parsed_field.pProperties[1], &pInfos[curr_rec_num].uSpecialAbilityDamageDiceRolls,
+                                    &pInfos[curr_rec_num].uSpecialAbilityDamageDiceSides,
+                                    &pInfos[curr_rec_num].uSpecialAbilityDamageDiceBonus);
+                                pInfos[curr_rec_num].field_3C_some_special_attack = ParseAttackType(test_string);
+                                }
+                            }
+                        }
                     }
                     break;     
                     }
@@ -1203,1122 +1154,17 @@
             } while ((decode_step<39)&&!break_loop);
         }
     uNumMonsters = i;
-
-/*
-  v103 = 0;
-  v1->uNumMonsters = 265;
-  do
-  {
-    v2 = (int)(strtok(NULL, "\r") + 1);
-    *(_DWORD *)&a3[1] = 0;
-    v97 = 0;
-    do
-    {
-      v3 = *(_BYTE *)v2;
-      v4 = 0;
-      while ( v3 != 9 && v3 )
-      {
-        ++v4;
-        v3 = *(_BYTE *)(v4 + v2);
-      }
-      v96 = v4 + v2;
-      if ( !*(_BYTE *)(v4 + v2) )
-        v97 = 1;
-      *(_BYTE *)(v4 + v2) = 0;
-      if ( v4 )
-      {
-        switch ( *(_DWORD *)&a3[1] )
-        {
-       /*   case 0:
-            v103 = atoi((const char *)v2);
-            v102->pInfos[v103].uID = v103;
-            goto LABEL_325;
-          case 2:
-            v102->pInfos[v103].pPictureName = RemoveQuotes((char *)v2);
-            goto LABEL_325;
-          case 1:
-            v102->pInfos[v103].pName = RemoveQuotes((char *)v2);
-            goto LABEL_325;
-          case 3:
-            v102->pInfos[v103].uLevel = atoi((const char *)v2);
-            goto LABEL_325;
-          case 4:
-            if ( *(_BYTE *)v2 == 34 )
-              *(_BYTE *)v2 = 32;
-            v5 = strlen((const char *)v2);
-            v6 = 0;
-            v101 = v5;
-            if ( (signed int)v5 <= 0 )
-              goto LABEL_24;
-            while ( *(_BYTE *)(v6 + v2) != 44 )
-            {
-              ++v6;
-              if ( v6 >= (signed int)v5 )
-                goto LABEL_24;
-            }
-            v7 = v102;
-            v8 = v103;
-            *(_BYTE *)(v6 + v2) = 0;
-            pHP = &v7->pInfos[v8].uHP;
-            *pHP = 1000 * atoi((const char *)v2);
-            v83 = (char *)(v6 + v2 + 1);
-            *(_BYTE *)(v6 + v2) = 44;
-            *pHP += atoi(v83);
-LABEL_24:
-            if ( v6 == v101 )
-              v102->pInfos[v103].uHP = atoi((const char *)v2);
-            goto LABEL_325;
-          case 5:
-            v102->pInfos[v103].uAC = atoi((const char *)v2);
-            goto LABEL_325;
-          case 6:
-            if ( *(_BYTE *)v2 == 34 )
-              *(_BYTE *)v2 = 32;
-            v10 = strlen((const char *)v2);
-            v11 = 0;
-            v101 = v10;
-            if ( (signed int)v10 <= 0 )
-              goto LABEL_34;
-            while ( *(_BYTE *)(v11 + v2) != 44 )
-            {
-              ++v11;
-              if ( v11 >= (signed int)v10 )
-                goto LABEL_34;
-            }
-            v12 = v102;
-            v13 = v103;
-            *(_BYTE *)(v11 + v2) = 0;
-            pExp = &v12->pInfos[v13].uExp;
-            *pExp = 1000 * atoi((const char *)v2);
-            v83 = (char *)(v11 + v2 + 1);
-            *(_BYTE *)(v11 + v2) = 44;
-            *pExp += atoi(v83);
-LABEL_34:
-            if ( v11 == v101 )
-              v102->pInfos[v103].uExp = atoi((const char *)v2);
-            goto LABEL_325;
-          case 7:
-            v15 = 0;
-            a2 = 0;
-            v100 = 0;
-            v16 = 0;
-            v101 = strlen((const char *)v2);
-            if ( (signed int)v101 <= 0 )
-              goto LABEL_325;
-            do
-            {
-              v84 = (char *)*(_BYTE *)(v16 + v2);
-              v17 = tolower((int)v84);
-              switch ( v17 )
-              {
-                case 37:
-                  v15 = 1;
-                  break;
-                case 100:
-                  v100 = 1;
-                  break;
-                case 108:
-                  a2 = 1;
-                  break;
-              }
-              ++v16;
-            }
-            while ( (signed int)v16 < (signed int)v101 );
-            if ( v15 )
-            {
-              v18 = &v102->pInfos[v103];
-              v18->uTreasureDropChance = atoi((const char *)v2);
-            }
-            else
-            {
-              if ( !v100 && !a2 )
-                goto LABEL_325;
-              v18 = &v102->pInfos[v103];
-              v18->uTreasureDropChance = 100;
-            }
-            if ( v100 )
-            {
-              v19 = 0;
-              v100 = 0;
-              do
-              {
-                v84 = (char *)*(_BYTE *)(v19 + v2);
-                v20 = tolower((int)v84);
-                if ( v20 == 37 )
-                {
-                  v84 = (char *)(v19 + v2 + 1);
-                  v18->uTreasureDiceRolls = atoi(v84);
-                  v100 = 1;
-                }
-                else
-                {
-                  if ( v20 == 100 )
-                  {
-                    if ( !v100 )
-                      v18->uTreasureDiceRolls = atoi((const char *)v2);
-                    v84 = (char *)(v19 + v2 + 1);
-                    v21 = atoi(v84);
-                    v19 = v101;
-                    v18->uTreasureDiceSides = v21;
-                  }
-                }
-                ++v19;
-              }
-              while ( (signed int)v19 < (signed int)v101 );
-            }
-            if ( a2 )
-            {
-              v22 = 0;
-              while ( 1 )
-              {
-                v84 = (char *)*(_BYTE *)(v22 + v2);
-                if ( tolower((int)v84) == 108 )
-                  break;
-                ++v22;
-                if ( (signed int)v22 >= (signed int)v101 )
-                  goto LABEL_325;
-              }
-              v23 = *(_BYTE *)(v22 + v2 + 1);
-              v24 = (const char *)(v22 + v2 + 2);
-              v18->uTreasureLevel = v23 - 48;
-              if ( *v24 )
-              {
-                if ( _strcmpi(v24, "WEAPON") )
-                {
-                  if ( _strcmpi(v24, "ARMOR") )
-                  {
-                    if ( _strcmpi(v24, "MISC") )
-                    {
-                      if ( _strcmpi(v24, "SWORD") )
-                      {
-                        if ( _strcmpi(v24, "DAGGER") )
-                        {
-                          if ( _strcmpi(v24, "AXE") )
-                          {
-                            if ( _strcmpi(v24, "SPEAR") )
-                            {
-                              if ( _strcmpi(v24, "BOW") )
-                              {
-                                if ( _strcmpi(v24, "MACE") )
-                                {
-                                  if ( _strcmpi(v24, "CLUB") )
-                                  {
-                                    if ( _strcmpi(v24, "STAFF") )
-                                    {
-                                      if ( _strcmpi(v24, "LEATHER") )
-                                      {
-                                        if ( _strcmpi(v24, "CHAIN") )
-                                        {
-                                          if ( _strcmpi(v24, "PLATE") )
-                                          {
-                                            if ( _strcmpi(v24, "SHIELD") )
-                                            {
-                                              if ( _strcmpi(v24, "HELM") )
-                                              {
-                                                if ( _strcmpi(v24, "BELT") )
-                                                {
-                                                  if ( _strcmpi(v24, "CAPE") )
-                                                  {
-                                                    if ( _strcmpi(v24, "GAUNTLETS") )
-                                                    {
-                                                      if ( _strcmpi(v24, "BOOTS") )
-                                                      {
-                                                        if ( _strcmpi(v24, "RING") )
-                                                        {
-                                                          if ( _strcmpi(v24, "AMULET") )
-                                                          {
-                                                            if ( _strcmpi(v24, "WAND") )
-                                                            {
-                                                              if ( _strcmpi(v24, "SCROLL") )
-                                                              {
-                                                                if ( !_strcmpi(v24, "GEM") )
-                                                                  v18->uTreasureType = 46;
-                                                              }
-                                                              else
-                                                              {
-                                                                v18->uTreasureType = 43;
-                                                              }
-                                                            }
-                                                            else
-                                                            {
-                                                              v18->uTreasureType = 42;
-                                                            }
-                                                          }
-                                                          else
-                                                          {
-                                                            v18->uTreasureType = 41;
-                                                          }
-                                                        }
-                                                        else
-                                                        {
-                                                          v18->uTreasureType = 40;
-                                                        }
-                                                      }
-                                                      else
-                                                      {
-                                                        v18->uTreasureType = 39;
-                                                      }
-                                                    }
-                                                    else
-                                                    {
-                                                      v18->uTreasureType = 38;
-                                                    }
-                                                  }
-                                                  else
-                                                  {
-                                                    v18->uTreasureType = 37;
-                                                  }
-                                                }
-                                                else
-                                                {
-                                                  v18->uTreasureType = 36;
-                                                }
-                                              }
-                                              else
-                                              {
-                                                v18->uTreasureType = 35;
-                                              }
-                                            }
-                                            else
-                                            {
-                                              v18->uTreasureType = 34;
-                                            }
-                                          }
-                                          else
-                                          {
-                                            v18->uTreasureType = 33;
-                                          }
-                                        }
-                                        else
-                                        {
-                                          v18->uTreasureType = 32;
-                                        }
-                                      }
-                                      else
-                                      {
-                                        v18->uTreasureType = 31;
-                                      }
-                                    }
-                                    else
-                                    {
-                                      v18->uTreasureType = 30;
-                                    }
-                                  }
-                                  else
-                                  {
-                                    v18->uTreasureType = 29;
-                                  }
-                                }
-                                else
-                                {
-                                  v18->uTreasureType = 28;
-                                }
-                              }
-                              else
-                              {
-                                v18->uTreasureType = 27;
-                              }
-                            }
-                            else
-                            {
-                              v18->uTreasureType = 26;
-                            }
-                          }
-                          else
-                          {
-                            v18->uTreasureType = 25;
-                          }
-                        }
-                        else
-                        {
-                          v18->uTreasureType = 24;
-                        }
-                      }
-                      else
-                      {
-                        v18->uTreasureType = 23;
-                      }
-                    }
-                    else
-                    {
-                      v18->uTreasureType = 22;
-                    }
-                  }
-                  else
-                  {
-                    v18->uTreasureType = 21;
-                  }
-                }
-                else
-                {
-                  v18->uTreasureType = 20;
-                }
-              }
-            }
-            goto LABEL_325;
-          case 8:
-            v84 = (char *)v2;
-            v25 = &v102->pInfos[v103].bQuestMonster;
-            *v25 = 0;
-            if ( atoi(v84) )
-              *(_BYTE *)v25 |= 1u;
-            goto LABEL_325;
-          case 9:
-            v102->pInfos[v103].uFlying = _strnicmp((const char *)v2, "n", 1u);
-            goto LABEL_325;
-          case 0xA:
-            v84 = (char *)*(_BYTE *)v2;
-            v101 = 4;
-            if ( tolower((int)v84) == 's' )
-            {
-              v84 = (char *)*(_BYTE *)(v2 + 1);
-              v26 = tolower((int)v84) != 'h' ? 5 : 0;
-            }
-            else
-            {
-              v84 = (char *)*(_BYTE *)v2;
-              if ( tolower((int)v84) == 'm' )
-              {
-                v101 = 1;
-              }
-              else
-              {
-                v84 = (char *)*(_BYTE *)v2;
-                if ( tolower((int)v84) == 'l' )
-                {
-                  v101 = 2;
-                }
-                else
-                {
-                  v84 = (char *)*(_BYTE *)v2;
-                  if ( tolower((int)v84) == 'g' )
-                    v101 = 3;
-                }
-              }
-              LOBYTE(v26) = v101;
-            }
-            v102->pInfos[v103].uMovementType = v26;
-            goto LABEL_325;
-          case 0xB:
-            v84 = (char *)*(_BYTE *)v2;
-            v101 = 3;
-            if ( tolower((int)v84) == 's' )
-            {
-              v101 = 0;
-            }
-            else
-            {
-              v84 = (char *)*(_BYTE *)v2;
-              if ( tolower((int)v84) == 'w' )
-              {
-                v101 = 1;
-              }
-              else
-              {
-                v84 = (char *)*(_BYTE *)v2;
-                if ( tolower((int)v84) == 'n' )
-                  v101 = 2;
-              }
-            }
-            v102->pInfos[v103].uAIType = v101;
-            goto LABEL_325;
-          case 0xC:
-            v102->pInfos[v103].uHostilityType = (MonsterInfo::HostilityRadius)atoi((const char *)v2);
-            goto LABEL_325;
-          case 0xD:
-            v102->pInfos[v103].uBaseSpeed = atoi((const char *)v2);
-            goto LABEL_325;
-          case 0xF:
-            v27 = strlen((const char *)v2);
-            v100 = 0;
-            v101 = v27;
-            if ( (signed int)v27 > 0 )
-            {
-              v28 = v103;
-              v29 = v102;
-              do
-              {
-                v84 = (char *)*(_BYTE *)(v100 + v2);
-                v30 = tolower((int)v84);
-                if ( v30 > 107 )
-                {
-                  if ( v30 > 115 )
-                  {
-                    v40 = v30 - 116;
-                    if ( v40 )
-                    {
-                      v41 = v40 - 3;
-                      if ( v41 )
-                      {
-                        if ( v41 == 1 )
-                          BYTE1(v29->pInfos[v28].uAttackPreference) |= 2u;
-                      }
-                      else
-                      {
-                        BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x20u;
-                      }
-                    }
-                    else
-                    {
-                      LOBYTE(v29->pInfos[v28].uAttackPreference) |= 0x80u;
-                    }
-                  }
-                  else
-                  {
-                    if ( v30 == 115 )
-                    {
-                      v29->pInfos[v28].uAttackPreference |= 0x20u;
-                    }
-                    else
-                    {
-                      v37 = v30 - 109;
-                      if ( v37 )
-                      {
-                        v38 = v37 - 2;
-                        if ( v38 )
-                        {
-                          v39 = v38 - 1;
-                          if ( v39 )
-                          {
-                            if ( v39 == 2 )
-                              v29->pInfos[v28].uAttackPreference |= 0x40u;
-                          }
-                          else
-                          {
-                            v29->pInfos[v28].uAttackPreference |= 2u;
-                          }
-                        }
-                        else
-                        {
-                          BYTE1(v29->pInfos[v28].uAttackPreference) |= 4u;
-                        }
-                      }
-                      else
-                      {
-                        BYTE1(v29->pInfos[v28].uAttackPreference) |= 1u;
-                      }
-                    }
-                  }
-                }
-                else
-                {
-                  if ( v30 == 107 )
-                  {
-                    v29->pInfos[v28].uAttackPreference |= 1u;
-                  }
-                  else
-                  {
-                    if ( v30 > 99 )
-                    {
-                      v34 = v30 - 100;
-                      if ( v34 )
-                      {
-                        v35 = v34 - 1;
-                        if ( v35 )
-                        {
-                          v36 = v35 - 2;
-                          if ( v36 )
-                          {
-                            if ( v36 == 1 )
-                              BYTE1(v29->pInfos[v28].uAttackPreference) |= 8u;
-                          }
-                          else
-                          {
-                            BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x40u;
-                          }
-                        }
-                        else
-                        {
-                          BYTE1(v29->pInfos[v28].uAttackPreference) |= 0x10u;
-                        }
-                      }
-                      else
-                      {
-                        v29->pInfos[v28].uAttackPreference |= 8u;
-                      }
-                    }
-                    else
-                    {
-                      if ( v30 == 99 )
-                      {
-                        v29->pInfos[v28].uAttackPreference |= 0x10u;
-                      }
-                      else
-                      {
-                        v31 = v30 - 50;
-                        if ( v31 )
-                        {
-                          v32 = v31 - 1;
-                          if ( v32 )
-                          {
-                            v33 = v32 - 1;
-                            if ( v33 )
-                            {
-                              if ( v33 == 45 )
-                                v29->pInfos[v28].uAttackPreference |= 4u;
-                            }
-                            else
-                            {
-                              v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 4;
-                            }
-                          }
-                          else
-                          {
-                            v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 3;
-                          }
-                        }
-                        else
-                        {
-                          v29->pInfos[v28].uNumCharactersAttackedPerSpecialAbility = 2;
-                        }
-                      }
-                    }
-                  }
-                }
-                ++v100;
-              }
-              while ( v100 < (signed int)v101 );
-            }
-            goto LABEL_325;
-          case 0xE:
-            v102->pInfos[v103].uRecoveryTime = atoi((const char *)v2);
-            goto LABEL_325;
-          case 0x10:
-            v42 = strlen((const char *)v2);
-            v43 = 0;
-            v44 = &v102->pInfos[v103];
-            v100 = v42;
-            v44->uSpecialAttackType = 1;
-            if ( (signed int)v42 <= 0 )
-              goto LABEL_185;
-            break;
-          case 0x11:
-            v102->pInfos[v103].uAttack1Type = ParseAttackType((unsigned __int8 *)v2);
-            goto LABEL_325;
-          case 0x12:
-            v46 = &v102->pInfos[v103];
-            v47 = (char *)&v46->uAttack1DamageDiceRolls;
-            v84 = (char *)&v46->uAttack1DamageBonus;
-            v48 = (char *)&v46->uAttack1DamageDiceSides;
-            goto LABEL_237;
-          case 0x13:
-            v102->pInfos[v103].uMissleAttack1Type = ParseMissleAttackType((const char *)v2);
-            goto LABEL_325;
-          case 0x14:
-            v102->pInfos[v103].uAttack2Chance = atoi((const char *)v2);
-            goto LABEL_325;
-          case 0x15:
-            v102->pInfos[v103].uAttack2Type = ParseAttackType((unsigned __int8 *)v2);
-            goto LABEL_325;
-          case 0x16:
-            v49 = &v102->pInfos[v103];
-            v47 = (char *)&v49->uAttack2DamageDiceRolls;
-            v84 = (char *)&v49->uAttack2DamageBonus;
-            v48 = (char *)&v49->uAttack2DamageDiceSides;
-LABEL_237:
-            ParseDamage((const char *)v2, (int)v47, (int)v48, (int)v84);
-            goto LABEL_325;
-          case 0x17:
-            v102->pInfos[v103].uMissleAttack2Type = ParseMissleAttackType((const char *)v2);
-            goto LABEL_325;
-          case 0x18:
-            v102->pInfos[v103].uSpell1UseChance = atoi((const char *)v2);
-            goto LABEL_325;
-          case 0x19:
-            strcpy(Str, (const char *)v2);
-            Str[0] = ' ';
-            Str[strlen(Str) - 1] = ' ';
-            v50 = texture_frame_table_txt_parser(Str, &v87);
-            v51 = 88 * v103;
-            memcpy(&v90, v50, sizeof(v90));
-            if ( v90.field_0 >= 3 )
-            {
-              v53 = (int)((char *)v102 + v51);
-              a2 = 1;
-              v102->pInfos[v51 / 0x58u].uSpell1ID = ParseSpellType(&v90, (int)&a2);
-              v54 = a2;
-              v84 = (char *)v90.pProperties[a2 + 1];
-              v55 = atoi(v84);
-              v56 = (char *)v90.pProperties[v54];
-              v84 = "E";
-              v83 = v56;
-              *(_WORD *)(v53 + 56) = v55 & 0x3F;
-              if ( _strcmpi(v83, v84) )
-              {
-                if ( _strcmpi(v56, "M") )
-                {
-                  if ( !_strcmpi(v56, "G") )
-                    *(_BYTE *)(v53 + 57) |= 1u;
-                }
-                else
-                {
-                  *(_BYTE *)(v53 + 56) |= 0x80u;
-                }
-              }
-              else
-              {
-                *(_BYTE *)(v53 + 56) |= 0x40u;
-              }
-            }
-            else
-            {
-              v52 = (int)((char *)v102 + v51);
-              *(_BYTE *)(v52 + 33) = 0;
-              *(_WORD *)(v52 + 56) = 0;
-            }
-            goto LABEL_325;
-          case 0x1A:
-            v102->pInfos[v103].uSpell2UseChance = atoi((const char *)v2);
-            goto LABEL_325;
-
-          case 0x1B:
-            strcpy(Dest, (const char *)v2);
-            Dest[0] = ' ';
-            Dest[strlen(Dest) - 1] = ' ';
-            v57 = texture_frame_table_txt_parser(Dest, &v86);
-            v58 = v103;
-            memcpy(&v89, v57, sizeof(v89));
-            if ( v89.field_0 >= 3 )
-            {
-              v60 = &v102->pInfos[v58];
-              a2 = 1;
-              v102->pInfos[v58].uSpell2ID = ParseSpellType(&v89, (int)&a2);
-              v61 = a2;
-              v84 = (char *)v89.pProperties[a2 + 1];
-              v62 = atoi(v84);
-              v63 = (char *)v89.pProperties[v61];
-              v84 = "E";
-              v83 = v63;
-              v60->uSpellSkillAndMastery2 = v62 & 0x3F;
-              if ( _strcmpi(v83, v84) )
-              {
-                if ( _strcmpi(v63, "M") )
-                {
-                  if ( !_strcmpi(v63, "G") )
-                    HIBYTE(v60->uSpellSkillAndMastery2) |= 1u;
-                }
-                else
-                {
-                  LOBYTE(v60->uSpellSkillAndMastery2) |= 0x80u;
-                }
-              }
-              else
-              {
-                LOBYTE(v60->uSpellSkillAndMastery2) |= 0x40u;
-              }
-            }
-            else
-            {
-              v59 = &v102->pInfos[v58];
-              v59->uSpell2ID = 0;
-              v59->uSpellSkillAndMastery2 = 0;
-            }
-            goto LABEL_325;
-          case 0x1C:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v64 = 200;
-            else
-              v64 = atoi((const char *)v2);
-            v102->pInfos[v103].uResFire = v64;
-            goto LABEL_325;
-          case 0x1D:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v65 = 200;
-            else
-              v65 = atoi((const char *)v2);
-            v102->pInfos[v103].uResAir = v65;
-            goto LABEL_325;
-          case 0x1E:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v66 = 200;
-            else
-              v66 = atoi((const char *)v2);
-            v102->pInfos[v103].uResWater = v66;
-            goto LABEL_325;
-          case 0x1F:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v67 = 200;
-            else
-              v67 = atoi((const char *)v2);
-            v102->pInfos[v103].uResEarth = v67;
-            goto LABEL_325;
-          case 0x20:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v68 = 200;
-            else
-              v68 = atoi((const char *)v2);
-            v102->pInfos[v103].uResMind = v68;
-            goto LABEL_325;
-          case 0x21:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v69 = 200;
-            else
-              v69 = atoi((const char *)v2);
-            v102->pInfos[v103].uResSpirit = v69;
-            goto LABEL_325;
-          case 0x22:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v70 = 200;
-            else
-              v70 = atoi((const char *)v2);
-            v102->pInfos[v103].uResBody = v70;
-            goto LABEL_325;
-          case 0x23:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v71 = 200;
-            else
-              v71 = atoi((const char *)v2);
-            v102->pInfos[v103].uResLight = v71;
-            goto LABEL_325;
-          case 0x24:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v72 = 200;
-            else
-              v72 = atoi((const char *)v2);
-            v102->pInfos[v103].uResDark = v72;
-            goto LABEL_325;
-          case 0x25:
-            v84 = (char *)*(_BYTE *)v2;
-            if ( tolower((int)v84) == 'i' )
-              v73 = 200;
-            else
-              v73 = atoi((const char *)v2);
-            v102->pInfos[v103].uResPhysical = v73;
-            goto LABEL_325;
-          case 0x26:
-            strcpy(v93, (const char *)v2);
-            v93[0] = ' ';
-            v93[strlen(v93) - 1] = ' ';
-            memcpy(&v94, texture_frame_table_txt_parser(v93, &v85), sizeof(v94));
-            if ( v94.field_0 )
-            {
-              v74 = v94.field_0;
-              if ( v94.field_0 < 10 )
-              {
-                if ( _strcmpi(v94.pProperties[0], "shot") )
-                {
-                  if ( _strcmpi(v94.pProperties[0], "summon") )
-                  {
-                    if ( !_strcmpi(v94.pProperties[0], "explode") )
-                    {
-                      v79 = &v102->pInfos[v103];
-                      v80 = v94.pProperties[1];
-                      v84 = (char *)&v79->uSpecialAbilityDamageDiceBonus;
-                      v83 = (char *)&v79->uSpecialAbilityDamageDiceSides;
-                      v79->uSpecialAbilityType = 3;
-                      ParseDamage(v80, (int)&v79->uSpecialAbilityDamageDiceRolls, (int)v83, (int)v84);
-                      v79->field_3C_some_special_attack = ParseAttackType((unsigned __int8 *)v2);
-                    }
-                  }
-                  else
-                  {
-                    v76 = &v102->pInfos[v103];
-                    v76->uSpecialAbilityType = 2;
-                    if ( v74 > 1 )
-                    {
-                      pTmpBuf[0] = 0;
-                      strcpy(pTmpBuf, v94.pProperties[2]);
-                      if ( v74 > 2 )
-                      {
-                        v100 = 3;
-                        if ( v74 > 3 )
-                        {
-                          do
-                          {
-                            strcat(pTmpBuf, " ");
-                            v77 = (char **)v94.pProperties[v100];
-                            v82 = v94.pProperties[v100];
-                            strcat(pTmpBuf, v82);
-                            if ( v100 == v94.field_0 - 1 )
-                            {
-                              v84 = (char *)*(_BYTE *)v77;
-                              if ( tolower((int)v84) == 'a' )
-                              {
-                                v76->uSpecialAbilityDamageDiceRolls = 1;
-                              }
-                              else
-                              {
-                                v84 = (char *)*(_BYTE *)v77;
-                                if ( tolower((int)v84) == 'b' )
-                                {
-                                  v76->uSpecialAbilityDamageDiceRolls = 2;
-                                }
-                                else
-                                {
-                                  v84 = (char *)*(_BYTE *)v77;
-                                  if ( tolower((int)v84) == 'c' )
-                                    v76->uSpecialAbilityDamageDiceRolls = 3;
-                                  else
-                                    v76->uSpecialAbilityDamageDiceRolls = 0;
-                                }
-                              }
-                            }
-                            ++v100;
-                          }
-                          while ( v100 < v94.field_0 );
-                        }
-                      }
-                      else
-                      {
-                        v76->uSpecialAbilityDamageDiceRolls = 0;
-                      }
-                      if ( pMonsterList->uNumMonsters )
-                      {
-                        v78 = pMonsterList->GetMonsterByName(pTmpBuf) + 1;
-                        v76->field_3C_some_special_attack = v78;
-                        if ( v78 == -1 )
-                        {
-                          sprintf(Src, "Can't create random monster: '%s' See MapStats!", Src);
-                          MessageBoxA(nullptr, Src, "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Itemdata.cpp:2239", 0);
-                        }
-                      }
-                      v76->uSpecialAbilityDamageDiceSides = 0;
-                      if ( !_strcmpi(v94.pProperties[1], "ground") )
-                        v76->uSpecialAbilityDamageDiceSides = 1;
-                      if ( v76->field_3C_some_special_attack == -1 )
-                        v76->uSpecialAbilityType = 0;
-                    }
-                  }
-                }
-                else
-                {
-                  v75 = &v102->pInfos[v103];
-                  v84 = (char *)(v94.pProperties[1] + 1);
-                  v75->uSpecialAbilityType = 1;
-                  v75->uSpecialAbilityDamageDiceBonus = atoi(v84);
-                }
-              }
-            }
-            goto LABEL_325;
-          default:
-            goto LABEL_325;
-        }
-        while ( 1 )
-        {
-          v84 = (char *)*(_BYTE *)(v43 + v2);
-          if ( tolower((int)v84) == 'x' )
-            break;
-          ++v43;
-          if ( v43 >= v100 )
-            goto LABEL_185;
-        }
-        v45 = v2 + v43;
-        *(_BYTE *)v45 = 0;
-        v44->uSpecialAttackType = atoi((const char *)(v45 + 1));
-        *(_BYTE *)v45 = 100;
-LABEL_185:
-        _strlwr((char *)v2);
-        if ( strstr((const char *)v2, "curse") )
-        {
-          v44->uSpecialAttack = 1;
-        }
-        else
-        {
-          if ( strstr((const char *)v2, "weak") )
-          {
-            v44->uSpecialAttack = 2;
-          }
-          else
-          {
-            if ( strstr((const char *)v2, "asleep") )
-            {
-              v44->uSpecialAttack = 3;
-            }
-            else
-            {
-              if ( strstr((const char *)v2, "afraid") )
-              {
-                v44->uSpecialAttack = 23;
-              }
-              else
-              {
-                if ( strstr((const char *)v2, "drunk") )
-                {
-                  v44->uSpecialAttack = 4;
-                }
-                else
-                {
-                  if ( strstr((const char *)v2, "insane") )
-                  {
-                    v44->uSpecialAttack = 5;
-                  }
-                  else
-                  {
-                    if ( strstr((const char *)v2, "poison1") )
-                    {
-                      v44->uSpecialAttack = 6;
-                    }
-                    else
-                    {
-                      if ( strstr((const char *)v2, "poison2") )
-                      {
-                        v44->uSpecialAttack = 7;
-                      }
-                      else
-                      {
-                        if ( strstr((const char *)v2, "poison3") )
-                        {
-                          v44->uSpecialAttack = 8;
-                        }
-                        else
-                        {
-                          if ( strstr((const char *)v2, "disease1") )
-                          {
-                            v44->uSpecialAttack = 9;
-                          }
-                          else
-                          {
-                            if ( strstr((const char *)v2, "disease2") )
-                            {
-                              v44->uSpecialAttack = 10;
-                            }
-                            else
-                            {
-                              if ( strstr((const char *)v2, "disease3") )
-                              {
-                                v44->uSpecialAttack = 11;
-                              }
-                              else
-                              {
-                                if ( strstr((const char *)v2, "paralyze") )
-                                {
-                                  v44->uSpecialAttack = 12;
-                                }
-                                else
-                                {
-                                  if ( strstr((const char *)v2, "uncon") )
-                                  {
-                                    v44->uSpecialAttack = 13;
-                                  }
-                                  else
-                                  {
-                                    if ( strstr((const char *)v2, "dead") )
-                                    {
-                                      v44->uSpecialAttack = 14;
-                                    }
-                                    else
-                                    {
-                                      if ( strstr((const char *)v2, "stone") )
-                                      {
-                                        v44->uSpecialAttack = 15;
-                                      }
-                                      else
-                                      {
-                                        if ( strstr((const char *)v2, "errad") )
-                                        {
-                                          v44->uSpecialAttack = 16;
-                                        }
-                                        else
-                                        {
-                                          if ( strstr((const char *)v2, "brkitem") )
-                                          {
-                                            v44->uSpecialAttack = 17;
-                                          }
-                                          else
-                                          {
-                                            if ( strstr((const char *)v2, "brkarmor") )
-                                            {
-                                              v44->uSpecialAttack = 18;
-                                            }
-                                            else
-                                            {
-                                              if ( strstr((const char *)v2, "brkweapon") )
-                                              {
-                                                v44->uSpecialAttack = 19;
-                                              }
-                                              else
-                                              {
-                                                if ( strstr((const char *)v2, "steal") )
-                                                {
-                                                  v44->uSpecialAttack = 20;
-                                                }
-                                                else
-                                                {
-                                                  if ( strstr((const char *)v2, "age") )
-                                                  {
-                                                    v44->uSpecialAttack = 21;
-                                                  }
-                                                  else
-                                                  {
-                                                    if ( strstr((const char *)v2, "drainsp") )
-                                                      v44->uSpecialAttack = 22;
-                                                  }
-                                                }
-                                              }
-                                            }
-                                          }
-                                        }
-                                      }
-                                    }
-                                  }
-                                }
-                              }
-                            }
-                          }
-                        }
-                      }
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-      else
-      {
-        v97 = 1;
-      }
-LABEL_325:
-      ++*(_DWORD *)&a3[1];
-      v2 = v96 + 1;
-    }
-    while ( *(_DWORD *)&a3[1] - 1 <= (signed int)v102->uNumMonsters && !v97 );
-    ++v103;
-  }
-  while ( v103 < 265 );
-  v102->uNumMonsters = v103;
-  */
 }
 
 
-
-
 //----- (0044FA08) --------------------------------------------------------
-unsigned __int16 MonsterList::GetMonsterByName(const char *pMonsterName)
-{
-  signed int v2; // ebx@1
-  MonsterList *v3; // esi@1
-  int v4; // edi@3
-  unsigned __int16 result; // ax@6
-
-  v2 = 0;
-  v3 = this;
-  if ( pMonsterName && (signed int)this->uNumMonsters > 0 )
-  {
-    v4 = 0;
-    while ( _strcmpi(pMonsterName, v3->pMonsters[v4].pMonsterName) )
+signed __int16 MonsterList::GetMonsterIDByName( const char *pMonsterName )
     {
-      ++v2;
-      ++v4;
-      if ( v2 >= (signed int)v3->uNumMonsters )
-        goto LABEL_6;
+    if (!pMonsterName)
+        return -1;
+    for (signed __int16 i=1; i<=uNumMonsters; ++i)
+        {
+        if( (!_strcmpi(pMonsters[i].pMonsterName, pMonsterName)))
+            return i;
+        }
     }
-    result = v2;
-  }
-  else
-  {
-LABEL_6:
-    result = -1;
-  }
-  return result;
-}
--- a/Monsters.h	Sat Mar 23 00:16:17 2013 +0200
+++ b/Monsters.h	Sat Mar 23 00:18:02 2013 +0200
@@ -158,7 +158,7 @@
 {
   void Initialize();
   void InitializePlacements();
-  signed int FindMonsterByName(const char *Str2);
+  signed int FindMonsterByTextureName(const char *Str2);
 
   static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype);
 
@@ -193,12 +193,12 @@
   inline MonsterList():  //----- (00458429)
     uNumMonsters(0), pMonsters(nullptr)
   {}
-  unsigned __int16 GetMonsterByName(const char *pMonsterName);
+    signed __int16 GetMonsterIDByName(const char *pMonsterName);
   void ToFile();
   void FromFile(void *pSerialized);
   bool FromFileTxt(const char *Args);
 
-  unsigned int uNumMonsters;
+  signed int uNumMonsters;
   struct MonsterDesc *pMonsters;
 };
 #pragma pack(pop)
--- a/Outdoor.cpp	Sat Mar 23 00:16:17 2013 +0200
+++ b/Outdoor.cpp	Sat Mar 23 00:18:02 2013 +0200
@@ -121,7 +121,7 @@
   {
     v4 = WorldPosToGridCellZ(pParty->vPosition.y);
     v5 = WorldPosToGridCellX(pParty->vPosition.x);
-    pOutdoor->_47EF60(v5, v4, 1);
+    pOutdoor->UpdateDiscoveredArea(v5, v4, 1);
   }
   pGame->uFlags2 &= 0xFFFFFFFEu;
   if (pRenderer->pRenderD3D && pRenderer->bUsingSpecular)
@@ -2115,9 +2115,9 @@
   //v108 = (int)".odm";
   //v83 = strlen(pContainer);
   //strcpy((char *)v141 + v83, (const char *)v108);
-  memcpy(array_528, pSrc, 0x3C8);
+  memcpy(uUndiscoveredArea, pSrc, 0x3C8);
   //v84 = (const void *)(v74 + 968);
-  memcpy(array_8F0, pSrc + 0x3C8, 0x3C8);
+  memcpy(uDicovered_area, pSrc + 0x3C8, 0x3C8);
   pSrc += 2 * 0x3C8;
   //v85 = (char *)v84 + 968;
 
@@ -2125,8 +2125,8 @@
 
   if ( *(int *)thisa )
   {
-    memcpy(array_528, Dst, 0x3C8u);
-    memcpy(array_8F0, Src, 0x3C8u);
+    memcpy(uUndiscoveredArea, Dst, 0x3C8u);
+    memcpy(uDicovered_area, Src, 0x3C8u);
   }
 
   //v25 = uNumBModels == 0;
@@ -2594,7 +2594,7 @@
 }
 
 //----- (0047EF60) --------------------------------------------------------
-int OutdoorLocation::_47EF60(int a2, int a3, int a4)
+int OutdoorLocation::UpdateDiscoveredArea(int X_grid_pos, int Y_grid_poa, int a4)
 {
   int v4; // ecx@1
   int v5; // edx@2
@@ -2614,14 +2614,14 @@
   int i; // [sp+24h] [bp+Ch]@5
 
   v18 = this;
-  v4 = a3 - 10;
-  if ( a3 - 10 < a3 + 10 )
+  v4 = Y_grid_poa - 10;
+  if ( Y_grid_poa - 10 < Y_grid_poa + 10 )
   {
-    v5 = v4 - a3;
-    v6 = 88 * (a3 - 30);
-    v7 = a2;
-    v19 = v4 - a3;
-    v17 = a3 + 10 - v4;
+    v5 = v4 - Y_grid_poa;
+    v6 = (Y_grid_poa - 30);
+    v7 = X_grid_pos;
+    v19 = v4 - Y_grid_poa;
+    v17 = Y_grid_poa + 10 - v4;
     while ( 1 )
     {
       v8 = abs(v5);
@@ -2634,14 +2634,13 @@
         {
           v11 = abs(v10);
           v15 = v11 * v11 + v16;
-          if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 7656 )
+          if ( v15 <= 100 && v9 >= 20 && v9 <= 107 && v6 >= 0 && v6 <= 87 )
           {
-            v12 = (v6 + v9 - 20) >> 3;
-            v13 = 1 << (8 - (v6 + v9 - 20) % 8 - 1);
-            v18->array_8F0[v12] |= v13;
+            v13 = 1 << (7 - (v9 - 20) % 8);
+            v18->uDicovered_area[v6][(v9 - 20)/8] |= v13;
             if ( v15 <= 49 )
-              v18->array_528[v12] |= v13;
-            v7 = a2;
+              v18->uUndiscoveredArea[v6][(v9 - 20)/8] |= v13;
+            v7 = X_grid_pos;
           }
           ++v9;
           ++i;
@@ -2649,7 +2648,7 @@
             break;
         }
       }
-      v6 += 88;
+      ++v6 ;
       ++v19;
       --v17;
       if ( !v17 )
@@ -2661,26 +2660,26 @@
 }
 
 //----- (0047F04C) --------------------------------------------------------
-bool OutdoorLocation::_47F04C(signed int a2, signed int a3)
+bool OutdoorLocation::_47F04C(signed int x_pos, signed int y_pos)
 {
   bool result; // eax@5
 
-  if ( a2 < 0 || a2 >= 88 || a3 < 0 || a3 >= 88 )
+  if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 )
     result = 0;
   else
-    result = (this->array_528[(a2 + 88 * a3) / 8] & (unsigned __int8)(1 << (7 - (a2 + 88 * a3) % 8))) != 0;
+    result = (uUndiscoveredArea[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0;
   return result;
 }
 
 //----- (0047F097) --------------------------------------------------------
-bool OutdoorLocation::_47F097(signed int a2, signed int a3)
+bool OutdoorLocation::_47F097(signed int x_pos, signed int y_pos)
 {
   bool result; // eax@5
 
-  if ( a2 < 0 || a2 >= 88 || a3 < 0 || a3 >= 88 )
+  if ( x_pos < 0 || x_pos >= 88 || y_pos < 0 || y_pos >= 88 )
     result = 0;
   else
-    result = (this->array_8F0[(a2 + 88 * a3) / 8] & (unsigned __int8)(1 << (7 - (a2 + 88 * a3) % 8))) != 0;
+    result = (uDicovered_area[y_pos][x_pos/8] & (unsigned __int8)(1 << (7 - (x_pos) % 8))) != 0;
   return result;
 }
 
--- a/Outdoor.h	Sat Mar 23 00:16:17 2013 +0200
+++ b/Outdoor.h	Sat Mar 23 00:18:02 2013 +0200
@@ -154,7 +154,7 @@
   int ActuallyGetSomeOtherTileInfo(unsigned int uX, unsigned int uY);
   int DoGetHeightOnTerrain(unsigned int uX, unsigned int uZ);
   int _47EE49(signed int a2, signed int a3, int a4);
-  int _47EF60(int a2, int a3, int a4);
+  int UpdateDiscoveredArea(int a2, int a3, int a4);
   bool _47F04C(signed int a2, signed int a3);
   bool _47F097(signed int a2, signed int a3);
   bool _47F0E2();
@@ -206,8 +206,8 @@
   int day_fogrange_1;
   int day_fogrange_2;
   char field_510[24];
-  char array_528[968];
-  char array_8F0[968];
+  unsigned char uUndiscoveredArea[88][11];//968
+  unsigned char uDicovered_area[88][11];//[968]
   int field_CB8;
   int max_terrain_dimming_level;
   int field_CC0;
--- a/SaveLoad.cpp	Sat Mar 23 00:16:17 2013 +0200
+++ b/SaveLoad.cpp	Sat Mar 23 00:18:02 2013 +0200
@@ -507,9 +507,9 @@
       pOutdoor->ddm.uNumDecorations = uNumLevelDecorations;
       memcpy(DstBuf, &pOutdoor->ddm, 0x28);
       v21 = (char *)v21 + 40;
-      memcpy(v21, pOutdoor->array_528, 0x3C8);
+      memcpy(v21, pOutdoor->uUndiscoveredArea, 0x3C8);
       v21 = (char *)v21 + 968;
-      memcpy(v21, pOutdoor->array_8F0, 0x3C8);
+      memcpy(v21, pOutdoor->uDicovered_area, 0x3C8);
       v22 = (char *)v21 + 968;
       if ( (signed int)pOutdoor->uNumBModels > 0 )
       {
--- a/mm7_2.cpp	Sat Mar 23 00:16:17 2013 +0200
+++ b/mm7_2.cpp	Sat Mar 23 00:18:02 2013 +0200
@@ -5061,17 +5061,16 @@
         }
         sprintf(Str2, v44, pTexture);
       }
-      v26 = pMonsterList->GetMonsterByName(Str2);
-      v50 = (signed __int16)v26;
+      v50 = pMonsterList->GetMonsterIDByName(Str2);
       pTexture = Str2;
-      if ( (signed __int16)v26 == -1 )
+      if ( (signed __int16)v50 == -1 )
       {
         sprintf(Str, "Can't create random monster: '%s'! See MapStats.txt and Monsters.txt!", pTexture);
         MessageBoxA(nullptr, Str, nullptr, 0);
         ExitProcess(0);
       }
-      v27 = &pMonsterList->pMonsters[(signed __int16)v26];
-      v28 = pMonsterStats->FindMonsterByName(pTexture);
+      v27 = &pMonsterList->pMonsters[(signed __int16)v50];
+      v28 = pMonsterStats->FindMonsterByTextureName(pTexture);
       if ( !v28 )
         v28 = 1;
       Src = &pMonsterStats->pInfos[v28];
@@ -5176,7 +5175,7 @@
     else
       v15 = "Elemental Light A";
   }
-  v23 = (signed __int16)pMonsterList->GetMonsterByName(v15);
+  v23 = pMonsterList->GetMonsterIDByName(v15);
   v3 = 0;
   v20 = uNumActors;
   if ( (signed int)uNumActors > 0 )