aboutsummaryrefslogtreecommitdiff
path: root/engines/gob
diff options
context:
space:
mode:
authorSven Hesse2006-06-06 15:43:44 +0000
committerSven Hesse2006-06-06 15:43:44 +0000
commitbf86b9b022186f8530a3430f6549c4f00350f12c (patch)
tree07ae31b79f75b38ccc3911d381110d3bfaf7b9df /engines/gob
parent9a46b6047d67b10f47541030ab5b29f0c7449d50 (diff)
downloadscummvm-rg350-bf86b9b022186f8530a3430f6549c4f00350f12c.tar.gz
scummvm-rg350-bf86b9b022186f8530a3430f6549c4f00350f12c.tar.bz2
scummvm-rg350-bf86b9b022186f8530a3430f6549c4f00350f12c.zip
Two segfault and several coding style related fixes
svn-id: r22954
Diffstat (limited to 'engines/gob')
-rw-r--r--engines/gob/draw.cpp2
-rw-r--r--engines/gob/draw_v2.cpp6
-rw-r--r--engines/gob/game.cpp11
-rw-r--r--engines/gob/game_v1.cpp2
-rw-r--r--engines/gob/game_v2.cpp10
-rw-r--r--engines/gob/goblin.cpp7
-rw-r--r--engines/gob/inter_v2.cpp4
-rw-r--r--engines/gob/mult_v2.cpp2
8 files changed, 24 insertions, 20 deletions
diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp
index 19a10947b3..78f25a19b8 100644
--- a/engines/gob/draw.cpp
+++ b/engines/gob/draw.cpp
@@ -667,7 +667,7 @@ void Draw::drawSprite(int16 source, Video::SurfaceDesc * dest, int16 left,
void Draw::drawString(char *str, int16 x, int16 y, int16 color1, int16 color2,
int16 transp, Video::SurfaceDesc *dest, Video::FontDesc *font) {
- while(*str != '\0') {
+ while (*str != '\0') {
_vm->_video->drawLetter(*str, x, y, font, transp, color1, color2, dest);
if (font->extraData == 0)
x += font->itemWidth;
diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp
index 6f600e127c..4e759e024d 100644
--- a/engines/gob/draw_v2.cpp
+++ b/engines/gob/draw_v2.cpp
@@ -144,7 +144,7 @@ void Draw_v2::printText(void) {
if ((_vm->_game->_totFileData[0x29] < 0x32) && (*ptr2 > 3) && (*ptr2 < 32))
*ptr2 = 32;
- switch(*ptr2) {
+ switch (*ptr2) {
case 1:
break;
@@ -202,7 +202,7 @@ void Draw_v2::printText(void) {
_backColor = 0;
_transparency = 1;
- while(true) {
+ while (true) {
if ((*ptr >= 1) && ((*ptr <= 7) || (*ptr == 10)) && (strPos != 0)) {
str[MAX(strPos, strPos2)] = 0;
strPosBak = strPos;
@@ -352,7 +352,7 @@ void Draw_v2::printText(void) {
if (cmd == 0) {
val = READ_LE_UINT16(ptr2 + 18) * 4;
sprintf(buf, "%d", VAR_OFFSET(val));
- } else if(cmd == 1) {
+ } else if (cmd == 1) {
val = READ_LE_UINT16(ptr2 + 18) * 4;
strcpy(buf, _vm->_global->_inter_variables + val);
} else {
diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp
index c301f8177a..189451eb1f 100644
--- a/engines/gob/game.cpp
+++ b/engines/gob/game.cpp
@@ -404,7 +404,10 @@ void Game::freeSoundSlot(int16 slot) {
if (_soundADL[slot]) {
_vm->_music->stopPlay();
- delete[] ((char *) _soundSamples[slot]);
+ if (_soundFromExt[slot] == 1) {
+ delete[] ((char *) _soundSamples[slot]);
+ _soundFromExt[slot] = 0;
+ }
} else {
char* data = _soundSamples[slot]->data;
@@ -2013,7 +2016,7 @@ Game::Imd *Game::loadImdFile(const char *path, Video::SurfaceDesc *surfDesc, int
delete imdPtr;
return 0;
}
- if(imdPtr->stdX != 0) {
+ if (imdPtr->stdX != 0) {
_vm->_dataio->readData(handle, buf, 8);
imdPtr->stdX = READ_LE_UINT16(buf);
imdPtr->stdY = READ_LE_UINT16(buf + 2);
@@ -2401,7 +2404,7 @@ int16 Game::viewImd(Game::Imd *imdPtr, int16 frame) {
}
} else
retVal |= 0x800;
- } while(var_4 != 0);
+ } while (var_4 != 0);
if (byte_2DA60 != 0) {
byte_2DA60 = 0;
@@ -2567,7 +2570,7 @@ void Game::imdFrameUncompressor(byte *dest, byte *src) {
chunkCount = 1;
chunkBitField = 0;
- while(frameLength > 0) {
+ while (frameLength > 0) {
chunkCount--;
if (chunkCount == 0) {
tmp = *src++;
diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp
index c4b20b44e6..43c66761db 100644
--- a/engines/gob/game_v1.cpp
+++ b/engines/gob/game_v1.cpp
@@ -80,7 +80,7 @@ void Game_v1::playTot(int16 skipPlay) {
_vm->_draw->_fontToSprite[i].height = -1;
}
- if(_vm->_features & GF_MAC)
+ if (_vm->_features & GF_MAC)
_vm->_music->stopPlay();
else
_vm->_cdrom->stopPlaying();
diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp
index 20a4e75abe..e02ac9f7f5 100644
--- a/engines/gob/game_v2.cpp
+++ b/engines/gob/game_v2.cpp
@@ -80,7 +80,7 @@ void Game_v2::playTot(int16 skipPlay) {
_vm->_draw->_fontToSprite[i].height = -1;
}
- if(_vm->_features & GF_MAC)
+ if (_vm->_features & GF_MAC)
_vm->_music->stopPlay();
else
_vm->_cdrom->stopPlaying();
@@ -481,14 +481,14 @@ int16 Game_v2::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
cursorRight = _vm->_global->_inter_mouseX + _vm->_draw->_cursorWidth;
if (cursorRight > (_word_2FC9E + sWidth))
_word_2FC9E = MIN(cursorRight - sWidth, width - sWidth);
- } else if(_vm->_global->_inter_mouseX < _word_2FC9E)
+ } else if (_vm->_global->_inter_mouseX < _word_2FC9E)
_word_2FC9E = _vm->_global->_inter_mouseX;
height = _vm->_draw->_frontSurface->height;
if ((height > sHeight) && (_vm->_global->_inter_mouseY >= _word_2FC9C)) {
cursorBottom = _vm->_global->_inter_mouseY + _vm->_draw->_cursorHeight;
if (cursorBottom > (_word_2FC9C + sHeight))
_word_2FC9C = MIN(cursorBottom - sHeight, height - sHeight);
- } else if(_vm->_global->_inter_mouseY < _word_2FC9C)
+ } else if (_vm->_global->_inter_mouseY < _word_2FC9C)
_word_2FC9C = _vm->_global->_inter_mouseY;
if ((oldWord_2FC9E != _word_2FC9E) || (oldWord_2FC9C != _word_2FC9C)) {
if (_byte_2FC9B == 0) {
@@ -499,7 +499,7 @@ int16 Game_v2::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
if ((_vm->_global->_inter_mouseX + _vm->_draw->_cursorWidth) >
(_word_2FC9E + sWidth))
_vm->_global->_inter_mouseX = _word_2FC9E + sWidth - _vm->_draw->_cursorWidth;
- } else if(_vm->_global->_inter_mouseX < oldWord_2FC9E)
+ } else if (_vm->_global->_inter_mouseX < oldWord_2FC9E)
_vm->_global->_inter_mouseX = oldWord_2FC9E;
if ((_vm->_draw->_frontSurface->height > sHeight) &&
@@ -507,7 +507,7 @@ int16 Game_v2::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
if ((_vm->_global->_inter_mouseY + _vm->_draw->_cursorHeight) >
(_word_2FC9C + sHeight))
_vm->_global->_inter_mouseY = _word_2FC9C + sHeight - _vm->_draw->_cursorHeight;
- } else if(_vm->_global->_inter_mouseY < oldWord_2FC9E)
+ } else if (_vm->_global->_inter_mouseY < oldWord_2FC9E)
_vm->_global->_inter_mouseY = _word_2FC9C;
} else {
if (oldWord_2FC9E > _word_2FC9E) {
diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp
index 3085dfa81b..24eb64e85e 100644
--- a/engines/gob/goblin.cpp
+++ b/engines/gob/goblin.cpp
@@ -1821,6 +1821,7 @@ void Goblin::zeroObjects(void) {
void Goblin::freeAllObjects(void) {
_vm->_util->deleteList(_objList);
+ _objList = 0;
freeObjects();
}
@@ -2347,7 +2348,7 @@ void Goblin::sub_19BD3(void) {
anim0->field_10 = 6;
}
if (anim1->someFlag == 0) {
- if((_word_2F9BA == 0) && (anim1->isStatic == 0)) {
+ if ((_word_2F9BA == 0) && (anim1->isStatic == 0)) {
if ((VAR(_dword_2F9B2) == 0) && (di == 28)) {
di = _vm->_util->getRandom(3) + 24;
warning("GOB2 Stub! sub_195C7(1, di);");
@@ -2369,7 +2370,7 @@ void Goblin::sub_19BD3(void) {
if (VAR(18) != ((uint32) -1)) {
if (anim0->layer == 44)
anim0->field_10 = 4;
- else if(anim0->layer == 45)
+ else if (anim0->layer == 45)
anim0->field_10 = 0;
if (anim0->someFlag == 0)
anim0->field_10 = 6;
@@ -2377,7 +2378,7 @@ void Goblin::sub_19BD3(void) {
if (VAR(19) != ((uint32) -1)) {
if (anim1->layer == 48)
anim1->field_10 = 4;
- else if(anim1->layer == 49)
+ else if (anim1->layer == 49)
anim1->field_10 = 0;
if (anim1->someFlag == 0)
anim1->field_10 = 6;
diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp
index 310a880dab..44eb2d3578 100644
--- a/engines/gob/inter_v2.cpp
+++ b/engines/gob/inter_v2.cpp
@@ -1253,7 +1253,7 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) {
cmd = *_vm->_global->_inter_execPtr++;
- switch(cmd & 0x7f) {
+ switch (cmd & 0x7f) {
case 48:
if ((_vm->_global->_videoMode < 0x32) || (_vm->_global->_videoMode > 0x63)) {
_vm->_global->_inter_execPtr += 48;
@@ -1325,7 +1325,7 @@ bool Inter_v2::o2_palLoad(char &cmdCount, int16 &counter, int16 &retFlag) {
int dl = 0;
for (i = 2; i < 18; i++) {
dl = 1;
- if(_vm->_global->_inter_execPtr[i] != 0)
+ if (_vm->_global->_inter_execPtr[i] != 0)
dl = 0;
}
if (dl != 0) {
diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp
index 5b420ec668..d26919d53a 100644
--- a/engines/gob/mult_v2.cpp
+++ b/engines/gob/mult_v2.cpp
@@ -1236,7 +1236,7 @@ void Mult_v2::animate(void) {
animData1->frame++;
if (animData1->frame >=
_vm->_scenery->_animations[(int)animData1->animation].layers[animData1->layer]->framesCount) {
- switch(animData1->animType) {
+ switch (animData1->animType) {
case 0:
animData1->frame = 0;
break;