2007-07-17 21:35:01 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2007-07-27 05:15:24 +00:00
|
|
|
* $URL$
|
2007-07-17 21:35:01 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common/events.h"
|
2007-07-28 19:43:26 +00:00
|
|
|
#include "common/keyboard.h"
|
2007-07-17 21:35:01 +00:00
|
|
|
#include "common/file.h"
|
|
|
|
#include "common/savefile.h"
|
|
|
|
#include "common/config-manager.h"
|
|
|
|
|
|
|
|
#include "base/plugins.h"
|
|
|
|
#include "base/version.h"
|
|
|
|
|
|
|
|
#include "sound/mixer.h"
|
|
|
|
|
|
|
|
#include "drascula/drascula.h"
|
|
|
|
|
|
|
|
namespace Drascula {
|
|
|
|
|
|
|
|
struct GameSettings {
|
|
|
|
const char *gameid;
|
|
|
|
const char *description;
|
|
|
|
byte id;
|
|
|
|
uint32 features;
|
|
|
|
const char *detectname;
|
|
|
|
};
|
|
|
|
|
2007-07-17 22:29:09 +00:00
|
|
|
static const GameSettings drasculaSettings[] = {
|
2007-07-17 21:35:01 +00:00
|
|
|
{"drascula", "Drascula game", 0, 0, 0},
|
|
|
|
|
|
|
|
{NULL, NULL, 0, 0, NULL}
|
|
|
|
};
|
|
|
|
|
2007-11-03 21:06:58 +00:00
|
|
|
DrasculaEngine::DrasculaEngine(OSystem *syst, const DrasculaGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
|
2007-07-17 21:35:01 +00:00
|
|
|
|
|
|
|
// Setup mixer
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume"));
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
|
|
|
|
|
|
|
|
const GameSettings *g;
|
|
|
|
|
|
|
|
const char *gameid = ConfMan.get("gameid").c_str();
|
2007-07-17 22:29:09 +00:00
|
|
|
for (g = drasculaSettings; g->gameid; ++g)
|
2007-07-17 21:35:01 +00:00
|
|
|
if (!scumm_stricmp(g->gameid, gameid))
|
|
|
|
_gameId = g->id;
|
|
|
|
|
|
|
|
_rnd = new Common::RandomSource();
|
2007-09-19 13:55:05 +00:00
|
|
|
syst->getEventManager()->registerRandomSource(*_rnd, "drascula");
|
2007-08-01 20:11:32 +00:00
|
|
|
|
|
|
|
int cd_num = ConfMan.getInt("cdrom");
|
|
|
|
if (cd_num >= 0)
|
|
|
|
_system->openCD(cd_num);
|
2008-05-02 15:09:20 +00:00
|
|
|
|
|
|
|
_lang = 0;
|
2007-07-17 21:35:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DrasculaEngine::~DrasculaEngine() {
|
|
|
|
delete _rnd;
|
|
|
|
}
|
|
|
|
|
2008-05-27 07:04:56 +00:00
|
|
|
struct ItemLocation {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
};
|
|
|
|
|
|
|
|
ItemLocation itemLocations[] = {
|
|
|
|
{ 0, 0 }, // empty
|
|
|
|
{ 5, 10 }, { 50, 10 }, { 95, 10 }, // 1-3
|
|
|
|
{ 140, 10 }, { 185, 10 }, { 230, 10 }, // 4-6
|
|
|
|
{ 275, 10 }, { 5, 40 }, { 50, 40 }, // 7-9
|
|
|
|
{ 95, 40 }, { 140, 40 }, { 185, 40 }, // 10-12
|
|
|
|
{ 230, 40 }, { 275, 40 }, { 5, 70 }, // 13-15
|
|
|
|
{ 50, 70 }, { 95, 70 }, { 140, 70 }, // 16-18
|
|
|
|
{ 185, 70 }, { 230, 70 }, { 275, 70 }, // 19-21
|
|
|
|
{ 5, 100 }, { 50, 100 }, { 95, 100 }, // 22-24
|
|
|
|
{ 140, 100 }, { 185, 100 }, { 230, 100 }, // 25-27
|
|
|
|
{ 275, 100 }, { 5, 130 }, { 50, 130 }, // 28-30
|
|
|
|
{ 95, 130 }, { 140, 130 }, { 185, 130 }, // 31-33
|
|
|
|
{ 230, 130 }, { 275, 130 }, { 5, 160 }, // 34-36
|
|
|
|
{ 50, 160 }, { 95, 160 }, { 140, 160 }, // 37-39
|
|
|
|
{ 185, 160 }, { 230, 160 }, { 275, 160 }, // 40-42
|
|
|
|
{ 275, 160 } // 43
|
|
|
|
};
|
|
|
|
|
2008-03-14 13:35:47 +00:00
|
|
|
static const int x_pol[44] = {0, 1, 42, 83, 124, 165, 206, 247, 83, 1, 206,
|
2007-07-26 19:52:18 +00:00
|
|
|
1, 42, 83, 124, 165, 206, 247, 83, 1, 206,
|
|
|
|
247, 83, 165, 1, 206, 42, 124, 83, 1, 247,
|
|
|
|
83, 165, 1, 206, 42, 124, 83, 1, 247, 42,
|
|
|
|
1, 165, 206};
|
2008-03-14 13:35:47 +00:00
|
|
|
static const int y_pol[44] = {0, 1, 1, 1, 1, 1, 1, 1, 27, 27, 1,
|
2007-07-28 09:45:05 +00:00
|
|
|
27, 27, 27, 27, 27, 27, 27, 1, 1, 27,
|
2007-07-26 19:52:18 +00:00
|
|
|
1, 1, 1, 1, 1, 27, 27, 27, 27, 27,
|
|
|
|
1, 1, 1, 1, 1, 27, 27, 27, 27, 27,
|
|
|
|
27, 1, 1};
|
2008-03-14 13:35:47 +00:00
|
|
|
static const int x_barra[] = {6, 51, 96, 141, 186, 232, 276, 321};
|
|
|
|
static const int x1d_menu[] = {280, 40, 80, 120, 160, 200, 240, 0, 40, 80, 120,
|
2007-07-26 19:52:18 +00:00
|
|
|
160, 200, 240, 0, 40, 80, 120, 160, 200, 240, 0,
|
|
|
|
40, 80, 120, 160, 200, 240, 0};
|
2008-03-14 13:35:47 +00:00
|
|
|
static const int y1d_menu[] = {0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25,
|
2007-07-26 19:52:18 +00:00
|
|
|
50, 50, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75, 75, 75, 100};
|
2007-08-02 20:59:03 +00:00
|
|
|
static int frame_x[20] = {43, 87, 130, 173, 216, 259};
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2007-07-17 21:35:01 +00:00
|
|
|
int DrasculaEngine::init() {
|
|
|
|
// Initialize backend
|
|
|
|
_system->beginGFXTransaction();
|
2008-03-09 08:31:16 +00:00
|
|
|
initCommonGFX(false);
|
2007-07-17 21:35:01 +00:00
|
|
|
_system->initSize(320, 200);
|
|
|
|
_system->endGFXTransaction();
|
|
|
|
|
2008-05-24 21:23:06 +00:00
|
|
|
switch (getLanguage()) {
|
|
|
|
case Common::EN_ANY:
|
|
|
|
_lang = 0;
|
|
|
|
break;
|
|
|
|
case Common::ES_ESP:
|
|
|
|
_lang = 1;
|
|
|
|
break;
|
|
|
|
case Common::DE_DEU:
|
|
|
|
_lang = 2;
|
|
|
|
break;
|
|
|
|
case Common::FR_FRA:
|
|
|
|
_lang = 3;
|
|
|
|
break;
|
|
|
|
case Common::IT_ITA:
|
|
|
|
_lang = 4;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
warning("Unknown game language. Falling back to English");
|
|
|
|
_lang = 0;
|
|
|
|
}
|
|
|
|
|
2007-07-17 21:35:01 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int DrasculaEngine::go() {
|
2008-03-09 08:30:24 +00:00
|
|
|
num_ejec = 1; // values from 1 to 6 will start each part of game
|
2008-02-29 00:04:43 +00:00
|
|
|
hay_que_load = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-08-02 07:09:28 +00:00
|
|
|
for (;;) {
|
2008-05-11 08:36:53 +00:00
|
|
|
int i;
|
|
|
|
|
2007-08-02 07:09:28 +00:00
|
|
|
VGA = (byte *)malloc(320 * 200);
|
|
|
|
memset(VGA, 0, 64000);
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = 0;
|
|
|
|
menuBar = 0; menuScreen = 0; hasName = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
frame_y = 0;
|
|
|
|
hare_x = -1; hare_se_mueve = 0; sentido_hare = 3; num_frame = 0; hare_se_ve = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
checkFlags = 1;
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
walkToObject = 0;
|
|
|
|
stepX = PASO_HARE_X; stepY = PASO_HARE_Y;
|
|
|
|
alto_hare = CHARACTER_HEIGHT; ancho_hare = CHARACTER_WIDTH; feetHeight = PIES_HARE;
|
2008-05-02 13:21:06 +00:00
|
|
|
alto_talk = ALTO_TALK_HARE; ancho_talk = ANCHO_TALK_HARE;
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
|
|
|
conta_blind_vez = 0;
|
|
|
|
changeColor = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
rompo_y_salgo = 0;
|
|
|
|
vb_x = 120; sentido_vb = 1; vb_se_mueve = 0; frame_vb = 1;
|
|
|
|
frame_piano = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
frame_drunk = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
frame_velas = 0;
|
|
|
|
cont_sv = 0;
|
|
|
|
term_int = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
musicStopped = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
hay_seleccion = 0;
|
|
|
|
UsingMem = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
globalSpeed = 0;
|
|
|
|
frame_blind = 0;
|
|
|
|
frame_snore = 0;
|
|
|
|
frame_bat = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
c_mirar = 0;
|
|
|
|
c_poder = 0;
|
2007-10-13 21:54:37 +00:00
|
|
|
ald = NULL;
|
2008-03-08 11:33:18 +00:00
|
|
|
sku = NULL;
|
2007-08-02 07:09:28 +00:00
|
|
|
|
2008-05-11 09:46:50 +00:00
|
|
|
allocMemory();
|
2008-02-29 00:04:43 +00:00
|
|
|
|
|
|
|
hay_sb = 1;
|
2008-05-11 11:20:40 +00:00
|
|
|
withVoices = 0;
|
2008-02-29 00:04:43 +00:00
|
|
|
hay_seleccion = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
|
2007-09-05 20:45:47 +00:00
|
|
|
if (num_ejec != 6) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("95.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(tableSurface, 1);
|
2007-09-05 20:45:47 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
if (num_ejec == 1) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, COMPLETE_PAL);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("97.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2007-08-02 20:59:03 +00:00
|
|
|
} else if (num_ejec == 2) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, COMPLETE_PAL);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("pts.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface2, 1);
|
2007-08-17 11:19:17 +00:00
|
|
|
} else if (num_ejec == 3) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("aux13.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, COMPLETE_PAL);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("97.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2007-08-17 11:19:17 +00:00
|
|
|
} else if (num_ejec == 4) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, COMPLETE_PAL);
|
2007-08-17 11:19:17 +00:00
|
|
|
if (hay_que_load == 0)
|
2008-05-02 11:02:28 +00:00
|
|
|
animation_rayo();
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("97.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2007-09-04 17:26:38 +00:00
|
|
|
} else if (num_ejec == 5) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, COMPLETE_PAL);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("97.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2007-09-05 20:45:47 +00:00
|
|
|
} else if (num_ejec == 6) {
|
|
|
|
x_igor = 105, y_igor = 85, sentido_igor = 1;
|
|
|
|
x_dr = 62, y_dr = 99, sentido_dr = 1;
|
|
|
|
frame_pen = 0;
|
|
|
|
flag_tv = 0;
|
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
pendulumSurface = drawSurface3;
|
2007-09-05 20:45:47 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, COMPLETE_PAL);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("97.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2007-09-05 20:45:47 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("95.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(tableSurface, 1);
|
2008-01-28 00:14:17 +00:00
|
|
|
}
|
2008-05-11 11:20:40 +00:00
|
|
|
memset(iconName, 0, sizeof(iconName));
|
2008-05-11 08:36:53 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 6; i++)
|
2008-05-11 11:20:40 +00:00
|
|
|
strcpy(iconName[i + 1], _textverbs[_lang][i]);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-08-02 07:09:28 +00:00
|
|
|
paleta_hare();
|
2007-10-07 22:00:43 +00:00
|
|
|
if (!escoba()) {
|
2008-05-11 10:03:06 +00:00
|
|
|
releaseGame();
|
2007-08-02 07:09:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-11 10:03:06 +00:00
|
|
|
releaseGame();
|
2007-10-07 22:00:43 +00:00
|
|
|
if (num_ejec == 6)
|
|
|
|
break;
|
2008-03-09 08:30:24 +00:00
|
|
|
|
|
|
|
num_ejec++;
|
2007-08-02 07:09:28 +00:00
|
|
|
}
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2007-07-26 19:52:18 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-05-11 10:03:06 +00:00
|
|
|
void DrasculaEngine::releaseGame() {
|
2007-07-26 19:52:18 +00:00
|
|
|
if (hay_sb == 1)
|
|
|
|
ctvd_end();
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2008-05-11 12:47:26 +00:00
|
|
|
black();
|
2007-07-26 19:52:18 +00:00
|
|
|
MusicFadeout();
|
2008-05-11 10:03:06 +00:00
|
|
|
stopMusic();
|
2008-05-11 09:51:30 +00:00
|
|
|
freeMemory();
|
2007-08-02 07:09:28 +00:00
|
|
|
free(VGA);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 09:46:50 +00:00
|
|
|
void DrasculaEngine::allocMemory() {
|
2008-05-30 07:09:36 +00:00
|
|
|
screenSurface = (byte *)malloc(64000);
|
|
|
|
assert(screenSurface);
|
|
|
|
frontSurface = (byte *)malloc(64000);
|
|
|
|
assert(frontSurface);
|
|
|
|
backSurface = (byte *)malloc(64000);
|
|
|
|
assert(backSurface);
|
|
|
|
drawSurface1 = (byte *)malloc(64000);
|
|
|
|
assert(drawSurface1);
|
|
|
|
drawSurface2 = (byte *)malloc(64000);
|
|
|
|
assert(drawSurface2);
|
|
|
|
drawSurface3 = (byte *)malloc(64000);
|
|
|
|
assert(drawSurface3);
|
|
|
|
tableSurface = (byte *)malloc(64000);
|
|
|
|
assert(tableSurface);
|
|
|
|
extraSurface = (byte *)malloc(64000);
|
|
|
|
assert(extraSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 09:51:30 +00:00
|
|
|
void DrasculaEngine::freeMemory() {
|
2008-05-30 07:09:36 +00:00
|
|
|
free(screenSurface);
|
|
|
|
free(drawSurface1);
|
|
|
|
free(backSurface);
|
|
|
|
free(drawSurface2);
|
|
|
|
free(tableSurface);
|
|
|
|
free(drawSurface3);
|
|
|
|
free(extraSurface);
|
|
|
|
free(frontSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
void DrasculaEngine::loadPic(const char *NamePcc) {
|
2007-07-26 19:52:18 +00:00
|
|
|
unsigned int con, x = 0;
|
|
|
|
unsigned int fExit = 0;
|
2007-07-28 14:45:26 +00:00
|
|
|
byte ch, rep;
|
2007-07-26 19:52:18 +00:00
|
|
|
Common::File file;
|
2007-07-28 14:45:26 +00:00
|
|
|
byte *auxPun;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
file.open(NamePcc);
|
|
|
|
if (!file.isOpen())
|
|
|
|
error("missing game data %s %c", NamePcc, 7);
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
pcxBuffer = (byte *)malloc(65000);
|
|
|
|
auxPun = pcxBuffer;
|
2007-07-26 19:52:18 +00:00
|
|
|
file.seek(128);
|
|
|
|
while (!fExit) {
|
|
|
|
ch = file.readByte();
|
|
|
|
rep = 1;
|
|
|
|
if ((ch & 192) == 192) {
|
|
|
|
rep = (ch & 63);
|
|
|
|
ch = file.readByte();
|
|
|
|
}
|
|
|
|
for (con = 0; con < rep; con++) {
|
|
|
|
*auxPun++ = ch;
|
|
|
|
x++;
|
|
|
|
if (x > 64000)
|
|
|
|
fExit = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
file.read(cPal, 768);
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
void DrasculaEngine::decompressPic(byte *dir_escritura, int plt) {
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(dir_escritura, pcxBuffer, 64000);
|
|
|
|
free(pcxBuffer);
|
2008-05-11 11:20:40 +00:00
|
|
|
setRGB((byte *)cPal, plt);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrasculaEngine::paleta_hare() {
|
|
|
|
int color, componente;
|
|
|
|
|
|
|
|
for (color = 235; color < 253; color++)
|
2007-07-28 14:45:26 +00:00
|
|
|
for (componente = 0; componente < 3; componente++)
|
2008-05-27 06:35:00 +00:00
|
|
|
palHare[color][componente] = gamePalette[color][componente];
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
void DrasculaEngine::hare_oscuro() {
|
|
|
|
int color, componente;
|
|
|
|
|
|
|
|
for (color = 235; color < 253; color++ )
|
|
|
|
for (componente = 0; componente < 3; componente++)
|
2008-05-27 06:35:00 +00:00
|
|
|
gamePalette[color][componente] = palHareOscuro[color][componente];
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
updatePalette();
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::setRGB(byte *dir_lectura, int plt) {
|
2007-07-26 19:52:18 +00:00
|
|
|
int x, cnt = 0;
|
|
|
|
|
|
|
|
for (x = 0; x < plt; x++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
gamePalette[x][0] = dir_lectura[cnt++] / 4;
|
|
|
|
gamePalette[x][1] = dir_lectura[cnt++] / 4;
|
|
|
|
gamePalette[x][2] = dir_lectura[cnt++] / 4;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-11 11:20:40 +00:00
|
|
|
updatePalette();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::black() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int color, componente;
|
|
|
|
DacPalette256 palNegra;
|
|
|
|
|
|
|
|
for (color = 0; color < 256; color++)
|
2007-07-28 14:45:26 +00:00
|
|
|
for (componente = 0; componente < 3; componente++)
|
2007-07-26 19:52:18 +00:00
|
|
|
palNegra[color][componente] = 0;
|
|
|
|
|
2007-07-28 14:51:32 +00:00
|
|
|
palNegra[254][0] = 0x3F;
|
|
|
|
palNegra[254][1] = 0x3F;
|
|
|
|
palNegra[254][2] = 0x15;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
setPalette((byte *)&palNegra);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::updatePalette() {
|
2008-05-27 06:35:00 +00:00
|
|
|
setPalette((byte *)&gamePalette);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
void DrasculaEngine::setPalette(byte *PalBuf) {
|
2007-07-28 14:45:26 +00:00
|
|
|
byte pal[256 * 4];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
pal[i * 4 + 0] = PalBuf[i * 3 + 0] * 4;
|
|
|
|
pal[i * 4 + 1] = PalBuf[i * 3 + 1] * 4;
|
|
|
|
pal[i * 4 + 2] = PalBuf[i * 3 + 2] * 4;
|
|
|
|
pal[i * 4 + 3] = 0;
|
|
|
|
}
|
|
|
|
_system->setPalette(pal, 0, 256);
|
|
|
|
_system->updateScreen();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::copyBackground(int xorg, int yorg, int xdes, int ydes, int width,
|
|
|
|
int height, byte *src, byte *dest) {
|
|
|
|
dest += xdes + ydes * 320;
|
|
|
|
src += xorg + yorg * 320;
|
2008-05-27 06:35:00 +00:00
|
|
|
for (int x = 0; x < height; x++) {
|
2008-05-11 12:47:26 +00:00
|
|
|
memcpy(dest, src, width);
|
|
|
|
dest += 320;
|
|
|
|
src += 320;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::copyRect(int xorg, int yorg, int xdes, int ydes, int width,
|
|
|
|
int height, byte *src, byte *dest) {
|
2007-07-26 19:52:18 +00:00
|
|
|
int y, x;
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
dest += xdes + ydes * 320;
|
|
|
|
src += xorg + yorg * 320;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
for (y = 0; y < height; y++)
|
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
if (src[x + y * 320] != 255)
|
|
|
|
dest[x + y * 320] = src[x + y * 320];
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::copyRectClip(int *Array, byte *src, byte *dest) {
|
2007-07-26 19:52:18 +00:00
|
|
|
int y, x;
|
|
|
|
int xorg = Array[0];
|
|
|
|
int yorg = Array[1];
|
|
|
|
int xdes = Array[2];
|
|
|
|
int ydes = Array[3];
|
2008-05-11 12:47:26 +00:00
|
|
|
int width = Array[4];
|
|
|
|
int height = Array[5];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
if (ydes < 0) {
|
|
|
|
yorg += -ydes;
|
2008-05-11 12:47:26 +00:00
|
|
|
height += ydes;
|
2007-07-28 09:45:05 +00:00
|
|
|
ydes = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
if (xdes < 0) {
|
|
|
|
xorg += -xdes;
|
2008-05-11 12:47:26 +00:00
|
|
|
width += xdes;
|
2007-07-26 19:52:18 +00:00
|
|
|
xdes = 0;
|
|
|
|
}
|
2008-05-11 12:47:26 +00:00
|
|
|
if ((xdes + width) > 319)
|
|
|
|
width -= (xdes + width) - 320;
|
|
|
|
if ((ydes + height) > 199)
|
|
|
|
height -= (ydes + height) - 200;
|
|
|
|
|
|
|
|
dest += xdes + ydes * 320;
|
|
|
|
src += xorg + yorg * 320;
|
|
|
|
|
|
|
|
for (y = 0; y < height; y++)
|
|
|
|
for (x = 0; x < width; x++)
|
|
|
|
if (src[x + y * 320] != 255)
|
|
|
|
dest[x + y * 320] = src[x + y * 320];
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
|
2007-07-28 19:43:26 +00:00
|
|
|
byte *ptr = VGA;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-07-28 19:43:26 +00:00
|
|
|
ptr += xdes + ydes * 320;
|
2008-05-11 12:47:26 +00:00
|
|
|
buffer += xorg + yorg * 320;
|
2008-05-27 06:35:00 +00:00
|
|
|
for (int x = 0; x < height; x++) {
|
2008-05-11 12:47:26 +00:00
|
|
|
memcpy(ptr, buffer, width);
|
2007-07-28 19:43:26 +00:00
|
|
|
ptr += 320;
|
2008-05-11 12:47:26 +00:00
|
|
|
buffer += 320;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-07-28 14:45:26 +00:00
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
_system->updateScreen();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 07:09:28 +00:00
|
|
|
bool DrasculaEngine::escoba() {
|
2007-09-10 16:03:12 +00:00
|
|
|
int n;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-24 21:23:06 +00:00
|
|
|
if (_lang == kSpanish)
|
2008-05-30 07:09:36 +00:00
|
|
|
textSurface = extraSurface;
|
2008-05-24 21:23:06 +00:00
|
|
|
else
|
2008-05-30 07:09:36 +00:00
|
|
|
textSurface = tableSurface;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = -1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 2) {
|
|
|
|
int soc = 0;
|
|
|
|
for (n = 0; n < 6; n++) {
|
2008-05-11 10:53:59 +00:00
|
|
|
soc = soc + CHARACTER_WIDTH;
|
2007-09-10 16:03:12 +00:00
|
|
|
frame_x[n] = soc;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-03-01 14:32:38 +00:00
|
|
|
for (n = 1; n < 43; n++)
|
2008-05-27 12:22:34 +00:00
|
|
|
inventoryObjects[n] = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 10:28:25 +00:00
|
|
|
for (n = 0; n < NUM_FLAGS; n++)
|
2007-07-26 19:52:18 +00:00
|
|
|
flags[n] = 0;
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
if (num_ejec == 2) {
|
|
|
|
flags[16] = 1;
|
|
|
|
flags[17] = 1;
|
|
|
|
flags[27] = 1;
|
|
|
|
}
|
|
|
|
|
2007-07-26 19:52:18 +00:00
|
|
|
for (n = 1; n < 7; n++)
|
2008-05-27 12:22:34 +00:00
|
|
|
inventoryObjects[n] = n;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
if (num_ejec == 1) {
|
2008-05-11 11:20:40 +00:00
|
|
|
pickObject(28);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
if (hay_que_load == 0)
|
2008-05-02 11:02:28 +00:00
|
|
|
animation_1_1();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("2aux62.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface2, 1);
|
2007-08-02 20:59:03 +00:00
|
|
|
sentido_hare = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = 104;
|
2008-02-29 00:04:43 +00:00
|
|
|
if (hay_que_load != 0) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(saveName)) {
|
2008-02-29 00:04:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
2007-09-10 16:03:12 +00:00
|
|
|
carga_escoba("62.ald");
|
2007-08-02 20:59:03 +00:00
|
|
|
hare_x = -20;
|
|
|
|
hare_y = 56;
|
|
|
|
lleva_al_hare(65, 145);
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 2) {
|
2008-05-29 22:34:03 +00:00
|
|
|
addObject(28);
|
2007-08-02 20:59:03 +00:00
|
|
|
sentido_hare = 3;
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = 162;
|
2007-08-02 20:59:03 +00:00
|
|
|
if (hay_que_load == 0)
|
2007-09-10 16:03:12 +00:00
|
|
|
carga_escoba("14.ald");
|
2008-02-29 00:04:43 +00:00
|
|
|
else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(saveName)) {
|
2008-02-29 00:04:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
} else if (num_ejec == 3) {
|
2008-05-29 22:34:03 +00:00
|
|
|
addObject(28);
|
|
|
|
addObject(11);
|
|
|
|
addObject(14);
|
|
|
|
addObject(22);
|
|
|
|
addObject(9);
|
|
|
|
addObject(20);
|
|
|
|
addObject(19);
|
2007-08-17 11:19:17 +00:00
|
|
|
flags[1] = 1;
|
|
|
|
sentido_hare = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = 99;
|
2007-08-17 11:19:17 +00:00
|
|
|
if (hay_que_load == 0)
|
2007-09-10 16:03:12 +00:00
|
|
|
carga_escoba("20.ald");
|
2008-02-29 00:04:43 +00:00
|
|
|
else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(saveName)) {
|
2008-02-29 00:04:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2007-10-13 12:42:32 +00:00
|
|
|
} else if (num_ejec == 4) {
|
2008-05-29 22:34:03 +00:00
|
|
|
addObject(28);
|
|
|
|
addObject(9);
|
|
|
|
addObject(20);
|
|
|
|
addObject(22);
|
|
|
|
objExit = 100;
|
2007-08-17 11:19:17 +00:00
|
|
|
if (hay_que_load == 0) {
|
2007-09-10 16:03:12 +00:00
|
|
|
carga_escoba("21.ald");
|
2007-08-17 11:19:17 +00:00
|
|
|
sentido_hare = 0;
|
|
|
|
hare_x = 235;
|
|
|
|
hare_y = 164;
|
2008-02-29 00:04:43 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(saveName)) {
|
2008-02-29 00:04:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2007-09-04 17:26:38 +00:00
|
|
|
} else if (num_ejec == 5) {
|
2008-05-29 22:34:03 +00:00
|
|
|
addObject(28);
|
|
|
|
addObject(7);
|
|
|
|
addObject(9);
|
|
|
|
addObject(11);
|
|
|
|
addObject(13);
|
|
|
|
addObject(14);
|
|
|
|
addObject(15);
|
|
|
|
addObject(17);
|
|
|
|
addObject(20);
|
2007-09-04 17:26:38 +00:00
|
|
|
sentido_hare = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = 100;
|
2007-09-04 17:26:38 +00:00
|
|
|
if (hay_que_load == 0) {
|
2007-09-10 16:03:12 +00:00
|
|
|
carga_escoba("45.ald");
|
2008-02-29 00:04:43 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(saveName)) {
|
2008-02-29 00:04:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2007-09-05 20:45:47 +00:00
|
|
|
} else if (num_ejec == 6) {
|
2008-05-29 22:34:03 +00:00
|
|
|
addObject(28);
|
|
|
|
addObject(9);
|
2007-09-05 20:45:47 +00:00
|
|
|
|
|
|
|
sentido_hare = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = 104;
|
2008-03-08 19:47:44 +00:00
|
|
|
if (hay_que_load == 0) {
|
2007-09-10 16:03:12 +00:00
|
|
|
carga_escoba("58.ald");
|
2008-05-02 11:02:28 +00:00
|
|
|
animation_1_6();
|
2008-03-08 19:47:44 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(saveName)) {
|
2008-02-29 00:04:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("auxdr.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface2, 1);
|
2007-09-05 20:45:47 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bucles:
|
|
|
|
if (hare_se_mueve == 0) {
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
if (hare_se_mueve == 0 && walkToObject == 1) {
|
2007-07-26 19:52:18 +00:00
|
|
|
sentido_hare = sentido_final;
|
2008-05-29 22:34:03 +00:00
|
|
|
walkToObject = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
if (num_ejec == 2) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 3 && (hare_x == 279) && (hare_y + alto_hare == 101))
|
2008-05-02 11:02:28 +00:00
|
|
|
animation_1_2();
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 14 && (hare_x == 214) && (hare_y + alto_hare == 121))
|
2007-08-02 20:59:03 +00:00
|
|
|
lleva_al_hare(190, 130);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 14 && (hare_x == 246) && (hare_y + alto_hare == 112))
|
2007-08-02 20:59:03 +00:00
|
|
|
lleva_al_hare(190, 130);
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
moveCursor();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-03-09 11:13:20 +00:00
|
|
|
|
|
|
|
if (num_ejec == 2) {
|
2008-05-11 12:47:26 +00:00
|
|
|
if (musicStatus() == 0 && roomMusic != 0)
|
|
|
|
playMusic(roomMusic);
|
2008-03-09 11:13:20 +00:00
|
|
|
} else {
|
2008-05-11 10:03:06 +00:00
|
|
|
if (musicStatus() == 0)
|
2008-05-11 12:47:26 +00:00
|
|
|
playMusic(roomMusic);
|
2008-03-09 11:13:20 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (menuScreen == 0 && takeObject == 1)
|
|
|
|
checkObjects();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (button_dch == 1 && menuScreen == 1) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-29 22:34:03 +00:00
|
|
|
loadPic(menuBackground);
|
2007-09-10 16:03:12 +00:00
|
|
|
else
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-27 06:35:00 +00:00
|
|
|
setPalette((byte *)&gamePalette);
|
2008-05-29 22:34:03 +00:00
|
|
|
menuScreen = 0;
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
if (button_dch == 1 && menuScreen == 0) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2007-07-26 19:52:18 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
if (sentido_hare == 2)
|
|
|
|
sentido_hare = 1;
|
2007-08-17 11:19:17 +00:00
|
|
|
if (num_ejec == 4)
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("icons2.alg");
|
2007-09-04 17:26:38 +00:00
|
|
|
else if (num_ejec == 5)
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("icons3.alg");
|
2007-09-05 20:45:47 +00:00
|
|
|
else if (num_ejec == 6)
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("iconsp.alg");
|
2007-09-10 16:03:12 +00:00
|
|
|
else
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("icons.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-29 22:34:03 +00:00
|
|
|
menuScreen = 1;
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (button_izq == 1 && menuBar == 1) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2007-07-26 19:52:18 +00:00
|
|
|
elige_en_barra();
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (button_izq == 1 && takeObject == 0) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2007-08-02 07:09:28 +00:00
|
|
|
if (comprueba1())
|
|
|
|
return true;
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (button_izq == 1 && takeObject == 1) {
|
2007-10-07 22:00:43 +00:00
|
|
|
if (comprueba2())
|
|
|
|
return true;
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (mouseY < 24 && menuScreen == 0)
|
|
|
|
menuBar = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
menuBar = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
Common::KeyCode key = getScan();
|
|
|
|
if (key == Common::KEYCODE_F1 && menuScreen == 0) {
|
|
|
|
selectVerb(1);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (key == Common::KEYCODE_F2 && menuScreen == 0) {
|
|
|
|
selectVerb(2);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (key == Common::KEYCODE_F3 && menuScreen == 0) {
|
|
|
|
selectVerb(3);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (key == Common::KEYCODE_F4 && menuScreen == 0) {
|
|
|
|
selectVerb(4);
|
2007-07-26 19:52:18 +00:00
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (key == Common::KEYCODE_F5 && menuScreen == 0) {
|
|
|
|
selectVerb(5);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
} else if (key == Common::KEYCODE_F6 && menuScreen == 0) {
|
|
|
|
selectVerb(6);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-08-01 22:11:04 +00:00
|
|
|
} else if (key == Common::KEYCODE_F9) {
|
2007-07-26 19:52:18 +00:00
|
|
|
mesa();
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-08-01 22:11:04 +00:00
|
|
|
} else if (key == Common::KEYCODE_F10) {
|
2008-02-29 00:04:43 +00:00
|
|
|
if (!saves())
|
|
|
|
return true;
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-08-01 22:11:04 +00:00
|
|
|
} else if (key == Common::KEYCODE_F8) {
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-08-01 22:11:04 +00:00
|
|
|
} else if (key == Common::KEYCODE_v) {
|
2008-05-11 11:20:40 +00:00
|
|
|
withVoices = 1;
|
2008-05-02 15:09:20 +00:00
|
|
|
print_abc(_textsys[_lang][2], 96, 86);
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
delay(1410);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-08-01 22:11:04 +00:00
|
|
|
} else if (key == Common::KEYCODE_t) {
|
2008-05-11 11:20:40 +00:00
|
|
|
withVoices = 0;
|
2008-05-02 15:09:20 +00:00
|
|
|
print_abc(_textsys[_lang][3], 94, 86);
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
delay(1460);
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2007-08-01 22:11:04 +00:00
|
|
|
} else if (key == Common::KEYCODE_ESCAPE) {
|
2008-02-29 15:11:44 +00:00
|
|
|
if (!confirma_salir())
|
|
|
|
return false;
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
} else if (num_ejec == 6 && key == Common::KEYCODE_0 && roomNumber == 61) {
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("alcbar.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, 255);
|
2007-07-26 19:52:18 +00:00
|
|
|
} else if (cont_sv == 1500) {
|
2008-05-29 22:34:03 +00:00
|
|
|
screenSaver();
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv = 0;
|
|
|
|
} else {
|
|
|
|
if (num_ejec != 3)
|
|
|
|
cont_sv++;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
goto bucles;
|
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::pickObject(int objeto) {
|
2007-09-05 20:45:47 +00:00
|
|
|
if (num_ejec == 6)
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("iconsp.alg");
|
2008-03-09 08:27:27 +00:00
|
|
|
else if (num_ejec == 4)
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("icons2.alg");
|
2008-03-09 08:27:27 +00:00
|
|
|
else if (num_ejec == 5)
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("icons3.alg");
|
2007-08-17 11:19:17 +00:00
|
|
|
else
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("icons.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-11 11:20:40 +00:00
|
|
|
chooseObject(objeto);
|
2008-03-09 08:27:27 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-29 22:34:03 +00:00
|
|
|
loadPic(menuBackground);
|
2008-03-09 08:27:27 +00:00
|
|
|
else
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::chooseObject(int objeto) {
|
2007-09-04 17:26:38 +00:00
|
|
|
if (num_ejec == 5) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1 && menuScreen == 0 && pickedObject != 16)
|
|
|
|
addObject(pickedObject);
|
2007-09-04 17:26:38 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1 && menuScreen == 0)
|
|
|
|
addObject(pickedObject);
|
2007-09-04 17:26:38 +00:00
|
|
|
}
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(x1d_menu[objeto], y1d_menu[objeto], 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3);
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = 1;
|
2008-05-27 12:02:26 +00:00
|
|
|
pickedObject = objeto;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
int DrasculaEngine::removeObject(int osj) {
|
2008-05-27 06:35:00 +00:00
|
|
|
int result = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
for (int h = 1; h < 43; h++) {
|
2008-05-27 12:22:34 +00:00
|
|
|
if (inventoryObjects[h] == osj) {
|
|
|
|
inventoryObjects[h] = 0;
|
2008-05-27 06:35:00 +00:00
|
|
|
result = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
return result;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::withoutVerb() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int c = 171;
|
2008-05-29 22:34:03 +00:00
|
|
|
if (menuScreen == 1)
|
2007-07-26 19:52:18 +00:00
|
|
|
c = 0;
|
2007-09-04 17:26:38 +00:00
|
|
|
if (num_ejec == 5) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1 && pickedObject != 16)
|
|
|
|
addObject(pickedObject);
|
2007-09-04 17:26:38 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1)
|
|
|
|
addObject(pickedObject);
|
2007-09-04 17:26:38 +00:00
|
|
|
}
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, c, 0, 0, OBJWIDTH,OBJHEIGHT, backSurface, drawSurface3);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = 0;
|
|
|
|
hasName = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
bool DrasculaEngine::para_cargar(char gameName[]) {
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2008-05-29 22:34:03 +00:00
|
|
|
menuScreen = 0;
|
2007-10-07 22:00:43 +00:00
|
|
|
if (num_ejec != 1)
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!loadGame(gameName))
|
2008-02-29 00:04:43 +00:00
|
|
|
return false;
|
2007-10-13 21:54:37 +00:00
|
|
|
if (num_ejec == 2 || num_ejec == 3 || num_ejec == 5) {
|
2007-09-10 16:03:12 +00:00
|
|
|
delete ald;
|
2007-10-13 21:54:37 +00:00
|
|
|
ald = NULL;
|
|
|
|
}
|
2008-05-11 11:20:40 +00:00
|
|
|
carga_escoba(currentData);
|
|
|
|
withoutVerb();
|
2008-02-29 00:04:43 +00:00
|
|
|
|
|
|
|
return true;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-07-28 19:43:26 +00:00
|
|
|
static char *getLine(Common::File *fp, char *buf, int len) {
|
2008-02-28 22:53:51 +00:00
|
|
|
byte c;
|
2007-07-28 19:43:26 +00:00
|
|
|
char *b;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
b = buf;
|
|
|
|
while (!fp->eos()) {
|
2008-02-28 22:53:51 +00:00
|
|
|
c = ~fp->readByte();
|
2008-05-27 09:03:22 +00:00
|
|
|
if (c == '\r')
|
2007-07-28 19:43:26 +00:00
|
|
|
continue;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (c == '\n' || b - buf >= (len - 1))
|
|
|
|
break;
|
2007-07-28 19:43:26 +00:00
|
|
|
*b++ = c;
|
|
|
|
}
|
|
|
|
*b = '\0';
|
|
|
|
if (fp->eos() && b == buf)
|
|
|
|
return NULL;
|
|
|
|
if (b != buf)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
void DrasculaEngine::carga_escoba(const char *nom_fich) {
|
2008-03-08 18:00:04 +00:00
|
|
|
int soc, l, martin = 0, obj_salir = 0;
|
2008-01-19 20:00:36 +00:00
|
|
|
float chiquez = 0, pequegnez = 0;
|
2007-09-10 16:03:12 +00:00
|
|
|
char pant1[20], pant2[20], pant3[20], pant4[20];
|
|
|
|
char para_codificar[20];
|
2007-07-28 19:43:26 +00:00
|
|
|
char buffer[256];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
hasName = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
strcpy(para_codificar, nom_fich);
|
2008-05-11 11:20:40 +00:00
|
|
|
strcpy(currentData, nom_fich);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-07-28 14:45:26 +00:00
|
|
|
ald = new Common::File;
|
|
|
|
ald->open(nom_fich);
|
|
|
|
if (!ald->isOpen()) {
|
2007-07-28 09:45:05 +00:00
|
|
|
error("missing data file");
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2007-07-28 14:45:26 +00:00
|
|
|
int size = ald->size();
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 09:03:22 +00:00
|
|
|
roomNumber = atoi(buffer);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-11 12:47:26 +00:00
|
|
|
sscanf(buffer, "%d", &roomMusic);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-02 11:44:47 +00:00
|
|
|
sscanf(buffer, "%s", roomDisk);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &nivel_osc);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2) {
|
|
|
|
getLine(ald, buffer, size);
|
|
|
|
sscanf(buffer, "%d", &martin);
|
|
|
|
if (martin == 0)
|
|
|
|
goto martini;
|
|
|
|
ancho_hare = martin;
|
|
|
|
getLine(ald, buffer, size);
|
|
|
|
sscanf(buffer, "%d",&alto_hare);
|
|
|
|
getLine(ald, buffer, size);
|
2008-05-29 22:34:03 +00:00
|
|
|
sscanf(buffer, "%d",&feetHeight);
|
2007-09-10 16:03:12 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-29 22:34:03 +00:00
|
|
|
sscanf(buffer, "%d",&stepX);
|
2007-09-10 16:03:12 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-29 22:34:03 +00:00
|
|
|
sscanf(buffer, "%d",&stepY);
|
2007-09-10 16:03:12 +00:00
|
|
|
|
|
|
|
getLine(ald, buffer, size);
|
|
|
|
sscanf(buffer, "%s",pant1);
|
|
|
|
getLine(ald, buffer, size);
|
|
|
|
sscanf(buffer, "%s",pant2);
|
|
|
|
getLine(ald, buffer, size);
|
|
|
|
sscanf(buffer, "%s",pant3);
|
|
|
|
getLine(ald, buffer, size);
|
|
|
|
sscanf(buffer, "%s",pant4);
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic(pant2);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic(pant1);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic(pant4);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(menuBackground, pant4);
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
martini:
|
|
|
|
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-11 20:05:09 +00:00
|
|
|
sscanf(buffer, "%d", &numRoomObjs);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-29 22:34:03 +00:00
|
|
|
sscanf(buffer, "%d", &objectNum[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-11 11:20:40 +00:00
|
|
|
sscanf(buffer, "%s", objName[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &x1[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &y1[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &x2[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &y2[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &sitiobj_x[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &sitiobj_y[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &sentidobj[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &visible[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-11 12:47:26 +00:00
|
|
|
sscanf(buffer, "%d", &isDoor[l]);
|
|
|
|
if (isDoor[l] != 0) {
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-29 22:34:03 +00:00
|
|
|
sscanf(buffer, "%s", targetScreen[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &x_alakeva[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &y_alakeva[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &sentido_alkeva[l]);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &alapuertakeva[l]);
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &suelo_x1);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &suelo_y1);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &suelo_x2);
|
2007-07-28 19:43:26 +00:00
|
|
|
getLine(ald, buffer, size);
|
2007-07-28 14:45:26 +00:00
|
|
|
sscanf(buffer, "%d", &suelo_y2);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 2) {
|
|
|
|
getLine(ald, buffer, size);
|
2008-05-11 12:47:26 +00:00
|
|
|
sscanf(buffer, "%d", &far);
|
2007-09-10 16:03:12 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-11 12:47:26 +00:00
|
|
|
sscanf(buffer, "%d", &near);
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
2007-07-28 19:43:26 +00:00
|
|
|
delete ald;
|
2007-10-13 21:54:37 +00:00
|
|
|
ald = NULL;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2) {
|
|
|
|
if (martin == 0) {
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-11 10:53:59 +00:00
|
|
|
alto_hare = CHARACTER_HEIGHT;
|
|
|
|
ancho_hare = CHARACTER_WIDTH;
|
2008-05-29 22:34:03 +00:00
|
|
|
feetHeight = PIES_HARE;
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("97.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("96.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(menuBackground, "99.alg");
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == objExit)
|
2007-07-26 19:52:18 +00:00
|
|
|
obj_salir = l;
|
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2) {
|
|
|
|
if (hare_x == -1) {
|
|
|
|
hare_x = x_alakeva[obj_salir];
|
|
|
|
hare_y = y_alakeva[obj_salir] - alto_hare;
|
|
|
|
}
|
|
|
|
hare_se_mueve = 0;
|
|
|
|
}
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic(roomDisk);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface3, 1);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-27 09:03:22 +00:00
|
|
|
char rm[20];
|
|
|
|
sprintf(rm, "%i.alg", roomNumber);
|
|
|
|
loadPic(rm);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, HALF_PAL);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
color_hare();
|
|
|
|
if (nivel_osc != 0)
|
|
|
|
funde_hare(nivel_osc);
|
|
|
|
paleta_hare_claro();
|
|
|
|
color_hare();
|
|
|
|
funde_hare(nivel_osc + 2);
|
|
|
|
paleta_hare_oscuro();
|
|
|
|
|
|
|
|
hare_claro();
|
2008-05-29 22:34:03 +00:00
|
|
|
changeColor = -1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorLightGreen);
|
2007-09-10 16:03:12 +00:00
|
|
|
|
|
|
|
if (num_ejec != 2) {
|
|
|
|
for (l = 0; l <= suelo_y1; l++)
|
2008-05-11 12:47:26 +00:00
|
|
|
factor_red[l] = far;
|
2007-09-10 16:03:12 +00:00
|
|
|
for (l = suelo_y1; l <= 201; l++)
|
2008-05-11 12:47:26 +00:00
|
|
|
factor_red[l] = near;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
chiquez = (float)(near - far) / (float)(suelo_y2 - suelo_y1);
|
2007-09-10 16:03:12 +00:00
|
|
|
for (l = suelo_y1; l <= suelo_y2; l++) {
|
2008-05-11 12:47:26 +00:00
|
|
|
factor_red[l] = (int)(far + pequegnez);
|
2007-09-10 16:03:12 +00:00
|
|
|
pequegnez = pequegnez + chiquez;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 24) {
|
2007-08-17 11:19:17 +00:00
|
|
|
for (l = suelo_y1 - 1; l > 74; l--) {
|
2008-05-11 12:47:26 +00:00
|
|
|
factor_red[l] = (int)(far - pequegnez);
|
2007-08-17 11:19:17 +00:00
|
|
|
pequegnez = pequegnez + chiquez;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-27 09:03:22 +00:00
|
|
|
if (num_ejec == 5 && roomNumber == 54) {
|
2007-09-04 17:26:38 +00:00
|
|
|
for (l = suelo_y1 - 1; l > 84; l--) {
|
2008-05-11 12:47:26 +00:00
|
|
|
factor_red[l] = (int)(far - pequegnez);
|
2007-09-04 17:26:38 +00:00
|
|
|
pequegnez = pequegnez + chiquez;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec != 2) {
|
|
|
|
if (hare_x == -1) {
|
|
|
|
hare_x = x_alakeva[obj_salir];
|
|
|
|
hare_y = y_alakeva[obj_salir];
|
2008-05-11 10:53:59 +00:00
|
|
|
alto_hare = (CHARACTER_HEIGHT * factor_red[hare_y]) / 100;
|
|
|
|
ancho_hare = (CHARACTER_WIDTH * factor_red[hare_y]) / 100;
|
2007-09-10 16:03:12 +00:00
|
|
|
hare_y = hare_y - alto_hare;
|
|
|
|
} else {
|
2008-05-11 10:53:59 +00:00
|
|
|
alto_hare = (CHARACTER_HEIGHT * factor_red[hare_y]) / 100;
|
|
|
|
ancho_hare = (CHARACTER_WIDTH * factor_red[hare_y]) / 100;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2007-09-10 16:03:12 +00:00
|
|
|
hare_se_mueve = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2) {
|
|
|
|
soc = 0;
|
|
|
|
for (l = 0; l < 6; l++) {
|
|
|
|
soc = soc + ancho_hare;
|
|
|
|
frame_x[l] = soc;
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 5)
|
|
|
|
hare_se_ve = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
updateData();
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
isDoor[7] = 0;
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2008-03-09 10:16:27 +00:00
|
|
|
if (num_ejec == 2) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 14 && flags[39] == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
roomMusic = 16;
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 15 && flags[39] == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
roomMusic = 16;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 14 && flags[5] == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
roomMusic = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 15 && flags[5] == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
roomMusic = 0;
|
2008-03-09 10:16:27 +00:00
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
if (previousMusic != roomMusic && roomMusic != 0)
|
|
|
|
playMusic(roomMusic);
|
|
|
|
if (roomMusic == 0)
|
2008-05-11 10:03:06 +00:00
|
|
|
stopMusic();
|
2008-03-09 10:16:27 +00:00
|
|
|
} else {
|
2008-05-11 12:47:26 +00:00
|
|
|
if (previousMusic != roomMusic && roomMusic != 0)
|
|
|
|
playMusic(roomMusic);
|
2008-03-09 10:16:27 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-03-09 08:52:52 +00:00
|
|
|
if (num_ejec == 2) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 9 || roomNumber == 2 || roomNumber == 14 || roomNumber == 18)
|
2008-05-29 22:34:03 +00:00
|
|
|
conta_blind_vez = vez();
|
2008-03-09 08:52:52 +00:00
|
|
|
}
|
|
|
|
if (num_ejec == 4) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 26)
|
2008-05-29 22:34:03 +00:00
|
|
|
conta_blind_vez = vez();
|
2008-03-08 19:47:44 +00:00
|
|
|
}
|
2008-03-09 10:16:27 +00:00
|
|
|
|
2008-05-27 09:03:22 +00:00
|
|
|
if (num_ejec == 4 && roomNumber == 24 && flags[29] == 1)
|
2008-05-02 11:02:28 +00:00
|
|
|
animation_7_4();
|
2008-03-09 10:16:27 +00:00
|
|
|
|
|
|
|
if (num_ejec == 5) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 45)
|
2008-03-09 10:16:27 +00:00
|
|
|
hare_se_ve = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 49 && flags[7] == 0)
|
2008-05-02 11:02:28 +00:00
|
|
|
animation_4_5();
|
2008-03-09 10:16:27 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
void DrasculaEngine::clearRoom() {
|
2007-07-26 19:52:18 +00:00
|
|
|
memset(VGA, 0, 64000);
|
2007-07-28 14:45:26 +00:00
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
_system->updateScreen();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::lleva_al_hare(int pointX, int pointY) {
|
2007-09-05 20:45:47 +00:00
|
|
|
if (num_ejec == 5 || num_ejec == 6) {
|
2007-09-10 16:03:12 +00:00
|
|
|
if (hare_se_ve == 0) {
|
2007-09-04 17:26:38 +00:00
|
|
|
hare_x = sitio_x;
|
|
|
|
hare_y = sitio_y;
|
|
|
|
goto fin;
|
|
|
|
}
|
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
sitio_x = pointX;
|
|
|
|
sitio_y = pointY;
|
|
|
|
startWalking();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-09-04 17:26:38 +00:00
|
|
|
for (;;) {
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
if (hare_se_mueve == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (walkToObject == 1) {
|
|
|
|
walkToObject = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
sentido_hare = sentido_final;
|
|
|
|
}
|
2007-09-04 17:26:38 +00:00
|
|
|
fin:
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::moveCursor() {
|
|
|
|
int cursorPos[8];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRefresh_pre();
|
2007-07-26 19:52:18 +00:00
|
|
|
pon_hare();
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRefresh();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!strcmp(textName, "hacker") && hasName == 1) {
|
2008-05-30 07:16:17 +00:00
|
|
|
if (_color != kColorRed && menuScreen == 0)
|
|
|
|
color_abc(kColorRed);
|
|
|
|
} else if (menuScreen == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
2008-05-29 22:34:03 +00:00
|
|
|
if (hasName == 1 && menuScreen == 0)
|
|
|
|
centerText(textName, mouseX, mouseY);
|
|
|
|
if (menuScreen == 1)
|
2007-07-26 19:52:18 +00:00
|
|
|
menu_sin_volcar();
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (menuBar == 1)
|
|
|
|
clearMenu();
|
|
|
|
|
|
|
|
cursorPos[0] = 0;
|
|
|
|
cursorPos[1] = 0;
|
|
|
|
cursorPos[2] = mouseX - 20;
|
|
|
|
cursorPos[3] = mouseY - 17;
|
|
|
|
cursorPos[4] = OBJWIDTH;
|
|
|
|
cursorPos[5] = OBJHEIGHT;
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(cursorPos, drawSurface3, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::checkObjects() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int l, veo = 0;
|
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > x1[l] && mouseY > y1[l]
|
|
|
|
&& mouseX < x2[l] && mouseY < y2[l]
|
2008-05-11 12:47:26 +00:00
|
|
|
&& visible[l] == 1 && isDoor[l] == 0) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(textName, objName[l]);
|
|
|
|
hasName = 1;
|
2007-07-28 19:43:26 +00:00
|
|
|
veo = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2007-09-10 16:03:12 +00:00
|
|
|
if (num_ejec == 2) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > hare_x + 2 && mouseY > hare_y + 2
|
|
|
|
&& mouseX < hare_x + ancho_hare - 2 && mouseY < hare_y + alto_hare - 2) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(textName, "hacker");
|
|
|
|
hasName = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
veo = 1;
|
|
|
|
}
|
2007-09-10 16:03:12 +00:00
|
|
|
} else {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > hare_x + 2 && mouseY > hare_y + 2
|
|
|
|
&& mouseX < hare_x + ancho_hare - 2 && mouseY < hare_y + alto_hare - 2 && veo == 0) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(textName, "hacker");
|
|
|
|
hasName = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
veo = 1;
|
|
|
|
}
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
if (veo == 0)
|
2008-05-29 22:34:03 +00:00
|
|
|
hasName = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrasculaEngine::elige_en_barra() {
|
|
|
|
int n, num_verbo = -1;
|
|
|
|
|
|
|
|
for (n = 0; n < 7; n++)
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > x_barra[n] && mouseX < x_barra[n + 1])
|
2007-07-26 19:52:18 +00:00
|
|
|
num_verbo = n;
|
|
|
|
|
|
|
|
if (num_verbo < 1)
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2007-07-26 19:52:18 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
selectVerb(num_verbo);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 07:09:28 +00:00
|
|
|
bool DrasculaEngine::comprueba1() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int l;
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (menuScreen == 1)
|
2008-05-29 14:04:47 +00:00
|
|
|
removeObject();
|
2007-07-26 19:52:18 +00:00
|
|
|
else {
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX >= x1[l] && mouseY >= y1[l]
|
2008-05-30 07:19:09 +00:00
|
|
|
&& mouseX <= x2[l] && mouseY <= y2[l] && doBreak == 0) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (exitRoom(l))
|
2007-08-02 07:09:28 +00:00
|
|
|
return true;
|
2008-05-30 07:19:09 +00:00
|
|
|
if (doBreak == 1)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > hare_x && mouseY > hare_y
|
|
|
|
&& mouseX < hare_x + ancho_hare && mouseY < hare_y + alto_hare)
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > x1[l] && mouseY > y1[l]
|
2008-05-30 07:19:09 +00:00
|
|
|
&& mouseX < x2[l] && mouseY < y2[l] && doBreak == 0) {
|
2007-07-26 19:52:18 +00:00
|
|
|
sitio_x = sitiobj_x[l];
|
|
|
|
sitio_y = sitiobj_y[l];
|
|
|
|
sentido_final = sentidobj[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
walkToObject = 1;
|
|
|
|
startWalking();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-30 07:19:09 +00:00
|
|
|
if (doBreak == 0) {
|
2008-05-27 06:35:00 +00:00
|
|
|
sitio_x = mouseX;
|
|
|
|
sitio_y = mouseY;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
if (sitio_x < suelo_x1)
|
|
|
|
sitio_x = suelo_x1;
|
|
|
|
if (sitio_x > suelo_x2)
|
|
|
|
sitio_x = suelo_x2;
|
2008-05-29 22:34:03 +00:00
|
|
|
if (sitio_y < suelo_y1 + feetHeight)
|
|
|
|
sitio_y = suelo_y1 + feetHeight;
|
2007-07-26 19:52:18 +00:00
|
|
|
if (sitio_y > suelo_y2)
|
|
|
|
sitio_y = suelo_y2;
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
startWalking();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2007-08-02 07:09:28 +00:00
|
|
|
|
|
|
|
return false;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-10-07 22:00:43 +00:00
|
|
|
bool DrasculaEngine::comprueba2() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int l;
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (menuScreen == 1) {
|
|
|
|
if (pickupObject())
|
2007-10-07 22:00:43 +00:00
|
|
|
return true;
|
2007-10-13 12:42:32 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!strcmp(textName, "hacker") && hasName == 1) {
|
|
|
|
if (checkFlag(50))
|
2007-10-07 22:00:43 +00:00
|
|
|
return true;
|
2007-10-13 12:42:32 +00:00
|
|
|
} else {
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > x1[l] && mouseY > y1[l]
|
|
|
|
&& mouseX < x2[l] && mouseY < y2[l] && visible[l] == 1) {
|
2007-07-26 19:52:18 +00:00
|
|
|
sentido_final = sentidobj[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
walkToObject = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
2008-05-29 22:34:03 +00:00
|
|
|
if (checkFlag(objectNum[l]))
|
2007-10-07 22:00:43 +00:00
|
|
|
return true;
|
2007-08-17 11:19:17 +00:00
|
|
|
if (num_ejec == 4)
|
|
|
|
break;
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2007-10-13 12:42:32 +00:00
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
|
|
|
return false;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
Common::KeyCode DrasculaEngine::getScan() {
|
2008-05-11 09:51:30 +00:00
|
|
|
updateEvents();
|
2007-07-28 19:43:26 +00:00
|
|
|
|
2007-08-01 22:11:04 +00:00
|
|
|
return _keyPressed.keycode;
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 09:51:30 +00:00
|
|
|
void DrasculaEngine::updateEvents() {
|
2007-07-28 14:45:26 +00:00
|
|
|
Common::Event event;
|
2007-07-28 19:43:26 +00:00
|
|
|
Common::EventManager *eventMan = _system->getEventManager();
|
2007-07-28 14:45:26 +00:00
|
|
|
|
2007-08-01 20:11:32 +00:00
|
|
|
AudioCD.updateCD();
|
|
|
|
|
2007-07-28 19:43:26 +00:00
|
|
|
while (eventMan->pollEvent(event)) {
|
2007-07-28 14:45:26 +00:00
|
|
|
switch (event.type) {
|
|
|
|
case Common::EVENT_KEYDOWN:
|
2007-07-28 19:43:26 +00:00
|
|
|
_keyPressed = event.kbd;
|
|
|
|
break;
|
|
|
|
case Common::EVENT_KEYUP:
|
2007-08-01 22:11:04 +00:00
|
|
|
_keyPressed.keycode = Common::KEYCODE_INVALID;
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
2007-07-28 19:43:26 +00:00
|
|
|
case Common::EVENT_MOUSEMOVE:
|
2008-05-27 06:35:00 +00:00
|
|
|
mouseX = event.mouse.x;
|
|
|
|
mouseY = event.mouse.y;
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
|
|
|
case Common::EVENT_LBUTTONDOWN:
|
2008-05-27 12:22:34 +00:00
|
|
|
button_izq = 1;
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
|
|
|
case Common::EVENT_LBUTTONUP:
|
2008-05-27 12:22:34 +00:00
|
|
|
button_izq = 0;
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
2007-07-28 19:43:26 +00:00
|
|
|
case Common::EVENT_RBUTTONDOWN:
|
2008-05-27 12:22:34 +00:00
|
|
|
button_dch = 1;
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
2007-07-28 19:43:26 +00:00
|
|
|
case Common::EVENT_RBUTTONUP:
|
2008-05-27 12:22:34 +00:00
|
|
|
button_dch = 0;
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
|
|
|
case Common::EVENT_QUIT:
|
2007-07-28 22:18:43 +00:00
|
|
|
// TODO
|
2008-05-11 10:03:06 +00:00
|
|
|
releaseGame();
|
2007-07-28 22:18:43 +00:00
|
|
|
exit(0);
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
2007-07-28 22:10:30 +00:00
|
|
|
default:
|
2007-07-28 14:45:26 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::selectVerb(int verbo) {
|
2007-07-26 19:52:18 +00:00
|
|
|
int c = 171;
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (menuScreen == 1)
|
2007-07-26 19:52:18 +00:00
|
|
|
c = 0;
|
2007-09-04 17:26:38 +00:00
|
|
|
if (num_ejec == 5) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1 && pickedObject != 16)
|
|
|
|
addObject(pickedObject);
|
2007-09-04 17:26:38 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1)
|
|
|
|
addObject(pickedObject);
|
2007-09-04 17:26:38 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(OBJWIDTH * verbo, c, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = 1;
|
2008-05-27 12:02:26 +00:00
|
|
|
pickedObject = verbo;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrasculaEngine::mesa() {
|
|
|
|
int nivel_master, nivel_voc, nivel_cd;
|
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface);
|
|
|
|
updateScreen(73, 63, 73, 63, 177, 97, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
for (;;) {
|
2007-08-01 19:31:36 +00:00
|
|
|
nivel_master = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4);
|
|
|
|
nivel_voc = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4);
|
|
|
|
nivel_cd = 72 + 61 - ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRect(1, 56, 73, 63, 177, 97, tableSurface, screenSurface);
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(183, 56, 82, nivel_master, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16) * 4), tableSurface, screenSurface);
|
|
|
|
copyBackground(183, 56, 138, nivel_voc, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16) * 4), tableSurface, screenSurface);
|
|
|
|
copyBackground(183, 56, 194, nivel_cd, 39, 2 + ((_mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16) * 4), tableSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
setCursorTable();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (button_dch == 1) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
2008-02-28 22:00:01 +00:00
|
|
|
}
|
2008-05-27 12:22:34 +00:00
|
|
|
if (button_izq == 1) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > 80 && mouseX < 121) {
|
2007-08-01 19:31:36 +00:00
|
|
|
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kPlainSoundType) / 16;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY < nivel_master && vol < 15)
|
2007-08-01 19:31:36 +00:00
|
|
|
vol++;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY > nivel_master && vol > 0)
|
2007-08-01 19:31:36 +00:00
|
|
|
vol--;
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kPlainSoundType, vol * 16);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > 136 && mouseX < 178) {
|
2007-08-01 19:31:36 +00:00
|
|
|
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kSFXSoundType) / 16;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY < nivel_voc && vol < 15)
|
2007-08-01 19:31:36 +00:00
|
|
|
vol++;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY > nivel_voc && vol > 0)
|
2007-08-01 19:31:36 +00:00
|
|
|
vol--;
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, vol * 16);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > 192 && mouseX < 233) {
|
2007-08-01 19:31:36 +00:00
|
|
|
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType) / 16;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY < nivel_cd && vol < 15)
|
2007-08-01 19:31:36 +00:00
|
|
|
vol++;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY > nivel_cd && vol > 0)
|
2007-08-01 19:31:36 +00:00
|
|
|
vol--;
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol * 16);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-02-29 00:04:43 +00:00
|
|
|
bool DrasculaEngine::saves() {
|
2008-05-29 22:34:03 +00:00
|
|
|
char names[10][23];
|
|
|
|
char file[50];
|
2008-05-24 21:23:06 +00:00
|
|
|
char fileEpa[50];
|
2007-09-08 11:16:40 +00:00
|
|
|
int n, n2, num_sav = 0, y = 27;
|
2007-08-01 19:31:36 +00:00
|
|
|
Common::InSaveFile *sav;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-24 21:23:06 +00:00
|
|
|
snprintf(fileEpa, 50, "%s.epa", _targetName.c_str());
|
|
|
|
if (!(sav = _saveFileMan->openForLoading(fileEpa))) {
|
2008-02-28 22:08:40 +00:00
|
|
|
Common::OutSaveFile *epa;
|
2008-05-24 21:23:06 +00:00
|
|
|
if (!(epa = _saveFileMan->openForSaving(fileEpa)))
|
|
|
|
error("Can't open %s file", fileEpa);
|
2008-02-28 22:08:40 +00:00
|
|
|
for (n = 0; n < NUM_SAVES; n++)
|
|
|
|
epa->writeString("*\n");
|
|
|
|
epa->finalize();
|
|
|
|
delete epa;
|
2008-05-24 21:23:06 +00:00
|
|
|
if (!(sav = _saveFileMan->openForLoading(fileEpa))) {
|
|
|
|
error("Can't open %s file", fileEpa);
|
2008-02-28 22:08:40 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
for (n = 0; n < NUM_SAVES; n++)
|
2008-05-29 22:34:03 +00:00
|
|
|
sav->readLine(names[n], 23);
|
2007-08-01 19:31:36 +00:00
|
|
|
delete sav;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("savescr.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, HALF_PAL);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorLightGreen);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
y = 27;
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
for (n = 0; n < NUM_SAVES; n++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
print_abc(names[n], 116, y);
|
2007-07-26 19:52:18 +00:00
|
|
|
y = y + 9;
|
|
|
|
}
|
|
|
|
print_abc(select, 117, 15);
|
2008-05-29 22:34:03 +00:00
|
|
|
setCursorTable();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
y = 27;
|
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (button_izq == 1) {
|
2008-02-28 22:00:01 +00:00
|
|
|
delay(100);
|
2007-07-26 19:52:18 +00:00
|
|
|
for (n = 0; n < NUM_SAVES; n++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > 115 && mouseY > y + (9 * n) && mouseX < 115 + 175 && mouseY < y + 10 + (9 * n)) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(select, names[n]);
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2007-10-11 07:44:22 +00:00
|
|
|
if (strcmp(select, "*"))
|
|
|
|
hay_seleccion = 1;
|
|
|
|
else {
|
2008-05-29 22:34:03 +00:00
|
|
|
enterName();
|
|
|
|
strcpy(names[n], select);
|
2007-10-11 07:44:22 +00:00
|
|
|
if (hay_seleccion == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1);
|
|
|
|
para_grabar(file);
|
2007-10-11 07:44:22 +00:00
|
|
|
Common::OutSaveFile *tsav;
|
2008-05-24 21:23:06 +00:00
|
|
|
if (!(tsav = _saveFileMan->openForSaving(fileEpa))) {
|
|
|
|
error("Can't open %s file", fileEpa);
|
2007-10-11 07:44:22 +00:00
|
|
|
}
|
2008-02-28 22:08:40 +00:00
|
|
|
for (n = 0; n < NUM_SAVES; n++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
tsav->writeString(names[n]);
|
2008-02-28 22:08:40 +00:00
|
|
|
tsav->writeString("\n");
|
|
|
|
}
|
2007-10-11 07:44:22 +00:00
|
|
|
tsav->finalize();
|
|
|
|
delete tsav;
|
|
|
|
}
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-10-11 07:44:22 +00:00
|
|
|
print_abc(select, 117, 15);
|
|
|
|
y = 27;
|
|
|
|
for (n2 = 0; n2 < NUM_SAVES; n2++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
print_abc(names[n2], 116, y);
|
2007-10-11 07:44:22 +00:00
|
|
|
y = y + 9;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
if (hay_seleccion == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
num_sav = n;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > 117 && mouseY > 15 && mouseX < 295 && mouseY < 24 && hay_seleccion == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
enterName();
|
|
|
|
strcpy(names[num_sav], select);
|
2007-07-26 19:52:18 +00:00
|
|
|
print_abc(select, 117, 15);
|
|
|
|
y = 27;
|
|
|
|
for (n2 = 0; n2 < NUM_SAVES; n2++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
print_abc(names[n2], 116, y);
|
2007-07-26 19:52:18 +00:00
|
|
|
y = y + 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && hay_seleccion == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!para_cargar(file))
|
2008-02-29 00:04:43 +00:00
|
|
|
return false;
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
2008-05-27 06:35:00 +00:00
|
|
|
} else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && hay_seleccion == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
para_grabar(file);
|
2007-08-01 19:31:36 +00:00
|
|
|
Common::OutSaveFile *tsav;
|
2008-05-24 21:23:06 +00:00
|
|
|
if (!(tsav = _saveFileMan->openForSaving(fileEpa))) {
|
|
|
|
error("Can't open %s file", fileEpa);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-02-28 22:08:40 +00:00
|
|
|
for (n = 0; n < NUM_SAVES; n++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
tsav->writeString(names[n]);
|
2008-02-28 22:08:40 +00:00
|
|
|
tsav->writeString("\n");
|
|
|
|
}
|
2007-08-01 19:31:36 +00:00
|
|
|
tsav->finalize();
|
|
|
|
delete tsav;
|
2008-05-27 06:35:00 +00:00
|
|
|
} else if (mouseX > 168 && mouseY > 154 && mouseX < 242 && mouseY < 180)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
|
|
|
else if (hay_seleccion == 0) {
|
2007-09-06 06:07:22 +00:00
|
|
|
print_abc("elige una partida", 117, 15);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
delay(400);
|
|
|
|
}
|
|
|
|
y = 26;
|
2008-05-24 21:23:06 +00:00
|
|
|
|
|
|
|
delay(10);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2008-05-27 09:03:22 +00:00
|
|
|
char rm[20];
|
|
|
|
sprintf(rm, "%i.alg", roomNumber);
|
|
|
|
loadPic(rm);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, HALF_PAL);
|
2007-07-26 19:52:18 +00:00
|
|
|
hay_seleccion = 0;
|
2008-02-29 00:04:43 +00:00
|
|
|
|
|
|
|
return true;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 12:17:40 +00:00
|
|
|
struct charInfo {
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::print_abc(const char *said, int x_pantalla, int y_pantalla) {
|
2007-07-26 19:52:18 +00:00
|
|
|
int pos_texto[8];
|
2008-05-27 12:22:34 +00:00
|
|
|
int y_de_letra = 0, x_de_letra = 0, h, length;
|
|
|
|
length = strlen(said);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 12:17:40 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
for (h = 0; h < length; h++) {
|
2008-05-24 21:23:06 +00:00
|
|
|
y_de_letra = (_lang == kSpanish) ? Y_ABC_ESP : Y_ABC;
|
2008-05-11 12:47:26 +00:00
|
|
|
int c = toupper(said[h]);
|
2008-05-29 12:17:40 +00:00
|
|
|
if (c == '\245')
|
2008-05-24 21:23:06 +00:00
|
|
|
x_de_letra = X_GN;
|
|
|
|
else if (c == '\244')
|
|
|
|
x_de_letra = X_GN;
|
2008-05-29 12:17:40 +00:00
|
|
|
else if (c >= 'A' && c <= 'N')
|
|
|
|
x_de_letra = X_A + (c - 'A') * 9;
|
|
|
|
else if (c >= 'O' && c <= 'Z')
|
2008-05-29 16:41:49 +00:00
|
|
|
x_de_letra = X_O + (c - 'O') * 9;
|
2008-02-29 14:27:25 +00:00
|
|
|
else if (c == 0xa7 || c == ' ')
|
2008-05-11 10:53:59 +00:00
|
|
|
x_de_letra = SPACE;
|
2007-07-26 19:52:18 +00:00
|
|
|
else {
|
2008-05-24 21:23:06 +00:00
|
|
|
y_de_letra = (_lang == kSpanish) ? Y_SIGNOS_ESP : Y_SIGNOS;
|
2007-07-28 22:00:21 +00:00
|
|
|
if (c == '.')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_DOT;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == ',')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_COMA;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '-')
|
2008-05-11 10:28:25 +00:00
|
|
|
x_de_letra = X_HYPHEN;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '?')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_CIERRA_INTERROGACION;
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c == '\250')
|
2008-02-29 14:27:25 +00:00
|
|
|
x_de_letra = X_ABRE_INTERROGACION;
|
2008-03-09 21:07:02 +00:00
|
|
|
// else if (c == '\'') // FIXME
|
2008-05-11 10:53:59 +00:00
|
|
|
// x_de_letra = SPACE; // space for now
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '"')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_COMILLAS;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '!')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_CIERRA_EXCLAMACION;
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c == '\255')
|
2008-02-29 14:27:25 +00:00
|
|
|
x_de_letra = X_ABRE_EXCLAMACION;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == ';')
|
2008-05-29 22:34:03 +00:00
|
|
|
x_de_letra = X_pointY_COMA;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '>')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_GREATER_THAN;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '<')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_LESSER_THAN;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '$')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_DOLAR;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '%')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_PERCENT;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == ':')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_DOS_PUNTOS;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '&')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_AND;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '/')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_BARRA;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '(')
|
2008-05-11 10:28:25 +00:00
|
|
|
x_de_letra = X_BRACKET_OPEN;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == ')')
|
2008-05-11 10:28:25 +00:00
|
|
|
x_de_letra = X_BRACKET_CLOSE;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '*')
|
2007-07-26 19:52:18 +00:00
|
|
|
x_de_letra = X_ASTERISCO;
|
2007-07-28 22:00:21 +00:00
|
|
|
else if (c == '+')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_PLUS;
|
2008-05-29 16:53:28 +00:00
|
|
|
else if (c >= '1' && c <= '9')
|
2008-05-29 12:17:40 +00:00
|
|
|
x_de_letra = X_N1 + (c - '1') * 9;
|
2008-05-29 16:53:28 +00:00
|
|
|
// "0" is mapped after "9" in the game's font
|
|
|
|
// (it's mapped before "1" normally)
|
|
|
|
else if (c == '0')
|
|
|
|
x_de_letra = X_N0;
|
2008-05-24 21:23:06 +00:00
|
|
|
else y_de_letra=Y_ACENTOS;
|
|
|
|
|
2008-05-26 20:19:56 +00:00
|
|
|
if (c == '\240') x_de_letra=X_A;
|
2008-05-29 12:17:40 +00:00
|
|
|
else if (c =='\202') x_de_letra = X_A + 1 * 9; // B
|
|
|
|
else if (c =='\241') x_de_letra = X_A + 2 * 9; // C
|
|
|
|
else if (c =='\242') x_de_letra = X_A + 3 * 9; // D
|
|
|
|
else if (c =='\243') x_de_letra = X_A + 4 * 9; // E
|
|
|
|
else if (c =='\205') x_de_letra = X_A + 5 * 9; // F
|
|
|
|
else if (c =='\212') x_de_letra = X_A + 6 * 9; // G
|
|
|
|
else if (c =='\215') x_de_letra = X_A + 7 * 9; // H
|
|
|
|
else if (c =='\225') x_de_letra = X_A + 8 * 9; // I
|
|
|
|
else if (c =='\227') x_de_letra = X_A + 9 * 9; // J
|
|
|
|
else if (c =='\203') x_de_letra = X_A + 10 * 9; // K
|
|
|
|
else if (c =='\210') x_de_letra = X_A + 11 * 9; // L
|
|
|
|
else if (c =='\214') x_de_letra = X_A + 12 * 9; // M
|
|
|
|
else if (c =='\223') x_de_letra = X_A + 13 * 9; // N
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c =='\226') x_de_letra = X_GN;
|
|
|
|
else if (c =='\047') x_de_letra = X_O;
|
2008-05-29 12:17:40 +00:00
|
|
|
else if (c =='\200') x_de_letra = X_O + 1 * 9; // P
|
|
|
|
else if (c =='\207') x_de_letra = X_O + 1 * 9; // P
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c =='\265') x_de_letra = X_A;
|
2008-05-29 12:17:40 +00:00
|
|
|
else if (c =='\220') x_de_letra = X_A + 1 * 9; // B
|
|
|
|
else if (c =='\326') x_de_letra = X_A + 2 * 9; // C
|
|
|
|
else if (c =='\340') x_de_letra = X_A + 3 * 9; // D
|
|
|
|
else if (c =='\351') x_de_letra = X_A + 4 * 9; // E
|
|
|
|
else if (c =='\267') x_de_letra = X_A + 5 * 9; // F
|
|
|
|
else if (c =='\324') x_de_letra = X_A + 6 * 9; // G
|
|
|
|
else if (c =='\336') x_de_letra = X_A + 7 * 9; // H
|
|
|
|
else if (c =='\343') x_de_letra = X_A + 8 * 9; // I
|
|
|
|
else if (c =='\353') x_de_letra = X_A + 9 * 9; // J
|
|
|
|
else if (c =='\266') x_de_letra = X_A + 10 * 9; // K
|
|
|
|
else if (c =='\322') x_de_letra = X_A + 11 * 9; // L
|
|
|
|
else if (c =='\327') x_de_letra = X_A + 12 * 9; // M
|
|
|
|
else if (c =='\342') x_de_letra = X_A + 13 * 9; // N
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c =='\352') x_de_letra = X_GN;
|
2008-01-28 00:14:17 +00:00
|
|
|
}
|
2007-07-28 22:00:21 +00:00
|
|
|
|
2007-07-26 19:52:18 +00:00
|
|
|
pos_texto[0] = x_de_letra;
|
|
|
|
pos_texto[1] = y_de_letra;
|
|
|
|
pos_texto[2] = x_pantalla;
|
|
|
|
pos_texto[3] = y_pantalla;
|
2008-05-11 10:28:25 +00:00
|
|
|
pos_texto[4] = CHAR_WIDTH;
|
|
|
|
pos_texto[5] = CHAR_HEIGHT;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_texto, textSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 10:28:25 +00:00
|
|
|
x_pantalla = x_pantalla + CHAR_WIDTH;
|
2007-07-26 19:52:18 +00:00
|
|
|
if (x_pantalla > 317) {
|
|
|
|
x_pantalla = 0;
|
2008-05-11 10:28:25 +00:00
|
|
|
y_pantalla = y_pantalla + CHAR_HEIGHT + 2;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-17 21:35:01 +00:00
|
|
|
}
|
|
|
|
|
2007-07-26 19:52:18 +00:00
|
|
|
void DrasculaEngine::delay(int ms) {
|
2007-07-29 07:12:24 +00:00
|
|
|
_system->delayMillis(ms * 2); // originaly was 1
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-02-29 15:11:44 +00:00
|
|
|
bool DrasculaEngine::confirma_salir() {
|
2007-07-29 17:48:25 +00:00
|
|
|
byte key;
|
|
|
|
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorRed);
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
centerText(_textsys[_lang][1], 160, 87);
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-02-29 15:11:44 +00:00
|
|
|
delay(100);
|
2007-07-26 19:52:18 +00:00
|
|
|
for (;;) {
|
2008-05-29 22:34:03 +00:00
|
|
|
key = getScan();
|
2007-07-28 09:45:05 +00:00
|
|
|
if (key != 0)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-08-01 22:11:04 +00:00
|
|
|
if (key == Common::KEYCODE_ESCAPE) {
|
2008-05-11 10:03:06 +00:00
|
|
|
stopMusic();
|
2008-02-29 15:11:44 +00:00
|
|
|
return false;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-02-29 15:11:44 +00:00
|
|
|
|
|
|
|
return true;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::screenSaver() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int xr, yr;
|
2008-05-26 21:48:59 +00:00
|
|
|
byte *copia, *ghost;
|
|
|
|
Common::File file;
|
|
|
|
float coeff = 0, coeff2 = 0;
|
|
|
|
int count = 0;
|
|
|
|
int count2 = 0;
|
|
|
|
int tempLine[320];
|
|
|
|
int tempRow[200];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-02-29 15:20:23 +00:00
|
|
|
// FIXME: that part (*.ghost) need RE from efecto.lib file for some gfx special effect
|
|
|
|
// for now ignore
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
loadPic("sv.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, HALF_PAL);
|
2008-05-26 21:48:59 +00:00
|
|
|
|
|
|
|
// 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();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2008-05-27 06:35:00 +00:00
|
|
|
xr = mouseX;
|
|
|
|
yr = mouseY;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
for (;;) {
|
2008-05-30 07:09:36 +00:00
|
|
|
// efecto(drawSurface1);
|
2008-05-26 21:48:59 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
memcpy(copia, drawSurface1, 64000);
|
2008-05-26 22:01:29 +00:00
|
|
|
coeff += 0.1f;
|
2008-05-26 21:48:59 +00:00
|
|
|
coeff2 = coeff;
|
|
|
|
|
|
|
|
if (++count > 319)
|
|
|
|
count = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < 320; i++) {
|
|
|
|
tempLine[i] = (int)(sin(coeff2) * 16);
|
2008-05-26 22:01:29 +00:00
|
|
|
coeff2 += 0.02f;
|
2008-05-26 21:48:59 +00:00
|
|
|
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);
|
2008-05-26 22:01:29 +00:00
|
|
|
coeff2 += 0.02f;
|
2008-05-26 21:48:59 +00:00
|
|
|
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_;
|
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
VGA[320 * i + j] = ghost[drawSurface1[off2] + (copia[off1] << 8)];
|
2008-05-26 21:48:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
_system->updateScreen();
|
|
|
|
|
|
|
|
_system->delayMillis(20);
|
|
|
|
|
|
|
|
// end of efecto()
|
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2008-05-27 12:22:34 +00:00
|
|
|
if (button_dch == 1 || button_izq == 1)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX != xr)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY != yr)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-26 21:48:59 +00:00
|
|
|
// fin_ghost();
|
|
|
|
free(copia);
|
|
|
|
free(ghost);
|
|
|
|
|
2008-05-27 09:03:22 +00:00
|
|
|
char rm[20];
|
|
|
|
sprintf(rm, "%i.alg", roomNumber);
|
|
|
|
loadPic(rm);
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, HALF_PAL);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-07-27 17:50:25 +00:00
|
|
|
void DrasculaEngine::fliplay(const char *filefli, int vel) {
|
2007-07-26 19:52:18 +00:00
|
|
|
OpenSSN(filefli, vel);
|
|
|
|
while (PlayFrameSSN() && (!term_int)) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (getScan() == Common::KEYCODE_ESCAPE)
|
2007-07-26 19:52:18 +00:00
|
|
|
term_int = 1;
|
|
|
|
}
|
|
|
|
EndSSN();
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::fadeFromBlack(int VelocidadDeFundido) {
|
2007-07-26 19:52:18 +00:00
|
|
|
char fundido;
|
|
|
|
unsigned int color, componente;
|
|
|
|
|
|
|
|
DacPalette256 palFundido;
|
|
|
|
|
|
|
|
for (fundido = 0; fundido < 64; fundido++) {
|
|
|
|
for (color = 0; color < 256; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
palFundido[color][componente] = LimitaVGA(gamePalette[color][componente] - 63 + fundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-02 11:44:47 +00:00
|
|
|
pause(VelocidadDeFundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
setPalette((byte *)&palFundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrasculaEngine::color_abc(int cl) {
|
2007-07-29 17:48:25 +00:00
|
|
|
_color = cl;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 20:35:15 +00:00
|
|
|
char colorTable[][3] = {
|
|
|
|
{ 0, 0, 0 }, { 0x10, 0x3E, 0x28 },
|
|
|
|
{ 0, 0, 0 }, // unused
|
|
|
|
{ 0x16, 0x3F, 0x16 }, { 0x09, 0x3F, 0x12 },
|
|
|
|
{ 0x3F, 0x3F, 0x15 },
|
|
|
|
{ 0, 0, 0 }, // unused
|
|
|
|
{ 0x38, 0, 0 }, { 0x3F, 0x27, 0x0B },
|
|
|
|
{ 0x2A, 0, 0x2A }, { 0x30, 0x30, 0x30 },
|
|
|
|
{ 98, 91, 100 }
|
2007-07-26 19:52:18 +00:00
|
|
|
};
|
|
|
|
|
2008-05-29 20:35:15 +00:00
|
|
|
for (int i = 0; i <= 2; i++)
|
|
|
|
gamePalette[254][i] = colorTable[cl][i];
|
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
setPalette((byte *)&gamePalette);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
char DrasculaEngine::LimitaVGA(char value) {
|
|
|
|
return (value & 0x3F) * (value > 0);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::centerText(const char *message, int textX, int textY) {
|
2007-09-04 17:26:38 +00:00
|
|
|
char bb[200], m2[200], m1[200], mb[10][50];
|
|
|
|
char m3[200];
|
2008-05-29 22:34:03 +00:00
|
|
|
int h, fil, textX3, textX2, textX1, conta_f = 0, ya = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
strcpy(m1, " ");
|
|
|
|
strcpy(m2, " ");
|
|
|
|
strcpy(m3, " ");
|
|
|
|
strcpy(bb, " ");
|
|
|
|
|
|
|
|
for (h = 0; h < 10; h++)
|
|
|
|
strcpy(mb[h], " ");
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (textX > 160)
|
2007-07-26 19:52:18 +00:00
|
|
|
ya = 1;
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(m1, message);
|
|
|
|
textX = CLIP<int>(textX, 60, 255);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
textX1 = textX;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
if (ya == 1)
|
2008-05-29 22:34:03 +00:00
|
|
|
textX1 = 315 - textX;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
textX2 = (strlen(m1) / 2) * CHAR_WIDTH;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
tut:
|
|
|
|
strcpy(bb, m1);
|
2007-07-27 04:23:22 +00:00
|
|
|
scumm_strrev(bb);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (textX1 < textX2) {
|
2007-07-26 19:52:18 +00:00
|
|
|
strcpy(m3, strrchr(m1, ' '));
|
|
|
|
strcpy(m1, strstr(bb, " "));
|
2007-07-27 04:23:22 +00:00
|
|
|
scumm_strrev(m1);
|
2007-07-26 19:52:18 +00:00
|
|
|
m1[strlen(m1) - 1] = '\0';
|
|
|
|
strcat(m3, m2);
|
|
|
|
strcpy(m2, m3);
|
|
|
|
};
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
textX2 = (strlen(m1) / 2) * CHAR_WIDTH;
|
|
|
|
if (textX1 < textX2)
|
2007-07-26 19:52:18 +00:00
|
|
|
goto tut;
|
|
|
|
strcpy(mb[conta_f], m1);
|
|
|
|
|
|
|
|
if (!strcmp(m2, ""))
|
|
|
|
goto imprimir;
|
2007-07-27 04:23:22 +00:00
|
|
|
scumm_strrev(m2);
|
2007-07-26 19:52:18 +00:00
|
|
|
m2[strlen(m2) - 1] = '\0';
|
2007-07-27 04:23:22 +00:00
|
|
|
scumm_strrev(m2);
|
2007-07-26 19:52:18 +00:00
|
|
|
strcpy(m1, m2);
|
|
|
|
strcpy(m2, "");
|
|
|
|
conta_f++;
|
|
|
|
|
|
|
|
goto tut;
|
|
|
|
|
|
|
|
imprimir:
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
fil = textY - (((conta_f + 3) * CHAR_HEIGHT));
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
for (h = 0; h < conta_f + 1; h++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
textX3 = strlen(mb[h]) / 2;
|
|
|
|
print_abc(mb[h], ((textX) - textX3 * CHAR_WIDTH) - 1, fil);
|
2008-05-11 10:28:25 +00:00
|
|
|
fil = fil + CHAR_HEIGHT + 2;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::playSound(const char *file) {
|
2007-07-28 09:45:05 +00:00
|
|
|
if (hay_sb == 1) {
|
2007-07-28 14:45:26 +00:00
|
|
|
sku = new Common::File;
|
2008-05-29 22:34:03 +00:00
|
|
|
sku->open(file);
|
2007-07-28 14:45:26 +00:00
|
|
|
if (!sku->isOpen()) {
|
2007-07-26 19:52:18 +00:00
|
|
|
error("no puedo abrir archivo de voz");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctvd_init(2);
|
|
|
|
ctvd_speaker(1);
|
|
|
|
ctvd_output(sku);
|
|
|
|
}
|
|
|
|
|
2008-05-30 07:26:55 +00:00
|
|
|
bool DrasculaEngine::animate(const char *animationFile, int FPS) {
|
2007-07-26 19:52:18 +00:00
|
|
|
Common::File FileIn;
|
2007-07-29 17:48:25 +00:00
|
|
|
unsigned j;
|
|
|
|
int NFrames = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
int cnt = 2;
|
2008-05-30 07:24:32 +00:00
|
|
|
int dataSize = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2007-07-28 15:18:21 +00:00
|
|
|
AuxBuffLast = (byte *)malloc(65000);
|
|
|
|
AuxBuffDes = (byte *)malloc(65000);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 07:26:55 +00:00
|
|
|
FileIn.open(animationFile);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
if (!FileIn.isOpen()) {
|
2008-05-30 07:26:55 +00:00
|
|
|
error("Animation file %s not found", animationFile);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FileIn.read(&NFrames, sizeof(NFrames));
|
2008-05-30 07:24:32 +00:00
|
|
|
FileIn.read(&dataSize, sizeof(dataSize));
|
|
|
|
AuxBuffOrg = (byte *)malloc(dataSize);
|
|
|
|
FileIn.read(AuxBuffOrg, dataSize);
|
2007-07-26 19:52:18 +00:00
|
|
|
FileIn.read(cPal, 768);
|
2008-05-11 11:20:40 +00:00
|
|
|
loadPCX(AuxBuffOrg);
|
2007-07-26 19:52:18 +00:00
|
|
|
free(AuxBuffOrg);
|
|
|
|
memcpy(VGA, AuxBuffDes, 64000);
|
2007-07-28 14:45:26 +00:00
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
_system->updateScreen();
|
2007-07-26 19:52:18 +00:00
|
|
|
set_dac(cPal);
|
|
|
|
memcpy(AuxBuffLast, AuxBuffDes, 64000);
|
2007-08-01 19:31:36 +00:00
|
|
|
WaitForNext(FPS);
|
2007-07-26 19:52:18 +00:00
|
|
|
while (cnt < NFrames) {
|
2008-05-30 07:24:32 +00:00
|
|
|
FileIn.read(&dataSize, sizeof(dataSize));
|
|
|
|
AuxBuffOrg = (byte *)malloc(dataSize);
|
|
|
|
FileIn.read(AuxBuffOrg, dataSize);
|
2007-07-26 19:52:18 +00:00
|
|
|
FileIn.read(cPal, 768);
|
2008-05-11 11:20:40 +00:00
|
|
|
loadPCX(AuxBuffOrg);
|
2007-07-26 19:52:18 +00:00
|
|
|
free(AuxBuffOrg);
|
|
|
|
for (j = 0;j < 64000; j++) {
|
|
|
|
VGA[j] = AuxBuffLast[j] = AuxBuffDes[j] ^ AuxBuffLast[j];
|
|
|
|
}
|
2007-07-28 14:45:26 +00:00
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
_system->updateScreen();
|
2007-08-01 19:31:36 +00:00
|
|
|
WaitForNext(FPS);
|
2007-07-26 19:52:18 +00:00
|
|
|
cnt++;
|
2008-05-29 22:34:03 +00:00
|
|
|
byte key = getScan();
|
2007-08-01 22:11:04 +00:00
|
|
|
if (key == Common::KEYCODE_ESCAPE)
|
2007-07-26 19:52:18 +00:00
|
|
|
term_int = 1;
|
2007-07-28 21:15:35 +00:00
|
|
|
if (key != 0)
|
2007-07-26 19:52:18 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
free(AuxBuffLast);
|
|
|
|
free(AuxBuffDes);
|
|
|
|
FileIn.close();
|
2008-05-26 14:08:53 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
return ((term_int == 1) || (getScan() == Common::KEYCODE_ESCAPE));
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-27 07:17:15 +00:00
|
|
|
void DrasculaEngine::animastopSound_corte() {
|
2007-07-26 19:52:18 +00:00
|
|
|
if (hay_sb == 1) {
|
|
|
|
ctvd_stop();
|
2007-07-28 14:45:26 +00:00
|
|
|
delete sku;
|
2008-03-08 11:33:18 +00:00
|
|
|
sku = NULL;
|
2007-07-26 19:52:18 +00:00
|
|
|
ctvd_terminate();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::fadeToBlack(int VelocidadDeFundido) {
|
2007-07-26 19:52:18 +00:00
|
|
|
char fundido;
|
|
|
|
unsigned int color, componente;
|
|
|
|
|
|
|
|
DacPalette256 palFundido;
|
|
|
|
|
|
|
|
for (fundido = 63; fundido >= 0; fundido--) {
|
|
|
|
for (color = 0; color < 256; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
palFundido[color][componente] = LimitaVGA(gamePalette[color][componente] - 63 + fundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-02 11:44:47 +00:00
|
|
|
pause(VelocidadDeFundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
setPalette((byte *)&palFundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
void DrasculaEngine::pause(int cuanto) {
|
2007-08-01 19:31:36 +00:00
|
|
|
_system->delayMillis(cuanto * 30); // was originaly 2
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::placeIgor() {
|
2008-05-02 11:18:46 +00:00
|
|
|
int pos_igor[6];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
pos_igor[0] = 1;
|
2007-08-17 11:19:17 +00:00
|
|
|
if (num_ejec == 4) {
|
2007-07-26 19:52:18 +00:00
|
|
|
pos_igor[1] = 138;
|
2007-08-17 11:19:17 +00:00
|
|
|
} else {
|
|
|
|
if (sentido_igor == 3)
|
|
|
|
pos_igor[1] = 138;
|
|
|
|
else if (sentido_igor == 1)
|
|
|
|
pos_igor[1] = 76;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
pos_igor[2] = x_igor;
|
|
|
|
pos_igor[3] = y_igor;
|
|
|
|
pos_igor[4] = 54;
|
|
|
|
pos_igor[5] = 61;
|
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_igor, frontSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::placeDrascula() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int pos_dr[6];
|
|
|
|
|
|
|
|
if (sentido_dr == 1)
|
|
|
|
pos_dr[0] = 47;
|
|
|
|
else if (sentido_dr == 0)
|
|
|
|
pos_dr[0] = 1;
|
2008-03-08 18:00:04 +00:00
|
|
|
else if (sentido_dr == 3 && num_ejec == 1)
|
2007-07-26 19:52:18 +00:00
|
|
|
pos_dr[0] = 93;
|
|
|
|
pos_dr[1] = 122;
|
|
|
|
pos_dr[2] = x_dr;
|
|
|
|
pos_dr[3] = y_dr;
|
|
|
|
pos_dr[4] = 45;
|
|
|
|
pos_dr[5] = 77;
|
|
|
|
|
2008-03-08 18:00:04 +00:00
|
|
|
if (num_ejec == 6)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_dr, drawSurface2, screenSurface);
|
2008-03-08 18:00:04 +00:00
|
|
|
else
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_dr, backSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::placeBJ() {
|
2007-07-26 19:52:18 +00:00
|
|
|
int pos_bj[6];
|
|
|
|
|
|
|
|
if (sentido_bj == 3)
|
2007-07-28 09:45:05 +00:00
|
|
|
pos_bj[0] = 10;
|
2007-07-26 19:52:18 +00:00
|
|
|
else if (sentido_bj == 0)
|
2007-07-28 09:45:05 +00:00
|
|
|
pos_bj[0] = 37;
|
2007-07-26 19:52:18 +00:00
|
|
|
pos_bj[1] = 99;
|
2007-07-28 09:45:05 +00:00
|
|
|
pos_bj[2] = x_bj;
|
|
|
|
pos_bj[3] = y_bj;
|
|
|
|
pos_bj[4] = 26;
|
|
|
|
pos_bj[5] = 76;
|
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_bj, drawSurface3, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::hiccup(int counter) {
|
2008-05-02 13:26:48 +00:00
|
|
|
int y = 0, sentido = 0;
|
|
|
|
if (num_ejec == 3)
|
|
|
|
y = -1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
comienza:
|
2008-05-11 12:47:26 +00:00
|
|
|
counter--;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
|
|
|
if (num_ejec == 3)
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, y, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 1, 0, y, 320, 198, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido == 0)
|
|
|
|
y++;
|
|
|
|
else
|
|
|
|
y--;
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3) {
|
|
|
|
if (y == 1)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == -1)
|
|
|
|
sentido = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
} else {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (y == 2)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == 0)
|
|
|
|
sentido = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-11 12:47:26 +00:00
|
|
|
if (counter > 0)
|
2008-05-02 13:26:48 +00:00
|
|
|
goto comienza;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-27 07:17:15 +00:00
|
|
|
void DrasculaEngine::stopSound() {
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(1);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
if (hay_sb == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
while (LookForFree() != 0);
|
2007-07-28 14:45:26 +00:00
|
|
|
delete sku;
|
2008-03-08 11:33:18 +00:00
|
|
|
sku = NULL;
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 10:03:06 +00:00
|
|
|
void DrasculaEngine::playMusic(int p) {
|
2008-05-02 13:26:48 +00:00
|
|
|
AudioCD.stop();
|
|
|
|
AudioCD.play(p - 1, 1, 0, 0);
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 10:03:06 +00:00
|
|
|
void DrasculaEngine::stopMusic() {
|
2008-05-02 13:26:48 +00:00
|
|
|
AudioCD.stop();
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 10:03:06 +00:00
|
|
|
int DrasculaEngine::musicStatus() {
|
2008-05-02 13:26:48 +00:00
|
|
|
return AudioCD.isPlaying();
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::updateRoom() {
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRefresh_pre();
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3) {
|
|
|
|
if (flags[0] == 0)
|
|
|
|
pon_hare();
|
|
|
|
else
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRect(113, 54, hare_x - 20, hare_y - 1, 77, 89, drawSurface3, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
} else {
|
2008-03-08 18:00:04 +00:00
|
|
|
pon_hare();
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
updateRefresh();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
bool DrasculaEngine::loadGame(const char *gameName) {
|
2008-05-02 13:26:48 +00:00
|
|
|
int l, n_ejec2;
|
|
|
|
Common::InSaveFile *sav;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!(sav = _saveFileMan->openForLoading(gameName))) {
|
2008-05-02 13:26:48 +00:00
|
|
|
error("missing savegame file");
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
n_ejec2 = sav->readSint32LE();
|
|
|
|
if (n_ejec2 != num_ejec) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(saveName, gameName);
|
2008-05-02 13:26:48 +00:00
|
|
|
num_ejec = n_ejec2 - 1;
|
|
|
|
hay_que_load = 1;
|
|
|
|
return false;
|
2008-03-08 19:47:44 +00:00
|
|
|
}
|
2008-05-11 11:20:40 +00:00
|
|
|
sav->read(currentData, 20);
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_x = sav->readSint32LE();
|
|
|
|
hare_y = sav->readSint32LE();
|
|
|
|
sentido_hare = sav->readSint32LE();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (l = 1; l < 43; l++) {
|
2008-05-27 12:22:34 +00:00
|
|
|
inventoryObjects[l] = sav->readSint32LE();
|
2008-03-08 19:47:44 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
|
2008-05-11 10:28:25 +00:00
|
|
|
for (l = 0; l < NUM_FLAGS; l++) {
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[l] = sav->readSint32LE();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = sav->readSint32LE();
|
2008-05-27 12:02:26 +00:00
|
|
|
pickedObject = sav->readSint32LE();
|
2008-05-02 13:26:48 +00:00
|
|
|
hay_que_load = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 14:04:47 +00:00
|
|
|
void DrasculaEngine::updateDoor(int doorNum) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1 || num_ejec == 3 || num_ejec == 5 || num_ejec == 6)
|
|
|
|
return;
|
|
|
|
else if (num_ejec == 2) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[doorNum] == 138)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[0];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 136)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[8];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 156)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[16];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 163)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[17];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 177)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[15];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 175)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[40];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 173)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[36];
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 4) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[doorNum] == 101 && flags[0] == 0)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 101 && flags[0] == 1 && flags[28] == 1)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 103)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[0];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 104)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[1];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 105)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[1];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 106)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[2];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 107)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[2];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 110)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[6];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 114)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[4];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 115)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[4];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 116 && flags[5] == 0)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 116 && flags[5] == 1 && flags[23] == 1)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 117)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[5];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 120)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[8];
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (objectNum[doorNum] == 122)
|
2008-05-29 14:04:47 +00:00
|
|
|
isDoor[doorNum] = flags[7];
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::color_hare() {
|
|
|
|
int color, componente;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
gamePalette[color][componente] = palHare[color][componente];
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-11 11:20:40 +00:00
|
|
|
updatePalette();
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::funde_hare(int oscuridad) {
|
|
|
|
char fundido;
|
|
|
|
unsigned int color, componente;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (fundido = oscuridad; fundido >= 0; fundido--) {
|
|
|
|
for (color = 235; color < 253; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++)
|
2008-05-27 06:35:00 +00:00
|
|
|
gamePalette[color][componente] = LimitaVGA(gamePalette[color][componente] - 8 + fundido);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2008-03-09 09:20:16 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
updatePalette();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::paleta_hare_claro() {
|
|
|
|
int color, componente;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++)
|
2008-05-27 06:35:00 +00:00
|
|
|
palHareClaro[color][componente] = gamePalette[color][componente];
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::paleta_hare_oscuro() {
|
|
|
|
int color, componente;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++)
|
2008-05-27 06:35:00 +00:00
|
|
|
palHareOscuro[color][componente] = gamePalette[color][componente];
|
2008-03-09 16:10:18 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::hare_claro() {
|
|
|
|
int color, componente;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
|
|
|
for (componente = 0; componente < 3; componente++)
|
2008-05-27 06:35:00 +00:00
|
|
|
gamePalette[color][componente] = palHareClaro[color][componente];
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
updatePalette();
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::startWalking() {
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2) {
|
|
|
|
if ((sitio_x < hare_x) && (sitio_y <= (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_1();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((sitio_x < hare_x) && (sitio_y > (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_3();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((sitio_x > hare_x + ancho_hare) && (sitio_y <= (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_2();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((sitio_x > hare_x + ancho_hare) && (sitio_y > (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_4();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (sitio_y < hare_y + alto_hare)
|
|
|
|
anda_parriba();
|
|
|
|
else if (sitio_y > hare_y + alto_hare)
|
|
|
|
anda_pabajo();
|
2007-07-26 19:52:18 +00:00
|
|
|
} else {
|
2008-05-02 13:26:48 +00:00
|
|
|
if ((sitio_x < hare_x + ancho_hare / 2 ) && (sitio_y <= (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_1();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((sitio_x < hare_x + ancho_hare / 2) && (sitio_y > (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_3();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((sitio_x > hare_x + ancho_hare / 2) && (sitio_y <= (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_2();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((sitio_x > hare_x + ancho_hare / 2) && (sitio_y > (hare_y + alto_hare)))
|
2008-05-27 12:22:34 +00:00
|
|
|
quadrant_4();
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
hare_se_mueve = 0;
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
conta_vez = vez();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::pon_hare() {
|
|
|
|
int pos_hare[6];
|
|
|
|
int r;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (hare_se_mueve == 1 && stepX == PASO_HARE_X) {
|
|
|
|
for (r = 0; r < stepX; r++) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec != 2) {
|
|
|
|
if (sentido_hare == 0 && sitio_x - r == hare_x + ancho_hare / 2) {
|
|
|
|
hare_se_mueve = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
if (sentido_hare == 1 && sitio_x + r == hare_x + ancho_hare / 2) {
|
|
|
|
hare_se_mueve = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_x = sitio_x - ancho_hare / 2;
|
|
|
|
hare_y = sitio_y - alto_hare;
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 2) {
|
|
|
|
if (sentido_hare == 0 && sitio_x - r == hare_x) {
|
|
|
|
hare_se_mueve = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
if (sentido_hare == 1 && sitio_x + r == hare_x + ancho_hare) {
|
|
|
|
hare_se_mueve = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_x = sitio_x - ancho_hare + 4;
|
|
|
|
hare_y = sitio_y - alto_hare;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
if (hare_se_mueve == 1 && stepY == PASO_HARE_Y) {
|
|
|
|
for (r = 0; r < stepY; r++) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido_hare == 2 && sitio_y - r == hare_y + alto_hare) {
|
|
|
|
hare_se_mueve = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
if (sentido_hare == 3 && sitio_y + r == hare_y + alto_hare) {
|
|
|
|
hare_se_mueve = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1 || num_ejec == 4 || num_ejec == 5 || num_ejec == 6) {
|
|
|
|
if (hare_se_ve == 0)
|
|
|
|
goto no_vuelco;
|
2007-08-17 11:19:17 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (hare_se_mueve == 0) {
|
|
|
|
pos_hare[0] = 0;
|
|
|
|
pos_hare[1] = DIF_MASK_HARE;
|
|
|
|
pos_hare[2] = hare_x;
|
|
|
|
pos_hare[3] = hare_y;
|
|
|
|
if (num_ejec == 2) {
|
|
|
|
pos_hare[4] = ancho_hare;
|
|
|
|
pos_hare[5] = alto_hare;
|
|
|
|
} else {
|
2008-05-11 10:53:59 +00:00
|
|
|
pos_hare[4] = CHARACTER_WIDTH;
|
|
|
|
pos_hare[5] = CHARACTER_HEIGHT;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido_hare == 0) {
|
|
|
|
pos_hare[1] = 0;
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (sentido_hare == 1) {
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (sentido_hare == 2) {
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, backSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], backSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, frontSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], frontSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
} else if (hare_se_mueve == 1) {
|
|
|
|
pos_hare[0] = frame_x[num_frame];
|
|
|
|
pos_hare[1] = frame_y + DIF_MASK_HARE;
|
|
|
|
pos_hare[2] = hare_x;
|
|
|
|
pos_hare[3] = hare_y;
|
|
|
|
if (num_ejec == 2) {
|
|
|
|
pos_hare[4] = ancho_hare;
|
|
|
|
pos_hare[5] = alto_hare;
|
|
|
|
} else {
|
2008-05-11 10:53:59 +00:00
|
|
|
pos_hare[4] = CHARACTER_WIDTH;
|
|
|
|
pos_hare[5] = CHARACTER_HEIGHT;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
if (sentido_hare == 0) {
|
|
|
|
pos_hare[1] = 0;
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (sentido_hare == 1) {
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], extraSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (sentido_hare == 2) {
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, backSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], backSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
if (num_ejec == 2)
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_hare, frontSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
reduce_hare_chico(pos_hare[0], pos_hare[1], pos_hare[2], pos_hare[3], pos_hare[4], pos_hare[5],
|
2008-05-30 07:09:36 +00:00
|
|
|
factor_red[hare_y + alto_hare], frontSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
no_vuelco:
|
2008-05-29 22:34:03 +00:00
|
|
|
increaseFrameNum();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::menu_sin_volcar() {
|
|
|
|
int h, n, x;
|
|
|
|
char texto_icono[13];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
x = whichObject();
|
2008-05-11 11:20:40 +00:00
|
|
|
strcpy(texto_icono, iconName[x]);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (n = 1; n < 43; n++) {
|
2008-05-27 12:22:34 +00:00
|
|
|
h = inventoryObjects[n];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (h != 0) {
|
|
|
|
if (num_ejec == 6)
|
2008-05-27 07:04:56 +00:00
|
|
|
copyBackground(x_pol[n], y_pol[n], itemLocations[n].x, itemLocations[n].y,
|
2008-05-30 07:09:36 +00:00
|
|
|
OBJWIDTH, OBJHEIGHT, tableSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-27 07:04:56 +00:00
|
|
|
copyBackground(x_pol[n], y_pol[n], itemLocations[n].x, itemLocations[n].y,
|
2008-05-30 07:09:36 +00:00
|
|
|
OBJWIDTH, OBJHEIGHT, frontSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-27 07:04:56 +00:00
|
|
|
copyRect(x1d_menu[h], y1d_menu[h], itemLocations[n].x, itemLocations[n].y,
|
2008-05-30 07:09:36 +00:00
|
|
|
OBJWIDTH, OBJHEIGHT, backSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (x < 7)
|
2008-05-27 07:04:56 +00:00
|
|
|
print_abc(texto_icono, itemLocations[x].x - 2, itemLocations[x].y - 7);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2008-03-08 11:33:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::clearMenu() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int n, sobre_verbo = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (n = 0; n < 7; n++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > x_barra[n] && mouseX < x_barra[n + 1])
|
2008-05-02 13:26:48 +00:00
|
|
|
sobre_verbo = 0;
|
2008-05-11 10:28:25 +00:00
|
|
|
copyRect(OBJWIDTH * n, OBJHEIGHT * sobre_verbo, x_barra[n], 2,
|
2008-05-30 07:09:36 +00:00
|
|
|
OBJWIDTH, OBJHEIGHT, backSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
sobre_verbo = 1;
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 14:04:47 +00:00
|
|
|
void DrasculaEngine::removeObject() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int h = 0, n;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (n = 1; n < 43; n++){
|
2008-05-29 22:34:03 +00:00
|
|
|
if (whichObject() == n) {
|
2008-05-27 12:22:34 +00:00
|
|
|
h = inventoryObjects[n];
|
|
|
|
inventoryObjects[n] = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
if (h != 0)
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = 1;
|
2007-09-05 20:45:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 1)
|
2008-05-11 11:20:40 +00:00
|
|
|
chooseObject(h);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
bool DrasculaEngine::exitRoom(int l) {
|
2008-05-02 13:26:48 +00:00
|
|
|
char salgo[13];
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 105 && flags[0] == 0)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][442], "442.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else {
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
|
|
|
sentido_hare = sentidobj[l];
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
sentido_hare = sentido_alkeva[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = alapuertakeva[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 105) {
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_2_1();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
clearRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(salgo, targetScreen[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 2) {
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
|
|
|
hare_se_mueve = 0;
|
|
|
|
sentido_hare = sentido_alkeva[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = alapuertakeva[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 136)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_2_2();
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 124)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_3_2();
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 173) {
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_35_2();
|
|
|
|
return true;
|
2008-05-29 22:34:03 +00:00
|
|
|
} if (objectNum[l] == 146 && flags[39] == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[5] = 1;
|
|
|
|
flags[11] = 1;
|
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 176 && flags[29] == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[29] = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
removeObject(23);
|
|
|
|
addObject(11);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
clearRoom();
|
|
|
|
delete ald;
|
|
|
|
ald = NULL;
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(salgo, targetScreen[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x =- 1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 3) {
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0 && visible[l] == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
|
|
|
sentido_hare = sentidobj[l];
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
sentido_hare = sentido_alkeva[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = alapuertakeva[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2008-05-02 13:26:48 +00:00
|
|
|
clearRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(salgo, targetScreen[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x =- 1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 4) {
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
|
|
|
sentido_hare = sentidobj[l];
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
sentido_hare = sentido_alkeva[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = alapuertakeva[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 108)
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(171, 78);
|
|
|
|
clearRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(salgo, targetScreen[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 5) {
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0 && visible[l] == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
|
|
|
sentido_hare = sentidobj[l];
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
sentido_hare = sentido_alkeva[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = alapuertakeva[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_ve = 1;
|
|
|
|
clearRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(salgo, targetScreen[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
|
|
|
} else if (num_ejec == 6) {
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
lleva_al_hare(sitiobj_x[l], sitiobj_y[l]);
|
|
|
|
sentido_hare = sentidobj[l];
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
sentido_hare = sentido_alkeva[l];
|
2008-05-29 22:34:03 +00:00
|
|
|
objExit = alapuertakeva[l];
|
2008-05-30 07:19:09 +00:00
|
|
|
doBreak = 1;
|
2008-05-11 12:47:26 +00:00
|
|
|
previousMusic = roomMusic;
|
2008-05-02 13:26:48 +00:00
|
|
|
clearRoom();
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(salgo, targetScreen[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objExit == 105)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_19_6();
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
bool DrasculaEngine::pickupObject() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int h, n;
|
2008-05-27 12:02:26 +00:00
|
|
|
h = pickedObject;
|
2008-05-29 22:34:03 +00:00
|
|
|
checkFlags = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
|
|
|
menu_sin_volcar();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject < 7)
|
2008-05-02 13:26:48 +00:00
|
|
|
goto usando_verbos;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (n = 1; n < 43; n++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (whichObject() == n && inventoryObjects[n] == 0) {
|
2008-05-27 12:22:34 +00:00
|
|
|
inventoryObjects[n] = h;
|
2008-05-29 22:34:03 +00:00
|
|
|
takeObject = 0;
|
|
|
|
checkFlags = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
usando_verbos:
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (checkFlags == 1) {
|
|
|
|
if (checkMenuFlags())
|
2008-05-02 13:26:48 +00:00
|
|
|
return true;
|
2007-10-13 12:42:32 +00:00
|
|
|
}
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2008-05-29 22:34:03 +00:00
|
|
|
if (takeObject == 0)
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return false;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
bool DrasculaEngine::checkFlag(int fl) {
|
2008-05-02 13:26:48 +00:00
|
|
|
hare_se_mueve = 0;
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (menuScreen == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][328], "328.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 2) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if ((pickedObject == kVerbLook && fl == 22 && flags[23] == 0)
|
|
|
|
|| (pickedObject == kVerbOpen && fl == 22 && flags[23] == 0)) {
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][164], "164.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[23] = 1;
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2008-05-29 22:34:03 +00:00
|
|
|
addObject(7);
|
|
|
|
addObject(18);
|
2008-05-27 12:02:26 +00:00
|
|
|
} else if (pickedObject == kVerbLook && fl == 22 && flags[23] == 1)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][307], "307.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][328], "328.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 7)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][143], "143.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 7)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][144], "144.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 8)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][145], "145.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 8)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][146], "146.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 9)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][147], "147.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 9)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][148], "148.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 10)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][151], "151.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 11)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][152], "152.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 11)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][153], "153.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 12)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][154], "154.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 13)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][155], "155.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 14)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][157], "157.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][58], "58.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 16)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][158], "158.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 17)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][159], "159.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 18)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][160], "160.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 19)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][161], "161.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 20)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][162], "162.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 23)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][152], "152.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 3) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 22)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][307], "307.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][328], "328.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 7)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][143], "143.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 7)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][144], "144.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 8)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][145], "145.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 8)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][146], "146.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 9)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][147], "147.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 9)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][148], "148.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 10)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][151], "151.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 11)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][152], "152.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 11)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][153], "153.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 12)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][154], "154.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 13)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][155], "155.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 14)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][157], "157.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][58], "58.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 16)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][158], "158.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 17)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][159], "159.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 18)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][160], "160.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 19)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][161], "161.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 20)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][162], "162.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 23)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][152], "152.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 4) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if ((pickedObject == 18 && fl == 19) || (pickedObject == 19 && fl == 18)) {
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
|
|
|
chooseObject(21);
|
2008-05-29 22:34:03 +00:00
|
|
|
removeObject(18);
|
|
|
|
removeObject(19);
|
2008-05-27 12:02:26 +00:00
|
|
|
} else if ((pickedObject == 14 && fl == 19) || (pickedObject == 19 && fl == 14))
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][484], "484.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][328], "328.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 7)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][478], "478.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 8)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][480], "480.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 9) {
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][482], "482.als");
|
|
|
|
talk(_text[_lang][483], "483.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
} else if (pickedObject == kVerbLook && fl == 10)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][485], "485.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 11)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][488], "488.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 12)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][486], "486.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 13)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][490], "490.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 14)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][122], "122.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][117], "117.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][118], "118.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][119], "119.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 16)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][491], "491.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 17)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][478], "478.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 18)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][493], "493.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 19) {
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][494], "494.als");
|
|
|
|
talk(_text[_lang][495], "495.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
} else if (pickedObject == kVerbLook && fl == 20)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][162], "162.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 21)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][496], "496.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 22)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][161], "161.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 5) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][328], "328.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 7)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][478],"478.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 8)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][120], "120.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 9) {
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][482], "482.als");
|
|
|
|
talk(_text[_lang][483], "483.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
} else if (pickedObject == kVerbLook && fl == 11)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][488], "488.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 13)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][490], "490.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 14)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][121], "121.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][117], "117.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][118], "118.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 15)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][119], "119.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 17)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][478], "478.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 20)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][162], "162.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 6) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][328], "328.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 9) {
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][482], "482.als");
|
|
|
|
talk(_text[_lang][483], "483.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
} else if (pickedObject == kVerbLook && fl == 20)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][123], "123.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 21)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][441], "441.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][308], "308.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][310], "310.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbClose && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][311], "311.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbMove && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][312], "312.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbPick && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][313], "313.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][314], "314.als");
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 62)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_62(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 63)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_63(fl);
|
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 2) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][308], "308.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][310], "310.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbClose && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][311], "311.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbMove && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][312], "312.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbPick && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][313], "313.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][314], "314.als");
|
2008-05-27 09:03:22 +00:00
|
|
|
// Note: the original check was strcmp(num_room, "18.alg")
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 11 && fl == 50 && flags[22] == 0 && roomNumber != 18)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][315], "315.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 13 && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][156], "156.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 20 && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][163], "163.als");
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_1(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 3)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_3(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 4)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_4(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 5)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_5(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 6)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_6(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 7)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_7(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 8)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_8(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 9)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_9(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 12)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_12(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 14)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_14(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 15)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_15(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 16)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_16(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 17)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_17(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 18)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_18(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 19)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_19(fl);
|
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 3) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][309], "309.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][310], "310.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbClose && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][311], "311.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbMove && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][312], "312.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbPick && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][313], "313.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][314], "314.als");
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 13) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (room_13(fl))
|
|
|
|
return true;
|
|
|
|
} else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 4) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 28)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][178], "178.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][309], "309.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][310], "310.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbClose && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][311], "311.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbMove && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][312], "312.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbPick && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][313], "313.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][314], "314.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 8 && fl == 50 && flags[18] == 0)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][481], "481.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 9 && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][484], "484.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 12 && fl == 50 && flags[18] == 0)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][487], "487.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 20 && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][487], "487.als");
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 21) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (room_21(fl))
|
|
|
|
return true;
|
2008-05-27 09:03:22 +00:00
|
|
|
} else if (roomNumber == 22)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_22(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 23)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_23(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 24)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_24(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 26)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_26(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 27)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_27(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 29)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_29(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 30)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_30(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 31)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_31(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 34)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_34(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 35)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_35(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 44)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_44(fl);
|
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 5) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 50)
|
2008-05-02 13:26:48 +00:00
|
|
|
talk("Cuanto mas me miro, mas me gusto", "54.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 50)
|
2008-05-02 13:26:48 +00:00
|
|
|
talk("y luego como me cierro", "19.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbClose && fl == 50)
|
2008-05-02 13:26:48 +00:00
|
|
|
talk("Tendre que abrirme primero no", "19.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbMove && fl == 50)
|
2008-05-02 13:26:48 +00:00
|
|
|
talk("Estoy bien donde estoy", "19.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbPick && fl == 50)
|
2008-05-02 13:26:48 +00:00
|
|
|
talk("Ya me tengo", "11.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 50)
|
2008-05-02 13:26:48 +00:00
|
|
|
talk("hola yo", "16.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == 20 && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][487], "487.als");
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 49)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_49(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 53)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_53(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 54)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_54(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 55)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_55(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 56) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (room_56(fl))
|
|
|
|
return true;
|
|
|
|
} else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 6) {
|
2008-05-27 12:02:26 +00:00
|
|
|
if (pickedObject == kVerbLook && fl == 50 && flags[0] == 1)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][308], "308.als");
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbLook && fl == 50 && flags[0] == 0)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][310], "250.als" );
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbOpen && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][310], "310.als" );
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbClose && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][311], "311.als" );
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbMove && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][312], "312.als" );
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbPick && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][313], "313.als" );
|
2008-05-27 12:02:26 +00:00
|
|
|
else if (pickedObject == kVerbTalk && fl == 50)
|
2008-05-02 15:09:20 +00:00
|
|
|
talk(_text[_lang][314], "314.als" );
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 102)
|
2008-05-29 22:34:03 +00:00
|
|
|
room_pendulum(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 58)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_58(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 59)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_59(fl);
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 60) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (room_60(fl))
|
|
|
|
return true;
|
2008-05-27 09:03:22 +00:00
|
|
|
} else if (roomNumber == 61)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_61(fl);
|
|
|
|
else
|
2008-05-29 22:34:03 +00:00
|
|
|
hasAnswer = 0;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
if (hasAnswer == 0 && hasName == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_0();
|
2008-05-29 22:34:03 +00:00
|
|
|
else if (hasAnswer == 0 && menuScreen == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
room_0();
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return false;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::setCursorTable() {
|
|
|
|
int cursorPos[8];
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
cursorPos[0] = 225;
|
|
|
|
cursorPos[1] = 56;
|
|
|
|
cursorPos[2] = mouseX - 20;
|
|
|
|
cursorPos[3] = mouseY - 12;
|
|
|
|
cursorPos[4] = 40;
|
|
|
|
cursorPos[5] = 25;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(cursorPos, tableSurface, screenSurface);
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::enterName() {
|
2008-05-02 13:26:48 +00:00
|
|
|
Common::KeyCode key;
|
|
|
|
int v = 0, h = 0;
|
|
|
|
char select2[23];
|
|
|
|
strcpy(select2, " ");
|
|
|
|
for (;;) {
|
|
|
|
select2[v] = '-';
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(115, 14, 115, 14, 176, 9, drawSurface1, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
print_abc(select2, 117, 15);
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-29 22:34:03 +00:00
|
|
|
key = getScan();
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(70);
|
|
|
|
if (key != 0) {
|
2008-05-26 17:49:32 +00:00
|
|
|
if (key >= 0 && key <= 0xFF && isalpha(key))
|
|
|
|
select2[v] = tolower(key);
|
2008-05-02 13:26:48 +00:00
|
|
|
else if ((key == Common::KEYCODE_LCTRL) || (key == Common::KEYCODE_RCTRL))
|
|
|
|
select2[v] = '\164';
|
2008-05-26 17:49:32 +00:00
|
|
|
else if (key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9)
|
|
|
|
select2[v] = key;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (key == Common::KEYCODE_SPACE)
|
|
|
|
select2[v] = '\167';
|
|
|
|
else if (key == ESC)
|
|
|
|
break;
|
|
|
|
else if (key == Common::KEYCODE_RETURN) {
|
|
|
|
select2[v] = '\0';
|
|
|
|
h = 1;
|
|
|
|
break;
|
|
|
|
} else if (key == Common::KEYCODE_BACKSPACE)
|
|
|
|
select2[v] = '\0';
|
|
|
|
else
|
|
|
|
v--;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (key == Common::KEYCODE_BACKSPACE)
|
|
|
|
v--;
|
|
|
|
else
|
|
|
|
v++;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
if (v == 22)
|
|
|
|
v = 21;
|
|
|
|
else if (v == -1)
|
|
|
|
v = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
if (h == 1) {
|
|
|
|
strcpy(select, select2);
|
|
|
|
hay_seleccion = 1;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::para_grabar(char gameName[]) {
|
|
|
|
saveGame(gameName);
|
2008-05-27 07:17:15 +00:00
|
|
|
playSound("99.als");
|
|
|
|
stopSound();
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::OpenSSN(const char *Name, int Pause) {
|
|
|
|
MiVideoSSN = (byte *)malloc(64256);
|
2008-05-29 22:34:03 +00:00
|
|
|
globalSpeed = 1000 / Pause;
|
2008-05-02 13:26:48 +00:00
|
|
|
FrameSSN = 0;
|
|
|
|
UsingMem = 0;
|
|
|
|
if (MiVideoSSN == NULL)
|
|
|
|
return;
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session = new Common::File;
|
|
|
|
_Session->open(Name);
|
|
|
|
mSession = TryInMem(_Session);
|
2008-05-02 13:26:48 +00:00
|
|
|
LastFrame = _system->getMillis();
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
int DrasculaEngine::PlayFrameSSN() {
|
|
|
|
int Exit = 0;
|
|
|
|
int Lengt;
|
|
|
|
byte *BufferSSN;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (!UsingMem)
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session->read(&CHUNK, 1);
|
2008-05-02 13:26:48 +00:00
|
|
|
else {
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(&CHUNK, mSession, 1);
|
|
|
|
mSession += 1;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
switch (CHUNK) {
|
2008-05-11 20:05:09 +00:00
|
|
|
case SET_PAL:
|
2008-05-02 13:26:48 +00:00
|
|
|
if (!UsingMem)
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session->read(dacSSN, 768);
|
2008-05-02 13:26:48 +00:00
|
|
|
else {
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(dacSSN, mSession, 768);
|
|
|
|
mSession += 768;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
set_dacSSN(dacSSN);
|
|
|
|
break;
|
|
|
|
case EMPTY_FRAME:
|
|
|
|
WaitFrameSSN();
|
|
|
|
break;
|
|
|
|
case INIT_FRAME:
|
|
|
|
if (!UsingMem) {
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session->read(&CMP, 1);
|
|
|
|
_Session->read(&Lengt, 4);
|
2008-05-02 11:18:46 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(&CMP, mSession, 1);
|
|
|
|
mSession += 1;
|
|
|
|
memcpy(&Lengt, mSession, 4);
|
|
|
|
mSession += 4;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
if (CMP == CMP_RLE) {
|
|
|
|
if (!UsingMem) {
|
|
|
|
BufferSSN = (byte *)malloc(Lengt);
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session->read(BufferSSN, Lengt);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
BufferSSN = (byte *)malloc(Lengt);
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(BufferSSN, mSession, Lengt);
|
|
|
|
mSession += Lengt;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
Des_RLE(BufferSSN, MiVideoSSN);
|
|
|
|
free(BufferSSN);
|
|
|
|
if (FrameSSN) {
|
|
|
|
WaitFrameSSN();
|
|
|
|
MixVideo(VGA, MiVideoSSN);
|
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
} else {
|
|
|
|
WaitFrameSSN();
|
|
|
|
memcpy(VGA, MiVideoSSN, 64000);
|
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
}
|
|
|
|
_system->updateScreen();
|
|
|
|
FrameSSN++;
|
|
|
|
} else {
|
|
|
|
if (CMP == CMP_OFF) {
|
|
|
|
if (!UsingMem) {
|
|
|
|
BufferSSN = (byte *)malloc(Lengt);
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session->read(BufferSSN, Lengt);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
BufferSSN = (byte *)malloc(Lengt);
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(BufferSSN, mSession, Lengt);
|
|
|
|
mSession += Lengt;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
Des_OFF(BufferSSN, MiVideoSSN, Lengt);
|
|
|
|
free(BufferSSN);
|
|
|
|
if (FrameSSN) {
|
|
|
|
WaitFrameSSN();
|
|
|
|
MixVideo(VGA, MiVideoSSN);
|
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
} else {
|
|
|
|
WaitFrameSSN();
|
|
|
|
memcpy(VGA, MiVideoSSN, 64000);
|
|
|
|
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
|
|
|
|
}
|
|
|
|
_system->updateScreen();
|
|
|
|
FrameSSN++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case END_ANIM:
|
|
|
|
Exit = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
Exit = 1;
|
|
|
|
break;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return (!Exit);
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::EndSSN() {
|
|
|
|
free(MiVideoSSN);
|
|
|
|
if (UsingMem)
|
|
|
|
free(pointer);
|
|
|
|
else {
|
2008-05-29 22:34:03 +00:00
|
|
|
_Session->close();
|
|
|
|
delete _Session;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
byte *DrasculaEngine::TryInMem(Common::File *Session) {
|
2008-05-02 13:26:48 +00:00
|
|
|
int Lengt;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
Session->seek(0, SEEK_END);
|
|
|
|
Lengt = Session->pos();
|
|
|
|
Session->seek(0, SEEK_SET);
|
2008-05-02 13:26:48 +00:00
|
|
|
pointer = (byte *)malloc(Lengt);
|
|
|
|
if (pointer == NULL)
|
|
|
|
return NULL;
|
2008-05-29 22:34:03 +00:00
|
|
|
Session->read(pointer, Lengt);
|
2008-05-02 13:26:48 +00:00
|
|
|
UsingMem = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
Session->close();
|
|
|
|
delete Session;
|
2008-05-02 13:26:48 +00:00
|
|
|
return pointer;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::set_dacSSN(byte *PalBuf) {
|
2008-05-11 20:05:09 +00:00
|
|
|
setPalette((byte *)PalBuf);
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::Des_OFF(byte *BufferOFF, byte *MiVideoOFF, int Lenght) {
|
|
|
|
int x = 0;
|
|
|
|
unsigned char Reps;
|
|
|
|
int Offset;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
memset(MiVideoSSN, 0, 64000);
|
|
|
|
while (x < Lenght) {
|
|
|
|
Offset = BufferOFF[x] + BufferOFF[x + 1] * 256;
|
|
|
|
Reps = BufferOFF[x + 2];
|
|
|
|
memcpy(MiVideoOFF + Offset, &BufferOFF[x + 3], Reps);
|
|
|
|
x += 3 + Reps;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::Des_RLE(byte *BufferRLE, byte *MiVideoRLE) {
|
|
|
|
signed int con = 0;
|
|
|
|
unsigned int X = 0;
|
|
|
|
unsigned int fExit = 0;
|
|
|
|
char ch, rep;
|
|
|
|
while (!fExit) {
|
|
|
|
ch = *BufferRLE++;
|
|
|
|
rep = 1;
|
|
|
|
if ((ch & 192) == 192) {
|
|
|
|
rep = (ch & 63);
|
|
|
|
ch =* BufferRLE++;
|
|
|
|
}
|
|
|
|
for (con = 0; con < rep; con++) {
|
|
|
|
*MiVideoRLE++ = ch;
|
|
|
|
X++;
|
|
|
|
if (X > 64000)
|
|
|
|
fExit = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::MixVideo(byte *OldScreen, byte *NewScreen) {
|
|
|
|
int x;
|
|
|
|
for (x = 0; x < 64000; x++)
|
|
|
|
OldScreen[x] ^= NewScreen[x];
|
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::WaitFrameSSN() {
|
|
|
|
uint32 now;
|
2008-05-29 22:34:03 +00:00
|
|
|
while ((now = _system->getMillis()) - LastFrame < ((uint32) globalSpeed))
|
|
|
|
_system->delayMillis(globalSpeed - (now - LastFrame));
|
|
|
|
LastFrame = LastFrame + globalSpeed;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
byte *DrasculaEngine::loadPCX(byte *NamePcc) {
|
2008-05-02 13:26:48 +00:00
|
|
|
signed int con = 0;
|
|
|
|
unsigned int X = 0;
|
|
|
|
unsigned int fExit = 0;
|
|
|
|
char ch, rep;
|
|
|
|
byte *AuxPun;
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
AuxPun = AuxBuffDes;
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
while (!fExit) {
|
|
|
|
ch = *NamePcc++;
|
|
|
|
rep = 1;
|
|
|
|
if ((ch & 192) == 192) {
|
|
|
|
rep = (ch & 63);
|
|
|
|
ch = *NamePcc++;
|
|
|
|
}
|
|
|
|
for (con = 0; con< rep; con++) {
|
|
|
|
*AuxPun++ = ch;
|
|
|
|
X++;
|
|
|
|
if (X > 64000)
|
|
|
|
fExit = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
return AuxBuffDes;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::set_dac(byte *dac) {
|
2008-05-11 20:05:09 +00:00
|
|
|
setPalette((byte *)dac);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::WaitForNext(int FPS) {
|
|
|
|
_system->delayMillis(1000 / FPS);
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
int DrasculaEngine::vez() {
|
|
|
|
return _system->getMillis() / 20; // originaly was 1
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 18:18:38 +00:00
|
|
|
void DrasculaEngine::reduce_hare_chico(int xx1, int yy1, int xx2, int yy2, int width, int height, int factor, byte *dir_inicio, byte *dir_fin) {
|
|
|
|
float totalX, totalY;
|
2008-05-02 13:26:48 +00:00
|
|
|
int n, m;
|
|
|
|
float pixel_x, pixel_y;
|
|
|
|
int pos_pixel[6];
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 18:18:38 +00:00
|
|
|
newWidth = (width * factor) / 100;
|
|
|
|
newHeight = (height * factor) / 100;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 18:18:38 +00:00
|
|
|
totalX = width / newWidth;
|
|
|
|
totalY = height / newHeight;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
pixel_x = xx1;
|
|
|
|
pixel_y = yy1;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 18:18:38 +00:00
|
|
|
for (n = 0; n < newHeight; n++) {
|
|
|
|
for (m = 0; m < newWidth; m++) {
|
2008-05-02 13:26:48 +00:00
|
|
|
pos_pixel[0] = (int)pixel_x;
|
|
|
|
pos_pixel[1] = (int)pixel_y;
|
|
|
|
pos_pixel[2] = xx2 + m;
|
|
|
|
pos_pixel[3] = yy2 + n;
|
|
|
|
pos_pixel[4] = 1;
|
|
|
|
pos_pixel[5] = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
copyRectClip(pos_pixel, dir_inicio, dir_fin);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 18:18:38 +00:00
|
|
|
pixel_x = pixel_x + totalX;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
pixel_x = xx1;
|
2008-05-29 18:18:38 +00:00
|
|
|
pixel_y = pixel_y + totalY;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
char DrasculaEngine::codifica(char car) {
|
|
|
|
return ~car;
|
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
void DrasculaEngine::quadrant_1() {
|
|
|
|
float distance_x, distance_y;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = hare_x - sitio_x;
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = hare_x + ancho_hare / 2 - sitio_x;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_y = (hare_y + alto_hare) - sitio_y;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (distance_x < distance_y) {
|
2008-05-02 13:26:48 +00:00
|
|
|
direccion_hare = 0;
|
|
|
|
sentido_hare = 2;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = (int)(distance_x / (distance_y / PASO_HARE_Y));
|
2008-05-02 11:18:46 +00:00
|
|
|
} else {
|
2008-05-02 13:26:48 +00:00
|
|
|
direccion_hare = 7;
|
|
|
|
sentido_hare = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepY = (int)(distance_y / (distance_x / PASO_HARE_X));
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
void DrasculaEngine::quadrant_2() {
|
|
|
|
float distance_x, distance_y;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = abs(hare_x + ancho_hare - sitio_x);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = abs(hare_x + ancho_hare / 2 - sitio_x);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_y = (hare_y + alto_hare) - sitio_y;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (distance_x < distance_y) {
|
2008-05-02 13:26:48 +00:00
|
|
|
direccion_hare = 1;
|
|
|
|
sentido_hare = 2;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = (int)(distance_x / (distance_y / PASO_HARE_Y));
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
direccion_hare = 2;
|
|
|
|
sentido_hare = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepY = (int)(distance_y / (distance_x / PASO_HARE_X));
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
void DrasculaEngine::quadrant_3() {
|
|
|
|
float distance_x, distance_y;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = hare_x - sitio_x;
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = hare_x + ancho_hare / 2 - sitio_x;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_y = sitio_y - (hare_y + alto_hare);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (distance_x < distance_y) {
|
2008-05-02 13:26:48 +00:00
|
|
|
direccion_hare = 5;
|
|
|
|
sentido_hare = 3;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = (int)(distance_x / (distance_y / PASO_HARE_Y));
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
direccion_hare = 6;
|
|
|
|
sentido_hare = 0;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepY = (int)(distance_y / (distance_x / PASO_HARE_X));
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-06 06:07:22 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
void DrasculaEngine::quadrant_4() {
|
|
|
|
float distance_x, distance_y;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = abs(hare_x + ancho_hare - sitio_x);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_x = abs(hare_x + ancho_hare / 2 - sitio_x);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
distance_y = sitio_y - (hare_y + alto_hare);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (distance_x < distance_y) {
|
2008-05-02 13:26:48 +00:00
|
|
|
direccion_hare = 4;
|
|
|
|
sentido_hare = 3;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = (int)(distance_x / (distance_y / PASO_HARE_Y));
|
2008-05-02 13:26:48 +00:00
|
|
|
} else {
|
|
|
|
direccion_hare = 3;
|
|
|
|
sentido_hare = 1;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepY = (int)(distance_y / (distance_x / PASO_HARE_X));
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::saveGame(char gameName[]) {
|
2008-05-02 13:26:48 +00:00
|
|
|
Common::OutSaveFile *out;
|
|
|
|
int l;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
if (!(out = _saveFileMan->openForSaving(gameName))) {
|
2008-05-02 13:26:48 +00:00
|
|
|
error("no puedo abrir el archivo");
|
|
|
|
}
|
|
|
|
out->writeSint32LE(num_ejec);
|
2008-05-11 11:20:40 +00:00
|
|
|
out->write(currentData, 20);
|
2008-05-02 13:26:48 +00:00
|
|
|
out->writeSint32LE(hare_x);
|
|
|
|
out->writeSint32LE(hare_y);
|
|
|
|
out->writeSint32LE(sentido_hare);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (l = 1; l < 43; l++) {
|
2008-05-27 12:22:34 +00:00
|
|
|
out->writeSint32LE(inventoryObjects[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-11 10:28:25 +00:00
|
|
|
for (l = 0; l < NUM_FLAGS; l++) {
|
2008-05-02 13:26:48 +00:00
|
|
|
out->writeSint32LE(flags[l]);
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
out->writeSint32LE(takeObject);
|
2008-05-27 12:02:26 +00:00
|
|
|
out->writeSint32LE(pickedObject);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
out->finalize();
|
|
|
|
if (out->ioFailed())
|
2008-05-29 22:34:03 +00:00
|
|
|
warning("Can't write file '%s'. (Disk full?)", gameName);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
delete out;
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::increaseFrameNum() {
|
2008-05-02 13:26:48 +00:00
|
|
|
diff_vez = vez() - conta_vez;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (diff_vez >= 6) {
|
|
|
|
conta_vez = vez();
|
|
|
|
num_frame++;
|
|
|
|
if (num_frame == 6)
|
|
|
|
num_frame = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-26 17:49:32 +00:00
|
|
|
if (direccion_hare == 0 || direccion_hare == 7) {
|
2008-05-29 22:34:03 +00:00
|
|
|
hare_x = hare_x - stepX;
|
|
|
|
hare_y = hare_y - stepY;
|
2008-05-26 17:49:32 +00:00
|
|
|
} else if (direccion_hare == 1 || direccion_hare == 2) {
|
2008-05-29 22:34:03 +00:00
|
|
|
hare_x = hare_x + stepX;
|
|
|
|
hare_y = hare_y - stepY;
|
2008-05-26 17:49:32 +00:00
|
|
|
} else if (direccion_hare == 3 || direccion_hare == 4) {
|
2008-05-29 22:34:03 +00:00
|
|
|
hare_x = hare_x + stepX;
|
|
|
|
hare_y = hare_y + stepY;
|
2008-05-26 17:49:32 +00:00
|
|
|
} else if (direccion_hare == 5 || direccion_hare == 6) {
|
2008-05-29 22:34:03 +00:00
|
|
|
hare_x = hare_x - stepX;
|
|
|
|
hare_y = hare_y + stepY;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec != 2) {
|
2008-05-29 18:18:38 +00:00
|
|
|
hare_y += (int)(alto_hare - newHeight);
|
|
|
|
hare_x += (int)(ancho_hare - newWidth);
|
|
|
|
alto_hare = (int)newHeight;
|
|
|
|
ancho_hare = (int)newWidth;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
int DrasculaEngine::whichObject() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int n = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (n = 1; n < 43; n++) {
|
2008-05-27 07:04:56 +00:00
|
|
|
if (mouseX > itemLocations[n].x && mouseY > itemLocations[n].y
|
|
|
|
&& mouseX < itemLocations[n].x + OBJWIDTH && mouseY < itemLocations[n].y + OBJHEIGHT)
|
2008-05-02 13:26:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return n;
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
bool DrasculaEngine::checkMenuFlags() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int h, n;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (n = 0; n < 43; n++) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (whichObject() == n) {
|
2008-05-27 12:22:34 +00:00
|
|
|
h = inventoryObjects[n];
|
2008-05-02 13:26:48 +00:00
|
|
|
if (h != 0)
|
2008-05-29 22:34:03 +00:00
|
|
|
if (checkFlag(h))
|
2008-05-02 13:26:48 +00:00
|
|
|
return true;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
return false;
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::converse(const char *nom_fich) {
|
2008-05-02 13:26:48 +00:00
|
|
|
int h;
|
2008-05-27 12:22:34 +00:00
|
|
|
int game1 = 1, game2 = 1, game3 = 1, game4 = 1;
|
|
|
|
char phrase1[78];
|
|
|
|
char phrase2[78];
|
|
|
|
char phrase3[87];
|
|
|
|
char phrase4[78];
|
2008-05-02 13:26:48 +00:00
|
|
|
char para_codificar[13];
|
2008-05-27 12:22:34 +00:00
|
|
|
char sound1[13];
|
|
|
|
char sound2[13];
|
|
|
|
char sound3[13];
|
|
|
|
char sound4[13];
|
|
|
|
int length;
|
|
|
|
int answer1;
|
|
|
|
int answer2;
|
|
|
|
int answer3;
|
|
|
|
int used1 = 0;
|
|
|
|
int used2 = 0;
|
|
|
|
int used3 = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
char buffer[256];
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
rompo_y_salgo = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
strcpy(para_codificar, nom_fich);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 5)
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
ald = new Common::File;
|
|
|
|
ald->open(nom_fich);
|
|
|
|
if (!ald->isOpen()) {
|
|
|
|
error("missing data file");
|
|
|
|
}
|
|
|
|
int size = ald->size();
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", phrase1);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", phrase2);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", phrase3);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", phrase4);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", sound1);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", sound2);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", sound3);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%s", sound4);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%d", &answer1);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%d", &answer2);
|
2008-05-02 13:26:48 +00:00
|
|
|
getLine(ald, buffer, size);
|
2008-05-27 12:22:34 +00:00
|
|
|
sscanf(buffer, "%d", &answer3);
|
2008-05-02 13:26:48 +00:00
|
|
|
delete ald;
|
|
|
|
ald = NULL;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2 && !strcmp(nom_fich, "op_5.cal") && flags[38] == 1 && flags[33] == 1) {
|
2008-05-27 12:22:34 +00:00
|
|
|
strcpy(phrase3, _text[_lang][405]);
|
|
|
|
strcpy(sound3, "405.als");
|
|
|
|
answer3 = 31;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 6 && !strcmp(nom_fich, "op_12.cal") && flags[7] == 1) {
|
2008-05-27 12:22:34 +00:00
|
|
|
strcpy(phrase3, _text[_lang][273]);
|
|
|
|
strcpy(sound3, "273.als");
|
|
|
|
answer3 = 14;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 6 && !strcmp(nom_fich, "op_12.cal") && flags[10] == 1) {
|
2008-05-27 12:22:34 +00:00
|
|
|
strcpy(phrase3, " cuanto queda para que acabe el partido?");
|
|
|
|
strcpy(sound3, "274.als");
|
|
|
|
answer3 = 15;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
length = strlen(phrase1);
|
|
|
|
for (h = 0; h < length; h++)
|
|
|
|
if (phrase1[h] == (char)0xa7)
|
|
|
|
phrase1[h] = ' ';
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
length = strlen(phrase2);
|
|
|
|
for (h = 0; h < length; h++)
|
|
|
|
if (phrase2[h] == (char)0xa7)
|
|
|
|
phrase2[h] = ' ';
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
length = strlen(phrase3);
|
|
|
|
for (h = 0; h < length; h++)
|
|
|
|
if (phrase3[h] == (char)0xa7)
|
|
|
|
phrase3[h] = ' ';
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
length = strlen(phrase4);
|
|
|
|
for (h = 0; h < length; h++)
|
|
|
|
if (phrase4[h] == (char)0xa7)
|
|
|
|
phrase4[h] = ' ';
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
loadPic("car.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-02 13:26:48 +00:00
|
|
|
// TODO code here should limit y position for mouse in dialog menu,
|
|
|
|
// but we can't implement this due lack backend functionality
|
|
|
|
// from 1(top) to 31
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorLightGreen);
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
bucle_opc:
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1 || num_ejec == 4 || num_ejec == 6) {
|
2008-05-11 10:03:06 +00:00
|
|
|
if (musicStatus() == 0 && flags[11] == 0)
|
2008-05-11 12:47:26 +00:00
|
|
|
playMusic(roomMusic);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 2) {
|
2008-05-11 12:47:26 +00:00
|
|
|
if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0)
|
|
|
|
playMusic(roomMusic);
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 3 || num_ejec == 5) {
|
2008-05-11 10:03:06 +00:00
|
|
|
if (musicStatus() == 0)
|
2008-05-11 12:47:26 +00:00
|
|
|
playMusic(roomMusic);
|
2007-08-17 11:19:17 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY > 0 && mouseY < 9) {
|
2008-05-30 07:16:17 +00:00
|
|
|
if (used1 == 1 && _color != kColorWhite)
|
|
|
|
color_abc(kColorWhite);
|
|
|
|
else if (used1 == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
2008-05-27 06:35:00 +00:00
|
|
|
} else if (mouseY > 8 && mouseY < 17) {
|
2008-05-30 07:16:17 +00:00
|
|
|
if (used2 == 1 && _color != kColorWhite)
|
|
|
|
color_abc(kColorWhite);
|
|
|
|
else if (used2 == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
2008-05-27 06:35:00 +00:00
|
|
|
} else if (mouseY > 16 && mouseY < 25) {
|
2008-05-30 07:16:17 +00:00
|
|
|
if (used3 == 1 && _color != kColorWhite)
|
|
|
|
color_abc(kColorWhite);
|
|
|
|
else if (used3 == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
|
|
|
} else if (_color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseY > 0 && mouseY < 9)
|
2008-05-27 12:22:34 +00:00
|
|
|
game1 = 2;
|
2008-05-27 06:35:00 +00:00
|
|
|
else if (mouseY > 8 && mouseY < 17)
|
2008-05-27 12:22:34 +00:00
|
|
|
game2 = 2;
|
2008-05-27 06:35:00 +00:00
|
|
|
else if (mouseY > 16 && mouseY < 25)
|
2008-05-27 12:22:34 +00:00
|
|
|
game3 = 2;
|
2008-05-27 06:35:00 +00:00
|
|
|
else if (mouseY > 24 && mouseY < 33)
|
2008-05-27 12:22:34 +00:00
|
|
|
game4 = 2;
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
print_abc_opc(phrase1, 1, 2, game1);
|
|
|
|
print_abc_opc(phrase2, 1, 10, game2);
|
|
|
|
print_abc_opc(phrase3, 1, 18, game3);
|
|
|
|
print_abc_opc(phrase4, 1, 26, game4);
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if ((button_izq == 1) && (game1 == 2)) {
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(100);
|
2008-05-27 12:22:34 +00:00
|
|
|
used1 = 1;
|
|
|
|
talk(phrase1, sound1);
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3)
|
|
|
|
grr();
|
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
response(answer1);
|
|
|
|
} else if ((button_izq == 1) && (game2 == 2)) {
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(100);
|
2008-05-27 12:22:34 +00:00
|
|
|
used2 = 1;
|
|
|
|
talk(phrase2, sound2);
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3)
|
|
|
|
grr();
|
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
response(answer2);
|
|
|
|
} else if ((button_izq == 1) && (game3 == 2)) {
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(100);
|
2008-05-27 12:22:34 +00:00
|
|
|
used3 = 1;
|
|
|
|
talk(phrase3, sound3);
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3)
|
|
|
|
grr();
|
|
|
|
else
|
2008-05-27 12:22:34 +00:00
|
|
|
response(answer3);
|
|
|
|
} else if ((button_izq == 1) && (game4 == 2)) {
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(100);
|
2008-05-27 12:22:34 +00:00
|
|
|
talk(phrase4, sound4);
|
2008-05-02 13:26:48 +00:00
|
|
|
rompo_y_salgo = 1;
|
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (button_izq == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
delay(100);
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorLightGreen);
|
2007-08-17 11:19:17 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
game1 = (used1 == 0) ? 1 : 3;
|
|
|
|
game2 = (used2 == 0) ? 1 : 3;
|
|
|
|
game3 = (used3 == 0) ? 1 : 3;
|
2008-05-27 12:22:34 +00:00
|
|
|
game4 = 1;
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (rompo_y_salgo == 0)
|
|
|
|
goto bucle_opc;
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 2)
|
2008-05-29 22:34:03 +00:00
|
|
|
loadPic(menuBackground);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
|
|
|
loadPic("99.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(backSurface, 1);
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec != 5)
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
void DrasculaEngine::print_abc_opc(const char *said, int x_pantalla, int y_pantalla, int game) {
|
2008-05-02 13:26:48 +00:00
|
|
|
int pos_texto[6];
|
2008-05-27 12:22:34 +00:00
|
|
|
int y_de_signos, y_de_letra, x_de_letra = 0, h, length;
|
|
|
|
length = strlen(said);
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
for (h = 0; h < length; h++) {
|
|
|
|
if (game == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
y_de_letra = Y_ABC_OPC_1;
|
|
|
|
y_de_signos = Y_SIGNOS_OPC_1;
|
2008-05-27 12:22:34 +00:00
|
|
|
} else if (game == 3) {
|
2008-05-02 13:26:48 +00:00
|
|
|
y_de_letra = Y_ABC_OPC_3;
|
|
|
|
y_de_signos = Y_SIGNOS_OPC_3;
|
|
|
|
} else {
|
|
|
|
y_de_letra = Y_ABC_OPC_2;
|
|
|
|
y_de_signos = Y_SIGNOS_OPC_2;
|
2007-08-17 11:19:17 +00:00
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
int c = toupper(said[h]);
|
2008-05-29 12:17:40 +00:00
|
|
|
|
|
|
|
if (c == '\265') x_de_letra = X_A_OPC;
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c == '\267') x_de_letra = X_A_OPC;
|
|
|
|
else if (c == '\266') x_de_letra = X_A_OPC;
|
2008-05-29 12:17:40 +00:00
|
|
|
else if (c == '\200') x_de_letra = X_A_OPC + 2 * 7; // C
|
|
|
|
else if (c == '\207') x_de_letra = X_A_OPC + 2 * 7; // C
|
|
|
|
else if (c == '\220') x_de_letra = X_A_OPC + 4 * 7; // E
|
|
|
|
else if (c == '\324') x_de_letra = X_A_OPC + 4 * 7; // E
|
|
|
|
else if (c == '\322') x_de_letra = X_A_OPC + 4 * 7; // E
|
|
|
|
else if (c == '\326') x_de_letra = X_A_OPC + 8 * 7; // I
|
|
|
|
else if (c == '\336') x_de_letra = X_A_OPC + 8 * 7; // I
|
|
|
|
else if (c == '\327') x_de_letra = X_A_OPC + 8 * 7; // I
|
2008-05-24 21:23:06 +00:00
|
|
|
else if (c == '\047') x_de_letra = X_GN_OPC;
|
|
|
|
else if (c == '\340') x_de_letra = X_O_OPC;
|
|
|
|
else if (c == '\342') x_de_letra = X_O_OPC;
|
|
|
|
else if (c == '\343') x_de_letra = X_O_OPC;
|
2008-05-29 12:17:40 +00:00
|
|
|
else if (c == '\353') x_de_letra = X_O_OPC + 6 * 7; // U
|
|
|
|
else if (c == '\352') x_de_letra = X_O_OPC + 6 * 7; // U
|
|
|
|
else if (c == '\351') x_de_letra = X_O_OPC + 6 * 7; // U
|
|
|
|
else if (c >= 'A' && c <= 'N')
|
|
|
|
x_de_letra = X_A_OPC + (c - 'A') * 7;
|
|
|
|
else if (c >= 'O' && c <= 'Z')
|
|
|
|
x_de_letra = X_O_OPC + (c - 'O') * 7;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == ' ')
|
2008-05-11 10:53:59 +00:00
|
|
|
x_de_letra = SPACE_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else {
|
|
|
|
y_de_letra = y_de_signos;
|
|
|
|
if (c == '.')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_DOT_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == ',')
|
|
|
|
x_de_letra = X_COMA_OPC;
|
|
|
|
else if (c == '-')
|
2008-05-11 10:28:25 +00:00
|
|
|
x_de_letra = X_HYPHEN_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == '?')
|
|
|
|
x_de_letra = X_CIERRA_INTERROGACION_OPC;
|
|
|
|
else if (c == 0xa8)
|
|
|
|
x_de_letra = X_ABRE_INTERROGACION_OPC;
|
|
|
|
// else if (c == '\'') // FIXME
|
2008-05-11 10:53:59 +00:00
|
|
|
// x_de_letra = SPACE; // space for now
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == '"')
|
|
|
|
x_de_letra = X_COMILLAS_OPC;
|
|
|
|
else if (c == '!')
|
|
|
|
x_de_letra = X_CIERRA_INTERROGACION_OPC;
|
|
|
|
else if (c == 0xad)
|
|
|
|
x_de_letra = X_ABRE_EXCLAMACION_OPC;
|
|
|
|
else if (c == ';')
|
2008-05-29 22:34:03 +00:00
|
|
|
x_de_letra = X_pointY_COMA_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == '>')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_GREATER_THAN_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == '<')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_LESSER_THAN_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == '$')
|
|
|
|
x_de_letra = X_DOLAR_OPC;
|
|
|
|
else if (c == '%')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_PERCENT_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == ':')
|
|
|
|
x_de_letra = X_DOS_PUNTOS_OPC;
|
|
|
|
else if (c == '&')
|
|
|
|
x_de_letra = X_AND_OPC;
|
|
|
|
else if (c == '/')
|
|
|
|
x_de_letra = X_BARRA_OPC;
|
|
|
|
else if (c == '(')
|
2008-05-11 10:28:25 +00:00
|
|
|
x_de_letra = X_BRACKET_OPEN_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == ')')
|
2008-05-11 10:28:25 +00:00
|
|
|
x_de_letra = X_BRACKET_CLOSE_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (c == '*')
|
|
|
|
x_de_letra = X_ASTERISCO_OPC;
|
|
|
|
else if (c == '+')
|
2008-05-11 10:36:48 +00:00
|
|
|
x_de_letra = X_PLUS_OPC;
|
2008-05-29 16:53:28 +00:00
|
|
|
else if (c >= '1' && c <= '9')
|
2008-05-29 12:17:40 +00:00
|
|
|
x_de_letra = X_N1_OPC + (c - '1') * 7;
|
2008-05-29 16:53:28 +00:00
|
|
|
// "0" is mapped after "9" in the game's font
|
|
|
|
// (it's mapped before "1" normally)
|
|
|
|
else if (c == '0')
|
|
|
|
x_de_letra = X_N0_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
pos_texto[0] = x_de_letra;
|
|
|
|
pos_texto[1] = y_de_letra;
|
|
|
|
pos_texto[2] = x_pantalla;
|
|
|
|
pos_texto[3] = y_pantalla;
|
2008-05-11 10:28:25 +00:00
|
|
|
pos_texto[4] = CHAR_WIDTH_OPC;
|
|
|
|
pos_texto[5] = CHAR_HEIGHT_OPC;
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_texto, backSurface, screenSurface);
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-11 10:28:25 +00:00
|
|
|
x_pantalla = x_pantalla + CHAR_WIDTH_OPC;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
void DrasculaEngine::response(int funcion) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1) {
|
|
|
|
if (funcion == 10)
|
2008-05-29 22:34:03 +00:00
|
|
|
talk_drunk(_textb[_lang][1], "B1.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (funcion == 11)
|
2008-05-29 22:34:03 +00:00
|
|
|
talk_drunk(_textb[_lang][2], "B2.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (funcion == 12)
|
2008-05-29 22:34:03 +00:00
|
|
|
talk_drunk(_textb[_lang][3], "B3.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
} else if (num_ejec == 2) {
|
|
|
|
if (funcion == 8)
|
|
|
|
animation_8_2();
|
|
|
|
else if (funcion == 9)
|
|
|
|
animation_9_2();
|
|
|
|
else if (funcion == 10)
|
|
|
|
animation_10_2();
|
|
|
|
else if (funcion == 15)
|
|
|
|
animation_15_2();
|
|
|
|
else if (funcion == 16)
|
|
|
|
animation_16_2();
|
|
|
|
else if (funcion == 17)
|
|
|
|
animation_17_2();
|
|
|
|
else if (funcion == 19)
|
|
|
|
animation_19_2();
|
|
|
|
else if (funcion == 20)
|
|
|
|
animation_20_2();
|
|
|
|
else if (funcion == 21)
|
|
|
|
animation_21_2();
|
|
|
|
else if (funcion == 23)
|
|
|
|
animation_23_2();
|
|
|
|
else if (funcion == 28)
|
|
|
|
animation_28_2();
|
|
|
|
else if (funcion == 29)
|
|
|
|
animation_29_2();
|
|
|
|
else if (funcion == 30)
|
|
|
|
animation_30_2();
|
|
|
|
else if (funcion == 31)
|
|
|
|
animation_31_2();
|
|
|
|
} else if (num_ejec == 4) {
|
|
|
|
if (funcion == 2)
|
|
|
|
animation_2_4();
|
|
|
|
else if (funcion == 3)
|
|
|
|
animation_3_4();
|
|
|
|
else if (funcion == 4)
|
|
|
|
animation_4_4();
|
|
|
|
} else if (num_ejec == 5) {
|
|
|
|
if (funcion == 2)
|
|
|
|
animation_2_5();
|
|
|
|
else if (funcion == 3)
|
|
|
|
animation_3_5();
|
|
|
|
else if (funcion == 6)
|
|
|
|
animation_6_5();
|
|
|
|
else if (funcion == 7)
|
|
|
|
animation_7_5();
|
|
|
|
else if (funcion == 8)
|
|
|
|
animation_8_5();
|
|
|
|
else if (funcion == 15)
|
|
|
|
animation_15_5();
|
|
|
|
else if (funcion == 16)
|
|
|
|
animation_16_5();
|
|
|
|
else if (funcion == 17)
|
|
|
|
animation_17_5();
|
|
|
|
} else if (num_ejec == 6) {
|
|
|
|
if (funcion == 2)
|
|
|
|
animation_2_6();
|
|
|
|
else if (funcion == 3)
|
|
|
|
animation_3_6();
|
|
|
|
else if (funcion == 4)
|
|
|
|
animation_4_6();
|
|
|
|
else if (funcion == 11)
|
|
|
|
animation_11_6();
|
|
|
|
else if (funcion == 12)
|
|
|
|
animation_12_6();
|
|
|
|
else if (funcion == 13)
|
|
|
|
animation_13_6();
|
|
|
|
else if (funcion == 14)
|
|
|
|
animation_14_6();
|
|
|
|
else if (funcion == 15)
|
|
|
|
animation_15_6();
|
2007-08-17 11:19:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::addObject(int osj) {
|
2008-05-27 12:22:34 +00:00
|
|
|
int h, position = 0;
|
2007-09-04 17:26:38 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (h = 1; h < 43; h++) {
|
2008-05-27 12:22:34 +00:00
|
|
|
if (inventoryObjects[h] == osj)
|
|
|
|
position = 1;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-09-04 17:26:38 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
if (position == 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
for (h = 1; h < 43; h++) {
|
2008-05-27 12:22:34 +00:00
|
|
|
if (inventoryObjects[h] == 0) {
|
|
|
|
inventoryObjects[h] = osj;
|
|
|
|
position = 1;
|
2008-05-02 13:26:48 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-09-04 17:26:38 +00:00
|
|
|
|
2008-05-27 07:17:15 +00:00
|
|
|
void DrasculaEngine::stopSound_corte() {
|
2008-05-02 11:18:46 +00:00
|
|
|
if (hay_sb == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
ctvd_stop();
|
2008-05-02 11:18:46 +00:00
|
|
|
delete sku;
|
|
|
|
sku = NULL;
|
|
|
|
ctvd_terminate();
|
2007-09-04 17:26:38 +00:00
|
|
|
}
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-09-04 17:26:38 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::MusicFadeout() {
|
|
|
|
int org_vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
|
|
|
|
for (;;) {
|
|
|
|
int vol = _mixer->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
|
|
|
|
vol -= 10;
|
|
|
|
if (vol < 0)
|
|
|
|
vol = 0;
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, vol);
|
|
|
|
if (vol == 0)
|
|
|
|
break;
|
2008-05-11 09:51:30 +00:00
|
|
|
updateEvents();
|
2008-05-02 13:26:48 +00:00
|
|
|
_system->updateScreen();
|
|
|
|
_system->delayMillis(50);
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
AudioCD.stop();
|
|
|
|
_system->delayMillis(100);
|
|
|
|
_mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, org_vol);
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::ctvd_end() {
|
|
|
|
_mixer->stopHandle(_soundHandle);
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::ctvd_stop() {
|
|
|
|
_mixer->stopHandle(_soundHandle);
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::ctvd_terminate() {
|
|
|
|
// _mixer->stopHandle(_soundHandle);
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::ctvd_speaker(int flag) {}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::ctvd_output(Common::File *file_handle) {}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::ctvd_init(int b) {
|
|
|
|
int soundSize = sku->size();
|
|
|
|
byte *soundData = (byte *)malloc(soundSize);
|
|
|
|
sku->seek(32);
|
|
|
|
sku->read(soundData, soundSize);
|
|
|
|
_mixer->playRaw(Audio::Mixer::kSFXSoundType, &_soundHandle, soundData, soundSize - 64,
|
|
|
|
11025, Audio::Mixer::FLAG_AUTOFREE | Audio::Mixer::FLAG_UNSIGNED);
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
int DrasculaEngine::LookForFree() {
|
|
|
|
return _mixer->isSoundHandleActive(_soundHandle);
|
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::updateData() {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 1) {
|
|
|
|
// nothing
|
|
|
|
} else if (num_ejec == 2) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 2 && flags[40] == 0)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 3 && flags[3] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[8] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 6 && flags[1] == 1 && flags[10] == 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
|
|
|
visible[4] = 1;
|
2008-05-27 09:03:22 +00:00
|
|
|
} else if (roomNumber == 7 && flags[35] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 14 && flags[5] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[4] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
else if (roomNumber == 18 && flags[28] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
|
|
|
} else if (num_ejec == 3) {
|
|
|
|
// nothing
|
|
|
|
} else if (num_ejec == 4) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 23 && flags[0] == 0 && flags[11] == 0)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 1;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 23 && flags[0] == 1 && flags[11] == 0)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 21 && flags[10] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 22 && flags[26] == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
|
|
|
visible[1] = 1;
|
|
|
|
}
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 22 && flags[27] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 26 && flags[21] == 0)
|
2008-05-11 11:20:40 +00:00
|
|
|
strcpy(objName[2], _textmisc[_lang][0]);
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 26 && flags[18] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 26 && flags[12] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[1] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 35 && flags[14] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 35 && flags[17] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 1;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 35 && flags[15] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[1] = 0;
|
|
|
|
} else if (num_ejec == 5) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 49 && flags[6] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[2] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 49 && flags[6] == 0)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[1] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 49 && flags[6] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[1] = 1;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 45 && flags[6] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 1;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 53 && flags[2] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 54 && flags[13] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[3] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 55 && flags[8] == 1)
|
2008-05-02 13:26:48 +00:00
|
|
|
visible[1] = 0;
|
|
|
|
} else if (num_ejec == 6) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 58 && flags[8] == 0)
|
2008-05-11 12:47:26 +00:00
|
|
|
isDoor[1] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 58 && flags[8] == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
isDoor[1] = 1;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 59)
|
2008-05-11 12:47:26 +00:00
|
|
|
isDoor[1] = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 60) {
|
2008-05-02 13:26:48 +00:00
|
|
|
sentido_dr = 0;
|
|
|
|
x_dr = 155;
|
|
|
|
y_dr = 69;
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::anda_pabajo() {
|
|
|
|
direccion_hare = 4;
|
|
|
|
sentido_hare = 3;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::anda_parriba() {
|
|
|
|
direccion_hare = 0;
|
|
|
|
sentido_hare = 2;
|
2008-05-29 22:34:03 +00:00
|
|
|
stepX = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::pon_vb() {
|
|
|
|
int pos_vb[6];
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (vb_se_mueve == 0) {
|
|
|
|
pos_vb[0] = 256;
|
|
|
|
pos_vb[1] = 129;
|
|
|
|
pos_vb[2] = vb_x;
|
|
|
|
pos_vb[3] = 66;
|
|
|
|
pos_vb[4] = 33;
|
|
|
|
pos_vb[5] = 69;
|
|
|
|
if (sentido_vb == 0)
|
|
|
|
pos_vb[0] = 222;
|
|
|
|
else if (sentido_vb == 1)
|
|
|
|
pos_vb[0] = 188;
|
2008-05-02 11:18:46 +00:00
|
|
|
} else {
|
2008-05-02 13:26:48 +00:00
|
|
|
pos_vb[2] = vb_x;
|
|
|
|
pos_vb[3] = 66;
|
|
|
|
pos_vb[4] = 28;
|
|
|
|
pos_vb[5] = 68;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido_vb == 0) {
|
|
|
|
pos_vb[0] = frame_vb;
|
|
|
|
pos_vb[1] = 62;
|
|
|
|
} else {
|
|
|
|
pos_vb[0] = frame_vb;
|
|
|
|
pos_vb[1] = 131;
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
frame_vb = frame_vb + 29;
|
|
|
|
if (frame_vb > 146)
|
|
|
|
frame_vb = 1;
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyRectClip(pos_vb, frontSurface, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::lleva_vb(int pointX) {
|
|
|
|
if (pointX < vb_x)
|
2008-05-02 13:26:48 +00:00
|
|
|
sentido_vb = 0;
|
|
|
|
else
|
|
|
|
sentido_vb = 1;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
vb_se_mueve = 1;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (;;) {
|
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido_vb == 0) {
|
|
|
|
vb_x = vb_x - 5;
|
2008-05-29 22:34:03 +00:00
|
|
|
if (vb_x <= pointX)
|
2008-05-02 13:26:48 +00:00
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
vb_x = vb_x + 5;
|
2008-05-29 22:34:03 +00:00
|
|
|
if (vb_x >= pointX)
|
2008-05-02 13:26:48 +00:00
|
|
|
break;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
pause(5);
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
vb_se_mueve = 0;
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-11 12:47:26 +00:00
|
|
|
void DrasculaEngine::hipo_sin_nadie(int counter){
|
2008-05-02 13:26:48 +00:00
|
|
|
int y = 0, sentido = 0;
|
|
|
|
if (num_ejec == 3)
|
|
|
|
y = -1;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
comienza:
|
2008-05-11 12:47:26 +00:00
|
|
|
counter--;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3)
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, y, 320, 200, screenSurface);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 1, 0, y, 320, 198, screenSurface);
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido == 0)
|
|
|
|
y++;
|
|
|
|
else
|
|
|
|
y--;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (num_ejec == 3) {
|
|
|
|
if (y == 1)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == -1)
|
|
|
|
sentido = 0;
|
2008-05-02 11:18:46 +00:00
|
|
|
} else {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (y == 2)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == 0)
|
|
|
|
sentido = 0;
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2008-05-11 12:47:26 +00:00
|
|
|
if (counter > 0)
|
2008-05-02 13:26:48 +00:00
|
|
|
goto comienza;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
|
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-27 07:17:15 +00:00
|
|
|
void DrasculaEngine::openDoor(int nflag, int doorNum) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (flags[nflag] == 0) {
|
|
|
|
if (num_ejec == 1 /*|| num_ejec == 4*/) {
|
|
|
|
if (nflag != 7) {
|
2008-05-27 07:17:15 +00:00
|
|
|
playSound("s3.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[nflag] = 1;
|
|
|
|
}
|
|
|
|
} else {
|
2008-05-27 07:17:15 +00:00
|
|
|
playSound("s3.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[nflag] = 1;
|
|
|
|
}
|
|
|
|
|
2008-05-27 07:17:15 +00:00
|
|
|
if (doorNum != NO_DOOR)
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(doorNum);
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-27 07:17:15 +00:00
|
|
|
stopSound();
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2008-05-02 11:18:46 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::showMap() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int l, veo = 0;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-27 06:35:00 +00:00
|
|
|
if (mouseX > x1[l] && mouseY > y1[l]
|
|
|
|
&& mouseX < x2[l] && mouseY < y2[l]
|
2008-05-02 13:26:48 +00:00
|
|
|
&& visible[l] == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(textName, objName[l]);
|
|
|
|
hasName = 1;
|
2008-05-02 13:26:48 +00:00
|
|
|
veo = 1;
|
2008-05-02 12:00:58 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (veo == 0)
|
2008-05-29 22:34:03 +00:00
|
|
|
hasName = 0;
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
void DrasculaEngine::grr() {
|
2008-05-27 12:22:34 +00:00
|
|
|
int length = 30;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorDarkGreen);
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 12:00:58 +00:00
|
|
|
if (hay_sb == 1) {
|
2007-10-07 22:00:43 +00:00
|
|
|
sku = new Common::File;
|
2008-05-02 13:26:48 +00:00
|
|
|
sku->open("s10.als");
|
2007-10-07 22:00:43 +00:00
|
|
|
if (!sku->isOpen()) {
|
|
|
|
error("no puedo abrir archivo de voz");
|
|
|
|
}
|
2008-05-02 13:26:48 +00:00
|
|
|
ctvd_init(4);
|
2007-10-07 22:00:43 +00:00
|
|
|
ctvd_speaker(1);
|
|
|
|
ctvd_output(sku);
|
|
|
|
}
|
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(253, 110, 150, 65, 20, 30, drawSurface3, screenSurface);
|
2008-05-02 12:00:58 +00:00
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
if (withVoices == 0)
|
2008-05-29 22:34:03 +00:00
|
|
|
centerText(".groaaarrrrgghhh!", 153, 65);
|
2008-05-02 12:00:58 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
bucless:
|
2008-05-29 22:34:03 +00:00
|
|
|
int key = getScan();
|
2007-10-07 22:00:43 +00:00
|
|
|
if (key != 0)
|
|
|
|
ctvd_stop();
|
2008-01-27 19:47:41 +00:00
|
|
|
if (hay_sb == 1) {
|
2007-10-07 22:00:43 +00:00
|
|
|
if (LookForFree() != 0)
|
|
|
|
goto bucless;
|
|
|
|
delete sku;
|
2008-03-08 11:33:18 +00:00
|
|
|
sku = NULL;
|
2007-10-07 22:00:43 +00:00
|
|
|
ctvd_terminate();
|
|
|
|
} else {
|
2008-05-27 12:22:34 +00:00
|
|
|
length -= 2;
|
|
|
|
if (length > 0)
|
2007-10-07 22:00:43 +00:00
|
|
|
goto bucless;
|
|
|
|
}
|
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
void DrasculaEngine::activatePendulum() {
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[1] = 2;
|
|
|
|
hare_se_ve = 0;
|
2008-05-27 09:03:22 +00:00
|
|
|
roomNumber = 102;
|
2008-05-02 13:26:48 +00:00
|
|
|
loadPic("102.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface1, HALF_PAL);
|
2008-05-02 13:26:48 +00:00
|
|
|
loadPic("an_p1.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(drawSurface3, 1);
|
2008-05-02 13:26:48 +00:00
|
|
|
loadPic("an_p2.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(extraSurface, 1);
|
2008-05-02 13:26:48 +00:00
|
|
|
loadPic("an_p3.alg");
|
2008-05-30 07:09:36 +00:00
|
|
|
decompressPic(frontSurface, 1);
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 07:09:36 +00:00
|
|
|
copyBackground(0, 171, 0, 0, OBJWIDTH, OBJHEIGHT, backSurface, drawSurface3);
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-29 22:34:03 +00:00
|
|
|
conta_blind_vez = vez();
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-27 07:17:15 +00:00
|
|
|
void DrasculaEngine::closeDoor(int nflag, int doorNum) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (flags[nflag] == 1) {
|
2008-05-27 07:17:15 +00:00
|
|
|
playSound("s4.als");
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[nflag] = 0;
|
2008-05-27 07:17:15 +00:00
|
|
|
if (doorNum != NO_DOOR)
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(doorNum);
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
2008-05-30 07:09:36 +00:00
|
|
|
updateScreen(0, 0, 0, 0, 320, 200, screenSurface);
|
2008-05-27 07:17:15 +00:00
|
|
|
stopSound();
|
2008-05-11 11:20:40 +00:00
|
|
|
withoutVerb();
|
2008-01-27 19:47:41 +00:00
|
|
|
}
|
2007-10-07 22:00:43 +00:00
|
|
|
}
|
2007-09-04 17:26:38 +00:00
|
|
|
|
2007-07-17 21:35:01 +00:00
|
|
|
} // End of namespace Drascula
|