changeset 1206:ab6560001f5b

arrays to std::arrays phase 2 - some more arrays converted
author Grumpy7
date Sun, 09 Jun 2013 01:10:49 +0200
parents 8c02e6f74b29
children 96a81634669e
files GUIWindow.cpp Indoor.cpp NPC.cpp NPC.h Outdoor.cpp Outdoor_stuff.h Render.cpp Render.h SaveLoad.cpp SaveLoad.h Spells.cpp Spells.h Texture.h UISaveLoad.cpp mm7_1.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp
diffstat 20 files changed, 178 insertions(+), 176 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/GUIWindow.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -870,7 +870,7 @@
     if ( v5 )
       pSavegameThumbnails[v2].LoadFromFILE(v5, 0, 0);
     else
-      *((int *)&pSavegameThumbnails->pPixels + 10 * v2) = 0;
+      *((int *)&pSavegameThumbnails.data()->pPixels + 10 * v2) = 0;
   }
 }
 
--- a/Indoor.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/Indoor.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -532,8 +532,8 @@
         sub_4B0E07(uFaceID);
         pGame->pLightmapBuilder->ApplyLights_IndoorFace(uFaceID);
         pDecalBuilder->ApplyBloodsplatDecals_IndoorFace(uFaceID);
-        pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28);
-        pGame->pIndoorCameraD3D->Project(array_507D30, uNumVerticesa, 0);
+        pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30.data(), &stru_F8AD28);
+        pGame->pIndoorCameraD3D->Project(array_507D30.data(), uNumVerticesa, 0);
         pGame->pLightmapBuilder->std__vector_000004_size = 0;
         if (stru_F8AD28.uNumLightsApplied > 0 ||
             pDecalBuilder->uNumDecals > 0)
@@ -546,10 +546,10 @@
         }
 
         if (stru_F8AD28.uNumLightsApplied > 0 && !(pFace->uAttributes & FACE_DO_NOT_LIGHT))
-          pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0);
+          pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30.data(), pVertices, 0);
 
         if (pDecalBuilder->uNumDecals > 0)
-          pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID);
+          pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30.data(), pVertices, 0, pFace->uSectorID);
 
         if (pFace->Fluid())
         {
--- a/NPC.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/NPC.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -13,7 +13,7 @@
 #include "NPC.h"
 
 int pDialogueNPCCount;
-struct Texture *pDialogueNPCPortraits[6];
+std::array<struct Texture *, 6> pDialogueNPCPortraits;
 int uNumDialogueNPCPortraits; // weak
 struct NPCStats *pNPCStats = nullptr;
 
--- a/NPC.h	Sun Jun 09 00:30:48 2013 +0200
+++ b/NPC.h	Sun Jun 09 01:10:49 2013 +0200
@@ -70,7 +70,7 @@
   const char *pText;
 };
 
-extern NPCTopic pNPCTopics[789];
+extern std::array<NPCTopic, 789> pNPCTopics;
 
 
 /*  136 */
@@ -187,7 +187,7 @@
 #pragma pack(pop)
 
 extern int pDialogueNPCCount;
-extern struct Texture *pDialogueNPCPortraits[6];
+extern std::array<struct Texture *, 6> pDialogueNPCPortraits;
 extern int uNumDialogueNPCPortraits; // weak
 extern struct NPCStats *pNPCStats;
 
--- a/Outdoor.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/Outdoor.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -43,7 +43,7 @@
 
 
 stru149 stru_8019C8;
-stru148 array_77EC08[2000 + 18000];
+std::array<stru148, 2000 + 18000> array_77EC08;
 Surf stru_80C980;
 Edge defaultEdge; // weak
 Edge stru_80C9A4;
--- a/Outdoor_stuff.h	Sun Jun 09 00:30:48 2013 +0200
+++ b/Outdoor_stuff.h	Sun Jun 09 01:10:49 2013 +0200
@@ -99,7 +99,7 @@
   float field_14;
 };
 #pragma pack(pop)
-extern stru148 array_77EC08[];
+extern std::array<stru148, 2000 + 18000> array_77EC08;
 
 
 
--- a/Render.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/Render.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -42,28 +42,28 @@
 
 struct IDirectDrawClipper *pDDrawClipper;
 struct Render *pRenderer; // idb
-struct RenderVertexD3D3  pVertices[50];
+struct RenderVertexD3D3 pVertices[50];
 int uNumDecorationsDrawnThisFrame; // weak
-RenderBillboard pBillboardRenderList[500];
+std::array<RenderBillboard, 500> pBillboardRenderList;
 unsigned int uNumBillboardsToDraw;
 int uNumSpritesDrawnThisFrame; // weak
 
-RenderVertexSoft array_507D30[50];
-RenderVertexSoft array_508690[50];
-RenderVertexSoft array_508FF0[50];
-RenderVertexSoft array_509950[50];
-RenderVertexSoft array_50A2B0[50];
-RenderVertexSoft array_50AC10[50];
-
-RenderVertexSoft array_73D150[20];
-
-RenderVertexD3D3 d3d_vertex_buffer[50];
+std::array<RenderVertexSoft, 50> array_507D30;
+std::array<RenderVertexSoft, 50> array_508690;
+std::array<RenderVertexSoft, 50> array_508FF0;
+std::array<RenderVertexSoft, 50> array_509950;
+std::array<RenderVertexSoft, 100> array_50A2B0;
+std::array<RenderVertexSoft, 50> array_50AC10;
+
+std::array<RenderVertexSoft, 20> array_73D150;
+
+std::array<RenderVertexD3D3, 50> d3d_vertex_buffer;
 
 RenderVertexSoft *ptr_801A04;
 RenderVertexSoft *ptr_801A08;
 
-RenderVertexSoft pVerticesSR_801A10[384];
-RenderVertexSoft pVerticesSR_806210[384];
+std::array<RenderVertexSoft, 384> pVerticesSR_801A10;
+std::array<RenderVertexSoft, 384> pVerticesSR_806210;
 
 void SetBillboardBlendOptions(RenderBillboardD3D::OpacityType a1);
 
