Mercurial > mm7
diff Player.cpp @ 469:0dbf780e247f
CompareVariable part 1
author | Ritor1 |
---|---|
date | Mon, 25 Feb 2013 17:27:27 +0600 |
parents | 17c90e543e28 |
children | d4ea2d382004 81410c3feebc |
line wrap: on
line diff
--- a/Player.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/Player.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -7701,7 +7701,7 @@ //----- (00449BB4) -------------------------------------------------------- -char Player::CompareVariable(enum VariableType var, signed int a1) +char Player::CompareVariable(enum VariableType VarNum, signed int pValue) { Player *v3; // esi@1 signed int v4; // edi@1 @@ -7731,51 +7731,50 @@ int v28; // ebx@161 int v29; // eax@161 + v6 = 0; v3 = this; v4 = -1; - if ( var > VAR_AutoNotes ) - { - switch ( var ) + if ( VarNum > VAR_AutoNotes ) + { + switch ( VarNum ) { case VAR_Invisible: if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime) > 0) ) - goto _return_true; - goto _cmp_against_arg; + return true; + return v4 >= pValue; case VAR_NumDeaths: v4 = pParty->uNumDeaths; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_NumBounties: v4 = pParty->uNumBountiesCollected; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_PrisonTerms: v4 = pParty->uNumPrisonTerms; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsPage: v4 = (unsigned __int8)pParty->uNumArenaPageWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsSquire: v4 = (unsigned __int8)pParty->uNumArenaSquireWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsKnight: v4 = (unsigned __int8)pParty->uNumArenaKnightWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ArenaWinsLord: v4 = (unsigned __int8)pParty->uNumArenaLordWins; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ReputationInCurrentLocation: v19 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v19 = &pIndoor->dlv; - v20 = v19->uReputation >= a1; - goto _return; + v6 = v19->uReputation >= pValue; + return v6; case VAR_History_28|VAR_Sex: v21 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) v21 = &pIndoor->dlv; - v20 = v21->field_C_alert == a1; -_return: - LOBYTE(v6) = v20; + v6 = v21->field_C_alert == pValue; return v6; case VAR_MonthEquals2|VAR_Sex: case VAR_MonthEquals2|VAR_Class: @@ -7787,21 +7786,21 @@ case VAR_Counter6: case VAR_Counter7: case VAR_Counter8: - v22 = *(int *)&stru_AA1058[3].pSounds[8 * var + 44304]; - if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * var + 44300] - && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * var + 44300]) - + (signed __int64)((double)(460800 * a1) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) - goto _return_true; - goto _return_false; + v22 = *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44304]; + if ( v22 | *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300] + && (signed __int64)(__PAIR__(v22, *(int *)&stru_AA1058[3].pSounds[8 * VarNum + 44300]) + + (signed __int64)((double)(460800 * pValue) * 0.033333335)) <= (signed __int64)pParty->uTimePlayed ) + return true; + return false; case VAR_NumSkillPoints: v4 = this->uSkillPoints; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_CircusPrises: v4 = 0; v23 = pParty->pPlayers;//[0].pInventoryItems; do { - v24 = v23->pInventoryItems; + v24 = v23->pInventoryItems; v25 = 138; do { @@ -7824,32 +7823,35 @@ ++v23; } while ( v23 <= &pParty->pPlayers[3] ); - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MonthEquals2: - v17 = pParty->uCurrentMonth == a1; - goto _return2; + v6 = pParty->uCurrentMonth == pValue; + return v6; case VAR_IsFlying: if ( pParty->bFlying && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) > 0) ) - goto _return_true; - goto _return_false; + return true; + return false; case VAR_HiredNPCHasSpeciality: - LOBYTE(v6) = CheckHiredNPCSpeciality(a1); + LOBYTE(v6) = CheckHiredNPCSpeciality(pValue); return v6; case VAR_NPCs2: - return pNPCStats->pNewNPCData[a1].Hired(); + return pNPCStats->pNewNPCData[pValue].Hired(); case VAR_MonthEquals|VAR_CurrentSP: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_1A50[((signed __int16)a1 - 1) >> 3]; - goto LABEL_108; + if ( !((unsigned __int8)v13 & v14) ) + return v4 >= pValue; + v4 = pValue; + return v4 >= pValue; case VAR_ItemEquipped: v26 = (ITEM_EQUIP_TYPE)0; v27 = (char *)&this->pEquipment; break; case VAR_GoldInBank: v4 = pParty->uNumGoldInBank; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ThieverySkill|0x80: v28 = GetActualMight(); v29 = v3->GetBaseStrength(); @@ -7882,70 +7884,65 @@ v9 = v28 - v29 < 0; LABEL_169: if ( v9 ^ v10 ) - goto _cmp_against_arg; - goto _return_true; + return v4 >= pValue; + return true; default: - goto _cmp_against_arg; + return v4 >= pValue; } while ( !v3->HasItemEquipped(v26) - || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != a1 ) + || *(int *)&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v27 + 5] != pValue ) { v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); v27 += 4; if ( (signed int)v26 >= 16 ) - { -_return_false: - LOBYTE(v6) = 0; - return v6; - } - } - goto _return_true; - } - if ( var == VAR_AutoNotes ) + return false; + } + return true; + } + if ( VarNum == VAR_AutoNotes ) { v13 = 0x80u >> ((signed __int16)(a1 - 1) - 1) % 8; v14 = pParty->_autonote_bits[((signed __int16)(a1 - 1) - 1) >> 3]; -LABEL_108: if ( !((unsigned __int8)v13 & v14) ) - goto _cmp_against_arg; - goto LABEL_109; - } - if ( var <= VAR_BaseLuck ) - { - if ( var != VAR_BaseLuck ) - { - switch ( var ) + return v4 >= pValue; + v4 = pValue; + return v4 >= pValue; + } + if ( VarNum <= VAR_BaseLuck ) + { + if ( VarNum != VAR_BaseLuck ) + { + switch ( VarNum ) { case VAR_Hour: - if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == a1 ) - goto _return_true; - goto _return_false; + if ( (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24 == pValue ) + return true; + return false; case VAR_DayOfYear: - v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 - % 0x150 - + 1; - goto LABEL_9; + v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 0x150 + 1; + v6 = v5 == pValue; + return v6; case VAR_DayOfWeek: - v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 - % 7; -LABEL_9: - LOBYTE(v6) = v5 == a1; + v5 = (unsigned int)((signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60) / 0x18 % 7; + v6 = v5 == pValue; return v6; case VAR_Sex: - v7 = (CHARACTER_RACE)this->uSex; - goto _cmp_against_arg2; + if ( pValue == (CHARACTER_RACE)this->uSex ) + return true; + return v4 >= pValue; case VAR_Class: v7 = (CHARACTER_RACE)this->classType; - goto _cmp_against_arg2; + if ( pValue == v7 ) + return true; + return v4 >= pValue; case VAR_Race: v7 = GetRace(); -_cmp_against_arg2: - if ( a1 == v7 ) - goto _return_true; - goto _cmp_against_arg; + if ( pValue == v7 ) + return true; + return v4 >= pValue; case VAR_CurrentHP: v4 = this->sHealth; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MaxHP: v8 = GetMaxHealth(); v10 = __OFSUB__(v3->sHealth, v8); @@ -7953,7 +7950,7 @@ goto LABEL_169; case VAR_CurrentSP: v4 = this->sMana; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MaxSP: v11 = GetMaxMana(); v10 = __OFSUB__(v3->sMana, v11); @@ -7964,135 +7961,136 @@ goto _j_cmp_against_arg; case VAR_ACModifier: v4 = this->sACModifier; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseLevel: v4 = this->uLevel; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_LevelModifier: v4 = this->sLevelModifier; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_Age: v12 = GetActualAge(); goto _j_cmp_against_arg; case VAR_Award: v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; v14 = this->field_152[((signed __int16)a1 - 1) >> 3]; - goto LABEL_108; + if ( !((unsigned __int8)v13 & v14) ) + return v4 >= pValue; + v4 = pValue; + return v4 >= pValue; case VAR_Experience: v4 = LODWORD(this->uExperience); - goto _cmp_against_arg; + return v4 >= pValue; case VAR_QBits_QuestsDone: - v13 = 0x80u >> ((signed __int16)a1 - 1) % 8; - v14 = pParty->_award_bits[((signed __int16)a1 - 1) >> 3]; - goto LABEL_108; + v13 = 0x80u >> (pValue - 1) % 8; + v14 = pParty->_award_bits[(pValue - 1) >> 3]; + if ( !((unsigned __int8)v13 & v14) ) + return false; + return true; case VAR_PlayerItemInHands: v15 = 0; v16 = v3->pInventoryItems; break; case VAR_FixedGold: v4 = pParty->uNumGold; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MightBonus: v4 = this->uMightBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_IntellectBonus: v4 = this->uIntelligenceBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_PersonalityBonus: v4 = this->uWillpowerBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_EnduranceBonus: v4 = this->uEnduranceBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_SpeedBonus: v4 = this->uSpeedBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_AccuracyBonus: v4 = this->uAccuracyBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_LuckBonus: v4 = this->uLuckBonus; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseMight: v4 = this->uMight; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseIntellect: v4 = this->uIntelligence; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BasePersonality: v4 = this->uWillpower; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseEndurance: v4 = this->uEndurance; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseSpeed: v4 = this->uSpeed; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BaseAccuracy: v4 = this->uAccuracy; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_FixedFood: v4 = pParty->uNumFoodRations; - goto _cmp_against_arg; + return v4 >= pValue; default: - goto _cmp_against_arg; - } - while ( v16->uItemID != a1 ) + return v4 >= pValue; + } + while ( v16->uItemID != pValue ) { ++v15; ++v16; if ( v15 >= 138 ) { - v17 = pParty->pPickedItem.uItemID == a1; -_return2: - LOBYTE(v6) = v17; + v6 = pParty->pPickedItem.uItemID == pValue; return v6; } } -_return_true: - LOBYTE(v6) = 1; - return v6; + return true; } v4 = this->uLuck; - goto _cmp_against_arg; - } - if ( var <= VAR_MagicResistance ) - { - if ( var == VAR_MagicResistance ) + return v4 >= pValue; + } + if ( VarNum <= VAR_MagicResistance ) + { + if ( VarNum == VAR_MagicResistance ) { v4 = this->sResMagicBase; } else { - switch ( var ) + switch ( VarNum ) { case VAR_FireResistance: v4 = this->sResFireBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_AirResistance: v4 = this->sResAirBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_WaterResistance: v4 = this->sResWaterBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_EarthResistance: v4 = this->sResEarthBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_SpiritResistance: v4 = this->sResSpiritBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_MindResistance: v4 = this->sResMindBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_BodyResistance: v4 = this->sResBodyBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_LightResistance: v4 = this->sResLightBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_DarkResistance: v4 = this->sResDarkBase; - goto _cmp_against_arg; + return v4 >= pValue; case VAR_ActualMight: v12 = GetActualMight(); goto _j_cmp_against_arg; @@ -8117,18 +8115,18 @@ v4 = v12; break; default: - goto _cmp_against_arg; - } - } - goto _cmp_against_arg; - } - if ( var <= VAR_DisarmTrapSkill ) - { - if ( var != VAR_DisarmTrapSkill ) - { - if ( var <= VAR_MindResistanceBonus ) - { - switch ( var ) + return v4 >= pValue; + } + } + return v4 >= pValue; + } + if ( VarNum <= VAR_DisarmTrapSkill ) + { + if ( VarNum != VAR_DisarmTrapSkill ) + { + if ( VarNum <= VAR_MindResistanceBonus ) + { + switch ( VarNum ) { case VAR_MindResistanceBonus: v4 = this->sResMindBonus; @@ -8149,63 +8147,60 @@ v4 = this->sResSpiritBonus; break; } - goto _cmp_against_arg; - } - if ( var == VAR_BodyResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_BodyResistanceBonus ) { v4 = this->sResBodyBonus; - goto _cmp_against_arg; - } - if ( var == VAR_LightResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_LightResistanceBonus ) { v4 = this->sResLightBonus; - goto _cmp_against_arg; - } - if ( var == VAR_DarkResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_DarkResistanceBonus ) { v4 = this->sResDarkBonus; - goto _cmp_against_arg; - } - if ( var == VAR_MagicResistanceBonus ) + return v4 >= pValue; + } + if ( VarNum == VAR_MagicResistanceBonus ) { v4 = this->sResMagicBonus; - goto _cmp_against_arg; - } - if ( var <= VAR_MagicResistanceBonus || var > VAR_DiplomacySkill ) - goto _cmp_against_arg; + return v4 >= pValue; + } + if ( VarNum <= VAR_MagicResistanceBonus || VarNum > VAR_DiplomacySkill ) + return v4 >= pValue; } LABEL_90: - v18 = *((short *)&this->pConditions[16] + var); - if ( a1 <= 63 ) + v18 = *((short *)&this->pConditions[16] + VarNum); + if ( pValue <= 63 ) v4 = v18 & 0x3F; else - v4 = a1 & v18; - goto _cmp_against_arg; - } - if ( var == 104 ) + v4 = pValue & v18; + return v4 >= pValue; + } + if ( VarNum == 104 ) goto LABEL_90; - if ( (signed int)var <= 104 ) - goto _cmp_against_arg; - if ( (signed int)var > 0x79 ) - { - if ( var != 122 ) - { - if ( (signed int)var > 122 && var <= VAR_ActiveSpells ) - v4 = (unsigned __int8)byte_5E4C15[var]; - goto _cmp_against_arg; + if ( (signed int)VarNum <= 104 ) + return v4 >= pValue; + if ( (signed int)VarNum > 0x79 ) + { + if ( VarNum != 122 ) + { + if ( (signed int)VarNum > 122 && VarNum <= VAR_ActiveSpells ) + v4 = (unsigned __int8)byte_5E4C15[VarNum]; + return v4 >= pValue; } v4 = GetMajorConditionIdx(); if ( v4 != 18 ) { -_cmp_against_arg: - LOBYTE(v6) = v4 >= a1; - return v6; - } -LABEL_109: - v4 = a1; - goto _cmp_against_arg; - } - return *((int *)this + 2 * var - 210); + return v4 >= pValue; + } + v4 = pValue; + return v4 >= pValue; + } + return *((int *)this + 2 * VarNum - 210); }