[Scummvm-cvs-logs] CVS: scummvm/simon charset.cpp,1.24,1.25 simon.cpp,1.371,1.372 simon.h,1.110,1.111

Travis Howell kirben at users.sourceforge.net
Mon Dec 15 21:05:01 CET 2003


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

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

Add some additional simon1 amiga code from tsuteiuQ, not working right yet.


Index: charset.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/charset.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- charset.cpp	28 Nov 2003 10:11:04 -0000	1.24
+++ charset.cpp	16 Dec 2003 05:04:39 -0000	1.25
@@ -61,6 +61,97 @@
 	}
 }
 
+void SimonEngine::render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
+	VgaPointersEntry *vpe = &_vga_buffer_pointers[2];
+	byte *src, *dst, *dst_org, chr;
+	uint count;
+
+	if (vga_sprite_id >= 100) {
+		vga_sprite_id -= 100;
+		vpe++;
+	}
+
+	src = dst = vpe->vgaFile2;
+
+	count = 499;
+	if (vga_sprite_id == 1)
+		count *= 2;
+
+	src += vga_sprite_id * 8;
+	dst += READ_BE_UINT32(src);
+	*(uint16 *)(dst + 4) = TO_BE_16(height);
+	*(uint16 *)(dst + 6) = TO_BE_16(width);
+
+	uint charsize = width/8 * height;
+	memset(dst, 0, count);
+	dst_org = dst;
+	int delta = 0;
+	while ((chr = *txt++) != 0) {
+		int tmp = chr;
+		if (chr == 10) {
+			dst_org += width * 10;
+			dst = dst_org;
+			delta = 0;
+		} else if ((tmp -= '!') < 0) {
+			delta += 6;
+			if (delta > 8)
+			{
+				delta -= 8;
+				dst_org++;
+			}
+		} else {
+			byte *img = src + chr * 41;
+			int CTR = img[40];
+			int D3 = 8 - delta;
+			for (int D2 = 9; D2 != 0; D2--)
+			{
+				byte *cur_dst = dst_org;
+				for (int D7 = 2; D7 != 0; D7--)
+				{
+					chr = *img >> delta;
+					if (chr)
+					{
+						if (color & 1) *(cur_dst + charsize * 0) |= chr;
+						if (color & 2) *(cur_dst + charsize * 1) |= chr;
+						if (color & 4) *(cur_dst + charsize * 2) |= chr;
+						if (color & 8) *(cur_dst + charsize * 3) |= chr;
+					}
+					if ((D3 >= CTR) && (chr = *img++ << (D3)))
+					{
+						if (color & 1) *(cur_dst + charsize * 0) |= chr;
+						if (color & 2) *(cur_dst + charsize * 1) |= chr;
+						if (color & 4) *(cur_dst + charsize * 2) |= chr;
+						if (color & 8) *(cur_dst + charsize * 3) |= chr;
+					}
+					color++;
+				}
+				chr = *img >> delta;
+				if (chr)
+				{
+					*(cur_dst + charsize * 0) |= chr;
+					*(cur_dst + charsize * 1) |= chr;
+					*(cur_dst + charsize * 2) |= chr;
+					*(cur_dst + charsize * 3) |= chr;
+				}
+				if ((D3 >= CTR) && (chr = *img++ << (D3)))
+				{
+					*(cur_dst + charsize * 0) |= chr;
+					*(cur_dst + charsize * 1) |= chr;
+					*(cur_dst + charsize * 2) |= chr;
+					*(cur_dst + charsize * 3) |= chr;
+				}
+				cur_dst += width/8;
+			}
+			delta += CTR;
+			if (delta > 8)
+			{
+				delta -= 8;
+				dst_org++;
+			}
+		}
+	}
+}
+
 void SimonEngine::render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt) {
 	VgaPointersEntry *vpe = &_vga_buffer_pointers[2];
 	byte *src, *dst, *p, *dst_org, chr;

Index: simon.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.cpp,v
retrieving revision 1.371
retrieving revision 1.372
diff -u -d -r1.371 -r1.372
--- simon.cpp	13 Dec 2003 13:46:58 -0000	1.371
+++ simon.cpp	16 Dec 2003 05:04:39 -0000	1.372
@@ -4289,7 +4289,12 @@
 	}
 	color = color * 3 + 192;
 
-	render_string(vga_sprite_id, color, width, height, print_str_buf);
+	if (_game & GF_AMIGA)
+		render_string_amiga(vga_sprite_id, color, width, height, print_str_buf);
+	else
+		render_string(vga_sprite_id, color, width, height, print_str_buf);
+		
+
 	num_of_rows = 4;
 	if (!(_bit_array[8] & 0x20))
 		num_of_rows = 3;

Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- simon.h	13 Dec 2003 01:18:31 -0000	1.110
+++ simon.h	16 Dec 2003 05:04:39 -0000	1.111
@@ -596,6 +596,7 @@
 	void talk_with_text(uint vga_sprite_id, uint color, const char *string_ptr, uint threeval_a, int threeval_b, uint width);
 	FillOrCopyStruct *fcs_alloc(uint x, uint y, uint w, uint h, uint flags, uint fill_color, uint unk4);
 
+	void render_string_amiga(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
 	void render_string(uint vga_sprite_id, uint color, uint width, uint height, const char *txt);
 
 	void setup_hit_areas(FillOrCopyStruct *fcs, uint fcs_index);





More information about the Scummvm-git-logs mailing list