Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Enumerations | Functions | Variables
game Namespace Reference

implementation of basic game functionsand cubescript bindings More...

Classes

struct  bombclientmode
 
struct  captureclientmode
 
struct  collectclientmode
 
struct  ctfclientmode
 
struct  clientmode
 
struct  hideandseekclientmode
 
struct  movable
 
struct  projectile
 
struct  bouncer
 
struct  hudent
 
struct  playermodelinfo
 
struct  scoreboardgui
 
struct  hitmsg
 

Enumerations

enum  {
  BOXWEIGHT = 25, BARRELHEALTH = 50, BARRELWEIGHT = 25, OBSTACLEHEALTH = 1,
  PLATFORMWEIGHT = 1000, PLATFORMSPEED = 8, EXPLODEDELAY = 200
}
 
enum  {
  BNC_GRENADE, BNC_BOMB, BNC_SPLINTER, BNC_GIBS,
  BNC_DEBRIS, BNC_BARRELDEBRIS
}
 

Functions

 VARP (showbombs, 0, 1, 1)
 
 VARP (showbombradius, 0, 1, 1)
 
 VARP (showbombdelay, 0, 1, 1)
 
 VARP (showminimapobstacles, 0, 1, 1)
 
 VARP (capturetether, 0, 1, 1)
 
 VARP (autorepammo, 0, 1, 1)
 
 VARP (basenumbers, 0, 0, 1)
 
 ICOMMAND (insidebases,"",(),{vector< char > buf;if(m_capture &&player1->state==CS_ALIVE) loopv(capturemode.bases){captureclientmode::baseinfo &b=capturemode.bases[i];if(b.valid()&&capturemode.insidebase(b, player1->feetpos())){if(buf.length()) buf.add(' ');defformatstring(basenum,"%d", i+1);buf.put(basenum, strlen(basenum));}}buf.add('\0');result(buf.getbuf());})
 
 ICOMMAND (repammo,"",(), capturemode.replenishammo())
 
 ICOMMAND (dropflag,"",(),{ctfmode.trydropflag();})
 
float calcradarscale ()
 calculate required radar scale More...
 
void drawminimap (fpsent *d, float x, float y, float s)
 draw rotated minimap More...
 
void setradartex ()
 bind the minimap frame's texture More...
 
void drawradar (float x, float y, float s)
 draw radar (a trangle square with matching texture coordinates to be precise) to target coordinates More...
 
void drawteammates (fpsent *d, float x, float y, float s)
 draw all teamate arrow icons in minimap More...
 
void setbliptex (int team, const char *type)
 set specific textures for teammates, skulls... on the minimap More...
 
void setclientmode ()
 set game mode pointer More...
 
 VARP (minradarscale, 0, 384, 10000)
 minimap and radar More...
 
 VARP (maxradarscale, 1, 1024, 10000)
 
 VARP (radarteammates, 0, 1, 1)
 
 FVARP (minimapalpha, 0, 1, 1)
 
void drawteammate (fpsent *d, float x, float y, float s, fpsent *o, float scale)
 draw a specific teamate's icon arrow in minimap More...
 
 VARP (deadpush, 1, 2, 20)
 push dead bodies (?) More...
 
void switchname (const char *name, const char *tag)
 

team, name and playermodel settings More...

 
void printname ()
 print my own nick name to the game console More...
 
 ICOMMAND (name,"sN",(char *s, int *numargs),{if(*numargs > 0) switchname(s, nullptr);else if(!*numargs) printname();else result(colorname(player1));})
 
 ICOMMAND (getname,"",(), result(player1->name))
 
 ICOMMAND (tag,"sN",(char *s, int *numargs),{if(*numargs > 0) switchname("", s);else if(!*numargs) Log.std->info("your tag is: {0}", player1->tag);else result(player1->tag);})
 
 ICOMMAND (gettag,"",(), result(player1->tag))
 
void switchteam (const char *team)
 switch own team More...
 
void printteam ()
 print own team name to the game console More...
 
 ICOMMAND (team,"sN",(char *s, int *numargs),{if(*numargs > 0) switchteam(s);else if(!*numargs) printteam();else result(player1->team);})
 switch team or print team name More...
 
 ICOMMAND (getteam,"",(), result(player1->team))
 cubescript implementation of getteam More...
 
void switchplayermodel (int playermodel)
 switch my player model (inky, ogro..) More...
 
void sendmapinfo ()
 set booleans sendcrc and senditemstoserver if connected. More...
 
void writeclientinfo (stream *f)
 write my player name to a stream More...
 
bool allowedittoggle ()
 check if editing is available More...
 
void edittoggled (bool on)
 send edit toggle to server More...
 
const char * getclientname (int cn)
 get nick name from cn More...
 
 ICOMMAND (getclientname,"i",(int *cn), result(getclientname(*cn)))
 
const char * getclientteam (int cn)
 get team name from cn More...
 
 ICOMMAND (getclientteam,"i",(int *cn), result(getclientteam(*cn)))
 
int getclientmodel (int cn)
 get client player model ID from cn More...
 
 ICOMMAND (getclientmodel,"i",(int *cn), intret(getclientmodel(*cn)))
 
const char * getclienticon (int cn)
 get client icon from cn depends on player model and spectator mode More...
 
 ICOMMAND (getclienticon,"i",(int *cn), result(getclienticon(*cn)))
 
bool ismaster (int cn)
 check if this client is a game master or administrator More...
 
 ICOMMAND (ismaster,"i",(int *cn), intret(ismaster(*cn)?1:0))
 
bool isadmin (int cn)
 check if this client is an administrator More...
 
 ICOMMAND (isadmin,"i",(int *cn), intret(isadmin(*cn)?1:0))
 
 ICOMMAND (getmastermode,"",(), intret(mastermode))
 
 ICOMMAND (mastermodename,"i",(int *mm), result(mastermodename(*mm,"")))
 
bool isspectator (int cn)
 
 ICOMMAND (isspectator,"i",(int *cn), intret(isspectator(*cn)?1:0))
 
bool isai (int cn, int type)
 check if this cn is a bot (computer controlled player) More...
 
 ICOMMAND (isai,"ii",(int *cn, int *type), intret(isai(*cn,*type)?1:0))
 
int parseplayer (const char *arg)
 all functions can be called using client number or full name name should be case sensitive but the engine checks is both ways More...
 
 ICOMMAND (getclientnum,"s",(char *name), intret(name[0]?parseplayer(name):player1->clientnum))
 
void listclients (bool local, bool bots)
 return a list of players More...
 
 ICOMMAND (listclients,"bb",(int *local, int *bots), listclients(*local >0,*bots!=0))
 
void clearbans ()
 server administration More...
 
 COMMAND (clearbans,"")
 
void setteam (const char *arg1, const char *arg2)
 change a players team More...
 
 COMMAND (setteam,"ss")
 
void kick (const char *victim, const char *reason)
 request to kickban a player More...
 
 COMMAND (kick,"ss")
 
void ignore (int cn)
 ignore all chat messags from a certain client number More...
 
void unignore (int cn)
 stop ignoring all chat messages from a certain client number More...
 
bool isignored (int cn)
 cubescript: check if this person is ignored by you More...
 
 ICOMMAND (ignore,"s",(char *arg), ignore(parseplayer(arg)))
 
 ICOMMAND (unignore,"s",(char *arg), unignore(parseplayer(arg)))
 
 ICOMMAND (isignored,"s",(char *arg), intret(isignored(parseplayer(arg))?1:0))
 
void hashpwd (const char *pwd)
 hash setmaster password cn and sessionid are used to hash: servers do to store the hash value. More...
 
 COMMAND (hashpwd,"s")
 
void setmaster (const char *arg, const char *who)
 acquire game master or give game master to players More...
 
 COMMAND (setmaster,"ss")
 
 ICOMMAND (mastermode,"i",(int *val), addmsg(N_MASTERMODE,"ri",*val))
 request to change server master mode (permissions requires) More...
 
void togglespectator (int val, const char *who)
 toggle own spectator or put player into spectator (permissions requred) More...
 
 ICOMMAND (spectator,"is",(int *val, char *who), togglespectator(*val, who))
 
 ICOMMAND (checkmaps,"",(), addmsg(N_CHECKMAPS,"r"))
 ask the server to acquire CRC32 checksum of all player's maps (permissions requred) More...
 
void changemapserv (const char *name, int mode)
 force server to change map (permissions required) More...
 
void setmode (int mode)
 force server to change game mode (permissions required) More...
 
 ICOMMAND (mode,"i",(int *val), setmode(*val))
 set game mode More...
 
 ICOMMAND (getmode,"",(), intret(gamemode))
 get game mode in cubescript More...
 
 ICOMMAND (timeremaining,"i",(int *formatted),{int val=max(maplimit-lastmillis, 0)/1000;if(*formatted){defformatstring(str,"%d:%02d", val/60, val%60);result(str);}else intret(val);})
 return remaining time More...
 
 ICOMMANDS ("m_noitems","i",(int *mode),{int gamemode=*mode;intret(m_noitems);})
 
 ICOMMANDS ("m_noammo","i",(int *mode),{int gamemode=*mode;intret(m_noammo);})
 
 ICOMMANDS ("m_insta","i",(int *mode),{int gamemode=*mode;intret(m_insta);})
 
 ICOMMANDS ("m_tactics","i",(int *mode),{int gamemode=*mode;intret(m_tactics);})
 
 ICOMMANDS ("m_efficiency","i",(int *mode),{int gamemode=*mode;intret(m_efficiency);})
 
 ICOMMANDS ("m_capture","i",(int *mode),{int gamemode=*mode;intret(m_capture);})
 
 ICOMMANDS ("m_regencapture","i",(int *mode),{int gamemode=*mode;intret(m_regencapture);})
 
 ICOMMANDS ("m_ctf","i",(int *mode),{int gamemode=*mode;intret(m_ctf);})
 
 ICOMMANDS ("m_protect","i",(int *mode),{int gamemode=*mode;intret(m_protect);})
 
 ICOMMANDS ("m_hold","i",(int *mode),{int gamemode=*mode;intret(m_hold);})
 
 ICOMMANDS ("m_collect","i",(int *mode),{int gamemode=*mode;intret(m_collect);})
 
 ICOMMANDS ("m_teammode","i",(int *mode),{int gamemode=*mode;intret(m_teammode);})
 
 ICOMMANDS ("m_demo","i",(int *mode),{int gamemode=*mode;intret(m_demo);})
 
 ICOMMANDS ("m_edit","i",(int *mode),{int gamemode=*mode;intret(m_edit);})
 
 ICOMMANDS ("m_lobby","i",(int *mode),{int gamemode=*mode;intret(m_lobby);})
 
 ICOMMANDS ("m_lms","i",(int *mode),{int gamemode=*mode;intret(m_lms);})
 
 ICOMMANDS ("m_bomb","i",(int *mode),{int gamemode=*mode;intret(m_bomb);})
 
 ICOMMANDS ("m_timeforward","i",(int *mode),{int gamemode=*mode;intret(m_timeforward);})
 
 ICOMMANDS ("m_obstacles","i",(int *mode),{int gamemode=*mode;intret(m_obstacles);})
 
void changemap (const char *name, int mode)
 request map change, server may ignore More...
 
void changemap (const char *name)
 validates game mode name and calls changemap above More...
 
 ICOMMAND (map,"s",(char *name), changemap(name))
 
void forceintermission ()
 
void forceedit (const char *name)
 force edit mode More...
 
void newmap (int size)
 request server to start new map (requires editmode) More...
 
void sendclipboard ()
 send copied data from your clipboard to server More...
 
void edittrigger (const selinfo &sel, int op, int arg1, int arg2, int arg3, const VSlot *vs)
 send edit messages to servers More...
 
void printvar (fpsent *d, ident *id)
 print map var change commited by other players in edit mode More...
 
void vartrigger (ident *id)
 change map vars in edit mode in multiplayer More...
 
void broadcastfov (int fov)
 
void pausegame (bool val)
 pause game More...
 
 ICOMMAND (pausegame,"i",(int *val), pausegame(*val > 0))
 
 ICOMMAND (paused,"iN$",(int *val, int *numargs, ident *id),{if(*numargs > 0) pausegame(clampvar(id,*val, 0, 1) > 0);else if(*numargs< 0) intret(gamepaused?1:0);else printvar(id, gamepaused?1:0);})
 cubescript: check if game is paused More...
 
