From ae37110c7d0a0243773ba2b2d110fe1b7edb510f Mon Sep 17 00:00:00 2001 From: richard Date: Fri, 12 Jun 2009 15:52:51 +0200 Subject: [PATCH] Fixed newlines. --- .../addons/sourcemod/configs/zr/downloads.txt | 2 +- src/zr/antistick.inc | 2 +- src/zr/config.inc | 2 +- src/zr/downloads.inc | 2 +- src/zr/models.inc | 2 +- src/zr/overlays.inc | 2 +- src/zr/serial.inc | 2 +- src/zr/visualeffects/ragdoll.inc | 2 +- src/zr/visualeffects/visualambience.inc | 850 +++++++++--------- src/zr/weapons/restrict.inc | 2 +- src/zr/weapons/weaponalpha.inc | 2 +- src/zr/weapons/weaponammo.inc | 2 +- src/zr/weapons/zmarket.inc | 2 +- src/zr/zspawn.inc | 2 +- src/zr/ztele.inc | 2 +- 15 files changed, 439 insertions(+), 439 deletions(-) diff --git a/cstrike/addons/sourcemod/configs/zr/downloads.txt b/cstrike/addons/sourcemod/configs/zr/downloads.txt index 22141ba..f11d6b8 100644 --- a/cstrike/addons/sourcemod/configs/zr/downloads.txt +++ b/cstrike/addons/sourcemod/configs/zr/downloads.txt @@ -29,4 +29,4 @@ materials/overlays/zr/humans_win.vmt // zvision materials/overlays/zr/zvision.vtf -materials/overlays/zr/zvision.vmt \ No newline at end of file +materials/overlays/zr/zvision.vmt diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index bf37fbc..a21c379 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -224,4 +224,4 @@ AntiStickClientCollisionGroup(client, bool:apply = true, collisiongroup = 0) } return GetEntData(client, g_iToolsCollisionGroup, 1); -} \ No newline at end of file +} diff --git a/src/zr/config.inc b/src/zr/config.inc index b37bdf0..5c1cf5f 100644 --- a/src/zr/config.inc +++ b/src/zr/config.inc @@ -913,4 +913,4 @@ stock bool:ConfigKvGetStringBool(Handle:kv, const String:key[], const String:def KvGetString(kv, key, value, sizeof(value), defaultvalue); return ConfigSettingToBool(value); -} \ No newline at end of file +} diff --git a/src/zr/downloads.inc b/src/zr/downloads.inc index b61b206..8634c5d 100644 --- a/src/zr/downloads.inc +++ b/src/zr/downloads.inc @@ -115,4 +115,4 @@ public DownloadsOnConfigReload(ConfigFile:config) { // Reload download config. DownloadsLoad(); -} \ No newline at end of file +} diff --git a/src/zr/models.inc b/src/zr/models.inc index 648a87c..f71c2ab 100644 --- a/src/zr/models.inc +++ b/src/zr/models.inc @@ -190,4 +190,4 @@ public ModelsOnConfigReload(ConfigFile:config) { // Reload models config. ModelsLoad(); -} \ No newline at end of file +} diff --git a/src/zr/overlays.inc b/src/zr/overlays.inc index 6a5a7a6..79fa079 100644 --- a/src/zr/overlays.inc +++ b/src/zr/overlays.inc @@ -303,4 +303,4 @@ public Action:OverlaysTimer(Handle:timer) // Update client's overlay. OverlaysClientUpdateOverlay(x); } -} \ No newline at end of file +} diff --git a/src/zr/serial.inc b/src/zr/serial.inc index f018329..f2f8d8c 100644 --- a/src/zr/serial.inc +++ b/src/zr/serial.inc @@ -97,4 +97,4 @@ SerialReset() { // Clear array. ClearArray(arraySerial); -} \ No newline at end of file +} diff --git a/src/zr/visualeffects/ragdoll.inc b/src/zr/visualeffects/ragdoll.inc index e132238..7a15d11 100644 --- a/src/zr/visualeffects/ragdoll.inc +++ b/src/zr/visualeffects/ragdoll.inc @@ -156,4 +156,4 @@ public Action:RagdollTimer(Handle:timer, any:ragdoll) RagdollGetClientRagdoll(client) { return GetEntDataEnt2(client, g_iToolsRagdoll); -} \ No newline at end of file +} diff --git a/src/zr/visualeffects/visualambience.inc b/src/zr/visualeffects/visualambience.inc index eed590b..56152e4 100644 --- a/src/zr/visualeffects/visualambience.inc +++ b/src/zr/visualeffects/visualambience.inc @@ -1,425 +1,425 @@ -/* - * ============================================================================ - * - * Zombie:Reloaded - * - * File: visualambience.inc - * Type: Module - * Description: Fog, light style, sky, sun rendering, etc - * - * Copyright (C) 2009 Greyscale, Richard Helgeby - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * ============================================================================ - */ - -/** - * Default sky of current map. - */ -new String:g_VAmbienceDefaultSky[PLATFORM_MAX_PATH]; - -/** - * Validate cvar data. - */ -VAmbienceLoad() -{ - // Apply all visual effects now - VAmbienceApplyAll(); - - // Find map's default sky. - new Handle:hSkyname = FindConVar("sv_skyname"); - if (hSkyname != INVALID_HANDLE) - { - // Store map's default sky before applying new one. - GetConVarString(hSkyname, g_VAmbienceDefaultSky, sizeof(g_VAmbienceDefaultSky)); - } - - // If sky is disabled, then stop. - new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); - if (!sky) - { - return; - } - - decl String:downloadpath[PLATFORM_MAX_PATH]; - decl String:skypath[PLATFORM_MAX_PATH]; - - // Get sky path. - GetConVarString(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], skypath, sizeof(skypath)); - - // Prepend materials/skybox to the path. - Format(downloadpath, sizeof(downloadpath), "materials/skybox/%s", skypath); - - // Add skybox file to downloads table. - AddFileToDownloadsTable(downloadpath); -} - -/** - * Hook zr_veffects_* cvar changes. - * - * @param unhook If true, cvars will be unhooked, false to hook cvars. - */ -VAmbienceCvarsHook(bool:unhook = false) -{ - // If unhook is true, then continue. - if (unhook) - { - // Unhook lightstyle cvars. - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE], VAmbienceCvarsHookLightStyle); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE], VAmbienceCvarsHookLightStyle); - - // Unhook sky cvars. - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY], VAmbienceCvarsHookSky); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], VAmbienceCvarsHookSky); - - // Unhook sun cvars. - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE], VAmbienceCvarsHookSunDisable); - - // Unhook fog cvars. - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST], VAmbienceCvarsHookFog); - UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ], VAmbienceCvarsHookFog); - - // Stop after unhooking cvars. - return; - } - - // Hook lightstyle cvars. - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE], VAmbienceCvarsHookLightStyle); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE], VAmbienceCvarsHookLightStyle); - - // Hook sky cvars. - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY], VAmbienceCvarsHookSky); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], VAmbienceCvarsHookSky); - - // Hook sun cvars. - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE], VAmbienceCvarsHookSunDisable); - - // Hook fog cvars. - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST], VAmbienceCvarsHookFog); - HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ], VAmbienceCvarsHookFog); -} - -/** - * Cvar hook callback (zr_veffects_lightstyle, zr_veffects_lightstyle_value) - * Updated server to cvar values. - * - * @param convar The cvar handle. - * @param oldvalue The value before change. - * @param newvalue The new value. - */ -public VAmbienceCvarsHookLightStyle(Handle:cvar, const String:oldvalue[], const String:newvalue[]) -{ - // If lightstyle is disabled, then disable. - new bool:lightstyle = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE]); - - // Apply light style. - VAmbienceApplyLightStyle(!lightstyle); -} - -/** - * Cvar hook callback (zr_veffects_sky, zr_veffects_sky_path) - * Updated server to cvar values. - * - * @param convar The cvar handle. - * @param oldvalue The value before change. - * @param newvalue The new value. - */ -public VAmbienceCvarsHookSky(Handle:cvar, const String:oldvalue[], const String:newvalue[]) -{ - // If sky is disabled, then disable. - new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); - - // Apply new sky. - VAmbienceApplySky(!sky); -} - -/** - * Cvar hook callback (zr_veffects_sun_disable) - * Updated server to cvar values. - * - * @param convar The cvar handle. - * @param oldvalue The value before change. - * @param newvalue The new value. - */ -public VAmbienceCvarsHookSunDisable(Handle:cvar, const String:oldvalue[], const String:newvalue[]) -{ - // If fog is disabled, then disable. - new bool:sun = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE]); - - // Apply fog. - VAmbienceApplySunDisable(!sun); -} - -/** - * Cvar hook callback (zr_veffects_fog_*) - * Updated server to cvar values. - * - * @param convar The cvar handle. - * @param oldvalue The value before change. - * @param newvalue The new value. - */ -public VAmbienceCvarsHookFog(Handle:cvar, const String:oldvalue[], const String:newvalue[]) -{ - // If fog is disabled, then disable. - new bool:fogoverride = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE]); - - // Apply fog. - VAmbienceApplyFog(fogoverride); -} - -/** - * Apply all cvar values on server. - */ -VAmbienceApplyAll() -{ - // If lightstyle is disabled, then disable. - new bool:lightstyle = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE]); - - // Apply light style. - VAmbienceApplyLightStyle(!lightstyle); - - // If sky is disabled, then disable. - new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); - - // Apply new sky. - VAmbienceApplySky(!sky); - - // If fog is disabled, then disable. - new bool:fogoverride = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE]); - - // Apply fog. - VAmbienceApplyFog(fogoverride); -} - -VAmbienceApplyLightStyle(bool:disable = false) -{ - // If default, then set to normal light style. - if (disable) - { - // Set light style. - SetLightStyle(0, "n"); - - return; - } - - // Get light value. - decl String:lightstylevalue[4]; - GetConVarString(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE], lightstylevalue, sizeof(lightstylevalue)); - - // Set light style. - SetLightStyle(0, lightstylevalue); -} - -VAmbienceApplySky(bool:disable = false) -{ - // if we can't find the sv_skyname cvar, then stop. - new Handle:hSkyname = FindConVar("sv_skyname"); - if (hSkyname == INVALID_HANDLE) - { - return; - } - - // If default, then set to default sky. - if (disable) - { - if (g_VAmbienceDefaultSky[0]) - { - SetConVarString(hSkyname, g_VAmbienceDefaultSky, true); - } - - return; - } - - // Get sky path. - decl String:skypath[PLATFORM_MAX_PATH]; - GetConVarString(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], skypath, sizeof(skypath)); - - // Set new sky on all clients. - SetConVarString(hSkyname, skypath, true); -} - -VAmbienceApplySunDisable(bool:disable = false) -{ - // Find sun entity. - new sun = FindEntityByClassname(-1, "env_sun"); - - // If sun is invalid, then stop. - if (sun == -1) - { - return; - } - - // If default, then re-enable sun rendering. - if (disable) - { - // Turn on sun rendering. - AcceptEntityInput(sun, "TurnOn"); - - return; - } - - // Turn off sun rendering. - AcceptEntityInput(sun, "TurnOff"); -} - -VAmbienceApplyFog(bool:override = false) -{ - // If fog is disabled, then stop. - new bool:fog = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG]); - - // DUE TO SOURCEMOD NOT SUPPORT FOG, DISABLE. - fog = false; - - if (!fog) - { - return; - } - - // Find current fog index - new fogindex = FindEntityByClassname(-1, "env_fog_controller"); - - // If override is enabled, then continue. - if (override) - { - // If there is fog, then continue. - if (fogindex != -1) - { - // Delete fog. - RemoveEdict(fogindex); - } - } - - // If there is no fog on the map, create new fog. - if (fogindex == -1) - { - // Create and spawn fog. - fogindex = CreateEntityByName("env_fog_controller"); - DispatchSpawn(fogindex); - } - - decl String:fogcolor[16]; - - // Set primary fog color. - GetConVarString(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], fogcolor, sizeof(fogcolor)); - VAmbienceSetFogColor(fogindex, fogcolor, true); - - // Set secondary fog color. - GetConVarString(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], fogcolor, sizeof(fogcolor)); - VAmbienceSetFogColor(fogindex, fogcolor, false); - - // Set fog's density. - new Float:fogdensity = GetConVarFloat(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY]); - VAmbienceSetFogDensity(fogindex, fogdensity); - - // Set fog's start distance. - new fogstart = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST]); - VAmbienceSetFogStartDist(fogindex, fogstart); - - // Set fog's end distance. - new fogend = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST]); - VAmbienceSetFogEndDist(fogindex, fogend); - - // Set fog's far z distance. - new fogfarz = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ]); - VAmbienceSetFogFarZ(fogindex, fogfarz); -} - -/** - * Set fog's primary or secondary color. - * - * @param fogindex Edict index of the fog to modify. - * @param color The rgb color of the fog. - * @param primary (Optional) True to set primary, false otherwise. - */ -VAmbienceSetFogColor(fogindex, const String:color[], bool:primary = true) -{ - // Set primary color. - if (primary) - { - // Set new color. - SetVariantString(color); - AcceptEntityInput(fogindex, "SetColor"); - } - // Set secondary color. - else - { - // Set new color. - SetVariantString(color); - AcceptEntityInput(fogindex, "SetColorSecondary"); - } -} - -/** - * Set fog's density. - * - * @param fogindex Edict index of the fog to modify. - * @param density The density of the fog. - */ -VAmbienceSetFogDensity(fogindex, Float:density) -{ - // Set density. - DispatchKeyValueFloat(fogindex, "fogmaxdensity", density); -} - -/** - * Set fog's start distance. - * - * @param fogindex Edict index of the fog to modify. - * @param startdist The start distance of the fog. - */ -VAmbienceSetFogStartDist(fogindex, startdist) -{ - // Set start distance. - SetVariantInt(startdist); - AcceptEntityInput(fogindex, "SetStartDist"); -} - -/** - * Set fog's end distance. - * - * @param fogindex Edict index of the fog to modify. - * @param enddist The end distance of the fog. - */ -VAmbienceSetFogEndDist(fogindex, enddist) -{ - // Set end distance. - SetVariantInt(enddist); - AcceptEntityInput(fogindex, "SetEndDist"); -} - -/** - * Set fog's far z distance. - * - * @param fogindex Edict index of the fog to modify. - * @param farz The far z distance of the fog. - */ -VAmbienceSetFogFarZ(fogindex, farz) -{ - // Set far z distance. - SetVariantInt(farz); - AcceptEntityInput(fogindex, "SetFarZ"); -} \ No newline at end of file +/* + * ============================================================================ + * + * Zombie:Reloaded + * + * File: visualambience.inc + * Type: Module + * Description: Fog, light style, sky, sun rendering, etc + * + * Copyright (C) 2009 Greyscale, Richard Helgeby + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * ============================================================================ + */ + +/** + * Default sky of current map. + */ +new String:g_VAmbienceDefaultSky[PLATFORM_MAX_PATH]; + +/** + * Validate cvar data. + */ +VAmbienceLoad() +{ + // Apply all visual effects now + VAmbienceApplyAll(); + + // Find map's default sky. + new Handle:hSkyname = FindConVar("sv_skyname"); + if (hSkyname != INVALID_HANDLE) + { + // Store map's default sky before applying new one. + GetConVarString(hSkyname, g_VAmbienceDefaultSky, sizeof(g_VAmbienceDefaultSky)); + } + + // If sky is disabled, then stop. + new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); + if (!sky) + { + return; + } + + decl String:downloadpath[PLATFORM_MAX_PATH]; + decl String:skypath[PLATFORM_MAX_PATH]; + + // Get sky path. + GetConVarString(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], skypath, sizeof(skypath)); + + // Prepend materials/skybox to the path. + Format(downloadpath, sizeof(downloadpath), "materials/skybox/%s", skypath); + + // Add skybox file to downloads table. + AddFileToDownloadsTable(downloadpath); +} + +/** + * Hook zr_veffects_* cvar changes. + * + * @param unhook If true, cvars will be unhooked, false to hook cvars. + */ +VAmbienceCvarsHook(bool:unhook = false) +{ + // If unhook is true, then continue. + if (unhook) + { + // Unhook lightstyle cvars. + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE], VAmbienceCvarsHookLightStyle); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE], VAmbienceCvarsHookLightStyle); + + // Unhook sky cvars. + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY], VAmbienceCvarsHookSky); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], VAmbienceCvarsHookSky); + + // Unhook sun cvars. + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE], VAmbienceCvarsHookSunDisable); + + // Unhook fog cvars. + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST], VAmbienceCvarsHookFog); + UnhookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ], VAmbienceCvarsHookFog); + + // Stop after unhooking cvars. + return; + } + + // Hook lightstyle cvars. + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE], VAmbienceCvarsHookLightStyle); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE], VAmbienceCvarsHookLightStyle); + + // Hook sky cvars. + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY], VAmbienceCvarsHookSky); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], VAmbienceCvarsHookSky); + + // Hook sun cvars. + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE], VAmbienceCvarsHookSunDisable); + + // Hook fog cvars. + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST], VAmbienceCvarsHookFog); + HookConVarChange(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ], VAmbienceCvarsHookFog); +} + +/** + * Cvar hook callback (zr_veffects_lightstyle, zr_veffects_lightstyle_value) + * Updated server to cvar values. + * + * @param convar The cvar handle. + * @param oldvalue The value before change. + * @param newvalue The new value. + */ +public VAmbienceCvarsHookLightStyle(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +{ + // If lightstyle is disabled, then disable. + new bool:lightstyle = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE]); + + // Apply light style. + VAmbienceApplyLightStyle(!lightstyle); +} + +/** + * Cvar hook callback (zr_veffects_sky, zr_veffects_sky_path) + * Updated server to cvar values. + * + * @param convar The cvar handle. + * @param oldvalue The value before change. + * @param newvalue The new value. + */ +public VAmbienceCvarsHookSky(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +{ + // If sky is disabled, then disable. + new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); + + // Apply new sky. + VAmbienceApplySky(!sky); +} + +/** + * Cvar hook callback (zr_veffects_sun_disable) + * Updated server to cvar values. + * + * @param convar The cvar handle. + * @param oldvalue The value before change. + * @param newvalue The new value. + */ +public VAmbienceCvarsHookSunDisable(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +{ + // If fog is disabled, then disable. + new bool:sun = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SUN_DISABLE]); + + // Apply fog. + VAmbienceApplySunDisable(!sun); +} + +/** + * Cvar hook callback (zr_veffects_fog_*) + * Updated server to cvar values. + * + * @param convar The cvar handle. + * @param oldvalue The value before change. + * @param newvalue The new value. + */ +public VAmbienceCvarsHookFog(Handle:cvar, const String:oldvalue[], const String:newvalue[]) +{ + // If fog is disabled, then disable. + new bool:fogoverride = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE]); + + // Apply fog. + VAmbienceApplyFog(fogoverride); +} + +/** + * Apply all cvar values on server. + */ +VAmbienceApplyAll() +{ + // If lightstyle is disabled, then disable. + new bool:lightstyle = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE]); + + // Apply light style. + VAmbienceApplyLightStyle(!lightstyle); + + // If sky is disabled, then disable. + new bool:sky = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_SKY]); + + // Apply new sky. + VAmbienceApplySky(!sky); + + // If fog is disabled, then disable. + new bool:fogoverride = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG_OVERRIDE]); + + // Apply fog. + VAmbienceApplyFog(fogoverride); +} + +VAmbienceApplyLightStyle(bool:disable = false) +{ + // If default, then set to normal light style. + if (disable) + { + // Set light style. + SetLightStyle(0, "n"); + + return; + } + + // Get light value. + decl String:lightstylevalue[4]; + GetConVarString(g_hCvarsList[CVAR_VEFFECTS_LIGHTSTYLE_VALUE], lightstylevalue, sizeof(lightstylevalue)); + + // Set light style. + SetLightStyle(0, lightstylevalue); +} + +VAmbienceApplySky(bool:disable = false) +{ + // if we can't find the sv_skyname cvar, then stop. + new Handle:hSkyname = FindConVar("sv_skyname"); + if (hSkyname == INVALID_HANDLE) + { + return; + } + + // If default, then set to default sky. + if (disable) + { + if (g_VAmbienceDefaultSky[0]) + { + SetConVarString(hSkyname, g_VAmbienceDefaultSky, true); + } + + return; + } + + // Get sky path. + decl String:skypath[PLATFORM_MAX_PATH]; + GetConVarString(g_hCvarsList[CVAR_VEFFECTS_SKY_PATH], skypath, sizeof(skypath)); + + // Set new sky on all clients. + SetConVarString(hSkyname, skypath, true); +} + +VAmbienceApplySunDisable(bool:disable = false) +{ + // Find sun entity. + new sun = FindEntityByClassname(-1, "env_sun"); + + // If sun is invalid, then stop. + if (sun == -1) + { + return; + } + + // If default, then re-enable sun rendering. + if (disable) + { + // Turn on sun rendering. + AcceptEntityInput(sun, "TurnOn"); + + return; + } + + // Turn off sun rendering. + AcceptEntityInput(sun, "TurnOff"); +} + +VAmbienceApplyFog(bool:override = false) +{ + // If fog is disabled, then stop. + new bool:fog = GetConVarBool(g_hCvarsList[CVAR_VEFFECTS_FOG]); + + // DUE TO SOURCEMOD NOT SUPPORT FOG, DISABLE. + fog = false; + + if (!fog) + { + return; + } + + // Find current fog index + new fogindex = FindEntityByClassname(-1, "env_fog_controller"); + + // If override is enabled, then continue. + if (override) + { + // If there is fog, then continue. + if (fogindex != -1) + { + // Delete fog. + RemoveEdict(fogindex); + } + } + + // If there is no fog on the map, create new fog. + if (fogindex == -1) + { + // Create and spawn fog. + fogindex = CreateEntityByName("env_fog_controller"); + DispatchSpawn(fogindex); + } + + decl String:fogcolor[16]; + + // Set primary fog color. + GetConVarString(g_hCvarsList[CVAR_VEFFECTS_FOG_PCOLOR], fogcolor, sizeof(fogcolor)); + VAmbienceSetFogColor(fogindex, fogcolor, true); + + // Set secondary fog color. + GetConVarString(g_hCvarsList[CVAR_VEFFECTS_FOG_SCOLOR], fogcolor, sizeof(fogcolor)); + VAmbienceSetFogColor(fogindex, fogcolor, false); + + // Set fog's density. + new Float:fogdensity = GetConVarFloat(g_hCvarsList[CVAR_VEFFECTS_FOG_DENSITY]); + VAmbienceSetFogDensity(fogindex, fogdensity); + + // Set fog's start distance. + new fogstart = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_STARTDIST]); + VAmbienceSetFogStartDist(fogindex, fogstart); + + // Set fog's end distance. + new fogend = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_ENDDIST]); + VAmbienceSetFogEndDist(fogindex, fogend); + + // Set fog's far z distance. + new fogfarz = GetConVarInt(g_hCvarsList[CVAR_VEFFECTS_FOG_FARZ]); + VAmbienceSetFogFarZ(fogindex, fogfarz); +} + +/** + * Set fog's primary or secondary color. + * + * @param fogindex Edict index of the fog to modify. + * @param color The rgb color of the fog. + * @param primary (Optional) True to set primary, false otherwise. + */ +VAmbienceSetFogColor(fogindex, const String:color[], bool:primary = true) +{ + // Set primary color. + if (primary) + { + // Set new color. + SetVariantString(color); + AcceptEntityInput(fogindex, "SetColor"); + } + // Set secondary color. + else + { + // Set new color. + SetVariantString(color); + AcceptEntityInput(fogindex, "SetColorSecondary"); + } +} + +/** + * Set fog's density. + * + * @param fogindex Edict index of the fog to modify. + * @param density The density of the fog. + */ +VAmbienceSetFogDensity(fogindex, Float:density) +{ + // Set density. + DispatchKeyValueFloat(fogindex, "fogmaxdensity", density); +} + +/** + * Set fog's start distance. + * + * @param fogindex Edict index of the fog to modify. + * @param startdist The start distance of the fog. + */ +VAmbienceSetFogStartDist(fogindex, startdist) +{ + // Set start distance. + SetVariantInt(startdist); + AcceptEntityInput(fogindex, "SetStartDist"); +} + +/** + * Set fog's end distance. + * + * @param fogindex Edict index of the fog to modify. + * @param enddist The end distance of the fog. + */ +VAmbienceSetFogEndDist(fogindex, enddist) +{ + // Set end distance. + SetVariantInt(enddist); + AcceptEntityInput(fogindex, "SetEndDist"); +} + +/** + * Set fog's far z distance. + * + * @param fogindex Edict index of the fog to modify. + * @param farz The far z distance of the fog. + */ +VAmbienceSetFogFarZ(fogindex, farz) +{ + // Set far z distance. + SetVariantInt(farz); + AcceptEntityInput(fogindex, "SetFarZ"); +} diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index 0603eaf..2c8b446 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -699,4 +699,4 @@ public Action:UnrestrictCommand(client, argc) } return Plugin_Handled; -} \ No newline at end of file +} diff --git a/src/zr/weapons/weaponalpha.inc b/src/zr/weapons/weaponalpha.inc index 6206fa7..a314ca5 100644 --- a/src/zr/weapons/weaponalpha.inc +++ b/src/zr/weapons/weaponalpha.inc @@ -184,4 +184,4 @@ WeaponAlphaApplyWeaponAlpha(entity, alpha) // Set alpha value on the weapon. SetEntityRenderColor(weapons[x], _, _, _, alpha); } -} \ No newline at end of file +} diff --git a/src/zr/weapons/weaponammo.inc b/src/zr/weapons/weaponammo.inc index 987d0f3..7f9d2a1 100644 --- a/src/zr/weapons/weaponammo.inc +++ b/src/zr/weapons/weaponammo.inc @@ -93,4 +93,4 @@ stock WeaponAmmoGetAmmo(weapon, bool:clip) // Return ammo offset value. return GetEntData(weapon, ammooffset); -} \ No newline at end of file +} diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index f953d65..b227aa4 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -685,4 +685,4 @@ stock bool:ZMarketIsClientInBuyZone(client) { // Return if client is in buyzone. return bool:GetEntData(client, g_iToolsInBuyZone); -} \ No newline at end of file +} diff --git a/src/zr/zspawn.inc b/src/zr/zspawn.inc index de3e2ca..ce1e209 100644 --- a/src/zr/zspawn.inc +++ b/src/zr/zspawn.inc @@ -209,4 +209,4 @@ public Action:ZSpawnTimer(Handle:timer) { // Reset timer handle. tZSpawn = INVALID_HANDLE; -} \ No newline at end of file +} diff --git a/src/zr/ztele.inc b/src/zr/ztele.inc index fcde8d6..2f26666 100644 --- a/src/zr/ztele.inc +++ b/src/zr/ztele.inc @@ -289,4 +289,4 @@ public Action:ZTeleTimer(Handle:timer, any:client) // Allow timer to continue repeating. return Plugin_Continue; -} \ No newline at end of file +}