Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
world.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "inexor/network/SharedVar.hpp" // for SharedVar
4 #include "inexor/shared/cube_types.hpp" // for uchar
5 #include "inexor/shared/cube_vector.hpp" // for vector
6 #include "inexor/shared/geom.hpp" // for bvec4, vec, svec2, vec2
7 
8 struct cube;
9 struct entity;
10 struct extentity;
11 struct selinfo;
12 struct undoblock;
13 
14 // world.h
15 // contains general enumerations and structures to describe world, map format and environment
16 
17 
18 // bump if map format changes, see worldio.cpp last sauerbraten-one was 33
19 #define MAPVERSION 40
20 
21 // constant macros to describe visual appearance of game world
22 #define WATER_AMPLITUDE 0.4f
23 #define WATER_OFFSET 1.1f
24 #define TEX_SCALE 8.0f
25 
27 
28 // hardcoded texture numbers
29 enum
30 {
33 };
34 
37 struct octaheader
38 {
39  char magic[4]; // "OCTA"
40  int version; // any >8bit quantity is little endian
41  int headersize; // sizeof(header)
42  int worldsize;
43  int numents;
44  int numpvs;
45  int lightmaps;
46  int blendmap;
47  int numvars;
48  int numvslots;
49 };
50 
53 {
54  char magic[4]; // "OCTA"
55  int version; // any >8bit quantity is little endian
56  int headersize; // sizeof(header)
57  int worldsize;
58  int numents;
59  int numpvs;
60  int lightmaps;
71  char maptitle[128];
72 };
73 
74 // enumeration for material visibility
75 enum
76 {
80 };
81 
82 struct vertex
83 {
84  vec pos; // vertex position
85  bvec4 norm; // normal vector
86  vec2 tc; // Texture UV coordinates
87  svec2 lm; // light map UV coordinates
88  bvec4 tangent; // tangents (for skinning/animation ?)
89 };
90 
91 
93 
94 extern void entcancel();
95 extern void entitiesinoctanodes();
96 extern void attachentities();
97 extern void freeoctaentities(cube &c);
98 extern bool pointinsel(const selinfo &sel, const vec &o);
99 
100 extern void resetmap();
101 extern void startmap(const char *name);
102 
103 extern char *entname(entity &e);
104 extern bool haveselent();
105 extern undoblock *copyundoents(undoblock *u);
106 extern void pasteundoent(int idx, const entity &ue);
107 extern void pasteundoents(undoblock *u);
108 
109 extern vector<int> entgroup;
110 
113 
114 
115 extern bool emptymap(int factor, bool force, const char *mname = "", bool usecfg = true);
116 extern bool enlargemap(bool force);
117 extern int findentity(int type, int index = 0, int attr1 = -1, int attr2 = -1);
118 extern void findents(int low, int high, bool notspawned, const vec &pos, const vec &radius, vector<int> &found);
119 extern extentity *newentity(bool local, const vec &o, int type, int v1, int v2, int v3, int v4, int v5, int &idx);
120 extern void attachentity(extentity &e);
121 extern bool modifyoctaent(int flags, int id);
122 extern void mpeditent(int i, const vec &o, int type, int attr1, int attr2, int attr3, int attr4, int attr5, bool local);
123 
124 extern vec getselpos();
125 extern int getworldsize();
126 extern int getmapversion();
127 extern void renderentcone(const extentity &e, const vec &dir, float radius, float angle);
128 extern void renderentarrow(const extentity &e, const vec &dir, float radius);
129 extern void renderentattachment(const extentity &e);
130 extern void renderentsphere(const extentity &e, float radius);
131 extern void renderentring(const extentity &e, float radius, int axis = 0);
132 
int worldsize
Definition: world.hpp:42
SharedVar< int > worldsize
vector< int > entgroup
Definition: world.cpp:373
int lighterror
Definition: world.hpp:61
bool pointinsel(const selinfo &sel, const vec &o)
Definition: world.cpp:363
SharedVar< char * > maptitle
vector< int > outsideents
Definition: world.cpp:228
int headersize
Definition: world.hpp:41
void startmap(const char *name)
called just after a map load send CRC32 to server
Definition: world.cpp:1301
vec getselpos()
Definition: world.cpp:501
Selection info: the marked area when editing.
Definition: octree.hpp:231
uchar reserved[10]
Definition: world.hpp:70
uchar skylight[3]
Definition: world.hpp:67
void renderentsphere(const extentity &e, float radius)
Definition: world.cpp:646
int numpvs
Definition: world.hpp:59
void pasteundoent(int idx, const entity &ue)
Definition: world.cpp:521
uchar lavacolour[3]
Definition: world.hpp:68
void mpeditent(int i, const vec &o, int type, int attr1, int attr2, int attr3, int attr4, int attr5, bool local)
Definition: world.cpp:1425
int numvars
Definition: world.hpp:47
int numvslots
Definition: world.hpp:48
2-dimensional float vectors
Definition: geom.hpp:38
bvec4 tangent
Definition: world.hpp:88
svec2 lm
Definition: world.hpp:87
bvec4 norm
Definition: world.hpp:85
void attachentities()
Definition: world.cpp:469
char magic[4]
Definition: world.hpp:39
int getmapversion()
Definition: world.cpp:1452
int lightmaps
Definition: world.hpp:45
persistent map entity.
Definition: ents.hpp:66
void renderentring(const extentity &e, float radius, int axis=0)
Definition: world.cpp:630
uchar waterfallcolour[3]
Definition: world.hpp:69
void renderentarrow(const extentity &e, const vec &dir, float radius)
Definition: world.cpp:662
vec pos
Definition: world.hpp:84
char * entname(entity &e)
Definition: world.cpp:339
void freeoctaentities(cube &c)
Definition: world.cpp:270
more intense map file header used when loading.
Definition: world.hpp:52
int worldsize
Definition: world.hpp:57
GLuint index
Definition: glexts.hpp:412
int lightlod
Definition: world.hpp:61
SharedVar< int > worldscale
extentity * newentity(bool local, const vec &o, int type, int v1, int v2, int v3, int v4, int v5, int &idx)
Definition: world.cpp:1009
Definition: world.hpp:77
Definition: ents.hpp:102
bool enlargemap(bool force)
Definition: world.cpp:1343
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
int numents
Definition: world.hpp:43
Definition: world.hpp:79
int version
Definition: world.hpp:40
int numpvs
Definition: world.hpp:44
2 dimensional vector containing shorts.
Definition: geom.hpp:1535
int getworldsize()
Definition: world.cpp:1451
uchar lerpsubdiv
Definition: world.hpp:65
uchar lerpsubdivsize
Definition: world.hpp:65
int numents
Definition: world.hpp:58
uchar watercolour[3]
Definition: world.hpp:63
void renderentattachment(const extentity &e)
Definition: world.cpp:652
void attachentity(extentity &e)
Definition: world.cpp:426
#define dir(name, v, d, s, os)
Definition: physics.cpp:2014
void entitiesinoctanodes()
Definition: world.cpp:285
unsigned char uchar
Basic type definitions.
Definition: cube_types.hpp:7
Definition: world.hpp:78
int version
Definition: world.hpp:55
bool haveselent()
Definition: world.cpp:375
char magic[4]
Definition: world.hpp:54
bool emptymap(int factor, bool force, const char *mname="", bool usecfg=true)
Definition: world.cpp:1306
uchar bumperror
Definition: world.hpp:66
octree header structure as its found in the ogz files.
Definition: world.hpp:37
int lightprecision
Definition: world.hpp:61
Definition: world.hpp:31
void findents(int low, int high, bool notspawned, const vec &pos, const vec &radius, vector< int > &found)
Definition: world.cpp:315
uchar flags[MAXBRUSH][MAXBRUSH]
Definition: octaedit.cpp:1742
Definition: world.hpp:82
SharedVar wrapper for primitive/immutable objects.
Definition: SharedVar.hpp:55
Definition: world.hpp:32
uchar ambient
Definition: world.hpp:62
bool modifyoctaent(int flags, int id)
Definition: world.cpp:261
void entcancel()
cancel (remove) entity selection
Definition: world.cpp:381
uchar lerpangle
Definition: world.hpp:65
void pasteundoents(undoblock *u)
Definition: world.cpp:530
mathmatics for vectors, matrices, quaterions and more
Definition: octree.hpp:273
selinfo sel
Bot Movement, according to waypoints (saved within the map in an excluded file).
Definition: octaedit.cpp:162
SharedVar< int > mapversion
int headersize
Definition: world.hpp:56
vec2 tc
Definition: world.hpp:86
void renderentcone(const extentity &e, const vec &dir, float radius, float angle)
Definition: world.cpp:684
Definition: geom.hpp:1455
int blendmap
Definition: world.hpp:46
Definition: octree.hpp:208
void resetmap()
Definition: world.cpp:1281
uchar blendmap
Definition: world.hpp:64
int lightmaps
Definition: world.hpp:60
int findentity(int type, int index=0, int attr1=-1, int attr2=-1)
Definition: world.cpp:1213
undoblock * copyundoents(undoblock *u)
Definition: world.cpp:509