-
RCS file: /cvsroot/scummvm/scummvm/gob/cdrom.cpp,v
retrieving revision 1.8
diff -u -r1.8 cdrom.cpp
|
|
|
86 | 86 | _vm->_dataio->seekData(handle, pos, SEEK_CUR); |
87 | 87 | } |
88 | 88 | |
89 | | _LICbuffer = (byte *)malloc(_numTracks * 22); |
| 89 | _LICbuffer = new byte[_numTracks * 22]; |
90 | 90 | _vm->_dataio->readData(handle, (char *)_LICbuffer, _numTracks * 22); |
91 | 91 | |
92 | 92 | _vm->_dataio->closeData(handle); |
93 | 93 | } |
94 | 94 | |
95 | 95 | void CDROM::freeLICbuffer(void) { |
96 | | free(_LICbuffer); |
| 96 | delete[] _LICbuffer; |
97 | 97 | _LICbuffer = 0; |
98 | 98 | } |
99 | 99 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/dataio.cpp,v
retrieving revision 1.14
diff -u -r1.14 dataio.cpp
|
|
|
185 | 185 | char path[128]; |
186 | 186 | int16 i; |
187 | 187 | int16 file; |
188 | | struct ChunkDesc *dataDesc; |
| 188 | ChunkDesc *dataDesc; |
189 | 189 | |
190 | 190 | strcpy(path, src); |
191 | 191 | for (i = 0; path[i] != '.' && path[i] != 0; i++); |
… |
… |
|
207 | 207 | |
208 | 208 | debug(7, "DataChunks: %d [for %s]", _vm->_global->_numDataChunks[file], path); |
209 | 209 | |
210 | | _vm->_global->_dataFiles[file] = dataDesc = |
211 | | (struct ChunkDesc *)malloc(sizeof(struct ChunkDesc) * |
212 | | _vm->_global->_numDataChunks[file]); |
| 210 | dataDesc = new ChunkDesc[_vm->_global->_numDataChunks[file]]; |
| 211 | _vm->_global->_dataFiles[file] = dataDesc; |
213 | 212 | |
214 | 213 | for (i = 0; i < _vm->_global->_numDataChunks[file]; i++) { |
215 | 214 | file_getHandle(_vm->_global->_dataFileHandles[file])->read(dataDesc[i].chunkName, 13); |
… |
… |
|
230 | 229 | int16 file; |
231 | 230 | for (file = MAX_DATA_FILES - 1; file >= 0; file--) { |
232 | 231 | if (_vm->_global->_dataFiles[file] != 0) { |
233 | | free(_vm->_global->_dataFiles[file]); |
| 232 | delete[] _vm->_global->_dataFiles[file]; |
234 | 233 | _vm->_global->_dataFiles[file] = 0; |
235 | 234 | file_getHandle(_vm->_global->_dataFileHandles[file])->close(); |
236 | 235 | return; |
… |
… |
|
254 | 253 | if (chunk == -1) |
255 | 254 | return 0; |
256 | 255 | |
257 | | unpackBuf = (char *)malloc(realSize); |
| 256 | unpackBuf = new char[realSize]; |
258 | 257 | if (unpackBuf == 0) |
259 | 258 | return 0; |
260 | 259 | |
261 | | packBuf = (char *)malloc(_vm->_global->_packedSize); |
| 260 | packBuf = new char[_vm->_global->_packedSize]; |
262 | 261 | if (packBuf == 0) { |
263 | | free(unpackBuf); |
| 262 | delete[] unpackBuf; |
264 | 263 | return 0; |
265 | 264 | } |
266 | 265 | |
… |
… |
|
274 | 273 | readChunk(chunk, ptr, sizeLeft); |
275 | 274 | freeChunk(chunk); |
276 | 275 | _vm->_pack->unpackData(packBuf, unpackBuf); |
277 | | free(packBuf); |
| 276 | |
| 277 | delete[] packBuf; |
278 | 278 | return unpackBuf; |
279 | 279 | } |
280 | 280 | |
… |
… |
|
346 | 346 | return data; |
347 | 347 | |
348 | 348 | size = getDataSize(path); |
349 | | data = (char *)malloc(size); |
| 349 | data = new char[size]; |
350 | 350 | if (data == 0) |
351 | 351 | return 0; |
352 | 352 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/draw.cpp,v
retrieving revision 1.21
diff -u -r1.21 draw.cpp
|
|
|
417 | 417 | _destSpriteX + _spriteRight - 1, |
418 | 418 | _destSpriteY + _spriteBottom - 1); |
419 | 419 | } |
420 | | free(dataBuf); |
| 420 | delete[] dataBuf; |
421 | 421 | break; |
422 | 422 | } |
423 | 423 | // Load from .TOT resources |
-
RCS file: /cvsroot/scummvm/scummvm/gob/draw.h,v
retrieving revision 1.10
diff -u -r1.10 draw.h
|
|
|
33 | 33 | |
34 | 34 | class Draw { |
35 | 35 | public: |
36 | | typedef struct FontToSprite { |
| 36 | struct FontToSprite { |
37 | 37 | int8 sprite; |
38 | 38 | int8 base; |
39 | 39 | int8 width; |
40 | 40 | int8 height; |
41 | 41 | FontToSprite() : sprite(0), base(0), width(0), height() {} |
42 | | } FontToSprite; |
| 42 | }; |
43 | 43 | |
44 | 44 | int16 _fontIndex; |
45 | 45 | int16 _spriteLeft; |
-
RCS file: /cvsroot/scummvm/scummvm/gob/game.cpp,v
retrieving revision 1.35
diff -u -r1.35 game.cpp
|
|
|
141 | 141 | |
142 | 142 | debug(7, "off: %ld size: %ld", offset, tableSize); |
143 | 143 | _vm->_dataio->seekData(handle, offset + tableSize, SEEK_SET); |
| 144 | // CHECKME: is the below correct? |
144 | 145 | if (isPacked) |
145 | | dataBuf = (char *)malloc(size); |
| 146 | dataBuf = new char[size]; |
146 | 147 | else |
147 | | dataBuf = (char *)malloc(size); |
| 148 | dataBuf = new char[size]; |
148 | 149 | |
149 | 150 | dataPtr = dataBuf; |
150 | 151 | while (size > 32000) { |
… |
… |
|
161 | 162 | |
162 | 163 | if (isPacked != 0) { |
163 | 164 | packedBuf = dataBuf; |
164 | | dataBuf = (char *)malloc(READ_LE_UINT32(packedBuf)); |
| 165 | dataBuf = new char[READ_LE_UINT32(packedBuf)]; |
165 | 166 | _vm->_pack->unpackData(packedBuf, dataBuf); |
166 | | free(packedBuf); |
| 167 | delete[] packedBuf; |
167 | 168 | } |
168 | 169 | |
169 | 170 | return dataBuf; |
… |
… |
|
229 | 230 | size++; |
230 | 231 | } |
231 | 232 | |
232 | | destPtr = (Collision *)malloc(size * sizeof(Collision)); |
| 233 | destPtr = new Collision[size]; |
233 | 234 | _collStack[_collStackSize] = destPtr; |
234 | 235 | _collStackElemSizes[_collStackSize] = size; |
235 | 236 | _collStackSize++; |
… |
… |
|
392 | 393 | void Game::loadSound(int16 slot, char *dataPtr) { |
393 | 394 | Snd::SoundDesc *soundDesc; |
394 | 395 | |
395 | | soundDesc = (Snd::SoundDesc *)malloc(sizeof(Snd::SoundDesc)); |
| 396 | soundDesc = new Snd::SoundDesc; |
396 | 397 | |
397 | 398 | _soundSamples[slot] = soundDesc; |
398 | 399 | |
… |
… |
|
437 | 438 | return; |
438 | 439 | |
439 | 440 | if (_soundFromExt[slot] == 1) { |
440 | | free(_soundSamples[slot]->data - 6); |
| 441 | delete[] (_soundSamples[slot]->data - 6); |
441 | 442 | _soundFromExt[slot] = 0; |
442 | 443 | } |
443 | 444 | |
444 | | free(_soundSamples[slot]); |
| 445 | delete _soundSamples[slot]; |
445 | 446 | _soundSamples[slot] = 0; |
446 | 447 | } |
447 | 448 | |
… |
… |
|
1687 | 1688 | count = FROM_LE_16(count); |
1688 | 1689 | |
1689 | 1690 | _vm->_dataio->seekData(_extHandle, 0, 0); |
1690 | | _extTable = (ExtTable *)malloc(sizeof(ExtTable) |
1691 | | + sizeof(ExtItem) * count); |
| 1691 | _extTable = new ExtTable; |
| 1692 | _extTable->items = 0; |
| 1693 | if (count) |
| 1694 | _extTable->items = new ExtItem[count]; |
1692 | 1695 | |
1693 | 1696 | _vm->_dataio->readData(_extHandle, (char *)&_extTable->itemsCount, 2); |
1694 | 1697 | _extTable->itemsCount = FROM_LE_16(_extTable->itemsCount); |
… |
… |
|
1855 | 1858 | _vm->_global->_inter_animDataSize = READ_LE_UINT16((char *)_totFileData + 0x38); |
1856 | 1859 | if (_vm->_global->_inter_variables == 0) { |
1857 | 1860 | variablesCount = READ_LE_UINT32((char *)_totFileData + 0x2c); |
1858 | | _vm->_global->_inter_variables = (char *)malloc(variablesCount * 4); |
| 1861 | _vm->_global->_inter_variables = new char[variablesCount * 4]; |
1859 | 1862 | for (i = 0; i < variablesCount; i++) |
1860 | 1863 | WRITE_VAR(i, 0); |
1861 | 1864 | } |
… |
… |
|
1877 | 1880 | |
1878 | 1881 | variablesCount = READ_LE_UINT32((char *)_totFileData + 0x2c); |
1879 | 1882 | _vm->_draw->blitInvalidated(); |
1880 | | free(_totFileData); |
| 1883 | delete[] _totFileData; |
1881 | 1884 | _totFileData = 0; |
1882 | 1885 | |
1883 | 1886 | if (needTextFree) |
1884 | | free(_totTextData); |
| 1887 | delete[] _totTextData; |
1885 | 1888 | _totTextData = 0; |
1886 | 1889 | |
1887 | 1890 | if (needFreeResTable) |
1888 | | free(_totResourceTable); |
| 1891 | delete[] _totResourceTable; |
1889 | 1892 | _totResourceTable = 0; |
1890 | 1893 | |
1891 | | free(_imFileData); |
| 1894 | delete[] _imFileData; |
1892 | 1895 | _imFileData = 0; |
1893 | 1896 | |
1894 | | free(_extTable); |
| 1897 | if (_extTable) |
| 1898 | delete[] _extTable->items; |
| 1899 | delete _extTable; |
1895 | 1900 | _extTable = 0; |
1896 | 1901 | |
1897 | 1902 | if (_extHandle >= 0) |
… |
… |
|
1931 | 1936 | } |
1932 | 1937 | |
1933 | 1938 | void Game::start(void) { |
1934 | | _collisionAreas = (Collision *)malloc(250 * sizeof(Collision)); |
| 1939 | _collisionAreas = new Collision[250]; |
1935 | 1940 | prepareStart(); |
1936 | 1941 | playTot(0); |
1937 | 1942 | |
1938 | | free(_collisionAreas); |
| 1943 | delete[] _collisionAreas; |
1939 | 1944 | |
1940 | 1945 | _vm->_video->freeSurfDesc(_vm->_draw->_cursorSprites); |
1941 | 1946 | _vm->_video->freeSurfDesc(_vm->_draw->_cursorBack); |
-
RCS file: /cvsroot/scummvm/scummvm/gob/game.h,v
retrieving revision 1.9
diff -u -r1.9 game.h
|
|
|
31 | 31 | |
32 | 32 | #pragma START_PACK_STRUCTS |
33 | 33 | #define szGame_TotResItem (4 + 2 + 2 + 2) |
34 | | typedef struct Collision { |
| 34 | struct Collision { |
35 | 35 | int16 id; |
36 | 36 | int16 left; |
37 | 37 | int16 top; |
… |
… |
|
41 | 41 | int16 key; |
42 | 42 | int16 funcEnter; |
43 | 43 | int16 funcLeave; |
44 | | } GCC_PACK Collision; |
| 44 | } GCC_PACK; |
45 | 45 | |
46 | | typedef struct TotResItem { |
| 46 | struct TotResItem { |
47 | 47 | int32 offset; // if > 0, then offset from end of resource table. |
48 | 48 | // If < 0, then -offset-1 is index in .IM file table |
49 | 49 | int16 size; |
50 | 50 | int16 width; |
51 | 51 | int16 height; |
52 | | } GCC_PACK TotResItem; |
| 52 | } GCC_PACK; |
53 | 53 | |
54 | 54 | #define szGame_TotResTable (2 + 1) |
55 | | typedef struct TotResTable { |
| 55 | struct TotResTable { |
56 | 56 | int16 itemsCount; |
57 | 57 | byte unknown; |
58 | 58 | TotResItem items[1]; |
59 | | } GCC_PACK TotResTable; |
| 59 | } GCC_PACK; |
60 | 60 | |
61 | 61 | #define szGame_ExtItem (4 + 2 + 2 + 2) |
62 | | typedef struct ExtItem { |
| 62 | struct ExtItem { |
63 | 63 | int32 offset; // offset from the table end |
64 | 64 | uint16 size; |
65 | 65 | int16 width; // width&0x7fff - width, width&0x8000 - pack flag |
66 | 66 | int16 height; // not zero |
67 | | } GCC_PACK ExtItem; |
| 67 | } GCC_PACK; |
68 | 68 | |
69 | 69 | #define szGame_ExtTable (2 + 1) |
70 | | typedef struct ExtTable { |
| 70 | struct ExtTable { |
71 | 71 | int16 itemsCount; |
72 | 72 | byte unknown; |
73 | | ExtItem items[1]; |
74 | | } GCC_PACK ExtTable; |
| 73 | ExtItem* items; |
| 74 | } GCC_PACK; |
75 | 75 | |
76 | 76 | #define szGame_TotTextItem (2 + 2) |
77 | | typedef struct TotTextItem { |
| 77 | struct TotTextItem { |
78 | 78 | int16 offset; |
79 | 79 | int16 size; |
80 | | } GCC_PACK TotTextItem; |
| 80 | } GCC_PACK; |
81 | 81 | |
82 | 82 | #define szGame_TotTextTable (2) |
83 | | typedef struct TotTextTable { |
| 83 | struct TotTextTable { |
84 | 84 | int16 itemsCount; |
85 | 85 | TotTextItem items[1]; |
86 | | } GCC_PACK TotTextTable; |
| 86 | } GCC_PACK; |
87 | 87 | |
88 | | typedef struct InputDesc { |
| 88 | struct InputDesc { |
89 | 89 | int16 fontIndex; |
90 | 90 | int16 backColor; |
91 | 91 | int16 frontColor; |
92 | 92 | char *ptr; |
93 | | } GCC_PACK InputDesc; |
| 93 | } GCC_PACK; |
94 | 94 | #pragma END_PACK_STRUCTS |
95 | 95 | |
96 | 96 | TotResTable *_totResourceTable; |
-
RCS file: /cvsroot/scummvm/scummvm/gob/global.cpp,v
retrieving revision 1.12
diff -u -r1.12 global.cpp
|
|
|
88 | 88 | |
89 | 89 | _oldMode = 3; |
90 | 90 | _dontSetPalette = 0; |
91 | | _curPrimaryDesc = 0; |
92 | | _allocatedPrimary = 0; |
93 | 91 | _pPrimarySurfDesc = 0; |
94 | 92 | |
95 | 93 | _pPaletteDesc = 0; |
… |
… |
|
146 | 144 | |
147 | 145 | _inter_mouseX = 0; |
148 | 146 | _inter_mouseY = 0; |
149 | | |
150 | | _tmpPalBuffer = 0; |
151 | 147 | } |
152 | 148 | |
153 | 149 | } // End of namespace Gob |
-
RCS file: /cvsroot/scummvm/scummvm/gob/global.h,v
retrieving revision 1.11
diff -u -r1.11 global.h
|
|
|
134 | 134 | |
135 | 135 | int16 _setAllPalette; |
136 | 136 | |
137 | | Video::SurfaceDesc *_curPrimaryDesc; |
138 | | Video::SurfaceDesc *_allocatedPrimary; |
139 | | Video::SurfaceDesc_t _primarySurfDesc; |
| 137 | Video::SurfaceDesc _primarySurfDesc; |
140 | 138 | Video::SurfaceDesc *_pPrimarySurfDesc; |
141 | 139 | |
142 | 140 | int16 _oldMode; |
… |
… |
|
163 | 161 | int16 _inter_mouseX; |
164 | 162 | int16 _inter_mouseY; |
165 | 163 | |
166 | | char *_tmpPalBuffer; |
167 | | |
168 | 164 | Global(GobEngine *vm); |
169 | 165 | |
170 | 166 | protected: |
-
RCS file: /cvsroot/scummvm/scummvm/gob/gob.h,v
retrieving revision 1.18
diff -u -r1.18 gob.h
|
|
|
73 | 73 | GF_MAC = 1 << 5 |
74 | 74 | }; |
75 | 75 | |
76 | | typedef struct GobGameSettings { |
| 76 | struct GobGameSettings { |
77 | 77 | const char *gameid; |
78 | 78 | const char *description; |
79 | 79 | uint32 features; |
… |
… |
|
82 | 82 | GameSettings dummy = { gameid, description, features }; |
83 | 83 | return dummy; |
84 | 84 | } |
85 | | } GobGameSettings; |
| 85 | }; |
86 | 86 | |
87 | 87 | class GobEngine : public Engine { |
88 | 88 | void errorString(const char *buf_input, char *buf_output); |
-
RCS file: /cvsroot/scummvm/scummvm/gob/goblin.cpp,v
retrieving revision 1.33
diff -u -r1.33 goblin.cpp
|
|
|
177 | 177 | } |
178 | 178 | |
179 | 179 | void Goblin::initList(void) { |
180 | | _objList = (Util::List *) malloc(sizeof(Util::List)); |
| 180 | _objList = new Util::List; |
181 | 181 | _objList->pHead = 0; |
182 | 182 | _objList->pTail = 0; |
183 | 183 | } |
… |
… |
|
1848 | 1848 | } |
1849 | 1849 | |
1850 | 1850 | delete[] _goblins[i]->stateMach; |
1851 | | free(_goblins[i]); |
| 1851 | delete _goblins[i]; |
1852 | 1852 | _goblins[i] = 0; |
1853 | 1853 | } |
1854 | 1854 | |
… |
… |
|
1866 | 1866 | } |
1867 | 1867 | |
1868 | 1868 | delete[] _objects[i]->stateMach; |
1869 | | free(_objects[i]); |
| 1869 | delete _objects[i]; |
1870 | 1870 | _objects[i] = 0; |
1871 | 1871 | } |
1872 | 1872 | } |
-
RCS file: /cvsroot/scummvm/scummvm/gob/goblin.h,v
retrieving revision 1.11
diff -u -r1.11 goblin.h
|
|
|
34 | 34 | class Goblin { |
35 | 35 | public: |
36 | 36 | #pragma START_PACK_STRUCTS |
37 | | typedef struct Gob_State { |
| 37 | struct Gob_State { |
38 | 38 | int16 animation;// +0h |
39 | 39 | int16 layer; // +2h |
40 | 40 | int16 unk0; // +4h |
… |
… |
|
43 | 43 | int16 freq; // +Ah, high/low byte * 100 - frequency |
44 | 44 | int16 repCount; // +Ch high/low byte - repeat count |
45 | 45 | int16 sndFrame; // +Eh |
46 | | } GCC_PACK Gob_State; |
| 46 | } GCC_PACK; |
47 | 47 | |
48 | 48 | typedef Gob_State *Gob_PState; |
49 | 49 | |
50 | 50 | typedef Gob_PState Gob_StateLine[6]; |
51 | 51 | |
52 | | typedef struct Gob_Object { |
| 52 | struct Gob_Object { |
53 | 53 | int16 animation; // +0h |
54 | 54 | int16 state; // +2h |
55 | 55 | int16 stateColumn; // +4h |
… |
… |
|
82 | 82 | char multObjIndex; // +37h, from which play mult animations |
83 | 83 | char unk14; // +38h |
84 | 84 | char visible; // +39h |
85 | | } GCC_PACK Gob_Object; |
| 85 | } GCC_PACK; |
86 | 86 | |
87 | | typedef struct Gob_Pos { |
| 87 | struct Gob_Pos { |
88 | 88 | char x; |
89 | 89 | char y; |
90 | | } GCC_PACK Gob_Pos; |
| 90 | } GCC_PACK; |
91 | 91 | #pragma END_PACK_STRUCTS |
92 | 92 | |
93 | 93 | Util::List *_objList; |
-
RCS file: /cvsroot/scummvm/scummvm/gob/init.cpp,v
retrieving revision 1.17
diff -u -r1.17 init.cpp
|
|
|
104 | 104 | _vm->_gtimer->disableTimer(); |
105 | 105 | |
106 | 106 | _vm->_video->freeDriver(); |
107 | | if (_vm->_global->_curPrimaryDesc != 0) { |
108 | | _vm->_video->freeSurfDesc(_vm->_global->_curPrimaryDesc); |
109 | | _vm->_video->freeSurfDesc(_vm->_global->_allocatedPrimary); |
110 | | _vm->_global->_allocatedPrimary = 0; |
111 | | _vm->_global->_curPrimaryDesc = 0; |
112 | | } |
| 107 | _vm->_video->freeSurfDesc(_vm->_global->_pPrimarySurfDesc); |
113 | 108 | _vm->_global->_pPrimarySurfDesc = 0; |
| 109 | |
114 | 110 | if (_vm->_snd->_cleanupFunc != 0 && _vm->_snd->_playingSound != 0) { |
115 | 111 | (*_vm->_snd->_cleanupFunc) (0); |
116 | 112 | _vm->_snd->_cleanupFunc = 0; |
… |
… |
|
172 | 168 | _vm->_game->_totFileData = 0; |
173 | 169 | _vm->_game->_totResourceTable = 0; |
174 | 170 | _vm->_global->_inter_variables = 0; |
175 | | _palDesc = (Video::PalDesc *)malloc(12); |
| 171 | _palDesc = new Video::PalDesc; |
176 | 172 | |
177 | 173 | if (_vm->_global->_videoMode != 0x13) |
178 | 174 | error("initGame: Only 0x13 video mode is supported!"); |
… |
… |
|
224 | 220 | if (infPtr == infEnd) |
225 | 221 | break; |
226 | 222 | } |
227 | | |
228 | | free(infBuf); |
| 223 | delete[] infBuf; |
229 | 224 | } |
230 | 225 | |
231 | 226 | if (totName != 0) { |
… |
… |
|
244 | 239 | varsCount = FROM_LE_32(varsCount); |
245 | 240 | _vm->_dataio->closeData(handle); |
246 | 241 | |
247 | | _vm->_global->_inter_variables = (char *)malloc(varsCount * 4); |
| 242 | _vm->_global->_inter_variables = new char[varsCount * 4]; |
248 | 243 | memset(_vm->_global->_inter_variables, 0, varsCount * 4); |
249 | 244 | |
250 | 245 | strcpy(_vm->_game->_curTotFile, buffer); |
… |
… |
|
256 | 251 | _vm->_cdrom->stopPlaying(); |
257 | 252 | _vm->_cdrom->freeLICbuffer(); |
258 | 253 | |
259 | | free(_vm->_global->_inter_variables); |
260 | | free(_vm->_game->_totFileData); |
261 | | free(_vm->_game->_totTextData); |
262 | | free(_vm->_game->_totResourceTable); |
| 254 | delete[] _vm->_global->_inter_variables; |
| 255 | delete[] _vm->_game->_totFileData; |
| 256 | delete[] _vm->_game->_totTextData; |
| 257 | delete[] _vm->_game->_totResourceTable; |
263 | 258 | } |
264 | 259 | |
265 | 260 | for (i = 0; i < 4; i++) { |
… |
… |
|
267 | 262 | _vm->_util->freeFont(_vm->_draw->_fonts[i]); |
268 | 263 | } |
269 | 264 | |
270 | | free(_palDesc); |
| 265 | delete _palDesc; |
271 | 266 | _vm->_dataio->closeDataFile(); |
272 | 267 | _vm->_video->initPrimary(-1); |
273 | 268 | cleanup(); |
-
RCS file: /cvsroot/scummvm/scummvm/gob/map.cpp,v
retrieving revision 1.23
diff -u -r1.23 map.cpp
|
|
|
512 | 512 | |
513 | 513 | _vm->_goblin->_gobsCount = loadFromAvo_LE_UINT16(); |
514 | 514 | for (i = 0; i < _vm->_goblin->_gobsCount; i++) { |
515 | | _vm->_goblin->_goblins[i] = (Goblin::Gob_Object *)malloc(sizeof(Goblin::Gob_Object)); |
| 515 | _vm->_goblin->_goblins[i] = new Goblin::Gob_Object; |
516 | 516 | |
517 | 517 | _vm->_goblin->_goblins[i]->xPos = READ_LE_UINT16(savedPtr2); |
518 | 518 | savedPtr2 += 2; |
… |
… |
|
620 | 620 | |
621 | 621 | _vm->_goblin->_objCount = loadFromAvo_LE_UINT16(); |
622 | 622 | for (i = 0; i < _vm->_goblin->_objCount; i++) { |
623 | | _vm->_goblin->_objects[i] = |
624 | | (Goblin::Gob_Object *) malloc(sizeof(Goblin::Gob_Object)); |
| 623 | _vm->_goblin->_objects[i] = new Goblin::Gob_Object; |
625 | 624 | |
626 | 625 | _vm->_goblin->_objects[i]->xPos = READ_LE_UINT16(savedPtr3); |
627 | 626 | savedPtr3 += 2; |
… |
… |
|
681 | 680 | delete[] tempstatedata; |
682 | 681 | } |
683 | 682 | |
684 | | _vm->_goblin->_objects[10] = (Goblin::Gob_Object *)malloc(sizeof(Goblin::Gob_Object)); |
| 683 | _vm->_goblin->_objects[10] = new Goblin::Gob_Object; |
685 | 684 | memset(_vm->_goblin->_objects[10], 0, sizeof(Goblin::Gob_Object)); |
686 | 685 | |
687 | 686 | _vm->_goblin->_objects[10]->stateMach = new Goblin::Gob_StateLine[40]; |
… |
… |
|
728 | 727 | strcpy(sndNames[i], buf); |
729 | 728 | } |
730 | 729 | |
731 | | free(dataBuf); |
| 730 | delete[] dataBuf; |
732 | 731 | |
733 | 732 | _vm->_goblin->_soundData[14] = _vm->_snd->loadSoundData("diamant1.snd"); |
734 | 733 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/map.h,v
retrieving revision 1.14
diff -u -r1.14 map.h
|
|
|
45 | 45 | |
46 | 46 | #pragma START_PACK_STRUCTS |
47 | 47 | |
48 | | typedef struct Point { |
| 48 | struct Point { |
49 | 49 | int16 x; |
50 | 50 | int16 y; |
51 | | } GCC_PACK Point; |
| 51 | } GCC_PACK; |
52 | 52 | |
53 | 53 | #define szMap_ItemPos 3 |
54 | 54 | |
55 | | typedef struct ItemPos { |
| 55 | struct ItemPos { |
56 | 56 | int8 x; |
57 | 57 | int8 y; |
58 | 58 | int8 orient; // ?? |
59 | | } GCC_PACK ItemPos; |
| 59 | } GCC_PACK; |
60 | 60 | |
61 | 61 | #pragma END_PACK_STRUCTS |
62 | 62 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/mult.cpp,v
retrieving revision 1.18
diff -u -r1.18 mult.cpp
|
|
|
437 | 437 | animDataVar = _vm->_parse->parseVarIndex(); |
438 | 438 | |
439 | 439 | if (_objects == 0) { |
440 | | _renderData = (int16 *)malloc(sizeof(int16) * _objCount * 9); |
441 | | _objects = (Mult_Object *)malloc(sizeof(Mult_Object) * _objCount); |
| 440 | _renderData = new int16[_objCount * 9]; |
| 441 | _objects = new Mult_Object[_objCount]; |
442 | 442 | |
443 | 443 | for (i = 0; i < _objCount; i++) { |
444 | 444 | _objects[i].pPosX = (int32 *)(_vm->_global->_inter_variables + i * 4 + (posXVar / 4) * 4); |
… |
… |
|
487 | 487 | if (_vm->_anim->_animSurf != 0) |
488 | 488 | _vm->_video->freeSurfDesc(_vm->_anim->_animSurf); |
489 | 489 | |
490 | | free(_objects); |
491 | | free(_renderData); |
| 490 | delete[] _objects; |
| 491 | delete[] _renderData; |
492 | 492 | |
493 | 493 | _objects = 0; |
494 | 494 | _renderData = 0; |
… |
… |
|
860 | 860 | _vm->_anim->_areaHeight = 200; |
861 | 861 | _objCount = 4; |
862 | 862 | |
863 | | _objects = (Mult_Object *)malloc(sizeof(Mult_Object) * _objCount); |
864 | | _renderData = (int16 *)malloc(sizeof(int16) * 9 * _objCount); |
| 863 | _objects = new Mult_Object[_objCount]; |
| 864 | _renderData = new int16[9 * _objCount]; |
865 | 865 | |
866 | | _animArrayX = (int32 *)malloc(sizeof(int32) * _objCount); |
867 | | _animArrayY = (int32 *)malloc(sizeof(int32) * _objCount); |
| 866 | _animArrayX = new int32[_objCount]; |
| 867 | _animArrayY = new int32[_objCount]; |
868 | 868 | |
869 | | _animArrayData = (Mult_AnimData *)malloc(sizeof(Mult_AnimData) * _objCount); |
| 869 | _animArrayData = new Mult_AnimData[_objCount]; |
870 | 870 | |
871 | 871 | for (_counter = 0; _counter < _objCount; _counter++) { |
872 | 872 | multObj = &_objects[_counter]; |
… |
… |
|
940 | 940 | |
941 | 941 | if (stopNoClear == 0) { |
942 | 942 | if (_animDataAllocated) { |
943 | | free(_objects); |
| 943 | delete[] _objects; |
944 | 944 | _objects = 0; |
945 | 945 | |
946 | | free(_renderData); |
| 946 | delete[] _renderData; |
947 | 947 | _renderData = 0; |
948 | 948 | |
949 | | free(_animArrayX); |
| 949 | delete[] _animArrayX; |
950 | 950 | _animArrayX = 0; |
951 | 951 | |
952 | | free(_animArrayY); |
| 952 | delete[] _animArrayY; |
953 | 953 | _animArrayY = 0; |
954 | 954 | |
955 | | free(_animArrayData); |
| 955 | delete[] _animArrayData; |
956 | 956 | _animArrayData = 0; |
957 | 957 | |
958 | 958 | if (_vm->_anim->_animSurf) |
… |
… |
|
1020 | 1020 | _staticKeysCount = READ_LE_UINT16(_dataPtr); |
1021 | 1021 | _dataPtr += 2; |
1022 | 1022 | |
1023 | | _staticKeys = (Mult_StaticKey *)malloc(sizeof(Mult_StaticKey) * |
1024 | | _staticKeysCount); |
| 1023 | _staticKeys = new Mult_StaticKey[_staticKeysCount]; |
1025 | 1024 | for (i = 0; i < _staticKeysCount; i++, _dataPtr += 4) { |
1026 | 1025 | _staticKeys[i].frame = (int16)READ_LE_UINT16(_dataPtr); |
1027 | 1026 | _staticKeys[i].layer = (int16)READ_LE_UINT16(_dataPtr + 2); |
… |
… |
|
1031 | 1030 | _animKeysCount[j] = READ_LE_UINT16(_dataPtr); |
1032 | 1031 | _dataPtr += 2; |
1033 | 1032 | |
1034 | | _animKeys[j] = (Mult_AnimKey *) malloc(sizeof(Mult_AnimKey) * _animKeysCount[j]); |
| 1033 | _animKeys[j] = new Mult_AnimKey[_animKeysCount[j]]; |
1035 | 1034 | for (i = 0; i < _animKeysCount[j]; i++, _dataPtr += 10) { |
1036 | 1035 | _animKeys[j][i].frame = (int16)READ_LE_UINT16(_dataPtr); |
1037 | 1036 | _animKeys[j][i].layer = (int16)READ_LE_UINT16(_dataPtr + 2); |
… |
… |
|
1052 | 1051 | |
1053 | 1052 | _palFadeKeysCount = READ_LE_UINT16(_dataPtr); |
1054 | 1053 | _dataPtr += 2; |
1055 | | _palFadeKeys = (Mult_PalFadeKey *)malloc(sizeof(Mult_PalFadeKey) * _palFadeKeysCount); |
| 1054 | _palFadeKeys = new Mult_PalFadeKey[_palFadeKeysCount]; |
1056 | 1055 | |
1057 | 1056 | for (i = 0; i < _palFadeKeysCount; i++, _dataPtr += 7) { |
1058 | 1057 | _palFadeKeys[i].frame = (int16)READ_LE_UINT16(_dataPtr); |
… |
… |
|
1064 | 1063 | _palKeysCount = READ_LE_UINT16(_dataPtr); |
1065 | 1064 | _dataPtr += 2; |
1066 | 1065 | |
1067 | | _palKeys = (Mult_PalKey *)malloc(sizeof(Mult_PalKey) * _palKeysCount); |
| 1066 | _palKeys = new Mult_PalKey[_palKeysCount]; |
1068 | 1067 | for (i = 0; i < _palKeysCount; i++, _dataPtr += 80) { |
1069 | 1068 | _palKeys[i].frame = (int16)READ_LE_UINT16(_dataPtr); |
1070 | 1069 | _palKeys[i].cmd = (int16)READ_LE_UINT16(_dataPtr + 2); |
… |
… |
|
1079 | 1078 | |
1080 | 1079 | _textKeysCount = READ_LE_UINT16(_dataPtr); |
1081 | 1080 | _dataPtr += 2; |
1082 | | _textKeys = (Mult_TextKey *) malloc(sizeof(Mult_TextKey) * _textKeysCount); |
| 1081 | _textKeys = new Mult_TextKey[_textKeysCount]; |
1083 | 1082 | |
1084 | 1083 | for (i = 0; i < _textKeysCount; i++, _dataPtr += 28) { |
1085 | 1084 | _textKeys[i].frame = (int16)READ_LE_UINT16(_dataPtr); |
… |
… |
|
1094 | 1093 | _sndKeysCount = READ_LE_UINT16(_dataPtr); |
1095 | 1094 | _dataPtr += 2; |
1096 | 1095 | |
1097 | | _sndKeys = (Mult_SndKey *)malloc(sizeof(Mult_SndKey) * _sndKeysCount); |
| 1096 | _sndKeys = new Mult_SndKey[_sndKeysCount]; |
1098 | 1097 | for (i = 0; i < _sndKeysCount; i++) { |
1099 | 1098 | _sndKeys[i].frame = (int16)READ_LE_UINT16(_dataPtr); |
1100 | 1099 | _sndKeys[i].cmd = (int16)READ_LE_UINT16(_dataPtr + 2); |
… |
… |
|
1149 | 1148 | staticCount = _dataPtr[0]; |
1150 | 1149 | animCount = _dataPtr[1]; |
1151 | 1150 | |
1152 | | free(_dataPtr); |
| 1151 | delete[] _dataPtr; |
1153 | 1152 | |
1154 | 1153 | staticCount++; |
1155 | 1154 | animCount++; |
… |
… |
|
1164 | 1163 | _vm->_scenery->freeAnim(_animIndices[i]); |
1165 | 1164 | } |
1166 | 1165 | |
1167 | | free(_staticKeys); |
| 1166 | delete[] _staticKeys; |
1168 | 1167 | |
1169 | 1168 | for (i = 0; i < 4; i++) |
1170 | | free(_animKeys[i]); |
| 1169 | delete[] _animKeys[i]; |
1171 | 1170 | |
1172 | | free(_palFadeKeys); |
1173 | | free(_palKeys); |
1174 | | free(_textKeys); |
| 1171 | delete[] _palFadeKeys; |
| 1172 | delete[] _palKeys; |
| 1173 | delete[] _textKeys; |
1175 | 1174 | |
1176 | 1175 | for (i = 0; i < _sndSlotsCount; i++) { |
1177 | 1176 | _vm->_game->freeSoundSlot(19 - i); |
1178 | 1177 | } |
1179 | 1178 | |
1180 | | free(_sndKeys); |
| 1179 | delete[] _sndKeys; |
1181 | 1180 | |
1182 | 1181 | _multData = 0; |
1183 | 1182 | |
1184 | 1183 | if (_animDataAllocated != 0) { |
1185 | | free(_objects); |
| 1184 | delete[] _objects; |
1186 | 1185 | _objects = 0; |
1187 | 1186 | |
1188 | | free(_renderData); |
| 1187 | delete[] _renderData; |
1189 | 1188 | _renderData = 0; |
1190 | 1189 | |
1191 | | free(_animArrayX); |
| 1190 | delete[] _animArrayX; |
1192 | 1191 | _animArrayX = 0; |
1193 | 1192 | |
1194 | | free(_animArrayY); |
| 1193 | delete[] _animArrayY; |
1195 | 1194 | _animArrayY = 0; |
1196 | 1195 | |
1197 | | free(_animArrayData); |
| 1196 | delete[] _animArrayData; |
1198 | 1197 | _animArrayData = 0; |
1199 | 1198 | |
1200 | 1199 | if (_vm->_anim->_animSurf) |
-
RCS file: /cvsroot/scummvm/scummvm/gob/mult.h,v
retrieving revision 1.9
diff -u -r1.9 mult.h
|
|
|
29 | 29 | class Mult { |
30 | 30 | public: |
31 | 31 | #pragma START_PACK_STRUCTS |
32 | | typedef struct Mult_AnimData { |
| 32 | struct Mult_AnimData { |
33 | 33 | int8 animation; |
34 | 34 | int8 layer; |
35 | 35 | int8 frame; |
… |
… |
|
43 | 43 | int8 newAnimation; |
44 | 44 | byte intersected; |
45 | 45 | int8 newCycle; |
46 | | } GCC_PACK Mult_AnimData; |
| 46 | } GCC_PACK; |
47 | 47 | |
48 | | typedef struct Mult_Object { |
| 48 | struct Mult_Object { |
49 | 49 | int32 *pPosX; |
50 | 50 | int32 *pPosY; |
51 | 51 | Mult_AnimData *pAnimData; |
… |
… |
|
54 | 54 | int16 lastRight; |
55 | 55 | int16 lastTop; |
56 | 56 | int16 lastBottom; |
57 | | } Mult_Object; |
| 57 | }; |
58 | 58 | |
59 | | // Mult |
60 | | typedef struct Mult_StaticKey { |
| 59 | struct Mult_StaticKey { |
61 | 60 | int16 frame; |
62 | 61 | int16 layer; |
63 | | } GCC_PACK Mult_StaticKey; |
| 62 | } GCC_PACK; |
64 | 63 | |
65 | | typedef struct Mult_AnimKey { |
| 64 | struct Mult_AnimKey { |
66 | 65 | int16 frame; |
67 | 66 | int16 layer; |
68 | 67 | int16 posX; |
69 | 68 | int16 posY; |
70 | 69 | int16 order; |
71 | | } GCC_PACK Mult_AnimKey; |
| 70 | } GCC_PACK; |
72 | 71 | |
73 | | typedef struct Mult_TextKey { |
| 72 | struct Mult_TextKey { |
74 | 73 | int16 frame; |
75 | 74 | int16 cmd; |
76 | 75 | int16 unknown0[9]; |
77 | 76 | int16 index; |
78 | 77 | int16 unknown1[2]; |
79 | | } GCC_PACK Mult_TextKey; |
| 78 | } GCC_PACK; |
80 | 79 | |
81 | | typedef struct Mult_PalKey { |
| 80 | struct Mult_PalKey { |
82 | 81 | int16 frame; |
83 | 82 | int16 cmd; |
84 | 83 | int16 rates[4]; |
85 | 84 | int16 unknown0; |
86 | 85 | int16 unknown1; |
87 | 86 | int8 subst[16][4]; |
88 | | } GCC_PACK Mult_PalKey; |
| 87 | } GCC_PACK; |
89 | 88 | |
90 | | typedef struct Mult_PalFadeKey { |
| 89 | struct Mult_PalFadeKey { |
91 | 90 | int16 frame; |
92 | 91 | int16 fade; |
93 | 92 | int16 palIndex; |
94 | 93 | int8 flag; |
95 | | } GCC_PACK Mult_PalFadeKey; |
| 94 | } GCC_PACK; |
96 | 95 | |
97 | | typedef struct Mult_SndKey { |
| 96 | struct Mult_SndKey { |
98 | 97 | int16 frame; |
99 | 98 | int16 cmd; |
100 | 99 | int16 freq; |
… |
… |
|
102 | 101 | int16 repCount; |
103 | 102 | int16 resId; |
104 | 103 | int16 soundIndex; |
105 | | } GCC_PACK Mult_SndKey; |
| 104 | } GCC_PACK; |
106 | 105 | #pragma END_PACK_STRUCTS |
107 | 106 | |
108 | 107 | // Globals |
-
RCS file: /cvsroot/scummvm/scummvm/gob/pack.cpp,v
retrieving revision 1.8
diff -u -r1.8 pack.cpp
|
|
|
40 | 40 | realSize = READ_LE_UINT32(sourceBuf); |
41 | 41 | counter = READ_LE_UINT32(sourceBuf); |
42 | 42 | |
43 | | tmpBuf = (byte *)malloc(4114); |
| 43 | tmpBuf = new byte[4114]; |
44 | 44 | |
45 | 45 | /* |
46 | 46 | * Can use assembler unpacker for small blocks - for speed. |
… |
… |
|
91 | 91 | *dest++ = tmpBuf[(off + i) % 4096]; |
92 | 92 | counter--; |
93 | 93 | if (counter == 0) { |
94 | | free(tmpBuf); |
| 94 | delete[] tmpBuf; |
95 | 95 | return realSize; |
96 | 96 | } |
97 | 97 | tmpBuf[tmpIndex] = tmpBuf[(off + i) % 4096]; |
… |
… |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } |
103 | | free(tmpBuf); |
| 103 | delete[] tmpBuf; |
104 | 104 | return realSize; |
105 | 105 | } |
106 | 106 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/palanim.cpp,v
retrieving revision 1.15
diff -u -r1.15 palanim.cpp
|
|
|
186 | 186 | |
187 | 187 | if (allColors == 0) { |
188 | 188 | do { |
189 | | if (_vm->_global->_tmpPalBuffer == 0) |
190 | | _vm->_video->waitRetrace(_vm->_global->_videoMode); |
| 189 | _vm->_video->waitRetrace(_vm->_global->_videoMode); |
191 | 190 | |
192 | 191 | stop = fadeStep(0); |
193 | 192 | |
… |
… |
|
222 | 221 | else |
223 | 222 | _vm->_util->clearPalette(); |
224 | 223 | } |
225 | | |
226 | | free(_vm->_global->_tmpPalBuffer); |
227 | | _vm->_global->_tmpPalBuffer = 0; |
228 | 224 | } |
229 | 225 | |
230 | 226 | } // End of namespace Gob |
-
RCS file: /cvsroot/scummvm/scummvm/gob/scenery.cpp,v
retrieving revision 1.25
diff -u -r1.25 scenery.cpp
|
|
|
116 | 116 | ptr->layersCount = (int16)READ_LE_UINT16(dataPtr); |
117 | 117 | dataPtr += 2; |
118 | 118 | |
119 | | ptr->layers = (StaticLayer **)malloc(sizeof(StaticLayer *) * ptr->layersCount); |
120 | | ptr->pieces = (PieceDesc **)malloc(sizeof(PieceDesc *) * picsCount); |
121 | | ptr->piecesFromExt = (int8 *)malloc(picsCount); |
| 119 | ptr->layers = new StaticLayer*[ptr->layersCount]; |
| 120 | ptr->pieces = new PieceDesc*[picsCount]; |
| 121 | ptr->piecesFromExt = new int8[picsCount]; |
122 | 122 | |
123 | 123 | for (i = 0; i < ptr->layersCount; i++) { |
124 | 124 | offset = (int16)READ_LE_UINT16(&((int16 *)dataPtr)[i]); |
… |
… |
|
196 | 196 | |
197 | 197 | for (i = 0; i < _staticPictCount[index]; i++) { |
198 | 198 | if (_statics[index].piecesFromExt[i] == 1) |
199 | | free(_statics[index].pieces[i]); |
| 199 | delete[] _statics[index].pieces[i]; |
200 | 200 | |
201 | 201 | spr = _staticPictToSprite[index * 7 + i]; |
202 | 202 | _spriteRefs[spr]--; |
… |
… |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
210 | | free(_statics[index].layers); |
211 | | free(_statics[index].pieces); |
212 | | free(_statics[index].piecesFromExt); |
| 210 | delete[] _statics[index].layers; |
| 211 | delete[] _statics[index].pieces; |
| 212 | delete[] _statics[index].piecesFromExt; |
213 | 213 | if (_staticFromExt[index] == 1) |
214 | | free(_statics[index].dataPtr); |
| 214 | delete[] _statics[index].dataPtr; |
215 | 215 | |
216 | 216 | _staticFromExt[index] = 0; |
217 | 217 | _staticPictCount[index] = -1; |
… |
… |
|
433 | 433 | ptr->layersCount = READ_LE_UINT16(dataPtr); |
434 | 434 | dataPtr += 2; |
435 | 435 | |
436 | | ptr->layers = |
437 | | (AnimLayer **) malloc(sizeof(AnimLayer *) * |
438 | | ptr->layersCount); |
439 | | ptr->pieces = |
440 | | (PieceDesc **) malloc(sizeof(PieceDesc *) * |
441 | | picsCount); |
442 | | ptr->piecesFromExt = (int8 *) malloc(picsCount); |
| 436 | ptr->layers = new AnimLayer*[ptr->layersCount]; |
| 437 | ptr->pieces = new PieceDesc*[picsCount]; |
| 438 | ptr->piecesFromExt = new int8[picsCount]; |
443 | 439 | |
444 | 440 | for (i = 0; i < ptr->layersCount; i++) { |
445 | 441 | offset = (int16)READ_LE_UINT16(&((int16 *)dataPtr)[i]); |
… |
… |
|
718 | 714 | |
719 | 715 | for (i = 0; i < _animPictCount[animation]; i++) { |
720 | 716 | if (_animations[animation].piecesFromExt[i] == 1) |
721 | | free(_animations[animation].pieces[i]); |
| 717 | delete[] _animations[animation].pieces[i]; |
722 | 718 | |
723 | 719 | spr = _animPictToSprite[animation * 7 + i]; |
724 | 720 | _spriteRefs[spr]--; |
… |
… |
|
730 | 726 | } |
731 | 727 | } |
732 | 728 | |
733 | | free(_animations[animation].layers); |
734 | | free(_animations[animation].pieces); |
735 | | free(_animations[animation].piecesFromExt); |
| 729 | delete[] _animations[animation].layers; |
| 730 | delete[] _animations[animation].pieces; |
| 731 | delete[] _animations[animation].piecesFromExt; |
736 | 732 | if (_animFromExt[animation] == 1) |
737 | | free(_animations[animation].dataPtr); |
| 733 | delete[] _animations[animation].dataPtr; |
738 | 734 | |
739 | 735 | _animFromExt[animation] = 0; |
740 | 736 | _animPictCount[animation] = 0; |
-
RCS file: /cvsroot/scummvm/scummvm/gob/scenery.h,v
retrieving revision 1.10
diff -u -r1.10 scenery.h
|
|
|
27 | 27 | class Scenery { |
28 | 28 | public: |
29 | 29 | #pragma START_PACK_STRUCTS |
30 | | typedef struct PieceDesc { |
| 30 | struct PieceDesc { |
31 | 31 | int16 left; //NOTE: |
32 | 32 | int16 right; //These are stored in Little Endian format |
33 | 33 | int16 top; //And should be converted by client code when accessed |
34 | 34 | int16 bottom; //i.e. use FROM_LE_16() |
35 | | } GCC_PACK PieceDesc; |
| 35 | } GCC_PACK; |
36 | 36 | |
37 | | typedef struct StaticPlane { |
| 37 | struct StaticPlane { |
38 | 38 | int8 pictIndex; |
39 | 39 | int8 pieceIndex; |
40 | 40 | int8 drawOrder; |
41 | 41 | int16 destX; |
42 | 42 | int16 destY; |
43 | 43 | int8 transp; |
44 | | } GCC_PACK StaticPlane; |
| 44 | } GCC_PACK; |
45 | 45 | |
46 | | typedef struct StaticLayer { |
| 46 | struct StaticLayer { |
47 | 47 | int16 backResId; |
48 | 48 | int16 planeCount; |
49 | 49 | StaticPlane planes[1]; |
50 | | } GCC_PACK StaticLayer; |
| 50 | } GCC_PACK; |
51 | 51 | |
52 | 52 | // Animations |
53 | 53 | |
54 | | typedef struct AnimFramePiece { |
| 54 | struct AnimFramePiece { |
55 | 55 | byte pictIndex; |
56 | 56 | byte pieceIndex; |
57 | 57 | int8 destX; |
58 | 58 | int8 destY; |
59 | 59 | int8 notFinal; |
60 | | } GCC_PACK AnimFramePiece; |
| 60 | } GCC_PACK; |
61 | 61 | |
62 | | typedef struct AnimLayer { |
| 62 | struct AnimLayer { |
63 | 63 | int16 unknown0; |
64 | 64 | int16 posX; |
65 | 65 | int16 posY; |
… |
… |
|
68 | 68 | int8 transp; |
69 | 69 | int16 framesCount; |
70 | 70 | AnimFramePiece frames[1]; |
71 | | } GCC_PACK AnimLayer; |
| 71 | } GCC_PACK; |
72 | 72 | #pragma END_PACK_STRUCTS |
73 | 73 | |
74 | | typedef struct Static { |
| 74 | struct Static { |
75 | 75 | int16 layersCount; |
76 | 76 | StaticLayer **layers; |
77 | 77 | PieceDesc **pieces; |
… |
… |
|
79 | 79 | char *dataPtr; |
80 | 80 | Static() : layersCount(0), layers(0), pieces(0), |
81 | 81 | piecesFromExt(0), dataPtr(0) {} |
82 | | } Static; |
| 82 | }; |
83 | 83 | |
84 | 84 | struct Animation { |
85 | 85 | int16 layersCount; |
-
RCS file: /cvsroot/scummvm/scummvm/gob/sound.cpp,v
retrieving revision 1.16
diff -u -r1.16 sound.cpp
|
|
|
118 | 118 | |
119 | 119 | Snd::SoundDesc *Snd::loadSoundData(const char *path) { |
120 | 120 | Snd::SoundDesc *sndDesc; |
121 | | int32 size; |
122 | 121 | |
123 | | size = _vm->_dataio->getDataSize(path); |
124 | | sndDesc = (Snd::SoundDesc *)malloc(size); |
125 | | sndDesc->size = size; |
| 122 | sndDesc = new Snd::SoundDesc; |
| 123 | sndDesc->size = _vm->_dataio->getDataSize(path); |
126 | 124 | sndDesc->data = _vm->_dataio->getData(path); |
127 | 125 | |
128 | 126 | return sndDesc; |
… |
… |
|
136 | 134 | _loopingSounds[i] = NULL; |
137 | 135 | } |
138 | 136 | |
139 | | free(sndDesc->data); |
140 | | free(sndDesc); |
| 137 | delete[] sndDesc->data; |
| 138 | delete sndDesc; |
141 | 139 | } |
142 | 140 | |
143 | 141 | } // End of namespace Gob |
-
RCS file: /cvsroot/scummvm/scummvm/gob/sound.h,v
retrieving revision 1.12
diff -u -r1.12 sound.h
|
|
|
28 | 28 | |
29 | 29 | class Snd { |
30 | 30 | public: |
31 | | typedef struct SoundDesc { |
| 31 | struct SoundDesc { |
32 | 32 | Audio::SoundHandle handle; |
33 | 33 | char *data; |
34 | 34 | int32 size; |
… |
… |
|
39 | 39 | int16 flag; |
40 | 40 | SoundDesc() : data(0), size(0), repCount(0), timerTicks(0), |
41 | 41 | inClocks(0), frequency(0), flag(0) {} |
42 | | } SoundDesc; |
| 42 | }; |
43 | 43 | |
44 | 44 | typedef void (*CleanupFuncPtr) (int16); |
45 | 45 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/util.cpp,v
retrieving revision 1.21
diff -u -r1.21 util.cpp
|
|
|
271 | 271 | } |
272 | 272 | |
273 | 273 | Video::FontDesc *Util::loadFont(const char *path) { |
274 | | Video::FontDesc *fontDesc = (Video::FontDesc *) malloc(sizeof(Video::FontDesc)); |
| 274 | Video::FontDesc *fontDesc = new Video::FontDesc; |
275 | 275 | char *data; |
276 | 276 | |
277 | 277 | if (fontDesc == 0) |
… |
… |
|
279 | 279 | |
280 | 280 | data = _vm->_dataio->getData(path); |
281 | 281 | if (data == 0) { |
282 | | free(fontDesc); |
| 282 | delete fontDesc; |
283 | 283 | return 0; |
284 | 284 | } |
285 | 285 | |
… |
… |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | void Util::freeFont(Video::FontDesc * fontDesc) { |
306 | | free(fontDesc->dataPtr - 4); |
307 | | free(fontDesc); |
| 306 | delete[] (fontDesc->dataPtr - 4); |
| 307 | delete fontDesc; |
308 | 308 | } |
309 | 309 | |
310 | 310 | void Util::clearPalette(void) { |
… |
… |
|
390 | 390 | void Util::listInsertFront(List * list, void *data) { |
391 | 391 | ListNode *node; |
392 | 392 | |
393 | | node = (ListNode *) malloc(sizeof(ListNode)); |
| 393 | node = new ListNode; |
394 | 394 | if (list->pHead != 0) { |
395 | 395 | node->pData = data; |
396 | 396 | node->pNext = list->pHead; |
… |
… |
|
415 | 415 | warning("listInsertBack: Broken list!"); |
416 | 416 | } |
417 | 417 | |
418 | | node = |
419 | | (ListNode *) malloc(sizeof(ListNode)); |
| 418 | node = new ListNode; |
420 | 419 | node->pData = data; |
421 | 420 | node->pPrev = list->pTail; |
422 | 421 | node->pNext = 0; |
… |
… |
|
429 | 428 | |
430 | 429 | void Util::listDropFront(List * list) { |
431 | 430 | if (list->pHead->pNext == 0) { |
432 | | free((list->pHead)); |
| 431 | delete list->pHead; |
433 | 432 | list->pHead = 0; |
434 | 433 | list->pTail = 0; |
435 | 434 | } else { |
436 | 435 | list->pHead = list->pHead->pNext; |
437 | | free((list->pHead->pPrev)); |
| 436 | delete list->pHead->pPrev; |
438 | 437 | list->pHead->pPrev = 0; |
439 | 438 | } |
440 | 439 | } |
… |
… |
|
444 | 443 | listDropFront(list); |
445 | 444 | } |
446 | 445 | |
447 | | free(list); |
| 446 | delete list; |
448 | 447 | } |
449 | 448 | |
450 | 449 | const char Util::trStr1[] = |
-
RCS file: /cvsroot/scummvm/scummvm/gob/util.h,v
retrieving revision 1.8
diff -u -r1.8 util.h
|
|
|
31 | 31 | class Util { |
32 | 32 | public: |
33 | 33 | struct ListNode; |
34 | | typedef struct ListNode { |
| 34 | struct ListNode { |
35 | 35 | void *pData; |
36 | 36 | struct ListNode *pNext; |
37 | 37 | struct ListNode *pPrev; |
38 | 38 | ListNode() : pData(0), pNext(0), pPrev(0) {} |
39 | | } ListNode; |
| 39 | }; |
40 | 40 | |
41 | | typedef struct List { |
| 41 | struct List { |
42 | 42 | ListNode *pHead; |
43 | 43 | ListNode *pTail; |
44 | 44 | List() : pHead(0), pTail(0) {} |
45 | | } List; |
| 45 | }; |
46 | 46 | |
47 | 47 | void initInput(void); |
48 | 48 | void processInput(void); |
-
RCS file: /cvsroot/scummvm/scummvm/gob/video.cpp,v
retrieving revision 1.19
diff -u -r1.19 video.cpp
|
|
|
85 | 85 | |
86 | 86 | Video::SurfaceDesc *Video::initSurfDesc(int16 vidMode, int16 width, int16 height, int16 flags) { |
87 | 87 | int8 flagsAnd2; |
88 | | byte *vidMem; |
| 88 | byte *vidMem = 0; |
89 | 89 | int32 sprSize; |
90 | 90 | int16 someFlags = 1; |
91 | 91 | SurfaceDesc *descPtr; |
… |
… |
|
108 | 108 | flagsAnd2 = 0; |
109 | 109 | |
110 | 110 | if (flags & PRIMARY_SURFACE) { |
111 | | vidMem = 0; |
112 | 111 | _vm->_global->_primaryWidth = width; |
113 | 112 | _vm->_global->_mouseMaxCol = width; |
114 | 113 | _vm->_global->_primaryHeight = height; |
115 | 114 | _vm->_global->_mouseMaxRow = height; |
116 | 115 | sprSize = 0; |
117 | | |
118 | 116 | } else { |
119 | | vidMem = 0; |
120 | 117 | sprSize = Video::getRectSize(width, height, flagsAnd2, vidMode); |
121 | 118 | if (flagsAnd2) |
122 | 119 | someFlags += 0x80; |
123 | 120 | } |
124 | 121 | if (flags & PRIMARY_SURFACE) { |
125 | 122 | descPtr = _vm->_global->_pPrimarySurfDesc; |
126 | | vidMem = (byte *)malloc(320 * 200); |
| 123 | delete[] descPtr->vidPtr; |
| 124 | assert(descPtr); |
| 125 | vidMem = new byte[320 * 200]; |
127 | 126 | } else { |
128 | | if (flags & DISABLE_SPR_ALLOC) |
129 | | descPtr = (SurfaceDesc *)malloc(sizeof(SurfaceDesc)); |
130 | | else |
131 | | descPtr = (SurfaceDesc *)malloc(sizeof(SurfaceDesc) + sprSize); |
| 127 | if (flags & DISABLE_SPR_ALLOC) { |
| 128 | descPtr = new SurfaceDesc; |
| 129 | // this case causes vidPtr to be set to invalid memory |
| 130 | assert(false); |
| 131 | } else { |
| 132 | descPtr = new SurfaceDesc; |
| 133 | descPtr->vidPtr = new byte[sprSize]; |
| 134 | vidMem = descPtr->vidPtr; |
| 135 | } |
132 | 136 | } |
133 | 137 | if (descPtr == 0) |
134 | 138 | return 0; |
… |
… |
|
137 | 141 | descPtr->height = height; |
138 | 142 | descPtr->flag = someFlags; |
139 | 143 | descPtr->vidMode = vidMode; |
140 | | if (vidMem == 0) |
141 | | vidMem = ((byte *)descPtr) + sizeof(SurfaceDesc); |
142 | 144 | descPtr->vidPtr = vidMem; |
143 | 145 | |
144 | 146 | descPtr->reserved1 = 0; |
… |
… |
|
147 | 149 | } |
148 | 150 | |
149 | 151 | void Video::freeSurfDesc(SurfaceDesc * surfDesc) { |
150 | | _vm->_global->_sprAllocated--; |
151 | | if (surfDesc != _vm->_global->_pPrimarySurfDesc) |
152 | | free(surfDesc); |
153 | | else |
154 | | free(surfDesc->vidPtr); |
| 152 | delete[] surfDesc->vidPtr; |
| 153 | if (surfDesc != _vm->_global->_pPrimarySurfDesc) { |
| 154 | _vm->_global->_sprAllocated--; |
| 155 | delete surfDesc; |
| 156 | } |
155 | 157 | } |
156 | 158 | |
157 | 159 | int16 Video::clampValue(int16 val, int16 max) { |
… |
… |
|
302 | 304 | return; |
303 | 305 | |
304 | 306 | if ((dest->vidMode & 0x7f) != 0x13) |
305 | | error("Video::drawPackedSprite: Vide mode 0x%x is not fully supported!", |
| 307 | error("Video::drawPackedSprite: Video mode 0x%x is not fully supported!", |
306 | 308 | dest->vidMode & 0x7f); |
307 | 309 | |
308 | 310 | _videoDriver->drawPackedSprite(sprBuf, width, height, x, y, transp, dest); |
… |
… |
|
378 | 380 | |
379 | 381 | void Video::initPrimary(int16 mode) { |
380 | 382 | int16 old; |
381 | | if (_vm->_global->_curPrimaryDesc) { |
382 | | Video::freeSurfDesc(_vm->_global->_curPrimaryDesc); |
383 | | Video::freeSurfDesc(_vm->_global->_allocatedPrimary); |
384 | | |
385 | | _vm->_global->_curPrimaryDesc = 0; |
386 | | _vm->_global->_allocatedPrimary = 0; |
387 | | } |
388 | 383 | if (mode != 0x13 && mode != 3 && mode != -1) |
389 | 384 | error("Video::initPrimary: Video mode 0x%x is not supported!", |
390 | 385 | mode); |
… |
… |
|
450 | 445 | srcHeight - 1, x, y, transp); |
451 | 446 | return 1; |
452 | 447 | } else { |
453 | | memBuffer = (byte *)malloc(4114); |
| 448 | memBuffer = new byte[4114]; |
454 | 449 | if (memBuffer == 0) |
455 | 450 | return 0; |
456 | 451 | |
… |
… |
|
520 | 515 | destPtr = linePtr; |
521 | 516 | curHeight++; |
522 | 517 | if (curHeight >= srcHeight) { |
523 | | free(memBuffer); |
| 518 | delete[] memBuffer; |
524 | 519 | return 1; |
525 | 520 | } |
526 | 521 | } |
527 | 522 | sourceLeft--; |
528 | 523 | if (sourceLeft == 0) { |
529 | | free(memBuffer); |
| 524 | delete[] memBuffer; |
530 | 525 | return 1; |
531 | 526 | } |
532 | 527 | memBuffer[bufPos] = temp; |
… |
… |
|
536 | 531 | } |
537 | 532 | } |
538 | 533 | } |
539 | | free(memBuffer); |
| 534 | delete[] memBuffer; |
540 | 535 | return 1; |
541 | 536 | } |
542 | 537 | |
-
RCS file: /cvsroot/scummvm/scummvm/gob/video.h,v
retrieving revision 1.12
diff -u -r1.12 video.h
|
|
|
40 | 40 | |
41 | 41 | class Video { |
42 | 42 | public: |
43 | | typedef struct SurfaceDesc_t { |
| 43 | struct SurfaceDesc { |
44 | 44 | int16 width; |
45 | 45 | int16 height; |
46 | 46 | int8 reserved1; |
… |
… |
|
48 | 48 | int16 vidMode; |
49 | 49 | byte *vidPtr; |
50 | 50 | int16 reserved2; |
51 | | SurfaceDesc_t() : width(0), height(0), reserved1(0), flag(0), |
| 51 | SurfaceDesc() : width(0), height(0), reserved1(0), flag(0), |
52 | 52 | vidMode(0), vidPtr(0), reserved2(0) {} |
53 | | } SurfaceDesc; |
| 53 | }; |
54 | 54 | |
55 | | typedef struct FontDesc_t { |
| 55 | struct FontDesc { |
56 | 56 | char *dataPtr; |
57 | 57 | int8 itemWidth; |
58 | 58 | int8 itemHeight; |
… |
… |
|
61 | 61 | int8 itemSize; |
62 | 62 | int8 bitWidth; |
63 | 63 | void *extraData; |
64 | | FontDesc_t() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0), |
| 64 | FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0), |
65 | 65 | endItem(0), itemSize(0), bitWidth(0) {} |
66 | | } FontDesc; |
| 66 | }; |
67 | 67 | |
68 | 68 | #define GDR_VERSION 4 |
69 | 69 | |
… |
… |
|
73 | 73 | |
74 | 74 | #pragma START_PACK_STRUCTS |
75 | 75 | |
76 | | typedef struct Color { |
| 76 | struct Color { |
77 | 77 | byte red; |
78 | 78 | byte green; |
79 | 79 | byte blue; |
80 | | } GCC_PACK Color; |
| 80 | } GCC_PACK; |
81 | 81 | |
82 | 82 | #pragma END_PACK_STRUCTS |
83 | 83 | |
84 | | typedef struct PalDesc { |
| 84 | struct PalDesc { |
85 | 85 | Color *vgaPal; |
86 | 86 | int16 *unused1; |
87 | 87 | int16 *unused2; |
88 | 88 | PalDesc() : vgaPal(0), unused1(0), unused2(0) {} |
89 | | } PalDesc; |
| 89 | }; |
90 | 90 | |
91 | 91 | Video(class GobEngine *vm); |
92 | 92 | int32 getRectSize(int16 width, int16 height, int16 flag, int16 mode); |