Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
worldio.hpp File Reference
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/cube_vector.hpp"

Go to the source code of this file.

Functions

bool load_world (const char *mname, const char *cname=nullptr)
 
bool save_world (const char *mname, bool nolms=false)
 save the current game world to a map file (.OGZ) More...
 
void getmapfilename (const char *fname, const char *cname, char *mapname)
 get the map name from a path/file More...
 
uint getmapcrc ()
 
void clearmapcrc ()
 clear the CRC32 checksum More...
 
bool loadents (const char *fname, vector< entity > &ents, uint *crc=nullptr)
 load/parse entities from a file More...
 

Function Documentation

void clearmapcrc ( )

clear the CRC32 checksum

References mapcrc.

Referenced by resetmap().

uint getmapcrc ( )

References mapcrc.

Referenced by game::sendmessages().

void getmapfilename ( const char *  fname,
const char *  realname,
char *  mapname 
)

get the map name from a path/file

Parameters
fnameactual map file name
realnamemap display name
mapnamea pointer to where the final map name will be copied (call by reference)

References copystring(), cutogz(), DIR_MAP, inexor::filesystem::getmediapath(), and MAXSTRLEN.

Referenced by ai::getwaypointfile(), loadents(), mapcfgname(), and setmapfilenames().

bool load_world ( const char *  mname,
const char *  cname = nullptr 
)

References vector< T, MINSIZE >::add(), allchanged(), compatheader::ambient, attachentities(), entity::attr1, entity::attr3, entity::attr4, octaheader::blendmap, compatheader::blendmap, LightMap::bpp, compatheader::bumperror, cfgname, clearmainmenu(), copystring(), LightMap::data, entities::deleteentity(), sphere::ebuf, entitiesinoctanodes(), entities::entname(), entities::ents, ET_GAMESPECIFIC, ET_LIGHT, ET_MAPMODEL, ET_SPOTLIGHT, execfile(), entities::extraentinfosize(), f(), LightMap::finalize(), fixent(), fixlightmapnormals(), fixrotatedlightmaps(), flushpreloadedmodels(), freeocta(), GAME_IDENTITY, stream::getchar(), stream::getcrc(), entities::getents(), getident(), stream::getlil(), ID_FVAR, ID_SVAR, ID_VAR, identflags, IDF_OVERRIDDEN, IDF_OVERRIDE, initlights(), insideworld(), compatheader::lavacolour, compatheader::lerpangle, compatheader::lerpsubdiv, compatheader::lerpsubdivsize, compatheader::lighterror, compatheader::lightlod, octaheader::lightmaps, lightmaps, compatheader::lightprecision, lilswap(), LM_ALPHA, LM_BUMPMAP1, LM_PACKH, LM_PACKW, LM_TYPE, loadblendmap(), loadchildren(), loadpvs(), loadvslots(), Log, loopi(), octaheader::magic, mapcrc, maptitle, compatheader::maptitle, MAPVERSION, mapversion, MAXENTS, MAXSTRLEN, inexor::rpc::min(), entities::newentity(), octaheader::numents, octaheader::numpvs, octaheader::numvars, octaheader::numvslots, entity::o, ogzname, opengzfile(), picname, vector< T, MINSIZE >::pop(), game::preload(), inexor::sound::preloadmapsounds(), preloadusedmapmodels(), stream::read(), entities::readent(), game::readgamedata(), renderbackground(), renderprogress(), resetmap(), stream::seek(), setfvar(), setmapfilenames(), setsvar(), setvar(), vector< T, MINSIZE >::shrink(), compatheader::skylight, startmap(), texmru, textureload(), LightMap::type, entity::type, LightMap::unlitx, LightMap::unlity, validatec(), octaheader::version, compatheader::watercolour, compatheader::waterfallcolour, inexor::util::log_manager::world, worldroot, worldscale, and octaheader::worldsize.

Referenced by game::changemapserv(), and game::receivefile().

bool loadents ( const char *  fname,
vector< entity > &  ents,
uint crc 
)
bool save_world ( const char *  mname,
bool  nolms 
)

save the current game world to a map file (.OGZ)

Parameters
mnamemap name
nolmsenable or disable lightmap loading
Warning
map stream will be compressed using GZIP automaticly!

validate map name

eventually save backup file

open output stream

get light map data

render savemap progress background

write map header

"magic number"

map version

size of header structure

size of the game world

set amount of entities to 0

ernumerate and count entities

PVS (potentially visible set) tree

ligthmaps

blendmap

enumerate and count idents which represent map variables (settings like "fog"...)

write header to map file

write map variables/settings from ident list

TODO: extend map format here...(?)

save texture IDs in map file

save "extra entities" ?

vertex shader slots?

save octree structure and display another progress bar menawhile

done

References allchanged(), entity::attr1, backup(), bakname, octaheader::blendmap, LightMap::bpp, compactvslots(), LightMap::data, sphere::ebuf, inexor::util::log_manager::edit, entities::ents, enumerate, ET_EMPTY, entities::extraentinfosize(), f(), hmap::flags, GAME_IDENTITY, game::getclientmap(), entities::getents(), getnumviewcells(), octaheader::headersize, ID_FVAR, ID_SVAR, ID_VAR, idents, IDF_OVERRIDDEN, IDF_OVERRIDE, IDF_READONLY, vector< T, MINSIZE >::length(), octaheader::lightmaps, lightmaps, lilswap(), LM_PACKH, LM_PACKW, Log, loopv, octaheader::magic, MAPVERSION, multiplayer(), octaheader::numents, octaheader::numpvs, octaheader::numvars, octaheader::numvslots, entity::o, ogzname, opengzfile(), stream::putchar(), stream::putlil(), renderprogress(), saveblendmap(), savec(), savemapprogress, savepvs(), savevslots(), setmapfilenames(), shouldsaveblendmap(), texmru, LightMap::type, LightMap::unlitx, LightMap::unlity, octaheader::version, vslots, inexor::util::log_manager::world, worldroot, octaheader::worldsize, worldsize, stream::write(), entities::writeent(), and game::writegamedata().

Referenced by savecurrentmap(), savemap(), and game::sendmap().