Mercurial > mm7
changeset 469:0dbf780e247f
CompareVariable part 1
author | Ritor1 |
---|---|
date | Mon, 25 Feb 2013 17:27:27 +0600 |
parents | 8822405efad2 |
children | fcdaa804074f 9fc37a2778d3 d027c6848fbb |
files | Chest.cpp Events.cpp Indoor.cpp Indoor.h Player.cpp Player.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_6.cpp mm7_data.cpp mm7_data.h |
diffstat | 13 files changed, 228 insertions(+), 257 deletions(-) [+] |
line wrap: on
line diff
--- a/Chest.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/Chest.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -104,9 +104,9 @@ v31 = 813; v32 = 814; v5 = rand() % 4; - v6 = dword_5B5920 >> 3; + v6 = EvtTargetObj >> 3; v35 = v5; - if ( (dword_5B5920 & 7) == OBJECT_Decoration) + if ( (EvtTargetObj & 7) == OBJECT_Decoration) { v16 = v6; v14 = pLevelDecorations[v6].vPosition.x; @@ -116,11 +116,11 @@ } else { - if ( (dword_5B5920 & 7) != OBJECT_BModel) + if ( (EvtTargetObj & 7) != OBJECT_BModel) goto LABEL_12; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { - v7 = &pOutdoor->pBModels[dword_5B5920 >> 9].pFaces[(dword_5B5920 >> 3) & 0x3F]; + v7 = &pOutdoor->pBModels[EvtTargetObj >> 9].pFaces[(EvtTargetObj >> 3) & 0x3F]; v8 = v7->pBoundingBox.y1; v9 = v7->pBoundingBox.z2; v10 = v7->pBoundingBox.x1 + v7->pBoundingBox.x2;
--- a/Events.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/Events.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -141,7 +141,7 @@ //----- (0044684A) -------------------------------------------------------- -void EventProcessor(int uEventID, int a2, int a3) +void EventProcessor(int uEventID, int targetObj, int canShowMessages) { unsigned int v3; // eax@5 signed int v4; // esi@7 @@ -198,8 +198,8 @@ Player *v55; // esi@114 Player *v56; // ecx@117 int v57; // ecx@118 - signed int v58; // ebp@124 - Player *v59; // esi@125 + signed int pValue; // ebp@124 + Player *pPlayer; // esi@125 int v60; // eax@126 int v61; // edx@133 int v62; // eax@139 @@ -287,9 +287,9 @@ //v131 = uEventID; v133 = 0; - dword_5B5920 = a2; + EvtTargetObj = targetObj; dword_5B65C4 = 0; - if ( !a1 ) + if ( !uEventID ) { if ( !GameUI_StatusBar_TimedStringTimeLeft ) ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here @@ -297,7 +297,7 @@ } player_choose = (uActiveCharacter == 0)?6:4; //4 - active or 6 - random player if active =0 curr_seq_num = start_event_seq_number; - if ( _5C3420_pDecoration ) + if ( GlobalEventInfo ) { uSomeEVT_NumEvents = uGlobalEVT_NumEvents; pSomeEVT = pGlobalEVT; @@ -504,21 +504,17 @@ break; case EVENT_SpeakNPC: - if ( a3 ) + if ( canShowMessages ) { //Actor::Actor(&Dst); memset(&Dst, 0, 0x344u); - dword_5B65D0_dialogue_actor_npc_id = _evt->v5 - + ((_evt->v6 - + ((_evt->v7 - + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + dword_5B65D0_dialogue_actor_npc_id = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); Dst.uNPC_ID = dword_5B65D0_dialogue_actor_npc_id; Dst.InitializeDialogue(0); } else { - bDialogueUI_InitializeActor_NPC_ID = _evt->v5 - + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); + bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } ++curr_seq_num; v4 = v124; @@ -530,12 +526,12 @@ v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); if ( v25 ) { - stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = _evt->v5 - 124; + stru_5E4C90._decor_events[GlobalEventInfo + 28] = _evt->v5 - 124; } else { - v26 = _5C3420_pDecoration; - stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; + v26 = (LevelDecoration *)GlobalEventInfo; + stru_5E4C90._decor_events[GlobalEventInfo + 28] = 0; LOBYTE(v26->field_2) |= 0x20u; } ++curr_seq_num; @@ -725,7 +721,7 @@ pVideoPlayer->Unload(); window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; - _5C3420_pDecoration = (LevelDecoration *)1; + GlobalEventInfo = 1; if ( EnterHouse((enum HOUSE_TYPE)165) ) { pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); @@ -824,20 +820,20 @@ //v6 = v123; //v7 = ""; break; - case EVENT_Compare: - v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); + case EVENT_Compare://_evt->_e_type == 14 cmp in Global.evt event 6 + pValue = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); if ( player_choose == 5 ) { v130 = 0; - v59 = pParty->pPlayers; + pPlayer = pParty->pPlayers; while ( 1 ) { - LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); + v60 = pPlayer->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); if ( v60 ) break; ++v130; - ++v59; - if ( (signed int)v59 >= (signed int)pParty->pHirelings ) + ++pPlayer; + if ( (signed int)pPlayer >= (signed int)pParty->pHirelings ) { ++curr_seq_num; v4 = v124; @@ -876,9 +872,7 @@ LABEL_138: //v123 = v6; LABEL_139: - LOBYTE(v62) = ((Player *)v6)->CompareVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v58); + v62 = ((Player *)v6)->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), pValue); LABEL_140: if ( v62 ) goto LABEL_129; @@ -889,10 +883,7 @@ //v7 = ""; break; case EVENT_IsActorAlive: - v62 = IsActorAlive( - _evt->v5, - _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), - _evt->v10); + v62 = IsActorAlive(_evt->v5, _evt->v6 + ((_evt->v7 + ((_evt->v8 + ((uint)_evt->v9 << 8)) << 8)) << 8), _evt->v10); goto LABEL_140; case EVENT_Substract: v63 = (void *)(_evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8)); @@ -1030,9 +1021,7 @@ v130 = 4; do { - v76->SubtractVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v63); + v76->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); ++v76; } while ( (signed int)v76 < (signed int)pParty->pHirelings ); @@ -1082,9 +1071,7 @@ v130 = 4; do { - v79->SetVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v77); + v79->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); ++v79; } while ( (signed int)v79 < (signed int)pParty->pHirelings ); @@ -1108,9 +1095,7 @@ if ( player_choose == 6 ) goto LABEL_208; LABEL_211: - ((Player *)v6)->AddVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v80); + ((Player *)v6)->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); goto LABEL_212; } if ( uActiveCharacter ) @@ -1131,9 +1116,7 @@ v130 = 4; do { - v82->AddVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v80); + v82->AddVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v80); ++v82; } while ( (signed int)v82 < (signed int)pParty->pHirelings ); @@ -1150,11 +1133,7 @@ case EVENT_InputString: if ( !start_event_seq_number ) { - strcpy( - GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[_evt->v5 - + ((_evt->v6 - + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); + strcpy(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)]]); v105 = curr_seq_num; v121 = 26; LABEL_295: @@ -1166,10 +1145,7 @@ return; } v84 = _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8); - if ( !_strcmpi( - GameUI_StatusBar_TimedString, - &pLevelStr[pLevelStrOffsets[_evt->v9 - + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) + if ( !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[_evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8)]]) || !_strcmpi(GameUI_StatusBar_TimedString, &pLevelStr[pLevelStrOffsets[v84]]) ) { v11 = _evt->v17; @@ -1301,9 +1277,9 @@ break; case EVENT_StatusText: v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( _5C3420_pDecoration ) + if ( GlobalEventInfo ) { - if ( _5C3420_pDecoration == (LevelDecoration *)1 ) + if ( GlobalEventInfo == 1 ) { ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; ++curr_seq_num; @@ -1313,7 +1289,7 @@ //v7 = ""; break; } - if ( a3 == 1 ) + if ( canShowMessages == 1 ) { v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; //LABEL_248: @@ -1328,7 +1304,7 @@ } else { - if ( a3 == 1 ) + if ( canShowMessages == 1 ) { v91 = &pLevelStr[pLevelStrOffsets[v90]]; ShowStatusBarString(v91, 2u); @@ -1348,7 +1324,7 @@ break; case EVENT_ShowMessage: v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); - if ( _5C3420_pDecoration ) + if ( GlobalEventInfo ) { v93 = (char *)pNPCTopics[v92-1].pText;//(&dword_721664)[8 * v92]; byte_5B0938[0] = 0; @@ -1501,7 +1477,7 @@ } else { - pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); + pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((GlobalEventInfo == 0) + 1); sub_44987B(v99, 0); v133 = 1; if ( pCurrentScreen == SCREEN_HOUSE )
--- a/Indoor.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/Indoor.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -41,7 +41,7 @@ LevelDecoration pLevelDecorations[3000]; size_t uNumLevelDecorations; -LevelDecoration *_5C3420_pDecoration; +int GlobalEventInfo; LEVEL_TYPE uCurrentlyLoadedLevelType = LEVEL_null;
--- a/Indoor.h Mon Feb 25 11:10:57 2013 +0600 +++ b/Indoor.h Mon Feb 25 17:27:27 2013 +0600 @@ -42,7 +42,7 @@ #pragma pack(pop) extern LevelDecoration pLevelDecorations[3000]; extern size_t uNumLevelDecorations; -extern LevelDecoration *_5C3420_pDecoration; +extern int GlobalEventInfo;
--- 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); }
--- a/Player.h Mon Feb 25 11:10:57 2013 +0600 +++ b/Player.h Mon Feb 25 17:27:27 2013 +0600 @@ -444,7 +444,7 @@ void SetVariable(enum VariableType var, signed int a3); void AddVariable(enum VariableType var, signed int val); void SubtractVariable(enum VariableType var, void *a3); - char CompareVariable(enum VariableType var, signed int a1); + char CompareVariable(enum VariableType VarNum, signed int pValue); void UseItem_DrinkPotion_etc(signed int a2, int a3); bool AddItem(struct ItemGen *pItem); int GetBaseStrength();
--- a/mm7_1.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_1.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -5274,9 +5274,9 @@ if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) { v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; - _5C3420_pDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; + GlobalEventInfo = (int)&pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; EventProcessor(v15, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; } return; }
--- a/mm7_2.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_2.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -4249,7 +4249,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pKeyActionMap->_459ED1(3); pKeyActionMap->ResetKeys(); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; ptr_F8B1E8 = 0; if ( pDialogueNPCCount ) { @@ -15002,9 +15002,9 @@ v10 = v8->_idx_in_stru123; v24 = 1; v11 = stru_5E4C90._decor_events[v10 - 75] + 380; - _5C3420_pDecoration = v8; + GlobalEventInfo = (int)v8; EventProcessor(v11, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; } break;
--- a/mm7_3.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_3.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -14860,7 +14860,7 @@ pEventTimer->Pause(); dword_5C3418 = v4; dword_5C341C = v3; - _591094_decoration = _5C3420_pDecoration; + _591094_decoration = (LevelDecoration *)GlobalEventInfo; pGUIWindow2 = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)19, a4, 0); pGUIWindow2->CreateButton(61u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); pGUIWindow2->CreateButton(177u, 424u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); @@ -14874,11 +14874,11 @@ { pGUIWindow2->Release(); pGUIWindow2 = 0; - _5C3420_pDecoration = _591094_decoration; + GlobalEventInfo = (int)_591094_decoration; start_event_seq_number = dword_5C341C; EventProcessor(dword_5C3418, 0, 1); start_event_seq_number = 0; - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; pEventTimer->Resume(); }
--- a/mm7_4.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_4.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -9462,9 +9462,9 @@ else { ptr_F8B1E8 = 0; - _5C3420_pDecoration = (LevelDecoration *)1; + GlobalEventInfo = 1; EventProcessor(pEventNumber, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; } } } @@ -12227,10 +12227,10 @@ sub_4BBCDD(); break; default: - _5C3420_pDecoration = (LevelDecoration *)1; + GlobalEventInfo = 1; ptr_F8B1E8 = 0; EventProcessor(v4, 0, 1); - _5C3420_pDecoration = 0; + GlobalEventInfo = 0; break; } }
--- a/mm7_6.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_6.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -6506,9 +6506,9 @@ } if ( v447->IsInteractive() ) { - _5C3420_pDecoration = v447; + GlobalEventInfo = (int)v447; EventProcessor(stru_5E4C90._decor_events[v447->_idx_in_stru123 - 75] + 380, 0, 1); - _5C3420_pDecoration = (LevelDecoration *)v1; + GlobalEventInfo = v1; } } }
--- a/mm7_data.cpp Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_data.cpp Mon Feb 25 17:27:27 2013 +0600 @@ -2008,7 +2008,7 @@ _UNKNOWN unk_597F10; // weak int start_event_seq_number; // weak char byte_5B0938[2000]; -int dword_5B5920; // weak +int EvtTargetObj; // 0x5B5920 int _unused_5B5924_is_travel_ui_drawn = false; // 005B5924 int _5B65A8_npcdata_uflags_or_other; // weak int _5B65AC_npcdata_fame_or_other; // weak
--- a/mm7_data.h Mon Feb 25 11:10:57 2013 +0600 +++ b/mm7_data.h Mon Feb 25 17:27:27 2013 +0600 @@ -1343,7 +1343,7 @@ extern _UNKNOWN unk_597F10; // weak extern int start_event_seq_number; // weak extern char byte_5B0938[2000]; -extern int dword_5B5920; // weak +extern int EvtTargetObj; // weak extern int _unused_5B5924_is_travel_ui_drawn; // 005B5924 extern int _5B65A8_npcdata_uflags_or_other; // weak extern int _5B65AC_npcdata_fame_or_other; // weak @@ -2341,7 +2341,7 @@ void __cdecl ArenaFight(); struct Texture *__cdecl sub_4BC8D5(); struct GUIButton *__cdecl UI_CreateEndConversationButton(); -void __fastcall sub_4BCACC_bounties(signed int a1); +void __fastcall DrawLearnSkillDialog(signed int uMessageParam); signed int __cdecl sub_4BD8B5(); bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx); void __cdecl sub_4BDB56_buy_skill____();