~ubuntu-branches/ubuntu/trusty/teeworlds/trusty-updates

« back to all changes in this revision

Viewing changes to src/game/server/entities/character.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Gonéri Le Bouder
  • Date: 2009-04-12 02:32:37 UTC
  • mfrom: (3.2.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090412023237-ufmf1xn0rkjmx6f3
Tags: 0.5.1-2
* Fix the ouput of teeworlds-server --help with /bin/sh ->
  /bin/bash (Closes: #511600)
* Standard version 3.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
 
2
 
 
3
#ifndef GAME_SERVER_ENTITY_CHARACTER_H
 
4
#define GAME_SERVER_ENTITY_CHARACTER_H
 
5
 
 
6
#include <game/server/entity.hpp>
 
7
#include <game/generated/gs_data.hpp>
 
8
#include <game/generated/g_protocol.hpp>
 
9
 
 
10
#include <game/gamecore.hpp>
 
11
 
 
12
enum
 
13
{
 
14
        WEAPON_GAME = -3, // team switching etc
 
15
        WEAPON_SELF = -2, // console kill command
 
16
        WEAPON_WORLD = -1, // death tiles etc
 
17
};
 
18
 
 
19
class CHARACTER : public ENTITY
 
20
{
 
21
        MACRO_ALLOC_POOL_ID()
 
22
public:
 
23
        // player controlling this character
 
24
        class PLAYER *player;
 
25
        
 
26
        bool alive;
 
27
 
 
28
        // weapon info
 
29
        ENTITY *hitobjects[10];
 
30
        int numobjectshit;
 
31
        struct WEAPONSTAT
 
32
        {
 
33
                int ammoregenstart;
 
34
                int ammo;
 
35
                int ammocost;
 
36
                bool got;
 
37
        } weapons[NUM_WEAPONS];
 
38
        
 
39
        int active_weapon;
 
40
        int last_weapon;
 
41
        int queued_weapon;
 
42
        
 
43
        int reload_timer;
 
44
        int attack_tick;
 
45
        
 
46
        int damage_taken;
 
47
 
 
48
        int emote_type;
 
49
        int emote_stop;
 
50
 
 
51
        // TODO: clean this up
 
52
        char skin_name[64];
 
53
        int use_custom_color;
 
54
        int color_body;
 
55
        int color_feet;
 
56
        
 
57
        int last_action; // last tick that the player took any action ie some input
 
58
 
 
59
        // these are non-heldback inputs
 
60
        NETOBJ_PLAYER_INPUT latest_previnput;
 
61
        NETOBJ_PLAYER_INPUT latest_input;
 
62
 
 
63
        // input        
 
64
        NETOBJ_PLAYER_INPUT previnput;
 
65
        NETOBJ_PLAYER_INPUT input;
 
66
        int num_inputs;
 
67
        int jumped;
 
68
        
 
69
        int damage_taken_tick;
 
70
 
 
71
        int health;
 
72
        int armor;
 
73
 
 
74
        // ninja
 
75
        struct
 
76
        {
 
77
                vec2 activationdir;
 
78
                int activationtick;
 
79
                int currentmovetime;
 
80
        } ninja;
 
81
 
 
82
        //
 
83
        //int score;
 
84
        int team;
 
85
        int player_state; // if the client is chatting, accessing a menu or so
 
86
 
 
87
        // the player core for the physics      
 
88
        CHARACTER_CORE core;
 
89
        
 
90
        // info for dead reckoning
 
91
        int reckoning_tick; // tick that we are performing dead reckoning from
 
92
        CHARACTER_CORE sendcore; // core that we should send
 
93
        CHARACTER_CORE reckoningcore; // the dead reckoning core
 
94
 
 
95
        //
 
96
        CHARACTER();
 
97
        
 
98
        virtual void reset();
 
99
        virtual void destroy();
 
100
                
 
101
        bool is_grounded();
 
102
        
 
103
        void set_weapon(int w);
 
104
        
 
105
        void handle_weaponswitch();
 
106
        void do_weaponswitch();
 
107
        
 
108
        int handle_weapons();
 
109
        int handle_ninja();
 
110
 
 
111
        void on_predicted_input(NETOBJ_PLAYER_INPUT *new_input);
 
112
        void on_direct_input(NETOBJ_PLAYER_INPUT *new_input);
 
113
        void fire_weapon();
 
114
 
 
115
        void die(int killer, int weapon);
 
116
 
 
117
        bool take_damage(vec2 force, int dmg, int from, int weapon);    
 
118
 
 
119
        
 
120
        bool spawn(PLAYER *player, vec2 pos, int team);
 
121
        //bool init_tryspawn(int team);
 
122
        bool remove();
 
123
 
 
124
        static const int phys_size = 28;
 
125
 
 
126
        virtual void tick();
 
127
        virtual void tick_defered();
 
128
        virtual void snap(int snapping_client);
 
129
        
 
130
        bool increase_health(int amount);
 
131
        bool increase_armor(int amount);
 
132
};
 
133
 
 
134
#endif