本文整理汇总了C++中common::Serializer::syncAsUint16LE方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::syncAsUint16LE方法的具体用法?C++ Serializer::syncAsUint16LE怎么用?C++ Serializer::syncAsUint16LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::syncAsUint16LE方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: syncCell
static void syncCell(Common::Serializer &s) {
int chunkCount = 0;
cellStruct *t, *p;
uint16 dummyWord = 0;
if (s.isSaving()) {
// Figure out the number of chunks to save
t = cellHead.next;
while (t) {
++chunkCount;
t = t->next;
}
} else {
cellHead.next = NULL; // Not in ASM code, but I guess the variable is defaulted in the EXE
}
s.syncAsSint16LE(chunkCount);
t = s.isSaving() ? cellHead.next : &cellHead;
for (int i = 0; i < chunkCount; ++i) {
p = s.isSaving() ? t : (cellStruct *)mallocAndZero(sizeof(cellStruct));
s.syncAsUint16LE(dummyWord);
s.syncAsUint16LE(dummyWord);
s.syncAsSint16LE(p->idx);
s.syncAsSint16LE(p->type);
s.syncAsSint16LE(p->overlay);
s.syncAsSint16LE(p->x);
s.syncAsSint16LE(p->field_C);
s.syncAsSint16LE(p->spriteIdx);
s.syncAsSint16LE(p->color);
s.syncAsSint16LE(p->backgroundPlane);
s.syncAsSint16LE(p->freeze);
s.syncAsSint16LE(p->parent);
s.syncAsSint16LE(p->parentOverlay);
s.syncAsSint16LE(p->parentType);
s.syncAsSint16LE(p->followObjectOverlayIdx);
s.syncAsSint16LE(p->followObjectIdx);
s.syncAsSint16LE(p->animStart);
s.syncAsSint16LE(p->animEnd);
s.syncAsSint16LE(p->animWait);
s.syncAsSint16LE(p->animStep);
s.syncAsSint16LE(p->animChange);
s.syncAsSint16LE(p->animType);
s.syncAsSint16LE(p->animSignal);
s.syncAsSint16LE(p->animCounter);
s.syncAsSint16LE(p->animLoop);
s.syncAsUint16LE(dummyWord);
if (s.isSaving())
t = t->next;
else {
p->next = NULL;
t->next = p;
p->prev = cellHead.prev;
cellHead.prev = p;
t = p;
}
}
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
}
示例5: 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);
}
示例6: syncSoundList
static void syncSoundList(Common::Serializer &s) {
for (int i = 0; i < 4; ++i) {
SoundEntry &se = soundList[i];
s.syncAsSint16LE(se.frameNum);
s.syncAsUint16LE(se.frequency);
s.syncAsSint16LE(se.volume);
}
}
示例7: 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));
}
}
示例8: synchronize
void Game::synchronize(Common::Serializer &s, bool phase1) {
if (phase1) {
s.syncAsSint16LE(_fx);
s.syncAsSint16LE(_trigger);
s.syncAsUint16LE(_triggerSetupMode);
s.syncAsUint16LE(_triggerMode);
s.syncString(_aaName);
s.syncAsSint16LE(_lastSave);
_scene.synchronize(s);
_objects.synchronize(s);
_visitedScenes.synchronize(s, _scene._nextSceneId);
_player.synchronize(s);
_screenObjects.synchronize(s);
} else {
// Load scene specific data for the loaded scene
_scene._sceneLogic->synchronize(s);
}
}
示例9:
void CGE2Engine::syncHeader(Common::Serializer &s) {
s.syncAsUint16LE(_now);
s.syncAsUint16LE(_sex);
s.syncAsUint16LE(_vga->_rot._len);
s.syncAsUint16LE(_waitSeq);
s.syncAsUint16LE(_waitRef);
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));
}
}
示例10:
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);
}
}
示例11: 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;
}
}
}
示例12: 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);
}
}
示例13: syncBasicInfo
static void syncBasicInfo(Common::Serializer &s) {
s.syncAsSint16LE(activeMouse);
s.syncAsSint16LE(userEnabled);
s.syncAsSint16LE(dialogueEnabled);
s.syncAsSint16LE(dialogueOvl);
s.syncAsSint16LE(dialogueObj);
s.syncAsSint16LE(userDelay);
s.syncAsSint16LE(sysKey);
s.syncAsSint16LE(sysX);
s.syncAsSint16LE(sysY);
s.syncAsSint16LE(automoveInc);
s.syncAsSint16LE(automoveMax);
s.syncAsSint16LE(displayOn);
s.syncAsSint16LE(isMessage);
s.syncAsSint16LE(fadeFlag);
s.syncAsSint16LE(automaticMode);
s.syncAsSint16LE(titleColor);
s.syncAsSint16LE(itemColor);
s.syncAsSint16LE(selectColor);
s.syncAsSint16LE(subColor);
s.syncAsSint16LE(narratorOvl);
s.syncAsSint16LE(narratorIdx);
s.syncAsSint16LE(aniX);
s.syncAsSint16LE(aniY);
s.syncAsUint16LE(animationStart);
s.syncAsSint16LE(masterScreen);
s.syncAsSint16LE(switchPal);
s.syncAsSint16LE(scroll);
s.syncAsSint16LE(fadeFlag);
s.syncAsSint16LE(doFade);
s.syncAsSint16LE(numOfLoadedOverlay);
s.syncAsSint16LE(stateID);
s.syncAsSint16LE(fontFileIndex);
s.syncAsSint16LE(currentActiveMenu);
s.syncAsSint16LE(userWait);
s.syncAsSint16LE(autoOvl);
s.syncAsSint16LE(autoMsg);
s.syncAsSint16LE(autoTrack);
s.syncAsSint16LE(var39);
s.syncAsSint16LE(var42);
s.syncAsSint16LE(var45);
s.syncAsSint16LE(var46);
s.syncAsSint16LE(var47);
s.syncAsSint16LE(var48);
s.syncAsSint16LE(flagCt);
s.syncAsSint16LE(var41);
s.syncAsSint16LE(playerMenuEnabled);
s.syncAsSint16LE(protectionCode);
}
示例14: 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;
}
示例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);
}
}