18 #include "precompiled.h"
70 packer.
Write(pathname);
79 WriteXML(pathnameXML, pWaterMan, pSkyMan, pLightEnv, pCamera, pCinema, pPostproc, pSimulation2);
87 const size_t limit = std::min(entries.size(), size_t(0xFFFEu));
88 for (
size_t i=0;i<limit;i++) {
89 if (entries[i]==entry) {
101 std::vector<CStr>& textures,
102 std::vector<STileDesc>& tiles)
105 std::vector<CTerrainTextureEntry*> entries;
113 for (
ssize_t j=0;j<patchesPerSide;j++) {
114 for (
ssize_t i=0;i<patchesPerSide;i++) {
120 index=(
u16)entries.size();
134 for (
size_t i=0;i<entries.size();i++) {
141 texturename=texentry->
GetTag();
143 textures.push_back(texturename);
168 std::vector<CStr> terrainTextures;
170 std::vector<STileDesc> tiles;
176 const size_t numTextures = terrainTextures.size();
178 for (
size_t i=0;i<numTextures;i++)
303 float rotation = atan2(in.
X, in.
Z);
304 float declination = atan2(sqrt(in.
X*in.
X + in.
Z*in.
Z), in.
Y) - (float)
M_PI/2;
319 if (!settings.empty())
322 XML_CDATA((
"\n" + settings +
"\n").c_str());
332 ENSURE(cmpTemplateManager);
337 for (CSimulation2::InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it)
352 XML_Setting(
"Player", (
int)cmpOwnership->GetOwner());
397 if (seed != (
u32)ent)
407 const std::map<CStrW, CCinemaPath>& paths = pCinema->
GetAllPaths();
408 std::map<CStrW, CCinemaPath>::const_iterator it = paths.begin();
413 for ( ; it != paths.end(); ++it )
415 CStrW name = it->first;
416 float timescale = it->second.GetTimescale();
422 const std::vector<SplineData>&
nodes = it->second.GetAllNodes();
433 for (
ssize_t j=nodes.size()-1; j >= 0; --j )
457 LOGERROR(L
"Failed to write map '%ls'", filename.
string().c_str());
CTerrainTextureEntry * GetTextureEntry()
static u16 GetEntryIndex(const CTerrainTextureEntry *entry, const std::vector< CTerrainTextureEntry * > &entries)
#define ENTITY_IS_LOCAL(id)
void WriteXML(const VfsPath &pathname, WaterManager *pWaterMan, SkyManager *pSkyMan, CLightEnv *pLightEnv, CCamera *pCamera, CCinemaManager *pCinema, CPostprocManager *pPostproc, CSimulation2 *pSimulation2)
void SaveMap(const VfsPath &pathname, CTerrain *pTerr, WaterManager *pWaterMan, SkyManager *pSkyMan, CLightEnv *pLightEnv, CCamera *pCamera, CCinemaManager *pCinema, CPostprocManager *pPostproc, CSimulation2 *pSimulation2)
RGBColor m_TerrainAmbientColor
#define XML_Element(name)
#define XML_Setting(name, value)
ssize_t GetVerticesPerSide() const
static Node nodes[os_cpu_MaxProcessors]
void PackRaw(const void *rawData, size_t rawDataSize)
pack given number of bytes onto the end of the data stream
virtual void ResolveFoundationCollisions()=0
Detects collisions between foundation-blocking entities and tries to fix them by setting control grou...
std::string GetMapSettingsString()
Get the current map settings as a UTF-8 JSON string.
helper class for writing binary files.
const entity_id_t SYSTEM_ENTITY
Entity ID for singleton 'system' components.
Public API for simulation system.
void PackTerrain(CFilePacker &packer, CTerrain *pTerrain)
float m_Elevation
Height of sun above the horizon, in radians.
RGBColor m_UnitsAmbientColor
void EnumTerrainTextures(CTerrain *pTerrain, std::vector< CStr > &textures, std::vector< STileDesc > &tileIndices)
std::vector< std::pair< entity_id_t, IComponent * > > InterfaceList
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
virtual entity_id_t GetControlGroup2()=0
float m_Rotation
Direction of sun on the compass, in radians.
const String & string() const
virtual u32 GetActorSeed()=0
Get actor seed used for random variations.
const std::map< CStrW, CCinemaPath > & GetAllPaths()
virtual float GetExactWaterLevel(float x, float z)=0
Get the current water level at the given point.
A simplified syntax for accessing entity components.
#define XML_StoreVFS(vfs, pathname)
const CStrW & GetPostEffect() const
Path ChangeExtension(Path extension) const
float m_ReflectionTintStrength
CPatch * GetPatch(ssize_t i, ssize_t j) const
const CCinemaData * GetData() const
InterfaceList GetEntitiesWithInterface(int iid)
Returns a list of components implementing the given interface, and their associated entities...
void Write(const VfsPath &filename)
write out to file all packed data added so far.
const CStrW & GetSkySet() const
GetSkySet(): Return the currently selected sky set name.
CMiniPatch m_MiniPatches[PATCH_SIZE][PATCH_SIZE]
void PackSize(size_t value)
convenience: convert a number (almost always a size type) to little-endian u32 and pack that...
#define XML_Attribute(name, value)
virtual entity_id_t GetControlGroup()=0
See SetControlGroup.
u16 * GetHeightMap() const
CVector3D GetTranslation() const
Class CLightEnv: description of a lighting environment - contains all the necessary parameters for re...
virtual std::string GetCurrentTemplateName(entity_id_t ent)=0
Returns the name of the template most recently specified for the entity 'ent'.
ssize_t GetPatchesPerSide() const
const entity_id_t INVALID_ENTITY
Invalid entity ID.
void PackMap(CFilePacker &packer, CTerrain *pTerrain)
u32 entity_id_t
Entity ID type.
void PackString(const CStr &str)
pack a string onto the end of the data stream (encoded as a 32-bit length followed by the characters)...
const std::string & GetStartupScript()
Get the current startup script.
Class WaterManager: Maintain water settings and textures.
Class SkyManager: Maintain sky settings and textures, and render the sky.