Mercurial > mm7
changeset 492:0e27362ac1d9
guild
author | Gloval |
---|---|
date | Thu, 28 Feb 2013 01:38:46 +0400 |
parents | d5da524ec901 |
children | 59649750a054 |
files | Party.h Player.cpp mm7_1.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp mm7_data.cpp mm7_data.h |
diffstat | 8 files changed, 260 insertions(+), 247 deletions(-) [+] |
line wrap: on
line diff
--- a/Party.h Wed Feb 27 22:48:10 2013 +0400 +++ b/Party.h Thu Feb 28 01:38:46 2013 +0400 @@ -258,8 +258,8 @@ char uNumArenaSquireWins; char uNumArenaKnightWins; char uNumArenaLordWins; - char pIsArtifactFound[68]; //7ba - //char pArtifactsFound[56]; + char pIsArtifactFound[29]; //7ba + char field_7d7[39]; unsigned char _autonote_bits[12]; char field_80A[74]; char field_854[32];
--- a/Player.cpp Wed Feb 27 22:48:10 2013 +0400 +++ b/Player.cpp Thu Feb 28 01:38:46 2013 +0400 @@ -8205,9 +8205,9 @@ //----- (0044A5CB) -------------------------------------------------------- -void Player::SetVariable(enum VariableType var, signed int a3) -{ - signed int v3; // ebx@1 +void Player::SetVariable(enum VariableType var_type, signed int var_value) +{ + signed int currPlayerId; // ebx@1 Player *v4; // esi@1 unsigned int v5; // edi@1 unsigned int v6; // esi@13 @@ -8237,125 +8237,114 @@ char v30; // [sp+32h] [bp-2h]@1 char v31; // [sp+33h] [bp-1h]@1 - v3 = 0; + currPlayerId = 0; v30 = 0; v31 = 0; v4 = this; v5 = 0; if ( this == pPlayers[2] ) - { - v3 = 1; - goto LABEL_8; - } - if ( this == pPlayers[3] ) - { - v27 = 2; - } - else - { - if ( this != pPlayers[4] ) - goto LABEL_8; - v27 = 3; - } - v3 = v27; -LABEL_8: - if ( var > VAR_AutoNotes ) - { - if ( var <= VAR_GoldInBank ) - { - if ( var == VAR_GoldInBank ) - { - pParty->uNumGoldInBank = a3; + currPlayerId = 1; + else if ( this == pPlayers[3] ) + currPlayerId = 2; + else if ( this == pPlayers[4] ); + currPlayerId = 3; + if ( var_type > VAR_AutoNotes ) + { + if ( var_type <= VAR_GoldInBank ) + { + if ( var_type == VAR_GoldInBank ) + { + pParty->uNumGoldInBank = var_value; return; } - if ( var <= VAR_Counter8 ) - { - if ( (signed int)var >= 0xF5 ) + if ( var_type <= VAR_Counter8 ) + { + if ( (signed int)var_type >= 0xF5 ) { - *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] = LODWORD(pParty->uTimePlayed); - *(int *)&stru_AA1058[3].pSounds[8 * var + 44304] = HIDWORD(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); } else { - switch ( var ) + switch ( var_type ) { case VAR_MonthEquals|VAR_CurrentSP: - _449B7E_toggle_bit((unsigned char *)field_1A50, a3, 1u); + _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u); break; case VAR_NPCs2: pParty->field_709 = 0; - LOBYTE(pNPCStats->pNewNPCData[a3].uFlags) |= 0x80u; + LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u; sub_44A56A(); viewparams->bRedrawGameUI = 1; break; case VAR_NumSkillPoints: - this->uSkillPoints = a3; + this->uSkillPoints = var_value; break; } } return; } - if ( var < VAR_Counter9 ) + if ( var_type < VAR_Counter9 ) return; - if ( (signed int)var <= 0x112 ) - { - *(int *)&stru_AA1058[3].pSounds[8 * var + 44532] = LODWORD(pParty->uTimePlayed); - *(int *)&stru_AA1058[3].pSounds[8 * var + 44536] = HIDWORD(pParty->uTimePlayed); + if ( (signed int)var_type <= 0x112 ) + { + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed); + *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed); } else { - if ( var == VAR_ReputationInCurrentLocation ) + if ( var_type == VAR_ReputationInCurrentLocation ) { v24 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v24 = &pIndoor->dlv; - v24->uReputation = a3; - if ( a3 > 10000 ) + v24->uReputation = var_value; + if ( var_value > 10000 ) v24->uReputation = 10000; return; } - if ( var <= VAR_ReputationInCurrentLocation - || var > VAR_History_28 - || (v22 = var - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) - || (pParty->field_3C.field_4F0[2 * (var - 276)] = LODWORD(pParty->uTimePlayed), + if ( var_type <= VAR_ReputationInCurrentLocation + || var_type > VAR_History_28 + || (v22 = var_type - 276, pParty->field_3C.field_4F0[2 * v22 + 1] | pParty->field_3C.field_4F0[2 * v22]) + || (pParty->field_3C.field_4F0[2 * (var_type - 276)] = LODWORD(pParty->uTimePlayed), v23 = pStorylineText->StoreLine[v22].pText==0,//*(&pStorylineText->field_0 + 3 * v22) == 0, - pParty->field_3C.field_4F0[2 * (var - 276) + 1] = HIDWORD(pParty->uTimePlayed), + pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed), v23) ) return; bFlashHistoryBook = 1; } LABEL_172: - v25 = 8 * v3 + 400; - LOBYTE(v25) = (8 * v3 - 112) | 4; + v25 = 8 * currPlayerId + 400; + LOBYTE(v25) = (8 * currPlayerId - 112) | 4; pAudioPlayer->PlaySound(SOUND_20001, v25, v5, -1, v5, v5, v5, v5); return; } - if ( var != 307 ) - { - switch ( var ) + if ( var_type != 307 ) + { + switch ( var_type ) { case 308: - pParty->uNumBountiesCollected = a3; + pParty->uNumBountiesCollected = var_value; break; case 309: - pParty->uNumPrisonTerms = a3; + pParty->uNumPrisonTerms = var_value; break; case 310: - pParty->uNumArenaPageWins = a3; + pParty->uNumArenaPageWins = var_value; break; case 311: - pParty->uNumArenaSquireWins = a3; + pParty->uNumArenaSquireWins = var_value; break; case 312: - pParty->uNumArenaKnightWins = a3; + pParty->uNumArenaKnightWins = var_value; break; case 313: - pParty->uNumArenaLordWins = a3; + pParty->uNumArenaLordWins = var_value; break; } return; } - pParty->uNumDeaths = a3; + pParty->uNumDeaths = var_value; LABEL_168: if ( v30 != 1 ) { @@ -8366,101 +8355,101 @@ goto LABEL_172; } LABEL_169: - pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, v3); + pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); goto LABEL_170; } - if ( var == VAR_AutoNotes ) - { - if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_autonote_bits[((signed __int16)a3 - 1) >> 3]) + if ( var_type == VAR_AutoNotes ) + { + 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] ) - && pAutonoteTxt[a3-1].pText ) - { - v20 = pPlayers[v3 + 1]; + && pAutonoteTxt[var_value-1].pText ) + { + v20 = pPlayers[currPlayerId + 1]; v30 = 1; v20->PlaySound(SPEECH_96, 0); - v21 = pAutonoteTxt[a3-1].eType;// dword_72371C[2 * a3]; + v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; dword_506568 = v21; } - _449B7E_toggle_bit(pParty->_autonote_bits, a3, 1u); + _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); v31 = 1; goto LABEL_168; } - if ( var <= VAR_ActualMight ) - { - if ( var != VAR_ActualMight ) - { - switch ( var ) + if ( var_type <= VAR_ActualMight ) + { + if ( var_type != VAR_ActualMight ) + { + switch ( var_type ) { case VAR_RandomGold: - v6 = rand() % a3 + 1; + v6 = rand() % var_value + 1; Party::SetGold(v6); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[500], v6);// You have %lu gold ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); return; case VAR_RandomFood: - v7 = rand() % a3 + 1; + v7 = rand() % var_value + 1; Party::SetFood(v7); sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[501], v7);// You have %lu food ShowStatusBarString(pTmpBuf, 2u); GameUI_DrawFoodAndGold(); goto LABEL_124; case VAR_Sex: - this->uSex = (PLAYER_SEX)a3; + this->uSex = (PLAYER_SEX)var_value; goto LABEL_124; case VAR_Class: - this->classType = (PLAYER_CLASS_TYPE)a3; - if ( (char)a3 != 35 ) + this->classType = (PLAYER_CLASS_TYPE)var_value; + if ( (char)var_value != 35 ) goto LABEL_124; v8 = 0; v9 = this->pInventoryItems; break; case VAR_CurrentHP: - this->sHealth = a3; + this->sHealth = var_value; goto LABEL_124; case VAR_MaxHP: this->sHealth = GetMaxHealth(); return; case VAR_CurrentSP: - this->sMana = a3; + this->sMana = var_value; goto LABEL_124; case VAR_MaxSP: this->sMana = GetMaxMana(); return; case VAR_ACModifier: - this->sACModifier = (unsigned __int8)a3; + this->sACModifier = (unsigned __int8)var_value; goto LABEL_124; case VAR_BaseLevel: - this->uLevel = (unsigned __int8)a3; + this->uLevel = (unsigned __int8)var_value; goto LABEL_124; case VAR_LevelModifier: - this->sLevelModifier = (unsigned __int8)a3; + this->sLevelModifier = (unsigned __int8)var_value; goto LABEL_124; case VAR_Age: - this->sAgeModifier = a3; + this->sAgeModifier = var_value; return; case VAR_Award: - if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pPlayers[v3 + 1]->_guilds_member_bits[((signed __int16)a3 - 1) >> 3]) + if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & + pPlayers[currPlayerId + 1]->_guilds_member_bits[((signed __int16)var_value - 1)/ 8]) //&& dword_723E80_award_related[2 * a3] ) - && pAwards[a3-1].pText ) + && pAwards[var_value].pText ) { - v12 = pPlayers[v3 + 1]; v30 = 1; v31 = 1; - v12->PlaySound(SPEECH_96, 0); + pPlayers[currPlayerId + 1]->PlaySound(SPEECH_96, 0); } - v13 = v4->_guilds_member_bits; - goto LABEL_51; + _449B7E_toggle_bit((unsigned char *)v4->_guilds_member_bits, var_value, 1u); + goto LABEL_168; case VAR_Experience: - this->uExperience = a3; + this->uExperience = var_value; goto LABEL_124; case VAR_QBits_QuestsDone: - if ( !((unsigned __int8)(0x80u >> ((signed __int16)a3 - 1) % 8) & pParty->_quest_bits[((signed __int16)a3 - 1) >> 3]) + if ( !((unsigned __int8)(0x80u >> ((signed __int16)var_value - 1) % 8) & pParty->_quest_bits[((signed __int16)var_value - 1) >> 3]) // && (&dword_722F10)[4 * a3] ) - && pQuestTable[a3-1] ) + && pQuestTable[var_value-1] ) { - v14 = pPlayers[v3 + 1]; + v14 = pPlayers[currPlayerId + 1]; bFlashQuestBook = 1; v30 = 1; v31 = 1; @@ -8468,43 +8457,52 @@ } v13 = (char *)pParty->_quest_bits; LABEL_51: - _449B7E_toggle_bit((unsigned char *)v13, a3, 1u); - goto LABEL_168; + _449B7E_toggle_bit((unsigned char *)v13, var_value, 1u); + if (( v30 != 1 )&&( v31 != 1 )) + return; + else + pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); + if ( v31 != 1 ) + return; + v25 = 8 * currPlayerId + 400; + LOBYTE(v25) = (8 * currPlayerId - 112) | 4; + pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); + return; case VAR_PlayerItemInHands: item.Reset(); item.Reset(); - item.uItemID = a3; + item.uItemID = var_value; item.uAttributes = 1; pParty->SetHoldingItem(&item); - if ( a3 >= ITEM_ARTIFACT_PUCK && a3 <= ITEM_RELIC_MEKORIGS_HAMMER ) - pParty->pIsArtifactFound[a3-500] = 1; + if ( var_value >= ITEM_ARTIFACT_PUCK && var_value <= ITEM_RELIC_MEKORIGS_HAMMER ) + pParty->pIsArtifactFound[var_value-500] = 1; return; case VAR_FixedGold: - Party::SetGold(a3); + Party::SetGold(var_value); return; case VAR_BaseMight: - this->uMight = (unsigned __int8)a3; + this->uMight = (unsigned __int8)var_value; goto LABEL_84; case VAR_BaseIntellect: - this->uIntelligence = (unsigned __int8)a3; + this->uIntelligence = (unsigned __int8)var_value; goto LABEL_84; case VAR_BasePersonality: - this->uWillpower = (unsigned __int8)a3; + this->uWillpower = (unsigned __int8)var_value; goto LABEL_84; case VAR_BaseEndurance: - this->uEndurance = (unsigned __int8)a3; + this->uEndurance = (unsigned __int8)var_value; goto LABEL_84; case VAR_BaseSpeed: - this->uSpeed = (unsigned __int8)a3; + this->uSpeed = (unsigned __int8)var_value; goto LABEL_84; case VAR_BaseAccuracy: - this->uAccuracy = (unsigned __int8)a3; + this->uAccuracy = (unsigned __int8)var_value; goto LABEL_84; case VAR_BaseLuck: - this->uLuck = (unsigned __int8)a3; + this->uLuck = (unsigned __int8)var_value; goto LABEL_84; case VAR_FixedFood: - Party::SetFood(a3); + Party::SetFood(var_value); goto LABEL_124; case VAR_MightBonus: goto LABEL_64; @@ -8532,7 +8530,7 @@ } v10 = (int)((char *)v4 + 36 * v8); *(int *)(v10 + 532) = 601; - *(char *)(v10 + 558) = v3 + 1; + *(char *)(v10 + 558) = currPlayerId + 1; LABEL_22: if ( v4->sResFireBase < 20 ) v4->sResFireBase = 20; @@ -8557,82 +8555,82 @@ v4->uFace = 20; v4->uVoiceID = 20; } - ReloadPlayerPortraits(v3, v4->uFace); + ReloadPlayerPortraits(currPlayerId, v4->uFace); goto LABEL_124; } LABEL_64: - this->uMightBonus = (unsigned __int8)a3; + this->uMightBonus = (unsigned __int8)var_value; LABEL_111: v28 = 0; v26 = SPEECH_91; LABEL_112: - v19 = pPlayers[v3 + 1]; + v19 = pPlayers[currPlayerId + 1]; v31 = 1; v19->PlaySound((PlayerSpeech)v26, v28); goto LABEL_169; } - if ( var <= VAR_FireResistanceBonus ) - { - if ( var == VAR_FireResistanceBonus ) - { - this->sResFireBonus = (unsigned __int8)a3; + if ( var_type <= VAR_FireResistanceBonus ) + { + if ( var_type == VAR_FireResistanceBonus ) + { + this->sResFireBonus = (unsigned __int8)var_value; goto LABEL_111; } - switch ( var ) + switch ( var_type ) { case VAR_ActualIntellect: LABEL_68: - this->uIntelligenceBonus = (unsigned __int8)a3; + this->uIntelligenceBonus = (unsigned __int8)var_value; goto LABEL_111; case VAR_ActualPersonality: LABEL_69: - this->uWillpowerBonus = (unsigned __int8)a3; + this->uWillpowerBonus = (unsigned __int8)var_value; goto LABEL_111; case VAR_ActualEndurance: LABEL_70: - this->uEnduranceBonus = (unsigned __int8)a3; + this->uEnduranceBonus = (unsigned __int8)var_value; goto LABEL_111; case VAR_ActualSpeed: LABEL_71: - this->uSpeedBonus = (unsigned __int8)a3; + this->uSpeedBonus = (unsigned __int8)var_value; goto LABEL_111; case VAR_ActualAccuracy: LABEL_72: - this->uAccuracyBonus = (unsigned __int8)a3; + this->uAccuracyBonus = (unsigned __int8)var_value; goto LABEL_111; case VAR_ActualLuck: LABEL_73: - this->uLuckBonus = (unsigned __int8)a3; + this->uLuckBonus = (unsigned __int8)var_value; goto LABEL_111; case VAR_FireResistance: - this->sResFireBase = (unsigned __int8)a3; + this->sResFireBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_AirResistance: - this->sResAirBase = (unsigned __int8)a3; + this->sResAirBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_WaterResistance: - this->sResWaterBase = (unsigned __int8)a3; + this->sResWaterBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_EarthResistance: - this->sResEarthBase = (unsigned __int8)a3; + this->sResEarthBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_SpiritResistance: - this->sResSpiritBase = (unsigned __int8)a3; + this->sResSpiritBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_MindResistance: - this->sResMindBase = (unsigned __int8)a3; + this->sResMindBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_BodyResistance: - this->sResBodyBase = (unsigned __int8)a3; + this->sResBodyBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_LightResistance: - this->sResLightBase = (unsigned __int8)a3; + this->sResLightBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_DarkResistance: - this->sResDarkBase = (unsigned __int8)a3; + this->sResDarkBase = (unsigned __int8)var_value; goto LABEL_84; case VAR_MagicResistance: - this->sResMagicBase = (unsigned __int8)a3; + this->sResMagicBase = (unsigned __int8)var_value; LABEL_84: v28 = 0; v26 = 92; @@ -8643,22 +8641,22 @@ return; } HIWORD(v15) = 0; - if ( var > VAR_DisarmTrapSkill ) - { - if ( var != VAR_LearningSkill ) - { - if ( var <= VAR_LearningSkill ) + if ( var_type > VAR_DisarmTrapSkill ) + { + if ( var_type != VAR_LearningSkill ) + { + if ( var_type <= VAR_LearningSkill ) return; - if ( var <= VAR_Eradicated ) - { - v4->SetCondition(var - 105, 1); + if ( var_type <= VAR_Eradicated ) + { + v4->SetCondition(var_type - 105, 1); } else { - if ( var != VAR_MajorCondition ) + if ( var_type != VAR_MajorCondition ) { - if ( var > VAR_MajorCondition && var <= VAR_ActiveSpells ) - byte_5E4C15[var] = a3; + if ( var_type > VAR_MajorCondition && var_type <= VAR_ActiveSpells ) + byte_5E4C15[var_type] = var_value; return; } memset(v4, 0, 0xA0u); @@ -8668,66 +8666,85 @@ goto LABEL_169; } LABEL_106: - v16 = (int)((char *)&v4->pConditions[16] + 2 * var); + v16 = (int)((char *)&v4->pConditions[16] + 2 * var_type); v17 = *(char *)v16; - if ( a3 <= VAR_BodyResistanceBonus ) - { - LOWORD(v15) = (unsigned __int8)a3; + if ( var_value <= VAR_BodyResistanceBonus ) + { + LOWORD(v15) = (unsigned __int8)var_value; v18 = v15 | v17 & VAR_BodyResistanceBonus; } else { - LOWORD(v18) = (unsigned __int8)(a3 | v17 & 0xC0); + LOWORD(v18) = (unsigned __int8)(var_value | v17 & 0xC0); } *(short *)v16 = v18; goto LABEL_124; } - if ( var == VAR_DisarmTrapSkill ) - goto LABEL_106; - if ( var <= VAR_BodyResistanceBonus ) - { - switch ( var ) + if ( var_type == VAR_DisarmTrapSkill ) + if ( v30 != 1 ) + { + if ( v31 != 1 ) + return; + v5 = 0; + goto LABEL_172; + } + pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); + goto LABEL_170; + if ( var_type <= VAR_BodyResistanceBonus ) + { + switch ( var_type ) { case VAR_BodyResistanceBonus: - v4->sResBodyBonus = (unsigned __int8)a3; + v4->sResBodyBonus = (unsigned __int8)var_value; break; case VAR_AirResistanceBonus: - v4->sResAirBonus = (unsigned __int8)a3; + v4->sResAirBonus = (unsigned __int8)var_value; break; case VAR_WaterResistanceBonus: - v4->sResWaterBonus = (unsigned __int8)a3; + v4->sResWaterBonus = (unsigned __int8)var_value; break; case VAR_EarthResistanceBonus: - v4->sResEarthBonus = (unsigned __int8)a3; + v4->sResEarthBonus = (unsigned __int8)var_value; break; case VAR_SpiritResistanceBonus: - v4->sResSpiritBonus = (unsigned __int8)a3; + v4->sResSpiritBonus = (unsigned __int8)var_value; break; default: - if ( var != 62 ) + if ( var_type != 62 ) return; - v4->sResMindBonus = (unsigned __int8)a3; + v4->sResMindBonus = (unsigned __int8)var_value; break; } goto LABEL_111; } - if ( var == VAR_LightResistanceBonus ) - { - v4->sResLightBonus = (unsigned __int8)a3; + if ( var_type == VAR_LightResistanceBonus ) + { + v4->sResLightBonus = (unsigned __int8)var_value; goto LABEL_111; } - if ( var == VAR_DarkResistanceBonus ) - { - v4->sResDarkBonus = (unsigned __int8)a3; + if ( var_type == VAR_DarkResistanceBonus ) + { + v4->sResDarkBonus = (unsigned __int8)var_value; + goto LABEL_111; + } + if ( var_type == VAR_MagicResistanceBonus ) + { + v4->sResMagicBonus = (unsigned __int8)var_value; goto LABEL_111; } - if ( var == VAR_MagicResistanceBonus ) - { - v4->sResMagicBonus = (unsigned __int8)a3; - goto LABEL_111; - } - if ( var > VAR_MagicResistanceBonus && var <= VAR_DiplomacySkill ) - goto LABEL_106; + if ( var_type > VAR_MagicResistanceBonus && var_type <= VAR_DiplomacySkill ) + if ( v30 != 1 ) + { + if ( v31 != 1 ) + return; + v5 = 0; + v25 = 8 * currPlayerId + 400; + LOBYTE(v25) = (8 * currPlayerId - 112) | 4; + pAudioPlayer->PlaySound(SOUND_20001, v25, 0, -1, 0, 0, 0, 0); + return; + } + pGame->pStru6Instance->SetPlayerBuffAnim(0x96u, currPlayerId); + goto LABEL_170; } @@ -8862,7 +8879,7 @@ v33 = 0x80u >> ((signed __int16)val - 1) % 8; if ( !((unsigned __int8)(0x80u >> ((signed __int16)val - 1) % 8) & v13->_guilds_member_bits[((signed __int16)val - 1) >> 3]) //&& dword_723E80_award_related[2 * val] ) - && pAwards[val-1].pText ) + && pAwards[val].pText ) { v14 = pPlayers[uPlayerIdx + 1]; v34 = 1;
--- a/mm7_1.cpp Wed Feb 27 22:48:10 2013 +0400 +++ b/mm7_1.cpp Thu Feb 28 01:38:46 2013 +0400 @@ -694,7 +694,7 @@ { v5 = pStru179.field_0[v21]; v20 = 8 * pStru179.field_0[v21]; - v6 = (char *)pAwards[v20/8-1].pText;//(char *)dword_723E80_award_related[v20 / 4]; + v6 = (char *)pAwards[(v20-1)/8].pText;//(char *)dword_723E80_award_related[v20 / 4]; if ( v5 != 1 ) break; v17 = pParty->uFine;
--- a/mm7_2.cpp Wed Feb 27 22:48:10 2013 +0400 +++ b/mm7_2.cpp Thu Feb 28 01:38:46 2013 +0400 @@ -11421,7 +11421,10 @@ pIcons_LOD->_4114F2(); } - +int __stdcall pWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam) + { + return DefWindowProcA(hWnd, Msg, wParam, lParam); + } //----- (004637EB) -------------------------------------------------------- @@ -12692,7 +12695,7 @@ wcxw.hInstance, nullptr); SetWindowTextW(hWnd, L"Might and MagicŪ VII"); - + SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS); pRenderer = Render::Create(); @@ -12715,7 +12718,7 @@ return false; } } - + pAllocator = Allocator::Create(); if (!pAllocator->Initialize(26 * 1024)) { @@ -12724,7 +12727,7 @@ L"More RAM Memory Required", MB_ICONEXCLAMATION); return false; } - + game_starting_year = 1168; pParty = new Party; @@ -12931,7 +12934,7 @@ pSoundList->ToFile(); } - + if (dword_6BE364_game_settings_1 & 2 || !(dword_6BE368_debug_settings_2 & 1))// // color depth != 16 // or @@ -13267,8 +13270,8 @@ } else __debugbreak(); - /*{ - if (GetCurrentMenuID() != MENU_10) + { + /* if (GetCurrentMenuID() != MENU_10) goto LABEL_49; pMouse->Activate(0); if (pAsyncMouse) @@ -13294,8 +13297,8 @@ if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) - pAsyncKeyboard->Resume(); - }*/ + pAsyncKeyboard->Resume();*/ + } //LABEL_48: pGame->Loop(); LABEL_49: @@ -13335,6 +13338,7 @@ else Log::Warning(L"MM init: failed"); pGame->Deinitialize(); +return 1; }
--- a/mm7_4.cpp Wed Feb 27 22:48:10 2013 +0400 +++ b/mm7_4.cpp Thu Feb 28 01:38:46 2013 +0400 @@ -5011,7 +5011,7 @@ v24 = v23; dword_A74CDC = v23; } - v11 = (char *)pAwards[v55[v24]-1].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; + v11 = (char *)pAwards[v55[v24]].pText;//(char *)dword_723E80_award_related[2 * v55[v24]]; } else { @@ -9503,20 +9503,20 @@ Party::TakeGold(gold_transaction_amount); if ( uActiveCharacter ) { - v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards]; + v12 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; *(short *)v12 &= 0x3Fu; switch ( dword_F8B1B0 ) { case 2: - v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards]; + v15 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; *v15 |= 0x40u; break; case 3: - v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards]; + v14 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; *v14 |= 0x80u; break; case 4: - v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_something_todo_with_awards]; + v13 = (char *)&pPlayers[uActiveCharacter]->pActiveSkills[dword_F8B1AC_award_bit_number]; v13[1] |= 1u; break; } @@ -9534,13 +9534,13 @@ } else { - if ( uMessageParam == 82 && contract_approved ) + if ( uMessageParam == 82 && contract_approved ) //join guild { Party::TakeGold(gold_transaction_amount); v4 = pParty->pPlayers; do { - v4->SetVariable(VAR_Award, dword_F8B1AC_something_todo_with_awards); + v4->SetVariable(VAR_Award, dword_F8B1AC_award_bit_number); ++v4; } while ( (signed int)v4 < (signed int)pParty->pHirelings ); @@ -9699,7 +9699,7 @@ v3 = (_this - 200) / 3; v4 = v2; v35 = (char *)pNPCTopics[127].pText; - dword_F8B1AC_something_todo_with_awards = v3; + dword_F8B1AC_award_bit_number = v3; if ( v2 ) { if ( v2 == 1 ) @@ -9795,8 +9795,8 @@ { if ( (signed int)v16 >= 2 && v7 >= 7 ) { - v17 = dword_F8B1AC_something_todo_with_awards; - switch ( dword_F8B1AC_something_todo_with_awards ) + v17 = dword_F8B1AC_award_bit_number; + switch ( dword_F8B1AC_award_bit_number ) { default: goto LABEL_41; @@ -9858,13 +9858,13 @@ if ( v34 != 4 ) { LABEL_40: - v17 = dword_F8B1AC_something_todo_with_awards; + v17 = dword_F8B1AC_award_bit_number; goto LABEL_41; } if ( (signed int)v16 >= 3 && v7 >= 10 ) { - v17 = dword_F8B1AC_something_todo_with_awards; - switch ( dword_F8B1AC_something_todo_with_awards ) + v17 = dword_F8B1AC_award_bit_number; + switch ( dword_F8B1AC_award_bit_number ) { case 19: if ( v1->_49327B(0x22u, 1) == 1 ) @@ -9921,12 +9921,12 @@ } if ( v7 < 4 ) return v35; - v17 = dword_F8B1AC_something_todo_with_awards; - if ( dword_F8B1AC_something_todo_with_awards > 27 ) - { - if ( dword_F8B1AC_something_todo_with_awards != 29 - && dword_F8B1AC_something_todo_with_awards != 32 - && (dword_F8B1AC_something_todo_with_awards <= 33 || dword_F8B1AC_something_todo_with_awards > 35) ) + v17 = dword_F8B1AC_award_bit_number; + if ( dword_F8B1AC_award_bit_number > 27 ) + { + if ( dword_F8B1AC_award_bit_number != 29 + && dword_F8B1AC_award_bit_number != 32 + && (dword_F8B1AC_award_bit_number <= 33 || dword_F8B1AC_award_bit_number > 35) ) { LABEL_41: if ( !gold_transaction_amount ) @@ -9937,18 +9937,18 @@ gold_transaction_amount = 500; goto LABEL_41; } - if ( dword_F8B1AC_something_todo_with_awards >= 23 ) + if ( dword_F8B1AC_award_bit_number >= 23 ) goto LABEL_87; - if ( dword_F8B1AC_something_todo_with_awards == 7 ) + if ( dword_F8B1AC_award_bit_number == 7 ) { gold_transaction_amount = 0; goto LABEL_79; } - if ( dword_F8B1AC_something_todo_with_awards <= 7 ) + if ( dword_F8B1AC_award_bit_number <= 7 ) goto LABEL_41; - if ( dword_F8B1AC_something_todo_with_awards > 18 ) - { - if ( dword_F8B1AC_something_todo_with_awards != 21 ) + if ( dword_F8B1AC_award_bit_number > 18 ) + { + if ( dword_F8B1AC_award_bit_number != 21 ) goto LABEL_41; goto LABEL_87; } @@ -9986,33 +9986,34 @@ //----- (004B29F2) -------------------------------------------------------- -const char *__fastcall ContractSelectText(int pEventNumber) -{ +const char * ContractSelectText( int pEventCode ) + { +static const int dialogue_base=110; contract_approved = 0; - dword_F8B1AC_something_todo_with_awards = pEventNumber + 50; - gold_transaction_amount = price_for_membership[pEventNumber]; + dword_F8B1AC_award_bit_number = pEventCode + 50; + gold_transaction_amount = price_for_membership[pEventCode]; if ( pPlayers[uActiveCharacter]->CanAct() ) { - if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_something_todo_with_awards) ) - { - return pNPCTopics[123].pText; + if ( (unsigned __int16)_449B57_test_bit((unsigned __int8 *)pPlayers[uActiveCharacter]->_guilds_member_bits, dword_F8B1AC_award_bit_number) ) + { + return pNPCTopics[dialogue_base+13].pText; } else { if ( gold_transaction_amount <= pParty->uNumGold ) { contract_approved = 1; - return pNPCTopics[pEventNumber + 110].pText; + return pNPCTopics[pEventCode + dialogue_base].pText; } else { - return pNPCTopics[124].pText; + return pNPCTopics[dialogue_base+14].pText; } } } else { - return pNPCTopics[122].pText; + return pNPCTopics[dialogue_base+12].pText; } } @@ -10622,13 +10623,13 @@ } //----- (004B3EF0) -------------------------------------------------------- -void __fastcall DrawJoinGuildWindow(int pEventNumber) -{ +void DrawJoinGuildWindow( int pEventCode ) + { uDialogueType = 81;//enum JoinGuildDialog - ptr_F8B1E8 = (char *)pNPCTopics[pEventNumber + 99].pText; - ContractSelectText(pEventNumber); + ptr_F8B1E8 = (char *)pNPCTopics[pEventCode + 99].pText; + ContractSelectText(pEventCode); pDialogueWindow->Release(); - pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventNumber, 0); + pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15E, WINDOW_MainMenu, pEventCode, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton(0x1D7, 0x1BD, 0xA9, 0x23, 1, 0, 0x71, 0, 0, pGlobalTXT_LocalizationStrings[34], (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); @@ -10651,16 +10652,7 @@ pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, v1, 0); v2 = ""; - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x1D7u, - 0x1BDu, - 0xA9u, - 0x23u, - 1, - 0, - 0x71u, - 0, - 0, + pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34], (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); @@ -14383,7 +14375,7 @@ memset(byte_F8B148, 0, 16); pRenderer->ClearZBuffer(0, 479); - if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour >=uOpenTime)||(pParty->uCurrentHour <=(uCloseTime - 1))))|| + if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) {
--- a/mm7_5.cpp Wed Feb 27 22:48:10 2013 +0400 +++ b/mm7_5.cpp Thu Feb 28 01:38:46 2013 +0400 @@ -17701,7 +17701,7 @@ v2 = (unsigned __int8 *)pPlayer->_guilds_member_bits; do { - v13 = (char *)pAwards[v1-1].pText;//dword_723E80_award_related[2 * v1]; + v13 = (char *)pAwards[v1].pText;//dword_723E80_award_related[2 * v1]; if ( (unsigned __int16)_449B57_test_bit(v2, v1) && v13 ) { v3 = dword_506520++;
--- a/mm7_data.cpp Wed Feb 27 22:48:10 2013 +0400 +++ b/mm7_data.cpp Thu Feb 28 01:38:46 2013 +0400 @@ -1681,7 +1681,7 @@ 0x0EB, 0x25C, 0x0EC, 0x25D, 0x0ED, 0x259, 0x0F1, 0x21E } ; -int price_for_membership[777]; // weak +int price_for_membership[11]={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak char byte_4F09B0[777]; // weak char byte_4F09B1[777]; // weak char byte_4F09B8[777]; // weak @@ -2350,7 +2350,7 @@ __int16 word_F8B1A0; // weak const char *dword_F8B1A4; // idb int contract_approved; // weak -int dword_F8B1AC_something_todo_with_awards; // idb +int dword_F8B1AC_award_bit_number; // idb int dword_F8B1B0; // weak int gold_transaction_amount; // F8B1B4 char *pShopOptions[4];
--- a/mm7_data.h Wed Feb 27 22:48:10 2013 +0400 +++ b/mm7_data.h Thu Feb 28 01:38:46 2013 +0400 @@ -1691,7 +1691,7 @@ extern __int16 word_F8B1A0; // weak extern const char *dword_F8B1A4; // idb extern int contract_approved; // weak -extern int dword_F8B1AC_something_todo_with_awards; // idb +extern int dword_F8B1AC_award_bit_number; // idb extern int dword_F8B1B0; // weak extern int gold_transaction_amount; // F8B1B4 extern char *pShopOptions[4]; @@ -2305,7 +2305,7 @@ void __cdecl sub_4B1ECE(); void __fastcall ClickNPCTopic(signed int uMessageParam); char *__thiscall _4B254D_SkillMasteryTeacher(int _this); -const char *__fastcall ContractSelectText(int pEventNumber); +const char * ContractSelectText(int pEventCode); char __cdecl SimpleHouseAndBoatsDialog(); void CreateButtonInColumn(int a1, unsigned int a2); void FillAviableSkillsToTeach(int _this); @@ -2313,7 +2313,7 @@ void sub_4B3AD4(signed int a1); void sub_4B3B42(signed int a1); void __cdecl sub_4B3E1E(); -void __fastcall DrawJoinGuildWindow(int pEventNumber); +void DrawJoinGuildWindow(int pEventCode); void __fastcall sub_4B3FE5(int a4); void __cdecl sub_4B40E6(); void _4B4224_UpdateNPCTopics(int _this);