bool ispaused ()
 check if game is paused More...
 
void persistteams (bool val)
 Set reshuffeling behaviour on mapchange according to bool val (true activates persistent teams) More...
 
 ICOMMAND (persistteams,"i",(int *val), persistteams(*val > 0))
 
bool ispersisted ()
 
bool allowmouselook ()
 check if looking around with the mouse is allowed. More...
 
void changegamespeed (int val)
 change game speed (requires permissions) More...
 
 ICOMMAND (gamespeed,"iN$",(int *val, int *numargs, ident *id),{if(*numargs > 0) changegamespeed(clampvar(id,*val, 10, 1000));else if(*numargs< 0) intret(gamespeed);else printvar(id, gamespeed);})
 
bool addmsg (int type, const char *fmt,...)
 add network message More...
 
void connectattempt (const char *mapwish, int modewish, const char *password)
 copy connection password (?) More...
 
void connectfail ()
 reset connection password after connection failed More...
 
void gameconnect ()
 ? More...
 
void gamedisconnect (bool cleanup)
 clean up local storage/vars after disconnect from server More...
 
void toserver (char *text)
 send chat messages to server More...
 
 COMMANDN (say, toserver,"C")
 
void sayteam (char *text)
 send team messages to server More...
 
 COMMAND (sayteam,"C")
 
void sayprivate (int i, char *text)
 
 ICOMMAND (pm,"is",(int *i, char *text), sayprivate(*i, text))
 
 ICOMMAND (servcmd,"C",(char *cmd), addmsg(N_SERVCMD,"rs", cmd))
 send custom server messages to servers this feature is not used on most servers (?) More...
 
static void sendposition (fpsent *d, packetbuf &q)
 network message parser More...
 
void sendposition (fpsent *d, bool reliable)
 send my own player position to server (call function above) More...
 
void sendpositions ()
 ? More...
 
void sendmessages ()
 ? More...
 
void c2sinfo (bool force)
 send update to the server More...
 
void sendintro ()
 send N_CONNECT (with own name, serverpassword, playermodel and fov) More...
 
void updatepos (fpsent *d)
 
void parsepositions (ucharbuf &p)
 
void parsestate (fpsent *d, ucharbuf &p, bool resume=false)
 
void parsemessages (int cn, fpsent *d, ucharbuf &p)
 
void receivefile (packetbuf &p)
 
void parsepacketclient (int chan, packetbuf &p)
 
void getmap ()
 
 COMMAND (getmap,"")
 
void stopdemo ()
 
 COMMAND (stopdemo,"")
 
void recorddemo (int val)
 
 ICOMMAND (recorddemo,"i",(int *val), recorddemo(*val))
 
void cleardemos (int val)
 
 ICOMMAND (cleardemos,"i",(int *val), cleardemos(*val))
 
void getdemo (int i)
 
 ICOMMAND (getdemo,"i",(int *val), getdemo(*val))
 
void listdemos ()
 
 COMMAND (listdemos,"")
 
void sendmap ()
 
 COMMAND (sendmap,"")
 
void gotoplayer (const char *arg)
 
 COMMANDN (goto, gotoplayer,"s")
 
void gotosel ()
 
 COMMAND (gotosel,"")
 
const char * savedconfig ()
 
const char * restoreconfig ()
 
const char * defaultconfig ()
 
const char * autoexec ()
 
const char * savedservers ()
 
void taunt ()
 send taunt network animation message to server taunt animation is this "im gonna kill you" gesture that can be seen by other players More...
 
 COMMAND (taunt,"")
 
 ICOMMAND (getfollow,"",(),{fpsent *f=followingplayer();intret(f?f->clientnum:-1);})
 cubescript: get the player I am following More...
 
void follow (char *arg)
 follow a specific player if you are in spectator mode More...
 
 COMMAND (follow,"s")
 
void nextfollow (int dir)
 follow previous/next client number More...
 
 ICOMMAND (nextfollow,"i",(int *dir), nextfollow(*dir< 0?-1:1))
 
const char * getclientmap ()
 get client map name More...
 
void resetgamestate ()
 reset game state in singleplayer reset all monsters, triggers, bouncers, movables, and projectiles More...
 
fpsentspawnstate (fpsent *d)
 reset player state not persistent accross spawns More...
 
void respawnself ()
 Send "I would like to spawn" to server. More...
 
fpsentpointatplayer ()
 Give me the player I am aiming at. More...
 
void stopfollowing ()
 stop spectating a specific player and start free camery fly More...
 
fpsentfollowingplayer ()
 Give me the fpsent instance of the player you are currently spectating. More...
 
int getfollowingfov ()
 Receive the fov the currently followed player got or -1 on failure. More...
 
 ICOMMAND (getfollowingfov,"",(), intret(getfollowingfov()))
 
fpsenthudplayer ()
 Give me the fpsent instance of the player whose coordinates will be used to calculate my camera's position. More...
 
void setupcamera ()
 initialise camera when entering spectator mode More...
 
bool detachcamera ()
 check if it is neccesary to detach the camera from first person view to third person view. More...
 
bool collidecamera ()
 check if camera collision detection is neccesary More...
 
 VARP (smoothmove, 0, 75, 100)
 interpolation factor for player positions low smoothmove means jumpily player movement More...
 
 VARP (smoothdist, 0, 32, 64)
 distance in which interpolation will be applied (?) More...
 
void predictplayer (fpsent *d, bool move)
 use latency and assume player movement to predict a player's new position. More...
 
void otherplayers (int curtime)
 parse player state, move players, predict their position, handle ragdoll, check for lag More...
 
void updateworld ()
 called in game loop to the update game world More...
 
void spawnplayer (fpsent *d)
 spawn yourself im the game world, also called for monsters/AI in singleplayer of course not used for other players in multiplayer because everyone determins his spawn point for himself. More...
 
 VARP (spawnwait, 0, 0, 1000)
 
void respawn (int gamemode=0)
 spawn myself in SP and DMSP game mode (singleplayer only) More...
 
void doattack (bool on)
 filter attack attempts not possible in intermission or if player's state is CS_DEAD More...
 
bool canjump ()
 check if I am allowed to jump at the moment called every time before jump command is executed More...
 
bool allowmove (physent *d)
 check if I am allowed to move More...
 
 VARP (hitsound, 0, 0, 1)
 
void damaged (int damage, fpsent *d, fpsent *actor, bool local)
 an fpsent (player/monster/bot) took damage More...
 
 VARP (deathscore, 0, 1, 1)
 
void deathstate (fpsent *d, bool restore)
 mark players as dead and update their state data More...
 
 VARP (teamcolorfrags, 0, 1, 1)
 highlight frags in team colors More...
 
void killed (fpsent *d, fpsent *actor)
 this callback is called when player actor kills d prints death messages to all kind of consoles More...
 
void timeupdate (int secs)
 update game session time display intermission statistics in console More...
 
 ICOMMAND (getaccuracy,"",(), intret((player1->totaldamage *100)/max(player1->totalshots, 1)))
 
 ICOMMAND (getdeaths,"",(), intret(player1->deaths))
 
 ICOMMAND (getflags,"",(), intret(player1->flags))
 
 ICOMMAND (getfrags,"",(), intret(player1->frags))
 return a player's statistics to cubescript More...
 
 ICOMMAND (getteamkills,"",(), intret(player1->teamkills))
 
 ICOMMAND (gettotaldamage,"",(), intret(player1->totaldamage))
 
 ICOMMAND (gettotalshots,"",(), intret(player1->totalshots))
 
fpsentnewclient (int cn)
 ensure new client is a valid entity More...
 
fpsentgetclient (int cn)
 access fpsent object safely using index More...
 
void clientdisconnected (int cn, bool notify)
 notify my client to change data when another clients disconnect More...
 
void clearclients (bool notify)
 delete all clients More...
 
void initclient ()
 
 VARP (showmodeinfo, 0, 1, 1)
 show game mode description text during map load More...
 
void startgame ()
 clear all game data to start a new game More...
 
void startmap (const char *name)
 called just after a map load send CRC32 to server More...
 
const char * getclientmode ()
 
void physicstrigger (physent *d, bool local, int floorlevel, int waterlevel, int material)
 trigger sound effects depending on the material you enter More...
 
void dynentcollide (physent *d, physent *o, const vec &dir)
 push monsters (or objects) together when they hit walls or other objects More...
 
void msgsound (int n, physent *d)
 play sound and send sound notification to server More...
 
int numdynents ()
 return the sum of dynamic entities currently in scene More...
 
dynentiterdynents (int i)
 iterate through all dynamic entities and return entity with index [i] You put the list in and get it through to return back The caller has to hand in a list which will get filled More...
 
 VARP (teamcolortext, 0, 1, 1)
 color team names in frag notifications in game console in red/blue, depending on my team More...
 
bool duplicatename (fpsent *d, const char *name=nullptr, const char *alt=nullptr)
 are there any duplicate names in our client list? in case this is true, their client numbers will be displayed behind both nicknames More...
 
const char * colorname (fpsent *d, const char *name, const char *prefix, const char *alt)
 add colored client number in [] brackets behind the name in case another player has the same name (duplicated name) More...
 
const char * teamcolorname (fpsent *d, const char *alt)
 color name depending on my team in red or blue More...
 
const char * teamcolor (const char *name, bool sameteam, const char *alt)
 color player name blue if you have the same team f1 otherwise red f3 More...
 
const char * teamcolor (const char *name, const char *team, const char *alt)
 this function calls the function above but also validates that team is a valid char pointer it is not possible to return memory to an invalid char* pointer!7 More...
 
void suicide (physent *d)
 suicide your player More...
 
 ICOMMAND (suicide,"",(), suicide(player1))
 
bool needminimap ()
 checks if minimap is required for this game mode More...
 
void drawicon (int icon, float x, float y, float sz)
 draw (blit) item texture (weapon, flags, armours, quad) on screen at x,y More...
 
float abovegameplayhud (int w, int h)
 calculate distance of hud from bottom of my screen depending on player state referenced only in gl_drawhud in render.cpp More...
 
 ICOMMAND (ammohudup,"V",(tagval *args, int numargs),{loopi(3) ammohudup[i]=i< numargs?getweapon(args[i].getstr()):-1;})
 those 3 functions are used to rotate in circles through your weapons so you see different preview images of the other weapons in your holsters More...
 
 ICOMMAND (ammohuddown,"V",(tagval *args, int numargs),{loopi(3) ammohuddown[i]=i< numargs?getweapon(args[i].getstr()):-1;})
 
 ICOMMAND (ammohudcycle,"V",(tagval *args, int numargs),{loopi(8) ammohudcycle[i]=i< numargs?getweapon(args[i].getstr()):-1;})
 
 VARP (ammohud, 0, 1, 1)
 decide if you want to display the little icons of your other weapons in the slot More...
 
void drawammohud (fpsent *d)
 draw other weapons in weapon slots beside the icon of the currently selected weapon More...
 
void drawhudicons (fpsent *d)
 draw health icon, armour icon and icon of selected gun other gun's preview icons are not included here More...
 
void drawhudannounce (int w, int h)
 draw announcement for upcoming pickup entities in BOMBERMAN mode More...
 
void gameplayhud (int w, int h)
 render game hud depending on hudplayer's state and "SPECTATOR" in spectator mode More...
 
int clipconsole (int w, int h)
 
 VARP (teamcrosshair, 0, 1, 1)
 use blue blocking crosshair when pointing at a teamate More...
 
 VARP (hitcrosshair, 0, 425, 1000)
 displaying a hit crosshair increases the players hit impression ('feel') More...
 
const char * defaultcrosshair (int index)
 
int selectcrosshair (vec &color)
 switch crosshair depending on player state and player health More...
 
void lighteffects (dynent *e, vec &color, vec &dir)
 
void writegamedata (vector< char > &extras)
 
void readgamedata (vector< char > &extras)
 
bool clientoption (const char *arg)
 
void clearmovables ()
 
