bool BaseObject::persist(BasePersistenceManager *persistMgr) { BaseScriptHolder::persist(persistMgr); for (int i = 0; i < 7; i++) { persistMgr->transfer(TMEMBER(_caption[i])); } persistMgr->transferPtr(TMEMBER_PTR(_activeCursor)); persistMgr->transfer(TMEMBER(_alphaColor)); persistMgr->transfer(TMEMBER(_autoSoundPanning)); persistMgr->transferPtr(TMEMBER_PTR(_cursor)); persistMgr->transfer(TMEMBER(_sharedCursors)); persistMgr->transfer(TMEMBER(_editorAlwaysRegister)); persistMgr->transfer(TMEMBER(_editorOnly)); persistMgr->transfer(TMEMBER(_editorSelected)); persistMgr->transfer(TMEMBER(_iD)); persistMgr->transfer(TMEMBER(_is3D)); persistMgr->transfer(TMEMBER(_movable)); persistMgr->transfer(TMEMBER(_posX)); persistMgr->transfer(TMEMBER(_posY)); persistMgr->transferFloat(TMEMBER(_relativeScale)); persistMgr->transfer(TMEMBER(_rotatable)); persistMgr->transferFloat(TMEMBER(_scale)); persistMgr->transferPtr(TMEMBER_PTR(_sFX)); persistMgr->transfer(TMEMBER(_sFXStart)); persistMgr->transfer(TMEMBER(_sFXVolume)); persistMgr->transfer(TMEMBER(_ready)); persistMgr->transfer(TMEMBER(_rect)); persistMgr->transfer(TMEMBER(_rectSet)); persistMgr->transfer(TMEMBER(_registrable)); persistMgr->transfer(TMEMBER(_shadowable)); persistMgr->transfer(TMEMBER(_soundEvent)); persistMgr->transfer(TMEMBER(_zoomable)); persistMgr->transferFloat(TMEMBER(_scaleX)); persistMgr->transferFloat(TMEMBER(_scaleY)); persistMgr->transferFloat(TMEMBER(_rotate)); persistMgr->transfer(TMEMBER(_rotateValid)); persistMgr->transferFloat(TMEMBER(_relativeRotate)); persistMgr->transfer(TMEMBER(_saveState)); persistMgr->transfer(TMEMBER(_nonIntMouseEvents)); persistMgr->transfer(TMEMBER_INT(_sFXType)); persistMgr->transferFloat(TMEMBER(_sFXParam1)); persistMgr->transferFloat(TMEMBER(_sFXParam2)); persistMgr->transferFloat(TMEMBER(_sFXParam3)); persistMgr->transferFloat(TMEMBER(_sFXParam4)); persistMgr->transfer(TMEMBER_INT(_blendMode)); return STATUS_OK; }
bool AdTalkNode::persist(BasePersistenceManager *persistMgr) { persistMgr->transfer(TMEMBER(_comment)); persistMgr->transfer(TMEMBER(_startTime)); persistMgr->transfer(TMEMBER(_endTime)); persistMgr->transfer(TMEMBER(_playToEnd)); persistMgr->transferPtr(TMEMBER_PTR(_sprite)); persistMgr->transfer(TMEMBER(_spriteFilename)); persistMgr->transferPtr(TMEMBER_PTR(_spriteSet)); persistMgr->transfer(TMEMBER(_spriteSetFilename)); return STATUS_OK; }
bool ScEngine::persist(BasePersistenceManager *persistMgr) { if (!persistMgr->getIsSaving()) { cleanup(); } persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transferPtr(TMEMBER_PTR(_currentScript)); persistMgr->transferPtr(TMEMBER_PTR(_globals)); _scripts.persist(persistMgr); return STATUS_OK; }
bool AdTalkDef::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_defaultSprite)); persistMgr->transfer(TMEMBER(_defaultSpriteFilename)); persistMgr->transferPtr(TMEMBER_PTR(_defaultSpriteSet)); persistMgr->transfer(TMEMBER(_defaultSpriteSetFilename)); _nodes.persist(persistMgr); return STATUS_OK; }
bool UIEntity::persist(BasePersistenceManager *persistMgr) { UIObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_entity)); return STATUS_OK; }
bool VideoTheoraPlayer::persist(BasePersistenceManager *persistMgr) { //BaseClass::persist(persistMgr); if (persistMgr->getIsSaving()) { _savedPos = getMovieTime() * 1000; _savedState = _state; } else { SetDefaults(); } persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transfer(TMEMBER(_savedPos)); persistMgr->transfer(TMEMBER(_savedState)); persistMgr->transfer(TMEMBER(_filename)); persistMgr->transfer(TMEMBER(_alphaFilename)); persistMgr->transfer(TMEMBER(_posX)); persistMgr->transfer(TMEMBER(_posY)); persistMgr->transferFloat(TMEMBER(_playZoom)); persistMgr->transfer(TMEMBER_INT(_playbackType)); persistMgr->transferBool(TMEMBER(_looping)); persistMgr->transfer(TMEMBER(_volume)); if (!persistMgr->getIsSaving() && (_savedState != THEORA_STATE_NONE)) { initializeSimple(); } return STATUS_OK; }
bool BaseSound::persist(BasePersistenceManager *persistMgr) { if (persistMgr->getIsSaving() && _sound) { _soundPlaying = _sound->isPlaying(); _soundLooping = _sound->_looping; _soundPrivateVolume = _sound->_privateVolume; if (_soundPlaying) { _soundPosition = _sound->getPosition(); } _soundLoopStart = _sound->_loopStart; _soundFreezePaused = _sound->_freezePaused; } if (persistMgr->getIsSaving()) { _sFXType = SFX_NONE; _sFXParam1 = _sFXParam2 = _sFXParam3 = _sFXParam4 = 0; } persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transfer(TMEMBER(_soundFilename)); persistMgr->transfer(TMEMBER(_soundLooping)); persistMgr->transfer(TMEMBER(_soundPaused)); persistMgr->transfer(TMEMBER(_soundFreezePaused)); persistMgr->transfer(TMEMBER(_soundPlaying)); persistMgr->transfer(TMEMBER(_soundPosition)); persistMgr->transfer(TMEMBER(_soundPrivateVolume)); persistMgr->transfer(TMEMBER(_soundStreamed)); persistMgr->transfer(TMEMBER_INT(_soundType)); persistMgr->transfer(TMEMBER(_soundLoopStart)); return STATUS_OK; }
bool AdInventoryBox::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_closeButton)); persistMgr->transfer(TMEMBER(_hideSelected)); persistMgr->transfer(TMEMBER(_itemHeight)); persistMgr->transfer(TMEMBER(_itemsArea)); persistMgr->transfer(TMEMBER(_itemWidth)); persistMgr->transfer(TMEMBER(_scrollBy)); persistMgr->transfer(TMEMBER(_scrollOffset)); persistMgr->transfer(TMEMBER(_spacing)); persistMgr->transfer(TMEMBER(_visible)); persistMgr->transferPtr(TMEMBER_PTR(_window)); persistMgr->transfer(TMEMBER(_exclusive)); return STATUS_OK; }
bool AdActor::persist(BasePersistenceManager *persistMgr) { AdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_dir)); persistMgr->transferPtr(TMEMBER_PTR(_path)); persistMgr->transfer(TMEMBER(_pFCount)); persistMgr->transfer(TMEMBER(_pFStepX)); persistMgr->transfer(TMEMBER(_pFStepY)); persistMgr->transfer(TMEMBER(_pFX)); persistMgr->transfer(TMEMBER(_pFY)); persistMgr->transferPtr(TMEMBER_PTR(_standSprite)); _talkSprites.persist(persistMgr); _talkSpritesEx.persist(persistMgr); persistMgr->transfer(TMEMBER_INT(_targetDir)); persistMgr->transfer(TMEMBER_INT(_afterWalkDir)); persistMgr->transferPtr(TMEMBER_PTR(_targetPoint)); persistMgr->transferPtr(TMEMBER_PTR(_turnLeftSprite)); persistMgr->transferPtr(TMEMBER_PTR(_turnRightSprite)); persistMgr->transferPtr(TMEMBER_PTR(_walkSprite)); persistMgr->transferPtr(TMEMBER_PTR(_animSprite2)); persistMgr->transfer(TMEMBER(_talkAnimName)); persistMgr->transfer(TMEMBER(_idleAnimName)); persistMgr->transfer(TMEMBER(_walkAnimName)); persistMgr->transfer(TMEMBER(_turnLeftAnimName)); persistMgr->transfer(TMEMBER(_turnRightAnimName)); _anims.persist(persistMgr); return STATUS_OK; }
bool UIObject::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_back)); persistMgr->transfer(TMEMBER(_canFocus)); persistMgr->transfer(TMEMBER(_disable)); persistMgr->transferPtr(TMEMBER_PTR(_focusedWidget)); persistMgr->transferPtr(TMEMBER_PTR(_font)); persistMgr->transfer(TMEMBER(_height)); persistMgr->transferPtr(TMEMBER_PTR(_image)); persistMgr->transferPtr(TMEMBER_PTR(_listenerObject)); persistMgr->transferPtr(TMEMBER_PTR(_listenerParamObject)); persistMgr->transfer(TMEMBER(_listenerParamDWORD)); persistMgr->transferPtr(TMEMBER_PTR(_parent)); persistMgr->transfer(TMEMBER(_parentNotify)); persistMgr->transfer(TMEMBER(_sharedFonts)); persistMgr->transfer(TMEMBER(_sharedImages)); persistMgr->transfer(TMEMBER(_text)); persistMgr->transfer(TMEMBER_INT(_type)); persistMgr->transfer(TMEMBER(_visible)); persistMgr->transfer(TMEMBER(_width)); return STATUS_OK; }
bool AdEntity::persist(BasePersistenceManager *persistMgr) { AdTalkHolder::persist(persistMgr); persistMgr->transfer(TMEMBER(_item)); persistMgr->transferPtr(TMEMBER_PTR(_region)); //persistMgr->transfer(TMEMBER(_sprite)); persistMgr->transfer(TMEMBER_INT(_subtype)); _talkSprites.persist(persistMgr); _talkSpritesEx.persist(persistMgr); persistMgr->transfer(TMEMBER(_walkToX)); persistMgr->transfer(TMEMBER(_walkToY)); persistMgr->transfer(TMEMBER_INT(_walkToDir)); persistMgr->transferPtr(TMEMBER_PTR(_theora)); return STATUS_OK; }
bool AdTalkHolder::persist(BasePersistenceManager *persistMgr) { AdObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_sprite)); _talkSprites.persist(persistMgr); _talkSpritesEx.persist(persistMgr); return STATUS_OK; }
bool ScStack::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transfer(TMEMBER(_sP)); _values.persist(persistMgr); return STATUS_OK; }
bool AdPathPoint::persist(BasePersistenceManager *persistMgr) { BasePoint::persist(persistMgr); persistMgr->transfer(TMEMBER(_distance)); persistMgr->transferBool(TMEMBER(_marked)); persistMgr->transferPtr(TMEMBER_PTR(_origin)); return STATUS_OK; }
bool AdPath::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transferSint32(TMEMBER(_currIndex)); _points.persist(persistMgr); persistMgr->transferBool(TMEMBER(_ready)); return STATUS_OK; }
bool AdResponseBox::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_font)); persistMgr->transferPtr(TMEMBER_PTR(_fontHover)); persistMgr->transfer(TMEMBER(_horizontal)); persistMgr->transfer(TMEMBER(_lastResponseText)); persistMgr->transfer(TMEMBER(_lastResponseTextOrig)); _respButtons.persist(persistMgr); persistMgr->transfer(TMEMBER(_responseArea)); _responses.persist(persistMgr); persistMgr->transfer(TMEMBER(_scrollOffset)); persistMgr->transferPtr(TMEMBER_PTR(_shieldWindow)); persistMgr->transfer(TMEMBER(_spacing)); persistMgr->transferPtr(TMEMBER_PTR(_waitingScript)); persistMgr->transferPtr(TMEMBER_PTR(_window)); persistMgr->transfer(TMEMBER_INT(_verticalAlign)); persistMgr->transfer(TMEMBER_INT(_align)); return STATUS_OK; }
bool AdNodeState::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transferBool(TMEMBER(_active)); persistMgr->transfer(TMEMBER(_name)); persistMgr->transfer(TMEMBER(_filename)); persistMgr->transfer(TMEMBER(_cursor)); persistMgr->transfer(TMEMBER(_alphaColor)); for (int i = 0; i < 7; i++) { persistMgr->transfer(TMEMBER(_caption[i])); } return STATUS_OK; }
bool UIEdit::persist(BasePersistenceManager *persistMgr) { UIObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_cursorBlinkRate)); persistMgr->transfer(TMEMBER(_cursorChar)); persistMgr->transferPtr(TMEMBER_PTR(_fontSelected)); persistMgr->transfer(TMEMBER(_frameWidth)); persistMgr->transfer(TMEMBER(_maxLength)); persistMgr->transfer(TMEMBER(_scrollOffset)); persistMgr->transfer(TMEMBER(_selEnd)); persistMgr->transfer(TMEMBER(_selStart)); if (!persistMgr->getIsSaving()) { _cursorVisible = false; _lastBlinkTime = 0; } return STATUS_OK; }
bool AdObject::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transferBool(TMEMBER(_active)); persistMgr->transferPtr(TMEMBER_PTR(_blockRegion)); persistMgr->transferPtr(TMEMBER_PTR(_currentBlockRegion)); persistMgr->transferPtr(TMEMBER_PTR(_currentWptGroup)); persistMgr->transferPtr(TMEMBER_PTR(_currentSprite)); persistMgr->transferBool(TMEMBER(_drawn)); persistMgr->transferPtr(TMEMBER_PTR(_font)); persistMgr->transferBool(TMEMBER(_ignoreItems)); persistMgr->transfer(TMEMBER_INT(_nextState)); persistMgr->transferPtr(TMEMBER_PTR(_sentence)); persistMgr->transfer(TMEMBER_INT(_state)); persistMgr->transferPtr(TMEMBER_PTR(_animSprite)); persistMgr->transferBool(TMEMBER(_sceneIndependent)); persistMgr->transfer(TMEMBER(_forcedTalkAnimName)); persistMgr->transferBool(TMEMBER(_forcedTalkAnimUsed)); persistMgr->transferPtr(TMEMBER_PTR(_tempSprite2)); persistMgr->transfer(TMEMBER_INT(_type)); persistMgr->transferPtr(TMEMBER_PTR(_wptGroup)); persistMgr->transferPtr(TMEMBER_PTR(_stickRegion)); persistMgr->transferBool(TMEMBER(_subtitlesModRelative)); persistMgr->transfer(TMEMBER(_subtitlesModX)); persistMgr->transfer(TMEMBER(_subtitlesModY)); persistMgr->transferBool(TMEMBER(_subtitlesModXCenter)); persistMgr->transfer(TMEMBER(_subtitlesWidth)); persistMgr->transferPtr(TMEMBER_PTR(_inventory)); persistMgr->transferPtr(TMEMBER_PTR(_partEmitter)); for (int i = 0; i < MAX_NUM_REGIONS; i++) { persistMgr->transferPtr(TMEMBER_PTR(_currentRegions[i])); } _attachmentsPre.persist(persistMgr); _attachmentsPost.persist(persistMgr); persistMgr->transferPtr(TMEMBER_PTR(_registerAlias)); persistMgr->transferBool(TMEMBER(_partFollowParent)); persistMgr->transfer(TMEMBER(_partOffsetX)); persistMgr->transfer(TMEMBER(_partOffsetY)); return STATUS_OK; }
bool ScValue::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transfer(TMEMBER(_persistent)); persistMgr->transfer(TMEMBER(_isConstVar)); persistMgr->transfer(TMEMBER_INT(_type)); persistMgr->transfer(TMEMBER(_valBool)); persistMgr->transfer(TMEMBER(_valFloat)); persistMgr->transfer(TMEMBER(_valInt)); persistMgr->transferPtr(TMEMBER_PTR(_valNative)); int32 size; const char *str; if (persistMgr->getIsSaving()) { size = _valObject.size(); persistMgr->transfer("", &size); _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { str = _valIter->_key.c_str(); persistMgr->transfer("", &str); persistMgr->transferPtr("", &_valIter->_value); _valIter++; } } else { ScValue *val = nullptr; persistMgr->transfer("", &size); for (int i = 0; i < size; i++) { persistMgr->transfer("", &str); persistMgr->transferPtr("", &val); _valObject[str] = val; delete[] str; } } persistMgr->transferPtr(TMEMBER_PTR(_valRef)); persistMgr->transfer(TMEMBER(_valString)); if (!persistMgr->getIsSaving() && !persistMgr->checkVersion(1,2,2)) { // Savegames prior to 1.2.2 stored empty strings as NULL. // We disambiguate those by turning NULL strings into empty // strings if _type is VAL_STRING instead of VAL_NULL. if (_type == VAL_STRING && !_valString) { _valString = new char[1]; _valString[0] = '\0'; } } /* // TODO: Convert to Debug-statements. FILE* f = fopen("c:\\val.log", "a+"); switch(_type) { case VAL_STRING: fprintf(f, "str %s\n", _valString); break; case VAL_INT: fprintf(f, "int %d\n", _valInt); break; case VAL_BOOL: fprintf(f, "bool %d\n", _valBool); break; case VAL_NULL: fprintf(f, "null\n"); break; case VAL_NATIVE: fprintf(f, "native\n"); break; case VAL_VARIABLE_REF: fprintf(f, "ref\n"); break; case VAL_OBJECT: fprintf(f, "obj\n"); break; case VAL_FLOAT: fprintf(f, "float\n"); break; } fclose(f); */ return STATUS_OK; }
bool PartEmitter::persist(BasePersistenceManager *persistMgr) { BaseObject::persist(persistMgr); persistMgr->transfer(TMEMBER(_width)); persistMgr->transfer(TMEMBER(_height)); persistMgr->transfer(TMEMBER(_angle1)); persistMgr->transfer(TMEMBER(_angle2)); persistMgr->transfer(TMEMBER(_velocity1)); persistMgr->transfer(TMEMBER(_velocity2)); persistMgr->transfer(TMEMBER(_velocityZBased)); persistMgr->transfer(TMEMBER(_scale1)); persistMgr->transfer(TMEMBER(_scale2)); persistMgr->transfer(TMEMBER(_scaleZBased)); persistMgr->transfer(TMEMBER(_maxParticles)); persistMgr->transfer(TMEMBER(_lifeTime1)); persistMgr->transfer(TMEMBER(_lifeTime2)); persistMgr->transfer(TMEMBER(_lifeTimeZBased)); persistMgr->transfer(TMEMBER(_genInterval)); persistMgr->transfer(TMEMBER(_genAmount)); persistMgr->transfer(TMEMBER(_running)); persistMgr->transfer(TMEMBER(_overheadTime)); persistMgr->transfer(TMEMBER(_border)); persistMgr->transfer(TMEMBER(_borderThicknessLeft)); persistMgr->transfer(TMEMBER(_borderThicknessRight)); persistMgr->transfer(TMEMBER(_borderThicknessTop)); persistMgr->transfer(TMEMBER(_borderThicknessBottom)); persistMgr->transfer(TMEMBER(_fadeInTime)); persistMgr->transfer(TMEMBER(_fadeOutTime)); persistMgr->transfer(TMEMBER(_alpha1)); persistMgr->transfer(TMEMBER(_alpha2)); persistMgr->transfer(TMEMBER(_alphaTimeBased)); persistMgr->transfer(TMEMBER(_angVelocity1)); persistMgr->transfer(TMEMBER(_angVelocity2)); persistMgr->transfer(TMEMBER(_rotation1)); persistMgr->transfer(TMEMBER(_rotation2)); persistMgr->transfer(TMEMBER(_growthRate1)); persistMgr->transfer(TMEMBER(_growthRate2)); persistMgr->transfer(TMEMBER(_exponentialGrowth)); persistMgr->transfer(TMEMBER(_useRegion)); persistMgr->transfer(TMEMBER_INT(_maxBatches)); persistMgr->transfer(TMEMBER_INT(_batchesGenerated)); persistMgr->transfer(TMEMBER(_emitEvent)); persistMgr->transferPtr(TMEMBER_PTR(_owner)); _sprites.persist(persistMgr); uint32 numForces; if (persistMgr->getIsSaving()) { numForces = _forces.size(); persistMgr->transfer(TMEMBER(numForces)); for (uint32 i = 0; i < _forces.size(); i++) { _forces[i]->persist(persistMgr); } } else { persistMgr->transfer(TMEMBER(numForces)); for (uint32 i = 0; i < numForces; i++) { PartForce *force = new PartForce(_gameRef); force->persist(persistMgr); _forces.add(force); } } uint32 numParticles; if (persistMgr->getIsSaving()) { numParticles = _particles.size(); persistMgr->transfer(TMEMBER(numParticles)); for (uint32 i = 0; i < _particles.size(); i++) { _particles[i]->persist(persistMgr); } } else { persistMgr->transfer(TMEMBER(numParticles)); for (uint32 i = 0; i < numParticles; i++) { PartParticle *particle = new PartParticle(_gameRef); particle->persist(persistMgr); _particles.add(particle); } } return STATUS_OK; }
bool ScValue::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); persistMgr->transfer(TMEMBER(_persistent)); persistMgr->transfer(TMEMBER(_isConstVar)); persistMgr->transfer(TMEMBER_INT(_type)); persistMgr->transfer(TMEMBER(_valBool)); persistMgr->transfer(TMEMBER(_valFloat)); persistMgr->transfer(TMEMBER(_valInt)); persistMgr->transferPtr(TMEMBER_PTR(_valNative)); int32 size; const char *str; if (persistMgr->getIsSaving()) { size = _valObject.size(); persistMgr->transfer("", &size); _valIter = _valObject.begin(); while (_valIter != _valObject.end()) { str = _valIter->_key.c_str(); persistMgr->transfer("", &str); persistMgr->transferPtr("", &_valIter->_value); _valIter++; } } else { ScValue *val = nullptr; persistMgr->transfer("", &size); for (int i = 0; i < size; i++) { persistMgr->transfer("", &str); persistMgr->transferPtr("", &val); _valObject[str] = val; delete[] str; } } persistMgr->transferPtr(TMEMBER_PTR(_valRef)); persistMgr->transfer(TMEMBER(_valString)); /* // TODO: Convert to Debug-statements. FILE* f = fopen("c:\\val.log", "a+"); switch(_type) { case VAL_STRING: fprintf(f, "str %s\n", _valString); break; case VAL_INT: fprintf(f, "int %d\n", _valInt); break; case VAL_BOOL: fprintf(f, "bool %d\n", _valBool); break; case VAL_NULL: fprintf(f, "null\n"); break; case VAL_NATIVE: fprintf(f, "native\n"); break; case VAL_VARIABLE_REF: fprintf(f, "ref\n"); break; case VAL_OBJECT: fprintf(f, "obj\n"); break; case VAL_FLOAT: fprintf(f, "float\n"); break; } fclose(f); */ return STATUS_OK; }
bool ScScript::persist(BasePersistenceManager *persistMgr) { persistMgr->transferPtr(TMEMBER_PTR(_gameRef)); // buffer if (persistMgr->getIsSaving()) { if (_state != SCRIPT_PERSISTENT && _state != SCRIPT_FINISHED && _state != SCRIPT_THREAD_FINISHED) { persistMgr->transfer(TMEMBER(_bufferSize)); persistMgr->putBytes(_buffer, _bufferSize); } else { // don't save idle/finished scripts int32 bufferSize = 0; persistMgr->transfer(TMEMBER(bufferSize)); } } else { persistMgr->transfer(TMEMBER(_bufferSize)); if (_bufferSize > 0) { _buffer = new byte[_bufferSize]; persistMgr->getBytes(_buffer, _bufferSize); _scriptStream = new Common::MemoryReadStream(_buffer, _bufferSize); initTables(); } else { _buffer = nullptr; _scriptStream = nullptr; } } persistMgr->transferPtr(TMEMBER_PTR(_callStack)); persistMgr->transfer(TMEMBER(_currentLine)); persistMgr->transferPtr(TMEMBER_PTR(_engine)); persistMgr->transfer(TMEMBER(_filename)); persistMgr->transferBool(TMEMBER(_freezable)); persistMgr->transferPtr(TMEMBER_PTR(_globals)); persistMgr->transfer(TMEMBER(_iP)); persistMgr->transferPtr(TMEMBER_PTR(_scopeStack)); persistMgr->transferPtr(TMEMBER_PTR(_stack)); persistMgr->transfer(TMEMBER_INT(_state)); persistMgr->transferPtr(TMEMBER_PTR(_operand)); persistMgr->transfer(TMEMBER_INT(_origState)); persistMgr->transferPtr(TMEMBER_PTR(_owner)); persistMgr->transferPtr(TMEMBER_PTR(_reg1)); persistMgr->transferBool(TMEMBER(_thread)); persistMgr->transfer(TMEMBER(_threadEvent)); persistMgr->transferPtr(TMEMBER_PTR(_thisStack)); persistMgr->transfer(TMEMBER(_timeSlice)); persistMgr->transferPtr(TMEMBER_PTR(_waitObject)); persistMgr->transferPtr(TMEMBER_PTR(_waitScript)); persistMgr->transfer(TMEMBER(_waitTime)); persistMgr->transferBool(TMEMBER(_waitFrozen)); persistMgr->transferBool(TMEMBER(_methodThread)); persistMgr->transferBool(TMEMBER(_methodThread)); // TODO-SAVE: Deduplicate. persistMgr->transferBool(TMEMBER(_unbreakable)); persistMgr->transferPtr(TMEMBER_PTR(_parentScript)); if (!persistMgr->getIsSaving()) { _tracingMode = false; } return STATUS_OK; }