[Scummvm-cvs-logs] SF.net SVN: scummvm: [24595] scummvm/trunk/engines/queen

cyx at users.sourceforge.net cyx at users.sourceforge.net
Fri Nov 3 23:36:21 CET 2006


Revision: 24595
          http://svn.sourceforge.net/scummvm/?rev=24595&view=rev
Author:   cyx
Date:     2006-11-03 14:36:05 -0800 (Fri, 03 Nov 2006)

Log Message:
-----------
cleanup (got rid of the custom Language enum, re-used the one in the Common namespace)

Modified Paths:
--------------
    scummvm/trunk/engines/queen/command.cpp
    scummvm/trunk/engines/queen/defs.h
    scummvm/trunk/engines/queen/display.cpp
    scummvm/trunk/engines/queen/graphics.cpp
    scummvm/trunk/engines/queen/input.cpp
    scummvm/trunk/engines/queen/input.h
    scummvm/trunk/engines/queen/journal.cpp
    scummvm/trunk/engines/queen/logic.cpp
    scummvm/trunk/engines/queen/queen.cpp
    scummvm/trunk/engines/queen/queen.h
    scummvm/trunk/engines/queen/resource.cpp
    scummvm/trunk/engines/queen/resource.h
    scummvm/trunk/engines/queen/talk.cpp

Modified: scummvm/trunk/engines/queen/command.cpp
===================================================================
--- scummvm/trunk/engines/queen/command.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/command.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -124,7 +124,7 @@
 
 Command::Command(QueenEngine *vm)
 	: _cmdList(NULL), _cmdArea(NULL), _cmdObject(NULL), _cmdInventory(NULL), _cmdGameState(NULL),
-	_cmdText((vm->resource()->getLanguage() == HEBREW), CmdText::COMMAND_Y_POS, vm), _vm(vm) {
+	_cmdText((vm->resource()->getLanguage() == Common::HB_ISR), CmdText::COMMAND_Y_POS, vm), _vm(vm) {
 }
 
 Command::~Command() {

Modified: scummvm/trunk/engines/queen/defs.h
===================================================================
--- scummvm/trunk/engines/queen/defs.h	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/defs.h	2006-11-03 22:36:05 UTC (rev 24595)
@@ -41,13 +41,11 @@
 	PANEL_ZONE_HEIGHT  =  50
 };
 
-
 enum {
 	FRAMES_JOE      = 38,
 	FRAMES_JOURNAL  = 40
 };
 
-
 enum Direction {
 	DIR_LEFT  = 1,
 	DIR_RIGHT = 2,
@@ -55,7 +53,6 @@
 	DIR_BACK  = 4
 };
 
-
 enum {
 	INK_BG_PANEL      = 226,
 	INK_JOURNAL       = 248,
@@ -68,7 +65,6 @@
 	INK_OUTLINED_TEXT = 16
 };
 
-
 enum {
 	ITEM_NONE                     =  0,
 	ITEM_BAT,
@@ -252,7 +248,6 @@
 	ROOM_JOURNAL              = 200 // dummy value to keep Display methods happy
 };
 
-
 //! GameState vars
 enum {
 	VAR_HOTEL_ITEMS_REMOVED       =   3,
@@ -265,18 +260,6 @@
 	VAR_AZURA_IN_LOVE             = 167
 };
 
-
-enum Language {
-	ENGLISH  = 'E',
-	FRENCH   = 'F',
-	GERMAN   = 'G',
-	HEBREW   = 'H',
-	ITALIAN  = 'I',
-	SPANISH  = 'S',
-	RUSSIAN  = 'R'
-};
-
-
 enum Verb {
 	VERB_NONE = 0,
 
@@ -317,7 +300,6 @@
 	VERB_PREP_TO   = 12
 };
 
-
 } // End of namespace Queen
 
 #endif

