19 g_targetmusic_list =
IL_NEW();
31 void target_music_sendto(
entity this,
int to,
bool is)
33 WriteHeader(to, TE_CSQC_TARGET_MUSIC);
41 void target_music_reset(
entity this)
45 target_music_sendto(
this,
MSG_ALL,
true);
48 void target_music_kill()
50 IL_EACH(g_targetmusic_list,
true,
53 if (it.targetname ==
"")
54 target_music_sendto(it,
MSG_ALL,
true);
56 target_music_sendto(it,
MSG_ALL,
false);
66 target_music_sendto(
this,
MSG_ONE,
true);
70 target_music_sendto(this, MSG_ONE, true);
75 this.
use = target_music_use;
76 this.reset = target_music_reset;
79 IL_PUSH(g_targetmusic_list,
this);
81 target_music_sendto(
this,
MSG_INIT,
true);
83 target_music_sendto(
this,
MSG_INIT,
false);
85 void TargetMusic_RestoreGame()
87 IL_EACH(g_targetmusic_list,
true,
89 if(it.targetname ==
"")
90 target_music_sendto(it,
MSG_INIT,
true);
92 target_music_sendto(it,
MSG_INIT,
false);
105 WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC);
109 WriteVector(MSG_ENTITY, this.
origin);
113 if(this.
model !=
"null")
116 WriteVector(MSG_ENTITY, this.
mins);
117 WriteVector(MSG_ENTITY, this.
maxs);
122 WriteVector(MSG_ENTITY, this.
maxs);
135 void trigger_music_reset(
entity this)
151 _setmodel(
this, this.
model);
160 setsize(
this,
'0 0 0', this.
maxs - this.
mins);
163 this.setactive = generic_netlinked_setactive;
164 this.
use = generic_netlinked_legacy_use;
165 this.reset = trigger_music_reset;
168 Net_LinkEntity(
this,
false, 0, trigger_music_SendEntity);
175 TargetMusic_list =
LL_NEW();
178 void TargetMusic_Advance()
182 if (music_target &&
time < music_target.lifetime)
188 best = music_trigger;
190 LL_EACH(TargetMusic_list, it.noise, {
191 const float vol0 = (getsoundtime(it, CH_BGM_SINGLE) >= 0) ? it.lastvol : -1;
195 it.state = (it.fade_time > 0) ? bound(0, it.state + frametime / it.fade_time, 1) : 1;
200 it.state = (it.fade_rate > 0) ? bound(0, it.state - frametime / it.fade_rate, 1) : 0;
212 music_trigger =
NULL;
222 void Net_TargetMusic()
224 const int id = ReadShort();
225 const float vol = ReadByte() / 255.0;
226 const float fai = ReadByte() / 16.0;
227 const float fao = ReadByte() / 16.0;
228 const float tim = ReadByte();
232 LL_EACH(TargetMusic_list, it.count ==
id, { e = it; break; });
245 LOG_TRACEF(
"Cannot initialize sound %s", e.noise);
268 e.lifetime =
time + tim;
273 void Ent_TriggerMusic_Think(
entity this)
282 music_trigger =
this;
286 void Ent_TriggerMusic_Remove(
entity this)
291 NET_HANDLE(ENT_CLIENT_TRIGGER_MUSIC,
bool isnew)
293 int sendflags = ReadByte();
294 if(sendflags & SF_MUSIC_ORIGIN)
296 this.
origin = ReadVector();
298 if(sendflags & SF_TRIGGER_INIT)
303 this.
mins = ReadVector();
304 this.
maxs = ReadVector();
309 this.
maxs = ReadVector();
312 this.
volume = ReadByte() / 255.0;
315 string s = this.
noise;
334 setsize(
this, this.
mins, this.
maxs);
335 this.draw = Ent_TriggerMusic_Think;
338 LL_PUSH(TargetMusic_list,
this);
#define IL_EACH(this, cond, body)
#define REGISTER_NET_LINKED(id)
const int SF_TRIGGER_INIT
#define LL_EACH(list, cond, body)
float cvar_settemp(string tmp_cvar, string tmp_value)
#define FOREACH_CLIENT(cond, body)
#define NET_HANDLE(id, param)
#define STATIC_INIT(func)
during worldspawn
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
spawnfunc(info_player_attacker)
#define IS_REAL_CLIENT(v)
entity LL_PUSH(LinkedList this, entity e)
Push to tail.
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define _sound(e, c, s, v, a)
const int SF_MUSIC_ORIGIN
#define new_pure(class)
purely logical entities (.origin doesn't work)
#define REGISTER_NET_TEMP(id)
IntrusiveList g_drawables
const int SF_TRIGGER_UPDATE