]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mapobjects/trigger/jumppads.qh
Merge remote-tracking branch 'origin/Juhu/q3_jumppads' into morosophos/server-current4
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / trigger / jumppads.qh
1 #pragma once
2
3
4 const int PUSH_ONCE = BIT(0); // legacy, deactivate with relay instead
5 const int PUSH_SILENT = BIT(1); // not used?
6 #define PUSH_STATIC BIT(12) // xonotic-only, Q3 already behaves like this by default
7
8 #define PUSH_VELOCITY_PLAYERDIR_XY        BIT(0)
9 #define PUSH_VELOCITY_ADD_XY              BIT(1)
10 #define PUSH_VELOCITY_PLAYERDIR_Z         BIT(2)
11 #define PUSH_VELOCITY_ADD_Z               BIT(3)
12 #define PUSH_VELOCITY_BIDIRECTIONAL_XY    BIT(4)
13 #define PUSH_VELOCITY_BIDIRECTIONAL_Z     BIT(5)
14 #define PUSH_VELOCITY_CLAMP_NEGATIVE_ADDS BIT(6)
15
16 IntrusiveList g_jumppads;
17 STATIC_INIT(g_jumppads) { g_jumppads = IL_NEW(); }
18
19 .float pushltime;
20 .bool istypefrag;
21 .float height;
22
23 // maximum amount of jump pads which are allowed to push simultaneously
24 #define MAX_PUSHED 16
25
26 .entity has_pushed[MAX_PUSHED];
27 IntrusiveList are_pushed;
28 STATIC_INIT(are_pushed) { are_pushed = IL_NEW(); }
29
30 const int NUM_JUMPPADSUSED = 3;
31 .float jumppadcount;
32 .entity jumppadsused[NUM_JUMPPADSUSED];
33
34 #ifdef SVQC
35 void SUB_UseTargets(entity this, entity actor, entity trigger);
36 void trigger_push_use(entity this, entity actor, entity trigger);
37 bool trigger_push_testorigin(entity tracetest_ent, entity targ, entity jp, vector org);
38 bool trigger_push_testorigin_for_item(entity tracetest_ent, entity item, vector org);
39 #endif
40
41 /*
42         trigger_push_calculatevelocity
43
44         Arguments:
45           org - origin of the object which is to be pushed
46           tgt - target entity (can be either a point or a model entity; if it is
47                 the latter, its midpoint is used)
48           ht  - jump height, measured from the higher one of org and tgt's midpoint
49           pushed_entity - object that is to be pushed
50
51         Returns: velocity for the jump
52  */
53 vector trigger_push_calculatevelocity(vector org, entity tgt, float ht, entity pushed_entity);
54
55 void trigger_push_touch(entity this, entity toucher);
56
57 .vector dest;
58 bool trigger_push_test(entity this, entity item);
59 void trigger_push_findtarget(entity this);
60
61 /*
62  * ENTITY PARAMETERS trigger_push:
63  *
64  *   target:  target of jump
65  *   height:  the absolute value is the height of the highest point of the jump
66  *            trajectory above the higher one of the player and the target.
67  *            the sign indicates whether the highest point is INSIDE (positive)
68  *            or OUTSIDE (negative) of the jump trajectory. General rule: use
69  *            positive values for targets mounted on the floor, and use negative
70  *            values to target a point on the ceiling.
71  *   movedir: if target is not set, this * speed * 10 is the velocity to be reached.
72  */
73
74 /*
75  * ENTITY PARAMETERS trigger_push_velocity:
76  *
77  *   target:  this points to the target_position to which the player will jump.
78  *   speed:   XY speed for player-directional velocity pads - either sets or adds to the player's horizontal velocity.
79  *   count:   Z speed for player-directional velocity pads - either sets or adds to the player's vertical velocity.
80  */
81 #ifdef SVQC
82 spawnfunc(trigger_push);
83 spawnfunc(trigger_push_velocity);
84
85 spawnfunc(target_push);
86 spawnfunc(info_notnull);
87 spawnfunc(target_position);
88 #endif