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.
|
2006-02-11 12:54:56 +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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2006-07-23 15:32:14 +00:00
|
|
|
#ifndef LURE_HOTSPOTS_H
|
|
|
|
#define LURE_HOTSPOTS_H
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
#include "lure/luredefs.h"
|
|
|
|
#include "lure/screen.h"
|
|
|
|
#include "lure/disk.h"
|
|
|
|
#include "lure/res_struct.h"
|
|
|
|
|
|
|
|
namespace Lure {
|
|
|
|
|
2006-04-11 10:52:11 +00:00
|
|
|
#define MAX_NUM_IMPINGING 10
|
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
class Hotspot;
|
|
|
|
|
2006-04-11 10:52:11 +00:00
|
|
|
class Support {
|
2006-07-08 08:42:58 +00:00
|
|
|
private:
|
|
|
|
static bool changeRoomCheckBumped(Hotspot &h);
|
2006-04-11 10:52:11 +00:00
|
|
|
public:
|
|
|
|
static int findIntersectingCharacters(Hotspot &h, uint16 *charList);
|
|
|
|
static bool checkForIntersectingCharacter(Hotspot &h);
|
2006-09-03 08:39:06 +00:00
|
|
|
static bool checkRoomChange(Hotspot &h);
|
2006-04-11 10:52:11 +00:00
|
|
|
static void characterChangeRoom(Hotspot &h, uint16 roomNumber,
|
|
|
|
int16 newX, int16 newY, Direction dir);
|
|
|
|
static bool charactersIntersecting(HotspotData *hotspot1, HotspotData *hotspot2);
|
2006-05-29 08:12:07 +00:00
|
|
|
static bool isCharacterInList(uint16 *lst, int numEntries, uint16 charId);
|
2006-04-11 10:52:11 +00:00
|
|
|
};
|
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
typedef void(*HandlerMethodPtr)(Hotspot &h);
|
|
|
|
|
|
|
|
class HotspotTickHandlers {
|
|
|
|
private:
|
2006-05-23 12:43:42 +00:00
|
|
|
// Support methods
|
|
|
|
static void npcRoomChange(Hotspot &h);
|
|
|
|
|
2006-02-19 04:25:28 +00:00
|
|
|
// Handler methods
|
2006-02-11 12:54:56 +00:00
|
|
|
static void defaultHandler(Hotspot &h);
|
2006-07-08 08:42:58 +00:00
|
|
|
static void voiceBubbleAnimHandler(Hotspot &h);
|
2006-02-11 12:54:56 +00:00
|
|
|
static void standardAnimHandler(Hotspot &h);
|
2007-02-26 22:56:02 +00:00
|
|
|
static void standardAnimHandler2(Hotspot &h);
|
2006-04-11 10:52:11 +00:00
|
|
|
static void standardCharacterAnimHandler(Hotspot &h);
|
2006-07-08 08:42:58 +00:00
|
|
|
static void puzzledAnimHandler(Hotspot &h);
|
2006-02-11 12:54:56 +00:00
|
|
|
static void roomExitAnimHandler(Hotspot &h);
|
|
|
|
static void playerAnimHandler(Hotspot &h);
|
2006-07-08 08:42:58 +00:00
|
|
|
static void followerAnimHandler(Hotspot &h);
|
2007-06-22 12:36:04 +00:00
|
|
|
static void jailorAnimHandler(Hotspot &h);
|
2007-04-15 10:49:59 +00:00
|
|
|
static void sonicRatAnimHandler(Hotspot &h);
|
2006-02-11 12:54:56 +00:00
|
|
|
static void droppingTorchAnimHandler(Hotspot &h);
|
2007-01-31 02:33:20 +00:00
|
|
|
static void playerSewerExitAnimHandler(Hotspot &h);
|
2006-02-11 12:54:56 +00:00
|
|
|
static void fireAnimHandler(Hotspot &h);
|
2007-04-22 22:42:01 +00:00
|
|
|
static void sparkleAnimHandler(Hotspot &h);
|
2007-04-15 10:49:59 +00:00
|
|
|
static void teaAnimHandler(Hotspot &h);
|
2007-04-02 06:03:47 +00:00
|
|
|
static void goewinCaptiveAnimHandler(Hotspot &h);
|
2006-07-08 08:42:58 +00:00
|
|
|
static void prisonerAnimHandler(Hotspot &h);
|
2007-02-16 23:17:00 +00:00
|
|
|
static void catrionaAnimHandler(Hotspot &h);
|
2007-03-06 08:24:52 +00:00
|
|
|
static void morkusAnimHandler(Hotspot &h);
|
2006-02-19 04:25:28 +00:00
|
|
|
static void talkAnimHandler(Hotspot &h);
|
2007-04-17 03:48:51 +00:00
|
|
|
static void grubAnimHandler(Hotspot &h);
|
2007-04-14 03:48:24 +00:00
|
|
|
static void barmanAnimHandler(Hotspot &h);
|
2007-06-22 12:36:04 +00:00
|
|
|
static void skorlAnimHandler(Hotspot &h);
|
2007-04-15 10:49:59 +00:00
|
|
|
static void gargoyleAnimHandler(Hotspot &h);
|
2007-06-22 12:36:04 +00:00
|
|
|
static void goewinShopAnimHandler(Hotspot &h);
|
2007-04-15 10:49:59 +00:00
|
|
|
static void skullAnimHandler(Hotspot &h);
|
2007-06-22 12:36:04 +00:00
|
|
|
static void dragonFireAnimHandler(Hotspot &h);
|
|
|
|
static void castleSkorlAnimHandler(Hotspot &h);
|
2006-07-08 08:42:58 +00:00
|
|
|
static void rackSerfAnimHandler(Hotspot &h);
|
2007-06-22 12:36:04 +00:00
|
|
|
static void fighterAnimHandler(Hotspot &h);
|
|
|
|
static void playerFightAnimHandler(Hotspot &h);
|
2006-02-11 12:54:56 +00:00
|
|
|
public:
|
|
|
|
static HandlerMethodPtr getHandler(uint16 procOffset);
|
|
|
|
};
|
|
|
|
|
2006-04-11 10:52:11 +00:00
|
|
|
enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT,
|
|
|
|
PROCESSING_PATH, WALKING};
|
|
|
|
|
|
|
|
class CurrentActionEntry {
|
|
|
|
private:
|
|
|
|
CurrentAction _action;
|
2006-05-23 12:43:42 +00:00
|
|
|
CharacterScheduleEntry *_supportData;
|
|
|
|
uint16 _roomNumber;
|
2006-08-30 12:19:05 +00:00
|
|
|
bool _dynamicSupportData;
|
2006-04-11 10:52:11 +00:00
|
|
|
public:
|
2006-08-30 12:19:05 +00:00
|
|
|
CurrentActionEntry(CurrentAction newAction, uint16 roomNum);
|
|
|
|
CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum);
|
|
|
|
CurrentActionEntry(Action newAction, uint16 roomNum, uint16 param1, uint16 param2);
|
|
|
|
virtual ~CurrentActionEntry() {
|
|
|
|
if (_dynamicSupportData) delete _supportData;
|
2006-04-29 11:22:05 +00:00
|
|
|
}
|
2006-04-11 10:52:11 +00:00
|
|
|
|
|
|
|
CurrentAction action() { return _action; }
|
2006-05-23 12:43:42 +00:00
|
|
|
CharacterScheduleEntry &supportData() {
|
|
|
|
if (!_supportData) error("Access made to non-defined action support record");
|
|
|
|
return *_supportData;
|
|
|
|
}
|
|
|
|
bool hasSupportData() { return _supportData != NULL; }
|
|
|
|
uint16 roomNumber() { return _roomNumber; }
|
|
|
|
void setAction(CurrentAction newAction) { _action = newAction; }
|
|
|
|
void setRoomNumber(uint16 roomNum) { _roomNumber = roomNum; }
|
2007-02-09 10:56:31 +00:00
|
|
|
void setSupportData(CharacterScheduleEntry *newRec) {
|
|
|
|
assert((newRec == NULL) || (newRec->parent() != NULL));
|
|
|
|
_supportData = newRec;
|
|
|
|
}
|
2006-07-08 08:42:58 +00:00
|
|
|
void setSupportData(uint16 entryId);
|
2006-10-02 12:48:56 +00:00
|
|
|
|
|
|
|
void saveToStream(WriteStream *stream);
|
|
|
|
static CurrentActionEntry *loadFromStream(ReadStream *stream);
|
2006-04-11 10:52:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CurrentActionStack {
|
|
|
|
private:
|
|
|
|
ManagedList<CurrentActionEntry *> _actions;
|
2007-06-22 12:36:04 +00:00
|
|
|
void validateStack() {
|
|
|
|
if (_actions.size() > 20)
|
|
|
|
error("NPC character got an excessive number of pending actions");
|
|
|
|
}
|
2006-04-11 10:52:11 +00:00
|
|
|
public:
|
|
|
|
CurrentActionStack() { _actions.clear(); }
|
|
|
|
|
|
|
|
bool isEmpty() { return _actions.begin() == _actions.end(); }
|
|
|
|
void clear() { _actions.clear(); }
|
|
|
|
CurrentActionEntry &top() { return **_actions.begin(); }
|
|
|
|
CurrentAction action() { return isEmpty() ? NO_ACTION : top().action(); }
|
|
|
|
void pop() { _actions.erase(_actions.begin()); }
|
2006-05-23 12:43:42 +00:00
|
|
|
int size() { return _actions.size(); }
|
2006-07-08 08:42:58 +00:00
|
|
|
void list(char *buffer);
|
|
|
|
void list() { list(NULL); }
|
2006-05-23 12:43:42 +00:00
|
|
|
|
|
|
|
void addBack(CurrentAction newAction, uint16 roomNum) {
|
|
|
|
_actions.push_back(new CurrentActionEntry(newAction, roomNum));
|
2007-06-22 12:36:04 +00:00
|
|
|
validateStack();
|
2006-04-29 11:22:05 +00:00
|
|
|
}
|
2006-05-23 12:43:42 +00:00
|
|
|
void addBack(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
|
|
|
|
_actions.push_back(new CurrentActionEntry(newAction, rec, roomNum));
|
2007-06-22 12:36:04 +00:00
|
|
|
validateStack();
|
2006-04-29 11:22:05 +00:00
|
|
|
}
|
2006-08-30 12:19:05 +00:00
|
|
|
void addBack(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
|
|
|
|
_actions.push_back(new CurrentActionEntry(newAction, roomNum, param1, param2));
|
2007-06-22 12:36:04 +00:00
|
|
|
validateStack();
|
2006-08-30 12:19:05 +00:00
|
|
|
}
|
2006-05-23 12:43:42 +00:00
|
|
|
void addFront(CurrentAction newAction, uint16 roomNum) {
|
|
|
|
_actions.push_front(new CurrentActionEntry(newAction, roomNum));
|
2007-06-22 12:36:04 +00:00
|
|
|
validateStack();
|
2006-04-29 11:22:05 +00:00
|
|
|
}
|
2006-05-23 12:43:42 +00:00
|
|
|
void addFront(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
|
|
|
|
_actions.push_front(new CurrentActionEntry(newAction, rec, roomNum));
|
2007-06-22 12:36:04 +00:00
|
|
|
validateStack();
|
2006-04-29 11:22:05 +00:00
|
|
|
}
|
2006-08-30 12:19:05 +00:00
|
|
|
void addFront(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
|
|
|
|
_actions.push_front(new CurrentActionEntry(newAction, roomNum, param1, param2));
|
2007-06-22 12:36:04 +00:00
|
|
|
validateStack();
|
2006-08-30 12:19:05 +00:00
|
|
|
}
|
2006-10-02 12:48:56 +00:00
|
|
|
|
|
|
|
void saveToStream(WriteStream *stream);
|
|
|
|
void loadFromStream(ReadStream *stream);
|
2006-04-11 10:52:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class WalkingActionEntry {
|
|
|
|
private:
|
|
|
|
Direction _direction;
|
|
|
|
int _numSteps;
|
|
|
|
public:
|
2007-04-26 19:08:53 +00:00
|
|
|
WalkingActionEntry(Direction dir, int steps): _direction(dir), _numSteps(steps) {}
|
2006-04-11 10:52:11 +00:00
|
|
|
Direction direction() { return _direction; }
|
|
|
|
int &rawSteps() { return _numSteps; }
|
|
|
|
int numSteps();
|
|
|
|
};
|
|
|
|
|
2007-05-07 12:16:05 +00:00
|
|
|
enum PathFinderResult {PF_UNFINISHED, PF_OK, PF_DEST_OCCUPIED, PF_PART_PATH, PF_NO_WALK};
|
2006-04-11 10:52:11 +00:00
|
|
|
|
|
|
|
class PathFinder {
|
|
|
|
private:
|
|
|
|
Hotspot *_hotspot;
|
2007-05-07 12:16:05 +00:00
|
|
|
bool _inUse;
|
2006-04-11 10:52:11 +00:00
|
|
|
ManagedList<WalkingActionEntry *> _list;
|
|
|
|
RoomPathsDecompressedData _layer;
|
|
|
|
int _stepCtr;
|
|
|
|
bool _inProgress;
|
|
|
|
int _countdownCtr;
|
|
|
|
int16 _destX, _destY;
|
|
|
|
int16 _xPos, _yPos;
|
|
|
|
int16 _xCurrent, _yCurrent;
|
|
|
|
int16 _xDestPos, _yDestPos;
|
|
|
|
int16 _xDestCurrent, _yDestCurrent;
|
|
|
|
bool _destOccupied;
|
|
|
|
bool _cellPopulated;
|
|
|
|
uint16 *_pSrc, *_pDest;
|
|
|
|
int _xChangeInc, _xChangeStart;
|
|
|
|
int _yChangeInc, _yChangeStart;
|
|
|
|
int _xCtr, _yCtr;
|
|
|
|
|
|
|
|
void initVars();
|
|
|
|
void processCell(uint16 *p);
|
|
|
|
void scanLine(int numScans, int changeAmount, uint16 *&pEnd, int &v);
|
|
|
|
|
|
|
|
void add(Direction dir, int steps) {
|
|
|
|
_list.push_front(new WalkingActionEntry(dir, steps));
|
|
|
|
}
|
|
|
|
void addBack(Direction dir, int steps) {
|
|
|
|
_list.push_back(new WalkingActionEntry(dir, steps));
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
PathFinder(Hotspot *h);
|
2006-05-29 08:12:07 +00:00
|
|
|
void clear();
|
2006-04-11 10:52:11 +00:00
|
|
|
void reset(RoomPathsData &src);
|
2007-05-07 12:16:05 +00:00
|
|
|
PathFinderResult process();
|
2006-07-08 08:42:58 +00:00
|
|
|
void list(char *buffer);
|
|
|
|
void list() { list(NULL); }
|
2006-04-11 10:52:11 +00:00
|
|
|
|
|
|
|
void pop() { _list.erase(_list.begin()); }
|
|
|
|
WalkingActionEntry &top() { return **_list.begin(); }
|
|
|
|
bool isEmpty() { return _list.empty(); }
|
|
|
|
int &stepCtr() { return _stepCtr; }
|
2006-10-02 12:48:56 +00:00
|
|
|
|
|
|
|
void saveToStream(Common::WriteStream *stream);
|
|
|
|
void loadFromStream(Common::ReadStream *stream);
|
2006-04-11 10:52:11 +00:00
|
|
|
};
|
|
|
|
|
2007-04-14 11:00:29 +00:00
|
|
|
enum HotspotPrecheckResult {PC_EXECUTE, PC_NOT_IN_ROOM, PC_FAILED, PC_WAIT, PC_EXCESS};
|
2006-02-11 12:54:56 +00:00
|
|
|
|
2007-04-14 03:48:24 +00:00
|
|
|
enum BarPlaceResult {BP_KEEP_TRYING, BP_GOT_THERE, BP_FAIL};
|
|
|
|
|
2007-08-05 02:56:51 +00:00
|
|
|
struct DestStructure {
|
|
|
|
uint8 counter;
|
|
|
|
Point position;
|
|
|
|
};
|
|
|
|
|
2006-07-08 08:42:58 +00:00
|
|
|
#define MAX_NUM_FRAMES 16
|
2006-05-29 08:12:07 +00:00
|
|
|
|
2006-02-11 12:54:56 +00:00
|
|
|
class Hotspot {
|
|
|
|
private:
|
|
|
|
HotspotData *_data;
|
2006-10-02 12:48:56 +00:00
|
|
|
uint16 _animId;
|
2006-02-11 12:54:56 +00:00
|
|
|
HotspotAnimData *_anim;
|
|
|
|
HandlerMethodPtr _tickHandler;
|
|
|
|
Surface *_frames;
|
2006-02-19 04:25:28 +00:00
|
|
|
uint16 _hotspotId;
|
2006-10-02 12:48:56 +00:00
|
|
|
uint16 _originalId;
|
2006-02-19 04:25:28 +00:00
|
|
|
uint16 _roomNumber;
|
2006-02-11 12:54:56 +00:00
|
|
|
int16 _startX, _startY;
|
|
|
|
uint16 _height, _width;
|
2006-02-19 04:25:28 +00:00
|
|
|
uint16 _heightCopy, _widthCopy;
|
2006-04-11 10:52:11 +00:00
|
|
|
uint16 _yCorrection;
|
|
|
|
uint16 _charRectY;
|
2006-02-19 04:25:28 +00:00
|
|
|
int8 _talkX, _talkY;
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 _numFrames;
|
|
|
|
uint16 _frameNumber;
|
2006-04-11 10:52:11 +00:00
|
|
|
Direction _direction;
|
2006-02-19 04:25:28 +00:00
|
|
|
uint8 _layer;
|
2007-04-29 11:30:29 +00:00
|
|
|
uint16 _hotspotScriptOffset;
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 _tickCtr;
|
2006-02-19 04:25:28 +00:00
|
|
|
uint8 _colourOffset;
|
2006-02-11 12:54:56 +00:00
|
|
|
bool _persistant;
|
2006-02-19 04:25:28 +00:00
|
|
|
HotspotOverrideData *_override;
|
2006-04-11 10:52:11 +00:00
|
|
|
bool _skipFlag;
|
|
|
|
CurrentActionStack _currentActions;
|
|
|
|
PathFinder _pathFinder;
|
2006-07-08 08:42:58 +00:00
|
|
|
uint16 _frameWidth;
|
|
|
|
bool _frameStartsUsed;
|
|
|
|
uint16 _frameStarts[MAX_NUM_FRAMES];
|
2007-02-14 02:37:53 +00:00
|
|
|
char _nameBuffer[MAX_HOTSPOT_NAME_SIZE];
|
2007-08-05 02:56:51 +00:00
|
|
|
DestStructure _tempDest;
|
2006-04-11 10:52:11 +00:00
|
|
|
|
2006-08-27 11:48:41 +00:00
|
|
|
// Runtime fields
|
2006-04-11 10:52:11 +00:00
|
|
|
uint16 _frameCtr;
|
2006-07-08 08:42:58 +00:00
|
|
|
uint8 _voiceCtr;
|
2006-02-11 12:54:56 +00:00
|
|
|
int16 _destX, _destY;
|
|
|
|
uint16 _destHotspotId;
|
2006-05-23 12:43:42 +00:00
|
|
|
uint16 _blockedOffset;
|
|
|
|
uint8 _exitCtr;
|
2006-07-08 08:42:58 +00:00
|
|
|
bool _walkFlag;
|
2006-08-27 11:48:41 +00:00
|
|
|
uint16 _startRoomNumber;
|
2007-04-14 03:48:24 +00:00
|
|
|
uint16 _supportValue;
|
2007-02-26 02:50:23 +00:00
|
|
|
|
2006-02-19 04:25:28 +00:00
|
|
|
// Support methods
|
2006-07-08 08:42:58 +00:00
|
|
|
uint16 getTalkId(HotspotData *charHotspot);
|
|
|
|
void startTalk(HotspotData *charHotspot, uint16 id);
|
|
|
|
void startTalkDialog();
|
2006-02-19 04:25:28 +00:00
|
|
|
|
2006-04-11 10:52:11 +00:00
|
|
|
// Action support methods
|
|
|
|
HotspotPrecheckResult actionPrecheck(HotspotData *hotspot);
|
2007-04-14 03:48:24 +00:00
|
|
|
BarPlaceResult getBarPlace();
|
|
|
|
bool findClearBarPlace();
|
2006-04-11 10:52:11 +00:00
|
|
|
bool characterWalkingCheck(HotspotData *hotspot);
|
2006-04-29 11:22:05 +00:00
|
|
|
bool doorCloseCheck(uint16 doorId);
|
2006-05-29 08:12:07 +00:00
|
|
|
void resetDirection();
|
2006-04-11 10:52:11 +00:00
|
|
|
|
2006-02-19 04:25:28 +00:00
|
|
|
// Action set
|
2006-05-23 12:43:42 +00:00
|
|
|
void doNothing(HotspotData *hotspot);
|
2006-02-19 04:25:28 +00:00
|
|
|
void doGet(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void doOperate(HotspotData *hotspot);
|
2006-02-19 04:25:28 +00:00
|
|
|
void doOpen(HotspotData *hotspot);
|
|
|
|
void doClose(HotspotData *hotspot);
|
|
|
|
void doLockUnlock(HotspotData *hotspot);
|
|
|
|
void doUse(HotspotData *hotspot);
|
|
|
|
void doGive(HotspotData *hotspot);
|
|
|
|
void doTalkTo(HotspotData *hotspot);
|
|
|
|
void doTell(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void doLook(HotspotData *hotspot);
|
2006-02-19 04:25:28 +00:00
|
|
|
void doLookAt(HotspotData *hotspot);
|
2006-04-29 11:22:05 +00:00
|
|
|
void doLookThrough(HotspotData *hotspot);
|
2006-02-19 04:25:28 +00:00
|
|
|
void doAsk(HotspotData *hotspot);
|
2006-04-29 11:22:05 +00:00
|
|
|
void doDrink(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void doStatus(HotspotData *hotspot);
|
|
|
|
void doGoto(HotspotData *hotspot);
|
|
|
|
void doReturn(HotspotData *hotspot);
|
2006-02-19 04:25:28 +00:00
|
|
|
void doBribe(HotspotData *hotspot);
|
2006-04-29 11:22:05 +00:00
|
|
|
void doExamine(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void npcSetRoomAndBlockedOffset(HotspotData *hotspot);
|
2007-02-26 02:50:23 +00:00
|
|
|
void npcHeySir(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void npcExecScript(HotspotData *hotspot);
|
2006-07-08 08:42:58 +00:00
|
|
|
void npcResetPausedList(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void npcSetRandomDest(HotspotData *hotspot);
|
|
|
|
void npcWalkingCheck(HotspotData *hotspot);
|
|
|
|
void npcSetSupportOffset(HotspotData *hotspot);
|
|
|
|
void npcSupportOffsetConditional(HotspotData *hotspot);
|
|
|
|
void npcDispatchAction(HotspotData *hotspot);
|
2007-04-30 07:56:45 +00:00
|
|
|
void npcTalkNpcToNpc(HotspotData *hotspot);
|
2006-07-08 08:42:58 +00:00
|
|
|
void npcPause(HotspotData *hotspot);
|
2006-05-23 12:43:42 +00:00
|
|
|
void npcStartTalking(HotspotData *hotspot);
|
|
|
|
void npcJumpAddress(HotspotData *hotspot);
|
2006-02-11 12:54:56 +00:00
|
|
|
public:
|
|
|
|
Hotspot(HotspotData *res);
|
2006-02-19 04:25:28 +00:00
|
|
|
Hotspot(Hotspot *character, uint16 objType);
|
2007-08-12 11:19:01 +00:00
|
|
|
Hotspot();
|
2006-02-11 12:54:56 +00:00
|
|
|
~Hotspot();
|
|
|
|
|
|
|
|
void setAnimation(uint16 newAnimId);
|
|
|
|
void setAnimation(HotspotAnimData *newRecord);
|
2006-02-19 04:25:28 +00:00
|
|
|
uint16 hotspotId() { return _hotspotId; }
|
2006-10-02 12:48:56 +00:00
|
|
|
uint16 originalId() { return _originalId; }
|
2006-02-11 12:54:56 +00:00
|
|
|
Surface &frames() { return *_frames; }
|
|
|
|
HotspotAnimData &anim() { return *_anim; }
|
2006-02-19 04:25:28 +00:00
|
|
|
HotspotData *resource() { return _data; }
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 numFrames() { return _numFrames; }
|
|
|
|
uint16 frameNumber() { return _frameNumber; }
|
2006-07-08 08:42:58 +00:00
|
|
|
void setFrameNumber(uint16 frameNum) {
|
|
|
|
assert(frameNum < _numFrames);
|
|
|
|
_frameNumber = frameNum;
|
|
|
|
}
|
2006-02-11 12:54:56 +00:00
|
|
|
void incFrameNumber();
|
2006-04-11 10:52:11 +00:00
|
|
|
Direction direction() { return _direction; }
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 frameWidth() { return _width; }
|
|
|
|
int16 x() { return _startX; }
|
|
|
|
int16 y() { return _startY; }
|
|
|
|
int16 destX() { return _destX; }
|
|
|
|
int16 destY() { return _destY; }
|
2006-02-19 04:25:28 +00:00
|
|
|
int8 talkX() { return _talkX; }
|
|
|
|
int8 talkY() { return _talkY; }
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 destHotspotId() { return _destHotspotId; }
|
2006-05-23 12:43:42 +00:00
|
|
|
uint16 blockedOffset() { return _blockedOffset; }
|
|
|
|
uint8 exitCtr() { return _exitCtr; }
|
2006-07-08 08:42:58 +00:00
|
|
|
bool walkFlag() { return _walkFlag; }
|
2006-08-27 11:48:41 +00:00
|
|
|
uint16 startRoomNumber() { return _startRoomNumber; }
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 width() { return _width; }
|
|
|
|
uint16 height() { return _height; }
|
2006-02-19 04:25:28 +00:00
|
|
|
uint16 widthCopy() { return _widthCopy; }
|
|
|
|
uint16 heightCopy() { return _heightCopy; }
|
2006-04-11 10:52:11 +00:00
|
|
|
uint16 yCorrection() { return _yCorrection; }
|
|
|
|
uint16 charRectY() { return _charRectY; }
|
2006-02-19 04:25:28 +00:00
|
|
|
uint16 roomNumber() { return _roomNumber; }
|
2007-04-29 11:30:29 +00:00
|
|
|
uint16 talkScript() {
|
|
|
|
assert(_data);
|
|
|
|
return _data->talkScriptOffset;
|
|
|
|
}
|
|
|
|
uint16 hotspotScript() { return _hotspotScriptOffset; }
|
2006-02-19 04:25:28 +00:00
|
|
|
uint8 layer() { return _layer; }
|
2006-02-11 12:54:56 +00:00
|
|
|
uint16 tickCtr() { return _tickCtr; }
|
2006-04-11 10:52:11 +00:00
|
|
|
bool skipFlag() { return _skipFlag; }
|
2006-02-11 12:54:56 +00:00
|
|
|
void setTickCtr(uint16 newVal) { _tickCtr = newVal; }
|
|
|
|
void setTickProc(uint16 newVal);
|
|
|
|
bool persistant() { return _persistant; }
|
|
|
|
void setPersistant(bool value) { _persistant = value; }
|
2007-06-22 12:36:04 +00:00
|
|
|
uint8 colourOffset() { return _colourOffset; }
|
|
|
|
void setColourOffset(uint8 value) { _colourOffset = value; }
|
2006-02-19 04:25:28 +00:00
|
|
|
void setRoomNumber(uint16 roomNum) {
|
|
|
|
_roomNumber = roomNum;
|
|
|
|
if (_data) _data->roomNumber = roomNum;
|
|
|
|
}
|
|
|
|
uint16 nameId();
|
2007-02-14 02:37:53 +00:00
|
|
|
const char *getName();
|
2006-02-11 12:54:56 +00:00
|
|
|
bool isActiveAnimation();
|
|
|
|
void setPosition(int16 newX, int16 newY);
|
|
|
|
void setDestPosition(int16 newX, int16 newY) { _destX = newX; _destY = newY; }
|
2006-04-11 10:52:11 +00:00
|
|
|
void setDestHotspot(uint16 id) { _destHotspotId = id; }
|
2006-05-23 12:43:42 +00:00
|
|
|
void setExitCtr(uint8 value) { _exitCtr = value; }
|
2006-07-08 08:42:58 +00:00
|
|
|
BlockedState blockedState() {
|
|
|
|
assert(_data);
|
|
|
|
return _data->blockedState;
|
|
|
|
}
|
|
|
|
void setBlockedState(BlockedState newState) {
|
|
|
|
assert(_data);
|
|
|
|
_data->blockedState = newState;
|
|
|
|
}
|
2007-02-09 10:56:31 +00:00
|
|
|
bool blockedFlag() {
|
|
|
|
assert(_data);
|
|
|
|
return _data->blockedFlag;
|
|
|
|
}
|
|
|
|
void setBlockedFlag(bool newValue) {
|
|
|
|
assert(_data);
|
|
|
|
_data->blockedFlag = newValue;
|
|
|
|
}
|
2006-07-08 08:42:58 +00:00
|
|
|
void setWalkFlag(bool value) { _walkFlag = value; }
|
2006-08-27 11:48:41 +00:00
|
|
|
void setStartRoomNumber(uint16 value) { _startRoomNumber = value; }
|
2006-02-11 12:54:56 +00:00
|
|
|
void setSize(uint16 newWidth, uint16 newHeight);
|
2007-04-14 03:48:24 +00:00
|
|
|
void setWidth(uint16 newWidth) {
|
|
|
|
_width = newWidth;
|
|
|
|
_frameWidth = newWidth;
|
|
|
|
}
|
|
|
|
void setHeight(uint16 newHeight) {
|
|
|
|
_height = newHeight;
|
|
|
|
}
|
2007-04-29 11:30:29 +00:00
|
|
|
void setHotspotScript(uint16 offset) {
|
2006-05-29 08:12:07 +00:00
|
|
|
assert(_data != NULL);
|
2007-04-29 11:30:29 +00:00
|
|
|
_hotspotScriptOffset = offset;
|
|
|
|
_data->hotspotScriptOffset = offset;
|
2006-02-19 04:25:28 +00:00
|
|
|
}
|
2006-07-08 08:42:58 +00:00
|
|
|
void setLayer(uint8 newLayer) {
|
|
|
|
assert(_data != NULL);
|
|
|
|
_layer = newLayer;
|
|
|
|
_data->layer = newLayer;
|
|
|
|
}
|
2007-04-15 10:49:59 +00:00
|
|
|
void setActions(uint32 newActions) {
|
|
|
|
assert(_data);
|
|
|
|
_data->actions = newActions;
|
|
|
|
}
|
2006-04-11 10:52:11 +00:00
|
|
|
void setCharRectY(uint16 value) { _charRectY = value; }
|
|
|
|
void setSkipFlag(bool value) { _skipFlag = value; }
|
2006-05-29 08:12:07 +00:00
|
|
|
CharacterMode characterMode() {
|
|
|
|
assert(_data != NULL);
|
|
|
|
return _data->characterMode;
|
|
|
|
}
|
|
|
|
void setCharacterMode(CharacterMode value) {
|
|
|
|
assert(_data != NULL);
|
|
|
|
_data->characterMode = value;
|
|
|
|
}
|
|
|
|
uint16 delayCtr() {
|
2006-07-08 08:42:58 +00:00
|
|
|
assert(_data);
|
|
|
|
return _data->delayCtr;
|
2006-05-29 08:12:07 +00:00
|
|
|
}
|
|
|
|
void setDelayCtr(uint16 value) {
|
2006-07-08 08:42:58 +00:00
|
|
|
assert(_data);
|
|
|
|
_data->delayCtr = value;
|
|
|
|
}
|
|
|
|
uint16 pauseCtr() {
|
|
|
|
assert(_data);
|
|
|
|
return _data->pauseCtr;
|
|
|
|
}
|
|
|
|
void setPauseCtr(uint16 value) {
|
|
|
|
assert(_data);
|
|
|
|
_data->pauseCtr = value;
|
|
|
|
}
|
2007-01-31 02:33:20 +00:00
|
|
|
VariantBool coveredFlag() {
|
2006-07-08 08:42:58 +00:00
|
|
|
assert(_data);
|
|
|
|
return _data->coveredFlag;
|
|
|
|
}
|
2007-01-31 02:33:20 +00:00
|
|
|
void setCoveredFlag(VariantBool value) {
|
2006-07-08 08:42:58 +00:00
|
|
|
assert(_data);
|
|
|
|
_data->coveredFlag = value;
|
|
|
|
}
|
|
|
|
uint16 useHotspotId() {
|
|
|
|
assert(_data);
|
|
|
|
return _data->useHotspotId;
|
|
|
|
}
|
|
|
|
void setUseHotspotId(uint16 value) {
|
|
|
|
assert(_data);
|
|
|
|
_data->useHotspotId = value;
|
|
|
|
}
|
2007-04-19 06:46:56 +00:00
|
|
|
uint16 talkGate() {
|
2006-07-08 08:42:58 +00:00
|
|
|
assert(_data);
|
2007-04-19 06:46:56 +00:00
|
|
|
return _data->talkGate;
|
2006-07-08 08:42:58 +00:00
|
|
|
}
|
2007-04-19 06:46:56 +00:00
|
|
|
void setTalkGate(uint16 value) {
|
2006-07-08 08:42:58 +00:00
|
|
|
assert(_data);
|
2007-04-19 06:46:56 +00:00
|
|
|
_data->talkGate = value;
|
2006-05-29 08:12:07 +00:00
|
|
|
}
|
2007-04-14 03:48:24 +00:00
|
|
|
uint16 supportValue() { return _supportValue; }
|
|
|
|
void setSupportValue(uint16 value) { _supportValue = value; }
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
void copyTo(Surface *dest);
|
|
|
|
bool executeScript();
|
|
|
|
void tick();
|
2006-02-19 04:25:28 +00:00
|
|
|
bool isRoomExit(uint16 id);
|
2006-02-11 12:54:56 +00:00
|
|
|
|
2006-04-11 10:52:11 +00:00
|
|
|
// Walking
|
|
|
|
void walkTo(int16 endPosX, int16 endPosY, uint16 destHotspot = 0);
|
2006-04-29 11:22:05 +00:00
|
|
|
void stopWalking();
|
2006-05-23 12:43:42 +00:00
|
|
|
void endAction();
|
2006-04-11 10:52:11 +00:00
|
|
|
void setDirection(Direction dir);
|
|
|
|
void faceHotspot(HotspotData *hotspot);
|
2006-07-08 08:42:58 +00:00
|
|
|
void faceHotspot(uint16 hotspotId);
|
2006-05-29 08:12:07 +00:00
|
|
|
void setRandomDest();
|
2006-04-11 10:52:11 +00:00
|
|
|
void setOccupied(bool occupiedFlag);
|
|
|
|
bool walkingStep();
|
2006-05-29 08:12:07 +00:00
|
|
|
void updateMovement();
|
|
|
|
void updateMovement2(CharacterMode value);
|
|
|
|
void resetPosition();
|
2006-04-11 10:52:11 +00:00
|
|
|
|
2006-05-23 12:43:42 +00:00
|
|
|
void doAction();
|
2006-02-11 12:54:56 +00:00
|
|
|
void doAction(Action action, HotspotData *hotspot);
|
2006-04-11 10:52:11 +00:00
|
|
|
CurrentActionStack ¤tActions() { return _currentActions; }
|
|
|
|
PathFinder &pathFinder() { return _pathFinder; }
|
2007-08-05 02:56:51 +00:00
|
|
|
DestStructure &tempDest() { return _tempDest; }
|
2006-04-11 10:52:11 +00:00
|
|
|
uint16 frameCtr() { return _frameCtr; }
|
|
|
|
void setFrameCtr(uint16 value) { _frameCtr = value; }
|
|
|
|
void decrFrameCtr() { if (_frameCtr > 0) --_frameCtr; }
|
2006-07-08 08:42:58 +00:00
|
|
|
uint8 actionCtr() {
|
|
|
|
assert(_data);
|
|
|
|
return _data->actionCtr;
|
|
|
|
}
|
|
|
|
void setActionCtr(uint8 v) {
|
|
|
|
assert(_data);
|
|
|
|
_data->actionCtr = v;
|
|
|
|
}
|
|
|
|
uint8 voiceCtr() { return _voiceCtr; }
|
|
|
|
void setVoiceCtr(uint8 v) { _voiceCtr = v; }
|
|
|
|
|
|
|
|
// Miscellaneous
|
2006-08-07 13:24:45 +00:00
|
|
|
void converse(uint16 destCharacterId, uint16 messageId, bool standStill);
|
|
|
|
void converse(uint16 destCharacterId, uint16 messageId) {
|
|
|
|
converse(destCharacterId, messageId, false);
|
|
|
|
}
|
|
|
|
void showMessage(uint16 messageId, uint16 destCharacterId = NOONE_ID);
|
2006-07-08 08:42:58 +00:00
|
|
|
void scheduleConverse(uint16 destHotspot, uint16 messageId);
|
|
|
|
void handleTalkDialog();
|
2006-10-02 12:48:56 +00:00
|
|
|
|
|
|
|
void saveToStream(Common::WriteStream *stream);
|
|
|
|
void loadFromStream(Common::ReadStream *stream);
|
2006-02-11 12:54:56 +00:00
|
|
|
};
|
|
|
|
|
2006-10-02 12:48:56 +00:00
|
|
|
class HotspotList: public ManagedList<Hotspot *> {
|
|
|
|
public:
|
|
|
|
void saveToStream(WriteStream *stream);
|
|
|
|
void loadFromStream(ReadStream *stream);
|
|
|
|
};
|
2006-02-11 12:54:56 +00:00
|
|
|
|
|
|
|
} // End of namespace Lure
|
|
|
|
|
|
|
|
#endif
|