aboutsummaryrefslogtreecommitdiff
path: root/engines/lab/labfile.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2015-12-02 11:58:53 +0100
committerWillem Jan Palenstijn2015-12-23 21:33:47 +0100
commitab2519f57b50a8d92a7f6fa192f453e2cf0e6888 (patch)
tree952abcc8076bd3d62820560be6848cc51ce678dc /engines/lab/labfile.cpp
parent17d6e5e8608dfbf70fb08507da1ac196e04c0654 (diff)
downloadscummvm-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.cpp43
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