aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tucker/locations.cpp3
-rw-r--r--engines/tucker/resource.cpp79
-rw-r--r--engines/tucker/sequences.cpp61
-rw-r--r--engines/tucker/tucker.h3
4 files changed, 80 insertions, 66 deletions
diff --git a/engines/tucker/locations.cpp b/engines/tucker/locations.cpp
index 7c1dbf7709..da0a1644d2 100644
--- a/engines/tucker/locations.cpp
+++ b/engines/tucker/locations.cpp
@@ -188,8 +188,7 @@ void TuckerEngine::execData3PreUpdate_locationNum2() {
_updateLocationYPosTable2[i] = 0;
}
if (_flagsTable[10] == 0) {
- strcpy(_fileToLoad, "path02b.pcx");
- copyLocBitmap(0, true);
+ copyLocBitmap("path02b.pcx", 0, true);
}
for (int i = 0; i < 3; ++i) {
if (_updateLocationYPosTable2[i] > 0) {
diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index d3387bf9af..44da244abe 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -335,8 +335,7 @@ void TuckerEngine::loadCharSizeDta() {
}
void TuckerEngine::loadPanel() {
- strcpy(_fileToLoad, (_panelNum == 0) ? "panel1.pcx" : "panel2.pcx");
- loadImage(_fileToLoad, _panelGfxBuf, 0);
+ loadImage((_panelNum == 0) ? "panel1.pcx" : "panel2.pcx", _panelGfxBuf, 0);
}
void TuckerEngine::loadBudSpr(int startOffset) {
@@ -347,18 +346,19 @@ void TuckerEngine::loadBudSpr(int startOffset) {
int spriteOffset = 0;
for (int i = startOffset; i < endOffset; ++i) {
if (_ctable01Table_sprite[frame] == i) {
+ char filename[40];
switch (_flagsTable[137]) {
case 0:
- sprintf(_fileToLoad, "bud_%d.pcx", frame + 1);
+ sprintf(filename, "bud_%d.pcx", frame + 1);
break;
case 1:
- sprintf(_fileToLoad, "peg_%d.pcx", frame + 1);
+ sprintf(filename, "peg_%d.pcx", frame + 1);
break;
default:
- sprintf(_fileToLoad, "mac_%d.pcx", frame + 1);
+ sprintf(filename, "mac_%d.pcx", frame + 1);
break;
}
- loadImage(_fileToLoad, _loadTempBuf, 0);
+ loadImage(filename, _loadTempBuf, 0);
++frame;
}
int sz = Graphics::encodeRLE(_loadTempBuf + _spriteFramesTable[i].sourceOffset, _spritesGfxBuf + spriteOffset, _spriteFramesTable[i].xSize, _spriteFramesTable[i].ySize);
@@ -428,28 +428,30 @@ void TuckerEngine::loadCTable02(int fl) {
}
void TuckerEngine::loadLoc() {
+ char filename[40];
+
int i = _locationWidthTable[_locationNum];
_locationHeight = (_locationNum < 73) ? 140 : 200;
- sprintf(_fileToLoad, (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
- copyLocBitmap(0, false);
+ sprintf(filename, (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
+ copyLocBitmap(filename, 0, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf, _quadBackgroundGfxBuf, 320, _locationHeight);
if (_locationHeight == 200) {
return;
}
- sprintf(_fileToLoad, (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
- copyLocBitmap(0, true);
+ sprintf(filename, (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
+ copyLocBitmap(filename, 0, true);
if (i > 1) {
- sprintf(_fileToLoad, "loc%02db.pcx", _locationNum);
- copyLocBitmap(320, false);
+ sprintf(filename, "loc%02db.pcx", _locationNum);
+ copyLocBitmap(filename, 320, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf + 320, _quadBackgroundGfxBuf + 44800, 320, 140);
if (i == 2) {
- sprintf(_fileToLoad, "path%02db.pcx", _locationNum);
- copyLocBitmap(320, true);
+ sprintf(filename, "path%02db.pcx", _locationNum);
+ copyLocBitmap(filename, 320, true);
}
}
if (i > 2) {
- sprintf(_fileToLoad, "loc%02dc.pcx", _locationNum);
- copyLocBitmap(0, false);
+ sprintf(filename, "loc%02dc.pcx", _locationNum);
+ copyLocBitmap(filename, 0, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf, _quadBackgroundGfxBuf + 89600, 320, 140);
}
if (_locationNum == 1) {
@@ -457,8 +459,8 @@ void TuckerEngine::loadLoc() {
loadImage("rochpath.pcx", _loadLocBufPtr, 0);
}
if (i > 3) {
- sprintf(_fileToLoad, "loc%02dd.pcx", _locationNum);
- copyLocBitmap(0, false);
+ sprintf(filename, "loc%02dd.pcx", _locationNum);
+ copyLocBitmap(filename, 0, false);
Graphics::copyFrom640(_locationBackgroundGfxBuf + 320, _quadBackgroundGfxBuf + 134400, 320, 140);
}
_fullRedrawCounter = 2;
@@ -484,12 +486,15 @@ void TuckerEngine::loadObj() {
debug(2, "loadObj() partNum %d locationNum %d", _partNum, _locationNum);
handleNewPartSequence();
_currentPartNum = _partNum;
- sprintf(_fileToLoad, "objtxt%d.c", _partNum);
+
+
+ char filename[40];
+ sprintf(filename, "objtxt%d.c", _partNum);
free(_objTxtBuf);
- _objTxtBuf = loadFile(_fileToLoad, 0);
- sprintf(_fileToLoad, "pt%dtext.c", _partNum);
+ _objTxtBuf = loadFile(filename, 0);
+ sprintf(filename, "pt%dtext.c", _partNum);
free(_ptTextBuf);
- _ptTextBuf = loadFile(_fileToLoad, 0);
+ _ptTextBuf = loadFile(filename, 0);
loadData();
loadPanObj();
}
@@ -538,8 +543,9 @@ void TuckerEngine::loadData() {
_dataCount = maxCount;
int offset = 0;
for (int i = 0; i < count; ++i) {
- sprintf(_fileToLoad, "scrobj%d%d.pcx", _partNum, i);
- loadImage(_fileToLoad, _loadTempBuf, 0);
+ char filename[40];
+ sprintf(filename, "scrobj%d%d.pcx", _partNum, i);
+ loadImage(filename, _loadTempBuf, 0);
offset = loadDataHelper(offset, i);
}
}
@@ -556,8 +562,9 @@ int TuckerEngine::loadDataHelper(int offset, int index) {
}
void TuckerEngine::loadPanObj() {
- sprintf(_fileToLoad, "panobjs%d.pcx", _partNum);
- loadImage(_fileToLoad, _loadTempBuf, 0);
+ char filename[40];
+ sprintf(filename, "panobjs%d.pcx", _partNum);
+ loadImage(filename, _loadTempBuf, 0);
int offset = 0;
for (int y = 0; y < 5; ++y) {
for (int x = 0; x < 10; ++x) {
@@ -651,18 +658,20 @@ void TuckerEngine::loadData4() {
}
void TuckerEngine::loadActionFile() {
+ char filename[40];
switch (_partNum) {
case 1:
- strcpy(_fileToLoad, "action1.c");
+ strcpy(filename, "action1.c");
break;
case 2:
- strcpy(_fileToLoad, "action2.c");
+ strcpy(filename, "action2.c");
break;
default:
- strcpy(_fileToLoad, "action3.c");
+ strcpy(filename, "action3.c");
break;
}
- loadFile(_fileToLoad, _loadTempBuf);
+ loadFile(filename, _loadTempBuf);
+
DataTokenizer t(_loadTempBuf, _fileLoadSize);
_actionsCount = 0;
if (t.findIndex(_locationNum)) {
@@ -759,8 +768,9 @@ void TuckerEngine::loadSprA02_01() {
unloadSprA02_01();
const int count = _sprA02LookupTable[_locationNum];
for (int i = 1; i < count + 1; ++i) {
- sprintf(_fileToLoad, "sprites/a%02d_%02d.spr", _locationNum, i);
- _sprA02Table[i] = loadFile(_fileToLoad, 0);
+ char filename[40];
+ sprintf(filename, "sprites/a%02d_%02d.spr", _locationNum, i);
+ _sprA02Table[i] = loadFile(filename, 0);
}
_sprA02Table[0] = _sprA02Table[1];
}
@@ -777,8 +787,9 @@ void TuckerEngine::loadSprC02_01() {
unloadSprC02_01();
const int count = _sprC02LookupTable[_locationNum];
for (int i = 1; i < count + 1; ++i) {
- sprintf(_fileToLoad, "sprites/c%02d_%02d.spr", _locationNum, i);
- _sprC02Table[i] = loadFile(_fileToLoad, 0);
+ char filename[40];
+ sprintf(filename, "sprites/c%02d_%02d.spr", _locationNum, i);
+ _sprC02Table[i] = loadFile(filename, 0);
}
_sprC02Table[0] = _sprC02Table[1];
_spritesCount = _sprC02LookupTable2[_locationNum];
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index bda1dd7bc0..3b93906afb 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -126,30 +126,31 @@ void TuckerEngine::handleCreditsSequence() {
_spritesTable[i].stateIndex = -1;
}
++num;
+ char filename[40];
if (num == 6) {
for (int i = 0; i < 16; ++i) {
- sprintf(_fileToLoad, "cogs%04d.pcx", i);
- loadImage(_fileToLoad, imgBuf + i * 64000, 2);
+ sprintf(filename, "cogs%04d.pcx", i);
+ loadImage(filename, imgBuf + i * 64000, 2);
}
} else {
switch (num) {
case 1:
- strcpy(_fileToLoad, "loc75.pcx");
+ strcpy(filename, "loc75.pcx");
break;
case 2:
- strcpy(_fileToLoad, "loc76.pcx");
+ strcpy(filename, "loc76.pcx");
break;
case 3:
- strcpy(_fileToLoad, "paper-3.pcx");
+ strcpy(filename, "paper-3.pcx");
break;
case 4:
- strcpy(_fileToLoad, "loc77.pcx");
+ strcpy(filename, "loc77.pcx");
break;
case 5:
- strcpy(_fileToLoad, "loc78.pcx");
+ strcpy(filename, "loc78.pcx");
break;
}
- loadImage(_fileToLoad, _quadBackgroundGfxBuf, 2);
+ loadImage(filename, _quadBackgroundGfxBuf, 2);
}
_spritesCount = _creditsSequenceData2[num];
++_flagsTable[236];
@@ -185,6 +186,8 @@ void TuckerEngine::handleCongratulationsSequence() {
}
void TuckerEngine::handleNewPartSequence() {
+ char filename[40];
+
stopSounds();
if (_flagsTable[219] == 1) {
_flagsTable[219] = 0;
@@ -203,16 +206,16 @@ void TuckerEngine::handleNewPartSequence() {
_scrollOffset = 0;
switch (_partNum) {
case 1:
- strcpy(_fileToLoad, "pt1bak.pcx");
+ strcpy(filename, "pt1bak.pcx");
break;
case 2:
- strcpy(_fileToLoad, "pt2bak.pcx");
+ strcpy(filename, "pt2bak.pcx");
break;
default:
- strcpy(_fileToLoad, "pt3bak.pcx");
+ strcpy(filename, "pt3bak.pcx");
break;
}
- loadImage(_fileToLoad, _quadBackgroundGfxBuf, 1);
+ loadImage(filename, _quadBackgroundGfxBuf, 1);
_spritesCount = 1;
memset(&_spritesTable[0], 0, sizeof(Sprite));
_spritesTable[0].state = -1;
@@ -223,16 +226,16 @@ void TuckerEngine::handleNewPartSequence() {
unloadSprC02_01();
switch (_partNum) {
case 1:
- strcpy(_fileToLoad, "sprites/partone.spr");
+ strcpy(filename, "sprites/partone.spr");
break;
case 2:
- strcpy(_fileToLoad, "sprites/parttwo.spr");
+ strcpy(filename, "sprites/parttwo.spr");
break;
default:
- strcpy(_fileToLoad, "sprites/partthr.spr");
+ strcpy(filename, "sprites/partthr.spr");
break;
}
- _sprC02Table[1] = loadFile(_fileToLoad, 0);
+ _sprC02Table[1] = loadFile(filename, 0);
startSpeechSound(9000, 60);
_fadePaletteCounter = 0;
do {
@@ -268,23 +271,24 @@ void TuckerEngine::handleNewPartSequence() {
}
void TuckerEngine::handleMeanwhileSequence() {
+ char filename[40];
uint8 backupPalette[256 * 3];
memcpy(backupPalette, _currentPalette, 256 * 3);
switch (_partNum) {
case 1:
- strcpy(_fileToLoad, "meanw01.pcx");
+ strcpy(filename, "meanw01.pcx");
break;
case 2:
- strcpy(_fileToLoad, "meanw02.pcx");
+ strcpy(filename, "meanw02.pcx");
break;
default:
- strcpy(_fileToLoad, "meanw03.pcx");
+ strcpy(filename, "meanw03.pcx");
break;
}
if (_flagsTable[215] == 0 && _flagsTable[231] == 1) {
- strcpy(_fileToLoad, "loc80.pcx");
+ strcpy(filename, "loc80.pcx");
}
- loadImage(_fileToLoad, _quadBackgroundGfxBuf + 89600, 1);
+ loadImage(filename, _quadBackgroundGfxBuf + 89600, 1);
_fadePaletteCounter = 0;
for (int i = 0; i < 60; ++i) {
if (_fadePaletteCounter < 16) {
@@ -427,20 +431,21 @@ void TuckerEngine::copyMapRect(int x, int y, int w, int h) {
}
int TuckerEngine::handleSpecialObjectSelectionSequence() {
+ char filename[40];
if (_partNum == 1 && _selectedObjectNum == 6) {
- strcpy(_fileToLoad, "news1.pcx");
+ strcpy(filename, "news1.pcx");
_flagsTable[7] = 4;
} else if (_partNum == 3 && _selectedObjectNum == 45) {
- strcpy(_fileToLoad, "profnote.pcx");
+ strcpy(filename, "profnote.pcx");
} else if (_partNum == 1 && _selectedObjectNum == 26) {
- strcpy(_fileToLoad, "photo.pcx");
+ strcpy(filename, "photo.pcx");
} else if (_partNum == 3 && _selectedObjectNum == 39) {
- strcpy(_fileToLoad, "news2.pcx");
+ strcpy(filename, "news2.pcx");
_flagsTable[135] = 1;
} else if (_currentInfoString1SourceType == 0 && _currentActionObj1Num == 259) {
- strcpy(_fileToLoad, "postit.pcx");
+ strcpy(filename, "postit.pcx");
} else if (_currentInfoString1SourceType == 1 && _currentActionObj1Num == 91) {
- strcpy(_fileToLoad, "memo.pcx");
+ strcpy(filename, "memo.pcx");
} else {
return 0;
}
@@ -450,7 +455,7 @@ int TuckerEngine::handleSpecialObjectSelectionSequence() {
--_fadePaletteCounter;
}
_mouseClick = 1;
- loadImage(_fileToLoad, _quadBackgroundGfxBuf, 1);
+ loadImage(filename, _quadBackgroundGfxBuf, 1);
_fadePaletteCounter = 0;
while (!_quitGame) {
waitForTimer(2);
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index 9d5110cbb7..630e6fc766 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -256,7 +256,7 @@ protected:
void setCursorNum(int num);
void setCursorType(int type);
void setupNewLocation();
- void copyLocBitmap(int offset, bool isMask);
+ void copyLocBitmap(const char *filename, int offset, bool isMask);
void updateMouseState();
void updateCharPositionHelper();
void updateCharPosition();
@@ -600,7 +600,6 @@ protected:
int _gameHintsDisplayText;
int _gameHintsStringNum;
- char _fileToLoad[40];
int _fileLoadSize;
int _compressedSoundType;
Common::File _fCompressedSound;