mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-02 14:51:40 +00:00
save load preparetion
svn-id: r17852
This commit is contained in:
parent
589b65945a
commit
3b1f8da4be
@ -2292,6 +2292,51 @@ void Actor::drawPathTest() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void Actor::saveState(File& out) {
|
||||
uint16 i;
|
||||
|
||||
out.writeSint32LE(_centerActor == NULL ? -1 : _centerActor->index);
|
||||
out.writeSint32LE(_protagonist == NULL ? -1 : _protagonist->index);
|
||||
out.writeSint16LE(getProtagState());
|
||||
|
||||
for (i = 0; i < _actorsCount; i++) {
|
||||
ActorData *a = _actors[i];
|
||||
a->saveState(out);
|
||||
}
|
||||
|
||||
//TODO: save _activeSpeech
|
||||
|
||||
for (i = 0; i < _objsCount; i++) {
|
||||
ObjectData *o = _objs[i];
|
||||
o->saveState(out);
|
||||
}
|
||||
}
|
||||
|
||||
void Actor::loadState(File& in) {
|
||||
int32 i;
|
||||
|
||||
i = in.readSint32LE();
|
||||
_centerActor = (i < 0) ? NULL : _actors[i];
|
||||
|
||||
i = in.readSint32LE();
|
||||
_protagonist = (i < 0) ? NULL : _actors[i];
|
||||
|
||||
setProtagState(in.readSint16LE());
|
||||
|
||||
//TODO: load _activeSpeech
|
||||
|
||||
for (i = 0; i < _actorsCount; i++) {
|
||||
ActorData *a = _actors[i];
|
||||
a->loadState(in);
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < _objsCount; i++) {
|
||||
ObjectData *o = _objs[i];
|
||||
o->loadState(in);
|
||||
}
|
||||
}
|
||||
|
||||
// Console wrappers - must be safe to run
|
||||
|
||||
void Actor::cmdActorWalkTo(int argc, const char **argv) {
|
||||
|
26
saga/actor.h
26
saga/actor.h
@ -428,9 +428,6 @@ class Actor {
|
||||
friend class IsoMap;
|
||||
friend class SagaEngine;
|
||||
public:
|
||||
ActorData *_centerActor;
|
||||
ActorData *_protagonist;
|
||||
StringsTable _actorsStrings;
|
||||
|
||||
Actor(SagaEngine *vm);
|
||||
~Actor();
|
||||
@ -496,6 +493,9 @@ public:
|
||||
return _activeSpeech.stringsCount > 0;
|
||||
}
|
||||
|
||||
void saveState(File& out);
|
||||
void loadState(File& in);
|
||||
|
||||
void setProtagState(int state);
|
||||
int getProtagState() { return _protagState; }
|
||||
|
||||
@ -537,22 +537,32 @@ private:
|
||||
void removePathPoints();
|
||||
bool validFollowerLocation(const Location &location);
|
||||
|
||||
int _lastTickMsec;
|
||||
SagaEngine *_vm;
|
||||
RSCFILE_CONTEXT *_actorContext;
|
||||
CommonObjectOrderList _drawOrderList;
|
||||
|
||||
protected:
|
||||
//constants
|
||||
int _actorsCount;
|
||||
ActorData **_actors;
|
||||
|
||||
int _objsCount;
|
||||
ObjectData **_objs;
|
||||
|
||||
private:
|
||||
SagaEngine *_vm;
|
||||
RSCFILE_CONTEXT *_actorContext;
|
||||
|
||||
StringsTable _actorsStrings;
|
||||
int _lastTickMsec;
|
||||
CommonObjectOrderList _drawOrderList;
|
||||
|
||||
//variables
|
||||
public:
|
||||
ActorData *_centerActor;
|
||||
ActorData *_protagonist;
|
||||
|
||||
protected:
|
||||
SpeechData _activeSpeech;
|
||||
int _protagState;
|
||||
|
||||
private:
|
||||
//path stuff
|
||||
struct PathNode {
|
||||
Point point;
|
||||
|
@ -46,7 +46,6 @@ void SagaEngine::save() {
|
||||
//TODO: version number
|
||||
|
||||
out.writeSint16LE(_script->_commonBufferSize);
|
||||
out.writeSint16LE(_actor->getProtagState());
|
||||
|
||||
// Surrounding scene
|
||||
out.writeSint32LE(_scene->getOutsetSceneNumber());
|
||||
@ -58,15 +57,7 @@ void SagaEngine::save() {
|
||||
|
||||
uint16 i;
|
||||
|
||||
for (i = 0; i < _actor->_actorsCount; i++) {
|
||||
ActorData *a = _actor->_actors[i];
|
||||
a->saveState(out);
|
||||
}
|
||||
|
||||
for (i = 0; i < _actor->_objsCount; i++) {
|
||||
ObjectData *o = _actor->_objs[i];
|
||||
o->saveState(out);
|
||||
}
|
||||
_actor->saveState(out);
|
||||
|
||||
for (i = 0; i < _script->_commonBufferSize; i++)
|
||||
out.writeByte(_script->_commonBuffer[i]);
|
||||
@ -89,7 +80,6 @@ void SagaEngine::load() {
|
||||
return;
|
||||
|
||||
commonBufferSize = in.readSint16LE();
|
||||
_actor->setProtagState(in.readSint16LE());
|
||||
|
||||
// Surrounding scene
|
||||
scenenum = in.readSint32LE();
|
||||
@ -103,17 +93,10 @@ void SagaEngine::load() {
|
||||
|
||||
uint16 i;
|
||||
|
||||
for (i = 0; i < _actor->_actorsCount; i++) {
|
||||
ActorData *a = _actor->_actors[i];
|
||||
a->loadState(in);
|
||||
}
|
||||
|
||||
_interface->clearInventory(); //TODO: interface load-save-state
|
||||
|
||||
for (i = 0; i < _actor->_objsCount; i++) {
|
||||
ObjectData *o = _actor->_objs[i];
|
||||
o->loadState(in);
|
||||
}
|
||||
_actor->loadState(in);
|
||||
|
||||
for (i = 0; i < commonBufferSize; i++)
|
||||
_script->_commonBuffer[i] = in.readByte();
|
||||
|
Loading…
x
Reference in New Issue
Block a user