2004-04-09 12:36:06 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2005-01-09 16:06:29 +00:00
|
|
|
* Copyright (C) 2004-2005 The ScummVM project
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-01-09 16:06:29 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2004-04-09 12:36:06 +00:00
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-04-09 12:36:06 +00:00
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KYRA_H
|
|
|
|
#define KYRA_H
|
|
|
|
|
|
|
|
#include "base/engine.h"
|
2005-10-05 16:40:51 +00:00
|
|
|
#include "common/rect.h"
|
2005-10-12 19:15:32 +00:00
|
|
|
#include "sound/mixer.h"
|
2005-10-13 21:12:47 +00:00
|
|
|
#include "common/file.h"
|
2005-10-12 19:15:32 +00:00
|
|
|
|
|
|
|
class AudioStream;
|
2004-04-09 12:36:06 +00:00
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
namespace Kyra {
|
|
|
|
|
2005-10-03 20:21:18 +00:00
|
|
|
#define MAX_NUM_ROOMS 12
|
|
|
|
|
2004-10-15 06:06:47 +00:00
|
|
|
enum {
|
2005-08-19 22:12:09 +00:00
|
|
|
GF_FLOPPY = 1 << 0,
|
|
|
|
GF_TALKIE = 1 << 1,
|
2005-10-14 11:25:48 +00:00
|
|
|
GF_AUDIOCD = 1 << 2, // FM-Towns versions seems to use audio CD
|
|
|
|
GF_DEMO = 1 << 3,
|
|
|
|
GF_ENGLISH = 1 << 4,
|
|
|
|
GF_FRENCH = 1 << 5,
|
|
|
|
GF_GERMAN = 1 << 6
|
2005-10-13 21:12:47 +00:00
|
|
|
|
2004-11-11 13:37:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
2005-10-13 21:12:47 +00:00
|
|
|
GI_KYRA1 = 0
|
2004-10-15 06:06:47 +00:00
|
|
|
};
|
|
|
|
|
2005-09-09 21:13:43 +00:00
|
|
|
struct Character {
|
|
|
|
uint16 sceneId;
|
|
|
|
uint8 height;
|
|
|
|
uint8 facing;
|
|
|
|
uint16 currentAnimFrame;
|
|
|
|
uint32 unk6;
|
|
|
|
uint8 inventoryItems[10];
|
|
|
|
int16 x1, y1, x2, y2;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Shape {
|
|
|
|
uint8 unk0;
|
|
|
|
uint8 unk1;
|
|
|
|
uint8 imageNum;
|
|
|
|
uint8 x, y, w, h;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Room {
|
2005-10-03 20:21:18 +00:00
|
|
|
// uint8 id;
|
2005-09-10 00:15:40 +00:00
|
|
|
uint16 northExit;
|
|
|
|
uint16 eastExit;
|
|
|
|
uint16 southExit;
|
|
|
|
uint16 westExit;
|
|
|
|
uint8 itemsTable[12];
|
2005-10-03 20:21:18 +00:00
|
|
|
const char *filename;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Cursor {
|
|
|
|
int x, y;
|
|
|
|
int w, h;
|
2005-09-09 21:13:43 +00:00
|
|
|
};
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
struct TalkCoords {
|
|
|
|
uint16 y, x, w;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SeqLoop {
|
|
|
|
const uint8 *ptr;
|
|
|
|
uint16 count;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct WSAMovieV1;
|
|
|
|
|
2004-11-14 20:11:22 +00:00
|
|
|
class MusicPlayer;
|
2005-10-06 11:57:02 +00:00
|
|
|
class SeqPlayer;
|
2005-08-19 22:12:09 +00:00
|
|
|
class Resource;
|
|
|
|
class Screen;
|
2005-10-03 20:21:18 +00:00
|
|
|
class Sprites;
|
2004-04-09 12:36:06 +00:00
|
|
|
|
|
|
|
class KyraEngine : public Engine {
|
2005-09-11 14:35:34 +00:00
|
|
|
friend class MusicPlayer;
|
2004-10-15 06:06:47 +00:00
|
|
|
public:
|
2004-04-09 12:36:06 +00:00
|
|
|
|
2005-09-08 19:09:52 +00:00
|
|
|
enum {
|
|
|
|
TALK_SUBSTRING_LEN = 80,
|
|
|
|
TALK_SUBSTRING_NUM = 3
|
|
|
|
};
|
2005-09-11 14:35:34 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
MUSIC_INTRO = 0
|
|
|
|
};
|
2005-09-08 19:09:52 +00:00
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
KyraEngine(GameDetector *detector, OSystem *system);
|
|
|
|
~KyraEngine();
|
|
|
|
|
|
|
|
void errorString(const char *buf_input, char *buf_output);
|
2004-10-15 06:06:47 +00:00
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
Resource *resource() { return _res; }
|
|
|
|
Screen *screen() { return _screen; }
|
2005-10-06 11:57:02 +00:00
|
|
|
MusicPlayer *midi() { return _midi; }
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
uint8 game() const { return _game; }
|
2005-10-13 21:12:47 +00:00
|
|
|
uint32 features() const { return _features; }
|
2005-09-02 11:12:09 +00:00
|
|
|
|
|
|
|
Common::RandomSource _rnd;
|
2004-10-15 06:06:47 +00:00
|
|
|
|
2005-09-08 19:09:52 +00:00
|
|
|
typedef void (KyraEngine::*IntroProc)();
|
|
|
|
|
2005-10-06 11:57:02 +00:00
|
|
|
// these tables are specific to the demo version
|
|
|
|
static const char *_seq_demo_WSATable[];
|
|
|
|
static const char *_seq_demo_COLTable[];
|
|
|
|
|
|
|
|
// these tables are specific to the floppy version
|
|
|
|
static const char *_seq_WSATable[];
|
|
|
|
static const char *_seq_CPSTable[];
|
|
|
|
static const char *_seq_COLTable[];
|
|
|
|
static const char *_seq_textsTableEN[];
|
|
|
|
|
|
|
|
bool seq_skipSequence() const;
|
|
|
|
|
|
|
|
void loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData);
|
|
|
|
|
|
|
|
void snd_playTheme(int file, int track = 0);
|
2005-10-12 19:15:32 +00:00
|
|
|
void snd_playTrack(int track);
|
|
|
|
void snd_playVoiceFile(int id);
|
|
|
|
bool snd_voicePlaying();
|
2005-10-06 11:57:02 +00:00
|
|
|
|
|
|
|
void printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage);
|
|
|
|
void restoreTalkTextMessageBkgd(int srcPage, int dstPage);
|
|
|
|
|
|
|
|
WSAMovieV1 *wsa_open(const char *filename, int offscreenDecode, uint8 *palBuf);
|
|
|
|
void wsa_close(WSAMovieV1 *wsa);
|
|
|
|
uint16 wsa_getNumFrames(WSAMovieV1 *wsa) const;
|
|
|
|
void wsa_play(WSAMovieV1 *wsa, int frameNum, int x, int y, int pageNum);
|
|
|
|
|
|
|
|
void waitTicks(int ticks);
|
|
|
|
|
2004-04-09 12:36:06 +00:00
|
|
|
protected:
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
int go();
|
2004-11-24 00:14:21 +00:00
|
|
|
int init(GameDetector &detector);
|
2004-04-09 12:36:06 +00:00
|
|
|
|
2005-09-10 00:15:40 +00:00
|
|
|
void startup();
|
|
|
|
void mainLoop();
|
2005-08-31 20:14:20 +00:00
|
|
|
void setTalkCoords(uint16 y);
|
|
|
|
int getCenterStringX(const char *str, int x1, int x2);
|
|
|
|
int getCharLength(const char *str, int len);
|
|
|
|
int dropCRIntoString(char *str, int offs);
|
|
|
|
char *preprocessString(const char *str);
|
|
|
|
int buildMessageSubstrings(const char *str);
|
|
|
|
int getWidestLineWidth(int linesCount);
|
|
|
|
void calcWidestLineBounds(int &x1, int &x2, int w, int cx);
|
|
|
|
void printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2);
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2005-09-10 06:40:20 +00:00
|
|
|
void seq_demo();
|
2005-08-19 22:12:09 +00:00
|
|
|
void seq_intro();
|
|
|
|
void seq_introLogos();
|
2005-09-08 19:09:52 +00:00
|
|
|
void seq_introStory();
|
|
|
|
void seq_introMalcomTree();
|
|
|
|
void seq_introKallakWriting();
|
|
|
|
void seq_introKallakMalcom();
|
2005-08-19 22:12:09 +00:00
|
|
|
|
|
|
|
void wsa_processFrame(WSAMovieV1 *wsa, int frameNum, uint8 *dst);
|
2005-09-11 14:35:34 +00:00
|
|
|
|
|
|
|
void snd_startTrack();
|
|
|
|
void snd_haltTrack();
|
|
|
|
void snd_setSoundEffectFile(int file);
|
|
|
|
void snd_playSoundEffect(int track);
|
2005-10-12 19:15:32 +00:00
|
|
|
|
2005-10-03 20:21:18 +00:00
|
|
|
void loadRoom(uint16 roomID);
|
|
|
|
void drawRoom();
|
|
|
|
void delay(uint32 millis);
|
|
|
|
void loadPalette(const char *filename, uint8 *palData);
|
|
|
|
void setCursor(uint8 cursorID);
|
|
|
|
void setupRooms();
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
uint8 _game;
|
|
|
|
bool _fastMode;
|
|
|
|
bool _quitFlag;
|
|
|
|
bool _skipIntroFlag;
|
2005-10-03 20:21:18 +00:00
|
|
|
bool _abortIntroFlag;
|
2005-09-08 19:09:52 +00:00
|
|
|
char _talkBuffer[300];
|
|
|
|
char _talkSubstrings[TALK_SUBSTRING_LEN * TALK_SUBSTRING_NUM];
|
2005-08-19 22:12:09 +00:00
|
|
|
TalkCoords _talkCoords;
|
2005-08-31 20:14:20 +00:00
|
|
|
uint16 _talkMessageY;
|
|
|
|
uint16 _talkMessageH;
|
|
|
|
bool _talkMessagePrinted;
|
2005-09-10 00:15:40 +00:00
|
|
|
uint8 _flagsTable[51];
|
2005-10-03 20:21:18 +00:00
|
|
|
uint16 _gameSpeed;
|
2005-10-13 21:12:47 +00:00
|
|
|
uint32 _features;
|
2005-08-19 22:12:09 +00:00
|
|
|
|
2005-10-03 20:21:18 +00:00
|
|
|
uint16 _currentRoom;
|
2005-10-12 19:15:32 +00:00
|
|
|
AudioStream *_currentVocFile;
|
|
|
|
Audio::SoundHandle _vocHandle;
|
2005-08-19 22:12:09 +00:00
|
|
|
|
|
|
|
Resource *_res;
|
|
|
|
Screen *_screen;
|
2005-09-08 19:09:52 +00:00
|
|
|
MusicPlayer *_midi;
|
2005-10-06 11:57:02 +00:00
|
|
|
SeqPlayer *_seq;
|
2005-10-03 20:21:18 +00:00
|
|
|
Sprites *_sprites;
|
|
|
|
Room _rooms[MAX_NUM_ROOMS];
|
2005-09-08 19:09:52 +00:00
|
|
|
|
2005-10-03 20:21:18 +00:00
|
|
|
static const Cursor _cursors[];
|
|
|
|
static const int _cursorsCount;
|
|
|
|
|
2005-09-10 06:40:20 +00:00
|
|
|
// these tables are specific to the demo version
|
|
|
|
static const uint8 _seq_demoData_WestwoodLogo[];
|
|
|
|
static const uint8 _seq_demoData_KyrandiaLogo[];
|
|
|
|
static const uint8 _seq_demoData_Demo1[];
|
|
|
|
static const uint8 _seq_demoData_Demo2[];
|
|
|
|
static const uint8 _seq_demoData_Demo3[];
|
|
|
|
static const uint8 _seq_demoData_Demo4[];
|
|
|
|
|
2005-09-08 19:09:52 +00:00
|
|
|
// these tables are specific to the floppy version
|
2005-09-10 07:46:18 +00:00
|
|
|
static const uint8 _seq_floppyData_Forest[];
|
|
|
|
static const uint8 _seq_floppyData_KallakWriting[];
|
|
|
|
static const uint8 _seq_floppyData_KyrandiaLogo[];
|
|
|
|
static const uint8 _seq_floppyData_KallakMalcom[];
|
|
|
|
static const uint8 _seq_floppyData_MalcomTree[];
|
|
|
|
static const uint8 _seq_floppyData_WestwoodLogo[];
|
2005-10-12 19:15:32 +00:00
|
|
|
|
|
|
|
// these tables are specific to the CD version
|
|
|
|
static const uint8 _seq_cdromData_KyrandiaLogo[];
|
|
|
|
static const uint8 _seq_cdromData_WestwoodLogo[];
|
|
|
|
static const uint8 _seq_cdromData_Forest[];
|
|
|
|
static const uint8 _seq_cdromData_MalcomTree[];
|
|
|
|
static const uint8 _seq_cdromData_KallakWriting[];
|
|
|
|
static const uint8 _seq_cdromData_KallakMalcom[];
|
2005-10-05 16:40:51 +00:00
|
|
|
|
2005-09-11 14:35:34 +00:00
|
|
|
static const char *_xmidiFiles[];
|
|
|
|
static const int _xmidiFilesCount;
|
2004-04-09 12:36:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Kyra
|
|
|
|
|
|
|
|
#endif
|