Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fps.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "inexor/network/SharedVar.hpp" // for SharedVar
4 #include "inexor/shared/cube_types.hpp" // for string
5 #include "inexor/shared/cube_vector.hpp" // for vector
6 
7 struct dynent;
8 struct fpsent;
9 struct physent;
10 struct vec;
11 
12 namespace game
13 {
14  // fps
15  extern int nextmode;
16  extern string clientmap;
17  extern bool intermission;
18  extern int maptime, maprealtime, maplimit;
19  extern fpsent *player1;
21  extern int lastspawnattempt;
22  extern int lasthit;
23  extern int respawnent;
24  extern int following;
26 
27  extern bool clientoption(const char *arg);
28  extern fpsent *getclient(int cn);
29  extern fpsent *newclient(int cn);
30  extern const char *colorname(fpsent *d, const char *name = nullptr, const char *prefix = "", const char *alt = nullptr);
31  extern const char *teamcolorname(fpsent *d, const char *alt = "you");
32  extern const char *teamcolor(const char *name, bool sameteam, const char *alt = nullptr);
33  extern const char *teamcolor(const char *name, const char *team, const char *alt = nullptr);
34  extern fpsent *pointatplayer();
35  extern fpsent *hudplayer();
36  extern fpsent *followingplayer();
37  extern void stopfollowing();
38  extern void clientdisconnected(int cn, bool notify = true);
39  extern void clearclients(bool notify = true);
40  extern void startgame();
41  extern void spawnplayer(fpsent *);
42  extern void deathstate(fpsent *d, bool restore = false);
43  extern void damaged(int damage, fpsent *d, fpsent *actor, bool local = true);
44  extern void killed(fpsent *d, fpsent *actor);
45  extern void timeupdate(int timeremain);
46  extern void msgsound(int n, physent *d = nullptr);
47  extern void drawicon(int icon, float x, float y, float sz = 120);
48 
49  extern int getfollowingfov();
50  extern void updateworld();
51  extern void initclient();
52  extern void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material = 0);
53  extern void dynentcollide(physent *d, physent *o, const vec &dir);
54  extern const char *getclientmap();
55  extern const char *getclientmode();
56  extern void resetgamestate();
57  extern void suicide(physent *d);
58  extern void startmap(const char *name);
59  extern float abovegameplayhud(int w, int h);
60  extern void gameplayhud(int w, int h);
61  extern bool canjump();
62  extern bool allowmove(physent *d);
63  extern void doattack(bool on);
64  extern dynent *iterdynents(int i);
65  extern int numdynents();
66  extern void writegamedata(vector<char> &extras);
67  extern void readgamedata(vector<char> &extras);
68  extern int clipconsole(int w, int h);
69  extern const char *defaultcrosshair(int index);
70  extern int selectcrosshair(vec &color);
71  extern void lighteffects(dynent *d, vec &color, vec &dir);
72  extern void setupcamera();
73  extern bool detachcamera();
74  extern bool collidecamera();
75  extern bool needminimap();
76 }
fpsent * pointatplayer()
Give me the player I am aiming at.
Definition: fps.cpp:172
void setupcamera()
initialise camera when entering spectator mode
Definition: fps.cpp:215
void lighteffects(dynent *e, vec &color, vec &dir)
Definition: fps.cpp:1121
void updateworld()
called in game loop to the update game world
Definition: fps.cpp:319
void drawicon(int icon, float x, float y, float sz)
draw (blit) item texture (weapon, flags, armours, quad) on screen at x,y
Definition: fps.cpp:858
void suicide(physent *d)
suicide your player
Definition: fps.cpp:836
fpsent * player1
Definition: fps.cpp:61
bool detachcamera()
check if it is neccesary to detach the camera from first person view to third person view...
Definition: fps.cpp:230
int maplimit
Definition: fps.cpp:65
Definition: material.cpp:178
fpsent * newclient(int cn)
ensure new client is a valid entity
Definition: fps.cpp:584
bool needminimap()
checks if minimap is required for this game mode
Definition: fps.cpp:852
int maptime
Definition: fps.cpp:65
void msgsound(int n, physent *d)
play sound and send sound notification to server
Definition: fps.cpp:748
int maprealtime
Definition: fps.cpp:65
void timeupdate(int secs)
update game session time display intermission statistics in console
Definition: fps.cpp:543
void damaged(int damage, fpsent *d, fpsent *actor, bool local)
an fpsent (player/monster/bot) took damage
Definition: fps.cpp:432
bool clientoption(const char *arg)
vector< fpsent * > players
our client
Definition: fps.cpp:62
bool collidecamera()
check if camera collision detection is neccesary
Definition: fps.cpp:238
void stopfollowing()
stop spectating a specific player and start free camery fly
Definition: fps.cpp:179
const char * getclientmode()
Definition: fps.cpp:717
int following
Definition: fps.cpp:68
void readgamedata(vector< char > &extras)
Definition: fps.cpp:1139
const char * getclientmap()
get client map name
Definition: fps.cpp:136
int lastspawnattempt
Definition: fps.cpp:67
const char * defaultcrosshair(int index)
Definition: fps.cpp:1081
Definition: ents.hpp:128
void killed(fpsent *d, fpsent *actor)
this callback is called when player actor kills d prints death messages to all kind of consoles ...
Definition: fps.cpp:495
float abovegameplayhud(int w, int h)
calculate distance of hud from bottom of my screen depending on player state referenced only in gl_dr...
Definition: fps.cpp:874
int getfollowingfov()
Receive the fov the currently followed player got or -1 on failure.
Definition: fps.cpp:197
fpsent * followingplayer()
Give me the fpsent instance of the player you are currently spectating.
Definition: fps.cpp:188
void clientdisconnected(int cn, bool notify)
notify my client to change data when another clients disconnect
Definition: fps.cpp:614
GLuint index
Definition: glexts.hpp:412
int lasthit
Definition: fps.cpp:67
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
bool intermission
other clients
Definition: fps.cpp:64
void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material)
trigger sound effects depending on the material you enter
Definition: fps.cpp:723
void gameplayhud(int w, int h)
render game hud depending on hudplayer's state and "SPECTATOR" in spectator mode
Definition: fps.cpp:1028
int d
Definition: octaedit.cpp:1749
string clientmap
Definition: client.cpp:580
void dynentcollide(physent *d, physent *o, const vec &dir)
push monsters (or objects) together when they hit walls or other objects
Definition: fps.cpp:738
int selectcrosshair(vec &color)
switch crosshair depending on player state and player health
Definition: fps.cpp:1092
Definition: ents.hpp:258
vector< fpsent * > clients
other clients connected to this server
Definition: fps.cpp:581
#define dir(name, v, d, s, os)
Definition: physics.cpp:2014
void spawnplayer(fpsent *d)
spawn yourself im the game world, also called for monsters/AI in singleplayer of course not used for ...
Definition: fps.cpp:363
SharedVar< int > smoothdist
SharedVar< int > smoothmove
void clearclients(bool notify)
delete all clients
Definition: fps.cpp:639
Definition: fpsent.hpp:12
int nextmode
Definition: client.cpp:579
dynent * iterdynents(int i)
iterate through all dynamic entities and return entity with index [i] You put the list in and get it ...
Definition: fps.cpp:770
void startmap(const char *name)
called just after a map load send CRC32 to server
Definition: fps.cpp:702
int numdynents()
return the sum of dynamic entities currently in scene
Definition: fps.cpp:764
SharedVar wrapper for primitive/immutable objects.
Definition: SharedVar.hpp:55
void doattack(bool on)
filter attack attempts not possible in intermission or if player's state is CS_DEAD ...
Definition: fps.cpp:404
void resetgamestate()
reset game state in singleplayer reset all monsters, triggers, bouncers, movables, and projectiles
Definition: fps.cpp:143
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 (du...
Definition: fps.cpp:799
const char * teamcolorname(fpsent *d, const char *alt)
color name depending on my team in red or blue
Definition: fps.cpp:813
void startgame()
clear all game data to start a new game
Definition: fps.cpp:655
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
Definition: fps.cpp:821
static void color(const bvec &v, uchar alpha=255)
Definition: glemu.hpp:71
fpsent * hudplayer()
Give me the fpsent instance of the player whose coordinates will be used to calculate my camera's pos...
Definition: fps.cpp:206
fpsent * getclient(int cn)
access fpsent object safely using index
Definition: fps.cpp:607
void writegamedata(vector< char > &extras)
Definition: fps.cpp:1138
void initclient()
Definition: fps.cpp:644
bool allowmove(physent *d)
check if I am allowed to move
Definition: fps.cpp:421
bool canjump()
check if I am allowed to jump at the moment called every time before jump command is executed ...
Definition: fps.cpp:413
void deathstate(fpsent *d, bool restore)
mark players as dead and update their state data
Definition: fps.cpp:463
int clipconsole(int w, int h)
Definition: fps.cpp:1067
int respawnent
Definition: fps.cpp:66