@@ -161,7 +161,7 @@
   pOutdoorCamera->uNumBillboards = ::uNumBillboardsToDraw;
   for (uint i = 0; i < ::uNumBillboardsToDraw; ++i)
   {
-    auto p = pBillboardRenderList + i;
+    auto p = &pBillboardRenderList[i];
 
       soft_billboard.uScreenSpaceX = p->uScreenSpaceX;
       soft_billboard.uParentBillboardID = i;
@@ -267,7 +267,7 @@
   v0 = pRenderer->pTargetSurface;
   v1 = pOutdoorCamera->numStru148s;
   a1 = pRenderer->pTargetSurface;
-  v2 = array_77EC08;
+  v2 = array_77EC08.data();
   v37 = pOutdoorCamera->numStru148s;
   if ( !(pParty->uFlags & 2) )
   {
@@ -1531,8 +1531,8 @@
       break;
   }
   //v69 = v16 - 1;
-  ptr_801A08 = pVerticesSR_806210;
-  ptr_801A04 = pVerticesSR_801A10;
+  ptr_801A08 = pVerticesSR_806210.data();
+  ptr_801A04 = pVerticesSR_801A10.data();
   //v126 = v69;
 
   if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 )//блок
@@ -1774,16 +1774,16 @@
       //v8->field_5C = WorldPosToGridCellX(floorf((v101->vWorldPosition.x + v8->vWorldPosition.x) / 2 + 0.5f));;
       v8->sTextureDeltaU = 0;
       v8->sTextureDeltaV = 0;
-      memcpy(array_73D150 + 0, &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft));
+      memcpy(&array_73D150[0], &pTerrainVertices[z * 128 + x], sizeof(RenderVertexSoft));
       array_73D150[0].u = 0;
       array_73D150[0].v = 0;
-      memcpy(array_73D150 + 1, &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft));
+      memcpy(&array_73D150[1], &pTerrainVertices[z * 128 + x + 1], sizeof(RenderVertexSoft));
       array_73D150[1].u = 1;
       array_73D150[1].v = 0;
-      memcpy(array_73D150 + 2, &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft));
+      memcpy(&array_73D150[2], &pTerrainVertices[(z + 1) * 128 + x + 1], sizeof(RenderVertexSoft));
       array_73D150[2].u = 1;
       array_73D150[2].v = 1;
-      memcpy(array_73D150 + 3, &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft));
+      memcpy(&array_73D150[3], &pTerrainVertices[(z + 1) * 128 + x], sizeof(RenderVertexSoft));
       array_73D150[3].u = 0;
       array_73D150[3].v = 1;
       v55 = 0;
@@ -2096,18 +2096,18 @@
             stru154(stru_76D5A8);
             atexit(loc_481199);
           }*/
-          v32 = (struct8 *)array_50AC10;
+          v32 = (struct8 *)array_50AC10.data();
           v97 = (int)pGame->pLightmapBuilder;
-          pGame->pLightmapBuilder->StackLights_TerrainFace(v23, &v95, array_50AC10, 4, 1);
-          pDecalBuilder->_49BE8A(v16, v23, &v95, array_50AC10, 4, 1);
+          pGame->pLightmapBuilder->StackLights_TerrainFace(v23, &v95, array_50AC10.data(), 4, 1);
+          pDecalBuilder->_49BE8A(v16, v23, &v95, array_50AC10.data(), 4, 1);
           a5 = 4;
           if ( byte_4D864C && pGame->uFlags & 0x80 )
           {
             thisa = pGame->pIndoorCameraD3D;
-            if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 )
+            if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10.data(), &a5, 0) == 1 && !a5 )
               goto LABEL_162;
-            thisa->ViewTransform(array_50AC10, a5);
-            thisa->Project(array_50AC10, a5, 0);
+            thisa->ViewTransform(array_50AC10.data(), a5);
+            thisa->Project(array_50AC10.data(), a5, 0);
           }
           this_3 = v102->vWorldViewPosition.x < 8.0 || pVertices->vWorldViewPosition.x < 8.0
               || v101->vWorldViewPosition.x < 8.0 || pVertices2->vWorldViewPosition.x < 8.0;
@@ -2124,10 +2124,10 @@
               v33 = v108 != 0 ? 5 : 0;
             static_sub_0048034E_stru_154.ClassifyPolygon(v23, v95);
             if ( pDecalBuilder->uNumDecals > 0 )
-              pDecalBuilder->ApplyDecals(31 - v16->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1);
+              pDecalBuilder->ApplyDecals(31 - v16->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10.data(), 0, *(float *)&v33, -1);
           }
           if ( stru_F8AD28.uNumLightsApplied > 0 )
-            pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, v33);
+            pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10.data(), 0, v33);
           v34 = a5;
           //v35 = byte_4D864C == 0;
           v16->uNumVertices = a5;
@@ -2653,7 +2653,7 @@
         if ( !sub_481FC9(v10, (RenderVertexSoft *)HIDWORD(v101), v102, v17) )
           goto LABEL_104;
         v26 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
-        memcpy(array_50AC10, v104, 0x30u);
+        memcpy(array_50AC10.data(), v104, 0x30u);
         array_50AC10[0]._rhw = v26;
         array_50AC10[0].u = 0.0;
         array_50AC10[0].v = 0.0;
@@ -2672,7 +2672,7 @@
         array_50AC10[3]._rhw = 1.0 / v29;
         array_50AC10[3].u = 1.0;
         array_50AC10[3].v = 0.0;
