Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
fpsent.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 #include "inexor/shared/geom.hpp"
6 #include "inexor/sound/sound.hpp"
8 #include "inexor/fpsgame/ai.hpp"
9 #include "inexor/engine/octaedit.hpp" // for freeeditinfo
10 
11 // mostly players can be described with this
13 {
14  int weight; // affects the effectiveness of hitpush
16  int lifesequence; // sequence id for each respawn, used in damage test
18  int lastpain;
20  bool attacking;
22  int lasttaunt;
29 
30  string name, tag, team, info;
32  int fov; // field of view
33 
36 
38 
40  frags(0), flags(0), deaths(0), teamkills(0), totaldamage(0), totalshots(0), edit(nullptr), smoothmillis(-1), playermodel(-1), fov(100), ai(nullptr), ownernum(-1), muzzle(-1, -1, -1)
41  {
42  name[0] = team[0] = tag[0] = info[0] = 0;
43  respawn();
44  }
46  {
50  if(ai) delete ai;
51  }
52 
54  void hitpush(int damage, const vec &dir, fpsent *actor, int gun)
55  {
56  vec push(dir);
57  push.mul((actor==this && guns[gun].exprad ? EXP_SELFPUSH : 1.0f)*guns[gun].hitpush*damage/weight);
58  vel.add(push);
59  }
60 
63  {
65  attacksound = attackchan = -1;
66  }
67 
70  {
72  idlesound = idlechan = -1;
73  }
74 
76  void respawn()
77  {
78  dynent::reset();
80  respawned = suicided = -1;
81  lastaction = 0;
83  attacking = false;
84  lasttaunt = 0;
85  lastpickup = -1;
86  lastpickupmillis = 0;
87  lastbase = lastrepammo = -1;
88  flagpickup = 0;
89  tokens = 0;
90  lastcollect = vec(-1e10f, -1e10f, -1e10f);
92  lastnode = -1;
93  }
94 };
int tokens
Definition: fpsent.hpp:23
#define EXP_SELFPUSH
Definition: guns.hpp:8
int lastrepammo
Definition: fpsent.hpp:23
float deltaroll
Definition: fpsent.hpp:27
void respawn()
respawn item
Definition: fpsent.hpp:76
fpsent()
Definition: fpsent.hpp:39
Definition: administration.hpp:6
int idlesound
Definition: fpsent.hpp:21
int fov
Definition: fpsent.hpp:32
void reset()
Definition: ents.hpp:287
float newyaw
Definition: fpsent.hpp:27
float deltapitch
Definition: fpsent.hpp:27
string name
Definition: fpsent.hpp:30
int clientnum
Definition: fpsent.hpp:15
static const guninfo guns[NUMGUNS]
create an array of guninfo instances ('guns')
Definition: guns.hpp:83
string tag
Definition: fpsent.hpp:30
vec & mul(const vec &o)
scalar multiplication
Definition: geom.hpp:168
int attacksound
Definition: fpsent.hpp:21
int weight
Definition: fpsent.hpp:14
int gunselect
Definition: fpsstate.hpp:23
vec muzzle
Definition: fpsent.hpp:37
int lastnode
Definition: fpsent.hpp:35
int lastaction
Definition: fpsent.hpp:19
int idlechan
Definition: fpsent.hpp:21
bool stopsound(int n, int chanid, int fade)
Definition: sound.cpp:572
int privilege
Definition: fpsent.hpp:15
ICOMMAND * f(float *a, float *b), floatret(*a **b)
vec lastcollect
Definition: fpsent.hpp:24
int attackchan
Definition: fpsent.hpp:21
void freeeditinfo(editinfo *&e)
Definition: octaedit.cpp:1203
int flagpickup
Definition: fpsent.hpp:23
void stopidlesound()
Definition: fpsent.hpp:69
void stopattacksound()
Definition: fpsent.hpp:62
vector with 3 floats and some useful methods.
Definition: geom.hpp:110
int frags
Definition: fpsent.hpp:25
int totaldamage
Definition: fpsent.hpp:25
int ping
Definition: fpsent.hpp:15
int lastpickupmillis
Definition: fpsent.hpp:23
Definition: ai.hpp:194
int lastpain
Definition: fpsent.hpp:18
int lasttaunt
Definition: fpsent.hpp:22
Definition: ents.hpp:258
int suicided
Definition: fpsent.hpp:17
int respawned
Definition: fpsent.hpp:17
bool attacking
Definition: fpsent.hpp:20
#define dir(name, v, d, s, os)
Definition: physics.cpp:2014
int lastattackgun
Definition: fpsent.hpp:19
editinfo * edit
Definition: fpsent.hpp:26
void respawn()
reset all members when spawning
Definition: fpsstate.hpp:109
string team
Definition: fpsent.hpp:30
vec & add(const vec &o)
scalar sum
Definition: geom.hpp:174
int teamkills
Definition: fpsent.hpp:25
int lastupdate
Definition: fpsent.hpp:15
int lastpickup
Definition: fpsent.hpp:23
Definition: fpsent.hpp:12
int playermodel
Definition: fpsent.hpp:31
float deltayaw
Definition: fpsent.hpp:27
int totalshots
Definition: fpsent.hpp:25
int lifesequence
Definition: fpsent.hpp:16
int deaths
Definition: fpsent.hpp:25
Definition: octree.hpp:266
int plag
Definition: fpsent.hpp:15
int flags
Definition: fpsent.hpp:25
~fpsent()
Definition: fpsent.hpp:45
int smoothmillis
Definition: fpsent.hpp:28
mathmatics for vectors, matrices, quaterions and more
void hitpush(int damage, const vec &dir, fpsent *actor, int gun)
apply push event to object's velocity vector
Definition: fpsent.hpp:54
vec vel
Definition: ents.hpp:130
int lastbase
Definition: fpsent.hpp:23
ai::aiinfo * ai
Definition: fpsent.hpp:34
float newroll
Definition: fpsent.hpp:27
First person state.
Definition: fpsstate.hpp:18
int ownernum
Definition: fpsent.hpp:35
float newpitch
Definition: fpsent.hpp:27
string info
Definition: fpsent.hpp:30