[Scummvm-cvs-logs] SF.net SVN: scummvm: [29689] scummvm/trunk/engines/lure
dreammaster at users.sourceforge.net
dreammaster at users.sourceforge.net
Sun Dec 2 05:49:34 CET 2007
Revision: 29689
http://scummvm.svn.sourceforge.net/scummvm/?rev=29689&view=rev
Author: dreammaster
Date: 2007-12-01 20:49:33 -0800 (Sat, 01 Dec 2007)
Log Message:
-----------
Enhanced savegames to store any active dialog when the game was saved
Modified Paths:
--------------
scummvm/trunk/engines/lure/res.cpp
scummvm/trunk/engines/lure/room.cpp
scummvm/trunk/engines/lure/surface.cpp
scummvm/trunk/engines/lure/surface.h
Modified: scummvm/trunk/engines/lure/res.cpp
===================================================================
--- scummvm/trunk/engines/lure/res.cpp 2007-12-02 02:33:50 UTC (rev 29688)
+++ scummvm/trunk/engines/lure/res.cpp 2007-12-02 04:49:33 UTC (rev 29689)
@@ -596,6 +596,10 @@
Hotspot *hotspot = new Hotspot(hData);
_activeHotspots.push_back(hotspot);
+ if (hotspotId < FIRST_NONCHARACTER_ID)
+ // Default characters to facing upwards until they start moving
+ hotspot->setDirection(UP);
+
return hotspot;
}
@@ -677,6 +681,10 @@
}
void Resources::saveToStream(Common::WriteStream *stream) {
+ // Save basic fields
+ stream->writeUint16LE(_talkingCharacter);
+
+ // Save sublist data
_hotspotData.saveToStream(stream);
_activeHotspots.saveToStream(stream);
_fieldList.saveToStream(stream);
@@ -688,6 +696,9 @@
}
void Resources::loadFromStream(Common::ReadStream *stream) {
+ debugC(ERROR_DETAILED, kLureDebugScripts, "Loading resource data");
+ _talkingCharacter = stream->readUint16LE();
+
debugC(ERROR_DETAILED, kLureDebugScripts, "Loading hotspot data");
_hotspotData.loadFromStream(stream);
debugC(ERROR_DETAILED, kLureDebugScripts, "Loading active hotspots");
Modified: scummvm/trunk/engines/lure/room.cpp
===================================================================
--- scummvm/trunk/engines/lure/room.cpp 2007-12-02 02:33:50 UTC (rev 29688)
+++ scummvm/trunk/engines/lure/room.cpp 2007-12-02 04:49:33 UTC (rev 29689)
@@ -727,6 +727,11 @@
}
void Room::saveToStream(Common::WriteStream *stream) {
+ if (_talkDialog == NULL)
+ stream->writeUint16LE(0);
+ else
+ _talkDialog->saveToStream(stream);
+
stream->writeUint16LE(_roomNumber);
stream->writeUint16LE(_destRoomNumber);
stream->writeByte(_showInfo);
@@ -734,6 +739,10 @@
}
void Room::loadFromStream(Common::ReadStream *stream) {
+ if (_talkDialog)
+ delete _talkDialog;
+
+ _talkDialog = TalkDialog::loadFromStream(stream);
uint16 roomNum = stream->readUint16LE();
_roomNumber = 999; // Dummy room number so current room is faded out
setRoomNumber(roomNum, false);
Modified: scummvm/trunk/engines/lure/surface.cpp
===================================================================
--- scummvm/trunk/engines/lure/surface.cpp 2007-12-02 02:33:50 UTC (rev 29688)
+++ scummvm/trunk/engines/lure/surface.cpp 2007-12-02 04:49:33 UTC (rev 29689)
@@ -524,6 +524,11 @@
char itemName[MAX_DESC_SIZE];
int characterArticle, hotspotArticle = 3;
+ _characterId = characterId;
+ _destCharacterId = destCharacterId;
+ _activeItemId = activeItemId;
+ _descId = descId;
+
HotspotData *talkingChar = res.getHotspot(characterId);
HotspotData *destCharacter = (destCharacterId == 0) ? NULL :
res.getHotspot(destCharacterId);
@@ -652,6 +657,33 @@
_surface->copyTo(dest, x, y);
}
+void TalkDialog::saveToStream(Common::WriteStream *stream) {
+ stream->writeUint16LE(_characterId);
+ stream->writeUint16LE(_destCharacterId);
+ stream->writeUint16LE(_activeItemId);
+ stream->writeUint16LE(_descId);
+ stream->writeSint16LE(_endLine);
+ stream->writeSint16LE(_endIndex);
+ stream->writeSint16LE(_wordCountdown);
+
+}
+
+TalkDialog *TalkDialog::loadFromStream(Common::ReadStream *stream) {
+ uint16 characterId = stream->readUint16LE();
+ if (characterId == 0)
+ return NULL;
+
+ uint16 destCharacterId = stream->readUint16LE();
+ uint16 activeItemId = stream->readUint16LE();
+ uint16 descId = stream->readUint16LE();
+
+ TalkDialog *dialog = new TalkDialog(characterId, destCharacterId, activeItemId, descId);
+ dialog->_endLine = stream->readSint16LE();
+ dialog->_endIndex = stream->readSint16LE();
+ dialog->_wordCountdown = stream->readSint16LE();
+ return dialog;
+}
+
/*--------------------------------------------------------------------------*/
#define SR_SEPARATOR_Y 21
Modified: scummvm/trunk/engines/lure/surface.h
===================================================================
--- scummvm/trunk/engines/lure/surface.h 2007-12-02 02:33:50 UTC (rev 29688)
+++ scummvm/trunk/engines/lure/surface.h 2007-12-02 04:49:33 UTC (rev 29689)
@@ -93,6 +93,11 @@
uint8 _numLines;
int _endLine, _endIndex;
int _wordCountdown;
+
+ uint16 _characterId;
+ uint16 _destCharacterId;
+ uint16 _activeItemId;
+ uint16 _descId;
public:
TalkDialog(uint16 characterId, uint16 destCharacterId, uint16 activeItemId, uint16 descId);
~TalkDialog();
@@ -101,6 +106,9 @@
Surface &surface() { return *_surface; }
void copyTo(Surface *dest, uint16 x, uint16 y);
bool isBuilding() { return _endLine < _numLines; }
+
+ void saveToStream(Common::WriteStream *stream);
+ static TalkDialog *loadFromStream(Common::ReadStream *stream);
};
class SaveRestoreDialog {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list