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;
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
1421extern void vectoryawpitch(const vec &v, float &yaw, float &pitch);
1422
1431
1438extern void gl_init();
1439
1446extern void gl_resize();
1447
1454extern void gl_setupframe(bool force = false);
1455
1466extern void gl_drawframe(int crosshairindex, void (*gamefxn)(), void (*hudfxn)(), void (*editfxn)(), void (*hud2d)());
1467
1480extern void drawminimap(int yaw, int pitch, vec loc, const cubeworld& world, int scalefactor = 1);
1481
1482// renderlights
1483
1543
1549extern void clearshadowcache();
1550
1551// rendermodel
1552
1771
1772extern std::vector<std::string> animnames;
1773
1794extern void rendermodel(std::string_view mdl,
1795 int anim,
1796 const vec &o,
1797 float yaw = 0,
1798 float pitch = 0,
1799 float roll = 0,
1800 int cull = Model_CullVFC | Model_CullDist | Model_CullOccluded,
1801 dynent *d = nullptr,
1802 modelattach *a = nullptr,
1803 int basetime = 0,
1804 int basetime2 = 0,
1805 float size = 1,
1806 const vec4<float> &color = vec4<float>(1, 1, 1, 1));
1807
1826extern int intersectmodel(std::string_view mdl,
1827 int anim,
1828 const vec &pos,
1829 float yaw,
1830 float pitch,
1831 float roll,
1832 const vec &o,
1833 const vec &ray,
1834 float &dist,
1835 dynent *d = nullptr,
1836 modelattach *a = nullptr,
1837 int basetime = 0,
1838 int basetime2 = 0,
1839 float size = 1);
1840
1850extern void abovemodel(vec &o, const char *mdl);
1851
1860extern const char *mapmodelname(int i);
1861
1869extern void preloadmodel(std::string name);
1870
1882extern model *loadmapmodel(int n);
1883
1891extern model *loadmodel(const char *name, int i = -1, bool msg = false);
1892
1898extern void flushpreloadedmodels(bool msg = true);
1899
1906extern void preloadusedmapmodels(bool msg = false, bool bih = false);
1907
1914extern void clear_models();
1915
1916// renderparticles
1917
1918extern std::vector<std::string> entnames;
1919
1929extern const char * getentname(int i);
1930
1955extern 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);
1956
1970extern 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);
1971extern 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);
1972extern void particle_trail(int type, int fade, const vec &from, const vec &to, int color = 0xFFFFFF, float size = 1.0f, int gravity = 20);
1973extern void particle_text(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1974extern void particle_textcopy(const vec &s, const char *t, int type, int fade = 2000, int color = 0xFFFFFF, float size = 2.0f, int gravity = 0);
1975extern 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);
1976extern void particle_meter(const vec &s, float val, int type, int fade = 1, int color = 0xFFFFFF, int color2 = 0xFFFFF, float size = 2.0f);
1977extern void particle_flare(const vec &p, const vec &dest, int fade, int type, int color = 0xFFFFFF, float size = 0.28f, physent *owner = nullptr);
1978extern void particle_fireball(const vec &dest, float max, int type, int fade = -1, int color = 0xFFFFFF, float size = 4.0f);
1979extern void removetrackedparticles(physent *owner = nullptr);
1980
1988extern void initparticles();
1989
1990// rendertext
1991
2010
2021extern bool setfont(const char *name);
2022
2023// renderwindow
2024
2025extern SDL_Window *screen;
2026
2040
2048extern void swapbuffers(bool overlay = true);
2049extern int fullscreen;
2050
2057extern void setupscreen();
2058extern void restoregamma();
2059extern void restorevsync();
2060
2066extern void resetfpshistory();
2067
2077extern void limitfps(int &millis, int curmillis);
2078
2089extern void limitfps(int &millis, int curmillis);
2090
2099extern void updatefpshistory(int millis);
2100
2107extern void cleargamma();
2108
2109extern void renderbackground(const char *caption = nullptr, const Texture *mapshot = nullptr, const char *mapname = nullptr, const char *mapinfo = nullptr, bool force = false);
2110
2120extern void renderprogress(float bar, const char *text, bool background = false);
2121
2122// shader
2123
2180extern void initshadercmds();
2181
2210extern void loadshaders();
2211
2212// stain
2213
2222extern void initstains();
2223extern void addstain(int type, const vec &center, const vec &surface, float radius, const bvec &color = bvec(0xFF, 0xFF, 0xFF), int info = 0);
2224
2225inline void addstain(int type, const vec &center, const vec &surface, float radius, int color, int info = 0)
2226{
2227 addstain(type, center, surface, radius, bvec::hexcolor(color), info);
2228}
2229
2230// texture
2231
2332extern void inittexturecmds();
2333
2334extern Texture *notexture;
2335
2336extern Texture *textureload(const char *name, int clamp = 0, bool mipit = true, bool msg = true);
2337
2344extern void packvslot(std::vector<uchar> &buf, int index);
2345
2352extern void packvslot(std::vector<uchar> &buf, const VSlot *vs);
2353extern bool settexture(const char *name, int clamp = 0);
2354
2355/*==============================================================================*\
2356 * World Functions & Values *
2357 * *
2358 * World Loading, Physics, Collision, Entity Handling *
2359 * *
2360 * bih.cpp *
2361 * dynlight.cpp *
2362 * heightmap.cpp *
2363 * light.cpp *
2364 * material.cpp *
2365 * octaworld.cpp *
2366 * octaedit.cpp *
2367 * physics.cpp *
2368 * raycube.cpp *
2369 * world.cpp *
2370 * worldio.cpp *
2371\*==============================================================================*/
2372
2373// dynlight
2374
2375extern 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);
2376extern void removetrackeddynlights(const physent *owner = nullptr);
2377
2378// heightmap
2379
2386extern bool isheightmap(int o, bool empty, const cube &c);
2387extern void heightmaprun(int dir, int mode);
2388
2400extern void initheightmapcmds();
2401
2402// material
2403extern int showmat;
2404
2415extern int findmaterial(const char *name);
2416
2417// octaworld
2418
2424extern void initoctaworldcmds();
2425
2435extern void freeocta(std::array<cube, 8> *&c);
2436extern void getcubevector(const cube &c, int d, int x, int y, int z, ivec &p);
2437
2438extern void optiface(const uchar *p, cube &c);
2439
2440// octaedit
2441
2512extern void initoctaeditcmds();
2513
2514extern bool allowediting;
2515extern bool multiplayer;
2516extern std::vector<ushort> texmru;
2517extern selinfo repsel;
2518extern int reptex;
2519extern int lasttex;
2520extern int curtexindex;
2521extern int moving, orient, horient;
2522extern bool editmode;
2523extern int entmoving;
2524extern int entediting;
2525extern selinfo sel, lastsel;
2526extern std::deque<undoblock *> undos,
2528extern int nompedit;
2529extern int hmapedit;
2530extern bool havesel;
2531extern std::vector<editinfo *> editinfos;
2532extern int texpaneltimer;
2533
2534extern ivec cor, cur, lastcor;
2535extern int gridsize;
2536extern int passthroughsel;
2537extern int outline;
2538extern int dragging;
2539extern int selectcorners;
2540
2541extern void clearremappedvslots();
2542
2551extern void boxs3D(const vec &o, vec s, int g, bool boxoutline);
2552
2562extern void boxs(int orient, vec o, const vec &s, float size, bool boxoutline);
2563
2572extern void boxs(int orient, vec o, const vec &s, bool boxoutline);
2573extern void boxsgrid(int orient, vec o, vec s, int g, bool boxoutline);
2574extern bool editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first);
2575
2582extern void countselchild(const std::array<cube, 8> &c, const ivec &cor, int size);
2583extern void normalizelookupcube(const ivec &o);
2584extern void updateselection();
2585
2586extern bool packeditinfo(const editinfo *e, int &inlen, uchar *&outbuf, int &outlen);
2587extern bool unpackeditinfo(editinfo *&e, const uchar *inbuf, int inlen, int outlen);
2588
2596extern void freeeditinfo(editinfo *&e);
2597extern bool packundo(bool undo, int &inlen, uchar *&outbuf, int &outlen);
2598extern bool noedit(bool view = false, bool msg = true);
2599
2613extern bool pointinsel(const selinfo &sel, const vec &o);
2614
2620extern void cancelsel();
2621
2627extern void addundo(undoblock *u);
2628
2640extern cube &blockcube(int x, int y, int z, const block3 &b, int rgrid);
2641
2649extern void makeundo(selinfo &s);
2650
2657extern void makeundo();
2658
2665extern void reorient();
2666
2674extern int countblock(block3 *b);
2675
2679extern void forcenextundo();
2680
2689extern void freeundo(undoblock *u);
2690
2698extern void pasteblock(const block3 &b, selinfo &sel, bool local);
2699
2708extern void remapvslots(cube &c, bool delta, const VSlot &ds, int orient, bool &findrep, VSlot *&findedit);
2709
2741extern void edittexcube(cube &c, int tex, int orient, bool &findrep);
2742
2749extern bool haveselent();
2750
2762extern void pastecube(const cube &src, cube &dst);
2763
2770extern void pasteundoblock(block3 *b, const uchar *g);
2771extern bool uncompresseditinfo(const uchar *inbuf, int inlen, uchar *&outbuf, int &outlen);
2772
2782extern void unpackundocube(ucharbuf &buf, uchar *outbuf);
2783
2790extern void multiplayerwarn();
2791
2802extern ushort getmaterial(const cube &c);
2803
2814extern void linkedpush(cube &c, int d, int x, int y, int dc, int dir);
2815
2816// raycube
2817
2832extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = Ray_ClipMat, int size = 0);
2833extern float rayfloor (const vec &o, vec &floor, int mode = 0, float radius = 0);
2834extern bool raycubelos(const vec &o, const vec &dest, vec &hitpos);
2835extern float rayent(const vec &o, const vec &ray, float radius, int mode, int size, int &orient, int &ent);
2836
2849extern bool insideworld(const vec &o);
2850
2851// physics
2852
2853extern int collideinside;
2854extern const physent *collideplayer;
2855extern int numdynents;
2856extern std::vector<dynent *> dynents;
2857
2867extern dynent *iterdynents(int i);
2868
2878extern bool collide(const physent *d, vec *cwall = nullptr, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool insideplayercol = false);
2879extern void avoidcollision(physent *d, const vec &dir, const physent *obstacle, float space);
2880
2881extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
2882
2892extern void dropenttofloor(entity *e);
2893
2903extern void rotatebb(vec &center, vec &radius, int yaw, int pitch, int roll = 0);
2904
2919extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m);
2920extern void cleardynentcache();
2921extern void updatedynentcache(physent *d);
2922
2931extern bool entinmap(dynent *d, bool avoidplayers = false);
2932
2945extern void recalcdir(const physent *d, const vec &oldvel, vec &dir);
2946
2956extern void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bool slidecollide);
2957
2967extern void freeblock(block3 *b, bool alloced = true);
2968
2981extern block3 *blockcopy(const block3 &s, int rgrid);
2982
2983// world
2984
2985extern std::vector<int> entgroup;
2986
2993extern void entcancel();
2994
3006extern void attachentity(extentity &e);
3007
3015extern void attachentities();
3016extern void removeentityedit(int id);
3017extern void addentityedit(int id);
3018
3027extern void detachentity(extentity &e);
3028extern void entselectionbox(const entity &e, vec &eo, vec &es);
3029extern void mmboundbox(const entity &e, model *m, vec &center, vec &radius);
3030
3040extern float getdecalslotdepth(const DecalSlot &s);
3041
3042namespace entities
3043{
3047 extern std::vector<extentity *> ents;
3048
3052 extern std::vector<extentity *> &getents();
3053 extern extentity *newentity();
3054 extern void deleteentity(extentity *e);
3055}
3056
3057// worldio
3058
3062const char *getclientmap();
3063
3067void setmapname(const char * newname);
3068
3079extern void initworldiocmds();
3080
3081#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 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 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.
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.
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:2527
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.
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:2530
floating point 4x4 array object
Definition geom.h:2747
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