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(){
return Ass_Database;
}
public int GetGameMode(){
return core.gamemode;
}
public Plugin myinfo = {
name = "Fartsy's Ass - Framework",

View File

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

View File

@@ -426,6 +426,7 @@ void SetupCoreData(){
WeatherManager.defFogEndDist = "3000";
WeatherManager.defFogDensity = 0.55;
WeatherManager.fogChangeRate = 0.001;
WeatherManager.fogChangeRateRGB = 0.25;
WeatherManager.hasTornado = false;
MapLighting[0].arcs = "MapLighting.StreetLamp00.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) {
AssLogger(LOGLVL_DEBUG, "Calling sudo with %i", task);
switch (task) {
@@ -17,6 +17,7 @@ void sudo(int task) {
}
//Wave init
case 2: {
UpdateGamemode();
core.curWave = GetCurWave();
PerformWaveSetup();
float hwn = GetRandomFloat(core.HWNMin, core.HWNMax);
@@ -624,6 +625,25 @@ void sudo(int task) {
case 305: {
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
case 500: {
AudioManager.indexBGM = 9;
@@ -1013,9 +1033,6 @@ public Action TimedOperator(Handle timer, int job) {
CreateTimer(3.0, TimedOperator, 200);
return Plugin_Stop;
}
case 420:{ //Init from Wave Null.
UpdateGamemode();
}
case 6969: {
if (!core.isWave){
ExitEmergencyMode();