void triggerplatform (int tag, int newdir)
 
 ICOMMAND (platform,"ii",(int *tag, int *newdir), triggerplatform(*tag,*newdir))
 
void stackmovable (movable *d, physent *o)
 
void updatemovables (int curtime)
 
void rendermovables ()
 
void suicidemovable (movable *m)
 
void hitmovable (int damage, movable *m, fpsent *at, const vec &vel, int gun)
 
bool isobstaclealive (movable *m)
 
void clearprojectiles ()
 
void renderprojectiles ()
 
void clearbouncers ()
 
void renderbouncers ()
 
void preloadbouncers ()
 
 VARP (ragdoll, 0, 1, 1)
 
 VARP (ragdollmillis, 0, 10000, 300000)
 
 VARP (ragdollfade, 0, 1000, 300000)
 
 VARFP (playermodel, 0, 0, 4, changedplayermodel())
 
 VARP (forceplayermodels, 0, 0, 1)
 
 VARP (hidedead, 0, 0, 1)
 
void saveragdoll (fpsent *d)
 
void clearragdolls ()
 
void moveragdolls ()
 
int chooserandomplayermodel (int seed)
 
const playermodelinfogetplayermodelinfo (int n)
 
const playermodelinfogetplayermodelinfo (fpsent *d)
 
void changedplayermodel ()
 
void preloadplayermodel ()
 
 VAR (testquad, 0, 0, 1)
 
 VAR (testarmour, 0, 0, 1)
 
 VAR (testteam, 0, 0, 3)
 
void renderplayer (fpsent *d, const playermodelinfo &mdl, int team, float fade, bool mainpass)
 
 VARP (teamskins, 0, 0, 1)
 
void rendergame (bool mainpass)
 
 VARP (hudgun, 0, 1, 1)
 
 VARP (hudgunsway, 0, 1, 1)
 
 VARP (teamhudguns, 0, 1, 1)
 
 VARP (chainsawhudgun, 0, 1, 1)
 
 VAR (testhudgun, 0, 0, 1)
 
 FVAR (swaystep, 1, 35.0f, 100)
 
 FVAR (swayside, 0, 0.04f, 1)
 
 FVAR (swayup,-1, 0.05f, 1)
 
void swayhudgun (int curtime)
 
 SVARP (hudgunsdir,"")
 
void drawhudmodel (fpsent *d, int anim, float speed=0, int base=0)
 
void drawhudgun ()
 
void renderavatar ()
 
void renderplayerpreview (int model, int team, int weap)
 
vec hudgunorigin (int gun, const vec &from, const vec &to, fpsent *d)
 
void preloadweapons ()
 
void preloadsounds ()
 
void preload ()
 
 VARP (scoreboard2d, 0, 1, 1)
 
 VARP (showservinfo, 0, 1, 1)
 
 VARP (showclientnum, 0, 0, 1)
 
 VARP (showpj, 0, 0, 1)
 
 VARP (showping, 0, 1, 1)
 
 VARP (showspectators, 0, 1, 1)
 
 VARP (showflags, 0, 0, 1)
 
 VARP (showfrags, 0, 1, 1)
 
 VARP (showaccuracy, 0, 1, 1)
 
 VARP (highlightscore, 0, 1, 1)
 
 VARP (showconnecting, 0, 0, 1)
 
void clearteaminfo ()
 
void setteaminfo (const char *team, int frags)
 
static bool playersort (const fpsent *a, const fpsent *b)
 
void getbestplayers (vector< fpsent * > &best)
 
void getbestteams (vector< const char * > &best)
 
static bool scoregroupcmp (const scoregroup *x, const scoregroup *y)
 
static int groupplayers ()
 
void renderscoreboard (g3d_gui &g, bool firstpass)
 
void g3d_gamemenus ()
 
 VARFN (scoreboard, showscoreboard, 0, 0, 1, scoreboard.show(showscoreboard!=0))
 
void showscores (bool on)
 
 ICOMMAND (showscores,"D",(int *down), showscores(*down!=0))
 
 VARP (maxdebris, 10, 25, 1000)
 
 VARP (maxbarreldebris, 5, 10, 1000)
 
 ICOMMAND (getweapon,"",(), intret(player1->gunselect))
 
void gunselect (int gun, fpsent *d)
 
void nextweapon (int dir, bool force=false)
 
 ICOMMAND (nextweapon,"ii",(int *dir, int *force), nextweapon(*dir,*force!=0))
 
int getweapon (const char *name)
 
void setweapon (const char *name, bool force=false)
 
 ICOMMAND (setweapon,"si",(char *name, int *force), setweapon(name,*force!=0))
 
void cycleweapon (int numguns, int *guns, bool force=false)
 
 ICOMMAND (cycleweapon,"V",(tagval *args, int numargs),{int numguns=min(numargs, 8);int guns[8];loopi(numguns) guns[i]=getweapon(args[i].getstr());cycleweapon(numguns, guns);})
 
void weaponswitch (fpsent *d)
 
 ICOMMAND (weapon,"V",(tagval *args, int numargs),{if(player1->state!=CS_ALIVE) return;loopi(8){const char *name=i< numargs?args[i].getstr():"";if(name[0]){int gun=getweapon(name);if(gun >=GUN_FIST &&gun<=GUN_BOMB &&gun!=player1->gunselect &&player1->ammo[gun]){gunselect(gun, player1);return;}}else{weaponswitch(player1);return;}}playsound(S_NOAMMO);})
 
void offsetray (const vec &from, const vec &to, int spread, float range, vec &dest)
 
void createrays (int gun, const vec &from, const vec &to)
 
void newbouncer (const vec &from, const vec &to, bool local, int id, fpsent *owner, int type, int lifetime, int speed, entitylight *light=nullptr, int generation=0)
 
void bounced (physent *d, const vec &surface)
 
void spawnnextsplinter (const vec &p, const vec &vel, fpsent *d, int generation)
 
void spawnsplinters (const vec &p, fpsent *d)
 
void updatebouncers (int time)
 
void removebouncers (fpsent *owner)
 
void newprojectile (const vec &from, const vec &to, float speed, bool local, int id, fpsent *owner, int gun)
 
void removeprojectiles (fpsent *owner)
 
 VARP (blood, 0, 1, 1)
 
void damageeffect (int damage, fpsent *d, bool thirdperson)
 
void spawnbouncer (const vec &p, const vec &vel, fpsent *d, int type, entitylight *light=nullptr)
 
void gibeffect (int damage, const vec &vel, fpsent *d)
 
void hit (int damage, dynent *d, fpsent *at, const vec &vel, int gun, float info1, int info2=1)
 
void hitpush (int damage, dynent *d, fpsent *at, vec &from, vec &to, int gun, int rays)
 
float projdist (dynent *o, vec &dir, const vec &v)
 
void radialeffect (dynent *o, const vec &v, int qdam, fpsent *at, int gun)
 
void radialbombeffect (bouncer *b, const vec &v)
 
void explode (bool local, fpsent *owner, const vec &v, dynent *safe, int damage, int gun)
 
void projsplash (projectile &p, vec &v, dynent *safe, int damage)
 
void explodeeffects (int gun, fpsent *d, bool local, int id)
 
bool projdamage (dynent *o, projectile &p, vec &v, int qdam)
 
void updateprojectiles (int time)
 
 VARP (muzzleflash, 0, 1, 1)
 
 VARP (muzzlelight, 0, 1, 1)
 
void shoteffects (int gun, const vec &from, const vec &to, fpsent *d, bool local, int id, int prevaction)
 
void particletrack (physent *owner, vec &o, vec &d)
 
void dynlighttrack (physent *owner, vec &o, vec &hud)
 
bool intersect (dynent *d, const vec &from, const vec &to, float &dist)
 
dynentintersectclosest (const vec &from, const vec &to, fpsent *at, float &bestdist)
 
void shorten (vec &from, vec &target, float dist)
 
void raydamage (vec &from, vec &to, fpsent *d)
 
void shoot (fpsent *d, const vec &targ)
 
void adddynlights ()
 
 VARP (bombcolliderad, 0, 16, 1000)
 
 VARP (bombbarrier, 0, 1, 1)
 
void checkattacksound (fpsent *d, bool local)
 
void checkidlesound (fpsent *d, bool local)
 
void removeweapons (fpsent *d)
 
void updateweapons (int curtime)
 
bool weaponcollide (physent *d, const vec &dir)
 
void avoidweapons (ai::avoidset &obstacles, float radius)
 

Variables

bombclientmode bombmode
 
captureclientmode capturemode
 
ctfclientmode ctfmode
 
SharedVar< float > minimapalpha
 
clientmodecmode = nullptr
 gamemodes More...
 
SharedVar< int > showminimapobstacles
 
hideandseekclientmode hideandseekmode
 
collectclientmode collectmode
 
bool senditemstoserver = false
 after a map change, since server doesn't have map data More...
 
bool sendcrc = false
 
int lastping = 0
 
bool connected = false
 
bool demoplayback = false
 
bool gamepaused = false
 
bool teamspersisted = false
 
int sessionid = 0
 
int mastermode = MM_OPEN
 
int gamespeed = 100
 
string servinfo = ""
 
string connectpass = ""
 
string connectmapwish = ""
 
int connectmodewish = -1
 
vector< int > ignores
 a vector of ignored client numbers (cns) More...
 
int nextmode = INT_MAX
 
string clientmap = ""
 
int needclipboard = -1
 ? More...
 
vector< ucharmessages
 collect client to server messages conveniently More...
 
int messagecn = -1
 
int messagereliable = false
 
SharedVar< int > deathscore
 
int paused
 
fpsentplayer1 = nullptr
 
vector< fpsent * > players
 our client More...
 
bool intermission = false
 other clients More...
 
int maptime = 0
 
int maprealtime = 0
 
int maplimit = -1
 
int respawnent = -1
 
int lasthit = 0
 
int lastspawnattempt = 0
 
int following = -1
 
int followdir = 0
 
int savedammo [NUMGUNS]
 
vector< fpsent * > clients
 other clients connected to this server More...
 
int ammohudup [3] = { GUN_CG, GUN_RL, GUN_GL }
 this static data is used to describe the sorting of the 3 next weapons in your holster preview. More...
 
int ammohuddown [3] = { GUN_RIFLE, GUN_SG, GUN_PISTOL }
 
int ammohudcycle [8] = { -1, -1, -1, -1, -1, -1, -1, -1 }
 
SharedVar< int > smoothmove
 
SharedVar< int > smoothdist
 
vector< movable * > movables
 
vector< projectileprojs
 
vector< bouncer * > bouncers
 
vector< fpsent * > bestplayers
 
vector< const char * > bestteams
 
vector< fpsent * > ragdolls
 
static const playermodelinfo playermodels [2]
 
float swayfade = 0
 
float swayspeed = 0
 
float swaydist = 0
 
vec swaydir (0, 0, 0)
 
game::hudent guninterp
 
SharedVar< int > playermodel
 
SharedVar< int > teamskins
 
SharedVar< int > testteam
 
static hashset< teaminfoteaminfos
 
static vector< scoregroup * > groups
 
static vector< fpsent * > spectators
 
game::scoreboardgui scoreboard
 
static const int MONSTERDAMAGEFACTOR = 4
 
static const int OFFSETMILLIS = 500
 
vec rays [MAXRAYS]
 
vector< hitmsghits
 
SharedVar< int > chainsawhudgun
 
float intersectdist = 1e16f
 
static const char *const projnames [3] = { "projectile/grenade", "projectile/rocket", "projectile/bomb" }
 
static const char *const gibnames [3] = { "particle/gibs/gib01", "particle/gibs/gib02", "particle/gibs/gib03" }
 
static const char *const debrisnames [4] = { "particle/debris/debris01", "particle/debris/debris02", "particle/debris/debris03", "particle/debris/debris04" }
 

Detailed Description

implementation of basic game functionsand cubescript bindings


Class Documentation

struct game::projectile
Class Members
vec dir
int gun
int id
entitylight light
bool local
vec o
vec offset
int offsetmillis
fpsent * owner
float speed
vec to
struct game::playermodelinfo
Class Members
const char * armour[3]
const char * blueicon
const char * blueteam
const char * ffa
const char * ffaicon
const char * hudguns
const char * quad
bool ragdoll
const char * redicon
const char * redteam
const char * vwep
struct game::hitmsg
Class Members
ivec dir
int info1
int info2
int lifesequence
int target

