Libprimis
Imprimis' 3D destroyable world engine
Loading...
Searching...
No Matches
ents.h
Go to the documentation of this file.
1
12#ifndef ENTS_H_
13#define ENTS_H_
14
15//constants
16constexpr int maxents = 10000;
17constexpr int crouchtime = 200;
18constexpr float crouchheight = 0.75f;
19constexpr int maxanimparts = 3;
20//forward declarations for some internal engine parts of objects
21struct occludequery;
22class ragdolldata;
23class model;
24
25enum
26{
27 Anim_Mapmodel = 0,
28 Anim_GameSpecific
29};
30
31enum
32{
33 Anim_All = 0x1FF,
34 Anim_Index = 0x1FF,
35 Anim_Loop = (1 << 9),
36 Anim_Clamp = (1 << 10),
37 Anim_Reverse = (1 << 11),
38 Anim_Start = (Anim_Loop | Anim_Clamp),
39 Anim_End = (Anim_Loop | Anim_Clamp | Anim_Reverse),
40 Anim_Dir = 0xE00,
41 Anim_Secondary = 12,
42 Anim_Reuse = 0xFFFFFF,
43 Anim_NoSkin = (1 << 24),
44 Anim_SetTime = (1 << 25),
45 Anim_FullBright = (1 << 26),
46 Anim_NoRender = (1 << 27),
47 Anim_Ragdoll = (1 << 28),
48 Anim_SetSpeed = (1 << 29),
49 Anim_NoPitch = (1 << 30),
50 Anim_Flags = 0xFF000000,
51};
52
53enum
54{
55 EngineEnt_Empty=0,
56 EngineEnt_Light,
57 EngineEnt_Mapmodel,
58 EngineEnt_Playerstart,
59 EngineEnt_Particles,
60 EngineEnt_Sound,
61 EngineEnt_Spotlight,
62 EngineEnt_Decal,
63 EngineEnt_GameSpecific,
64};
65
66enum
67{
68 PhysEntState_Float = 0,
69 PhysEntState_Fall,
70 PhysEntState_Slide,
71 PhysEntState_Slope,
72 PhysEntState_Floor,
73 PhysEntState_StepUp,
74 PhysEntState_StepDown,
75 PhysEntState_Bounce,
76};
77
81struct entity
82{
84 short attr1, attr2, attr3, attr4, attr5;
85 uchar type;
86 uchar reserved;
87};
88
93{
94 int flags;
95 extentity *attached;
96
97 extentity();
98
99 bool spawned() const;
100 void setspawned(bool val);
101 void setspawned();
102 void clearspawned();
103};
104
111{
112 vec o, vel, falling;
113 vec deltapos, newpos;
114 float yaw, pitch, roll;
115 float maxspeed;
116 int timeinair;
117 float radius, eyeheight, maxheight, aboveeye;
118 float xradius, yradius, zmargin;
121 int inwater;
122 bool jumping;
123
124 // The velocity type: `move` is movement along camera axis while `strafe` is
125 // side-to-side movement perpendicular to camera axis.
126 char move, strafe, crouching;
127
128 uchar physstate;
129 uchar state, editstate;
131 enum
132 {
133 PhysEnt_Player = 0,
134 PhysEnt_Camera,
135 PhysEnt_Bounce,
136 };
137 uchar type;
140 bool blocked;
142 physent();
143
144 void resetinterp();
145 void reset();
146 vec feetpos(float offset = 0) const;
147 vec headpos(float offset = 0) const;
148 bool crouched() const;
149};
150
154struct modelattach final
155{
156 const char *tag, *name;
157 int anim, basetime;
158 vec *pos;
159 model *m;
160
161 modelattach();
162 modelattach(const char *tag, const char *name, int anim = -1, int basetime = 0);
163 modelattach(const char *tag, vec *pos);
164};
165
169struct animinfo final
170{
171 int anim, frame, range, basetime;
172 float speed;
173 uint varseed;
174
175 animinfo();
176 bool operator==(const animinfo &o) const;
177 bool operator!=(const animinfo &o) const;
178};
179
183struct animinterpinfo final
184{
185 animinfo prev, cur;
186 int lastswitch;
187 void *lastmodel;
188
190 void reset();
191};
192
197{
198 bool k_left,
203 animinterpinfo animinterp[maxanimparts];
204 ragdolldata *ragdoll;
205 occludequery *query;
206 int lastrendered;
207
208 dynent();
209 ~dynent();
210
211 void stopmoving();
212 void reset();
213 vec abovehead() const;
214};
215
216#endif /* ENTS_H_ */
description of a character's animation
Definition ents.h:170
used for animation blending of animated characters
Definition ents.h:184
Definition ents.h:197
bool k_down
Definition ents.h:201
bool k_right
Definition ents.h:199
bool k_left
Definition ents.h:198
bool k_up
Definition ents.h:200
Entity data capable of being saved to disk.
Definition ents.h:82
vec o
Definition ents.h:83
short attr5
Definition ents.h:84
uchar type
Definition ents.h:85
Extended entity data not of the subset which is saved to disk.
Definition ents.h:93
An representation of a model attachment (e.g. weapon to player).
Definition ents.h:155
A base object representing a class.
Definition ents.h:111
vec floor
Definition ents.h:119
vec falling
Definition ents.h:112
float aboveeye
Definition ents.h:117
bool blocked
Definition ents.h:140
vec newpos
Definition ents.h:113
float maxspeed
Definition ents.h:115
uchar type
Definition ents.h:137
uchar editstate
Definition ents.h:129
uchar collidetype
Definition ents.h:138
uchar physstate
Definition ents.h:128
three dimensional Cartesian vector object
Definition geom.h:185