Mercurial > mm7
changeset 197:5979fc0de9ae
Merge
author | Nomad |
---|---|
date | Sat, 16 Feb 2013 20:24:31 +0200 |
parents | 982c1ec5a983 (current diff) 821fd955c379 (diff) |
children | e6e348d66a75 8646cad02950 |
files | |
diffstat | 2 files changed, 128 insertions(+), 155 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.cpp Sat Feb 16 20:24:02 2013 +0200 +++ b/Items.cpp Sat Feb 16 20:24:31 2013 +0200 @@ -1492,89 +1492,78 @@ //----- (00453B3C) -------------------------------------------------------- void ItemsTable::LoadPotions() { - char *i; // eax@3 - signed int v2; // esi@11 - char *v3; // eax@16 - char *v4; // edi@16 - __int16 v5; // ax@17 - char *v6; // esi@17 - CHAR Text; // [sp+Ch] [bp-6Ch]@26 - ItemsTable *v8; // [sp+68h] [bp-10h]@1 - int v9; // [sp+6Ch] [bp-Ch]@10 - int v10; // [sp+70h] [bp-8h]@10 - char *v11; // [sp+74h] [bp-4h]@4 + + CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26 + char* test_string; + unsigned int uRow; + unsigned int uColumn; + unsigned __int8 potion_value; - v8 = this; if ( pPotionsTXT_Raw ) pAllocator->FreeChunk(pPotionsTXT_Raw); - pPotionsTXT_Raw = 0; + pPotionsTXT_Raw = NULL; pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); - for ( i = strtok(pPotionsTXT_Raw, "\t\r\n"); ; i = strtok(0, "\t\r\n") ) - { - v11 = i; - if ( !strcmp(i, "222") ) - break; - if ( !v11 ) - { -LABEL_20: - MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", 0x10u); - return; - } - } + test_string = strtok(pPotionsTXT_Raw,"\t\r\n"); + while ( 1 ) + { + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + + test_string = strtok(NULL, "\t\r\n"); + } while ( 1 ) { - v11 = strtok(0, "\t\r\n"); - if ( !strcmp(v11, "222") ) + test_string = strtok(NULL, "\t\r\n"); + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } +if ( !strcmp(test_string, "222") ) break; - if ( !v11 ) - goto LABEL_20; } - v9 = 0; - v10 = 30642; - do + + for (uRow = 0;uRow < 50; ++uRow) { - v11 = 0; - v2 = 0; - do - { - if ( !strtok(0, "\r\t\n") ) - break; - ++v2; - } - while ( v2 < 6 ); - if ( v2 != 6 ) - break; - v11 = 0; - do + int skip_count; + for (skip_count = 0;skip_count < 6; ++skip_count) { - v3 = strtok(0, "\r\t\n"); - v4 = v3; - if ( !v3 ) + if ( !strtok(NULL, "\r\t\n") ) break; - v5 = atoi(v3); - v6 = (char *)v8 + 2 * (uint)&v11[v10]; - *(_WORD *)v6 = v5; - if ( !v5 ) + } + if ( skip_count != 6 ) + break; + for (uColumn = 0; uColumn < 50; ++uColumn) + { + test_string = strtok(NULL, "\r\t\n"); + if ( !test_string ) + break; + potion_value = atoi(test_string); + char c=*test_string; + if ( !potion_value ) { - if ( tolower((unsigned __int8)*v4) == 101 ) - *(_WORD *)v6 = atoi(v4 + 1); + if ( tolower(c) == 'e' ) + potion_value = atoi(test_string + 1); else - *(_WORD *)v6 = 0; + potion_value = 0; } - ++v11; + this->potion_data[uRow][uColumn]=potion_value; } - while ( (signed int)v11 < 50 ); - if ( v11 != (char *)50 ) + if ( uColumn != 50 ) break; - strtok(0, "\r\t\n"); - v10 += 50; - ++v9; + strtok(NULL, "\r\t\n"); } - while ( v10 < 33142 ); - if ( v9 != 50 ) + + if ( uRow != 50 ) { - wsprintfA(&Text, "Error Parsing Potion Table at Row: %d Column: %d", v9, v11); - MessageBoxA(0, &Text, "Parsing Error", 0x10u); + wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); + MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); } if ( pPotionsTXT_Raw ) { @@ -1586,100 +1575,79 @@ //----- (00453CE5) -------------------------------------------------------- void ItemsTable::LoadPotionNotes() { - char *i; // eax@3 - signed int v2; // esi@11 - char *v3; // eax@16 - char *v4; // edi@16 - __int16 v5; // ax@17 - char *v6; // esi@17 - CHAR *v7; // [sp-Ch] [bp-84h]@20 - const CHAR *v8; // [sp-8h] [bp-80h]@20 - UINT v9; // [sp-4h] [bp-7Ch]@20 - CHAR Text; // [sp+Ch] [bp-6Ch]@26 - ItemsTable *v11; // [sp+68h] [bp-10h]@1 - int v12; // [sp+6Ch] [bp-Ch]@10 - int v13; // [sp+70h] [bp-8h]@10 - char *v14; // [sp+74h] [bp-4h]@4 + + CHAR Text[90]; + char* test_string; + unsigned int uRow; + unsigned int uColumn; + unsigned __int8 potion_note; - v11 = this; if ( pPotionNotesTXT_Raw ) pAllocator->FreeChunk(pPotionNotesTXT_Raw); - pPotionNotesTXT_Raw = 0; + pPotionNotesTXT_Raw = NULL; pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); - for ( i = strtok(pPotionNotesTXT_Raw, "\t\r\n"); ; i = strtok(0, "\t\r\n") ) - { - v14 = i; - if ( !strcmp(i, "222") ) - break; - if ( !v14 ) - { -LABEL_20: - v9 = 16; - v8 = "Load Error"; - v7 = "Error Pre-Parsing Potion Table"; -LABEL_27: - MessageBoxA(0, v7, v8, v9); - return; - } - } + test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); while ( 1 ) - { - v14 = strtok(0, "\t\r\n"); - if ( !strcmp(v14, "222") ) - break; - if ( !v14 ) - goto LABEL_20; - } - v12 = 0; - v13 = 33142; - do - { - v14 = 0; - v2 = 0; - do - { - if ( !strtok(0, "\r\t\n") ) - break; - ++v2; - } - while ( v2 < 6 ); - if ( v2 != 6 ) - break; - v14 = 0; - do - { - v3 = strtok(0, "\r\t\n"); - v4 = v3; - if ( !v3 ) - break; - v5 = atoi(v3); - v6 = (char *)v11 + 2 * (unsigned int)&v14[v13]; - *(unsigned short *)v6 = v5; - if ( !v5 ) - { - if ( tolower((unsigned __int8)*v4) == 101 ) - *(unsigned short *)v6 = atoi(v4 + 1); - else - *(unsigned short *)v6 = 0; - } - ++v14; - } - while ( (signed int)v14 < 50 ); - if ( v14 != (char *)50 ) - break; - strtok(0, "\r\t\n"); - v13 += 50; - ++v12; - } - while ( v13 < 35642 ); - if ( v12 != 50 ) - { - wsprintfA(&Text, "Error Parsing Potion Autonote Table at Row: %d Column: %d", v12, v14); - v9 = 16; - v8 = "Parsing Error"; - v7 = &Text; - goto LABEL_27; - } + { + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + test_string = strtok(NULL, "\t\r\n"); + } + while ( 1 ) + { + test_string = strtok(NULL, "\t\r\n"); + + if ( !test_string ) + { + MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + return; + } + if ( !strcmp(test_string, "222") ) + break; + } + + for (uRow = 0;uRow < 50; ++uRow) + { + int skip_count; + for (skip_count = 0;skip_count < 6; ++skip_count) + { + if ( !strtok(NULL, "\r\t\n") ) + break; + } + if ( skip_count != 6 ) + break; + for (uColumn = 0; uColumn < 50; ++uColumn) + { + test_string = strtok(NULL, "\r\t\n"); + if ( !test_string ) + break; + potion_note = atoi(test_string); + char c=*test_string; + if ( !potion_note ) + { + if ( tolower(c) == 'e' ) + potion_note = atoi(test_string + 1); + else + potion_note = 0; + } + this->potion_note[uRow][uColumn]=potion_note; + } + if ( uColumn != 50 ) + break; + strtok(NULL, "\r\t\n"); + } + + if ( uRow != 50 ) + { + wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); + MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); + } }
--- a/Items.h Sat Feb 16 20:24:02 2013 +0200 +++ b/Items.h Sat Feb 16 20:24:31 2013 +0200 @@ -178,6 +178,7 @@ #pragma pack(pop) + /* 176 */ #pragma pack(push, 1) struct ItemsTable @@ -192,7 +193,11 @@ char *Release(); - ItemDesc pItems[800]; + ItemDesc pItems[638]; + char align1[18]; + unsigned __int8 potion_data[50][50]; //int8!!!! not int16 as in decomp code. hexrays wrong!! + unsigned __int8 potion_note[50][50]; + char align2[2758]; ItemEnchantment pEnchantments[24]; ItemSpecialEnchantment pSpecialEnchantments[72]; char field_9FC0[5000];