-        pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 4u, 1);
+        pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10.data(), 4u, 1);
         if ( stru_F8AD28.uNumLightsApplied <= 0 )
         {
           v17->field_108 = 0;
@@ -2681,7 +2681,7 @@
         {
           v30 = pGame;
           v17->field_108 = 1;
-          pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 4, pNormal);
+          pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10.data(), 4, pNormal);
         }
         if ( v104->vWorldViewPosition.x < 8.0
           || *(float *)(HIDWORD(v101) + 12) < 8.0
@@ -2774,7 +2774,7 @@
     if ( !sub_481FC9((RenderVertexSoft *)HIDWORD(v101), v103, v104, v38) )
       goto LABEL_74;
     v48 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
-    memcpy(array_50AC10, v104, 0x30u);
+    memcpy(array_50AC10.data(), v104, 0x30u);
     array_50AC10[0]._rhw = v48;
     array_50AC10[0].u = 0.0;
     array_50AC10[0].v = 0.0;
@@ -2788,7 +2788,7 @@
     array_50AC10[2]._rhw = 1.0 / v50;
     array_50AC10[2].u = 1.0;
     array_50AC10[2].v = 1.0;
-    pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 3u, 0);
+    pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10.data(), 3u, 0);
     if ( stru_F8AD28.uNumLightsApplied <= 0 )
     {
       v38->field_108 = 0;
@@ -2797,7 +2797,7 @@
     {
       v51 = pGame;
       v38->field_108 = 1;
-      pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormala);
+      pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10.data(), 3, pNormala);
     }
     if ( v104->vWorldViewPosition.x < 8.0
       || *(float *)(HIDWORD(v101) + 12) < 8.0
@@ -2818,7 +2818,7 @@
         {
           sr_sub_4829B9((RenderVertexSoft *)HIDWORD(v101), v52, v104, v38, 0);
 LABEL_68:
-          sr_sub_481DB2(array_508690, v54, v38);
+          sr_sub_481DB2(array_508690.data(), v54, v38);
 LABEL_75:
           v17 = &array_77EC08[pOutdoorCamera->numStru148s];
           v57 = pOutdoor->GetTileTexture(v101, v100);
@@ -2868,7 +2868,7 @@
             goto LABEL_105;
           }
           v62 = 1.0 / (v104->vWorldViewPosition.x + 0.0000001);
-          memcpy(array_50AC10, v104, 0x30u);
+          memcpy(array_50AC10.data(), v104, 0x30u);
           array_50AC10[0]._rhw = v62;
           array_50AC10[0].u = 0.0;
           array_50AC10[0].v = 0.0;
@@ -2882,7 +2882,7 @@
           array_50AC10[2]._rhw = 1.0 / v64;
           array_50AC10[2].u = 1.0;
           array_50AC10[2].v = 0.0;
-          pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 3u, 1);
+          pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10.data(), 3u, 1);
           if ( stru_F8AD28.uNumLightsApplied <= 0 )
           {
             v17->field_108 = 0;
@@ -2891,7 +2891,7 @@
           {
             v65 = pGame;
             v17->field_108 = 1;
-            pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 3, pNormalb);
+            pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10.data(), 3, pNormalb);
           }
           if ( v104->vWorldViewPosition.x < 8.0 || v103->vWorldViewPosition.x < 8.0 || v102->vWorldViewPosition.x < 8.0 )
           {
@@ -2921,7 +2921,7 @@
 LABEL_37:
           sr_sub_4829B9(v35, v34, v67, v68, v69);
 LABEL_38:
-          sr_sub_481DB2(array_508690, v33, v17);
+          sr_sub_481DB2(array_508690.data(), v33, v17);
           goto LABEL_105;
         }
         goto LABEL_74;
@@ -2981,7 +2981,7 @@
 
   for (int i = 0; i < ::uNumBillboardsToDraw; ++i)
   {
-    auto pBillboard = pBillboardRenderList + i;
+    auto pBillboard = &pBillboardRenderList[i];
 
     billboard.uScreenSpaceX = pBillboard->uScreenSpaceX;
     billboard.uScreenSpaceY = pBillboard->uScreenSpaceY;
@@ -4508,7 +4508,7 @@
         pRenderD3D->pDevice->SetTexture(0, pTexture);
         pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                            D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                                           d3d_vertex_buffer,
+                                           d3d_vertex_buffer.data(),
                                            uNumVertices,
                                            D3DDP_DONOTLIGHT);
       }
@@ -4543,7 +4543,7 @@
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr));
         ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                                   D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR,
-                                                  d3d_vertex_buffer,
+                                                  d3d_vertex_buffer.data(),
                                                   uNumVertices,
                                                   D3DDP_DONOTLIGHT));
         //v50 = (const char *)v5->pRenderD3D->pDevice;
@@ -4564,7 +4564,7 @@
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR));
         ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                                   D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR,
-                                                  d3d_vertex_buffer,
+                                                  d3d_vertex_buffer.data(),
                                                   uNumVertices,
                                                   D3DDP_DONOTLIGHT));
         if (bUsingSpecular)
@@ -4582,7 +4582,7 @@
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA));
           ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                                                     D3DFVF_XYZRHW | D3DFVF_TEX1 | D3DFVF_DIFFUSE | D3DFVF_SPECULAR,
-                                                    d3d_vertex_buffer,
+                                                    d3d_vertex_buffer.data(),
                                                     uNumVertices,
                                                     D3DDP_DONOTLIGHT));
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE));
@@ -7415,7 +7415,7 @@
 		}
 
 		this->pRenderD3D->pDevice->SetTexture(0, a5);
-        this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, uNumVertices, 16);
+        this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer.data(), uNumVertices, 16);
         if (transparent)
         {
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE));
@@ -7453,7 +7453,7 @@
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, 0));
         ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                d3d_vertex_buffer,
+                d3d_vertex_buffer.data(),
                 uNumVertices,
                 16));
         //v63 = (const char *)v7->pRenderD3D->pDevice;
@@ -7475,7 +7475,7 @@
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR));
         ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                d3d_vertex_buffer,
+                d3d_vertex_buffer.data(),
                 uNumVertices,
                 16));
         if ( pRenderer->bUsingSpecular )
@@ -7493,7 +7493,7 @@
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCALPHA));
           ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                   D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                  d3d_vertex_buffer,
+                  d3d_vertex_buffer.data(),
                   uNumVertices,
                   16));
           ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, TRUE));
@@ -7510,7 +7510,7 @@
     }
 
     if (pIndoorCamera->flags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES || pBLVRenderParams->uFlags & INDOOR_CAMERA_DRAW_TERRAIN_OUTLINES)
-      pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, uNumVertices, 0x00FFFFFF, 0.0);
+      pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer.data(), uNumVertices, 0x00FFFFFF, 0.0);
   }
 // 4A26BC: could not find valid save-restore pair for esi
 // 4D864C: using guessed type char byte_4D864C;
@@ -7594,7 +7594,7 @@
       ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex));
       ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
         D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-        d3d_vertex_buffer,
