Mercurial > mm7
comparison Events.cpp @ 1202:0dbf6c4dd029
arrays to std::arrays phase 1
author | Grumpy7 |
---|---|
date | Sat, 08 Jun 2013 21:33:22 +0200 |
parents | 883eaee77094 |
children | 8c02e6f74b29 |
comparison
equal
deleted
inserted
replaced
1196:44f37efc159c | 1202:0dbf6c4dd029 |
---|---|
32 #include "Log.h" | 32 #include "Log.h" |
33 #include "MM7.h" | 33 #include "MM7.h" |
34 | 34 |
35 | 35 |
36 | 36 |
37 EventIndex pSomeOtherEVT_Events[4400]; | 37 std::array<EventIndex, 4400> pSomeOtherEVT_Events; |
38 signed int uSomeOtherEVT_NumEvents; | 38 signed int uSomeOtherEVT_NumEvents; |
39 char *pSomeOtherEVT; | 39 char *pSomeOtherEVT; |
40 EventIndex pSomeEVT_Events[4400]; | 40 std::array<EventIndex, 4400> pSomeEVT_Events; |
41 signed int uSomeEVT_NumEvents; | 41 signed int uSomeEVT_NumEvents; |
42 char *pSomeEVT; | 42 char *pSomeEVT; |
43 | 43 |
44 unsigned int uGlobalEVT_NumEvents; | 44 unsigned int uGlobalEVT_NumEvents; |
45 unsigned int uGlobalEVT_Size; | 45 unsigned int uGlobalEVT_Size; |
46 char pGlobalEVT[46080]; | 46 std::array<char, 46080> pGlobalEVT; |
47 EventIndex pGlobalEVT_Index[4400]; | 47 std::array<EventIndex, 4400> pGlobalEVT_Index; |
48 | 48 |
49 unsigned int pLevelStrOffsets[500]; | 49 std::array<unsigned int, 500> pLevelStrOffsets; |
50 unsigned int uLevelStrNumStrings; | 50 unsigned int uLevelStrNumStrings; |
51 unsigned int uLevelStrFileSize; | 51 unsigned int uLevelStrFileSize; |
52 signed int uLevelEVT_NumEvents; | 52 signed int uLevelEVT_NumEvents; |
53 unsigned int uLevelEVT_Size; | 53 unsigned int uLevelEVT_Size; |
54 char pLevelStr[9216]; | 54 std::array<char, 9216> pLevelStr; |
55 char pLevelEVT[9216]; | 55 std::array<char, 9216> pLevelEVT; |
56 EventIndex pLevelEVT_Index[4400]; | 56 std::array<EventIndex, 4400> pLevelEVT_Index; |
57 | 57 |
58 | 58 |
59 _2devent p2DEvents[525]; // weak | 59 std::array<_2devent, 525> p2DEvents; // weak |
60 | 60 |
61 | 61 |
62 | 62 |
63 //----- (00443CE1) -------------------------------------------------------- | 63 //----- (00443CE1) -------------------------------------------------------- |
64 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) | 64 unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) |
100 } ; | 100 } ; |
101 uint events_count; | 101 uint events_count; |
102 unsigned int offset_in; | 102 unsigned int offset_in; |
103 raw_event_header *current_hdr; | 103 raw_event_header *current_hdr; |
104 uGlobalEVT_NumEvents = 0; | 104 uGlobalEVT_NumEvents = 0; |
105 uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT, 46080); | 105 uGlobalEVT_Size = LoadEventsToBuffer("global.evt", pGlobalEVT.data(), 46080); |
106 if ( !uGlobalEVT_Size ) | 106 if ( !uGlobalEVT_Size ) |
107 return; | 107 return; |
108 memset(pGlobalEVT_Index, 0x80, sizeof(pGlobalEVT_Index));//52800 | 108 memset(pGlobalEVT_Index.data(), 0x80, sizeof(pGlobalEVT_Index));//52800 |
109 events_count = uGlobalEVT_NumEvents; | 109 events_count = uGlobalEVT_NumEvents; |
110 current_hdr=(raw_event_header *)pGlobalEVT; | 110 current_hdr=(raw_event_header *)pGlobalEVT.data(); |
111 offset_in=0; | 111 offset_in=0; |
112 for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) | 112 for (events_count = 0, offset_in = 0; offset_in < uGlobalEVT_Size; ++events_count) |
113 { | 113 { |
114 pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); | 114 pGlobalEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); |
115 pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; | 115 pGlobalEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; |
141 | 141 |
142 if (!uLevelEVT_Size) | 142 if (!uLevelEVT_Size) |
143 return; | 143 return; |
144 | 144 |
145 memset(array_5B5928_timers, 0, 3200); | 145 memset(array_5B5928_timers, 0, 3200); |
146 memset(pLevelEVT_Index, 80, sizeof(EventIndex)*4400); | 146 memset(pLevelEVT_Index.data(), 80, sizeof(EventIndex)*4400); |
147 | 147 |
148 uLevelEVT_NumEvents = 0; | 148 uLevelEVT_NumEvents = 0; |
149 dword_5B65C8_timers_count = 0; | 149 dword_5B65C8_timers_count = 0; |
150 | 150 |
151 current_hdr=(raw_event_header *)pLevelEVT; | 151 current_hdr=(raw_event_header *)pLevelEVT.data(); |
152 offset_in=0; | 152 offset_in=0; |
153 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count) | 153 for (events_count = 0, offset_in = 0; offset_in < uLevelEVT_Size; ++events_count) |
154 { | 154 { |
155 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); | 155 pLevelEVT_Index[events_count].uEventID=current_hdr->evt_id_l+(current_hdr->evt_id_h<<8); |
156 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; | 156 pLevelEVT_Index[events_count].event_sequence_num=current_hdr->evt_sequence_num; |
438 curr_seq_num = entry_line; | 438 curr_seq_num = entry_line; |
439 | 439 |
440 if ( activeLevelDecoration ) | 440 if ( activeLevelDecoration ) |
441 { | 441 { |
442 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; | 442 uSomeEVT_NumEvents = uGlobalEVT_NumEvents; |
443 pSomeEVT = pGlobalEVT; | 443 pSomeEVT = pGlobalEVT.data(); |
444 memcpy(pSomeEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); //4400 evts | 444 memcpy(pSomeEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400); //4400 evts |
445 } | 445 } |
446 else | 446 else |
447 { | 447 { |
448 uSomeEVT_NumEvents = uLevelEVT_NumEvents; | 448 uSomeEVT_NumEvents = uLevelEVT_NumEvents; |
449 pSomeEVT = pLevelEVT; | 449 pSomeEVT = pLevelEVT.data(); |
450 memcpy(pSomeEVT_Events, pLevelEVT_Index, sizeof(EventIndex)*4400); | 450 memcpy(pSomeEVT_Events.data(), pLevelEVT_Index.data(), sizeof(EventIndex)*4400); |
451 } | 451 } |
452 | 452 |
453 v4 = 0; | 453 v4 = 0; |
454 v124 = 0; | 454 v124 = 0; |
455 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) | 455 //for (uint i = 0; i < uSomeEVT_NumEvents; ++i) |
747 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | 747 v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); |
748 v40 = uNumActors; | 748 v40 = uNumActors; |
749 __debugbreak(); | 749 __debugbreak(); |
750 if ( (signed int)uNumActors > 0 ) | 750 if ( (signed int)uNumActors > 0 ) |
751 { | 751 { |
752 v41 = pActors;//[0].uGroup; | 752 v41 = pActors.data();//[0].uGroup; |
753 do | 753 do |
754 { | 754 { |
755 if ( v41->uGroup == v38 ) | 755 if ( v41->uGroup == v38 ) |
756 v41->uGroup = v39; | 756 v41->uGroup = v39; |
757 ++v41; | 757 ++v41; |
770 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); | 770 v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); |
771 v44 = uNumActors; | 771 v44 = uNumActors; |
772 __debugbreak(); | 772 __debugbreak(); |
773 if ( (signed int)uNumActors > 0 ) | 773 if ( (signed int)uNumActors > 0 ) |
774 { | 774 { |
775 v45 = pActors;//[0].uAlly; | 775 v45 = pActors.data();//[0].uAlly; |
776 do | 776 do |
777 { | 777 { |
778 if ( v45->uGroup == v42 ) | 778 if ( v45->uGroup == v42 ) |
779 v45->uAlly = v43; | 779 v45->uAlly = v43; |
780 ++v45; | 780 ++v45; |