Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
plat.qc File Reference
#include "plat.qh"
Include dependency graph for plat.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void plat_delayedinit (entity this)
void plat_link (entity this)
float plat_send (entity this, entity to, float sf)
 spawnfunc (func_plat)

Function Documentation

◆ plat_delayedinit()

void plat_delayedinit ( entity this)

Definition at line 7 of file plat.qc.

8{
9 plat_link(this);
10 // Q3 uses only a truth check of .targetname to decide whether to spawn a trigger
11 if (!Q3COMPAT_COMMON || this.targetname == "")
12 plat_spawn_inside_trigger(this); // the "start moving" trigger
13}
#define Q3COMPAT_COMMON
Definition stats.qh:368
void plat_link(entity this)
Definition plat.qc:54
void plat_spawn_inside_trigger(entity this)
Definition platforms.qc:21
string targetname
Definition triggers.qh:56

References entity(), plat_link(), plat_spawn_inside_trigger(), Q3COMPAT_COMMON, and targetname.

Referenced by spawnfunc().

◆ plat_link()

void plat_link ( entity this)

Definition at line 54 of file plat.qc.

55{
56 //Net_LinkEntity(this, 0, false, plat_send);
57}

References entity().

Referenced by plat_delayedinit().

◆ plat_send()

float plat_send ( entity this,
entity to,
float sf )

Definition at line 15 of file plat.qc.

16{
17 WriteHeader(MSG_ENTITY, ENT_CLIENT_PLAT);
19
20 if(sf & SF_TRIGGER_INIT)
21 {
26
28
29 trigger_common_write(this, true);
30
31 WriteVector(MSG_ENTITY, this.pos1);
32 WriteVector(MSG_ENTITY, this.pos2);
33
34 WriteVector(MSG_ENTITY, this.size);
35
36 WriteAngleVector(MSG_ENTITY, this.mangle);
37
42
44 }
45
46 if(sf & SF_TRIGGER_RESET)
47 {
48 // used on client
49 }
50
51 return true;
52}
float height
Definition bobbing.qc:3
float dmg
Definition breakable.qc:12
int spawnflags
Definition ammo.qh:15
vector size
int state
const int SF_TRIGGER_RESET
Definition defs.qh:24
const int SF_TRIGGER_INIT
Definition defs.qh:22
float speed
Definition dynlight.qc:9
model
Definition ent_cs.qc:139
const int MSG_ENTITY
Definition net.qh:115
#define WriteHeader(to, id)
Definition net.qh:221
void WriteString(string data, float dest, float desto)
void WriteShort(float data, float dest, float desto)
void WriteByte(float data, float dest, float desto)
float platmovetype_turn
Definition subs.qc:113
float platmovetype_start
Definition subs.qh:44
vector pos2
Definition subs.qh:50
vector mangle
Definition subs.qh:51
float lip
Definition subs.qh:40
float platmovetype_end
Definition subs.qh:44
vector pos1
Definition subs.qh:50
void trigger_common_write(entity this, bool withtarget)
Definition triggers.qc:110

References dmg, entity(), height, lip, mangle, model, MSG_ENTITY, platmovetype_end, platmovetype_start, platmovetype_turn, pos1, pos2, SF_TRIGGER_INIT, SF_TRIGGER_RESET, size, spawnflags, speed, state, trigger_common_write(), WriteByte(), WriteHeader, WriteShort(), and WriteString().

◆ spawnfunc()

spawnfunc ( func_plat )

Definition at line 59 of file plat.qc.

