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

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Thu Aug 2 09:09:28 CEST 2007


Revision: 28401
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28401&view=rev
Author:   aquadran
Date:     2007-08-02 00:09:28 -0700 (Thu, 02 Aug 2007)

Log Message:
-----------
allow engine shutdown and restart with diffrent mode

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

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2007-08-02 06:47:04 UTC (rev 28400)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2007-08-02 07:09:28 UTC (rev 28401)
@@ -82,8 +82,6 @@
 DrasculaEngine::~DrasculaEngine() {
 	salir_al_dos(0);
 
-	free(VGA);
-
 	delete _rnd;
 }
 
@@ -130,68 +128,72 @@
 	_system->initSize(320, 200);
 	_system->endGFXTransaction();
 
-	VGA = (byte *)malloc(320 * 200);
-	memset(VGA, 0, 64000);
+	return 0;
+}
 
-	lleva_objeto = 0;
-	menu_bar = 0; menu_scr = 0; hay_nombre = 0;
-	frame_y = 0;
-	hare_x = -1; hare_se_mueve = 0; sentido_hare = 3; num_frame = 0; hare_se_ve = 1;
-	comprueba_flags = 1;
-	rompo = 0; rompo2 = 0;
-	anda_a_objeto = 0;
-	paso_x = PASO_HARE_X; paso_y = PASO_HARE_Y;
-	alto_hare = ALTO_PERSONAJE; ancho_hare = ANCHO_PERSONAJE; alto_pies = PIES_HARE;
-	alto_habla = ALTO_HABLA_HARE; ancho_habla = ANCHO_HABLA_HARE;
-	hay_respuesta = 0;
-	conta_ciego_vez = 0;
-	cambio_de_color = 0;
-	rompo_y_salgo = 0;
-	vb_x = 120; sentido_vb = 1; vb_se_mueve = 0; frame_vb = 1;
-	frame_piano = 0;
-	frame_borracho = 0;
-	frame_velas = 0;
-	cont_sv = 0;
-	term_int = 0;
-	num_ejec = 1;
-	cual_ejec = 0; hay_que_load = 0;
-	corta_musica = 0;
-	hay_seleccion = 0;
-	Leng = 0;
-	UsingMem = 0;
-	GlobalSpeed = 0;
 
+int DrasculaEngine::go() {
+	_gameMode = 1;
 
+	for (;;) {
+		VGA = (byte *)malloc(320 * 200);
+		memset(VGA, 0, 64000);
 
-	asigna_memoria();
-	carga_info();
+		lleva_objeto = 0;
+		menu_bar = 0; menu_scr = 0; hay_nombre = 0;
+		frame_y = 0;
+		hare_x = -1; hare_se_mueve = 0; sentido_hare = 3; num_frame = 0; hare_se_ve = 1;
+		comprueba_flags = 1;
+		rompo = 0; rompo2 = 0;
+		anda_a_objeto = 0;
+		paso_x = PASO_HARE_X; paso_y = PASO_HARE_Y;
+		alto_hare = ALTO_PERSONAJE; ancho_hare = ANCHO_PERSONAJE; alto_pies = PIES_HARE;
+		alto_habla = ALTO_HABLA_HARE; ancho_habla = ANCHO_HABLA_HARE;
+		hay_respuesta = 0;
+		conta_ciego_vez = 0;
+		cambio_de_color = 0;
+		rompo_y_salgo = 0;
+		vb_x = 120; sentido_vb = 1; vb_se_mueve = 0; frame_vb = 1;
+		frame_piano = 0;
+		frame_borracho = 0;
+		frame_velas = 0;
+		cont_sv = 0;
+		term_int = 0;
+		num_ejec = 1;
+		cual_ejec = 0; hay_que_load = 0;
+		corta_musica = 0;
+		hay_seleccion = 0;
+		Leng = 0;
+		UsingMem = 0;
+		GlobalSpeed = 0;
 
+		asigna_memoria();
+		carga_info();
 
-	return 0;
-}
+		lee_dibujos("95.alg");
+		descomprime_dibujo(dir_mesa, 1);
 
+		lee_dibujos("96.alg");
+		descomprime_dibujo(dir_hare_frente, COMPLETA);
+		lee_dibujos("99.alg");
+		descomprime_dibujo(dir_hare_fondo, 1);
+		lee_dibujos("97.alg");
+		descomprime_dibujo(dir_hare_dch, 1);
 
-int DrasculaEngine::go() {
-	lee_dibujos("95.alg");
-	descomprime_dibujo(dir_mesa, 1);
+		strcpy(nombre_icono[1], "look");
+		strcpy(nombre_icono[2], "take");
+		strcpy(nombre_icono[3], "open");
+		strcpy(nombre_icono[4], "close");
+		strcpy(nombre_icono[5], "talk");
+		strcpy(nombre_icono[6], "push");
 
-	lee_dibujos("96.alg");
-	descomprime_dibujo(dir_hare_frente, COMPLETA);
-	lee_dibujos("99.alg");
-	descomprime_dibujo(dir_hare_fondo, 1);
-	lee_dibujos("97.alg");
-	descomprime_dibujo(dir_hare_dch, 1);
-
-	strcpy(nombre_icono[1], "look");
-	strcpy(nombre_icono[2], "take");
-	strcpy(nombre_icono[3], "open");
-	strcpy(nombre_icono[4], "close");
-	strcpy(nombre_icono[5], "talk");
-	strcpy(nombre_icono[6], "push");
-
-	paleta_hare();
-	escoba();
-
+		paleta_hare();
+		if (escoba()) {
+			salir_al_dos(0);
+			break;
+		}
+		salir_al_dos(0);
+	}
 	return 0;
 }
 