Modified: scummvm/trunk/engines/queen/display.cpp
===================================================================
--- scummvm/trunk/engines/queen/display.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/display.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -45,9 +45,9 @@
 	: _fullscreen(true), _horizontalScroll(0), _bdWidth(0), _bdHeight(0),
 	_system(system), _vm(vm) {
 
-	if (vm->resource()->getLanguage() == HEBREW)
+	if (vm->resource()->getLanguage() == Common::HB_ISR)
 		_font = _fontHebrew;
-	else if (vm->resource()->getLanguage() == RUSSIAN)
+	else if (vm->resource()->getLanguage() == Common::RU_RUS)
 		_font = _fontRussian;
 	else
 		_font = _fontRegular;

Modified: scummvm/trunk/engines/queen/graphics.cpp
===================================================================
--- scummvm/trunk/engines/queen/graphics.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/graphics.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -469,7 +469,7 @@
 
 	// Hebrew strings are written from right to left and should be cut
 	// to lines in reverse
-	if (_vm->resource()->getLanguage() == HEBREW) {
+	if (_vm->resource()->getLanguage() == Common::HB_ISR) {
 		for (i = length - 1; i >= 0; i--) {
 			lineLength++;
 

Modified: scummvm/trunk/engines/queen/input.cpp
===================================================================
--- scummvm/trunk/engines/queen/input.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/input.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -27,7 +27,7 @@
 
 namespace Queen {
 
-const char *Input::_commandKeys[LANGUAGE_COUNT] = {
+const char *Input::_commandKeys[] = {
 	"ocmglptu", // English
 	"osbgpnre", // German
 	"ofdnepau", // French
@@ -36,7 +36,7 @@
 	"acodmthu"  // Spanish
 };
 
-const Verb Input::_verbKeys[8] = {
+const Verb Input::_verbKeys[] = {
 	VERB_OPEN,
 	VERB_CLOSE,
 	VERB_MOVE,
@@ -47,7 +47,7 @@
 	VERB_USE
 };
 
-Input::Input(Language language, OSystem *system) :
+Input::Input(Common::Language language, OSystem *system) :
 	_system(system), _fastMode(false), _keyVerb(VERB_NONE),
 	_cutawayRunning(false), _canQuit(false), _cutawayQuit(false),
 	_dialogueRunning(false), _talkQuit(false), _quickSave(false),
@@ -55,23 +55,23 @@
 	_mouse_y(0), _mouseButton(0), _idleTime(0) {
 
 	switch (language) {
-	case ENGLISH:
-	case RUSSIAN:
+	case Common::EN_ANY:
+	case Common::RU_RUS:
 		_currentCommandKeys = _commandKeys[0];
 		break;
-	case GERMAN:
+	case Common::DE_DEU:
 		_currentCommandKeys = _commandKeys[1];
 		break;
-	case FRENCH:
+	case Common::FR_FRA:
 		_currentCommandKeys = _commandKeys[2];
 		break;
-	case ITALIAN:
+	case Common::IT_ITA:
 		_currentCommandKeys = _commandKeys[3];
 		break;
-	case HEBREW:
+	case Common::HB_ISR:
 		_currentCommandKeys = _commandKeys[4];
 		break;
-	case SPANISH:
+	case Common::ES_ESP:
 		_currentCommandKeys = _commandKeys[5];
 		break;
 	default:

Modified: scummvm/trunk/engines/queen/input.h
===================================================================
--- scummvm/trunk/engines/queen/input.h	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/input.h	2006-11-03 22:36:05 UTC (rev 24595)
@@ -44,7 +44,7 @@
 		MOUSE_RBUTTON = 2
 	};
 
-	Input(Language language, OSystem *system);
+	Input(Common::Language language, OSystem *system);
 
 	//! calls the other delay() with a value adjusted depending on _fastMode
 	void delay();
@@ -114,10 +114,6 @@
 		KEY_F12
 	};
 
-	enum {
-		LANGUAGE_COUNT = 6
-	};
-
 	//! used to get keyboard and mouse events
 	OSystem *_system;
 
@@ -167,10 +163,10 @@
 	const char *_currentCommandKeys;
 
 	//! command keys for all languages
-	static const char *_commandKeys[LANGUAGE_COUNT];
+	static const char *_commandKeys[];
 
 	//! verbs matching the command keys
-	static const Verb _verbKeys[8];
+	static const Verb _verbKeys[];
 };
 
 } // End of namespace Queen

Modified: scummvm/trunk/engines/queen/journal.cpp
===================================================================
--- scummvm/trunk/engines/queen/journal.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/journal.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -387,7 +387,7 @@
 		_panelTextY[_panelTextCount++] = y;
 	} else {
 		*p++ = '\0';
-		if (_vm->resource()->getLanguage() == HEBREW) {
+		if (_vm->resource()->getLanguage() == Common::HB_ISR) {
 			drawPanelText(y - 5, p);
 			drawPanelText(y + 5, s);
 		} else {

Modified: scummvm/trunk/engines/queen/logic.cpp
===================================================================
--- scummvm/trunk/engines/queen/logic.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/logic.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -206,7 +206,7 @@
 	}
 
 	// Patch for German text bug
-	if (_vm->resource()->getLanguage() == GERMAN) {
+	if (_vm->resource()->getLanguage() == Common::DE_DEU) {
 		_objDescription[296] = "Es bringt nicht viel, das festzubinden.";
 	}
 
@@ -233,7 +233,7 @@
 	// Spanish version adds some space characters (0x20) at the beginning
 	// and the end of the journal button captions. As the engine computes
 	// the text width to center it, we need to trim those strings.
-	if (_vm->resource()->getLanguage() == SPANISH) {
+	if (_vm->resource()->getLanguage() == Common::ES_ESP) {
 		for (i = 30; i <= 35; i++) {
 			_joeResponse[i] = trim(_joeResponse[i]);
 		}
@@ -1232,7 +1232,7 @@
 
 	_entryObj = 0;
 	uint16 prevObj = 0;
-	CmdText cmdText((_vm->resource()->getLanguage() == HEBREW), 5, _vm);
+	CmdText cmdText((_vm->resource()->getLanguage() == Common::HB_ISR), 5, _vm);
 	cmdText.setVerb(VERB_WALK_TO);
 	while (_vm->input()->mouseButton() == 0 || _entryObj == 0) {
 

Modified: scummvm/trunk/engines/queen/queen.cpp
===================================================================
--- scummvm/trunk/engines/queen/queen.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/queen.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -68,8 +68,9 @@
 	return GameDescriptor();
 }
 
-
-GameDescriptor determineTarget(uint32 size) {
+// FIXME/TODO: it would be nice to re-use the existing code of the
+// Resource class to detect the FOTAQ version.
+static GameDescriptor determineTarget(uint32 size) {
 	switch (size) {
 	case 3724538:	//regular demo
 	case 3732177:
@@ -260,14 +261,14 @@
 		assert(dataSize < SAVESTATE_MAX_SIZE);
 
 		// write header
-		GameStateHeader header;
-		memset(&header, 0, sizeof(header));
 		file->writeUint32BE('SCVM');
-		header.version = TO_BE_32(SAVESTATE_CUR_VER);
-		header.flags = TO_BE_32(0);
-		header.dataSize = TO_BE_32(dataSize);
-		strncpy(header.description, desc, sizeof(header.description) - 1);
-		file->write(&header, sizeof(header));
+		file->writeUint32BE(SAVESTATE_CUR_VER);
+		file->writeUint32BE(0);
+		file->writeUint32BE(dataSize);
+		char description[32];
+		memset(description, 0, 32);
+		strncpy(description, desc, 31);
+		file->write(description, 32);
 
 		// write save data
 		file->write(saveData, dataSize);

Modified: scummvm/trunk/engines/queen/queen.h
===================================================================
--- scummvm/trunk/engines/queen/queen.h	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/queen.h	2006-11-03 22:36:05 UTC (rev 24595)
@@ -49,8 +49,6 @@
 
 namespace Queen {
 
-#include "common/pack-start.h"	// START STRUCT PACKING
-
 struct GameStateHeader {
 	uint32 version;
 	uint32 flags;
@@ -58,8 +56,6 @@
 	char description[32];
 };
 
-#include "common/pack-end.h"	// END STRUCT PACKING
-
 class BamScene;
 class BankManager;
 class Command;

Modified: scummvm/trunk/engines/queen/resource.cpp
===================================================================
--- scummvm/trunk/engines/queen/resource.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/resource.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -172,24 +172,25 @@
 		error("Verifying game version failed! (expected: '%s', found: '%s')", _versionString, versionStr);
 }
 
-Language Resource::getLanguage() const {
+Common::Language Resource::getLanguage() const {
 	switch (_versionString[1]) {
 	case 'E':
 		if (Common::parseLanguage(ConfMan.get("language")) == Common::RU_RUS)
-			return RUSSIAN;
-		return ENGLISH;
+			return Common::RU_RUS;
+		return Common::EN_ANY;
 	case 'G':
-		return GERMAN;
+		return Common::DE_DEU;
 	case 'F':
-		return FRENCH;
+		return Common::FR_FRA;
 	case 'I':
-		return ITALIAN;
+		return Common::IT_ITA;
 	case 'S':
-		return SPANISH;
+		return Common::ES_ESP;
 	case 'H':
-		return HEBREW;
+		return Common::HB_ISR;
 	default:
-		return ENGLISH;
+		warning("Unknown language id '%c', defaulting to English", _versionString[1]);
+		return Common::EN_ANY;
 	}
 }
 
@@ -211,8 +212,7 @@
 		error("Invalid table header");
 
 	_resourceFile->read(_versionString, 6);
-	_resourceFile->readByte(); // obsolete
-	_resourceFile->readByte(); // obsolete
+	_resourceFile->skip(2); // obsolete
 	_compression = _resourceFile->readByte();
 
 	readTableEntries(_resourceFile);

Modified: scummvm/trunk/engines/queen/resource.h
===================================================================
--- scummvm/trunk/engines/queen/resource.h	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/resource.h	2006-11-03 22:36:05 UTC (rev 24595)
@@ -83,7 +83,7 @@
 	const char *JASVersion() const { return _versionString; }
 
 	//! returns language of the game
-	Language getLanguage() const;
+	Common::Language getLanguage() const;
 
 	enum Version {
 		VER_ENG_FLOPPY   = 0,

Modified: scummvm/trunk/engines/queen/talk.cpp
===================================================================
--- scummvm/trunk/engines/queen/talk.cpp	2006-11-03 21:54:08 UTC (rev 24594)
+++ scummvm/trunk/engines/queen/talk.cpp	2006-11-03 22:36:05 UTC (rev 24595)
@@ -348,15 +348,15 @@
 byte *Talk::loadDialogFile(const char *filename) {
 	static const struct {
 		const char *filename;
-		Language lang;
+		Common::Language language;
 	} dogFiles[] = {
-		{ "chief1.dog", FRENCH  },
-		{ "chief2.dog", FRENCH  },
-		{ "bud1.dog",   ITALIAN }
+		{ "chief1.dog", Common::FR_FRA },
+		{ "chief2.dog", Common::FR_FRA },
+		{ "bud1.dog",   Common::IT_ITA }
 	};
 	for (int i = 0; i < ARRAYSIZE(dogFiles); ++i) {
 		if (!scumm_stricmp(filename, dogFiles[i].filename) &&
-			_vm->resource()->getLanguage() == dogFiles[i].lang) {
+			_vm->resource()->getLanguage() == dogFiles[i].language) {
 			Common::File fdog;
 			fdog.open(filename);
 			if (fdog.isOpen()) {
@@ -798,7 +798,7 @@
 
 	// French talkie version has a useless voice file ;	c30e_102 file is the same as c30e_101,
 	// so there is no need to play it. This voice was used in room 30 (N8) when talking to Klunk.
-	if (!(_vm->resource()->getLanguage() == FRENCH && !strcmp(voiceFileName, "c30e_102"))
+	if (!(_vm->resource()->getLanguage() == Common::FR_FRA && !strcmp(voiceFileName, "c30e_102"))
 		&& _vm->sound()->speechOn())
 		_vm->sound()->playSfx(voiceFileName, true);
 
@@ -1076,10 +1076,10 @@
 	}
 	int lines;
 	memset(optionText, 0, 5 * MAX_STRING_SIZE);
-	if (_vm->resource()->getLanguage() == ENGLISH || _vm->display()->textWidth(option) <= MAX_TEXT_WIDTH) {
+	if (_vm->resource()->getLanguage() == Common::EN_ANY || _vm->display()->textWidth(option) <= MAX_TEXT_WIDTH) {
 		strcpy(optionText[0], option);
 		lines = 1;
-	} else if (_vm->resource()->getLanguage() == HEBREW) {
+	} else if (_vm->resource()->getLanguage() == Common::HB_ISR) {
 		lines = splitOptionHebrew(option, optionText);
 	} else {
 		lines = splitOptionDefault(option, optionText);
@@ -1196,7 +1196,7 @@
 
 		_vm->grid()->clear(GS_PANEL);
 
-		if (_vm->resource()->getLanguage() != ENGLISH) {
+		if (_vm->resource()->getLanguage() != Common::EN_ANY) {
 			_vm->grid()->setZone(GS_PANEL, ARROW_ZONE_UP,   MAX_TEXT_WIDTH + 1, 0,  319, 24);
 			_vm->grid()->setZone(GS_PANEL, ARROW_ZONE_DOWN, MAX_TEXT_WIDTH + 1, 25, 319, 49);
 		}
@@ -1219,7 +1219,7 @@
 							i,
 							0,
 							yOffset * LINE_HEIGHT - PUSHUP,
-							(_vm->resource()->getLanguage() == ENGLISH) ? 319 : MAX_TEXT_WIDTH,
+							(_vm->resource()->getLanguage() == Common::EN_ANY) ? 319 : MAX_TEXT_WIDTH,
 							(yOffset + optionLines) * LINE_HEIGHT - PUSHUP);
 				}
 
@@ -1242,7 +1242,7 @@
 
 		// Up and down dialogue arrows
 
-		if (_vm->resource()->getLanguage() != ENGLISH) {
+		if (_vm->resource()->getLanguage() != Common::EN_ANY) {
 			arrowBobUp->active    = (startOption > 1);
 			arrowBobDown->active  = (yOffset > 4);
 		}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list