~ubuntu-branches/ubuntu/oneiric/blobandconquer/oneiric

« back to all changes in this revision

Viewing changes to src/game/CEntity.h

  • Committer: Bazaar Package Importer
  • Author(s): Guus Sliepen
  • Date: 2008-06-15 12:04:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080615120429-5ss7cbb4z9mpywj5
Tags: 0.95-1
New upstream release. Closes: #486310

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Copyright (C) 2006 Parallel Realities
3
 
 
4
 
This program is free software; you can redistribute it and/or
5
 
modify it under the terms of the GNU General Public License
6
 
as published by the Free Software Foundation; either version 2
7
 
of the License, or (at your option) any later version.
8
 
 
9
 
This program is distributed in the hope that it will be useful,
10
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
 
 
13
 
See the GNU General Public License for more details.
14
 
 
15
 
You should have received a copy of the GNU General Public License
16
 
along with this program; if not, write to the Free Software
17
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 
19
 
*/
20
 
 
21
 
class Entity : public Linkable {
22
 
 
23
 
        protected:
24
 
 
25
 
                unsigned int uniqueId;
26
 
                
27
 
                // can't be called directly
28
 
                virtual void loadAdditional(Properties *p) = 0;
29
 
                virtual void saveAdditional(Properties *p) = 0;
30
 
 
31
 
        public:
32
 
 
33
 
                String name;
34
 
                
35
 
                int entityType;
36
 
                
37
 
                int contentType;
38
 
                
39
 
                float health, maxHealth;
40
 
                
41
 
                int movementType;
42
 
                
43
 
                int currentAnimFrame;
44
 
                int nextAnimFrame;
45
 
                float animationTimer;
46
 
                Animation *currentAnim;
47
 
                
48
 
                float scale;
49
 
                
50
 
                Vector velocity;
51
 
                Vector position;
52
 
                Vector destination;
53
 
                Vector rotation;
54
 
                
55
 
                Vector oldPosition;
56
 
                Vector realVelocity;
57
 
                
58
 
                bool inCollisionCandidateList;
59
 
                BoundingBox boundingBox;
60
 
                
61
 
                // definitions
62
 
                EntityDef *definition;
63
 
                
64
 
                unsigned int ownerId;
65
 
                Entity *owner;
66
 
                String ownerName; // temporary storage
67
 
                
68
 
                // what the entity is standing on
69
 
                Entity *riding;
70
 
                
71
 
                float thinkTime;
72
 
                float custom;
73
 
                
74
 
                float elasticity;
75
 
                
76
 
                GLColor color;
77
 
                float heightAboveGround;
78
 
                
79
 
                bool referenced;
80
 
                
81
 
                long flags;
82
 
                
83
 
                String q3RadiantTargetName;
84
 
                String q3RadiantTarget;
85
 
                
86
 
                SDL_Rect occupiedRect;
87
 
                
88
 
                int cluster;
89
 
                
90
 
                Vector grapplingRopeVelocity;
91
 
                Vector grapplingRopePosition;
92
 
                
93
 
                void setOwner(Entity *owner);
94
 
                
95
 
                void (*action)(void);
96
 
                void (*die)(void);
97
 
                void (*walk)(void);
98
 
                void (*attack)(void);
99
 
                void (*touch)(Entity *other);
100
 
                void (*draw)(bool transparent, bool reflected);
101
 
 
102
 
        Entity();
103
 
 
104
 
        const unsigned int getUniqueId();
105
 
        void setName(const char *name);
106
 
        char *getName();
107
 
        char *getEntityTypeName();
108
 
        
109
 
        float getHealthPercent();
110
 
        
111
 
        bool performNextAction(float td);
112
 
        
113
 
        void applyGravity(float td);
114
 
        
115
 
        void prepareToMove(float td);
116
 
        void move(float td);
117
 
        
118
 
        void updateBoundingBox();
119
 
        
120
 
        void load(Properties *props);
121
 
        void save(FILE *fp);
122
 
 
123
 
};