comparison Monsters.cpp @ 1554:e303d8a9bcdc

Merge
author Grumpy7
date Sat, 07 Sep 2013 21:14:48 +0200
parents c4ab816fcc5e
children 75fafd8ced59
comparison
equal deleted inserted replaced
1553:b98812ead5d9 1554:e303d8a9bcdc
366 366
367 v2 = this; 367 v2 = this;
368 v3 = fopen(Args, "r"); 368 v3 = fopen(Args, "r");
369 File = v3; 369 File = v3;
370 if ( !v3 ) 370 if ( !v3 )
371 Abortf("MonsterRaceListStruct::load - Unable to open file: %s."); 371 Error("MonsterRaceListStruct::load - Unable to open file: %s.");
372
372 v4 = 0; 373 v4 = 0;
373 Argsa = 0; 374 Argsa = 0;
374 if ( fgets(&Buf, 490, v3) ) 375 if ( fgets(&Buf, 490, v3) )
375 { 376 {
376 do 377 do
385 } 386 }
386 v2->uNumMonsters = v4; 387 v2->uNumMonsters = v4;
387 v5 = pAllocator->AllocNamedChunk(v2->pMonsters, 152 * v4, "Mon Race"); 388 v5 = pAllocator->AllocNamedChunk(v2->pMonsters, 152 * v4, "Mon Race");
388 v2->pMonsters = (MonsterDesc *)v5; 389 v2->pMonsters = (MonsterDesc *)v5;
389 if ( !v5 ) 390 if ( !v5 )
390 Abortf("MonsterRaceListStruct::load - Out of Memory!"); 391 Error("MonsterRaceListStruct::load - Out of Memory!");
392
391 v6 = File; 393 v6 = File;
392 v2->uNumMonsters = 0; 394 v2->uNumMonsters = 0;
393 fseek(v6, 0, 0); 395 fseek(v6, 0, 0);
394 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) 396 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) )
395 { 397 {
461 uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0, 463 uint num_mm6_monsters = data_mm6 ? *(int *)data_mm6 : 0,
462 num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0, 464 num_mm7_monsters = data_mm7 ? *(int *)data_mm7 : 0,
463 num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0; 465 num_mm8_monsters = data_mm8 ? *(int *)data_mm8 : 0;
464 466
465 uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters; 467 uNumMonsters = num_mm6_monsters + num_mm7_monsters + num_mm8_monsters;
466 assert(uNumMonsters); 468 Assert(uNumMonsters);
467 assert(!num_mm8_monsters); 469 Assert(!num_mm8_monsters);
468 470
469 pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race"); 471 pMonsters = (MonsterDesc *)pAllocator->AllocNamedChunk(pMonsters, sizeof(MonsterDesc) * uNumMonsters, "Mon Race");
470 memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc)); 472 memcpy(pMonsters, (char *)data_mm7 + 4, num_mm7_monsters * sizeof(MonsterDesc));
471 for (uint i = 0; i < num_mm6_monsters; ++i) 473 for (uint i = 0; i < num_mm6_monsters; ++i)
472 { 474 {
494 496
495 v1 = this; 497 v1 = this;
496 v2 = fopen("data\\dmonlist.bin", "wb"); 498 v2 = fopen("data\\dmonlist.bin", "wb");
497 v3 = v2; 499 v3 = v2;
498 if ( !v2 ) 500 if ( !v2 )
499 Abortf("Unable to save dmonlist.bin!"); 501 Error("Unable to save dmonlist.bin!");
500 fwrite(v1, 4u, 1u, v2); 502 fwrite(v1, 4u, 1u, v2);
501 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3); 503 fwrite(v1->pMonsters, 0x98u, v1->uNumMonsters, v3);
502 fclose(v3); 504 fclose(v3);
503 } 505 }
504 506
1191 for (signed __int16 i=1; i<=uNumMonsters; ++i) 1193 for (signed __int16 i=1; i<=uNumMonsters; ++i)
1192 { 1194 {
1193 if( (!_stricmp(pMonsters[i].pMonsterName, pMonsterName))) 1195 if( (!_stricmp(pMonsters[i].pMonsterName, pMonsterName)))
1194 return i; 1196 return i;
1195 } 1197 }
1196 assert(false && "Monster not found!"); 1198 Error("Monster not found: %s", pMonsterName);
1197 } 1199 }
1198 //----- (00438BDF) -------------------------------------------------------- 1200 //----- (00438BDF) --------------------------------------------------------
1199 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype) 1201 bool MonsterStats::BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype)
1200 { 1202 {
1201 unsigned __int8 v2; // zf@15 1203 unsigned __int8 v2; // zf@15