Mercurial > mm7
comparison Player.cpp @ 1766:110727780974
Player::SetVariable restarting function refatcoring
author | Grumpy7 |
---|---|
date | Tue, 01 Oct 2013 07:29:30 +0200 |
parents | a2ea57410b15 |
children | 3ee4a4d592af |
comparison
equal
deleted
inserted
replaced
1760:a2ea57410b15 | 1766:110727780974 |
---|---|
5415 | 5415 |
5416 //----- (0044A5CB) -------------------------------------------------------- | 5416 //----- (0044A5CB) -------------------------------------------------------- |
5417 void Player::SetVariable(enum VariableType var_type, signed int var_value) | 5417 void Player::SetVariable(enum VariableType var_type, signed int var_value) |
5418 { | 5418 { |
5419 signed int currPlayerId; // ebx@1 | 5419 signed int currPlayerId; // ebx@1 |
5420 Player *v4_unused; // esi@1 | 5420 Player *v4; // esi@1 |
5421 unsigned int v5_unused; // edi@1 | 5421 unsigned int v5; // edi@1 |
5422 unsigned int v6; // esi@13 | 5422 unsigned int v6; // esi@13 |
5423 unsigned int v7; // esi@14 | 5423 unsigned int v7; // esi@14 |
5424 signed int v8_unused; // eax@17 | 5424 signed int v8; // eax@17 |
5425 ItemGen *v9; // ecx@17 | 5425 ItemGen *v9; // ecx@17 |
5426 int v10; // eax@21 | 5426 int v10; // eax@21 |
5427 signed int v11; // eax@30 | 5427 signed int v11; // eax@30 |
5428 Player *unused12; // ecx@44 | 5428 Player *v12; // ecx@44 |
5429 char *v13; // ecx@45 | 5429 char *v13; // ecx@45 |
5430 Player *v14; // ecx@49 | 5430 Player *v14; // ecx@49 |
5431 int v15; // ecx@86 | 5431 int v15; // ecx@86 |
5432 int v16; // esi@106 | 5432 int v16; // esi@106 |
5433 char v17; // al@106 | 5433 char v17; // al@106 |
5438 int v22; // eax@145 | 5438 int v22; // eax@145 |
5439 char v23; // zf@146 | 5439 char v23; // zf@146 |
5440 DDM_DLV_Header *v24; // ecx@148 | 5440 DDM_DLV_Header *v24; // ecx@148 |
5441 signed int v25; // eax@172 | 5441 signed int v25; // eax@172 |
5442 int v26; // [sp-8h] [bp-3Ch]@84 | 5442 int v26; // [sp-8h] [bp-3Ch]@84 |
5443 signed int unused27; // [sp-4h] [bp-38h]@4 | 5443 signed int v27; // [sp-4h] [bp-38h]@4 |
5444 int v28_unused; // [sp-4h] [bp-38h]@84 | 5444 int v28; // [sp-4h] [bp-38h]@84 |
5445 ItemGen item; // [sp+Ch] [bp-28h]@52 | 5445 ItemGen item; // [sp+Ch] [bp-28h]@52 |
5446 char v30_unused; // [sp+32h] [bp-2h]@1 | 5446 char v30; // [sp+32h] [bp-2h]@1 |
5447 char v31_unused; // [sp+33h] [bp-1h]@1 | 5447 char v31; // [sp+33h] [bp-1h]@1 |
5448 | 5448 |
5449 currPlayerId = -1; | 5449 currPlayerId = 0; |
5450 for (int i = 1; i <= 4; i++) //TODO: add a member variable for playerid in the future | 5450 v30 = 0; |
5451 { | 5451 v31 = 0; |
5452 if ( this == pPlayers[i] ) | 5452 v4 = this; |
5453 { | 5453 v5 = 0; |
5454 currPlayerId = i - 1; | 5454 if ( this == pPlayers[2] ) |
5455 break; | 5455 currPlayerId = 1; |
5456 } | 5456 else if ( this == pPlayers[3] ) |
5457 } | 5457 currPlayerId = 2; |
5458 | 5458 else if ( this == pPlayers[4] ) |
5459 Assert(currPlayerId != -1); | 5459 currPlayerId = 3; |
5460 if ( var_type > VAR_AutoNotes ) | 5460 if ( var_type > VAR_AutoNotes ) |
5461 { | 5461 { |
5462 if ( var_type <= VAR_GoldInBank ) | 5462 if ( var_type <= VAR_GoldInBank ) |
5463 { | 5463 { |
5464 if ( var_type == VAR_GoldInBank ) | 5464 if ( var_type == VAR_GoldInBank ) |
5516 || (pParty->PartyTimes.HistoryEventTimes[v22] = pParty->uTimePlayed, | 5516 || (pParty->PartyTimes.HistoryEventTimes[v22] = pParty->uTimePlayed, |
5517 pStorylineText->StoreLine[v22].pText == 0) )//*(&pStorylineText->field_0 + 3 * v22) == 0, | 5517 pStorylineText->StoreLine[v22].pText == 0) )//*(&pStorylineText->field_0 + 3 * v22) == 0, |
5518 return; | 5518 return; |
5519 bFlashHistoryBook = 1; | 5519 bFlashHistoryBook = 1; |
5520 } | 5520 } |
5521 LABEL_172: | |
5521 v25 = 8 * currPlayerId + 400; | 5522 v25 = 8 * currPlayerId + 400; |
5522 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); | 5523 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
5523 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | 5524 pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); |
5524 return; | 5525 return; |
5525 } | 5526 } |
5526 switch ( var_type ) | 5527 if ( var_type != 307 ) |
5527 { | 5528 { |
5528 case VAR_NumDeaths: | 5529 switch ( var_type ) |
5529 pParty->uNumDeaths = var_value; | 5530 { |
5530 break; | 5531 case 308: |
5531 case VAR_NumBounties: | 5532 pParty->uNumBountiesCollected = var_value; |
5532 pParty->uNumBountiesCollected = var_value; | 5533 break; |
5533 break; | 5534 case 309: |
5534 case VAR_PrisonTerms: | 5535 pParty->uNumPrisonTerms = var_value; |
5535 pParty->uNumPrisonTerms = var_value; | 5536 break; |
5536 break; | 5537 case 310: |
5537 case VAR_ArenaWinsPage: | 5538 pParty->uNumArenaPageWins = var_value; |
5538 pParty->uNumArenaPageWins = var_value; | 5539 break; |
5539 break; | 5540 case 311: |
5540 case VAR_ArenaWinsSquire: | 5541 pParty->uNumArenaSquireWins = var_value; |
5541 pParty->uNumArenaSquireWins = var_value; | 5542 break; |
5542 break; | 5543 case 312: |
5543 case VAR_ArenaWinsKnight: | 5544 pParty->uNumArenaKnightWins = var_value; |
5544 pParty->uNumArenaKnightWins = var_value; | 5545 break; |
5545 break; | 5546 case 313: |
5546 case VAR_ArenaWinsLord: | 5547 pParty->uNumArenaLordWins = var_value; |
5547 pParty->uNumArenaLordWins = var_value; | 5548 break; |
5548 break; | 5549 } |
5549 } | 5550 return; |
5550 return; | 5551 } |
5552 pParty->uNumDeaths = var_value; | |
5553 LABEL_168: | |
5554 if ( v30 != 1 ) | |
5555 { | |
5556 LABEL_170: | |
5557 if ( v31 != 1 ) | |
5558 return; | |
5559 v5 = 0; | |
5560 goto LABEL_172; | |
5561 } | |
5562 LABEL_169: | |
5563 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
5564 goto LABEL_170; | |
5551 } | 5565 } |
5552 if ( var_type == VAR_AutoNotes ) | 5566 if ( var_type == VAR_AutoNotes ) |
5553 { | 5567 { |
5554 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) | 5568 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) |
5555 //&& (&dword_723718_autonote_related)[8 * a3] ) | 5569 //&& (&dword_723718_autonote_related)[8 * a3] ) |
5556 && pAutonoteTxt[var_value].pText ) | 5570 && pAutonoteTxt[var_value-1].pText ) |
5557 { | 5571 { |
5558 v20 = pPlayers[currPlayerId + 1]; | 5572 v20 = pPlayers[currPlayerId + 1]; |
5573 v30 = 1; | |
5559 v20->PlaySound(SPEECH_96, 0); | 5574 v20->PlaySound(SPEECH_96, 0); |
5560 //v21 = pAutonoteTxt[var_value].eType;// dword_72371C[2 * a3]; | 5575 v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; |
5561 bFlashAutonotesBook = 1; | 5576 bFlashAutonotesBook = 1; |
5562 _506568_autonote_type = pAutonoteTxt[var_value].eType; | 5577 _506568_autonote_type = v21; |
5563 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); | 5578 } |
5564 } | 5579 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); |
5565 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1); | 5580 v31 = 1; |
5566 PlaySoundBasedOnCondition(currPlayerId); | 5581 goto LABEL_168; |
5567 return; | 5582 } |
5568 } | 5583 if ( var_type <= VAR_ActualMight ) |
5569 if ( var_type <= VAR_BaseLuck ) | 5584 { |
5570 { | 5585 if ( var_type != VAR_ActualMight ) |
5571 switch ( var_type ) | 5586 { |
5572 { | 5587 switch ( var_type ) |
5573 case VAR_Sex: | 5588 { |
5574 this->uSex = (PLAYER_SEX)var_value; | 5589 case VAR_RandomGold: |
5575 goto LABEL_124; | 5590 v6 = rand() % var_value + 1; |
5576 case VAR_Class: | 5591 Party::SetGold(v6); |
5577 this->classType = (PLAYER_CLASS_TYPE)var_value; | 5592 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold |
5578 if ( (char)var_value == PLAYER_CLASS_LICH ) | 5593 ShowStatusBarString(pTmpBuf.data(), 2u); |
5579 { | 5594 GameUI_DrawFoodAndGold(); |
5580 for (int i = 0; i < 138; i++) | 5595 return; |
5596 case VAR_RandomFood: | |
5597 v7 = rand() % var_value + 1; | |
5598 Party::SetFood(v7); | |
5599 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | |
5600 ShowStatusBarString(pTmpBuf.data(), 2u); | |
5601 GameUI_DrawFoodAndGold(); | |
5602 goto LABEL_124; | |
5603 case VAR_Sex: | |
5604 this->uSex = (PLAYER_SEX)var_value; | |
5605 goto LABEL_124; | |
5606 case VAR_Class: | |
5607 this->classType = (PLAYER_CLASS_TYPE)var_value; | |
5608 if ( (char)var_value != 35 ) | |
5609 goto LABEL_124; | |
5610 v8 = 0; | |
5611 v9 = this->pInventoryItemList; | |
5612 break; | |
5613 case VAR_CurrentHP: | |
5614 this->sHealth = var_value; | |
5615 goto LABEL_124; | |
5616 case VAR_MaxHP: | |
5617 this->sHealth = GetMaxHealth(); | |
5618 return; | |
5619 case VAR_CurrentSP: | |
5620 this->sMana = var_value; | |
5621 goto LABEL_124; | |
5622 case VAR_MaxSP: | |
5623 this->sMana = GetMaxMana(); | |
5624 return; | |
5625 case VAR_ACModifier: | |
5626 this->sACModifier = (unsigned __int8)var_value; | |
5627 goto LABEL_124; | |
5628 case VAR_BaseLevel: | |
5629 this->uLevel = (unsigned __int8)var_value; | |
5630 goto LABEL_124; | |
5631 case VAR_LevelModifier: | |
5632 this->sLevelModifier = (unsigned __int8)var_value; | |
5633 goto LABEL_124; | |
5634 case VAR_Age: | |
5635 this->sAgeModifier = var_value; | |
5636 return; | |
5637 case VAR_Award: | |
5638 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & | |
5639 pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) | |
5640 //&& dword_723E80_award_related[2 * a3] ) | |
5641 && pAwards[var_value].pText ) | |
5581 { | 5642 { |
5582 v9 = &this->pInventoryItemList[i]; | 5643 v30 = 1; |
5583 if (v9->uItemID == ITEM_LICH_JAR_EMPTY) | 5644 v31 = 1; |
5584 { | 5645 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); |
5585 v9->uItemID = ITEM_LICH_JAR_FULL; | |
5586 v9->uHolderPlayer = currPlayerId + 1; | |
5587 v10 = (int)((char *)this + 36 * 138); | |
5588 *(int *)(v10 + 532) = 601; | |
5589 *(char *)(v10 + 558) = currPlayerId + 1; | |
5590 break; | |
5591 } | |
5592 } | 5646 } |
5593 if ( this->sResFireBase < 20 ) | 5647 _449B7E_toggle_bit((unsigned char *)v4->_achieved_awards_bits, var_value, 1u); |
5594 this->sResFireBase = 20; | 5648 goto LABEL_168; |
5595 if ( this->sResAirBase < 20 ) | 5649 case VAR_Experience: |
5596 this->sResAirBase = 20; | 5650 this->uExperience = var_value; |
5597 if ( this->sResWaterBase < 20 ) | 5651 goto LABEL_124; |
5598 this->sResWaterBase = 20; | 5652 case VAR_QBits_QuestsDone: |
5599 if ( this->sResEarthBase < 20 ) | 5653 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) |
5600 this->sResEarthBase = 20; | 5654 // && (&dword_722F10)[4 * a3] ) |
5601 this->sResMindBase = 200; | 5655 && pQuestTable[var_value-1] ) |
5602 this->sResBodyBase = 200; | |
5603 this->uPrevVoiceID = this->uVoiceID; | |
5604 this->uPrevFace = this->uCurrentFace; | |
5605 if ( IsFemale() ) | |
5606 { | 5656 { |
5607 this->uCurrentFace = 21; | 5657 v14 = pPlayers[currPlayerId + 1]; |
5608 this->uVoiceID = 21; | 5658 bFlashQuestBook = 1; |
5659 v30 = 1; | |
5660 v31 = 1; | |
5661 v14->PlaySound(SPEECH_93, 0); | |
5609 } | 5662 } |
5610 else | 5663 v13 = (char *)pParty->_quest_bits; |
5611 { | 5664 LABEL_51: |
5612 this->uCurrentFace = 20; | 5665 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); |
5613 this->uVoiceID = 20; | 5666 if (( v30 != 1 )&&( v31 != 1 )) |
5614 } | 5667 return; |
5615 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace); | 5668 else |
5616 } | 5669 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
5617 goto LABEL_124; | 5670 if ( v31 != 1 ) |
5618 case VAR_CurrentHP: | 5671 return; |
5619 this->sHealth = var_value; | 5672 v25 = 8 * currPlayerId + 400; |
5620 goto LABEL_124; | 5673 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); |
5621 case VAR_MaxHP: | 5674 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); |
5622 this->sHealth = GetMaxHealth(); | 5675 return; |
5623 return; | 5676 case VAR_PlayerItemInHands: |
5624 case VAR_CurrentSP: | 5677 item.Reset(); |
5625 this->sMana = var_value; | 5678 item.Reset(); |
5626 goto LABEL_124; | 5679 item.uItemID = var_value; |
5627 case VAR_MaxSP: | 5680 item.uAttributes = 1; |
5628 this->sMana = GetMaxMana(); | 5681 pParty->SetHoldingItem(&item); |
5629 return; | 5682 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) |
5630 case VAR_ACModifier: | 5683 pParty->pIsArtifactFound[var_value-500] = 1; |
5631 this->sACModifier = (unsigned __int8)var_value; | 5684 return; |
5632 goto LABEL_124; | 5685 case VAR_FixedGold: |
5633 case VAR_BaseLevel: | 5686 Party::SetGold(var_value); |
5634 this->uLevel = (unsigned __int8)var_value; | 5687 return; |
5635 goto LABEL_124; | 5688 case VAR_BaseMight: |
5636 case VAR_LevelModifier: | 5689 this->uMight = (unsigned __int8)var_value; |
5637 this->sLevelModifier = (unsigned __int8)var_value; | 5690 goto LABEL_84; |
5638 goto LABEL_124; | 5691 case VAR_BaseIntellect: |
5639 case VAR_Age: | 5692 this->uIntelligence = (unsigned __int8)var_value; |
5640 this->sAgeModifier = var_value; | 5693 goto LABEL_84; |
5641 return; | 5694 case VAR_BasePersonality: |
5642 case VAR_Award: | 5695 this->uWillpower = (unsigned __int8)var_value; |
5643 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & | 5696 goto LABEL_84; |
5644 pPlayers[currPlayerId + 1]->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) | 5697 case VAR_BaseEndurance: |
5645 //&& dword_723E80_award_related[2 * a3] ) | 5698 this->uEndurance = (unsigned __int8)var_value; |
5646 && pAwards[var_value].pText ) | 5699 goto LABEL_84; |
5647 { | 5700 case VAR_BaseSpeed: |
5648 pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); | 5701 this->uSpeed = (unsigned __int8)var_value; |
5649 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); | 5702 goto LABEL_84; |
5650 PlaySoundBasedOnCondition(currPlayerId); | 5703 case VAR_BaseAccuracy: |
5651 } | 5704 this->uAccuracy = (unsigned __int8)var_value; |
5652 _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, var_value, 1u); | 5705 goto LABEL_84; |
5653 return; | 5706 case VAR_BaseLuck: |
5654 case VAR_Experience: | 5707 this->uLuck = (unsigned __int8)var_value; |
5655 this->uExperience = var_value; | 5708 goto LABEL_84; |
5656 goto LABEL_124; | 5709 case VAR_FixedFood: |
5657 case VAR_QBits_QuestsDone: | 5710 Party::SetFood(var_value); |
5658 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) | 5711 goto LABEL_124; |
5659 // && (&dword_722F10)[4 * a3] ) | 5712 case VAR_MightBonus: |
5660 && pQuestTable[var_value] ) | 5713 goto LABEL_64; |
5661 { | 5714 case VAR_IntellectBonus: |
5662 v14 = pPlayers[currPlayerId + 1]; | 5715 goto LABEL_68; |
5663 bFlashQuestBook = 1; | 5716 case VAR_PersonalityBonus: |
5664 v14->PlaySound(SPEECH_93, 0); | 5717 goto LABEL_69; |
5665 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); | 5718 case VAR_EnduranceBonus: |
5666 PlaySoundBasedOnCondition(currPlayerId); | 5719 goto LABEL_70; |
5667 } | 5720 case VAR_SpeedBonus: |
5668 v13 = (char *)pParty->_quest_bits; | 5721 goto LABEL_71; |
5669 _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); | 5722 case VAR_AccuracyBonus: |
5670 return; | 5723 goto LABEL_72; |
5671 case VAR_PlayerItemInHands: | 5724 case VAR_LuckBonus: |
5672 item.Reset(); | 5725 goto LABEL_73; |
5673 item.Reset(); | 5726 default: |
5674 item.uItemID = var_value; | 5727 return; |
5675 item.uAttributes = 1; | 5728 } |
5676 pParty->SetHoldingItem(&item); | 5729 while ( v9->uItemID != 615 ) |
5677 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) | 5730 { |
5678 pParty->pIsArtifactFound[var_value-500] = 1; | 5731 ++v8; |
5679 return; | 5732 ++v9; |
5680 case VAR_FixedGold: | 5733 if ( v8 >= 138 ) |
5681 Party::SetGold(var_value); | 5734 goto LABEL_22; |
5682 return; | 5735 } |
5683 case VAR_RandomGold: | 5736 v10 = (int)((char *)v4 + 36 * v8); |
5684 v6 = rand() % var_value + 1; | 5737 *(int *)(v10 + 532) = 601; |
5685 Party::SetGold(v6); | 5738 *(char *)(v10 + 558) = currPlayerId + 1; |
5686 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold | 5739 LABEL_22: |
5687 ShowStatusBarString(pTmpBuf.data(), 2u); | 5740 if ( v4->sResFireBase < 20 ) |
5688 GameUI_DrawFoodAndGold(); | 5741 v4->sResFireBase = 20; |
5689 return; | 5742 if ( v4->sResAirBase < 20 ) |
5690 case VAR_FixedFood: | 5743 v4->sResAirBase = 20; |
5691 Party::SetFood(var_value); | 5744 if ( v4->sResWaterBase < 20 ) |
5692 goto LABEL_124; | 5745 v4->sResWaterBase = 20; |
5693 case VAR_RandomFood: | 5746 if ( v4->sResEarthBase < 20 ) |
5694 v7 = rand() % var_value + 1; | 5747 v4->sResEarthBase = 20; |
5695 Party::SetFood(v7); | 5748 v4->sResMindBase = 200; |
5696 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food | 5749 v4->sResBodyBase = 200; |
5697 ShowStatusBarString(pTmpBuf.data(), 2u); | 5750 v11 = v4->GetSexByVoice(); |
5698 GameUI_DrawFoodAndGold(); | 5751 v4->uPrevVoiceID = v4->uVoiceID; |
5699 goto LABEL_124; | 5752 v4->uPrevFace = v4->uCurrentFace; |
5700 case VAR_MightBonus: | 5753 if ( v11 ) |
5701 goto LABEL_64; | 5754 { |
5702 case VAR_IntellectBonus: | 5755 v4->uCurrentFace = 21; |
5703 goto LABEL_68; | 5756 v4->uVoiceID = 21; |
5704 case VAR_PersonalityBonus: | 5757 } |
5705 goto LABEL_69; | 5758 else |
5706 case VAR_EnduranceBonus: | 5759 { |
5707 goto LABEL_70; | 5760 v4->uCurrentFace = 20; |
5708 case VAR_SpeedBonus: | 5761 v4->uVoiceID = 20; |
5709 goto LABEL_71; | 5762 } |
5710 case VAR_AccuracyBonus: | 5763 ReloadPlayerPortraits(currPlayerId, v4->uCurrentFace); |
5711 goto LABEL_72; | 5764 goto LABEL_124; |
5712 case VAR_LuckBonus: | 5765 } |
5713 goto LABEL_73; | 5766 LABEL_64: |
5714 case VAR_BaseMight: | 5767 this->uMightBonus = (unsigned __int8)var_value; |
5715 this->uMight = (unsigned __int8)var_value; | |
5716 v26 = 92; | |
5717 goto LABEL_112; | |
5718 case VAR_BaseIntellect: | |
5719 this->uIntelligence = (unsigned __int8)var_value; | |
5720 v26 = 92; | |
5721 goto LABEL_112; | |
5722 case VAR_BasePersonality: | |
5723 this->uWillpower = (unsigned __int8)var_value; | |
5724 v26 = 92; | |
5725 goto LABEL_112; | |
5726 case VAR_BaseEndurance: | |
5727 this->uEndurance = (unsigned __int8)var_value; | |
5728 v26 = 92; | |
5729 goto LABEL_112; | |
5730 case VAR_BaseSpeed: | |
5731 this->uSpeed = (unsigned __int8)var_value; | |
5732 v26 = 92; | |
5733 goto LABEL_112; | |
5734 case VAR_BaseAccuracy: | |
5735 this->uAccuracy = (unsigned __int8)var_value; | |
5736 v26 = 92; | |
5737 goto LABEL_112; | |
5738 case VAR_BaseLuck: | |
5739 this->uLuck = (unsigned __int8)var_value; | |
5740 v26 = 92; | |
5741 goto LABEL_112; | |
5742 default: | |
5743 return; | |
5744 } | |
5745 LABEL_111: | 5768 LABEL_111: |
5769 v28 = 0; | |
5746 v26 = SPEECH_91; | 5770 v26 = SPEECH_91; |
5747 LABEL_112: | 5771 LABEL_112: |
5748 v19 = pPlayers[currPlayerId + 1]; | 5772 v19 = pPlayers[currPlayerId + 1]; |
5749 v19->PlaySound((PlayerSpeech)v26, 0); | 5773 v31 = 1; |
5750 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); | 5774 v19->PlaySound((PlayerSpeech)v26, v28); |
5751 PlaySoundBasedOnCondition(currPlayerId); | 5775 goto LABEL_169; |
5752 return; | 5776 } |
5753 } | 5777 if ( var_type <= VAR_FireResistanceBonus ) |
5754 if ( var_type <= VAR_MagicResistance ) | 5778 { |
5755 { | 5779 if ( var_type == VAR_FireResistanceBonus ) |
5780 { | |
5781 this->sResFireBonus = (unsigned __int8)var_value; | |
5782 goto LABEL_111; | |
5783 } | |
5756 switch ( var_type ) | 5784 switch ( var_type ) |
5757 { | 5785 { |
5758 case VAR_ActualMight: | |
5759 LABEL_64: | |
5760 this->uMightBonus = (unsigned __int8)var_value; | |
5761 goto LABEL_111; | |
5762 case VAR_ActualIntellect: | 5786 case VAR_ActualIntellect: |
5763 LABEL_68: | 5787 LABEL_68: |
5764 this->uIntelligenceBonus = (unsigned __int8)var_value; | 5788 this->uIntelligenceBonus = (unsigned __int8)var_value; |
5765 goto LABEL_111; | 5789 goto LABEL_111; |
5766 case VAR_ActualPersonality: | 5790 case VAR_ActualPersonality: |
5783 LABEL_73: | 5807 LABEL_73: |
5784 this->uLuckBonus = (unsigned __int8)var_value; | 5808 this->uLuckBonus = (unsigned __int8)var_value; |
5785 goto LABEL_111; | 5809 goto LABEL_111; |
5786 case VAR_FireResistance: | 5810 case VAR_FireResistance: |
5787 this->sResFireBase = (unsigned __int8)var_value; | 5811 this->sResFireBase = (unsigned __int8)var_value; |
5788 v26 = 92; | 5812 goto LABEL_84; |
5789 goto LABEL_112; | |
5790 case VAR_AirResistance: | 5813 case VAR_AirResistance: |
5791 this->sResAirBase = (unsigned __int8)var_value; | 5814 this->sResAirBase = (unsigned __int8)var_value; |
5792 v26 = 92; | 5815 goto LABEL_84; |
5793 goto LABEL_112; | |
5794 case VAR_WaterResistance: | 5816 case VAR_WaterResistance: |
5795 this->sResWaterBase = (unsigned __int8)var_value; | 5817 this->sResWaterBase = (unsigned __int8)var_value; |
5796 v26 = 92; | 5818 goto LABEL_84; |
5797 goto LABEL_112; | |
5798 case VAR_EarthResistance: | 5819 case VAR_EarthResistance: |
5799 this->sResEarthBase = (unsigned __int8)var_value; | 5820 this->sResEarthBase = (unsigned __int8)var_value; |
5800 v26 = 92; | 5821 goto LABEL_84; |
5801 goto LABEL_112; | |
5802 case VAR_SpiritResistance: | 5822 case VAR_SpiritResistance: |
5803 this->sResSpiritBase = (unsigned __int8)var_value; | 5823 this->sResSpiritBase = (unsigned __int8)var_value; |
5804 v26 = 92; | 5824 goto LABEL_84; |
5805 goto LABEL_112; | |
5806 case VAR_MindResistance: | 5825 case VAR_MindResistance: |
5807 this->sResMindBase = (unsigned __int8)var_value; | 5826 this->sResMindBase = (unsigned __int8)var_value; |
5808 v26 = 92; | 5827 goto LABEL_84; |
5809 goto LABEL_112; | |
5810 case VAR_BodyResistance: | 5828 case VAR_BodyResistance: |
5811 this->sResBodyBase = (unsigned __int8)var_value; | 5829 this->sResBodyBase = (unsigned __int8)var_value; |
5812 v26 = 92; | 5830 goto LABEL_84; |
5813 goto LABEL_112; | |
5814 case VAR_LightResistance: | 5831 case VAR_LightResistance: |
5815 this->sResLightBase = (unsigned __int8)var_value; | 5832 this->sResLightBase = (unsigned __int8)var_value; |
5816 v26 = 92; | 5833 goto LABEL_84; |
5817 goto LABEL_112; | |
5818 case VAR_DarkResistance: | 5834 case VAR_DarkResistance: |
5819 this->sResDarkBase = (unsigned __int8)var_value; | 5835 this->sResDarkBase = (unsigned __int8)var_value; |
5820 v26 = 92; | 5836 goto LABEL_84; |
5821 goto LABEL_112; | |
5822 case VAR_MagicResistance: | 5837 case VAR_MagicResistance: |
5823 this->sResMagicBase = (unsigned __int8)var_value; | 5838 this->sResMagicBase = (unsigned __int8)var_value; |
5839 LABEL_84: | |
5840 v28 = 0; | |
5824 v26 = 92; | 5841 v26 = 92; |
5825 goto LABEL_112; | 5842 goto LABEL_112; |
5826 default: | 5843 default: |
5827 return; | 5844 return; |
5828 } | 5845 } |
5835 { | 5852 { |
5836 if ( var_type <= VAR_LearningSkill ) | 5853 if ( var_type <= VAR_LearningSkill ) |
5837 return; | 5854 return; |
5838 if ( var_type <= VAR_Eradicated ) | 5855 if ( var_type <= VAR_Eradicated ) |
5839 { | 5856 { |
5840 this->SetCondition(var_type - 105, 1); | 5857 v4->SetCondition(var_type - 105, 1); |
5841 } | 5858 } |
5842 else | 5859 else |
5843 { | 5860 { |
5844 if ( var_type != VAR_MajorCondition ) | 5861 if ( var_type != VAR_MajorCondition ) |
5845 { | 5862 { |
5846 if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 ) | 5863 if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 ) |
5847 byte_5E4C15[var_type] = var_value; | 5864 byte_5E4C15[var_type] = var_value; |
5848 return; | 5865 return; |
5849 } | 5866 } |
5850 memset(this, 0, 0xA0u); | 5867 memset(v4, 0, 0xA0u); |
5851 } | 5868 } |
5869 LABEL_124: | |
5870 v31 = 1; | |
5871 goto LABEL_169; | |
5872 } | |
5873 LABEL_106: | |
5874 v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); | |
5875 v17 = *(char *)v16; | |
5876 if ( var_value <= VAR_BodyResistanceBonus ) | |
5877 { | |
5878 LOWORD(v15) = (unsigned __int8)var_value; | |
5879 v18 = v15 | v17 & VAR_BodyResistanceBonus; | |
5852 } | 5880 } |
5853 else | 5881 else |
5854 { | 5882 { |
5855 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type); | 5883 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); |
5856 v17 = *(char *)v16; | 5884 } |
5857 if ( var_value <= 63 ) | 5885 *(short *)v16 = v18; |
5858 { | 5886 goto LABEL_124; |
5859 LOWORD(v15) = (unsigned __int8)var_value; | 5887 } |
5860 v18 = v15 | v17 & 63; | 5888 if ( var_type == VAR_DisarmTrapSkill ) |
5861 } | 5889 if ( v30 != 1 ) |
5862 else | 5890 { |
5863 { | 5891 if ( v31 != 1 ) |
5864 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); | 5892 return; |
5865 } | 5893 v5 = 0; |
5866 *(short *)v16 = v18; | 5894 goto LABEL_172; |
5867 } | 5895 } |
5868 LABEL_124: | 5896 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); |
5869 DrawPlayerBuffAnimBasedOnCondition(currPlayerId); | 5897 goto LABEL_170; |
5870 PlaySoundBasedOnCondition(currPlayerId); | 5898 if ( var_type <= VAR_BodyResistanceBonus ) |
5871 return; | |
5872 } | |
5873 if ( var_type <= VAR_MagicResistanceBonus ) | |
5874 { | 5899 { |
5875 switch ( var_type ) | 5900 switch ( var_type ) |
5876 { | 5901 { |
5877 case VAR_FireResistanceBonus: | 5902 case VAR_BodyResistanceBonus: |
5878 this->sResFireBonus = (unsigned __int8)var_value; | 5903 v4->sResBodyBonus = (unsigned __int8)var_value; |
5879 break; | 5904 break; |
5880 case VAR_AirResistanceBonus: | 5905 case VAR_AirResistanceBonus: |
5881 this->sResAirBonus = (unsigned __int8)var_value; | 5906 v4->sResAirBonus = (unsigned __int8)var_value; |
5882 break; | 5907 break; |
5883 case VAR_WaterResistanceBonus: | 5908 case VAR_WaterResistanceBonus: |
5884 this->sResWaterBonus = (unsigned __int8)var_value; | 5909 v4->sResWaterBonus = (unsigned __int8)var_value; |
5885 break; | 5910 break; |
5886 case VAR_EarthResistanceBonus: | 5911 case VAR_EarthResistanceBonus: |
5887 this->sResEarthBonus = (unsigned __int8)var_value; | 5912 v4->sResEarthBonus = (unsigned __int8)var_value; |
5888 break; | 5913 break; |
5889 case VAR_SpiritResistanceBonus: | 5914 case VAR_SpiritResistanceBonus: |
5890 this->sResSpiritBonus = (unsigned __int8)var_value; | 5915 v4->sResSpiritBonus = (unsigned __int8)var_value; |
5891 break; | |
5892 case VAR_MindResistanceBonus: | |
5893 this->sResMindBonus = (unsigned __int8)var_value; | |
5894 break; | |
5895 case VAR_BodyResistanceBonus: | |
5896 this->sResBodyBonus = (unsigned __int8)var_value; | |
5897 break; | |
5898 case VAR_LightResistanceBonus: | |
5899 this->sResLightBonus = (unsigned __int8)var_value; | |
5900 break; | |
5901 case VAR_DarkResistanceBonus: | |
5902 this->sResDarkBonus = (unsigned __int8)var_value; | |
5903 break; | |
5904 case VAR_PhysicalResistanceBonus: | |
5905 Assert("VAR_PhysicalResistanceBonus variable unsupported" && false); | |
5906 return; | |
5907 break; | |
5908 case VAR_MagicResistanceBonus: | |
5909 this->sResMagicBonus = (unsigned __int8)var_value; | |
5910 break; | 5916 break; |
5911 default: | 5917 default: |
5912 Error("Unexpected var_type: %u", var_type); | 5918 if ( var_type != 62 ) |
5913 return; | 5919 return; |
5920 v4->sResMindBonus = (unsigned __int8)var_value; | |
5914 break; | 5921 break; |
5915 } | 5922 } |
5916 goto LABEL_111; | 5923 goto LABEL_111; |
5917 } | 5924 } |
5918 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill || var_type == VAR_DisarmTrapSkill) //VAR_ThieverySkill wasn't present in the original function | 5925 if ( var_type == VAR_LightResistanceBonus ) |
5919 { | 5926 { |
5920 return; | 5927 v4->sResLightBonus = (unsigned __int8)var_value; |
5921 } | 5928 goto LABEL_111; |
5929 } | |
5930 if ( var_type == VAR_DarkResistanceBonus ) | |
5931 { | |
5932 v4->sResDarkBonus = (unsigned __int8)var_value; | |
5933 goto LABEL_111; | |
5934 } | |
5935 if ( var_type == VAR_MagicResistanceBonus ) | |
5936 { | |
5937 v4->sResMagicBonus = (unsigned __int8)var_value; | |
5938 goto LABEL_111; | |
5939 } | |
5940 if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) | |
5941 if ( v30 != 1 ) | |
5942 { | |
5943 if ( v31 != 1 ) | |
5944 return; | |
5945 v5 = 0; | |
5946 v25 = 8 * currPlayerId + 400; | |
5947 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); | |
5948 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); | |
5949 return; | |
5950 } | |
5951 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); | |
5952 goto LABEL_170; | |
5922 } | 5953 } |
5923 | 5954 |
5924 | 5955 |
5925 //----- (new function) -------------------------------------------------------- | 5956 //----- (new function) -------------------------------------------------------- |
5926 void Player::PlaySoundBasedOnCondition(int currPlayerId) | 5957 void Player::PlaySoundBasedOnCondition(int currPlayerId) |