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 {
|
|
|
|
|
2004-10-15 06:06:47 +00:00
|
|
|
enum {
|
2005-10-18 19:59:51 +00:00
|
|
|
GF_FLOPPY = 1 << 0,
|
|
|
|
GF_TALKIE = 1 << 1,
|
|
|
|
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,
|
|
|
|
GF_SPANISH = 1 << 7,
|
|
|
|
// other languages here
|
|
|
|
GF_LNGUNK = 1 << 16
|
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;
|
2005-10-29 18:37:40 +00:00
|
|
|
uint16 field_20;
|
|
|
|
uint16 field_23;
|
2005-09-09 21:13:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Shape {
|
2005-10-29 18:37:40 +00:00
|
|
|
uint8 imageIndex;
|
|
|
|
int8 xOffset, yOffset;
|
2005-09-09 21:13:43 +00:00
|
|
|
uint8 x, y, w, h;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Room {
|
2005-10-29 18:37:40 +00:00
|
|
|
uint8 nameIndex;
|
2005-09-10 00:15:40 +00:00
|
|
|
uint16 northExit;
|
|
|
|
uint16 eastExit;
|
|
|
|
uint16 southExit;
|
|
|
|
uint16 westExit;
|
|
|
|
uint8 itemsTable[12];
|
2005-10-29 18:37:40 +00:00
|
|
|
uint16 itemsXPos[12];
|
|
|
|
uint8 itemsYPos[12];
|
2005-12-08 17:19:18 +00:00
|
|
|
uint32 unkField3[12];
|
2005-10-03 20:21:18 +00:00
|
|
|
};
|
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
struct AnimObject {
|
|
|
|
uint8 index;
|
|
|
|
uint32 active;
|
|
|
|
uint32 refreshFlag;
|
|
|
|
uint32 bkgdChangeFlag;
|
2005-10-30 19:58:51 +00:00
|
|
|
uint32 unk1;
|
2005-10-29 18:37:40 +00:00
|
|
|
uint32 flags;
|
|
|
|
int16 drawY;
|
|
|
|
uint8 *sceneAnimPtr;
|
2005-11-10 14:08:50 +00:00
|
|
|
int16 animFrameNumber;
|
2005-10-29 18:37:40 +00:00
|
|
|
uint8 *background;
|
|
|
|
uint16 rectSize;
|
|
|
|
int16 x1, y1;
|
|
|
|
int16 x2, y2;
|
|
|
|
uint16 width;
|
|
|
|
uint16 height;
|
|
|
|
uint16 width2;
|
|
|
|
uint16 height2;
|
|
|
|
AnimObject *nextAnimObject;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Rect {
|
2005-10-03 20:21:18 +00:00
|
|
|
int x, y;
|
2005-10-29 18:37:40 +00:00
|
|
|
int x2, y2;
|
2005-09-09 21:13:43 +00:00
|
|
|
};
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
struct TalkCoords {
|
|
|
|
uint16 y, x, w;
|
|
|
|
};
|
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
struct Item {
|
|
|
|
uint8 unk1;
|
|
|
|
uint8 height;
|
|
|
|
uint8 unk2;
|
|
|
|
uint8 unk3;
|
|
|
|
};
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
struct SeqLoop {
|
|
|
|
const uint8 *ptr;
|
|
|
|
uint16 count;
|
|
|
|
};
|
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
struct SceneExits {
|
2005-11-09 22:26:12 +00:00
|
|
|
uint16 northXPos;
|
|
|
|
uint8 northYPos;
|
|
|
|
uint16 eastXPos;
|
|
|
|
uint8 eastYPos;
|
|
|
|
uint16 southXPos;
|
|
|
|
uint8 southYPos;
|
|
|
|
uint16 westXPos;
|
|
|
|
uint8 westYPos;
|
2005-10-29 18:37:40 +00:00
|
|
|
};
|
|
|
|
|
2005-08-19 22:12:09 +00:00
|
|
|
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;
|
2005-10-18 19:59:51 +00:00
|
|
|
class PAKFile;
|
2005-08-19 22:12:09 +00:00
|
|
|
class Screen;
|
2005-10-03 20:21:18 +00:00
|
|
|
class Sprites;
|
2005-10-29 18:37:40 +00:00
|
|
|
struct ScriptState;
|
|
|
|
struct ScriptData;
|
|
|
|
class ScriptHelper;
|
2005-11-11 22:17:06 +00:00
|
|
|
class KyraEngine;
|
|
|
|
|
|
|
|
struct Timer {
|
|
|
|
bool active;
|
|
|
|
int16 countdown;
|
|
|
|
uint32 nextRun;
|
|
|
|
void (KyraEngine::*func)(int timerNum);
|
|
|
|
};
|
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;
|
2005-10-29 18:37:40 +00:00
|
|
|
int16 _northExitHeight;
|
2004-10-15 06:06:47 +00:00
|
|
|
|
2005-11-10 14:08:50 +00:00
|
|
|
Character *_currentCharacter;
|
|
|
|
|
2005-09-08 19:09:52 +00:00
|
|
|
typedef void (KyraEngine::*IntroProc)();
|
2005-10-29 18:37:40 +00:00
|
|
|
typedef int (KyraEngine::*OpcodeProc)(ScriptState *script);
|
2005-09-08 19:09:52 +00:00
|
|
|
|
2005-10-18 19:59:51 +00:00
|
|
|
const char **seqWSATable() { return (const char **)_seq_WSATable; }
|
|
|
|
const char **seqCPSTable() { return (const char **)_seq_CPSTable; }
|
|
|
|
const char **seqCOLTable() { return (const char **)_seq_COLTable; }
|
|
|
|
const char **seqTextsTable() { return (const char **)_seq_textsTable; }
|
2005-10-06 11:57:02 +00:00
|
|
|
|
|
|
|
bool seq_skipSequence() const;
|
2005-11-10 14:08:50 +00:00
|
|
|
void quitGame();
|
2005-10-06 11:57:02 +00:00
|
|
|
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-11-10 14:08:50 +00:00
|
|
|
void snd_playSoundEffect(int track);
|
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);
|
2005-11-10 14:08:50 +00:00
|
|
|
void drawSentenceCommand(char *sentence, int unk1);
|
2005-10-06 11:57:02 +00:00
|
|
|
|
2005-11-11 22:17:06 +00:00
|
|
|
void updateGameTimers();
|
|
|
|
void clearNextEventTickCount();
|
|
|
|
void setTimerCountdown(uint8 timer, int16 countdown);
|
|
|
|
int16 getTimerDelay(uint8 timer);
|
|
|
|
void enableTimer(uint8 timer);
|
|
|
|
void disableTimer(uint8 timer);
|
|
|
|
|
2005-10-06 11:57:02 +00:00
|
|
|
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);
|
2005-11-10 14:08:50 +00:00
|
|
|
void updateAllObjectShapes();
|
|
|
|
void flagAllObjectsForRefresh();
|
|
|
|
void animRefreshNPC(int character);
|
|
|
|
int16 fetchAnimWidth(const uint8 *shape, int16 mult);
|
2005-12-08 17:19:18 +00:00
|
|
|
int16 fetchAnimHeight(const uint8 *shape, int16 mult);
|
2005-10-22 00:24:07 +00:00
|
|
|
|
|
|
|
int mouseX() { return _mouseX; }
|
|
|
|
int mouseY() { return _mouseY; }
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
// all opcode procs (maybe that is somehow useless atm)
|
|
|
|
int cmd_magicInMouseItem(ScriptState *script);
|
|
|
|
int cmd_characterSays(ScriptState *script);
|
|
|
|
int cmd_pauseTicks(ScriptState *script);
|
|
|
|
int cmd_drawSceneAnimShape(ScriptState *script);
|
|
|
|
int cmd_queryGameFlag(ScriptState *script);
|
|
|
|
int cmd_setGameFlag(ScriptState *script);
|
|
|
|
int cmd_resetGameFlag(ScriptState *script);
|
|
|
|
int cmd_runNPCScript(ScriptState *script);
|
|
|
|
int cmd_setSpecialExitList(ScriptState *script);
|
|
|
|
int cmd_blockInWalkableRegion(ScriptState *script);
|
|
|
|
int cmd_blockOutWalkableRegion(ScriptState *script);
|
|
|
|
int cmd_walkPlayerToPoint(ScriptState *script);
|
|
|
|
int cmd_dropItemInScene(ScriptState *script);
|
|
|
|
int cmd_drawAnimShapeIntoScene(ScriptState *script);
|
|
|
|
int cmd_createMouseItem(ScriptState *script);
|
|
|
|
int cmd_savePageToDisk(ScriptState *script);
|
|
|
|
int cmd_sceneAnimOn(ScriptState *script);
|
|
|
|
int cmd_sceneAnimOff(ScriptState *script);
|
|
|
|
int cmd_getElapsedSeconds(ScriptState *script);
|
|
|
|
int cmd_mouseIsPointer(ScriptState *script);
|
|
|
|
int cmd_destroyMouseItem(ScriptState *script);
|
|
|
|
int cmd_runSceneAnimUntilDone(ScriptState *script);
|
|
|
|
int cmd_fadeSpecialPalette(ScriptState *script);
|
|
|
|
int cmd_playAdlibSound(ScriptState *script);
|
|
|
|
int cmd_playAdlibScore(ScriptState *script);
|
|
|
|
int cmd_phaseInSameScene(ScriptState *script);
|
|
|
|
int cmd_setScenePhasingFlag(ScriptState *script);
|
|
|
|
int cmd_resetScenePhasingFlag(ScriptState *script);
|
|
|
|
int cmd_queryScenePhasingFlag(ScriptState *script);
|
|
|
|
int cmd_sceneToDirection(ScriptState *script);
|
|
|
|
int cmd_setBirthstoneGem(ScriptState *script);
|
|
|
|
int cmd_placeItemInGenericMapScene(ScriptState *script);
|
|
|
|
int cmd_setBrandonStatusBit(ScriptState *script);
|
|
|
|
int cmd_pauseSeconds(ScriptState *script);
|
|
|
|
int cmd_getCharactersLocation(ScriptState *script);
|
|
|
|
int cmd_runNPCSubscript(ScriptState *script);
|
|
|
|
int cmd_magicOutMouseItem(ScriptState *script);
|
|
|
|
int cmd_internalAnimOn(ScriptState *script);
|
|
|
|
int cmd_forceBrandonToNormal(ScriptState *script);
|
|
|
|
int cmd_poisonDeathNow(ScriptState *script);
|
|
|
|
int cmd_setScaleMode(ScriptState *script);
|
|
|
|
int cmd_openWSAFile(ScriptState *script);
|
|
|
|
int cmd_closeWSAFile(ScriptState *script);
|
|
|
|
int cmd_runWSAFromBeginningToEnd(ScriptState *script);
|
|
|
|
int cmd_displayWSAFrame(ScriptState *script);
|
|
|
|
int cmd_enterNewScene(ScriptState *script);
|
|
|
|
int cmd_setSpecialEnterXAndY(ScriptState *script);
|
|
|
|
int cmd_runWSAFrames(ScriptState *script);
|
|
|
|
int cmd_popBrandonIntoScene(ScriptState *script);
|
|
|
|
int cmd_restoreAllObjectBackgrounds(ScriptState *script);
|
|
|
|
int cmd_setCustomPaletteRange(ScriptState *script);
|
|
|
|
int cmd_loadPageFromDisk(ScriptState *script);
|
|
|
|
int cmd_customPrintTalkString(ScriptState *script);
|
|
|
|
int cmd_restoreCustomPrintBackground(ScriptState *script);
|
|
|
|
int cmd_hideMouse(ScriptState *script);
|
|
|
|
int cmd_showMouse(ScriptState *script);
|
|
|
|
int cmd_getCharacterX(ScriptState *script);
|
|
|
|
int cmd_getCharacterY(ScriptState *script);
|
|
|
|
int cmd_changeCharactersFacing(ScriptState *script);
|
2005-11-18 23:55:31 +00:00
|
|
|
int cmd_copyWSARegion(ScriptState *script);
|
2005-10-29 18:37:40 +00:00
|
|
|
int cmd_printText(ScriptState *script);
|
|
|
|
int cmd_random(ScriptState *script);
|
|
|
|
int cmd_loadSoundFile(ScriptState *script);
|
|
|
|
int cmd_displayWSAFrameOnHidPage(ScriptState *script);
|
|
|
|
int cmd_displayWSASequentialFrames(ScriptState *script);
|
|
|
|
int cmd_drawCharacterStanding(ScriptState *script);
|
|
|
|
int cmd_internalAnimOff(ScriptState *script);
|
|
|
|
int cmd_changeCharactersXAndY(ScriptState *script);
|
|
|
|
int cmd_clearSceneAnimatorBeacon(ScriptState *script);
|
|
|
|
int cmd_querySceneAnimatorBeacon(ScriptState *script);
|
|
|
|
int cmd_refreshSceneAnimator(ScriptState *script);
|
|
|
|
int cmd_placeItemInOffScene(ScriptState *script);
|
|
|
|
int cmd_wipeDownMouseItem(ScriptState *script);
|
|
|
|
int cmd_placeCharacterInOtherScene(ScriptState *script);
|
|
|
|
int cmd_getKey(ScriptState *script);
|
|
|
|
int cmd_specificItemInInventory(ScriptState *script);
|
|
|
|
int cmd_popMobileNPCIntoScene(ScriptState *script);
|
|
|
|
int cmd_mobileCharacterInScene(ScriptState *script);
|
|
|
|
int cmd_hideMobileCharacter(ScriptState *script);
|
|
|
|
int cmd_unhideMobileCharacter(ScriptState *script);
|
|
|
|
int cmd_setCharactersLocation(ScriptState *script);
|
|
|
|
int cmd_walkCharacterToPoint(ScriptState *script);
|
|
|
|
int cmd_specialEventDisplayBrynnsNote(ScriptState *script);
|
|
|
|
int cmd_specialEventRemoveBrynnsNote(ScriptState *script);
|
|
|
|
int cmd_setLogicPage(ScriptState *script);
|
|
|
|
int cmd_fatPrint(ScriptState *script);
|
|
|
|
int cmd_preserveAllObjectBackgrounds(ScriptState *script);
|
|
|
|
int cmd_updateSceneAnimations(ScriptState *script);
|
|
|
|
int cmd_sceneAnimationActive(ScriptState *script);
|
|
|
|
int cmd_setCharactersMovementDelay(ScriptState *script);
|
|
|
|
int cmd_getCharactersFacing(ScriptState *script);
|
|
|
|
int cmd_bkgdScrollSceneAndMasksRight(ScriptState *script);
|
|
|
|
int cmd_dispelMagicAnimation(ScriptState *script);
|
|
|
|
int cmd_findBrightestFireberry(ScriptState *script);
|
|
|
|
int cmd_setFireberryGlowPalette(ScriptState *script);
|
|
|
|
int cmd_setDeathHandlerFlag(ScriptState *script);
|
|
|
|
int cmd_drinkPotionAnimation(ScriptState *script);
|
|
|
|
int cmd_makeAmuletAppear(ScriptState *script);
|
|
|
|
int cmd_drawItemShapeIntoScene(ScriptState *script);
|
|
|
|
int cmd_setCharactersCurrentFrame(ScriptState *script);
|
|
|
|
int cmd_waitForConfirmationMouseClick(ScriptState *script);
|
|
|
|
int cmd_pageFlip(ScriptState *script);
|
|
|
|
int cmd_setSceneFile(ScriptState *script);
|
|
|
|
int cmd_getItemInMarbleVase(ScriptState *script);
|
|
|
|
int cmd_setItemInMarbleVase(ScriptState *script);
|
|
|
|
int cmd_addItemToInventory(ScriptState *script);
|
|
|
|
int cmd_intPrint(ScriptState *script);
|
|
|
|
int cmd_shakeScreen(ScriptState *script);
|
|
|
|
int cmd_createAmuletJewel(ScriptState *script);
|
|
|
|
int cmd_setSceneAnimCurrXY(ScriptState *script);
|
|
|
|
int cmd_Poison_Brandon_And_Remaps(ScriptState *script);
|
|
|
|
int cmd_fillFlaskWithWater(ScriptState *script);
|
|
|
|
int cmd_getCharactersMovementDelay(ScriptState *script);
|
|
|
|
int cmd_getBirthstoneGem(ScriptState *script);
|
|
|
|
int cmd_queryBrandonStatusBit(ScriptState *script);
|
|
|
|
int cmd_playFluteAnimation(ScriptState *script);
|
|
|
|
int cmd_playWinterScrollSequence(ScriptState *script);
|
|
|
|
int cmd_getIdolGem(ScriptState *script);
|
|
|
|
int cmd_setIdolGem(ScriptState *script);
|
|
|
|
int cmd_totalItemsInScene(ScriptState *script);
|
|
|
|
int cmd_restoreBrandonsMovementDelay(ScriptState *script);
|
|
|
|
int cmd_setMousePos(ScriptState *script);
|
|
|
|
int cmd_getMouseState(ScriptState *script);
|
|
|
|
int cmd_setEntranceMouseCursorTrack(ScriptState *script);
|
|
|
|
int cmd_itemAppearsOnGround(ScriptState *script);
|
|
|
|
int cmd_setNoDrawShapesFlag(ScriptState *script);
|
|
|
|
int cmd_fadeEntirePalette(ScriptState *script);
|
|
|
|
int cmd_itemOnGroundHere(ScriptState *script);
|
|
|
|
int cmd_queryCauldronState(ScriptState *script);
|
|
|
|
int cmd_setCauldronState(ScriptState *script);
|
|
|
|
int cmd_queryCrystalState(ScriptState *script);
|
|
|
|
int cmd_setCrystalState(ScriptState *script);
|
|
|
|
int cmd_setPaletteRange(ScriptState *script);
|
|
|
|
int cmd_shrinkBrandonDown(ScriptState *script);
|
|
|
|
int cmd_growBrandonUp(ScriptState *script);
|
|
|
|
int cmd_setBrandonScaleXAndY(ScriptState *script);
|
|
|
|
int cmd_resetScaleMode(ScriptState *script);
|
|
|
|
int cmd_getScaleDepthTableValue(ScriptState *script);
|
|
|
|
int cmd_setScaleDepthTableValue(ScriptState *script);
|
|
|
|
int cmd_message(ScriptState *script);
|
|
|
|
int cmd_checkClickOnNPC(ScriptState *script);
|
|
|
|
int cmd_getFoyerItem(ScriptState *script);
|
|
|
|
int cmd_setFoyerItem(ScriptState *script);
|
|
|
|
int cmd_setNoItemDropRegion(ScriptState *script);
|
|
|
|
int cmd_walkMalcolmOn(ScriptState *script);
|
|
|
|
int cmd_passiveProtection(ScriptState *script);
|
|
|
|
int cmd_setPlayingLoop(ScriptState *script);
|
|
|
|
int cmd_brandonToStoneSequence(ScriptState *script);
|
|
|
|
int cmd_brandonHealingSequence(ScriptState *script);
|
|
|
|
int cmd_protectCommandLine(ScriptState *script);
|
|
|
|
int cmd_pauseMusicSeconds(ScriptState *script);
|
|
|
|
int cmd_resetMaskRegion(ScriptState *script);
|
|
|
|
int cmd_setPaletteChangeFlag(ScriptState *script);
|
|
|
|
int cmd_fillRect(ScriptState *script);
|
|
|
|
int cmd_dummy(ScriptState *script);
|
2005-10-06 11:57:02 +00:00
|
|
|
|
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-11-10 14:08:50 +00:00
|
|
|
void characterSays(char *msg, int8 charNum, int8 chatDuration);
|
|
|
|
int initCharacterChat(int8 charNum);
|
|
|
|
int8 getChatPartnerNum();
|
|
|
|
void backupChatPartnerAnimFrame(int8 charNum);
|
|
|
|
void restoreChatPartnerAnimFrame(int8 charNum);
|
|
|
|
void endCharacterChat(int8 charNum, int16 arg_4);
|
|
|
|
void waitForChatToFinish(int16 chatDuration, char *str, uint8 charNum);
|
|
|
|
void printCharacterText(char *text, int8 charNum);
|
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
void setCharacterDefaultFrame(int character);
|
|
|
|
void setCharactersPositions(int character);
|
|
|
|
void setCharactersHeight();
|
|
|
|
int setGameFlag(int flag);
|
|
|
|
int queryGameFlag(int flag);
|
|
|
|
int resetGameFlag(int flag);
|
|
|
|
|
|
|
|
void enterNewScene(int sceneId, int facing, int unk1, int unk2, int brandonAlive);
|
|
|
|
void moveCharacterToPos(int character, int facing, int xpos, int ypos);
|
|
|
|
void setCharacterPositionWithUpdate(int character);
|
2005-11-09 22:26:12 +00:00
|
|
|
int setCharacterPosition(int character, int *facingTable);
|
|
|
|
void setCharacterPositionHelper(int character, int *facingTable);
|
2005-10-29 18:37:40 +00:00
|
|
|
int getOppositeFacingDirection(int dir);
|
|
|
|
void loadSceneMSC();
|
|
|
|
void blockInRegion(int x, int y, int width, int height);
|
|
|
|
void blockOutRegion(int x, int y, int width, int height);
|
|
|
|
void startSceneScript(int brandonAlive);
|
2005-12-08 17:19:18 +00:00
|
|
|
void setupSceneItems();
|
2005-10-29 18:37:40 +00:00
|
|
|
void initSceneData(int facing, int unk1, int brandonAlive);
|
|
|
|
void clearNoDropRects();
|
|
|
|
void addToNoDropRects(int x, int y, int w, int h);
|
|
|
|
byte findFreeItemInScene(int scene);
|
|
|
|
byte findItemAtPos(int x, int y);
|
|
|
|
void placeItemInGenericMapScene(int item, int index);
|
|
|
|
void initSceneObjectList(int brandonAlive);
|
2005-11-10 14:08:50 +00:00
|
|
|
void initSceneScreen(int brandonAlive);
|
|
|
|
void preserveAllBackgrounds();
|
|
|
|
void flagAllObjectsForBkgdChange();
|
2005-10-29 18:37:40 +00:00
|
|
|
void restoreAllObjectBackgrounds();
|
|
|
|
void preserveAnyChangedBackgrounds();
|
|
|
|
void preserveOrRestoreBackground(AnimObject *obj, bool restore);
|
|
|
|
void prepDrawAllObjects();
|
|
|
|
void copyChangedObjectsForward(int refreshFlag);
|
|
|
|
int findDuplicateItemShape(int shape);
|
2005-11-01 14:19:50 +00:00
|
|
|
int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);
|
|
|
|
int findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end);
|
|
|
|
int getFacingFromPointToPoint(int x, int y, int toX, int toY);
|
|
|
|
void changePosTowardsFacing(int &x, int &y, int facing);
|
|
|
|
bool lineIsPassable(int x, int y);
|
|
|
|
int getMoveTableSize(int *moveTable);
|
2005-11-09 22:26:12 +00:00
|
|
|
int handleSceneChange(int xpos, int ypos, int unk1, int frameReset);
|
|
|
|
int processSceneChange(int *table, int unk1, int frameReset);
|
|
|
|
int changeScene(int facing);
|
2005-11-18 23:55:31 +00:00
|
|
|
void createMouseItem(int item);
|
|
|
|
void destroyMouseItem();
|
|
|
|
void setMouseItem(int item);
|
|
|
|
void wipeDownMouseItem(int xpos, int ypos);
|
2005-12-08 17:19:18 +00:00
|
|
|
void backUpRect0(int xpos, int ypos);
|
|
|
|
void restoreRect0(int xpos, int ypos);
|
2005-11-18 23:55:31 +00:00
|
|
|
void backUpRect1(int xpos, int ypos);
|
|
|
|
void restoreRect1(int xpos, int ypos);
|
|
|
|
|
|
|
|
void processInput(int xpos, int ypos);
|
|
|
|
int processInputHelper(int xpos, int ypos);
|
|
|
|
int clickEventHandler(int xpos, int ypos);
|
2005-12-08 17:19:18 +00:00
|
|
|
void clickEventHandler2();
|
2005-11-18 23:55:31 +00:00
|
|
|
void updateMousePointer();
|
2005-10-29 18:37:40 +00:00
|
|
|
|
2005-12-08 17:19:18 +00:00
|
|
|
int countItemsInScene(uint16 sceneId);
|
|
|
|
int unkItemFunction(uint16 sceneId, uint8 item, int x, int y, int unk1, int unk2);
|
|
|
|
void exchangeItemWithMouseItem(uint16 sceneId, int itemIndex);
|
|
|
|
void addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y);
|
|
|
|
int getDrawLayer(int x, int y);
|
|
|
|
int getDrawLayer2(int x, int y, int height);
|
|
|
|
int checkNoDropRects(int x, int y);
|
|
|
|
int isDropable(int x, int y);
|
|
|
|
void itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item);
|
|
|
|
|
|
|
|
void animRemoveGameItem(int index);
|
|
|
|
void animAddGameItem(int index, uint16 sceneId);
|
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
AnimObject *objectRemoveQueue(AnimObject *queue, AnimObject *rem);
|
|
|
|
AnimObject *objectAddHead(AnimObject *queue, AnimObject *head);
|
|
|
|
AnimObject *objectQueue(AnimObject *queue, AnimObject *add);
|
2005-11-10 14:08:50 +00:00
|
|
|
AnimObject *_animStates;
|
2005-12-08 17:19:18 +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();
|
2005-10-18 19:59:51 +00:00
|
|
|
void seq_introMalcolmTree();
|
2005-09-08 19:09:52 +00:00
|
|
|
void seq_introKallakWriting();
|
2005-10-18 19:59:51 +00:00
|
|
|
void seq_introKallakMalcolm();
|
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);
|
2005-11-10 14:08:50 +00:00
|
|
|
|
2005-10-18 19:59:51 +00:00
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
static OpcodeProc _opcodeTable[];
|
|
|
|
static const int _opcodeTableSize;
|
|
|
|
|
2005-10-18 19:59:51 +00:00
|
|
|
enum {
|
|
|
|
RES_ALL = 0,
|
2005-10-29 18:37:40 +00:00
|
|
|
RES_INTRO = (1 << 0),
|
|
|
|
RES_INGAME = (1 << 1)
|
2005-10-18 19:59:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void res_loadResources(int type = RES_ALL);
|
|
|
|
void res_unloadResources(int type = RES_ALL);
|
|
|
|
void res_loadLangTable(const char *filename, PAKFile *res, byte ***loadTo, int *size, bool nativ);
|
|
|
|
void res_loadTable(const byte *src, byte ***loadTo, int *size);
|
2005-10-29 18:37:40 +00:00
|
|
|
void res_loadRoomTable(const byte *src, Room **loadTo, int *size);
|
|
|
|
void res_loadShapeTable(const byte *src, Shape **loadTo, int *size);
|
|
|
|
|
2005-10-03 20:21:18 +00:00
|
|
|
void delay(uint32 millis);
|
|
|
|
void loadPalette(const char *filename, uint8 *palData);
|
2005-10-22 00:24:07 +00:00
|
|
|
void loadMouseShapes();
|
2005-10-29 18:37:40 +00:00
|
|
|
void loadCharacterShapes();
|
|
|
|
void loadSpecialEffectShapes();
|
|
|
|
void loadItems();
|
|
|
|
void loadMainScreen();
|
|
|
|
void setCharactersInDefaultScene();
|
|
|
|
void resetBrandonPosionFlags();
|
|
|
|
void initAnimStateList();
|
2005-11-11 22:17:06 +00:00
|
|
|
|
2005-11-18 23:55:31 +00:00
|
|
|
void setTimer19();
|
2005-11-11 22:17:06 +00:00
|
|
|
void setupTimers();
|
|
|
|
void timerUpdateHeadAnims(int timerNum);
|
|
|
|
void timerSetFlags1(int timerNum);
|
|
|
|
void timerSetFlags2(int timerNum);
|
|
|
|
void timerCheckAnimFlag1(int timerNum);
|
|
|
|
void timerCheckAnimFlag2(int timerNum);
|
|
|
|
void checkSpecialAnimFlags();
|
|
|
|
void timerRedrawAmulet(int timerNum);
|
|
|
|
void drawAmulet();
|
2005-10-03 20:21:18 +00:00
|
|
|
|
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-10-29 18:37:40 +00:00
|
|
|
uint8 _flagsTable[53];
|
|
|
|
uint8 *_shapes[377];
|
2005-10-03 20:21:18 +00:00
|
|
|
uint16 _gameSpeed;
|
2005-11-11 22:17:06 +00:00
|
|
|
uint16 _tickLength;
|
2005-10-13 21:12:47 +00:00
|
|
|
uint32 _features;
|
2005-10-22 00:24:07 +00:00
|
|
|
int _mouseX, _mouseY;
|
2005-11-18 23:55:31 +00:00
|
|
|
int _itemInHand;
|
|
|
|
int _mouseState;
|
|
|
|
bool _handleInput;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
WSAMovieV1 *_wsaObjects[10];
|
|
|
|
uint16 _entranceMouseCursorTracks[8];
|
|
|
|
uint16 _walkBlockNorth;
|
|
|
|
uint16 _walkBlockEast;
|
|
|
|
uint16 _walkBlockSouth;
|
|
|
|
uint16 _walkBlockWest;
|
|
|
|
|
|
|
|
int32 _scaleMode;
|
2005-11-01 14:19:50 +00:00
|
|
|
int16 _scaleTable[145];
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
Rect _noDropRects[11];
|
|
|
|
|
|
|
|
uint16 _birthstoneGemTable[4];
|
|
|
|
uint8 _idolGemsTable[3];
|
|
|
|
|
2005-11-18 23:55:31 +00:00
|
|
|
int16 _marbleVaseItem;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
uint16 _brandonStatusBit;
|
|
|
|
uint8 _unkBrandonPoisonFlags[256]; // this seem not to be posion flags, it is used for drawing once
|
|
|
|
int _brandonPosX;
|
|
|
|
int _brandonPosY;
|
|
|
|
int16 _brandonScaleX;
|
|
|
|
int16 _brandonScaleY;
|
|
|
|
int _brandonDrawFrame;
|
2005-11-10 14:08:50 +00:00
|
|
|
|
|
|
|
uint16 _currentChatPartnerBackupFrame;
|
|
|
|
uint16 _currentCharAnimFrame;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
int8 *_sceneAnimTable[50];
|
|
|
|
|
|
|
|
Item _itemTable[145];
|
2005-12-08 17:19:18 +00:00
|
|
|
int _lastProcessedItem;
|
|
|
|
int _lastProcessedItemHeight;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
2005-11-13 19:35:01 +00:00
|
|
|
int16 *_exitListPtr;
|
|
|
|
int16 _exitList[11];
|
2005-10-29 18:37:40 +00:00
|
|
|
SceneExits _sceneExits;
|
2005-10-03 20:21:18 +00:00
|
|
|
uint16 _currentRoom;
|
2005-10-29 18:37:40 +00:00
|
|
|
uint8 *_maskBuffer;
|
|
|
|
|
2005-11-09 22:26:12 +00:00
|
|
|
int _sceneChangeState;
|
|
|
|
int _loopFlag2;
|
|
|
|
|
2005-11-01 14:19:50 +00:00
|
|
|
int _pathfinderFlag;
|
|
|
|
int _pathfinderFlag2;
|
2005-10-29 18:37:40 +00:00
|
|
|
int _lastFindWayRet;
|
|
|
|
int *_movFacingTable;
|
|
|
|
|
2005-11-10 18:58:44 +00:00
|
|
|
int8 _charSayUnk1;
|
2005-11-10 14:08:50 +00:00
|
|
|
int8 _charSayUnk2;
|
2005-11-10 18:58:44 +00:00
|
|
|
int8 _charSayUnk3;
|
|
|
|
int8 _charSayUnk4;
|
2005-11-10 14:08:50 +00:00
|
|
|
|
|
|
|
uint8 _configTalkspeed;
|
2005-10-29 18:37:40 +00:00
|
|
|
AnimObject *_objectQueue;
|
|
|
|
AnimObject *_charactersAnimState;
|
2005-10-30 19:58:51 +00:00
|
|
|
AnimObject *_animItems;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
int _curMusicTheme;
|
|
|
|
int _newMusicTheme;
|
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;
|
2005-10-29 18:37:40 +00:00
|
|
|
ScriptHelper *_scriptInterpreter;
|
|
|
|
|
|
|
|
ScriptState *_scriptMain;
|
|
|
|
ScriptData *_npcScriptData;
|
|
|
|
|
|
|
|
ScriptState *_scriptClick; // TODO: rename to a better name
|
|
|
|
ScriptData *_scriptClickData;
|
|
|
|
|
|
|
|
Character *_characterList;
|
2005-10-03 20:21:18 +00:00
|
|
|
|
2005-10-18 19:59:51 +00:00
|
|
|
uint8 *_seq_Forest;
|
|
|
|
uint8 *_seq_KallakWriting;
|
|
|
|
uint8 *_seq_KyrandiaLogo;
|
|
|
|
uint8 *_seq_KallakMalcolm;
|
|
|
|
uint8 *_seq_MalcolmTree;
|
|
|
|
uint8 *_seq_WestwoodLogo;
|
|
|
|
uint8 *_seq_Demo1;
|
|
|
|
uint8 *_seq_Demo2;
|
|
|
|
uint8 *_seq_Demo3;
|
|
|
|
uint8 *_seq_Demo4;
|
|
|
|
|
|
|
|
char **_seq_WSATable;
|
|
|
|
char **_seq_CPSTable;
|
|
|
|
char **_seq_COLTable;
|
|
|
|
char **_seq_textsTable;
|
|
|
|
|
|
|
|
int _seq_WSATable_Size;
|
|
|
|
int _seq_CPSTable_Size;
|
|
|
|
int _seq_COLTable_Size;
|
|
|
|
int _seq_textsTable_Size;
|
2005-10-12 19:15:32 +00:00
|
|
|
|
2005-10-29 18:37:40 +00:00
|
|
|
char **_characterImageTable;
|
|
|
|
int _characterImageTableSize;
|
|
|
|
|
|
|
|
Shape *_defaultShapeTable;
|
|
|
|
int _defaultShapeTableSize;
|
|
|
|
|
|
|
|
Room *_roomTable;
|
|
|
|
int _roomTableSize;
|
|
|
|
char **_roomFilenameTable;
|
|
|
|
int _roomFilenameTableSize;
|
2005-11-11 22:17:06 +00:00
|
|
|
|
|
|
|
Timer _timers[34];
|
|
|
|
uint32 _timerNextRun;
|
2005-09-11 14:35:34 +00:00
|
|
|
static const char *_xmidiFiles[];
|
|
|
|
static const int _xmidiFilesCount;
|
2005-10-29 18:37:40 +00:00
|
|
|
|
|
|
|
static const int8 _charXPosTable[];
|
2005-11-01 14:19:50 +00:00
|
|
|
static const int8 _addXPosTable[];
|
2005-10-29 18:37:40 +00:00
|
|
|
static const int8 _charYPosTable[];
|
2005-11-01 14:19:50 +00:00
|
|
|
static const int8 _addYPosTable[];
|
2005-11-11 22:17:06 +00:00
|
|
|
|
|
|
|
static const uint16 _amuletX[];
|
|
|
|
static const uint16 _amuletY[];
|
|
|
|
|
2004-04-09 12:36:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Kyra
|
|
|
|
|
|
|
|
#endif
|