Mercurial > might-and-magic-trilogy
comparison Party.cpp @ 65:65c940aa7bf9
Слияние
author | Ritor1 |
---|---|
date | Thu, 25 Oct 2012 18:02:42 +0600 |
parents | c28452924144 |
children | 30ec77bbd018 |
comparison
equal
deleted
inserted
replaced
64:38025d9ab757 | 65:65c940aa7bf9 |
---|---|
278 } | 278 } |
279 | 279 |
280 //----- (0049137D) -------------------------------------------------------- | 280 //----- (0049137D) -------------------------------------------------------- |
281 void Party::CreateDefaultParty(char bGiveItems) | 281 void Party::CreateDefaultParty(char bGiveItems) |
282 { | 282 { |
283 Party *v2; // esi@1 | 283 Party *pParty; // esi@1 |
284 signed __int16 v3; // ax@1 | 284 signed __int16 v3; // ax@1 |
285 int v4; // ecx@1 | 285 int pResMagicBase; // ecx@1 |
286 Player *v5; // esi@3 | 286 Player *pCharacter; // esi@3 |
287 signed int v6; // edx@5 | 287 signed int uSpellBookPageCount; // edx@5 |
288 int v7; // eax@5 | 288 int v7; // eax@5 |
289 int uSkillIdx; // eax@11 | 289 int uSkillIdx; // eax@11 |
290 unsigned __int8 v9; // zf@37 | 290 unsigned __int8 v9; // zf@37 |
291 char v10; // sf@37 | 291 char v10; // sf@37 |
292 unsigned __int8 v11; // of@37 | 292 unsigned __int8 v11; // of@37 |
293 char *v12; // eax@38 | 293 char *v12; // eax@38 |
294 signed int v13; // ecx@38 | 294 signed int v13; // ecx@38 |
295 int v14; // eax@42 | 295 int uMaxSP; // eax@42 |
296 unsigned int v15; // [sp-4h] [bp-44h]@14 | 296 unsigned int v15; // [sp-4h] [bp-44h]@14 |
297 unsigned int v16; // [sp-4h] [bp-44h]@26 | 297 unsigned int v16; // [sp-4h] [bp-44h]@26 |
298 int v17; // [sp+10h] [bp-30h]@1 | 298 int v17; // [sp+10h] [bp-30h]@1 |
299 int v18; // [sp+14h] [bp-2Ch]@11 | 299 int v18; // [sp+14h] [bp-2Ch]@11 |
300 signed int v19; // [sp+18h] [bp-28h]@1 | 300 signed int uNumPlayers; // [sp+18h] [bp-28h]@1 |
301 ItemGen Dst; // [sp+1Ch] [bp-24h]@10 | 301 ItemGen Dst; // [sp+1Ch] [bp-24h]@10 |
302 | 302 |
303 v2 = this; | 303 pParty = this; |
304 strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); | 304 strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan |
305 v2->pPlayers[0].field_1928 = 17; | 305 pParty->pPlayers[0].field_1928 = 17; |
306 v2->pPlayers[0].uFace = 17; | 306 pParty->pPlayers[0].uFace = 17; |
307 v2->pPlayers[0].field_1924 = 17; | 307 pParty->pPlayers[0].field_1924 = 17; |
308 v2->pPlayers[0].uVoiceID = 17; | 308 pParty->pPlayers[0].uVoiceID = 17; |
309 v2->pPlayers[0].uMight = 30; | 309 pParty->pPlayers[0].uMight = 30; |
310 v2->pPlayers[0].uIntelligence = 5; | 310 pParty->pPlayers[0].uIntelligence = 5; |
311 v2->pPlayers[0].uWillpower = 5; | 311 pParty->pPlayers[0].uWillpower = 5; |
312 v2->pPlayers[0].uEndurance = 13; | 312 pParty->pPlayers[0].uEndurance = 13; |
313 v2->pPlayers[0].uAccuracy = 13; | 313 pParty->pPlayers[0].uAccuracy = 13; |
314 v2->pPlayers[0].uSpeed = 14; | 314 pParty->pPlayers[0].uSpeed = 14; |
315 v2->pPlayers[0].uLuck = 7; | 315 pParty->pPlayers[0].uLuck = 7; |
316 v2->pPlayers[0].pActiveSkills[9] = 1; // leather | 316 pParty->pPlayers[0].pActiveSkills[9] = 1; // leather |
317 v2->pPlayers[0].pActiveSkills[33] = 1; // armsmaster | 317 pParty->pPlayers[0].pActiveSkills[33] = 1; // armsmaster |
318 v2->pPlayers[0].pActiveSkills[5] = 1; // bow | 318 pParty->pPlayers[0].pActiveSkills[5] = 1; // bow |
319 v2->pPlayers[0].pActiveSkills[1] = 1; // sword | 319 pParty->pPlayers[0].pActiveSkills[1] = 1; // sword |
320 v2->pPlayers[1].field_1928 = 3; | 320 pParty->pPlayers[1].field_1928 = 3; |
321 v2->pPlayers[1].uFace = 3; | 321 pParty->pPlayers[1].uFace = 3; |
322 v2->pPlayers[1].field_1924 = 3; | 322 pParty->pPlayers[1].field_1924 = 3; |
323 v2->pPlayers[1].uVoiceID = 3; | 323 pParty->pPlayers[1].uVoiceID = 3; |
324 strcpy(v2->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); | 324 strcpy(pParty->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); //Roderic |
325 v2->pPlayers[1].uMight = 13; | 325 pParty->pPlayers[1].uMight = 13; |
326 v2->pPlayers[1].uIntelligence = 9; | 326 pParty->pPlayers[1].uIntelligence = 9; |
327 v2->pPlayers[1].uWillpower = 9; | 327 pParty->pPlayers[1].uWillpower = 9; |
328 v2->pPlayers[1].uEndurance = 13; | 328 pParty->pPlayers[1].uEndurance = 13; |
329 v2->pPlayers[1].uAccuracy = 13; | 329 pParty->pPlayers[1].uAccuracy = 13; |
330 v2->pPlayers[1].uSpeed = 13; | 330 pParty->pPlayers[1].uSpeed = 13; |
331 v2->pPlayers[1].uLuck = 13; | 331 pParty->pPlayers[1].uLuck = 13; |
332 v2->pPlayers[1].pActiveSkills[9] = 1; // leather | 332 pParty->pPlayers[1].pActiveSkills[9] = 1; // leather |
333 v2->pPlayers[1].pActiveSkills[34] = 1; // stealing | 333 pParty->pPlayers[1].pActiveSkills[34] = 1; // stealing |
334 v2->pPlayers[1].pActiveSkills[2] = 1; // dagger | 334 pParty->pPlayers[1].pActiveSkills[2] = 1; // dagger |
335 v2->pPlayers[1].pActiveSkills[29] = 1; // disarm trap | 335 pParty->pPlayers[1].pActiveSkills[29] = 1; // disarm trap |
336 v2->pPlayers[2].field_1928 = 14; | 336 pParty->pPlayers[2].field_1928 = 14; |
337 v2->pPlayers[2].uFace = 14; | 337 pParty->pPlayers[2].uFace = 14; |
338 v2->pPlayers[2].field_1924 = 14; | 338 pParty->pPlayers[2].field_1924 = 14; |
339 v2->pPlayers[2].uVoiceID = 14; | 339 pParty->pPlayers[2].uVoiceID = 14; |
340 strcpy(v2->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); | 340 strcpy(pParty->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); // Serena |
341 v2->pPlayers[2].uMight = 12; | 341 pParty->pPlayers[2].uMight = 12; |
342 v2->pPlayers[2].uIntelligence = 9; | 342 pParty->pPlayers[2].uIntelligence = 9; |
343 v2->pPlayers[2].uWillpower = 20; | 343 pParty->pPlayers[2].uWillpower = 20; |
344 v2->pPlayers[2].uEndurance = 22; | 344 pParty->pPlayers[2].uEndurance = 22; |
345 v2->pPlayers[2].uAccuracy = 7; | 345 pParty->pPlayers[2].uAccuracy = 7; |
346 v2->pPlayers[2].uSpeed = 13; | 346 pParty->pPlayers[2].uSpeed = 13; |
347 v2->pPlayers[2].uLuck = 7; | 347 pParty->pPlayers[2].uLuck = 7; |
348 v2->pPlayers[2].pActiveSkills[35] = 1; // alchemy | 348 pParty->pPlayers[2].pActiveSkills[35] = 1; // alchemy |
349 v2->pPlayers[2].pActiveSkills[9] = 1; // leather | 349 pParty->pPlayers[2].pActiveSkills[9] = 1; // leather |
350 v2->pPlayers[2].pActiveSkills[18] = 1; // body | 350 pParty->pPlayers[2].pActiveSkills[18] = 1; // body |
351 v2->pPlayers[2].pActiveSkills[6] = 1; // mace | 351 pParty->pPlayers[2].pActiveSkills[6] = 1; // mace |
352 strcpy(v2->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); | 352 strcpy(pParty->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); // Alexis |
353 v3 = 10; | 353 v3 = 10; |
354 v2->pPlayers[3].field_1928 = 10; | 354 pParty->pPlayers[3].field_1928 = 10; |
355 v2->pPlayers[3].uFace = 10; | 355 pParty->pPlayers[3].uFace = 10; |
356 v4 = (int)&v2->pPlayers[0].sResMagicBase; | 356 pResMagicBase = (int)&pParty->pPlayers[0].sResMagicBase; |
357 v2->pPlayers[3].uEndurance = 13; | 357 pParty->pPlayers[3].uEndurance = 13; |
358 v2->pPlayers[3].uAccuracy = 13; | 358 pParty->pPlayers[3].uAccuracy = 13; |
359 v2->pPlayers[3].uSpeed = 13; | 359 pParty->pPlayers[3].uSpeed = 13; |
360 v2->pPlayers[3].field_1924 = 10; | 360 pParty->pPlayers[3].field_1924 = 10; |
361 v2->pPlayers[3].uVoiceID = 10; | 361 pParty->pPlayers[3].uVoiceID = 10; |
362 v2->pPlayers[3].uMight = 5; | 362 pParty->pPlayers[3].uMight = 5; |
363 v2->pPlayers[3].uIntelligence = 30; | 363 pParty->pPlayers[3].uIntelligence = 30; |
364 v2->pPlayers[3].uWillpower = 9; | 364 pParty->pPlayers[3].uWillpower = 9; |
365 v2->pPlayers[3].uLuck = 7; | 365 pParty->pPlayers[3].uLuck = 7; |
366 v2->pPlayers[3].pActiveSkills[9] = 1; // leather | 366 pParty->pPlayers[3].pActiveSkills[9] = 1; // leather |
367 v2->pPlayers[3].pActiveSkills[13] = 1; // air | 367 pParty->pPlayers[3].pActiveSkills[13] = 1; // air |
368 v2->pPlayers[3].pActiveSkills[12] = 1; // fire | 368 pParty->pPlayers[3].pActiveSkills[12] = 1; // fire |
369 v2->pPlayers[3].pActiveSkills[0] = 1; // staff | 369 pParty->pPlayers[3].pActiveSkills[0] = 1; // staff |
370 v17 = (int)&v2->pPlayers[0].sResMagicBase; | 370 pCharacter = &pParty->pPlayers[0]; |
371 v19 = 4; | 371 uNumPlayers = 4; |
372 while ( 1 ) | 372 while ( 1 ) |
373 { | 373 { |
374 v5 = (Player *)(v4 - 6014); | 374 if ( !pCharacter->uClass ) |
375 if ( !*(char *)(v4 - 5829) ) | 375 *(short *)pResMagicBase = v3; |
376 *(short *)v4 = v3; | 376 uSpellBookPageCount = 0; |
377 v6 = 0; | 377 v7 = pResMagicBase - 5726;// Skills |
378 v7 = v4 - 5726; | |
379 while ( !*(short *)v7 ) | 378 while ( !*(short *)v7 ) |
380 { | 379 { |
381 ++v6; | 380 ++uSpellBookPageCount; |
382 v7 += 2; | 381 v7 += 2; |
383 if ( v6 >= 9 ) | 382 if ( uSpellBookPageCount >= 9 ) |
384 goto LABEL_10; | 383 goto LABEL_10; |
385 } | 384 } |
386 v5->field_1A4E = v6; | 385 pCharacter->pNumSpellBookPage = uSpellBookPageCount; |
387 LABEL_10: | 386 LABEL_10: |
388 v5->uExpressionTimePassed = 0; | 387 pCharacter->uExpressionTimePassed = 0; |
389 Dst.Reset(); | 388 Dst.Reset(); |
390 if ( bGiveItems ) | 389 if ( bGiveItems ) |
391 { | 390 { |
392 pItemsTable->GenerateItem(2, 40, &Dst); | 391 pItemsTable->GenerateItem(2, 40, &Dst); |
393 v5->AddItem2(0xFFFFFFFFu, &Dst); | 392 pCharacter->AddItem2(-1, &Dst); |
394 uSkillIdx = 0; | 393 uSkillIdx = 0; |
395 v18 = 0; | 394 v18 = 0; |
396 do | 395 do |
397 { | 396 { |
398 if ( v5->pActiveSkills[uSkillIdx] ) | 397 if ( pCharacter->pActiveSkills[uSkillIdx] ) |
399 { | 398 { |
400 switch ( uSkillIdx ) | 399 switch ( uSkillIdx ) |
401 { | 400 { |
402 case PLAYER_SKILL_STAFF: | 401 case PLAYER_SKILL_STAFF: |
403 v15 = ITEM_STAFF_1; | 402 v15 = ITEM_STAFF_1; |
430 v15 = ITEM_CHAINMAIL_1; | 429 v15 = ITEM_CHAINMAIL_1; |
431 goto wear_item; | 430 goto wear_item; |
432 case PLAYER_SKILL_PLATE: | 431 case PLAYER_SKILL_PLATE: |
433 v15 = ITEM_PLATE_1; | 432 v15 = ITEM_PLATE_1; |
434 wear_item: | 433 wear_item: |
435 v5->WearItem(v15); | 434 pCharacter->WearItem(v15); |
436 break; | 435 break; |
437 case PLAYER_SKILL_FIRE: | 436 case PLAYER_SKILL_FIRE: |
438 v16 = ITEM_SPELLBOOK_FIRE_STRIKE; | 437 v16 = ITEM_SPELLBOOK_FIRE_STRIKE; |
439 goto add_item; | 438 goto add_item; |
440 case PLAYER_SKILL_AIR: | 439 case PLAYER_SKILL_AIR: |
460 case PLAYER_SKILL_MEDITATION: | 459 case PLAYER_SKILL_MEDITATION: |
461 case PLAYER_SKILL_PERCEPTION: | 460 case PLAYER_SKILL_PERCEPTION: |
462 case PLAYER_SKILL_DIPLOMACY: | 461 case PLAYER_SKILL_DIPLOMACY: |
463 case PLAYER_SKILL_TRAP_DISARM: | 462 case PLAYER_SKILL_TRAP_DISARM: |
464 case PLAYER_SKILL_LEARNING: | 463 case PLAYER_SKILL_LEARNING: |
465 v5->AddItem(0xFFFFFFFFu, ITEM_POTION_BOTTLE); | 464 pCharacter->AddItem(-1, ITEM_POTION_BOTTLE); |
466 v16 = 5 * (rand() % 3 + 40); // simple reagent | 465 v16 = 5 * (rand() % 3 + 40); // simple reagent |
467 goto add_item; | 466 goto add_item; |
468 case PLAYER_SKILL_DODGE: | 467 case PLAYER_SKILL_DODGE: |
469 v16 = ITEM_BOOTS_1; | 468 v16 = ITEM_BOOTS_1; |
470 goto add_item; | 469 goto add_item; |
471 case PLAYER_SKILL_UNARMED: | 470 case PLAYER_SKILL_UNARMED: |
472 v16 = ITEM_GAUNTLETS_1; | 471 v16 = ITEM_GAUNTLETS_1; |
473 add_item: | 472 add_item: |
474 v5->AddItem(0xFFFFFFFFu, v16); | 473 pCharacter->AddItem(-1, v16); |
475 break; | 474 break; |
476 default: | 475 default: |
477 break; | 476 break; |
478 } | 477 } |
479 } | 478 } |
481 v11 = __OFSUB__(v18 + 1, 36); | 480 v11 = __OFSUB__(v18 + 1, 36); |
482 v9 = v18 == 35; | 481 v9 = v18 == 35; |
483 v10 = v18++ - 35 < 0; | 482 v10 = v18++ - 35 < 0; |
484 } | 483 } |
485 while ( (unsigned __int8)(v10 ^ v11) | v9 ); | 484 while ( (unsigned __int8)(v10 ^ v11) | v9 ); |
486 v12 = (char *)&v5->pInventoryItems[0].uAttributes; | 485 v12 = (char *)&pCharacter->pInventoryItems[0].uAttributes; |
487 v13 = 138; | 486 v13 = 138; |
488 do | 487 do |
489 { | 488 { |
490 if ( *((int *)v12 - 5) ) | 489 if ( *((int *)v12 - 5) ) |
491 *(int *)v12 |= 1u; | 490 *(int *)v12 |= 1u; |
492 v12 += 36; | 491 v12 += 36; |
493 --v13; | 492 --v13; |
494 } | 493 } |
495 while ( v13 ); | 494 while ( v13 ); |
496 } | 495 } |
497 v5->sHealth = v5->GetMaxHealth(); | 496 pCharacter->sHealth = pCharacter->GetMaxHealth(); |
498 v14 = v5->GetMaxMana(); | 497 pCharacter->sMana = pCharacter->GetMaxMana(); |
499 v17 += 6972; | 498 pCharacter++; |
500 v9 = v19-- == 1; | 499 v9 = uNumPlayers-- == 1; |
501 v5->sMana = v14; | |
502 if ( v9 ) | 500 if ( v9 ) |
503 break; | 501 break; |
504 v4 = v17; | 502 pResMagicBase = (int)pCharacter; |
505 v3 = 10; | 503 v3 = 10; |
506 } | 504 } |
507 } | 505 } |
508 | 506 |
509 //----- (004917CE) -------------------------------------------------------- | 507 //----- (004917CE) -------------------------------------------------------- |