comparison mm7_3.cpp @ 1202:0dbf6c4dd029

arrays to std::arrays phase 1
author Grumpy7
date Sat, 08 Jun 2013 21:33:22 +0200
parents 15ad868d972f
children 8c02e6f74b29
comparison
equal deleted inserted replaced
1196:44f37efc159c 1202:0dbf6c4dd029
11847 int current_string_length; 11847 int current_string_length;
11848 int prev_string_offset; 11848 int prev_string_offset;
11849 11849
11850 if (sizeof(pLevelStrOffsets) != 2000) 11850 if (sizeof(pLevelStrOffsets) != 2000)
11851 Log::Warning(L"pLevelStrOffsets: deserialization warning"); 11851 Log::Warning(L"pLevelStrOffsets: deserialization warning");
11852 memset(pLevelStrOffsets, 0, 2000); 11852 memset(pLevelStrOffsets.data(), 0, 2000);
11853 11853
11854 max_string_length = 0; 11854 max_string_length = 0;
11855 string_num = 1; 11855 string_num = 1;
11856 prev_string_offset = 0; 11856 prev_string_offset = 0;
11857 pLevelStrOffsets[0]=0; 11857 pLevelStrOffsets[0]=0;
11935 11935
11936 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) 11936 for (uint i = 0; i < uLevelEVT_NumEvents; ++i)
11937 { 11937 {
11938 auto pEvent = pLevelEVT_Index[i]; 11938 auto pEvent = pLevelEVT_Index[i];
11939 11939
11940 auto _evt = (_evt_raw *)(pLevelEVT + pEvent.uEventOffsetInEVT); 11940 auto _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]);
11941 11941
11942 if (_evt->_e_type == EVENT_PlaySound) 11942 if (_evt->_e_type == EVENT_PlaySound)
11943 { 11943 {
11944 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); 11944 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0);
11945 } 11945 }
12065 void __thiscall Level_LoadEvtAndStr(const char *pLevelName) 12065 void __thiscall Level_LoadEvtAndStr(const char *pLevelName)
12066 { 12066 {
12067 char pContainerName[120]; // [sp+8h] [bp-98h]@1 12067 char pContainerName[120]; // [sp+8h] [bp-98h]@1
12068 12068
12069 sprintf(pContainerName, "%s.evt", pLevelName); 12069 sprintf(pContainerName, "%s.evt", pLevelName);
12070 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT, 0x2400u); 12070 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 0x2400u);
12071 12071
12072 sprintf(pContainerName, "%s.str", pLevelName); 12072 sprintf(pContainerName, "%s.str", pLevelName);
12073 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr, 0x2400u); 12073 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 0x2400u);
12074 if (uLevelStrFileSize) 12074 if (uLevelStrFileSize)
12075 LoadLevel_InitializeLevelStr(); 12075 LoadLevel_InitializeLevelStr();
12076 } 12076 }
12077 12077
12078 //----- (00444564) -------------------------------------------------------- 12078 //----- (00444564) --------------------------------------------------------
12422 12422
12423 event_index = 0; 12423 event_index = 0;
12424 if ( !npc_event_id ) 12424 if ( !npc_event_id )
12425 return 0; 12425 return 0;
12426 evt_seq_num = entry_line; 12426 evt_seq_num = entry_line;
12427 pSomeOtherEVT = pGlobalEVT; 12427 pSomeOtherEVT = pGlobalEVT.data();
12428 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents; 12428 uSomeOtherEVT_NumEvents = uGlobalEVT_NumEvents;
12429 memcpy(pSomeOtherEVT_Events, pGlobalEVT_Index, sizeof(EventIndex)*4400); 12429 memcpy(pSomeOtherEVT_Events.data(), pGlobalEVT_Index.data(), sizeof(EventIndex)*4400);
12430 npc_activity = 1; 12430 npc_activity = 1;
12431 ready_to_exit = false; 12431 ready_to_exit = false;
12432 if ( uSomeOtherEVT_NumEvents <= 0 ) 12432 if ( uSomeOtherEVT_NumEvents <= 0 )
12433 return 2; 12433 return 2;
12434 do 12434 do
12783 { 12783 {
12784 if ( bToggle ) 12784 if ( bToggle )
12785 { 12785 {
12786 if ( (signed int)uNumActors > Standing ) 12786 if ( (signed int)uNumActors > Standing )
12787 { 12787 {
12788 v6 = pActors;//[0].uAttributes; 12788 v6 = pActors.data();//[0].uAttributes;
12789 do 12789 do
12790 { 12790 {
12791 if ( v6->uGroup == v4 ) 12791 if ( v6->uGroup == v4 )
12792 { 12792 {
12793 v6->uAttributes |= v3; 12793 v6->uAttributes |= v3;
12806 else 12806 else
12807 { 12807 {
12808 v7 = uNumActors; 12808 v7 = uNumActors;
12809 if ( (signed int)uNumActors > Standing ) 12809 if ( (signed int)uNumActors > Standing )
12810 { 12810 {
12811 v8 = pActors;//[0].uAIState; 12811 v8 = pActors.data();//[0].uAIState;
12812 do 12812 do
12813 { 12813 {
12814 if ( v8->uGroup == v4 ) 12814 if ( v8->uGroup == v4 )
12815 { 12815 {
12816 if ( v3 == 0x10000 ) 12816 if ( v3 == 0x10000 )
13729 if ( v4 ) 13729 if ( v4 )
13730 { 13730 {
13731 v5 = 0; 13731 v5 = 0;
13732 if ( (signed int)uNumLevelDecorations > 0 ) 13732 if ( (signed int)uNumLevelDecorations > 0 )
13733 { 13733 {
13734 v6 = pLevelDecorations; 13734 v6 = pLevelDecorations.data();
13735 while ( v6->uDecorationDescID != (signed __int16)v4 ) 13735 while ( v6->uDecorationDescID != (signed __int16)v4 )
13736 { 13736 {
13737 ++v5; 13737 ++v5;
13738 ++v6; 13738 ++v6;
13739 if ( v5 >= (signed int)uNumLevelDecorations ) 13739 if ( v5 >= (signed int)uNumLevelDecorations )
14049 pParty->uFlags &= 0xFFFFFFCFu; 14049 pParty->uFlags &= 0xFFFFFFCFu;
14050 14050
14051 ai_arrays_size = 0; 14051 ai_arrays_size = 0;
14052 for (uint i = 0; i < uNumActors; ++i) 14052 for (uint i = 0; i < uNumActors; ++i)
14053 { 14053 {
14054 auto actor = pActors + i; 14054 auto actor = &pActors[i];
14055 14055
14056 actor->uAttributes &= 0xFFFFFBFF; 14056 actor->uAttributes &= 0xFFFFFBFF;
14057 if (!actor->CanAct()) 14057 if (!actor->CanAct())
14058 { 14058 {
14059 actor->uAttributes &= 0xFFFFBFFF; 14059 actor->uAttributes &= 0xFFFFBFFF;
14225 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); 14225 v37 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
14226 v45 = 0; 14226 v45 = 0;
14227 v43 = 0; 14227 v43 = 0;
14228 if ( (signed int)uNumActors > 0 ) 14228 if ( (signed int)uNumActors > 0 )
14229 { 14229 {
14230 v0 = pActors;//[0].uAttributes; 14230 v0 = pActors.data();//[0].uAttributes;
14231 do 14231 do
14232 { 14232 {
14233 BYTE1(v0->uAttributes) &= 0xFBu; 14233 BYTE1(v0->uAttributes) &= 0xFBu;
14234 if ( ! v0->CanAct() ) 14234 if ( ! v0->CanAct() )
14235 goto LABEL_60; 14235 goto LABEL_60;
14342 } 14342 }
14343 v23 = 0; 14343 v23 = 0;
14344 ai_arrays_size = v19; 14344 ai_arrays_size = v19;
14345 if ( (signed int)uNumActors > 0 ) 14345 if ( (signed int)uNumActors > 0 )
14346 { 14346 {
14347 v24 = pActors;//[0].uAttributes; 14347 v24 = pActors.data();//[0].uAttributes;
14348 do 14348 do
14349 { 14349 {
14350 if ( v24->CanAct() && v24->uSectorID == v37 ) 14350 if ( v24->CanAct() && v24->uSectorID == v37 )
14351 { 14351 {
14352 v25 = 0; 14352 v25 = 0;