Enumeration Type Documentation

anonymous enum
Enumerator
BOXWEIGHT 
BARRELHEALTH 
BARRELWEIGHT 
OBSTACLEHEALTH 
PLATFORMWEIGHT 
PLATFORMSPEED 
EXPLODEDELAY 
anonymous enum
Enumerator
BNC_GRENADE 
BNC_BOMB 
BNC_SPLINTER 
BNC_GIBS 
BNC_DEBRIS 
BNC_BARRELDEBRIS 

Function Documentation

float game::abovegameplayhud ( int  w,
int  h 
)

calculate distance of hud from bottom of my screen depending on player state referenced only in gl_drawhud in render.cpp

References CS_EDITING, CS_SPECTATOR, hudplayer(), and recorder::state.

Referenced by gl_drawhud().

void game::adddynlights ( )
bool game::addmsg ( int  type,
const char *  fmt,
  ... 
)
bool game::allowedittoggle ( )
bool game::allowmouselook ( )

check if looking around with the mouse is allowed.

References gamepaused, and m_edit.

Referenced by mousemove().

bool game::allowmove ( physent d)

check if I am allowed to move

References ENT_PLAYER, lastmillis, and physent::type.

Referenced by ai::logic(), modifygravity(), modifyvelocity(), renderclient(), and trystepdown().

const char* game::autoexec ( )
inline

Referenced by main(), and writecfg().

void game::avoidweapons ( ai::avoidset obstacles,
float  radius 
)
void game::bounced ( physent d,
const vec surface 
)
void game::broadcastfov ( int  fov)

References addmsg(), fpsent::fov, N_FOV, and player1.

Referenced by broadcastfov().

void game::c2sinfo ( bool  force)

send update to the server

References flushclient(), sendmessages(), sendpositions(), and totalmillis.

Referenced by edittrigger(), and updateworld().

float game::calcradarscale ( )
bool game::canjump ( )

check if I am allowed to jump at the moment called every time before jump command is executed

See Also
respawn

References connected, CS_DEAD, gamemode, intermission, player1, respawn(), and physent::state.

void game::changedplayermodel ( )
void game::changegamespeed ( int  val)

change game speed (requires permissions)

References addmsg(), connected, and N_GAMESPEED.

void game::changemap ( const char *  name,
int  mode 
)

request map change, server may ignore

References addmsg(), connectserv(), isconnected(), and N_MAPVOTE.

void game::changemap ( const char *  name)

validates game mode name and calls changemap above

References m_valid, and nextmode.

Referenced by forceedit().

void game::changemapserv ( const char *  name,
int  mode 
)

force server to change map (permissions required)

See Also
startgame

References editmode, emptymap(), gamemode, load_world(), m_demo, m_edit, nextmode, entities::resetspawns(), senditemstoserver, startgame(), and toggleedit().

Referenced by parsemessages().

void game::checkattacksound ( fpsent d,
bool  local 
)
void game::checkidlesound ( fpsent d,
bool  local 
)
int game::chooserandomplayermodel ( int  seed)

References playermodels.

Referenced by ai::init().

void game::clearbans ( )

server administration

many server commands require administrative permissions clears server ban lists

See Also
addmsg

References addmsg(), and N_CLEARBANS.

void game::clearbouncers ( )

References bouncers.

Referenced by resetgamestate(), and startgame().

void game::clearclients ( bool  notify)

delete all clients

See Also
disconnect

References clientdisconnected(), clients, and loopv.

Referenced by gamedisconnect(), and parsemessages().

void game::cleardemos ( int  val)
void game::clearmovables ( )
void game::clearprojectiles ( )
void game::clearragdolls ( )
void game::clearteaminfo ( )

References teaminfos.

Referenced by startgame().

void game::clientdisconnected ( int  cn,
bool  notify 
)
bool game::clientoption ( const char *  arg)
int game::clipconsole ( int  w,
int  h 
)

References game::clientmode::clipconsole(), and cmode.

Referenced by renderconsole().

bool game::collidecamera ( )

check if camera collision detection is neccesary

See Also
followingplayer

References CS_EDITING, CS_SPECTATOR, followingplayer(), player1, and physent::state.

Referenced by recomputecamera().

const char * game::colorname ( fpsent d,
const char *  name,
const char *  prefix,
const char *  alt 
)

add colored client number in [] brackets behind the name in case another player has the same name (duplicated name)

Warning
not safe.
resets color to white afterwards!
See Also
duplicatename

References AI_NONE, COL_MAGENTA, COL_WHITE, duplicatename(), fpsent::name, player1, and tempformatstring().

Referenced by clientdisconnected(), gameplayhud(), ai::init(), killed(), parsemessages(), printname(), printvar(), ai::render(), rendergame(), renderscoreboard(), sayprivate(), sayteam(), teamcolorname(), and toserver().

game::COMMAND ( taunt  ,
""   
)
game::COMMAND ( follow  ,
"s"   
)
game::COMMAND ( clearbans  ,
""   
)
game::COMMAND ( setteam  ,
"ss"   
)
game::COMMAND ( kick  ,
"ss"   
)
game::COMMAND ( hashpwd  ,
"s"   
)
game::COMMAND ( setmaster  ,
"ss"   
)
game::COMMAND ( sayteam  ,
"C"   
)
game::COMMAND ( getmap  ,
""   
)
game::COMMAND ( stopdemo  ,
""   
)
game::COMMAND ( listdemos  ,
""   
)
game::COMMAND ( sendmap  ,
""   
)
game::COMMAND ( gotosel  ,
""   
)
game::COMMANDN ( say  ,
toserver  ,
"C"   
)
game::COMMANDN ( goto  ,
gotoplayer  ,
"s"   
)
void game::connectattempt ( const char *  mapwish,
int  modewish,
const char *  password 
)

copy connection password (?)

References connectmapwish, connectmodewish, connectpass, and copystring().

Referenced by connectserv().

void game::connectfail ( )

reset connection password after connection failed

References connectmapwish, connectmodewish, connectpass, m_valid, and nextmode.

Referenced by abortconnect().

void game::createrays ( int  gun,
const vec from,
const vec to 
)

References loopi(), offsetray(), and rays.

Referenced by shoot(), and shoteffects().

void game::cycleweapon ( int  numguns,
int *  guns,
bool  force = false 
)
void game::damaged ( int  damage,
fpsent d,
fpsent actor,
bool  local 
)
void game::damageeffect ( int  damage,
fpsent d,
bool  thirdperson 
)
void game::deathstate ( fpsent d,
bool  restore 
)
const char* game::defaultconfig ( )
inline

Referenced by main(), and writecfg().

const char * game::defaultcrosshair ( int  index)

Referenced by loadcrosshair().

bool game::detachcamera ( )

check if it is neccesary to detach the camera from first person view to third person view.

this is mostly triggered by player death

See Also
hudplayer

References CS_DEAD, hmap::d, hudplayer(), and physent::state.

Referenced by recomputecamera().

void game::doattack ( bool  on)

filter attack attempts not possible in intermission or if player's state is CS_DEAD

References fpsent::attacking, connected, gamemode, intermission, player1, and respawn().

void game::drawammohud ( fpsent d)

draw other weapons in weapon slots beside the icon of the currently selected weapon

References ammohudup, drawicon(), f(), flushhudmatrix(), GUN_BOMB, HICON_FIST, HICON_SIZE, HICON_STEP, HICON_X, HICON_Y, hudmatrix, loopi(), pophudmatrix(), pushhudmatrix(), and matrix4::scale().

Referenced by drawhudicons().

void game::drawhudannounce ( int  w,
int  h 
)
void game::drawhudgun ( )
void game::drawhudicons ( fpsent d)
void game::drawhudmodel ( fpsent d,
int  anim,
float  speed = 0,
int  base = 0 
)
void game::drawicon ( int  icon,
float  x,
float  y,
float  sz 
)

draw (blit) item texture (weapon, flags, armours, quad) on screen at x,y

References gle::begin(), bind_items_texture(), and gle::end().

Referenced by drawammohud(), game::ctfclientmode::drawhud(), game::collectclientmode::drawhud(), and drawhudicons().

void game::drawminimap ( fpsent d,
float  x,
float  y,
float  s 
)
void game::drawradar ( float  x,
float  y,
float  s 
)
void game::drawteammate ( fpsent d,
float  x,
float  y,
float  s,
fpsent o,
float  scale 
)

draw a specific teamate's icon arrow in minimap

References camera1, dir, vec::div(), f(), vec::magnitude2(), vec::mul(), physent::o, RAD, vec::rotate_around_z(), vec::sub(), and physent::yaw.

Referenced by drawteammates().

void game::drawteammates ( fpsent d,
float  x,
float  y,
float  s 
)
bool game::duplicatename ( fpsent d,
const char *  name = nullptr,
const char *  alt = nullptr 
)

are there any duplicate names in our client list? in case this is true, their client numbers will be displayed behind both nicknames

References loopv, fpsent::name, player1, and players.

Referenced by colorname().

void game::dynentcollide ( physent d,
physent o,
const vec dir 
)

push monsters (or objects) together when they hit walls or other objects

References ENT_INANIMATE, stackmovable(), and physent::type.

Referenced by plcollide().

void game::dynlighttrack ( physent owner,
vec o,
vec hud 
)
void game::edittoggled ( bool  on)
void game::edittrigger ( const selinfo sel,
int  op,
int  arg1,
int  arg2,
int  arg3,
const VSlot vs 
)
void game::explode ( bool  local,
fpsent owner,
const vec v,
dynent safe,
int  damage,
int  gun 
)
void game::explodeeffects ( int  gun,
fpsent d,
bool  local,
int  id 
)
void game::follow ( char *  arg)

follow a specific player if you are in spectator mode

Parameters
argeither the player's name or his client number
See Also
parseplayer

References fpsent::clientnum, CS_SPECTATOR, followdir, following, Log, parseplayer(), player1, physent::state, and inexor::util::log_manager::std.

fpsent * game::followingplayer ( )

Give me the fpsent instance of the player you are currently spectating.

References CS_SPECTATOR, following, getclient(), player1, physent::state, and ai::target().

Referenced by collidecamera(), gameplayhud(), getfollowingfov(), hudplayer(), killed(), rendergame(), setupcamera(), and updateweapons().

void game::forceedit ( const char *  name)

force edit mode

References changemap().

Referenced by newmap().

void game::forceintermission ( )

References addmsg(), and N_FORCEINTERMISSION.

game::FVAR ( swaystep  ,
,
35.  0f,
100   
)
game::FVAR ( swayside  ,
,
0.  04f,
 
)
game::FVAR ( swayup  ,
1,
0.  05f,
 
)
game::FVARP ( minimapalpha  ,
,
,
 
)
void game::g3d_gamemenus ( )

References game::scoreboardgui::render(), and scoreboard.

Referenced by g3d_render().

void game::gameconnect ( )

?

References editmode, and toggleedit().

Referenced by gets2c().

void game::gamedisconnect ( bool  cleanup)
void game::gameplayhud ( int  w,
int  h 
)
void game::getbestplayers ( vector< fpsent * > &  best)
void game::getbestteams ( vector< const char * > &  best)
fpsent * game::getclient ( int  cn)
const char* game::getclienticon ( int  cn)
const char * game::getclientmap ( )
const char * game::getclientmode ( )

References gamemode, and modename().

Referenced by screenshot().

int game::getclientmodel ( int  cn)

get client player model ID from cn

References hmap::d, getclient(), and fpsent::playermodel.

const char* game::getclientname ( int  cn)

get nick name from cn

Parameters
cnclient number

References hmap::d, getclient(), and fpsent::name.

const char* game::getclientteam ( int  cn)

get team name from cn

References hmap::d, getclient(), and fpsent::team.

void game::getdemo ( int  i)
int game::getfollowingfov ( )

Receive the fov the currently followed player got or -1 on failure.

References hmap::d, followingplayer(), and fpsent::fov.

Referenced by computezoom().

void game::getmap ( )
const playermodelinfo* game::getplayermodelinfo ( int  n)

References playermodels.

