ScummVM API documentation
res_struct.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef LURE_RESSTRUCT_H
23 #define LURE_RESSTRUCT_H
24 
25 #include "lure/luredefs.h"
26 #include "common/rect.h"
27 #include "common/list.h"
28 #include "common/file.h"
29 #include "common/ptr.h"
30 #include "common/str-array.h"
31 #include "common/textconsole.h"
32 
33 namespace Lure {
34 
35 /*-------------------------------------------------------------------------*/
36 /* Structure definitions */
37 /* */
38 /*-------------------------------------------------------------------------*/
39 
40 /* HACK/FIXME: three structs are misaligned (at least on 4-byte aligned system,
41  should have more troubles with coming 64bit systems), GET_NEXT let us read
42  properly sequence of struct in lure.dat hardcoding size of struct.
43 */
44 
45 #define GET_NEXT(v, sc) v = (sc *)(((byte *)v) + kSizeOf##sc)
46 
47 #define kSizeOfRoomExitJoinResource 13
48 #define kSizeOfHotspotResource 62
49 #define kSizeOfHotspotActionResource 3
50 
51 
52 #include "common/pack-start.h" // START STRUCT PACKING
53 
55  uint16 id;
56  byte vMajor;
57  byte vMinor;
58 } PACKED_STRUCT;
59 
60 struct FileEntry {
61  uint16 id;
62  byte unused;
63  byte sizeExtension;
64  uint16 size;
65  uint16 offset;
66 } PACKED_STRUCT;
67 
69  uint16 hotspotId;
70  uint16 nameId;
71  uint16 descId;
72  uint16 descId2;
73  uint32 actions;
74  uint16 actionsOffset;
75  uint16 roomNumber;
76  byte layer;
77  byte scriptLoadFlag;
78  uint16 loadOffset;
79  uint16 startX;
80  uint16 startY;
81  uint16 width;
82  uint16 height;
83  uint16 widthCopy;
84  uint16 heightCopy;
85  uint16 yCorrection;
86  int16 walkX;
87  uint16 walkY;
88  int8 talkX;
89  int8 talkY;
90  uint16 colorOffset;
91  uint16 animRecordId;
92  uint16 hotspotScriptOffset;
93  uint16 talkScriptOffset;
94  uint16 tickProcId;
95  uint16 tickTimeout;
96  uint16 tickScriptOffset;
97  uint16 npcSchedule;
98  uint16 characterMode;
99  uint16 delayCtr;
100  byte flags2;
101  byte hdrFlags;
102 } PACKED_STRUCT;
103 
105  uint16 animRecordId;
106  uint16 animId;
107  uint16 flags;
108  uint16 upOffset;
109  uint16 downOffset;
110  uint16 leftOffset;
111  uint16 rightOffset;
112  uint8 upFrame;
113  uint8 downFrame;
114  uint8 leftFrame;
115  uint8 rightFrame;
116 } PACKED_STRUCT;
117 
119  uint16 frameNumber;
120  int16 xChange;
121  int16 yChange;
122 } PACKED_STRUCT;
123 
124 struct RoomRect {
125  int16 xs, xe;
126  int16 ys, ye;
127 } PACKED_STRUCT;
128 
129 struct RoomResource {
130  uint16 roomNumber;
131  uint8 hdrFlags;
132  uint8 unused;
133  uint32 actions;
134  uint16 descId;
135  uint16 numLayers;
136  uint16 layers[4];
137  uint16 sequenceOffset;
138  int16 clippingXStart;
139  int16 clippingXEnd;
140  uint8 areaFlag;
141  uint8 numExits;
142  uint32 exitTime;
143  RoomRect walkBounds;
144 } PACKED_STRUCT;
145 
147  int16 xs, xe, ys, ye;
148  uint16 sequenceOffset;
149  uint8 newRoom;
150  uint8 direction;
151  int16 newRoomX, newRoomY;
152 } PACKED_STRUCT;
153 
155  uint16 hotspotId;
156  int16 xs, xe, ys, ye;
157 } PACKED_STRUCT;
158 
160  uint16 hotspotId;
161  int16 xs, xe;
162  int16 ys, ye;
163  uint16 cursorNum;
164  uint16 destRoomNumber;
165 } PACKED_STRUCT;
166 
168  uint16 hotspot1Id;
169  byte h1CurrentFrame;
170  byte h1DestFrame;
171  uint8 h1OpenSound;
172  uint8 h1CloseSound;
173  uint16 hotspot2Id;
174  byte h2CurrentFrame;
175  byte h2DestFrame;
176  uint8 h2OpenSound;
177  uint8 h2CloseSound;
178  byte blocked;
179 } PACKED_STRUCT;
180 
182  byte action;
183  uint16 sequenceOffset;
184 } PACKED_STRUCT;
185 
187  uint16 hotspotId;
188  uint16 offset;
189 } PACKED_STRUCT;
190 
192  uint16 recordId;
193  uint16 listOffset;
194  uint16 responsesOffset;
195 } PACKED_STRUCT;
196 
198  uint16 preSequenceId;
199  uint16 descId;
200  uint16 postSequenceId;
201 } PACKED_STRUCT;
202 
204  uint16 sequenceId1;
205  uint16 sequenceId2;
206  uint16 sequenceId3;
207 } PACKED_STRUCT;
208 
210  int16 x;
211  int16 y;
212  uint16 roomNumber;
213 } PACKED_STRUCT;
214 
215 #define ROOM_EXIT_COORDINATES_NUM_ENTRIES 6
216 #define ROOM_EXIT_COORDINATES_NUM_ROOMS 52
217 
219  uint8 roomIndex[ROOM_EXIT_COORDINATES_NUM_ROOMS];
220  RoomExitCoordinateResource entries[ROOM_EXIT_COORDINATES_NUM_ENTRIES];
221 } PACKED_STRUCT;
222 
223 #define MAX_SCHEDULE_ENTRY_PARAMS 5
224 
226  uint16 action;
227  uint16 params[MAX_SCHEDULE_ENTRY_PARAMS];
228 } PACKED_STRUCT;
229 
231  uint8 roomNumber;
232  uint8 hotspotIndex;
233  uint16 hotspotId;
234 } PACKED_STRUCT;
235 
236 enum SoundDescFlags {SF_IN_USE = 1, SF_RESTORE = 2};
237 
238 // In desc entry, numChannels: bits 0-1 # roland, bits 2-3 #adlib, bits 4-5 #internal
239 
241  uint8 soundNumber;
242  uint8 channel;
243  uint8 numChannels;
244  uint8 flags;
245  uint8 volume;
246 } PACKED_STRUCT;
247 
248 #include "common/pack-end.h" // END STRUCT PACKING
249 
251 enum Direction {UP, DOWN, LEFT, RIGHT, NO_DIRECTION};
252 
253 // Support classes to hold loaded resources
254 
256 public:
258 
259  uint16 hotspotId;
260  int16 xs, xe;
261  int16 ys, ye;
262  uint16 cursorNum;
263  uint16 destRoomNumber;
264 };
265 
267 
269 public:
271  bool insideRect(int16 xp, int16 yp);
272 
273  int16 xs, xe, ys, ye;
274  uint16 sequenceOffset;
275  Direction direction;
276  uint8 roomNumber;
277  uint16 x, y;
278 };
279 
280 class RoomExitList: public Common::List<Common::SharedPtr<RoomExitData> > {
281 public:
282  RoomExitData *checkExits(int16 xp, int16 yp);
283 };
284 
285 #define ROOM_PATHS_WIDTH 40
286 #define ROOM_PATHS_HEIGHT 24
287 #define ROOM_PATHS_SIZE (ROOM_PATHS_WIDTH / 8 * ROOM_PATHS_HEIGHT)
288 #define DECODED_PATHS_WIDTH 42
289 #define DECODED_PATHS_HEIGHT 26
290 
291 typedef uint16 RoomPathsDecompressedData[DECODED_PATHS_WIDTH * DECODED_PATHS_HEIGHT];
292 
294 private:
295  byte _data[ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH];
296 public:
297  RoomPathsData() {}
298  RoomPathsData(byte *srcData) { load(srcData); }
299 
300  void load(byte *srcData) {
301  memcpy(_data, srcData, ROOM_PATHS_SIZE);
302  }
303  const byte *data() const { return _data; }
304  bool isOccupied(int x, int y);
305  bool isOccupied(int x, int y, int width);
306  void setOccupied(int x, int y, int width);
307  void clearOccupied(int x, int y, int width);
308  void decompress(RoomPathsDecompressedData &dataOut, int characterWidth);
309 };
310 
311 #define MAX_NUM_LAYERS 4
312 
313 class RoomData {
314 public:
315  RoomData(RoomResource *rec, MemoryBlock *pathData);
316 
317  uint16 roomNumber;
318  uint8 hdrFlags;
319  uint8 flags;
320  uint32 actions;
321  uint16 descId;
322  uint16 numLayers;
323  uint16 layers[MAX_NUM_LAYERS];
324  uint16 sequenceOffset;
325  int16 clippingXStart;
326  int16 clippingXEnd;
327  uint8 areaFlag;
328  uint32 exitTime;
329  Common::Rect walkBounds;
330  RoomExitHotspotList exitHotspots;
331  RoomExitList exits;
332  RoomPathsData paths;
333 };
334 
335 class RoomDataList: public Common::List<Common::SharedPtr<RoomData> > {
336 public:
337  void saveToStream(Common::WriteStream *stream) const;
338  void loadFromStream(Common::ReadStream *stream);
339 };
340 
342  uint16 hotspotId;
343  byte currentFrame;
344  byte destFrame;
345  uint8 openSound;
346  uint8 closeSound;
347 };
348 
350 public:
352 
353  RoomExitJoinStruct hotspots[2];
354 
355  byte blocked;
356 };
357 
358 class RoomExitJoinList: public Common::List<Common::SharedPtr<RoomExitJoinData> > {
359 public:
360  void saveToStream(Common::WriteStream *stream) const;
361  void loadFromStream(Common::ReadStream *stream);
362 };
363 
365 public:
367 
368  Action action;
369  uint16 sequenceOffset;
370 };
371 
372 class HotspotActionList: public Common::List<Common::SharedPtr<HotspotActionData> > {
373 public:
374  uint16 recordId;
375 
376  HotspotActionList(uint16 id, byte *data);
377  uint16 getActionOffset(Action action);
378 };
379 
380 class HotspotActionSet: public Common::List<Common::SharedPtr<HotspotActionList> > {
381 public:
382  HotspotActionList *getActions(uint16 recordId);
383 };
384 
385 enum CharacterMode {CHARMODE_NONE, CHARMODE_HESITATE, CHARMODE_IDLE, CHARMODE_PAUSED,
386  CHARMODE_WAIT_FOR_PLAYER, CHARMODE_CONVERSING, CHARMODE_PLAYER_WAIT,
387  CHARMODE_WAIT_FOR_INTERACT, CHARMODE_INTERACTING, CHARMODE_SPECIAL_PLAYER};
388 
389 enum BlockedState {BS_NONE, BS_INITIAL, BS_FINAL};
390 
391 enum VariantBool {VB_INITIAL, VB_FALSE, VB_TRUE};
392 
393 enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT,
394  PROCESSING_PATH, WALKING};
395 
397 
399 private:
400  CharacterScheduleSet *_parent;
401  Action _action;
402  uint16 _params[MAX_TELL_COMMANDS * 3];
403  int _numParams;
404 public:
405  CharacterScheduleEntry() { _action = NONE; _parent = NULL; }
406  CharacterScheduleEntry(int theAction, ...);
410 
411  Action action() { return _action; }
412  int numParams() { return _numParams; }
413  uint16 param(int index);
414  void setDetails(int theAction, ...);
415  void setDetails2(Action theAction, int numParamEntries, uint16 *paramList);
416  CharacterScheduleEntry *next();
417  CharacterScheduleSet *parent() { return _parent; }
418  uint16 id();
419 };
420 
422 private:
423  CurrentAction _action;
424  CharacterScheduleEntry *_supportData;
425  uint16 _roomNumber;
426  bool _dynamicSupportData;
427 public:
428  CurrentActionEntry(CurrentAction newAction, uint16 roomNum);
429  CurrentActionEntry(CurrentAction newAction, CharacterScheduleEntry *data, uint16 roomNum);
430  CurrentActionEntry(Action newAction, uint16 roomNum, uint16 param1, uint16 param2);
432  virtual ~CurrentActionEntry() {
433  if (_dynamicSupportData) delete _supportData;
434  }
435 
436  CurrentAction action() const { return _action; }
437  CharacterScheduleEntry &supportData() const {
438  if (!_supportData) error("Access made to non-defined action support record");
439  return *_supportData;
440  }
441  bool hasSupportData() const { return _supportData != NULL; }
442  uint16 roomNumber() const { return _roomNumber; }
443  void setAction(CurrentAction newAction) { _action = newAction; }
444  void setRoomNumber(uint16 roomNum) { _roomNumber = roomNum; }
445  void setSupportData(CharacterScheduleEntry *newRec) {
446  assert((newRec == NULL) || (newRec->parent() != NULL));
447  if (_dynamicSupportData) {
448  delete _supportData;
449  _dynamicSupportData = false;
450  }
451  _supportData = newRec;
452  }
453  void setSupportData(uint16 entryId);
454 
455  void saveToStream(Common::WriteStream *stream) const;
456  static CurrentActionEntry *loadFromStream(Common::ReadStream *stream);
457 };
458 
460 private:
462  ActionsList _actions;
463  void validateStack() {
464  if (_actions.size() > 20)
465  error("NPC character got an excessive number of pending actions");
466  }
467 public:
468  CurrentActionStack() { _actions.clear(); }
469 
470  bool isEmpty() const { return _actions.begin() == _actions.end(); }
471  void clear() { _actions.clear(); }
472  CurrentActionEntry &top() { return **_actions.begin(); }
473  CurrentActionEntry &bottom() {
474  ActionsList::iterator i = _actions.end();
475  --i;
476  return **i;
477  }
478  CurrentAction action() { return isEmpty() ? NO_ACTION : top().action(); }
479  void pop() { _actions.erase(_actions.begin()); }
480  int size() const { return _actions.size(); }
481  Common::String getDebugInfo() const;
482 
483  void addBack(CurrentAction newAction, uint16 roomNum) {
484  _actions.push_back(ActionsList::value_type(new CurrentActionEntry(newAction, roomNum)));
485  validateStack();
486  }
487  void addBack(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
488  _actions.push_back(ActionsList::value_type(new CurrentActionEntry(newAction, rec, roomNum)));
489  validateStack();
490  }
491  void addBack(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
492  _actions.push_back(ActionsList::value_type(new CurrentActionEntry(newAction, roomNum, param1, param2)));
493  validateStack();
494  }
495  void addFront(CurrentAction newAction, uint16 roomNum) {
496  _actions.push_front(ActionsList::value_type(new CurrentActionEntry(newAction, roomNum)));
497  validateStack();
498  }
499  void addFront(CurrentAction newAction, CharacterScheduleEntry *rec, uint16 roomNum) {
500  _actions.push_front(ActionsList::value_type(new CurrentActionEntry(newAction, rec, roomNum)));
501  validateStack();
502  }
503  void addFront(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
504  _actions.push_front(ActionsList::value_type(new CurrentActionEntry(newAction, roomNum, param1, param2)));
505  validateStack();
506  }
507 
508  void saveToStream(Common::WriteStream *stream) const;
509  void loadFromStream(Common::ReadStream *stream);
510  void copyFrom(CurrentActionStack &stack);
511 };
512 
513 class HotspotData {
514 public:
515  CurrentActionStack npcSchedule;
517 
518  uint16 hotspotId;
519  uint16 nameId;
520  uint16 descId;
521  uint16 descId2;
522  uint32 actions;
523  uint16 actionsOffset;
524  byte flags;
525  uint16 roomNumber;
526  byte layer;
527  byte scriptLoadFlag;
528  uint16 loadOffset;
529  int16 startX;
530  int16 startY;
531  uint16 width;
532  uint16 height;
533  uint16 widthCopy;
534  uint16 heightCopy;
535  uint16 yCorrection;
536  int16 walkX;
537  uint16 walkY;
538  int8 talkX;
539  int8 talkY;
540  uint16 colorOffset;
541  uint16 animRecordId;
542  uint16 hotspotScriptOffset;
543  uint16 talkScriptOffset;
544  uint16 tickProcId;
545  uint16 tickTimeout;
546  uint16 tickScriptOffset;
547  CharacterMode characterMode;
548  uint16 delayCtr;
549  uint8 flags2;
550  uint8 headerFlags;
551  uint16 npcScheduleId;
552 
553  // Runtime fields
554  uint16 actionCtr;
555  BlockedState blockedState;
556  bool blockedFlag;
557  VariantBool coveredFlag;
558  uint16 talkMessageId;
559  uint16 talkerId;
560  uint16 talkDestCharacterId;
561  uint16 talkCountdown;
562  uint16 pauseCtr;
563  uint16 useHotspotId;
564  uint16 talkGate;
565  uint16 actionHotspotId;
566  uint16 talkOverride;
567  uint16 scriptHotspotId;
568 
569  void enable() { flags |= 0x80; }
570  void disable() { flags &= 0x7F; }
571  Direction nonVisualDirection() { return (Direction) scriptLoadFlag; }
572  void saveToStream(Common::WriteStream *stream) const;
573  void loadFromStream(Common::ReadStream *stream);
574 };
575 
576 class HotspotDataList: public Common::List<Common::SharedPtr<HotspotData> > {
577 public:
578  void saveToStream(Common::WriteStream *stream) const;
579  void loadFromStream(Common::ReadStream *stream);
580 };
581 
583 public:
585 
586  uint16 hotspotId;
587  int16 xs, xe, ys, ye;
588 };
589 
591 
593 public:
595 
596  uint16 frameNumber;
597  int16 xChange;
598  int16 yChange;
599 };
600 
601 class MovementDataList: public Common::List<Common::SharedPtr<MovementData> > {
602 public:
603  bool getFrame(uint16 currentFrame, int16 &xChange, int16 &yChange,
604  uint16 &nextFrame);
605 };
606 
608 public:
610 
611  uint16 animRecordId;
612  uint16 animId;
613  uint16 flags;
614  uint8 upFrame;
615  uint8 downFrame;
616  uint8 leftFrame;
617  uint8 rightFrame;
618 
619  MovementDataList leftFrames, rightFrames;
620  MovementDataList upFrames, downFrames;
621 };
622 
624 
625 // Talk header list
626 
628 private:
629  uint16 *_data;
630  int _numEntries;
631 public:
632  TalkHeaderData(uint16 charId, uint16 *entries);
633  ~TalkHeaderData();
634 
635  uint16 characterId;
636  uint16 getEntry(int index);
637 };
638 
640 
642 public:
644 
645  uint16 preSequenceId;
646  uint16 descId;
647  uint16 postSequenceId;
648 };
649 
651 
652 class TalkData {
653 public:
654  TalkData(uint16 id);
655  ~TalkData();
656 
657  uint16 recordId;
658  TalkEntryList entries;
659  TalkEntryList responses;
660 
661  TalkEntryData *getResponse(int index);
662 };
663 
664 class TalkDataList: public Common::List<Common::SharedPtr<TalkData> > {
665 public:
666  void saveToStream(Common::WriteStream *stream) const;
667  void loadFromStream(Common::ReadStream *stream);
668 };
669 
671  int16 x;
672  int16 y;
673  uint16 roomNumber;
674  byte hotspotIndexId;
675 };
676 
678 private:
679  RoomExitCoordinateData _entries[ROOM_EXIT_COORDINATES_NUM_ENTRIES];
680  uint8 _roomIndex[ROOM_EXIT_COORDINATES_NUM_ROOMS];
681 public:
683  RoomExitCoordinateData &getData(uint16 destRoomNumber);
684 };
685 
686 class RoomExitCoordinatesList: public Common::List<Common::SharedPtr<RoomExitCoordinates> > {
687 public:
688  RoomExitCoordinates &getEntry(uint16 roomNumber);
689 };
690 
692 public:
694 
695  uint16 roomNumber;
696  uint8 hotspotIndex;
697  uint16 hotspotId;
698 };
699 
700 class RoomExitIndexedHotspotList: public Common::List<Common::SharedPtr<RoomExitIndexedHotspotData> > {
701 public:
702  uint16 getHotspot(uint16 roomNumber, uint8 hotspotIndexId);
703 };
704 
705 // The following classes hold any sequence offsets that are being delayed
706 
708 private:
709  SequenceDelayData() {}
710 public:
711  SequenceDelayData(uint16 delay, uint16 seqOffset, bool canClearFlag);
712  static SequenceDelayData *load(uint32 delay, uint16 seqOffset, bool canClearFlag);
713 
714  uint32 timeoutCtr;
715  uint16 sequenceOffset;
716  bool canClear;
717 };
718 
719 class SequenceDelayList: public Common::List<Common::SharedPtr<SequenceDelayData> > {
720 public:
721  void add(uint16 delay, uint16 seqOffset, bool canClear);
722  void tick();
723  void clear(bool forceClear = false);
724 
725  void saveToStream(Common::WriteStream *stream) const;
726  void loadFromStream(Common::ReadStream *stream);
727 };
728 
729 // The following classes holds the data for NPC schedules
730 
731 extern const int actionNumParams[NPC_JUMP_ADDRESS+1];
732 
733 class CharacterScheduleSet: public Common::List<Common::SharedPtr<CharacterScheduleEntry> > {
734 private:
735  uint16 _id;
736 public:
738  uint16 getId(CharacterScheduleEntry *rec);
739  uint16 id() { return _id; }
740 };
741 
742 class CharacterScheduleList: public Common::List<Common::SharedPtr<CharacterScheduleSet> > {
743 public:
744  CharacterScheduleEntry *getEntry(uint16 id, CharacterScheduleSet *currentSet = NULL);
745 };
746 
748 
749 // The follow classes are used to store the NPC schedule Ids for the random actions a follower can do in each room
750 
751 enum RandomActionType {REPEATABLE, REPEAT_ONCE, REPEAT_ONCE_DONE};
752 
754 private:
755  uint16 _roomNumber;
756  int _numActions;
757  RandomActionType *_types;
758  uint16 *_ids;
759 public:
760  RandomActionSet(uint16 *&offset);
761  ~RandomActionSet();
762 
763  uint16 roomNumber() const { return _roomNumber; }
764  int numActions() const { return _numActions; }
765  void getEntry(int index, RandomActionType &actionType, uint16 &id) {
766  assert((index >= 0) && (index < _numActions));
767  actionType = _types[index];
768  id = _ids[index];
769  }
770  void setDone(int index) {
771  assert((index >= 0) && (index < _numActions));
772  assert(_types[index] == REPEAT_ONCE);
773  _types[index] = REPEAT_ONCE_DONE;
774  }
775  void saveToStream(Common::WriteStream *stream) const;
776  void loadFromStream(Common::ReadStream *stream);
777 };
778 
779 class RandomActionList: public Common::List<Common::SharedPtr<RandomActionSet> > {
780 public:
781  RandomActionSet *getRoom(uint16 roomNumber);
782  void saveToStream(Common::WriteStream *stream) const;
783  void loadFromStream(Common::ReadStream *stream);
784 };
785 
787 public:
788  PausedCharacter(uint16 SrcCharId, uint16 DestCharId);
789 
790  uint16 srcCharId;
791  uint16 destCharId;
792  uint16 counter;
793  HotspotData *charHotspot;
794 };
795 
796 class Hotspot;
797 
798 class PausedCharacterList: public Common::List<Common::SharedPtr<PausedCharacter> > {
799 public:
800  void reset(uint16 hotspotId);
801  void countdown();
802  void scan(Hotspot &h);
803  int check(uint16 charId, int numImpinging, uint16 *impingingList);
804 };
805 
806 struct ServeEntry {
807  uint16 hotspotId;
808  uint8 serveFlags;
809 };
810 
811 #define NUM_SERVE_CUSTOMERS 4
812 
813 enum BarmanGraphicType {BG_RANDOM = 0, BG_BEER = 1, BG_EXTRA1 = 2, BG_EXTRA2 = 3};
814 
815 struct BarEntry {
816  uint16 roomNumber;
817  uint16 barmanId;
818  ServeEntry customers[NUM_SERVE_CUSTOMERS];
819  const uint16 *graphics[4];
820  uint16 gridLine;
821  ServeEntry *currentCustomer;
822 };
823 
824 class BarmanLists {
825  BarEntry _barList[3];
826 public:
827  BarmanLists();
828 
829  void reset();
830  BarEntry &getDetails(uint16 roomNumber);
831  void saveToStream(Common::WriteStream *stream) const;
832  void loadFromStream(Common::ReadStream *stream);
833 };
834 
835 enum BarmanAction {WALK_AROUND = 1, POLISH_BAR = 2, WAIT = 3, WAIT_DIALOG = 4, SERVE_BEER = 5};
836 
838  uint8 srcRoom;
839  uint8 destRoom;
840 };
841 
842 extern const RoomTranslationRecord roomTranslations[];
843 
844 enum StringEnum {S_CREDITS = 25, S_RESTART_GAME = 26, S_SAVE_GAME = 27, S_RESTORE_GAME = 28,
845  S_QUIT = 29, S_FAST_TEXT = 30, S_SLOW_TEXT = 31, S_SOUND_ON = 32, S_SOUND_OFF = 33,
846  S_ACTION_NOTHING = 34, S_FOR = 35, S_TO = 36, S_ON = 37, S_AND_THEN = 38, S_FINISH = 39,
847  S_CONFIRM_YN = 40, S_YOU_ARE_CARRYING = 41, S_INV_NOTHING = 42, S_YOU_HAVE = 43,
848  S_GROAT = 44, S_GROATS = 45,
849  S_ARTICLE_LIST = 46};
850 
851 class StringList {
852 private:
853  Common::StringArray _entries;
854 public:
855  StringList() {}
856 
857  void load(MemoryBlock *data);
858  void clear();
859  int count() { return _entries.size(); }
860  const char *getString(int index) {
861  return _entries[index].c_str();
862  }
863  const char *getString(Action action) { return getString((int)action - 1); }
864  const char *getString(StringEnum sEnum) { return getString((int)sEnum); }
865  void setString(Action action, const Common::String &s) { _entries[(int)action - 1] = s; }
866 };
867 
868 // The following class holds the field list used by the script engine as
869 // well as miscellaneous fields used by the game.
870 
871 #define NUM_VALUE_FIELDS 90
872 
873 enum FieldName {
874  ROOM_NUMBER = 0,
875  CHARACTER_HOTSPOT_ID = 1,
876  USE_HOTSPOT_ID = 2,
877  ACTIVE_HOTSPOT_ID = 3,
878  SEQUENCE_RESULT = 4,
879  GENERAL = 5,
880  GIVE_TALK_INDEX = 6,
881  NEW_ROOM_NUMBER = 7,
882  OLD_ROOM_NUMBER = 8,
883  CELL_DOOR_STATE = 9,
884  TORCH_HIDE = 10,
885  PRISONER_DEAD = 15,
886  BOTTLE_FILLED = 18,
887  TALK_INDEX = 19,
888  SACK_CUT = 20,
889  ROOM_EXIT_ANIMATION = 76,
890  AREA_FLAG = 82
891 };
892 
894  Common::Point position;
895  uint16 roomNumber;
896 };
897 
899 private:
900  uint16 _numGroats;
901  PlayerNewPosition _playerNewPos;
902  uint8 _textCtr1, _textCtr2; // originally 2 2-bit counters
903  uint8 _hdrFlagMask;
904 
905  uint16 _fieldList[NUM_VALUE_FIELDS];
906  bool isKnownField(uint16 fieldIndex);
907 public:
908  ValueTableData();
909  void reset();
910  uint16 getField(uint16 fieldIndex);
911  uint16 getField(FieldName fieldName);
912 
913  void setField(uint16 fieldIndex, uint16 value);
914  void setField(FieldName fieldName, uint16 value);
915  int size() { return NUM_VALUE_FIELDS; }
916 
917  uint16 &numGroats() { return _numGroats; }
918  uint8 &textCtr1() { return _textCtr1; }
919  uint8 &textCtr2() { return _textCtr2; }
920  uint8 &hdrFlagMask() { return _hdrFlagMask; }
921  PlayerNewPosition &playerNewPos() { return _playerNewPos; }
922 
923  void saveToStream(Common::WriteStream *stream) const;
924  void loadFromStream(Common::ReadStream *stream);
925 };
926 
927 } // End of namespace Lure
928 
929 #endif
Definition: str.h:59
Definition: res_struct.h:592
Definition: res_struct.h:421
Definition: res_struct.h:255
Definition: res_struct.h:851
Definition: res_struct.h:68
Definition: res_struct.h:652
Definition: stream.h:77
Definition: res_struct.h:837
Definition: res_struct.h:786
Definition: res_struct.h:707
Definition: res_struct.h:209
Definition: res_struct.h:341
Definition: res_struct.h:607
Definition: res_struct.h:118
Definition: res_struct.h:335
Definition: res_struct.h:677
Direction
Definition: res_struct.h:251
Definition: list.h:44
size_type size() const
Definition: list.h:198
Definition: rect.h:144
Definition: res_struct.h:513
Definition: res_struct.h:806
Definition: hotspots.h:180
Definition: res_struct.h:197
void push_front(const t_T &element)
Definition: list.h:135
Definition: res_struct.h:893
Definition: res_struct.h:898
Definition: res_struct.h:700
Definition: res_struct.h:293
Definition: res_struct.h:627
Definition: res_struct.h:686
Definition: res_struct.h:358
Definition: res_struct.h:601
Definition: res_struct.h:691
Definition: res_struct.h:459
Definition: res_struct.h:576
Definition: res_struct.h:104
Definition: res_struct.h:280
Definition: res_struct.h:372
iterator end()
Definition: list.h:240
Definition: res_struct.h:129
Definition: res_struct.h:154
iterator begin()
Definition: list.h:227
Definition: res_struct.h:240
Definition: res_struct.h:54
Definition: res_struct.h:779
Definition: res_struct.h:218
Definition: res_struct.h:225
Definition: rect.h:45
Definition: res_struct.h:349
Definition: res_struct.h:398
Definition: res_struct.h:824
void clear()
Definition: list.h:206
Definition: res_struct.h:582
Definition: res_struct.h:167
size_type size() const
Definition: array.h:315
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: res_struct.h:742
Definition: res_struct.h:641
Definition: res_struct.h:146
Definition: res_struct.h:364
Definition: res_struct.h:670
Definition: stream.h:385
Definition: res_struct.h:159
Definition: res_struct.h:60
Definition: res_struct.h:798
Definition: res_struct.h:719
Definition: res_struct.h:186
Definition: list_intern.h:51
iterator erase(iterator pos)
Definition: list.h:95
Definition: res_struct.h:230
Definition: res_struct.h:733
Definition: res_struct.h:124
Definition: animseq.h:27
Definition: ptr.h:159
void push_back(const t_T &element)
Definition: list.h:140
Definition: memory.h:31
Definition: res_struct.h:268
Definition: res_struct.h:181
Definition: res_struct.h:203
Definition: res_struct.h:664
Definition: res_struct.h:191
Definition: res_struct.h:313
Definition: res_struct.h:380
Definition: res_struct.h:815
Definition: res_struct.h:753