comparison Player.cpp @ 1780:01b3c314e9be

Player::SetVariable moved most of the conditions into a switch
author Grumpy7
date Thu, 03 Oct 2013 05:27:54 +0200
parents 50e91a820f6f
children 7b42e79eb2d0
comparison
equal deleted inserted replaced
1779:50e91a820f6f 1780:01b3c314e9be
5436 currPlayerId = 1; 5436 currPlayerId = 1;
5437 else if ( this == pPlayers[3] ) 5437 else if ( this == pPlayers[3] )
5438 currPlayerId = 2; 5438 currPlayerId = 2;
5439 else if ( this == pPlayers[4] ) 5439 else if ( this == pPlayers[4] )
5440 currPlayerId = 3; 5440 currPlayerId = 3;
5441 if ( var_type > VAR_AutoNotes ) 5441
5442 { 5442
5443 if ( var_type <= VAR_GoldInBank ) 5443 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28)
5444 { 5444 {
5445 if ( var_type == VAR_GoldInBank ) 5445 if (!pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
5446 { 5446 {
5447 pParty->uNumGoldInBank = var_value; 5447 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
5448 return; 5448 if (pStorylineText->StoreLine[var_type - VAR_History_0].pText)
5449 } 5449 {
5450 if ( var_type <= VAR_Counter10 ) 5450 bFlashHistoryBook = 1;
5451 { 5451 PlayAwardSound(currPlayerId);
5452 if ( (signed int)var_type >= 0xF5 ) 5452 }
5453 }
5454 return;
5455 }
5456
5457 if ( var_type >= VAR_MapPersistentVariable_0 && var_type <= VAR_MapPersistentVariable_99 )
5458 {
5459 byte_5E4C15[var_type] = var_value;
5460 return;
5461 }
5462
5463 if ( var_type >= VAR_UnknownTimeEvent0 && var_type <= VAR_UnknownTimeEvent19 )
5464 {
5465 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed
5466 PlayAwardSound(currPlayerId);
5467 return;
5468 }
5469
5470 switch ( var_type )
5471 {
5472 case VAR_Sex:
5473 this->uSex = (PLAYER_SEX)var_value;
5474 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5475 PlayAwardSound(currPlayerId);
5476 return;
5477 case VAR_Class:
5478 this->classType = (PLAYER_CLASS_TYPE)var_value;
5479 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH )
5480 {
5481 for (int i = 0; i < 138; i++)
5453 { 5482 {
5454 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; // *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed); 5483 if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY)
5455 return; 5484 {
5485 this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL;
5486 this->pOwnItems[i].uHolderPlayer = currPlayerId + 1;
5487 }
5488 }
5489 if ( this->sResFireBase < 20 )
5490 this->sResFireBase = 20;
5491 if ( this->sResAirBase < 20 )
5492 this->sResAirBase = 20;
5493 if ( this->sResWaterBase < 20 )
5494 this->sResWaterBase = 20;
5495 if ( this->sResEarthBase < 20 )
5496 this->sResEarthBase = 20;
5497 this->sResMindBase = 200;
5498 this->sResBodyBase = 200;
5499 v11 = this->GetSexByVoice();
5500 this->uPrevVoiceID = this->uVoiceID;
5501 this->uPrevFace = this->uCurrentFace;
5502 if ( v11 )
5503 {
5504 this->uCurrentFace = 21;
5505 this->uVoiceID = 21;
5456 } 5506 }
5457 else 5507 else
5458 { 5508 {
5459 switch ( var_type ) 5509 this->uCurrentFace = 20;
5460 { 5510 this->uVoiceID = 20;
5461 case VAR_PlayerBits:
5462 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
5463 return;
5464 case VAR_NPCs2:
5465 pParty->field_709 = 0;
5466 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
5467 pParty->CountHirelings();
5468 viewparams->bRedrawGameUI = true;
5469 return;
5470 case VAR_NumSkillPoints:
5471 this->uSkillPoints = var_value;
5472 return;
5473 }
5474 } 5511 }
5475 return; 5512 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace);
5476 } 5513 }
5477 if ( var_type <= VAR_Counter10 ) 5514 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5478 return; 5515 PlayAwardSound(currPlayerId);
5479 if ( (signed int)var_type <= VAR_UnknownTimeEvent19 ) 5516 return;
5480 { 5517 case VAR_CurrentHP:
5481 pParty->PartyTimes._s_times[var_type - VAR_UnknownTimeEvent0] = pParty->uTimePlayed; //*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);, *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed 5518 this->sHealth = var_value;
5519 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5520 PlayAwardSound(currPlayerId);
5521 return;
5522 case VAR_MaxHP:
5523 this->sHealth = GetMaxHealth();
5524 return;
5525 case VAR_CurrentSP:
5526 this->sMana = var_value;
5527 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5528 PlayAwardSound(currPlayerId);
5529 return;
5530 case VAR_MaxSP:
5531 this->sMana = GetMaxMana();
5532 return;
5533 case VAR_ACModifier:
5534 this->sACModifier = (unsigned __int8)var_value;
5535 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5536 PlayAwardSound(currPlayerId);
5537 return;
5538 case VAR_BaseLevel:
5539 this->uLevel = (unsigned __int8)var_value;
5540 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5541 PlayAwardSound(currPlayerId);
5542 return;
5543 case VAR_LevelModifier:
5544 this->sLevelModifier = (unsigned __int8)var_value;
5545 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5546 PlayAwardSound(currPlayerId);
5547 return;
5548 case VAR_Age:
5549 this->sAgeModifier = var_value;
5550 return;
5551 case VAR_Award:
5552 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) &
5553 this->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) //&& dword_723E80_award_related[2 * a3] )
5554 && pAwards[var_value].pText )
5555 {
5556 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5482 PlayAwardSound(currPlayerId); 5557 PlayAwardSound(currPlayerId);
5483 return; 5558 this->PlaySound(SPEECH_96, 0);
5484 } 5559 }
5485 else 5560 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u);
5486 { 5561 return;
5487 if ( var_type == VAR_ReputationInCurrentLocation ) 5562 case VAR_Experience:
5488 { 5563 this->uExperience = var_value;
5489 v24 = &pOutdoor->ddm;
5490 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
5491 v24 = &pIndoor->dlv;
5492 v24->uReputation = var_value;
5493 if ( var_value > 10000 )
5494 v24->uReputation = 10000;
5495 return;
5496 }
5497 if ( var_type >= VAR_History_0 && var_type <= VAR_History_28 && !pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0])
5498 {
5499 pParty->PartyTimes.HistoryEventTimes[var_type - VAR_History_0] = pParty->uTimePlayed;
5500 if (pStorylineText->StoreLine[v22].pText)
5501 {
5502 bFlashHistoryBook = 1;
5503 PlayAwardSound(currPlayerId);
5504 }
5505 return;
5506 }
5507 }
5508 return;
5509 }
5510 if ( var_type != 307 )
5511 {
5512 switch ( var_type )
5513 {
5514 case 308:
5515 pParty->uNumBountiesCollected = var_value;
5516 return;
5517 case 309:
5518 pParty->uNumPrisonTerms = var_value;
5519 return;
5520 case 310:
5521 pParty->uNumArenaPageWins = var_value;
5522 return;
5523 case 311:
5524 pParty->uNumArenaSquireWins = var_value;
5525 return;
5526 case 312:
5527 pParty->uNumArenaKnightWins = var_value;
5528 return;
5529 case 313:
5530 pParty->uNumArenaLordWins = var_value;
5531 return;
5532 }
5533 return;
5534 }
5535 pParty->uNumDeaths = var_value;
5536 return;
5537 }
5538 if ( var_type == VAR_AutoNotes )
5539 {
5540 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3])
5541 //&& (&dword_723718_autonote_related)[8 * a3] )
5542 && pAutonoteTxt[var_value-1].pText )
5543 {
5544 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5564 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5545 this->PlaySound(SPEECH_96, 0); 5565 PlayAwardSound(currPlayerId);
5546 bFlashAutonotesBook = 1; 5566 return;
5547 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; 5567 case VAR_QBits_QuestsDone:
5548 } 5568 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3])// && (&dword_722F10)[4 * a3] )
5549 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); 5569 && pQuestTable[var_value-1] )
5550 PlayAwardSound(currPlayerId); 5570 {
5551 return; 5571 bFlashQuestBook = 1;
5552 } 5572 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5553 if ( var_type <= VAR_ActualMight ) 5573 PlayAwardSound(currPlayerId);
5554 { 5574 this->PlaySound(SPEECH_93, 0);
5555 if ( var_type != VAR_ActualMight ) 5575 }
5556 { 5576 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u);
5557 switch ( var_type ) 5577 return;
5558 { 5578 case VAR_PlayerItemInHands:
5559 case VAR_RandomGold: 5579 item.Reset();
5560 v6 = rand() % var_value + 1; 5580 item.uItemID = var_value;
5561 Party::SetGold(v6); 5581 item.uAttributes = 1;
5562 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold 5582 pParty->SetHoldingItem(&item);
5563 ShowStatusBarString(pTmpBuf.data(), 2u); 5583 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER )
5564 GameUI_DrawFoodAndGold(); 5584 pParty->pIsArtifactFound[var_value-500] = 1;
5565 return; 5585 return;
5566 case VAR_RandomFood: 5586 case VAR_FixedGold:
5567 v7 = rand() % var_value + 1; 5587 Party::SetGold(var_value);
5568 Party::SetFood(v7); 5588 return;
5569 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food 5589 case VAR_RandomGold:
5570 ShowStatusBarString(pTmpBuf.data(), 2u); 5590 v6 = rand() % var_value + 1;
5571 GameUI_DrawFoodAndGold(); 5591 Party::SetGold(v6);
5572 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5592 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold
5573 PlayAwardSound(currPlayerId); 5593 ShowStatusBarString(pTmpBuf.data(), 2u);
5574 return; 5594 GameUI_DrawFoodAndGold();
5575 case VAR_Sex: 5595 return;
5576 this->uSex = (PLAYER_SEX)var_value; 5596 case VAR_FixedFood:
5577 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5597 Party::SetFood(var_value);
5578 PlayAwardSound(currPlayerId); 5598 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5579 return; 5599 PlayAwardSound(currPlayerId);
5580 case VAR_Class: 5600 return;
5581 this->classType = (PLAYER_CLASS_TYPE)var_value; 5601 case VAR_RandomFood:
5582 if ( (PLAYER_CLASS_TYPE)var_value == PLAYER_CLASS_LICH ) 5602 v7 = rand() % var_value + 1;
5583 { 5603 Party::SetFood(v7);
5584 for (int i = 0; i < 138; i++) 5604 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food
5585 { 5605 ShowStatusBarString(pTmpBuf.data(), 2u);
5586 if (this->pOwnItems[i].uItemID == ITEM_LICH_JAR_EMPTY) 5606 GameUI_DrawFoodAndGold();
5587 { 5607 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5588 this->pOwnItems[i].uItemID = ITEM_LICH_JAR_FULL; 5608 PlayAwardSound(currPlayerId);
5589 this->pOwnItems[i].uHolderPlayer = currPlayerId + 1; 5609 return;
5590 } 5610 case VAR_BaseMight:
5591 } 5611 this->uMight = (unsigned __int8)var_value;
5592 if ( this->sResFireBase < 20 ) 5612 this->PlaySound(SPEECH_92, 0);
5593 this->sResFireBase = 20; 5613 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5594 if ( this->sResAirBase < 20 ) 5614 PlayAwardSound(currPlayerId);
5595 this->sResAirBase = 20; 5615 return;
5596 if ( this->sResWaterBase < 20 ) 5616 case VAR_BaseIntellect:
5597 this->sResWaterBase = 20; 5617 this->uIntelligence = (unsigned __int8)var_value;
5598 if ( this->sResEarthBase < 20 ) 5618 this->PlaySound(SPEECH_92, 0);
5599 this->sResEarthBase = 20; 5619 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5600 this->sResMindBase = 200; 5620 PlayAwardSound(currPlayerId);
5601 this->sResBodyBase = 200; 5621 return;
5602 v11 = this->GetSexByVoice(); 5622 case VAR_BasePersonality:
5603 this->uPrevVoiceID = this->uVoiceID; 5623 this->uWillpower = (unsigned __int8)var_value;
5604 this->uPrevFace = this->uCurrentFace; 5624 this->PlaySound(SPEECH_92, 0);
5605 if ( v11 ) 5625 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5606 { 5626 PlayAwardSound(currPlayerId);
5607 this->uCurrentFace = 21; 5627 return;
5608 this->uVoiceID = 21; 5628 case VAR_BaseEndurance:
5609 } 5629 this->uEndurance = (unsigned __int8)var_value;
5610 else 5630 this->PlaySound(SPEECH_92, 0);
5611 { 5631 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5612 this->uCurrentFace = 20; 5632 PlayAwardSound(currPlayerId);
5613 this->uVoiceID = 20; 5633 return;
5614 } 5634 case VAR_BaseSpeed:
5615 ReloadPlayerPortraits(currPlayerId, this->uCurrentFace); 5635 this->uSpeed = (unsigned __int8)var_value;
5616 } 5636 this->PlaySound(SPEECH_92, 0);
5617 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5637 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5618 PlayAwardSound(currPlayerId); 5638 PlayAwardSound(currPlayerId);
5619 return; 5639 return;
5620 case VAR_CurrentHP: 5640 case VAR_BaseAccuracy:
5621 this->sHealth = var_value; 5641 this->uAccuracy = (unsigned __int8)var_value;
5622 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5642 this->PlaySound(SPEECH_92, 0);
5623 PlayAwardSound(currPlayerId); 5643 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5624 return; 5644 PlayAwardSound(currPlayerId);
5625 case VAR_MaxHP: 5645 return;
5626 this->sHealth = GetMaxHealth(); 5646 case VAR_BaseLuck:
5627 return; 5647 this->uLuck = (unsigned __int8)var_value;
5628 case VAR_CurrentSP: 5648 this->PlaySound(SPEECH_92, 0);
5629 this->sMana = var_value; 5649 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5630 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5650 PlayAwardSound(currPlayerId);
5631 PlayAwardSound(currPlayerId); 5651 return;
5632 return; 5652 case VAR_MightBonus:
5633 case VAR_MaxSP: 5653 case VAR_ActualMight:
5634 this->sMana = GetMaxMana(); 5654 this->uMightBonus = (unsigned __int8)var_value;
5635 return; 5655 this->PlaySound(SPEECH_91, 0);
5636 case VAR_ACModifier: 5656 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5637 this->sACModifier = (unsigned __int8)var_value; 5657 PlayAwardSound(currPlayerId);
5638 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5658 return;
5639 PlayAwardSound(currPlayerId); 5659 case VAR_IntellectBonus:
5640 return; 5660 case VAR_ActualIntellect:
5641 case VAR_BaseLevel: 5661 this->uIntelligenceBonus = (unsigned __int8)var_value;
5642 this->uLevel = (unsigned __int8)var_value; 5662 this->PlaySound(SPEECH_91, 0);
5643 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5663 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5644 PlayAwardSound(currPlayerId); 5664 PlayAwardSound(currPlayerId);
5645 return; 5665 return;
5646 case VAR_LevelModifier: 5666 case VAR_PersonalityBonus:
5647 this->sLevelModifier = (unsigned __int8)var_value; 5667 case VAR_ActualPersonality:
5648 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5668 this->uWillpowerBonus = (unsigned __int8)var_value;
5649 PlayAwardSound(currPlayerId); 5669 this->PlaySound(SPEECH_91, 0);
5650 return; 5670 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5651 case VAR_Age: 5671 PlayAwardSound(currPlayerId);
5652 this->sAgeModifier = var_value; 5672 return;
5653 return; 5673 case VAR_EnduranceBonus:
5654 case VAR_Award: 5674 case VAR_ActualEndurance:
5655 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & 5675 this->uEnduranceBonus = (unsigned __int8)var_value;
5656 this->_achieved_awards_bits[((signed __int16)var_value - 1)/ 8]) 5676 this->PlaySound(SPEECH_91, 0);
5657 //&& dword_723E80_award_related[2 * a3] ) 5677 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5658 && pAwards[var_value].pText ) 5678 PlayAwardSound(currPlayerId);
5659 { 5679 return;
5660 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5680 case VAR_SpeedBonus:
5661 PlayAwardSound(currPlayerId); 5681 case VAR_ActualSpeed:
5662 this->PlaySound(SPEECH_96, 0); 5682 this->uSpeedBonus = (unsigned __int8)var_value;
5663 } 5683 this->PlaySound(SPEECH_91, 0);
5664 _449B7E_toggle_bit(this->_achieved_awards_bits, var_value, 1u); 5684 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5665 return; 5685 PlayAwardSound(currPlayerId);
5666 case VAR_Experience: 5686 return;
5667 this->uExperience = var_value; 5687 case VAR_AccuracyBonus:
5668 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5688 case VAR_ActualAccuracy:
5669 PlayAwardSound(currPlayerId); 5689 this->uAccuracyBonus = (unsigned __int8)var_value;
5670 return; 5690 this->PlaySound(SPEECH_92, 0);
5671 case VAR_QBits_QuestsDone: 5691 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5672 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) 5692 PlayAwardSound(currPlayerId);
5673 // && (&dword_722F10)[4 * a3] ) 5693 return;
5674 && pQuestTable[var_value-1] ) 5694 case VAR_LuckBonus:
5675 { 5695 case VAR_ActualLuck:
5676 bFlashQuestBook = 1; 5696 this->uLuckBonus = (unsigned __int8)var_value;
5677 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5697 this->PlaySound(SPEECH_92, 0);
5678 PlayAwardSound(currPlayerId); 5698 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5679 this->PlaySound(SPEECH_93, 0); 5699 PlayAwardSound(currPlayerId);
5680 } 5700 return;
5681 _449B7E_toggle_bit(pParty->_quest_bits, var_value, 1u); 5701 case VAR_FireResistance:
5682 return; 5702 this->sResFireBase = (unsigned __int8)var_value;
5683 case VAR_PlayerItemInHands: 5703 this->PlaySound(SPEECH_92, 0);
5684 item.Reset(); 5704 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5685 item.uItemID = var_value; 5705 PlayAwardSound(currPlayerId);
5686 item.uAttributes = 1; 5706 return;
5687 pParty->SetHoldingItem(&item); 5707 case VAR_AirResistance:
5688 if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) 5708 this->sResAirBase = (unsigned __int8)var_value;
5689 pParty->pIsArtifactFound[var_value-500] = 1; 5709 this->PlaySound(SPEECH_92, 0);
5690 return; 5710 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5691 case VAR_FixedGold: 5711 PlayAwardSound(currPlayerId);
5692 Party::SetGold(var_value); 5712 return;
5693 return; 5713 case VAR_WaterResistance:
5694 case VAR_BaseMight: 5714 this->sResWaterBase = (unsigned __int8)var_value;
5695 this->uMight = (unsigned __int8)var_value; 5715 this->PlaySound(SPEECH_92, 0);
5696 this->PlaySound(SPEECH_92, 0); 5716 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5697 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5717 PlayAwardSound(currPlayerId);
5698 PlayAwardSound(currPlayerId); 5718 return;
5699 return; 5719 case VAR_EarthResistance:
5700 case VAR_BaseIntellect: 5720 this->sResEarthBase = (unsigned __int8)var_value;
5701 this->uIntelligence = (unsigned __int8)var_value; 5721 this->PlaySound(SPEECH_92, 0);
5702 this->PlaySound(SPEECH_92, 0); 5722 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5703 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5723 PlayAwardSound(currPlayerId);
5704 PlayAwardSound(currPlayerId); 5724 return;
5705 return; 5725 case VAR_SpiritResistance:
5706 case VAR_BasePersonality: 5726 this->sResSpiritBase = (unsigned __int8)var_value;
5707 this->uWillpower = (unsigned __int8)var_value; 5727 this->PlaySound(SPEECH_92, 0);
5708 this->PlaySound(SPEECH_92, 0); 5728 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5709 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5729 PlayAwardSound(currPlayerId);
5710 PlayAwardSound(currPlayerId); 5730 return;
5711 return; 5731 case VAR_MindResistance:
5712 case VAR_BaseEndurance: 5732 this->sResMindBase = (unsigned __int8)var_value;
5713 this->uEndurance = (unsigned __int8)var_value; 5733 this->PlaySound(SPEECH_92, 0);
5714 this->PlaySound(SPEECH_92, 0); 5734 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5715 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5735 PlayAwardSound(currPlayerId);
5716 PlayAwardSound(currPlayerId); 5736 return;
5717 return; 5737 case VAR_BodyResistance:
5718 case VAR_BaseSpeed: 5738 this->sResBodyBase = (unsigned __int8)var_value;
5719 this->uSpeed = (unsigned __int8)var_value; 5739 this->PlaySound(SPEECH_92, 0);
5720 this->PlaySound(SPEECH_92, 0); 5740 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5721 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5741 PlayAwardSound(currPlayerId);
5722 PlayAwardSound(currPlayerId); 5742 return;
5723 return; 5743 case VAR_LightResistance:
5724 case VAR_BaseAccuracy: 5744 this->sResLightBase = (unsigned __int8)var_value;
5725 this->uAccuracy = (unsigned __int8)var_value; 5745 this->PlaySound(SPEECH_92, 0);
5726 this->PlaySound(SPEECH_92, 0); 5746 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5727 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5747 PlayAwardSound(currPlayerId);
5728 PlayAwardSound(currPlayerId); 5748 return;
5729 return; 5749 case VAR_DarkResistance:
5730 case VAR_BaseLuck: 5750 this->sResDarkBase = (unsigned __int8)var_value;
5731 this->uLuck = (unsigned __int8)var_value; 5751 this->PlaySound(SPEECH_92, 0);
5732 this->PlaySound(SPEECH_92, 0); 5752 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5733 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5753 PlayAwardSound(currPlayerId);
5734 PlayAwardSound(currPlayerId); 5754 return;
5735 return; 5755 case VAR_MagicResistance:
5736 case VAR_FixedFood: 5756 this->sResMagicBase = (unsigned __int8)var_value;
5737 Party::SetFood(var_value); 5757 this->PlaySound(SPEECH_92, 0);
5738 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5758 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5739 PlayAwardSound(currPlayerId); 5759 PlayAwardSound(currPlayerId);
5740 return; 5760 return;
5741 case VAR_MightBonus: 5761 case VAR_FireResistanceBonus:
5742 goto LABEL_64;
5743 case VAR_IntellectBonus:
5744 goto LABEL_68;
5745 case VAR_PersonalityBonus:
5746 goto LABEL_69;
5747 case VAR_EnduranceBonus:
5748 goto LABEL_70;
5749 case VAR_SpeedBonus:
5750 goto LABEL_71;
5751 case VAR_AccuracyBonus:
5752 goto LABEL_72;
5753 case VAR_LuckBonus:
5754 goto LABEL_73;
5755 default:
5756 return;
5757 }
5758 }
5759 LABEL_64:
5760 this->uMightBonus = (unsigned __int8)var_value;
5761 this->PlaySound(SPEECH_91, 0);
5762 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5763 PlayAwardSound(currPlayerId);
5764 return;
5765 }
5766 if ( var_type <= VAR_FireResistanceBonus )
5767 {
5768 if ( var_type == VAR_FireResistanceBonus )
5769 {
5770 this->sResFireBonus = (unsigned __int8)var_value; 5762 this->sResFireBonus = (unsigned __int8)var_value;
5771 this->PlaySound(SPEECH_91, 0); 5763 this->PlaySound(SPEECH_91, 0);
5772 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5764 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5773 PlayAwardSound(currPlayerId); 5765 PlayAwardSound(currPlayerId);
5774 return; 5766 return;
5775 } 5767 case VAR_AirResistanceBonus:
5776 switch ( var_type ) 5768 this->sResAirBonus = (unsigned __int8)var_value;
5777 { 5769 this->PlaySound(SPEECH_91, 0);
5778 case VAR_ActualIntellect:
5779 LABEL_68:
5780 this->uIntelligenceBonus = (unsigned __int8)var_value;
5781 this->PlaySound(SPEECH_91, 0);
5782 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5783 PlayAwardSound(currPlayerId);
5784 return;
5785 case VAR_ActualPersonality:
5786 LABEL_69:
5787 this->uWillpowerBonus = (unsigned __int8)var_value;
5788 this->PlaySound(SPEECH_91, 0);
5789 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5790 PlayAwardSound(currPlayerId);
5791 return;
5792 case VAR_ActualEndurance:
5793 LABEL_70:
5794 this->uEnduranceBonus = (unsigned __int8)var_value;
5795 this->PlaySound(SPEECH_91, 0);
5796 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5797 PlayAwardSound(currPlayerId);
5798 return;
5799 case VAR_ActualSpeed:
5800 LABEL_71:
5801 this->uSpeedBonus = (unsigned __int8)var_value;
5802 this->PlaySound(SPEECH_91, 0);
5803 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5804 PlayAwardSound(currPlayerId);
5805 return;
5806 case VAR_ActualAccuracy:
5807 LABEL_72:
5808 this->uAccuracyBonus = (unsigned __int8)var_value;
5809 this->PlaySound(SPEECH_92, 0);
5810 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5811 PlayAwardSound(currPlayerId);
5812 return;
5813 case VAR_ActualLuck:
5814 LABEL_73:
5815 this->uLuckBonus = (unsigned __int8)var_value;
5816 this->PlaySound(SPEECH_92, 0);
5817 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5818 PlayAwardSound(currPlayerId);
5819 return;
5820 case VAR_FireResistance:
5821 this->sResFireBase = (unsigned __int8)var_value;
5822 this->PlaySound(SPEECH_92, 0);
5823 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5824 PlayAwardSound(currPlayerId);
5825 return;
5826 case VAR_AirResistance:
5827 this->sResAirBase = (unsigned __int8)var_value;
5828 this->PlaySound(SPEECH_92, 0);
5829 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5830 PlayAwardSound(currPlayerId);
5831 return;
5832 case VAR_WaterResistance:
5833 this->sResWaterBase = (unsigned __int8)var_value;
5834 this->PlaySound(SPEECH_92, 0);
5835 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5836 PlayAwardSound(currPlayerId);
5837 return;
5838 case VAR_EarthResistance:
5839 this->sResEarthBase = (unsigned __int8)var_value;
5840 this->PlaySound(SPEECH_92, 0);
5841 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5842 PlayAwardSound(currPlayerId);
5843 return;
5844 case VAR_SpiritResistance:
5845 this->sResSpiritBase = (unsigned __int8)var_value;
5846 this->PlaySound(SPEECH_92, 0);
5847 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5848 PlayAwardSound(currPlayerId);
5849 return;
5850 case VAR_MindResistance:
5851 this->sResMindBase = (unsigned __int8)var_value;
5852 this->PlaySound(SPEECH_92, 0);
5853 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5854 PlayAwardSound(currPlayerId);
5855 return;
5856 case VAR_BodyResistance:
5857 this->sResBodyBase = (unsigned __int8)var_value;
5858 this->PlaySound(SPEECH_92, 0);
5859 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5860 PlayAwardSound(currPlayerId);
5861 return;
5862 case VAR_LightResistance:
5863 this->sResLightBase = (unsigned __int8)var_value;
5864 this->PlaySound(SPEECH_92, 0);
5865 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5866 PlayAwardSound(currPlayerId);
5867 return;
5868 case VAR_DarkResistance:
5869 this->sResDarkBase = (unsigned __int8)var_value;
5870 this->PlaySound(SPEECH_92, 0);
5871 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5872 PlayAwardSound(currPlayerId);
5873 return;
5874 case VAR_MagicResistance:
5875 this->sResMagicBase = (unsigned __int8)var_value;
5876 this->PlaySound(SPEECH_92, 0);
5877 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5878 PlayAwardSound(currPlayerId);
5879 return;
5880 default:
5881 return;
5882 }
5883 return;
5884 }
5885 HIWORD(v15) = 0;
5886 if ( var_type > VAR_DisarmTrapSkill )
5887 {
5888 if ( var_type != VAR_LearningSkill )
5889 {
5890 if ( var_type <= VAR_LearningSkill )
5891 return;
5892 if ( var_type <= VAR_Eradicated )
5893 {
5894 this->SetCondition(var_type - 105, 1);
5895 }
5896 else
5897 {
5898 if ( var_type != VAR_MajorCondition )
5899 {
5900 if ( var_type > VAR_MajorCondition && var_type <= VAR_MapPersistentVariable_99 )
5901 byte_5E4C15[var_type] = var_value;
5902 return;
5903 }
5904 memset(this, 0, 0xA0u);
5905 }
5906 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5770 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5907 PlayAwardSound(currPlayerId); 5771 PlayAwardSound(currPlayerId);
5908 return; 5772 return;
5909 } 5773 case VAR_WaterResistanceBonus:
5910 } 5774 this->sResWaterBonus = (unsigned __int8)var_value;
5911 else 5775 this->PlaySound(SPEECH_91, 0);
5912 { 5776 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5913 if (var_type != VAR_DisarmTrapSkill) 5777 PlayAwardSound(currPlayerId);
5914 { 5778 return;
5915 if ( var_type <= VAR_BodyResistanceBonus ) 5779 case VAR_EarthResistanceBonus:
5916 { 5780 this->sResEarthBonus = (unsigned __int8)var_value;
5917 switch ( var_type ) 5781 this->PlaySound(SPEECH_91, 0);
5918 { 5782 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5919 case VAR_BodyResistanceBonus: 5783 PlayAwardSound(currPlayerId);
5920 this->sResBodyBonus = (unsigned __int8)var_value; 5784 return;
5921 break; 5785 case VAR_SpiritResistanceBonus:
5922 case VAR_AirResistanceBonus: 5786 this->sResSpiritBonus = (unsigned __int8)var_value;
5923 this->sResAirBonus = (unsigned __int8)var_value; 5787 this->PlaySound(SPEECH_91, 0);
5924 break; 5788 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5925 case VAR_WaterResistanceBonus: 5789 PlayAwardSound(currPlayerId);
5926 this->sResWaterBonus = (unsigned __int8)var_value; 5790 return;
5927 break; 5791 case VAR_MindResistanceBonus:
5928 case VAR_EarthResistanceBonus: 5792 this->sResMindBonus = (unsigned __int8)var_value;
5929 this->sResEarthBonus = (unsigned __int8)var_value; 5793 this->PlaySound(SPEECH_91, 0);
5930 break; 5794 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5931 case VAR_SpiritResistanceBonus: 5795 PlayAwardSound(currPlayerId);
5932 this->sResSpiritBonus = (unsigned __int8)var_value; 5796 return;
5933 break; 5797 case VAR_BodyResistanceBonus:
5934 default: 5798 this->sResBodyBonus = (unsigned __int8)var_value;
5935 if ( var_type != 62 ) 5799 this->PlaySound(SPEECH_91, 0);
5936 return; 5800 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5937 this->sResMindBonus = (unsigned __int8)var_value; 5801 PlayAwardSound(currPlayerId);
5938 break; 5802 return;
5939 } 5803 case VAR_LightResistanceBonus:
5940 this->PlaySound(SPEECH_91, 0); 5804 this->sResLightBonus = (unsigned __int8)var_value;
5805 this->PlaySound(SPEECH_91, 0);
5806 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5807 PlayAwardSound(currPlayerId);
5808 return;
5809 case VAR_DarkResistanceBonus:
5810 this->sResDarkBonus = (unsigned __int8)var_value;
5811 this->PlaySound(SPEECH_91, 0);
5812 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5813 PlayAwardSound(currPlayerId);
5814 return;
5815 case VAR_PhysicalResistanceBonus:
5816 Error("Physical res. bonus not used");
5817 return;
5818 case VAR_MagicResistanceBonus:
5819 this->sResMagicBonus = (unsigned __int8)var_value;
5820 this->PlaySound(SPEECH_91, 0);
5821 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5822 PlayAwardSound(currPlayerId);
5823 return;
5824 case VAR_Cursed:
5825 this->SetCondition(Condition_Cursed, 1);
5826 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5827 PlayAwardSound(currPlayerId);
5828 return;
5829 case VAR_Weak:
5830 this->SetCondition(Condition_Weak, 1);
5831 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5832 PlayAwardSound(currPlayerId);
5833 return;
5834 case VAR_Asleep:
5835 this->SetCondition(Condition_Sleep, 1);
5836 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5837 PlayAwardSound(currPlayerId);
5838 return;
5839 case VAR_Afraid:
5840 this->SetCondition(Condition_Fear, 1);
5841 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5842 PlayAwardSound(currPlayerId);
5843 return;
5844 case VAR_Drunk:
5845 this->SetCondition(Condition_Drunk, 1);
5846 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5847 PlayAwardSound(currPlayerId);
5848 return;
5849 case VAR_Insane:
5850 this->SetCondition(Condition_Insane, 1);
5851 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5852 PlayAwardSound(currPlayerId);
5853 return;
5854 case VAR_PoisonedGreen:
5855 this->SetCondition(Condition_Poison1, 1);
5856 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5857 PlayAwardSound(currPlayerId);
5858 return;
5859 case VAR_DiseasedGreen:
5860 this->SetCondition(Condition_Disease1, 1);
5861 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5862 PlayAwardSound(currPlayerId);
5863 return;
5864 case VAR_PoisonedYellow:
5865 this->SetCondition(Condition_Poison2, 1);
5866 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5867 PlayAwardSound(currPlayerId);
5868 return;
5869 case VAR_DiseasedYellow:
5870 this->SetCondition(Condition_Disease2, 1);
5871 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5872 PlayAwardSound(currPlayerId);
5873 return;
5874 case VAR_PoisonedRed:
5875 this->SetCondition(Condition_Poison3, 1);
5876 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5877 PlayAwardSound(currPlayerId);
5878 return;
5879 case VAR_DiseasedRed:
5880 this->SetCondition(Condition_Disease3, 1);
5881 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5882 PlayAwardSound(currPlayerId);
5883 return;
5884 case VAR_Paralyzed:
5885 this->SetCondition(Condition_Paralyzed, 1);
5886 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5887 PlayAwardSound(currPlayerId);
5888 return;
5889 case VAR_Unconsious:
5890 this->SetCondition(Condition_Unconcious, 1);
5891 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5892 PlayAwardSound(currPlayerId);
5893 return;
5894 case VAR_Dead:
5895 this->SetCondition(Condition_Dead, 1);
5896 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5897 PlayAwardSound(currPlayerId);
5898 return;
5899 case VAR_Stoned:
5900 this->SetCondition(Condition_Pertified, 1);
5901 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5902 PlayAwardSound(currPlayerId);
5903 return;
5904 case VAR_Eradicated:
5905 this->SetCondition(Condition_Eradicated, 1);
5906 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5907 PlayAwardSound(currPlayerId);
5908 return;
5909 case VAR_MajorCondition:
5910 memset(this, 0, 0xA0u);
5911 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5912 PlayAwardSound(currPlayerId);
5913 return;
5914 case VAR_AutoNotes:
5915 if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_autonote_bits[((signed __int16)var_value - 1) >> 3]) //&& (&dword_723718_autonote_related)[8 * a3] )
5916 && pAutonoteTxt[var_value-1].pText )
5917 {
5941 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5918 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5942 PlayAwardSound(currPlayerId); 5919 this->PlaySound(SPEECH_96, 0);
5943 return; 5920 bFlashAutonotesBook = 1;
5944 } 5921 _506568_autonote_type = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3];
5945 if ( var_type == VAR_LightResistanceBonus ) 5922 }
5946 { 5923 _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u);
5947 this->sResLightBonus = (unsigned __int8)var_value; 5924 PlayAwardSound(currPlayerId);
5948 this->PlaySound(SPEECH_91, 0); 5925 return;
5949 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5926 case VAR_PlayerBits:
5950 PlayAwardSound(currPlayerId); 5927 _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
5951 return; 5928 return;
5952 } 5929 case VAR_NPCs2:
5953 if ( var_type == VAR_DarkResistanceBonus ) 5930 pParty->field_709 = 0;
5954 { 5931 LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
5955 this->sResDarkBonus = (unsigned __int8)var_value; 5932 pParty->CountHirelings();
5956 this->PlaySound(SPEECH_91, 0); 5933 viewparams->bRedrawGameUI = true;
5957 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5934 return;
5958 PlayAwardSound(currPlayerId); 5935 case VAR_NumSkillPoints:
5959 return; 5936 this->uSkillPoints = var_value;
5960 } 5937 return;
5961 if ( var_type == VAR_MagicResistanceBonus ) 5938 case VAR_Counter1:
5962 { 5939 case VAR_Counter2:
5963 this->sResMagicBonus = (unsigned __int8)var_value; 5940 case VAR_Counter3:
5964 this->PlaySound(SPEECH_91, 0); 5941 case VAR_Counter4:
5965 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); 5942 case VAR_Counter5:
5966 PlayAwardSound(currPlayerId); 5943 case VAR_Counter6:
5967 return; 5944 case VAR_Counter7:
5968 } 5945 case VAR_Counter8:
5969 if ( var_type <= VAR_MagicResistanceBonus || var_type > VAR_DiplomacySkill ) 5946 case VAR_Counter9:
5970 return; 5947 case VAR_Counter10:
5971 } 5948 pParty->PartyTimes.CounterEventValues[var_type - VAR_Counter1] = pParty->uTimePlayed; // *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);*(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
5949 return;
5950 case VAR_ReputationInCurrentLocation:
5951 v24 = &pOutdoor->ddm;
5952 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
5953 v24 = &pIndoor->dlv;
5954 v24->uReputation = var_value;
5955 if ( var_value > 10000 )
5956 v24->uReputation = 10000;
5957 return;
5958 case VAR_GoldInBank:
5959 pParty->uNumGoldInBank = var_value;
5960 return;
5961 case VAR_NumDeaths:
5962 pParty->uNumDeaths = var_value;
5963 return;
5964 case VAR_NumBounties:
5965 pParty->uNumBountiesCollected = var_value;
5966 return;
5967 case VAR_PrisonTerms:
5968 pParty->uNumPrisonTerms = var_value;
5969 return;
5970 case VAR_ArenaWinsPage:
5971 pParty->uNumArenaPageWins = var_value;
5972 return;
5973 case VAR_ArenaWinsSquire:
5974 pParty->uNumArenaSquireWins = var_value;
5975 return;
5976 case VAR_ArenaWinsKnight:
5977 pParty->uNumArenaKnightWins = var_value;
5978 return;
5979 case VAR_ArenaWinsLord:
5980 pParty->uNumArenaLordWins = var_value;
5981 return;
5982 }
5983
5984 if (var_type >= VAR_StaffSkill && var_type <= VAR_LearningSkill)
5985 {
5986 HIWORD(v15) = 0;
5987
5988 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type);
5989 v17 = *(char *)v16;
5990 if ( var_value <= 63 )
5991 {
5992 LOWORD(v15) = (unsigned __int8)var_value;
5993 v18 = v15 | v17 & 63;
5994 }
5995 else
5996 {
5997 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0);
5998 }
5999 *(short *)v16 = v18;
6000 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
6001 PlayAwardSound(currPlayerId);
6002 return;
5972 } 6003 }
5973 6004
5974 v16 = (int)((char *)&this->pConditions[16] + 2 * var_type);
5975 v17 = *(char *)v16;
5976 if ( var_value <= 63 )
5977 {
5978 LOWORD(v15) = (unsigned __int8)var_value;
5979 v18 = v15 | v17 & 63;
5980 }
5981 else
5982 {
5983 LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0);
5984 }
5985 *(short *)v16 = v18;
5986 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
5987 PlayAwardSound(currPlayerId);
5988 return;
5989 } 6005 }
5990 6006
5991 6007
5992 //----- (new function) -------------------------------------------------------- 6008 //----- (new function) --------------------------------------------------------
5993 void Player::PlayAwardSound(int currPlayerId) 6009 void Player::PlayAwardSound(int currPlayerId)
5994 { 6010 {
5995 signed int v25 = 8 * currPlayerId + 400; 6011 signed int v25 = 8 * currPlayerId + 400;
5996 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112); 6012 LOBYTE(v25) = PID(OBJECT_Player,currPlayerId - 112);
5997 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); 6013 pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0);
6014 }
6015
6016 void Player::SetSkillByEvent( unsigned __int16 Player::* skillToSet, unsigned __int16 newSkillValue, int currPlayerId )
6017 {
6018 unsigned __int16 currSkillValue = this->*skillToSet;
6019 if ( newSkillValue > 63 ) //the original had the condition reversed which was probably wrong
6020 {
6021 this->*skillToSet = newSkillValue | currSkillValue & 63;
6022 }
6023 else
6024 {
6025 this->*skillToSet = newSkillValue | currSkillValue & 0xC0;
6026 }
6027 pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId);
6028 PlayAwardSound(currPlayerId);
5998 } 6029 }
5999 6030
6000 //----- (0044AFFB) -------------------------------------------------------- 6031 //----- (0044AFFB) --------------------------------------------------------
6001 void Player::AddVariable(enum VariableType var_type, signed int val) 6032 void Player::AddVariable(enum VariableType var_type, signed int val)
6002 { 6033 {