All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Namespaces | Functions | Variables
fps.cpp File Reference
#include <string.h>
#include <algorithm>
#include <memory>
#include "SDL_opengl.h"
#include "inexor/client/gamemode/gamemode_client.hpp"
#include "inexor/client/network.hpp"
#include "inexor/engine/dynlight.hpp"
#include "inexor/engine/glemu.hpp"
#include "inexor/engine/material.hpp"
#include "inexor/engine/octaedit.hpp"
#include "inexor/engine/rendergl.hpp"
#include "inexor/engine/renderparticles.hpp"
#include "inexor/engine/rendertext.hpp"
#include "inexor/fpsgame/ai.hpp"
#include "inexor/fpsgame/client.hpp"
#include "inexor/fpsgame/entities.hpp"
#include "inexor/fpsgame/fps.hpp"
#include "inexor/fpsgame/fpsent.hpp"
#include "inexor/fpsgame/fpsstate.hpp"
#include "inexor/fpsgame/guns.hpp"
#include "inexor/fpsgame/movable.hpp"
#include "inexor/fpsgame/player.hpp"
#include "inexor/fpsgame/projectile.hpp"
#include "inexor/fpsgame/render.hpp"
#include "inexor/fpsgame/scoreboard.hpp"
#include "inexor/fpsgame/teaminfo.hpp"
#include "inexor/fpsgame/weapon.hpp"
#include "inexor/gamemode/gamemode.hpp"
#include "inexor/io/Logging.hpp"
#include "inexor/model/ragdoll.hpp"
#include "inexor/network/SharedVar.hpp"
#include "inexor/network/legacy/administration.hpp"
#include "inexor/network/legacy/cube_network.hpp"
#include "inexor/network/legacy/game_types.hpp"
#include "inexor/physics/physics.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_formatting.hpp"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_tools.hpp"
#include "inexor/shared/cube_vector.hpp"
#include "inexor/shared/ents.hpp"
#include "inexor/shared/geom.hpp"
#include "inexor/shared/tools.hpp"
#include "inexor/sound/sound.hpp"
#include "inexor/ui/legacy/3dgui.hpp"
#include "inexor/util/legacy_time.hpp"


 implementation of basic game functionsand cubescript bindings


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 More...
 game::COMMAND (taunt,"")
 game::ICOMMAND (getfollow,"",(),{fpsent *f=followingplayer();intret(f?f->clientnum:-1);})
 cubescript: get the player I am following More...
void game::follow (char *arg)
 follow a specific player if you are in spectator mode More...
 game::COMMAND (follow,"s")
void game::nextfollow (int dir)
 follow previous/next client number More...
 game::ICOMMAND (nextfollow,"i",(int *dir), nextfollow(*dir< 0?-1:1))
const char * game::getclientmap ()
 get client map name More...
void game::resetgamestate ()
 reset game state in singleplayer reset all monsters, triggers, bouncers, movables, and projectiles More...
fpsentgame::spawnstate (fpsent *d)
 reset player state not persistent accross spawns More...
void game::respawnself ()
 Send "I would like to spawn" to server. More...
fpsentgame::pointatplayer ()
 Give me the player I am aiming at. More...
void game::stopfollowing ()
 stop spectating a specific player and start free camery fly More...
fpsentgame::followingplayer ()
 Give me the fpsent instance of the player you are currently spectating. More...
int game::getfollowingfov ()
 Receive the fov the currently followed player got or -1 on failure. More...
 game::ICOMMAND (getfollowingfov,"",(), intret(getfollowingfov()))
fpsentgame::hudplayer ()
 Give me the fpsent instance of the player whose coordinates will be used to calculate my camera's position. More...
void game::setupcamera ()
 initialise camera when entering spectator mode More...
bool game::detachcamera ()
 check if it is neccesary to detach the camera from first person view to third person view. More...
bool game::collidecamera ()
 check if camera collision detection is neccesary More...
 game::VARP (smoothmove, 0, 75, 100)
 interpolation factor for player positions low smoothmove means jumpily player movement More...
 game::VARP (smoothdist, 0, 32, 64)
 distance in which interpolation will be applied (?) More...
void game::predictplayer (fpsent *d, bool move)
 use latency and assume player movement to predict a player's new position. More...
void game::otherplayers (int curtime)
 parse player state, move players, predict their position, handle ragdoll, check for lag More...
void game::updateworld ()
 called in game loop to the update game world More...
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. More...
 game::VARP (spawnwait, 0, 0, 1000)
void game::respawn (int gamemode=0)
 spawn myself in SP and DMSP game mode (singleplayer only) More...
void game::doattack (bool on)
 filter attack attempts not possible in intermission or if player's state is CS_DEAD More...
