[Scummvm-cvs-logs] CVS: scummvm/simon charset.cpp,1.11.2.1,1.11.2.2 items.cpp,1.88.2.1,1.88.2.2 simon.cpp,1.260.2.5,1.260.2.6 simon.h,1.82.2.1,1.82.2.2 vga.cpp,1.72.2.1,1.72.2.2

Travis Howell kirben at users.sourceforge.net
Sun Aug 3 22:57:05 CEST 2003


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

Modified Files:
      Tag: branch-0-5-0
	charset.cpp items.cpp simon.cpp simon.h vga.cpp 
Log Message:

Simon backports:
Hebrew support
simon1cd32 fix
warnings cleanup


Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/charset.cpp,v
retrieving revision 1.11.2.1
retrieving revision 1.11.2.2
diff -u -d -r1.11.2.1 -r1.11.2.2
--- charset.cpp	29 Jul 2003 06:12:05 -0000	1.11.2.1
+++ charset.cpp	4 Aug 2003 05:56:24 -0000	1.11.2.2
@@ -82,6 +82,8 @@
 	dst += READ_BE_UINT32(p);
 
 	memset(dst, 0, count);
+	if (_language == 20)
+		dst += width - 1; // For Hebrew, start at the right edge, not the left.
 
 	dst_org = dst;
 	while ((chr = *txt++) != 0) {
@@ -89,12 +91,14 @@
 			dst_org += width * 10;
 			dst = dst_org;
 		} else if ((chr -= ' ') == 0) {
-			dst += 6;
+			dst += (_language == 20 ? -6 : 6); // Hebrew moves to the left, all others to the right
 		} else {
 			byte *img_hdr = src + 48 + chr * 4;
 			uint img_height = img_hdr[2];
 			uint img_width = img_hdr[3], i;
 			byte *img = src + READ_LE_UINT16(img_hdr);
+			if (_language == 20)
+				dst -= img_width - 1; // For Hebrew, move from right edge to left edge of image.
 			byte *cur_dst = dst;
 
 			if (_game == GAME_SIMON1AMIGA) {
@@ -122,7 +126,8 @@
 				cur_dst += width;
 			} while (--img_height);
 
-			dst += img_width - 1;
+			if (_language != 20) // Hebrew character movement is done higher up
+				dst += img_width - 1;
 		}
 	}
 }
@@ -204,18 +209,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 +246,28 @@
 			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: items.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/items.cpp,v
retrieving revision 1.88.2.1
retrieving revision 1.88.2.2
diff -u -d -r1.88.2.1 -r1.88.2.2
--- items.cpp	27 Jul 2003 12:06:49 -0000	1.88.2.1
+++ items.cpp	4 Aug 2003 05:56:24 -0000	1.88.2.2
@@ -1000,9 +1000,9 @@
 					d = _array_4[a];
 
 				if (_game & GF_SIMON2) {
-					if (d != 0 && !_subtitles)
+					if (d != 0 && (_language == 20 || !_subtitles))
 						talk_with_speech(d, b);
-					else if (s != NULL)
+					if (s != NULL && _subtitles)
 						talk_with_text(b, c, s, tv->a, tv->b, tv->c);
 				} else {
 					if (d != 0)
@@ -1304,7 +1304,7 @@
 				}
 			}
 
-			if (!_subtitles)
+			if (_language == 20 || !_subtitles)
 				talk_with_speech(var200, a);
 		}
 

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.260.2.5
retrieving revision 1.260.2.6
diff -u -d -r1.260.2.5 -r1.260.2.6
--- simon.cpp	30 Jul 2003 01:43:58 -0000	1.260.2.5
+++ simon.cpp	4 Aug 2003 05:56:24 -0000	1.260.2.6
@@ -424,7 +424,6 @@
 
 	_dump_file = 0;
 
-	_number_of_savegames = 0;
 	_saveload_row_curpos = 0;
 	_num_savegame_rows = 0;
 	_savedialog_flag = false;
@@ -438,6 +437,10 @@
 	_sdl_buf = 0;
 	_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)
@@ -2063,7 +2066,7 @@
 	case GAME_SIMON1CD32:
 		if (speech_id != 0)
 			talk_with_speech(speech_id, num_1);
-		if (string_ptr != NULL && (_subtitles || speech_id == 0))
+		if (string_ptr != NULL && (speech_id == 0 || _subtitles))
 			talk_with_text(num_1, num_2, (const char *)string_ptr, tv->a, tv->b, tv->c);
 		break;
 
@@ -2077,16 +2080,14 @@
 	case GAME_SIMON2TALKIE:
 	case GAME_SIMON2WIN:
 	case GAME_SIMON2MAC:
