bool AppWaterdemo2::LoadMap () { // Set VFS current directory to the level we want to load. csRef<iVFS> VFS (csQueryRegistry<iVFS> (GetObjectRegistry ())); VFS->ChDir ("/lev/oceantest"); // Load the level file which is called 'world'. if (!loader->LoadMapFile ("world")) ReportError("Error couldn't load level!"); return true; }
int MPTWrap::stream_seek(void *instance, std::int64_t offset, int whence) { qint64 pos; if(VFS(instance)->isSequential()) return -1; switch(whence) { case OPENMPT_STREAM_SEEK_SET: pos = offset; break; case OPENMPT_STREAM_SEEK_CUR: pos = VFS(instance)->pos() + offset; break; case OPENMPT_STREAM_SEEK_END: pos = VFS(instance)->size() + offset; break; default: return -1; } return VFS(instance)->seek(pos) ? 0 : -1; }
size_t MPTWrap::stream_read(void *instance, void *buf, std::size_t n) { return VFS(instance)->read(reinterpret_cast<char *>(buf), n); }
std::int64_t MPTWrap::stream_tell(void *instance) { return VFS(instance)->isSequential() ? -1 : VFS(instance)->pos(); }