+#include "music.qh"
#if defined(CSQC)
#elif defined(MENUQC)
#elif defined(SVQC)
#include <common/constants.qh>
+ #include <common/net_linked.qh>
#include <server/constants.qh>
#include <server/defs.qh>
#endif
#ifdef SVQC
+IntrusiveList g_targetmusic_list;
+STATIC_INIT(g_targetmusic_list) { g_targetmusic_list = IL_NEW(); }
+
// values:
// volume
// noise
}
void target_music_kill()
{
- FOREACH_ENTITY_CLASS("target_music", true, {
+ IL_EACH(g_targetmusic_list, true,
+ {
it.volume = 0;
if (it.targetname == "")
target_music_sendto(it, MSG_ALL, 1);
this.reset = target_music_reset;
if(!this.volume)
this.volume = 1;
+ IL_PUSH(g_targetmusic_list, this);
if(this.targetname == "")
target_music_sendto(this, MSG_INIT, 1);
else
}
void TargetMusic_RestoreGame()
{
- for(entity e = NULL; (e = find(e, classname, "target_music")); )
+ IL_EACH(g_targetmusic_list, true,
{
- if(e.targetname == "")
- target_music_sendto(e, MSG_INIT, 1);
+ if(it.targetname == "")
+ target_music_sendto(it, MSG_INIT, 1);
else
- target_music_sendto(e, MSG_INIT, 0);
- }
+ target_music_sendto(it, MSG_INIT, 0);
+ });
}
// values:
// volume
WriteByte(MSG_ENTITY, sf);
if(sf & 4)
{
- WriteCoord(MSG_ENTITY, this.origin.x);
- WriteCoord(MSG_ENTITY, this.origin.y);
- WriteCoord(MSG_ENTITY, this.origin.z);
+ WriteVector(MSG_ENTITY, this.origin);
}
if(sf & 1)
{
if(this.model != "null")
{
WriteShort(MSG_ENTITY, this.modelindex);
- WriteCoord(MSG_ENTITY, this.mins.x);
- WriteCoord(MSG_ENTITY, this.mins.y);
- WriteCoord(MSG_ENTITY, this.mins.z);
- WriteCoord(MSG_ENTITY, this.maxs.x);
- WriteCoord(MSG_ENTITY, this.maxs.y);
- WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteVector(MSG_ENTITY, this.mins);
+ WriteVector(MSG_ENTITY, this.maxs);
}
else
{
WriteShort(MSG_ENTITY, 0);
- WriteCoord(MSG_ENTITY, this.maxs.x);
- WriteCoord(MSG_ENTITY, this.maxs.y);
- WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteVector(MSG_ENTITY, this.maxs);
}
WriteByte(MSG_ENTITY, this.volume * 255.0);
WriteByte(MSG_ENTITY, this.fade_time * 16.0);
_sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
if(getsoundtime(e, CH_BGM_SINGLE) < 0)
{
- LOG_TRACEF("Cannot initialize sound %s\n", e.noise);
+ LOG_TRACEF("Cannot initialize sound %s", e.noise);
strunzone(e.noise);
e.noise = string_null;
}
int f = ReadByte();
if(f & 4)
{
- this.origin_x = ReadCoord();
- this.origin_y = ReadCoord();
- this.origin_z = ReadCoord();
+ this.origin = ReadVector();
}
if(f & 1)
{
this.modelindex = ReadShort();
if(this.modelindex)
{
- this.mins_x = ReadCoord();
- this.mins_y = ReadCoord();
- this.mins_z = ReadCoord();
- this.maxs_x = ReadCoord();
- this.maxs_y = ReadCoord();
- this.maxs_z = ReadCoord();
+ this.mins = ReadVector();
+ this.maxs = ReadVector();
}
else
{
this.mins = '0 0 0';
- this.maxs_x = ReadCoord();
- this.maxs_y = ReadCoord();
- this.maxs_z = ReadCoord();
+ this.maxs = ReadVector();
}
this.volume = ReadByte() / 255.0;
_sound(this, CH_BGM_SINGLE, this.noise, 0, ATTEN_NONE);
if(getsoundtime(this, CH_BGM_SINGLE) < 0)
{
- LOG_TRACEF("Cannot initialize sound %s\n", this.noise);
+ LOG_TRACEF("Cannot initialize sound %s", this.noise);
strunzone(this.noise);
this.noise = string_null;
}