+        d3d_vertex_buffer.data(),
         a2,
         28));
     }
@@ -7682,7 +7682,7 @@
       ErrD3D(pRenderD3D->pDevice->DrawPrimitive(
               D3DPT_TRIANGLEFAN,
               D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-              d3d_vertex_buffer,
+              d3d_vertex_buffer.data(),
               uNumVertices,
               28));
       pGame->pLightmapBuilder->_45D74F_MessWithLight(-1, 0);
@@ -7708,7 +7708,7 @@
       ErrD3D(pRenderD3D->pDevice->SetTexture(0, pHwTex));
       ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                d3d_vertex_buffer,
+                d3d_vertex_buffer.data(),
                 uNumVertices,
                 28));
     }
@@ -7760,7 +7760,7 @@
         ErrD3D(pRenderD3D->pDevice->SetTexture(0, nullptr));
         ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                d3d_vertex_buffer,
+                d3d_vertex_buffer.data(),
                 uNumVertices,
                 28));
 
@@ -7789,7 +7789,7 @@
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_SRCCOLOR));
         ErrD3D(pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN,
                 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1,
-                d3d_vertex_buffer,
+                d3d_vertex_buffer.data(),
                 uNumVertices,
                 28));
         ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
--- a/Render.h	Sun Jun 09 00:30:48 2013 +0200
+++ b/Render.h	Sun Jun 09 01:10:49 2013 +0200
@@ -257,7 +257,7 @@
   char field_78[208];
 };
 #pragma pack(pop)
-extern struct RenderVertexD3D3  pVertices[50];
+extern struct RenderVertexD3D3 pVertices[50];
 
 /*  182 */
 #pragma pack(push, 1)
@@ -502,26 +502,26 @@
 
 
 extern int uNumDecorationsDrawnThisFrame; // weak
-extern RenderBillboard pBillboardRenderList[500];
+extern std::array<RenderBillboard, 500> pBillboardRenderList;
 extern unsigned int uNumBillboardsToDraw;
 extern int uNumSpritesDrawnThisFrame; // weak
 
 
 
 
-extern RenderVertexSoft array_507D30[50];
-extern RenderVertexSoft array_508690[50];
-extern RenderVertexSoft array_508FF0[50];
-extern RenderVertexSoft array_509950[50];
-extern RenderVertexSoft array_50A2B0[50];
-extern RenderVertexSoft array_50AC10[50];
+extern std::array<RenderVertexSoft, 50> array_507D30;
+extern std::array<RenderVertexSoft, 50> array_508690;
+extern std::array<RenderVertexSoft, 50> array_508FF0;
+extern std::array<RenderVertexSoft, 50> array_509950;
+extern std::array<RenderVertexSoft, 100> array_50A2B0;
+extern std::array<RenderVertexSoft, 50> array_50AC10;
 
-extern RenderVertexSoft array_73D150[20];
+extern std::array<RenderVertexSoft, 20> array_73D150;
 
-extern RenderVertexD3D3 d3d_vertex_buffer[50];
+extern std::array<RenderVertexD3D3, 50> d3d_vertex_buffer;
 
 extern RenderVertexSoft *ptr_801A04;
 extern RenderVertexSoft *ptr_801A08;
 
-extern RenderVertexSoft pVerticesSR_801A10[384];
-extern RenderVertexSoft pVerticesSR_806210[384];
\ No newline at end of file
+extern std::array<RenderVertexSoft, 384> pVerticesSR_801A10;
+extern std::array<RenderVertexSoft, 384> pVerticesSR_806210;
\ No newline at end of file
--- a/SaveLoad.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/SaveLoad.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -32,9 +32,9 @@
 
 struct SavegameList *pSavegameList = new SavegameList;
 unsigned int uNumSavegameFiles;
-unsigned int pSavegameUsedSlots[45];
-struct RGBTexture pSavegameThumbnails[45];
-SavegameHeader    pSavegameHeader[45];
+std::array<unsigned int, 45> pSavegameUsedSlots;
+std::array<struct RGBTexture, 45> pSavegameThumbnails;
+std::array<SavegameHeader, 45> pSavegameHeader;
 
 
 
--- a/SaveLoad.h	Sun Jun 09 00:30:48 2013 +0200
+++ b/SaveLoad.h	Sun Jun 09 01:10:49 2013 +0200
@@ -1,4 +1,5 @@
 #pragma once
+#include<array>
 
 #pragma pack(push, 1)
 struct SaveFile_
@@ -41,7 +42,6 @@
 
 
 extern unsigned int uNumSavegameFiles;
-extern unsigned int pSavegameUsedSlots[45];
+extern std::array<unsigned int, 45> pSavegameUsedSlots;
 extern struct SavegameList  *pSavegameList;
-extern struct RGBTexture     pSavegameThumbnails[];
-extern struct SavegameHeader pSavegameHeader[];
\ No newline at end of file
+extern std::array<SavegameHeader, 45>  pSavegameHeader;
\ No newline at end of file
--- a/Spells.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/Spells.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -15,21 +15,21 @@
 
 
 
-TownPortalData TownPortalList[6] = //4ECBB8
-{
+std::array<TownPortalData, 6> TownPortalList = //4ECBB8
+{{
  {Vec3_int_(-5121, 2107, 1), 1536, 0, 21, 0},
  {Vec3_int_(-15148, -10240, 1473), 0, 0, 4, 0},
  {Vec3_int_(-10519, 5375, 753), 512, 0, 3, 0},
  {Vec3_int_(3114, -11055, 513), 0, 0, 10, 0},
  {Vec3_int_(-158, 7624, 1), 512, 0, 7, 0},
  {Vec3_int_(-1837, -4247, 65), 65, 0, 8, 0}
-} ;
+}} ;
 
 struct SpellStats *pSpellStats;
 
 
