# HG changeset patch # User Ritor1 # Date 1385992279 -21600 # Node ID c2a004e7458b7630222f24a3afb9d15d07321df2 # Parent 72177f3603da6bb5fe41113b2b83639ecdf488b1 _494035_timed_effects__water_walking_damage__etc() diff -r 72177f3603da -r c2a004e7458b Party.cpp --- a/Party.cpp Mon Dec 02 17:00:58 2013 +0600 +++ b/Party.cpp Mon Dec 02 19:51:19 2013 +0600 @@ -160,7 +160,6 @@ int Party::GetNextActiveCharacter() { int v2; // eax@4 - Player *v6; // eax@7 signed int v8; // esi@23 int v12; // [sp+Ch] [bp-4h]@1 @@ -177,12 +176,8 @@ playerAlreadyPicked.fill(false); for (int i = 0; i < 4; i++) { - v6 = &this->pPlayers[i]; - if ( !v6->CanAct() - || v6->uTimeToRecovery > 0) - { + if ( !this->pPlayers[i].CanAct() || this->pPlayers[i].uTimeToRecovery > 0) playerAlreadyPicked[i] = true; - } else if ( !playerAlreadyPicked[i] ) { playerAlreadyPicked[i] = true; @@ -194,8 +189,7 @@ for (int i = 0; i < 4; i++) { - if ( this->pPlayers[i].CanAct() - && this->pPlayers[i].uTimeToRecovery == 0 ) + if ( this->pPlayers[i].CanAct() && this->pPlayers[i].uTimeToRecovery == 0 ) { if ( v12 == 0 || this->pPlayers[i].uSpeedBonus > v8 ) { diff -r 72177f3603da -r c2a004e7458b mm7_4.cpp --- a/mm7_4.cpp Mon Dec 02 17:00:58 2013 +0600 +++ b/mm7_4.cpp Mon Dec 02 19:51:19 2013 +0600 @@ -645,90 +645,41 @@ void _494035_timed_effects__water_walking_damage__etc() { signed __int64 v0; // qax@1 - signed __int64 v1; // ST30_8@1 - signed __int64 v2; // ST38_8@1 - unsigned __int64 v3; // qax@1 unsigned int v4; // edi@1 - //signed int v5; // eax@4 - //char *v6; // ecx@5 - //Player *v7; // esi@8 - //char *v8; // ecx@12 - //Player *pPlayer; // esi@15 - //void *v10; // esi@25 - unsigned int v11; // ecx@27 signed int v12; // edi@29 - //Player *v13; // ecx@30 - //Player *v14; // esi@35 - //double v15; // st7@35 - Player **v16; // esi@43 - Player *v17; // edi@44 - double v18; // st7@44 - //float v19; // ST28_4@48 - //double v20; // ST38_8@48 - Player *v21; // esi@51 - signed int v22; // edi@53 - int v23; // eax@59 int v24; // ecx@60 - int v25; // eax@63 int v26; // ecx@64 - int v27; // eax@67 int v28; // ecx@68 - int v29; // eax@71 int v30; // ecx@72 - int v31; // eax@75 int v32; // ecx@76 - int v33; // eax@79 int v34; // ecx@80 - int v35; // eax@83 int v36; // ecx@84 - int v37; // eax@87 int v38; // ecx@88 - int v39; // eax@91 int v40; // ecx@92 - int v41; // eax@95 int v42; // ecx@96 bool v43; // ebx@102 - //SpellBuff *v44; // edi@104 - //signed int v45; // ebp@104 bool v46; // edi@111 - //SpellBuff *v47; // esi@113 - //Player **v48; // esi@119 - //signed int v49; // edi@121 - //char *v50; // esi@122 - signed int v51; // edx@128 - signed int v52; // ecx@130 - int v53; // eax@131 - Player *v54; // eax@141 - //unsigned int v55; // [sp-8h] [bp-38h]@18 unsigned int v56; // [sp-8h] [bp-38h]@55 - //int v57; // [sp-4h] [bp-34h]@18 - //int v58; // [sp-4h] [bp-34h]@33 int v59; // [sp-4h] [bp-34h]@55 - //unsigned int v60; // [sp+10h] [bp-20h]@1 unsigned int v61; // [sp+14h] [bp-1Ch]@1 - Player **v62; // [sp+14h] [bp-1Ch]@50 - //unsigned int a2; // [sp+18h] [bp-18h]@1 signed int a2a; // [sp+18h] [bp-18h]@47 - signed int v65; // [sp+1Ch] [bp-14h]@47 + signed int old_day; // [sp+1Ch] [bp-14h]@47 + signed int old_hour; - //a2 = pParty->uCurrentHour; - v61 = pParty->uDaysPlayed; + old_day = pParty->uDaysPlayed; + old_hour = pParty->uCurrentHour; //auto prev_time = pEventTimer->uTimeElapsed; pParty->uTimePlayed += pEventTimer->uTimeElapsed; - v0 = (signed __int64)(pParty->uTimePlayed * 0.234375) / 60; - v1 = v0; - v0 /= 60i64; - v2 = v0; - v3 = (unsigned int)v0 / 24; - v4 = (unsigned int)(v3 / 7) >> 2; + v0 = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60)/60i64; + v4 = (unsigned int)(((unsigned int)v0 / 24) / 7) >> 2; pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; - pParty->uCurrentMinute = v1 % 60; - pParty->uCurrentMonthWeek = v3 / 7 & 3; - pParty->uCurrentHour = v2 % 24; - pParty->uDaysPlayed = (unsigned int)v3 % 28; + pParty->uCurrentMinute = ((signed __int64)(pParty->uTimePlayed * 0.234375) / 60) % 60; + pParty->uCurrentHour = v0 % 24; + pParty->uCurrentMonthWeek = ((unsigned int)v0 / 24) / 7 & 3; + pParty->uDaysPlayed = (unsigned int)((unsigned int)v0 / 24) % 28; pParty->uCurrentMonth = v4 % 12; pParty->uCurrentYear = v4 / 0xC + game_starting_year; - if ( pParty->uCurrentHour >= 3 && (pParty->uCurrentHour < 3 || pParty->uDaysPlayed > v61) ) // new day dawns + if ( pParty->uCurrentHour >= 3 && (old_hour < 3 || pParty->uDaysPlayed > old_day) ) // new day dawns { pParty->pHirelings[0].bHasUsedTheAbility = false; pParty->pHirelings[1].bHasUsedTheAbility = false; @@ -749,20 +700,18 @@ pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / (pParty->days_played_without_rest + 1) + 1; if (pParty->days_played_without_rest > 3) - for (uint i = 0; i < 4; ++i) + for ( uint i = 0; i < 4; ++i ) + { + pParty->pPlayers[i].Zero(); + if (!pParty->pPlayers[i].IsPertified() && !pParty->pPlayers[i].IsEradicated() + && !pParty->pPlayers[i].IsDead()) { - Player* player = &pParty->pPlayers[i]; - - player->Zero(); - - if (!player->IsPertified() && !player->IsEradicated() && !player->IsDead()) - { - if (rand() % 100 < 5 * pParty->days_played_without_rest) - player->SetCondDeadWithBlockCheck(0); - if (rand() % 100 < 10 * pParty->days_played_without_rest) - player->SetCondInsaneWithBlockCheck(0); - } + if (rand() % 100 < 5 * pParty->days_played_without_rest) + pParty->pPlayers[i].SetCondDeadWithBlockCheck(0); + if (rand() % 100 < 10 * pParty->days_played_without_rest) + pParty->pPlayers[i].SetCondInsaneWithBlockCheck(0); } + } } if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) pOutdoor->SetFog(); @@ -771,69 +720,49 @@ pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; } - v11 = LODWORD(pParty->uTimePlayed); - if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage error + if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed )//water damage { - //v12 = 1; - pParty->field_6FC = LODWORD(pParty->uTimePlayed) + 128; - viewparams->bRedrawGameUI = 1; - //while ( 1 ) - for ( v12 = 1; v12 <= 4; ++v12 ) + pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128; + viewparams->bRedrawGameUI = true; + for ( uint pl = 1; pl <= 4; ++pl ) { - if ( pPlayers[v12]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) - || pPlayers[v12]->HasEnchantedItemEquipped(71) - || pPlayers[v12]->pPlayerBuffs[23].uExpireTime > 0 ) - { - //v58 = 0; - pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); - } + if ( pPlayers[pl]->WearsItem(ITEM_RELIC_HARECS_LEATHER, EQUIP_ARMOUR) + || pPlayers[pl]->HasEnchantedItemEquipped(71) + || pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_WATER_WALK].uExpireTime > 0 ) + pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); else { - //v58 = 0; - if ( !pPlayers[v12]->HasUnderwaterSuitEquipped() ) + if ( !pPlayers[pl]->HasUnderwaterSuitEquipped() ) { - //v14 = pPlayers[v12]; - //v15 = (double)pPlayers[v12]->GetMaxHealth() * 0.1; - pPlayers[v12]->ReceiveDamage((signed __int64)pPlayers[v12]->GetMaxHealth() * 0.1, DMGT_FIRE); + pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE); if ( pParty->uFlags & 4 ) { - strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]); + strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[660]);// Вы тонете! GameUI_Footer_TimeLeft = 128; } } - else - pPlayers[v12]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); - } - //++v12; - //if ( v12 > 4 ) - //{ - //v11 = LODWORD(pParty->uTimePlayed); - //break; + else + pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_37, 0); } - v11 = LODWORD(pParty->uTimePlayed); - //} + } } - if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)__PAIR__(HIDWORD(pParty->uTimePlayed), v11) ) + if ( pParty->uFlags & 0x200 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) //lava damage { - viewparams->bRedrawGameUI = 1; - pParty->field_6FC = v11 + 128; - v16 = &pPlayers[1]; - do + viewparams->bRedrawGameUI = true; + pParty->field_6FC = (signed __int64)pParty->uTimePlayed + 128; + + for ( uint pl = 1; pl <= 4; pl++ ) { - v17 = *v16; - v18 = (double)(*v16)->GetMaxHealth() * 0.1; - v17->ReceiveDamage((signed __int64)v18, DMGT_FIRE); + pPlayers[pl]->ReceiveDamage((signed __int64)pPlayers[pl]->GetMaxHealth() * 0.1, DMGT_FIRE); if ( pParty->uFlags & 0x200 ) { - strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); + strcpy(GameUI_Footer_TimedString.data(), pGlobalTXT_LocalizationStrings[661]); //Вы горите! GameUI_Footer_TimeLeft = 128; } - ++v16; } - while ( (signed int)v16 <= (signed int)&pPlayers[4] ); } _493938_regenerate(); - v65 = 4; + uint party_condition_flag = 4; a2a = pEventTimer->uTimeElapsed; if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING ) { @@ -843,187 +772,148 @@ if (a2a < 1) a2a = 1; } - v62 = &pPlayers[1]; - do + + for ( uint pl = 1; pl <= 4; pl++ ) { - v21 = *v62; - if ( (*v62)->uTimeToRecovery ) - v21->Recover(a2a); - v22 = v21->sHealth; - if ( v21->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + v22 + v21->uEndurance >= 1 - || (signed __int64)v21->pPlayerBuffs[11].uExpireTime > 0 ) + if ( pPlayers[pl]->uTimeToRecovery ) + pPlayers[pl]->Recover(a2a); + if ( pPlayers[pl]->GetItemsBonus(CHARACTER_ATTRIBUTE_ENDURANCE) + pPlayers[pl]->sHealth + pPlayers[pl]->uEndurance >= 1 + || (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime > 0 ) { - if ( v22 < 1 ) - { - v59 = 0; - v56 = 13; - v21->SetCondition(v56, v59); - } + if ( pPlayers[pl]->sHealth < 1 ) + pPlayers[pl]->SetCondition(Condition_Unconcious, 0); } else + pPlayers[pl]->SetCondition(Condition_Dead, 0); + if ( pPlayers[pl]->field_E0 ) { - v59 = 0; - v56 = 14; - v21->SetCondition(v56, v59); - } - v23 = (int)&v21->field_E0; - if ( v21->field_E0 ) - { - v24 = *(int *)v23 - pEventTimer->uTimeElapsed; + v24 = pPlayers[pl]->field_E0 - pEventTimer->uTimeElapsed; if ( v24 > 0 ) - { - *(int *)v23 = v24; - } + pPlayers[pl]->field_E0 = v24; else { - *(int *)v23 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_E0 = 0; + viewparams->bRedrawGameUI = true; } } - v25 = (int)&v21->field_E4; - if ( v21->field_E4 ) + if ( pPlayers[pl]->field_E4 ) { - v26 = *(int *)v25 - pEventTimer->uTimeElapsed; + v26 = pPlayers[pl]->field_E4 - pEventTimer->uTimeElapsed; if ( v26 > 0 ) - { - *(int *)v25 = v26; - } + pPlayers[pl]->field_E4 = v26; else { - *(int *)v25 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_E4 = 0; + viewparams->bRedrawGameUI = true; } } - v27 = (int)&v21->field_E8; - if ( v21->field_E8 ) + if ( pPlayers[pl]->field_E8 ) { - v28 = *(int *)v27 - pEventTimer->uTimeElapsed; + v28 = pPlayers[pl]->field_E8 - pEventTimer->uTimeElapsed; if ( v28 > 0 ) - { - *(int *)v27 = v28; - } + pPlayers[pl]->field_E8 = v28; else { - *(int *)v27 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_E8 = 0; + viewparams->bRedrawGameUI = true; } } - v29 = (int)&v21->field_EC; - if ( v21->field_EC ) + if ( pPlayers[pl]->field_EC ) { - v30 = *(int *)v29 - pEventTimer->uTimeElapsed; + v30 = pPlayers[pl]->field_EC - pEventTimer->uTimeElapsed; if ( v30 > 0 ) - { - *(int *)v29 = v30; - } + pPlayers[pl]->field_EC = v30; else { - *(int *)v29 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_EC = 0; + viewparams->bRedrawGameUI = true; + } + } + if ( pPlayers[pl]->field_F0 ) + { + v32 = pPlayers[pl]->field_F0 - pEventTimer->uTimeElapsed; + if ( v32 > 0 ) + pPlayers[pl]->field_F0 = v32; + else + { + pPlayers[pl]->field_F0 = 0; + viewparams->bRedrawGameUI = true; } } - v31 = (int)&v21->field_F0; - if ( v21->field_F0 ) + if ( pPlayers[pl]->field_F4 ) { - v32 = *(int *)v31 - pEventTimer->uTimeElapsed; - if ( v32 > 0 ) - { - *(int *)v31 = v32; - } + v34 = pPlayers[pl]->field_F4 - pEventTimer->uTimeElapsed; + if ( v34 > 0 ) + pPlayers[pl]->field_F4 = v34; else { - *(int *)v31 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_F4 = 0; + viewparams->bRedrawGameUI = true; } } - v33 = (int)&v21->field_F4; - if ( v21->field_F4 ) + if ( pPlayers[pl]->field_F8 ) { - v34 = *(int *)v33 - pEventTimer->uTimeElapsed; - if ( v34 > 0 ) - { - *(int *)v33 = v34; - } + v36 = pPlayers[pl]->field_F8 - pEventTimer->uTimeElapsed; + if ( v36 > 0 ) + pPlayers[pl]->field_F8 = v36; else { - *(int *)v33 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_F8 = 0; + viewparams->bRedrawGameUI = true; } } - v35 = (int)&v21->field_F8; - if ( v21->field_F8 ) + if ( pPlayers[pl]->field_FC ) { - v36 = *(int *)v35 - pEventTimer->uTimeElapsed; - if ( v36 > 0 ) - { - *(int *)v35 = v36; - } + v38 = pPlayers[pl]->field_FC - pEventTimer->uTimeElapsed; + if ( v38 > 0 ) + pPlayers[pl]->field_FC = v38; else { - *(int *)v35 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_FC = 0; + viewparams->bRedrawGameUI = true; } } - v37 = (int)&v21->field_FC; - if ( v21->field_FC ) + if ( pPlayers[pl]->field_100 ) { - v38 = *(int *)v37 - pEventTimer->uTimeElapsed; - if ( v38 > 0 ) - { - *(int *)v37 = v38; - } + v40 = pPlayers[pl]->field_100 - pEventTimer->uTimeElapsed; + if ( v40 > 0 ) + pPlayers[pl]->field_100 = v40; else { - *(int *)v37 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_100 = 0; + viewparams->bRedrawGameUI = true; } } - v39 = (int)&v21->field_100; - if ( v21->field_100 ) + if ( pPlayers[pl]->field_104 ) { - v40 = *(int *)v39 - pEventTimer->uTimeElapsed; - if ( v40 > 0 ) - { - *(int *)v39 = v40; - } + v42 = pPlayers[pl]->field_104 - pEventTimer->uTimeElapsed; + if ( v42 > 0 ) + pPlayers[pl]->field_104 = v42; else { - *(int *)v39 = 0; - viewparams->bRedrawGameUI = 1; + pPlayers[pl]->field_104 = 0; + viewparams->bRedrawGameUI = true; } } - v41 = (int)&v21->field_104; - if ( v21->field_104 ) - { - v42 = *(int *)v41 - pEventTimer->uTimeElapsed; - if ( v42 > 0 ) - { - *(int *)v41 = v42; - } - else - { - *(int *)v41 = 0; - viewparams->bRedrawGameUI = 1; - } - } - if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) - --v65; - v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; + if ( pPlayers[pl]->pConditions[Condition_Sleep] | pPlayers[pl]->pConditions[Condition_Paralyzed] + | pPlayers[pl]->pConditions[Condition_Unconcious] | pPlayers[pl]->pConditions[Condition_Dead] + | pPlayers[pl]->pConditions[Condition_Pertified] | pPlayers[pl]->pConditions[Condition_Eradicated] ) + --party_condition_flag; + v43 = (signed __int64)pPlayers[pl]->pPlayerBuffs[PLAYER_BUFF_HASTE].uExpireTime > 0; //спешка - for (uint k = 0; k < 24; ++k) - v21->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed); + for ( uint k = 0; k < 24; ++k ) + pPlayers[pl]->pPlayerBuffs[k].IsBuffExpiredToTime(pParty->uTimePlayed); - if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) - v21->SetCondition(1u, 0); - ++v62; + if ( v43 && (signed __int64)pPlayers[pl]->pPlayerBuffs[7].uExpireTime <= 0 ) + pPlayers[pl]->SetCondition(Condition_Weak, 0); } - while ( (signed int)v62 <= (signed int)&pPlayers[4] ); + v46 = (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime > 0; for (uint i = 0; i < 20; ++i) { if (pParty->pPartyBuffs[i].IsBuffExpiredToTime(pParty->uTimePlayed) == 1) - viewparams->bRedrawGameUI = 1; + viewparams->bRedrawGameUI = true; } if ( v46 && (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_HASTE].uExpireTime <= 0 ) @@ -1049,42 +939,36 @@ } } - v51 = v65; - if ( v65 ) - goto LABEL_135; - if ( pCurrentScreen != SCREEN_REST ) - { - v52 = (signed int)&pPlayers[1]; - while ( 1 ) - { - v53 = *(int *)v52; - if ( *(_QWORD *)(*(int *)v52 + 16) ) - break; - v52 += 4; - if ( v52 > (signed int)&pPlayers[4] ) - goto LABEL_135; - } - *(int *)(v53 + 16) = 0; - *(int *)(v53 + 20) = 0; - v51 = 1; -LABEL_135: - if ( pCurrentScreen != SCREEN_REST - && (!v51 || dword_5C35C0) ) - uGameState = GAME_STATE_PARTY_DIED; - } - if ( uActiveCharacter ) + if ( !party_condition_flag ) { if ( pCurrentScreen != SCREEN_REST ) { - v54 = pPlayers[uActiveCharacter]; - if ( v54->pConditions[2] - || v54->pConditions[12] - || v54->pConditions[13] - || v54->pConditions[14] - || v54->pConditions[15] - || v54->pConditions[16] ) + for ( uint pl = 1; pl <= 4; pl++ ) { - viewparams->bRedrawGameUI = 1; + if ( pPlayers[pl]->pConditions[Condition_Sleep] ) + { + pPlayers[pl]->pConditions[Condition_Sleep] = 0; + party_condition_flag = 1; + break; + } + } + if ( !party_condition_flag || dword_5C35C0 ) + uGameState = GAME_STATE_PARTY_DIED; + } + } + + if ( uActiveCharacter )//выбор следующего после пропускающего ход + { + if ( pCurrentScreen != SCREEN_REST ) + { + if ( pPlayers[uActiveCharacter]->pConditions[Condition_Sleep] + || pPlayers[uActiveCharacter]->pConditions[Condition_Paralyzed] + || pPlayers[uActiveCharacter]->pConditions[Condition_Unconcious] + || pPlayers[uActiveCharacter]->pConditions[Condition_Dead] + || pPlayers[uActiveCharacter]->pConditions[Condition_Pertified] + || pPlayers[uActiveCharacter]->pConditions[Condition_Eradicated] ) + { + viewparams->bRedrawGameUI = true; uActiveCharacter = pParty->GetNextActiveCharacter(); } }