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

Go to the source code of this file.

Functions

 spawnfunc (target_music)
 spawnfunc (trigger_music)
 STATIC_INIT (g_targetmusic_list)
void target_music_kill ()
void target_music_reset (entity this)
void target_music_sendto (entity this, int to, bool is)
void target_music_use (entity this, entity actor, entity trigger)
void TargetMusic_RestoreGame ()
void trigger_music_reset (entity this)
bool trigger_music_SendEntity (entity this, entity to, int sendflags)

Variables

IntrusiveList g_targetmusic_list

Function Documentation

◆ spawnfunc() [1/2]

spawnfunc ( target_music )

Definition at line 73 of file music.qc.

74{
75 this.use = target_music_use;
76 this.reset = target_music_reset;
77 if(!this.volume)
78 this.volume = 1;
80 if(this.targetname == "")
81 target_music_sendto(this, MSG_INIT, true);
82 else
83 target_music_sendto(this, MSG_INIT, false);
84}
#define use
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float MSG_INIT
Definition menudefs.qc:58
IntrusiveList g_targetmusic_list
Definition music.qc:16
void target_music_use(entity this, entity actor, entity trigger)
Definition music.qc:59
void target_music_sendto(entity this, int to, bool is)
Definition music.qc:31
void target_music_reset(entity this)
Definition music.qc:41
float volume
Definition triggers.qh:47
string targetname
Definition triggers.qh:56

References g_targetmusic_list, IL_PUSH(), MSG_INIT, target_music_reset(), target_music_sendto(), target_music_use(), targetname, use, and volume.

◆ spawnfunc() [2/2]

spawnfunc ( trigger_music )

Definition at line 147 of file music.qc.

148{
149 if(this.model != "")
150 {
151 _setmodel(this, this.model);
152 }
153 if(!this.volume)
154 {
155 this.volume = 1;
156 }
157 if(!this.modelindex)
158 {
159 setorigin(this, this.origin + this.mins);
160 setsize(this, '0 0 0', this.maxs - this.mins);
161 }
162
163 this.setactive = generic_netlinked_setactive;
164 this.use = generic_netlinked_legacy_use; // backwards compatibility
165 this.reset = trigger_music_reset;
166 this.reset(this);
167
169}
float modelindex
vector mins
vector maxs
vector origin
model
Definition ent_cs.qc:139
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity this, entity to, int sendflags) sendfunc)
Definition net.qh:123
void trigger_music_reset(entity this)
Definition music.qc:135
bool trigger_music_SendEntity(entity this, entity to, int sendflags)
Definition music.qc:103
void generic_netlinked_legacy_use(entity this, entity actor, entity trigger)
Definition triggers.qc:98
void generic_netlinked_setactive(entity this, int act)
Definition triggers.qc:65

References generic_netlinked_legacy_use(), generic_netlinked_setactive(), maxs, mins, model, modelindex, Net_LinkEntity(), origin, trigger_music_reset(), trigger_music_SendEntity(), use, and volume.

◆ STATIC_INIT()

STATIC_INIT ( g_targetmusic_list )

Definition at line 17 of file music.qc.

18{
20}
#define IL_NEW()

References g_targetmusic_list, and IL_NEW.

◆ target_music_kill()

void target_music_kill ( )

Definition at line 48 of file music.qc.

49{
51 {
52 it.volume = 0;
53 if (it.targetname == "")
55 else
56 target_music_sendto(it, MSG_ALL, false);
57 });
58}
#define IL_EACH(this, cond, body)
float MSG_ALL
Definition menudefs.qc:57

References g_targetmusic_list, IL_EACH, MSG_ALL, and target_music_sendto().

Referenced by NextLevel().

◆ target_music_reset()

void target_music_reset ( entity this)

Definition at line 41 of file music.qc.

42{
43 if (this.targetname == "")
44 {
45 target_music_sendto(this, MSG_ALL, true);
46 }
47}

References entity(), MSG_ALL, target_music_sendto(), and targetname.

Referenced by spawnfunc().

◆ target_music_sendto()

void target_music_sendto ( entity this,
int to,
bool is )

Definition at line 31 of file music.qc.

32{
33 WriteHeader(to, TE_CSQC_TARGET_MUSIC);
34 WriteShort(to, etof(this));
35 WriteByte(to, this.volume * 255.0 * is);
36 WriteByte(to, this.fade_time * 16.0);
37 WriteByte(to, this.fade_rate * 16.0);
38 WriteByte(to, this.lifetime);
39 WriteString(to, this.noise);
40}
float lifetime
Definition powerups.qc:23
#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)
#define etof(e)
Definition misc.qh:25
fade_rate
Definition projectile.qh:14
float fade_time
Definition common.qh:23
string noise
Definition subs.qh:83

