comparison mm7_3.cpp @ 363:2bc1c8d68f41

Allocator and SpellCost Tip
author Gloval
date Fri, 22 Feb 2013 00:48:54 +0400
parents 5f36449527c6
children edd2d8b7e3c4
comparison
equal deleted inserted replaced
359:57d81602e72c 363:2bc1c8d68f41
14209 } 14209 }
14210 14210
14211 14211
14212 //----- (00443FDC) -------------------------------------------------------- 14212 //----- (00443FDC) --------------------------------------------------------
14213 void OnMapLoad() 14213 void OnMapLoad()
14214 { 14214 {
14215 stru176 *v3; // esi@7 14215 stru176 *v3; // esi@7
14216 __int16 v4; // cx@9 14216 __int16 v4; // cx@9
14217 __int16 v5; // di@9 14217 __int16 v5; // di@9
14218 int v6; // eax@9 14218 int v6; // eax@9
14219 signed __int64 v8; // qax@26 14219 signed __int64 v8; // qax@26
14220 unsigned int v9; // ecx@26 14220 unsigned int v9; // ecx@26
14221 signed __int64 v10; // qax@26 14221 signed __int64 v10; // qax@26
14222 signed __int64 v11; // qax@26 14222 signed __int64 v11; // qax@26
14223 int v12; // ST50_4@26 14223 int v12; // ST50_4@26
14224 signed __int64 v13; // qax@26 14224 signed __int64 v13; // qax@26
14225 signed __int64 v14; // qax@26 14225 signed __int64 v14; // qax@26
14226 int v15; // ST58_4@26 14226 int v15; // ST58_4@26
14227 signed __int64 v16; // qax@26 14227 signed __int64 v16; // qax@26
14228 int hours; // ebx@26 14228 int hours; // ebx@26
14229 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 14229 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12
14230 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 14230 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26
14231 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 14231 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7
14232 int minutes; // [sp+2Ch] [bp-24h]@26 14232 int minutes; // [sp+2Ch] [bp-24h]@26
14233 int month; // [sp+34h] [bp-1Ch]@26 14233 int years; // [sp+34h] [bp-1Ch]@26
14234 int weeks; // [sp+38h] [bp-18h]@26 14234 int weeks; // [sp+38h] [bp-18h]@26
14235 int v26; // [sp+3Ch] [bp-14h]@15 14235 int v26; // [sp+3Ch] [bp-14h]@15
14236 int days; // [sp+3Ch] [bp-14h]@26 14236 int days; // [sp+3Ch] [bp-14h]@26
14237 int v28; // [sp+40h] [bp-10h]@26 14237 int months; // [sp+40h] [bp-10h]@26
14238 __int16 v29; // [sp+46h] [bp-Ah]@9 14238 __int16 v29; // [sp+46h] [bp-Ah]@9
14239 __int16 v30; // [sp+48h] [bp-8h]@9 14239 __int16 v30; // [sp+48h] [bp-8h]@9
14240 __int16 v31; // [sp+4Ah] [bp-6h]@9 14240 __int16 v31; // [sp+4Ah] [bp-6h]@9
14241 __int16 v32; // [sp+4Ch] [bp-4h]@9 14241 __int16 v32; // [sp+4Ch] [bp-4h]@9
14242 __int16 v33; // [sp+4Eh] [bp-2h]@9 14242 __int16 v33; // [sp+4Eh] [bp-2h]@9
14243 14243
14244 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) 14244 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
14245 { 14245 {
14246 auto pEvent = pLevelEVT_Index[i]; 14246 auto pEvent = pLevelEVT_Index[i];
14247 14247
14248 auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT); 14248 auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT);
14249 14249
14250 if (_evt->_e_type == EVENT_PlaySound) 14250 if (_evt->_e_type == EVENT_PlaySound)
14251 { 14251 {
14252 pSoundList->LoadSound( 14252 pSoundList->LoadSound(
14253 _evt->v5 + 14253 _evt->v5 +
14254 ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8), 14254 ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8),
14255 0); 14255 0);
14256 } 14256 }
14257 else if (_evt->_e_type == EVENT_OnMapReload) 14257 else if (_evt->_e_type == EVENT_OnMapReload)
14258 { 14258 {
14259 start_event_seq_number = pEvent.event_sequence_num; 14259 start_event_seq_number = pEvent.event_sequence_num;
14260 EventProcessor(pEvent.uEventID, 0, 0); 14260 EventProcessor(pEvent.uEventID, 0, 0);
14261 start_event_seq_number = 0; 14261 start_event_seq_number = 0;
14262 } 14262 }
14263 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer) 14263 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_OnLongTimer)
14264 { 14264 {
14265 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; 14265 v3 = &array_5B5928_timers[dword_5B65C8_timers_count];
14266 v20 = pOutdoor->uLastVisitDay; 14266 v20 = pOutdoor->uLastVisitDay;
14267 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) 14267 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
14268 v20 = pIndoor->stru1.uLastVisitDay; 14268 v20 = pIndoor->stru1.uLastVisitDay;
14269 14269
14270 v3->timer_evt_type = _evt->_e_type; 14270 v3->timer_evt_type = _evt->_e_type;
14271 v3->timer_evt_ID = pEvent.uEventID; 14271 v3->timer_evt_ID = pEvent.uEventID;
14272 v3->timer_evt_seq_num = pEvent.event_sequence_num; 14272 v3->timer_evt_seq_num = pEvent.event_sequence_num;
14273 14273
14274 v3->field_10 = _evt->v5; 14274 v3->field_10 = _evt->v5;
14275 v3->field_12 = _evt->v6; 14275 v3->field_12 = _evt->v6;
14276 v3->field_14 = _evt->v7; 14276 v3->field_14 = _evt->v7;
14277 v3->field_16 = _evt->v8; 14277 v3->field_16 = _evt->v8;
14278 v3->field_18 = _evt->v9; 14278 v3->field_18 = _evt->v9;
14279 v3->field_1A = _evt->v10; 14279 v3->field_1A = _evt->v10;
14280 14280
14281 14281
14282 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; 14282 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11;
14283 14283
14284 v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11; 14284 v3->field_C = ((unsigned short)_evt->v12 << 8) + _evt->v11;
14285 v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11; 14285 v3->field_E = ((unsigned short)_evt->v12 << 8) + _evt->v11;
14286 if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 ) 14286 if (v3->timer_evt_type == EVENT_OnLongTimer && !(short)v6 )
14287 { 14287 {
14288 if ( v20 ) 14288 if ( v20 )
14289 v18 = pParty->uTimePlayed - v20; 14289 v18 = pParty->uTimePlayed - v20;
14290 else 14290 else
14291 v18 = 0i64; 14291 v18 = 0i64;
14292 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; 14292 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24;
14293 14293
14294 if ( v26 / 7 / 4 / 12 ) 14294 if ( v26 / 7 / 4 / 12 )
14295 { 14295 {
14296 if ( v5 ) 14296 if ( v3->field_10 )
14297 { 14297 {
14298 ++dword_5B65C8_timers_count; 14298 ++dword_5B65C8_timers_count;
14299 v3->field_0_time = 0; 14299 v3->field_0_time = 0;
14300 continue; 14300 continue;
14301 } 14301 }
14302 } 14302 }
14303 if (v26 / 7 / 4 != 0 && v33 != 0 || 14303 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 ||
14304 v26 / 7 != 0 && v32 != 0 || 14304 v26 / 7 != 0 && v3->field_14 != 0 ||
14305 v26 != 0 || !v20) 14305 v26 != 0 || !v20)
14306 { 14306 {
14307 ++dword_5B65C8_timers_count; 14307 ++dword_5B65C8_timers_count;
14308 v3->field_0_time = 0; 14308 v3->field_0_time = 0;
14309 continue; 14309 continue;
14310 } 14310 }
14311 } 14311 }
14312 else 14312 else
14313 { 14313 {
14314 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); 14314 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375);
14315 v9 = v8; 14315 v9 = v8;
14316 v10 = (signed int)v8 / 60; 14316 v10 = (signed int)v8 / 60;
14317 minutes = v10 % 60; 14317 minutes = v10 % 60;
14318 v11 = (signed int)(v10 / 60); 14318 v11 = (signed int)(v10 / 60);
14319 v12 = v11 % 24; 14319 v12 = v11 % 24;
14320 v13 = (signed int)(v11 / 24); 14320 v13 = (signed int)(v11 / 24);
14321 days = v13 % 7; 14321 days = v13 % 7;
14322 v14 = (signed int)(v13 / 7); 14322 v14 = (signed int)(v13 / 7);
14323 v15 = v14 % 4; 14323 v15 = v14 % 4;
14324 v16 = (signed int)(v14 / 4); 14324 v16 = (signed int)(v14 / 4);
14325 month = v16 / 12; 14325 years = v16 / 12;
14326 14326
14327 auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; 14327 auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32;
14328 auto _2 = ((__int64)v9 << 32) | _1; 14328 auto _2 = ((__int64)v9 << 32) | _1;
14329 14329
14330 seconds = _2 % 60; 14330 seconds = _2 % 60;
14331 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, 14331 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32,
14332 // v9) 14332 // v9)
14333 // % 60; 14333 // % 60;
14334 14334
14335 hours = v12; 14335 hours = v12;
14336 weeks = v15; 14336 weeks = v15;
14337 v28 = v16 % 12; 14337 months = v16 % 12;
14338 if ( v5 ) 14338 if ( v3->field_10 )
14339 { 14339 {
14340 ++month; 14340 ++years;
14341 } 14341 }
14342 else 14342 else
14343 { 14343 {
14344 if ( v33 ) 14344 if ( v3->field_12 )
14345 { 14345 {
14346 ++v28; 14346 ++months;
14347 } 14347 }
14348 else 14348 else
14349 { 14349 {
14350 if ( v32 ) 14350 if ( v3->field_14 )
14351 { 14351 {
14352 ++weeks; 14352 ++weeks;
14353 } 14353 }
14354 else 14354 else
14355 { 14355 {
14356 ++days; 14356 ++days;
14357 minutes = v30; 14357 minutes = v3->field_18;
14358 hours = v31; 14358 hours = v3->field_16;
14359 seconds = v29; 14359 seconds = v3->field_1A;
14360 } 14360 }
14361 } 14361 }
14362 } 14362 }
14363 v3->field_0_time = (signed __int64)((double)((seconds 14363 v3->field_0_time = (signed __int64)((double)((seconds
14364 + 60 * minutes 14364 + 60 * minutes
14365 + 3600 * hours 14365 + 3600 * hours
14366 + 0x93A80 * weeks 14366 + 0x93A80 * weeks
14367 + 0x15180 * days 14367 + 0x15180 * days
14368 + 0x24EA00 * (v28 + 12i64 * month)) << 7) 14368 + 0x24EA00 * (months + 12i64 * years)) << 7)
14369 * 0.033333335); 14369 * 0.033333335);
14370 14370
14371 ++dword_5B65C8_timers_count; 14371 ++dword_5B65C8_timers_count;
14372 } 14372 }
14373 } 14373 }
14374 } 14374 }
14375 } 14375 }
14376 14376
14377 //----- (00444360) -------------------------------------------------------- 14377 //----- (00444360) --------------------------------------------------------
14378 void __thiscall Level_LoadEvtAndStr(const char *pLevelName) 14378 void __thiscall Level_LoadEvtAndStr(const char *pLevelName)
14379 { 14379 {
14380 char pContainerName[120]; // [sp+8h] [bp-98h]@1 14380 char pContainerName[120]; // [sp+8h] [bp-98h]@1
15114 } 15114 }
15115 else if (v16 == 9) 15115 else if (v16 == 9)
15116 strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession)); 15116 strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession));
15117 else if (v16 == 19) 15117 else if (v16 == 19)
15118 { 15118 {
15119 __debugbreak(); // learn conditions of this event 15119 // __debugbreak(); // learn conditions of this event Scavenger Hunt
15120 auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23]; 15120 auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23];
15121 if (!topic) 15121 if (!topic)
15122 { 15122 {
15123 v14->pButtonName[0] = 0; 15123 v14->pButtonName[0] = 0;
15124 v14->uControlParam = 0; 15124 v14->uControlParam = 0;