2009-09-03 20:59:17 +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.
|
|
|
|
*/
|
|
|
|
|
2009-09-04 20:06:19 +00:00
|
|
|
#ifndef TEENAGENT_ENGINE_H
|
|
|
|
#define TEENAGENT_ENGINE_H
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
#include "engines/engine.h"
|
2012-07-07 23:36:05 +00:00
|
|
|
|
2011-02-09 01:09:01 +00:00
|
|
|
#include "audio/audiostream.h"
|
|
|
|
#include "audio/mixer.h"
|
2012-07-07 23:36:05 +00:00
|
|
|
|
2010-03-18 15:07:11 +00:00
|
|
|
#include "common/random.h"
|
2012-07-07 23:36:05 +00:00
|
|
|
#include "common/rect.h"
|
|
|
|
#include "common/array.h"
|
2009-09-05 08:16:35 +00:00
|
|
|
|
|
|
|
struct ADGameDescription;
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2009-11-24 22:10:14 +00:00
|
|
|
/**
|
|
|
|
* This is the namespace of the TeenAgent engine.
|
|
|
|
*
|
2010-01-03 15:18:20 +00:00
|
|
|
* Status of this engine: Complete
|
2009-11-24 22:10:14 +00:00
|
|
|
*
|
2010-10-15 12:48:19 +00:00
|
|
|
* Games using this engine:
|
2010-01-03 15:18:20 +00:00
|
|
|
* - Teen Agent
|
2009-11-24 22:10:14 +00:00
|
|
|
*/
|
2009-09-03 20:59:17 +00:00
|
|
|
namespace TeenAgent {
|
|
|
|
|
|
|
|
struct Object;
|
2012-07-07 23:36:05 +00:00
|
|
|
struct UseHotspot;
|
2009-09-03 20:59:17 +00:00
|
|
|
class Scene;
|
|
|
|
class MusicPlayer;
|
2012-07-11 13:34:09 +00:00
|
|
|
class Dialog;
|
2009-11-08 19:11:57 +00:00
|
|
|
class Console;
|
2012-07-07 23:36:05 +00:00
|
|
|
class Resources;
|
|
|
|
class Inventory;
|
|
|
|
|
|
|
|
// Engine Debug Flags
|
|
|
|
enum {
|
|
|
|
kDebugActor = (1 << 0),
|
|
|
|
kDebugAnimation = (1 << 1),
|
|
|
|
kDebugCallbacks = (1 << 2),
|
|
|
|
kDebugDialog = (1 << 3),
|
|
|
|
kDebugFont = (1 << 4),
|
|
|
|
kDebugInventory = (1 << 5),
|
|
|
|
kDebugMusic = (1 << 6),
|
|
|
|
kDebugObject = (1 << 7),
|
|
|
|
kDebugPack = (1 << 8),
|
|
|
|
kDebugScene = (1 << 9),
|
|
|
|
kDebugSurface = (1 << 10)
|
|
|
|
};
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2011-05-17 09:58:34 +00:00
|
|
|
class TeenAgentEngine : public Engine {
|
2009-09-15 08:54:06 +00:00
|
|
|
public:
|
2009-09-15 20:21:18 +00:00
|
|
|
enum Action { kActionNone, kActionExamine, kActionUse };
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2009-09-15 07:41:05 +00:00
|
|
|
TeenAgentEngine(OSystem *system, const ADGameDescription *gd);
|
2011-01-31 07:44:40 +00:00
|
|
|
~TeenAgentEngine();
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
virtual Common::Error run();
|
|
|
|
virtual Common::Error loadGameState(int slot);
|
2011-06-02 12:11:38 +00:00
|
|
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
2009-09-03 20:59:17 +00:00
|
|
|
virtual bool canLoadGameStateCurrently() { return true; }
|
|
|
|
virtual bool canSaveGameStateCurrently() { return !scene_busy; }
|
|
|
|
virtual bool hasFeature(EngineFeature f) const;
|
|
|
|
|
2009-09-26 15:04:09 +00:00
|
|
|
void init();
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2009-09-03 20:59:17 +00:00
|
|
|
void examine(const Common::Point &point, Object *object);
|
|
|
|
void use(Object *object);
|
2009-11-14 11:29:37 +00:00
|
|
|
inline void cancel() { action = kActionNone; }
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
bool processCallback(uint16 addr);
|
2009-09-15 07:41:05 +00:00
|
|
|
inline Scene *getScene() { return scene; }
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2010-01-03 15:18:20 +00:00
|
|
|
bool showLogo();
|
2010-04-28 19:50:28 +00:00
|
|
|
bool showCDLogo();
|
2010-01-03 15:18:20 +00:00
|
|
|
bool showMetropolis();
|
|
|
|
int skipEvents() const;
|
2010-01-02 22:30:43 +00:00
|
|
|
|
2012-07-07 12:46:28 +00:00
|
|
|
Common::String parseMessage(uint16 addr);
|
2009-09-13 09:54:53 +00:00
|
|
|
|
2009-09-03 20:59:17 +00:00
|
|
|
//event driven:
|
2012-07-18 02:29:52 +00:00
|
|
|
void displayMessage(uint16 addr, byte color = 0xd1, uint16 x = 0, uint16 y = 0);
|
|
|
|
void displayMessage(const Common::String &str, byte color = 0xd1, uint16 x = 0, uint16 y = 0);
|
2012-07-18 01:55:38 +00:00
|
|
|
void displayAsyncMessage(uint16 addr, uint16 x, uint16 y, uint16 first_frame, uint16 last_frame, byte color = 0xd1);
|
2009-11-08 21:59:26 +00:00
|
|
|
void displayAsyncMessageInSlot(uint16 addr, byte slot, uint16 first_frame, uint16 last_frame, byte color = 0xd1);
|
2009-12-08 22:13:06 +00:00
|
|
|
void displayCredits(uint16 addr, uint16 timer = 0);
|
2012-07-17 13:15:47 +00:00
|
|
|
void displayCutsceneMessage(uint16 addr, uint16 x, uint16 y);
|
2009-09-15 08:54:06 +00:00
|
|
|
void moveTo(const Common::Point &dst, byte o, bool warp = false);
|
2009-09-05 15:04:37 +00:00
|
|
|
void moveTo(uint16 x, uint16 y, byte o, bool warp = false);
|
2009-09-15 07:41:05 +00:00
|
|
|
void moveTo(Object *obj);
|
2009-09-05 17:15:28 +00:00
|
|
|
void moveRel(int16 x, int16 y, byte o, bool warp = false);
|
2009-11-09 07:58:27 +00:00
|
|
|
void playActorAnimation(uint16 id, bool async = false, bool ignore = false);
|
2009-11-09 23:22:35 +00:00
|
|
|
void playAnimation(uint16 id, byte slot, bool async = false, bool ignore = false, bool loop = false);
|
2009-09-03 20:59:17 +00:00
|
|
|
void loadScene(byte id, const Common::Point &pos, byte o = 0);
|
|
|
|
void loadScene(byte id, uint16 x, uint16 y, byte o = 0);
|
2010-03-21 07:38:09 +00:00
|
|
|
void enableOn(bool enable = true);
|
2009-09-03 20:59:17 +00:00
|
|
|
void setOns(byte id, byte value, byte scene_id = 0);
|
|
|
|
void setLan(byte id, byte value, byte scene_id = 0);
|
2010-02-07 17:13:39 +00:00
|
|
|
void setFlag(uint16 addr, byte value);
|
2010-02-26 07:36:52 +00:00
|
|
|
byte getFlag(uint16 addr);
|
2009-09-03 20:59:17 +00:00
|
|
|
void reloadLan();
|
|
|
|
void rejectMessage();
|
|
|
|
|
|
|
|
void playMusic(byte id); //schedules play
|
2009-11-08 21:59:26 +00:00
|
|
|
void playSound(byte id, byte skip_frames);
|
2009-09-03 20:59:17 +00:00
|
|
|
void playSoundNow(byte id);
|
|
|
|
void enableObject(byte id, byte scene_id = 0);
|
|
|
|
void disableObject(byte id, byte scene_id = 0);
|
2009-09-13 12:48:57 +00:00
|
|
|
void hideActor();
|
|
|
|
void showActor();
|
2009-09-03 20:59:17 +00:00
|
|
|
void waitAnimation();
|
2009-11-07 12:00:56 +00:00
|
|
|
void waitLanAnimationFrame(byte slot, uint16 frame);
|
2009-11-08 21:59:26 +00:00
|
|
|
void setTimerCallback(uint16 addr, uint16 frames);
|
2009-11-17 22:45:41 +00:00
|
|
|
void shakeScreen();
|
2009-12-08 22:04:00 +00:00
|
|
|
void displayCredits();
|
2009-12-27 18:21:49 +00:00
|
|
|
void fadeIn();
|
|
|
|
void fadeOut();
|
2010-02-02 07:26:36 +00:00
|
|
|
void wait(uint16 frames);
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2011-05-17 09:58:34 +00:00
|
|
|
Common::RandomSource _rnd;
|
2009-09-03 20:59:17 +00:00
|
|
|
|
2012-07-07 12:46:28 +00:00
|
|
|
Resources *res;
|
2009-09-03 20:59:17 +00:00
|
|
|
Scene *scene;
|
|
|
|
Inventory *inventory;
|
|
|
|
MusicPlayer *music;
|
2012-07-11 13:34:09 +00:00
|
|
|
Dialog *dialog;
|
2011-10-23 00:05:05 +00:00
|
|
|
Console *console;
|
2009-09-15 08:54:06 +00:00
|
|
|
|
2009-09-03 20:59:17 +00:00
|
|
|
void setMusic(byte id);
|
|
|
|
|
2009-09-15 08:54:06 +00:00
|
|
|
private:
|
2009-09-03 20:59:17 +00:00
|
|
|
void processObject();
|
2009-12-01 08:00:13 +00:00
|
|
|
bool trySelectedObject();
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
bool scene_busy;
|
|
|
|
Action action;
|
2009-09-15 07:41:05 +00:00
|
|
|
Object *dst_object;
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
Audio::AudioStream *_musicStream;
|
|
|
|
Audio::SoundHandle _musicHandle, _soundHandle;
|
2009-09-05 08:16:35 +00:00
|
|
|
const ADGameDescription *_gameDescription;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2010-01-08 18:03:34 +00:00
|
|
|
uint _mark_delay, _game_delay;
|
2010-01-25 01:39:44 +00:00
|
|
|
|
2009-09-26 15:04:09 +00:00
|
|
|
Common::Array<Common::Array<UseHotspot> > use_hotspots;
|
2012-07-22 23:50:19 +00:00
|
|
|
|
|
|
|
void fnIntro();
|
2012-07-26 05:06:44 +00:00
|
|
|
void fnPoleClimbFail();
|
2012-07-22 23:50:19 +00:00
|
|
|
void fnGotAnchor();
|
2012-07-26 05:06:44 +00:00
|
|
|
void fnGetOutOfLake();
|
2012-07-22 23:50:19 +00:00
|
|
|
void fnGuardDrinking();
|
2012-07-26 05:06:44 +00:00
|
|
|
void fnEgoDefaultPosition();
|
|
|
|
void fnEnterCave();
|
|
|
|
void fnEgoScaredBySpider();
|
|
|
|
void fnMoveToLadderAndLeaveCellar();
|
|
|
|
void fnLeaveCellar();
|
2012-07-22 23:50:19 +00:00
|
|
|
void fnPutRockInHole();
|
2012-07-26 05:06:44 +00:00
|
|
|
void fnEgoBottomRightTurn();
|
|
|
|
bool fnCheckingDrawers();
|
|
|
|
void fnDrawerOpenMessage();
|
|
|
|
bool fnRobotSafeAlreadyUnlockedCheck();
|
|
|
|
void fnRobotSafeUnlockCheck();
|
|
|
|
bool fnMansionIntrusionAttempt();
|
|
|
|
void fnTooDark();
|
|
|
|
bool fnIsCookGone();
|
|
|
|
void fnEgoSuspiciousPosition();
|
|
|
|
void fnGivingFlowerToOldLady();
|
|
|
|
void fnGiveAnotherFlowerToOldLady();
|
|
|
|
void fnGivingFlowerToAnne();
|
|
|
|
void fnGiveAnotherFlowerToAnne();
|
2009-09-03 20:59:17 +00:00
|
|
|
};
|
|
|
|
|
2009-09-04 20:08:33 +00:00
|
|
|
} // End of namespace TeenAgent
|
2009-09-03 20:59:17 +00:00
|
|
|
|
|
|
|
#endif
|