Mercurial > mm7
comparison Player.cpp @ 187:49728858c35e
On player voices
author | Nomad |
---|---|
date | Fri, 15 Feb 2013 22:38:05 +0200 |
parents | f102bbff6fd8 |
children | 207b2492e14b |
comparison
equal
deleted
inserted
replaced
186:d65528fc3bda | 187:49728858c35e |
---|---|
1 #include <assert.h> | |
2 | |
1 #include "OSAPI.h" | 3 #include "OSAPI.h" |
2 | |
3 #include "Player.h" | 4 #include "Player.h" |
4 #include "PlayerFrameTable.h" | 5 #include "PlayerFrameTable.h" |
5 #include "Texture.h" | 6 #include "Texture.h" |
6 #include "AudioPlayer.h" | 7 #include "AudioPlayer.h" |
7 #include "Party.h" | 8 #include "Party.h" |
567 } | 568 } |
568 return (char)v5; | 569 return (char)v5; |
569 } | 570 } |
570 | 571 |
571 //----- (004948B1) -------------------------------------------------------- | 572 //----- (004948B1) -------------------------------------------------------- |
572 __int16 Player::PlaySound(int a2, int a3) | 573 void Player::PlaySound(PlayerSpeech speech, int a3) |
573 { | 574 { |
574 Player *pPlayer; // edi@1 | 575 //Player *pPlayer; // edi@1 |
575 int v4; // eax@4 | 576 //int v4; // eax@4 |
576 signed int v5; // esi@4 | 577 signed int v5; // esi@4 |
577 short *v6; // ebx@4 | 578 char *v6; // ebx@4 |
578 signed int v7; // ecx@5 | 579 signed int v7; // ecx@5 |
579 unsigned __int8 v8; // al@6 | 580 unsigned __int8 v8; // al@6 |
580 int v9; // eax@10 | 581 int v9; // eax@10 |
581 unsigned int pVoiceID; // ecx@10 | 582 //unsigned int pVoiceID; // ecx@10 |
582 int v11; // esi@10 | 583 int v11; // esi@10 |
583 signed int v12; // eax@11 | 584 signed int v12; // eax@11 |
584 signed int v13; // esi@12 | 585 signed int v13; // esi@12 |
585 int v14; // eax@12 | 586 int v14; // eax@12 |
586 int v15; // eax@17 | 587 //int v15; // eax@17 |
587 int pExpression; // ebx@17 | 588 int pExpression; // ebx@17 |
588 signed int v17; // ecx@19 | 589 signed int v17; // ecx@19 |
589 char *pSoundID; // edi@20 | 590 char *pSoundID; // edi@20 |
590 int v20[5]; // [sp+Ch] [bp-1Ch]@7 | 591 int v20[5]; // [sp+Ch] [bp-1Ch]@7 |
591 Player *pPlayer2; // [sp+20h] [bp-8h]@1 | 592 //Player *pPlayer2; // [sp+20h] [bp-8h]@1 |
592 int pPlayerNum; // [sp+24h] [bp-4h]@1 | 593 int pPlayerNum; // [sp+24h] [bp-4h]@1 |
593 int pSoundId; // [sp+30h] [bp+8h]@4 | 594 int pSoundId; // [sp+30h] [bp+8h]@4 |
594 | 595 |
595 pPlayer = this; | 596 //pPlayer = this; |
596 pPlayer2 = this; | 597 //pPlayer2 = this; |
598 | |
597 pPlayerNum = 1; | 599 pPlayerNum = 1; |
598 do | 600 for (int i = 0; i < 4; ++i) |
599 { | 601 if (&pParty->pPlayers[i] == this) |
600 if ( this == pPlayers[pPlayerNum] ) | 602 { |
603 pPlayerNum = i + 1; | |
601 break; | 604 break; |
602 ++pPlayerNum; | 605 } |
603 } | 606 |
604 while ( pPlayerNum <= 4 ); | 607 //v4 = a2;//102 |
605 v4 = a2;//102 | |
606 v5 = 0; | 608 v5 = 0; |
607 pSoundId = 0; | 609 pSoundId = 0; |
608 v6 = &SoundSetAction[8 * v4];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? | 610 v6 = (char *)&SoundSetAction[4 * speech];//byte_4ED280 &byte_4ED3D8[4 * v4] ??? |
609 if ( uVoicesVolumeMultiplier ) | 611 if ( uVoicesVolumeMultiplier ) |
610 { | 612 { |
611 v7 = 0; | 613 v7 = 0; |
612 do | 614 do |
613 { | 615 { |
618 } | 620 } |
619 while ( v7 < 2 ); | 621 while ( v7 < 2 ); |
620 if ( v5 ) | 622 if ( v5 ) |
621 { | 623 { |
622 v9 = rand(); | 624 v9 = rand(); |
623 pVoiceID = pPlayer->uVoiceID; | 625 //pVoiceID = uVoiceID; |
624 v11 = v20[v9 % v5]; | 626 v11 = v20[v9 % v5]; |
625 if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) ) | 627 if ( LOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) ) |
626 { | 628 { |
627 pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[pVoiceID]) | 629 pSoundId = rand() % SLOBYTE((&(&dlhu_texnames_by_face[19])[25 * v11 + 3])[uVoiceID]) |
628 + 2 * (v11 + 50 * pPlayer2->uVoiceID) | 630 + 2 * (v11 + 50 * uVoiceID) |
629 + 4998; | 631 + 4998; |
630 v12 = 8 * pPlayerNum + 312; | 632 v12 = 8 * pPlayerNum + 312; |
631 LOBYTE(v12) = v12 | 4; | 633 LOBYTE(v12) = v12 | OBJECT_Player; |
632 pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); | 634 pAudioPlayer->PlaySound((SoundID)pSoundId, v12, 0, -1, 0, 0, (pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0), 0); |
633 } | 635 } |
634 } | 636 } |
635 } | 637 } |
636 v13 = 0; | 638 v13 = 0; |
642 ++v14; | 644 ++v14; |
643 } | 645 } |
644 while ( -3 - (signed int)v6 + v14 < 5 ); | 646 while ( -3 - (signed int)v6 + v14 < 5 ); |
645 if ( v13 ) | 647 if ( v13 ) |
646 { | 648 { |
647 v15 = rand(); | |
648 pPlayerNum = 0; | 649 pPlayerNum = 0; |
649 pExpression = v20[v15 % v13]; | 650 pExpression = v20[rand() % v13]; |
650 if ( pExpression == 21 && pSoundId ) | 651 if ( pExpression == 21 && pSoundId ) |
651 { | 652 { |
652 v17 = 0; | 653 v17 = 0; |
653 if ( (signed int)pSoundList->uNumSounds <= 0 ) | 654 if ( (signed int)pSoundList->uNumSounds <= 0 ) |
654 { | 655 { |
667 } | 668 } |
668 } | 669 } |
669 if ( pSoundList->pSounds[v17].pSoundData[0] ) | 670 if ( pSoundList->pSounds[v17].pSoundData[0] ) |
670 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; | 671 pPlayerNum = (sLastTrackLengthMS << 7) / 1000; |
671 } | 672 } |
672 LOWORD(v14) = pPlayer2->PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); | 673 /*LOWORD(v14) = */PlayEmotion((CHARACTER_EXPRESSION_ID)pExpression, pPlayerNum); |
673 } | 674 } |
674 return v14; | 675 //return v14; |
675 } | 676 } |
676 // 4948B1: using guessed type int var_1C[5]; | 677 // 4948B1: using guessed type int var_1C[5]; |
677 | 678 |
678 //----- (00494A25) -------------------------------------------------------- | 679 //----- (00494A25) -------------------------------------------------------- |
679 __int16 Player::PlayEmotion(CHARACTER_EXPRESSION_ID expr, int a3) | 680 void Player::PlayEmotion(CHARACTER_EXPRESSION_ID new_expression, int a3) |
680 { | 681 { |
681 signed int v3; // eax@1 | 682 //signed int v3; // eax@1 |
682 CHARACTER_EXPRESSION_ID v4; // dx@1 | 683 //CHARACTER_EXPRESSION_ID v4; // dx@1 |
683 signed int v5; // edi@15 | 684 signed int v5; // edi@15 |
684 PlayerFrame *v6; // esi@17 | 685 PlayerFrame *v6; // esi@17 |
685 signed int v7; // eax@20 | 686 signed int v7; // eax@20 |
686 | 687 |
687 LOWORD(v3) = this->expression; | 688 //LOWORD(v3) = this->expression; |
688 v4 = expr; | 689 //v4 = expr; |
689 if ( (short)v3 != 4 && (short)v3 != 12 || expr != 58 ) | 690 if (expression != CHARACTER_EXPRESSION_SLEEP && |
690 { | 691 expression != CHARACTER_EXPRESSION_PERTIFIED || new_expression != CHARACTER_EXPRESSION_58) |
691 v3 = (unsigned __int16)v3; | 692 { |
693 int v3 = (unsigned)expression; | |
692 if ( (signed int)(unsigned __int16)v3 >= 2 ) | 694 if ( (signed int)(unsigned __int16)v3 >= 2 ) |
693 { | 695 { |
694 if ( v3 <= 7 ) | 696 if ( v3 <= 7 ) |
695 goto LABEL_12; | 697 goto LABEL_12; |
696 if ( v3 > 8 ) | 698 if ( v3 > 8 ) |
697 { | 699 { |
698 if ( v3 > 11 ) | 700 if ( v3 > 11 ) |
699 { | 701 { |
700 if ( v3 == 12 || v3 > 97 && v3 <= 99 ) | 702 if ( v3 == CHARACTER_EXPRESSION_PERTIFIED || v3 > 97 && v3 <= 99 ) |
701 return v3; | 703 return; |
702 goto LABEL_15; | 704 goto LABEL_15; |
703 } | 705 } |
704 LABEL_12: | 706 LABEL_12: |
705 if ( expr != 34 && expr != 35 && expr != 36 ) | 707 if (new_expression != CHARACTER_EXPRESSION_34 && new_expression != CHARACTER_EXPRESSION_35 && new_expression != CHARACTER_EXPRESSION_36) |
706 return v3; | 708 return; |
707 goto LABEL_15; | 709 goto LABEL_15; |
708 } | 710 } |
709 } | 711 } |
710 } | 712 } |
711 LABEL_15: | 713 LABEL_15: |
712 LOWORD(v3) = a3; | 714 //LOWORD(v3) = a3; |
713 v5 = 0; | 715 v5 = 0; |
714 this->uExpressionTimeLength = a3; | 716 this->uExpressionTimeLength = a3; |
715 this->uExpressionTimePassed = 0; | 717 this->uExpressionTimePassed = 0; |
716 if ( !a3 ) | 718 if ( !a3 ) |
717 { | 719 { |
721 v7 = 0; | 723 v7 = 0; |
722 } | 724 } |
723 else | 725 else |
724 { | 726 { |
725 v6 = pPlayerFrameTable->pFrames; | 727 v6 = pPlayerFrameTable->pFrames; |
726 while ( v6->expression != expr ) | 728 while ( v6->expression != new_expression ) |
727 { | 729 { |
728 ++v5; | 730 ++v5; |
729 ++v6; | 731 ++v6; |
730 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) | 732 if ( v5 >= (signed int)pPlayerFrameTable->uNumFrames ) |
731 goto LABEL_20; | 733 goto LABEL_20; |
732 } | 734 } |
733 v7 = v5; | 735 v7 = v5; |
734 } | 736 } |
735 v4 = expr; | 737 //v4 = expr; |
736 LOWORD(v3) = 8 * pPlayerFrameTable->pFrames[v3].uAnimLength; | 738 this->uExpressionTimeLength = 8 * pPlayerFrameTable->pFrames[a3].uAnimLength; |
737 this->uExpressionTimeLength = v3; | 739 } |
738 } | 740 expression = new_expression; |
739 this->expression = v4; | |
740 viewparams->bRedrawGameUI = 1; | 741 viewparams->bRedrawGameUI = 1; |
741 return v3; | |
742 } | 742 } |
743 | 743 |
744 //----- (0049327B) -------------------------------------------------------- | 744 //----- (0049327B) -------------------------------------------------------- |
745 int Player::_49327B(unsigned int uClass, int a3) | 745 int Player::_49327B(unsigned int uClass, int a3) |
746 { | 746 { |
1235 LABEL_16: | 1235 LABEL_16: |
1236 if ( v3->WearsItem(v24, v27) ) | 1236 if ( v3->WearsItem(v24, v27) ) |
1237 goto LABEL_76; | 1237 goto LABEL_76; |
1238 goto LABEL_82; | 1238 goto LABEL_82; |
1239 case 0xDu: | 1239 case 0xDu: |
1240 v3->PlaySound(32, 0); | 1240 v3->PlaySound(SPEECH_32, 0); |
1241 v13 = (char *)&v3->sHealth; | 1241 v13 = (char *)&v3->sHealth; |
1242 goto LABEL_70; | 1242 goto LABEL_70; |
1243 case 0xEu: | 1243 case 0xEu: |
1244 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) | 1244 if ( a3 == 1 && (signed __int64)pParty->pPartyBuffs[13].uExpireTime > 0 && pParty->pPartyBuffs[13].uSkill >= 4u ) |
1245 goto LABEL_10; | 1245 goto LABEL_10; |
1266 if ( pParty->pPartyBuffs[13].uPower < 1u ) | 1266 if ( pParty->pPartyBuffs[13].uPower < 1u ) |
1267 pParty->pPartyBuffs[13].Reset(); | 1267 pParty->pPartyBuffs[13].Reset(); |
1268 goto LABEL_76; | 1268 goto LABEL_76; |
1269 } | 1269 } |
1270 v28 = 0; | 1270 v28 = 0; |
1271 v25 = 35; | 1271 v25 = SPEECH_35; |
1272 LABEL_67: | 1272 LABEL_67: |
1273 v3->PlaySound(v25, v28); | 1273 v3->PlaySound((PlayerSpeech)v25, v28); |
1274 if ( v3->sHealth > 0 ) | 1274 if ( v3->sHealth > 0 ) |
1275 v3->sHealth = 0; | 1275 v3->sHealth = 0; |
1276 v13 = (char *)&v3->sMana; | 1276 v13 = (char *)&v3->sMana; |
1277 LABEL_70: | 1277 LABEL_70: |
1278 if ( *(int *)v13 > 0 ) | 1278 if ( *(int *)v13 > 0 ) |
1293 } | 1293 } |
1294 while ( v22 <= 4 ); | 1294 while ( v22 <= 4 ); |
1295 if ( v30 == 2 ) | 1295 if ( v30 == 2 ) |
1296 { | 1296 { |
1297 if ( v31 == 1 ) | 1297 if ( v31 == 1 ) |
1298 pPlayers[v21]->PlaySound(107, 0); | 1298 pPlayers[v21]->PlaySound(SPEECH_107, 0); |
1299 } | 1299 } |
1300 result = 1; | 1300 result = 1; |
1301 break; | 1301 break; |
1302 case 0x11u: | 1302 case 0x11u: |
1303 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || | 1303 if ( v3->classType == PLAYER_CLASS_LICH || v3->Eradicated() || |
1343 default: | 1343 default: |
1344 break; | 1344 break; |
1345 } | 1345 } |
1346 v26 = 0; | 1346 v26 = 0; |
1347 v20 = (v18 != 0) + 23; | 1347 v20 = (v18 != 0) + 23; |
1348 v23 = 99; | 1348 v23 = SPEECH_99; |
1349 v3->uFace = v20; | 1349 v3->uFace = v20; |
1350 v3->uVoiceID = v20; | 1350 v3->uVoiceID = v20; |
1351 LABEL_81: | 1351 LABEL_81: |
1352 v3->PlaySound(v23, v26); | 1352 v3->PlaySound((PlayerSpeech)v23, v26); |
1353 goto LABEL_82; | 1353 goto LABEL_82; |
1354 default: | 1354 default: |
1355 goto LABEL_82; | 1355 goto LABEL_82; |
1356 } | 1356 } |
1357 } | 1357 } |
1460 v12 = v3; | 1460 v12 = v3; |
1461 LABEL_5: | 1461 LABEL_5: |
1462 if ( v12 == -1 ) | 1462 if ( v12 == -1 ) |
1463 { | 1463 { |
1464 if ( uActiveCharacter ) | 1464 if ( uActiveCharacter ) |
1465 pPlayers[uActiveCharacter]->PlaySound(15, 0); | 1465 pPlayers[uActiveCharacter]->PlaySound(SPEECH_15, 0); |
1466 result = 0; | 1466 result = 0; |
1467 } | 1467 } |
1468 else | 1468 else |
1469 { | 1469 { |
1470 v6 = uItemID; | 1470 v6 = uItemID; |
2388 } | 2388 } |
2389 } | 2389 } |
2390 memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u); | 2390 memcpy(&v9->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], pItem, 0x24u); |
2391 pItem->Reset(); | 2391 pItem->Reset(); |
2392 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); | 2392 pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); |
2393 v19->PlaySound(60, 0); | 2393 v19->PlaySound(SPEECH_60, 0); |
2394 if ( !v21 ) | 2394 if ( !v21 ) |
2395 { | 2395 { |
2396 v7->Release(); | 2396 v7->Release(); |
2397 pIcons_LOD->_40F9C5(); | 2397 pIcons_LOD->_40F9C5(); |
2398 } | 2398 } |
3664 int v5; // eax@1 | 3664 int v5; // eax@1 |
3665 bool v6; // ebx@1 | 3665 bool v6; // ebx@1 |
3666 unsigned int v7; // eax@8 | 3666 unsigned int v7; // eax@8 |
3667 char *v8; // ecx@9 | 3667 char *v8; // ecx@9 |
3668 int v9; // eax@9 | 3668 int v9; // eax@9 |
3669 signed int typea; // [sp+14h] [bp+8h]@1 | 3669 //signed int typea; // [sp+14h] [bp+8h]@1 |
3670 | 3670 |
3671 v3 = this; | 3671 v3 = this; |
3672 this->pConditions[2] = 0i64; | 3672 this->pConditions[2] = 0i64; |
3673 v4 = CalculateIncommingDamage(resistance, type); | 3673 v4 = CalculateIncommingDamage(resistance, type); |
3674 v3->sHealth -= v4; | 3674 v3->sHealth -= v4; |
3675 typea = v4; | 3675 //typea = v4; |
3676 v5 = v3->sHealth; | 3676 v5 = v3->sHealth; |
3677 v6 = v5 < -10; | 3677 v6 = v5 < -10; |
3678 LOBYTE(v6) = v5 <= -10; | 3678 LOBYTE(v6) = v5 <= -10; |
3679 if ( v5 < 1 ) | 3679 if ( v5 < 1 ) |
3680 { | 3680 { |
3703 *(int *)v8 = v9; | 3703 *(int *)v8 = v9; |
3704 } | 3704 } |
3705 } | 3705 } |
3706 } | 3706 } |
3707 } | 3707 } |
3708 if ( typea && CanAct() ) | 3708 if ( v4 && CanAct() ) |
3709 PlaySound(24, 0); | 3709 PlaySound(SPEECH_24, 0); |
3710 return typea; | 3710 return v4; |
3711 } | 3711 } |
3712 | 3712 |
3713 //----- (0048DCF6) -------------------------------------------------------- | 3713 //----- (0048DCF6) -------------------------------------------------------- |
3714 int Player::_48DCF6(int a2, Actor *pActor) | 3714 int Player::_48DCF6(int a2, Actor *pActor) |
3715 { | 3715 { |
4016 case 18: | 4016 case 18: |
4017 case 19: | 4017 case 19: |
4018 v26 = v48; | 4018 v26 = v48; |
4019 if ( *(char *)(v48 + 21) & 2 ) | 4019 if ( *(char *)(v48 + 21) & 2 ) |
4020 goto LABEL_84; | 4020 goto LABEL_84; |
4021 PlaySound(40, 0); | 4021 PlaySound(SPEECH_40, 0); |
4022 *(int *)(v26 + 20) |= 2u; | 4022 *(int *)(v26 + 20) |= 2u; |
4023 goto LABEL_79; | 4023 goto LABEL_79; |
4024 case 20: | 4024 case 20: |
4025 PlaySound(40, 0); | 4025 PlaySound(SPEECH_40, 0); |
4026 v27 = pActor->array_000234; | 4026 v27 = pActor->array_000234; |
4027 if ( pActor->array_000234[0].uItemID ) | 4027 if ( pActor->array_000234[0].uItemID ) |
4028 { | 4028 { |
4029 v27 = &pActor->array_000234[1]; | 4029 v27 = &pActor->array_000234[1]; |
4030 if ( pActor->array_000234[1].uItemID ) | 4030 if ( pActor->array_000234[1].uItemID ) |
4042 v32 = 0; | 4042 v32 = 0; |
4043 v31 = 0; | 4043 v31 = 0; |
4044 v30 = (SoundID)47; | 4044 v30 = (SoundID)47; |
4045 goto LABEL_83; | 4045 goto LABEL_83; |
4046 case 21: | 4046 case 21: |
4047 PlaySound(42, 0); | 4047 PlaySound(SPEECH_42, 0); |
4048 ++v5->sAgeModifier; | 4048 ++v5->sAgeModifier; |
4049 goto LABEL_82; | 4049 goto LABEL_82; |
4050 case 22: | 4050 case 22: |
4051 PlaySound(41, 0); | 4051 PlaySound(SPEECH_41, 0); |
4052 v5->sMana = 0; | 4052 v5->sMana = 0; |
4053 LABEL_82: | 4053 LABEL_82: |
4054 v42 = 0; | 4054 v42 = 0; |
4055 v37 = 0; | 4055 v37 = 0; |
4056 v35 = 0; | 4056 v35 = 0; |
6405 } | 6405 } |
6406 return CHARACTER_RACE_HUMAN; | 6406 return CHARACTER_RACE_HUMAN; |
6407 } | 6407 } |
6408 | 6408 |
6409 //----- (00490141) -------------------------------------------------------- | 6409 //----- (00490141) -------------------------------------------------------- |
6410 int Player::GetSexByVoice() | 6410 PLAYER_SEX Player::GetSexByVoice() |
6411 { | 6411 { |
6412 signed int result; // eax@1 | 6412 signed int result; // eax@1 |
6413 | 6413 |
6414 result = 0; | 6414 result = 0; |
6415 switch ( this->uVoiceID ) | 6415 switch ( this->uVoiceID ) |
6424 case 0xDu: | 6424 case 0xDu: |
6425 case 0x10u: | 6425 case 0x10u: |
6426 case 0x11u: | 6426 case 0x11u: |
6427 case 0x14u: | 6427 case 0x14u: |
6428 case 0x17u: | 6428 case 0x17u: |
6429 result = 0; | 6429 return SEX_MALE; |
6430 break; | 6430 |
6431 case 4u: | 6431 case 4u: |
6432 case 5u: | 6432 case 5u: |
6433 case 6u: | 6433 case 6u: |
6434 case 7u: | 6434 case 7u: |
6435 case 0xAu: | 6435 case 0xAu: |
6438 case 0xFu: | 6438 case 0xFu: |
6439 case 0x12u: | 6439 case 0x12u: |
6440 case 0x13u: | 6440 case 0x13u: |
6441 case 0x15u: | 6441 case 0x15u: |
6442 case 0x18u: | 6442 case 0x18u: |
6443 result = 1; | 6443 return SEX_FEMALE; |
6444 break; | 6444 |
6445 default: | 6445 default: |
6446 return result; | 6446 assert(false); |
6447 } | 6447 } |
6448 return result; | |
6449 } | 6448 } |
6450 | 6449 |
6451 //----- (00490188) -------------------------------------------------------- | 6450 //----- (00490188) -------------------------------------------------------- |
6452 void Player::SetInitialStats() | 6451 void Player::SetInitialStats() |
6453 { | 6452 { |
7004 v69 = 2; | 7003 v69 = 2; |
7005 LABEL_111: | 7004 LABEL_111: |
7006 pParty->pPlayers[a2-1].Heal(v69);//((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->Heal(v69); | 7005 pParty->pPlayers[a2-1].Heal(v69);//((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->Heal(v69); |
7007 } | 7006 } |
7008 LABEL_112: | 7007 LABEL_112: |
7009 v3->PlaySound(36, 0); | 7008 v3->PlaySound(SPEECH_36, 0); |
7010 goto LABEL_173; | 7009 goto LABEL_173; |
7011 } | 7010 } |
7012 LABEL_172: | 7011 LABEL_172: |
7013 pParty->pPlayers[a2-1].SetCondition(6u, 1); | 7012 pParty->pPlayers[a2-1].SetCondition(6u, 1); |
7014 goto LABEL_173; | 7013 goto LABEL_173; |
7446 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); | 7445 sprintf(pTmpBuf, "+%u %s %s", v49, v53, v62); |
7447 LABEL_54: | 7446 LABEL_54: |
7448 ShowStatusBarString(pTmpBuf, 2u); | 7447 ShowStatusBarString(pTmpBuf, 2u); |
7449 pMouse->RemoveHoldingItem(); | 7448 pMouse->RemoveHoldingItem(); |
7450 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); | 7449 pGame->pStru6Instance->SetPlayerBuffAnim(0x97u, a2 - 1); |
7451 v3->PlaySound(93, 0); | 7450 v3->PlaySound(SPEECH_93, 0); |
7452 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); | 7451 pAudioPlayer->PlaySound((SoundID)(SOUND_Bell|0x2), 0, 0, -1, 0, 0, 0, 0); |
7453 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) | 7452 if ( pParty->uDaysPlayed == 6 || pParty->uDaysPlayed == 20 ) |
7454 { | 7453 { |
7455 v64 = 0; | 7454 v64 = 0; |
7456 v55 = 16; | 7455 v55 = 16; |
7549 } | 7548 } |
7550 if ( pParty->pPlayers[a2-1].CanAct() )//if ( ((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) | 7549 if ( pParty->pPlayers[a2-1].CanAct() )//if ( ((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) |
7551 { | 7550 { |
7552 sub_467F48(pParty->pPickedItem.uItemID); | 7551 sub_467F48(pParty->pPickedItem.uItemID); |
7553 v65 = 0; | 7552 v65 = 0; |
7554 v56 = 37; | 7553 v56 = SPEECH_37; |
7555 LABEL_67: | 7554 LABEL_67: |
7556 v3->PlaySound(v56, v65); | 7555 v3->PlaySound((PlayerSpeech)v56, v65); |
7557 return; | 7556 return; |
7558 } | 7557 } |
7559 LABEL_89: | 7558 LABEL_89: |
7560 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; | 7559 v68 = aCharacterConditionNames[v3->GetMajorConditionIdx()]; |
7561 v58 = pGlobalTXT_LocalizationStrings[382]; | 7560 v58 = pGlobalTXT_LocalizationStrings[382]; |
7621 v65 = 0; | 7620 v65 = 0; |
7622 v56 = 20; | 7621 v56 = 20; |
7623 goto LABEL_67; | 7622 goto LABEL_67; |
7624 } | 7623 } |
7625 *v72 = 1; | 7624 *v72 = 1; |
7626 v3->PlaySound(21, 0); | 7625 v3->PlaySound(SPEECH_21, 0); |
7627 v73 = 0; | 7626 v73 = 0; |
7628 LABEL_173: | 7627 LABEL_173: |
7629 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | 7628 v36 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; |
7630 if ( v36 == 14 ) | 7629 if ( v36 == 14 ) |
7631 { | 7630 { |
8432 //&& (&dword_723718_autonote_related)[8 * a3] ) | 8431 //&& (&dword_723718_autonote_related)[8 * a3] ) |
8433 && pAutonoteTxt[a3-1].pText ) | 8432 && pAutonoteTxt[a3-1].pText ) |
8434 { | 8433 { |
8435 v20 = pPlayers[v3 + 1]; | 8434 v20 = pPlayers[v3 + 1]; |
8436 v30 = 1; | 8435 v30 = 1; |
8437 v20->PlaySound(96, 0); | 8436 v20->PlaySound(SPEECH_96, 0); |
8438 v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; | 8437 v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; |
8439 bFlashAutonotesBook = 1; | 8438 bFlashAutonotesBook = 1; |
8440 dword_506568 = v21; | 8439 dword_506568 = v21; |
8441 } | 8440 } |
8442 _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); | 8441 _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); |
8503 && pAwards[a3-1].pText ) | 8502 && pAwards[a3-1].pText ) |
8504 { | 8503 { |
8505 v12 = pPlayers[v3 + 1]; | 8504 v12 = pPlayers[v3 + 1]; |
8506 v30 = 1; | 8505 v30 = 1; |
8507 v31 = 1; | 8506 v31 = 1; |
8508 v12->PlaySound(96, 0); | 8507 v12->PlaySound(SPEECH_96, 0); |
8509 } | 8508 } |
8510 v13 = v4->field_152; | 8509 v13 = v4->field_152; |
8511 goto LABEL_51; | 8510 goto LABEL_51; |
8512 case VAR_Experience: | 8511 case VAR_Experience: |
8513 this->uExperience = a3; | 8512 this->uExperience = a3; |
8519 { | 8518 { |
8520 v14 = pPlayers[v3 + 1]; | 8519 v14 = pPlayers[v3 + 1]; |
8521 bFlashQuestBook = 1; | 8520 bFlashQuestBook = 1; |
8522 v30 = 1; | 8521 v30 = 1; |
8523 v31 = 1; | 8522 v31 = 1; |
8524 v14->PlaySound(93, 0); | 8523 v14->PlaySound(SPEECH_93, 0); |
8525 } | 8524 } |
8526 v13 = (char *)pParty->_award_bits; | 8525 v13 = (char *)pParty->_award_bits; |
8527 LABEL_51: | 8526 LABEL_51: |
8528 _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); | 8527 _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); |
8529 goto LABEL_168; | 8528 goto LABEL_168; |
8619 } | 8618 } |
8620 LABEL_64: | 8619 LABEL_64: |
8621 this->uMightBonus = (unsigned __int8)a3; | 8620 this->uMightBonus = (unsigned __int8)a3; |
8622 LABEL_111: | 8621 LABEL_111: |
8623 v28 = 0; | 8622 v28 = 0; |
8624 v26 = 91; | 8623 v26 = SPEECH_91; |
8625 LABEL_112: | 8624 LABEL_112: |
8626 v19 = pPlayers[v3 + 1]; | 8625 v19 = pPlayers[v3 + 1]; |
8627 v31 = 1; | 8626 v31 = 1; |
8628 v19->PlaySound(v26, v28); | 8627 v19->PlaySound((PlayerSpeech)v26, v28); |
8629 goto LABEL_169; | 8628 goto LABEL_169; |
8630 } | 8629 } |
8631 if ( var <= VAR_FireResistanceBonus ) | 8630 if ( var <= VAR_FireResistanceBonus ) |
8632 { | 8631 { |
8633 if ( var == VAR_FireResistanceBonus ) | 8632 if ( var == VAR_FireResistanceBonus ) |
8932 && pAwards[val-1].pText ) | 8931 && pAwards[val-1].pText ) |
8933 { | 8932 { |
8934 v14 = pPlayers[uPlayerIdx + 1]; | 8933 v14 = pPlayers[uPlayerIdx + 1]; |
8935 v34 = 1; | 8934 v34 = 1; |
8936 v3 = 1; | 8935 v3 = 1; |
8937 v14->PlaySound(96, 0); | 8936 v14->PlaySound(SPEECH_96, 0); |
8938 } | 8937 } |
8939 v15 = v4->field_152; | 8938 v15 = v4->field_152; |
8940 goto LABEL_44; | 8939 goto LABEL_44; |
8941 case VAR_Experience: | 8940 case VAR_Experience: |
8942 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); | 8941 v16 = __CFADD__(val, LODWORD(Dst->uExperience)); |
8952 { | 8951 { |
8953 v17 = pPlayers[uPlayerIdx + 1]; | 8952 v17 = pPlayers[uPlayerIdx + 1]; |
8954 bFlashQuestBook = 1; | 8953 bFlashQuestBook = 1; |
8955 v34 = 1; | 8954 v34 = 1; |
8956 v3 = 1; | 8955 v3 = 1; |
8957 v17->PlaySound(93, 0); | 8956 v17->PlaySound(SPEECH_93, 0); |
8958 } | 8957 } |
8959 v15 = (char *)pParty->_award_bits; | 8958 v15 = (char *)pParty->_award_bits; |
8960 LABEL_44: | 8959 LABEL_44: |
8961 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); | 8960 _449B7E_toggle_bit((unsigned char *)v15, val, 1u); |
8962 goto LABEL_173; | 8961 goto LABEL_173; |
9103 LABEL_113: | 9102 LABEL_113: |
9104 *v19 += val; | 9103 *v19 += val; |
9105 if ( *v19 > 255 ) | 9104 if ( *v19 > 255 ) |
9106 *v19 = 255; | 9105 *v19 = 255; |
9107 v31 = 0; | 9106 v31 = 0; |
9108 v29 = 91; | 9107 v29 = SPEECH_91; |
9109 LABEL_116: | 9108 LABEL_116: |
9110 v3 = 1; | 9109 v3 = 1; |
9111 pPlayers[uPlayerIdx + 1]->PlaySound(v29, v31); | 9110 pPlayers[uPlayerIdx + 1]->PlaySound((PlayerSpeech)v29, v31); |
9112 goto _play_anim_and_maybe_sound; | 9111 goto _play_anim_and_maybe_sound; |
9113 } | 9112 } |
9114 if ( var <= VAR_DisarmTrapSkill ) | 9113 if ( var <= VAR_DisarmTrapSkill ) |
9115 { | 9114 { |
9116 if ( var != VAR_DisarmTrapSkill ) | 9115 if ( var != VAR_DisarmTrapSkill ) |
9215 //&& (&dword_723718_autonote_related)[8 * val] ) | 9214 //&& (&dword_723718_autonote_related)[8 * val] ) |
9216 && pAutonoteTxt[val-1].pText ) | 9215 && pAutonoteTxt[val-1].pText ) |
9217 { | 9216 { |
9218 v23 = pPlayers[uPlayerIdx + 1]; | 9217 v23 = pPlayers[uPlayerIdx + 1]; |
9219 v34 = 1; | 9218 v34 = 1; |
9220 v23->PlaySound(96, 0); | 9219 v23->PlaySound(SPEECH_96, 0); |
9221 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; | 9220 v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; |
9222 bFlashAutonotesBook = 1; | 9221 bFlashAutonotesBook = 1; |
9223 dword_506568 = v24; | 9222 dword_506568 = v24; |
9224 } | 9223 } |
9225 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); | 9224 _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); |
9563 *(int *)v12 -= (int)a3; | 9562 *(int *)v12 -= (int)a3; |
9564 *((int *)v12 + 1) -= v14 + HIDWORD(v13); | 9563 *((int *)v12 + 1) -= v14 + HIDWORD(v13); |
9565 goto LABEL_17; | 9564 goto LABEL_17; |
9566 case VAR_QBits_QuestsDone: | 9565 case VAR_QBits_QuestsDone: |
9567 _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0); | 9566 _449B7E_toggle_bit(pParty->_award_bits, (__int16)a3, 0); |
9568 pPlayers[v4 + 1]->PlaySound(96, 0); | 9567 pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); |
9569 return; | 9568 return; |
9570 case VAR_PlayerItemInHands: | 9569 case VAR_PlayerItemInHands: |
9571 v15 = (char *)this->pInventoryIndices; | 9570 v15 = (char *)this->pInventoryIndices; |
9572 break; | 9571 break; |
9573 case VAR_FixedGold: | 9572 case VAR_FixedGold: |
9686 goto LABEL_72; | 9685 goto LABEL_72; |
9687 case VAR_MagicResistanceBonus: | 9686 case VAR_MagicResistanceBonus: |
9688 this->sResMagicBonus -= (signed __int16)a3; | 9687 this->sResMagicBonus -= (signed __int16)a3; |
9689 LABEL_72: | 9688 LABEL_72: |
9690 v25 = 0; | 9689 v25 = 0; |
9691 v23 = 91; | 9690 v23 = SPEECH_91; |
9692 LABEL_73: | 9691 LABEL_73: |
9693 pPlayers[v4 + 1]->PlaySound(v23, v25); | 9692 pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); |
9694 goto LABEL_17; | 9693 goto LABEL_17; |
9695 case VAR_FixedFood: | 9694 case VAR_FixedFood: |
9696 Party::TakeFood((unsigned int)a3); | 9695 Party::TakeFood((unsigned int)a3); |
9697 goto LABEL_17; | 9696 goto LABEL_17; |
9698 case VAR_StaffSkill: | 9697 case VAR_StaffSkill: |