mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
parent
6049a370b3
commit
e5ec399c55
@ -180,12 +180,12 @@ void FontRendererGui::fetchText(uint32 textId, byte *buf) {
|
||||
byte *data = _vm->fetchTextLine(_vm->_resman->openResource(textId / SIZE), textId & 0xffff);
|
||||
int i;
|
||||
|
||||
for (i = 0; data[i + 2]; i++) {
|
||||
if (buf)
|
||||
if (buf) {
|
||||
for (i = 0; data[i + 2]; i++)
|
||||
buf[i] = data[i + 2];
|
||||
buf[i] = 0;
|
||||
}
|
||||
|
||||
buf[i] = 0;
|
||||
_vm->_resman->closeResource(textId / SIZE);
|
||||
}
|
||||
|
||||
|
@ -496,9 +496,16 @@ int Sound::readBuffer(int16 *buffer, const int numSamples) {
|
||||
memset(buffer, 0, 2 * numSamples);
|
||||
|
||||
if (!_mixBuffer || numSamples > _mixBufferLen) {
|
||||
if (_mixBuffer)
|
||||
_mixBuffer = (int16 *)realloc(_mixBuffer, 2 * numSamples);
|
||||
else
|
||||
if (_mixBuffer) {
|
||||
int16 *newBuffer = (int16 *)realloc(_mixBuffer, 2 * numSamples);
|
||||
if (newBuffer) {
|
||||
_mixBuffer = newBuffer;
|
||||
} else {
|
||||
// We can't use the old buffer any more. It's too small.
|
||||
free(_mixBuffer);
|
||||
_mixBuffer = 0;
|
||||
}
|
||||
} else
|
||||
_mixBuffer = (int16 *)malloc(2 * numSamples);
|
||||
|
||||
_mixBufferLen = numSamples;
|
||||
|
@ -412,8 +412,8 @@ byte *Sword2Engine::fetchPsxParallax(uint32 location, uint8 level) {
|
||||
debug(2, "fetchPsxParallax() -> %s parallax, xRes: %u, yRes: %u", (level == 0) ? "Background" : "Foreground", plxXres, plxYres);
|
||||
|
||||
// Calculate the number of tiles which compose the parallax grid.
|
||||
horTiles = plxXres % 64 ? (plxXres / 64) + 1 : plxXres / 64;
|
||||
verTiles = plxYres % 16 ? (plxYres / 16) + 1 : plxYres / 16;
|
||||
horTiles = (plxXres % 64) ? (plxXres / 64) + 1 : plxXres / 64;
|
||||
verTiles = (plxYres % 16) ? (plxYres / 16) + 1 : plxYres / 16;
|
||||
|
||||
totSize = plxSize + horTiles * verTiles * 4 + 8;
|
||||
|
||||
|
@ -731,8 +731,8 @@ int32 Screen::initialisePsxParallaxLayer(byte *parallax) {
|
||||
data = parallax + xTiles * yTiles * 4;
|
||||
|
||||
_xBlocks[_layer] = xTiles;
|
||||
_yBlocks[_layer] = (yTiles / 2) + (yTiles % 2 ? 1 : 0);
|
||||
bool oddTiles = (yTiles % 2 ? true : false);
|
||||
_yBlocks[_layer] = (yTiles / 2) + ((yTiles % 2) ? 1 : 0);
|
||||
bool oddTiles = ((yTiles % 2) ? true : false);
|
||||
|
||||
_blockSurfaces[_layer] = (BlockSurface **)calloc(_xBlocks[_layer] * _yBlocks[_layer], sizeof(BlockSurface *));
|
||||
if (!_blockSurfaces[_layer])
|
||||
|
@ -474,7 +474,7 @@ void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
|
||||
file->seek(table_offset);
|
||||
|
||||
assert((tableSize % 8) == 0);
|
||||
_resFiles[fileNum].entryTab = (uint32*)malloc(tableSize);
|
||||
_resFiles[fileNum].entryTab = (uint32 *)malloc(tableSize);
|
||||
_resFiles[fileNum].numEntries = tableSize / 8;
|
||||
file->read(_resFiles[fileNum].entryTab, tableSize);
|
||||
if (file->eos() || file->err())
|
||||
@ -482,7 +482,7 @@ void ResourceManager::readCluIndex(uint16 fileNum, Common::File *file) {
|
||||
|
||||
#ifdef SCUMM_BIG_ENDIAN
|
||||
for (int tabCnt = 0; tabCnt < _resFiles[fileNum].numEntries * 2; tabCnt++)
|
||||
_resFiles[fileNum].entryTab[tabCnt] = FROM_LE_32(_resFiles[fileNum].entryTab[tabCnt]);
|
||||
_resFiles[fileNum].entryTab[tabCnt] = FROM_LE_32(_resFiles[fileNum].entryTab[tabCnt]);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user