本文整理汇总了C++中common::Serializer::syncAsSint32LE方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::syncAsSint32LE方法的具体用法?C++ Serializer::syncAsSint32LE怎么用?C++ Serializer::syncAsSint32LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::syncAsSint32LE方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: syncCT
static void syncCT(Common::Serializer &s) {
int v = (_vm->_polyStruct) ? 1 : 0;
s.syncAsSint32LE(v);
if (s.isLoading())
_vm->_polyStruct = (v != 0) ? &_vm->_polyStructNorm : NULL;
if (v == 0)
// There is no further data to load or save
return;
s.syncAsSint16LE(numberOfWalkboxes);
if (numberOfWalkboxes) {
for (int i = 0; i < numberOfWalkboxes; ++i)
s.syncAsSint16LE(walkboxColor[i]);
for (int i = 0; i < numberOfWalkboxes; ++i)
s.syncAsSint16LE(walkboxState[i]);
}
for (int i = 0; i < 10; i++) {
v = 0;
if (s.isSaving()) v = (persoTable[i]) ? 1 : 0;
s.syncAsSint32LE(v);
if (s.isLoading())
// Set up the pointer for the next structure
persoTable[i] = (v == 0) ? NULL : (persoStruct *)mallocAndZero(sizeof(persoStruct));
if (v != 0)
syncPerso(s, *persoTable[i]);
}
}
示例2: syncSavedMover
static void syncSavedMover(Common::Serializer &s, SAVED_MOVER &sm) {
int i, j;
s.syncAsUint32LE(sm.bActive);
s.syncAsSint32LE(sm.actorID);
s.syncAsSint32LE(sm.objX);
s.syncAsSint32LE(sm.objY);
s.syncAsUint32LE(sm.hLastfilm);
// Sync walk reels
for (i = 0; i < TOTAL_SCALES; ++i)
for (j = 0; j < 4; ++j)
s.syncAsUint32LE(sm.walkReels[i][j]);
// Sync stand reels
for (i = 0; i < TOTAL_SCALES; ++i)
for (j = 0; j < 4; ++j)
s.syncAsUint32LE(sm.standReels[i][j]);
// Sync talk reels
for (i = 0; i < TOTAL_SCALES; ++i)
for (j = 0; j < 4; ++j)
s.syncAsUint32LE(sm.talkReels[i][j]);
if (TinselV2) {
s.syncAsByte(sm.bHidden);
s.syncAsSint32LE(sm.brightness);
s.syncAsSint32LE(sm.startColor);
s.syncAsSint32LE(sm.paletteLength);
}
}
示例3: syncSCdata
void syncSCdata(Common::Serializer &s) {
s.syncAsUint32LE(HookScene.scene);
s.syncAsSint32LE(HookScene.entry);
s.syncAsSint32LE(HookScene.trans);
s.syncAsUint32LE(DelayedScene.scene);
s.syncAsSint32LE(DelayedScene.entry);
s.syncAsSint32LE(DelayedScene.trans);
}
示例4: syncTimerInfo
/**
* (Un)serialize the timer data for save/restore game.
*/
void syncTimerInfo(Common::Serializer &s) {
for (int i = 0; i < MAX_TIMERS; i++) {
s.syncAsSint32LE(timers[i].tno);
s.syncAsSint32LE(timers[i].ticks);
s.syncAsSint32LE(timers[i].secs);
s.syncAsSint32LE(timers[i].delta);
s.syncAsSint32LE(timers[i].frame);
}
}
示例5: syncSavedData
static void syncSavedData(Common::Serializer &s, SAVED_DATA &sd, int numInterp) {
s.syncAsUint32LE(sd.SavedSceneHandle);
s.syncAsUint32LE(sd.SavedBgroundHandle);
for (int i = 0; i < MAX_MOVERS; ++i)
syncSavedMover(s, sd.SavedMoverInfo[i]);
for (int i = 0; i < MAX_SAVED_ACTORS; ++i)
syncSavedActor(s, sd.SavedActorInfo[i]);
s.syncAsSint32LE(sd.NumSavedActors);
s.syncAsSint32LE(sd.SavedLoffset);
s.syncAsSint32LE(sd.SavedToffset);
for (int i = 0; i < numInterp; ++i)
sd.SavedICInfo[i].syncWithSerializer(s);
for (int i = 0; i < MAX_POLY; ++i)
s.syncAsUint32LE(sd.SavedDeadPolys[i]);
s.syncAsUint32LE(sd.SavedControl);
s.syncAsUint32LE(sd.SavedMidi);
s.syncAsUint32LE(sd.SavedLoop);
s.syncAsUint32LE(sd.SavedNoBlocking);
// SavedNoScrollData
for (int i = 0; i < MAX_VNOSCROLL; ++i)
syncNoScrollB(s, sd.SavedNoScrollData.NoVScroll[i]);
for (int i = 0; i < MAX_HNOSCROLL; ++i)
syncNoScrollB(s, sd.SavedNoScrollData.NoHScroll[i]);
s.syncAsUint32LE(sd.SavedNoScrollData.NumNoV);
s.syncAsUint32LE(sd.SavedNoScrollData.NumNoH);
// Tinsel 2 fields
if (TinselV2) {
// SavedNoScrollData
s.syncAsUint32LE(sd.SavedNoScrollData.xTrigger);
s.syncAsUint32LE(sd.SavedNoScrollData.xDistance);
s.syncAsUint32LE(sd.SavedNoScrollData.xSpeed);
s.syncAsUint32LE(sd.SavedNoScrollData.yTriggerTop);
s.syncAsUint32LE(sd.SavedNoScrollData.yTriggerBottom);
s.syncAsUint32LE(sd.SavedNoScrollData.yDistance);
s.syncAsUint32LE(sd.SavedNoScrollData.ySpeed);
for (int i = 0; i < NUM_ZPOSITIONS; ++i)
syncZPosition(s, sd.zPositions[i]);
s.syncBytes(sd.savedActorZ, MAX_SAVED_ACTOR_Z);
for (int i = 0; i < MAX_POLY; ++i)
syncPolyVolatile(s, sd.SavedPolygonStuff[i]);
for (int i = 0; i < 3; ++i)
s.syncAsUint32LE(sd.SavedTune[i]);
s.syncAsByte(sd.bTinselDim);
s.syncAsSint32LE(sd.SavedScrollFocus);
for (int i = 0; i < SV_TOPVALID; ++i)
s.syncAsSint32LE(sd.SavedSystemVars[i]);
for (int i = 0; i < MAX_SOUNDREELS; ++i)
syncSoundReel(s, sd.SavedSoundReels[i]);
}
}
示例6: DoSync
static bool DoSync(Common::Serializer &s, int numInterp) {
int sg = 0;
if (TinselV2) {
if (s.isSaving())
g_restoreCD = GetCurrentCD();
s.syncAsSint16LE(g_restoreCD);
}
if (TinselV2 && s.isLoading())
HoldItem(INV_NOICON);
syncSavedData(s, *g_srsd, numInterp);
syncGlobInfo(s); // Glitter globals
syncInvInfo(s); // Inventory data
// Held object
if (s.isSaving())
sg = WhichItemHeld();
s.syncAsSint32LE(sg);
if (s.isLoading()) {
if (sg != -1 && !GetIsInvObject(sg))
// Not a valid inventory object, so return false
return false;
if (TinselV2)
g_thingHeld = sg;
else
HoldItem(sg);
}
syncTimerInfo(s); // Timer data
if (!TinselV2)
syncPolyInfo(s); // Dead polygon data
syncSCdata(s); // Hook Scene and delayed scene
s.syncAsSint32LE(*g_SaveSceneSsCount);
if (*g_SaveSceneSsCount != 0) {
SAVED_DATA *sdPtr = g_SaveSceneSsData;
for (int i = 0; i < *g_SaveSceneSsCount; ++i, ++sdPtr)
syncSavedData(s, *sdPtr, numInterp);
// Flag that there is a saved scene to return to. Note that in this context 'saved scene'
// is a stored scene to return to from another scene, such as from the Summoning Book close-up
// in Discworld 1 to whatever scene Rincewind was in prior to that
g_ASceneIsSaved = true;
}
if (!TinselV2)
syncAllActorsAlive(s);
return true;
}
示例7: saveLoadWithSerializer
void Player_AD::saveLoadWithSerializer(Common::Serializer &s) {
Common::StackLock lock(_mutex);
if (s.getVersion() < VER(95)) {
IMuse *dummyImuse = IMuse::create(_vm->_system, NULL, NULL);
dummyImuse->saveLoadIMuse(s, _vm, false);
delete dummyImuse;
return;
}
if (s.getVersion() >= VER(96)) {
int32 res[4] = {
_musicResource, _sfx[0].resource, _sfx[1].resource, _sfx[2].resource
};
// The first thing we save is a list of sound resources being played
// at the moment.
s.syncArray(res, 4, Common::Serializer::Sint32LE);
// If we are loading start the music again at this point.
if (s.isLoading()) {
if (res[0] != -1) {
startSound(res[0]);
}
}
uint32 musicOffset = _curOffset;
s.syncAsSint32LE(_engineMusicTimer, VER(96));
s.syncAsUint32LE(_musicTimer, VER(96));
s.syncAsUint32LE(_internalMusicTimer, VER(96));
s.syncAsUint32LE(_curOffset, VER(96));
s.syncAsUint32LE(_nextEventTimer, VER(96));
// We seek back to the old music position.
if (s.isLoading()) {
SWAP(musicOffset, _curOffset);
musicSeekTo(musicOffset);
}
// Finally start up the SFX. This makes sure that they are not
// accidently stopped while seeking to the old music position.
if (s.isLoading()) {
for (int i = 1; i < ARRAYSIZE(res); ++i) {
if (res[i] != -1) {
startSound(res[i]);
}
}
}
}
}
示例8: syncWithSerializer
/**
* (Un)serialize an interpreter context for save/restore game.
*/
void INT_CONTEXT::syncWithSerializer(Common::Serializer &s) {
if (s.isLoading()) {
// Null out the pointer fields
pProc = NULL;
code = NULL;
pinvo = NULL;
}
// Write out used fields
s.syncAsUint32LE(GSort);
s.syncAsUint32LE(hCode);
s.syncAsUint32LE(event);
s.syncAsSint32LE(hPoly);
s.syncAsSint32LE(idActor);
for (int i = 0; i < PCODE_STACK_SIZE; ++i)
s.syncAsSint32LE(stack[i]);
s.syncAsSint32LE(sp);
s.syncAsSint32LE(bp);
s.syncAsSint32LE(ip);
s.syncAsUint32LE(bHalt);
s.syncAsUint32LE(escOn);
s.syncAsSint32LE(myEscape);
}
示例9: syncSoundReel
static void syncSoundReel(Common::Serializer &s, SOUNDREELS &sr) {
s.syncAsUint32LE(sr.hFilm);
s.syncAsSint32LE(sr.column);
s.syncAsSint32LE(sr.actorCol);
}
示例10: syncZPosition
static void syncZPosition(Common::Serializer &s, Z_POSITIONS &zp) {
s.syncAsSint16LE(zp.actor);
s.syncAsSint16LE(zp.column);
s.syncAsSint32LE(zp.z);
}
示例11: syncNoScrollB
static void syncNoScrollB(Common::Serializer &s, NOSCROLLB &ns) {
s.syncAsSint32LE(ns.ln);
s.syncAsSint32LE(ns.c1);
s.syncAsSint32LE(ns.c2);
}
示例12: saveLoadEarly
void IMuseDigital::saveLoadEarly(Common::Serializer &s) {
Common::StackLock lock(_mutex, "IMuseDigital::saveLoadEarly()");
s.skip(4, VER(31), VER(42)); // _volVoice
s.skip(4, VER(31), VER(42)); // _volSfx
s.skip(4, VER(31), VER(42)); // _volMusic
s.syncAsSint32LE(_curMusicState, VER(31));
s.syncAsSint32LE(_curMusicSeq, VER(31));
s.syncAsSint32LE(_curMusicCue, VER(31));
s.syncAsSint32LE(_nextSeqToPlay, VER(31));
s.syncAsByte(_radioChatterSFX, VER(76));
s.syncArray(_attributes, 188, Common::Serializer::Sint32LE, VER(31));
for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) {
Track *track = _track[l];
if (s.isLoading()) {
memset(track, 0, sizeof(Track));
}
syncWithSerializer(s, *track);
if (s.isLoading()) {
_track[l]->trackId = l;
if (!track->used)
continue;
if ((track->toBeRemoved) || (track->souStreamUsed) || (track->curRegion == -1)) {
track->used = false;
continue;
}
// TODO: The code below has a lot in common with that in IMuseDigital::startSound.
// Try to refactor them to reduce the code duplication.
track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, -1);
if (!track->soundDesc)
track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, 1);
if (!track->soundDesc)
track->soundDesc = _sound->openSound(track->soundId, track->soundName, track->soundType, track->volGroupId, 2);
if (!track->soundDesc) {
warning("IMuseDigital::saveOrLoad: Can't open sound so will not be resumed");
track->used = false;
continue;
}
track->sndDataExtComp = _sound->isSndDataExtComp(track->soundDesc);
track->dataOffset = _sound->getRegionOffset(track->soundDesc, track->curRegion);
int bits = _sound->getBits(track->soundDesc);
int channels = _sound->getChannels(track->soundDesc);
int freq = _sound->getFreq(track->soundDesc);
track->feedSize = freq * channels;
track->mixerFlags = 0;
if (channels == 2)
track->mixerFlags = kFlagStereo;
if ((bits == 12) || (bits == 16)) {
track->mixerFlags |= kFlag16Bits;
track->feedSize *= 2;
} else if (bits == 8) {
track->mixerFlags |= kFlagUnsigned;
} else
error("IMuseDigital::saveOrLoad(): Can't handle %d bit samples", bits);
track->stream = Audio::makeQueuingAudioStream(freq, (track->mixerFlags & kFlagStereo) != 0);
_mixer->playStream(track->getType(), &track->mixChanHandle, track->stream, -1, track->getVol(), track->getPan());
_mixer->pauseHandle(track->mixChanHandle, true);
}
}
}
示例13: synchronize
void AvalancheEngine::synchronize(Common::Serializer &sz) {
_animation->synchronize(sz);
_parser->synchronize(sz);
_nim->synchronize(sz);
_sequence->synchronize(sz);
_background->synchronize(sz);
sz.syncAsByte(_carryNum);
for (int i = 0; i < kObjectNum; i++)
sz.syncAsByte(_objects[i]);
sz.syncAsSint16LE(_score);
sz.syncAsSint32LE(_money);
sz.syncAsByte(_room);
if (sz.isSaving())
_saveNum++;
sz.syncAsByte(_saveNum);
sz.syncBytes(_roomCount, 100);
sz.syncAsByte(_wonNim);
sz.syncAsByte(_wineState);
sz.syncAsByte(_cwytalotGone);
sz.syncAsByte(_passwordNum);
sz.syncAsByte(_aylesIsAwake);
sz.syncAsByte(_drawbridgeOpen);
sz.syncAsByte(_avariciusTalk);
sz.syncAsByte(_rottenOnion);
sz.syncAsByte(_onionInVinegar);
sz.syncAsByte(_givenToSpludwick);
sz.syncAsByte(_brummieStairs);
sz.syncAsByte(_cardiffQuestionNum);
sz.syncAsByte(_passedCwytalotInHerts);
sz.syncAsByte(_avvyIsAwake);
sz.syncAsByte(_avvyInBed);
sz.syncAsByte(_userMovesAvvy);
sz.syncAsByte(_npcFacing);
sz.syncAsByte(_givenBadgeToIby);
sz.syncAsByte(_friarWillTieYouUp);
sz.syncAsByte(_tiedUp);
sz.syncAsByte(_boxContent);
sz.syncAsByte(_talkedToCrapulus);
sz.syncAsByte(_jacquesState);
sz.syncAsByte(_bellsAreRinging);
sz.syncAsByte(_standingOnDais);
sz.syncAsByte(_takenPen);
sz.syncAsByte(_arrowInTheDoor);
if (sz.isSaving()) {
uint16 like2drinkSize = _favoriteDrink.size();
sz.syncAsUint16LE(like2drinkSize);
for (uint16 i = 0; i < like2drinkSize; i++) {
char actChr = _favoriteDrink[i];
sz.syncAsByte(actChr);
}
uint16 favoriteSongSize = _favoriteSong.size();
sz.syncAsUint16LE(favoriteSongSize);
for (uint16 i = 0; i < favoriteSongSize; i++) {
char actChr = _favoriteSong[i];
sz.syncAsByte(actChr);
}
uint16 worst_place_on_earthSize = _worstPlaceOnEarth.size();
sz.syncAsUint16LE(worst_place_on_earthSize);
for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
char actChr = _worstPlaceOnEarth[i];
sz.syncAsByte(actChr);
}
uint16 spare_eveningSize = _spareEvening.size();
sz.syncAsUint16LE(spare_eveningSize);
for (uint16 i = 0; i < spare_eveningSize; i++) {
char actChr = _spareEvening[i];
sz.syncAsByte(actChr);
}
} else {
if (!_favoriteDrink.empty())
_favoriteDrink.clear();
uint16 like2drinkSize = 0;
char actChr = ' ';
sz.syncAsUint16LE(like2drinkSize);
for (uint16 i = 0; i < like2drinkSize; i++) {
sz.syncAsByte(actChr);
_favoriteDrink += actChr;
}
if (!_favoriteSong.empty())
_favoriteSong.clear();
uint16 favoriteSongSize = 0;
sz.syncAsUint16LE(favoriteSongSize);
for (uint16 i = 0; i < favoriteSongSize; i++) {
sz.syncAsByte(actChr);
_favoriteSong += actChr;
}
if (!_worstPlaceOnEarth.empty())
_worstPlaceOnEarth.clear();
uint16 worst_place_on_earthSize = 0;
sz.syncAsUint16LE(worst_place_on_earthSize);
for (uint16 i = 0; i < worst_place_on_earthSize; i++) {
sz.syncAsByte(actChr);
_worstPlaceOnEarth += actChr;
//.........这里部分代码省略.........
示例14: syncGlobInfo
/**
* (Un)serialize the global data for save/restore game.
*/
void syncGlobInfo(Common::Serializer &s) {
for (int i = 0; i < numGlobals; i++) {
s.syncAsSint32LE(pGlobals[i]);
}
}
示例15: syncWithSerializer
static void syncWithSerializer(Common::Serializer &s, Track &t) {
s.syncAsSByte(t.pan, VER(31));
s.syncAsSint32LE(t.vol, VER(31));
s.syncAsSint32LE(t.volFadeDest, VER(31));
s.syncAsSint32LE(t.volFadeStep, VER(31));
s.syncAsSint32LE(t.volFadeDelay, VER(31));
s.syncAsByte(t.volFadeUsed, VER(31));
s.syncAsSint32LE(t.soundId, VER(31));
s.syncArray(t.soundName, 15, Common::Serializer::SByte, VER(31));
s.syncAsByte(t.used, VER(31));
s.syncAsByte(t.toBeRemoved, VER(31));
s.syncAsByte(t.souStreamUsed, VER(31));
s.skip(1, VER(31), VER(76)); // mixerStreamRunning
s.syncAsSint32LE(t.soundPriority, VER(31));
s.syncAsSint32LE(t.regionOffset, VER(31));
s.skip(4, VER(31), VER(31)); // trackOffset
s.syncAsSint32LE(t.dataOffset, VER(31));
s.syncAsSint32LE(t.curRegion, VER(31));
s.syncAsSint32LE(t.curHookId, VER(31));
s.syncAsSint32LE(t.volGroupId, VER(31));
s.syncAsSint32LE(t.soundType, VER(31));
s.syncAsSint32LE(t.feedSize, VER(31));
s.syncAsSint32LE(t.dataMod12Bit, VER(31));
s.syncAsSint32LE(t.mixerFlags, VER(31));
s.skip(4, VER(31), VER(42)); // mixerVol
s.skip(4, VER(31), VER(42)); // mixerPan
s.syncAsByte(t.sndDataExtComp, VER(45));
}