Mercurial > mm7
diff mm7_3.cpp @ 2386:41c36ecc9f32
MapsLongTimer.h
author | Ritor1 |
---|---|
date | Mon, 23 Jun 2014 23:45:14 +0600 |
parents | b4a79e3ef2f0 |
children | eba7123e4a2d |
line wrap: on
line diff
--- a/mm7_3.cpp Sun Jun 22 12:56:25 2014 +0100 +++ b/mm7_3.cpp Mon Jun 23 23:45:14 2014 +0600 @@ -26,7 +26,7 @@ #include "Timer.h" #include "TurnEngine.h" #include "Events2D.h" -#include "stru176.h" +#include "MapsLongTimer.h" #include "stru298.h" #include "texts.h" #include "Level/Decoration.h" @@ -3444,16 +3444,8 @@ //----- (00443FDC) -------------------------------------------------------- void OnMapLoad() { -// __int16 v4; // cx@9 int v6; // eax@9 unsigned __int64 v8; // qax@26 -// unsigned int v9; // ecx@26 - unsigned __int64 v10; // qax@26 - unsigned __int64 v11; // qax@26 - unsigned __int64 v13; // qax@26 - unsigned __int64 v14; // qax@26 -// int v15; // ST58_4@26 - unsigned __int64 v16; // qax@26 int hours; // ebx@26 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 unsigned int seconds; // [sp+14h] [bp-3Ch]@26 @@ -3464,10 +3456,6 @@ int v26; // [sp+3Ch] [bp-14h]@15 unsigned int days; // [sp+3Ch] [bp-14h]@26 unsigned int months; // [sp+40h] [bp-10h]@26 -// __int16 v29; // [sp+46h] [bp-Ah]@9 -// __int16 v30; // [sp+48h] [bp-8h]@9 -// __int16 v32; // [sp+4Ch] [bp-4h]@9 -// __int16 v33; // [sp+4Eh] [bp-2h]@9 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) { @@ -3481,28 +3469,28 @@ EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) { - //v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; + //v3 = &MapsLongTimersList[MapsLongTimers_count]; v20 = pOutdoor->loc_time.uLastVisitDay; if (uCurrentlyLoadedLevelType == LEVEL_Indoor) v20 = pIndoor->stru1.uLastVisitDay; - array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type = _evt->_e_type; - array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_ID = pEvent.uEventID; - array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_seq_num = pEvent.event_sequence_num; - - array_5B5928_timers[dword_5B65C8_timers_count].field_10 = _evt->v5; - array_5B5928_timers[dword_5B65C8_timers_count].field_12 = _evt->v6; - array_5B5928_timers[dword_5B65C8_timers_count].field_14 = _evt->v7; - array_5B5928_timers[dword_5B65C8_timers_count].field_16 = _evt->v8; - array_5B5928_timers[dword_5B65C8_timers_count].field_18 = _evt->v9; - array_5B5928_timers[dword_5B65C8_timers_count].field_1A = _evt->v10; + MapsLongTimersList[MapsLongTimers_count].timer_evt_type = _evt->_e_type; + MapsLongTimersList[MapsLongTimers_count].timer_evt_ID = pEvent.uEventID; + MapsLongTimersList[MapsLongTimers_count].timer_evt_seq_num = pEvent.event_sequence_num; + + MapsLongTimersList[MapsLongTimers_count].YearsInterval = _evt->v5; + MapsLongTimersList[MapsLongTimers_count].MonthsInterval = _evt->v6; + MapsLongTimersList[MapsLongTimers_count].WeeksInterval = _evt->v7; + MapsLongTimersList[MapsLongTimers_count].HoursInterval = _evt->v8; + MapsLongTimersList[MapsLongTimers_count].MinutesInterval = _evt->v9; + MapsLongTimersList[MapsLongTimers_count].SecondsInterval = _evt->v10; v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; - array_5B5928_timers[dword_5B65C8_timers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; - array_5B5928_timers[dword_5B65C8_timers_count].fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; - if (array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type == EVENT_Initialize && !(short)v6 ) + MapsLongTimersList[MapsLongTimers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; + MapsLongTimersList[MapsLongTimers_count].IntervalHalfMins = ((unsigned short)_evt->v12 << 8) + _evt->v11; + if (MapsLongTimersList[MapsLongTimers_count].timer_evt_type == EVENT_Initialize && !(short)v6 ) { if ( v20 ) v18 = pParty->uTimePlayed - v20; @@ -3510,13 +3498,13 @@ v18 = 0; v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; - if ( v26 / 7 / 4 / 12 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_10 || - v26 / 7 / 4 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_12 != 0 || - v26 / 7 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_14 != 0 || + if ( v26 / 7 / 4 / 12 != 0 && MapsLongTimersList[MapsLongTimers_count].YearsInterval || + v26 / 7 / 4 != 0 && MapsLongTimersList[MapsLongTimers_count].MonthsInterval != 0 || + v26 / 7 != 0 && MapsLongTimersList[MapsLongTimers_count].WeeksInterval != 0 || v26 != 0 || !v20) { - ++dword_5B65C8_timers_count; - array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = 0; + ++MapsLongTimers_count; + MapsLongTimersList[MapsLongTimers_count].NextStartTime = 0; continue; } } @@ -3524,32 +3512,27 @@ { v8 = (__int64)((double)pParty->uTimePlayed * 0.234375); seconds = v8 % 60; - v10 = v8 / 60; - minutes = v10 % 60; - v11 = v10 / 60; - hours = v11 % 24; - v13 = v11 / 24; - days = v13 % 7; - v14 = v13 / 7; - weeks = v14 % 4; - v16 = v14 / 4; - months = v16 % 12; - years = v16 / 12; - - if ( array_5B5928_timers[dword_5B65C8_timers_count].field_10 ) + minutes = (v8 / 60) % 60; + hours = ((v8 / 60) / 60) % 24; + days = (((v8 / 60) / 60) / 24) % 7; + weeks = ((((v8 / 60) / 60) / 24) / 7) % 4; + months = (((((v8 / 60) / 60) / 24) / 7) / 4) % 12; + years = (((((v8 / 60) / 60) / 24) / 7) / 4) / 12; + + if ( MapsLongTimersList[MapsLongTimers_count].YearsInterval ) ++years; - else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_12 ) + else if ( MapsLongTimersList[MapsLongTimers_count].MonthsInterval ) ++months; - else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_14 ) + else if ( MapsLongTimersList[MapsLongTimers_count].WeeksInterval ) ++weeks; else { ++days; - minutes = array_5B5928_timers[dword_5B65C8_timers_count].field_18; - hours = array_5B5928_timers[dword_5B65C8_timers_count].field_16; - seconds = array_5B5928_timers[dword_5B65C8_timers_count].field_1A; + hours = MapsLongTimersList[MapsLongTimers_count].HoursInterval; + minutes = MapsLongTimersList[MapsLongTimers_count].MinutesInterval; + seconds = MapsLongTimersList[MapsLongTimers_count].SecondsInterval; } - array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = (signed __int64)((double)((seconds + MapsLongTimersList[MapsLongTimers_count].NextStartTime = (signed __int64)((double)((seconds + 60 * minutes + 3600 * hours + 86400 * days @@ -3558,7 +3541,7 @@ + 29030400 * years) << 7) * 0.033333335); - ++dword_5B65C8_timers_count; + ++MapsLongTimers_count; } } } @@ -3797,10 +3780,10 @@ _5773B8_event_timer = pParty->uTimePlayed; - for (uint i = 0; i < dword_5B65C8_timers_count; ++i) + for (uint i = 0; i < MapsLongTimers_count; ++i) { //v4 = (char *)&array_5B5928_timers[0].field_C; - stru176* timer = &array_5B5928_timers[i]; + MapsLongTimer* timer = &MapsLongTimersList[i]; //while ( 1 ) //{ //v5 = *(short *)v4; @@ -3810,25 +3793,25 @@ timer->time_left_to_fire -= v13; else { - timer->time_left_to_fire = timer->fire_interval; + timer->time_left_to_fire = timer->IntervalHalfMins; EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); } } else { - if (timer->next_fire_time < pParty->uTimePlayed) + if (timer->NextStartTime < pParty->uTimePlayed) { uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day - if (timer->field_10) + if (timer->YearsInterval) next_trigger_time = 336 * 60 * 60 * 24; // 1 year - else if (timer->field_12) + else if (timer->MonthsInterval) next_trigger_time = 28 * 60 * 60 * 24; // 1 month - else if (timer->field_14) + else if (timer->WeeksInterval) next_trigger_time = 7 * 60 * 60 * 24; // 1 week - timer->next_fire_time += (next_trigger_time * 128) / 3.0f; - if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed - timer->next_fire_time = pParty->uTimePlayed; + timer->NextStartTime += (next_trigger_time * 128) / 3.0f; + if (timer->NextStartTime < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed + timer->NextStartTime = pParty->uTimePlayed; EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); }