aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tucker/resource.cpp32
-rw-r--r--engines/tucker/sequences.cpp2
-rw-r--r--engines/tucker/tucker.cpp25
3 files changed, 28 insertions, 31 deletions
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 6b6ab1e600..d96b8a35d1 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -393,16 +393,16 @@ void TuckerEngine::loadBudSpr(int startOffset) {
switch (_flagsTable[137]) {
case 0:
if ((_gameFlags & kGameFlagDemo) != 0) {
- sprintf(filename, "budl00_%d.pcx", frame + 1);
+ snprintf(filename, sizeof(filename), "budl00_%d.pcx", frame + 1);
} else {
- sprintf(filename, "bud_%d.pcx", frame + 1);
+ snprintf(filename, sizeof(filename), "bud_%d.pcx", frame + 1);
}
break;
case 1:
- sprintf(filename, "peg_%d.pcx", frame + 1);
+ snprintf(filename, sizeof(filename), "peg_%d.pcx", frame + 1);
break;
default:
- sprintf(filename, "mac_%d.pcx", frame + 1);
+ snprintf(filename, sizeof(filename), "mac_%d.pcx", frame + 1);
break;
}
loadImage(filename, _loadTempBuf, 0);
@@ -483,25 +483,25 @@ void TuckerEngine::loadLoc() {
int i = _locationWidthTable[_locationNum];
_locationHeight = (_locationNum < 73) ? 140 : 200;
- sprintf(filename, (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
+ snprintf(filename, sizeof(filename), (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
copyLocBitmap(filename, 0, false);
Graphics::copyRect(_quadBackgroundGfxBuf, 320, _locationBackgroundGfxBuf, 640, 320, _locationHeight);
if (_locationHeight == 200) {
return;
}
- sprintf(filename, (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
+ snprintf(filename, sizeof(filename), (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
copyLocBitmap(filename, 0, true);
if (i > 1) {
- sprintf(filename, "loc%02db.pcx", _locationNum);
+ snprintf(filename, sizeof(filename), "loc%02db.pcx", _locationNum);
copyLocBitmap(filename, 320, false);
Graphics::copyRect(_quadBackgroundGfxBuf + 44800, 320, _locationBackgroundGfxBuf + 320, 640, 320, _locationHeight);
if (i == 2) {
- sprintf(filename, "path%02db.pcx", _locationNum);
+ snprintf(filename, sizeof(filename), "path%02db.pcx", _locationNum);
copyLocBitmap(filename, 320, true);
}
}
if (i > 2) {
- sprintf(filename, "loc%02dc.pcx", _locationNum);
+ snprintf(filename, sizeof(filename), "loc%02dc.pcx", _locationNum);
copyLocBitmap(filename, 0, false);
Graphics::copyRect(_quadBackgroundGfxBuf + 89600, 320, _locationBackgroundGfxBuf, 640, 320, 140);
}
@@ -510,7 +510,7 @@ void TuckerEngine::loadLoc() {
loadImage("rochpath.pcx", _loadLocBufPtr, 0);
}
if (i > 3) {
- sprintf(filename, "loc%02dd.pcx", _locationNum);
+ snprintf(filename, sizeof(filename), "loc%02dd.pcx", _locationNum);
copyLocBitmap(filename, 0, false);
Graphics::copyRect(_quadBackgroundGfxBuf + 134400, 320, _locationBackgroundGfxBuf + 320, 640, 320, 140);
}
@@ -541,10 +541,10 @@ void TuckerEngine::loadObj() {
_currentPartNum = _partNum;
char filename[40];
- sprintf(filename, "objtxt%d.c", _partNum);
+ snprintf(filename, sizeof(filename), "objtxt%d.c", _partNum);
free(_objTxtBuf);
_objTxtBuf = loadFile(filename, 0);
- sprintf(filename, "pt%dtext.c", _partNum);
+ snprintf(filename, sizeof(filename), "pt%dtext.c", _partNum);
free(_ptTextBuf);
_ptTextBuf = loadFile(filename, 0);
_characterSpeechDataPtr = _ptTextBuf;
@@ -585,7 +585,7 @@ void TuckerEngine::loadData() {
int offset = 0;
for (int i = 0; i < count; ++i) {
char filename[40];
- sprintf(filename, "scrobj%d%d.pcx", _partNum, i);
+ snprintf(filename, sizeof(filename), "scrobj%d%d.pcx", _partNum, i);
loadImage(filename, _loadTempBuf, 0);
offset = loadDataHelper(offset, i);
}
@@ -604,7 +604,7 @@ int TuckerEngine::loadDataHelper(int offset, int index) {
void TuckerEngine::loadPanObj() {
char filename[40];
- sprintf(filename, "panobjs%d.pcx", _partNum);
+ snprintf(filename, sizeof(filename), "panobjs%d.pcx", _partNum);
loadImage(filename, _loadTempBuf, 0);
int offset = 0;
for (int y = 0; y < 5; ++y) {
@@ -813,7 +813,7 @@ void TuckerEngine::loadSprA02_01() {
const int count = _sprA02LookupTable[_locationNum];
for (int i = 1; i < count + 1; ++i) {
char filename[40];
- sprintf(filename, "sprites/a%02d_%02d.spr", _locationNum, i);
+ snprintf(filename, sizeof(filename), "sprites/a%02d_%02d.spr", _locationNum, i);
_sprA02Table[i] = loadFile(filename, 0);
}
_sprA02Table[0] = _sprA02Table[1];
@@ -832,7 +832,7 @@ void TuckerEngine::loadSprC02_01() {
const int count = _sprC02LookupTable[_locationNum];
for (int i = 1; i < count + 1; ++i) {
char filename[40];
- sprintf(filename, "sprites/c%02d_%02d.spr", _locationNum, i);
+ snprintf(filename, sizeof(filename), "sprites/c%02d_%02d.spr", _locationNum, i);
_sprC02Table[i] = loadFile(filename, 0);
}
_sprC02Table[0] = _sprC02Table[1];
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 73018b8c00..a655d5b456 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -119,7 +119,7 @@ void TuckerEngine::handleCreditsSequence() {
char filename[40];
if (num == 6) {
for (int i = 0; i < 16; ++i) {
- sprintf(filename, "cogs%04d.pcx", i + 1);
+ snprintf(filename, sizeof(filename), "cogs%04d.pcx", i + 1);
loadImage(filename, imgBuf + i * 64000, 2);
}
} else {
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index 553a860219..766172c87f 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -668,8 +668,8 @@ void TuckerEngine::updateCursorPos(int x, int y) {
void TuckerEngine::setCursorNum(int num) {
_cursorNum = num;
- const int cursorW = 16;
- const int cursorH = 16;
+ static const int cursorW = 16;
+ static const int cursorH = 16;
CursorMan.replaceCursor(_cursorGfxBuf + _cursorNum * 256, cursorW, cursorH, 1, 1, 0);
}
@@ -1090,17 +1090,15 @@ void TuckerEngine::stopSounds() {
}
void TuckerEngine::playSounds() {
- for (int i = 0; i < 29; ++i) {
- if (i < _locationSoundsCount) {
- if (_locationSoundsTable[i].type == 1 || _locationSoundsTable[i].type == 2 || _locationSoundsTable[i].type == 5 ||
- (_locationSoundsTable[i].type == 7 && _flagsTable[_locationSoundsTable[i].flagNum] == _locationSoundsTable[i].flagValueStartFx)) {
- startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
- }
+ for (int i = 0; i < _locationSoundsCount; ++i) {
+ if (_locationSoundsTable[i].type == 1 || _locationSoundsTable[i].type == 2 || _locationSoundsTable[i].type == 5 ||
+ (_locationSoundsTable[i].type == 7 && _flagsTable[_locationSoundsTable[i].flagNum] == _locationSoundsTable[i].flagValueStartFx)) {
+ startSound(_locationSoundsTable[i].offset, i, _locationSoundsTable[i].volume);
}
- if (i < _locationMusicsCount) {
- if (_locationMusicsTable[i].flag > 0) {
- startMusic(_locationMusicsTable[i].offset, i, _locationMusicsTable[i].volume);
- }
+ }
+ for (int i = 0; i < _locationMusicsCount; ++i) {
+ if (_locationMusicsTable[i].flag > 0) {
+ startMusic(_locationMusicsTable[i].offset, i, _locationMusicsTable[i].volume);
}
}
}
@@ -1422,7 +1420,6 @@ void TuckerEngine::redrawPanelOverBackground() {
}
void TuckerEngine::drawConversationTexts() {
- int x = 0;
int y = 141;
int flag = 0;
for (int i = 0; i < _conversationOptionsCount; ++i) {
@@ -1430,7 +1427,7 @@ void TuckerEngine::drawConversationTexts() {
if ((_mousePosY > y && _mousePosY < y + 11) || _nextTableToLoadIndex == i) {
color = 106;
}
- drawSpeechText(x, y, _characterSpeechDataPtr, _instructionsActionsTable[i], color);
+ drawSpeechText(0, y, _characterSpeechDataPtr, _instructionsActionsTable[i], color);
if (_mousePosY > y && _mousePosY < _conversationOptionLinesCount * 10 + y + 1) {
_nextTableToLoadIndex = i;
flag = 1;