@@ -203,8 +205,7 @@
 	MusicFadeout();
 	stopmusic();
 	libera_memoria();
-	if (r == 2)
-		error("Game reach next segment");
+	free(VGA);
 }
 
 void DrasculaEngine::asigna_memoria() {
@@ -413,7 +414,7 @@
 	_system->updateScreen();
 }
 
-void DrasculaEngine::escoba() {
+bool DrasculaEngine::escoba() {
 	int soc, l, n;
 
 	dir_texto = dir_mesa;
@@ -500,7 +501,8 @@
 		elige_en_barra();
 		cont_sv = 0;
 	} else if (boton_izq == 1 && lleva_objeto == 0) {
-		comprueba1();
+		if (comprueba1())
+			return true;
 		cont_sv = 0;
 	} else if (boton_izq == 1 && lleva_objeto == 1) {
 		comprueba2();
@@ -956,7 +958,7 @@
 	descomprime_dibujo(dir_hare_fondo, 1);
 }
 
-void DrasculaEngine::animacion_2() {
+bool DrasculaEngine::animacion_2() {
 	int l;
 
 	lleva_al_hare(231, 91);
@@ -1160,7 +1162,9 @@
 		FundeAlNegro(0);
 		break;
 	}
-	salir_al_dos(2);
+
+	_gameMode = 2;
+	return true;
 }
 
 void DrasculaEngine::sin_verbo() {
@@ -1455,7 +1459,7 @@
 		elige_verbo(num_verbo);
 }
 
-void DrasculaEngine::comprueba1() {
+bool DrasculaEngine::comprueba1() {
 	int l;
 
 	if (menu_scr == 1)
@@ -1464,7 +1468,8 @@
 		for (l = 0; l < objs_room; l++) {
 			if (x_raton >= x1[l] && y_raton >= y1[l]
 					&& x_raton <= x2[l] && y_raton <= y2[l] && rompo == 0) {
-				sal_de_la_habitacion(l);
+				if (sal_de_la_habitacion(l))
+					return true;
 				if (rompo == 1)
 					break;
 			}
@@ -1503,6 +1508,8 @@
 		}
 		rompo = 0;
 	}
+
+	return false;
 }
 
 void DrasculaEngine::comprueba2() {
@@ -3439,7 +3446,7 @@
 		elige_objeto(h);
 }
 
-void DrasculaEngine::sal_de_la_habitacion(int l) {
+bool DrasculaEngine::sal_de_la_habitacion(int l) {
 	char salgo[13];
 
 	if (num_obj[l] == 105 && flags[0] == 0)
@@ -3459,7 +3466,8 @@
 			musica_antes = musica_room;
 
 			if (num_obj[l] == 105)
-				animacion_2();
+				if (animacion_2())
+					return true;
 			borra_pantalla();
 			strcpy(salgo, alapantallakeva[l]);
 			strcat(salgo, ".ald");
@@ -3467,6 +3475,8 @@
 			carga_escoba(salgo);
 		}
 	}
+
+	return false;
 }
 
 void DrasculaEngine::coge_objeto() {

Modified: scummvm/trunk/engines/drascula/drascula.h
===================================================================
--- scummvm/trunk/engines/drascula/drascula.h	2007-08-02 06:47:04 UTC (rev 28400)
+++ scummvm/trunk/engines/drascula/drascula.h	2007-08-02 07:09:28 UTC (rev 28401)
@@ -467,13 +467,14 @@
 	int y_raton_ant;
 	int boton_izq;
 	int boton_dch;
+	int _gameMode;
 
-	void escoba();
+	bool escoba();
 	void Negro();
 	void agarra_objeto(int);
 	void buffer_teclado() { }
 	void animacion_1();
-	void animacion_2();
+	bool animacion_2();
 	void sin_verbo();
 	void para_cargar(char[]);
 	void carga_escoba(const char *);
@@ -484,7 +485,7 @@
 	void espera_soltar();
 	void MirarRaton();
 	void elige_en_barra();
-	void comprueba1();
+	bool comprueba1();
 	void comprueba2();
 	byte getscan();
 	void elige_verbo(int);
@@ -543,7 +544,7 @@
 	void menu_sin_volcar();
 	void barra_menu();
 	void saca_objeto();
-	void sal_de_la_habitacion(int);
+	bool sal_de_la_habitacion(int);
 	void coge_objeto();
 	void banderas(int);
 	void cursor_mesa();


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