LILLIPUT: Migrate engine to Path

This commit is contained in:
Le Philousophe 2023-10-31 23:20:22 +01:00 committed by Eugene Sandulenko
parent 1a31b42ca4
commit 0df39efb81
5 changed files with 19 additions and 19 deletions

View File

@ -2342,13 +2342,13 @@ void LilliputEngine::pollEvent() {
}
}
byte *LilliputEngine::loadVGA(Common::String filename, int expectedSize, bool loadPal) {
debugC(1, kDebugEngine, "loadVGA(%s, %d, %d)", filename.c_str(), expectedSize, (loadPal) ? 1 : 0);
byte *LilliputEngine::loadVGA(const Common::Path &filename, int expectedSize, bool loadPal) {
debugC(1, kDebugEngine, "loadVGA(%s, %d, %d)", filename.toString().c_str(), expectedSize, (loadPal) ? 1 : 0);
Common::File f;
if (!f.open(filename))
error("Missing game file %s", filename.c_str());
error("Missing game file %s", filename.toString().c_str());
int remainingSize = f.size();
if (loadPal) {
@ -2402,13 +2402,13 @@ byte *LilliputEngine::loadVGA(Common::String filename, int expectedSize, bool lo
return decodeBuffer;
}
byte *LilliputEngine::loadRaw(Common::String filename, int filesize) {
debugC(1, kDebugEngine, "loadRaw(%s)", filename.c_str());
byte *LilliputEngine::loadRaw(const Common::Path &filename, int filesize) {
debugC(1, kDebugEngine, "loadRaw(%s)", filename.toString().c_str());
Common::File f;
if (!f.open(filename))
error("Missing game file %s", filename.c_str());
error("Missing game file %s", filename.toString().c_str());
byte *res = (byte *)malloc(sizeof(byte) * filesize);
for (int i = 0; i < filesize; ++i)
@ -2431,7 +2431,7 @@ void LilliputEngine::loadRules() {
Common::File f;
uint16 curWord;
Common::String filename = "ERULES.PRG";
Common::Path filename("ERULES.PRG");
Common::Language lang = Common::parseLanguage(ConfMan.get("language"));
switch (lang) {
@ -2451,7 +2451,7 @@ void LilliputEngine::loadRules() {
}
if (!f.open(filename))
error("Missing game file %s", filename.c_str());
error("Missing game file %s", filename.toString().c_str());
_word10800_ERULES = f.readUint16LE();
@ -2609,8 +2609,8 @@ void LilliputEngine::loadRules() {
f.close();
}
void LilliputEngine::displayVGAFile(Common::String fileName) {
debugC(1, kDebugEngine, "displayVGAFile(%s)", fileName.c_str());
void LilliputEngine::displayVGAFile(const Common::Path &fileName) {
debugC(1, kDebugEngine, "displayVGAFile(%s)", fileName.toString().c_str());
byte *buffer = loadVGA(fileName, 64000, true);
memcpy(_mainSurface->getPixels(), buffer, 320*200);

View File

@ -304,11 +304,11 @@ public:
void homeInChooseDirection(int index);
void initGame(const LilliputGameDescription *gd);
byte *loadVGA(Common::String filename, int fileSize, bool loadPal);
byte *loadRaw(Common::String filename, int filesize);
byte *loadVGA(const Common::Path &filename, int fileSize, bool loadPal);
byte *loadRaw(const Common::Path &filename, int filesize);
void loadRules();
void displayVGAFile(Common::String fileName);
void displayVGAFile(const Common::Path &fileName);
void initPalette();
void fixPaletteEntries(uint8 *palette, int num);

View File

@ -2972,7 +2972,7 @@ void LilliputScript::OC_loadAndDisplayCubesGfx() {
int setNumb = (_currScript->readUint16LE() & 0xFF);
assert((setNumb >= 0) && (setNumb <= 9));
Common::String fileName = Common::String::format("CUBES%d.GFX", setNumb);
Common::Path fileName(Common::String::format("CUBES%d.GFX", setNumb));
_cubeSet = setNumb; // Useless in this variant, keep for the moment for Rome
_vm->_bufferCubegfx = _vm->loadVGA(fileName, 61440, false);
@ -3147,7 +3147,7 @@ void LilliputScript::OC_displayVGAFile() {
_vm->paletteFadeOut();
int curWord = _currScript->readUint16LE();
int index = _vm->_packedStringIndex[curWord];
Common::String fileName = Common::String((const char *)&_vm->_packedStrings[index]);
Common::Path fileName((const char *)&_vm->_packedStrings[index]);
_talkingCharacter = -1;
_vm->displayVGAFile(fileName);
_vm->paletteFadeIn();

View File

@ -91,13 +91,13 @@ uint32 LilliputSound::decode(const byte *src, byte *dst, uint32 len, uint32 star
return i;
}
void LilliputSound::loadMusic(Common::String filename) {
debugC(1, kDebugSound, "loadMusic(%s)", filename.c_str());
void LilliputSound::loadMusic(const Common::Path &filename) {
debugC(1, kDebugSound, "loadMusic(%s)", filename.toString().c_str());
Common::File f;
if (!f.open(filename))
error("Missing music file %s", filename.c_str());
error("Missing music file %s", filename.toString().c_str());
_fileNumb = f.readUint16LE();

View File

@ -55,7 +55,7 @@ private:
uint32 decode(const byte *src, byte *dst, uint32 len, uint32 start);
byte readByte(const byte *data, uint32 offset);
void loadMusic(Common::String filename);
void loadMusic(const Common::Path &filename);
void playMusic(int var1);
void send(uint32 b) override;