fb31785e7fdc0901448110a45e109ee1c2eb0fe3
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / teleporters.qh
1 #ifndef T_TELEPORTERS_H
2 #define T_TELEPORTERS_H
3
4 .entity pusher;
5 const float TELEPORT_FLAG_SOUND = 1;
6 const float TELEPORT_FLAG_PARTICLES = 2;
7 const float TELEPORT_FLAG_TDEATH = 4;
8 const float TELEPORT_FLAG_FORCE_TDEATH = 8;
9
10 #define TELEPORT_FLAGS_WARPZONE   0
11 #define TELEPORT_FLAGS_PORTAL     (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH)
12 #define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH)
13
14 // types for .teleportable entity setting
15 const float TELEPORT_NORMAL = 1; // play sounds/effects etc
16 const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special
17
18 entity Simple_TeleportPlayer(entity teleporter, entity player);
19
20 void Teleport_Touch ();
21
22 void teleport_findtarget();
23
24 entity Teleport_Find(vector mi, vector ma);
25
26 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags);
27
28 entity teleport_first;
29 .entity teleport_next;
30
31 #ifdef SVQC
32
33 void trigger_teleport_use();
34
35 #define TDEATHLOOP(o) \
36         entity head; \
37         vector deathmin; \
38         vector deathmax; \
39         float deathradius; \
40         deathmin = (o) + player.mins; \
41         deathmax = (o) + player.maxs; \
42         if(telefragmin != telefragmax) \
43         { \
44                 if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
45                 if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
46                 if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
47                 if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
48                 if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
49                 if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
50         } \
51         deathradius = max(vlen(deathmin), vlen(deathmax)); \
52         for(head = findradius(o, deathradius); head; head = head.chain) \
53                 if(head != player) \
54                         if(head.takedamage) \
55                                 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
56
57 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax);
58 float tdeath_hit;
59 void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax);
60
61 void spawn_tdeath(vector v0, entity e, vector v);
62
63 void Reset_ArcBeam(entity player, vector forward);
64
65 void WarpZone_PostTeleportPlayer_Callback(entity pl);
66 #endif
67
68 #ifdef CSQC
69 #define TDEATHLOOP(o) \
70         entity head; \
71         vector deathmin; \
72         vector deathmax; \
73         float deathradius; \
74         deathmin = (o) + player.mins; \
75         deathmax = (o) + player.maxs; \
76         if(telefragmin != telefragmax) \
77         { \
78                 if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
79                 if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
80                 if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
81                 if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
82                 if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
83                 if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
84         } \
85         deathradius = max(vlen(deathmin), vlen(deathmax)); \
86         for(head = findradius(o, deathradius); head; head = head.chain) \
87                 if(head != player) \
88                         if(head.isplayermodel) \
89                                 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
90 #endif
91
92 #endif