diff options
-rw-r--r-- | sword2/driver/render.cpp | 11 | ||||
-rw-r--r-- | sword2/resman.cpp | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index 8beceddc51..3ef3151744 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -708,15 +708,10 @@ int32 Graphics::initialiseBackgroundLayer(_parallax *p) { // Decode the parallax layer into a large chunk of memory - memchunk = (uint8 *) malloc(_xBlocks[_layer] * BLOCKWIDTH * _yBlocks[_layer] * BLOCKHEIGHT); + memchunk = (uint8 *) calloc(_xBlocks[_layer] * _yBlocks[_layer], BLOCKWIDTH * BLOCKHEIGHT); if (!memchunk) return RDERR_OUTOFMEMORY; - // We clear not the entire memory chunk, but enough of it to store - // the entire parallax layer. - - memset(memchunk, 0, p->w * p->h); - for (i = 0; i < p->h; i++) { if (p->offset[i] == 0) continue; @@ -763,6 +758,10 @@ int32 Graphics::initialiseBackgroundLayer(_parallax *p) { data = memchunk + (p->w * BLOCKHEIGHT * (i / _xBlocks[_layer])) + BLOCKWIDTH * (i % _xBlocks[_layer]); + // FIXME: The 'block_is_transparent' flag should only consider + // data that is inside the parallax layer. Still, it won't do + // any harm to leave it this way... + for (j = 0; j < BLOCKHEIGHT; j++) { for (k = 0; k < BLOCKWIDTH; k++) { if (data[j * p->w + k]) diff --git a/sword2/resman.cpp b/sword2/resman.cpp index 49098b7021..ef5f852be6 100644 --- a/sword2/resman.cpp +++ b/sword2/resman.cpp @@ -165,7 +165,7 @@ ResourceManager::ResourceManager(Sword2Engine *vm) { _cdTab[j] = cdInf[i].cd; } - delete cdInf; + delete [] cdInf; debug(5, "%d resources in %d cluster files", _totalResFiles, _totalClusters); for (j = 0; j < _totalClusters; j++) |