diff options
-rw-r--r-- | engines/lure/res_struct.cpp | 33 | ||||
-rw-r--r-- | engines/lure/res_struct.h | 37 |
2 files changed, 18 insertions, 52 deletions
diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 75cb27f9c5..115cadbad8 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -118,10 +118,9 @@ bool RoomPathsData::isOccupied(int x, int y) { } void RoomPathsData::setOccupied(int x, int y, int width) { - if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (x >= ROOM_PATHS_HEIGHT)) + if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (y >= ROOM_PATHS_HEIGHT)) return; - - byte *p = &_data[y * 5 + (x % 8)]; + byte *p = &_data[y * 5 + (x / 8)]; byte bitMask = 0x80 >> (x % 8); for (int bitCtr = 0; bitCtr < width; ++bitCtr) { @@ -135,14 +134,13 @@ void RoomPathsData::setOccupied(int x, int y, int width) { } void RoomPathsData::clearOccupied(int x, int y, int width) { - if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (x >= ROOM_PATHS_HEIGHT)) + if ((x < 0) || (y < 0) || (x >= ROOM_PATHS_WIDTH) || (y >= ROOM_PATHS_HEIGHT)) return; - - byte *p = &_data[y * 5 + (x % 8)]; + byte *p = &_data[y * 5 + (x / 8)]; byte bitMask = 0x80 >> (x % 8); for (int bitCtr = 0; bitCtr < width; ++bitCtr) { - *p &= !bitMask; + *p &= ~bitMask; bitMask >>= 1; if (bitMask == 0) { ++p; @@ -274,6 +272,8 @@ HotspotData::HotspotData(HotspotResource *rec) { widthCopy = READ_LE_UINT16(&rec->widthCopy); heightCopy = READ_LE_UINT16(&rec->heightCopy); yCorrection = READ_LE_UINT16(&rec->yCorrection); + walkX = READ_LE_INT16(&rec->walkX); + walkY = READ_LE_UINT16(&rec->walkY); talkX = rec->talkX; talkY = rec->talkY; colourOffset = READ_LE_UINT16(&rec->colourOffset); @@ -481,25 +481,6 @@ void SequenceDelayList::tick() { } } -// The following class holds the proximity data for hotspots that is used -// to determine whether a character needs to walk to a hotspot or not - -HotspotProximityData::HotspotProximityData(HotspotProximityResource *rec) { - hotspotId = FROM_LE_16(rec->hotspotId); - x = FROM_LE_16(rec->x); - y = FROM_LE_16(rec->y); -} - -HotspotProximityData *HotspotProximityList::getHotspot(uint16 hotspotId) { - iterator i; - for (i = begin(); i != end(); ++i) { - HotspotProximityData *rec = *i; - if (rec->hotspotId == hotspotId) return rec; - } - - return NULL; -} - // Field list and miscellaneous variables ValueTableData::ValueTableData() { diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index d8334c8c1f..938040002f 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -73,6 +73,8 @@ struct HotspotResource { uint16 widthCopy; uint16 heightCopy; uint16 yCorrection; + int16 walkX; + uint16 walkY; int8 talkX; int8 talkY; uint16 colourOffset; @@ -177,12 +179,6 @@ struct TalkResponseResource { uint16 sequenceId3; } GCC_PACK; -struct HotspotProximityResource { - uint16 hotspotId; - uint16 x; - uint16 y; -} GCC_PACK; - struct RoomExitCoordinateResource { int16 x; int16 y; @@ -378,6 +374,8 @@ public: uint16 widthCopy; uint16 heightCopy; uint16 yCorrection; + int16 walkX; + uint16 walkY; int8 talkX; int8 talkY; uint16 colourOffset; @@ -385,9 +383,10 @@ public: uint16 sequenceOffset; uint16 tickProcOffset; uint16 tickTimeout; - + void enable() { flags |= 0x80; } void disable() { flags &= 0x7F; } + Direction nonVisualDirection() { return (Direction) scriptLoadFlag; } }; typedef ManagedList<HotspotData *> HotspotDataList; @@ -514,25 +513,6 @@ public: void tick(); }; -class HotspotProximityData { -public: - HotspotProximityData(HotspotProximityResource *rec); - - uint16 hotspotId; - uint16 x; - uint16 y; -}; - -class HotspotProximityList: public ManagedList<HotspotProximityData *> { -public: - HotspotProximityData *getHotspot(uint16 hotspotId); -}; - -struct PlayerNewPosition { - Point position; - uint16 roomNumber; -}; - // The following class holds the field list used by the script engine as // well as miscellaneous fields used by the game. @@ -555,6 +535,11 @@ enum FieldName { SACK_CUT = 20 }; +struct PlayerNewPosition { + Point position; + uint16 roomNumber; +}; + class ValueTableData { private: uint16 _numGroats; |