comparison Player.cpp @ 190:9b77686e2239

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