165
162
uint8 *TuckerEngine::loadFile(const char *fname, uint8 *p) {
167
strcpy(filename, fname);
163
Common::String filename;
168
165
if (_gameLang == Common::DE_DEU) {
169
if (strcmp(filename, "bgtext.c") == 0) {
170
strcpy(filename, "bgtextgr.c");
171
} else if (strcmp(filename, "charname.c") == 0) {
172
strcpy(filename, "charnmgr.c");
173
} else if (strcmp(filename, "data5.c") == 0) {
174
strcpy(filename, "data5gr.c");
175
} else if (strcmp(filename, "infobar.txt") == 0) {
176
strcpy(filename, "infobrgr.txt");
177
} else if (strcmp(filename, "charsize.dta") == 0) {
178
strcpy(filename, "charszgr.dta");
179
} else if (strncmp(filename, "objtxt", 6) == 0) {
180
const char num = filename[6];
181
snprintf(filename, sizeof(filename), "objtx%cgr.c", num);
182
} else if (strncmp(filename, "pt", 2) == 0) {
183
const char num = filename[2];
184
snprintf(filename, sizeof(filename), "pt%ctxtgr.c", num);
166
if (filename == "bgtext.c") {
167
filename = "bgtextgr.c";
168
} else if (filename == "charname.c") {
169
filename = "charnmgr.c";
170
} else if (filename == "data5.c") {
171
filename = "data5gr.c";
172
} else if (filename == "infobar.txt") {
173
filename = "infobrgr.txt";
174
} else if (filename == "charsize.dta") {
175
filename = "charszgr.dta";
176
} else if (filename.hasPrefix("objtxt")) {
177
filename = Common::String::format("objtx%cgr.c", filename[6]);
178
} else if (filename.hasPrefix("pt")) {
179
filename = Common::String::format("pt%ctxtgr.c", filename[2]);
187
182
_fileLoadSize = 0;
188
183
bool decode = false;
189
184
if (_gameFlags & kGameFlagEncodedData) {
190
char *ext = strrchr(filename, '.');
191
if (ext && strcmp(ext + 1, "c") == 0) {
192
strcpy(ext + 1, "enc");
185
if (filename.hasSuffix(".c")) {
186
filename.deleteLastChar();
197
192
if (!f.open(filename)) {
198
warning("Unable to open '%s'", filename);
193
warning("Unable to open '%s'", filename.c_str());
201
196
const int sz = f.size();
392
387
int spriteOffset = 0;
393
388
for (int i = startOffset; i < endOffset; ++i) {
394
389
if (framesCount[frame] == i) {
390
Common::String filename;
396
391
switch (_flagsTable[137]) {
398
393
if ((_gameFlags & kGameFlagDemo) != 0) {
399
snprintf(filename, sizeof(filename), "budl00_%d.pcx", frame + 1);
394
filename = Common::String::format("budl00_%d.pcx", frame + 1);
401
snprintf(filename, sizeof(filename), "bud_%d.pcx", frame + 1);
396
filename = Common::String::format("bud_%d.pcx", frame + 1);
405
snprintf(filename, sizeof(filename), "peg_%d.pcx", frame + 1);
400
filename = Common::String::format("peg_%d.pcx", frame + 1);
408
snprintf(filename, sizeof(filename), "mac_%d.pcx", frame + 1);
403
filename = Common::String::format("mac_%d.pcx", frame + 1);
411
loadImage(filename, _loadTempBuf, 0);
406
loadImage(filename.c_str(), _loadTempBuf, 0);
414
409
int sz = Graphics::encodeRLE(_loadTempBuf + _spriteFramesTable[i].sourceOffset, _spritesGfxBuf + spriteOffset, _spriteFramesTable[i].xSize, _spriteFramesTable[i].ySize);
484
479
void TuckerEngine::loadLoc() {
480
Common::String filename;
487
482
int i = _locationWidthTable[_locationNum];
488
483
_locationHeight = (_locationNum < 73) ? 140 : 200;
489
snprintf(filename, sizeof(filename), (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
490
copyLocBitmap(filename, 0, false);
484
filename = Common::String::format((i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
485
copyLocBitmap(filename.c_str(), 0, false);
491
486
Graphics::copyRect(_quadBackgroundGfxBuf, 320, _locationBackgroundGfxBuf, 640, 320, _locationHeight);
492
487
if (_locationHeight == 200) {
495
snprintf(filename, sizeof(filename), (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
496
copyLocBitmap(filename, 0, true);
490
filename = Common::String::format((i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
491
copyLocBitmap(filename.c_str(), 0, true);
498
snprintf(filename, sizeof(filename), "loc%02db.pcx", _locationNum);
499
copyLocBitmap(filename, 320, false);
493
filename = Common::String::format("loc%02db.pcx", _locationNum);
494
copyLocBitmap(filename.c_str(), 320, false);
500
495
Graphics::copyRect(_quadBackgroundGfxBuf + 44800, 320, _locationBackgroundGfxBuf + 320, 640, 320, _locationHeight);
502
snprintf(filename, sizeof(filename), "path%02db.pcx", _locationNum);
503
copyLocBitmap(filename, 320, true);
497
filename = Common::String::format("path%02db.pcx", _locationNum);
498
copyLocBitmap(filename.c_str(), 320, true);
507
snprintf(filename, sizeof(filename), "loc%02dc.pcx", _locationNum);
508
copyLocBitmap(filename, 0, false);
502
filename = Common::String::format("loc%02dc.pcx", _locationNum);
503
copyLocBitmap(filename.c_str(), 0, false);
509
504
Graphics::copyRect(_quadBackgroundGfxBuf + 89600, 320, _locationBackgroundGfxBuf, 640, 320, 140);
511
506
if (_locationNum == 1) {
513
508
loadImage("rochpath.pcx", _loadLocBufPtr, 0);
516
snprintf(filename, sizeof(filename), "loc%02dd.pcx", _locationNum);
517
copyLocBitmap(filename, 0, false);
511
filename = Common::String::format("loc%02dd.pcx", _locationNum);
512
copyLocBitmap(filename.c_str(), 0, false);
518
513
Graphics::copyRect(_quadBackgroundGfxBuf + 134400, 320, _locationBackgroundGfxBuf + 320, 640, 320, 140);
520
515
_fullRedraw = true;
544
539
_currentPartNum = _partNum;
547
snprintf(filename, sizeof(filename), "objtxt%d.c", _partNum);
541
Common::String filename;
542
filename = Common::String::format("objtxt%d.c", _partNum);
548
543
free(_objTxtBuf);
549
_objTxtBuf = loadFile(filename, 0);
550
snprintf(filename, sizeof(filename), "pt%dtext.c", _partNum);
544
_objTxtBuf = loadFile(filename.c_str(), 0);
545
filename = Common::String::format("pt%dtext.c", _partNum);
551
546
free(_ptTextBuf);
552
_ptTextBuf = loadFile(filename, 0);
547
_ptTextBuf = loadFile(filename.c_str(), 0);
553
548
_characterSpeechDataPtr = _ptTextBuf;
587
582
_dataCount = maxCount;
589
584
for (int i = 0; i < count; ++i) {
591
snprintf(filename, sizeof(filename), "scrobj%d%d.pcx", _partNum, i);
592
loadImage(filename, _loadTempBuf, 0);
585
Common::String filename = Common::String::format("scrobj%d%d.pcx", _partNum, i);
586
loadImage(filename.c_str(), _loadTempBuf, 0);
593
587
offset = loadDataHelper(offset, i);
608
602
void TuckerEngine::loadPanObj() {
610
snprintf(filename, sizeof(filename), "panobjs%d.pcx", _partNum);
611
loadImage(filename, _loadTempBuf, 0);
603
Common::String filename = Common::String::format("panobjs%d.pcx", _partNum);
604
loadImage(filename.c_str(), _loadTempBuf, 0);
613
606
for (int y = 0; y < 5; ++y) {
614
607
for (int x = 0; x < 10; ++x) {
815
808
unloadSprA02_01();
816
809
const int count = _sprA02LookupTable[_locationNum];
817
810
for (int i = 1; i < count + 1; ++i) {
819
snprintf(filename, sizeof(filename), "sprites/a%02d_%02d.spr", _locationNum, i);
820
_sprA02Table[i] = loadFile(filename, 0);
811
Common::String filename = Common::String::format("sprites/a%02d_%02d.spr", _locationNum, i);
812
_sprA02Table[i] = loadFile(filename.c_str(), 0);
822
814
_sprA02Table[0] = _sprA02Table[1];
834
826
unloadSprC02_01();
835
827
const int count = _sprC02LookupTable[_locationNum];
836
828
for (int i = 1; i < count + 1; ++i) {
838
snprintf(filename, sizeof(filename), "sprites/c%02d_%02d.spr", _locationNum, i);
839
_sprC02Table[i] = loadFile(filename, 0);
829
Common::String filename = Common::String::format("sprites/c%02d_%02d.spr", _locationNum, i);
830
_sprC02Table[i] = loadFile(filename.c_str(), 0);
841
832
_sprC02Table[0] = _sprC02Table[1];
842
833
_spritesCount = _sprC02LookupTable2[_locationNum];