// fade_rate
// when triggered, the music is overridden for activator until lifetime (or forever, if lifetime is 0)
// when targetname is not set, THIS ONE is default
// fade_rate
// when triggered, the music is overridden for activator until lifetime (or forever, if lifetime is 0)
// when targetname is not set, THIS ONE is default
- WriteShort(to, etof(self));
- WriteByte(to, self.volume * 255.0 * is);
- WriteByte(to, self.fade_time * 16.0);
- WriteByte(to, self.fade_rate * 16.0);
- WriteByte(to, self.lifetime);
- WriteString(to, self.noise);
+ WriteShort(to, etof(this));
+ WriteByte(to, this.volume * 255.0 * is);
+ WriteByte(to, this.fade_time * 16.0);
+ WriteByte(to, this.fade_rate * 16.0);
+ WriteByte(to, this.lifetime);
+ WriteString(to, this.noise);
- self.use = target_music_use;
- self.reset = target_music_reset;
- if(!self.volume)
- self.volume = 1;
- if(self.targetname == "")
- target_music_sendto(MSG_INIT, 1);
+ this.use = target_music_use;
+ this.reset = target_music_reset;
+ if(!this.volume)
+ this.volume = 1;
+ if(this.targetname == "")
+ target_music_sendto(this, MSG_INIT, 1);
- setself(e);
- if(self.targetname == "")
- target_music_sendto(MSG_INIT, 1);
+ if(it.targetname == "")
+ target_music_sendto(it, MSG_INIT, 1);
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
+ 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);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
- WriteByte(MSG_ENTITY, self.volume * 255.0);
- WriteByte(MSG_ENTITY, self.fade_time * 16.0);
- WriteByte(MSG_ENTITY, self.fade_rate * 16.0);
- WriteString(MSG_ENTITY, self.noise);
+ WriteByte(MSG_ENTITY, this.volume * 255.0);
+ WriteByte(MSG_ENTITY, this.fade_time * 16.0);
+ WriteByte(MSG_ENTITY, this.fade_rate * 16.0);
+ WriteString(MSG_ENTITY, this.noise);
_sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
if(getsoundtime(e, CH_BGM_SINGLE) < 0)
{
_sound(e, CH_BGM_SINGLE, e.noise, 0, ATTEN_NONE);
if(getsoundtime(e, CH_BGM_SINGLE) < 0)
{
-void Ent_TriggerMusic_Think()
-{SELFPARAM();
- if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
+void Ent_TriggerMusic_Think(entity this)
+{
+ if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, this, NULL))
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
- self.mins = '0 0 0';
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
+ this.mins = '0 0 0';
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
- self.volume = ReadByte() / 255.0;
- self.fade_time = ReadByte() / 16.0;
- self.fade_rate = ReadByte() / 16.0;
- string s = self.noise;
- if(self.noise)
- strunzone(self.noise);
- self.noise = strzone(ReadString());
- if(self.noise != s)
+ this.volume = ReadByte() / 255.0;
+ this.fade_time = ReadByte() / 16.0;
+ this.fade_rate = ReadByte() / 16.0;
+ string s = this.noise;
+ if(this.noise)
+ strunzone(this.noise);
+ this.noise = strzone(ReadString());
+ if(this.noise != s)
- precache_sound(self.noise);
- _sound(self, CH_BGM_SINGLE, self.noise, 0, ATTEN_NONE);
- if(getsoundtime(self, CH_BGM_SINGLE) < 0)
+ precache_sound(this.noise);
+ _sound(this, CH_BGM_SINGLE, this.noise, 0, ATTEN_NONE);
+ if(getsoundtime(this, CH_BGM_SINGLE) < 0)
- LOG_TRACEF("Cannot initialize sound %s\n", self.noise);
- strunzone(self.noise);
- self.noise = string_null;
+ LOG_TRACEF("Cannot initialize sound %s", this.noise);
+ strunzone(this.noise);
+ this.noise = string_null;
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
- self.cnt = 1;
- self.think = Ent_TriggerMusic_Think;
- self.nextthink = time;
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
+ this.cnt = 1;
+ setthink(this, Ent_TriggerMusic_Think);
+ this.nextthink = time;