comparison Items.cpp @ 374:f0f66f690777

items
author Gloval
date Fri, 22 Feb 2013 08:20:59 +0400
parents 0f35f908547f
children c606cabd7cbf
comparison
equal deleted inserted replaced
365:0f35f908547f 374:f0f66f690777
212 } 212 }
213 } 213 }
214 } 214 }
215 215
216 //----- (0045814E) -------------------------------------------------------- 216 //----- (0045814E) --------------------------------------------------------
217 char *ItemsTable::Release() 217 void ItemsTable::Release()
218 { 218 {
219 ItemsTable *v1; // edi@1
220 char *result; // eax@23
221
222 v1 = this;
223 if ( pMonstersTXT_Raw ) 219 if ( pMonstersTXT_Raw )
224 pAllocator->FreeChunk(pMonstersTXT_Raw); 220 pAllocator->FreeChunk(pMonstersTXT_Raw);
225 if ( pMonsterPlacementTXT_Raw ) 221 if ( pMonsterPlacementTXT_Raw )
226 pAllocator->FreeChunk(pMonsterPlacementTXT_Raw); 222 pAllocator->FreeChunk(pMonsterPlacementTXT_Raw);
227 if ( pSkillDescTXT_Raw ) 223 if ( pSkillDescTXT_Raw )
228 pAllocator->FreeChunk(pSkillDescTXT_Raw); 224 pAllocator->FreeChunk(pSkillDescTXT_Raw);
229 if ( v1->pSpcItemsTXT_Raw ) 225 if (pSpcItemsTXT_Raw )
230 pAllocator->FreeChunk(v1->pSpcItemsTXT_Raw); 226 pAllocator->FreeChunk(pSpcItemsTXT_Raw);
231 if ( v1->pStdItemsTXT_Raw ) 227 if ( pStdItemsTXT_Raw )
232 pAllocator->FreeChunk(v1->pStdItemsTXT_Raw); 228 pAllocator->FreeChunk(pStdItemsTXT_Raw);
233 if ( v1->pRndItemsTXT_Raw ) 229 if ( pRndItemsTXT_Raw )
234 pAllocator->FreeChunk(v1->pRndItemsTXT_Raw); 230 pAllocator->FreeChunk(pRndItemsTXT_Raw);
235 if ( v1->pItemsTXT_Raw ) 231 if ( pItemsTXT_Raw )
236 pAllocator->FreeChunk(v1->pItemsTXT_Raw); 232 pAllocator->FreeChunk(pItemsTXT_Raw);
237 if ( pHostileTXT_Raw ) 233 if ( pHostileTXT_Raw )
238 pAllocator->FreeChunk(pHostileTXT_Raw); 234 pAllocator->FreeChunk(pHostileTXT_Raw);
239 if ( pHistoryTXT_Raw ) 235 if ( pHistoryTXT_Raw )
240 pAllocator->FreeChunk(pHistoryTXT_Raw); 236 pAllocator->FreeChunk(pHistoryTXT_Raw);
241 if ( pPotionsTXT_Raw ) 237 if ( pPotionsTXT_Raw )
242 pAllocator->FreeChunk(pPotionsTXT_Raw); 238 pAllocator->FreeChunk(pPotionsTXT_Raw);
243 if ( pPotionNotesTXT_Raw ) 239 if ( pPotionNotesTXT_Raw )
244 pAllocator->FreeChunk(pPotionNotesTXT_Raw); 240 pAllocator->FreeChunk(pPotionNotesTXT_Raw);
245 v1->pSpcItemsTXT_Raw = 0; 241 pSpcItemsTXT_Raw = NULL;
246 pSkillDescTXT_Raw = 0; 242 pSkillDescTXT_Raw = NULL;
247 v1->pStdItemsTXT_Raw = 0; 243 pStdItemsTXT_Raw = NULL;
248 v1->pRndItemsTXT_Raw = pSkillDescTXT_Raw; 244 pRndItemsTXT_Raw = NULL;
249 result = pSkillDescTXT_Raw; 245 pItemsTXT_Raw = NULL;
250 v1->pItemsTXT_Raw = pSkillDescTXT_Raw; 246
251 return result;
252 } 247 }
253 248
254 249
255 //----- (00456D84) -------------------------------------------------------- 250 //----- (00456D84) --------------------------------------------------------
256 void ItemsTable::Initialize() 251 void ItemsTable::Initialize()
442 { 437 {
443 for (j=0;j<pSpecialEnchantments_count;++j) 438 for (j=0;j<pSpecialEnchantments_count;++j)
444 pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i]; 439 pSpecialEnchantmentsSumm[i]+=pSpecialEnchantments[j].to_item_apply[i];
445 } 440 }
446 441
447
448
449 Initialize2DA(); 442 Initialize2DA();
450 443
451 pItemsTXT_Raw = NULL; 444 pItemsTXT_Raw = NULL;
452 pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0); 445 pItemsTXT_Raw = (char*) pEvents_LOD->LoadRaw("items.txt", 0);
453 strtok(pItemsTXT_Raw, "\r"); 446 strtok(pItemsTXT_Raw, "\r");
571 pItems[item_counter].uEquipType = EQUIP_POTION; 564 pItems[item_counter].uEquipType = EQUIP_POTION;
572 break; 565 break;
573 } 566 }
574 if ( !_strcmpi(test_string, "sscroll") ) 567 if ( !_strcmpi(test_string, "sscroll") )
575 { 568 {
576 pItems[item_counter].uEquipType = 15; 569 pItems[item_counter].uEquipType = EQUIP_SPELL_SCROLL;
577 break; 570 break;
578 } 571 }
579 if ( !_strcmpi(test_string, "book") ) 572 if ( !_strcmpi(test_string, "book") )
580 { 573 {
581 pItems[item_counter].uEquipType = EQUIP_BOOK; 574 pItems[item_counter].uEquipType = EQUIP_BOOK;
582 break; 575 break;
583 } 576 }
584 if ( !_strcmpi(test_string, "mscroll") ) 577 if ( !_strcmpi(test_string, "mscroll") )
585 { 578 {
586 pItems[item_counter].uEquipType = 17; 579 pItems[item_counter].uEquipType = EQUIP_MESSAGE_SCROLL;
587 break; 580 break;
588 } 581 }
589 if ( !_strcmpi(test_string, "gold") ) 582 if ( !_strcmpi(test_string, "gold") )
590 { 583 {
591 pItems[item_counter].uEquipType = EQUIP_GOLD; 584 pItems[item_counter].uEquipType = EQUIP_GOLD;
601 } 594 }
602 case 5: //Skill Group 595 case 5: //Skill Group
603 { 596 {
604 if ( !_strcmpi(test_string, "staff") ) 597 if ( !_strcmpi(test_string, "staff") )
605 { 598 {
606 pItems[item_counter].uSkillType = 0; 599 pItems[item_counter].uSkillType = PLAYER_SKILL_STAFF;
607 break; 600 break;
608 } 601 }
609 if ( !_strcmpi(test_string, "sword") ) 602 if ( !_strcmpi(test_string, "sword") )
610 { 603 {
611 pItems[item_counter].uSkillType = 1; 604 pItems[item_counter].uSkillType = PLAYER_SKILL_SWORD;
612 break; 605 break;
613 } 606 }
614 if ( !_strcmpi(test_string, "dagger") ) 607 if ( !_strcmpi(test_string, "dagger") )
615 { 608 {
616 pItems[item_counter].uSkillType = 2; 609 pItems[item_counter].uSkillType = PLAYER_SKILL_DAGGER;
617 break; 610 break;
618 } 611 }
619 if ( !_strcmpi(test_string, "axe") ) 612 if ( !_strcmpi(test_string, "axe") )
620 { 613 {
621 pItems[item_counter].uSkillType = 3; 614 pItems[item_counter].uSkillType = PLAYER_SKILL_AXE;
622 break; 615 break;
623 } 616 }
624 if ( !_strcmpi(test_string, "spear") ) 617 if ( !_strcmpi(test_string, "spear") )
625 { 618 {
626 pItems[item_counter].uSkillType = 4; 619 pItems[item_counter].uSkillType = PLAYER_SKILL_SPEAR;
627 break; 620 break;
628 } 621 }
629 if ( !_strcmpi(test_string, "bow") ) 622 if ( !_strcmpi(test_string, "bow") )
630 { 623 {
631 pItems[item_counter].uSkillType = 5; 624 pItems[item_counter].uSkillType = PLAYER_SKILL_BOW;
632 break; 625 break;
633 } 626 }
634 if ( !_strcmpi(test_string, "mace") ) 627 if ( !_strcmpi(test_string, "mace") )
635 { 628 {
636 pItems[item_counter].uSkillType = 6; 629 pItems[item_counter].uSkillType = PLAYER_SKILL_MACE;
637 break; 630 break;
638 } 631 }
639 if ( !_strcmpi(test_string, "blaster") ) 632 if ( !_strcmpi(test_string, "blaster") )
640 { 633 {
641 pItems[item_counter].uSkillType = 7; 634 pItems[item_counter].uSkillType = PLAYER_SKILL_BLASTER;
642 break; 635 break;
643 } 636 }
644 if ( !_strcmpi(test_string, "shield") ) 637 if ( !_strcmpi(test_string, "shield") )
645 { 638 {
646 pItems[item_counter].uSkillType = 8; 639 pItems[item_counter].uSkillType = PLAYER_SKILL_SHIELD;
647 break; 640 break;
648 } 641 }
649 if ( !_strcmpi(test_string, "leather") ) 642 if ( !_strcmpi(test_string, "leather") )
650 { 643 {
651 pItems[item_counter].uSkillType = 9; 644 pItems[item_counter].uSkillType = PLAYER_SKILL_LEATHER;
652 break; 645 break;
653 } 646 }
654 if ( !_strcmpi(test_string, "chain") ) 647 if ( !_strcmpi(test_string, "chain") )
655 { 648 {
656 pItems[item_counter].uSkillType = 10; 649 pItems[item_counter].uSkillType = PLAYER_SKILL_CHAIN;
657 break; 650 break;
658 } 651 }
659 if ( !_strcmpi(test_string, "plate") ) 652 if ( !_strcmpi(test_string, "plate") )
660 { 653 {
661 pItems[item_counter].uSkillType = 11; 654 pItems[item_counter].uSkillType = PLAYER_SKILL_PLATE;
662 break; 655 break;
663 } 656 }
664 if ( !_strcmpi(test_string, "club") ) 657 if ( !_strcmpi(test_string, "club") )
665 { 658 {
666 pItems[item_counter].uSkillType = 37; 659 pItems[item_counter].uSkillType = PLAYER_SKILL_CLUB;
667 break; 660 break;
668 } 661 }
669 pItems[item_counter].uSkillType = 38; 662 pItems[item_counter].uSkillType = PLAYER_SKILL_ANY;
670 break; 663 break;
671 } 664 }
672 case 6: //Mod1 665 case 6: //Mod1
673 { 666 {
674 int ii; 667 int ii;
1615 case 38: requested_equip = EQUIP_GAUNTLETS; break; 1608 case 38: requested_equip = EQUIP_GAUNTLETS; break;
1616 case 39: requested_equip = EQUIP_BOOTS; break; 1609 case 39: requested_equip = EQUIP_BOOTS; break;
1617 case 40: requested_equip = EQUIP_RING; break; 1610 case 40: requested_equip = EQUIP_RING; break;
1618 case 41: requested_equip = EQUIP_AMULET; break; 1611 case 41: requested_equip = EQUIP_AMULET; break;
1619 case 42: requested_equip = EQUIP_WAND; break; 1612 case 42: requested_equip = EQUIP_WAND; break;
1620 case 43: requested_equip = EQUIP_F; break; 1613 case 43: requested_equip = EQUIP_SPELL_SCROLL; break;
1621 case 44: requested_equip = EQUIP_POTION; break; 1614 case 44: requested_equip = EQUIP_POTION; break;
1622 case 45: requested_equip = EQUIP_REAGENT; break; 1615 case 45: requested_equip = EQUIP_REAGENT; break;
1623 case 46: requested_equip = EQUIP_GEM; break; 1616 case 46: requested_equip = EQUIP_GEM; break;
1624 default: 1617 default:
1625 __debugbreak(); // check this condition 1618 __debugbreak(); // check this condition