-stru324_spell stru_4E3ACC[103] =
-{
+std::array<stru324_spell, 103> stru_4E3ACC =
+{{
   {10, 0},
   {1000, 0}, {1010, 0}, {1020, 0}, {1030, 0}, {1040, 0}, {1050, 0}, {1060, 0}, {1070, 0}, {1080, 0}, {1090, 0}, {1100, 0},
   {2000, 0}, {2010, 0}, {2020, 0}, {2030, 0}, {2040, 0}, {2050, 0}, {2060, 0}, {2070, 0}, {2080, 0}, {2090, 0}, {2100, 0},
@@ -43,9 +43,9 @@
   {545, 0},
   {545, 0},
   {555, 0}
-};
+}};
  //9 spellbook pages  11 spells per page 9*11 =99 +1 zero struct at 0. It counted from 1!
-SpellData pSpellDatas[100]={
+std::array<SpellData, 100> pSpellDatas={{
 					 {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
 
 					 {1, 1, 1, 1, 60, 60, 60, 40, 0, 0},//0
@@ -155,10 +155,10 @@
 	                 {50, 50, 50, 50, 120, 120, 120, 100, 6400, 0},
 	                 {55, 55, 55, 55, 250, 250, 250, 250, 306, 0},
 	                 {60, 60, 60, 60, 300, 300, 300, 300, 2073, 0}
-	};
+  }};
 
 
-unsigned int wand_spell_ids[25] =
+std::array<unsigned int, 25> wand_spell_ids =
 {
 // 135 Wand of Fire               136 Wand of Sparks             137 Wand of Poison             138 Wand of Stunning           139 Wand of Harm
   SPELL_FIRE_FIRE_BOLT,           SPELL_AIR_SPARKS,              SPELL_WATER_POISON_SPRAY,      SPELL_EARTH_STUN,              SPELL_BODY_HARM,
@@ -186,43 +186,43 @@
 		{0,  9,  3,  7,  1,  5,  2, 10, 11,  8,  6,  4}
 }};
 
-	struct SpellBookIconPos pIconPos[9][12]={
+	std::array<std::array<struct SpellBookIconPos, 12>, 9> pIconPos={{
 
-		{{  0,   0}, { 17,  13}, {115,   2}, {217,  15},
-		 {299,   6}, { 28, 125}, {130, 133}, {294, 114},
-		 { 11, 232}, {134, 233}, {237, 171}, {296, 231}},
+		 {  0,   0,  17,  13, 115,   2, 217,  15,
+		 299,   6,  28, 125, 130, 133, 294, 114,
+      11, 232, 134, 233, 237, 171, 296, 231},
 
-		{{  0,   0},  {19,   9}, {117,   3}, {206,  13},	
-		 {285,   7},  {16, 123}, {113, 101}, {201, 118},
-		 {317, 110},  {11, 230}, {149, 236}, {296, 234}},
+		 {  0,   0, 19,   9, 117,   3, 206,  13,	
+		 285,   7,  16, 123, 113, 101, 201, 118,
+		 317, 110,  11, 230, 149, 236, 296, 234},
 
-		{{  0,   0},  {17,   9}, {140,   0}, {210,  34},
-		 {293,   5},  {15,  98}, { 78, 121}, {175, 136},
-		 {301, 115},  {15, 226}, {154, 225}, {272, 220}},
+		 {  0,   0,  17,   9, 140,   0, 210,  34,
+		 293,   5,   15,  98,  78, 121, 175, 136,
+     301, 115,   15, 226, 154, 225, 272, 220},
 
-		{{ 0,    0}, {  7,   9}, {156,   2}, {277,   9},
-		 { 11, 117}, {111,  82}, {180, 102}, {303, 108},
-		 { 10, 229}, {120, 221}, {201, 217}, {296, 225}},
+		 { 0,    0,   7,   9, 156,   2, 277,   9,
+		  11, 117, 111,  82, 180, 102, 303, 108,
+		  10, 229, 120, 221, 201, 217, 296, 225},
 
-		{{  0,   0},  {18,   8}, { 89,  15}, {192,  14},
-		 {292,   7},  {22, 129}, {125, 146}, {217, 136},
-		 {305, 115},  {22, 226}, {174, 237}, {290, 231}},
+		 {  0,   0,  18,   8,  89,  15, 192,  14,
+		 292,   7,  22, 129, 125, 146, 217, 136,
+		 305, 115,  22, 226, 174, 237, 290, 231},
 
-		{{ 0,    0}, { 18,  12}, {148,   9}, {292,   7},
-		 { 17, 122}, {121,  99}, {220,  87}, {293, 112},
-		 { 13, 236}, {128, 213}, {220, 223}, {315, 223}},
+     { 0,    0,  18,  12, 148,   9, 292,   7,
+     17, 122, 121,  99, 220,  87, 293, 112,
+     13, 236, 128, 213, 220, 223, 315, 223},
 
-		{{  0,   0},  {23,  14}, {127,   8}, {204, 0},
-		 {306,   8},  {14, 115}, {122, 132}, {200, 116},
-		 {293, 122},  {20, 228}, {154, 228}, {294, 239}},
+     {  0,   0,  23,  14, 127,   8, 204, 0,
+     306,   8,  14, 115, 122, 132, 200, 116,
+     293, 122,  20, 228, 154, 228, 294, 239},
 
-		{{  0,   0}, { 19,  14}, {124,  10}, {283,  12},
-		 {  8, 105}, {113,  89}, {190,  82}, {298, 108},
-		 { 18, 181}, {101, 204}, {204, 203}, {285, 218}},
+     {  0,   0,  19,  14, 124,  10, 283,  12,
+     8, 105, 113,  89, 190,  82, 298, 108,
+     18, 181, 101, 204, 204, 203, 285, 218},
 
-		{{  0,   0}, {18,  17}, {110,  16}, {201,  15},
-		 {307,  15}, {18, 148}, {125, 166}, {201, 123},
-		 {275, 120}, {28, 235}, {217, 222}, {324, 216}}};
+		 {  0,   0, 18,  17, 110,  16, 201,  15,
+		 307,  15, 18, 148, 125, 166, 201, 123,
+     275, 120, 28, 235, 217, 222, 324, 216}}};
 
 
 //----- (0042EB31) --------------------------------------------------------
--- a/Spells.h	Sun Jun 09 00:30:48 2013 +0200
+++ b/Spells.h	Sun Jun 09 01:10:49 2013 +0200
@@ -267,13 +267,13 @@
   __int16 field_12;
 };
 #pragma pack(pop)
