[Scummvm-cvs-logs] CVS: scummvm/simon charset.cpp,1.12,1.13 simon.cpp,1.273,1.274 simon.h,1.86,1.87

Travis Howell kirben at users.sourceforge.net
Sat Aug 2 00:02:04 CEST 2003


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1:/tmp/cvs-serv540/simon

Modified Files:
	charset.cpp simon.cpp simon.h 
Log Message:

Improved hebrew support, thanks to Jamieson


Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/charset.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- charset.cpp	29 Jul 2003 06:12:52 -0000	1.12
+++ charset.cpp	2 Aug 2003 07:00:57 -0000	1.13
@@ -204,18 +204,33 @@
 }
 
 void SimonEngine::video_putchar(FillOrCopyStruct *fcs, byte c) {
+	byte width = 6;
+
 	if (c == 0xC) {
 		video_fill_or_copy_from_3_to_2(fcs);
 	} else if (c == 0xD || c == 0xA) {
 		video_putchar_newline(fcs);
-	} else if (c == 8 || c == 1) {
-		int8 val = (c == 8) ? 6 : 4;
-		if (fcs->textLength != 0) {
-			fcs->textLength--;
-			fcs->textColumnOffset -= val;
-			if ((int8)fcs->textColumnOffset < val) {
-				fcs->textColumnOffset += 8;
-				fcs->textColumn--;
+	} else if (c == 8 || (_language != 20 && c == 1)) {
+		if (_language == 20) { //Hebrew
+			if (fcs->textLength != 0) {
+				if (c >= 64 && c < 91)
+					width = _hebrew_char_widths [c-64];
+				fcs->textLength--;			
+				fcs->textColumnOffset += width;
+				if (fcs->textColumnOffset >= 8) {
+					fcs->textColumnOffset -= 8;
+					fcs->textColumn--;
+				}
+			}
+		} else {
+			int8 val = (c == 8) ? 6 : 4;
+			if (fcs->textLength != 0) {
+				fcs->textLength--;
+				fcs->textColumnOffset -= val;
+				if ((int8)fcs->textColumnOffset < val) {
+					fcs->textColumnOffset += 8;
+					fcs->textColumn--;
+				}
 			}
 		}
 	} else if (c >= 0x20) {
@@ -226,19 +241,29 @@
 			fcs->textRow--;
 		}
 
-		if (_language == 20)
+		if (_language == 20) { //Hebrew
+			if (c >= 64 && c < 91)
+				width = _hebrew_char_widths [c-64];
+
+			fcs->textColumnOffset  -= width;
+			if (fcs->textColumnOffset >= width) {
+				++fcs->textColumn;
+				fcs->textColumnOffset += 8;
+			}
 			video_putchar_drawchar(fcs, fcs->width + fcs->x - fcs->textColumn, fcs->textRow * 8 + fcs->y, c);
-		else
+			fcs->textLength++;
+		} else {
 			video_putchar_drawchar(fcs, fcs->textColumn + fcs->x, fcs->textRow * 8 + fcs->y, c);
 
-		fcs->textLength++;
-		fcs->textColumnOffset += 6;
-		if (c == 'i' || c == 'l')
-			fcs->textColumnOffset -= 2;
+			fcs->textLength++;
+			fcs->textColumnOffset += 6;
+			if (c == 'i' || c == 'l')
+				fcs->textColumnOffset -= 2;
 
-		if (fcs->textColumnOffset >= 8) {
-			fcs->textColumnOffset -= 8;
-			fcs->textColumn++;
+			if (fcs->textColumnOffset >= 8) {
+				fcs->textColumnOffset -= 8;
+				fcs->textColumn++;
+			}
 		}
 	}
 }

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -d -r1.273 -r1.274
--- simon.cpp	2 Aug 2003 00:36:38 -0000	1.273
+++ simon.cpp	2 Aug 2003 07:00:57 -0000	1.274
@@ -437,6 +437,9 @@
 	_sdl_buf_attached = 0;
 
 	_vc_10_base_ptr_old = 0;
+	memcpy (_hebrew_char_widths,
+		"\x5\x5\x4\x6\x5\x3\x4\x5\x6\x3\x5\x5\x4\x6\x5\x3\x4\x6\x5\x6\x6\x6\x5\x5\x5\x6\x5\x6\x6\x6\x6\x6", 32);
+
 
 	// Setup midi driver
 	if (!driver)
@@ -2656,10 +2659,17 @@
 
 		fcs->textRow = unk132_result;
 
-		// init x offset with a 2 character savegame number + a period (18 pix)
-		fcs->textColumn = 2;
-		fcs->textColumnOffset = 2;
-		fcs->textLength = 3;
+		if (_language == 20) {
+			// init x offset with a 2 character savegame number + a period (18 pix)
+			fcs->textColumn = 3;
+			fcs->textColumnOffset = 6;
+			fcs->textLength = 3;
+		} else {
+			// init x offset with a 2 character savegame number + a period (18 pix)
+			fcs->textColumn = 2;
+			fcs->textColumnOffset = 2;
+			fcs->textLength = 3;
+		}
 
 		name = buf + i * 18;
 

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- simon.h	2 Aug 2003 00:36:38 -0000	1.86
+++ simon.h	2 Aug 2003 07:00:58 -0000	1.87
@@ -348,6 +348,7 @@
 	RandomSource _rnd;
 
 	byte *_vc_10_base_ptr_old;
+	byte _hebrew_char_widths[32];
 
 public:
 	SimonEngine(GameDetector *detector, OSystem *syst);





More information about the Scummvm-git-logs mailing list