Mercurial > mm7
changeset 1207:96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
undone changes in render.h, because framerate dropped by half
author | Grumpy7 |
---|---|
date | Sun, 09 Jun 2013 01:30:36 +0200 |
parents | ab6560001f5b |
children | 4d90f0591add |
files | Indoor.cpp Outdoor.cpp Player.cpp Render.cpp Render.h SaveLoad.cpp SpriteObject.cpp SpriteObject.h Texture.cpp Texture.h UIHouses.cpp UIPopup.cpp UiGame.cpp mm7_1.cpp mm7_3.cpp mm7_5.cpp mm7_6.cpp mm7_data.cpp stru159.h stru160.h stru220.h stru6.cpp texts.cpp texts.h |
diffstat | 24 files changed, 170 insertions(+), 170 deletions(-) [+] |
line wrap: on
line diff
--- a/Indoor.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/Indoor.cpp Sun Jun 09 01:30:36 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.data(), &stru_F8AD28); - pGame->pIndoorCameraD3D->Project(array_507D30.data(), uNumVerticesa, 0); + pGame->pIndoorCameraD3D->ViewTransfrom_OffsetUV(static_vertices_F7B628, uNumVerticesa, array_507D30, &stru_F8AD28); + pGame->pIndoorCameraD3D->Project(array_507D30, 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.data(), pVertices, 0); + pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0); if (pDecalBuilder->uNumDecals > 0) - pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30.data(), pVertices, 0, pFace->uSectorID); + pDecalBuilder->ApplyDecals(a4a, 1, &stru_F7B60C, uNumVerticesa, array_507D30, pVertices, 0, pFace->uSectorID); if (pFace->Fluid()) { @@ -2886,14 +2886,14 @@ pGameLoadingUI_ProgressBar->Progress(); memcpy(&uNumSpriteObjects, pData, 4); - memcpy(pSpriteObjects, pData + 4, uNumSpriteObjects * sizeof(SpriteObject)); + memcpy(pSpriteObjects.data(), pData + 4, uNumSpriteObjects * sizeof(SpriteObject)); pData += 4 + uNumSpriteObjects * sizeof(SpriteObject); pGameLoadingUI_ProgressBar->Progress(); for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto pItem = pSpriteObjects + i; + auto pItem = &pSpriteObjects[i]; if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100)) { @@ -4546,7 +4546,7 @@ for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto p = pSpriteObjects + i; + auto p = &pSpriteObjects[i]; if (p->uObjectDescID) { auto uItemID = p->stru_24.uItemID;
--- a/Outdoor.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/Outdoor.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -2306,7 +2306,7 @@ pGameLoadingUI_ProgressBar->Progress(); //pFilename = (char *)(112 * uNumSpriteObjects); - memcpy(pSpriteObjects, pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject)); + memcpy(pSpriteObjects.data(), pSrc + 4, uNumSpriteObjects * sizeof(SpriteObject)); pSrc += 4 + uNumSpriteObjects * sizeof(SpriteObject); //v94 = (char *)v93 + (int)pFilename;
--- a/Player.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/Player.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -109,7 +109,7 @@ signed int pAgeingTable[4] = {50, 100, 150, 0xFFFF}; -unsigned int pConditionImportancyTable[18] = {16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}; +std::array<unsigned int, 18> pConditionImportancyTable = {{16, 15, 14, 17, 13, 2, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0}}; short param_to_bonus_table[29] = {500, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100, 75, 50, 40, 35, 30, 25, 21,
--- a/Render.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/Render.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -42,28 +42,28 @@ struct IDirectDrawClipper *pDDrawClipper; struct Render *pRenderer; // idb -struct RenderVertexD3D3 pVertices[50]; +struct RenderVertexD3D3 pVertices[50]; int uNumDecorationsDrawnThisFrame; // weak -std::array<RenderBillboard, 500> pBillboardRenderList; +RenderBillboard pBillboardRenderList[500]; unsigned int uNumBillboardsToDraw; int uNumSpritesDrawnThisFrame; // weak -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 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]; RenderVertexSoft *ptr_801A04; RenderVertexSoft *ptr_801A08; -std::array<RenderVertexSoft, 384> pVerticesSR_801A10; -std::array<RenderVertexSoft, 384> pVerticesSR_806210; +RenderVertexSoft pVerticesSR_801A10[384]; +RenderVertexSoft pVerticesSR_806210[384]; 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; @@ -1531,8 +1531,8 @@ break; } //v69 = v16 - 1; - ptr_801A08 = pVerticesSR_806210.data(); - ptr_801A04 = pVerticesSR_801A10.data(); + ptr_801A08 = pVerticesSR_806210; + ptr_801A04 = pVerticesSR_801A10; //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.data(); + v32 = (struct8 *)array_50AC10; v97 = (int)pGame->pLightmapBuilder; - pGame->pLightmapBuilder->StackLights_TerrainFace(v23, &v95, array_50AC10.data(), 4, 1); - pDecalBuilder->_49BE8A(v16, v23, &v95, array_50AC10.data(), 4, 1); + pGame->pLightmapBuilder->StackLights_TerrainFace(v23, &v95, array_50AC10, 4, 1); + pDecalBuilder->_49BE8A(v16, v23, &v95, array_50AC10, 4, 1); a5 = 4; if ( byte_4D864C && pGame->uFlags & 0x80 ) { thisa = pGame->pIndoorCameraD3D; - if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10.data(), &a5, 0) == 1 && !a5 ) + if ( pGame->pIndoorCameraD3D->_4371C3(array_50AC10, &a5, 0) == 1 && !a5 ) goto LABEL_162; - thisa->ViewTransform(array_50AC10.data(), a5); - thisa->Project(array_50AC10.data(), a5, 0); + thisa->ViewTransform(array_50AC10, a5); + thisa->Project(array_50AC10, 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.data(), 0, *(float *)&v33, -1); + pDecalBuilder->ApplyDecals(31 - v16->dimming_level, 4, &static_sub_0048034E_stru_154, a5, array_50AC10, 0, *(float *)&v33, -1); } if ( stru_F8AD28.uNumLightsApplied > 0 ) - pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10.data(), 0, v33); + pGame->pLightmapBuilder->ApplyLights(&stru_F8AD28, &static_sub_0048034E_stru_154, a5, array_50AC10, 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.data(), v104, 0x30u); + memcpy(array_50AC10, 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.data(), 4u, 1); + pGame->pLightmapBuilder->StackLights_TerrainFace(pNormal, &a3a, array_50AC10, 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.data(), 4, pNormal); + pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 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.data(), v104, 0x30u); + memcpy(array_50AC10, 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.data(), 3u, 0); + pGame->pLightmapBuilder->StackLights_TerrainFace(pNormala, &v78, array_50AC10, 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.data(), 3, pNormala); + pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 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.data(), v54, v38); + sr_sub_481DB2(array_508690, 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.data(), v104, 0x30u); + memcpy(array_50AC10, 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.data(), 3u, 1); + pGame->pLightmapBuilder->StackLights_TerrainFace(pNormalb, &v70, array_50AC10, 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.data(), 3, pNormalb); + pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, 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.data(), v33, v17); + sr_sub_481DB2(array_508690, 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; @@ -3079,7 +3079,7 @@ //v41 = 0; for (int i = 0; i < uNumSpriteObjects; ++i) { - auto object = pSpriteObjects + i; + auto object = &pSpriteObjects[i]; //auto v0 = (char *)&pSpriteObjects[i].uSectorID; //v0 = (char *)&pSpriteObjects[0].uSectorID; //do @@ -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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), uNumVertices, 16); + this->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), uNumVertices, 0x00FFFFFF, 0.0); + pGame->pIndoorCameraD3D->debug_outline_d3d(d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, a2, 28)); } @@ -7682,7 +7682,7 @@ ErrD3D(pRenderD3D->pDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, - d3d_vertex_buffer.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, 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.data(), + d3d_vertex_buffer, uNumVertices, 28)); ErrD3D(pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE));
--- a/Render.h Sun Jun 09 01:10:49 2013 +0200 +++ b/Render.h Sun Jun 09 01:30:36 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 std::array<RenderBillboard, 500> pBillboardRenderList; +extern RenderBillboard pBillboardRenderList[500]; extern unsigned int uNumBillboardsToDraw; extern int uNumSpritesDrawnThisFrame; // weak -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_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, 20> array_73D150; +extern RenderVertexSoft array_73D150[20]; -extern std::array<RenderVertexD3D3, 50> d3d_vertex_buffer; +extern RenderVertexD3D3 d3d_vertex_buffer[50]; extern RenderVertexSoft *ptr_801A04; extern RenderVertexSoft *ptr_801A08; -extern std::array<RenderVertexSoft, 384> pVerticesSR_801A10; -extern std::array<RenderVertexSoft, 384> pVerticesSR_806210; \ No newline at end of file +extern RenderVertexSoft pVerticesSR_801A10[384]; +extern RenderVertexSoft pVerticesSR_806210[384]; \ No newline at end of file
--- a/SaveLoad.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/SaveLoad.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -423,7 +423,7 @@ data_write_pos += 836 * uNumActors; memcpy(data_write_pos, &uNumSpriteObjects, 4); data_write_pos += 4; - memcpy(data_write_pos, pSpriteObjects, 112 * uNumSpriteObjects); + memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects); data_write_pos += 112 * uNumSpriteObjects; memcpy(data_write_pos, &uNumChests, 4); data_write_pos += 4; @@ -472,7 +472,7 @@ data_write_pos += 836 * uNumActors; memcpy(data_write_pos, &uNumSpriteObjects, 4); data_write_pos += 4; - memcpy(data_write_pos, pSpriteObjects, 112 * uNumSpriteObjects); + memcpy(data_write_pos, pSpriteObjects.data(), 112 * uNumSpriteObjects); data_write_pos += 112 * uNumSpriteObjects; memcpy(data_write_pos, &uNumChests, 4); data_write_pos += 4;
--- a/SpriteObject.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/SpriteObject.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -27,7 +27,7 @@ size_t uNumSpriteObjects; -SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS]; +std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects; //----- (00404828) -------------------------------------------------------- SpriteObject::SpriteObject()
--- a/SpriteObject.h Sun Jun 09 01:10:49 2013 +0200 +++ b/SpriteObject.h Sun Jun 09 01:30:36 2013 +0200 @@ -52,4 +52,4 @@ extern size_t uNumSpriteObjects; -extern SpriteObject pSpriteObjects[MAX_SPRITE_OBJECTS]; \ No newline at end of file +extern std::array<SpriteObject, MAX_SPRITE_OBJECTS> pSpriteObjects; \ No newline at end of file
--- a/Texture.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/Texture.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -28,7 +28,7 @@ -Texture *pTexture_LloydBeacons[2]; +std::array<Texture *, 2> pTexture_LloydBeacons; Texture *pTexture_50635C; Texture *pTexture_506368; Texture *pTexture_50636C; @@ -46,17 +46,17 @@ Texture *pTex_tab_an_6a__zoom_off; Texture *pTex_tab_an_7b__zoot_on; Texture *pTex_tab_an_6b__zoom_on; -Texture *pTexture_TownPortalIcons[6]; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit -Texture *dword_5063D8[12]; -Texture *dword_506408[12]; +std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit +std::array<Texture *, 12> dword_5063D8; +std::array<Texture *, 12> dword_506408; Texture *pTexture_50643C; // idb Texture *ptr_506440; Texture *pTexture_506444; Texture *pTexture_506448; // idb -Texture *pTextures_tabs[9][2]; +std::array<std::array<Texture *, 2>, 9> pTextures_tabs; Texture *pTexture_mapbordr; // idb Texture *pTexture_pagemask; // idb -Texture *pSpellBookPagesTextr[9]; +std::array<Texture *, 9> pSpellBookPagesTextr; Texture *pSpellBookPagesTextr_9; Texture *pSpellBookPagesTextr_10; Texture *pSpellBookPagesTextr_11; @@ -110,12 +110,12 @@ unsigned int uTextureID_BUTTMAKE; unsigned int uTextureID_BUTTYES2; unsigned int uTextureID_x_ok_u; -Texture *pPlayerPortraits[22]; -Texture *pTexture_IC_KNIGHT[9]; +std::array<Texture *, 22> pPlayerPortraits; +std::array<Texture *, 9> pTexture_IC_KNIGHT; Texture *pTexture_MAKESKY; Texture *pTexture_MAKETOP; -Texture *pTextures_arrowr[20]; -Texture *pTextures_arrowl[20]; +std::array<Texture *, 20> pTextures_arrowr; +std::array<Texture *, 20> pTextures_arrowl; Texture *pTexture_presleft; Texture *pTexture_pressrigh; Texture *pTexture_buttminu; @@ -146,7 +146,7 @@ unsigned int uTextureID_FONTPAL; unsigned int uTextureID_Btn_NPCRight; unsigned int uTextureID_Btn_NPCLeft; -unsigned int pTextureIDs_pMapDirs[8]; +std::array<unsigned int, 8> pTextureIDs_pMapDirs; unsigned int uTextureID_BarRed; @@ -173,7 +173,7 @@ Texture *pTexture_RestUI_CurrentHourglassFrame; // idb -unsigned int uTextureID_Optkb[5]; +std::array<unsigned int, 5> uTextureID_Optkb; unsigned int uTextureID_507C10; // weak unsigned int uTextureID_507C14; // weak @@ -181,7 +181,7 @@ unsigned int uTextureID_507C1C; // weak unsigned int uTextureID_507C20; // weak unsigned int uTextureID_507C24; // weak -unsigned int pTextureIDs_GammaPositions[10]; +std::array<unsigned int, 10> pTextureIDs_GammaPositions; unsigned int uTextureID_507C50; // weak unsigned int uTextureID_507C54; // weak unsigned int uTextureID_507C58; // weak
--- a/Texture.h Sun Jun 09 01:10:49 2013 +0200 +++ b/Texture.h Sun Jun 09 01:30:36 2013 +0200 @@ -128,7 +128,7 @@ extern std::array<struct RGBTexture, 45> pSavegameThumbnails; -extern Texture *pTexture_LloydBeacons[2]; +extern std::array<Texture *, 2> pTexture_LloydBeacons; extern Texture *pTexture_50635C; extern Texture *pTexture_506368; extern Texture *pTexture_50636C; @@ -146,18 +146,18 @@ extern Texture *pTex_tab_an_6a__zoom_off; extern Texture *pTex_tab_an_7b__zoot_on; extern Texture *pTex_tab_an_6b__zoom_on; -extern Texture *pTexture_TownPortalIcons[]; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit +extern std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit -extern Texture *dword_5063D8[]; -extern Texture *dword_506408[]; +extern std::array<Texture *, 12> dword_5063D8; +extern std::array<Texture *, 12> dword_506408; extern Texture *pTexture_50643C; // idb extern Texture *ptr_506440; extern Texture *pTexture_506444; extern Texture *pTexture_506448; // idb -extern Texture *pTextures_tabs[9][2]; +extern std::array<std::array<Texture *, 2>, 9> pTextures_tabs; extern Texture *pTexture_mapbordr; // idb extern Texture *pTexture_pagemask; // idb -extern Texture *pSpellBookPagesTextr[9]; +extern std::array<Texture *, 9> pSpellBookPagesTextr; extern Texture *pSpellBookPagesTextr_9; extern Texture *pSpellBookPagesTextr_10; extern Texture *pSpellBookPagesTextr_11; @@ -211,12 +211,12 @@ extern unsigned int uTextureID_BUTTMAKE; extern unsigned int uTextureID_BUTTYES2; extern unsigned int uTextureID_x_ok_u; -extern Texture *pPlayerPortraits[22]; -extern Texture *pTexture_IC_KNIGHT[]; +extern std::array<Texture *, 22> pPlayerPortraits; +extern std::array<Texture *, 9> pTexture_IC_KNIGHT; extern Texture *pTexture_MAKESKY; extern Texture *pTexture_MAKETOP; -extern Texture *pTextures_arrowr[20]; -extern Texture *pTextures_arrowl[20]; +extern std::array<Texture *, 20> pTextures_arrowr; +extern std::array<Texture *, 20> pTextures_arrowl; extern Texture *pTexture_presleft; extern Texture *pTexture_pressrigh; extern Texture *pTexture_buttminu; @@ -247,7 +247,7 @@ extern unsigned int uTextureID_FONTPAL; extern unsigned int uTextureID_Btn_NPCRight; extern unsigned int uTextureID_Btn_NPCLeft; -extern unsigned int pTextureIDs_pMapDirs[8]; +extern std::array<unsigned int, 8> pTextureIDs_pMapDirs; extern unsigned int uTextureID_BarRed; @@ -274,7 +274,7 @@ extern Texture *pTexture_RestUI_CurrentHourglassFrame; // idb -extern unsigned int uTextureID_Optkb[5]; +extern std::array<unsigned int, 5> uTextureID_Optkb; extern unsigned int uTextureID_507C10; // weak extern unsigned int uTextureID_507C14; // weak @@ -282,7 +282,7 @@ extern unsigned int uTextureID_507C1C; // weak extern unsigned int uTextureID_507C20; // weak extern unsigned int uTextureID_507C24; // weak -extern unsigned int pTextureIDs_GammaPositions[10]; +extern std::array<unsigned int, 10> pTextureIDs_GammaPositions; extern unsigned int uTextureID_507C50; // weak extern unsigned int uTextureID_507C54; // weak extern unsigned int uTextureID_507C58; // weak
--- a/UIHouses.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/UIHouses.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -118,8 +118,8 @@ -const stru159 pAnimatedRooms[196] = //0x4E5F70 -{ +std::array<const stru159, 196> pAnimatedRooms = //0x4E5F70 +{{ {"", 0x4, 0x1F4, 0, 0, 0}, {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, @@ -316,7 +316,7 @@ {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, {"Player Castle Good", 0x24, 0, 25, 0, 0 }, {"Player Castle Bad", 0x24, 0, 25, 0, 0} -}; +}};
--- a/UIPopup.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/UIPopup.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -1639,7 +1639,7 @@ case 10:// Player Condition strcpy(pTmpBuf2.data(), pPlayerConditionAttributeDescription); strcat(pTmpBuf2.data(), "\n"); - extern unsigned int pConditionImportancyTable[18]; + extern std::array<unsigned int, 18> pConditionImportancyTable; for ( uint i = 0; i < 18; ++i ) { if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] )
--- a/UiGame.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/UiGame.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -2638,7 +2638,7 @@ for (uint i = 0; i < uNumSpriteObjects; ++i) //if (uNumSpriteObjects > 0) { - auto object = pSpriteObjects + i; + auto object = &pSpriteObjects[i]; //a2c = (char *)&pSpriteObjects[0].uObjectDescID; //while ( 1 )
--- a/mm7_1.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/mm7_1.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -2593,7 +2593,7 @@ char *v25; // [sp+2Ch] [bp-4h]@4 v1 = uVertexID; - memcpy(&array_50AC10[uVertexID], array_50AC10.data(), sizeof(array_50AC10[uVertexID])); + memcpy(&array_50AC10[uVertexID], array_50AC10, 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.data(); + v21 = array_507D30; 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 01:10:49 2013 +0200 +++ b/mm7_3.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -1362,7 +1362,7 @@ //v20 = 0; for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto item = pSpriteObjects + i; + auto item = &pSpriteObjects[i]; //v2 = (char *)&item->uSpriteFrameID; //do //{ @@ -4665,7 +4665,7 @@ { //v19 = (char *)&array_73D150[0].vWorldPosition.z; //v20 = (char *)pFace->pTextureUIDs; - v19 = array_73D150.data(); + v19 = array_73D150; v20 = pFace->pTextureUIDs; v20b = pFace->pVertexIDs; v20c = pFace->pTextureVIDs; @@ -4707,7 +4707,7 @@ } while ( !v10 ); //v23 = (char *)&array_73D150[0].vWorldViewPosition; - v23 = array_73D150.data(); + v23 = array_73D150; 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.data(), v7) ) + if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) ) { LOBYTE(v25) = (char)v54; v26 = a1; @@ -4814,13 +4814,13 @@ v40 = -1; v39 = v31; v38 = 0; - v37 = array_50AC10.data(); + v37 = array_50AC10; v36 = uNumVertices; pDecalBuilder->ApplyDecals(31 - v7->dimming_level, 2, &static_RenderBuildingsD3D_stru_73C834, uNumVertices, - array_50AC10.data(), + array_50AC10, 0, (char)v31, -1); @@ -4831,7 +4831,7 @@ &stru_F8AD28, &static_RenderBuildingsD3D_stru_73C834, uNumVertices, - array_50AC10.data(), + array_50AC10, 0, (char)v31); if ( v50 ) @@ -5091,7 +5091,7 @@ return result; ++pOutdoorCamera->numStru148s; ++pOutdoorCamera->field_44; - if ( !ODMFace::IsBackfaceCulled(v3, array_73D150.data(), v12) ) + if ( !ODMFace::IsBackfaceCulled(v3, array_73D150, 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.data(), v26, (Vec3_float_ *)&v55); + pGame->pLightmapBuilder->_45CA88(&stru_F8AD28, array_50AC10, v26, (Vec3_float_ *)&v55); } if ( v74 ) { @@ -5273,7 +5273,7 @@ } } } - sr_sub_486B4E_push_outdoor_edges(array_508690.data(), dword_50B638.data(), dword_50B570.data(), v12); + sr_sub_486B4E_push_outdoor_edges(array_508690, dword_50B638.data(), dword_50B570.data(), v12); } LABEL_72: ++v79; @@ -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.data(), sizeof(array_507D30[v3])); + memcpy(&array_507D30[v3], array_507D30, 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.data() + 28; + LODWORD(v76) = (int)(char *)array_50AC10 + 28; v29 = (char *)&array_50AC10[0].vWorldViewProjX; v30 = (char *)&array_507D30[1].vWorldViewProjY; - v79 = array_50AC10.data(); - v81 = array_507D30.data(); + v79 = array_50AC10; + v81 = array_507D30; v78 = v62.uNumVertices; do { @@ -6546,8 +6546,8 @@ if ( SLODWORD(v73) > 0 ) { v48 = (double)SLODWORD(v80); - v75 = array_507D30.data(); - v49 = array_50AC10.data(); + v75 = array_507D30; + v49 = array_50AC10; HIDWORD(v69) = LODWORD(v73); do { @@ -6569,8 +6569,8 @@ if ( SLODWORD(v73) > 0 ) { v51 = (double)SLODWORD(v80); - v75 = array_507D30.data(); - v52 = array_50AC10.data(); + v75 = array_507D30; + v52 = array_50AC10; v80 = v73; do { @@ -7914,8 +7914,8 @@ v13 = &array_508690[v21]; if ( LODWORD(v29) != 3 ) { - v11 = array_508690.data(); - v13 = (RenderVertexSoft *)((char *)array_508690.data() + 16 * (3 * v1 - 3)); + v11 = array_508690; + v13 = (RenderVertexSoft *)((char *)array_508690 + 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; @@ -11258,7 +11258,7 @@ for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto p = pSpriteObjects + i; + auto p = &pSpriteObjects[i]; if (p->uObjectDescID) { v1 = &pObjectList->pObjects[p->uObjectDescID];
--- a/mm7_5.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/mm7_5.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -8830,7 +8830,7 @@ { for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto item = pSpriteObjects + i; + auto item = &pSpriteObjects[i]; if (item->uType && (item->uSoundID & 8 || pObjectList->pObjects[item->uType].uFlags & 0x10))
--- a/mm7_6.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/mm7_6.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -75,7 +75,7 @@ v1 = uVertexID; v2 = (double)pOutdoorCamera->shading_dist_mist; - memcpy(&array_50AC10[uVertexID], array_50AC10.data(), sizeof(array_50AC10[uVertexID])); + memcpy(&array_50AC10[uVertexID], array_50AC10, 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.data(); + v24 = array_507D30; 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.data(), sizeof(array_50AC10[uVertexID])); + memcpy(&array_50AC10[uVertexID], array_50AC10, 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.data(); + v22 = array_507D30; 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.data(), sizeof(array_50AC10[uVertexID])); + memcpy(&array_50AC10[uVertexID], array_50AC10, 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.data(); + v23 = array_507D30; 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.data(), array_50AC10.data(), 4 * ((unsigned int)(48 * a1) >> 2)); + memcpy(array_508690, array_50AC10, 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.data(), sizeof(array_50AC10[v1])); + memcpy(&array_50AC10[v1], array_50AC10, 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.data(); + v132 = array_50A2B0; 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.data(), sizeof(array_50A2B0[v110])), + memcpy(&array_50A2B0[v110], array_50A2B0, 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.data(); + v138 = array_509950; 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.data(), sizeof(array_509950[v115])), + memcpy(&array_509950[v115], array_509950, 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.data(); + v130 = array_508FF0; 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.data(), sizeof(array_508FF0[v123])), + memcpy(&array_508FF0[v123], array_508FF0, 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.data(); + v131 = array_508690; 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.data(), sizeof(array_508690[v116])); + memcpy(&array_508690[v116], array_508690, sizeof(array_508690[v116])); if ( v116 > 0 ) { v81 = (char *)&array_508690[0].vWorldViewProjX; @@ -2930,7 +2930,7 @@ int _v733 = 0; for (uint i = 0; i < uNumSpriteObjects; ++i) { - auto object = pSpriteObjects + i; + auto object = &pSpriteObjects[i]; if (object->uType && object->spell_id == SPELL_FIRE_FIRE_SPIKE && object->spell_caster_pid == PID(OBJECT_Player, pCastSpell->uPlayerID)) ++_v733; /*v33 = (char *)&pSpriteObjects[0].field_48;
--- a/mm7_data.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/mm7_data.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -64,8 +64,8 @@ #include "stru159.h" #include "stru160.h" -stru160 array_4EB8B8[66] = -{ +std::array<stru160, 66> array_4EB8B8 = +{{ stru160( 0.0000000f, 0.0000000f, 1.0000000f), stru160( 0.0000000f, 0.3826830f, 0.9238799f), stru160( 0.3826830f, 0.0000000f, 0.9238799f), @@ -132,10 +132,10 @@ stru160(-0.4082480f, 0.4082480f, -0.8164970f), stru160(-0.8164970f, 0.4082480f, -0.4082480f), stru160(-0.4082480f, 0.8164970f, -0.4082480f) -}; -stru160 array_4EBBD0[128]; -__int32 array_4EBBD0_x[128*3] = -{ +}}; +std::array<stru160, 128> array_4EBBD0; +std::array<__int32, 128*3> array_4EBBD0_x = +{{ 0x00000000, 0x00000001, 0x00000002, 0x00000001, 0x00000003, 0x00000002, 0x00000001, 0x00000004, 0x00000003, 0x00000003, 0x00000005, 0x00000002, @@ -232,10 +232,10 @@ 0x00000026, 0x00000028, 0x00000041, 0x00000028, 0x00000031, 0x00000041, 0x00000028, 0x0000000B, 0x00000031, 0x00000031, 0x0000002D, 0x00000041 -}; +}}; #include "stru220.h" -stru220 stru_76E5C8[16384]; +std::array<stru220, 16384> stru_76E5C8; #include "stru176.h" stru176 array_5B5928_timers[100];
--- a/stru159.h Sun Jun 09 01:10:49 2013 +0200 +++ b/stru159.h Sun Jun 09 01:30:36 2013 +0200 @@ -16,4 +16,4 @@ #pragma pack(pop) -extern const stru159 pAnimatedRooms[196]; \ No newline at end of file +extern std::array<const stru159, 196> pAnimatedRooms; \ No newline at end of file
--- a/stru160.h Sun Jun 09 01:10:49 2013 +0200 +++ b/stru160.h Sun Jun 09 01:30:36 2013 +0200 @@ -21,6 +21,6 @@ }; #pragma pack(pop) -extern stru160 array_4EB8B8[66]; -extern stru160 array_4EBBD0[128]; -extern __int32 array_4EBBD0_x[128*3]; \ No newline at end of file +extern std::array<stru160, 66> array_4EB8B8; +extern std::array<stru160, 128> array_4EBBD0; +extern std::array<__int32, 128*3> array_4EBBD0_x; \ No newline at end of file
--- a/stru220.h Sun Jun 09 01:10:49 2013 +0200 +++ b/stru220.h Sun Jun 09 01:30:36 2013 +0200 @@ -11,4 +11,4 @@ __int16 distance; }; #pragma pack(pop) -extern stru220 stru_76E5C8[16384]; \ No newline at end of file +extern std::array<stru220, 16384> stru_76E5C8; \ No newline at end of file
--- a/stru6.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/stru6.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -56,7 +56,7 @@ pArray1[i].field_8 = array_4EB8B8[i].field_8; pArray1[i].field_C = a2; } - memcpy(pArray2, array_4EBBD0_x/*array_4EBBD0*/, uNumVec3sInArray2 * sizeof(stru160)); + memcpy(pArray2, array_4EBBD0_x.data()/*array_4EBBD0*/, uNumVec3sInArray2 * sizeof(stru160)); } //----- (0047829F) --------------------------------------------------------
--- a/texts.cpp Sun Jun 09 01:10:49 2013 +0200 +++ b/texts.cpp Sun Jun 09 01:30:36 2013 +0200 @@ -14,7 +14,7 @@ static char *pGlobalTXT_Raw=NULL; -char *pGlobalTXT_LocalizationStrings[MAX_LOC_STRINGS]; +std::array<char *, MAX_LOC_STRINGS> pGlobalTXT_LocalizationStrings;
--- a/texts.h Sun Jun 09 01:10:49 2013 +0200 +++ b/texts.h Sun Jun 09 01:30:36 2013 +0200 @@ -1,5 +1,5 @@ #pragma once - +#include <array> int __cdecl sprintfex(char *buf, const char *format, ...); @@ -168,7 +168,7 @@ }; -extern char *pGlobalTXT_LocalizationStrings[MAX_LOC_STRINGS]; + extern std::array<char *, MAX_LOC_STRINGS> pGlobalTXT_LocalizationStrings; /*