bool game::canjump ()
 check if I am allowed to jump at the moment called every time before jump command is executed More...
bool game::allowmove (physent *d)
 check if I am allowed to move More...
 game::VARP (hitsound, 0, 0, 1)
void game::damaged (int damage, fpsent *d, fpsent *actor, bool local)
 an fpsent (player/monster/bot) took damage More...
 game::VARP (deathscore, 0, 1, 1)
void game::deathstate (fpsent *d, bool restore)
 mark players as dead and update their state data More...
 game::VARP (teamcolorfrags, 0, 1, 1)
 highlight frags in team colors More...
void game::killed (fpsent *d, fpsent *actor)
 this callback is called when player actor kills d prints death messages to all kind of consoles More...
void game::timeupdate (int secs)
 update game session time display intermission statistics in console More...
 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 (getfrags,"",(), intret(player1->frags))
 return a player's statistics to cubescript More...
 game::ICOMMAND (getteamkills,"",(), intret(player1->teamkills))
 game::ICOMMAND (gettotaldamage,"",(), intret(player1->totaldamage))
 game::ICOMMAND (gettotalshots,"",(), intret(player1->totalshots))
fpsentgame::newclient (int cn)
 ensure new client is a valid entity More...
fpsentgame::getclient (int cn)
 access fpsent object safely using index More...
void game::clientdisconnected (int cn, bool notify)
 notify my client to change data when another clients disconnect More...
void game::clearclients (bool notify)
 delete all clients More...
void game::initclient ()
 game::VARP (showmodeinfo, 0, 1, 1)
 show game mode description text during map load More...
void game::startgame ()
 clear all game data to start a new game More...
void game::startmap (const char *name)
 called just after a map load send CRC32 to server More...
const char * game::getclientmode ()
void game::physicstrigger (physent *d, bool local, int floorlevel, int waterlevel, int material)
 trigger sound effects depending on the material you enter More...
void game::dynentcollide (physent *d, physent *o, const vec &dir)
 push monsters (or objects) together when they hit walls or other objects More...
void game::msgsound (int n, physent *d)
 play sound and send sound notification to server More...
int game::numdynents ()
 return the sum of dynamic entities currently in scene More...
dynentgame::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 More...
 game::VARP (teamcolortext, 0, 1, 1)
 color team names in frag notifications in game console in red/blue, depending on my team More...
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 More...
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) More...
const char * game::teamcolorname (fpsent *d, const char *alt)
 color name depending on my team in red or blue More...
const char * game::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 * 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 More...
void game::suicide (physent *d)
 suicide your player More...
 game::ICOMMAND (suicide,"",(), suicide(player1))
bool game::needminimap ()
 checks if minimap is required for this game mode More...
void game::drawicon (int icon, float x, float y, float sz)
 draw (blit) item texture (weapon, flags, armours, quad) on screen at x,y More...
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 More...
 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 More...
 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::VARP (ammohud, 0, 1, 1)
 decide if you want to display the little icons of your other weapons in the slot More...
void game::drawammohud (fpsent *d)
 draw other weapons in weapon slots beside the icon of the currently selected weapon More...
void game::drawhudicons (fpsent *d)
 draw health icon, armour icon and icon of selected gun other gun's preview icons are not included here More...
void game::drawhudannounce (int w, int h)
 draw announcement for upcoming pickup entities in BOMBERMAN mode More...
void game::gameplayhud (int w, int h)
 render game hud depending on hudplayer's state and "SPECTATOR" in spectator mode More...
int game::clipconsole (int w, int h)
 game::VARP (teamcrosshair, 0, 1, 1)
 use blue blocking crosshair when pointing at a teamate More...
 game::VARP (hitcrosshair, 0, 425, 1000)
 displaying a hit crosshair increases the players hit impression ('feel') More...
const char * game::defaultcrosshair (int index)
int game::selectcrosshair (vec &color)
 switch crosshair depending on player state and player health More...
void game::lighteffects (dynent *e, vec &color, vec &dir)
void game::writegamedata (vector< char > &extras)
void game::readgamedata (vector< char > &extras)


fpsentgame::player1 = nullptr
vector< fpsent * > game::players
 our client More...
bool game::intermission = false
 other clients More...
int game::maptime = 0
int game::maprealtime = 0
int game::maplimit = -1
int game::respawnent = -1
int game::lasthit = 0
int game::lastspawnattempt = 0
int game::following = -1
int game::followdir = 0
int game::savedammo [NUMGUNS]
vector< fpsent * > game::clients
 other clients connected to this server More...
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. More...
int game::ammohuddown [3] = { GUN_RIFLE, GUN_SG, GUN_PISTOL }
int game::ammohudcycle [8] = { -1, -1, -1, -1, -1, -1, -1, -1 }