[Scummvm-cvs-logs] SF.net SVN: scummvm: [32306] scummvm/trunk/engines/drascula/drascula.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Mon May 26 23:48:59 CEST 2008


Revision: 32306
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32306&view=rev
Author:   sev
Date:     2008-05-26 14:48:59 -0700 (Mon, 26 May 2008)

Log Message:
-----------
Implement built-in screensaver

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2008-05-26 21:07:49 UTC (rev 32305)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2008-05-26 21:48:59 UTC (rev 32306)
@@ -1841,24 +1841,111 @@
 
 void DrasculaEngine::salva_pantallas() {
 	int xr, yr;
+	byte *copia, *ghost;
+	Common::File file;
+	float coeff = 0, coeff2 = 0;
+	int count = 0;
+	int count2 = 0;
+	int tempLine[320];
+	int tempRow[200];
 
 	// FIXME: that part (*.ghost) need RE from efecto.lib file for some gfx special effect
 	// for now ignore
-	return;
 
 	clearRoom();
 
 	loadPic("sv.alg");
 	decompressPic(dir_dibujo1, HALF_PAL);
-	//TODO inicio_ghost();
-	//TODO carga_ghost();
 
+	// inicio_ghost();
+	copia = (byte *)malloc(64000);
+	ghost = (byte *)malloc(65536);
+
+	// carga_ghost();
+	file.open("ghost.drv");
+	if (!file.isOpen())
+		error("Cannot open file ghost.drv");
+
+	file.read(ghost, 65536);
+	file.close();
+
 	MirarRaton();
 	xr = x_raton;
 	yr = y_raton;
 
 	for (;;) {
-		//TODO efecto(dir_dibujo1);
+		// efecto(dir_dibujo1);
+
+		memcpy(copia, dir_dibujo1, 64000);
+		coeff += 0.1;
+		coeff2 = coeff;
+
+		if (++count > 319)
+			count = 0;
+
+		for (int i = 0; i < 320; i++) {
+			tempLine[i] = (int)(sin(coeff2) * 16);
+			coeff2 += 0.02;
+			if (tempLine[i] < 0)
+				tempLine[i] += 200;
+			if (tempLine[i] > 199)
+				tempLine[i] -= 200;
+		}
+
+		coeff2 = coeff;
+		for (int i = 0; i < 200; i++) {
+			tempRow[i] = (int)(sin(coeff2) * 16);
+			coeff2 += 0.02;
+			if (tempRow[i] < 0)
+				tempRow[i] += 320;
+			if (tempRow[i] > 319)
+				tempRow[i] -= 320;
+		}
+
+		if (++count2 > 199)
+			count2 = 0;
+
+		int x1_, y1_, off1, off2;
+
+		for (int i = 0; i < 200; i++) {
+			for (int j = 0; j < 320; j++) {
+				x1_ = j + tempRow[i];
+				if (x1_ < 0)
+					x1_ += 320;
+				if (x1_ > 319)
+					x1_ -= 319;
+
+				y1_ = i + count2;
+				if (y1_ < 0)
+					y1_ += 200;
+				if (y1_ > 199)
+					y1_ -= 200;
+
+				off1 = 320 * y1_ + x1_;
+
+				x1_ = j + count;
+				if (x1_ < 0)
+					x1_ += 320;
+				if (x1_ > 319)
+					x1_ -= 320;
+
+				y1_ = i + tempLine[j];
+				if (y1_ < 0)
+					y1_ += 200;
+				if (y1_ > 199)
+					y1_ -= 200;
+				off2 = 320 * y1_ + x1_;
+
+				VGA[320 * i + j] = ghost[dir_dibujo1[off2] + (copia[off1] << 8)];
+			}
+		}
+		_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+		_system->updateScreen();
+
+		_system->delayMillis(20);
+
+		// end of efecto()
+
 		MirarRaton();
 		if (boton_dch == 1 || boton_izq == 1)
 			break;
@@ -1867,7 +1954,10 @@
 		if (y_raton != yr)
 			break;
 	}
-	//TODO fin_ghost();
+	// fin_ghost();
+	free(copia);
+	free(ghost);
+
 	loadPic(num_room);
 	decompressPic(dir_dibujo1, HALF_PAL);
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list