Referenced by getclienticon(), and renderscoreboard().

const playermodelinfo & game::getplayermodelinfo ( fpsent d)
int game::getweapon ( const char *  name)

References loopi(), and parseint().

Referenced by setweapon().

void game::gibeffect ( int  damage,
const vec vel,
fpsent d 
)
void game::gotoplayer ( const char *  arg)
void game::gotosel ( )
static int game::groupplayers ( )
static
void game::gunselect ( int  gun,
fpsent d 
)
void game::hashpwd ( const char *  pwd)

hash setmaster password cn and sessionid are used to hash: servers do to store the hash value.

References fpsent::clientnum, tiger::hash(), hashpassword(), player1, result(), and sessionid.

void game::hit ( int  damage,
dynent d,
fpsent at,
const vec vel,
int  gun,
float  info1,
int  info2 = 1 
)
void game::hitmovable ( int  damage,
movable *  m,
fpsent at,
const vec vel,
int  gun 
)

References game::movable::damaged(), and game::movable::hitpush().

Referenced by hit().

void game::hitpush ( int  damage,
dynent d,
fpsent at,
vec from,
vec to,
int  gun,
int  rays 
)

References vec::dist(), hit(), and rays.

Referenced by server::dodamage(), and raydamage().

vec game::hudgunorigin ( int  gun,
const vec from,
const vec to,
fpsent d 
)
fpsent * game::hudplayer ( )

Give me the fpsent instance of the player whose coordinates will be used to calculate my camera's position.

See Also
followingplayer

References followingplayer(), player1, ai::target(), and thirdperson.

Referenced by abovegameplayhud(), damaged(), detachcamera(), drawhudgun(), dynlighttrack(), gameplayhud(), hudgunorigin(), newbouncer(), game::collectclientmode::rendergame(), selectcrosshair(), shoteffects(), and swayhudgun().

game::ICOMMAND ( insidebases  ,
""  ,
()  ,
{vector< char > buf;if(m_capture &&player1->state==CS_ALIVE) loopv(capturemode.bases){captureclientmode::baseinfo &b=capturemode.bases[i];if(b.valid()&&capturemode.insidebase(b, player1->feetpos())){if(buf.length()) buf.add(' ');defformatstring(basenum,"%d", i+1);buf.put(basenum, strlen(basenum));}}buf.add('\0');result(buf.getbuf());}   
)
game::ICOMMAND ( repammo  ,
""  ,
()  ,
capturemode.  replenishammo() 
)
game::ICOMMAND ( getweapon  ,
""  ,
()  ,
intret(player1->gunselect)   
)
game::ICOMMAND ( getfollow  ,
""  ,
()  ,
{fpsent *f=followingplayer();intret(f?f->clientnum:-1);}   
)

cubescript: get the player I am following

game::ICOMMAND ( nextweapon  ,
"ii"  ,
(int *dir, int *force)  ,
nextweapon *,*!=  0force 
)
game::ICOMMAND ( setweapon  ,
"si"  ,
(char *name, int *force)  ,
setweapon(name,*force!=0)   
)
game::ICOMMAND ( cycleweapon  ,
"V"  ,
(tagval *args, int numargs)  ,
{int numguns=min(numargs, 8);int guns[8];loopi(numguns) guns[i]=getweapon(args[i].getstr());cycleweapon(numguns, guns);}   
)
game::ICOMMAND ( nextfollow  ,
"i"  ,
(int *dir ,
nextfollow *< 0?-1:1dir   
)
game::ICOMMAND ( weapon  ,
"V"  ,
(tagval *args, int numargs)  ,
{if(player1->state!=CS_ALIVE) return;loopi(8){const char *name=i< numargs?args[i].getstr():"";if(name[0]){int gun=getweapon(name);if(gun >=GUN_FIST &&gun<=GUN_BOMB &&gun!=player1->gunselect &&player1->ammo[gun]){gunselect(gun, player1);return;}}else{weaponswitch(player1);return;}}playsound(S_NOAMMO);}   
)
game::ICOMMAND ( platform  ,
"ii"  ,
(int *tag, int *newdir)  ,
triggerplatform *,*  newdir 
)
game::ICOMMAND ( getfollowingfov  ,
""  ,
()  ,
intret(getfollowingfov())   
)
game::ICOMMAND ( name  ,
"sN"  ,
(char *s, int *numargs)  ,
{if(*numargs > 0) switchname(s, nullptr);else if(!*numargs) printname();else result(colorname(player1));}   
)
game::ICOMMAND ( getname  ,
""  ,
()  ,
result(player1->name)   
)
game::ICOMMAND ( tag  ,
"sN"  ,
(char *s, int *numargs)  ,
{if(*numargs > 0) switchname("", s);else if(!*numargs) Log.std->info("your tag is: {0}", player1->tag);else result(player1->tag);}   
)
game::ICOMMAND ( gettag  ,
""  ,
()  ,
result(player1->tag)   
)
game::ICOMMAND ( team  ,
"sN"  ,
(char *s, int *numargs)  ,
{if(*numargs > 0) switchteam(s);else if(!*numargs) printteam();else result(player1->team);}   
)

switch team or print team name

game::ICOMMAND ( getteam  ,
""  ,
()  ,
result(player1->team)   
)

cubescript implementation of getteam

game::ICOMMAND ( getclientname  ,
"i"  ,
(int *cn)  ,
result(getclientname(*cn))   
)
game::ICOMMAND ( getclientteam  ,
"i"  ,
(int *cn)  ,
result(getclientteam(*cn))   
)
game::ICOMMAND ( getclientmodel  ,
"i"  ,
(int *cn)  ,
intret(getclientmodel(*cn))   
)
game::ICOMMAND ( getclienticon  ,
"i"  ,
(int *cn)  ,
result(getclienticon(*cn))   
)
game::ICOMMAND ( ismaster  ,
"i"  ,
(int *cn)  ,
intret(ismaster(*cn)?1:0)   
)
game::ICOMMAND ( isadmin  ,
"i"  ,
(int *cn)  ,
intret(isadmin(*cn)?1:0)   
)
game::ICOMMAND ( getmastermode  ,
""  ,
()  ,
intret(mastermode)   
)
game::ICOMMAND ( mastermodename  ,
"i"  ,
(int *mm)  ,
result(mastermodename(*mm,""))   
)
game::ICOMMAND ( isspectator  ,
"i"  ,
(int *cn)  ,
intret(isspectator(*cn)?1:0)   
)
game::ICOMMAND ( isai  ,
"ii"  ,
(int *cn, int *type)  ,
intret(isai(*cn,*type)?1:0)   
)
game::ICOMMAND ( getclientnum  ,
"s"  ,
(char *name)  ,
intret(name[0]?parseplayer(name):player1->clientnum)   
)
game::ICOMMAND ( showscores  ,
"D"  ,
(int *down)  ,
showscores *!=  0down 
)
game::ICOMMAND ( listclients  ,
"bb"  ,
(int *local, int *bots)  ,
listclients * >0,*!=  0bots 
)
game::ICOMMAND ( ignore  ,
"s"  ,
(char *arg)  ,
ignore(parseplayer(arg))   
)
game::ICOMMAND ( unignore  ,
"s"  ,
(char *arg)  ,
unignore(parseplayer(arg))   
)
game::ICOMMAND ( isignored  ,
"s"  ,
(char *arg)  ,
intret(isignored(parseplayer(arg))?1:0)   
)
game::ICOMMAND ( mastermode  ,
"i"  ,
(int *val)  ,
addmsg(N_MASTERMODE,"ri",*val)   
)

request to change server master mode (permissions requires)

game::ICOMMAND ( getaccuracy  ,
""  ,
()  ,
intret((player1->totaldamage *100)/max(player1->totalshots, 1))   
)
game::ICOMMAND ( getdeaths  ,
""  ,
()  ,
intret(player1->deaths)   
)
game::ICOMMAND ( getflags  ,
""  ,
()  ,
intret(player1->flags)   
)
game::ICOMMAND ( spectator  ,
"is"  ,
(int *val, char *who)  ,
togglespectator *,  who 
)
game::ICOMMAND ( getfrags  ,
""  ,
()  ,
intret(player1->frags)   
)

return a player's statistics to cubescript

game::ICOMMAND ( getteamkills  ,
""  ,
()  ,
intret(player1->teamkills)   
)
game::ICOMMAND ( gettotaldamage  ,
""  ,
()  ,
intret(player1->totaldamage)   
)
game::ICOMMAND ( checkmaps  ,
""  ,
()  ,
addmsg(N_CHECKMAPS,"r")   
)

ask the server to acquire CRC32 checksum of all player's maps (permissions requred)

game::ICOMMAND ( gettotalshots  ,
""  ,
()  ,
intret(player1->totalshots)   
)
game::ICOMMAND ( mode  ,
"i"  ,
(int *val)  ,
setmode *  val 
)

set game mode

game::ICOMMAND ( getmode  ,
""  ,
()  ,
intret(gamemode  
)

get game mode in cubescript

game::ICOMMAND ( timeremaining  ,
"i"  ,
(int *formatted)  ,
{int val=max(maplimit-lastmillis, 0)/1000;if(*formatted){defformatstring(str,"%d:%02d", val/60, val%60);result(str);}else intret(val);}   
)

return remaining time

game::ICOMMAND ( map  ,
"s"  ,
(char *name)  ,
changemap(name)   
)
game::ICOMMAND ( dropflag  ,
""  ,
()  ,
{ctfmode.trydropflag();}   
)
game::ICOMMAND ( suicide  ,
""  ,
()  ,
suicide(player1)   
)
game::ICOMMAND ( pausegame  ,
"i"  ,
(int *val)  ,
pausegame * >  0val 
)
game::ICOMMAND ( paused  ,
"iN$"  ,
(int *val, int *numargs, ident *id)  ,
{if(*numargs > 0) pausegame(clampvar(id,*val, 0, 1) > 0);else if(*numargs< 0) intret(gamepaused?1:0);else printvar(id, gamepaused?1:0);}   
)

cubescript: check if game is paused

game::ICOMMAND ( persistteams  ,
"i"  ,
(int *val)  ,
persistteams * >  0val 
)
game::ICOMMAND ( ammohudup  ,
"V"  ,
(tagval *args, int numargs)  ,
{loopi(3) ammohudup[i]=i< numargs?getweapon(args[i].getstr()):-1;}   
)

those 3 functions are used to rotate in circles through your weapons so you see different preview images of the other weapons in your holsters

game::ICOMMAND ( ammohuddown  ,
"V"  ,
(tagval *args, int numargs)  ,
{loopi(3) ammohuddown[i]=i< numargs?getweapon(args[i].getstr()):-1;}   
)
game::ICOMMAND ( ammohudcycle  ,
"V"  ,
(tagval *args, int numargs)  ,
{loopi(8) ammohudcycle[i]=i< numargs?getweapon(args[i].getstr()):-1;}   
)
game::ICOMMAND ( gamespeed  ,
"iN$"  ,
(int *val, int *numargs, ident *id)  ,
{if(*numargs > 0) changegamespeed(clampvar(id,*val, 10, 1000));else if(*numargs< 0) intret(gamespeed);else printvar(id, gamespeed);}   
)
game::ICOMMAND ( pm  ,
"is"  ,
(int *i, char *text)  ,
sayprivate *,  text 
)
game::ICOMMAND ( servcmd  ,
"C"  ,
(char *cmd)  ,
addmsg(N_SERVCMD,"rs", cmd)   
)

send custom server messages to servers this feature is not used on most servers (?)

game::ICOMMAND ( recorddemo  ,
"i"  ,
(int *val)  ,
recorddemo *  val 
)
game::ICOMMAND ( cleardemos  ,
"i"  ,
(int *val)  ,
cleardemos *  val 
)
game::ICOMMAND ( getdemo  ,
"i"  ,
(int *val)  ,
getdemo *  val 
)
game::ICOMMANDS ( "m_noitems"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_noitems);}   
)
game::ICOMMANDS ( "m_noammo"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_noammo);}   
)
game::ICOMMANDS ( "m_insta"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_insta);}   
)
game::ICOMMANDS ( "m_tactics"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_tactics);}   
)
game::ICOMMANDS ( "m_efficiency"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_efficiency);}   
)
game::ICOMMANDS ( "m_capture"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_capture);}   
)
game::ICOMMANDS ( "m_regencapture"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_regencapture);}   
)
game::ICOMMANDS ( "m_ctf"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_ctf);}   
)
game::ICOMMANDS ( "m_protect"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_protect);}   
)
game::ICOMMANDS ( "m_hold"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_hold);}   
)
game::ICOMMANDS ( "m_collect"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_collect);}   
)
game::ICOMMANDS ( "m_teammode"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_teammode);}   
)
game::ICOMMANDS ( "m_demo"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_demo);}   
)
game::ICOMMANDS ( "m_edit"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_edit);}   
)
game::ICOMMANDS ( "m_lobby"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_lobby);}   
)
game::ICOMMANDS ( "m_lms"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_lms);}   
)
game::ICOMMANDS ( "m_bomb"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_bomb);}   
)
game::ICOMMANDS ( "m_timeforward"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_timeforward);}   
)
game::ICOMMANDS ( "m_obstacles"  ,
"i"  ,
(int *mode)  ,
{int gamemode=*mode;intret(m_obstacles);}   
)
void game::ignore ( int  cn)
void game::initclient ( )
bool game::intersect ( dynent d,
const vec from,
const vec to,
float &  dist 
)
dynent * game::intersectclosest ( const vec from,
const vec to,
fpsent at,
float &  bestdist 
)
bool game::isadmin ( int  cn)

