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;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-05-31 09:16:26 +00:00
|
|
|
currentChapter = 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;
|
2008-05-30 08:14:01 +00:00
|
|
|
hare_x = -1; characterMoved = 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;
|
2008-05-31 00:15:01 +00:00
|
|
|
breakOut = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
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;
|
2008-05-31 00:06:05 +00:00
|
|
|
frame_candles = 0;
|
2007-08-02 07:09:28 +00:00
|
|
|
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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 6) {
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("95.alg", tableSurface, 1);
|
2007-09-05 20:45:47 +00:00
|
|
|
}
|
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1) {
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("96.alg", frontSurface, COMPLETE_PAL);
|
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
|
|
|
loadAndDecompressPic("97.alg", extraSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 2) {
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("96.alg", frontSurface, COMPLETE_PAL);
|
|
|
|
loadAndDecompressPic("pts.alg", drawSurface2, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 3) {
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("aux13.alg", drawSurface1, COMPLETE_PAL);
|
|
|
|
loadAndDecompressPic("96.alg", frontSurface, 1);
|
|
|
|
loadAndDecompressPic("97.alg", extraSurface, 1);
|
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 4) {
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("96.alg", 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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("96.alg", frontSurface, 1);
|
2008-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
|
|
|
loadAndDecompressPic("97.alg", extraSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 5) {
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("96.alg", frontSurface, COMPLETE_PAL);
|
|
|
|
loadAndDecompressPic("97.alg", extraSurface, 1);
|
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 6) {
|
2008-05-31 13:01:48 +00:00
|
|
|
igorX = 105, igorY = 85, sentido_igor = 1;
|
2007-09-05 20:45:47 +00:00
|
|
|
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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("96.alg", frontSurface, COMPLETE_PAL);
|
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
|
|
|
loadAndDecompressPic("97.alg", extraSurface, 1);
|
|
|
|
loadAndDecompressPic("95.alg", 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();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 6)
|
2007-10-07 22:00:43 +00:00
|
|
|
break;
|
2008-03-09 08:30:24 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
currentChapter++;
|
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-30 10:55:43 +00:00
|
|
|
void DrasculaEngine::decompressPic(byte *targetSurface, int colorCount) {
|
|
|
|
memcpy(targetSurface, pcxBuffer, 64000);
|
2008-05-29 22:34:03 +00:00
|
|
|
free(pcxBuffer);
|
2008-05-30 10:55:43 +00:00
|
|
|
setRGB((byte *)cPal, colorCount);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DrasculaEngine::paleta_hare() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
for (color = 235; color < 253; color++)
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
|
|
|
palHare[color][component] = gamePalette[color][component];
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2007-08-02 20:59:03 +00:00
|
|
|
void DrasculaEngine::hare_oscuro() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
|
|
|
for (color = 235; color < 253; color++ )
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
|
|
|
gamePalette[color][component] = palHareOscuro[color][component];
|
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() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
DacPalette256 palNegra;
|
|
|
|
|
|
|
|
for (color = 0; color < 256; color++)
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
|
|
|
palNegra[color][component] = 0;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 2) {
|
2007-09-10 16:03:12 +00:00
|
|
|
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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2007-08-02 20:59:03 +00:00
|
|
|
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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("2aux62.alg", 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);
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
|
|
|
}
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
|
|
|
}
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
|
|
|
}
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
|
|
|
}
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("auxdr.alg", drawSurface2, 1);
|
2007-09-05 20:45:47 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
while (1) {
|
|
|
|
if (characterMoved == 0) {
|
|
|
|
stepX = PASO_HARE_X;
|
|
|
|
stepY = PASO_HARE_Y;
|
|
|
|
}
|
|
|
|
if (characterMoved == 0 && walkToObject == 1) {
|
|
|
|
sentido_hare = sentido_final;
|
|
|
|
walkToObject = 0;
|
|
|
|
}
|
2008-03-09 11:13:20 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2008-05-31 08:26:06 +00:00
|
|
|
if (roomNumber == 3 && (hare_x == 279) && (hare_y + alto_hare == 101))
|
|
|
|
animation_1_2();
|
|
|
|
else if (roomNumber == 14 && (hare_x == 214) && (hare_y + alto_hare == 121))
|
|
|
|
lleva_al_hare(190, 130);
|
|
|
|
else if (roomNumber == 14 && (hare_x == 246) && (hare_y + alto_hare == 112))
|
|
|
|
lleva_al_hare(190, 130);
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
moveCursor();
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2008-05-31 08:26:06 +00:00
|
|
|
if (musicStatus() == 0 && roomMusic != 0)
|
|
|
|
playMusic(roomMusic);
|
|
|
|
} else {
|
|
|
|
if (musicStatus() == 0)
|
|
|
|
playMusic(roomMusic);
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-29 14:14:31 +00:00
|
|
|
updateEvents();
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (menuScreen == 0 && takeObject == 1)
|
|
|
|
checkObjects();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (button_dch == 1 && menuScreen == 1) {
|
|
|
|
delay(100);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2)
|
2008-05-31 08:26:06 +00:00
|
|
|
loadAndDecompressPic(menuBackground, backSurface, 1);
|
|
|
|
else
|
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
|
|
|
setPalette((byte *)&gamePalette);
|
|
|
|
menuScreen = 0;
|
|
|
|
updateEvents();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
}
|
|
|
|
if (button_dch == 1 && menuScreen == 0) {
|
|
|
|
delay(100);
|
|
|
|
characterMoved = 0;
|
|
|
|
if (sentido_hare == 2)
|
|
|
|
sentido_hare = 1;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 4)
|
2008-05-31 08:26:06 +00:00
|
|
|
loadAndDecompressPic("icons2.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
else if (currentChapter == 5)
|
2008-05-31 08:26:06 +00:00
|
|
|
loadAndDecompressPic("icons3.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
else if (currentChapter == 6)
|
2008-05-31 08:26:06 +00:00
|
|
|
loadAndDecompressPic("iconsp.alg", backSurface, 1);
|
|
|
|
else
|
|
|
|
loadAndDecompressPic("icons.alg", backSurface, 1);
|
|
|
|
menuScreen = 1;
|
|
|
|
updateEvents();
|
|
|
|
withoutVerb();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (button_izq == 1 && menuBar == 1) {
|
|
|
|
delay(100);
|
|
|
|
elige_en_barra();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (button_izq == 1 && takeObject == 0) {
|
|
|
|
delay(100);
|
|
|
|
if (comprueba1())
|
|
|
|
return true;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (button_izq == 1 && takeObject == 1) {
|
|
|
|
if (comprueba2())
|
|
|
|
return true;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
menuBar = (mouseY < 24 && menuScreen == 0) ? 1 : 0;
|
|
|
|
|
|
|
|
Common::KeyCode key = getScan();
|
|
|
|
if (key == Common::KEYCODE_F1 && menuScreen == 0) {
|
|
|
|
selectVerb(1);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_F2 && menuScreen == 0) {
|
|
|
|
selectVerb(2);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_F3 && menuScreen == 0) {
|
|
|
|
selectVerb(3);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_F4 && menuScreen == 0) {
|
|
|
|
selectVerb(4);
|
2007-09-10 16:03:12 +00:00
|
|
|
cont_sv = 0;
|
2008-05-31 08:26:06 +00:00
|
|
|
} else if (key == Common::KEYCODE_F5 && menuScreen == 0) {
|
|
|
|
selectVerb(5);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_F6 && menuScreen == 0) {
|
|
|
|
selectVerb(6);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_F9) {
|
2007-07-26 19:52:18 +00:00
|
|
|
mesa();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2007-09-10 16:03:12 +00:00
|
|
|
cont_sv = 0;
|
2008-05-31 08:26:06 +00:00
|
|
|
} else if (key == Common::KEYCODE_F10) {
|
|
|
|
if (!saves())
|
|
|
|
return true;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_F8) {
|
|
|
|
withoutVerb();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_v) {
|
|
|
|
withVoices = 1;
|
|
|
|
print_abc(_textsys[_lang][2], 96, 86);
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-31 08:26:06 +00:00
|
|
|
delay(1410);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_t) {
|
|
|
|
withVoices = 0;
|
|
|
|
print_abc(_textsys[_lang][3], 94, 86);
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-31 08:26:06 +00:00
|
|
|
delay(1460);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else if (key == Common::KEYCODE_ESCAPE) {
|
|
|
|
if (!confirmExit())
|
|
|
|
return false;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) {
|
2008-05-31 08:26:06 +00:00
|
|
|
loadAndDecompressPic("alcbar.alg", drawSurface1, 255);
|
|
|
|
} else if (cont_sv == 15000) {
|
|
|
|
screenSaver();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv = 0;
|
|
|
|
} else {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
cont_sv++;
|
|
|
|
}
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::pickObject(int objeto) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 6)
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("iconsp.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
else if (currentChapter == 4)
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("icons2.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
else if (currentChapter == 5)
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("icons3.alg", backSurface, 1);
|
2007-08-17 11:19:17 +00:00
|
|
|
else
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("icons.alg", backSurface, 1);
|
2008-05-11 11:20:40 +00:00
|
|
|
chooseObject(objeto);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2)
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(menuBackground, backSurface, 1);
|
2008-03-09 08:27:27 +00:00
|
|
|
else
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
|
2008-05-11 11:20:40 +00:00
|
|
|
void DrasculaEngine::chooseObject(int objeto) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2 || currentChapter == 3 || currentChapter == 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;
|
|
|
|
}
|
|
|
|
|
2008-05-31 09:38:12 +00:00
|
|
|
void getIntFromLine(Common::File *fp, char *buf, int len, int* result) {
|
|
|
|
getLine(fp, buf, len);
|
|
|
|
sscanf(buf, "%d", result);
|
|
|
|
}
|
|
|
|
|
|
|
|
void getStringFromLine(Common::File *fp, char *buf, int len, char* result) {
|
|
|
|
getLine(fp, buf, len);
|
|
|
|
sscanf(buf, "%s", result);
|
|
|
|
}
|
|
|
|
|
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-09-19 08:40:12 +00:00
|
|
|
|
2008-05-31 09:38:12 +00:00
|
|
|
getIntFromLine(ald, buffer, size, &roomNumber);
|
|
|
|
getIntFromLine(ald, buffer, size, &roomMusic);
|
|
|
|
getStringFromLine(ald, buffer, size, roomDisk);
|
|
|
|
getIntFromLine(ald, buffer, size, &nivel_osc);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 09:38:12 +00:00
|
|
|
if (currentChapter == 2)
|
|
|
|
getIntFromLine(ald, buffer, size, &martin);
|
2008-05-30 08:00:42 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2 && martin != 0) {
|
2007-09-10 16:03:12 +00:00
|
|
|
ancho_hare = martin;
|
2008-05-31 09:38:12 +00:00
|
|
|
getIntFromLine(ald, buffer, size, &alto_hare);
|
|
|
|
getIntFromLine(ald, buffer, size, &feetHeight);
|
|
|
|
getIntFromLine(ald, buffer, size, &stepX);
|
|
|
|
getIntFromLine(ald, buffer, size, &stepY);
|
|
|
|
|
|
|
|
getStringFromLine(ald, buffer, size, pant1);
|
|
|
|
getStringFromLine(ald, buffer, size, pant2);
|
|
|
|
getStringFromLine(ald, buffer, size, pant3);
|
|
|
|
getStringFromLine(ald, buffer, size, pant4);
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(pant2, extraSurface, 1);
|
|
|
|
loadAndDecompressPic(pant1, frontSurface, 1);
|
|
|
|
loadAndDecompressPic(pant4, 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
|
|
|
}
|
|
|
|
|
2008-05-31 09:38:12 +00:00
|
|
|
getIntFromLine(ald, buffer, size, &numRoomObjs);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-11 20:05:09 +00:00
|
|
|
for (l = 0; l < numRoomObjs; l++) {
|
2008-05-31 09:38:12 +00:00
|
|
|
getIntFromLine(ald, buffer, size, &objectNum[l]);
|
|
|
|
getStringFromLine(ald, buffer, size, objName[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &x1[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &y1[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &x2[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &y2[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &sitiobj_x[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &sitiobj_y[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &sentidobj[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &visible[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &isDoor[l]);
|
2008-05-11 12:47:26 +00:00
|
|
|
if (isDoor[l] != 0) {
|
2008-05-31 09:38:12 +00:00
|
|
|
getStringFromLine(ald, buffer, size, _targetSurface[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &_destX[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &_destY[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &sentido_alkeva[l]);
|
|
|
|
getIntFromLine(ald, buffer, size, &alapuertakeva[l]);
|
2008-05-29 14:04:47 +00:00
|
|
|
updateDoor(l);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-31 09:38:12 +00:00
|
|
|
getIntFromLine(ald, buffer, size, &suelo_x1);
|
|
|
|
getIntFromLine(ald, buffer, size, &suelo_y1);
|
|
|
|
getIntFromLine(ald, buffer, size, &suelo_x2);
|
|
|
|
getIntFromLine(ald, buffer, size, &suelo_y2);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 2) {
|
2008-05-31 09:38:12 +00:00
|
|
|
getIntFromLine(ald, buffer, size, &far);
|
|
|
|
getIntFromLine(ald, buffer, size, &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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2007-09-10 16:03:12 +00:00
|
|
|
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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("97.alg", extraSurface, 1);
|
|
|
|
loadAndDecompressPic("96.alg", frontSurface, 1);
|
|
|
|
loadAndDecompressPic("99.alg", 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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2007-09-10 16:03:12 +00:00
|
|
|
if (hare_x == -1) {
|
2008-05-30 16:39:49 +00:00
|
|
|
hare_x = _destX[obj_salir];
|
|
|
|
hare_y = _destY[obj_salir] - alto_hare;
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2007-09-10 16:03:12 +00:00
|
|
|
}
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(roomDisk, 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);
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(rm, 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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2)
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorLightGreen);
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 2) {
|
2007-09-10 16:03:12 +00:00
|
|
|
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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 2) {
|
2007-09-10 16:03:12 +00:00
|
|
|
if (hare_x == -1) {
|
2008-05-30 16:39:49 +00:00
|
|
|
hare_x = _destX[obj_salir];
|
|
|
|
hare_y = _destY[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
|
|
|
}
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2007-09-10 16:03:12 +00:00
|
|
|
soc = 0;
|
|
|
|
for (l = 0; l < 6; l++) {
|
2008-05-30 10:55:43 +00:00
|
|
|
soc += ancho_hare;
|
2007-09-10 16:03:12 +00:00
|
|
|
frame_x[l] = soc;
|
|
|
|
}
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 5)
|
2007-09-10 16:03:12 +00:00
|
|
|
hare_se_ve = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
updateVisible();
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1)
|
2008-05-11 12:47:26 +00:00
|
|
|
isDoor[7] = 0;
|
2007-09-10 16:03:12 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 9 || roomNumber == 2 || roomNumber == 14 || roomNumber == 18)
|
2008-05-30 08:14:01 +00:00
|
|
|
conta_blind_vez = getTime();
|
2008-03-09 08:52:52 +00:00
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 4) {
|
2008-05-27 09:03:22 +00:00
|
|
|
if (roomNumber == 26)
|
2008-05-30 08:14:01 +00:00
|
|
|
conta_blind_vez = getTime();
|
2008-03-08 19:47:44 +00:00
|
|
|
}
|
2008-03-09 10:16:27 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 5 || currentChapter == 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;
|
2008-05-30 08:00:42 +00:00
|
|
|
updateRoom();
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:00:42 +00:00
|
|
|
return;
|
2007-09-04 17:26:38 +00:00
|
|
|
}
|
|
|
|
}
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:14:01 +00:00
|
|
|
if (characterMoved == 0)
|
2007-07-26 19:52:18 +00:00
|
|
|
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;
|
|
|
|
}
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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)
|
2008-05-30 08:14:01 +00:00
|
|
|
showMenu();
|
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
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-30 14:44:08 +00:00
|
|
|
sitio_x = CLIP(mouseX, suelo_x1, suelo_x2);
|
|
|
|
sitio_y = CLIP(mouseY, suelo_y1 + feetHeight, 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 4)
|
2007-08-17 11:19:17 +00:00
|
|
|
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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("savescr.alg", 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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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);
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(rm, 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-31 09:55:11 +00:00
|
|
|
void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) {
|
|
|
|
int textPos[8];
|
2008-05-30 23:43:47 +00:00
|
|
|
int letterY = 0, letterX = 0, h, length;
|
2008-05-27 12:22:34 +00:00
|
|
|
length = strlen(said);
|
2008-05-31 10:01:13 +00:00
|
|
|
|
2008-05-27 12:22:34 +00:00
|
|
|
for (h = 0; h < length; h++) {
|
2008-05-11 12:47:26 +00:00
|
|
|
int c = toupper(said[h]);
|
2008-05-30 23:43:47 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < CHARMAP_SIZE; i++) {
|
|
|
|
if (c == charMap[i].inChar) {
|
|
|
|
letterX = charMap[i].mappedChar;
|
|
|
|
|
|
|
|
switch (charMap[i].charType) {
|
|
|
|
case 0: // letters
|
|
|
|
letterY = (_lang == kSpanish) ? 149 : 158;
|
|
|
|
break;
|
|
|
|
case 1: // signs
|
|
|
|
letterY = (_lang == kSpanish) ? 160 : 169;
|
|
|
|
break;
|
|
|
|
case 2: // accented
|
|
|
|
letterY = 180;
|
|
|
|
break;
|
|
|
|
} // switch
|
|
|
|
break;
|
|
|
|
} // if
|
|
|
|
} // for
|
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
textPos[0] = letterX;
|
|
|
|
textPos[1] = letterY;
|
|
|
|
textPos[2] = screenX;
|
|
|
|
textPos[3] = screenY;
|
|
|
|
textPos[4] = CHAR_WIDTH;
|
|
|
|
textPos[5] = CHAR_HEIGHT;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
copyRectClip(textPos, textSurface, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
screenX = screenX + CHAR_WIDTH;
|
|
|
|
if (screenX > 317) {
|
|
|
|
screenX = 0;
|
|
|
|
screenY = screenY + CHAR_HEIGHT + 2;
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
2008-05-30 23:43:47 +00:00
|
|
|
} // for
|
|
|
|
}
|
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
void DrasculaEngine::print_abc_opc(const char *said, int screenX, int screenY, int game) {
|
|
|
|
int textPos[6];
|
|
|
|
int signY, letterY, letterX = 0, h, length;
|
2008-05-30 23:43:47 +00:00
|
|
|
length = strlen(said);
|
|
|
|
|
|
|
|
for (h = 0; h < length; h++) {
|
|
|
|
if (game == 1) {
|
|
|
|
letterY = 6;
|
2008-05-31 09:55:11 +00:00
|
|
|
signY = 15;
|
2008-05-30 23:43:47 +00:00
|
|
|
} else if (game == 3) {
|
|
|
|
letterY = 56;
|
2008-05-31 09:55:11 +00:00
|
|
|
signY = 65;
|
2008-05-30 23:43:47 +00:00
|
|
|
} else {
|
|
|
|
letterY = 31;
|
2008-05-31 09:55:11 +00:00
|
|
|
signY = 40;
|
2008-05-30 23:43:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int c = toupper(said[h]);
|
|
|
|
|
|
|
|
for (int i = 0; i < CHARMAP_SIZE; i++) {
|
|
|
|
if (c == charMap[i].inChar) {
|
|
|
|
// Convert the mapped char of the normal font to the
|
|
|
|
// mapped char of the dialogue font
|
|
|
|
|
|
|
|
int multiplier = (charMap[i].mappedChar - 6) / 9;
|
|
|
|
|
|
|
|
letterX = multiplier * 7 + 10;
|
|
|
|
|
|
|
|
if (charMap[i].charType > 0)
|
2008-05-31 09:55:11 +00:00
|
|
|
letterY = signY;
|
2008-05-30 23:43:47 +00:00
|
|
|
break;
|
|
|
|
} // if
|
|
|
|
} // for
|
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
textPos[0] = letterX;
|
|
|
|
textPos[1] = letterY;
|
|
|
|
textPos[2] = screenX;
|
|
|
|
textPos[3] = screenY;
|
|
|
|
textPos[4] = CHAR_WIDTH_OPC;
|
|
|
|
textPos[5] = CHAR_HEIGHT_OPC;
|
2008-05-30 23:43:47 +00:00
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
copyRectClip(textPos, backSurface, screenSurface);
|
2008-05-30 23:43:47 +00:00
|
|
|
|
2008-05-31 09:55:11 +00:00
|
|
|
screenX = screenX + CHAR_WIDTH_OPC;
|
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-05-30 14:44:08 +00:00
|
|
|
bool DrasculaEngine::confirmExit() {
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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-05-02 11:44:47 +00:00
|
|
|
clearRoom();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("sv.alg", 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-31 10:24:45 +00:00
|
|
|
tempLine[i] = checkWrapY(tempLine[i]);
|
2008-05-26 21:48:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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-31 10:24:45 +00:00
|
|
|
tempRow[i] = checkWrapX(tempRow[i]);
|
2008-05-26 21:48:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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];
|
2008-05-31 10:24:45 +00:00
|
|
|
x1_ = checkWrapX(x1_);
|
2008-05-26 21:48:59 +00:00
|
|
|
|
|
|
|
y1_ = i + count2;
|
2008-05-31 10:24:45 +00:00
|
|
|
y1_ = checkWrapY(y1_);
|
2008-05-26 21:48:59 +00:00
|
|
|
|
|
|
|
off1 = 320 * y1_ + x1_;
|
|
|
|
|
|
|
|
x1_ = j + count;
|
2008-05-31 10:24:45 +00:00
|
|
|
x1_ = checkWrapX(x1_);
|
2008-05-26 21:48:59 +00:00
|
|
|
|
|
|
|
y1_ = i + tempLine[j];
|
2008-05-31 10:24:45 +00:00
|
|
|
y1_ = checkWrapY(y1_);
|
2008-05-26 21:48:59 +00:00
|
|
|
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);
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(rm, 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) {
|
2008-05-30 08:28:54 +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-31 00:06:05 +00:00
|
|
|
void DrasculaEngine::fadeFromBlack(int fadeSpeed) {
|
2007-07-26 19:52:18 +00:00
|
|
|
char fundido;
|
2008-05-30 08:28:54 +00:00
|
|
|
unsigned int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
DacPalette256 palFundido;
|
|
|
|
|
|
|
|
for (fundido = 0; fundido < 64; fundido++) {
|
|
|
|
for (color = 0; color < 256; color++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++) {
|
2008-05-31 00:06:05 +00:00
|
|
|
palFundido[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-31 00:06:05 +00:00
|
|
|
pause(fadeSpeed);
|
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-31 00:06:05 +00:00
|
|
|
char DrasculaEngine::adjustToVGA(char value) {
|
2008-05-29 22:34:03 +00:00
|
|
|
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
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
while (true) {
|
|
|
|
strcpy(bb, m1);
|
|
|
|
scumm_strrev(bb);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (textX1 < textX2) {
|
|
|
|
strcpy(m3, strrchr(m1, ' '));
|
|
|
|
strcpy(m1, strstr(bb, " "));
|
|
|
|
scumm_strrev(m1);
|
|
|
|
m1[strlen(m1) - 1] = '\0';
|
|
|
|
strcat(m3, m2);
|
|
|
|
strcpy(m2, m3);
|
|
|
|
};
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
textX2 = (strlen(m1) / 2) * CHAR_WIDTH;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (textX1 < textX2)
|
|
|
|
continue;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
strcpy(mb[conta_f], m1);
|
|
|
|
|
|
|
|
if (!strcmp(m2, ""))
|
|
|
|
break;
|
|
|
|
|
|
|
|
scumm_strrev(m2);
|
|
|
|
m2[strlen(m2) - 1] = '\0';
|
|
|
|
scumm_strrev(m2);
|
|
|
|
strcpy(m1, m2);
|
|
|
|
strcpy(m2, "");
|
|
|
|
conta_f++;
|
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
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-30 11:04:40 +00:00
|
|
|
void DrasculaEngine::playSound(int soundNum) {
|
|
|
|
char file[20];
|
|
|
|
sprintf(file, "s%i.als", soundNum);
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2008-05-31 22:54:09 +00:00
|
|
|
NFrames = FileIn.readSint32LE();
|
|
|
|
dataSize = FileIn.readSint32LE();
|
2008-05-30 07:24:32 +00:00
|
|
|
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-31 22:54:09 +00:00
|
|
|
dataSize = FileIn.readSint32LE();
|
2008-05-30 07:24:32 +00:00
|
|
|
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-31 00:06:05 +00:00
|
|
|
void DrasculaEngine::fadeToBlack(int fadeSpeed) {
|
2007-07-26 19:52:18 +00:00
|
|
|
char fundido;
|
2008-05-30 08:28:54 +00:00
|
|
|
unsigned int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
|
|
|
DacPalette256 palFundido;
|
|
|
|
|
|
|
|
for (fundido = 63; fundido >= 0; fundido--) {
|
|
|
|
for (color = 0; color < 256; color++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++) {
|
2008-05-31 00:06:05 +00:00
|
|
|
palFundido[color][component] = adjustToVGA(gamePalette[color][component] - 63 + fundido);
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
2008-05-31 00:06:05 +00:00
|
|
|
pause(fadeSpeed);
|
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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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;
|
|
|
|
}
|
2008-05-31 13:01:48 +00:00
|
|
|
pos_igor[2] = igorX;
|
|
|
|
pos_igor[3] = igorY;
|
2007-07-26 19:52:18 +00:00
|
|
|
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-05-31 09:16:26 +00:00
|
|
|
else if (sentido_dr == 3 && currentChapter == 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-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-02 13:26:48 +00:00
|
|
|
y = -1;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
do {
|
|
|
|
counter--;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
updateRoom();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-30 08:00:42 +00:00
|
|
|
updateScreen(0, 0, 0, y, 320, 200, screenSurface);
|
|
|
|
else
|
|
|
|
updateScreen(0, 1, 0, y, 320, 198, screenSurface);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
if (sentido == 0)
|
|
|
|
y++;
|
|
|
|
else
|
|
|
|
y--;
|
2007-07-28 09:45:05 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3) {
|
2008-05-30 08:00:42 +00:00
|
|
|
if (y == 1)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == -1)
|
|
|
|
sentido = 0;
|
|
|
|
} else {
|
|
|
|
if (y == 2)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == 0)
|
|
|
|
sentido = 0;
|
|
|
|
}
|
|
|
|
} while (counter > 0);
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
updateRoom();
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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-30 15:15:49 +00:00
|
|
|
while (soundIsActive());
|
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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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();
|
2008-05-31 09:16:26 +00:00
|
|
|
if (n_ejec2 != currentChapter) {
|
2008-05-29 22:34:03 +00:00
|
|
|
strcpy(saveName, gameName);
|
2008-05-31 09:16:26 +00:00
|
|
|
currentChapter = n_ejec2 - 1;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1 || currentChapter == 3 || currentChapter == 5 || currentChapter == 6)
|
2008-05-02 13:26:48 +00:00
|
|
|
return;
|
2008-05-31 09:16:26 +00:00
|
|
|
else if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++) {
|
|
|
|
gamePalette[color][component] = palHare[color][component];
|
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;
|
2008-05-30 08:28:54 +00:00
|
|
|
unsigned int color, component;
|
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++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
2008-05-31 00:06:05 +00:00
|
|
|
gamePalette[color][component] = adjustToVGA(gamePalette[color][component] - 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() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
|
|
|
palHareClaro[color][component] = gamePalette[color][component];
|
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() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
|
|
|
palHareOscuro[color][component] = gamePalette[color][component];
|
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() {
|
2008-05-30 08:28:54 +00:00
|
|
|
int color, component;
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
for (color = 235; color < 253; color++) {
|
2008-05-30 08:28:54 +00:00
|
|
|
for (component = 0; component < 3; component++)
|
|
|
|
gamePalette[color][component] = palHareClaro[color][component];
|
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-30 08:14:01 +00:00
|
|
|
characterMoved = 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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)
|
2008-05-31 00:06:05 +00:00
|
|
|
walkUp();
|
2008-05-02 13:26:48 +00:00
|
|
|
else if (sitio_y > hare_y + alto_hare)
|
2008-05-31 00:06:05 +00:00
|
|
|
walkDown();
|
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
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2007-07-28 09:45:05 +00:00
|
|
|
}
|
2008-05-30 08:14:01 +00:00
|
|
|
conta_vez = getTime();
|
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-30 08:14:01 +00:00
|
|
|
if (characterMoved == 1 && stepX == PASO_HARE_X) {
|
2008-05-29 22:34:03 +00:00
|
|
|
for (r = 0; r < stepX; r++) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 2) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido_hare == 0 && sitio_x - r == hare_x + ancho_hare / 2) {
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 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) {
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 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;
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 2) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (sentido_hare == 0 && sitio_x - r == hare_x) {
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 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) {
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 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-30 08:14:01 +00:00
|
|
|
if (characterMoved == 1 && stepY == PASO_HARE_Y) {
|
2008-05-29 22:34:03 +00:00
|
|
|
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) {
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 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) {
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1 || currentChapter == 4 || currentChapter == 5 || currentChapter == 6) {
|
2008-05-30 08:00:42 +00:00
|
|
|
if (hare_se_ve == 0) {
|
|
|
|
increaseFrameNum();
|
|
|
|
return;
|
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
}
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 08:14:01 +00:00
|
|
|
if (characterMoved == 0) {
|
2008-05-02 13:26:48 +00:00
|
|
|
pos_hare[0] = 0;
|
|
|
|
pos_hare[1] = DIF_MASK_HARE;
|
|
|
|
pos_hare[2] = hare_x;
|
|
|
|
pos_hare[3] = hare_y;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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 {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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
|
|
|
}
|
2008-05-30 08:14:01 +00:00
|
|
|
} else if (characterMoved == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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 {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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
|
|
|
}
|
2008-05-29 22:34:03 +00:00
|
|
|
increaseFrameNum();
|
2007-07-26 19:52:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-30 08:14:01 +00:00
|
|
|
void DrasculaEngine::showMenu() {
|
2008-05-02 13:26:48 +00:00
|
|
|
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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1) {
|
2008-05-29 22:34:03 +00:00
|
|
|
if (objectNum[l] == 105 && flags[0] == 0)
|
2008-05-30 08:48:01 +00:00
|
|
|
talk(442);
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 16:39:49 +00:00
|
|
|
strcpy(salgo, _targetSurface[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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]);
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 16:39:49 +00:00
|
|
|
strcpy(salgo, _targetSurface[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x =- 1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 16:39:49 +00:00
|
|
|
strcpy(salgo, _targetSurface[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x =- 1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 16:39:49 +00:00
|
|
|
strcpy(salgo, _targetSurface[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 16:39:49 +00:00
|
|
|
strcpy(salgo, _targetSurface[l]);
|
2008-05-02 13:26:48 +00:00
|
|
|
strcat(salgo, ".ald");
|
|
|
|
hare_x = -1;
|
|
|
|
carga_escoba(salgo);
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-30 08:14:01 +00:00
|
|
|
characterMoved = 0;
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 16:39:49 +00:00
|
|
|
strcpy(salgo, _targetSurface[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();
|
2008-05-30 08:14:01 +00:00
|
|
|
showMenu();
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2007-07-26 19:52:18 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
// Objects with an ID smaller than 7 are the inventory verbs
|
|
|
|
if (pickedObject >= 7) {
|
|
|
|
for (n = 1; n < 43; n++) {
|
|
|
|
if (whichObject() == n && inventoryObjects[n] == 0) {
|
|
|
|
inventoryObjects[n] = h;
|
|
|
|
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-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
|
|
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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';
|
2008-05-30 10:21:29 +00:00
|
|
|
else if (key == Common::KEYCODE_ESCAPE)
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 11:04:40 +00:00
|
|
|
playSound(99);
|
2008-05-27 07:17:15 +00:00
|
|
|
stopSound();
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
|
|
|
|
2008-05-30 08:28:54 +00:00
|
|
|
void DrasculaEngine::openSSN(const char *Name, int Pause) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 08:28:54 +00:00
|
|
|
int DrasculaEngine::playFrameSSN() {
|
2008-05-02 13:26:48 +00:00
|
|
|
int Exit = 0;
|
2008-05-31 22:41:31 +00:00
|
|
|
uint32 Lengt;
|
2008-05-02 13:26:48 +00:00
|
|
|
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
|
|
|
}
|
2008-05-30 10:21:29 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
switch (CHUNK) {
|
2008-05-30 10:21:29 +00:00
|
|
|
case kFrameSetPal:
|
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;
|
2008-05-30 10:21:29 +00:00
|
|
|
case kFrameEmptyFrame:
|
2008-05-02 13:26:48 +00:00
|
|
|
WaitFrameSSN();
|
|
|
|
break;
|
2008-05-30 10:21:29 +00:00
|
|
|
case kFrameInit:
|
2008-05-02 13:26:48 +00:00
|
|
|
if (!UsingMem) {
|
2008-05-31 22:41:31 +00:00
|
|
|
CMP = _Session->readByte();
|
|
|
|
Lengt = _Session->readUint32LE();
|
2008-05-02 11:18:46 +00:00
|
|
|
} else {
|
2008-05-29 22:34:03 +00:00
|
|
|
memcpy(&CMP, mSession, 1);
|
|
|
|
mSession += 1;
|
2008-05-31 22:41:31 +00:00
|
|
|
Lengt = READ_LE_UINT32(mSession);
|
2008-05-29 22:34:03 +00:00
|
|
|
mSession += 4;
|
2007-08-02 20:59:03 +00:00
|
|
|
}
|
2008-05-30 10:21:29 +00:00
|
|
|
if (CMP == kFrameCmpRle) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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 {
|
2008-05-30 10:21:29 +00:00
|
|
|
if (CMP == kFrameCmpOff) {
|
2008-05-02 13:26:48 +00:00
|
|
|
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;
|
2008-05-30 10:21:29 +00:00
|
|
|
case kFrameEndAnim:
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 08:14:01 +00:00
|
|
|
int DrasculaEngine::getTime() {
|
2008-05-02 13:26:48 +00:00
|
|
|
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;
|
2008-05-30 08:14:01 +00:00
|
|
|
float pixelX, pixelY;
|
|
|
|
int pixelPos[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-30 08:14:01 +00:00
|
|
|
pixelX = xx1;
|
|
|
|
pixelY = 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-30 08:14:01 +00:00
|
|
|
pixelPos[0] = (int)pixelX;
|
|
|
|
pixelPos[1] = (int)pixelY;
|
|
|
|
pixelPos[2] = xx2 + m;
|
|
|
|
pixelPos[3] = yy2 + n;
|
|
|
|
pixelPos[4] = 1;
|
|
|
|
pixelPos[5] = 1;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-30 08:14:01 +00:00
|
|
|
copyRectClip(pixelPos, dir_inicio, dir_fin);
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-30 08:14:01 +00:00
|
|
|
pixelX = pixelX + totalX;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
2008-05-30 08:14:01 +00:00
|
|
|
pixelX = xx1;
|
|
|
|
pixelY = pixelY + totalY;
|
2008-05-02 13:26:48 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-07 22:00:43 +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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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");
|
|
|
|
}
|
2008-05-31 09:16:26 +00:00
|
|
|
out->writeSint32LE(currentChapter);
|
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-30 08:14:01 +00:00
|
|
|
diff_vez = getTime() - conta_vez;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-02 13:26:48 +00:00
|
|
|
if (diff_vez >= 6) {
|
2008-05-30 08:14:01 +00:00
|
|
|
conta_vez = getTime();
|
2008-05-02 13:26:48 +00:00
|
|
|
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-31 09:16:26 +00:00
|
|
|
if (currentChapter != 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-31 00:15:01 +00:00
|
|
|
breakOut = 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:38:12 +00:00
|
|
|
getStringFromLine(ald, buffer, size, phrase1);
|
|
|
|
getStringFromLine(ald, buffer, size, phrase2);
|
|
|
|
getStringFromLine(ald, buffer, size, phrase3);
|
|
|
|
getStringFromLine(ald, buffer, size, phrase4);
|
|
|
|
getStringFromLine(ald, buffer, size, sound1);
|
|
|
|
getStringFromLine(ald, buffer, size, sound2);
|
|
|
|
getStringFromLine(ald, buffer, size, sound3);
|
|
|
|
getStringFromLine(ald, buffer, size, sound4);
|
|
|
|
getIntFromLine(ald, buffer, size, &answer1);
|
|
|
|
getIntFromLine(ald, buffer, size, &answer2);
|
|
|
|
getIntFromLine(ald, buffer, size, &answer3);
|
2008-05-02 13:26:48 +00:00
|
|
|
delete ald;
|
|
|
|
ald = NULL;
|
2007-08-02 20:59:03 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-31 09:16:26 +00:00
|
|
|
if (currentChapter == 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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("car.alg", 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-31 08:26:06 +00:00
|
|
|
while (breakOut == 0) {
|
|
|
|
updateRoom();
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1 || currentChapter == 4 || currentChapter == 6) {
|
2008-05-31 08:26:06 +00:00
|
|
|
if (musicStatus() == 0 && flags[11] == 0)
|
|
|
|
playMusic(roomMusic);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 2) {
|
2008-05-31 08:26:06 +00:00
|
|
|
if (musicStatus() == 0 && flags[11] == 0 && roomMusic != 0)
|
|
|
|
playMusic(roomMusic);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 3 || currentChapter == 5) {
|
2008-05-31 08:26:06 +00:00
|
|
|
if (musicStatus() == 0)
|
|
|
|
playMusic(roomMusic);
|
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
updateEvents();
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (mouseY > 0 && mouseY < 9) {
|
|
|
|
if (used1 == 1 && _color != kColorWhite)
|
|
|
|
color_abc(kColorWhite);
|
|
|
|
else if (used1 == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
|
|
|
} else if (mouseY > 8 && mouseY < 17) {
|
|
|
|
if (used2 == 1 && _color != kColorWhite)
|
|
|
|
color_abc(kColorWhite);
|
|
|
|
else if (used2 == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
|
|
|
} else if (mouseY > 16 && mouseY < 25) {
|
|
|
|
if (used3 == 1 && _color != kColorWhite)
|
|
|
|
color_abc(kColorWhite);
|
|
|
|
else if (used3 == 0 && _color != kColorLightGreen)
|
|
|
|
color_abc(kColorLightGreen);
|
|
|
|
} else if (_color != kColorLightGreen)
|
2008-05-30 07:16:17 +00:00
|
|
|
color_abc(kColorLightGreen);
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (mouseY > 0 && mouseY < 9)
|
|
|
|
game1 = 2;
|
|
|
|
else if (mouseY > 8 && mouseY < 17)
|
|
|
|
game2 = 2;
|
|
|
|
else if (mouseY > 16 && mouseY < 25)
|
|
|
|
game3 = 2;
|
|
|
|
else if (mouseY > 24 && mouseY < 33)
|
|
|
|
game4 = 2;
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 08:26:06 +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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2008-05-02 11:18:46 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if ((button_izq == 1) && (game1 == 2)) {
|
|
|
|
delay(100);
|
|
|
|
used1 = 1;
|
|
|
|
talk(phrase1, sound1);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
grr();
|
|
|
|
else
|
|
|
|
response(answer1);
|
|
|
|
} else if ((button_izq == 1) && (game2 == 2)) {
|
|
|
|
delay(100);
|
|
|
|
used2 = 1;
|
|
|
|
talk(phrase2, sound2);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
grr();
|
|
|
|
else
|
|
|
|
response(answer2);
|
|
|
|
} else if ((button_izq == 1) && (game3 == 2)) {
|
|
|
|
delay(100);
|
|
|
|
used3 = 1;
|
|
|
|
talk(phrase3, sound3);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-31 08:26:06 +00:00
|
|
|
grr();
|
|
|
|
else
|
|
|
|
response(answer3);
|
|
|
|
} else if ((button_izq == 1) && (game4 == 2)) {
|
|
|
|
delay(100);
|
|
|
|
talk(phrase4, sound4);
|
|
|
|
breakOut = 1;
|
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
if (button_izq == 1) {
|
|
|
|
delay(100);
|
|
|
|
color_abc(kColorLightGreen);
|
|
|
|
}
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
game1 = (used1 == 0) ? 1 : 3;
|
|
|
|
game2 = (used2 == 0) ? 1 : 3;
|
|
|
|
game3 = (used3 == 0) ? 1 : 3;
|
|
|
|
game4 = 1;
|
|
|
|
} // while (breakOut == 0)
|
2007-08-17 11:19:17 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 2)
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic(menuBackground, backSurface, 1);
|
2008-05-02 13:26:48 +00:00
|
|
|
else
|
2008-05-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("99.alg", backSurface, 1);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter != 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-30 10:55:43 +00:00
|
|
|
void DrasculaEngine::response(int function) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1) {
|
2008-05-30 10:55:43 +00:00
|
|
|
if (function == 10)
|
|
|
|
talk_drunk(1);
|
|
|
|
else if (function == 11)
|
|
|
|
talk_drunk(2);
|
|
|
|
else if (function == 12)
|
|
|
|
talk_drunk(3);
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 2) {
|
2008-05-30 10:55:43 +00:00
|
|
|
if (function == 8)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_8_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 9)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_9_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 10)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_10_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 15)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_15_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 16)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_16_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 17)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_17_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 19)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_19_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 20)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_20_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 21)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_21_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 23)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_23_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 28)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_28_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 29)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_29_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 30)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_30_2();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 31)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_31_2();
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 4) {
|
2008-05-30 10:55:43 +00:00
|
|
|
if (function == 2)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_2_4();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 3)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_3_4();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 4)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_4_4();
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 5) {
|
2008-05-30 10:55:43 +00:00
|
|
|
if (function == 2)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_2_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 3)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_3_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 6)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_6_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 7)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_7_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 8)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_8_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 15)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_15_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 16)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_16_5();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 17)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_17_5();
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 6) {
|
2008-05-30 10:55:43 +00:00
|
|
|
if (function == 2)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_2_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 3)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_3_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 4)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_4_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 11)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_11_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 12)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_12_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 13)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_13_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 14)
|
2008-05-02 13:26:48 +00:00
|
|
|
animation_14_6();
|
2008-05-30 10:55:43 +00:00
|
|
|
else if (function == 15)
|
2008-05-02 13:26:48 +00:00
|
|
|
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-30 15:15:49 +00:00
|
|
|
bool DrasculaEngine::soundIsActive() {
|
2008-05-02 13:26:48 +00:00
|
|
|
return _mixer->isSoundHandleActive(_soundHandle);
|
|
|
|
}
|
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
void DrasculaEngine::updateVisible() {
|
|
|
|
if (currentChapter == 1) {
|
2008-05-02 13:26:48 +00:00
|
|
|
// nothing
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 3) {
|
2008-05-02 13:26:48 +00:00
|
|
|
// nothing
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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;
|
2008-05-31 09:16:26 +00:00
|
|
|
} else if (currentChapter == 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-31 00:06:05 +00:00
|
|
|
void DrasculaEngine::walkDown() {
|
2008-05-02 13:26:48 +00:00
|
|
|
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-31 00:06:05 +00:00
|
|
|
void DrasculaEngine::walkUp() {
|
2008-05-02 13:26:48 +00:00
|
|
|
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) {
|
2008-05-30 10:55:43 +00:00
|
|
|
sentido_vb = (pointX < vb_x) ? 0 : 1;
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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;
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-02 13:26:48 +00:00
|
|
|
y = -1;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
do {
|
|
|
|
counter--;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
copyBackground(0, 0, 0, 0, 320, 200, drawSurface1, screenSurface);
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3)
|
2008-05-30 08:00:42 +00:00
|
|
|
updateScreen(0, 0, 0, y, 320, 200, screenSurface);
|
|
|
|
else
|
|
|
|
updateScreen(0, 1, 0, y, 320, 198, screenSurface);
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-30 08:00:42 +00:00
|
|
|
if (sentido == 0)
|
|
|
|
y++;
|
|
|
|
else
|
|
|
|
y--;
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 3) {
|
2008-05-30 08:00:42 +00:00
|
|
|
if (y == 1)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == -1)
|
|
|
|
sentido = 0;
|
|
|
|
} else {
|
|
|
|
if (y == 2)
|
|
|
|
sentido = 1;
|
|
|
|
if (y == 0)
|
|
|
|
sentido = 0;
|
|
|
|
}
|
|
|
|
} while (counter > 0);
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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) {
|
2008-05-31 09:16:26 +00:00
|
|
|
if (currentChapter == 1 /*|| currentChapter == 4*/) {
|
2008-05-02 13:26:48 +00:00
|
|
|
if (nflag != 7) {
|
2008-05-30 11:04:40 +00:00
|
|
|
playSound(3);
|
2008-05-02 13:26:48 +00:00
|
|
|
flags[nflag] = 1;
|
|
|
|
}
|
|
|
|
} else {
|
2008-05-30 11:04:40 +00:00
|
|
|
playSound(3);
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-31 08:26:06 +00:00
|
|
|
while (!isTalkFinished(&length));
|
2007-10-07 22:00:43 +00:00
|
|
|
|
2008-05-02 11:44:47 +00:00
|
|
|
updateRoom();
|
2008-05-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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-30 14:25:03 +00:00
|
|
|
loadAndDecompressPic("102.alg", drawSurface1, HALF_PAL);
|
|
|
|
loadAndDecompressPic("an_p1.alg", drawSurface3, 1);
|
|
|
|
loadAndDecompressPic("an_p2.alg", extraSurface, 1);
|
|
|
|
loadAndDecompressPic("an_p3.alg", 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-30 08:14:01 +00:00
|
|
|
conta_blind_vez = getTime();
|
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-30 11:04:40 +00:00
|
|
|
playSound(4);
|
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-31 12:40:02 +00:00
|
|
|
updateScreen();
|
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
|