FIXED THE MUSIC SYSTEM FINALLY AFTER THE 7TH REWRITE.

THANK YOU SO MUCH, @arieshi255 !!!

+ Made music system CONSIDERABLY more accurate, and virtually immune to server lag as we now base ticks off the game engine's real time clock in seconds, with an accuracy of up to 100ns.

+ Changed ChangeBGM function to accept a true or false, determining whether to stop the music and change it on the fly, or wait for the current song to finish.

+ Disabled debug info (getting real world time) from going into global chat.

+ Optimised music system's loop code to skip over index 0 (console) as the server console should never receive sound commands anyways.
This commit is contained in:
2025-08-19 01:58:06 -04:00
parent 06fa175eb9
commit 9fbe3b54ad
6 changed files with 78 additions and 67 deletions

View File

@@ -1,4 +1,4 @@
public char PLUGIN_VERSION[8] = "8.2.0c";
public char PLUGIN_VERSION[8] = "8.3.0a";
void sudo(int task) {
AssLogger(LOGLVL_DEBUG, "Calling sudo with %i", task);
switch (task) {
@@ -22,7 +22,7 @@ void sudo(int task) {
PerformWaveSetup();
float hwn = GetRandomFloat(core.HWNMin, core.HWNMax);
CreateTimer(hwn, HWBosses);
AudioManager.ChangeBGM(core.tacobell ? tacoBellBGMIndex[core.curWave] : DefaultsArray[core.curWave].defBGMIndex);
AudioManager.ChangeBGM(core.tacobell ? tacoBellBGMIndex[core.curWave] : DefaultsArray[core.curWave].defBGMIndex, true);
PrintToChatAll("WARNING, AUDIOMANAGER'S CHANGEBGM FUNCTION IS DEPRECATED IN FAVOR OF THE NEW CONFIGS. FIX THIS IMMEDIATELY.");
return;
}
@@ -634,19 +634,19 @@ void sudo(int task) {
}
case 421:{
FastFire2("weather.sky", "Skin", "2", 0.0, false);
AudioManager.ChangeBGM(28);
AudioManager.ChangeBGM(28, false);
WeatherManager.fogColorRTarget = 95.0;
WeatherManager.fogColorGTarget = 35.0;
WeatherManager.fogColorBTarget = 35.0;
}
case 422:{
AudioManager.ChangeBGM(29);
AudioManager.ChangeBGM(29, false);
}
case 423:{
AudioManager.ChangeBGM(30);
AudioManager.ChangeBGM(30, false);
}
case 424:{
AudioManager.ChangeBGM(31);
AudioManager.ChangeBGM(31, false);
}
case 425:{
for (int i = 0; i < 32; i++) {
@@ -686,9 +686,10 @@ void sudo(int task) {
AudioManager.indexBGM = 11;
AudioManager.stopBGM = true;
}
// FINAL Music system rewrite (again) AGAINNNNNNNNNNNN.... and again!
// FINAL Music system rewrite (again) AGAINNNNNNNNNNNN.... and again!... and again :p
case 1000: {
AudioManager.ChangeBGM(AudioManager.indexBGM);
AudioManager.shouldTick = true;
AudioManager.ChangeBGM(AudioManager.indexBGM, true);
}
//Stop current song
case 1001: {
@@ -978,8 +979,8 @@ public Action TimedOperator(Handle timer, int job) {
//DO THE THING ALREADY
case 7: {
core.sephiroth = true;
AudioManager.ticksBGM = 0;
AudioManager.refireBGM = BGMArray[16].refireTime;
//AudioManager.ticksBGM = 0;
AudioManager.loopSeconds = BGMArray[16].loopSeconds;
}
//Signal boss to actually spawn after delay.
case 8: {