check if this client is an administrator

References hmap::d, getclient(), PRIV_ADMIN, and fpsent::privilege.

bool game::isai ( int  cn,
int  type 
)

check if this cn is a bot (computer controlled player)

References AI_BOT, AI_MAX, fpsstate::aitype, hmap::d, and getclient().

bool game::isignored ( int  cn)

cubescript: check if this person is ignored by you

References vector< T, MINSIZE >::find(), and ignores.

Referenced by parsemessages().

bool game::ismaster ( int  cn)

check if this client is a game master or administrator

References hmap::d, getclient(), PRIV_MASTER, and fpsent::privilege.

bool game::isobstaclealive ( movable *  m)
bool game::ispaused ( )

check if game is paused

References gamepaused.

Referenced by addmotionblur(), main(), renderscoreboard(), and respawnself().

bool game::ispersisted ( )

References teamspersisted.

bool game::isspectator ( int  cn)
dynent * game::iterdynents ( int  i)

iterate through all dynamic entities and return entity with index [i] You put the list in and get it through to return back The caller has to hand in a list which will get filled

Returns
a player, monster or movable (all dynamic entities)

References vector< T, MINSIZE >::length(), movables, and players.

Referenced by game::captureclientmode::aidefend(), game::ctfclientmode::aidefend(), game::captureclientmode::aifind(), game::ctfclientmode::aifind(), checkdynentcache(), explode(), intersectclosest(), main(), and updateprojectiles().

void game::kick ( const char *  victim,
const char *  reason 
)

request to kickban a player

References addmsg(), fpsent::clientnum, N_KICK, parseplayer(), and player1.

Referenced by server::addteamkillkick().

void game::killed ( fpsent d,
fpsent actor 
)
void game::lighteffects ( dynent e,
vec color,
vec dir 
)

