Git Repos / fte_dogmode / qc / triggers / changemusic.qc
Last update to this file was on 2024-06-15 at 19:50.
Show changemusic.qc
//==============================================================================
// trigger_changemusic, trigger_cdtrack
//==============================================================================
//======================================================================
// forward declarations
//======================================================================
// base_changemusic
#ifdef SSQC
void(float newtrack) base_changemusic_newtrack;
#endif
#ifdef SSQC
// trigger_changemusic
void() trigger_changemusic_touch;
entity(entity src, vector org, vector nmins, vector nmaxs, float newsnd)
spawn_trigger_changemusic;
void(entity e) trigger_changemusic_init;
void() trigger_changemusic;
#endif
#ifdef SSQC
// trigger_cdtrack
void() trigger_cdtrack_use;
entity(entity src, vector org, float newcount) spawn_trigger_cdtrack;
void(entity e) trigger_cdtrack_init;
void() trigger_cdtrack;
#endif
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
// class base_changemusic: base_trigger
// {
#ifdef SSQC
//--------------------------------------------------------------
void(float newtrack) base_changemusic_newtrack =
{
// changing the field via a pointer
*world_sounds = newtrack;
// world.sounds has now been changed via our pointer, newly
// connecting players (like those connecting after the game
// is loaded) will get sent the new cd track's number.
// let everyone currently on the server know.
WriteByte (MSG_ALL, SVC_CDTRACK);
// initial track
WriteByte (MSG_ALL, newtrack);
// looped track... should generally be set the same as the
// initial track as most engines ignore it entirely so it
// might as well be same for those that care.
WriteByte (MSG_ALL, newtrack);
};
#endif
// };
#ifdef SSQC
/*QUAKED trigger_changemusic (.5 .5 .5) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
A trigger brush that changes the currently playing music track. The number of the track to play goes in the sounds key (just like worldspawn). */
//----------------------------------------------------------------------
// class trigger_changemusic: base_changemusic
// {
//--------------------------------------------------------------
// thanks to jleww via changemusic.rar --dumptruck_ds
//--------------------------------------------------------------
void() trigger_changemusic_touch =
{
// from Copper -- dumptruck_ds
if (sub_checkvalidtouch(other) == FALSE)
return;
if (!(other.flags & FL_CLIENT))
return;
self.touch = sub_null;
base_changemusic_newtrack (self.sounds);
self.nextthink = (time + 0.1);
};
//--------------------------------------------------------------
entity(entity src, vector org, vector nmins, vector nmaxs,
float newsnd) spawn_trigger_changemusic =
{
local entity e = spawn ();
e.owner = src;
e.origin = org;
e.mins = nmins;
e.maxs = nmaxs;
e.sounds = newsnd;
setorigin (e, org);
setsize (e, nmins, nmaxs);
trigger_changemusic_init (e);
return e;
};
//--------------------------------------------------------------
void(entity e) trigger_changemusic_init =
{
e.classname = "trigger_changemusic";
e.classtype = CT_TRIGGER_CHANGEMUSIC;
e.think = sub_remove;
e.touch = trigger_changemusic_touch;
if (!e.sounds)
{
// splitting the error string up, FTEQCC does implicit
// string concatenation -- CEV
objerror ("ERROR: trigger_changemusic needs valid track"
" number in sounds field");
return;
}
base_trigger_init (e);
sub_checkwaiting (e);
};
//--------------------------------------------------------------
void() trigger_changemusic =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
trigger_changemusic_init (self);
};
// };
#endif
#ifdef SSQC
/*QUAKED trigger_cdtrack (.7 .7 .7) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
A point entity that changes the currently playing music track when triggered. The number of the track to play goes in the count key. e.g. 32 for track32.ogg See manual trigger_changemusic for more information on formats and more.
NOTE: the track number uses the count key here but trigger_changemusic uses the sound key for the same info.
*/
//----------------------------------------------------------------------
// class trigger_cdtrack: base_changemusic
// {
//--------------------------------------------------------------
// point entity version uses count for music track number for
// backwards compatibly in Adoria mod -- dumptruck_ds
//--------------------------------------------------------------
void() trigger_cdtrack_use =
{
base_changemusic_newtrack (self.count);
};
//--------------------------------------------------------------
entity(entity src, vector org, float newcount) spawn_trigger_cdtrack =
{
local entity e = spawn ();
e.owner = src;
e.origin = org;
e.count = newcount;
setorigin (e, org);
trigger_cdtrack_init (e);
return e;
};
//--------------------------------------------------------------
void(entity e) trigger_cdtrack_init =
{
e.classname = "trigger_cdtrack";
e.classtype = CT_TRIGGER_CDTRACK;
e.use = trigger_cdtrack_use;
if (!e.count)
{
objerror ("ERROR: trigger_cdtrack needs valid track "
"number in count field");
return;
}
base_trigger_init (e);
};
//--------------------------------------------------------------
void() trigger_cdtrack =
{
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
trigger_cdtrack_init (self);
};
// };
#endif
Return to the top of this page or return to the overview of this repo.
Log changemusic.qc
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-06-15 | Major update, committing as-is, will have bugs | cev | +12 | |
2024-03-24 | 2nd pass refactor, rework QC class structure | cev | +102 | -35 |
2024-01-31 | Class based monster refactor & start projectiles | cev | +1 | -1 |
2024-01-09 | Continue OO / Class-based refactor | cev | +25 | -28 |
2023-12-09 | Start OO / class-based refactor, work on items | cev | +87 | -69 |
2023-11-20 | changes to movement, build environment, file reorg | cev | +94 |
Return to the top of this page or return to the overview of this repo.