From 63ffcf0a0deb05c77bdcc18d1f39d9384de5111a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 25 Aug 2016 18:36:14 -0400 Subject: TITANIC: Add loading of bedhead data --- engines/titanic/game/sgt/bedhead.cpp | 39 ++++++++++++++++++++++-------------- engines/titanic/game/sgt/bedhead.h | 2 +- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/engines/titanic/game/sgt/bedhead.cpp b/engines/titanic/game/sgt/bedhead.cpp index 45031bd6b3..f911a83ae3 100644 --- a/engines/titanic/game/sgt/bedhead.cpp +++ b/engines/titanic/game/sgt/bedhead.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/sgt/bedhead.h" +#include "titanic/titanic.h" namespace Titanic { @@ -30,41 +31,49 @@ BEGIN_MESSAGE_MAP(CBedhead, CSGTStateRoom) END_MESSAGE_MAP() void BedheadEntry::load(Common::SeekableReadStream *s) { - // TODO + _name1 = readStringFromStream(s); + _name2 = readStringFromStream(s); + _name3 = readStringFromStream(s); + _name4 = readStringFromStream(s); + _startFrame = s->readUint32LE(); + _endFrame = s->readUint32LE(); } /*------------------------------------------------------------------------*/ -void BedheadEntries::load(Common::SeekableReadStream *s) { - resize(s->readUint32LE()); - for (uint idx = 0; idx < size(); ++idx) +void BedheadEntries::load(Common::SeekableReadStream *s, int count) { + resize(count); + for (uint idx = 0; idx < count; ++idx) (*this)[idx].load(s); } /*------------------------------------------------------------------------*/ void TurnOnEntries::load(Common::SeekableReadStream *s) { - _closed.load(s); - _restingTV.load(s); - _restingUV.load(s); - _closedWrong.load(s); + _closed.load(s, 4); + _restingTV.load(s, 2); + _restingUV.load(s, 2); + _closedWrong.load(s, 2); } /*------------------------------------------------------------------------*/ void TurnOffEntries::load(Common::SeekableReadStream *s) { - _open.load(s); - _restingUTV.load(s); - _restingV.load(s); - _restingG.load(s); - _openWrong.load(s); - _restingDWrong.load(s); + _open.load(s, 3); + _restingUTV.load(s, 1); + _restingV.load(s, 1); + _restingG.load(s, 3); + _openWrong.load(s, 1); + _restingDWrong.load(s, 1); } /*------------------------------------------------------------------------*/ CBedhead::CBedhead() : CSGTStateRoom() { - // TODO: Load data for turn on/off methods + Common::SeekableReadStream *s = g_vm->_filesManager->getResource("DATA/BEDHEAD"); + _on.load(s); + _off.load(s); + delete s; } void CBedhead::save(SimpleFile *file, int indent) { diff --git a/engines/titanic/game/sgt/bedhead.h b/engines/titanic/game/sgt/bedhead.h index 53c61e19d8..7784cb8caf 100644 --- a/engines/titanic/game/sgt/bedhead.h +++ b/engines/titanic/game/sgt/bedhead.h @@ -40,7 +40,7 @@ struct BedheadEntry { }; class BedheadEntries : public Common::Array { public: - void load(Common::SeekableReadStream *s); + void load(Common::SeekableReadStream *s, int count); }; struct TurnOnEntries { -- cgit v1.2.3