From 9a9d0cb0a5fbbce0f59d0b7587067f9e08cd98e2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 12 Aug 2007 11:16:43 +0000 Subject: Cleaned up structures for room exit joins svn-id: r28550 --- engines/lure/res.cpp | 2 +- engines/lure/res_struct.cpp | 46 ++++++++++++++++++++++++--------------------- engines/lure/res_struct.h | 36 +++++++++++++++++++++++------------ 3 files changed, 50 insertions(+), 34 deletions(-) (limited to 'engines/lure') diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp index 4da38eddc7..a2f2530248 100644 --- a/engines/lure/res.cpp +++ b/engines/lure/res.cpp @@ -341,7 +341,7 @@ RoomExitJoinData *Resources::getExitJoin(uint16 hotspotId) { for (i = _exitJoins.begin(); i != _exitJoins.end(); ++i) { RoomExitJoinData *rec = *i; - if ((rec->hotspot1Id == hotspotId) || (rec->hotspot2Id == hotspotId)) + if ((rec->hotspots[0].hotspotId == hotspotId) || (rec->hotspots[1].hotspotId == hotspotId)) return rec; } diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 12cf61a58a..3db92d9c56 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -308,28 +308,29 @@ void RoomDataList::loadFromStream(ReadStream *stream) { // Room exit joins class RoomExitJoinData::RoomExitJoinData(RoomExitJoinResource *rec) { - hotspot1Id = FROM_LE_16(rec->hotspot1Id); - h1CurrentFrame = rec->h1CurrentFrame; - h1DestFrame = rec->h1DestFrame; - h1OpenSound = rec->h1OpenSound; - h1CloseSound = rec->h1CloseSound; - hotspot2Id = FROM_LE_16(rec->hotspot2Id); - h2CurrentFrame = rec->h2CurrentFrame; - h2DestFrame = rec->h2DestFrame; - h2OpenSound = rec->h2OpenSound; - h2CloseSound = rec->h2CloseSound; + hotspots[0].hotspotId = FROM_LE_16(rec->hotspot1Id); + hotspots[0].currentFrame = rec->h1CurrentFrame; + hotspots[0].destFrame = rec->h1DestFrame; + hotspots[0].openSound = rec->h1OpenSound; + hotspots[0].closeSound = rec->h1CloseSound; + hotspots[1].hotspotId = FROM_LE_16(rec->hotspot2Id); + hotspots[1].currentFrame = rec->h2CurrentFrame; + hotspots[1].destFrame = rec->h2DestFrame; + hotspots[1].openSound = rec->h2OpenSound; + hotspots[1].closeSound = rec->h2CloseSound; blocked = rec->blocked; } void RoomExitJoinList::saveToStream(WriteStream *stream) { for (RoomExitJoinList::iterator i = begin(); i != end(); ++i) { RoomExitJoinData *rec = *i; - stream->writeUint16LE(rec->hotspot1Id); - stream->writeUint16LE(rec->hotspot2Id); - stream->writeByte(rec->h1CurrentFrame); - stream->writeByte(rec->h1DestFrame); - stream->writeByte(rec->h2CurrentFrame); - stream->writeByte(rec->h2DestFrame); + + stream->writeUint16LE(rec->hotspots[0].hotspotId); + stream->writeUint16LE(rec->hotspots[1].hotspotId); + stream->writeByte(rec->hotspots[0].currentFrame); + stream->writeByte(rec->hotspots[0].destFrame); + stream->writeByte(rec->hotspots[1].currentFrame); + stream->writeByte(rec->hotspots[1].destFrame); stream->writeByte(rec->blocked); } @@ -345,13 +346,14 @@ void RoomExitJoinList::loadFromStream(ReadStream *stream) { if (hotspot1Id == 0xffff) error("Invalid room exit join list"); uint16 hotspot2Id = stream->readUint16LE(); - if ((rec->hotspot1Id != hotspot1Id) || (rec->hotspot2Id != hotspot2Id)) + if ((rec->hotspots[0].hotspotId != hotspot1Id) || + (rec->hotspots[1].hotspotId != hotspot2Id)) break; - rec->h1CurrentFrame = stream->readByte(); - rec->h1DestFrame = stream->readByte(); - rec->h2CurrentFrame = stream->readByte(); - rec->h2DestFrame = stream->readByte(); + rec->hotspots[0].currentFrame = stream->readByte(); + rec->hotspots[0].destFrame = stream->readByte(); + rec->hotspots[1].currentFrame = stream->readByte(); + rec->hotspots[1].destFrame = stream->readByte(); rec->blocked = stream->readByte(); } @@ -429,6 +431,8 @@ HotspotData::HotspotData(HotspotResource *rec) { pauseCtr = 0; actionHotspotId = 0; talkOverride = 0; + talkGate = 0; + scriptHotspotId = 0; } void HotspotData::saveToStream(WriteStream *stream) { diff --git a/engines/lure/res_struct.h b/engines/lure/res_struct.h index 4d2c55e6b1..0e0475bbde 100644 --- a/engines/lure/res_struct.h +++ b/engines/lure/res_struct.h @@ -225,6 +225,18 @@ struct RoomExitIndexedHotspotResource { uint16 hotspotId; } PACKED_STRUCT; +enum SoundDescFlags {SF_IN_USE = 1, SF_RESTORE = 2}; + +// In desc entry, numChannels: bits 0-1 # roland, bits 2-3 #adlib, bits 4-5 #internal + +struct SoundDescResource { + uint8 soundNumber; + uint8 channel; + uint8 numChannels; + uint8 flags; + uint8 volume; +} PACKED_STRUCT; + #include "common/pack-end.h" // END STRUCT PACKING /** @@ -353,22 +365,21 @@ public: void loadFromStream(ReadStream *stream); }; +struct RoomExitJoinStruct { + uint16 hotspotId; + byte currentFrame; + byte destFrame; + uint8 openSound; + uint8 closeSound; +}; + class RoomExitJoinData { public: RoomExitJoinData(RoomExitJoinResource *rec); - uint16 hotspot1Id; - byte h1CurrentFrame; - byte h1DestFrame; - uint8 h1OpenSound; - uint8 h1CloseSound; - uint16 hotspot2Id; - byte h2CurrentFrame; - byte h2DestFrame; - uint8 h2OpenSound; - uint8 h2CloseSound; + RoomExitJoinStruct hotspots[2]; + byte blocked; - uint32 unknown; }; class RoomExitJoinList: public ManagedList { @@ -797,7 +808,8 @@ enum FieldName { BOTTLE_FILLED = 18, TALK_INDEX = 19, SACK_CUT = 20, - ROOM_EXIT_ANIMATION = 76 + ROOM_EXIT_ANIMATION = 76, + AREA_FLAG = 82 }; enum GameFlags { -- cgit v1.2.3