[Scummvm-cvs-logs] CVS: scummvm/sky control.cpp,1.39,1.40 control.h,1.19,1.20 logic.cpp,1.122,1.123 sky.cpp,1.89,1.90 sky.h,1.43,1.44 skydefs.h,1.23,1.24

Robert G?ffringmann lavosspawn at users.sourceforge.net
Fri Jul 11 20:41:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/sky
In directory sc8-pr-cvs1:/tmp/cvs-serv2949/sky

Modified Files:
	control.cpp control.h logic.cpp sky.cpp sky.h skydefs.h 
Log Message:
added support for different languages and fixed memory leak and screen refreshes in load/save dialogs

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- control.cpp	11 Jul 2003 22:19:16 -0000	1.39
+++ control.cpp	12 Jul 2003 03:40:44 -0000	1.40
@@ -818,7 +818,8 @@
 
 	uint8 *saveGameTexts = (uint8 *)malloc(MAX_SAVE_GAMES * MAX_TEXT_LEN);
 	dataFileHeader *textSprites[MAX_ON_SCREEN + 1];
-	textSprites[MAX_ON_SCREEN] = NULL;
+	for (cnt = 0; cnt < MAX_ON_SCREEN + 1; cnt++)
+		textSprites[cnt] = NULL;
 	_firstText = 0;
 	
 	loadDescriptions(saveGameTexts);
@@ -829,6 +830,7 @@
 	bool refreshAll = true;
 	uint16 clickRes = 0;
 	while (!quitPanel) {
+		clickRes = 0;
 		if (refreshNames || refreshAll) {
 			if (refreshAll) {
 				_text->flushForRedraw();
@@ -836,7 +838,11 @@
 				_quitButton->drawToScreen(NO_MASK);
 				if (withAutoSave)
 					_autoSaveButton->drawToScreen(NO_MASK);
+				refreshAll = false;
 			}
+			for (cnt = 0; cnt < MAX_ON_SCREEN; cnt++)
+				if (textSprites[cnt])
+					free(textSprites[cnt]);
 			setUpGameSprites(saveGameTexts, textSprites, _firstText, _selectedGame);
 			showSprites(textSprites, allowSave);
 			refreshNames = false;
@@ -1632,7 +1638,6 @@
 	_skyText->fnSetFont(0);
 	uint8 *textBuf1 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
 	uint8 *textBuf2 = (uint8 *)malloc(GAME_SCREEN_WIDTH * 14 + sizeof(dataFileHeader));
-	uint8 textNum;
 	uint8 *screenData;
 	if (useScreen) {
 		if (_skyScreen->sequenceRunning())
@@ -1641,15 +1646,8 @@
 		screenData = _skyScreen->giveCurrent();
 	} else
 		screenData = _screenBuf;
-	switch (SkyState::_systemVars.language) {
-		case DE_DEU: textNum = 1; break;
-		case FR_FRA: textNum = 2; break;
-		case IT_ITA: textNum = 4; break;
-		case PT_BRA: textNum = 5; break;
-		default: textNum = 0; break;
-	}
-	_skyText->displayText(_quitTexts[textNum * 2 + 0], textBuf1, true, 320, 255);
-	_skyText->displayText(_quitTexts[textNum * 2 + 1], textBuf2, true, 320, 255);
+	_skyText->displayText(_quitTexts[SkyState::_systemVars.language * 2 + 0], textBuf1, true, 320, 255);
+	_skyText->displayText(_quitTexts[SkyState::_systemVars.language * 2 + 1], textBuf2, true, 320, 255);
 	uint8 *curLine1 = textBuf1 + sizeof(dataFileHeader);
 	uint8 *curLine2 = textBuf2 + sizeof(dataFileHeader);
 	uint8 *targetLine = screenData + GAME_SCREEN_WIDTH * 80;
@@ -1671,19 +1669,23 @@
 	_system->quit();
 }
 
-char SkyControl::_quitTexts[12][30] = {
+char SkyControl::_quitTexts[16][35] = {
 	"Game over player one",
 	"BE VIGILANT",
 	"Das Spiel ist aus.",
 	"SEI WACHSAM",
 	"Game over joueur 1",
 	"SOYEZ VIGILANTS",
-	"Spelet r slut, Agent 1.",
+	"Game over player one",
+	"BE VIGILANT",
+	"SPELET \x8Er SLUT, Agent 1.",
 	"VAR VAKSAM",
 	"Game over giocatore 1",
 	"SIATE VIGILANTI",
 	"Fim de jogo para o jogador um",
 	"BE VIGILANT"
+	"Game over player one",
+	"BE VIGILANT",
 };
 
 uint8 SkyControl::_crossImg[594] = {

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/control.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- control.h	11 Jul 2003 22:19:16 -0000	1.19
+++ control.h	12 Jul 2003 03:40:44 -0000	1.20
@@ -285,7 +285,7 @@
 
 	SkyControlStatus *_statusBar;
 
-	static char _quitTexts[12][30];
+	static char _quitTexts[16][35];
 	static uint8 _crossImg[594];
 };
 

Index: logic.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/logic.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- logic.cpp	12 Jul 2003 01:12:00 -0000	1.122
+++ logic.cpp	12 Jul 2003 03:40:44 -0000	1.123
@@ -2438,11 +2438,10 @@
 
 	// if sky is configured to speech-only return now - except if we're running another
 	// language than english
-	if (speechUsed && (!(SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT)) &&
-		(SkyState::_systemVars.language == EN_USA)) {
-            target->extCompact->spTime = 10;
-			target->logic = L_TALK; 
-			return ;
+	if (speechUsed && (!(SkyState::_systemVars.systemFlags & SF_ALLOW_TEXT))) {
+		target->extCompact->spTime = 10;
+		target->logic = L_TALK; 
+		return ;
 	}
 
 	//now form the text sprite

Index: sky.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.cpp,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -d -r1.89 -r1.90
--- sky.cpp	12 Jul 2003 02:07:37 -0000	1.89
+++ sky.cpp	12 Jul 2003 03:40:44 -0000	1.90
@@ -87,7 +87,10 @@
 	
 	_debugMode = detector->_debugMode;
 	_debugLevel = detector->_debugLevel;
-	_systemVars.language = detector->_language;
+	if (detector->_language > 10)
+		_systemVars.language = SKY_USA;
+	else
+		_systemVars.language = _languageTable[detector->_language];
 	_detector = detector;
 
 	_floppyIntro = detector->_floppyIntro;
@@ -109,6 +112,20 @@
 void SkyState::errorString(const char *buf1, char *buf2) {
 	strcpy(buf2, buf1);
 }
+
+uint8 SkyState::_languageTable[11] = {
+	SKY_USA, // EN_USA
+	SKY_GERMAN, // DE_DEU
+	SKY_FRENCH, // FR_FRA
+	SKY_ITALIAN, // IT_ITA
+	SKY_PORTUGUESE, // PT_BRA
+	SKY_SPANISH, // ES_ESP
+	SKY_USA, // JA_JPN
+	SKY_USA, // ZH_TWN
+	SKY_USA, // KO_KOR
+	SKY_SWEDISH, // SE_SWE
+	SKY_ENGLISH  // EN_GRB
+};
 
 void SkyState::doCheat(uint8 num) {
 

Index: sky.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/sky.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- sky.h	12 Jul 2003 02:07:37 -0000	1.43
+++ sky.h	12 Jul 2003 03:40:44 -0000	1.44
@@ -61,6 +61,7 @@
 protected:
 	byte _game;
 	byte _key_pressed;
+	static uint8 _languageTable[11];
 
 	//intro related
 	

Index: skydefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sky/skydefs.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- skydefs.h	12 Jul 2003 01:12:00 -0000	1.23
+++ skydefs.h	12 Jul 2003 03:40:44 -0000	1.24
@@ -26,6 +26,15 @@
 
 //This file is incomplete, several flags still missing.
 
+#define SKY_ENGLISH		0
+#define SKY_GERMAN		1
+#define SKY_FRENCH		2
+#define SKY_USA			3
+#define SKY_SWEDISH		4
+#define SKY_ITALIAN		5
+#define SKY_PORTUGUESE	6
+#define SKY_SPANISH		7
+
 #define ST_COLLISION_BIT	5
 
 #define S_COUNT	0





More information about the Scummvm-git-logs mailing list