allow engine shutdown and restart with diffrent mode
svn-id: r28401
This commit is contained in:
parent
014de3cfe7
commit
46d6ffcdf6
2 changed files with 80 additions and 69 deletions
|
@ -82,8 +82,6 @@ DrasculaEngine::DrasculaEngine(OSystem *syst) : Engine(syst) {
|
|||
DrasculaEngine::~DrasculaEngine() {
|
||||
salir_al_dos(0);
|
||||
|
||||
free(VGA);
|
||||
|
||||
delete _rnd;
|
||||
}
|
||||
|
||||
|
@ -130,6 +128,14 @@ int DrasculaEngine::init() {
|
|||
_system->initSize(320, 200);
|
||||
_system->endGFXTransaction();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int DrasculaEngine::go() {
|
||||
_gameMode = 1;
|
||||
|
||||
for (;;) {
|
||||
VGA = (byte *)malloc(320 * 200);
|
||||
memset(VGA, 0, 64000);
|
||||
|
||||
|
@ -161,17 +167,9 @@ int DrasculaEngine::init() {
|
|||
UsingMem = 0;
|
||||
GlobalSpeed = 0;
|
||||
|
||||
|
||||
|
||||
asigna_memoria();
|
||||
carga_info();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int DrasculaEngine::go() {
|
||||
lee_dibujos("95.alg");
|
||||
descomprime_dibujo(dir_mesa, 1);
|
||||
|
||||
|
@ -190,8 +188,12 @@ int DrasculaEngine::go() {
|
|||
strcpy(nombre_icono[6], "push");
|
||||
|
||||
paleta_hare();
|
||||
escoba();
|
||||
|
||||
if (escoba()) {
|
||||
salir_al_dos(0);
|
||||
break;
|
||||
}
|
||||
salir_al_dos(0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -203,8 +205,7 @@ void DrasculaEngine::salir_al_dos(int r) {
|
|||
MusicFadeout();
|
||||
stopmusic();
|
||||
libera_memoria();
|
||||
if (r == 2)
|
||||
error("Game reach next segment");
|
||||
free(VGA);
|
||||
}
|
||||
|
||||
void DrasculaEngine::asigna_memoria() {
|
||||
|
@ -413,7 +414,7 @@ void DrasculaEngine::VUELCA_PANTALLA(int xorg, int yorg, int xdes, int ydes, int
|
|||
_system->updateScreen();
|
||||
}
|
||||
|
||||
void DrasculaEngine::escoba() {
|
||||
bool DrasculaEngine::escoba() {
|
||||
int soc, l, n;
|
||||
|
||||
dir_texto = dir_mesa;
|
||||
|
@ -500,7 +501,8 @@ bucles:
|
|||
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 @@ void DrasculaEngine::animacion_1() {
|
|||
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 @@ void DrasculaEngine::animacion_2() {
|
|||
FundeAlNegro(0);
|
||||
break;
|
||||
}
|
||||
salir_al_dos(2);
|
||||
|
||||
_gameMode = 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrasculaEngine::sin_verbo() {
|
||||
|
@ -1455,7 +1459,7 @@ void DrasculaEngine::elige_en_barra() {
|
|||
elige_verbo(num_verbo);
|
||||
}
|
||||
|
||||
void DrasculaEngine::comprueba1() {
|
||||
bool DrasculaEngine::comprueba1() {
|
||||
int l;
|
||||
|
||||
if (menu_scr == 1)
|
||||
|
@ -1464,7 +1468,8 @@ void DrasculaEngine::comprueba1() {
|
|||
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 @@ void DrasculaEngine::comprueba1() {
|
|||
}
|
||||
rompo = 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DrasculaEngine::comprueba2() {
|
||||
|
@ -3439,7 +3446,7 @@ void DrasculaEngine::saca_objeto() {
|
|||
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 @@ void DrasculaEngine::sal_de_la_habitacion(int l) {
|
|||
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 @@ void DrasculaEngine::sal_de_la_habitacion(int l) {
|
|||
carga_escoba(salgo);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void DrasculaEngine::coge_objeto() {
|
||||
|
|
|
@ -467,13 +467,14 @@ public:
|
|||
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 @@ public:
|
|||
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 @@ public:
|
|||
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue