Mercurial > might-and-magic-trilogy
diff mm7_4.cpp @ 26:93bf1d5f6a6d
Game loading.
author | Nomad |
---|---|
date | Tue, 16 Oct 2012 00:05:53 +0200 |
parents | 2bbf33898c6b |
children | be2066176d89 |
line wrap: on
line diff
--- a/mm7_4.cpp Mon Oct 15 18:45:11 2012 +0200 +++ b/mm7_4.cpp Tue Oct 16 00:05:53 2012 +0200 @@ -3811,7 +3811,6 @@ } return result; } -// 493938: using guessed type char var_22C[400]; @@ -3853,12 +3852,12 @@ 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 + //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 + //void *v10; // esi@25 unsigned int v11; // ecx@27 signed int v12; // edi@29 Player *v13; // ecx@30 @@ -3892,13 +3891,13 @@ int v41; // eax@95 int v42; // ecx@96 bool v43; // ebx@102 - SpellBuff *v44; // edi@104 - signed int v45; // ebp@104 + //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 + //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 @@ -3923,54 +3922,37 @@ v1 = v0; v0 /= 60i64; v2 = v0; - v3 = (unsigned int)v0 / 0x18; + v3 = (unsigned int)v0 / 24; v4 = (unsigned int)(v3 / 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 % 0x1C; - pParty->uCurrentMonth = v4 % 0xC; + pParty->uDaysPlayed = (unsigned int)v3 % 28; + pParty->uCurrentMonth = v4 % 12; pParty->uCurrentYear = v4 / 0xC + 1168; - if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 0x1C > v61) ) - { - v5 = 0; - pParty->pHirelings[0].bHasUsedTheAbility = 0; - pParty->pHirelings[1].bHasUsedTheAbility = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) - { - v6 = (char *)&pNPCStats->pNewNPCData[0].bHasUsedTheAbility; - do - { - *(int *)v6 = 0; - ++v5; - v6 += 76; - } - while ( v5 < (signed int)pNPCStats->uNumNewNPCs ); - } + if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) + { + pParty->pHirelings[0].bHasUsedTheAbility = false; + pParty->pHirelings[1].bHasUsedTheAbility = false; + + for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) + pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; + ++pParty->field_764; if ( pParty->field_764 > 1u ) { - v7 = pParty->pPlayers; - do - { - v7->SetCondition(1u, 0); - ++v7; - } - while ( (signed int)v7 < (signed int)pParty->pHirelings ); + for (uint i = 0; i < 4; ++i) + pParty->pPlayers[i].SetCondition(1, 0); + if ( pParty->uNumFoodRations ) { Party::TakeFood(1u); } else { - v8 = (char *)&pParty->pPlayers[0].sHealth; - do - { - *(int *)v8 = *(int *)v8 / ((unsigned __int8)pParty->field_764 + 1) + 1; - v8 += 6972; - } - while ( (signed int)v8 < (signed int)&pParty->field_871C[567] ); + for (uint i = 0; i < 4; ++i) + pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / ((unsigned __int8)pParty->field_764 + 1) + 1; } if ( pParty->field_764 > 3u ) { @@ -4003,13 +3985,9 @@ } if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) pOutdoor->SetFog(); - v10 = &pParty->pPlayers[0].uNumDivineInterventionCastsThisDay; - do - { - memset(v10, 0, 4u); - v10 = (char *)v10 + 6972; - } - while ( (signed int)v10 < (signed int)&pParty->field_871C[694] ); + + for (uint i = 0; i < 4; ++i) + pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; } v11 = LODWORD(pParty->uTimePlayed); if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) @@ -4247,58 +4225,46 @@ 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; - v44 = v21->pPlayerBuffs; - v45 = 24; - do - { - v44->_4585CA(pParty->uTimePlayed); - ++v44; - --v45; - } - while ( v45 ); + + for (uint k = 0; k < 24; ++k) + v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); + if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) v21->SetCondition(1u, 0); ++v62; } while ( (signed int)v62 <= (signed int)&pPlayers[4] ); v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; - v47 = pParty->pPartyBuffs; - do - { - if ( v47->_4585CA(pParty->uTimePlayed) == 1 ) + + for (uint i = 0; i < 20; ++i) + { + if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) viewparams->bRedrawGameUI = 1; - ++v47; - } - while ( (signed int)v47 < (signed int)pParty->pPlayers ); + } + if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) { - v48 = &pPlayers[1]; - do - { - (*v48)->SetCondition(1u, 0); - ++v48; - } - while ( (signed int)v48 <= (signed int)&pPlayers[4] ); - } - v49 = (signed int)dword_4EE07C; - do - { - v50 = (char *)&pParty->pPartyBuffs[*(int *)v49]; - if ( *(_QWORD *)v50 > 0i64 ) - { - if ( !(v50[15] & 1) ) - { - if ( !pPlayers[(unsigned __int8)v50[14]]->CanAct() ) - { - ((SpellBuff *)v50)->Reset(); - if ( *(int *)v49 == 7 ) - pParty->bFlying = 0; - } - } - } - v49 += 4; - } - while ( v49 < (signed int)&unk_4EE084 ); + for (uint i = 0; i < 4; ++i) + pParty->pPlayers[i].SetCondition(1, 0); + } + + for (uint i = 0; i < 2; ++i) + { + auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; + if (pBuf->uExpireTime == 0) + continue; + + if ( !(pBuf->uFlags & 1) ) + { + if (!pPlayers[pBuf->uCaster]->CanAct()) + { + pBuf->Reset(); + if (dword_4EE07C[i] == 7 ) + pParty->bFlying = false; + } + } + } + v51 = v65; if ( v65 ) goto LABEL_135; @@ -9737,7 +9703,7 @@ v10 = result->field_152; result = (Player *)_449B57_test_bit((unsigned __int8 *)result->field_152, 1); if ( !(short)result ) - result = (Player *)_449B7E_toggle_bit(v10, 1, 1u); + result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); } ++v8; }