本文整理汇总了C++中common::Serializer::syncAsUint32LE方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::syncAsUint32LE方法的具体用法?C++ Serializer::syncAsUint32LE怎么用?C++ Serializer::syncAsUint32LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::syncAsUint32LE方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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: 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]);
}
}
}
}
}
示例5: 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;
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: saveLoadWithSerializer
//////////////////////////////////////////////////////////////////////////
// Savegame
//////////////////////////////////////////////////////////////////////////
void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
Common::StackLock locker(_mutex);
s.syncAsUint32LE(_state);
s.syncAsUint32LE(_currentType);
// Compute the number of entries to save
uint32 numEntries = count();
s.syncAsUint32LE(numEntries);
// Save or load each entry data
if (s.isSaving()) {
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
(*i)->saveLoadWithSerializer(s);
} else {
warning("[Sound::saveLoadWithSerializer] Loading not implemented");
s.skip(numEntries * 64);
}
}
示例9:
void SaveLoad::sync<ScriptRegister::Script>(Common::Serializer &serializer, ScriptRegister::Script &var) {
if (serializer.isSaving())
if (var.chunk)
var.line = var.chunk->getCurLine();
serializer.syncAsUint32LE(var.line);
if (serializer.isLoading())
var.chunk = 0;
}
示例10: syncSavedActor
static void syncSavedActor(Common::Serializer &s, SAVED_ACTOR &sa) {
s.syncAsUint16LE(sa.actorID);
s.syncAsUint16LE(sa.zFactor);
s.syncAsUint16LE(sa.bAlive);
s.syncAsUint16LE(sa.bHidden);
s.syncAsUint32LE(sa.presFilm);
s.syncAsUint16LE(sa.presRnum);
s.syncAsUint16LE(sa.presPlayX);
s.syncAsUint16LE(sa.presPlayY);
}
示例11:
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);
}
}
示例12: syncScript
void syncScript(Common::Serializer &s, scriptInstanceStruct *entry) {
int numScripts = 0;
uint32 dummyLong = 0;
uint16 dummyWord = 0;
if (s.isSaving()) {
// Figure out the number of scripts to save
scriptInstanceStruct* pCurrent = entry->nextScriptPtr;
while (pCurrent) {
++numScripts;
pCurrent = pCurrent->nextScriptPtr;
}
}
s.syncAsSint16LE(numScripts);
scriptInstanceStruct *ptr = entry->nextScriptPtr;
for (int i = 0; i < numScripts; ++i) {
if (s.isLoading())
ptr = (scriptInstanceStruct *)mallocAndZero(sizeof(scriptInstanceStruct));
s.syncAsUint16LE(dummyWord);
s.syncAsSint16LE(ptr->ccr);
s.syncAsSint16LE(ptr->scriptOffset);
s.syncAsUint32LE(dummyLong);
s.syncAsSint16LE(ptr->dataSize);
s.syncAsSint16LE(ptr->scriptNumber);
s.syncAsSint16LE(ptr->overlayNumber);
s.syncAsSint16LE(ptr->sysKey);
s.syncAsSint16LE(ptr->freeze);
s.syncAsSint16LE(ptr->type);
s.syncAsSint16LE(ptr->var16);
s.syncAsSint16LE(ptr->var18);
s.syncAsSint16LE(ptr->var1A);
s.syncAsSint16LE(ptr->dataSize);
if (ptr->dataSize) {
if (s.isLoading())
ptr->data = (byte *)mallocAndZero(ptr->dataSize);
s.syncBytes(ptr->data, ptr->dataSize);
}
if (s.isLoading()) {
ptr->nextScriptPtr = NULL;
entry->nextScriptPtr = ptr;
entry = ptr;
} else {
ptr = ptr->nextScriptPtr;
}
}
}
示例13: 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);
}
}
示例14: saveLoadWithSerializer
//////////////////////////////////////////////////////////////////////////
// Savegame
//////////////////////////////////////////////////////////////////////////
void SoundQueue::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsUint32LE(_ambientState);
s.syncAsUint32LE(_currentTag);
// Save or load each entry data
if (s.isSaving()) {
// Compute the number of entries to save
uint32 numEntries = count();
s.syncAsUint32LE(numEntries);
for (Common::List<SoundEntry *>::iterator i = _soundList.begin(); i != _soundList.end(); ++i)
if ((*i)->needSaving())
(*i)->saveLoadWithSerializer(s);
} else {
uint32 numEntries;
s.syncAsUint32LE(numEntries);
for (uint32 i = 0; i < numEntries; i++) {
SoundEntry* entry = new SoundEntry(_engine);
entry->saveLoadWithSerializer(s);
addToQueue(entry);
}
}
}
示例15: syncActors
static void syncActors(Common::Serializer &s) {
int numEntries = 0;
actorStruct *ptr;
uint16 dummyLong = 0;
if (s.isSaving()) {
ptr = actorHead.next;
while (ptr) {
++numEntries;
ptr = ptr->next;
}
}
s.syncAsSint16LE(numEntries);
ptr = s.isSaving() ? actorHead.next : &actorHead;
for (int i = 0; i < numEntries; ++i) {
actorStruct *p = s.isSaving() ? ptr : (actorStruct *)mallocAndZero(sizeof(actorStruct));
s.syncAsUint32LE(dummyLong);
s.syncAsSint16LE(p->idx);
s.syncAsSint16LE(p->type);
s.syncAsSint16LE(p->overlayNumber);
s.syncAsSint16LE(p->x_dest);
s.syncAsSint16LE(p->y_dest);
s.syncAsSint16LE(p->x);
s.syncAsSint16LE(p->y);
s.syncAsSint16LE(p->startDirection);
s.syncAsSint16LE(p->nextDirection);
s.syncAsSint16LE(p->endDirection);
s.syncAsSint16LE(p->stepX);
s.syncAsSint16LE(p->stepY);
s.syncAsSint16LE(p->pathId);
s.syncAsSint16LE(p->phase);
s.syncAsSint16LE(p->counter);
s.syncAsSint16LE(p->poly);
s.syncAsSint16LE(p->flag);
s.syncAsSint16LE(p->start);
s.syncAsSint16LE(p->freeze);
if (s.isSaving())
ptr = ptr->next;
else {
p->next = NULL;
ptr->next = p;
p->prev = actorHead.prev;
actorHead.prev = p;
ptr = p->next;
}
}
}