2007-05-30 21:56:52 +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.
|
2007-04-15 13:44:49 +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
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2008-05-12 04:17:51 +00:00
|
|
|
#ifndef KYRA_KYRA_MR_H
|
|
|
|
#define KYRA_KYRA_MR_H
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
#include "kyra/kyra_v2.h"
|
|
|
|
#include "kyra/screen_mr.h"
|
2008-04-16 20:28:27 +00:00
|
|
|
#include "kyra/script.h"
|
2008-05-04 15:56:28 +00:00
|
|
|
#include "kyra/gui_mr.h"
|
2008-04-16 23:09:07 +00:00
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
#include "common/hashmap.h"
|
2008-04-16 23:09:07 +00:00
|
|
|
#include "common/list.h"
|
2007-04-15 13:44:49 +00:00
|
|
|
|
|
|
|
namespace Kyra {
|
|
|
|
|
2007-07-29 16:31:29 +00:00
|
|
|
class SoundDigital;
|
2008-05-02 14:46:30 +00:00
|
|
|
class Screen_MR;
|
2008-04-12 23:17:21 +00:00
|
|
|
class MainMenu;
|
2008-05-11 22:32:37 +00:00
|
|
|
class WSAMovie_v2;
|
2008-05-02 14:46:30 +00:00
|
|
|
class TextDisplayer_MR;
|
2008-04-16 23:09:07 +00:00
|
|
|
struct Button;
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
class KyraEngine_MR : public KyraEngine_v2 {
|
|
|
|
friend class TextDisplayer_MR;
|
2008-05-04 15:18:46 +00:00
|
|
|
friend class GUI_MR;
|
2007-04-15 13:44:49 +00:00
|
|
|
public:
|
2008-05-02 14:46:30 +00:00
|
|
|
KyraEngine_MR(OSystem *system, const GameFlags &flags);
|
|
|
|
~KyraEngine_MR();
|
2007-07-29 16:31:29 +00:00
|
|
|
|
2009-10-04 17:54:08 +00:00
|
|
|
// Regarding pausing of the engine:
|
2008-05-23 13:37:56 +00:00
|
|
|
// Idle animation time, item animations and album animations should be taken
|
|
|
|
// care of, but since those would just produce minor glitches it's not that
|
|
|
|
// important.
|
|
|
|
|
2008-04-12 23:17:21 +00:00
|
|
|
Screen *screen() { return _screen; }
|
2008-05-02 14:46:30 +00:00
|
|
|
Screen_v2 *screen_v2() const { return _screen; }
|
2008-12-16 17:40:34 +00:00
|
|
|
GUI *gui() const { return _gui; }
|
2007-04-15 13:44:49 +00:00
|
|
|
SoundDigital *soundDigital() { return _soundDigital; }
|
2008-04-19 22:22:00 +00:00
|
|
|
int language() const { return _lang; }
|
2008-05-11 17:50:13 +00:00
|
|
|
bool heliumMode() const { return _configHelium; }
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-11-06 17:05:54 +00:00
|
|
|
Common::Error go();
|
2007-04-15 13:44:49 +00:00
|
|
|
|
|
|
|
void playVQA(const char *name);
|
2007-09-23 22:43:46 +00:00
|
|
|
|
2008-05-05 17:12:48 +00:00
|
|
|
private:
|
2008-05-03 19:32:45 +00:00
|
|
|
static const EngineDesc _mrEngineDesc;
|
|
|
|
|
2008-05-05 17:12:48 +00:00
|
|
|
// config
|
|
|
|
bool _configStudio;
|
|
|
|
bool _configSkip;
|
2008-05-11 17:50:13 +00:00
|
|
|
bool _configHelium;
|
2010-07-23 00:39:23 +00:00
|
|
|
int _configVQAQuality;
|
2008-05-05 17:12:48 +00:00
|
|
|
|
|
|
|
void registerDefaultSettings();
|
|
|
|
void writeSettings();
|
|
|
|
void readSettings();
|
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
void initStaticResource();
|
|
|
|
|
2008-05-02 14:46:30 +00:00
|
|
|
// --
|
|
|
|
Screen_MR *_screen;
|
2008-04-16 23:09:07 +00:00
|
|
|
SoundDigital *_soundDigital;
|
|
|
|
|
2008-11-06 17:05:54 +00:00
|
|
|
Common::Error init();
|
2007-04-15 13:44:49 +00:00
|
|
|
|
|
|
|
void preinit();
|
2008-04-14 20:20:51 +00:00
|
|
|
void startup();
|
|
|
|
void runStartupScript(int script, int unk1);
|
|
|
|
|
|
|
|
void setupOpcodeTable();
|
2007-05-05 12:18:02 +00:00
|
|
|
|
2008-05-05 17:12:48 +00:00
|
|
|
// input
|
|
|
|
bool skipFlag() const;
|
|
|
|
void resetSkipFlag(bool removeEvent = true);
|
|
|
|
|
2008-04-16 23:09:07 +00:00
|
|
|
// run
|
2008-05-05 16:05:56 +00:00
|
|
|
bool _menuDirectlyToLoad;
|
|
|
|
|
2008-04-16 23:09:07 +00:00
|
|
|
void runLoop();
|
|
|
|
void handleInput(int x, int y);
|
2008-04-20 02:11:10 +00:00
|
|
|
int inputSceneChange(int x, int y, int unk1, int unk2);
|
2008-04-16 23:09:07 +00:00
|
|
|
|
|
|
|
void update();
|
2008-04-19 22:22:00 +00:00
|
|
|
void updateWithText();
|
2008-04-17 15:29:10 +00:00
|
|
|
void updateMouse();
|
2008-04-16 23:09:07 +00:00
|
|
|
|
2007-04-15 13:44:49 +00:00
|
|
|
// sound specific
|
|
|
|
private:
|
|
|
|
void playMenuAudioFile();
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2007-04-15 13:44:49 +00:00
|
|
|
int _musicSoundChannel;
|
2008-04-16 20:28:27 +00:00
|
|
|
int _fadeOutMusicChannel;
|
2007-04-15 13:44:49 +00:00
|
|
|
const char *_menuAudioFile;
|
2008-01-27 19:47:41 +00:00
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
const char *const *_soundList;
|
|
|
|
int _soundListSize;
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-04-29 14:08:08 +00:00
|
|
|
void snd_playWanderScoreViaMap(int track, int force);
|
2007-04-15 13:44:49 +00:00
|
|
|
void stopMusicTrack();
|
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
void fadeOutMusic(int ticks);
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-04-29 14:08:08 +00:00
|
|
|
void snd_playSoundEffect(int item, int volume);
|
2008-04-17 17:46:39 +00:00
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
const uint8 *_sfxFileMap;
|
|
|
|
int _sfxFileMapSize;
|
|
|
|
const char *const *_sfxFileList;
|
|
|
|
int _sfxFileListSize;
|
2008-04-17 17:46:39 +00:00
|
|
|
|
2008-04-19 22:22:00 +00:00
|
|
|
int _voiceSoundChannel;
|
|
|
|
|
|
|
|
void playVoice(int high, int low);
|
|
|
|
void snd_playVoiceFile(int file);
|
|
|
|
bool snd_voiceIsPlaying();
|
|
|
|
void snd_stopVoice();
|
|
|
|
|
|
|
|
int _curStudioSFX;
|
2008-04-20 00:32:39 +00:00
|
|
|
void playStudioSFX(const char *str);
|
2008-04-12 23:17:21 +00:00
|
|
|
|
2008-04-26 21:08:47 +00:00
|
|
|
// gui
|
2008-05-04 15:18:46 +00:00
|
|
|
GUI_MR *_gui;
|
2008-04-26 21:08:47 +00:00
|
|
|
|
|
|
|
Button *_mainButtonData;
|
|
|
|
Button *_mainButtonList;
|
|
|
|
bool _mainButtonListInitialized;
|
|
|
|
void initMainButtonList(bool disable);
|
|
|
|
|
|
|
|
bool _enableInventory;
|
|
|
|
int buttonInventory(Button *button);
|
2008-04-26 21:52:15 +00:00
|
|
|
int buttonMoodChange(Button *button);
|
|
|
|
int buttonShowScore(Button *button);
|
|
|
|
int buttonJesterStaff(Button *button);
|
2008-04-26 21:08:47 +00:00
|
|
|
|
2008-05-05 16:05:56 +00:00
|
|
|
void loadButtonShapes();
|
|
|
|
int callbackButton1(Button *button);
|
|
|
|
int callbackButton2(Button *button);
|
|
|
|
int callbackButton3(Button *button);
|
|
|
|
|
2008-04-26 21:08:47 +00:00
|
|
|
// -> main menu
|
2008-04-12 23:17:21 +00:00
|
|
|
void initMainMenu();
|
|
|
|
void uninitMainMenu();
|
|
|
|
|
2011-01-29 18:40:04 +00:00
|
|
|
MainMenu *_menu;
|
2008-05-11 22:32:37 +00:00
|
|
|
WSAMovie_v2 *_menuAnim;
|
2008-04-12 23:17:21 +00:00
|
|
|
|
|
|
|
// timer
|
2008-04-17 14:26:50 +00:00
|
|
|
void setupTimers();
|
|
|
|
|
|
|
|
void setWalkspeed(uint8);
|
|
|
|
void setCommandLineRestoreTimer(int secs);
|
|
|
|
|
|
|
|
void timerRestoreCommandLine(int arg);
|
|
|
|
void timerRunSceneScript7(int arg);
|
|
|
|
void timerFleaDeath(int arg);
|
2008-04-12 23:17:21 +00:00
|
|
|
|
2008-04-23 19:24:02 +00:00
|
|
|
uint32 _nextIdleAnim;
|
|
|
|
void setNextIdleAnimTimer();
|
|
|
|
|
2008-04-12 23:17:21 +00:00
|
|
|
// pathfinder
|
2008-04-17 15:39:34 +00:00
|
|
|
bool lineIsPassable(int x, int y);
|
2007-04-15 13:44:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// main menu
|
2008-07-05 07:47:27 +00:00
|
|
|
const char * const *_mainMenuStrings;
|
2008-05-12 13:35:58 +00:00
|
|
|
int _mainMenuStringsSize;
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-07-05 07:47:27 +00:00
|
|
|
static const char * const _mainMenuSpanishFan[];
|
2008-07-05 08:20:10 +00:00
|
|
|
static const char * const _mainMenuItalianFan[];
|
2008-07-05 07:47:27 +00:00
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// animator
|
2008-05-02 14:46:30 +00:00
|
|
|
uint8 *_gamePlayBuffer;
|
|
|
|
void restorePage3();
|
2008-04-14 20:20:51 +00:00
|
|
|
|
|
|
|
void clearAnimObjects();
|
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
void animSetupPaletteEntry(AnimObj *anim);
|
|
|
|
|
|
|
|
void drawAnimObjects();
|
|
|
|
void drawSceneAnimObject(AnimObj *obj, int x, int y, int drawLayer);
|
|
|
|
void drawCharacterAnimObject(AnimObj *obj, int x, int y, int drawLayer);
|
|
|
|
|
|
|
|
void refreshAnimObjects(int force);
|
2008-04-19 22:22:00 +00:00
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
bool _loadingState;
|
2008-05-10 14:12:48 +00:00
|
|
|
void updateItemAnimations();
|
2008-04-16 20:28:27 +00:00
|
|
|
void updateCharacterAnim(int charId);
|
|
|
|
|
2008-04-17 13:38:44 +00:00
|
|
|
void updateSceneAnim(int anim, int newFrame);
|
2008-04-20 00:11:42 +00:00
|
|
|
void setupSceneAnimObject(int anim, uint16 flags, int x, int y, int x2, int y2, int w, int h, int unk10, int specialSize, int unk14, int shape, const char *filename);
|
2008-04-17 13:38:44 +00:00
|
|
|
void removeSceneAnimObject(int anim, int refresh);
|
|
|
|
|
2008-04-19 22:22:00 +00:00
|
|
|
int _charBackUpWidth2, _charBackUpHeight2;
|
|
|
|
int _charBackUpWidth, _charBackUpHeight;
|
|
|
|
|
|
|
|
void setCharacterAnimDim(int w, int h);
|
|
|
|
void resetCharacterAnimDim();
|
|
|
|
|
2008-04-23 19:24:02 +00:00
|
|
|
bool _nextIdleType;
|
|
|
|
void showIdleAnim();
|
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
const ItemAnimData_v2 *_itemAnimData;
|
2008-05-10 14:12:48 +00:00
|
|
|
ActiveItemAnim _activeItemAnim[10];
|
|
|
|
int _nextAnimItem;
|
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// interface
|
|
|
|
uint8 *_interface;
|
|
|
|
uint8 *_interfaceCommandLine;
|
|
|
|
|
|
|
|
void loadInterfaceShapes();
|
|
|
|
void loadInterface();
|
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
void showMessage(const char *string, uint8 c0, uint8 c1);
|
2008-04-24 13:05:14 +00:00
|
|
|
void showMessageFromCCode(int string, uint8 c0, int);
|
2010-10-22 02:10:22 +00:00
|
|
|
void updateItemCommand(Item item, int str, uint8 c0);
|
2008-04-24 13:05:14 +00:00
|
|
|
|
2008-04-17 14:26:50 +00:00
|
|
|
void updateCommandLine();
|
2008-04-16 20:28:27 +00:00
|
|
|
void restoreCommandLine();
|
2008-04-23 20:50:31 +00:00
|
|
|
void updateCLState();
|
2008-04-16 20:28:27 +00:00
|
|
|
|
|
|
|
int _commandLineY;
|
|
|
|
const char *_shownMessage;
|
|
|
|
bool _restoreCommandLine;
|
|
|
|
bool _inventoryState;
|
2008-04-23 20:50:31 +00:00
|
|
|
int _inventoryScrollSpeed;
|
|
|
|
|
|
|
|
void showInventory();
|
|
|
|
void hideInventory();
|
|
|
|
|
2008-04-23 21:07:58 +00:00
|
|
|
void drawMalcolmsMoodText();
|
|
|
|
void drawMalcolmsMoodPointer(int frame, int page);
|
2008-04-23 20:50:31 +00:00
|
|
|
void drawJestersStaff(int type, int page);
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-04-24 21:11:55 +00:00
|
|
|
void drawScore(int page, int x, int y);
|
|
|
|
void drawScoreCounting(int oldScore, int newScore, int drawOld, const int x);
|
|
|
|
int getScoreX(const char *str);
|
2008-04-23 20:50:31 +00:00
|
|
|
|
|
|
|
static const uint8 _inventoryX[];
|
|
|
|
static const uint8 _inventoryY[];
|
|
|
|
void redrawInventory(int page);
|
|
|
|
void clearInventorySlot(int slot, int page);
|
2010-10-22 02:10:22 +00:00
|
|
|
void drawInventorySlot(int page, Item item, int slot);
|
2008-04-16 20:28:27 +00:00
|
|
|
|
2008-05-11 22:32:37 +00:00
|
|
|
WSAMovie_v2 *_invWsa;
|
2008-04-23 21:07:58 +00:00
|
|
|
int _invWsaFrame;
|
|
|
|
|
2008-04-17 13:38:44 +00:00
|
|
|
// localization
|
2007-04-15 13:44:49 +00:00
|
|
|
uint8 *_scoreFile;
|
|
|
|
uint8 *_cCodeFile;
|
2008-04-14 20:20:51 +00:00
|
|
|
uint8 *_scenesFile;
|
|
|
|
uint8 *_itemFile;
|
2008-05-05 16:05:56 +00:00
|
|
|
uint8 *_optionsFile;
|
2008-04-14 20:20:51 +00:00
|
|
|
uint8 *_actorFile;
|
|
|
|
uint32 _actorFileSize;
|
2008-04-16 20:28:27 +00:00
|
|
|
uint8 *_sceneStrings;
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-04-17 13:38:44 +00:00
|
|
|
uint8 *getTableEntry(uint8 *buffer, int id);
|
2008-04-22 22:36:09 +00:00
|
|
|
void getTableEntry(Common::SeekableReadStream *stream, int id, char *dst);
|
2008-04-17 13:38:44 +00:00
|
|
|
|
2007-04-15 13:44:49 +00:00
|
|
|
// items
|
2008-04-20 12:34:16 +00:00
|
|
|
int8 *_itemBuffer1;
|
|
|
|
int8 *_itemBuffer2;
|
2008-04-17 15:29:10 +00:00
|
|
|
|
2010-10-22 02:10:22 +00:00
|
|
|
static const Item _trashItemList[];
|
2008-04-23 22:53:19 +00:00
|
|
|
void removeTrashItems();
|
2008-04-17 15:29:10 +00:00
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
void initItems();
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-04-17 15:29:10 +00:00
|
|
|
int checkItemCollision(int x, int y);
|
|
|
|
|
2010-10-22 02:10:22 +00:00
|
|
|
bool dropItem(int unk1, Item item, int x, int y, int unk2);
|
|
|
|
bool processItemDrop(uint16 sceneId, Item item, int x, int y, int unk1, int unk2);
|
|
|
|
void itemDropDown(int startX, int startY, int dstX, int dstY, int itemSlot, Item item, int remove);
|
2008-04-23 22:53:19 +00:00
|
|
|
void exchangeMouseItem(int itemPos, int runScript);
|
2008-04-24 13:14:39 +00:00
|
|
|
bool pickUpItem(int x, int y, int runScript);
|
2008-04-23 22:53:19 +00:00
|
|
|
|
|
|
|
bool isDropable(int x, int y);
|
2008-04-22 18:08:56 +00:00
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
const uint8 *_itemMagicTable;
|
2010-10-22 02:10:22 +00:00
|
|
|
bool itemListMagic(Item handItem, int itemSlot);
|
|
|
|
bool itemInventoryMagic(Item handItem, int invSlot);
|
2008-04-24 13:05:14 +00:00
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
const uint8 *_itemStringMap;
|
|
|
|
int _itemStringMapSize;
|
2008-04-24 13:27:05 +00:00
|
|
|
static const uint8 _itemStringPickUp[];
|
|
|
|
static const uint8 _itemStringDrop[];
|
|
|
|
static const uint8 _itemStringInv[];
|
|
|
|
|
|
|
|
int getItemCommandStringPickUp(uint16 item);
|
|
|
|
int getItemCommandStringDrop(uint16 item);
|
|
|
|
int getItemCommandStringInv(uint16 item);
|
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
// -> hand item
|
2008-04-17 15:29:10 +00:00
|
|
|
void setItemMouseCursor();
|
2010-10-22 02:11:50 +00:00
|
|
|
void setMouseCursor(Item item);
|
2008-04-16 20:28:27 +00:00
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// shapes
|
|
|
|
void initMouseShapes();
|
|
|
|
|
2008-05-02 15:21:51 +00:00
|
|
|
void loadCharacterShapes(int newShapes);
|
2008-04-14 20:20:51 +00:00
|
|
|
void updateMalcolmShapes();
|
|
|
|
|
|
|
|
int _malcolmShapeXOffset, _malcolmShapeYOffset;
|
|
|
|
|
|
|
|
struct ShapeDesc {
|
|
|
|
uint8 width, height;
|
|
|
|
int8 xOffset, yOffset;
|
|
|
|
};
|
|
|
|
static const ShapeDesc _shapeDescs[];
|
|
|
|
static const int _shapeDescsSize;
|
|
|
|
|
|
|
|
// scene animation
|
|
|
|
uint8 *_sceneShapes[20];
|
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
void freeSceneShapes();
|
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// voice
|
|
|
|
int _currentTalkFile;
|
|
|
|
void openTalkFile(int file);
|
|
|
|
|
|
|
|
// scene
|
2008-04-16 20:28:27 +00:00
|
|
|
bool _noScriptEnter;
|
|
|
|
void enterNewScene(uint16 scene, int facing, int unk1, int unk2, int unk3);
|
|
|
|
void enterNewSceneUnk1(int facing, int unk1, int unk2);
|
|
|
|
void enterNewSceneUnk2(int unk1);
|
|
|
|
int _enterNewSceneLock;
|
|
|
|
|
|
|
|
void unloadScene();
|
|
|
|
|
|
|
|
void loadScenePal();
|
|
|
|
void loadSceneMsc();
|
|
|
|
void initSceneScript(int unk1);
|
|
|
|
void initSceneAnims(int unk1);
|
|
|
|
void initSceneScreen(int unk1);
|
|
|
|
|
2008-04-20 02:11:10 +00:00
|
|
|
int runSceneScript1(int x, int y);
|
|
|
|
int runSceneScript2();
|
2008-04-16 20:28:27 +00:00
|
|
|
bool _noStartupChat;
|
|
|
|
void runSceneScript4(int unk1);
|
|
|
|
void runSceneScript8();
|
|
|
|
|
2008-04-17 15:29:10 +00:00
|
|
|
int _sceneMinX, _sceneMaxX;
|
2008-04-16 20:28:27 +00:00
|
|
|
int _maskPageMinY, _maskPageMaxY;
|
|
|
|
|
2008-04-20 02:11:10 +00:00
|
|
|
int trySceneChange(int *moveTable, int unk1, int unk2);
|
|
|
|
int checkSceneChange();
|
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
int8 _sceneDatPalette[45];
|
|
|
|
int8 _sceneDatLayerTable[15];
|
2008-04-20 13:44:44 +00:00
|
|
|
struct SceneShapeDesc {
|
|
|
|
// the original saves those variables, we don't, since
|
|
|
|
// they are just needed on scene load
|
|
|
|
/*int x, y;
|
|
|
|
int w, h;*/
|
|
|
|
int drawX, drawY;
|
|
|
|
};
|
|
|
|
SceneShapeDesc _sceneShapeDescs[20];
|
2008-04-16 20:28:27 +00:00
|
|
|
|
|
|
|
int getDrawLayer(int x, int y);
|
|
|
|
|
|
|
|
int getScale(int x, int y);
|
|
|
|
int _scaleTable[15];
|
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// character
|
2008-05-02 15:39:51 +00:00
|
|
|
int getCharacterWalkspeed() const;
|
2011-04-10 22:31:24 +00:00
|
|
|
void updateCharAnimFrame(int *table);
|
2008-04-16 20:28:27 +00:00
|
|
|
int8 _characterAnimTable[2];
|
|
|
|
static const uint8 _characterFrameTable[];
|
|
|
|
|
|
|
|
void updateCharPal(int unk1);
|
|
|
|
int _lastCharPalLayer;
|
|
|
|
bool _charPalUpdate;
|
2008-04-14 20:20:51 +00:00
|
|
|
|
2008-04-20 02:11:10 +00:00
|
|
|
bool checkCharCollision(int x, int y);
|
2008-04-19 22:22:00 +00:00
|
|
|
|
2008-04-23 21:07:58 +00:00
|
|
|
int _malcolmsMood;
|
2008-04-23 16:06:33 +00:00
|
|
|
|
2008-04-23 22:53:19 +00:00
|
|
|
void makeCharFacingMouse();
|
|
|
|
|
2008-04-26 22:13:19 +00:00
|
|
|
int findFreeInventorySlot();
|
|
|
|
|
2008-04-19 22:22:00 +00:00
|
|
|
// talk object
|
|
|
|
struct TalkObject {
|
|
|
|
char filename[13];
|
2008-04-22 22:36:09 +00:00
|
|
|
int8 sceneAnim;
|
|
|
|
int8 sceneScript;
|
2008-04-19 22:22:00 +00:00
|
|
|
int16 x, y;
|
|
|
|
uint8 color;
|
2008-04-23 19:24:02 +00:00
|
|
|
uint8 sceneId;
|
2008-04-19 22:22:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
TalkObject *_talkObjectList;
|
|
|
|
|
2008-04-23 19:24:02 +00:00
|
|
|
bool talkObjectsInCurScene();
|
|
|
|
|
2008-04-19 22:22:00 +00:00
|
|
|
// chat
|
|
|
|
int chatGetType(const char *text);
|
|
|
|
int chatCalcDuration(const char *text);
|
|
|
|
|
|
|
|
void objectChat(const char *text, int object, int vocHigh, int vocLow);
|
|
|
|
void objectChatInit(const char *text, int object, int vocHigh, int vocLow);
|
|
|
|
void objectChatPrintText(const char *text, int object);
|
|
|
|
void objectChatProcess(const char *script);
|
|
|
|
void objectChatWaitToFinish();
|
|
|
|
|
2008-04-20 00:30:39 +00:00
|
|
|
void badConscienceChat(const char *str, int vocHigh, int vocLow);
|
|
|
|
void badConscienceChatWaitToFinish();
|
|
|
|
|
2008-04-28 20:45:22 +00:00
|
|
|
void goodConscienceChat(const char *str, int vocHigh, int vocLow);
|
|
|
|
void goodConscienceChatWaitToFinish();
|
|
|
|
|
2008-05-11 15:24:25 +00:00
|
|
|
bool _albumChatActive;
|
|
|
|
void albumChat(const char *str, int vocHigh, int vocLow);
|
|
|
|
void albumChatInit(const char *str, int object, int vocHigh, int vocLow);
|
|
|
|
void albumChatWaitToFinish();
|
|
|
|
|
2008-04-22 22:36:09 +00:00
|
|
|
void malcolmSceneStartupChat();
|
|
|
|
|
2008-04-27 00:38:01 +00:00
|
|
|
byte _newSceneDlgState[40];
|
2008-04-22 22:36:09 +00:00
|
|
|
int8 _conversationState[30][30];
|
|
|
|
bool _chatAltFlag;
|
2008-05-04 13:07:13 +00:00
|
|
|
void setDlgIndex(int index);
|
2008-04-25 17:59:38 +00:00
|
|
|
void updateDlgIndex();
|
2008-04-22 22:36:09 +00:00
|
|
|
|
|
|
|
Common::SeekableReadStream *_cnvFile;
|
|
|
|
Common::SeekableReadStream *_dlgBuffer;
|
|
|
|
int _curDlgChapter, _curDlgIndex, _curDlgLang;
|
|
|
|
void updateDlgBuffer();
|
|
|
|
void loadDlgHeader(int &vocHighBase, int &vocHighIndex, int &index1, int &index2);
|
|
|
|
|
|
|
|
static const uint8 _vocHighTable[];
|
|
|
|
bool _isStartupDialog;
|
|
|
|
void processDialog(int vocHighIndex, int vocHighBase, int funcNum);
|
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
EMCData _dialogScriptData;
|
|
|
|
EMCState _dialogScriptState;
|
2008-04-22 22:36:09 +00:00
|
|
|
int _dialogSceneAnim;
|
|
|
|
int _dialogSceneScript;
|
|
|
|
int _dialogScriptFuncStart, _dialogScriptFuncProc, _dialogScriptFuncEnd;
|
|
|
|
|
|
|
|
void dialogStartScript(int object, int funcNum);
|
|
|
|
void dialogEndScript(int object);
|
|
|
|
|
|
|
|
void npcChatSequence(const char *str, int object, int vocHigh, int vocLow);
|
|
|
|
|
|
|
|
Common::Array<const Opcode *> _opcodesDialog;
|
|
|
|
|
2008-04-29 15:12:09 +00:00
|
|
|
int o3d_updateAnim(EMCState *script);
|
|
|
|
int o3d_delay(EMCState *script);
|
2008-04-22 22:36:09 +00:00
|
|
|
|
2008-05-04 13:07:13 +00:00
|
|
|
void randomSceneChat();
|
2011-02-10 01:19:48 +00:00
|
|
|
void doDialog(int dlgIndex, int funcNum);
|
2008-04-23 14:20:34 +00:00
|
|
|
|
2008-04-20 00:11:42 +00:00
|
|
|
// conscience
|
|
|
|
bool _badConscienceShown;
|
|
|
|
int _badConscienceAnim;
|
|
|
|
bool _badConsciencePosition;
|
|
|
|
|
|
|
|
static const uint8 _badConscienceFrameTable[];
|
|
|
|
|
|
|
|
void showBadConscience();
|
|
|
|
void hideBadConscience();
|
|
|
|
|
2008-04-28 20:45:22 +00:00
|
|
|
bool _goodConscienceShown;
|
|
|
|
int _goodConscienceAnim;
|
|
|
|
bool _goodConsciencePosition;
|
|
|
|
|
|
|
|
static const uint8 _goodConscienceFrameTable[];
|
|
|
|
|
|
|
|
void showGoodConscience();
|
|
|
|
void hideGoodConscience();
|
|
|
|
|
2008-04-19 22:22:00 +00:00
|
|
|
// special script code
|
|
|
|
bool _useFrameTable;
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-05-03 19:23:45 +00:00
|
|
|
int o3a_setCharacterFrame(EMCState *script);
|
2009-07-29 14:54:27 +00:00
|
|
|
int o3a_playSoundEffect(EMCState *script);
|
2008-04-23 19:24:02 +00:00
|
|
|
|
2008-04-19 22:22:00 +00:00
|
|
|
// special shape code
|
2008-05-03 19:23:45 +00:00
|
|
|
int initAnimationShapes(uint8 *filedata);
|
|
|
|
void uninitAnimationShapes(int count, uint8 *filedata);
|
2008-04-23 19:24:02 +00:00
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// unk
|
|
|
|
uint8 *_costPalBuffer;
|
|
|
|
uint8 *_paletteOverlay;
|
2008-04-19 22:22:00 +00:00
|
|
|
bool _useActorBuffer;
|
2008-04-26 22:22:21 +00:00
|
|
|
|
2008-04-27 00:42:17 +00:00
|
|
|
int _currentChapter;
|
2008-04-26 22:22:21 +00:00
|
|
|
void changeChapter(int newChapter, int sceneId, int malcolmShapes, int facing);
|
2008-04-14 20:20:51 +00:00
|
|
|
|
2008-04-22 22:36:09 +00:00
|
|
|
static const uint8 _chapterLowestScene[];
|
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
void loadCostPal();
|
|
|
|
void loadShadowShape();
|
|
|
|
void loadExtrasShapes();
|
|
|
|
|
2008-04-22 18:08:56 +00:00
|
|
|
uint8 *_gfxBackUpRect;
|
|
|
|
void backUpGfxRect32x32(int x, int y);
|
|
|
|
void restoreGfxRect32x32(int x, int y);
|
|
|
|
|
2008-04-22 22:36:09 +00:00
|
|
|
char *_stringBuffer;
|
|
|
|
|
2008-04-24 21:11:55 +00:00
|
|
|
int _score;
|
|
|
|
int _scoreMax;
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-05-12 13:35:58 +00:00
|
|
|
const uint8 *_scoreTable;
|
|
|
|
int _scoreTableSize;
|
|
|
|
|
2008-04-24 21:11:55 +00:00
|
|
|
int8 _scoreFlagTable[26];
|
|
|
|
bool updateScore(int scoreId, int strId);
|
|
|
|
void scoreIncrease(int count, const char *str);
|
|
|
|
|
2008-04-27 12:39:16 +00:00
|
|
|
void eelScript();
|
|
|
|
|
2008-05-11 15:24:25 +00:00
|
|
|
// Album
|
|
|
|
struct Album {
|
|
|
|
uint8 *backUpPage;
|
|
|
|
uint8 *file;
|
2008-05-11 22:32:37 +00:00
|
|
|
WSAMovie_v2 *wsa;
|
2008-05-11 15:24:25 +00:00
|
|
|
uint8 *backUpRect;
|
|
|
|
|
|
|
|
struct PageMovie {
|
2008-05-11 22:32:37 +00:00
|
|
|
WSAMovie_v2 *wsa;
|
2008-05-11 15:24:25 +00:00
|
|
|
int curFrame;
|
|
|
|
int maxFrame;
|
|
|
|
uint32 timer;
|
|
|
|
};
|
|
|
|
|
|
|
|
PageMovie leftPage, rightPage;
|
|
|
|
|
|
|
|
int curPage, nextPage;
|
|
|
|
bool running;
|
|
|
|
bool isPage14;
|
|
|
|
} _album;
|
|
|
|
|
|
|
|
static const int8 _albumWSAX[];
|
|
|
|
static const int8 _albumWSAY[];
|
|
|
|
|
|
|
|
void showAlbum();
|
|
|
|
|
|
|
|
void loadAlbumPage();
|
|
|
|
void loadAlbumPageWSA();
|
|
|
|
|
|
|
|
void printAlbumPageText();
|
|
|
|
void printAlbumText(int page, const char *str, int x, int y, uint8 c0);
|
2009-01-01 15:06:43 +00:00
|
|
|
|
2008-05-11 15:24:25 +00:00
|
|
|
void processAlbum();
|
|
|
|
|
|
|
|
void albumNewPage();
|
|
|
|
void albumUpdateAnims();
|
|
|
|
void albumAnim1();
|
|
|
|
void albumAnim2();
|
|
|
|
|
|
|
|
void albumBackUpRect();
|
|
|
|
void albumRestoreRect();
|
|
|
|
void albumUpdateRect();
|
|
|
|
|
2008-05-11 15:57:50 +00:00
|
|
|
void albumSwitchPages(int oldPage, int newPage, int srcPage);
|
2008-05-11 15:24:25 +00:00
|
|
|
|
|
|
|
int albumNextPage(Button *caller);
|
|
|
|
int albumPrevPage(Button *caller);
|
|
|
|
int albumClose(Button *caller);
|
|
|
|
|
2008-04-27 00:38:01 +00:00
|
|
|
// save/load
|
2010-10-28 23:57:24 +00:00
|
|
|
Common::Error saveGameStateIntern(int slot, const char *saveName, const Graphics::Surface *thumbnail);
|
2008-11-09 13:00:40 +00:00
|
|
|
Common::Error loadGameState(int slot);
|
2008-04-27 00:38:01 +00:00
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
// opcodes
|
2008-04-29 15:12:09 +00:00
|
|
|
int o3_getMalcolmShapes(EMCState *script);
|
|
|
|
int o3_setCharacterPos(EMCState *script);
|
|
|
|
int o3_defineObject(EMCState *script);
|
|
|
|
int o3_refreshCharacter(EMCState *script);
|
|
|
|
int o3_getMalcolmsMood(EMCState *script);
|
|
|
|
int o3_getCharacterFrameFromFacing(EMCState *script);
|
|
|
|
int o3_setCharacterFacing(EMCState *script);
|
|
|
|
int o3_showSceneFileMessage(EMCState *script);
|
|
|
|
int o3_setCharacterAnimFrameFromFacing(EMCState *script);
|
|
|
|
int o3_showBadConscience(EMCState *script);
|
|
|
|
int o3_hideBadConscience(EMCState *script);
|
2008-05-11 15:24:25 +00:00
|
|
|
int o3_showAlbum(EMCState *script);
|
2008-04-29 15:12:09 +00:00
|
|
|
int o3_setInventorySlot(EMCState *script);
|
|
|
|
int o3_getInventorySlot(EMCState *script);
|
|
|
|
int o3_addItemToInventory(EMCState *script);
|
|
|
|
int o3_addItemToCurScene(EMCState *script);
|
|
|
|
int o3_objectChat(EMCState *script);
|
|
|
|
int o3_resetInventory(EMCState *script);
|
|
|
|
int o3_removeInventoryItemInstances(EMCState *script);
|
|
|
|
int o3_countInventoryItemInstances(EMCState *script);
|
|
|
|
int o3_npcChatSequence(EMCState *script);
|
|
|
|
int o3_badConscienceChat(EMCState *script);
|
|
|
|
int o3_wipeDownMouseItem(EMCState *script);
|
|
|
|
int o3_setMalcolmsMood(EMCState *script);
|
|
|
|
int o3_updateScore(EMCState *script);
|
|
|
|
int o3_makeSecondChanceSave(EMCState *script);
|
|
|
|
int o3_setSceneFilename(EMCState *script);
|
|
|
|
int o3_removeItemsFromScene(EMCState *script);
|
|
|
|
int o3_disguiseMalcolm(EMCState *script);
|
|
|
|
int o3_drawSceneShape(EMCState *script);
|
|
|
|
int o3_drawSceneShapeOnPage(EMCState *script);
|
|
|
|
int o3_checkInRect(EMCState *script);
|
|
|
|
int o3_updateConversations(EMCState *script);
|
2008-05-08 22:10:34 +00:00
|
|
|
int o3_removeItemSlot(EMCState *script);
|
2008-04-29 15:12:09 +00:00
|
|
|
int o3_setSceneDim(EMCState *script);
|
|
|
|
int o3_setSceneAnimPosAndFrame(EMCState *script);
|
|
|
|
int o3_removeItemInstances(EMCState *script);
|
|
|
|
int o3_disableInventory(EMCState *script);
|
|
|
|
int o3_enableInventory(EMCState *script);
|
|
|
|
int o3_enterNewScene(EMCState *script);
|
|
|
|
int o3_switchScene(EMCState *script);
|
|
|
|
int o3_setMalcolmPos(EMCState *script);
|
|
|
|
int o3_stopMusic(EMCState *script);
|
|
|
|
int o3_playSoundEffect(EMCState *script);
|
|
|
|
int o3_getScore(EMCState *script);
|
2008-05-05 18:50:42 +00:00
|
|
|
int o3_daggerWarning(EMCState *script);
|
2008-05-12 13:11:42 +00:00
|
|
|
int o3_blockOutWalkableRegion(EMCState *script);
|
2008-04-29 15:12:09 +00:00
|
|
|
int o3_showSceneStringsMessage(EMCState *script);
|
|
|
|
int o3_showGoodConscience(EMCState *script);
|
|
|
|
int o3_goodConscienceChat(EMCState *script);
|
|
|
|
int o3_hideGoodConscience(EMCState *script);
|
|
|
|
int o3_defineSceneAnim(EMCState *script);
|
|
|
|
int o3_updateSceneAnim(EMCState *script);
|
|
|
|
int o3_runActorScript(EMCState *script);
|
2011-02-10 01:19:48 +00:00
|
|
|
int o3_doDialog(EMCState *script);
|
2008-04-29 15:12:09 +00:00
|
|
|
int o3_setConversationState(EMCState *script);
|
|
|
|
int o3_getConversationState(EMCState *script);
|
|
|
|
int o3_changeChapter(EMCState *script);
|
|
|
|
int o3_countItemInstances(EMCState *script);
|
|
|
|
int o3_dialogStartScript(EMCState *script);
|
|
|
|
int o3_dialogEndScript(EMCState *script);
|
|
|
|
int o3_customChat(EMCState *script);
|
|
|
|
int o3_customChatFinish(EMCState *script);
|
|
|
|
int o3_setupSceneAnimObject(EMCState *script);
|
|
|
|
int o3_removeSceneAnimObject(EMCState *script);
|
|
|
|
int o3_dummy(EMCState *script);
|
2007-04-15 13:44:49 +00:00
|
|
|
|
2008-04-16 20:28:27 +00:00
|
|
|
// misc
|
2008-05-02 14:46:30 +00:00
|
|
|
TextDisplayer_MR *_text;
|
2008-05-05 16:14:45 +00:00
|
|
|
bool _wasPlayingVQA;
|
2008-04-16 20:28:27 +00:00
|
|
|
|
2007-04-15 13:44:49 +00:00
|
|
|
// resource specific
|
|
|
|
private:
|
|
|
|
static const char *_languageExtension[];
|
|
|
|
static const int _languageExtensionSize;
|
|
|
|
|
2008-04-14 20:20:51 +00:00
|
|
|
int loadLanguageFile(const char *file, uint8 *&buffer);
|
2007-04-15 13:44:49 +00:00
|
|
|
};
|
|
|
|
|
2009-10-04 21:26:33 +00:00
|
|
|
} // End of namespace Kyra
|
2007-04-15 13:44:49 +00:00
|
|
|
|
|
|
|
#endif
|
2007-04-15 16:41:20 +00:00
|
|
|
|