References entity(), etof, fade_rate, fade_time, lifetime, noise, volume, WriteByte(), WriteHeader, WriteShort(), and WriteString().

Referenced by spawnfunc(), target_music_kill(), target_music_reset(), target_music_use(), and TargetMusic_RestoreGame().

◆ target_music_use()

void target_music_use ( entity this,
entity actor,
entity trigger )

Definition at line 59 of file music.qc.

60{
61 if(!actor)
62 return;
63 if(IS_REAL_CLIENT(actor))
64 {
65 msg_entity = actor;
66 target_music_sendto(this, MSG_ONE, true);
67 }
68 FOREACH_CLIENT(IS_SPEC(it) && it.enemy == actor, {
69 msg_entity = it;
70 target_music_sendto(this, MSG_ONE, true);
71 });
72}
float MSG_ONE
Definition menudefs.qc:56
entity msg_entity
Definition progsdefs.qc:63
#define IS_SPEC(v)
Definition utils.qh:10
#define IS_REAL_CLIENT(v)
Definition utils.qh:17
#define FOREACH_CLIENT(cond, body)
Definition utils.qh:50

References entity(), FOREACH_CLIENT, IS_REAL_CLIENT, IS_SPEC, msg_entity, MSG_ONE, and target_music_sendto().

Referenced by spawnfunc().

◆ TargetMusic_RestoreGame()

void TargetMusic_RestoreGame ( )

Definition at line 85 of file music.qc.

86{
88 {
89 if(it.targetname == "")
91 else
92 target_music_sendto(it, MSG_INIT, false);
93 });
94}

References g_targetmusic_list, IL_EACH, MSG_INIT, and target_music_sendto().

Referenced by RestoreGame().

◆ trigger_music_reset()

void trigger_music_reset ( entity this)

Definition at line 135 of file music.qc.

136{
137 if(this.spawnflags & START_DISABLED)
138 {
139 this.setactive(this, ACTIVE_NOT);
140 }
141 else
142 {
143 this.setactive(this, ACTIVE_ACTIVE);
144 }
145}
int spawnflags
Definition ammo.qh:15
const int ACTIVE_NOT
Definition defs.qh:36
const int START_DISABLED
Definition defs.qh:7
const int ACTIVE_ACTIVE
Definition defs.qh:37

References ACTIVE_ACTIVE, ACTIVE_NOT, entity(), spawnflags, and START_DISABLED.

Referenced by spawnfunc().

◆ trigger_music_SendEntity()

bool trigger_music_SendEntity ( entity this,
entity to,
int sendflags )

Definition at line 103 of file music.qc.

104{
105 WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC);
106 WriteByte(MSG_ENTITY, sendflags);
107 if(sendflags & SF_MUSIC_ORIGIN)
108 {
109 WriteVector(MSG_ENTITY, this.origin);
110 }
111 if(sendflags & SF_TRIGGER_INIT)
112 {
113 if(this.model != "null")
114 {
116 WriteVector(MSG_ENTITY, this.mins);
117 WriteVector(MSG_ENTITY, this.maxs);
118 }
119 else
120 {
122 WriteVector(MSG_ENTITY, this.maxs);
123 }
124 WriteByte(MSG_ENTITY, this.volume * 255.0);
125 WriteByte(MSG_ENTITY, this.fade_time * 16.0);
126 WriteByte(MSG_ENTITY, this.fade_rate * 16.0);
128 }
129 if(sendflags & SF_TRIGGER_UPDATE)
130 {
132 }
133 return true;
134}
const int SF_TRIGGER_INIT
Definition defs.qh:22
int active
Definition defs.qh:34
const int SF_TRIGGER_UPDATE
Definition defs.qh:23
const int MSG_ENTITY
Definition net.qh:115
const int SF_MUSIC_ORIGIN
Definition music.qh:5

References active, entity(), fade_rate, fade_time, maxs, mins, model, modelindex, MSG_ENTITY, noise, origin, SF_MUSIC_ORIGIN, SF_TRIGGER_INIT, SF_TRIGGER_UPDATE, volume, WriteByte(), WriteHeader, WriteShort(), and WriteString().

Referenced by spawnfunc().

Variable Documentation

◆ g_targetmusic_list

IntrusiveList g_targetmusic_list

Definition at line 16 of file music.qc.

Referenced by spawnfunc(), STATIC_INIT(), target_music_kill(), and TargetMusic_RestoreGame().