Mercurial > might-and-magic-trilogy
comparison mm7_4.cpp @ 26:93bf1d5f6a6d
Game loading.
author | Nomad |
---|---|
date | Tue, 16 Oct 2012 00:05:53 +0200 |
parents | 2bbf33898c6b |
children | be2066176d89 |
comparison
equal
deleted
inserted
replaced
25:2bbf33898c6b | 26:93bf1d5f6a6d |
---|---|
3809 } | 3809 } |
3810 } | 3810 } |
3811 } | 3811 } |
3812 return result; | 3812 return result; |
3813 } | 3813 } |
3814 // 493938: using guessed type char var_22C[400]; | |
3815 | 3814 |
3816 | 3815 |
3817 | 3816 |
3818 //----- (00493F79) -------------------------------------------------------- | 3817 //----- (00493F79) -------------------------------------------------------- |
3819 int sub_493F79(stru351 *_this, __int64 a2) | 3818 int sub_493F79(stru351 *_this, __int64 a2) |
3851 signed __int64 v0; // qax@1 | 3850 signed __int64 v0; // qax@1 |
3852 signed __int64 v1; // ST30_8@1 | 3851 signed __int64 v1; // ST30_8@1 |
3853 signed __int64 v2; // ST38_8@1 | 3852 signed __int64 v2; // ST38_8@1 |
3854 unsigned __int64 v3; // qax@1 | 3853 unsigned __int64 v3; // qax@1 |
3855 unsigned int v4; // edi@1 | 3854 unsigned int v4; // edi@1 |
3856 signed int v5; // eax@4 | 3855 //signed int v5; // eax@4 |
3857 char *v6; // ecx@5 | 3856 //char *v6; // ecx@5 |
3858 Player *v7; // esi@8 | 3857 //Player *v7; // esi@8 |
3859 char *v8; // ecx@12 | 3858 //char *v8; // ecx@12 |
3860 Player *pPlayer; // esi@15 | 3859 Player *pPlayer; // esi@15 |
3861 void *v10; // esi@25 | 3860 //void *v10; // esi@25 |
3862 unsigned int v11; // ecx@27 | 3861 unsigned int v11; // ecx@27 |
3863 signed int v12; // edi@29 | 3862 signed int v12; // edi@29 |
3864 Player *v13; // ecx@30 | 3863 Player *v13; // ecx@30 |
3865 Player *v14; // esi@35 | 3864 Player *v14; // esi@35 |
3866 double v15; // st7@35 | 3865 double v15; // st7@35 |
3890 int v39; // eax@91 | 3889 int v39; // eax@91 |
3891 int v40; // ecx@92 | 3890 int v40; // ecx@92 |
3892 int v41; // eax@95 | 3891 int v41; // eax@95 |
3893 int v42; // ecx@96 | 3892 int v42; // ecx@96 |
3894 bool v43; // ebx@102 | 3893 bool v43; // ebx@102 |
3895 SpellBuff *v44; // edi@104 | 3894 //SpellBuff *v44; // edi@104 |
3896 signed int v45; // ebp@104 | 3895 //signed int v45; // ebp@104 |
3897 bool v46; // edi@111 | 3896 bool v46; // edi@111 |
3898 SpellBuff *v47; // esi@113 | 3897 //SpellBuff *v47; // esi@113 |
3899 Player **v48; // esi@119 | 3898 //Player **v48; // esi@119 |
3900 signed int v49; // edi@121 | 3899 //signed int v49; // edi@121 |
3901 char *v50; // esi@122 | 3900 //char *v50; // esi@122 |
3902 signed int v51; // edx@128 | 3901 signed int v51; // edx@128 |
3903 signed int v52; // ecx@130 | 3902 signed int v52; // ecx@130 |
3904 int v53; // eax@131 | 3903 int v53; // eax@131 |
3905 Player *v54; // eax@141 | 3904 Player *v54; // eax@141 |
3906 unsigned int v55; // [sp-8h] [bp-38h]@18 | 3905 unsigned int v55; // [sp-8h] [bp-38h]@18 |
3921 pParty->uTimePlayed += (signed int)pEventTimer->uTimeElapsed; | 3920 pParty->uTimePlayed += (signed int)pEventTimer->uTimeElapsed; |
3922 v0 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; | 3921 v0 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60; |
3923 v1 = v0; | 3922 v1 = v0; |
3924 v0 /= 60i64; | 3923 v0 /= 60i64; |
3925 v2 = v0; | 3924 v2 = v0; |
3926 v3 = (unsigned int)v0 / 0x18; | 3925 v3 = (unsigned int)v0 / 24; |
3927 v4 = (unsigned int)(v3 / 7) >> 2; | 3926 v4 = (unsigned int)(v3 / 7) >> 2; |
3928 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; | 3927 pParty->uCurrentTimeSecond = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) % 60; |
3929 pParty->uCurrentMinute = v1 % 60; | 3928 pParty->uCurrentMinute = v1 % 60; |
3930 pParty->uCurrentMonthWeek = v3 / 7 & 3; | 3929 pParty->uCurrentMonthWeek = v3 / 7 & 3; |
3931 pParty->uCurrentHour = v2 % 24; | 3930 pParty->uCurrentHour = v2 % 24; |
3932 pParty->uDaysPlayed = (unsigned int)v3 % 0x1C; | 3931 pParty->uDaysPlayed = (unsigned int)v3 % 28; |
3933 pParty->uCurrentMonth = v4 % 0xC; | 3932 pParty->uCurrentMonth = v4 % 12; |
3934 pParty->uCurrentYear = v4 / 0xC + 1168; | 3933 pParty->uCurrentYear = v4 / 0xC + 1168; |
3935 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 0x1C > v61) ) | 3934 if ( pParty->uCurrentHour >= 3 && ((signed int)a2 < 3 || (unsigned int)v3 % 28 > v61) ) |
3936 { | 3935 { |
3937 v5 = 0; | 3936 pParty->pHirelings[0].bHasUsedTheAbility = false; |
3938 pParty->pHirelings[0].bHasUsedTheAbility = 0; | 3937 pParty->pHirelings[1].bHasUsedTheAbility = false; |
3939 pParty->pHirelings[1].bHasUsedTheAbility = 0; | 3938 |
3940 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | 3939 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) |
3941 { | 3940 pNPCStats->pNewNPCData[i].bHasUsedTheAbility = false; |
3942 v6 = (char *)&pNPCStats->pNewNPCData[0].bHasUsedTheAbility; | 3941 |
3943 do | |
3944 { | |
3945 *(int *)v6 = 0; | |
3946 ++v5; | |
3947 v6 += 76; | |
3948 } | |
3949 while ( v5 < (signed int)pNPCStats->uNumNewNPCs ); | |
3950 } | |
3951 ++pParty->field_764; | 3942 ++pParty->field_764; |
3952 if ( pParty->field_764 > 1u ) | 3943 if ( pParty->field_764 > 1u ) |
3953 { | 3944 { |
3954 v7 = pParty->pPlayers; | 3945 for (uint i = 0; i < 4; ++i) |
3955 do | 3946 pParty->pPlayers[i].SetCondition(1, 0); |
3956 { | 3947 |
3957 v7->SetCondition(1u, 0); | |
3958 ++v7; | |
3959 } | |
3960 while ( (signed int)v7 < (signed int)pParty->pHirelings ); | |
3961 if ( pParty->uNumFoodRations ) | 3948 if ( pParty->uNumFoodRations ) |
3962 { | 3949 { |
3963 Party::TakeFood(1u); | 3950 Party::TakeFood(1u); |
3964 } | 3951 } |
3965 else | 3952 else |
3966 { | 3953 { |
3967 v8 = (char *)&pParty->pPlayers[0].sHealth; | 3954 for (uint i = 0; i < 4; ++i) |
3968 do | 3955 pParty->pPlayers[i].sHealth = pParty->pPlayers[i].sHealth / ((unsigned __int8)pParty->field_764 + 1) + 1; |
3969 { | |
3970 *(int *)v8 = *(int *)v8 / ((unsigned __int8)pParty->field_764 + 1) + 1; | |
3971 v8 += 6972; | |
3972 } | |
3973 while ( (signed int)v8 < (signed int)&pParty->field_871C[567] ); | |
3974 } | 3956 } |
3975 if ( pParty->field_764 > 3u ) | 3957 if ( pParty->field_764 > 3u ) |
3976 { | 3958 { |
3977 pPlayer = pParty->pPlayers; | 3959 pPlayer = pParty->pPlayers; |
3978 do | 3960 do |
4001 while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); | 3983 while ( (signed int)pPlayer < (signed int)pParty->pHirelings ); |
4002 } | 3984 } |
4003 } | 3985 } |
4004 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) | 3986 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
4005 pOutdoor->SetFog(); | 3987 pOutdoor->SetFog(); |
4006 v10 = &pParty->pPlayers[0].uNumDivineInterventionCastsThisDay; | 3988 |
4007 do | 3989 for (uint i = 0; i < 4; ++i) |
4008 { | 3990 pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; |
4009 memset(v10, 0, 4u); | |
4010 v10 = (char *)v10 + 6972; | |
4011 } | |
4012 while ( (signed int)v10 < (signed int)&pParty->field_871C[694] ); | |
4013 } | 3991 } |
4014 v11 = LODWORD(pParty->uTimePlayed); | 3992 v11 = LODWORD(pParty->uTimePlayed); |
4015 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) | 3993 if ( pParty->uFlags & 4 && pParty->field_6FC < (signed __int64)pParty->uTimePlayed ) |
4016 { | 3994 { |
4017 v12 = 1; | 3995 v12 = 1; |
4245 } | 4223 } |
4246 } | 4224 } |
4247 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) | 4225 if ( v21->pConditions[2] | v21->pConditions[12] | v21->pConditions[13] | v21->pConditions[14] | v21->pConditions[15] | v21->pConditions[16] ) |
4248 --v65; | 4226 --v65; |
4249 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; | 4227 v43 = (signed __int64)v21->pPlayerBuffs[7].uExpireTime > 0; |
4250 v44 = v21->pPlayerBuffs; | 4228 |
4251 v45 = 24; | 4229 for (uint k = 0; k < 24; ++k) |
4252 do | 4230 v21->pPlayerBuffs[k]._4585CA(pParty->uTimePlayed); |
4253 { | 4231 |
4254 v44->_4585CA(pParty->uTimePlayed); | |
4255 ++v44; | |
4256 --v45; | |
4257 } | |
4258 while ( v45 ); | |
4259 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) | 4232 if ( v43 && (signed __int64)v21->pPlayerBuffs[7].uExpireTime <= 0 ) |
4260 v21->SetCondition(1u, 0); | 4233 v21->SetCondition(1u, 0); |
4261 ++v62; | 4234 ++v62; |
4262 } | 4235 } |
4263 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); | 4236 while ( (signed int)v62 <= (signed int)&pPlayers[4] ); |
4264 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; | 4237 v46 = (signed __int64)pParty->pPartyBuffs[8].uExpireTime > 0; |
4265 v47 = pParty->pPartyBuffs; | 4238 |
4266 do | 4239 for (uint i = 0; i < 20; ++i) |
4267 { | 4240 { |
4268 if ( v47->_4585CA(pParty->uTimePlayed) == 1 ) | 4241 if (pParty->pPartyBuffs[i]._4585CA(pParty->uTimePlayed) == 1) |
4269 viewparams->bRedrawGameUI = 1; | 4242 viewparams->bRedrawGameUI = 1; |
4270 ++v47; | 4243 } |
4271 } | 4244 |
4272 while ( (signed int)v47 < (signed int)pParty->pPlayers ); | |
4273 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) | 4245 if ( v46 && (signed __int64)pParty->pPartyBuffs[8].uExpireTime <= 0 ) |
4274 { | 4246 { |
4275 v48 = &pPlayers[1]; | 4247 for (uint i = 0; i < 4; ++i) |
4276 do | 4248 pParty->pPlayers[i].SetCondition(1, 0); |
4277 { | 4249 } |
4278 (*v48)->SetCondition(1u, 0); | 4250 |
4279 ++v48; | 4251 for (uint i = 0; i < 2; ++i) |
4280 } | 4252 { |
4281 while ( (signed int)v48 <= (signed int)&pPlayers[4] ); | 4253 auto pBuf = &pParty->pPartyBuffs[dword_4EE07C[i]]; |
4282 } | 4254 if (pBuf->uExpireTime == 0) |
4283 v49 = (signed int)dword_4EE07C; | 4255 continue; |
4284 do | 4256 |
4285 { | 4257 if ( !(pBuf->uFlags & 1) ) |
4286 v50 = (char *)&pParty->pPartyBuffs[*(int *)v49]; | 4258 { |
4287 if ( *(_QWORD *)v50 > 0i64 ) | 4259 if (!pPlayers[pBuf->uCaster]->CanAct()) |
4288 { | 4260 { |
4289 if ( !(v50[15] & 1) ) | 4261 pBuf->Reset(); |
4290 { | 4262 if (dword_4EE07C[i] == 7 ) |
4291 if ( !pPlayers[(unsigned __int8)v50[14]]->CanAct() ) | 4263 pParty->bFlying = false; |
4292 { | 4264 } |
4293 ((SpellBuff *)v50)->Reset(); | 4265 } |
4294 if ( *(int *)v49 == 7 ) | 4266 } |
4295 pParty->bFlying = 0; | 4267 |
4296 } | |
4297 } | |
4298 } | |
4299 v49 += 4; | |
4300 } | |
4301 while ( v49 < (signed int)&unk_4EE084 ); | |
4302 v51 = v65; | 4268 v51 = v65; |
4303 if ( v65 ) | 4269 if ( v65 ) |
4304 goto LABEL_135; | 4270 goto LABEL_135; |
4305 if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 5 ) | 4271 if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 5 ) |
4306 { | 4272 { |
9735 if ( pParty->uFine ) | 9701 if ( pParty->uFine ) |
9736 { | 9702 { |
9737 v10 = result->field_152; | 9703 v10 = result->field_152; |
9738 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->field_152, 1); | 9704 result = (Player *)_449B57_test_bit((unsigned __int8 *)result->field_152, 1); |
9739 if ( !(short)result ) | 9705 if ( !(short)result ) |
9740 result = (Player *)_449B7E_toggle_bit(v10, 1, 1u); | 9706 result = (Player *)_449B7E_toggle_bit((unsigned char *)v10, 1, 1u); |
9741 } | 9707 } |
9742 ++v8; | 9708 ++v8; |
9743 } | 9709 } |
9744 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); | 9710 while ( (signed int)v8 <= (signed int)&pPlayers[4] ); |
9745 return result; | 9711 return result; |