60{
61 if (q3compat)
62 {
63 this.spawnflags = 0; // Q3 plats have no spawnflags
64 if (!this.dmg) this.dmg = 2;
65 }
66 else if (this.spawnflags & CRUSH)
67 {
68 this.dmg = 10000;
69 }
70
71 if (this.dmg && (this.message == ""))
72 {
73 this.message = "was squished";
74 }
75 if (this.dmg && (this.message2 == ""))
76 {
77 this.message2 = "was squished by";
78 }
79
80 if (this.sounds == 1)
81 {
82 this.noise = "plats/plat1.wav";
83 this.noise1 = "plats/plat2.wav";
84 }
85
86 if (this.sounds == 2 || q3compat)
87 {
88 // Plats in Q3 always have sounds (they're hard coded in Q3 engine)
89 this.noise = "plats/medplat1.wav";
90 this.noise1 = "plats/medplat2.wav";
91 }
92
93 // WARNING: backwards compatibility because people don't use already existing fields :(
94 if (this.sound1)
95 this.noise = this.sound1;
96 if (this.sound2)
97 this.noise1 = this.sound2;
98
99 if (q3compat)
100 {
101 // CPMA adds these fields for overriding the Q3 default sounds
102 string s = GetField_fullspawndata(this, "sound_start", true);
103 string e = GetField_fullspawndata(this, "sound_end", true);
104
105 if (s)
106 this.noise = strzone(s);
107 else
108 {
109 // PK3s supporting Q3A sometimes include custom sounds at Q3 default paths
110 s = "sound/movers/plats/pt1_strt.wav";
111 if (FindFileInMapPack(s))
112 this.noise = s;
113 }
114
115 if (e)
116 this.noise1 = strzone(e);
117 else
118 {
119 e = "sound/movers/plats/pt1_end.wav";
120 if (FindFileInMapPack(e))
121 this.noise1 = e;
122 }
123 }
124
125 if(this.noise && this.noise != "")
126 {
127 precache_sound(this.noise);
128 }
129 if(this.noise1 && this.noise1 != "")
130 {
132 }
133
134 this.mangle = this.angles;
135 this.angles = '0 0 0';
136
137 this.classname = "plat";
138 this.draggable = drag_undraggable;
139 if (!InitMovingBrushTrigger(this))
140 return;
141 this.effects |= EF_LOWPRECISION;
142 setsize (this, this.mins , this.maxs);
143
144 setblocked(this, plat_crush);
145
146 if (!this.speed) this.speed = q3compat ? 200 : 150;
147 if (!this.lip) this.lip = q3compat ? 8 : 16;
148 if (!this.height) this.height = this.size.z - this.lip;
149
150 this.pos1 = this.origin;
151 this.pos2 = this.origin;
152 this.pos2_z = this.origin.z - this.height;
153
154 this.reset = plat_reset;
155 this.reset(this);
156
158}
bool drag_undraggable(entity draggee, entity dragger)
Definition cheats.qc:903
string message
Definition powerups.qc:19
const int INITPRIO_FINDTARGET
Definition constants.qh:96
string classname
vector mins
float effects
vector maxs
vector origin
const int CRUSH
Definition defs.qh:11
float EF_LOWPRECISION
ent angles
Definition ent_cs.qc:121
string precache_sound(string sample)
string strzone(string s)
void plat_delayedinit(entity this)
Definition plat.qc:7
void plat_crush(entity this, entity blocker)
Definition platforms.qc:138
string sound1
Definition platforms.qc:186
void plat_reset(entity this)
Definition platforms.qc:188
string sound2
Definition platforms.qc:186
q3compat
Definition quake3.qc:59
#define setblocked(e, f)
string GetField_fullspawndata(entity e, string fieldname, bool vfspath)
Retrieves the value of a map entity field from fullspawndata.
Definition main.qc:451
string FindFileInMapPack(string pattern)
Definition main.qc:500
bool InitMovingBrushTrigger(entity this)
Definition subs.qc:577
string noise
Definition subs.qh:83
string noise1
Definition subs.qh:83
float sounds
Definition subs.qh:42
string message2
Definition triggers.qh:19
void InitializeEntity(entity e, void(entity this) func, int order)
Definition world.qc:2209

References angles, classname, CRUSH, dmg, drag_undraggable(), EF_LOWPRECISION, effects, FindFileInMapPack(), GetField_fullspawndata(), height, InitializeEntity(), InitMovingBrushTrigger(), INITPRIO_FINDTARGET, lip, mangle, maxs, message, message2, mins, noise, noise1, origin, plat_crush(), plat_delayedinit(), plat_reset(), pos1, pos2, precache_sound(), q3compat, setblocked, size, sound1, sound2, sounds, spawnflags, speed, and strzone().