if 0 is another way to comment out like this: /*

References CS_DEAD, hmap::d, f(), lastmillis, fpsstate::quadmillis, physent::state, and anonymous_namespace{utilTest.cpp}::t().

Referenced by rendermodel().

void game::listclients ( bool  local,
bool  bots 
)
void game::listdemos ( )
void game::moveragdolls ( )
void game::msgsound ( int  n,
physent d 
)

play sound and send sound notification to server

See Also
playsound

References addmsg(), ENT_PLAYER, N_SOUND, physent::o, player1, inexor::sound::playsound(), and physent::type.

Referenced by entities::addammo(), physicstrigger(), and shoot().

bool game::needminimap ( )

checks if minimap is required for this game mode

References m_bomb, m_capture, m_collect, m_ctf, m_hold, and m_protect.

Referenced by drawminimap().

void game::newbouncer ( const vec from,
const vec to,
bool  local,
int  id,
fpsent owner,
int  type,
int  lifetime,
int  speed,
entitylight light = nullptr,
int  generation = 0 
)
fpsent * game::newclient ( int  cn)
void game::newmap ( int  size)

request server to start new map (requires editmode)

References addmsg(), and N_NEWMAP.

Referenced by mapenlarge(), and newmap().

void game::newprojectile ( const vec from,
const vec to,
float  speed,
bool  local,
int  id,
fpsent owner,
int  gun 
)
void game::nextfollow ( int  dir)

follow previous/next client number

Parameters
direither forwards (1) or backwards (-1)

References clients, CS_SPECTATOR, cur, dir, vector< T, MINSIZE >::empty(), followdir, following, vector< T, MINSIZE >::length(), Log, loopv, player1, physent::state, recorder::state, inexor::util::log_manager::std, and stopfollowing().

Referenced by clientdisconnected().

void game::nextweapon ( int  dir,
bool  force = false 
)
int game::numdynents ( )
void game::offsetray ( const vec from,
const vec to,
int  spread,
float  range,
vec dest 
)
void game::otherplayers ( int  curtime)
void game::parsemessages ( int  cn,
fpsent d,
ucharbuf p 
)

References physent::abovehead(), addmsg(), alias(), fpsstate::ammo, fpsstate::armour, at(), attachentity(), guninfo::attackdelay, fpsent::attacking, databuf< T >::buf, changemapserv(), inexor::util::log_manager::chat, cleanragdoll(), clearclients(), clientdisconnected(), fpsent::clientnum, cmode, COL_BLUE, COL_GREEN, COL_GREY, COL_WHITE, colorname(), connected, copystring(), selinfo::corner, CS_ALIVE, CS_DEAD, CS_EDITING, CS_SPAWNING, CS_SPECTATOR, selinfo::cx, selinfo::cxs, selinfo::cy, selinfo::cys, guninfo::damage, ai::damaged(), deathscore, deathstate(), defformatstring, demoplayback, server::demos, dir, disablezoom(), disconnect(), DMF, DNF, sphere::ebuf, fpsent::edit, inexor::util::log_manager::edit, editmode, physent::editstate, emptymap(), enlargemap(), entities::ents, ET_EMPTY, execute(), explodeeffects(), f(), filtertext(), packetbuf::finalize(), findplayerspawn(), ident::flags, following, fpsent::fov, inexor::util::log_manager::game, gamepaused, gamespeed, getclient(), entities::getents(), getfloat(), getident(), getint(), getstring(), getuint(), getworldsize(), selinfo::grid, GUN_BOMB, GUN_FIST, guns, fpsstate::gunselect, fpsstate::gunwait, fpsstate::health, game::clientmode::hidefrags(), fpsent::hitpush(), hudannounce_begin, hudannounce_effect, hudannounce_text, hudannounce_timeout, I_BOOST, I_QUAD, ID_FVAR, ID_SVAR, ID_VAR, identexists(), IDF_OVERRIDE, IDF_READONLY, ai::init(), isignored(), isteam, entities::itemicon(), entities::itemname(), ai::itemspawned(), ai::killed(), fpsent::lastaction, fpsent::lastattackgun, lasthit, lastmillis, fpsent::lastpain, fpsent::lasttaunt, fpsent::lifesequence, lilswap(), Log, loopi(), loopk, loopv, m_teammode, mastermode, mastermodename(), inexor::rpc::max(), databuf< T >::maxlen, MAXNAMELEN, MAXTAGLEN, MAXTEAMLEN, MAXTEAMS, MAXTRANS, modifyoctaent(), mpcopy(), mpdelcube(), mpeditent(), mpeditface(), mpeditmat(), mpedittex(), mpeditvslot(), mpflip(), mppaste(), mpremip(), mpreplacetex(), mprotate(), N_ANNOUNCE, N_CDIS, N_CLIENT, N_CLIENTPING, N_CLIPBOARD, N_COPY, N_CURRENTMASTER, N_DAMAGE, N_DELCUBE, N_DEMOPACKET, N_DEMOPLAYBACK, N_DIED, N_EDITENT, N_EDITF, N_EDITM, N_EDITMODE, N_EDITT, N_EDITVAR, N_EDITVSLOT, N_EXPLODEFX, N_FLIP, N_FORCEDEATH, N_FOV, N_GAMESPEED, N_GUNSELECT, N_HITPUSH, N_HUDANNOUNCE, N_INITAI, N_INITCLIENT, N_ITEMACC, N_ITEMLIST, N_ITEMPUSH, N_ITEMSPAWN, N_MAPCHANGE, N_MASTERMODE, N_NEWMAP, N_PASTE, N_PAUSEGAME, N_PERSISTTEAMS, N_PONG, N_PRIVMSG, N_REDO, N_REMIP, N_REPLACE, N_RESUME, N_ROTATE, N_SAYTEAM, N_SENDDEMOLIST, N_SERVCMD, N_SERVINFO, N_SERVMSG, N_SETTEAM, N_SHOTFX, N_SOUND, N_SPAWN, N_SPAWNSTATE, N_SPECTATOR, N_SWITCHMODEL, N_SWITCHNAME, N_TAUNT, N_TEAMINFO, N_TEXT, N_TIMEUP, N_UNDO, N_WELCOME, fpsent::name, needclipboard, neterr(), newclient(), entities::newentity(), newentity(), notifywelcome(), physent::o, selinfo::o, selinfo::orient, databuf< T >::overread(), databuf< T >::pad(), game::clientmode::parse_network_message(), parsestate(), PART_HUD_ICON, PART_TEXT, particle_icon(), particle_text(), particle_textcopy(), game::clientmode::pickspawn(), entities::pickupeffects(), fpsent::ping, player1, fpsent::playermodel, players, inexor::sound::playsound(), printvar(), PRIV_NONE, fpsent::privilege, PROTOCOL_VERSION, putint(), fpsstate::quadmillis, dynent::ragdoll, guninfo::rays, databuf< T >::remaining(), physent::resetinterp(), fpsent::respawn(), game::clientmode::respawned(), selinfo::s, S_ITEMSPAWN, S_V_BOOST10, S_V_QUAD10, S_WEAPLOAD, saveragdoll(), sel, sendclientpacket(), sendintro(), senditemstoserver, servinfo, sessionid, setfvar(), entities::setspawn(), setsvar(), setteaminfo(), setvar(), shoteffects(), showscores(), ai::spawned(), entities::spawnitems(), physent::state, inexor::util::log_manager::std, stopfollowing(), databuf< T >::subbuf(), anonymous_namespace{utilTest.cpp}::t(), fpsent::tag, ai::target(), fpsent::team, inexor::util::log_manager::team_chat, teamspersisted, timeupdate(), toggleedit(), totalmillis, fpsent::totalshots, unpackeditinfo(), unpackundo(), and selinfo::validate().

Referenced by parsepacketclient().

void game::parsepacketclient ( int  chan,
packetbuf p 
)
int game::parseplayer ( const char *  arg)

all functions can be called using client number or full name name should be case sensitive but the engine checks is both ways

try to parse it as cn

try case sensitive first

nothing found, try case insensitive

no match found!

References fpsent::clientnum, clients, gle::end(), vector< T, MINSIZE >::inrange(), loopv, fpsent::name, player1, and players.

Referenced by follow(), gotoplayer(), kick(), setmaster(), setteam(), and togglespectator().

void game::parsepositions ( ucharbuf p)
void game::parsestate ( fpsent d,
ucharbuf p,
bool  resume = false 
)
void game::particletrack ( physent owner,
vec o,
vec d 
)
void game::pausegame ( bool  val)
void game::persistteams ( bool  val)

Set reshuffeling behaviour on mapchange according to bool val (true activates persistent teams)

References addmsg(), inexor::util::log_manager::game, isconnected(), Log, and N_PERSISTTEAMS.

void game::physicstrigger ( physent d,
bool  local,
int  floorlevel,
int  waterlevel,
int  material 
)

trigger sound effects depending on the material you enter

as long as you do not enter lava play a splash sound

only send server message if I entered the water and fpsent d is not a bot

References ENT_INANIMATE, ENT_PLAYER, MAT_LAVA, msgsound(), physent::o, player1, inexor::sound::playsound(), S_BURN, S_JUMP, S_LAND, S_SPLASH1, S_SPLASH2, and physent::type.

Referenced by modifyvelocity(), ragdolldata::move(), and moveplayer().

static bool game::playersort ( const fpsent a,
const fpsent b 
)
inlinestatic
fpsent * game::pointatplayer ( )

Give me the player I am aiming at.

References intersect(), loopv, physent::o, player1, players, and worldpos.

void game::predictplayer ( fpsent d,
bool  move 
)

use latency and assume player movement to predict a player's new position.

Improves visual appearance of his movement tremendous - even under lag

See Also
moveplayer

References vec::add(), fpsent::deltapitch, physent::deltapos, fpsent::deltaroll, fpsent::deltayaw, lastmillis, moveplayer(), vec::mul(), fpsent::newpitch, physent::newpos, fpsent::newroll, fpsent::newyaw, physent::o, physent::pitch, physent::roll, fpsent::smoothmillis, smoothmove, and physent::yaw.

Referenced by otherplayers().

void game::preload ( )
void game::preloadbouncers ( )

References loopi(), and preloadmodel().

Referenced by preload().

void game::preloadplayermodel ( )
void game::preloadsounds ( )
void game::preloadweapons ( )
void game::printname ( )

print my own nick name to the game console

References colorname(), Log, player1, and inexor::util::log_manager::std.

void game::printteam ( )

print own team name to the game console

References Log, player1, inexor::util::log_manager::std, and fpsent::team.

void game::printvar ( fpsent d,
ident id 
)

print map var change commited by other players in edit mode

References colorname(), inexor::util::log_manager::edit, ident::flags, formatstring(), ID_FVAR, ID_SVAR, ID_VAR, IDF_HEX, Log, ident::name, and ident::type.

Referenced by parsemessages(), and vartrigger().

bool game::projdamage ( dynent o,
projectile &  p,
vec v,
int  qdam 
)
float game::projdist ( dynent o,
vec dir,
const vec v 
)
void game::projsplash ( projectile &  p,
vec v,
dynent safe,
int  damage 
)
void game::radialbombeffect ( bouncer *  b,
const vec v 
)
void game::radialeffect ( dynent o,
const vec v,
int  qdam,
fpsent at,
int  gun 
)
void game::raydamage ( vec from,
vec to,
fpsent d 
)
void game::readgamedata ( vector< char > &  extras)

Referenced by load_world().

void game::receivefile ( packetbuf p)
void game::recorddemo ( int  val)
void game::removebouncers ( fpsent owner)

References bouncers, and loopv.

Referenced by removeweapons().

void game::removeprojectiles ( fpsent owner)
void game::removeweapons ( fpsent d)
void game::renderavatar ( )

References drawhudgun().

Referenced by drawreflection(), and renderavatar().

void game::renderbouncers ( )
void game::rendergame ( bool  mainpass)
void game::rendermovables ( )
void game::renderplayer ( fpsent d,
const playermodelinfo &  mdl,
int  team,
float  fade,
bool  mainpass 
)
void game::renderplayerpreview ( int  model,
int  team,
int  weap 
)
void game::renderprojectiles ( )
void game::renderscoreboard ( g3d_gui g,
bool  firstpass 
)
void game::resetgamestate ( )

reset game state in singleplayer reset all monsters, triggers, bouncers, movables, and projectiles

References clearbouncers(), clearmovables(), clearprojectiles(), and m_obstacles.

Referenced by toggleedit().

void game::respawn ( int  gamemode = 0)

spawn myself in SP and DMSP game mode (singleplayer only)

See Also
changemap

References fpsent::attacking, cmode, CS_DEAD, lastmillis, lastspawnattempt, player1, respawnself(), game::clientmode::respawnwait(), and physent::state.

Referenced by canjump(), and doattack().

void game::respawnself ( )

Send "I would like to spawn" to server.

References addmsg(), ispaused(), lastmillis, fpsent::lifesequence, N_TRYSPAWN, player1, and fpsent::respawned.

Referenced by respawn().

const char* game::restoreconfig ( )
inline

Referenced by main().

const char* game::savedconfig ( )
inline

Referenced by main(), and writecfg().

const char* game::savedservers ( )
inline

Referenced by main().

void game::saveragdoll ( fpsent d)
void game::sayprivate ( int  i,
char *  text 
)
void game::sayteam ( char *  text)

send team messages to server

References addmsg(), COL_BLUE, colorname(), Log, N_SAYTEAM, player1, and inexor::util::log_manager::team_chat.

static bool game::scoregroupcmp ( const scoregroup x,
const scoregroup y 
)
inlinestatic
int game::selectcrosshair ( vec color)
void game::sendclipboard ( )

send copied data from your clipboard to server

References packetbuf::finalize(), localedit, N_CLIPBOARD, needclipboard, packeditinfo(), packetbuf::put(), putint(), and sendclientpacket().

Referenced by edittrigger().

void game::sendintro ( )
void game::sendmap ( )
void game::sendmapinfo ( )

set booleans sendcrc and senditemstoserver if connected.

References connected, CS_SPECTATOR, player1, fpsent::privilege, sendcrc, senditemstoserver, and physent::state.

Referenced by startmap().

void game::sendmessages ( )
static void game::sendposition ( fpsent d,
packetbuf q 
)
static
void game::sendposition ( fpsent d,
bool  reliable 
)

send my own player position to server (call function above)

References CS_ALIVE, CS_EDITING, packetbuf::finalize(), sendclientpacket(), and physent::state.

Referenced by sendpositions().

void game::sendpositions ( )
void game::setbliptex ( int  team,
const char *  type = "" 
)
void game::setclientmode ( )

set game mode pointer

References bombmode, capturemode, cmode, collectmode, ctfmode, hideandseekmode, m_bomb, m_capture, m_collect, m_ctf, and m_hideandseek.

Referenced by startgame().

void game::setmaster ( const char *  arg,
const char *  who 
)

acquire game master or give game master to players

References addmsg(), fpsent::clientnum, tiger::hash(), hashpassword(), N_SETMASTER, parseint(), parseplayer(), player1, and sessionid.

void game::setmode ( int  mode)

force server to change game mode (permissions required)

References intret(), and nextmode.

void game::setradartex ( )
void game::setteam ( const char *  arg1,
const char *  arg2 
)

change a players team

See Also
addmsg

References addmsg(), N_SETTEAM, and parseplayer().

void game::setteaminfo ( const char *  team,
int  frags 
)
void game::setupcamera ( )

initialise camera when entering spectator mode

See Also
followingplayer

References CS_DEAD, followingplayer(), physent::o, physent::pitch, player1, physent::resetinterp(), physent::state, ai::target(), and physent::yaw.

Referenced by recomputecamera().

void game::setweapon ( const char *  name,
bool  force = false 
)
void game::shoot ( fpsent d,
const vec targ 
)
void game::shorten ( vec from,
vec target,
float  dist 
)

References vec::add(), f(), inexor::rpc::min(), vec::mul(), and vec::sub().

Referenced by raydamage(), and shoot().

void game::shoteffects ( int  gun,
const vec from,
const vec to,
fpsent d,
bool  local,
int  id,
int  prevaction 
)
void game::showscores ( bool  on)
void game::spawnbouncer ( const vec p,
const vec vel,
fpsent d,
int  type,
entitylight light = nullptr 
)
void game::spawnnextsplinter ( const vec p,
const vec vel,
fpsent d,
int  generation 
)
void game::spawnplayer ( fpsent d)

spawn yourself im the game world, also called for monsters/AI in singleplayer of course not used for other players in multiplayer because everyone determins his spawn point for himself.

See Also
spawnstate

References cmode, CS_ALIVE, CS_EDITING, CS_SPECTATOR, editmode, findplayerspawn(), game::clientmode::pickspawn(), player1, respawnent, spawnstate(), and physent::state.

void game::spawnsplinters ( const vec p,
fpsent d 
)
fpsent* game::spawnstate ( fpsent d)

reset player state not persistent accross spawns

Parameters
dthe affected fpsent ("player"/"monster"/"bot")

References hmap::d, gamemode, fpsent::respawn(), and fpsstate::spawnstate().

Referenced by initclient(), and spawnplayer().

void game::stackmovable ( movable *  d,
physent o 
)
void game::startgame ( )
void game::startmap ( const char *  name)

called just after a map load send CRC32 to server

See Also
sendmapinfo

send CRC32 checksum of my current map yeah if you would like to cheat this is the code passage you must modify you little ****** *

References ai::clearwaypoints(), clientmap, copystring(), findplayerspawn(), player1, entities::resetspawns(), respawnent, ai::savewaypoints(), sendmapinfo(), and startmap().

Referenced by startmap().

void game::stopdemo ( )
void game::stopfollowing ( )

stop spectating a specific player and start free camery fly

References followdir, following, Log, and inexor::util::log_manager::std.

Referenced by clientdisconnected(), gamedisconnect(), nextfollow(), and parsemessages().

void game::suicide ( physent d)
void game::suicidemovable ( movable *  m)

References game::movable::suicide().

Referenced by suicide().

game::SVARP ( hudgunsdir  ,
""   
)
void game::swayhudgun ( int  curtime)
void game::switchname ( const char *  name,
const char *  tag 
)


team, name and playermodel settings

change own nick name

Parameters
namemy new nickname
tagis clantag of the player
See Also
filtertext

References addmsg(), copystring(), filtertext(), MAXNAMELEN, MAXTAGLEN, N_SWITCHNAME, fpsent::name, player1, and fpsent::tag.

void game::switchplayermodel ( int  playermodel)

switch my player model (inky, ogro..)

See Also
addmsg

References addmsg(), N_SWITCHMODEL, player1, playermodel, and fpsent::playermodel.

Referenced by startgame().

void game::switchteam ( const char *  team)
void game::taunt ( )

send taunt network animation message to server taunt animation is this "im gonna kill you" gesture that can be seen by other players

References addmsg(), CS_ALIVE, lastmillis, fpsent::lasttaunt, N_TAUNT, PHYS_SLOPE, physent::physstate, player1, and physent::state.

const char * game::teamcolor ( const char *  name,
bool  sameteam,
const char *  alt 
)
const char * game::teamcolor ( const char *  name,
const char *  team,
const char *  alt 
)

this function calls the function above but also validates that team is a valid char pointer it is not possible to return memory to an invalid char* pointer!7

See Also
teamcolor

References isteam, player1, and fpsent::team.

const char * game::teamcolorname ( fpsent d,
const char *  alt 
)
void game::timeupdate ( int  secs)
void game::togglespectator ( int  val,
const char *  who 
)

toggle own spectator or put player into spectator (permissions requred)

References addmsg(), fpsent::clientnum, N_SPECTATOR, parseplayer(), and player1.

void game::toserver ( char *  text)

send chat messages to server

References addmsg(), inexor::util::log_manager::chat, COL_GREEN, colorname(), Log, N_TEXT, and player1.

Referenced by hline::run().

void game::triggerplatform ( int  tag,
int  newdir 
)
void game::unignore ( int  cn)

stop ignoring all chat messages from a certain client number

References hmap::d, vector< T, MINSIZE >::find(), inexor::util::log_manager::game, getclient(), ignores, Log, fpsent::name, and vector< T, MINSIZE >::removeobj().

Referenced by clientdisconnected().

void game::updatebouncers ( int  time)
void game::updatemovables ( int  curtime)
void game::updatepos ( fpsent d)
void game::updateprojectiles ( int  time)
void game::updateweapons ( int  curtime)
void game::updateworld ( )
game::VAR ( testquad  ,
,
,
 
)
game::VAR ( testarmour  ,
,
,
 
)
game::VAR ( testteam  ,
,
,
 
)
game::VAR ( testhudgun  ,
,
,
 
)
game::VARFN ( scoreboard  ,
showscoreboard  ,
,
,
,
scoreboard.  showshowscoreboard!=0 
)
game::VARFP ( playermodel  ,
,
,
,
changedplayermodel()   
)
game::VARP ( scoreboard2d  ,
,
,
 
)
game::VARP ( showservinfo  ,
,
,
 
)
game::VARP ( showclientnum  ,
,
,
 
)
game::VARP ( showpj  ,
,
,
 
)
game::VARP ( capturetether  ,
,
,
 
)
game::VARP ( autorepammo  ,
,
,
 
)
game::VARP ( showping  ,
,
,
 
)
game::VARP ( showbombs  ,
,
,
 
)
game::VARP ( showspectators  ,
,
,
 
)
game::VARP ( basenumbers  ,
,
,
 
)
game::VARP ( showflags  ,
,
,
 
)
game::VARP ( showbombradius  ,
,
,
 
)
game::VARP ( showbombdelay  ,
,
,
 
)
game::VARP ( showfrags  ,
,
,
 
)
game::VARP ( showminimapobstacles  ,
,
,
 
)
game::VARP ( showaccuracy  ,
,
,
 
)
game::VARP ( highlightscore  ,
,
,
 
)
game::VARP ( showconnecting  ,
,
,
 
)
game::VARP ( ragdoll  ,
,
,
 
)
game::VARP ( ragdollmillis  ,
,
10000  ,
300000   
)
game::VARP ( ragdollfade  ,
,
1000  ,
300000   
)
game::VARP ( forceplayermodels  ,
,
,
 
)
game::VARP ( hidedead  ,
,
,
 
)
game::VARP ( maxdebris  ,
10  ,
25  ,
1000   
)
game::VARP ( maxbarreldebris  ,
,
10  ,
1000   
)
game::VARP ( minradarscale  ,
,
384  ,
10000   
)

minimap and radar

radar and minimap settings

game::VARP ( maxradarscale  ,
,
1024  ,
10000   
)
game::VARP ( radarteammates  ,
,
,
 
)
game::VARP ( teamskins  ,
,
,
 
)
game::VARP ( deadpush  ,
,
,
20   
)

push dead bodies (?)

game::VARP ( smoothmove  ,
,
75  ,
100   
)

interpolation factor for player positions low smoothmove means jumpily player movement

game::VARP ( smoothdist  ,
,
32  ,
64   
)

distance in which interpolation will be applied (?)

game::VARP ( hudgun  ,
,
,
 
)
game::VARP ( hudgunsway  ,
,
,
 
)
game::VARP ( teamhudguns  ,
,
,
 
)
game::VARP ( chainsawhudgun  ,
,
,
 
)
game::VARP ( spawnwait  ,
,
,
1000   
)
game::VARP ( blood  ,
,
,
 
)
game::VARP ( hitsound  ,
,
,
 
)
game::VARP ( deathscore  ,
,
,
 
)
game::VARP ( teamcolorfrags  ,
,
,
 
)

highlight frags in team colors

game::VARP ( showmodeinfo  ,
,
,
 
)

show game mode description text during map load

game::VARP ( muzzleflash  ,
,
,
 
)
game::VARP ( muzzlelight  ,
,
,
 
)
game::VARP ( teamcolortext  ,
,
,
 
)

color team names in frag notifications in game console in red/blue, depending on my team

game::VARP ( ammohud  ,
,
,
 
)

decide if you want to display the little icons of your other weapons in the slot

game::VARP ( bombcolliderad  ,
,
16  ,
1000   
)
game::VARP ( bombbarrier  ,
,
,
 
)
game::VARP ( teamcrosshair  ,
,
,
 
)

use blue blocking crosshair when pointing at a teamate

game::VARP ( hitcrosshair  ,
,
425  ,
1000   
)

displaying a hit crosshair increases the players hit impression ('feel')

void game::vartrigger ( ident id)

change map vars in edit mode in multiplayer

access memory storage union depending on var type

print my own change as well

References addmsg(), ID_FVAR, ID_SVAR, ID_VAR, m_edit, N_EDITVAR, ident::name, player1, printvar(), and ident::type.

Referenced by setfvarchecked(), setsvarchecked(), and setvarchecked().

bool game::weaponcollide ( physent d,
const vec dir 
)
void game::weaponswitch ( fpsent d)
void game::writeclientinfo ( stream f)

write my player name to a stream

See Also
escapestring

References escapestring(), fpsent::name, player1, and stream::printf().

Referenced by writecfg().

void game::writegamedata ( vector< char > &  extras)

Referenced by save_world().

Variable Documentation

int game::ammohudcycle[8] = { -1, -1, -1, -1, -1, -1, -1, -1 }
int game::ammohuddown[3] = { GUN_RIFLE, GUN_SG, GUN_PISTOL }
int game::ammohudup[3] = { GUN_CG, GUN_RL, GUN_GL }

this static data is used to describe the sorting of the 3 next weapons in your holster preview.

Referenced by drawammohud().

vector<fpsent *> game::bestplayers

Referenced by rendergame(), and renderplayer().

vector<const char *> game::bestteams

Referenced by rendergame(), and renderplayer().

bombclientmode game::bombmode

Referenced by server::changemap(), and setclientmode().

vector< bouncer * > game::bouncers
captureclientmode game::capturemode

Referenced by server::changemap(), and setclientmode().

SharedVar<int> game::chainsawhudgun
string game::clientmap = ""
vector< fpsent * > game::clients
clientmode * game::cmode = nullptr
collectclientmode game::collectmode

Referenced by setclientmode().

bool game::connected = false
string game::connectmapwish = ""
int game::connectmodewish = -1
string game::connectpass = ""
ctfclientmode game::ctfmode

Referenced by server::changemap(), and setclientmode().

SharedVar<int> game::deathscore

Referenced by deathstate(), and parsemessages().

const char* const game::debrisnames[4] = { "particle/debris/debris01", "particle/debris/debris02", "particle/debris/debris03", "particle/debris/debris04" }
static
bool game::demoplayback = false
int game::followdir = 0
int game::following = -1
bool game::gamepaused = false
int game::gamespeed = 100
const char* const game::gibnames[3] = { "particle/gibs/gib01", "particle/gibs/gib02", "particle/gibs/gib03" }
static
vector<scoregroup *> game::groups
static

Referenced by groupplayers(), and renderscoreboard().

game::hudent game::guninterp

Referenced by drawhudmodel().

hideandseekclientmode game::hideandseekmode

Referenced by server::changemap(), and setclientmode().

vector<hitmsg> game::hits
vector<int> game::ignores

a vector of ignored client numbers (cns)

Referenced by gamedisconnect(), ignore(), isignored(), and unignore().

bool game::intermission = false
float game::intersectdist = 1e16f
int game::lasthit = 0
int game::lastping = 0

Referenced by sendmessages().

int game::lastspawnattempt = 0
int game::maplimit = -1
int game::maprealtime = 0

Referenced by startgame(), and updateworld().

int game::maptime = 0
int game::mastermode = MM_OPEN

Referenced by gamedisconnect(), and parsemessages().

int game::messagecn = -1
int game::messagereliable = false
vector< uchar > game::messages

collect client to server messages conveniently

Referenced by addmsg(), edittrigger(), gamedisconnect(), and sendmessages().

SharedVar<float> game::minimapalpha
const int game::MONSTERDAMAGEFACTOR = 4
static

Referenced by raydamage(), and updateprojectiles().

vector< movable * > game::movables
int game::needclipboard = -1
int game::nextmode = INT_MAX
const int game::OFFSETMILLIS = 500
static
int game::paused
fpsent * game::player1 = nullptr

Referenced by addmsg(), ai::avoid(), game::collectclientmode::baseeffect(), game::collectclientmode::baseexplosion(), broadcastfov(), canjump(), changedplayermodel(), game::captureclientmode::checkitems(), entities::checkquad(), entities::checktriggers(), ai::cleanwaypoints(), cleardemos(), collidecamera(), colorname(), cycleweapon(), damaged(), deathstate(), ai::delselwaypoints(), game::collectclientmode::deposittokens(), doattack(), game::collectclientmode::drawbaseblip(), game::ctfclientmode::drawblip(), game::captureclientmode::drawblips(), game::bombclientmode::drawhud(), game::ctfclientmode::drawhud(), game::collectclientmode::drawhud(), game::captureclientmode::drawhud(), drawhudgun(), drawhudmodel(), game::collectclientmode::droptoken(), duplicatename(), edittoggled(), entities::fixentity(), game::ctfclientmode::flageffect(), game::ctfclientmode::flagexplosion(), follow(), followingplayer(), gamedisconnect(), gameplayhud(), getclient(), getclienticon(), getplayermodelinfo(), gotoplayer(), gotosel(), hashpwd(), hit(), hudplayer(), ignore(), ai::init(), initclient(), game::hideandseekclientmode::isinvisible(), entities::jumppadeffects(), kick(), game::bombclientmode::killed(), killed(), listclients(), ai::movewaypoints(), msgsound(), newclient(), nextfollow(), nextweapon(), otherplayers(), game::collectclientmode::parse_network_message(), game::captureclientmode::parse_network_message(), game::ctfclientmode::parse_network_message(), game::ctfclientmode::parseflags(), parsemessages(), parseplayer(), parsestate(), game::collectclientmode::parsetokens(), physicstrigger(), game::hideandseekclientmode::pickspawn(), entities::pickupeffects(), pointatplayer(), preloadweapons(), printname(), printteam(), game::captureclientmode::receiveammo(), recorddemo(), game::captureclientmode::rendergame(), game::collectclientmode::rendergame(), game::ctfclientmode::rendergame(), rendergame(), game::bombclientmode::renderplayersposindicator(), renderscoreboard(), game::captureclientmode::rendertether(), game::captureclientmode::replenishammo(), respawn(), respawnself(), saveragdoll(), sayprivate(), sayteam(), game::ctfclientmode::scoreflag(), sendintro(), sendmap(), sendmapinfo(), sendpositions(), setmaster(), game::captureclientmode::setscore(), setupcamera(), setweapon(), shoot(), spawnplayer(), startgame(), startmap(), game::collectclientmode::stealtoken(), stopdemo(), game::movable::suicide(), suicide(), switchname(), switchplayermodel(), switchteam(), game::collectclientmode::taketoken(), taunt(), teamcolor(), teamcolorname(), entities::teleporteffects(), timeupdate(), togglespectator(), toserver(), game::ctfclientmode::trydropflag(), entities::trypickup(), game::captureclientmode::updatebase(), updatepos(), updateweapons(), updateworld(), vartrigger(), and writeclientinfo().

SharedVar<int> game::playermodel
const playermodelinfo game::playermodels[2]
static
Initial value:
=
{
{ "player/mrfixit2", "player/mrfixit2/blue", "player/mrfixit2/red", "player/mrfixit2/hudgun", nullptr, "player/mrfixit2/horns", { "player/mrfixit2/armor/blue", "player/mrfixit2/armor/green", "player/mrfixit2/armor/yellow" }, "mrfixit2", "mrfixit2_blue", "mrfixit2_red", true },
{ "player/ironsnoutx10k", "player/ironsnoutx10k/blue", "player/ironsnoutx10k/red", "player/ironsnoutx10k/hudgun", nullptr, "player/ironsnoutx10k/wings", { "player/ironsnoutx10k/armor/blue", "player/ironsnoutx10k/armor/green", "player/ironsnoutx10k/armor/yellow" }, "ironsnoutx10k", "ironsnoutx10k_blue", "ironsnoutx10k_red", true },
}

Referenced by chooserandomplayermodel(), getplayermodelinfo(), and preloadplayermodel().

vector< fpsent * > game::players
const char* const game::projnames[3] = { "projectile/grenade", "projectile/rocket", "projectile/bomb" }
static
vector< projectile > game::projs

Referenced by avoidweapons(), and renderprojectiles().

vector<fpsent *> game::ragdolls
vec game::rays[MAXRAYS]
int game::respawnent = -1
int game::savedammo[NUMGUNS]

Referenced by deathstate().

game::scoreboardgui game::scoreboard

Referenced by g3d_gamemenus(), and showscores().

bool game::sendcrc = false
bool game::senditemstoserver = false

after a map change, since server doesn't have map data

Referenced by changemapserv(), gamedisconnect(), parsemessages(), sendmapinfo(), and sendmessages().

string game::servinfo = ""

Referenced by parsemessages(), and renderscoreboard().

int game::sessionid = 0
SharedVar<int> game::showminimapobstacles
SharedVar<int> game::smoothdist

Referenced by parsepositions().