Implement dynamic 3D sky fog + more music

This commit is contained in:
2025-04-24 14:07:03 -04:00
parent 0254ad5eed
commit 702006315b
4 changed files with 58 additions and 27 deletions

View File

@@ -30,6 +30,9 @@
public Database Get_Ass_Database(){ public Database Get_Ass_Database(){
return Ass_Database; return Ass_Database;
} }
public int GetGameMode(){
return core.gamemode;
}
public Plugin myinfo = { public Plugin myinfo = {
name = "Fartsy's Ass - Framework", name = "Fartsy's Ass - Framework",

View File

@@ -9,7 +9,7 @@ enum struct BGM {
int ticksOffset; int ticksOffset;
int SNDLVL; int SNDLVL;
} }
BGM BGMArray[32]; BGM BGMArray[48];
//All sound effects //All sound effects
enum struct SFXARRAY { enum struct SFXARRAY {
@@ -254,11 +254,12 @@ MAPLIGHTING MapLighting[15];
//Weather Manager //Weather Manager
BULKFIRE lightningStrike[16]; BULKFIRE lightningStrike[16];
BULKFIRE lightningFlash[13]; BULKFIRE lightningFlash[17];
enum struct WEATHERMANAGER { enum struct WEATHERMANAGER {
bool canTornado; bool canTornado;
bool hasTornado; bool hasTornado;
bool powerSurging; bool powerSurging;
bool reset;
bool sirenExplode; bool sirenExplode;
bool sirenExploded; bool sirenExploded;
bool tickWeather; bool tickWeather;
@@ -272,23 +273,23 @@ enum struct WEATHERMANAGER {
float defFogDensity; float defFogDensity;
float fogTarget; float fogTarget;
float fogChangeRate; float fogChangeRate;
float fogChangeRateRGB;
float sirenPitch; float sirenPitch;
float sirenPitchRate; float sirenPitchRate;
float sirenPitchTarget; float sirenPitchTarget;
int fogColorR; float fogColorR;
int fogColorG; float fogColorG;
int fogColorB; float fogColorB;
int fogColorRTarget; float fogColorRTarget;
int fogColorGTarget; float fogColorGTarget;
int fogColorBTarget; float fogColorBTarget;
int intensity; int intensity;
int mIntensity; int mIntensity;
void Activate(){ void Activate(){
this.Reset(); this.Reset();
sudo(1001); //Stop any BGM sudo(1001); //Stop any BGM
FastFire2("Weather.Sky", "Enable", "", 0.0, false);
this.tickWeather = true; this.tickWeather = true;
this.PerformRandomWeather(); //Start weather system if (GetGameMode() != 2) this.PerformRandomWeather(); //Start weather system ONLY IF NOT IN GAMEMODE 2.
} }
void doLightning(){ void doLightning(){
sudo(1003); sudo(1003);
@@ -577,9 +578,16 @@ enum struct WEATHERMANAGER {
void Reset(){ void Reset(){
AssLogger(LOGLVL_DEBUG, "[Fartsy's Enhancer] WeatherManager has been reset!"); AssLogger(LOGLVL_DEBUG, "[Fartsy's Enhancer] WeatherManager has been reset!");
this.fogDensity = 0.50; this.fogDensity = 0.50;
this.fogColorRTarget = 35.0;
this.fogColorGTarget = 55.0;
this.fogColorBTarget = 55.0;
this.Dissipate(); this.Dissipate();
this.reset = true;
this.tickWeather = false; this.tickWeather = false;
FastFire2("rain", "Alpha", "0", 0.0, false); FastFire2("rain", "Alpha", "0", 0.0, false);
FastFire2("Weather.Sky", "Enable", "", 0.0, false);
FastFire2("Weather.Sky", "Skin", "0", 0.0, false);
FastFire2("Weather.FogSky", "Enable", "", 2.0, false);
} }
void SetFogStartQueued(const char[] fsq){ void SetFogStartQueued(const char[] fsq){
FastFire2("Weather.FogOutdoor", "SetStartDistLerpTo", fsq, 0.0, false); FastFire2("Weather.FogOutdoor", "SetStartDistLerpTo", fsq, 0.0, false);
@@ -591,25 +599,27 @@ enum struct WEATHERMANAGER {
FastFire2("Weather.FogOutdoor", "StartFogTransition", "", 0.0, false); FastFire2("Weather.FogOutdoor", "StartFogTransition", "", 0.0, false);
} }
void TickFog(){ void TickFog(){
if(this.fogDensity != this.fogTarget){ if(this.fogDensity != this.fogTarget || this.reset){
char targetAlpha[4];
char targetDensity[24]; char targetDensity[24];
this.fogDensity = (this.fogDensity < this.fogTarget) ? FloatMin(this.fogDensity+=this.fogChangeRate, this.fogTarget) : FloatMax(this.fogDensity-=this.fogChangeRate, this.fogTarget); this.fogDensity = (this.fogDensity < this.fogTarget) ? FloatMin(this.fogDensity+=this.fogChangeRate, this.fogTarget) : FloatMax(this.fogDensity-=this.fogChangeRate, this.fogTarget);
IntToString(RoundFloat(FloatMin(255.0 * (this.fogDensity * 1.20), 255.0)), targetAlpha, sizeof(targetAlpha));
FloatToString(this.fogDensity, targetDensity, sizeof(targetDensity)); FloatToString(this.fogDensity, targetDensity, sizeof(targetDensity));
FastFire2("Weather.FogOutdoor", "SetMaxDensity", targetDensity, 0.0, false); FastFire2("Weather.FogOutdoor", "SetMaxDensity", targetDensity, 0.0, false);
FastFire2("Weather.FogSky", "Alpha", targetAlpha, 0.0, false);
} }
if(this.fogColorR != this.fogColorRTarget || this.fogColorG != this.fogColorGTarget || this.fogColorB != this.fogColorBTarget){ if(this.fogColorR != this.fogColorRTarget || this.fogColorG != this.fogColorGTarget || this.fogColorB != this.fogColorBTarget || this.reset){
char target[15]; char target[24];
char targetR[3]; this.fogColorR = (this.fogColorR < this.fogColorRTarget) ? FloatMin(this.fogColorR+=this.fogChangeRateRGB, this.fogColorRTarget) : FloatMax(this.fogColorR-=this.fogChangeRateRGB, this.fogColorRTarget);
char targetG[3]; this.fogColorG = (this.fogColorG < this.fogColorGTarget) ? FloatMin(this.fogColorG+=this.fogChangeRateRGB, this.fogColorGTarget) : FloatMax(this.fogColorG-=this.fogChangeRateRGB, this.fogColorGTarget);
char targetB[3]; this.fogColorB = (this.fogColorB < this.fogColorBTarget) ? FloatMin(this.fogColorB+=this.fogChangeRateRGB, this.fogColorBTarget) : FloatMax(this.fogColorB-=this.fogChangeRateRGB, this.fogColorBTarget);
this.fogColorR = (this.fogColorR < this.fogColorRTarget) ? FloatMin(this.fogColorR+=this.fogChangeRate, this.fogColorRTarget) : FloatMax(this.fogColorR-=this.fogChangeRate, this.fogColorRTarget); Format(target, sizeof(target), "%i %i %i", RoundFloat(this.fogColorR), RoundFloat(this.fogColorG), RoundFloat(this.fogColorB));
this.fogColorG = (this.fogColorG < this.fogColorGTarget) ? FloatMin(this.fogColorG+=this.fogChangeRate, this.fogColorGTarget) : FloatMax(this.fogColorG-=this.fogChangeRate, this.fogColorGTarget); FastFire2("Weather.FogIndoor", "SetColor", target, 0.0, false);
this.fogColorB = (this.fogColorB < this.fogColorBTarget) ? FloatMin(this.fogColorB+=this.fogChangeRate, this.fogColorBTarget) : FloatMax(this.fogColorB-=this.fogChangeRate, this.fogColorBTarget); FastFire2("Weather.FogIndoor", "SetColorSecondary", target, 0.0, false);
IntToString(this.fogColorR, targetR, sizeof(targetR));
IntToString(this.fogColorG, targetG, sizeof(targetG));
IntToString(this.fogColorB, targetB, sizeof(targetB));
Format(target, sizeof(target), "%i %i %i", targetR, targetG, targetB);
FastFire2("Weather.FogOutdoor", "SetColor", target, 0.0, false); FastFire2("Weather.FogOutdoor", "SetColor", target, 0.0, false);
FastFire2("Weather.FogOutdoor", "SetColorSecondary", target, 0.0, false);
FastFire2("Weather.FogSky", "Color", target, 0.0, false);
this.reset = false;
} }
} }
void TickSiren(){ void TickSiren(){

View File

@@ -426,6 +426,7 @@ void SetupCoreData(){
WeatherManager.defFogEndDist = "3000"; WeatherManager.defFogEndDist = "3000";
WeatherManager.defFogDensity = 0.55; WeatherManager.defFogDensity = 0.55;
WeatherManager.fogChangeRate = 0.001; WeatherManager.fogChangeRate = 0.001;
WeatherManager.fogChangeRateRGB = 0.25;
WeatherManager.hasTornado = false; WeatherManager.hasTornado = false;
MapLighting[0].arcs = "MapLighting.StreetLamp00.arcs"; MapLighting[0].arcs = "MapLighting.StreetLamp00.arcs";
MapLighting[1].arcs = "MapLighting.StreetLamp01.arcs"; MapLighting[1].arcs = "MapLighting.StreetLamp01.arcs";

View File

@@ -1,4 +1,4 @@
public char PLUGIN_VERSION[8] = "8.1.0a"; public char PLUGIN_VERSION[8] = "8.1.0c";
void sudo(int task) { void sudo(int task) {
AssLogger(LOGLVL_DEBUG, "Calling sudo with %i", task); AssLogger(LOGLVL_DEBUG, "Calling sudo with %i", task);
switch (task) { switch (task) {
@@ -17,6 +17,7 @@ void sudo(int task) {
} }
//Wave init //Wave init
case 2: { case 2: {
UpdateGamemode();
core.curWave = GetCurWave(); core.curWave = GetCurWave();
PerformWaveSetup(); PerformWaveSetup();
float hwn = GetRandomFloat(core.HWNMin, core.HWNMax); float hwn = GetRandomFloat(core.HWNMin, core.HWNMax);
@@ -624,6 +625,25 @@ void sudo(int task) {
case 305: { case 305: {
EmitSoundToAll(BGMArray[6].realPath, _, AudioManager.chanBGM, BGMArray[6].SNDLVL, SND_CHANGEVOL, 1.0, _, _, _, _, _, _); EmitSoundToAll(BGMArray[6].realPath, _, AudioManager.chanBGM, BGMArray[6].SNDLVL, SND_CHANGEVOL, 1.0, _, _, _, _, _, _);
} }
case 420:{ //Init from Wave Null.
UpdateGamemode();
}
case 421:{
FastFire2("weather.sky", "Skin", "2", 0.0, false);
AudioManager.ChangeBGM(28);
WeatherManager.fogColorRTarget = 95.0;
WeatherManager.fogColorGTarget = 35.0;
WeatherManager.fogColorBTarget = 35.0;
}
case 422:{
AudioManager.ChangeBGM(29);
}
case 423:{
AudioManager.ChangeBGM(30);
}
case 424:{
AudioManager.ChangeBGM(31);
}
//LOOP SYSTEM //LOOP SYSTEM
case 500: { case 500: {
AudioManager.indexBGM = 9; AudioManager.indexBGM = 9;
@@ -1013,9 +1033,6 @@ public Action TimedOperator(Handle timer, int job) {
CreateTimer(3.0, TimedOperator, 200); CreateTimer(3.0, TimedOperator, 200);
return Plugin_Stop; return Plugin_Stop;
} }
case 420:{ //Init from Wave Null.
UpdateGamemode();
}
case 6969: { case 6969: {
if (!core.isWave){ if (!core.isWave){
ExitEmergencyMode(); ExitEmergencyMode();