-extern TownPortalData TownPortalList[6]; //4ECBB8
+extern std::array<TownPortalData, 6> TownPortalList; //4ECBB8
 
 
 extern struct SpellStats *pSpellStats;
 
-extern struct SpellBookIconPos pIconPos[9][12];
+extern std::array<std::array<struct SpellBookIconPos, 12>, 9> pIconPos;
 
-extern stru324_spell stru_4E3ACC[];
-extern SpellData pSpellDatas[100];
-extern unsigned int wand_spell_ids[];
\ No newline at end of file
+extern std::array<stru324_spell, 103> stru_4E3ACC;
+extern std::array<SpellData, 100> pSpellDatas;
+extern std::array<unsigned int, 25> wand_spell_ids;
\ No newline at end of file
--- a/Texture.h	Sun Jun 09 00:30:48 2013 +0200
+++ b/Texture.h	Sun Jun 09 01:10:49 2013 +0200
@@ -1,5 +1,6 @@
 #pragma once
 #include <stdio.h>
+#include<array>
 
 
 
@@ -126,6 +127,7 @@
 
 
 
+extern std::array<struct RGBTexture, 45> pSavegameThumbnails;
 extern Texture *pTexture_LloydBeacons[2];
 extern Texture *pTexture_50635C;
 extern Texture *pTexture_506368;
--- a/UISaveLoad.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/UISaveLoad.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -131,7 +131,7 @@
     v6 = uLoadGameUI_SelectedSlot;
     if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels)
     {
-      pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot);
+      pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]);
       v6 = uLoadGameUI_SelectedSlot;
     }
     pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName);
@@ -200,8 +200,8 @@
     //v18 = pGlobalTXT_LocalizationStrings[135];
     v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка"
     pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);
-    v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
-    v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
+    v20 = (const char *)(&pSavegameHeader[uLoadGameUI_SelectedSlot]);
+    v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot);
     pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0);
     //v22 = pGlobalTXT_LocalizationStrings[165];
     v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите"
@@ -278,8 +278,8 @@
     dword_6BE138 = -1;
     pIcons_LOD->_inlined_sub2();
 
-    memset(pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
-    memset(pSavegameThumbnails, 0, 45 * sizeof(RGBTexture));
+    memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots));
+    memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture));
     uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
     uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
     uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE);
@@ -390,7 +390,7 @@
     ++pIcons_LOD->uTexturePacksCount;
     if ( !pIcons_LOD->uNumPrevLoadedFiles )
         pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
-    memset(pSavegameUsedSlots, 0, 0xB4u);
+    memset(pSavegameUsedSlots.data(), 0, 0xB4u);
     memset(&pSavegameThumbnails, 0, 0x708u);
     uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE);
     uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE);
--- a/mm7_1.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/mm7_1.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -2593,7 +2593,7 @@
   char *v25; // [sp+2Ch] [bp-4h]@4
 
   v1 = uVertexID;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  memcpy(&array_50AC10[uVertexID], array_50AC10.data(), sizeof(array_50AC10[uVertexID]));
   v2 = 0;
   v20 = 0;
   if ( array_50AC10[0].vWorldViewPosition.x >= 8.0 )
@@ -2604,7 +2604,7 @@
   v4 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v5 = v1;
   v23 = (char *)&array_507D30[0]._rhw;
-  v21 = array_507D30;
+  v21 = array_507D30.data();
   v18 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v19 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v22 = (char *)&array_507D30[0].vWorldViewPosition;
--- a/mm7_3.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/mm7_3.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -4665,7 +4665,7 @@
       {
         //v19 = (char *)&array_73D150[0].vWorldPosition.z;
         //v20 = (char *)pFace->pTextureUIDs;
-		v19 = array_73D150;
+		v19 = array_73D150.data();
         v20 = pFace->pTextureUIDs;
 		v20b = pFace->pVertexIDs;
 		v20c = pFace->pTextureVIDs;
@@ -4707,7 +4707,7 @@
         }
         while ( !v10 );
         //v23 = (char *)&array_73D150[0].vWorldViewPosition;
-		v23 = array_73D150;
+		v23 = array_73D150.data();
         v51 = uNumVertices;
         *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder;
         do
@@ -4760,7 +4760,7 @@
         return result;
       ++pOutdoorCamera->numStru148s;
       ++pOutdoorCamera->field_44;
-      if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) )
+      if ( ODMFace::IsBackfaceCulled(pFace, array_73D150.data(), v7) )
       {
         LOBYTE(v25) = (char)v54;
         v26 = a1;
@@ -4814,13 +4814,13 @@
             v40 = -1;
             v39 = v31;
             v38 = 0;
-            v37 = array_50AC10;
+            v37 = array_50AC10.data();
             v36 = uNumVertices;
             pDecalBuilder->ApplyDecals(31 - v7->dimming_level,
               2,
               &static_RenderBuildingsD3D_stru_73C834,
               uNumVertices,
-              array_50AC10,
+              array_50AC10.data(),
               0,
               (char)v31,
               -1);
@@ -4831,7 +4831,7 @@
             &stru_F8AD28,
             &static_RenderBuildingsD3D_stru_73C834,
             uNumVertices,
-            array_50AC10,
+            array_50AC10.data(),
             0,
             (char)v31);
         if ( v50 )
@@ -5091,7 +5091,7 @@
           return result;
         ++pOutdoorCamera->numStru148s;
         ++pOutdoorCamera->field_44;
-        if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, v12) )
+        if ( !ODMFace::IsBackfaceCulled(v3, array_73D150.data(), v12) )
         {
 LABEL_71:
           --pOutdoorCamera->numStru148s;
@@ -5185,7 +5185,7 @@
           v55 = static_sub_004789DE_stru_73C818.face_plane.vNormal.x;
           v56 = static_sub_004789DE_stru_73C818.face_plane.vNormal.y;
           v57 = static_sub_004789DE_stru_73C818.face_plane.vNormal.z;
-          pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, v26, (Vec3_float_ *)&v55);
+          pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10.data(), v26, (Vec3_float_ *)&v55);
         }
         if ( v74 )
         {
@@ -5273,7 +5273,7 @@
             }
           }
         }
