63 extern void begin(GLenum mode,
int numverts);
91 extern void colorf(
float x,
float y,
float z,
float w = 0.0f);
101 extern void colorub(uchar x, uchar y, uchar z, uchar w = 255);
110 extern void defvertex(
int size = 3,
int format = GL_FLOAT);
177extern void conoutf(
const char *s, ...) PRINTFARGS(1, 2);
190extern
void conoutf(
int type, const
char *s, ...) PRINTFARGS(2, 3);
288extern
bool inbetweenframes,
306extern
void fatal(const
char *s, ...) PRINTFARGS(1, 2);
315extern
int scr_w, scr_h;
316extern
int desktopw, desktoph;
703extern
bool grabinput,
706extern
bool interceptkey(
int sym);
707extern
void inputgrab(
bool on);
1322extern int xtraverts;
1361extern vec calcavatarpos(
const vec &pos,
float dist);
1363extern void damageblend(
int n);
1364extern void damagecompass(
int n,
const vec &loc);
1366extern vec minimapcenter, minimapradius, minimapscale;
1377extern void resethudmatrix();
1378extern void pushhudmatrix();
1379extern void flushhudmatrix(
bool flushparams =
true);
1380extern void pophudmatrix(
bool flush =
true,
bool flushparams =
true);
1388extern void initgbuffer();
1390extern void computezoom();
1466extern void gl_drawframe(
int crosshairindex,
void (*gamefxn)(),
void (*hudfxn)(),
void (*editfxn)(),
void (*hud2d)());
1772extern std::vector<std::string>
animnames;
1800 int cull = Model_CullVFC | Model_CullDist | Model_CullOccluded,
1891extern model *
loadmodel(
const char *name,
int i = -1,
bool msg =
false);
1918extern std::vector<std::string>
entnames;
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);
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);
2027extern SDL_Window *screen;
2060extern void restoregamma();
2061extern void restorevsync();
2091extern void limitfps(
int &millis,
int curmillis);
2111extern void renderbackground(
const char *caption =
nullptr,
const Texture *mapshot =
nullptr,
const char *mapname =
nullptr,
const char *mapinfo =
nullptr,
bool force =
false);
2225extern void addstain(
int type,
const vec ¢er,
const vec &surface,
float radius,
const bvec &color =
bvec(0xFF, 0xFF, 0xFF),
int info = 0);
2227inline void addstain(
int type,
const vec ¢er,
const vec &surface,
float radius,
int color,
int info = 0)
2229 addstain(type, center, surface, radius, bvec::hexcolor(color), info);
2336extern Texture *notexture;
2338extern Texture *textureload(
const char *name,
int clamp = 0,
bool mipit =
true,
bool msg =
true);
2355extern bool settexture(
const char *name,
int clamp = 0);
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);
2389extern void heightmaprun(
int dir,
int mode);
2438extern void getcubevector(
const cube &c,
int d,
int x,
int y,
int z,
ivec &p);
2440extern void optiface(
const uchar *p,
cube &c);
2516extern bool allowediting;
2517extern bool multiplayer;
2518extern std::vector<ushort> texmru;
2522extern int curtexindex;
2523extern int moving, orient, horient;
2524extern bool editmode;
2525extern int entmoving;
2526extern int entediting;
2528extern std::deque<undoblock *>
undos,
2533extern std::vector<editinfo *> editinfos;
2536extern ivec cor, cur, lastcor;
2538extern int passthroughsel;
2541extern int selectcorners;
2543extern void clearremappedvslots();
2564extern void boxs(
int orient,
vec o,
const vec &s,
float size,
bool boxoutline);
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);
2585extern void normalizelookupcube(
const ivec &o);
2586extern void updateselection();
2588extern bool packeditinfo(
const editinfo *e,
int &inlen, uchar *&outbuf,
int &outlen);
2589extern bool unpackeditinfo(
editinfo *&e,
const uchar *inbuf,
int inlen,
int outlen);
2599extern bool packundo(
bool undo,
int &inlen, uchar *&outbuf,
int &outlen);
2600extern bool noedit(
bool view =
false,
bool msg =
true);
2710extern void remapvslots(
cube &c,
bool delta,
const VSlot &ds,
int orient,
bool &findrep,
VSlot *&findedit);
2773extern bool uncompresseditinfo(
const uchar *inbuf,
int inlen, uchar *&outbuf,
int &outlen);
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);
2855extern int collideinside;
2856extern const physent *collideplayer;
2857extern int numdynents;
2858extern std::vector<dynent *> dynents;
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);
2883extern bool movecamera(
physent *pl,
const vec &dir,
float dist,
float stepdist);
2922extern void cleardynentcache();
2923extern void updatedynentcache(
physent *d);
2987extern std::vector<int> entgroup;
3018extern void removeentityedit(
int id);
3019extern void addentityedit(
int id);
3030extern void entselectionbox(
const entity &e,
vec &eo,
vec &es);
3031extern void mmboundbox(
const entity &e, model *m,
vec ¢er,
vec &radius);
3049 extern std::vector<extentity *> ents;
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 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.
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.
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 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.
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.
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
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.
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.
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.
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.
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.
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.
const char * getclientmap()
Returns the name of the map currently loaded.
void rotatebb(vec ¢er, 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.
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.
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.
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
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
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
A four dimensional Cartesian-space vector template.
Definition geom.h:844
three dimensional Cartesian vector object
Definition geom.h:207