comparison TileTable.cpp @ 1607:d4282f59f312

Слияние
author Ritor1
date Wed, 11 Sep 2013 00:16:58 +0600
parents 75fafd8ced59
children c1c74df0a33e
comparison
equal deleted inserted replaced
1606:25f5c041f39b 1607:d4282f59f312
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "TileFrameTable.h" 9 #include "TileFrameTable.h"
10 #include "FrameTableInc.h" 10 #include "FrameTableInc.h"
11 #include "Allocator.h"
12 #include "PaletteManager.h" 11 #include "PaletteManager.h"
13 #include "LOD.h" 12 #include "LOD.h"
14 13
15 #include "mm7_data.h" 14 #include "mm7_data.h"
16 15
18 //----- (00487E1D) -------------------------------------------------------- 17 //----- (00487E1D) --------------------------------------------------------
19 TileTable::~TileTable() 18 TileTable::~TileTable()
20 { 19 {
21 if ( pTiles ) 20 if ( pTiles )
22 { 21 {
23 pAllocator->FreeChunk(pTiles); 22 free(pTiles);
24 pTiles = nullptr; 23 pTiles = nullptr;
25 } 24 }
26 sNumTiles = 0; 25 sNumTiles = 0;
27 } 26 }
28 27
117 num_mm8_tiles = data_mm8 ? *(int *)data_mm8 : 0; 116 num_mm8_tiles = data_mm8 ? *(int *)data_mm8 : 0;
118 sNumTiles = num_mm6_tiles + num_mm7_tiles + num_mm8_tiles; 117 sNumTiles = num_mm6_tiles + num_mm7_tiles + num_mm8_tiles;
119 Assert(sNumTiles); 118 Assert(sNumTiles);
120 Assert(!num_mm8_tiles); 119 Assert(!num_mm8_tiles);
121 120
122 pTiles = (TileDesc *)pAllocator->AllocNamedChunk(pTiles, sNumTiles * sizeof(TileDesc), "Tile Descrip"); 121 pTiles = (TileDesc *)malloc(sNumTiles * sizeof(TileDesc));
123 memcpy(pTiles, (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc)); 122 memcpy(pTiles, (char *)data_mm7 + 4, num_mm7_tiles * sizeof(TileDesc));
124 memcpy(pTiles + num_mm7_tiles, (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc)); 123 memcpy(pTiles + num_mm7_tiles, (char *)data_mm6 + 4, num_mm6_tiles * sizeof(TileDesc));
125 memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc)); 124 memcpy(pTiles + num_mm6_tiles + num_mm7_tiles, (char *)data_mm8 + 4, num_mm8_tiles * sizeof(TileDesc));
126 } 125 }
127 126
225 memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84)); 224 memcpy(&v84, txt_file_frametable_parser(&Buf, &v85), sizeof(v84));
226 if ( v84.uPropCount && *v84.pProperties[0] != 47 ) 225 if ( v84.uPropCount && *v84.pProperties[0] != 47 )
227 ++v4; 226 ++v4;
228 } 227 }
229 v2->sNumTiles = v4; 228 v2->sNumTiles = v4;
230 v5 = pAllocator->AllocNamedChunk(v2->pTiles, 26 * v4, "Tile Descrip"); 229 v5 = malloc(26 * v4);
231 v2->pTiles = (TileDesc *)v5; 230 v2->pTiles = (TileDesc *)v5;
232 if ( !v5 ) 231 if ( !v5 )
233 Error("TileTable::Load - Out of Memory!"); 232 Error("TileTable::Load - Out of Memory!");
234 memset(v5, 0, 26 * v2->sNumTiles); 233 memset(v5, 0, 26 * v2->sNumTiles);
235 v2->sNumTiles = 0; 234 v2->sNumTiles = 0;