Libprimis
Imprimis' 3D destroyable world engine
Loading...
Searching...
No Matches
iengine.h
Go to the documentation of this file.
1
9
10#ifndef IENGINE_H_
11#define IENGINE_H_
12
13//forward object declarations (used in some functions below)
14struct DecalSlot;
15struct VSlot;
16struct Texture;
17struct editinfo;
18class model;
19struct undoblock;
20struct vslotmap;
21struct prefab;
22
23// ragdoll
24
32extern void moveragdoll(dynent *d);
33
42extern void cleanragdoll(dynent *d);
43
44// glemu
45
46namespace gle
47{
53 extern void begin(GLenum mode);
54
63 extern void begin(GLenum mode, int numverts);
64
70 extern void attrib(const vec &v);
71
78 extern void attribf(float x, float y);
79
91 extern void colorf(float x, float y, float z, float w = 0.0f);
92
101 extern void colorub(uchar x, uchar y, uchar z, uchar w = 255);
102
109 extern void deftexcoord0(int size = 2, int format = GL_FLOAT);
110 extern void defvertex(int size = 3, int format = GL_FLOAT);
111 extern int end();
112}
113/*==============================================================================*\
114 * Interface Functions & Values *
115 * *
116 * Input, Scripting, Sound, UI *
117 * *
118 * command.cpp *
119 * console.cpp *
120 * control.cpp *
121 * cubestd.cpp *
122 * input.cpp *
123 * menus.cpp *
124 * textedit.cpp *
125 * ui.cpp *
126\*==============================================================================*/
127
128// command
129
130/* see command.h */
131
163
164extern void initcscmds();
165
166// console
167
177extern void conoutf(const char *s, ...) PRINTFARGS(1, 2);
178
190extern void conoutf(int type, const char *s, ...) PRINTFARGS(2, 3);
191
192extern int initing;
193
199extern void clear_console();
200
254
255extern void initconsolecmds();
256
257// control
258extern int curtime;
259extern int lastmillis;
260extern int elapsedtime;
261extern int totalmillis;
262extern FILE *logfile;
263
271
281void logoutf(const char *fmt, ...);
282
286
287extern dynent *player;
288extern bool inbetweenframes,
289 renderedframe;
290
296extern bool initsdl();
297
306extern void fatal(const char *s, ...) PRINTFARGS(1, 2);
307
313extern int getclockmillis();
314
315extern int scr_w, scr_h;
316extern int desktopw, desktoph;
317
328extern std::string enginebuilddate();
329
339extern std::string enginestr();
340
341// cubestd
342
493extern void initmathcmds();
494
541extern void initstrcmds();
542
699extern void initcontrolcmds();
700
701// input
702
703extern bool grabinput,
705
706extern bool interceptkey(int sym);
707extern void inputgrab(bool on);
708
716extern void checkinput(int map = 0);
717
726extern void ignoremousemotion();
727
739extern void keyrepeat(bool on, int mask = ~0);
740
741
742// menus
743
744extern int mainmenu;
745
753extern void initmenuscmds();
754
755//textedit
756
790
791extern void inittextcmds();
792
793// UI
794
795namespace UI
796{
806 bool hascursor();
807
820 void getcursorpos(float &x, float &y);
821
829
840 bool movecursor(int dx, int dy);
841
845 void setup();
846
850 void update();
851
855 void cleanup();
856
868 bool showui(const char *name);
869
881 bool hideui(const char *name);
882
894 bool toggleui(const char *name);
895
905 void holdui(const char *name, bool on);
906
916 bool uivisible(const char *name);
917
1193}
1194
1195/*==============================================================================*\
1196 * Render Functions & Values *
1197 * *
1198 * World, Model, Material, Screenspace FX Rendering *
1199 * *
1200 * aa.cpp *
1201 * grass.cpp *
1202 * hud.cpp *
1203 * normal.cpp *
1204 * octarender.cpp *
1205 * radiancehints.cpp *
1206 * rendergl.cpp *
1207 * renderlights.cpp *
1208 * rendermodel.cpp *
1209 * renderparticles.cpp *
1210 * rendersky.cpp *
1211 * rendertext.cpp *
1212 * renderva.cpp *
1213 * renderwindow.cpp *
1214 * shader.cpp *
1215 * stain.cpp *
1216 * texture.cpp *
1217 * water.cpp *
1218\*==============================================================================*/
1219
1220// aa
1255extern void initaacmds();
1256
1257// hud
1258
1271extern void inithudcmds();
1272
1273// normal
1274
1283extern void initnormalcmds();
1284
1285// octarender
1286
1294
1295// rendergl
1296
1316extern void initrenderglcmds();
1317
1318extern physent *camera1;
1319extern vec worldpos;
1320extern float fovy;
1321extern bool detachedcamera;
1322extern int xtraverts;
1323
1329extern vec camdir();
1330
1336extern vec camright();
1337
1343extern vec camup();
1344
1351extern void disablezoom();
1352
1353extern vec calcavatarpos(const vec &pos, float dist);
1354
1355extern void damageblend(int n);
1356extern void damagecompass(int n, const vec &loc);
1357
1358extern vec minimapcenter, minimapradius, minimapscale;
1359
1366extern void bindminimap();
1367
1368extern matrix4 hudmatrix;
1369extern void resethudmatrix();
1370extern void pushhudmatrix();
1371extern void flushhudmatrix(bool flushparams = true);
1372extern void pophudmatrix(bool flush = true, bool flushparams = true);
1373
1379extern void resethudshader();
1380extern void initgbuffer();
1381
1382extern void computezoom();
1392extern void enablepolygonoffset(GLenum type);
1393
1401extern void disablepolygonoffset(GLenum type);
1402
1413extern void vectoryawpitch(const vec &v, float &yaw, float &pitch);
1414
1423
1430extern void gl_init();
1431
1438extern void gl_resize();
1439
1446extern void gl_setupframe(bool force = false);
1447
1458extern void gl_drawframe(int crosshairindex, void (*gamefxn)(), void (*hudfxn)(), void (*editfxn)(), void (*hud2d)());
1459
1472extern void drawminimap(int yaw, int pitch, vec loc, const cubeworld& world, int scalefactor = 1);
1473
1474// renderlights
1475
1535
1541extern void clearshadowcache();
1542
1543// rendermodel
1544
1763
1764extern std::vector<std::string> animnames;
1765
1786extern void rendermodel(std::string_view mdl,
1787 int anim,
1788 const vec &o,
1789 float yaw = 0,
1790 float pitch = 0,
1791 float roll = 0,
1792 int cull = Model_CullVFC | Model_CullDist | Model_CullOccluded,
1793 dynent *d = nullptr,
1794 modelattach *a = nullptr,
1795 int basetime = 0,
1796 int basetime2 = 0,
1797 float size = 1,
1798 const vec4<float> &color = vec4<float>(1, 1, 1, 1));
1799
1818extern int intersectmodel(std::string_view mdl,
1819 int anim,
1820 const vec &pos,
1821 float yaw,
1822 float pitch,
1823 float roll,
1824 const vec &o,
1825 const vec &ray,
1826 float &dist,
1827 dynent *d = nullptr,
1828 modelattach *a = nullptr,
1829 int basetime = 0,
1830 int basetime2 = 0,
1831 float size = 1);
1832
1842extern void abovemodel(vec &o, const char *mdl);
1843
1852extern const char *mapmodelname(int i);
1853
1861extern void preloadmodel(std::string name);
1862
1874extern model *loadmapmodel(int n);
1875
1883extern model *loadmodel(const char *name, int i = -1, bool msg = false);
1884
1890extern void flushpreloadedmodels(bool msg = true);
1891
1898extern void preloadusedmapmodels(bool msg = false, bool bih = false);
1899
1906extern void clear_models();
1907
1908// renderparticles
1909
1910extern std::vector<std::string> entnames;
1911
1921extern const char * getentname(int i);
1922
1947extern void regular_particle_splash(int type, int num, int fade, const vec &p, int color = 0xFFFFFF, float size = 1.0f, int radius = 150, int gravity = 2, int delay = 0);
1948
1962extern void regular_particle_flame(int type, const vec &p, float radius, float height, int color, int density = 3, float scale = 2.0f, float speed = 200.0f, float fade = 600.0f, int gravity = -15);
1963extern void particle_splash(int type, int num, int fade, const vec &p, int color = 0xFFFFFF, float size = 1.0f, int radius = 150, int gravity = 2);
1964extern void particle_trail(int type, int fade, const vec &from, const vec &to, int color = 0xFFFFFF, float size = 1.0f, int gravity = 20);
1965extern void particle_text(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1966extern void particle_textcopy(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1967extern void particle_icon(const vec &s, int ix, int iy, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1968extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
1969extern void particle_flare(const vec &p, const vec &dest, int fade, int type, int color = 0xFFFFFF, float size = 0.28f, physent *owner = nullptr);
1970extern void particle_fireball(const vec &dest, float max, int type, int fade = -1, int color = 0xFFFFFF, float size = 4.0f);
1971extern void removetrackedparticles(physent *owner = nullptr);
1972
1980extern void initparticles();
1981
1982// rendertext
1983
2004
2015extern bool setfont(const char *name);
2016
2017// renderwindow
2018
2019extern SDL_Window *screen;
2020
2034
2042extern void swapbuffers(bool overlay = true);
2043extern int fullscreen;
2044
2051extern void setupscreen();
2052extern void restoregamma();
2053extern void restorevsync();
2054
2060extern void resetfpshistory();
2061
2071extern void limitfps(int &millis, int curmillis);
2072
2083extern void limitfps(int &millis, int curmillis);
2084
2093extern void updatefpshistory(int millis);
2094
2101extern void cleargamma();
2102
2103extern void renderbackground(const char *caption = nullptr, Texture *mapshot = nullptr, const char *mapname = nullptr, const char *mapinfo = nullptr, bool force = false);
2104
2114extern void renderprogress(float bar, const char *text, bool background = false);
2115
2116// shader
2117
2174extern void initshadercmds();
2175
2204extern void loadshaders();
2205
2206// stain
2207
2216extern void initstains();
2217extern void addstain(int type, const vec &center, const vec &surface, float radius, const bvec &color = bvec(0xFF, 0xFF, 0xFF), int info = 0);
2218
2219inline void addstain(int type, const vec &center, const vec &surface, float radius, int color, int info = 0)
2220{
2221 addstain(type, center, surface, radius, bvec::hexcolor(color), info);
2222}
2223
2224// texture
2225
2326extern void inittexturecmds();
2327
2328extern Texture *notexture;
2329
2330extern Texture *textureload(const char *name, int clamp = 0, bool mipit = true, bool msg = true);
2331
2338extern void packvslot(std::vector<uchar> &buf, int index);
2339
2346extern void packvslot(std::vector<uchar> &buf, const VSlot *vs);
2347extern bool settexture(const char *name, int clamp = 0);
2348
2349/*==============================================================================*\
2350 * World Functions & Values *
2351 * *
2352 * World Loading, Physics, Collision, Entity Handling *
2353 * *
2354 * bih.cpp *
2355 * dynlight.cpp *
2356 * heightmap.cpp *
2357 * light.cpp *
2358 * material.cpp *
2359 * octaworld.cpp *
2360 * octaedit.cpp *
2361 * physics.cpp *
2362 * raycube.cpp *
2363 * world.cpp *
2364 * worldio.cpp *
2365\*==============================================================================*/
2366
2367// dynlight
2368
2369extern void adddynlight(const vec &o, float radius, const vec &color, int fade = 0, int peak = 0, int flags = 0, float initradius = 0, const vec &initcolor = vec(0, 0, 0), physent *owner = nullptr, const vec &dir = vec(0, 0, 0), int spot = 0);
2370extern void removetrackeddynlights(const physent *owner = nullptr);
2371
2372// heightmap
2373
2380extern bool isheightmap(int o, bool empty, const cube &c);
2381extern void heightmaprun(int dir, int mode);
2382
2394extern void initheightmapcmds();
2395
2396// material
2397extern int showmat;
2398
2409extern int findmaterial(const char *name);
2410
2411// octaworld
2412
2418extern void initoctaworldcmds();
2419
2429extern void freeocta(std::array<cube, 8> *&c);
2430extern void getcubevector(const cube &c, int d, int x, int y, int z, ivec &p);
2431
2432extern void optiface(const uchar *p, cube &c);
2433
2434// octaedit
2435
2506extern void initoctaeditcmds();
2507
2508extern bool allowediting;
2509extern bool multiplayer;
2510extern std::vector<ushort> texmru;
2511extern selinfo repsel;
2512extern int reptex;
2513extern int lasttex;
2514extern int curtexindex;
2515extern int moving, orient, horient;
2516extern bool editmode;
2517extern int entmoving;
2518extern int entediting;
2519extern selinfo sel, lastsel;
2520extern std::deque<undoblock *> undos,
2522extern int nompedit;
2523extern int hmapedit;
2524extern bool havesel;
2525extern std::vector<editinfo *> editinfos;
2526extern int texpaneltimer;
2527
2528extern ivec cor, cur, lastcor;
2529extern int gridsize;
2530extern int passthroughsel;
2531extern int outline;
2532extern int dragging;
2533extern int selectcorners;
2534
2535extern void clearremappedvslots();
2536
2545extern void boxs3D(const vec &o, vec s, int g, bool boxoutline);
2546
2556extern void boxs(int orient, vec o, const vec &s, float size, bool boxoutline);
2557
2566extern void boxs(int orient, vec o, const vec &s, bool boxoutline);
2567extern void boxsgrid(int orient, vec o, vec s, int g, bool boxoutline);
2568extern bool editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first);
2569
2576extern void countselchild(const std::array<cube, 8> &c, const ivec &cor, int size);
2577extern void normalizelookupcube(const ivec &o);
2578extern void updateselection();
2579
2580extern bool packeditinfo(const editinfo *e, int &inlen, uchar *&outbuf, int &outlen);
2581extern bool unpackeditinfo(editinfo *&e, const uchar *inbuf, int inlen, int outlen);
2582
2590extern void freeeditinfo(editinfo *&e);
2591extern bool packundo(bool undo, int &inlen, uchar *&outbuf, int &outlen);
2592extern bool noedit(bool view = false, bool msg = true);
2593
2607extern bool pointinsel(const selinfo &sel, const vec &o);
2608
2614extern void cancelsel();
2615
2621extern void addundo(undoblock *u);
2622
2634extern cube &blockcube(int x, int y, int z, const block3 &b, int rgrid);
2635
2643extern void makeundo(selinfo &s);
2644
2651extern void makeundo();
2652
2659extern void reorient();
2660
2668extern int countblock(block3 *b);
2669
2673extern void forcenextundo();
2674
2683extern void freeundo(undoblock *u);
2684
2692extern void pasteblock(const block3 &b, selinfo &sel, bool local);
2693
2702extern void remapvslots(cube &c, bool delta, const VSlot &ds, int orient, bool &findrep, VSlot *&findedit);
2703
2735extern void edittexcube(cube &c, int tex, int orient, bool &findrep);
2736
2743extern bool haveselent();
2744
2756extern void pastecube(const cube &src, cube &dst);
2757
2764extern void pasteundoblock(block3 *b, const uchar *g);
2765extern bool uncompresseditinfo(const uchar *inbuf, int inlen, uchar *&outbuf, int &outlen);
2766
2776extern void unpackundocube(ucharbuf &buf, uchar *outbuf);
2777
2784extern void multiplayerwarn();
2785
2796extern ushort getmaterial(cube &c);
2797
2808extern void linkedpush(cube &c, int d, int x, int y, int dc, int dir);
2809
2810// raycube
2811
2826extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = Ray_ClipMat, int size = 0);
2827extern float rayfloor (const vec &o, vec &floor, int mode = 0, float radius = 0);
2828extern bool raycubelos(const vec &o, const vec &dest, vec &hitpos);
2829extern float rayent(const vec &o, const vec &ray, float radius, int mode, int size, int &orient, int &ent);
2830
2843extern bool insideworld(const vec &o);
2844
2845// physics
2846
2847extern vec collidewall;
2848extern int collideinside;
2849extern const physent *collideplayer;
2850extern int numdynents;
2851extern std::vector<dynent *> dynents;
2852
2862extern dynent *iterdynents(int i);
2863
2873extern bool collide(const physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true, bool insideplayercol = false);
2874extern void avoidcollision(physent *d, const vec &dir, const physent *obstacle, float space);
2875
2876extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
2877
2887extern void dropenttofloor(entity *e);
2888
2898extern void rotatebb(vec &center, vec &radius, int yaw, int pitch, int roll = 0);
2899
2914extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m);
2915extern void cleardynentcache();
2916extern void updatedynentcache(physent *d);
2917
2926extern bool entinmap(dynent *d, bool avoidplayers = false);
2927
2940extern void recalcdir(const physent *d, const vec &oldvel, vec &dir);
2941
2951extern void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bool slidecollide);
2952
2962extern void freeblock(block3 *b, bool alloced = true);
2963
2976extern block3 *blockcopy(const block3 &s, int rgrid);
2977
2978// world
2979
2980extern std::vector<int> entgroup;
2981
2988extern void entcancel();
2989
3001extern void attachentity(extentity &e);
3002
3010extern void attachentities();
3011extern void removeentityedit(int id);
3012extern void addentityedit(int id);
3013
3022extern void detachentity(extentity &e);
3023extern void entselectionbox(const entity &e, vec &eo, vec &es);
3024extern void mmboundbox(const entity &e, model *m, vec &center, vec &radius);
3025
3035extern float getdecalslotdepth(const DecalSlot &s);
3036
3037namespace entities
3038{
3042 extern std::vector<extentity *> ents;
3043
3047 extern std::vector<extentity *> &getents();
3048 extern extentity *newentity();
3049 extern void deleteentity(extentity *e);
3050}
3051
3052// worldio
3053
3057const char *getclientmap();
3058
3062const void setmapname(const char * newname);
3063
3074extern void initworldiocmds();
3075
3076#endif /* IENGINE_H_ */
The fundemental building block of the octree world, representing a 3D cube.
Definition octa.h:100
An object representing the entirety of an octree world.
Definition octa.h:456
bool isheightmap(int o, bool empty, const cube &c)
Determines if a heightmap is active for the current selection.
void attrib(const vec &v)
Adds three float values, packed in a vec, to the attribbuf.
void makeundo()
Adds an undo entry to the undos vector given the current selection.
void int getclockmillis()
Returns the number of milliseconds since the game started.
void boxs(int orient, vec o, const vec &s, float size, bool boxoutline)
Draws a box corresponding to positions in worldspace.
void freeblock(block3 *b, bool alloced=true)
Deletes dynamically allocated cubes to a block entity.
FILE * getlogfile()
Returns the logfile (Linux) or stdout (Windows)
bool hideui(const char *name)
Hides an open UI window with the specified name.
void dropenttofloor(entity *e)
Drops the map entity to a set distance above the floor.
int intersectmodel(std::string_view mdl, int anim, const vec &pos, float yaw, float pitch, float roll, const vec &o, const vec &ray, float &dist, dynent *d=nullptr, modelattach *a=nullptr, int basetime=0, int basetime2=0, float size=1)
Returns the intersection status of a model.
void initmathcmds()
Adds math commands to the cubescript interpreter.
cube & blockcube(int x, int y, int z, const block3 &b, int rgrid)
Looks up a world cube inside the block passed.
std::string enginestr()
Returns the engine library's name string.
void setup()
Creates a new UI World object, used globally for UI functionality.
void preloadusedmapmodels(bool msg=false, bool bih=false)
Preloads mapmodels corresponding to the world's mapmodel entities.
void initaacmds()
Initializes AA cubescript commands.
void renderprogress(float bar, const char *text, bool background=false)
Renders a loading progress bar at the bottom center of the window.
void limitfps(int &millis, int curmillis)
delays a frame by a specified amount
void vectoryawpitch(const vec &v, float &yaw, float &pitch)
Returns 2 Euler angles for a given vector.
model * loadmapmodel(int n)
Loads the mapmodel assigned to the specified index.
std::vector< std::string > entnames
void keyrepeat(bool on, int mask=~0)
Sets the key repeat mask for SDL.
void initconsolecmds()
Initializes console cubescript commands.
void resetcursor()
Sets the cursor to the middle of the screen.
void initoctarendercmds()
Initializes octarender.cpp cubescript commands.
void disablezoom()
Unsets any zoom progress and disables zooming.
void detachentity(extentity &e)
Attempts to dettach the given entity.
void clearshadowcache()
Clears the shadow maps cached in the shadow atlas.
void linkedpush(cube &c, int d, int x, int y, int dc, int dir)
Pushes cubes linked with the passed cube.
void disablepolygonoffset(GLenum type)
Disables GL offset mode for overlay drawing.
void initshadercmds()
Initializes shader Cubescript commands.
void packvslot(std::vector< uchar > &buf, int index)
Packs into the passed char vector the contents of a VSlot.
void ignoremousemotion()
Flushes all queued mouse events.
bool haveselent()
Queries whether the current selection has entities selected.
void rendermodel(std::string_view mdl, int anim, const vec &o, float yaw=0, float pitch=0, float roll=0, int cull=Model_CullVFC|Model_CullDist|Model_CullOccluded, dynent *d=nullptr, modelattach *a=nullptr, int basetime=0, int basetime2=0, float size=1, const vec4< float > &color=vec4< float >(1, 1, 1, 1))
Renders a world model.
model * loadmodel(const char *name, int i=-1, bool msg=false)
Loads the model with the associated name.
void forcenextundo()
Sets lastsel's orientation flag to -1.
void getcursorpos(float &x, float &y)
Queries current UI cursor location.
void gl_setupframe(bool force=false)
Sets render frame variables up.
void initmenuscmds()
void abovemodel(vec &o, const char *mdl)
Adds the z height of the model to the vector passed.
void multiplayerwarn()
Prints a warning message to the console.
undoblock * newundocube(const selinfo &s)
Creates an undoblock object given a cube selection.
int lastmillis
void clear_console()
Clears the console KeyM history hashtable.
void setupscreen()
Sets up the SDL window the application runs in.
void loadshaders()
Loads a series of shaders hardcoded into the engine.
void resetfpshistory()
Sets the entirety of the fps history buffer (used for averaging the FPS readout) to 1.
void gl_resize()
Changes the viewport size to set values.
void reorient()
Reorients sel to point in the direction of orient.
void cleanup()
Deletes all of the open windows exposed and deletes the UI world object.
void countselchild(const std::array< cube, 8 > &c, const ivec &cor, int size)
Assigns selchildcount the number of cubes in selection.
void pasteundoblock(block3 *b, const uchar *g)
Pastes an undo block associated with the passed block3 object.
void update()
Updates cursor vis a vis the UI elements.
std::vector< extentity * > & getents()
Returns the entities::ents vector.
void bindminimap()
Binds a GL texture to the minimaptex global object.
ushort getmaterial(cube &c)
Returns the material bitmask for the given cube.
void conoutf(const char *s,...) PRINTFARGS(1
Prints a message to the ingame console.
void deftexcoord0(int size=2, int format=GL_FLOAT)
Sets texcoord0 with the given dimensionality and type.
void moveragdoll(dynent *d)
Update a ragdoll's position and physics.
void initrenderlightscmds()
Initializes renderlights CubeScript commands.
void entcancel()
Cancels selection of selected entities.
void initrenderglcmds()
Initializes rendergl.cpp cubescript commands.
bool setfont(const char *name)
Sets the currently used font.
vec camdir()
returns the camera matrix direction component
bool havesel
bool toggleui(const char *name)
Toggles the open/closed state of a window.
void preloadmodel(std::string name)
Adds a model to the cache of models to load.
void holdui(const char *name, bool on)
Opens or closes the specified UI.
void updatefpshistory(int millis)
Adds an entry to the fps history.
void pastecube(const cube &src, cube &dst)
Copies and pastes a single cube (with its children).
void drawminimap(int yaw, int pitch, vec loc, const cubeworld &world, int scalefactor=1)
Draws a minimap texture.
void resethudshader()
Binds the HUD shader via glUseProgram()
void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m)
Modifies a vector based on passed movement modifiers.
int lasttex
void gl_checkextensions()
Ensures computer environment can run the engine.
void recalcdir(const physent *d, const vec &oldvel, vec &dir)
Recalculates dir based on the provided physent, normalized to oldvel.
int elapsedtime
void regular_particle_splash(int type, int num, int fade, const vec &p, int color=0xFFFFFF, float size=1.0f, int radius=150, int gravity=2, int delay=0)
Spawns a splash particle with the designated properties.
void colorub(uchar x, uchar y, uchar z, uchar w=255)
Calls glVertexAttrib4Nub to set the color of an attribute.
void unpackundocube(ucharbuf &buf, uchar *outbuf)
Unpacks a buffer containing an undo action into a unsigned char array.
void cleargamma()
Sets the SDL gamma level to 1.
const char * mapmodelname(int i)
Returns the mapmodel name at the given index.
dynent * iterdynents(int i)
Returns the dynent at index i.
bool movecursor(int dx, int dy)
Moves the UI cursor by the amount perscribed.
void clear_models()
Clears all loaded models' basic information.
std::deque< undoblock * > undos
bool detachedcamera
const char * getentname(int i)
Returns the entity name of of a given entity type index.
bool initsdl()
Initializes SDL functions necessary to run a game.
void cancelsel()
Deselects edit selection.
bool minimized
Definition iengine.h:704
float getdecalslotdepth(const DecalSlot &s)
Gets the depth of a decal slot.
void freeocta(std::array< cube, 8 > *&c)
Deletes a cube and its children.
void regular_particle_flame(int type, const vec &p, float radius, float height, int color, int density=3, float scale=2.0f, float speed=200.0f, float fade=600.0f, int gravity=-15)
Spawns a flame particle.
std::string enginebuilddate()
Returns the engine library's build date.
void cleanragdoll(dynent *d)
Deletes the ragdoll associated with the passed dynent.
bool showui(const char *name)
Shows a UI window with the specified name.
void attachentities()
Attempts to attach all entities in selection.
void flushpreloadedmodels(bool msg=true)
Clears the loaded model cache.
void boxs3D(const vec &o, vec s, int g, bool boxoutline)
Draws a box corresponding to positions in worldspace.
void initcscmds()
Initializes core cubescript commands.
void logoutf(const char *fmt,...)
Prints a line to the log file.
int mainmenu
void attachentity(extentity &e)
Attempts to attach the given entity to another entity.
void inithudcmds()
Initializes HUD cubescript commands.
void checkinput(int map=0)
Handles input from SDL.
int texpaneltimer
void initstains()
Loads stains into the global stains array.
void initoctaworldcmds()
Initializes octaworld Cubescript commands.
void initcontrolcmds()
Adds program control commands to the cubescript interpreter.
physent * camera1
int showmat
vec camup()
returns the camera matrix up component
void initworldiocmds()
Initializes worldio Cubescript commands.
void begin(GLenum mode)
Sets the type of primitive to draw.
void gl_drawframe(int crosshairindex, void(*gamefxn)(), void(*hudfxn)(), void(*editfxn)(), void(*hud2d)())
Draws the frame to the screen.
FILE * logfile
void initparticles()
Loads the shaders/renderer objects to render particles.
bool entinmap(dynent *d, bool avoidplayers=false)
Brute force but effective way to find a free spawn spot in the map.
const void setmapname(const char *newname)
Sets the client map string to the provided value.
void initrenderwindowcmds()
Initializes renderwindow Cubescript commands.
float fovy
void enablepolygonoffset(GLenum type)
Enables GL offset mode for overlay drawing.
dynent * player
The dynamic entity representing the player.
int countblock(block3 *b)
Counts the number of cubes (incl. children) within a block3 volume.
bool insideworld(const vec &o)
Queries whether the given vector lies inside the octree world.
void fatal(const char *s,...) PRINTFARGS(1
Immediately shuts down the game and prints error message(s)
void gl_init()
Sets up GL global parameters for the game.
void inituicmds()
Binds the UI commands to the command parser.
bool pointinsel(const selinfo &sel, const vec &o)
Determines whether selection contains location at specified location.
int totalmillis
const char * getclientmap()
Returns the name of the map currently loaded.
void rotatebb(vec &center, vec &radius, int yaw, int pitch, int roll=0)
Rotates the center and radius vectors using the given Euler angles.
void attribf(float x, float y)
Adds two float values to the attribbuf.
void freeundo(undoblock *u)
Deletes an undoblock object.
void inittexturecmds()
Initializes texture Cubescript commands.
int fullscreen
void inittextcmds()
Initializes textedit cubescript commands.
bool hascursor()
Queries UI windows' cursor input ability.
float raycubepos(const vec &o, const vec &ray, vec &hit, float radius=0, int mode=Ray_ClipMat, int size=0)
Returns the distance before a ray hits a cube.
void initoctaeditcmds()
Initializes the octaedit cubescript commands.
int hmapedit
void pasteblock(const block3 &b, selinfo &sel, bool local)
Pastes the block3 passed to the volume in the selinfo object.
void initstrcmds()
Adds string commands to the cubescript interpreter.
std::deque< undoblock * > redos
Definition iengine.h:2521
void initheightmapcmds()
Initializes heightmap Cubescript commands.
void freeeditinfo(editinfo *&e)
Safely frees an editinfo object.
void swapbuffers(bool overlay=true)
Refreshes the rendered screenbuffer.
bool collide(const physent *d, const vec &dir=vec(0, 0, 0), float cutoff=0.0f, bool playercol=true, bool insideplayercol=false)
Determines whether the specified physent has collided with the octree world.
void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bool slidecollide)
Re-projects a physent's velocity according to a given wall normal.
bool uivisible(const char *name)
Gets the open/close status of a UI window.
int findmaterial(const char *name)
Returns the bitmask for the given material name.
block3 * blockcopy(const block3 &s, int rgrid)
Allocates a new copy of the given block3 on the heap.
void initrendertextcmds()
Initializes rendertext Cubescript commands.
void colorf(float x, float y, float z, float w=0.0f)
Calls glVertexAttrib of the appropriate dimension.
void addundo(undoblock *u)
Adds an undo entry to the global undos vector.
void initrendermodelcmds()
Initializes rendermodel CubeScript commands.
std::vector< std::string > animnames
vec camright()
returns the camera matrix right component
void edittexcube(cube &c, int tex, int orient, bool &findrep)
Changes the texture for a cube and its children.
void initnormalcmds()
Initializes normal.cpp cubescript commands.
Definition slot.h:247
A virtual texture slot.
Definition slot.h:188
A representation of a rectangular volume of cubes, with less metadata.
Definition octa.h:358
three dimensional Cartesian byte vector
Definition geom.h:696
Definition ents.h:197
Definition octa.h:381
Entity data capable of being saved to disk.
Definition ents.h:82
Extended entity data not of the subset which is saved to disk.
Definition ents.h:93
Definition geom.h:2289
floating point 4x4 array object
Definition geom.h:2506
An representation of a model attachment (e.g. weapon to player).
Definition ents.h:155
A base object representing a class.
Definition ents.h:111
A representation of a rectangular volume of cubes.
Definition octa.h:297
Definition octa.h:393
A four dimensional Cartesian-space vector template.
Definition geom.h:844
three dimensional Cartesian vector object
Definition geom.h:207