[Scummvm-cvs-logs] CVS: scummvm/simon simon.h,1.166,1.167 vga.cpp,1.162,1.163

kirben kirben at users.sourceforge.net
Fri Nov 18 05:51:48 CET 2005


Update of /cvsroot/scummvm/scummvm/simon
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7622/simon

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

Set scale in FF.


Index: simon.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/simon.h,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -d -r1.166 -r1.167
--- simon.h	18 Nov 2005 12:40:03 -0000	1.166
+++ simon.h	18 Nov 2005 13:47:47 -0000	1.167
@@ -767,6 +767,8 @@
 	void vc_write_var(uint var, int16 value);
 	void vc_skip_next_instruction();
 
+	int getScale(int y, int x);
+
 	bool itemIsSiblingOf(uint16 val);
 	bool itemIsParentOf(uint16 a, uint16 b);
 	bool vc_maybe_skip_proc_1(uint16 a, int16 b);

Index: vga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/simon/vga.cpp,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -d -r1.162 -r1.163
--- vga.cpp	18 Nov 2005 12:40:03 -0000	1.162
+++ vga.cpp	18 Nov 2005 13:47:47 -0000	1.163
@@ -2051,8 +2051,30 @@
 	_marks &= ~(1 << vc_read_next_byte());
 }
 
+int SimonEngine::getScale(int y, int x) {
+	int z;
+
+	if (y > _baseY) {
+		return((int)(x * (1 + ((y - _baseY) * _scale))));
+	} else {	
+		if (x == 0)
+			return(0);
+		if (x < 0) {
+			z = ((int)((x * (1 - ((_baseY - y)* _scale))) - 0.5));
+			if (z >- 2)
+				return(-2);
+			return(z);
+		}
+
+		z=((int)((x * (1 - ((_baseY-y) * _scale))) + 0.5));
+		if (z < 2)
+			return(2);
+
+		return(z);
+	}
+}
+
 void SimonEngine::vc75_setScale() {
-	// Set scale
 	_baseY = vc_read_next_word();
 	_scale = (float)vc_read_next_word() / 1000000.;
 }
@@ -2060,33 +2082,30 @@
 void SimonEngine::vc76_setScaleXOffs() {
 	VgaSprite *vsp = find_cur_sprite();
 
-	// Scale X related
 	vsp->image = vc_read_next_word();
 	int16 xoffs = vc_read_next_word();
 	int var = vc_read_next_word();
 
-	vsp->x += xoffs;
-	vsp->flags = 0x40;
-
+	vsp->x += getScale(vsp->x, xoffs);
 	_variableArray[var] = vsp->x;
 
-	debug(0, "STUB: vc76_setScaleXOffs: image %d xoffs %d var %d", vsp->image, xoffs, var);
+	if (_scrollXMax) {
+		// TODO: Scroll check
+	}
+
+	vsp->flags = 0x40;
 }
 
 void SimonEngine::vc77_setScaleYOffs() {
 	VgaSprite *vsp = find_cur_sprite();
 
-	// Scale Y related
 	vsp->image = vc_read_next_word();
 	int16 yoffs = vc_read_next_word();
 	int var = vc_read_next_word();
 
-	vsp->y += yoffs;
-	vsp->flags = 0x40;
-
+	vsp->y += getScale(vsp->y, yoffs);
 	_variableArray[var] = vsp->y;
-
-	debug(0, "STUB: vc77_setScaleYOffs: image %d yoffs %d var %d", vsp->image, yoffs, var);
+	vsp->flags = 0x40;
 }
 
 void SimonEngine::vc78_computeXY() {





More information about the Scummvm-git-logs mailing list