-        sr_sub_486B4E_push_outdoor_edges(array_508690, dword_50B638.data(), dword_50B570.data(), v12);
+        sr_sub_486B4E_push_outdoor_edges(array_508690.data(), dword_50B638.data(), dword_50B570.data(), v12);
       }
 LABEL_72:
       ++v79;
@@ -5434,7 +5434,7 @@
   v1 = (unsigned int)&array_77EC08[pOutdoorCamera->numStru148s];
   v15 = (double)pOutdoor->vSunlight.y / 65536.0;
   v16 = (double)pOutdoor->vSunlight.z / 65536.0;
-  if ( v1 > (unsigned int)array_77EC08 )
+  if ( v1 > (unsigned int)array_77EC08.data() )
   {
     v2 = (char *)&array_77EC08[0].pODMFace;
     while ( 1 )
@@ -6319,7 +6319,7 @@
   v62.v_18.x = -v9;
   v62.v_18.z = -stru_5C6E00->Cos(v8 + 16);
   v10 = pBLVRenderParams->uViewportZ - pBLVRenderParams->uViewportX;
-  memcpy(&array_507D30[v3], array_507D30, sizeof(array_507D30[v3]));
+  memcpy(&array_507D30[v3], array_507D30.data(), sizeof(array_507D30[v3]));
   LODWORD(v80) = v10;
   v62.field_24 = 33554432;
   v64 = (double)(signed int)v10 * 0.5;
@@ -6421,11 +6421,11 @@
   if ( (signed int)v62.uNumVertices > 0 )
   {
     v28 = (double)SLODWORD(v76);
-    LODWORD(v76) = (int)(char *)array_50AC10 + 28;
+    LODWORD(v76) = (int)(char *)array_50AC10.data() + 28;
     v29 = (char *)&array_50AC10[0].vWorldViewProjX;
     v30 = (char *)&array_507D30[1].vWorldViewProjY;
-    v79 = array_50AC10;
-    v81 = array_507D30;
+    v79 = array_50AC10.data();
+    v81 = array_507D30.data();
     v78 = v62.uNumVertices;
     do
     {
@@ -6546,8 +6546,8 @@
   if ( SLODWORD(v73) > 0 )
   {
     v48 = (double)SLODWORD(v80);
-    v75 = array_507D30;
-    v49 = array_50AC10;
+    v75 = array_507D30.data();
+    v49 = array_50AC10.data();
     HIDWORD(v69) = LODWORD(v73);
     do
     {
@@ -6569,8 +6569,8 @@
   if ( SLODWORD(v73) > 0 )
   {
     v51 = (double)SLODWORD(v80);
-    v75 = array_507D30;
-    v52 = array_50AC10;
+    v75 = array_507D30.data();
+    v52 = array_50AC10.data();
     v80 = v73;
     do
     {
@@ -7914,8 +7914,8 @@
     v13 = &array_508690[v21];
     if ( LODWORD(v29) != 3 )
     {
-      v11 = array_508690;
-      v13 = (RenderVertexSoft *)((char *)array_508690 + 16 * (3 * v1 - 3));
+      v11 = array_508690.data();
+      v13 = (RenderVertexSoft *)((char *)array_508690.data() + 16 * (3 * v1 - 3));
       v12 = &array_508690[1];
       v28 = array_508690[1].vWorldPosition.x - array_508690[0].vWorldPosition.x;
       v27 = array_508690[1].vWorldPosition.y - array_508690[0].vWorldPosition.y;
--- a/mm7_4.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/mm7_4.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -1442,7 +1442,7 @@
   v0 = 0;
   if ( pOutdoorCamera->numStru148s > 0 )
   {
-    v1 = array_77EC08;
+    v1 = array_77EC08.data();
     do
     {
       result = pGame->pLightmapBuilder->_45D3C7(v1);
--- a/mm7_5.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/mm7_5.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -1964,7 +1964,7 @@
           uNumSeconds = (unsigned int)&pPlayer->pInstalledBeacons[uMessageParam];
           if ( bRecallingBeacon )
           {
-            if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) )
+            if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) )
               continue;
             v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName;
             sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
@@ -1975,7 +1975,7 @@
           thise = "Not in Map Stats";
           if ( v59 )
             thise = pMapStats->pInfos[v59].pName;
-          if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) || !v59 )
+          if ( !*((int *)&pSavegameThumbnails.data()->pPixels + 10 * uMessageParam) || !v59 )
           {
             sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s"
             GameUI_SetFooterString(pTmpBuf.data());
@@ -5974,7 +5974,7 @@
 {
   for (uint i = 0; i < uNumBillboardsToDraw; ++i)
   {
-    auto p = pBillboardRenderList + i;
+    auto p = &pBillboardRenderList[i];
 
     if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID)
       p->dimming_level = 0;
@@ -9255,7 +9255,7 @@
   v27 = 0;
   if ( uNumMaxBeacons > 0 )
   {
-    v29 = pSavegameThumbnails;
+    v29 = pSavegameThumbnails.data();
     v28 = pPlayer->pInstalledBeacons;
     while ( 1 )
     {
--- a/mm7_6.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/mm7_6.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -75,7 +75,7 @@
 
   v1 = uVertexID;
   v2 = (double)pOutdoorCamera->shading_dist_mist;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  memcpy(&array_50AC10[uVertexID], array_50AC10.data(), sizeof(array_50AC10[uVertexID]));
   v3 = 0;
   v22 = 0;
   if ( array_50AC10[0].vWorldViewPosition.x <= v2 )
@@ -87,7 +87,7 @@
   v6 = v1;
   v23 = (char *)&array_507D30[0].flt_2C;
   v26 = (char *)&array_507D30[0]._rhw;
-  v24 = array_507D30;
+  v24 = array_507D30.data();
   v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v25 = (char *)&array_507D30[0].vWorldViewPosition;
@@ -216,7 +216,7 @@
   char *v25; // [sp+2Ch] [bp-4h]@5
 
   v1 = uVertexID;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  memcpy(&array_50AC10[uVertexID], array_50AC10.data(), sizeof(array_50AC10[uVertexID]));
   v21 = 0;
   v17 = array_50AC10[0].vWorldViewPosition.x >= 8.0;
   if ( (signed int)(uVertexID + 1) <= 1 )
@@ -224,7 +224,7 @@
   v2 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v3 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v24 = (char *)&array_507D30[0]._rhw;
-  v22 = array_507D30;
+  v22 = array_507D30.data();
   v19 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v20 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v23 = (char *)&array_507D30[0].vWorldViewPosition;
@@ -347,7 +347,7 @@
 
   v1 = uVertexID;
   v2 = (double)pOutdoorCamera->shading_dist_mist;
-  memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID]));
+  memcpy(&array_50AC10[uVertexID], array_50AC10.data(), sizeof(array_50AC10[uVertexID]));
   v22 = 0;
   v18 = array_50AC10[0].vWorldViewPosition.x <= v2;
   if ( (signed int)(uVertexID + 1) <= 1 )
@@ -355,7 +355,7 @@
   v3 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v4 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v25 = (char *)&array_507D30[0]._rhw;
-  v23 = array_507D30;
+  v23 = array_507D30.data();
   v20 = (char *)&array_507D30[0].vWorldViewPosition.z;
   v21 = (char *)&array_507D30[0].vWorldViewPosition.y;
   v24 = (char *)&array_507D30[0].vWorldViewPosition;
@@ -600,7 +600,7 @@
     return v117;
   v127 = a1;
   v1 = a1;
-  memcpy(array_508690, array_50AC10, 4 * ((unsigned int)(48 * a1) >> 2));
+  memcpy(array_508690.data(), array_50AC10.data(), 4 * ((unsigned int)(48 * a1) >> 2));
   v2 = 0;
   do
   {
@@ -615,13 +615,13 @@
   if ( v136 )
     return v117;
   v110 = 0;
-  memcpy(&array_50AC10[v1], array_50AC10, sizeof(array_50AC10[v1]));
+  memcpy(&array_50AC10[v1], array_50AC10.data(), sizeof(array_50AC10[v1]));
   v4 = array_50AC10[0].vWorldViewProjX + 6.7553994e15;
   v5 = SLODWORD(v4) >= (signed int)pViewport->uViewportTL_X;
   if ( v117 < 1 )
     goto LABEL_112;
   v6 = (char *)&array_50A2B0[0].vWorldViewProjY;
-  v132 = array_50A2B0;
+  v132 = array_50A2B0.data();
   v137 = (char *)&array_50A2B0[0].vWorldViewProjX;
   v128 = (char *)&array_50A2B0[0].vWorldViewProjY;
   v121 = (char *)&array_50A2B0[0].flt_2C;
@@ -706,13 +706,13 @@
   while ( v117 );
   if ( v110 < 3
     || (v115 = 0,
-        memcpy(&array_50A2B0[v110], array_50A2B0, sizeof(array_50A2B0[v110])),
+        memcpy(&array_50A2B0[v110], array_50A2B0.data(), sizeof(array_50A2B0[v110])),
         v23 = array_50A2B0[0].vWorldViewProjX + 6.7553994e15,
         v24 = SLODWORD(v23) <= (signed int)pViewport->uViewportBR_X,
         v110 < 1) )
     goto LABEL_112;
   v25 = (char *)&array_509950[0]._rhw;
-  v138 = array_509950;
+  v138 = array_509950.data();
   v129 = (char *)&array_50A2B0[0].vWorldViewProjX;
   v118 = (char *)&array_50A2B0[0].vWorldViewProjY;
   v133 = (char *)&array_509950[0].vWorldViewProjX;
@@ -803,13 +803,13 @@
   }
   if ( v115 < 3
     || (v123 = 0,
-        memcpy(&array_509950[v115], array_509950, sizeof(array_509950[v115])),
+        memcpy(&array_509950[v115], array_509950.data(), sizeof(array_509950[v115])),
         v42 = array_509950[0].vWorldViewProjY + 6.7553994e15,
         v43 = SLODWORD(v42) >= (signed int)pViewport->uViewportTL_Y,
         v115 < 1) )
     goto LABEL_112;
   v44 = (char *)&array_508FF0[0].vWorldViewProjX;
-  v130 = array_508FF0;
+  v130 = array_508FF0.data();
   v119 = (char *)&array_508FF0[0].vWorldViewProjX;
   v139 = (char *)&array_508FF0[0].vWorldViewProjY;
   v125 = (char *)&array_508FF0[0].flt_2C;
@@ -894,13 +894,13 @@
   }
   if ( v123 < 3
     || (v116 = 0,
-        memcpy(&array_508FF0[v123], array_508FF0, sizeof(array_508FF0[v123])),
+        memcpy(&array_508FF0[v123], array_508FF0.data(), sizeof(array_508FF0[v123])),
         v61 = array_508FF0[0].vWorldViewProjY + 6.7553994e15,
         v62 = SLODWORD(v61) <= (signed int)pViewport->uViewportBR_Y,
         v123 < 1) )
     goto LABEL_112;
   v63 = (char *)&array_508690[0].vWorldViewProjX;
-  v131 = array_508690;
+  v131 = array_508690.data();
   v120 = (char *)&array_508690[0].vWorldViewProjX;
   v140 = (char *)&array_508690[0].vWorldViewProjY;
   v126 = (char *)&array_508690[0].flt_2C;
@@ -986,7 +986,7 @@
   if ( v116 < 3 )
     goto LABEL_112;
   v80 = v116;
-  memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116]));
+  memcpy(&array_508690[v116], array_508690.data(), sizeof(array_508690[v116]));
   if ( v116 > 0 )
   {
     v81 = (char *)&array_508690[0].vWorldViewProjX;
--- a/mm7_data.cpp	Sun Jun 09 00:30:48 2013 +0200
+++ b/mm7_data.cpp	Sun Jun 09 01:10:49 2013 +0200
@@ -1340,7 +1340,7 @@
 int blv_prev_party_y; // weak
 char *dword_721660; // idb
 char *dword_721664; // idb
-NPCTopic pNPCTopics[789];
+std::array<NPCTopic, 789> pNPCTopics;
 char *dword_722F10; // idb
 std::array<const char *, 512> pQuestTable;
 _UNKNOWN unk_723714; // weak