Libprimis
Imprimis' 3D destroyable world engine
|
The interface the game uses to access the engine. More...
Go to the source code of this file.
Functions | |
void | moveragdoll (dynent *d) |
Update a ragdoll's position and physics. | |
void | cleanragdoll (dynent *d) |
Deletes the ragdoll associated with the passed dynent. | |
void | gle::begin (GLenum mode) |
Sets the type of primitive to draw. | |
void | gle::begin (GLenum mode, int numverts) |
Sets up an immediate-like rendering context. | |
void | gle::attrib (const vec &v) |
Adds three float values, packed in a vec, to the attribbuf. | |
void | gle::attribf (float x, float y) |
Adds two float values to the attribbuf. | |
void | gle::colorf (float x, float y, float z, float w=0.0f) |
Calls glVertexAttrib of the appropriate dimension. | |
void | gle::colorub (uchar x, uchar y, uchar z, uchar w=255) |
Calls glVertexAttrib4Nub to set the color of an attribute. | |
void | gle::deftexcoord0 (int size=2, int format=GL_FLOAT) |
Sets texcoord0 with the given dimensionality and type. | |
void | gle::defvertex (int size=3, int format=GL_FLOAT) |
int | gle::end () |
void | initcscmds () |
Initializes core cubescript commands. | |
void | conoutf (const char *s,...) PRINTFARGS(1 |
Prints a message to the ingame console. | |
void void | conoutf (int type, const char *s,...) PRINTFARGS(2 |
Prints a message to the ingame console, with a specific type flag. | |
void | clear_console () |
Clears the console KeyM history hashtable. | |
void | initconsolecmds () |
Initializes console cubescript commands. | |
FILE * | getlogfile () |
Returns the logfile (Linux) or stdout (Windows) | |
void | logoutf (const char *fmt,...) |
Prints a line to the log file. | |
bool | initsdl () |
Initializes SDL functions necessary to run a game. | |
void | fatal (const char *s,...) PRINTFARGS(1 |
Immediately shuts down the game and prints error message(s) | |
void int | getclockmillis () |
Returns the number of milliseconds since the game started. | |
std::string | enginebuilddate () |
Returns the engine library's build date. | |
std::string | enginestr () |
Returns the engine library's name string. | |
void | initmathcmds () |
Adds math commands to the cubescript interpreter. | |
void | initstrcmds () |
Adds string commands to the cubescript interpreter. | |
void | initcontrolcmds () |
Adds program control commands to the cubescript interpreter. | |
bool | interceptkey (int sym) |
void | inputgrab (bool on) |
void | checkinput (int map=0) |
Handles input from SDL. | |
void | ignoremousemotion () |
Flushes all queued mouse events. | |
void | keyrepeat (bool on, int mask=~0) |
Sets the key repeat mask for SDL. | |
void | initmenuscmds () |
void | inittextcmds () |
Initializes textedit cubescript commands. | |
bool | UI::hascursor () |
Queries UI windows' cursor input ability. | |
void | UI::getcursorpos (float &x, float &y) |
Queries current UI cursor location. | |
void | UI::resetcursor () |
Sets the cursor to the middle of the screen. | |
bool | UI::movecursor (int dx, int dy) |
Moves the UI cursor by the amount perscribed. | |
void | UI::setup () |
Creates a new UI World object, used globally for UI functionality. | |
void | UI::update () |
Updates cursor vis a vis the UI elements. | |
void | UI::cleanup () |
Deletes all of the open windows exposed and deletes the UI world object. | |
bool | UI::showui (const char *name) |
Shows a UI window with the specified name. | |
bool | UI::hideui (const char *name) |
Hides an open UI window with the specified name. | |
bool | UI::toggleui (const char *name) |
Toggles the open/closed state of a window. | |
void | UI::holdui (const char *name, bool on) |
Opens or closes the specified UI. | |
bool | UI::uivisible (const char *name) |
Gets the open/close status of a UI window. | |
void | UI::inituicmds () |
Binds the UI commands to the command parser. | |
void | initaacmds () |
Initializes AA cubescript commands. | |
void | inithudcmds () |
Initializes HUD cubescript commands. | |
void | initnormalcmds () |
Initializes normal.cpp cubescript commands. | |
void | initoctarendercmds () |
Initializes octarender.cpp cubescript commands. | |
void | initrenderglcmds () |
Initializes rendergl.cpp cubescript commands. | |
vec | camdir () |
returns the camera matrix direction component | |
vec | camright () |
returns the camera matrix right component | |
vec | camup () |
returns the camera matrix up component | |
void | disablezoom () |
Unsets any zoom progress and disables zooming. | |
vec | calcavatarpos (const vec &pos, float dist) |
void | damageblend (int n) |
void | damagecompass (int n, const vec &loc) |
void | bindminimap () |
Binds a GL texture to the minimaptex global object. | |
void | resethudmatrix () |
void | pushhudmatrix () |
void | flushhudmatrix (bool flushparams=true) |
void | pophudmatrix (bool flush=true, bool flushparams=true) |
void | resethudshader () |
Binds the HUD shader via glUseProgram() | |
void | initgbuffer () |
void | computezoom () |
void | enablepolygonoffset (GLenum type) |
Enables GL offset mode for overlay drawing. | |
void | disablepolygonoffset (GLenum type) |
Disables GL offset mode for overlay drawing. | |
void | vectoryawpitch (const vec &v, float &yaw, float &pitch) |
Returns 2 Euler angles for a given vector. | |
void | gl_checkextensions () |
Ensures computer environment can run the engine. | |
void | gl_init () |
Sets up GL global parameters for the game. | |
void | gl_resize () |
Changes the viewport size to set values. | |
void | gl_setupframe (bool force=false) |
Sets render frame variables up. | |
void | gl_drawframe (int crosshairindex, void(*gamefxn)(), void(*hudfxn)(), void(*editfxn)(), void(*hud2d)()) |
Draws the frame to the screen. | |
void | drawminimap (int yaw, int pitch, vec loc, const cubeworld &world, int scalefactor=1) |
Draws a minimap texture. | |
void | initrenderlightscmds () |
Initializes renderlights CubeScript commands. | |
void | clearshadowcache () |
Clears the shadow maps cached in the shadow atlas. | |
void | initrendermodelcmds () |
Initializes rendermodel CubeScript commands. | |
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. | |
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 | abovemodel (vec &o, const char *mdl) |
Adds the z height of the model to the vector passed. | |
const char * | mapmodelname (int i) |
Returns the mapmodel name at the given index. | |
void | preloadmodel (std::string name) |
Adds a model to the cache of models to load. | |
model * | loadmapmodel (int n) |
Loads the mapmodel assigned to the specified index. | |
model * | loadmodel (const char *name, int i=-1, bool msg=false) |
Loads the model with the associated name. | |
void | flushpreloadedmodels (bool msg=true) |
Clears the loaded model cache. | |
void | preloadusedmapmodels (bool msg=false, bool bih=false) |
Preloads mapmodels corresponding to the world's mapmodel entities. | |
void | clear_models () |
Clears all loaded models' basic information. | |
const char * | getentname (int i) |
Returns the entity name of of a given entity type index. | |
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 | 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. | |
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) |
void | particle_trail (int type, int fade, const vec &from, const vec &to, int color=0xFFFFFF, float size=1.0f, int gravity=20) |
void | particle_text (const vec &s, const char *t, int type, int fade=2000, int color=0xFFFFFF, float size=2.0f, int gravity=0) |
void | particle_textcopy (const vec &s, const char *t, int type, int fade=2000, int color=0xFFFFFF, float size=2.0f, int gravity=0) |
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) |
void | particle_meter (const vec &s, float val, int type, int fade=1, int color=0xFFFFFF, int color2=0xFFFFF, float size=2.0f) |
void | particle_flare (const vec &p, const vec &dest, int fade, int type, int color=0xFFFFFF, float size=0.28f, physent *owner=nullptr) |
void | particle_fireball (const vec &dest, float max, int type, int fade=-1, int color=0xFFFFFF, float size=4.0f) |
void | removetrackedparticles (physent *owner=nullptr) |
void | initparticles () |
Loads the shaders/renderer objects to render particles. | |
void | initrendertextcmds () |
Initializes rendertext Cubescript commands. | |
bool | setfont (const char *name) |
Sets the currently used font. | |
void | initrenderwindowcmds () |
Initializes renderwindow Cubescript commands. | |
void | swapbuffers (bool overlay=true) |
Refreshes the rendered screenbuffer. | |
void | setupscreen () |
Sets up the SDL window the application runs in. | |
void | restoregamma () |
void | restorevsync () |
void | resetfpshistory () |
Sets the entirety of the fps history buffer (used for averaging the FPS readout) to 1. | |
void | limitfps (int &millis, int curmillis) |
delays a frame by a specified amount | |
void | updatefpshistory (int millis) |
Adds an entry to the fps history. | |
void | cleargamma () |
Sets the SDL gamma level to 1. | |
void | renderbackground (const char *caption=nullptr, Texture *mapshot=nullptr, const char *mapname=nullptr, const char *mapinfo=nullptr, bool force=false) |
void | renderprogress (float bar, const char *text, bool background=false) |
Renders a loading progress bar at the bottom center of the window. | |
void | initshadercmds () |
Initializes shader Cubescript commands. | |
void | loadshaders () |
Loads a series of shaders hardcoded into the engine. | |
void | initstains () |
Loads stains into the global stains array. | |
void | addstain (int type, const vec ¢er, const vec &surface, float radius, const bvec &color=bvec(0xFF, 0xFF, 0xFF), int info=0) |
void | addstain (int type, const vec ¢er, const vec &surface, float radius, int color, int info=0) |
void | inittexturecmds () |
Initializes texture Cubescript commands. | |
Texture * | textureload (const char *name, int clamp=0, bool mipit=true, bool msg=true) |
void | packvslot (std::vector< uchar > &buf, int index) |
Packs into the passed char vector the contents of a VSlot. | |
void | packvslot (std::vector< uchar > &buf, const VSlot *vs) |
Packs into the passed char vector the contents of a VSlot. | |
bool | settexture (const char *name, int clamp=0) |
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) |
void | removetrackeddynlights (const physent *owner=nullptr) |
bool | isheightmap (int o, bool empty, const cube &c) |
Determines if a heightmap is active for the current selection. | |
void | heightmaprun (int dir, int mode) |
void | initheightmapcmds () |
Initializes heightmap Cubescript commands. | |
int | findmaterial (const char *name) |
Returns the bitmask for the given material name. | |
void | initoctaworldcmds () |
Initializes octaworld Cubescript commands. | |
void | freeocta (std::array< cube, 8 > *&c) |
Deletes a cube and its children. | |
void | getcubevector (const cube &c, int d, int x, int y, int z, ivec &p) |
void | optiface (const uchar *p, cube &c) |
void | initoctaeditcmds () |
Initializes the octaedit cubescript commands. | |
void | clearremappedvslots () |
void | boxs3D (const vec &o, vec s, int g, bool boxoutline) |
Draws a box corresponding to positions in worldspace. | |
void | boxs (int orient, vec o, const vec &s, float size, bool boxoutline) |
Draws a box corresponding to positions in worldspace. | |
void | boxs (int orient, vec o, const vec &s, bool boxoutline) |
Draws a box corresponding to positions in worldspace. | |
void | boxsgrid (int orient, vec o, vec s, int g, bool boxoutline) |
bool | editmoveplane (const vec &o, const vec &ray, int d, float off, vec &handle, vec &dest, bool first) |
void | countselchild (const std::array< cube, 8 > &c, const ivec &cor, int size) |
Assigns selchildcount the number of cubes in selection. | |
void | normalizelookupcube (const ivec &o) |
void | updateselection () |
bool | packeditinfo (const editinfo *e, int &inlen, uchar *&outbuf, int &outlen) |
bool | unpackeditinfo (editinfo *&e, const uchar *inbuf, int inlen, int outlen) |
void | freeeditinfo (editinfo *&e) |
Safely frees an editinfo object. | |
bool | packundo (bool undo, int &inlen, uchar *&outbuf, int &outlen) |
bool | noedit (bool view=false, bool msg=true) |
bool | pointinsel (const selinfo &sel, const vec &o) |
Determines whether selection contains location at specified location. | |
void | cancelsel () |
Deselects edit selection. | |
void | addundo (undoblock *u) |
Adds an undo entry to the global undos vector. | |
cube & | blockcube (int x, int y, int z, const block3 &b, int rgrid) |
Looks up a world cube inside the block passed. | |
void | makeundo (selinfo &s) |
Adds an undo entry to the undos vector given the passed selection. | |
void | makeundo () |
Adds an undo entry to the undos vector given the current selection. | |
void | reorient () |
Reorients sel to point in the direction of orient . | |
int | countblock (block3 *b) |
Counts the number of cubes (incl. children) within a block3 volume. | |
void | forcenextundo () |
Sets lastsel 's orientation flag to -1. | |
void | freeundo (undoblock *u) |
Deletes an undoblock object. | |
void | pasteblock (const block3 &b, selinfo &sel, bool local) |
Pastes the block3 passed to the volume in the selinfo object. | |
undoblock * | newundocube (const selinfo &s) |
Creates an undoblock object given a cube selection. | |
void | remapvslots (cube &c, bool delta, const VSlot &ds, int orient, bool &findrep, VSlot *&findedit) |
void | edittexcube (cube &c, int tex, int orient, bool &findrep) |
Changes the texture for a cube and its children. | |
bool | haveselent () |
Queries whether the current selection has entities selected. | |
void | pastecube (const cube &src, cube &dst) |
Copies and pastes a single cube (with its children). | |
void | pasteundoblock (block3 *b, const uchar *g) |
Pastes an undo block associated with the passed block3 object. | |
bool | uncompresseditinfo (const uchar *inbuf, int inlen, uchar *&outbuf, int &outlen) |
void | unpackundocube (ucharbuf &buf, uchar *outbuf) |
Unpacks a buffer containing an undo action into a unsigned char array. | |
void | multiplayerwarn () |
Prints a warning message to the console. | |
ushort | getmaterial (cube &c) |
Returns the material bitmask for the given cube. | |
void | linkedpush (cube &c, int d, int x, int y, int dc, int dir) |
Pushes cubes linked with the passed cube. | |
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. | |
float | rayfloor (const vec &o, vec &floor, int mode=0, float radius=0) |
bool | raycubelos (const vec &o, const vec &dest, vec &hitpos) |
float | rayent (const vec &o, const vec &ray, float radius, int mode, int size, int &orient, int &ent) |
bool | insideworld (const vec &o) |
Queries whether the given vector lies inside the octree world. | |
dynent * | iterdynents (int i) |
Returns the dynent at index i. | |
bool | collide (const physent *d, const vec &dir=vec(0, 0, 0), float cutoff=0.0f, bool playercol=true, bool insideplayercol=false) |
Determines whether the specified physent has collided with the octree world. | |
void | avoidcollision (physent *d, const vec &dir, const physent *obstacle, float space) |
bool | movecamera (physent *pl, const vec &dir, float dist, float stepdist) |
void | dropenttofloor (entity *e) |
Drops the map entity to a set distance above the floor. | |
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 | vecfromyawpitch (float yaw, float pitch, int move, int strafe, vec &m) |
Modifies a vector based on passed movement modifiers. | |
void | cleardynentcache () |
void | updatedynentcache (physent *d) |
bool | entinmap (dynent *d, bool avoidplayers=false) |
Brute force but effective way to find a free spawn spot in the map. | |
void | recalcdir (const physent *d, const vec &oldvel, vec &dir) |
Recalculates dir based on the provided physent, normalized to oldvel. | |
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. | |
void | freeblock (block3 *b, bool alloced=true) |
Deletes dynamically allocated cubes to a block entity. | |
block3 * | blockcopy (const block3 &s, int rgrid) |
Allocates a new copy of the given block3 on the heap. | |
void | entcancel () |
Cancels selection of selected entities. | |
void | attachentity (extentity &e) |
Attempts to attach the given entity to another entity. | |
void | attachentities () |
Attempts to attach all entities in selection. | |
void | removeentityedit (int id) |
void | addentityedit (int id) |
void | detachentity (extentity &e) |
Attempts to dettach the given entity. | |
void | entselectionbox (const entity &e, vec &eo, vec &es) |
void | mmboundbox (const entity &e, model *m, vec ¢er, vec &radius) |
float | getdecalslotdepth (const DecalSlot &s) |
Gets the depth of a decal slot. | |
std::vector< extentity * > & | entities::getents () |
Returns the entities::ents vector. | |
extentity * | entities::newentity () |
void | entities::deleteentity (extentity *e) |
const char * | getclientmap () |
Returns the name of the map currently loaded. | |
const void | setmapname (const char *newname) |
Sets the client map string to the provided value. | |
void | initworldiocmds () |
Initializes worldio Cubescript commands. | |
Variables | |
void void int | initing |
int | curtime |
int | lastmillis |
int | elapsedtime |
int | totalmillis |
FILE * | logfile |
dynent * | player |
The dynamic entity representing the player. | |
bool | inbetweenframes |
bool | renderedframe |
int | scr_w |
int | scr_h |
int | desktopw |
int | desktoph |
bool | grabinput |
bool | minimized |
int | mainmenu |
physent * | camera1 |
vec | worldpos |
float | fovy |
bool | detachedcamera |
int | xtraverts |
vec | minimapcenter |
vec | minimapradius |
vec | minimapscale |
matrix4 | hudmatrix |
std::vector< std::string > | animnames |
std::vector< std::string > | entnames |
SDL_Window * | screen |
int | fullscreen |
Texture * | notexture |
int | showmat |
bool | allowediting |
bool | multiplayer |
std::vector< ushort > | texmru |
selinfo | repsel |
int | reptex |
int | lasttex |
int | curtexindex |
int | moving |
int | orient |
int | horient |
bool | editmode |
int | entmoving |
int | entediting |
selinfo | sel |
selinfo | lastsel |
std::deque< undoblock * > | undos |
std::deque< undoblock * > | redos |
int | nompedit |
int | hmapedit |
bool | havesel |
std::vector< editinfo * > | editinfos |
int | texpaneltimer |
ivec | cor |
ivec | cur |
ivec | lastcor |
int | gridsize |
int | passthroughsel |
int | outline |
int | dragging |
int | selectcorners |
vec | collidewall |
int | collideinside |
const physent * | collideplayer |
int | numdynents |
std::vector< dynent * > | dynents |
std::vector< int > | entgroup |
std::vector< extentity * > | entities::ents |
The list of extentities corresponding to the cube world's entities. | |
The interface the game uses to access the engine.
The file contains functions which comprise the API for writing games. This header file is not called by the game internally but should be included in the game code to expose functions to the game.
|
extern |
Adds the z height of the model to the vector passed.
Takes the passed-by-reference vector and adds the z height of the bounding box to the vector given.
o | the vector to add the height to |
mdl | the name of the model object to use |
|
extern |
Adds an undo entry to the global undos vector.
the | undo object to add |
|
extern |
Attempts to attach all entities in selection.
For all eligible entities in the current selection, the engine attempts to link it with its nearest entity it can link with; silently fails and does nothing if no entities in selection are eligible or selected.
|
extern |
Attempts to attach the given entity to another entity.
Attempts to attach the entity passed to another entity that it can be attached to, as long as it is within the attach radius.
Fails silently if the given entity has no close by entities to link to or the entity type is ineligible to be linked
e | the extentity to attempt to link |
|
extern |
Adds three float values, packed in a vec, to the attribbuf.
v | the vec to add to the attribbuf |
|
extern |
Adds two float values to the attribbuf.
x | the first value to add |
y | the second value to add |
|
extern |
Sets the type of primitive to draw.
mode | one of the GL primitive types (e.g. GL_TRIANGLES, GL_TRIANGLE_STRIP, ..) |
|
extern |
Sets up an immediate-like rendering context.
Does not use glBegin() or other legacy constructs.
mode | one of the GL primitive types (e.g. GL_TRIANGLES, GL_TRIANGLE_STRIP, ..) |
numverts | the number of vertices to draw |
|
extern |
Binds a GL texture to the minimaptex global object.
The global variable minimap texture, minimaptex, has a GL buffer bound to it. Before this is called, no texture is associated with it.
Allocates a new copy of the given block3 on the heap.
Generates a new object of type uchar[blocksize] which is filled with the same contents of the passed block. This is operated on by reinterpret_cast<block3 *> to return a pointer of the return type.
s | the block3 to copy |
the | grid power to copy at |
Looks up a world cube inside the block passed.
x | the x coordiante inside the block3 to look up |
y | the y coordiante inside the block3 to look up |
z | the z coordiante inside the block3 to look up |
b | the block3 object to search inside |
rgrid | the grid power to look up with |
Draws a box corresponding to positions in worldspace.
orient | the orientation direction of the square |
o | the origin from where to draw the box |
s | the displacement vector from the origin to place the opposite corner |
boxoutline | toggles rendering such that it appears outside a cube with the same dimensions |
Draws a box corresponding to positions in worldspace.
orient | the orientation direction of the square |
o | the origin from where to draw the box |
s | the displacement vector from the origin to place the opposite corner |
size | the scale factor of the box in the world |
boxoutline | toggles rendering such that it appears outside a cube with the same dimensions |
Draws a box corresponding to positions in worldspace.
o | the origin from where to draw the box |
s | the displacement vector from the origin to place the opposite corner |
g | the gridpower to multiply the box by |
boxoutline | toggles rendering such that it appears outside a cube with the same dimensions |
|
extern |
returns the camera matrix direction component
|
extern |
returns the camera matrix right component
|
extern |
returns the camera matrix up component
|
extern |
Deselects edit selection.
This function deselects the cubes and entities currently selected.
|
extern |
Handles input from SDL.
Executes the CubeScript commands associated with any SDL key operations queued.
map | the keymap to use: 0 for default, 1 for edit, 2 for spec |
|
extern |
Deletes the ragdoll associated with the passed dynent.
The function does nothinf if the dynent does not point to a ragdoll object. Also, the function does nothing if the dynent is a ragdoll that is not present.
d | a dynent pointer. |
|
extern |
Clears the console KeyM history hashtable.
Empties the KeyM hashtable keyms, typicall used when shutting down the program.
|
extern |
Clears all loaded models' basic information.
Clears the model information from its associated hashmap. Does not clear preloaded model information.
|
extern |
Sets the SDL gamma level to 1.
Sets SDL_SetWindowBrightness of the screen the engine is rendering to to 1, if the screen exists and the current gamma global variable has been changed from its default.
|
extern |
Clears the shadow maps cached in the shadow atlas.
Also clears the radiance hints cache, if enabled.
|
extern |
Determines whether the specified physent has collided with the octree world.
d | a pointer to the physent |
dir | the direction to attempt to collide at |
cutoff | collision cutoff slope |
playercol | toggles colliding with outside players |
insideplayercol | tooggles collidign with players you share space with |
|
extern |
Calls glVertexAttrib of the appropriate dimension.
If the alpha value (w) is 0, glVertexAttrib3f is called, else glVertexAttrib4f. Sets the color of the attribute currently active.
x | the red channel (0..1) |
y | the green channel (0..1) |
z | the blue channel (0..1) |
w | the alpha channel (0..1) |
|
extern |
Calls glVertexAttrib4Nub to set the color of an attribute.
x | the red channel (0..255) |
y | the green channel (0..255) |
z | the blue channel (0..255) |
w | the alpha channel (0..255) |
|
extern |
Prints a message to the ingame console.
This function behaves the same way as printf() except it prints to the console instead.
s | the string to print |
... | the names of variables to substitute into the string, in order |
|
extern |
Prints a message to the ingame console, with a specific type flag.
This function behaves the same way as printf() except it prints to the console instead. It uses a parameter type
to indicate what type of console message to print. The console flags are defined in consts.h.
type | the flag to modify the console printout with |
s | the string to print |
... | the names of variables to substitute into the string, in order |
|
extern |
Counts the number of cubes (incl. children) within a block3 volume.
b | the block to evaluate |
Assigns selchildcount the number of cubes in selection.
Recursively counts the number of cubes being selected in the current selection, and assigns this value to selchildcount
|
extern |
Sets texcoord0 with the given dimensionality and type.
size | the number of dimensions to use |
the | GL format of the dimensions |
|
extern |
Attempts to dettach the given entity.
Attempts to detach the entity from any entity it may be attached to. Fails silently if the entity is not attached.
e | the extentity to attempt to de-link |
|
extern |
Disables GL offset mode for overlay drawing.
Also disables the GL mode passed to type.
type | the GL mode to glDisable() |
|
extern |
Unsets any zoom progress and disables zooming.
Sets the zoom variable to 0 (disabled) and removes any zoom progress that may be occuring.
|
extern |
Draws a minimap texture.
Draws a minimap buffer at the specified orientation and location on the map. Does not render it to the screen, instead rendering it to the minimaptex buffer.
yaw | the yaw angle to draw the texture at |
pitch | the pitch angle to draw the texture at |
loc | the location about which to draw the texture |
cubeworld | the world to draw |
scalefactor | the texture zoom factor |
|
extern |
Drops the map entity to a set distance above the floor.
Drops the entity passed such that it is 4 cube units above the floor, unless the map entity is of the type "particles", whereupon it is dropped to be at the same height as the floor.
e | the entity to drop towards the floor. |
|
extern |
Changes the texture for a cube and its children.
The integer indices for the orient
parameter are indicated below.
c | the cube to modify |
tex | the texture slot to apply |
orient | the face of the cube to apply to; -1 indicates all faces |
findrep | toggles whether to find the existing texture |
|
extern |
Enables GL offset mode for overlay drawing.
Controlled by polygonoffsetfactor/polygonoffsetunits variables; negative values will overlay in depth so there is no z fighting. Enables the GL mode passed to type.
type | the GL mode to glEnable() |
|
extern |
Returns the engine library's build date.
Returns the value of DATE macro at the time the engine was built; this value is in the format MMM DD YYYY (e.g. Jan 01 1970). The purpose of the function is to quickly disambiguate how old a (development) build of the engine is.
|
extern |
Returns the engine library's name string.
Returns the version string for the engine library, which is a compiled-in constant inside the engine library. The purpose of the function is to quickly disambiguate different versions of the library.
|
extern |
Cancels selection of selected entities.
Clears the selection of any entities in edit mode. Has no effect if no entities are selected.
|
extern |
Brute force but effective way to find a free spawn spot in the map.
Attemps to place a dynent onto the map.
d | the dynent to place onto the map |
avoidplayers | toggles whether this dynent should be spawned on top of others |
|
extern |
Immediately shuts down the game and prints error message(s)
Shuts down SDL and closes the game immediately. Up to two error messages are printed in a SDL message box after exiting the game.
s | a series of C strings corresponding to error messages |
|
extern |
Returns the bitmask for the given material name.
Given a material name (water, clip, noclip, etc.), returns the bitmask value the material is associated with in the octree world.
name | a C string with the name of the material to look up |
|
extern |
Clears the loaded model cache.
msg | toggles rendering a loading progress meter |
|
extern |
|
extern |
Safely frees an editinfo object.
Deletes an editinfo object, including its position in the editinfos vector.
e | the editinfo object to destroy. |
|
extern |
Deletes a cube and its children.
Recursively deletes child members of the cube passed, then deletes the cube itself. The node allocation counter is also decreased to correspond to the removed cubes.
c | the cube object to be deleted |
|
extern |
Deletes an undoblock object.
Destroys an undoblock and frees its memory allocation. The pointer passed will become invalid.
u | the undoblock to destroy. |
|
extern |
Returns the number of milliseconds since the game started.
Uses SDL to retrieve the amount of time since the game started.
void UI::getcursorpos | ( | float & | x, |
float & | y ) |
Queries current UI cursor location.
Returns to the parameters passed by reference the location of the UI cursor. This location ranges from 0 to 1.f in x and y, with 0,0 being the bottom left part of the screen, and 0.5 0.5 being the middle of the screen. The x and y parameters do not scale by aspect ratio, and 1,1 is always the top right corner of the screen
x | variable to assign x-coordinate of the cursor's location to |
y | variable to assign y-coordinate of the cursor's location to |
|
extern |
Gets the depth of a decal slot.
Returns the depth value for a decal slot. The depth value determines the distance between a decal and a piece of geometry where the decal will still render.
s | the decalslot to query |
|
extern |
Returns the entity name of of a given entity type index.
For the given entity type index (light, model, etc.) returns the human readable name of the entity type. Returns an empty string if index out of bounds.
FILE * getlogfile | ( | ) |
Returns the logfile (Linux) or stdout (Windows)
the file where the
Log files are not supported on Windows, so this function returns stdout if on Windows.
|
extern |
Returns the material bitmask for the given cube.
Returns the bitmask for the cube passed, which corresponds to the sum of all materials occupying the cube. Every sum is unique due to the basis selection, and therefore any combination of materials can be represented in the output. Returns 0 (air) if there is no valid material that describes the entire cube.
|
extern |
Ensures computer environment can run the engine.
This function checks for the OpenGL contexts, GLSL version information, and other graphics capabilities required to run the engine. This function will call fatal() and exit the game if any of its conditions are not met.
|
extern |
Draws the frame to the screen.
crosshairindex | the crosshair to render at the center of the screen |
gamefxn | the game interface rendering function |
hudfxn | the 3d HUD rendering function |
editfxn | the game's edit rendering function |
hud2d | the game's HUD rendering function |
|
extern |
Sets up GL global parameters for the game.
This function sets up the global variables which allow for the appropriate operation of the renderer, and sets up the basic shaders required.
|
extern |
Changes the viewport size to set values.
This function sets the size of the viewport to the dimensions defined in hudw
and hudh
. It also calls gl_setupframe()
.
|
extern |
Sets render frame variables up.
Sets renderw/h and hudw/h to the screen size, then sets up deferred buffers if force
is true.
bool UI::hascursor | ( | ) |
Queries UI windows' cursor input ability.
Returns whether the UI system is accepting cursor input; if any windows in the UI system accept cursor input, returns True.
|
extern |
Queries whether the current selection has entities selected.
bool UI::hideui | ( | const char * | name | ) |
Hides an open UI window with the specified name.
If the specified window is not shown or does not exist, no action is taken, Otherwise, hides the open window specified
name | the name of the UI window to show |
void UI::holdui | ( | const char * | name, |
bool | on ) |
Opens or closes the specified UI.
Opens the specified UI if on
is true
and closes it if on
is false; calls either showui() or hideui().
name | the name of the window to hold |
on | whether to open or close the specified UI window |
|
extern |
Flushes all queued mouse events.
For all SDL_MOUSEMOTION events currently queued in SDL's event queue, this function dumps them one by one while doing nothing. This is used to clear any mouse events which may happen while the game is starting up, to ensure the cursor spawns in the middle of the screen.
|
extern |
Initializes AA cubescript commands.
getsmaaproperty
int index
setsmaaproperty
int index int value
|
extern |
Initializes console cubescript commands.
fullconsole
toggleconsole
conskip
miniconskip
clearconsole
keymap
bind
specbind
editbind
getbind
getspecbind
geteditbind
searchbinds
searchspecbinds
searcheditbinds
clearbinds
clearspecbinds
cleareditbinds
clearallbinds
inputcommand
saycommand
history
onrelease
complete
listcomplete
|
extern |
Adds program control commands to the cubescript interpreter.
exec
string file int msg
escape
string str
unescape
string str
writecfg
changedvars
doargs
if
?
pushif
do
append
result
tagval v
listlen
string list
list
givenat
string list int index
index
position in list
sublist
count
length subset of the list
givencount
is given then all elements fromskip
to the end of the list are returnedskip
is given then all elements will be returnedskip
and count
values are treated as zerolistcount
ident id string list expression condition
id
is set to the value of each list element before running the conditionlistfind
ident id string list expression condition
list
that satisfies the given conditionid
is set to the value of each list element before running the conditionlistfind=
loop
ident id int num expression body
num
times with id
set from 0 to num
-1id
will become an int regardless of prior typeid
retains its value set at the last loop iterationloop+
ident id int offset int num expression body
num
times with id
set from offset
to offset
+num
-1id
will become an int regardless of prior typeid
retains its value set at hte last loop iterationloop* *ident* id *int* step *int* num *expression* body
numtimes with
idset from 0 to (
num-1)*
step
stepis zero,
idis zero for all iterations (
num` iterations)
loop+*
*ident* id int step int num expression body
num
times with id
set from offset
to (offset
+num
-1)*step
step
is zero, id
is offset
for all iterations (num
iterations)loopconcat
ident id int num expression body
num
times with id
set from 0 to num
-1body
body
expression are delimited by single spacesid
will become an int regardless of prior typeid
retains its value set at hte last loop iterationloopconcat+
ident id int offset int num expression body
num
times with id
set from offset
to offset
+num
-1body
expression are delimited by single spaceslooplist
looplist2
looplist3
listassoc=
looplistconcat
looplistconcatword
prettylist
string list string conjunction
indexof
string list string elem
elem
is found within list
list
compares equal to elem
, returns -1listdel
string list string elems
list
passed with all elements in elems
removed from itlistintersect
string list string elems
list
and elems
(both space-delimited strings)list
and elems
are included in the return setlist
and elems
list
list
are preserved in the output set, if such a value is also in elems
elems
are never preserved in the output setlistunion
string list string elems
list
and elems
(both space-delimited strings)list
are in the return setelems
that are not in list
are appended (up to one per unique entry)list
are preserved in the output setelems
are not preserved in the output setloopfiles
listsplice
string list string list2 int skip int count
count
elements with spliced-in listskip
number of elements (starting from zero)findfile
sortlist
string list ident lesser ident greater expression comparison expression unique
lesser
and greater
parameters to evaluatesortlist $list lesser greater [<s $lesser $greater] will sort in ascending order
An expression that asserts
$greater<
$lesser` can be used to sort in reverse (descending) orderuniquelist
string list ident arg1 ident arg2 expression unique
unique
expressionarg1
and arg2
and returns if they compare equalgetmillis
sleep
clearsleep
|
extern |
Initializes core cubescript commands.
defvar
defvarp
deffvarp
defsvar
defsvarp
getvarmin
getfvarmin
getfvarmax
identexists
getalias
nodebug
push
alias
resetvar
|
extern |
Initializes heightmap Cubescript commands.
hmapcancel
hmapselect
clearhbrush
hbrushvert
|
extern |
Initializes HUD cubescript commands.
loadcrosshair
string file int index
getcrosshair
int index
index
the crosshair index to query
|
extern |
Adds math commands to the cubescript interpreter.
+
+f
*
*f
-
-f
=
=f
=s
!=
!=f
!=f
<
<f
<s
>
>f
>s
<=
<=f
<=s
>=
>=f
>=s
!
tagval val
&&
(variadic) expression arg1, expression arg2...
||
(variadic) expression arg1, expression arg2...
div
divf
mod
modf
pow
sin
float angle
cos
float angle
tan
float angle
asin
float ratio
acos
float ratio
atan
float ratio
atan2
float y float x
sqrt
float value
loge
float value
log2
float value
log10
float value
exp
float value
min
minf
(variadic) (int, float) arg1, (int, float) arg2...
max
maxf
(variadic) (int, float) arg1, (int, float) arg2...
bitscan
int value
abs
absf
floor
ceil
round
cond
(variadic) expression arg1, expression arg2...
cond
with one or zero parameters returns 0 regardless of parameter valuescase
casef
cases
rnd
rndstr
tohex
int value int digits
digits
(more if necessary to represent value)strcmp
|
extern |
Initializes menus CubeScript commands.
applychanges
pendingchanges
|
extern |
Initializes normal.cpp cubescript commands.
smoothangle
int id int angle
|
extern |
Initializes the octaedit cubescript commands.
moving
entcancel
cubecancel
cancelsel
reorient
selextend
selmoved
selsave
selrestore
selswap
havesel
selchildnum
selchildmat
clearundos
delprefab
saveprefab
pasteprefab
wtr
vtr
wvt
vvt
evt
eva
octa
va
gldes
geombatch
oq
|
extern |
Initializes octarender.cpp cubescript commands.
recalc
|
extern |
Initializes octaworld Cubescript commands.
printcube
prints debug information for a cube
|
extern |
Loads the shaders/renderer objects to render particles.
Loads a series of particle related shader (particle, particlenotexture, particlesoft, particletext) as well as initializing particlerenderer objects as necessary to begin particle rendering.
|
extern |
Initializes rendergl.cpp cubescript commands.
glext
ext
ext
the name of the extension to querygetcamyaw
getcampitch
getcamroll
getcampos
|
extern |
Initializes renderlights CubeScript commands.
usepacknorm
debuglightinfo
int type
getcsmproperty
int type
setcsmproperty
int type float value
|
extern |
Initializes rendermodel CubeScript commands.
Commands starting with obj
or md5
will only have an effect when called by files loaded by the following functions: loadmodel
rendermodel
loadmapmodel(int)
intersectmodel
preloadusedmapmodels
flushpreloadedmodels
abovemodel
.
They define the parameters of the loaded model, and are not to be used when not loaded by the above functions. All obj
/md5
functions will return a "not loading an X" error if they are called outside of these special scopes.
mapmodelreset
int index
mapmodel
string name
mapmodelname
int index int prefix
mapmodelloaded
int index
nummapmodels
null
clearmodel
string name
findanims
string name
objcullface
int cullface
objcolor
float red float green float blue
objcollide
bool collide
objellipsecollide
bool collide
objtricollide
bool collide
objspec
float scale
objgloss
float type
objalphatest
float cutoff
objdepthoffset
int offset
objglow
float scale float delta float pulse
objfullbright
float scale
objshader
string shader
objspin
float yaw float pitch float roll
objscale
float scale
objtrans
float x float y float z
objyaw
float angle
objpitch
float angle
objroll
float angle
objshadow
bool shadow
objalphashadow
bool shadow
objbb
float radius float height float eyeheight
objextendbb
float x float y float z
objname
objskin
string meshname string tex string masks
objtexspec
string tex float scale
objtexgloss
string tex int type
objtexglow
string tex float percent float delta float pulse
objmeshalphatest
string meshname float cutoff
objcullface
string meshname int cullface
objmeshcolor
string meshname float red float green float blue
objbumpmap
string meshname string tex
objdecal
string meshname string tex
objmeshfullbright
string meshname string brightness
objmeshshader
string meshname string shader
objscroll
string meshname float xscroll float yscroll
objnoclip
string meshname bool clip
objtricollide
string meshname
objlink
int parent int child string tagname float x float y float z
objload
string meshname float smooth
objtag
string tagname float tx float ty float tz float rx float ry float rz
objpitch
string meshname
md5cullface
gltfcullface
int cullface
md5color
gltfcolor
float red float green float blue
md5collide
gltfcollide
bool collide
md5ellipsecollide
gltfellipsecollide
bool collide
md5tricollide
gltftricollide
bool collide
md5spec
gltfspec
float scale
md5gloss
gltfgloss
float type
md5alphatest
gltfalphatest
float cutoff
md5depthoffset
gltfdepthoffset
int offset
md5glow
gltfglow
float scale float delta float pulse
md5fullbright
gltffullbright
float scale
md5shader
gltfshader
string shader
md5spin
gltfspin
float yaw float pitch float roll
md5scale
gltfscale
float scale
md5trans
gltftrans
float x float y float z
md5yaw
gltfyaw
float angle
md5pitch
gltfpitch
float angle
md5roll
gltfroll
float angle
md5shadow
gltfshadow
bool shadow
md5alphashadow
gltfalphashadow
bool shadow
md5bb
gltfbb
float radius float height float eyeheight
md5extendbb
gltfextendbb
float x float y float z
md5name
gltfname
md5skin
gltfskin
string meshname string tex string masks
md5texspec
gltftexspec
string tex float scale
md5texgloss
gltftexgloss
string tex int type
md5texglow
gltftexglow
string tex float percent float delta float pulse
md5meshalphatest
gltfmeshalphatest
string meshname float cutoff
md5meshcullface
gltfmeshcullface
string meshname int cullface
md5meshcolor
gltfmeshcolor
string meshname float red float green float blue
md5bumpmap
gltfbumpmap
string meshname string tex
md5decal
gltfdecal
string meshname string tex
md5meshfullbright
gltfmeshfullbright
string meshname string brightness
md5meshshader
gltfmeshshader
string meshname string shader
md5scroll
gltfscroll
string meshname float xscroll float yscroll
md5noclip
gltfnoclip
string meshname bool clip
md5tricollide
gltftricollide
string meshname string meshname
md5link
gltflink
int parent int child string tagname float x float y float z
md5load
gltfload
string meshname string skel float smooth
md5tag
gltftag
string tagname float tx float ty float tz float rx float ry float rz
md5pitch
gltfpitch
string meshname float pitchscale float pitchoffset float pitchmin float pitchmax
md5pitchtarget
gltfpitchtarget
string meshname string animfile int frameoffset float pitchmin float pitchmax
md5pitchcorrect
gltfpitchcorrect
string meshname string targetname float scale float pitchmin float pitchmax
md5hitzone
gltfhitzone
int hitzoneid string maskstring
md5anim
gltfanim
string animname string animfile float speed int priority int startoffset int endoffset
md5animpart
gltfanimpart
string maskstring
md5adjust
gltfadjust
string bonename float yaw float pitch float roll float translatex float translatey float translatez
md5rdvert
gltfrdvert
float x float y float z float radius
md5rdeye
gltfrdeye
int level
md5rdtri
gltfrdtri
int vertex1 int vertex2 int vertex3
md5rdjoint
`gltfrdjoint int num int tri bool vertex1 bool vertex2 bool vertex3
md5rdlimitdist
gltfrdlimitdist
int vertex1 int vertex2 float mindist float maxdist
md5rdlimitrot
gltfrdlimitrot
int tri1 int tri2 float maxangle float quatx float quaty float quatz float quatw
md5rdanimjoints
gltfrdanimjoints
bool on
|
extern |
Initializes rendertext Cubescript commands.
font
fontborder
fontoutline
fontoffset
fontscale
fonttex
fontchar
fontskip
|
extern |
Initializes renderwindow Cubescript commands.
getfps
bool raw
resetgl
null
screenres
int width int height
|
extern |
Initializes SDL functions necessary to run a game.
Initializes SDL_INIT_TIMER, SDL_INIT_VIDEO, and SDL_INIT_AUDIO.
|
extern |
Initializes shader Cubescript commands.
defershader
forceshader
shader
type name ps vs
type
a bitmask describing the properties of the shadername
the name of the shader for calls from e.g. useshaderbyname
vs
the vertex shaderps
the pixel shadervariantshader
setshader
isshaderdefined
setshaderparam
reuseuniformparam
clearpostfx
addpostfx
setpostfx
resetshaders
variantshader_new
int string int int code
shader_new
int string exec
shader_define
string string
shader_source
string vs string fs
shader_new
shader_include_vs
string
shader_include_ps
string
shader_get_defines
null
shader_get_includes_vs
null
shader_get_includes_ps
null
|
extern |
Loads stains into the global stains array.
Sets up each entry in the stains global variable array using init() method and then preloads them.
Fails to do anything if initing is set (early game loading time).
|
extern |
Adds string commands to the cubescript interpreter.
echo
commandstr expression
error
commandstr expression
strstr
string haystack string needle
strlen
string
struni
unistr
strlower
converts the string to lowercase
strupper
converts the string to uppercase
strsplice
string str string vals int skip int count
skip
and skip
+ count
with the passed vals
vals
is larger than count
+ 1, the resulting string will be lengthened instead of values overwrittenstrreplace
string str string oldval string newval string newval2
oldval
with newval
newval2
parameter exists, every other oldval
will be newval2
(starting with newval
)substr
stripcolors
string str
appendword
concat
(variadic) string param1, string param2...
concatword
(variadic) string param1, string param2...
format
nicely formats the string passed
|
extern |
Initializes textedit cubescript commands.
textinit
textlist
textshow
textfocus
textprev
textmode
textsave
textload
textcopy
textpaste
textmark
textselectall
textclear
textcurrentline
textexec
|
extern |
Initializes texture Cubescript commands.
texturereset
int max
max
the maximum number of slots to retain.materialreset
null
decalreset
int max
max
the maximum number of decals to retain.compactvslots
int max
max
the maximum number of slots to retain.texture
string type string name int rot int xoffset int yoffset float scale
type
the type of texture file being loaded:0
diffuse1
unknown texc
diffuseu
unknown texn
normal mapg
glow maps
specular mapz
depth mapa
alpha mapname
the path to the texture filesrot
the rotation value of the texture (see texrotate)xoffset
the x-offset of the texture (see texoffset)yoffset
the y-offset of the texture (see texoffset)scale
the scale factor for the texture on the worldtexgrass
string name
texscroll
float x float y
texoffset
int x int y
texrotate
int xform
xform
the transform code:0
no transform1
90 degrees2
180 degrees3
270 degrees CW4
flip, X axis5
flip, Y axis6
transpose7
flipped transposetexangle
float angle
angle
the angle in degrees to rotate the texturetexalpha
float front float back
front
the opacity of a texture viewed from the frontback
the opacity of a texture viewed from the backtexcolor
float red float green float blue
red
the intensity of the red channelgreen
the intensity of the green channelblue
the intensity of the blue channeltexrefract
float k float red float green float blue
k
the refractive indexred
the intensity of the red channelgreen
the intensity of the green channelblue
the intensity of the blue channeltexsmooth
int id bool angle
id
the id of the smoothgroupangle
the angle to lerp atdecaldepth
float depth float fade
depth
the depth to set the decalfade
the fade intensity of the decalreloadtex
string name
screenshot
string filename
void UI::inituicmds | ( | ) |
Binds the UI commands to the command parser.
Places into the CubeScript interpreter a series of UI commands, required before it is possible to use CubeScript to create UI elements.
Commands defined:
showui
hideui
hidetopui
hideallui
toggleui
holdui
uivisiblecmd
uiname
uihover
uihover?
uihover+
uihover+?
uipress
uipress?
uipress+
uipress+?
uihold
uihold?
uihold+
uihold+?
uirelease
uirelease?
uirelease+
uirelease+?
uialthold
uialthold?
uialthold+
uialthold+?
uialtpress
uialtpress?
uialtpress+
uialtpress+?
uialtrelease
uialtrelease?
uialtrelease+
uialtrelease+?
uieschold
uieschold?
uieschold+
uieschold+?
uiescpress
uiescpress?
uiescpress+
uiescpress+?
uiescrelease
uiescrelease?
uiescrelease+
uiescrelease+?
uiscrollup
uiscrollup?
uiscrollup+
uiscrollup+?
uiscrolldown
uiscrolldown?
uiscrolldown+
uiscrolldown+?
uifocus
uifocus?
uifocus+
uifocus+?
uialign
uialign-
uialign*
uiclamp
uiclamp-
uiclamp*
uigroup
uihlist
uivlist
uilist
uigrid
uitableheader
uitablerow
uitable
uispace
uioffset
uifill
uitarget
uiclip
uiscroll
uihscrolloffset
uivscrolloffset
uihscrollbar
uivscrollbar
uiscrollarrow
uiscrollbutton
uihslider
uivslider
uisliderarrow
uisliderbutton
uicolor
uimodcolor
uivgradient
uimodvgradient
uihgradient
uimodhgradient
uioutline
uiline
uitriangle
uitriangleoutline
uimodtriangle
uicircle
uicircleoutline
uimodcircle
uicolortext
uitext
uitextfill
uiwrapcolortext
uiwraptext
uicolorcontext
uicontext
uicontextfill
uiwrapcolorcontext
uiwrapcontext
uitexteditor
uifont
uiabovehud
uiconsole
uifield
uikeyfield
uiimage
uistretchedimage
uicroppedimage
uiborderedimage
uitiledimage
uimodelpreview
uiprefabpreview
uislotview
uivslotview
uicontextscale
newui
uiallowinput
uieschide
|
extern |
Initializes worldio Cubescript commands.
mapcfgname
mapversion
|
extern |
Queries whether the given vector lies inside the octree world.
Returns truth value for whether the vector given has coordinates which lie within the space occupied by the worldroot cube. If the dimension passed is exactly equal to a boundary, the function returns true (this is considered as being inside the world).
|
extern |
Returns the intersection status of a model.
mdl | name of the model to load |
anim | animation status (Anim_ enum) |
pos | position of the model |
yaw | yaw of the model |
pitch | pitch of the model |
roll | roll of the model |
o | origin of intersecting ray |
ray | direction of intersecting ray |
dist | length of the ray |
d | dynent associated with this model |
a | array of modelattach objects |
basetime | animation basetime |
basetime2 | if Anim_SetSpeed, speed factor |
size | scale factor of model |
|
extern |
Determines if a heightmap is active for the current selection.
|
extern |
Returns the dynent at index i.
Returns a pointer to the dynent object stored at index i of the dynents vector. Returns nullptr if index i is out of bounds.
i | the index to get the dynent at |
|
extern |
Sets the key repeat mask for SDL.
If on is true, sets keyrepeatmask to the OR of the existing mask and the passed mask; if on is false, sets keyrepeat mask to the AND of the existing mask and the inverse of the passed mask.
The keyrepeat enum is defined in consts.h with the appropriate masks to pass.
on | the mode for the mask to be combined |
mask | the bitmask to apply |
|
extern |
delays a frame by a specified amount
Delays rendering of a frame.
Uses SDL_Delay to delay a frame, given the time the last frame was rendered and the current time. Takes into account the global fps cap global variable (maxfps) to calculate delay.
millis | the time (in ms) since program started |
curmillis | the last registered frame time |
Uses SDL_Delay to delay a frame, given the time the last frame was rendered and the current time. The amount of delay is calculated from the global maxfps and menufps variables.
millis | the time (in ms) since program started |
curmillis | the last registered frame time |
|
extern |
Pushes cubes linked with the passed cube.
c | the cube to push |
d | dimension of the selection's orient |
x | selection bounds x |
y | selection bounds y |
dc | dimension coordinate of the selection's orient |
dir | direction to push |
|
extern |
Loads the mapmodel assigned to the specified index.
Loads the mapmodel assigned to the specified model index into a model object. If a model object already exists, a new model is not created and a pointer to that model is returned instead; otherwise, returns a pointer to the new model object. If the index is out of bounds, nullptr is returned.
|
extern |
Loads the model with the associated name.
name | the name of the model to load |
i | the number of models to search through before giving up |
msg | toggles rendering a loading progress meter while loading the model |
|
extern |
Loads a series of shaders hardcoded into the engine.
The shaders loaded are:
null
hud
hudtext
hudnotexture
stdworld
nocolor
fogged
foggednotexture
ldr
ldrnotexture
If the shaders null
...stdworld
are not found, the engine exits by calling fatal
. setupshaders
creates these textures and adds them to the shader global hashtable.
void logoutf | ( | const char * | fmt, |
... ) |
Prints a line to the log file.
This function behaves the same way as printf(), except it prints to the output specified in getlogfile()
.
fmt | The string to print |
... | the names of variables to substitute into the string, in order |
|
extern |
Adds an undo entry to the undos vector given the current selection.
Uses the current global selection to add a new undo object to the global undos vector.
|
extern |
Adds an undo entry to the undos vector given the passed selection.
Uses the passed selection to add a new undo object to the global undos vector.
the | selection to use |
|
extern |
Returns the mapmodel name at the given index.
If the passed index corresponds to a valid mapmodel, the function returns a C string with its name; if not, the function returns a nullptr.
bool UI::movecursor | ( | int | dx, |
int | dy ) |
Moves the UI cursor by the amount perscribed.
Moves the UI cursor by the amount described (positive or negative), scaled by the UI sensitivity variable. Values are capped in both dimensions between 0 and 1, thereby preventing the cursor from completely leaving the screen.
dx | amount to move the cursor in the x direction |
dy | amount to move the cursor in the y direction |
|
extern |
Update a ragdoll's position and physics.
If the dynent pointed to does not have a valid ragdoll object as a member, nothing happens.
d | a dynent pointer. |
|
extern |
Prints a warning message to the console.
This function prints a message warning the user that the operation is not possible in multiplayer. It does nothing else.
Creates an undoblock object given a cube selection.
s | the selection information to give to the undoblock object |
|
extern |
Packs into the passed char vector the contents of a VSlot.
buf | the vector to pack information into |
vs | a pointer to the slot to pack |
|
extern |
Packs into the passed char vector the contents of a VSlot.
buf | the vector to pack information into |
index | the index in the vslot list to pack |
Copies and pastes a single cube (with its children).
Copies the cube located at src
, along with its child cubes, and pastes it into the cube node located at dst
. If the dst
cube is of a smaller grid size than the source cube, the extra child levels are truncated.
src | a reference to the source cube to copy |
dst | a reference to the destination cube where the selection is pasted |
|
extern |
Determines whether selection contains location at specified location.
Returns whether the location of the vector passed falls within the selection information object's volume. If the passed vector is exactly along the boundary, the function still returns true.
sel | selinfo object corresponding to a world volume |
origin | vector corresponding to a world location |
|
extern |
Adds a model to the cache of models to load.
When flushpreloadedmodels() is called, the entries added to the preloadedmodels vector by this function are loaded. Silently fails and does nothing if the model name passed is not valid or already exists in the vector.
|
extern |
Preloads mapmodels corresponding to the world's mapmodel entities.
msg | toggles printing warning messages |
bih | toggles preloading the bounding interval hierarchy (BIH) for the model |
|
extern |
Returns the distance before a ray hits a cube.
This function behaves the same as raycube() execept also returning the location where the hit happened.
o | the starting location of the ray to be drawn |
ray | normalized direction vector for the ray to point |
hit | output parameter for the vector location the hit happened at |
radius | region around ray that counts as a hit |
mode | flags which determine what counts as a hit |
size | size of cube which registers a hit |
t | entity to check against |
Recalculates dir based on the provided physent, normalized to oldvel.
The magnitude of the dir vec passed in is used to multiply the output by (magnitude of oldvel)/(magnitude of dir). The direction of the output is not determined by the input; this is equal to the physnent's vel and falling fields added together.
d | the physent to use the fall velocity of | |
oldvel | the velocity to use the magnitude of to scale | |
[in,out] | dir | the dynent's direction scaled to the oldvel and input dir |
|
extern |
Spawns a flame particle.
type | the type of particle to spawn |
p | location to spawn at |
radius | spawning radius of the particle |
color | the color of the particle (web hex color) |
density | the density of particle spawns |
scale | the scale factor for the particle |
speed | initial speed of particles after spawning |
fade | time in ms before the particle fades |
gravity | gravity factor for particles after spawning |
|
extern |
Spawns a splash particle with the designated properties.
type | the type of particle to spawn |
num | the number indicating the spawning direction/pattern |
fade | the number of ms before the particle fades |
p | the location for the particle |
color | the color of the particle (web hex color) |
size | the size factor for the particle |
radius | the spawn area radius for the particle |
gravity | the gravity factor for particles after spawning |
delay | the delay in milliseconds between particle spawns |
|
extern |
Renders a world model.
This function renders a model inside the world, given the following parameters. If the model is not found, the function fails silently.
mdl | name of the model to load |
anim | index of the animation to use |
o | location of the model |
yaw | yaw orientation |
pitch | pitch orientation |
roll | roll orientation |
cull | occlusion culling flags |
d | dynent to associate model with |
a | attached models to load |
basetime | animation interpolation factor |
basetime2 | animation interpolation factor |
size | scale factor for model |
color | rgba color of the model |
|
extern |
Renders a loading progress bar at the bottom center of the window.
Intended for indicating asset loading or similar technical holding of the game state.
bar | from 0...1, indicates how full the progress bar should be |
text | the string to overlay on the progress bar |
toggles | rendering a background for the loading bar |
|
extern |
Reorients sel
to point in the direction of orient
.
See the cube faces in octa.h to interpret what the value of orient
means in dimensions.
void UI::resetcursor | ( | ) |
Sets the cursor to the middle of the screen.
Sets the location of the UI cursor to the middle of the screen; that is, the cursor's x and y values are both set to 0.5.
|
extern |
Sets the entirety of the fps history buffer (used for averaging the FPS readout) to 1.
Sets the fps history buffer values all to 1.
|
extern |
Binds the HUD shader via glUseProgram()
Also sets the color of the gle system to white (1,1,1).
Rotates the center and radius vectors using the given Euler angles.
center | the center of the bounding box |
radius | the size of the bounding box |
yaw | the yaw amount to modify by |
pitch | the pitch amount to modify by |
roll | the roll amount to modify by |
|
extern |
Sets the currently used font.
This function sets the current font to use to the one associated with the name passed. If the function does not find the font requestion, the function returns false.
|
extern |
Sets up the SDL window the application runs in.
Should only be called once in the lifetime of the program. This function opens a window onscreen that the application runs in.
bool UI::showui | ( | const char * | name | ) |
Shows a UI window with the specified name.
If the specified window does not exist or already is shown, no action is taken. Otherwise, displays the window specified.
name | the name of the UI to show |
|
extern |
Re-projects a physent's velocity according to a given wall normal.
d | the dynent to velocity project |
dir | the direction to recalcdir() using the dynent's velocity |
obstacle | the normal of the wall |
foundfloor | toggles whether to omit the z coordinate of the given wall normal |
slidecollide | toggles whether to omit the z-coord of the given wall normal (if foundfloor==false) |
|
extern |
Refreshes the rendered screenbuffer.
This function refreshes the display buffer. The paramater has no effect.
overlay | Has no effect. |
bool UI::toggleui | ( | const char * | name | ) |
Toggles the open/closed state of a window.
If the speficied window is open, closes the window; if it is closed, opens it. If the window does not exist, does nothing.
name | the name of the window to toggle |
bool UI::uivisible | ( | const char * | name | ) |
Gets the open/close status of a UI window.
Returns whether the specified window is open or closed (displayed onscreen or hidden).
|
extern |
Unpacks a buffer containing an undo action into a unsigned char array.
This function does not preserve the original buffer.
buf | the buffer to unpack |
outbuf | the buffer to unpack into. |
|
extern |
Adds an entry to the fps history.
The value millis passed is added to the fps history array, at a position greater one greater than the previous entry.
millis | the timestamp to add to the fps history |
|
extern |
Modifies a vector based on passed movement modifiers.
Given a vector and a series of movement parameters, the passed vector is modified by the values of move (forward and backward) and strafe (side to side). These axes are independent of the vec to be modified, and are oriented relative to the yaw and pitch parameters passed.
yaw | the angle the player is pointing |
pitch | the angle at which the player is ascending |
move | the quantity of forwards to backwards motion to add |
strafe | the quantity of side to side motion to add |
m | the vector to modify |
|
extern |
Returns 2 Euler angles for a given vector.
Given a vector v, yaw and pitch are assigned to the orientation of the vector in 3D space. Roll is not assigned, as it is ambiguous for a vector.
v | vector to be used to calc yaw & pitch |
yaw | output parameter v's yaw is assigned to |
pitch | output parameter v's pitch is assigned to |
|
extern |
A list of anim names to be loaded into the engine by the game.
|
extern |
Camera location for the renderer to render at
|
extern |
read only variable corresponding to camera at ent location (1p) or away from it (3p)
|
extern |
last time
|
extern |
The names of the map entities, set by the application code.
|
extern |
Field of view in degrees in the vertical direction (normal fov is X dimension).
|
extern |
Toggles fullscreen, behaves like bool; 0 for windowed and 1 for fullscreen.
|
extern |
true if there is a set of cubes in selection, false otherwise
|
extern |
used as boolean, 0 if not heightmapping, 1 otherwise
|
extern |
current frame time
|
extern |
index for the most recently used texture
|
extern |
total elapsed time
|
extern |
toggles if the main menu is shown, bool-like int
bool minimized |
Set to 1 if the window is minimized.
std::deque<undoblock *> redos |
list of cube operations available to redo
|
extern |
treat as bool, determines whether material outlines are rendered
|
extern |
Sets the length before the texture scroll panel turns off.
|
extern |
elapsed frame time
|
extern |
list of cube undo operations