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
2012
2023extern bool setfont(const char *name);
2024
2025// renderwindow
2026
2027extern SDL_Window *screen;
2028
2042
2050extern void swapbuffers(bool overlay = true);
2051extern int fullscreen;
2052
2059extern void setupscreen();
2060extern void restoregamma();
2061extern void restorevsync();
2062
2068extern void resetfpshistory();
2069
2079extern void limitfps(int &millis, int curmillis);
2080
2091extern void limitfps(int &millis, int curmillis);
2092
2101extern void updatefpshistory(int millis);
2102
2109extern void cleargamma();
2110
2111extern void renderbackground(const char *caption = nullptr, const Texture *mapshot = nullptr, const char *mapname = nullptr, const char *mapinfo = nullptr, bool force = false);
2112
2122extern void renderprogress(float bar, const char *text, bool background = false);
2123
2124// shader
2125
2182extern void initshadercmds();
2183
2212extern void loadshaders();
2213
2214// stain
2215
2224extern void initstains();
2225extern void addstain(int type, const vec &center, const vec &surface, float radius, const bvec &color = bvec(0xFF, 0xFF, 0xFF), int info = 0);
2226
2227inline void addstain(int type, const vec &center, const vec &surface, float radius, int color, int info = 0)
2228{
2229 addstain(type, center, surface, radius, bvec::hexcolor(color), info);
2230}
2231
2232// texture
2233
2334extern void inittexturecmds();
2335
2336extern Texture *notexture;
2337
2338extern Texture *textureload(const char *name, int clamp = 0, bool mipit = true, bool msg = true);
2339
2346extern void packvslot(std::vector<uchar> &buf, int index);
2347
2354extern void packvslot(std::vector<uchar> &buf, const VSlot *vs);
2355extern bool settexture(const char *name, int clamp = 0);
2356
2357/*==============================================================================*\
2358 * World Functions & Values *
2359 * *
2360 * World Loading, Physics, Collision, Entity Handling *
2361 * *
2362 * bih.cpp *
2363 * dynlight.cpp *
2364 * heightmap.cpp *
2365 * light.cpp *
2366 * material.cpp *
2367 * octaworld.cpp *
2368 * octaedit.cpp *
2369 * physics.cpp *
2370 * raycube.cpp *
2371 * world.cpp *
2372 * worldio.cpp *
2373\*==============================================================================*/
2374
2375// dynlight
2376
2377extern 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);
2378extern void removetrackeddynlights(const physent *owner = nullptr);
2379
2380// heightmap
2381
2388extern bool isheightmap(int o, bool empty, const cube &c);
2389extern void heightmaprun(int dir, int mode);
2390
2402extern void initheightmapcmds();
2403
2404// material
2405extern int showmat;
2406
2417extern int findmaterial(const char *name);
2418
2419// octaworld
2420
2426extern void initoctaworldcmds();
2427
2437extern void freeocta(std::array<cube, 8> *&c);
2438extern void getcubevector(const cube &c, int d, int x, int y, int z, ivec &p);
2439
2440extern void optiface(const uchar *p, cube &c);
2441
2442// octaedit
2443
2514extern void initoctaeditcmds();
2515
2516extern bool allowediting;
2517extern bool multiplayer;
2518extern std::vector<ushort> texmru;
2519extern selinfo repsel;
2520extern int reptex;
2521extern int lasttex;
2522extern int curtexindex;
2523extern int moving, orient, horient;
2524extern bool editmode;
2525extern int entmoving;
2526extern int entediting;
2527extern selinfo sel, lastsel;
2528extern std::deque<undoblock *> undos,
2530extern int nompedit;
2531extern int hmapedit;
2532extern bool havesel;
2533extern std::vector<editinfo *> editinfos;
2534extern int texpaneltimer;
2535
2536extern ivec cor, cur, lastcor;
2537extern int gridsize;
2538extern int passthroughsel;
2539extern int outline;
2540extern int dragging;
2541extern int selectcorners;
2542
2543extern void clearremappedvslots();
2544
2553extern void boxs3D(const vec &o, vec s, int g, bool boxoutline);
2554
2564extern void boxs(int orient, vec o, const vec &s, float size, bool boxoutline);
2565
2574extern void boxs(int orient, vec o, const vec &s, bool boxoutline);
2575extern void boxsgrid(int orient, vec o, vec s, int g, bool boxoutline);
2576extern bool editmoveplane(const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first);
2577
2584extern void countselchild(const std::array<cube, 8> &c, const ivec &cor, int size);
2585extern void normalizelookupcube(const ivec &o);
2586extern void updateselection();
2587
2588extern bool packeditinfo(const editinfo *e, int &inlen, uchar *&outbuf, int &outlen);
2589extern bool unpackeditinfo(editinfo *&e, const uchar *inbuf, int inlen, int outlen);
2590
2598extern void freeeditinfo(editinfo *&e);
2599extern bool packundo(bool undo, int &inlen, uchar *&outbuf, int &outlen);
2600extern bool noedit(bool view = false, bool msg = true);
2601
2615extern bool pointinsel(const selinfo &sel, const vec &o);
2616
2622extern void cancelsel();
2623
2629extern void addundo(undoblock *u);
2630
2642extern cube &blockcube(int x, int y, int z, const block3 &b, int rgrid);
2643
2651extern void makeundo(selinfo &s);
2652
2659extern void makeundo();
2660
2667extern void reorient();
2668
2676extern int countblock(block3 *b);
2677
2681extern void forcenextundo();
2682
2691extern void freeundo(undoblock *u);
2692
2700extern void pasteblock(const block3 &b, selinfo &sel, bool local);
2701
2710extern void remapvslots(cube &c, bool delta, const VSlot &ds, int orient, bool &findrep, VSlot *&findedit);
2711
2743extern void edittexcube(cube &c, int tex, int orient, bool &findrep);
2744
2751extern bool haveselent();
2752
2764extern void pastecube(const cube &src, cube &dst);
2765
2772extern void pasteundoblock(block3 *b, const uchar *g);
2773extern bool uncompresseditinfo(const uchar *inbuf, int inlen, uchar *&outbuf, int &outlen);
2774
2784extern void unpackundocube(ucharbuf &buf, uchar *outbuf);
2785
2792extern void multiplayerwarn();
2793
2804extern ushort getmaterial(const cube &c);
2805
2816extern void linkedpush(cube &c, int d, int x, int y, int dc, int dir);
2817
2818// raycube
2819
2834extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = Ray_ClipMat, int size = 0);
2835extern float rayfloor (const vec &o, vec &floor, int mode = 0, float radius = 0);
2836extern bool raycubelos(const vec &o, const vec &dest, vec &hitpos);
2837extern float rayent(const vec &o, const vec &ray, float radius, int mode, int size, int &orient, int &ent);
2838
2851extern bool insideworld(const vec &o);
2852
2853// physics
2854
2855extern int collideinside;
2856extern const physent *collideplayer;
2857extern int numdynents;
2858extern std::vector<dynent *> dynents;
2859
2869extern dynent *iterdynents(int i);
2870
2880extern bool collide(const physent *d, vec *cwall = nullptr, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool insideplayercol = false);
2881extern void avoidcollision(physent *d, const vec &dir, const physent *obstacle, float space);
2882
2883extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
2884
2894extern void dropenttofloor(entity *e);
2895
2905extern void rotatebb(vec &center, vec &radius, int yaw, int pitch, int roll = 0);
2906
2921extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m);
2922extern void cleardynentcache();
2923extern void updatedynentcache(physent *d);
2924
2933extern bool entinmap(dynent *d, bool avoidplayers = false);
2934
2947extern void recalcdir(const physent *d, const vec &oldvel, vec &dir);
2948
2958extern void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bool slidecollide);
2959
2969extern void freeblock(block3 *b, bool alloced = true);
2970
2983extern block3 *blockcopy(const block3 &s, int rgrid);
2984
2985// world
2986
2987extern std::vector<int> entgroup;
2988
2995extern void entcancel();
2996
3008extern void attachentity(extentity &e);
3009
3017extern void attachentities();
3018extern void removeentityedit(int id);
3019extern void addentityedit(int id);
3020
3029extern void detachentity(extentity &e);
3030extern void entselectionbox(const entity &e, vec &eo, vec &es);
3031extern void mmboundbox(const entity &e, model *m, vec &center, vec &radius);
3032
3042extern float getdecalslotdepth(const DecalSlot &s);
3043
3044namespace entities
3045{
3049 extern std::vector<extentity *> ents;
3050
3054 extern std::vector<extentity *> &getents();
3055 extern extentity *newentity();
3056 extern void deleteentity(extentity *e);
3057}
3058
3059// worldio
3060
3064const char *getclientmap();
3065
3069void setmapname(const char * newname);
3070
3081extern void initworldiocmds();
3082
3083#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:2529
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