diff options
author | Eugene Sandulenko | 2015-12-02 11:58:53 +0100 |
---|---|---|
committer | Willem Jan Palenstijn | 2015-12-23 21:33:47 +0100 |
commit | ab2519f57b50a8d92a7f6fa192f453e2cf0e6888 (patch) | |
tree | 952abcc8076bd3d62820560be6848cc51ce678dc /engines/lab/labfile.cpp | |
parent | 17d6e5e8608dfbf70fb08507da1ac196e04c0654 (diff) | |
download | scummvm-rg350-ab2519f57b50a8d92a7f6fa192f453e2cf0e6888.tar.gz scummvm-rg350-ab2519f57b50a8d92a7f6fa192f453e2cf0e6888.tar.bz2 scummvm-rg350-ab2519f57b50a8d92a7f6fa192f453e2cf0e6888.zip |
LAB: Get rid of machine.cpp
Diffstat (limited to 'engines/lab/labfile.cpp')
-rw-r--r-- | engines/lab/labfile.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/engines/lab/labfile.cpp b/engines/lab/labfile.cpp index 83f3b0f2e9..99a02c14ff 100644 --- a/engines/lab/labfile.cpp +++ b/engines/lab/labfile.cpp @@ -28,6 +28,7 @@ * */ +#include "lab/lab.h" #include "lab/labfun.h" #include "lab/mouse.h" #include "common/file.h" @@ -309,4 +310,46 @@ void freeAllStolenMem() { _memPlace = buffer; } +static char NewFileName[255]; + +/*****************************************************************************/ +/* Modifies the filename so that paths and stuff are correct. Should mostly */ +/* deal with assigns and the '/' instead of '\' on IBM systems. */ +/* */ +/* NOTE: Make a *copy* of the string, and modify that. It would be a real */ +/* *bad* idea to modify the original. Since Labyrinth only focuses its */ +/* attention to one file at a time, it would be fine to have one variable */ +/* not on the stack which is used to store the new filename. */ +/*****************************************************************************/ +char *translateFileName(const char *filename) { + Common::String fileNameStr = filename; + fileNameStr.toUppercase(); + Common::String fileNameStrFinal; + + if (fileNameStr.hasPrefix("P:")) { + if (g_lab->_isHiRes) + fileNameStrFinal = "GAME/SPICT/"; + else + fileNameStrFinal = "GAME/PICT/"; + } else if (fileNameStr.hasPrefix("LAB:")) + fileNameStrFinal = "GAME/"; + else if (fileNameStr.hasPrefix("MUSIC:")) + fileNameStrFinal = "GAME/MUSIC/"; + + if (fileNameStr.contains(':')) { + while (fileNameStr[0] != ':') { + fileNameStr.deleteChar(0); + } + + fileNameStr.deleteChar(0); + } + + fileNameStrFinal += fileNameStr; + + strcpy(NewFileName, fileNameStrFinal.c_str()); + + return NewFileName; +} + + } // End of namespace Lab |