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 == "") if (chaptertitle == "")
chaptertitle = "'Nazi Zombies'"; chaptertitle = "'Nazi Zombies'";
break; break;
case EVENT_SONGPLAY:
string track_name = readstring();
localsound_enhanced(strcat("tracks/", track_name, ".ogg"), CHAN_MUSIC, 1);
break;
case EVENT_ACHIEVEMENT: case EVENT_ACHIEVEMENT:
float ach = readbyte(); float ach = readbyte();

View file

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

View file

@ -65,6 +65,14 @@ void(entity to, float type, float cost, float weapon) useprint = {
msg_entity = to; msg_entity = to;
multicast('0 0 0', MULTICAST_ONE); 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 #endif // FTE
void(vector org) CallExplosion = { void(vector org) CallExplosion = {

View file

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

View file

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

View file

@ -139,24 +139,19 @@ void() teddy_spawn =
Custom Song Code Custom Song Code
================== */ ================== */
void() touch_songtrigger = { void() game_songtriggered =
if (other.classname != "player" || self.activated) {
return; songegg(self.aistatus);
music_override = time + self.cost;
if (other.button7) {
sound(self, CHAN_VOICE, self.tune, 1, ATTN_NORM);
self.activated = true;
sndActivCnt++;
if (sndTriggerCnt == sndActivCnt)
playSoundAtPlayers(world.song);
} }
} void() game_songplay =
{
self.use = game_songtriggered;
};
void() trigger_song = { // Old gross ent..
remove(self); void() trigger_song = { remove(self); }
}
// //
// ============================================================ // ============================================================
@ -360,3 +355,36 @@ void() place_model =
// Now just execute the misc_model spawn function. // Now just execute the misc_model spawn function.
misc_model(); 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; temptotal = 0;
tempcount = 0; tempcount = 0;
breakthis = false; breakthis = false;
if (self.target)
tempcount = tempcount + 1;
if (self.target2) if (self.target2)
tempcount = tempcount + 1; tempcount = tempcount + 1;
if (self.target3) if (self.target3)

View file

@ -97,6 +97,10 @@ float() getZombieTotal = {
void(string s) playSoundAtPlayers = 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; local entity p;
p = find(world,classname,"player"); p = find(world,classname,"player");
while(p) while(p)

View file

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

View file

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