This commit is contained in:
MikeyRay 2023-03-27 02:59:14 +02:00
commit e4b8b38c6a
10 changed files with 74 additions and 25 deletions

View file

@ -1167,6 +1167,10 @@ noref void() CSQC_Parse_Event =
if (chaptertitle == "")
chaptertitle = "'Nazi Zombies'";
break;
case EVENT_SONGPLAY:
string track_name = readstring();
localsound_enhanced(strcat("tracks/", track_name, ".ogg"), CHAN_MUSIC, 1);
break;
case EVENT_ACHIEVEMENT:
float ach = readbyte();

View file

@ -1872,15 +1872,15 @@ void() Draw_Menu =
{
// main menu theme iterating
if (menu_initialized == false && in_menu == MENU_MAIN) {
localsound_enhanced("tracks/tensioned_by_the_damned.mp3", CHAN_MUSIC, 1);
menu_sound_length = 490; // have to hard code because soundlength() doesn't like MP3 media it seems..
localsound_enhanced("tracks/tensioned_by_the_damned.ogg", CHAN_MUSIC, 1);
menu_sound_length = 490;
menu_sound_time = 0;
menu_initialized = true;
}
// restart the track if it has ended
if (menu_initialized == true && (menu_sound_time >= menu_sound_length - 1)) {
localsound_enhanced("tracks/tensioned_by_the_damned.mp3", CHAN_MUSIC, 1);
localsound_enhanced("tracks/tensioned_by_the_damned.ogg", CHAN_MUSIC, 1);
menu_sound_time = 0;
}

View file

@ -65,6 +65,14 @@ void(entity to, float type, float cost, float weapon) useprint = {
msg_entity = to;
multicast('0 0 0', MULTICAST_ONE);
}
void(string track_name) songegg =
{
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EVENT_SONGPLAY);
WriteString(MSG_MULTICAST, track_name);
multicast('0 0 0', MULTICAST_ALL);
};
#endif // FTE
void(vector org) CallExplosion = {

View file

@ -46,6 +46,8 @@ float framecount;
float deathmatch;
float coop;
float music_override;
#ifndef FTE
void(string com) SV_ParseClientCommand;
@ -53,6 +55,7 @@ void(string com) SV_ParseClientCommand;
.float recoil_delay;
.float mapversion;
.float ammo;
.float frags;
#endif // FTE
@ -517,9 +520,6 @@ float G_WORLDTEXT;
float G_PERKS;
float G_PERKPOWER;
//song easter egg
float sndTriggerCnt;
float sndActivCnt;
.float activated;
//teleporter

View file

@ -42,6 +42,7 @@ void() Barrel_Explode =
CallExplosion(self.origin);
SUB_UseTargets ();
SUB_Remove ();
};

View file

@ -138,25 +138,20 @@ void() teddy_spawn =
/* ==================
Custom Song Code
================== */
void() touch_songtrigger = {
if (other.classname != "player" || self.activated)
return;
if (other.button7) {
sound(self, CHAN_VOICE, self.tune, 1, ATTN_NORM);
self.activated = true;
sndActivCnt++;
if (sndTriggerCnt == sndActivCnt)
playSoundAtPlayers(world.song);
}
void() game_songtriggered =
{
songegg(self.aistatus);
music_override = time + self.cost;
}
void() trigger_song = {
remove(self);
}
void() game_songplay =
{
self.use = game_songtriggered;
};
// Old gross ent..
void() trigger_song = { remove(self); }
//
// ============================================================
@ -359,4 +354,37 @@ void() place_model =
// Now just execute the misc_model spawn function.
misc_model();
};
};
//
// game_counter()
// Quick and dirty game_counter implementation, referenced
// from TWHL docs (https://twhl.info/index.php/wiki/page/game_counter)
//
#define SPAWNFLAG_COUNTER_REMOVEONFIRE 1
#define SPAWNFLAG_COUNTER_RESETONFIRE 2
void() game_counter_increment =
{
self.frags++;
if (self.frags == self.health) {
SUB_UseTargets();
if (self.spawnflags & SPAWNFLAG_COUNTER_REMOVEONFIRE) {
remove(self);
} else if (self.spawnflags & SPAWNFLAG_COUNTER_RESETONFIRE) {
self.frags = self.cost;
}
}
}
void() game_counter =
{
// TODO: master checking..
// Store the initial value in case RESET ON FIRE is set.
self.cost = self.frags;
// Every time its triggered, increment.
self.use = game_counter_increment;
}

View file

@ -64,6 +64,9 @@ void() SUB_UseTargets =
temptotal = 0;
tempcount = 0;
breakthis = false;
if (self.target)
tempcount = tempcount + 1;
if (self.target2)
tempcount = tempcount + 1;
if (self.target3)

View file

@ -97,6 +97,10 @@ float() getZombieTotal = {
void(string s) playSoundAtPlayers =
{
// Don't play any round stuff while there's a song egg happening.
if (music_override > time)
return;
local entity p;
p = find(world,classname,"player");
while(p)

View file

@ -54,6 +54,7 @@ const float EVENT_REVIVEON = 37;
const float EVENT_REVIVEOFF = 38;
const float EVENT_REVIVECHANGE = 39;
const float EVENT_WEAPONRECOIL = 40;
const float EVENT_SONGPLAY = 41;
// Define our FTE platform
#ifndef STANDARD

View file

@ -152,7 +152,7 @@ string(float wep) GetWeaponName =
case W_PORTER:
return "Porter's X2 Ray Gun";
case W_SAWNOFF:
return "Sawnoff shotgun";
return "Sawed-Off Shotgun";
case W_SNUFF:
return "The Snuff Box";
case W_STG: