[Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.10,1.11 control.h,1.3,1.4 resman.cpp,1.9,1.10 swordres.h,1.2,1.3

Robert G?ffringmann lavosspawn at users.sourceforge.net
Mon Dec 29 07:39:02 CET 2003


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1:/tmp/cvs-serv11613/sword1

Modified Files:
	control.cpp control.h resman.cpp swordres.h 
Log Message:
made control panel use the correct fonts

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- control.cpp	28 Dec 2003 23:24:02 -0000	1.10
+++ control.cpp	29 Dec 2003 15:38:16 -0000	1.11
@@ -89,7 +89,8 @@
 enum TextModes {
 	TEXT_LEFT_ALIGN = 0,
 	TEXT_CENTER,
-	TEXT_RIGHT_ALIGN
+	TEXT_RIGHT_ALIGN,
+	TEXT_RED_FONT = 128
 };
 
 ControlButton::ControlButton(uint16 x, uint16 y, uint32 resId, uint8 id, ResMan *pResMan, uint8 *screenBuf, OSystem *system) {
@@ -159,7 +160,8 @@
 	_lStrings = _languageStrings + MIN(SwordEngine::_systemVars.language, (uint8)BS1_SPANISH) * 20;
 	_keyPressed = _numButtons = 0;
 	_screenBuf = (uint8*)malloc(640 * 480);
-	_font = (uint8*)_resMan->openFetchRes(GAME_FONT); // todo: czech support
+	_font = (uint8*)_resMan->openFetchRes(SR_FONT); // todo: czech support
+	_redFont = (uint8*)_resMan->openFetchRes(SR_REDFONT);
 	uint8 *pal = (uint8*)_resMan->openFetchRes(SR_PALETTE);
 	uint8 *palOut = (uint8*)malloc(256 * 4);
 	for (uint16 cnt = 1; cnt < 256; cnt++) {
@@ -214,6 +216,8 @@
 		newMode = getClicks(mode, &retVal);
 	} while ((newMode != 1) && (retVal == 0));
 	destroyButtons();
+	_resMan->resClose(SR_FONT);
+	_resMan->resClose(SR_REDFONT);
 	memset(_screenBuf, 0, 640 * 480);
 	_system->copy_rect(_screenBuf, 640, 0, 0, 640, 480);
 	free(_screenBuf);
@@ -461,7 +465,13 @@
 void SwordControl::showSavegameNames(void) {
 	for (uint8 cnt = 0; cnt < 8; cnt++) {
 		_buttons[cnt]->draw();
-		renderText(_saveNames[cnt + _saveScrollPos], _saveButtons[cnt].x + 6, _saveButtons[cnt].y + 2, TEXT_LEFT_ALIGN);
+		uint8 textMode = TEXT_LEFT_ALIGN;
+		uint16 ycoord = _saveButtons[cnt].y + 2;
+		if (cnt + _saveScrollPos == _selectedSavegame) {
+			textMode |= TEXT_RED_FONT;
+			ycoord += 2;
+		}
+		renderText(_saveNames[cnt + _saveScrollPos], _saveButtons[cnt].x + 6, ycoord, textMode);
 	}
 }
 
@@ -539,6 +549,11 @@
 }
 
 void SwordControl::renderText(const char *str, uint16 x, uint16 y, uint8 mode) {
+	uint8 *font = _font;
+	if (mode & TEXT_RED_FONT)
+		font = _redFont;
+	mode &= ~TEXT_RED_FONT;
+	
 	if (mode == TEXT_RIGHT_ALIGN) // negative x coordinate means right-aligned.
 		x -= getTextWidth(str);
 	else if (mode == TEXT_CENTER)
@@ -548,7 +563,7 @@
 	while (*str) {
 		uint8 *dst = _screenBuf + y * SCREEN_WIDTH + destX;
 
-		FrameHeader *chSpr = _resMan->fetchFrame(_font, ((uint8)*str) - 32);
+		FrameHeader *chSpr = _resMan->fetchFrame(font, ((uint8)*str) - 32);
 		uint8 *sprData = (uint8*)chSpr + sizeof(FrameHeader);
 		for (uint16 cnty = 0; cnty < FROM_LE_16(chSpr->height); cnty++) {
 			for (uint16 cntx = 0; cntx < FROM_LE_16(chSpr->width); cntx++) {

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- control.h	28 Dec 2003 23:24:02 -0000	1.3
+++ control.h	29 Dec 2003 15:38:16 -0000	1.4
@@ -115,8 +115,7 @@
 	SwordMouse *_mouse;
 	SwordMusic *_music;
 	char _savePath[256];
-	uint8 *_font;
-	uint32 _fontId;
+	uint8 *_font, *_redFont;
 	uint8 *_screenBuf;
 	uint8 _keyPressed;
 	void delay(uint32 msecs);

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/resman.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- resman.cpp	28 Dec 2003 19:03:35 -0000	1.9
+++ resman.cpp	29 Dec 2003 15:38:16 -0000	1.10
@@ -325,9 +325,9 @@
 }
 
 uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array
-	0,
+	OTHER_SR_FONT,
 	0x04050000,
-	0,
+	OTHER_SR_REDFONT,
 	0x04050001,
 	0x04050002,
 	0x04050003,

Index: swordres.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/swordres.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- swordres.h	20 Dec 2003 09:12:54 -0000	1.2
+++ swordres.h	29 Dec 2003 15:38:16 -0000	1.3
@@ -761,8 +761,8 @@
 // general
 	// fonts
 #define GAME_FONT 				 0x04000000
-#define SR_FONT 				 0x04000001
-#define SR_REDFONT 				 0x04000002
+#define OTHER_SR_FONT 			 0x04000001
+#define OTHER_SR_REDFONT 		 0x04000002
 #define SR_DEATHFONT 			 0x04000003
 #define CZECH_GAME_FONT 		 0x04000004
 #define CZECH_SR_FONT 			 0x04000005
@@ -996,9 +996,9 @@
 #define ICON_YES 				 0x0404005D
 	// 94 entities in TXTs, 94 in datafiles.
 	// save_menu
-#define SR_UNKNOWN_RESOURCE1	 0x04050000
+#define SR_FONT					 0x04050000
 #define SR_BUTTON				 0x04050001
-#define SR_UNKNOWN_RESOURCE2	 0x04050002 // this is actually the red font
+#define SR_REDFONT				 0x04050002
 #define SR_PALETTE 				 0x04050003
 #define SR_PANEL_ENGLISH 		 0x04050004
 #define SR_PANEL_FRENCH 		 0x04050005





More information about the Scummvm-git-logs mailing list