-		if (speech_id != 0 && num_1 == 1 && !_subtitles)
+		if (speech_id != 0 && num_1 == 1 && (_language == 20 || !_subtitles))
 			talk_with_speech(speech_id, num_1);
 
-		if (speech_id != 0 && !_subtitles)
-			return;
-
 		if ((_game & GF_TALKIE) && (speech_id == 0))
 			o_kill_sprite_simon2(2, num_1 + 2);
 
-		talk_with_text(num_1, num_2, (const char *)string_ptr, tv->a, tv->b, tv->c);
+		if (string_ptr != NULL && (speech_id == 0 || _subtitles))
+			talk_with_text(num_1, num_2, (const char *)string_ptr, tv->a, tv->b, tv->c);
 		break;
 	}
 }
@@ -2606,7 +2607,7 @@
 
 void SimonEngine::save_or_load_dialog(bool load) {
 	time_t save_time;
-	int num = _number_of_savegames;
+	int number_of_savegames;
 	int i;
 	int unk132_result;
 	FillOrCopyStruct *fcs;
@@ -2621,18 +2622,18 @@
 
 	_copy_partial_mode = 1;
 
-	_number_of_savegames = num = count_savegames();
+	number_of_savegames = count_savegames();
 	if (!load)
-		num++;
-	num -= 6;
-	if (num < 0)
-		num = 0;
-	num++;
-	_num_savegame_rows = num;
+		number_of_savegames++;
+	number_of_savegames -= 6;
+	if (number_of_savegames < 0)
+		number_of_savegames = 0;
+	number_of_savegames++;
+	_num_savegame_rows = number_of_savegames;
 
 	_saveload_row_curpos = 1;
 	if (!load)
-		_saveload_row_curpos = num;
+		_saveload_row_curpos = number_of_savegames;
 
 	_saveload_flag = false;
 
@@ -2657,25 +2658,44 @@
 
 		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) { //Hebrew
+			// 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;
 
 		// now process entire savegame name to get correct x offset for cursor
 		name_len = 0;
 		while (name[name_len]) {
-			fcs->textLength++;
-			fcs->textColumnOffset += 6;
-			if (name[name_len] == 'i' || name[name_len] == 'l')
-				fcs->textColumnOffset -= 2;
-			if (fcs->textColumnOffset >= 8) {
-				fcs->textColumnOffset -= 8;
-				fcs->textColumn++;
+			if (_language == 20) { //Hebrew
+				byte width = 6;
+				if (name[name_len] >= 64 && name[name_len] < 91)
+					width = _hebrew_char_widths [name[name_len]-64];
+				fcs->textLength++;
+				fcs->textColumnOffset -= width;
+				if (fcs->textColumnOffset >= width) {
+					fcs->textColumnOffset += 8;
+					fcs->textColumn++;
+				}
+			} else {
+				fcs->textLength++;
+				fcs->textColumnOffset += 6;
+				if (name[name_len] == 'i' || name[name_len] == 'l')
+					fcs->textColumnOffset -= 2;
+				if (fcs->textColumnOffset >= 8) {
+					fcs->textColumnOffset -= 8;
+					fcs->textColumn++;
+				}
+				name_len++;
 			}
-			name_len++;
 		}
 		// while_1_end
 

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.82.2.1
retrieving revision 1.82.2.2
diff -u -d -r1.82.2.1 -r1.82.2.2
--- simon.h	27 Jul 2003 12:06:49 -0000	1.82.2.1
+++ simon.h	4 Aug 2003 05:56:24 -0000	1.82.2.2
@@ -334,8 +334,6 @@
 
 	FILE *_dump_file;
 
-	int _number_of_savegames;
-
 	int _saveload_row_curpos;
 	int _num_savegame_rows;
 	bool _savedialog_flag;
@@ -350,6 +348,8 @@
 
 	RandomSource _rnd;
 
+	byte *_vc_10_base_ptr_old;
+	byte _hebrew_char_widths[32];
 
 public:
 	SimonEngine(GameDetector *detector, OSystem *syst);
@@ -752,6 +752,7 @@
 	void shutdown();
 
 	byte *vc_10_depack_swap(byte *src, uint w, uint h);
+	byte *vc_10_no_depack_swap(byte *src, uint w, uint h);
 
 	Item *getNextItemPtrStrange();
 

Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.72.2.1
retrieving revision 1.72.2.2
diff -u -d -r1.72.2.1 -r1.72.2.2
--- vga.cpp	30 Jul 2003 16:29:27 -0000	1.72.2.1
+++ vga.cpp	4 Aug 2003 05:56:24 -0000	1.72.2.2
@@ -511,10 +511,26 @@
 	return _video_buf_1;
 }
 
-byte *vc_10_no_depack_swap(byte *src) {
-	// TODO Add vc_10_no_depack_swap support, should be very similar to 
-	// vc_10_depack_swap but without the depacking
-	return NULL;
+byte *SimonEngine::vc_10_no_depack_swap(byte *src, uint w, uint h) {
+	if (src == _vc_10_base_ptr_old)
+		return _video_buf_1;
+
+	_vc_10_base_ptr_old = src;
+	h *= 8;
+	byte *dst = _video_buf_1 + h - 1;
+
+	// loc_40F57F
+	uint h_cur = h;
+	do {
+		do {
+			*dst = *src << 4;
+			(*dst--) |= (*src++) >> 4;
+		} while (--h_cur != 0);
+		h_cur = h;
+		dst += h * 2;
+	} while (--w != 0);
+
+	return _video_buf_1;
 }
 
 /* must not be const */
@@ -656,10 +672,7 @@
 	if (state.e & 0x10) {
 		state.depack_src = vc_10_depack_swap(state.depack_src, width, height);
 	} else if (state.e & 1) {
-		// FIXME: vc_10_no_depack_swap should be called but is currently not supported
-		//state.depack_src = vc_10_no_depack_swap(state.depack_src);
-		debug(5,"vc_10_no_depack_swap unimpl");
-		state.depack_src = vc_10_depack_swap(state.depack_src, width, height);
+		state.depack_src = vc_10_no_depack_swap(state.depack_src, width, height);
 	}
 
 	vlut = &_video_windows[_video_palette_mode * 4];
@@ -1292,9 +1305,8 @@
 }
 
 void SimonEngine::vc_28_dummy_op() {
-	/* dummy opcode */
+	/* unused */
 	_vc_ptr += 8;
-	warning("vc_28 - Please report error message and where in game it occured");
 }
 
 void SimonEngine::vc_29_stop_all_sounds() {
@@ -1337,12 +1349,9 @@
 }
 
 void SimonEngine::vc_35() {
-	/* unknown function is simon1dos/simon2dos */
-	/* dummy op in simon1win/simon2win */
-	/* not used? */
+	/* unused */
 	_vc_ptr += 4;
 	_vga_sprite_changed++;
-	warning("vc_35 - Please report error message and where in game it occured");
 }
 
 void SimonEngine::vc_36_saveload_thing() {
@@ -1546,15 +1555,13 @@
 }
 
 void SimonEngine::vc_53_no_op() {
-	/* dummy op in simon1dos/talkie */
-	/* no op in simon1win */
-	warning("vc_53 - Please report error message and where in game it occured");
+	/* unused */
+	_vc_ptr += 4;
 }
 
 void SimonEngine::vc_54_no_op() {
-	/* dummy op in simon1dos/talkie */
-	/* no op in simon1win */
-	warning("vc_54 - Please report error message and where in game it occured");
+	/* unused */
+	_vc_ptr += 6;
 }
 
 void SimonEngine::vc_55_offset_hit_area() {
@@ -1579,7 +1586,6 @@
 }
 
 void SimonEngine::vc_56() {
-	/* no op in simon1 */
 	if (_game & GF_SIMON2) {
 		uint num = vc_read_var_or_word() * _vga_base_delay;
 
@@ -1588,8 +1594,6 @@
 
 		add_vga_timer(num + gss->VGA_DELAY_BASE, _vc_ptr, _vga_cur_sprite_id, _vga_cur_file_id);
 		_vc_ptr = (byte *)&vc_get_out_of_code;
-	} else {
-		warning("vc_56 - Please report error message and where in game it occured");
 	}
 }
 
@@ -1609,10 +1613,6 @@
 }
 
 void SimonEngine::vc_58() {
-	/* no op in simon1dos */
-	/* not used in simon1win? */
-	if (!(_game & GF_SIMON2))
-		warning("vc_58 - Please report error message and where in game it occured");
 	uint sprite = _vga_cur_sprite_id;
 	uint file = _vga_cur_file_id;
 	byte *vc_ptr;
@@ -1633,10 +1633,7 @@
 }
 
 void SimonEngine::vc_57_no_op() {
-	/* unknown function in simon1dos/simon2dos */
-	/* no op in simon1win/simon2win */
-	/* not used? */
-		warning("vc_57 - Please report error message and where in game it occured");
+	/* unused */
 }
 
 void SimonEngine::vc_kill_sprite(uint file, uint sprite) {





More information about the Scummvm-git-logs mailing list