mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 22:58:09 +00:00
DRAGONS: Fixed bug with missing inventory items when loading from save game.
This commit is contained in:
parent
a77889f85a
commit
8286a6de7a
@ -19,6 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#include <common/debug.h>
|
||||
#include "dragonflg.h"
|
||||
#include "bigfile.h"
|
||||
|
||||
@ -85,6 +86,18 @@ void Properties::save(uint numberToWrite, Common::WriteStream *out) {
|
||||
out->write(_properties, numberToWrite / 8);
|
||||
}
|
||||
|
||||
void Properties::print(char *prefix) {
|
||||
char *str = new char[_count + 1];
|
||||
int i = 0;
|
||||
for(; i < _count; i++) {
|
||||
str[i] = get(i) ? '1' : '0';
|
||||
}
|
||||
str[i] = 0;
|
||||
debug("%s: props = %s", prefix, str);
|
||||
|
||||
delete str;
|
||||
}
|
||||
|
||||
DragonFLG::DragonFLG(BigfileArchive *bigfileArchive) {
|
||||
_data = bigfileArchive->load("dragon.flg", _dataSize);
|
||||
properties = new Properties(288);
|
||||
@ -104,6 +117,7 @@ void DragonFLG::set(uint32 propertyId, bool value) {
|
||||
}
|
||||
|
||||
void DragonFLG::saveState(Common::WriteStream *out) {
|
||||
//properties->print("save");
|
||||
properties->save(128, out); // save first 80 flags.
|
||||
}
|
||||
|
||||
@ -114,6 +128,7 @@ void DragonFLG::loadState(Common::ReadStream *in) {
|
||||
|
||||
in->read(savedState, 0x10);
|
||||
properties->init(0x10, savedState);
|
||||
//properties->print("load");
|
||||
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ public:
|
||||
bool get(uint32 propertyId);
|
||||
void set(uint32 propertyId, bool value);
|
||||
void save(uint numberToWrite, Common::WriteStream *out);
|
||||
void print(char *prefix);
|
||||
private:
|
||||
uint _count;
|
||||
byte *_properties;
|
||||
|
@ -128,7 +128,7 @@ bool DragonsEngine::loadgame(const char *filename) {
|
||||
// TODO load game state here. _gameState->read(in);
|
||||
uint16 newSceneId = (uint16)in->readByte();
|
||||
_dragonFLG->loadState(in);
|
||||
|
||||
_dragonFLG->set(165, true); //TODO check why this is needed to load save games properly.
|
||||
_dragonVAR->reset();
|
||||
|
||||
_dragonINIResource->reset();
|
||||
|
Loading…
Reference in New Issue
Block a user