22 #ifndef LURE_HOTSPOTS_H 23 #define LURE_HOTSPOTS_H 25 #include "lure/luredefs.h" 26 #include "lure/screen.h" 27 #include "lure/disk.h" 28 #include "lure/res_struct.h" 32 #define MAX_NUM_IMPINGING 10 35 class HotspotTickHandlers;
39 static bool changeRoomCheckBumped(
Hotspot &h);
41 static int findIntersectingCharacters(
Hotspot &h, uint16 *charList, int16 xp = -1, int16 yp = -1,
int roomNumber = -1);
42 static bool checkForIntersectingCharacter(
Hotspot &h, int16 xp = -1, int16 yp = -1,
int roomNumber = -1);
43 static bool checkRoomChange(
Hotspot &h);
44 static void characterChangeRoom(
Hotspot &h, uint16 roomNumber,
47 static bool isCharacterInList(uint16 *lst,
int numEntries, uint16 charId);
59 uint16 talkDestCharacter;
66 void talkEndConversation();
69 void defaultHandler(
Hotspot &h);
70 void voiceBubbleAnimHandler(
Hotspot &h);
71 void standardAnimHandler(
Hotspot &h);
72 void standardAnimHandler2(
Hotspot &h);
73 void standardCharacterAnimHandler(
Hotspot &h);
74 void puzzledAnimHandler(
Hotspot &h);
75 void roomExitAnimHandler(
Hotspot &h);
76 void playerAnimHandler(
Hotspot &h);
77 void followerAnimHandler(
Hotspot &h);
78 void jailorAnimHandler(
Hotspot &h);
79 void sonicRatAnimHandler(
Hotspot &h);
80 void droppingTorchAnimHandler(
Hotspot &h);
81 void playerSewerExitAnimHandler(
Hotspot &h);
82 void fireAnimHandler(
Hotspot &h);
83 void sparkleAnimHandler(
Hotspot &h);
84 void teaAnimHandler(
Hotspot &h);
85 void goewinCaptiveAnimHandler(
Hotspot &h);
86 void prisonerAnimHandler(
Hotspot &h);
87 void catrionaAnimHandler(
Hotspot &h);
88 void morkusAnimHandler(
Hotspot &h);
89 void talkAnimHandler(
Hotspot &h);
90 void grubAnimHandler(
Hotspot &h);
91 void barmanAnimHandler(
Hotspot &h);
92 void skorlAnimHandler(
Hotspot &h);
93 void gargoyleAnimHandler(
Hotspot &h);
94 void goewinShopAnimHandler(
Hotspot &h);
95 void skullAnimHandler(
Hotspot &h);
96 void dragonFireAnimHandler(
Hotspot &h);
97 void castleSkorlAnimHandler(
Hotspot &h);
98 void rackSerfAnimHandler(
Hotspot &h);
99 void fighterAnimHandler(
Hotspot &h);
100 void playerFightAnimHandler(
Hotspot &h);
104 HandlerMethodPtr getHandler(uint16 procIndex);
113 Direction direction()
const {
return _direction; }
114 int &rawSteps() {
return _numSteps; }
115 int numSteps()
const;
118 enum PathFinderResult {PF_UNFINISHED, PF_OK, PF_DEST_OCCUPIED, PF_PART_PATH, PF_NO_WALK};
125 WalkingActionList _list;
126 RoomPathsDecompressedData _layer;
130 int16 _destX, _destY;
132 int16 _xCurrent, _yCurrent;
133 int16 _xDestPos, _yDestPos;
134 int16 _xDestCurrent, _yDestCurrent;
137 uint16 *_pSrc, *_pDest;
138 int _xChangeInc, _xChangeStart;
139 int _yChangeInc, _yChangeStart;
143 void processCell(uint16 *p);
144 void scanLine(
int numScans,
int changeAmount, uint16 *&pEnd,
int &v);
156 PathFinderResult process();
161 bool isEmpty()
const {
return _list.
empty(); }
162 int &stepCtr() {
return _stepCtr; }
168 enum HotspotPrecheckResult {PC_EXECUTE, PC_NOT_IN_ROOM, PC_FAILED, PC_WAIT, PC_EXCESS};
170 enum BarPlaceResult {BP_KEEP_TRYING, BP_GOT_THERE, BP_FAIL};
178 #define MAX_NUM_FRAMES 16 186 HandlerMethodPtr _tickHandler;
191 int16 _startX, _startY;
192 uint16 _height, _width;
193 uint16 _heightCopy, _widthCopy;
201 uint16 _hotspotScriptOffset;
208 bool _frameStartsUsed;
209 uint16 _frameStarts[MAX_NUM_FRAMES];
210 char _nameBuffer[MAX_HOTSPOT_NAME_SIZE];
216 int16 _destX, _destY;
217 uint16 _destHotspotId;
218 uint16 _blockedOffset;
221 uint16 _startRoomNumber;
222 uint16 _supportValue;
226 void startTalk(
HotspotData *charHotspot, uint16
id);
227 void startTalkDialog();
230 HotspotPrecheckResult actionPrecheck(
HotspotData *hotspot);
231 BarPlaceResult getBarPlace();
232 bool findClearBarPlace();
233 bool characterWalkingCheck(uint16
id);
234 void resetDirection();
256 void npcSetRoomAndBlockedOffset(
HotspotData *hotspot);
263 void npcSupportOffsetConditional(
HotspotData *hotspot);
271 void doLookAction(
HotspotData *hotspot, Action action);
278 void setAnimation(uint16 newAnimId);
279 void setAnimationIndex(
int animIndex);
281 uint16 hotspotId()
const {
return _hotspotId; }
282 uint16 originalId()
const {
return _originalId; }
283 Surface &frames()
const {
return *_frames; }
286 uint16 numFrames()
const {
return _numFrames; }
287 uint16 frameNumber()
const {
return _frameNumber; }
288 void setFrameNumber(uint16 frameNum) {
289 assert(frameNum < _numFrames);
290 _frameNumber = frameNum;
292 void incFrameNumber();
293 Direction direction()
const {
return _direction; }
294 uint16 frameWidth()
const {
return _width; }
295 int16 x()
const {
return _startX; }
296 int16 y()
const {
return _startY; }
297 int16 destX()
const {
return _destX; }
298 int16 destY()
const {
return _destY; }
299 int8 talkX()
const {
return _talkX; }
300 int8 talkY()
const {
return _talkY; }
301 uint16 destHotspotId()
const {
return _destHotspotId; }
302 uint16 blockedOffset()
const {
return _blockedOffset; }
303 uint8 exitCtr()
const {
return _exitCtr; }
304 bool walkFlag()
const {
return _walkFlag; }
305 uint16 startRoomNumber()
const {
return _startRoomNumber; }
306 uint16 width()
const {
return _width; }
307 uint16 height()
const {
return _height; }
308 uint16 widthCopy()
const {
return _widthCopy; }
309 uint16 heightCopy()
const {
return _heightCopy; }
310 uint16 yCorrection()
const {
return _yCorrection; }
311 uint16 charRectY()
const {
return _charRectY; }
312 uint16 roomNumber()
const {
return _roomNumber; }
313 uint16 talkScript()
const {
315 return _data->talkScriptOffset;
317 uint16 hotspotScript()
const {
return _hotspotScriptOffset; }
318 uint8 layer()
const {
return _layer; }
319 bool skipFlag()
const {
return _skipFlag; }
320 void setTickProc(uint16 newVal);
321 bool persistant()
const {
return _persistant; }
322 void setPersistant(
bool value) { _persistant = value; }
323 uint8 colorOffset()
const {
return _colorOffset; }
324 void setColorOffset(uint8 value) { _colorOffset = value; }
325 void setRoomNumber(uint16 roomNum) {
326 _roomNumber = roomNum;
327 if (_data) _data->roomNumber = roomNum;
329 uint16 nameId()
const;
330 const char *getName();
331 bool isActiveAnimation();
332 void setPosition(int16 newX, int16 newY);
333 void setDestPosition(int16 newX, int16 newY) { _destX = newX; _destY = newY; }
334 void setDestHotspot(uint16
id) { _destHotspotId = id; }
335 void setExitCtr(uint8 value) { _exitCtr = value; }
336 BlockedState blockedState()
const {
338 return _data->blockedState;
340 void setBlockedState(BlockedState newState) {
342 _data->blockedState = newState;
344 bool blockedFlag()
const {
346 return _data->blockedFlag;
348 void setBlockedFlag(
bool newValue) {
350 _data->blockedFlag = newValue;
352 void setWalkFlag(
bool value) { _walkFlag = value; }
353 void setStartRoomNumber(uint16 value) { _startRoomNumber = value; }
354 void setSize(uint16 newWidth, uint16 newHeight);
355 void setWidth(uint16 newWidth) {
357 _frameWidth = newWidth;
359 void setHeight(uint16 newHeight) {
362 void setHotspotScript(uint16 offset) {
363 assert(_data != NULL);
364 _hotspotScriptOffset = offset;
365 _data->hotspotScriptOffset = offset;
367 void setLayer(uint8 newLayer) {
368 assert(_data != NULL);
370 _data->layer = newLayer;
372 void setActions(uint32 newActions) {
374 _data->actions = newActions;
376 void setCharRectY(uint16 value) { _charRectY = value; }
377 void setSkipFlag(
bool value) { _skipFlag = value; }
378 CharacterMode characterMode()
const {
379 assert(_data != NULL);
380 return _data->characterMode;
382 void setCharacterMode(CharacterMode value) {
383 assert(_data != NULL);
384 _data->characterMode = value;
386 uint16 delayCtr()
const {
388 return _data->delayCtr;
390 void setDelayCtr(uint16 value) {
392 _data->delayCtr = value;
394 uint16 pauseCtr()
const {
396 return _data->pauseCtr;
398 void setPauseCtr(uint16 value) {
400 _data->pauseCtr = value;
402 VariantBool coveredFlag()
const {
404 return _data->coveredFlag;
406 void setCoveredFlag(VariantBool value) {
408 _data->coveredFlag = value;
410 uint16 useHotspotId()
const {
412 return _data->useHotspotId;
414 void setUseHotspotId(uint16 value) {
416 _data->useHotspotId = value;
418 uint16 talkGate()
const {
420 return _data->talkGate;
422 void setTalkGate(uint16 value) {
424 _data->talkGate = value;
426 uint16 supportValue()
const {
return _supportValue; }
427 void setSupportValue(uint16 value) { _supportValue = value; }
430 bool executeScript();
432 bool isRoomExit(uint16
id);
435 void walkTo(int16 endPosX, int16 endPosY, uint16 destHotspot = 0);
440 void faceHotspot(uint16 hotspotId);
441 void setRandomDest();
442 void setOccupied(
bool occupiedFlag);
444 void updateMovement();
445 void updateMovement2(CharacterMode value);
446 void resetPosition();
447 bool doorCloseCheck(uint16 doorId);
450 void doAction(Action action,
HotspotData *hotspot);
453 return _data->npcSchedule;
455 PathFinder &pathFinder() {
return _pathFinder; }
457 uint16 frameCtr()
const {
return _frameCtr; }
458 void setFrameCtr(uint16 value) { _frameCtr = value; }
459 void decrFrameCtr() {
if (_frameCtr > 0) --_frameCtr; }
460 uint8 actionCtr()
const {
462 return _data->actionCtr;
464 void setActionCtr(uint8 v) {
466 _data->actionCtr = v;
468 uint8 voiceCtr()
const {
return _voiceCtr; }
469 void setVoiceCtr(uint8 v) { _voiceCtr = v; }
473 void converse(uint16 destCharacterId, uint16 messageId,
bool srcStandStill =
false,
474 bool destStandStill =
false);
475 void showMessage(uint16 messageId, uint16 destCharacterId = NOONE_ID);
476 void scheduleConverse(uint16 destHotspot, uint16 messageId);
477 void handleTalkDialog();
Definition: hotspots.h:483
Definition: hotspots.h:172
Definition: res_struct.h:607
Direction
Definition: res_struct.h:251
Definition: res_struct.h:513
Definition: hotspots.h:37
Definition: hotspots.h:180
void push_front(const t_T &element)
Definition: list.h:135
Definition: res_struct.h:293
Definition: res_struct.h:459
Definition: hotspots.h:120
iterator begin()
Definition: list.h:227
Definition: res_struct.h:582
Definition: res_struct.h:641
iterator erase(iterator pos)
Definition: list.h:95
void push_back(const t_T &element)
Definition: list.h:140
bool empty() const
Definition: list.h:219
Definition: hotspots.h:52
Definition: hotspots.h:107