Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
collect_client.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <algorithm> // for max
3 
4 #include "inexor/client/gamemode/gamemode_client.hpp" // for clientmode
5 #include "inexor/fpsgame/fpsent.hpp" // for fpsent
6 #include "inexor/gamemode/collect_common.hpp" // for collectmode_co...
7 #include "inexor/network/legacy/buffer_types.hpp" // for ucharbuf, pack...
8 #include "inexor/physics/physics.hpp" // for findplayerspawn
9 #include "inexor/shared/cube_vector.hpp" // for vector
10 #include "inexor/shared/geom.hpp" // for vec
11 #include "inexor/shared/tools.hpp" // for max
12 #include "inexor/util/legacy_time.hpp" // for lastmillis
13 
14 namespace ai {
15 struct aistate;
16 struct interest;
17 } // namespace ai
18 
19 namespace game {
20 
22 {
23  static const int TOKENHEIGHT = 5;
24 
25  token &droptoken(int id, const vec &o, int team, int droptime);
26 
27  void preload() override;
28 
29  void drawblip(fpsent *d, float x, float y, float s, const vec &pos, float size = 0.05f);
30 
31  void drawbaseblip(fpsent *d, float x, float y, float s, int i);
32 
33  int clipconsole(int w, int h) override
34  {
35  return (h*(1 + 1 + 10))/(4*10);
36  }
37 
38  void drawhud(fpsent *d, int w, int h) override;
39 
40  void rendergame() override;
41 
42  void setup() override;
43 
44  void senditems(packetbuf &p) override;
45 
46  vec movetoken(const vec &o, int yaw);
47 
48  void parsetokens(ucharbuf &p, bool commit);
49 
50  void baseexplosion(int i, int team, const vec &loc);
51 
52  void baseeffect(int i, int team, const vec &from, const vec &to, bool showfrom = true, bool showto = true);
53 
54  void expiretoken(int id);
55 
56  void taketoken(fpsent *d, int id, int total);
57 
58  token *droptoken(fpsent *d, int id, const vec &o, int team, int yaw, int n);
59 
60  void stealtoken(fpsent *d, int id, const vec &o, int team, int yaw, int n, int basenum, int enemyteam, int score);
61 
62  void deposittokens(fpsent *d, int basenum, int deposited, int team, int score, int flags);
63 
64  void checkitems(fpsent *d) override;
65 
66  int respawnwait(fpsent *d) override
67  {
68  return max(0, RESPAWNSECS-(lastmillis-d->lastpain)/1000);
69  }
70 
71  void pickspawn(fpsent *d) override
72  {
74  }
75 
76  bool aicheck(fpsent *d, ai::aistate &b) override;
77 
78  void aifind(fpsent *d, ai::aistate &b, vector<ai::interest> &interests) override;
79 
80  bool aipursue(fpsent *d, ai::aistate &b) override;
81 
82  bool parse_network_message(int type, ucharbuf &p) override;
83 };
84 
85 } // ns game
Vector template.
Definition: cube_vector.hpp:22
Definition: gamemode_client.hpp:25
const T & max(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:224
template implementation of buffers (networking e.g.).
Definition: buffer_types.hpp:14
void rendergame() override
Definition: collect_client.cpp:125
bool parse_network_message(int type, ucharbuf &p) override
Parse game mode specific network messages.
Definition: collect_client.cpp:436
void senditems(packetbuf &p) override
Definition: collect_client.cpp:187
void parsetokens(ucharbuf &p, bool commit)
Definition: collect_client.cpp:217
Definition: ai.hpp:174
#define collectteambase(s)
Definition: collect_common.hpp:10
void taketoken(fpsent *d, int id, int total)
Definition: collect_client.cpp:267
Definition: ai.hpp:166
ICOMMAND * f(float *a, float *b), floatret(*a **b)
int respawnwait(fpsent *d) override
Definition: collect_client.hpp:66
void preload() override
Definition: collect_client.cpp:42
void checkitems(fpsent *d) override
Definition: collect_client.cpp:337
void pickspawn(fpsent *d) override
Definition: collect_client.hpp:71
void setup() override
Definition: collect_client.cpp:169
void baseexplosion(int i, int team, const vec &loc)
Definition: collect_client.cpp:244
int lastmillis
Definition: legacy_time.cpp:14
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
bool aipursue(fpsent *d, ai::aistate &b) override
Definition: collect_client.cpp:421
void aifind(fpsent *d, ai::aistate &b, vector< ai::interest > &interests) override
Definition: collect_client.cpp:392
Definition: collect_client.hpp:21
static const int RESPAWNSECS
Definition: collect_common.hpp:24
void findplayerspawn(dynent *d, int forceent, int tag)
Definition: world.cpp:1234
int lastpain
Definition: fpsent.hpp:18
vec movetoken(const vec &o, int yaw)
Definition: collect_client.cpp:198
int d
Definition: octaedit.cpp:1749
void expiretoken(int id)
Definition: collect_client.cpp:260
int clipconsole(int w, int h) override
Definition: collect_client.hpp:33
static const int TOKENHEIGHT
Definition: collect_client.hpp:23
void stealtoken(fpsent *d, int id, const vec &o, int team, int yaw, int n, int basenum, int enemyteam, int score)
Definition: collect_client.cpp:297
GLuint GLuint GLintptr GLsizeiptr size
Definition: glexts.hpp:412
string team
Definition: fpsent.hpp:30
bool aicheck(fpsent *d, ai::aistate &b) override
Definition: collect_client.cpp:363
network packet buffer
Definition: buffer_types.hpp:132
uchar flags[MAXBRUSH][MAXBRUSH]
Definition: octaedit.cpp:1742
void drawhud(fpsent *d, int w, int h) override
Definition: collect_client.cpp:69
Definition: fpsent.hpp:12
void drawblip(fpsent *d, float x, float y, float s, const vec &pos, float size=0.05f)
Definition: collect_client.cpp:51
void baseeffect(int i, int team, const vec &from, const vec &to, bool showfrom=true, bool showto=true)
Definition: collect_client.cpp:253
void deposittokens(fpsent *d, int basenum, int deposited, int team, int score, int flags)
Definition: collect_client.cpp:314
token & droptoken(int id, const vec &o, int team, int droptime)
Definition: collect_client.cpp:36
void drawbaseblip(fpsent *d, float x, float y, float s, int i)
Definition: collect_client.cpp:63
mathmatics for vectors, matrices, quaterions and more
Definition: collect_common.hpp:14
Definition: collect_common.hpp:51