本文整理汇总了C++中common::Serializer::bytesSynced方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::bytesSynced方法的具体用法?C++ Serializer::bytesSynced怎么用?C++ Serializer::bytesSynced使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::bytesSynced方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
// Skip over any extra bytes
s.skip(tmp);
return true;
}
示例2: syncLocation
bool BuriedEngine::syncLocation(Common::Serializer &s, Location &location) {
s.syncAsSint16LE(location.timeZone);
s.syncAsSint16LE(location.environment);
s.syncAsSint16LE(location.node);
s.syncAsSint16LE(location.facing);
s.syncAsSint16LE(location.orientation);
s.syncAsSint16LE(location.depth);
return s.bytesSynced() == 12;
}
示例3: 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;
}
示例4: syncGameState
//.........这里部分代码省略.........
s.syncAsUint32LE(_channelwood.waterPumpBridgeState);
s.syncAsUint32LE(_channelwood.elevatorState);
s.syncAsUint32LE(_channelwood.stairsLowerDoorState);
s.syncAsUint32LE(_channelwood.pipeState);
} else {
s.syncAsByte(_channelwood.waterPumpBridgeState);
s.syncAsByte(_channelwood.elevatorState);
s.syncAsByte(_channelwood.stairsLowerDoorState);
s.syncAsByte(_channelwood.pipeState);
}
s.syncAsUint16LE(_channelwood.waterValveStates);
s.syncAsUint16LE(_channelwood.holoprojectorSelection);
s.syncAsUint16LE(_channelwood.stairsUpperDoorState);
if (isME)
s.skip(4);
else
s.skip(1);
// Mechanical
s.syncAsUint16LE(_mechanical.achenarPanelState);
s.syncAsUint16LE(_mechanical.sirrusPanelState);
s.syncAsUint16LE(_mechanical.staircaseState);
s.syncAsUint16LE(_mechanical.elevatorRotation);
for (int i = 0; i < 4; i++)
s.syncAsUint16LE(_mechanical.codeShape[i]);
// Selenitic
if (isME) {
s.syncAsUint32LE(_selenitic.emitterEnabledWater);
s.syncAsUint32LE(_selenitic.emitterEnabledVolcano);
s.syncAsUint32LE(_selenitic.emitterEnabledClock);
s.syncAsUint32LE(_selenitic.emitterEnabledCrystal);
s.syncAsUint32LE(_selenitic.emitterEnabledWind);
s.syncAsUint32LE(_selenitic.soundReceiverOpened);
s.syncAsUint32LE(_selenitic.tunnelLightsSwitchedOn);
} else {
s.syncAsByte(_selenitic.emitterEnabledWater);
s.syncAsByte(_selenitic.emitterEnabledVolcano);
s.syncAsByte(_selenitic.emitterEnabledClock);
s.syncAsByte(_selenitic.emitterEnabledCrystal);
s.syncAsByte(_selenitic.emitterEnabledWind);
s.syncAsByte(_selenitic.soundReceiverOpened);
s.syncAsByte(_selenitic.tunnelLightsSwitchedOn);
}
s.syncAsUint16LE(_selenitic.soundReceiverCurrentSource);
for (byte i = 0; i < 5; i++)
s.syncAsUint16LE(_selenitic.soundReceiverPositions[i]);
for (byte i = 0; i < 5; i++)
s.syncAsUint16LE(_selenitic.soundLockSliderPositions[i]);
// Stoneship
if (isME) {
s.syncAsUint32LE(_stoneship.lightState);
} else {
s.syncAsByte(_stoneship.lightState);
}
s.syncAsUint16LE(_stoneship.sideDoorOpened);
s.syncAsUint16LE(_stoneship.pumpState);
s.syncAsUint16LE(_stoneship.trapdoorState);
s.syncAsUint16LE(_stoneship.chestWaterState);
s.syncAsUint16LE(_stoneship.chestValveState);
s.syncAsUint16LE(_stoneship.chestOpenState);
s.syncAsUint16LE(_stoneship.trapdoorKeyState);
s.syncAsUint32LE(_stoneship.generatorDuration);
s.syncAsUint16LE(_stoneship.generatorPowerAvailable);
s.syncAsUint32LE(_stoneship.generatorDepletionTime);
// D'ni
s.syncAsUint16LE(_globals.ending);
// Already visited zip destinations
for (byte i = 0; i < 41; i++)
s.syncAsUint16LE(_mystReachableZipDests[i]);
for (byte i = 0; i < 41; i++)
s.syncAsUint16LE(_channelwoodReachableZipDests[i]);
for (byte i = 0; i < 41; i++)
s.syncAsUint16LE(_mechReachableZipDests[i]);
for (byte i = 0; i < 41; i++)
s.syncAsUint16LE(_seleniticReachableZipDests[i]);
for (byte i = 0; i < 41; i++)
s.syncAsUint16LE(_stoneshipReachableZipDests[i]);
if ((isME && s.bytesSynced() != 664) || (!isME && s.bytesSynced() != 601))
warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced());
}
示例5: syncGlobalFlags
bool BuriedEngine::syncGlobalFlags(Common::Serializer &s, GlobalFlags &flags) {
uint32 startBytes = s.bytesSynced();
s.syncAsByte(flags.cgWallExploded);
s.syncAsByte(flags.cgHookPresent);
s.syncAsByte(flags.cgArrowPresent);
s.syncAsByte(flags.cgHammerPresent);
s.syncAsByte(flags.cgSmithyStatus);
s.syncAsByte(flags.cgSmithyGuard);
s.syncAsByte(flags.cgBaileyOneWayGuard);
s.syncAsByte(flags.cgBaileyTwoWayGuards);
s.syncAsByte(flags.cgTapestryFlag);
s.syncAsByte(flags.cgBurnedLetterPresent);
s.syncAsByte(flags.cgGoldCoinsPresent);
s.syncAsByte(flags.cgStorageRoomVisit);
s.syncAsByte(flags.bcTranslateEnabled);
s.syncAsByte(flags.bcCloakingEnabled);
s.syncAsByte(flags.bcLocateEnabled);
s.syncAsByte(flags.myPickedUpCeramicBowl);
s.syncAsByte(flags.myTPCodeWheelStatus);
s.syncAsByte(flags.myTPCodeWheelLeftIndex);
s.syncAsByte(flags.myTPCodeWheelRightIndex);
s.syncAsByte(flags.myMCPickedUpSkull);
s.syncAsByte(flags.myMCDeathGodOfferings);
s.syncAsByte(flags.myWGPlacedRope);
s.syncAsByte(flags.myWGRetrievedJadeBlock);
s.syncAsByte(flags.myWTRetrievedLimestoneBlock);
s.syncAsByte(flags.myWTCurrentBridgeStatus);
s.syncAsByte(flags.myAGRetrievedEntrySkull);
s.syncAsByte(flags.myAGRetrievedSpearSkull);
s.syncAsByte(flags.myAGRetrievedCopperMedal);
s.syncAsByte(flags.myAGRetrievedObsidianBlock);
s.syncAsByte(flags.myAGHeadAStatus);
s.syncAsByte(flags.myAGHeadBStatus);
s.syncAsByte(flags.myAGHeadCStatus);
s.syncAsByte(flags.myAGHeadDStatus);
s.syncAsByte(flags.myAGHeadAStatusSkullID);
s.syncAsByte(flags.myAGHeadBStatusSkullID);
s.syncAsByte(flags.myAGHeadCStatusSkullID);
s.syncAsByte(flags.myAGHeadDStatusSkullID);
s.syncAsByte(flags.myAGTimerHeadID);
SYNC_FLAG_UINT32(myAGTimerStartTime);
s.syncAsByte(flags.myDGOfferedHeart);
s.syncAsByte(flags.takenEnvironCart);
s.syncAsByte(flags.alRDTakenLiveCore);
s.syncAsByte(flags.alRDTakenDeadCore);
s.syncAsByte(flags.alNMWrongAlienPrefixCode);
s.syncAsByte(flags.faKIOvenStatus);
s.syncAsByte(flags.faKIPostBoxSlotA);
s.syncAsByte(flags.faKIPostBoxSlotB);
s.syncAsByte(flags.faKIPostBoxSlotC);
s.syncAsByte(flags.faERCurrentCartridge);
s.syncAsByte(flags.faERTakenRemoteControl);
s.syncAsByte(flags.myMCStingerID);
s.syncAsByte(flags.myMCStingerChannelID);
s.syncAsByte(flags.faStingerID);
s.syncAsByte(flags.faStingerChannelID);
s.syncBytes(flags.unused0, sizeof(flags.unused0));
SYNC_FLAG_UINT32(cgMWCatapultData);
SYNC_FLAG_UINT32(cgMWCatapultOffset);
s.syncAsByte(flags.cgTSTriedDoor);
s.syncAsByte(flags.cgMBCrossedMoat);
s.syncAsByte(flags.cgKSSmithyEntryRead);
s.syncAsByte(flags.cgKSSmithyEntryTranslated);
s.syncAsByte(flags.cgBSFoundMold);
s.syncAsByte(flags.readBurnedLetter);
s.syncAsByte(flags.evcapNumCaptured);
s.syncBytes(flags.evcapBaseID, sizeof(flags.evcapBaseID));
s.syncBytes(flags.unused1, sizeof(flags.unused1));
s.syncAsByte(flags.faMNEnvironDoor);
s.syncAsByte(flags.faMNClockClicked);
s.syncAsByte(flags.faMNBooksClicked);
s.syncAsByte(flags.faMNTazClicked);
s.syncAsByte(flags.faMNPongClicked);
s.syncAsByte(flags.faKIBirdsBobbed);
s.syncAsByte(flags.faKICoffeeSpilled);
s.syncAsByte(flags.cgViewedKeepPlans);
s.syncAsByte(flags.cgFoundChestPanel);
s.syncAsByte(flags.cgTRFoundSword);
s.syncAsByte(flags.faHeardAgentFigure);
s.syncAsByte(flags.jumpBCNoInfoMessageCycle);
s.syncAsByte(flags.myTPCalendarTopTranslated);
s.syncAsByte(flags.myTPCalendarListTranslated);
s.syncAsByte(flags.myTPTextTranslated);
s.syncAsByte(flags.myMCTransDoor);
s.syncAsByte(flags.myMCTransAGOffering);
s.syncAsByte(flags.myMCTransWGOffering);
s.syncAsByte(flags.myMCTransWTOffering);
s.syncAsByte(flags.myMCTransDGOffering);
s.syncAsByte(flags.myMCTransMadeAnOffering);
s.syncAsByte(flags.myWGTransDoorTop);
s.syncAsByte(flags.myWGSeenLowerPassage);
s.syncAsByte(flags.myWGCrossedRopeBridge);
s.syncAsByte(flags.myMCViewedDeathGodDoor);
s.syncAsByte(flags.myTPTransBreathOfItzamna);
SYNC_FLAG_UINT32(myAGHeadAOpenedTime);
SYNC_FLAG_UINT32(myAGHeadBOpenedTime);
SYNC_FLAG_UINT32(myAGHeadCOpenedTime);
SYNC_FLAG_UINT32(myAGHeadDOpenedTime);
s.syncAsByte(flags.myAGHeadATouched);
//.........这里部分代码省略.........