22 #ifndef LURE_RESSTRUCT_H 23 #define LURE_RESSTRUCT_H 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" 45 #define GET_NEXT(v, sc) v = (sc *)(((byte *)v) + kSizeOf##sc) 47 #define kSizeOfRoomExitJoinResource 13 48 #define kSizeOfHotspotResource 62 49 #define kSizeOfHotspotActionResource 3 52 #include "common/pack-start.h" 92 uint16 hotspotScriptOffset;
93 uint16 talkScriptOffset;
96 uint16 tickScriptOffset;
137 uint16 sequenceOffset;
138 int16 clippingXStart;
147 int16 xs, xe, ys, ye;
148 uint16 sequenceOffset;
151 int16 newRoomX, newRoomY;
156 int16 xs, xe, ys, ye;
164 uint16 destRoomNumber;
183 uint16 sequenceOffset;
194 uint16 responsesOffset;
198 uint16 preSequenceId;
200 uint16 postSequenceId;
215 #define ROOM_EXIT_COORDINATES_NUM_ENTRIES 6 216 #define ROOM_EXIT_COORDINATES_NUM_ROOMS 52 219 uint8 roomIndex[ROOM_EXIT_COORDINATES_NUM_ROOMS];
223 #define MAX_SCHEDULE_ENTRY_PARAMS 5 227 uint16 params[MAX_SCHEDULE_ENTRY_PARAMS];
236 enum SoundDescFlags {SF_IN_USE = 1, SF_RESTORE = 2};
248 #include "common/pack-end.h" 263 uint16 destRoomNumber;
271 bool insideRect(int16 xp, int16 yp);
273 int16 xs, xe, ys, ye;
274 uint16 sequenceOffset;
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 291 typedef uint16 RoomPathsDecompressedData[DECODED_PATHS_WIDTH * DECODED_PATHS_HEIGHT];
295 byte _data[ROOM_PATHS_HEIGHT * ROOM_PATHS_WIDTH];
300 void load(byte *srcData) {
301 memcpy(_data, srcData, ROOM_PATHS_SIZE);
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);
311 #define MAX_NUM_LAYERS 4 323 uint16 layers[MAX_NUM_LAYERS];
324 uint16 sequenceOffset;
325 int16 clippingXStart;
330 RoomExitHotspotList exitHotspots;
369 uint16 sequenceOffset;
377 uint16 getActionOffset(Action action);
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};
389 enum BlockedState {BS_NONE, BS_INITIAL, BS_FINAL};
391 enum VariantBool {VB_INITIAL, VB_FALSE, VB_TRUE};
393 enum CurrentAction {NO_ACTION, START_WALKING, DISPATCH_ACTION, EXEC_HOTSPOT_SCRIPT,
394 PROCESSING_PATH, WALKING};
402 uint16 _params[MAX_TELL_COMMANDS * 3];
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);
423 CurrentAction _action;
426 bool _dynamicSupportData;
433 if (_dynamicSupportData)
delete _supportData;
436 CurrentAction action()
const {
return _action; }
438 if (!_supportData)
error(
"Access made to non-defined action support record");
439 return *_supportData;
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; }
446 assert((newRec == NULL) || (newRec->parent() != NULL));
447 if (_dynamicSupportData) {
449 _dynamicSupportData =
false;
451 _supportData = newRec;
453 void setSupportData(uint16 entryId);
462 ActionsList _actions;
463 void validateStack() {
464 if (_actions.
size() > 20)
465 error(
"NPC character got an excessive number of pending actions");
470 bool isEmpty()
const {
return _actions.
begin() == _actions.
end(); }
471 void clear() { _actions.
clear(); }
478 CurrentAction action() {
return isEmpty() ? NO_ACTION : top().action(); }
479 void pop() { _actions.
erase(_actions.
begin()); }
480 int size()
const {
return _actions.
size(); }
483 void addBack(CurrentAction newAction, uint16 roomNum) {
491 void addBack(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
495 void addFront(CurrentAction newAction, uint16 roomNum) {
503 void addFront(Action newAction, uint16 roomNum, uint16 param1, uint16 param2) {
523 uint16 actionsOffset;
542 uint16 hotspotScriptOffset;
543 uint16 talkScriptOffset;
546 uint16 tickScriptOffset;
547 CharacterMode characterMode;
551 uint16 npcScheduleId;
555 BlockedState blockedState;
557 VariantBool coveredFlag;
558 uint16 talkMessageId;
560 uint16 talkDestCharacterId;
561 uint16 talkCountdown;
565 uint16 actionHotspotId;
567 uint16 scriptHotspotId;
569 void enable() { flags |= 0x80; }
570 void disable() { flags &= 0x7F; }
587 int16 xs, xe, ys, ye;
603 bool getFrame(uint16 currentFrame, int16 &xChange, int16 &yChange,
636 uint16 getEntry(
int index);
645 uint16 preSequenceId;
647 uint16 postSequenceId;
658 TalkEntryList entries;
659 TalkEntryList responses;
680 uint8 _roomIndex[ROOM_EXIT_COORDINATES_NUM_ROOMS];
702 uint16 getHotspot(uint16 roomNumber, uint8 hotspotIndexId);
712 static SequenceDelayData *load(uint32 delay, uint16 seqOffset,
bool canClearFlag);
715 uint16 sequenceOffset;
721 void add(uint16 delay, uint16 seqOffset,
bool canClear);
723 void clear(
bool forceClear =
false);
731 extern const int actionNumParams[NPC_JUMP_ADDRESS+1];
739 uint16 id() {
return _id; }
751 enum RandomActionType {REPEATABLE, REPEAT_ONCE, REPEAT_ONCE_DONE};
757 RandomActionType *_types;
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];
770 void setDone(
int index) {
771 assert((index >= 0) && (index < _numActions));
772 assert(_types[index] == REPEAT_ONCE);
773 _types[index] = REPEAT_ONCE_DONE;
800 void reset(uint16 hotspotId);
803 int check(uint16 charId,
int numImpinging, uint16 *impingingList);
811 #define NUM_SERVE_CUSTOMERS 4 813 enum BarmanGraphicType {BG_RANDOM = 0, BG_BEER = 1, BG_EXTRA1 = 2, BG_EXTRA2 = 3};
819 const uint16 *graphics[4];
830 BarEntry &getDetails(uint16 roomNumber);
835 enum BarmanAction {WALK_AROUND = 1, POLISH_BAR = 2, WAIT = 3, WAIT_DIALOG = 4, SERVE_BEER = 5};
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};
859 int count() {
return _entries.
size(); }
860 const char *getString(
int index) {
861 return _entries[index].c_str();
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; }
871 #define NUM_VALUE_FIELDS 90 875 CHARACTER_HOTSPOT_ID = 1,
877 ACTIVE_HOTSPOT_ID = 3,
889 ROOM_EXIT_ANIMATION = 76,
902 uint8 _textCtr1, _textCtr2;
905 uint16 _fieldList[NUM_VALUE_FIELDS];
906 bool isKnownField(uint16 fieldIndex);
910 uint16 getField(uint16 fieldIndex);
911 uint16 getField(FieldName fieldName);
913 void setField(uint16 fieldIndex, uint16 value);
914 void setField(FieldName fieldName, uint16 value);
915 int size() {
return NUM_VALUE_FIELDS; }
917 uint16 &numGroats() {
return _numGroats; }
918 uint8 &textCtr1() {
return _textCtr1; }
919 uint8 &textCtr2() {
return _textCtr2; }
920 uint8 &hdrFlagMask() {
return _hdrFlagMask; }
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: 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
size_type size() const
Definition: list.h:198
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: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: 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: res_struct.h:159
Definition: res_struct.h:60
Definition: res_struct.h:798
Definition: res_struct.h:719
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
void push_back(const t_T &element)
Definition: list.h:140
Definition: res_struct.h:268
Definition: res_struct.h:181
Definition: res_struct.h:203
Definition: res_struct.h:664
Definition: res_struct.h:313
Definition: res_struct.h:380
Definition: res_struct.h:815
Definition: res_struct.h:753