aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cruise/cruise.cpp30
-rw-r--r--engines/cruise/cruise.h8
-rw-r--r--engines/cruise/cruise_main.cpp17
-rw-r--r--engines/cruise/font.cpp6
-rw-r--r--engines/cruise/font.h2
-rw-r--r--engines/cruise/menu.cpp14
-rw-r--r--engines/cruise/staticres.cpp18
-rw-r--r--engines/cruise/staticres.h6
8 files changed, 56 insertions, 45 deletions
diff --git a/engines/cruise/cruise.cpp b/engines/cruise/cruise.cpp
index 71ab343daa..53dc5bd031 100644
--- a/engines/cruise/cruise.cpp
+++ b/engines/cruise/cruise.cpp
@@ -75,6 +75,9 @@ Common::Error CruiseEngine::init() {
// Initialize backend
initGraphics(320, 200, false);
+ if (!loadLanguageStrings())
+ return Common::kUnknownError;
+
initialize();
return Common::kNoError;
@@ -109,4 +112,31 @@ void CruiseEngine::initialize() {
}
+bool CruiseEngine::loadLanguageStrings() {
+ Common::File f;
+
+ if (!f.open("DELPHINE.LNG"))
+ return false;
+
+ char *data = (char *)malloc(f.size());
+ f.read(data, f.size());
+ char *ptr = data;
+
+ for (int i = 0; i < MAX_LANGUAGE_STRINGS; ++i) {
+ // Get the start of the next string
+ while (*ptr != '"') ++ptr;
+ const char *v = ++ptr;
+
+ // Find the end of the string, and replace the end '"' with a NULL
+ while (*ptr != '"') ++ptr;
+ *ptr++ = '\0';
+
+ // Add the string to the list
+ _langStrings.push_back(v);
+ }
+
+ f.close();
+ return true;
+}
+
} // End of namespace Cruise
diff --git a/engines/cruise/cruise.h b/engines/cruise/cruise.h
index 0ed3e57d1b..2345e60f67 100644
--- a/engines/cruise/cruise.h
+++ b/engines/cruise/cruise.h
@@ -40,16 +40,23 @@ enum CruiseGameType {
GType_CRUISE = 1
};
+#define MAX_LANGUAGE_STRINGS 25
+
+enum LangStringId { ID_PAUSED = 0, ID_INVENTORY = 5, ID_PLAYER_MENU = 7,
+ ID_SAVE = 9, ID_LOAD = 10, ID_RESTART = 11, ID_QUIT = 12};
+
struct CRUISEGameDescription;
class CruiseEngine: public Engine {
private:
void initialize(void);
+ bool loadLanguageStrings();
bool makeLoad(char *saveName);
void mainLoop(int bootScriptIdx);
bool _preLoad;
Debugger *_debugger;
+ Common::StringList _langStrings;
protected:
// Engine APIs
@@ -69,6 +76,7 @@ public:
Common::Language getLanguage() const;
Common::Platform getPlatform() const;
virtual GUI::Debugger *getDebugger() { return _debugger; }
+ const char *langString(LangStringId langId) { return _langStrings[(int)langId].c_str(); }
bool loadSaveDirectory(void);
void makeSystemMenu(void);
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index 7e6d602079..f44eef6413 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -58,21 +58,16 @@ void resetRaster(uint8 *rasterPtr, int32 rasterSize) {
memset(rasterPtr, 0, rasterSize);
}
-void drawInfoStringSmallBlackBox(uint8 *string) {
- //uint8 buffer[256];
-
+void drawInfoStringSmallBlackBox(const char *s) {
gfxModuleData_field_90();
gfxModuleData_gfxWaitVSync();
drawBlackSolidBoxSmall();
- drawString(10, 100, string, gfxModuleData.pPage10, titleColor, 300);
+ drawString(10, 100, (const uint8 *)s, gfxModuleData.pPage10, titleColor, 300);
gfxModuleData_flip();
flipScreen();
-
- while (1)
- ;
}
void loadPakedFileToMem(int fileIdx, uint8 *buffer) {
@@ -751,8 +746,7 @@ void *allocAndZero(int size) {
void buildInventory(int X, int Y) {
menuStruct *pMenu;
- const char **sl = getStringList();
- pMenu = createMenu(X, Y, sl[SL_INVENTORY]);
+ pMenu = createMenu(X, Y, _vm->langString(ID_INVENTORY));
menuTable[1] = pMenu;
if (pMenu == NULL)
@@ -1336,6 +1330,11 @@ int processInput(void) {
if (keyboardCode == Common::KEYCODE_x)
return 1;
+ // Check for Pause 'P' key
+ if (keyboardCode == Common::KEYCODE_p) {
+ drawInfoStringSmallBlackBox(_vm->langString(ID_PAUSED));
+ }
+
if (!userEnabled) {
return 0;
}
diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index b055433da0..40f8b8bb1f 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -262,7 +262,7 @@ void renderWord(uint8 * fontPtr_Data, uint8 * outBufferPtr,
// returns character count and pixel size (via pointer) per line of the string (old: prepareWordRender(int32 param, int32 var1, int16* out2, uint8* ptr3, uint8* string))
int32 prepareWordRender(int32 inRightBorder_X, int32 wordSpacingWidth,
- int16 * strPixelLength, uint8 * ptr3, const uint8 * textString) {
+ int16 * strPixelLength, uint8 * ptr3, const uint8 *textString) {
const uint8 *localString = textString;
int32 counter = 0;
@@ -315,7 +315,7 @@ int32 prepareWordRender(int32 inRightBorder_X, int32 wordSpacingWidth,
return counter;
}
-void drawString(int32 x, int32 y, uint8 *string, uint8 *buffer, uint8 color,
+void drawString(int32 x, int32 y, const uint8 *string, uint8 *buffer, uint8 color,
int32 inRightBorder_X) {
uint8 *fontPtr;
uint8 *fontPtr_Data; // ptr2
@@ -414,7 +414,7 @@ void drawString(int32 x, int32 y, uint8 *string, uint8 *buffer, uint8 color,
int spacesCount = 0; // si
char character = *(string);
short int strPixelLength; // var_16;
- uint8 *ptrStringEnd; // var_4 //ok
+ const uint8 *ptrStringEnd; // var_4 //ok
int drawPosPixel_X; // di
while (character == ' ') {
diff --git a/engines/cruise/font.h b/engines/cruise/font.h
index 4f210a5d89..2263b1806c 100644
--- a/engines/cruise/font.h
+++ b/engines/cruise/font.h
@@ -45,7 +45,7 @@ void renderWord(uint8 * fontPtr_Data, uint8 * outBufferPtr,
int32 drawPosPixel_X, int32 heightOff, int32 height, int32 param4,
int32 stringRenderBufferSize, int32 width, int32 charWidth);
gfxEntryStruct *renderText(int inRightBorder_X, const uint8 *string);
-void drawString(int32 x, int32 y, uint8 * string, uint8 * buffer, uint8 color,
+void drawString(int32 x, int32 y, const uint8 * string, uint8 * buffer, uint8 color,
int32 inRightBorder_X);
} // End of namespace Cruise
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index af1b1827d2..42a69b71da 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "cruise/cruise.h"
#include "cruise/cruise_main.h"
#include "cruise/staticres.h"
@@ -236,19 +237,16 @@ int playerMenu(int menuX, int menuY) {
linkedRelation = 0; */
freeDisk();
- // Get the correct string set to use
- const char **sl = getStringList();
-
- menuTable[0] = createMenu(menuX, menuY, sl[SL_MENU]);
+ menuTable[0] = createMenu(menuX, menuY, _vm->langString(ID_PLAYER_MENU));
ASSERT(menuTable[0]);
//addSelectableMenuEntry(0, 3, menuTable[0], 1, -1, "Save game disk");
if (userEnabled) {
- addSelectableMenuEntry(0, 4, menuTable[0], 1, -1, sl[SL_SAVE]);
+ addSelectableMenuEntry(0, 4, menuTable[0], 1, -1, _vm->langString(ID_SAVE));
}
- addSelectableMenuEntry(0, 5, menuTable[0], 1, -1, sl[SL_LOAD]);
- addSelectableMenuEntry(0, 6, menuTable[0], 1, -1, sl[SL_RESTART]);
- addSelectableMenuEntry(0, 7, menuTable[0], 1, -1, sl[SL_QUIT]);
+ addSelectableMenuEntry(0, 5, menuTable[0], 1, -1, _vm->langString(ID_LOAD));
+ addSelectableMenuEntry(0, 6, menuTable[0], 1, -1, _vm->langString(ID_RESTART));
+ addSelectableMenuEntry(0, 7, menuTable[0], 1, -1, _vm->langString(ID_QUIT));
retourMenu = processMenu(menuTable[0]);
diff --git a/engines/cruise/staticres.cpp b/engines/cruise/staticres.cpp
index b3174414f3..769eec2590 100644
--- a/engines/cruise/staticres.cpp
+++ b/engines/cruise/staticres.cpp
@@ -29,22 +29,4 @@
namespace Cruise {
-const char *english_strings[] = {
- "Player Menu", "Save", "Load", "Start again", "Quit", "Inventory"
-};
-const char *french_strings[] = {
- "Menu Joueur", "Sauvegarde", "Chargement", "Recommencer le jeu", "Quitter", "Inventaire"
-};
-
-const char **getStringList() {
- switch (_vm->getLanguage()) {
- case Common::EN_ANY:
- return english_strings;
- case Common::FR_FRA:
- return french_strings;
- default:
- error("Unknown language encountered");
- }
-}
-
} // End of namespace Cruise
diff --git a/engines/cruise/staticres.h b/engines/cruise/staticres.h
index d11a57e161..6b358464d5 100644
--- a/engines/cruise/staticres.h
+++ b/engines/cruise/staticres.h
@@ -28,12 +28,6 @@
namespace Cruise {
-enum MenuConstants {
- SL_MENU, SL_SAVE, SL_LOAD, SL_RESTART, SL_QUIT, SL_INVENTORY
-};
-
-const char **getStringList();
-
} // End of namespace Cruise
#endif