Mercurial > mm7
diff Player.cpp @ 1818:253194aba8b8
Player::SubtractVariable helper functions
author | Grumpy7 |
---|---|
date | Mon, 07 Oct 2013 07:56:07 +0200 |
parents | 4dee76d79c78 |
children | 1641ab7f21ec |
line wrap: on
line diff
--- a/Player.cpp Mon Oct 07 06:37:49 2013 +0200 +++ b/Player.cpp Mon Oct 07 07:56:07 2013 +0200 @@ -6612,47 +6612,54 @@ signed int v24; // [sp-4h] [bp-10h]@4 int v25; // [sp-4h] [bp-10h]@45 + v4 = 0; + if ( this == pPlayers[2] ) + v4 = 1; + else if ( this == pPlayers[3] ) + v4 = 2; + else if ( this == pPlayers[4] ) + v4 = 3; + v3 = 0; - v4 = uActiveCharacter - 1; result = false; - if ( (signed int)VarNum > 222 ) - { - if ( (signed int)VarNum <= 307 ) + if ( VarNum >= VAR_AutoNotes ) + { + if ( VarNum <= VAR_NumDeaths ) { - if ( VarNum == 307 ) + if ( VarNum == VAR_NumDeaths ) { pParty->uNumDeaths -= (unsigned int)pValue; return pValue; } - if ( VarNum == 223 ) + if ( VarNum == VAR_AutoNotes ) { v11 = (char *)pParty->_autonote_bits; v22 = (short)pValue - 1; } else { - if ( VarNum != 231 ) + if ( VarNum != VAR_PlayerBits ) { switch ( VarNum ) { - case 232: - VarNum = (VariableType)0; - GetNewNPCData(sDialogue_SpeakingActorNPC_ID, (int*)&VarNum); + case VAR_NPCs2: + v18 = 0; + GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &v18); result = (bool) pValue; - npcIdToDismissAfterDialogue = 0; - if ( (int)VarNum == pValue ) + if ( v18 == pValue ) { - npcIdToDismissAfterDialogue = (int)pValue; + npcIdToDismissAfterDialogue = pValue; } else { + npcIdToDismissAfterDialogue = 0; pParty->hirelingScrollPosition = 0; LOBYTE(pNPCStats->pNewNPCData[(int)pValue].uFlags) &= 0x7Fu; pParty->CountHirelings(); viewparams->bRedrawGameUI = true; } break; - case 241: + case VAR_HiredNPCHasSpeciality: if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) { v20 = (char *)&pNPCStats->pNewNPCData[0].uFlags; @@ -6677,7 +6684,7 @@ pParty->hirelingScrollPosition = 0; pParty->CountHirelings(); break; - case 243: + case VAR_NumSkillPoints: v17 = (char *)&this->uSkillPoints; result = *v17 != NULL; if ( (unsigned int)pValue <= *(int *)v17 ) @@ -6688,7 +6695,7 @@ else *(int *)v17 = 0; break; - case 275: + case VAR_ReputationInCurrentLocation: v16 = (char *)&pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v16 = (char *)&pIndoor->dlv; @@ -6696,7 +6703,7 @@ if ( *((int *)v16 + 2) < -10000 ) *((int *)v16 + 2) = -10000; break; - case 306: + case VAR_GoldInBank: result = VarNum - 306; if ( (unsigned int)pValue <= pParty->uNumGoldInBank ) { @@ -6718,27 +6725,27 @@ } switch ( VarNum ) { - case 308: + case VAR_NumBounties: result = (bool)pValue; pParty->uNumBountiesCollected -= (unsigned int)pValue; break; - case 309: + case VAR_PrisonTerms: result = (bool)pValue; pParty->uNumPrisonTerms -= (int)pValue; break; - case 310: + case VAR_ArenaWinsPage: result = (bool)pValue; pParty->uNumArenaPageWins -= (char)pValue; break; - case 311: + case VAR_ArenaWinsSquire: result = (bool)pValue; pParty->uNumArenaSquireWins -= (char)pValue; break; - case 312: + case VAR_ArenaWinsKnight: result = (bool)pValue; pParty->uNumArenaKnightWins -= (char)pValue; break; - case 313: + case VAR_ArenaWinsLord: result = (bool)pValue; pParty->uNumArenaLordWins -= (char)pValue; break; @@ -6747,7 +6754,7 @@ } else { - if ( (signed int)VarNum >= 123 ) + if ( VarNum >= VAR_MapPersistentVariable_0 ) { byte_5E4C15[VarNum] -= (char)pValue; } @@ -6772,70 +6779,41 @@ sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[504], v7); ShowStatusBarString(pTmpBuf.data(), 2u); GameUI_DrawFoodAndGold(); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_CurrentHP: ReceiveDamage((signed int)pValue, DMGT_PHISYCAL); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_CurrentSP: - v9 = (char *)&this->sMana; - v10 = this->sMana - (signed int)pValue < 0; - *(int *)v9 -= (int)pValue; - if ( v10 ) - *(int *)v9 = 0; - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->sMana = max(this->sMana - pValue, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_ACModifier: this->sACModifier -= (unsigned __int8)pValue; - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_BaseLevel: this->uLevel -= (unsigned __int8)pValue; - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_LevelModifier: this->sLevelModifier -= (unsigned __int8)pValue; - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_Age: this->sAgeModifier -= (signed __int16)pValue; return result; case VAR_Award: - _449B7E_toggle_bit((unsigned char *)this->_achieved_awards_bits, (signed __int16)pValue, 0); + _449B7E_toggle_bit(this->_achieved_awards_bits, (signed __int16)pValue, 0); return result; case VAR_Experience: - v12 = (char *)&this->uExperience; - v13 = (signed int)pValue; - v14 = *(int *)v12 < (unsigned int)pValue; - *(int *)v12 -= (int)pValue; - *((int *)v12 + 1) -= v14 + HIDWORD(v13); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->uExperience -= pValue; + PlayAwardSound_Anim98(v4); return result; case VAR_QBits_QuestsDone: _449B7E_toggle_bit(pParty->_quest_bits, (__int16)pValue, 0); - pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); + this->PlaySound(SPEECH_96, 0); return true; case VAR_PlayerItemInHands: v15 = this->pInventoryMatrix; @@ -6848,290 +6826,149 @@ case VAR_MightBonus: case VAR_ActualMight: this->uMightBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_IntellectBonus: case VAR_ActualIntellect: this->uIntelligenceBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_PersonalityBonus: case VAR_ActualPersonality: this->uWillpowerBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_EnduranceBonus: case VAR_ActualEndurance: this->uEnduranceBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_SpeedBonus: case VAR_ActualSpeed: this->uSpeedBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_AccuracyBonus: case VAR_ActualAccuracy: this->uAccuracyBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_LuckBonus: case VAR_ActualLuck: this->uLuckBonus -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_BaseMight: this->uMight -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BaseIntellect: this->uIntelligence -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BasePersonality: this->uWillpower -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BaseEndurance: this->uEndurance -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BaseSpeed: this->uSpeed -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BaseAccuracy: this->uAccuracy -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BaseLuck: this->uLuck -= (unsigned __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_FireResistance: this->sResFireBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_AirResistance: this->sResAirBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_WaterResistance: this->sResWaterBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_EarthResistance: this->sResEarthBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_SpiritResistance: this->sResSpiritBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_MindResistance: this->sResMindBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_BodyResistance: this->sResBodyBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_LightResistance: this->sResLightBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_DarkResistance: this->sResDarkBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_MagicResistance: this->sResMagicBase -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_FireResistanceBonus: this->sResFireBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_AirResistanceBonus: this->sResAirBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)92, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_92); return result; case VAR_WaterResistanceBonus: this->sResWaterBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_EarthResistanceBonus: this->sResEarthBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_SpiritResistanceBonus: this->sResSpiritBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_MindResistanceBonus: this->sResMindBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_BodyResistanceBonus: this->sResBodyBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_LightResistanceBonus: this->sResLightBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_DarkResistanceBonus: this->sResDarkBonus -= (signed __int16)pValue; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)SPEECH_91, 0); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_MagicResistanceBonus: this->sResMagicBonus -= (signed __int16)pValue; - v25 = 0; - v23 = SPEECH_91; - pPlayers[v4 + 1]->PlaySound((PlayerSpeech)v23, v25); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->PlayAwardSound_Anim98_Face(v4, SPEECH_91); return result; case VAR_FixedFood: Party::TakeFood((unsigned int)pValue); - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_StaffSkill: case VAR_SwordSkill: @@ -7164,10 +7001,7 @@ case VAR_DisarmTrapSkill: case VAR_LearningSkill: *((short *)&this->pConditions[16] + VarNum) -= (unsigned __int8)pValue; - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + PlayAwardSound_Anim98(v4); return result; case VAR_Cursed: case VAR_Weak: @@ -7188,11 +7022,8 @@ case VAR_Eradicated: //*((int *)this + 2 * VarNum - 210) = 0; //*((int *)this + 2 * result - 209) = 0; - this->pConditions[VarNum] = 0; - pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, v4); - v8 = 8 * v4 + 400; - LOBYTE(v8) = PID(OBJECT_Player,v4 - 112); - pAudioPlayer->PlaySound(SOUND_20001, v8, 0, -1, 0, 0, 0, 0); + this->pConditions[VarNum] = 0; + PlayAwardSound_Anim98(v4); return result; default: return result; @@ -7220,6 +7051,19 @@ // 5B65C4: using guessed type int dword_5B65C4; // 5B65CC: using guessed type int dword_5B65CC; +//----- (new function) -------------------------------------------------------- +void Player::PlayAwardSound_Anim98(int currPlayerId) +{ + pGame->pStru6Instance->SetPlayerBuffAnim(0x98u, currPlayerId); + PlayAwardSound(currPlayerId); +} + +//----- (new function) -------------------------------------------------------- +void Player::PlayAwardSound_Anim98_Face(int currPlayerId, PlayerSpeech speech) +{ + this->PlaySound(speech, 0); + PlayAwardSound_Anim98(currPlayerId); +} //----- (00467E7F) -------------------------------------------------------- void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType)