Mercurial > mm7
comparison Items.cpp @ 212:9f349addbe00
Слияние
author | Ritor1 |
---|---|
date | Sat, 16 Feb 2013 22:14:04 +0600 |
parents | 821fd955c379 |
children | 30aa44013f7a 8113753ed2ae |
comparison
equal
deleted
inserted
replaced
211:cd2077e24f95 | 212:9f349addbe00 |
---|---|
1490 | 1490 |
1491 | 1491 |
1492 //----- (00453B3C) -------------------------------------------------------- | 1492 //----- (00453B3C) -------------------------------------------------------- |
1493 void ItemsTable::LoadPotions() | 1493 void ItemsTable::LoadPotions() |
1494 { | 1494 { |
1495 char *i; // eax@3 | 1495 |
1496 signed int v2; // esi@11 | 1496 CHAR Text[90]; // [sp+Ch] [bp-6Ch]@26 |
1497 char *v3; // eax@16 | 1497 char* test_string; |
1498 char *v4; // edi@16 | 1498 unsigned int uRow; |
1499 __int16 v5; // ax@17 | 1499 unsigned int uColumn; |
1500 char *v6; // esi@17 | 1500 unsigned __int8 potion_value; |
1501 CHAR Text; // [sp+Ch] [bp-6Ch]@26 | 1501 |
1502 ItemsTable *v8; // [sp+68h] [bp-10h]@1 | |
1503 int v9; // [sp+6Ch] [bp-Ch]@10 | |
1504 int v10; // [sp+70h] [bp-8h]@10 | |
1505 char *v11; // [sp+74h] [bp-4h]@4 | |
1506 | |
1507 v8 = this; | |
1508 if ( pPotionsTXT_Raw ) | 1502 if ( pPotionsTXT_Raw ) |
1509 pAllocator->FreeChunk(pPotionsTXT_Raw); | 1503 pAllocator->FreeChunk(pPotionsTXT_Raw); |
1510 pPotionsTXT_Raw = 0; | 1504 pPotionsTXT_Raw = NULL; |
1511 pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); | 1505 pPotionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("potion.txt", 0); |
1512 for ( i = strtok(pPotionsTXT_Raw, "\t\r\n"); ; i = strtok(0, "\t\r\n") ) | 1506 test_string = strtok(pPotionsTXT_Raw,"\t\r\n"); |
1513 { | 1507 while ( 1 ) |
1514 v11 = i; | 1508 { |
1515 if ( !strcmp(i, "222") ) | 1509 if ( !test_string ) |
1510 { | |
1511 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); | |
1512 return; | |
1513 } | |
1514 if ( !strcmp(test_string, "222") ) | |
1515 break; | |
1516 | |
1517 test_string = strtok(NULL, "\t\r\n"); | |
1518 } | |
1519 while ( 1 ) | |
1520 { | |
1521 test_string = strtok(NULL, "\t\r\n"); | |
1522 | |
1523 if ( !test_string ) | |
1524 { | |
1525 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); | |
1526 return; | |
1527 } | |
1528 if ( !strcmp(test_string, "222") ) | |
1516 break; | 1529 break; |
1517 if ( !v11 ) | 1530 } |
1518 { | 1531 |
1519 LABEL_20: | 1532 for (uRow = 0;uRow < 50; ++uRow) |
1520 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", 0x10u); | 1533 { |
1521 return; | 1534 int skip_count; |
1522 } | 1535 for (skip_count = 0;skip_count < 6; ++skip_count) |
1523 } | 1536 { |
1524 while ( 1 ) | 1537 if ( !strtok(NULL, "\r\t\n") ) |
1525 { | 1538 break; |
1526 v11 = strtok(0, "\t\r\n"); | 1539 } |
1527 if ( !strcmp(v11, "222") ) | 1540 if ( skip_count != 6 ) |
1528 break; | 1541 break; |
1529 if ( !v11 ) | 1542 for (uColumn = 0; uColumn < 50; ++uColumn) |
1530 goto LABEL_20; | 1543 { |
1531 } | 1544 test_string = strtok(NULL, "\r\t\n"); |
1532 v9 = 0; | 1545 if ( !test_string ) |
1533 v10 = 30642; | 1546 break; |
1534 do | 1547 potion_value = atoi(test_string); |
1535 { | 1548 char c=*test_string; |
1536 v11 = 0; | 1549 if ( !potion_value ) |
1537 v2 = 0; | 1550 { |
1538 do | 1551 if ( tolower(c) == 'e' ) |
1539 { | 1552 potion_value = atoi(test_string + 1); |
1540 if ( !strtok(0, "\r\t\n") ) | 1553 else |
1541 break; | 1554 potion_value = 0; |
1542 ++v2; | 1555 } |
1543 } | 1556 this->potion_data[uRow][uColumn]=potion_value; |
1544 while ( v2 < 6 ); | 1557 } |
1545 if ( v2 != 6 ) | 1558 if ( uColumn != 50 ) |
1546 break; | 1559 break; |
1547 v11 = 0; | 1560 strtok(NULL, "\r\t\n"); |
1548 do | 1561 } |
1549 { | 1562 |
1550 v3 = strtok(0, "\r\t\n"); | 1563 if ( uRow != 50 ) |
1551 v4 = v3; | 1564 { |
1552 if ( !v3 ) | 1565 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); |
1553 break; | 1566 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); |
1554 v5 = atoi(v3); | |
1555 v6 = (char *)v8 + 2 * (uint)&v11[v10]; | |
1556 *(_WORD *)v6 = v5; | |
1557 if ( !v5 ) | |
1558 { | |
1559 if ( tolower((unsigned __int8)*v4) == 101 ) | |
1560 *(_WORD *)v6 = atoi(v4 + 1); | |
1561 else | |
1562 *(_WORD *)v6 = 0; | |
1563 } | |
1564 ++v11; | |
1565 } | |
1566 while ( (signed int)v11 < 50 ); | |
1567 if ( v11 != (char *)50 ) | |
1568 break; | |
1569 strtok(0, "\r\t\n"); | |
1570 v10 += 50; | |
1571 ++v9; | |
1572 } | |
1573 while ( v10 < 33142 ); | |
1574 if ( v9 != 50 ) | |
1575 { | |
1576 wsprintfA(&Text, "Error Parsing Potion Table at Row: %d Column: %d", v9, v11); | |
1577 MessageBoxA(0, &Text, "Parsing Error", 0x10u); | |
1578 } | 1567 } |
1579 if ( pPotionsTXT_Raw ) | 1568 if ( pPotionsTXT_Raw ) |
1580 { | 1569 { |
1581 pAllocator->FreeChunk(pPotionsTXT_Raw); | 1570 pAllocator->FreeChunk(pPotionsTXT_Raw); |
1582 pPotionsTXT_Raw = 0; | 1571 pPotionsTXT_Raw = 0; |
1584 } | 1573 } |
1585 | 1574 |
1586 //----- (00453CE5) -------------------------------------------------------- | 1575 //----- (00453CE5) -------------------------------------------------------- |
1587 void ItemsTable::LoadPotionNotes() | 1576 void ItemsTable::LoadPotionNotes() |
1588 { | 1577 { |
1589 char *i; // eax@3 | 1578 |
1590 signed int v2; // esi@11 | 1579 CHAR Text[90]; |
1591 char *v3; // eax@16 | 1580 char* test_string; |
1592 char *v4; // edi@16 | 1581 unsigned int uRow; |
1593 __int16 v5; // ax@17 | 1582 unsigned int uColumn; |
1594 char *v6; // esi@17 | 1583 unsigned __int8 potion_note; |
1595 CHAR *v7; // [sp-Ch] [bp-84h]@20 | 1584 |
1596 const CHAR *v8; // [sp-8h] [bp-80h]@20 | |
1597 UINT v9; // [sp-4h] [bp-7Ch]@20 | |
1598 CHAR Text; // [sp+Ch] [bp-6Ch]@26 | |
1599 ItemsTable *v11; // [sp+68h] [bp-10h]@1 | |
1600 int v12; // [sp+6Ch] [bp-Ch]@10 | |
1601 int v13; // [sp+70h] [bp-8h]@10 | |
1602 char *v14; // [sp+74h] [bp-4h]@4 | |
1603 | |
1604 v11 = this; | |
1605 if ( pPotionNotesTXT_Raw ) | 1585 if ( pPotionNotesTXT_Raw ) |
1606 pAllocator->FreeChunk(pPotionNotesTXT_Raw); | 1586 pAllocator->FreeChunk(pPotionNotesTXT_Raw); |
1607 pPotionNotesTXT_Raw = 0; | 1587 pPotionNotesTXT_Raw = NULL; |
1608 pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); | 1588 pPotionNotesTXT_Raw = (char *)pEvents_LOD->LoadRaw("potnotes.txt", 0); |
1609 for ( i = strtok(pPotionNotesTXT_Raw, "\t\r\n"); ; i = strtok(0, "\t\r\n") ) | 1589 test_string = strtok(pPotionNotesTXT_Raw ,"\t\r\n"); |
1610 { | |
1611 v14 = i; | |
1612 if ( !strcmp(i, "222") ) | |
1613 break; | |
1614 if ( !v14 ) | |
1615 { | |
1616 LABEL_20: | |
1617 v9 = 16; | |
1618 v8 = "Load Error"; | |
1619 v7 = "Error Pre-Parsing Potion Table"; | |
1620 LABEL_27: | |
1621 MessageBoxA(0, v7, v8, v9); | |
1622 return; | |
1623 } | |
1624 } | |
1625 while ( 1 ) | 1590 while ( 1 ) |
1626 { | 1591 { |
1627 v14 = strtok(0, "\t\r\n"); | 1592 |
1628 if ( !strcmp(v14, "222") ) | 1593 if ( !test_string ) |
1629 break; | 1594 { |
1630 if ( !v14 ) | 1595 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); |
1631 goto LABEL_20; | 1596 return; |
1632 } | 1597 } |
1633 v12 = 0; | 1598 if ( !strcmp(test_string, "222") ) |
1634 v13 = 33142; | 1599 break; |
1635 do | 1600 test_string = strtok(NULL, "\t\r\n"); |
1636 { | 1601 } |
1637 v14 = 0; | 1602 while ( 1 ) |
1638 v2 = 0; | 1603 { |
1639 do | 1604 test_string = strtok(NULL, "\t\r\n"); |
1640 { | 1605 |
1641 if ( !strtok(0, "\r\t\n") ) | 1606 if ( !test_string ) |
1642 break; | 1607 { |
1643 ++v2; | 1608 MessageBoxA(0, "Error Pre-Parsing Potion Table", "Load Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); |
1644 } | 1609 return; |
1645 while ( v2 < 6 ); | 1610 } |
1646 if ( v2 != 6 ) | 1611 if ( !strcmp(test_string, "222") ) |
1647 break; | 1612 break; |
1648 v14 = 0; | 1613 } |
1649 do | 1614 |
1650 { | 1615 for (uRow = 0;uRow < 50; ++uRow) |
1651 v3 = strtok(0, "\r\t\n"); | 1616 { |
1652 v4 = v3; | 1617 int skip_count; |
1653 if ( !v3 ) | 1618 for (skip_count = 0;skip_count < 6; ++skip_count) |
1654 break; | 1619 { |
1655 v5 = atoi(v3); | 1620 if ( !strtok(NULL, "\r\t\n") ) |
1656 v6 = (char *)v11 + 2 * (unsigned int)&v14[v13]; | 1621 break; |
1657 *(unsigned short *)v6 = v5; | 1622 } |
1658 if ( !v5 ) | 1623 if ( skip_count != 6 ) |
1659 { | 1624 break; |
1660 if ( tolower((unsigned __int8)*v4) == 101 ) | 1625 for (uColumn = 0; uColumn < 50; ++uColumn) |
1661 *(unsigned short *)v6 = atoi(v4 + 1); | 1626 { |
1662 else | 1627 test_string = strtok(NULL, "\r\t\n"); |
1663 *(unsigned short *)v6 = 0; | 1628 if ( !test_string ) |
1664 } | 1629 break; |
1665 ++v14; | 1630 potion_note = atoi(test_string); |
1666 } | 1631 char c=*test_string; |
1667 while ( (signed int)v14 < 50 ); | 1632 if ( !potion_note ) |
1668 if ( v14 != (char *)50 ) | 1633 { |
1669 break; | 1634 if ( tolower(c) == 'e' ) |
1670 strtok(0, "\r\t\n"); | 1635 potion_note = atoi(test_string + 1); |
1671 v13 += 50; | 1636 else |
1672 ++v12; | 1637 potion_note = 0; |
1673 } | 1638 } |
1674 while ( v13 < 35642 ); | 1639 this->potion_note[uRow][uColumn]=potion_note; |
1675 if ( v12 != 50 ) | 1640 } |
1676 { | 1641 if ( uColumn != 50 ) |
1677 wsprintfA(&Text, "Error Parsing Potion Autonote Table at Row: %d Column: %d", v12, v14); | 1642 break; |
1678 v9 = 16; | 1643 strtok(NULL, "\r\t\n"); |
1679 v8 = "Parsing Error"; | 1644 } |
1680 v7 = &Text; | 1645 |
1681 goto LABEL_27; | 1646 if ( uRow != 50 ) |
1682 } | 1647 { |
1648 wsprintfA(Text, "Error Parsing Potion Table at Row: %d Column: %d", uRow, uColumn); | |
1649 MessageBoxA(0, Text, "Parsing Error", MB_ICONHAND|MB_CANCELTRYCONTINUE); | |
1650 } | |
1683 } | 1651 } |
1684 | 1652 |
1685 | 1653 |
1686 //----- (00456442) -------------------------------------------------------- | 1654 //----- (00456442) -------------------------------------------------------- |
1687 unsigned int ItemGen::GetValue() | 1655 unsigned int ItemGen::GetValue() |