ef47b0c6c8d00f180394f9f882d6bac61950d80d
[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 (entity this);
21
22 void teleport_findtarget(entity this);
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(entity this, entity actor, entity trigger);
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 #endif
66
67 void WarpZone_PostTeleportPlayer_Callback(entity pl);
68
69 #ifdef CSQC
70 .entity realowner;
71 .float lastteleporttime;
72
73 #define TDEATHLOOP(o) \
74         entity head; \
75         vector deathmin; \
76         vector deathmax; \
77         float deathradius; \
78         deathmin = (o) + player.mins; \
79         deathmax = (o) + player.maxs; \
80         if(telefragmin != telefragmax) \
81         { \
82                 if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
83                 if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
84                 if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
85                 if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
86                 if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
87                 if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
88         } \
89         deathradius = max(vlen(deathmin), vlen(deathmax)); \
90         for(head = findradius(o, deathradius); head; head = head.chain) \
91                 if(head != player) \
92                         if(head.isplayermodel) \
93                                 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
94 #endif
95
96 #endif