本文整理汇总了C++中common::Serializer::syncAsByte方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::syncAsByte方法的具体用法?C++ Serializer::syncAsByte怎么用?C++ Serializer::syncAsByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::syncAsByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: synchronize
void MADSAction::synchronize(Common::Serializer &s) {
_action.synchronize(s);
_activeAction.synchronize(s);
s.syncAsSint16LE(_articleNumber);
s.syncAsByte(_lookFlag);
s.syncAsByte(_textChanged);
s.syncAsSint16LE(_selectedRow);
s.syncAsSint16LE(_selectedAction);
s.syncAsSint16LE(_statusTextIndex);
s.syncAsSint16LE(_hotspotId);
_savedFields.synchronize(s);
// TODO: When saving in Rex Village Hut, _senetence size() doesn't match
// string length. Find out why not
_sentence = Common::String(_sentence.c_str());
s.syncString(_sentence);
s.syncAsSint16LE(_verbType);
s.syncAsSint16LE(_prepType);
s.syncAsSint16LE(_commandSource);
s.syncAsSint16LE(_mainObjectSource);
s.syncAsSint16LE(_secondObject);
s.syncAsSint16LE(_secondObjectSource);
s.syncAsSint16LE(_recentCommandSource);
s.syncAsSint16LE(_recentCommand);
s.syncAsSint16LE(_interAwaiting);
s.syncAsSint16LE(_pickedWord);
s.syncAsByte(_pointEstablished);
s.syncAsByte(_inProgress);
}
示例3: syncAllActorsAlive
void syncAllActorsAlive(Common::Serializer &s) {
for (int i = 0; i < MAX_SAVED_ALIVES; i++) {
s.syncAsByte(actorInfo[i].bAlive);
s.syncAsByte(actorInfo[i].tagged);
s.syncAsByte(actorInfo[i].tType);
s.syncAsUint32LE(actorInfo[i].hTag);
}
}
示例4: syncTime
static void syncTime(Common::Serializer &s, TimeDate &t) {
s.syncAsUint16LE(t.tm_year);
s.syncAsByte(t.tm_mon);
s.syncAsByte(t.tm_mday);
s.syncAsByte(t.tm_hour);
s.syncAsByte(t.tm_min);
s.syncAsByte(t.tm_sec);
}
示例5: synchronize
void Scene::synchronize(Common::Serializer &s) {
_action.synchronize(s);
_rails.synchronize(s);
_userInterface.synchronize(s);
s.syncAsByte(_reloadSceneFlag);
s.syncAsByte(_roomChanged);
s.syncAsUint16LE(_nextSceneId);
s.syncAsUint16LE(_priorSceneId);
_dynamicHotspots.synchronize(s);
}
示例6: syncSaveGameHeader
static bool syncSaveGameHeader(Common::Serializer &s, SaveGameHeader &hdr) {
s.syncAsUint32LE(hdr.id);
s.syncAsUint32LE(hdr.size);
s.syncAsUint32LE(hdr.ver);
s.syncBytes((byte *)hdr.desc, SG_DESC_LEN);
hdr.desc[SG_DESC_LEN - 1] = 0;
syncTime(s, hdr.dateTime);
int tmp = hdr.size - s.bytesSynced();
// NOTE: We can't use SAVEGAME_ID here when attempting to remove a saved game from the launcher,
// as there is no TinselEngine initialized then. This means that we can't check if this is a DW1
// or DW2 savegame in this case, but it doesn't really matter, as the saved game is about to be
// deleted anyway. Refer to bug #3387551.
bool correctID = _vm ? (hdr.id == SAVEGAME_ID) : (hdr.id == DW1_SAVEGAME_ID || hdr.id == DW2_SAVEGAME_ID);
// Perform sanity check
if (tmp < 0 || !correctID || hdr.ver > CURRENT_VER || hdr.size > 1024)
return false;
if (tmp > 0) {
// If there's header space left, handling syncing the Scn flag and game language
s.syncAsByte(hdr.scnFlag);
s.syncAsByte(hdr.language);
tmp -= 2;
if (_vm && s.isLoading()) {
// If the engine is loaded, ensure the Scn/Gra usage is correct, and it's the correct language
if ((hdr.scnFlag != ((_vm->getFeatures() & GF_SCNFILES) != 0)) ||
(hdr.language != _vm->_config->_language))
return false;
}
}
// Handle the number of interpreter contexts that will be saved in the savegame
if (tmp >= 2) {
tmp -= 2;
hdr.numInterpreters = NUM_INTERPRET;
s.syncAsUint16LE(hdr.numInterpreters);
} else {
hdr.numInterpreters = (TinselV2 ? 70 : 64) - 20;
}
// Skip over any extra bytes
s.skip(tmp);
return true;
}
示例7: syncSongs
static void syncSongs(Common::Serializer &s) {
int size = 0;
if (songLoaded) {
// TODO: implement
s.syncAsByte(size);
if (s.isLoading()) {
saveVar1 = size;
if (saveVar1)
s.syncBytes(saveVar2, saveVar1);
}
} else {
s.syncAsByte(size);
}
}
示例8: 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);
}
}
示例9: 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]);
}
}
示例10: syncPreloadData
static void syncPreloadData(Common::Serializer &s) {
uint8 dummyByte = 0;
uint32 dummyLong = 0;
for (int i = 0; i < 64; i++) {
preloadStruct &pe = preloadData[i];
s.syncBytes((byte *)pe.name, 15);
s.syncAsByte(dummyByte);
s.syncAsUint32LE(pe.size);
s.syncAsUint32LE(pe.sourceSize);
s.syncAsUint32LE(dummyLong);
s.syncAsUint16LE(pe.nofree);
s.syncAsUint16LE(pe.protect);
s.syncAsUint16LE(pe.ovl);
}
}
示例11: syncHeader
void CGEEngine::syncHeader(Common::Serializer &s) {
debugC(1, kCGEDebugEngine, "CGEEngine::syncHeader(s)");
int i = kDemo;
s.syncAsUint16LE(_now);
s.syncAsUint16LE(_oldLev);
s.syncAsUint16LE(i); // unused Demo string id
for (i = 0; i < 5; i++)
s.syncAsUint16LE(_game);
s.syncAsSint16LE(i); // unused VGA::Mono variable
s.syncAsUint16LE(_music);
s.syncBytes(_volume, 2);
for (i = 0; i < 4; i++)
s.syncAsUint16LE(_flag[i]);
if (s.isLoading()) {
// Reset scene values
initSceneValues();
}
for (i = 0; i < kSceneMax; i++) {
s.syncAsSint16LE(_heroXY[i].x);
s.syncAsUint16LE(_heroXY[i].y);
}
for (i = 0; i < 1 + kSceneMax; i++) {
s.syncAsByte(_barriers[i]._horz);
s.syncAsByte(_barriers[i]._vert);
}
for (i = 0; i < kPocketNX; i++)
s.syncAsUint16LE(_pocref[i]);
if (s.isSaving()) {
// Write checksum
int checksum = kSavegameCheckSum;
s.syncAsUint16LE(checksum);
} else {
// Read checksum and validate it
uint16 checksum = 0;
s.syncAsUint16LE(checksum);
if (checksum != kSavegameCheckSum)
error("%s", _text->getText(kBadSVG));
}
}
示例12:
static void syncOverlays1(Common::Serializer &s) {
uint8 dummyByte = 0;
uint32 dummyLong = 0;
for (int i = 0; i < numOfLoadedOverlay; i++) {
overlayStruct &oe = overlayTable[i];
s.syncBytes((byte *)oe.overlayName, 13);
s.syncAsByte(dummyByte);
s.syncAsUint32LE(dummyLong);
s.syncAsUint16LE(oe.alreadyLoaded);
s.syncAsUint16LE(oe.state);
s.syncAsUint32LE(dummyLong);
s.syncAsUint32LE(dummyLong);
s.syncAsUint32LE(dummyLong);
s.syncAsUint32LE(dummyLong);
s.syncAsUint16LE(oe.executeScripts);
}
}
示例13: syncBitFlags
void SavesManager::syncBitFlags(Common::Serializer &s, bool *startP, bool *endP) {
byte data = 0;
int bitCounter = 0;
for (bool *p = startP; p <= endP; ++p, bitCounter = (bitCounter + 1) % 8) {
if (p == endP || bitCounter == 0) {
if (p != endP || s.isSaving())
s.syncAsByte(data);
if (p == endP)
break;
if (s.isSaving())
data = 0;
}
if (s.isLoading())
*p = (data >> bitCounter) != 0;
else if (*p)
data |= 1 << bitCounter;
}
示例14: syncFilesDatabase
static void syncFilesDatabase(Common::Serializer &s) {
uint8 dummyVal = 0;
uint32 tmp;
for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
dataFileEntry &fe = filesDatabase[i];
s.syncAsUint16LE(fe.widthInColumn);
s.syncAsUint16LE(fe.width);
s.syncAsUint16LE(fe.resType);
s.syncAsUint16LE(fe.height);
// Remember whether this file database was open or not.
// Upon loading, loadSavegameData uses this information
// in order to re-open the file databases accordingly.
tmp = (fe.subData.ptr) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptr = tmp ? (uint8 *)1 : 0;
}
s.syncAsSint16LE(fe.subData.index);
s.syncBytes((byte *)fe.subData.name, 13);
s.syncAsByte(dummyVal);
s.syncAsSint16LE(fe.subData.transparency);
// Treat fe.subData.ptrMask the same as fe.subData.ptr.
tmp = (fe.subData.ptrMask) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptrMask = tmp ? (uint8 *)1 : 0;
}
s.syncAsUint16LE(fe.subData.resourceType);
s.syncAsSint16LE(fe.subData.compression);
}
}
示例15: syncFilesDatabase
static void syncFilesDatabase(Common::Serializer &s) {
uint8 dummyVal = 0;
uint32 tmp;
for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
dataFileEntry &fe = filesDatabase[i];
s.syncAsUint16LE(fe.widthInColumn);
s.syncAsUint16LE(fe.width);
s.syncAsUint16LE(fe.resType);
s.syncAsUint16LE(fe.height);
// TODO: Have a look at the saving/loading of this pointer
tmp = (fe.subData.ptr) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptr = (uint8 *)tmp;
}
s.syncAsSint16LE(fe.subData.index);
s.syncBytes((byte *)fe.subData.name, 13);
s.syncAsByte(dummyVal);
s.syncAsSint16LE(fe.subData.transparency);
// TODO: Have a look at the saving/loading of this pointer
tmp = (fe.subData.ptrMask) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptrMask = (uint8 *)tmp;
}
s.syncAsUint16LE(fe.subData.resourceType);
s.syncAsSint16LE(fe.subData.compression);
}
}