本文整理汇总了C++中common::Serializer::syncAsSint16LE方法的典型用法代码示例。如果您正苦于以下问题:C++ Serializer::syncAsSint16LE方法的具体用法?C++ Serializer::syncAsSint16LE怎么用?C++ Serializer::syncAsSint16LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::Serializer
的用法示例。
在下文中一共展示了Serializer::syncAsSint16LE方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
}
示例2: syncIncrust
static void syncIncrust(Common::Serializer &s) {
int numEntries = 0;
backgroundIncrustStruct *pl, *pl1;
uint8 dummyByte = 0;
uint16 dummyWord = 0;
uint32 dummyLong = 0;
if (s.isSaving()) {
// Figure out the number of entries to save
pl = backgroundIncrustHead.next;
while (pl) {
++numEntries;
pl = pl->next;
}
}
s.syncAsSint16LE(numEntries);
pl = s.isSaving() ? backgroundIncrustHead.next : &backgroundIncrustHead;
pl1 = &backgroundIncrustHead;
for (int i = 0; i < numEntries; ++i) {
backgroundIncrustStruct *t = s.isSaving() ? pl :
(backgroundIncrustStruct *)mallocAndZero(sizeof(backgroundIncrustStruct));
s.syncAsUint32LE(dummyLong);
s.syncAsSint16LE(t->objectIdx);
s.syncAsSint16LE(t->type);
s.syncAsSint16LE(t->overlayIdx);
s.syncAsSint16LE(t->X);
s.syncAsSint16LE(t->Y);
s.syncAsSint16LE(t->frame);
s.syncAsSint16LE(t->scale);
s.syncAsSint16LE(t->backgroundIdx);
s.syncAsSint16LE(t->scriptNumber);
s.syncAsSint16LE(t->scriptOverlayIdx);
s.syncAsUint32LE(dummyLong);
s.syncAsSint16LE(t->saveWidth);
s.syncAsSint16LE(t->saveHeight);
s.syncAsSint16LE(t->saveSize);
s.syncAsSint16LE(t->savedX);
s.syncAsSint16LE(t->savedY);
s.syncBytes((byte *)t->name, 13);
s.syncAsByte(dummyByte);
s.syncAsSint16LE(t->spriteId);
s.syncAsUint16LE(dummyWord);
if (t->saveSize) {
if (s.isLoading())
t->ptr = (byte *)MemAlloc(t->saveSize);
s.syncBytes(t->ptr, t->saveSize);
}
if (s.isSaving())
pl = pl->next;
else {
t->next = NULL;
pl->next = t;
t->prev = pl1->prev;
pl1->prev = t;
pl = t;
}
}
}
示例3: 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;
}
}
}
示例4: 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;
}
}
}
示例5: mallocAndZero
static void syncOverlays2(Common::Serializer &s) {
for (int i = 1; i < numOfLoadedOverlay; i++) {
if (s.isSaving()) {
// Saving code
if (!overlayTable[i].alreadyLoaded)
continue;
ovlDataStruct *ovlData = overlayTable[i].ovlData;
// save BSS
s.syncAsSint16LE(ovlData->sizeOfData4);
if (ovlData->sizeOfData4)
s.syncBytes(ovlData->data4Ptr, ovlData->sizeOfData4);
// save variables
s.syncAsSint16LE(ovlData->size9);
for (int j = 0; j < ovlData->size9; j++) {
s.syncAsSint16LE(ovlData->arrayObjVar[j].X);
s.syncAsSint16LE(ovlData->arrayObjVar[j].Y);
s.syncAsSint16LE(ovlData->arrayObjVar[j].Z);
s.syncAsSint16LE(ovlData->arrayObjVar[j].frame);
s.syncAsSint16LE(ovlData->arrayObjVar[j].scale);
s.syncAsSint16LE(ovlData->arrayObjVar[j].state);
}
} else {
// Loading code
ovlRestoreData[i]._sBssSize = ovlRestoreData[i]._sNumObj = 0;
ovlRestoreData[i]._pBss = NULL;
ovlRestoreData[i]._pObj = NULL;
if (overlayTable[i].alreadyLoaded) {
s.syncAsSint16LE(ovlRestoreData[i]._sBssSize);
if (ovlRestoreData[i]._sBssSize) {
ovlRestoreData[i]._pBss = (uint8 *) mallocAndZero(ovlRestoreData[i]._sBssSize);
ASSERT(ovlRestoreData[i]._pBss);
s.syncBytes(ovlRestoreData[i]._pBss, ovlRestoreData[i]._sBssSize);
}
s.syncAsSint16LE(ovlRestoreData[i]._sNumObj);
if (ovlRestoreData[i]._sNumObj) {
ovlRestoreData[i]._pObj = (objectParams *) mallocAndZero(ovlRestoreData[i]._sNumObj * sizeof(objectParams));
ASSERT(ovlRestoreData[i]._pObj);
for (int j = 0; j < ovlRestoreData[i]._sNumObj; j++) {
s.syncAsSint16LE(ovlRestoreData[i]._pObj[j].X);
s.syncAsSint16LE(ovlRestoreData[i]._pObj[j].Y);
s.syncAsSint16LE(ovlRestoreData[i]._pObj[j].Z);
s.syncAsSint16LE(ovlRestoreData[i]._pObj[j].frame);
s.syncAsSint16LE(ovlRestoreData[i]._pObj[j].scale);
s.syncAsSint16LE(ovlRestoreData[i]._pObj[j].state);
}
}
}
}
}
}