]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/animdecide.qh
Factor out animation decisions and gameplay
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / animdecide.qh
1 // client side frame inferring
2 void animdecide_init(entity e);
3 void animdecide_setframes(entity e, float support_blending);
4
5 // please network this one
6 .float anim_state;
7 .float anim_time;
8 #define ReadAnimState() do { self.anim_state = ReadByte(); self.anim_time = ReadApproxPastTime(); } while(0)
9 #define WriteAnimState(dest) do { WriteByte(dest, self.anim_state); WriteApproxPastTime(dest, self.anim_time); } while(0)
10
11 // explicit anim states (networked)
12 void animdecide_setstate(entity e, float newstate, float restart);
13 #define ANIMSTATE_DEAD1 1 // base frames: die1
14 #define ANIMSTATE_DEAD2 2 // base frames: die2
15 #define ANIMSTATE_DUCK 4 // turns walk into duckwalk, jump into duckjump, etc.
16 #define ANIMSTATE_FROZEN 8 // force idle
17
18 // implicit anim states (inferred from velocity, etc.)
19 #define ANIMIMPLICITSTATE_RUN 1
20 #define ANIMIMPLICITSTATE_FORWARD 2
21 #define ANIMIMPLICITSTATE_BACKWARDS 4
22 #define ANIMIMPLICITSTATE_LEFT 8
23 #define ANIMIMPLICITSTATE_RIGHT 16
24
25 // explicit actions (networked); negative values are for lower body
26 void animdecide_setaction(entity e, float action, float restart);
27 #define ANIMACTION_JUMP -1 // jump
28 #define ANIMACTION_DRAW 1 // draw
29 #define ANIMACTION_PAIN1 2 // pain
30 #define ANIMACTION_PAIN2 3 // pain
31 #define ANIMACTION_SHOOT 4 // shoot
32 #define ANIMACTION_TAUNT 5 // taunt
33 #define ANIMACTION_MELEE 6 // melee