本文整理汇总了C++中common::OutSaveFile::writeSint16LE方法的典型用法代码示例。如果您正苦于以下问题:C++ OutSaveFile::writeSint16LE方法的具体用法?C++ OutSaveFile::writeSint16LE怎么用?C++ OutSaveFile::writeSint16LE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common::OutSaveFile
的用法示例。
在下文中一共展示了OutSaveFile::writeSint16LE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveGame
bool AvalancheEngine::saveGame(const int16 slot, const Common::String &desc) {
Common::String fileName = getSaveFileName(slot);
Common::OutSaveFile *f = g_system->getSavefileManager()->openForSaving(fileName);
if (!f) {
warning("Can't create file '%s', game not saved.", fileName.c_str());
return false;
}
f->writeUint32LE(MKTAG('A', 'V', 'A', 'L'));
// Write version. We can't restore from obsolete versions.
f->writeByte(kSavegameVersion);
f->writeUint32LE(desc.size());
f->write(desc.c_str(), desc.size());
Graphics::saveThumbnail(*f);
TimeDate t;
_system->getTimeAndDate(t);
f->writeSint16LE(t.tm_mday);
f->writeSint16LE(t.tm_mon);
f->writeSint16LE(t.tm_year);
_totalTime += getTimeInSeconds() - _startTime;
Common::Serializer sz(NULL, f);
synchronize(sz);
f->finalize();
delete f;
return true;
}
示例2: save
void SagaEngine::save(const char *fileName, const char *saveName) {
Common::OutSaveFile *out;
char title[TITLESIZE];
if (!(out = _saveFileMan->openForSaving(fileName))) {
return;
}
_saveHeader.type = MKTAG('S','A','G','A');
_saveHeader.size = 0;
_saveHeader.version = CURRENT_SAGA_VER;
// Note that IHNM has a smaller save title size than ITE
// We allocate the ITE save title size here, to preserve
// savegame backwards compatibility
Common::strlcpy(_saveHeader.name, saveName, SAVE_TITLE_SIZE);
out->writeUint32BE(_saveHeader.type);
out->writeUint32LE(_saveHeader.size);
out->writeUint32LE(_saveHeader.version);
out->write(_saveHeader.name, sizeof(_saveHeader.name));
// Original game title
memset(title, 0, TITLESIZE);
Common::strlcpy(title, _gameTitle.c_str(), TITLESIZE);
out->write(title, TITLESIZE);
// Thumbnail
// First draw scene without save dialog
int oldMode = _interface->getMode();
_interface->setMode(kPanelMain);
_render->drawScene();
Graphics::saveThumbnail(*out);
_interface->setMode(oldMode);
// Date / time
TimeDate curTime;
_system->getTimeAndDate(curTime);
uint32 saveDate = ((curTime.tm_mday & 0xFF) << 24) | (((curTime.tm_mon + 1) & 0xFF) << 16) | ((curTime.tm_year + 1900) & 0xFFFF);
uint16 saveTime = ((curTime.tm_hour & 0xFF) << 8) | ((curTime.tm_min) & 0xFF);
uint32 playTime = g_engine->getTotalPlayTime() / 1000;
out->writeUint32BE(saveDate);
out->writeUint16BE(saveTime);
out->writeUint32BE(playTime);
// Surrounding scene
out->writeSint32LE(_scene->getOutsetSceneNumber());
#ifdef ENABLE_IHNM
if (getGameId() == GID_IHNM) {
out->writeSint32LE(_scene->currentChapterNumber());
out->writeSint32LE(0); // obsolete, was used for the protagonist
out->writeSint32LE(_scene->getCurrentMusicTrack());
out->writeSint32LE(_scene->getCurrentMusicRepeat());
}
#endif
// Inset scene
out->writeSint32LE(_scene->currentSceneNumber());
#ifdef ENABLE_IHNM
if (getGameId() == GID_IHNM) {
out->writeUint32LE(_globalFlags);
for (int i = 0; i < ARRAYSIZE(_ethicsPoints); i++)
out->writeSint16LE(_ethicsPoints[i]);
}
#endif
_interface->saveState(out);
_actor->saveState(out);
out->writeSint16LE(_script->_commonBuffer.size());
out->write(_script->_commonBuffer.getBuffer(), _script->_commonBuffer.size());
// ISO map x, y coordinates for ITE
if (getGameId() == GID_ITE) {
out->writeSint16LE(_isoMap->getMapPosition().x);
out->writeSint16LE(_isoMap->getMapPosition().y);
}
out->finalize();
if (out->err())
warning("Can't write file '%s'. (Disk full?)", fileName);
delete out;
_interface->resetSaveReminder();
}