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,
704 minimized;
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;
1323extern int fog;
1324
1330extern bool isthirdperson();
1331
1337extern vec camdir();
1338
1344extern vec camright();
1345
1351extern vec camup();
1352
1359extern void disablezoom();
1360
1361extern vec calcavatarpos(const vec &pos, float dist);
1362
1363extern void damageblend(int n);
1364extern void damagecompass(int n, const vec &loc);
1365
1366extern vec minimapcenter, minimapradius, minimapscale;
1367
1374extern void bindminimap();
1375
1376extern matrix4 hudmatrix;
1377extern void resethudmatrix();
1378extern void pushhudmatrix();
1379extern void flushhudmatrix(bool flushparams = true);
1380extern void pophudmatrix(bool flush = true, bool flushparams = true);
1381
1387extern void resethudshader();
1388extern void initgbuffer();
1389
1390extern void computezoom();
1400extern void enablepolygonoffset(GLenum type);
1401
1409extern void disablepolygonoffset(GLenum type);
1410
1422extern void vectoryawpitch(const vec &v, float &yaw, float &pitch);
1423
1432
1439extern void gl_init();
1440
1447extern void gl_resize();
1448
1455extern void gl_setupframe(bool force = false);
1456
1467extern void gl_drawframe(int crosshairindex, void (*gamefxn)(), void (*hudfxn)(), void (*editfxn)(), void (*hud2d)());
1468
1481extern void drawminimap(int yaw, int pitch, vec loc, const cubeworld& world, int scalefactor = 1);
1482
1483// renderlights
1484
1544
1550extern void clearshadowcache();
1551
1552// rendermodel
1553
1771extern void initrendermodelcmds();
1772
1773extern std::vector<std::string> animnames;
1774
1795extern void rendermodel(std::string_view mdl,
1796 int anim,
1797 const vec &o,
1798 float yaw = 0,
1799 float pitch = 0,
1800 float roll = 0,
1801 int cull = Model_CullVFC | Model_CullDist | Model_CullOccluded,
1802 dynent *d = nullptr,
1803 modelattach *a = nullptr,
1804 int basetime = 0,
1805 int basetime2 = 0,
1806 float size = 1,
1807 const vec4<float> &color = vec4<float>(1, 1, 1, 1));
1808
1827extern int intersectmodel(std::string_view mdl,
1828 int anim,
1829 const vec &pos,
1830 float yaw,
1831 float pitch,
1832 float roll,
1833 const vec &o,
1834 const vec &ray,
1835 float &dist,
1836 dynent *d = nullptr,
1837 modelattach *a = nullptr,
1838 int basetime = 0,
1839 int basetime2 = 0,
1840 float size = 1);
1841
1851extern void abovemodel(vec &o, const char *mdl);
1852
1861extern const char *mapmodelname(int i);
1862
1870extern void preloadmodel(std::string name);
1871
1883extern model *loadmapmodel(int n);
1884
1892extern model *loadmodel(const char *name, int i = -1, bool msg = false);
1893
1899extern void flushpreloadedmodels(bool msg = true);
1900
1907extern void preloadusedmapmodels(bool msg = false, bool bih = false);
1908
1915extern void clear_models();
1916
1917// renderparticles
1918
1919extern std::vector<std::string> entnames;
1920
1930extern const char * getentname(int i);
1931
1956extern 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);
1957
1971extern 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);
1972extern 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);
1973extern void particle_trail(int type, int fade, const vec &from, const vec &to, int color = 0xFFFFFF, float size = 1.0f, int gravity = 20);
1974extern void particle_text(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1975extern void particle_textcopy(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1976extern 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);
1977extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
1978extern void particle_flare(const vec &p, const vec &dest, int fade, int type, int color = 0xFFFFFF, float size = 0.28f, physent *owner = nullptr);
1979extern void particle_fireball(const vec &dest, float max, int type, int fade = -1, int color = 0xFFFFFF, float size = 4.0f);
1980extern void removetrackedparticles(physent *owner = nullptr);
1981
1989extern void initparticles();
1990
1991// rendertext
1992
2011
2022extern bool setfont(const char *name);
2023
2024// renderwindow
2025
2026extern SDL_Window *screen;
2027
2041
2049extern void swapbuffers(bool overlay = true);
2050extern int fullscreen;
2051
2058extern void setupscreen();
2059extern void restoregamma();
2060extern void restorevsync();
2061
2067extern void resetfpshistory();
2068
2078extern void limitfps(int &millis, int curmillis);
2079
2090extern void limitfps(int &millis, int curmillis);
2091
2100extern void updatefpshistory(int millis);
2101
2108extern void cleargamma();
2109
2110extern void renderbackground(const char *caption = nullptr, const Texture *mapshot = nullptr, const char *mapname = nullptr, const char *mapinfo = nullptr, bool force = false);
2111
2121extern void renderprogress(float bar, const char *text, bool background = false);
2122
2123// shader
2124
2181extern void initshadercmds();
2182
2211extern void loadshaders();
2212
2213// stain
2214
2223extern void initstains();
2224
2235extern void addstain(int type, const vec &center, const vec &surface, float radius, const bvec &color = bvec(0xFF, 0xFF, 0xFF), int info = 0);
2236
2247inline void addstain(int type, const vec &center, const vec &surface, float radius, int color, int info = 0)
2248{
2249 addstain(type, center, surface, radius, bvec::hexcolor(color), info);
2250}
2251
2252// texture
2253
2354extern void inittexturecmds();
2355
2356extern Texture *notexture;
2357
2358extern Texture *textureload(const char *name, int clamp = 0, bool mipit = true, bool msg = true);
2359
2366extern void packvslot(std::vector<uchar> &buf, int index);
2367
2374extern void packvslot(std::vector<uchar> &buf, const VSlot *vs);
2375extern bool settexture(const char *name, int clamp = 0);
2376
2377/*==============================================================================*\
2378 * World Functions & Values *
2379 * *
2380 * World Loading, Physics, Collision, Entity Handling *
2381 * *
2382 * bih.cpp *
2383 * dynlight.cpp *
2384 * heightmap.cpp *
2385 * light.cpp *
2386 * material.cpp *
2387 * octaworld.cpp *
2388 * octaedit.cpp *
2389 * physics.cpp *
2390 * raycube.cpp *
2391 * world.cpp *
2392 * worldio.cpp *
2393\*==============================================================================*/
2394
2395// dynlight
2396
2397extern 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);
2398extern void removetrackeddynlights(const physent *owner = nullptr);
2399
2400// heightmap
2401
2408extern bool isheightmap(int o, bool empty, const cube &c);
2409extern void heightmaprun(int dir, int mode);
2410
2422extern void initheightmapcmds();
2423
2424// material
2425extern int showmat;
2426
2437extern int findmaterial(const char *name);
2438
2439// octaworld
2440
2446extern void initoctaworldcmds();
2447
2457extern void freeocta(std::array<cube, 8> *&c);
2458extern void getcubevector(const cube &c, int d, int x, int y, int z, ivec &p);
2459
2460extern void optiface(const uchar *p, cube &c);
2461
2462// octaedit
2463
2534extern void initoctaeditcmds();
2535
2536extern bool allowediting;
2537extern bool multiplayer;
2538extern std::vector<ushort> texmru;
2539extern selinfo repsel;
2540extern int reptex;
2541extern int lasttex;
2542extern int curtexindex;
2543extern int moving, orient, horient;
2544extern bool editmode;
2545extern int entmoving;
2546extern int entediting;
2547extern selinfo sel, lastsel;
2548extern std::deque<undoblock *> undos,
2550extern int nompedit;
2551extern int hmapedit;
2552extern bool havesel;
2553extern std::vector<editinfo *> editinfos;
2554extern int texpaneltimer;
2555
2556extern ivec cor, cur, lastcor;
2557extern int gridsize;
2558extern int passthroughsel;
2559extern int outline;
2560extern int dragging;
2561extern int selectcorners;
2562
2563extern void clearremappedvslots();
2564
2573extern void boxs3D(const vec &o, vec s, int g, bool boxoutline);
2574
2584extern void boxs(int orient, vec o, const vec &s, float size, bool boxoutline);
2585
2594extern void boxs(int orient, vec o, const vec &s, bool boxoutline);
2595extern void boxsgrid(int orient, vec o, vec s, int g, bool boxoutline);
2596extern bool editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first);
2597
2604extern void countselchild(const std::array<cube, 8> &c, const ivec &cor, int size);
2605extern void normalizelookupcube(const ivec &o);
2606extern void updateselection();
2607
2608extern bool packeditinfo(const editinfo *e, int &inlen, uchar *&outbuf, int &outlen);
2609extern bool unpackeditinfo(editinfo *&e, const uchar *inbuf, int inlen, int outlen);
2610
2618extern void freeeditinfo(editinfo *&e);
2619extern bool packundo(bool undo, int &inlen, uchar *&outbuf, int &outlen);
2620extern bool noedit(bool view = false, bool msg = true);
2621
2635extern bool pointinsel(const selinfo &sel, const vec &o);
2636
2642extern void cancelsel();
2643
2649extern void addundo(undoblock *u);
2650
2662extern cube &blockcube(int x, int y, int z, const block3 &b, int rgrid);
2663
2671extern void makeundo(selinfo &s);
2672
2679extern void makeundo();
2680
2687extern void reorient();
2688
2696extern int countblock(block3 *b);
2697
2701extern void forcenextundo();
2702
2711extern void freeundo(undoblock *u);
2712
2720extern void pasteblock(const block3 &b, selinfo &sel, bool local);
2721
2730extern void remapvslots(cube &c, bool delta, const VSlot &ds, int orient, bool &findrep, VSlot *&findedit);
2731
2763extern void edittexcube(cube &c, int tex, int orient, bool &findrep);
2764
2771extern bool haveselent();
2772
2784extern void pastecube(const cube &src, cube &dst);
2785
2792extern void pasteundoblock(block3 *b, const uchar *g);
2793extern bool uncompresseditinfo(const uchar *inbuf, int inlen, uchar *&outbuf, int &outlen);
2794
2804extern void unpackundocube(ucharbuf &buf, uchar *outbuf);
2805
2812extern void multiplayerwarn();
2813
2824extern ushort getmaterial(const cube &c);
2825
2836extern void linkedpush(cube &c, int d, int x, int y, int dc, int dir);
2837
2838// raycube
2839
2854extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = Ray_ClipMat, int size = 0);
2855extern float rayfloor (const vec &o, vec &floor, int mode = 0, float radius = 0);
2856extern bool raycubelos(const vec &o, const vec &dest, vec &hitpos);
2857extern float rayent(const vec &o, const vec &ray, float radius, int mode, int size, int &orient, int &ent);
2858
2871extern bool insideworld(const vec &o);
2872
2873// physics
2874
2875extern int collideinside;
2876extern const physent *collideplayer;
2877extern int numdynents;
2878extern std::vector<dynent *> dynents;
2879
2889extern dynent *iterdynents(int i);
2890
2900extern bool collide(const physent *d, vec *cwall = nullptr, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool insideplayercol = false);
2901extern void avoidcollision(physent *d, const vec &dir, const physent *obstacle, float space);
2902
2903extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
2904
2914extern void dropenttofloor(entity *e);
2915
2925extern void rotatebb(vec &center, vec &radius, int yaw, int pitch, int roll = 0);
2926
2941extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m);
2942extern void cleardynentcache();
2943extern void updatedynentcache(physent *d);
2944
2953extern bool entinmap(dynent *d, bool avoidplayers = false);
2954
2967extern void recalcdir(const physent *d, const vec &oldvel, vec &dir);
2968
2978extern void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bool slidecollide);
2979
2989extern void freeblock(block3 *b, bool alloced = true);
2990
3003extern block3 *blockcopy(const block3 &s, int rgrid);
3004
3005// world
3006
3007extern std::vector<size_t> entgroup;
3008
3015extern void entcancel();
3016
3030extern void attachentity(extentity &e);
3031
3039extern void attachentities();
3040extern void removeentityedit(int id);
3041extern void addentityedit(int id);
3042
3051extern void detachentity(extentity &e);
3052extern void entselectionbox(const entity &e, vec &eo, vec &es);
3053extern void mmboundbox(const entity &e, model *m, vec &center, vec &radius);
3054
3064extern float getdecalslotdepth(const DecalSlot &s);
3065
3066namespace entities
3067{
3071 extern std::vector<extentity *> ents;
3072
3076 extern std::vector<extentity *> &getents();
3077 extern extentity *newentity();
3078 extern void deleteentity(extentity *e);
3079}
3080
3081// worldio
3082
3088const char *getclientmap();
3089
3095void setmapname(const char * newname);
3096
3107extern void initworldiocmds();
3108
3109#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))
Initializes rendermodel CubeScript commands.
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 setmapname(const char *newname)
Sets the client map string to the provided value.
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.
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.
int fog
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 interceptkey(int sym)
Adds program control commands to the cubescript interpreter.
bool initsdl()
Initializes SDL functions necessary to run a game.
void cancelsel()
Deselects edit selection.
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.
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.
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.
bool collide(const physent *d, vec *cwall=nullptr, const vec &dir=vec(0, 0, 0), float cutoff=0.0f, bool insideplayercol=false)
Determines whether the specified physent has collided with the octree world.
int countblock(block3 *b)
Counts the number of cubes (incl. children) within a block3 volume.
ushort getmaterial(const cube &c)
Returns the material bitmask for the given cube.
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 addstain(int type, const vec &center, const vec &surface, float radius, const bvec &color=bvec(0xFF, 0xFF, 0xFF), int info=0)
Adds a new stain at the specified location and with specified properties.
bool isthirdperson()
returns whether the player is in third person mode
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:2549
void initheightmapcmds()
Initializes heightmap Cubescript commands.
void freeeditinfo(editinfo *&e)
Safely frees an editinfo object.
void swapbuffers(bool overlay=true)
Refreshes the rendered screenbuffer.
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.
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:248
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:220
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:2539
floating point 4x4 array object
Definition geom.h:2756
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:850
three dimensional Cartesian vector object
Definition geom.h:207