parent
6049a370b3
commit
e5ec399c55
5 changed files with 19 additions and 12 deletions
|
@ -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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue