From 52ea640c4b473afc9593364b4b85b2109cd4f6da Mon Sep 17 00:00:00 2001 From: voiperr Date: Fri, 27 May 2016 10:16:15 -0700 Subject: [PATCH] ace_map: More realistic flashlight glow + minor fix (#3824) * -Converted flashlight glow object to chemlight type (emits light without sprite) -Fixed issue where glow object was being deleted without being first detached * Cleanup of temp classes. * Spaces before and after = * Moved effects into Effects.hpp. --- addons/map/CfgAmmo.hpp | 84 +++++++++++---------- addons/map/CfgLights.hpp | 35 +++++++++ addons/map/Effects.hpp | 36 +++++++++ addons/map/XEH_postInitClient.sqf | 1 + addons/map/config.cpp | 4 +- addons/map/functions/fnc_flashlightGlow.sqf | 9 ++- 6 files changed, 126 insertions(+), 43 deletions(-) create mode 100644 addons/map/CfgLights.hpp create mode 100644 addons/map/Effects.hpp diff --git a/addons/map/CfgAmmo.hpp b/addons/map/CfgAmmo.hpp index 01cd9427e8..82ff6841cb 100644 --- a/addons/map/CfgAmmo.hpp +++ b/addons/map/CfgAmmo.hpp @@ -1,48 +1,54 @@ class CfgAmmo { - - class FlareCore; - - class FlareBase: FlareCore {}; - class F_20mm_White: FlareBase {}; - - class ACE_FlashlightProxy_White: F_20mm_White { + + class Chemlight_base; + + class ACE_FlashlightProxy_White: Chemlight_base { model = "\A3\Weapons_f\empty"; - effectFlare = "FlareShell"; - - triggerTime = 0; - intensity = 0.5; - flareSize = 1; - timeToLive = 10e10; - - lightColor[] = {1,1,1,1}; - - grenadeBurningSound[] = {}; - grenadeFireSound[] = {}; - soundTrigger[] = {}; - SmokeShellSoundHit1[] = {}; - SmokeShellSoundHit2[] = {}; - SmokeShellSoundHit3[] = {}; - SmokeShellSoundLoop1[] = {}; - SmokeShellSoundLoop2[] = {}; + effectsSmoke = "ACE_FlashlightEffect_White"; + explosionTime = 0.01; + timeToLive = 1e10; + + soundImpactHard1[] = {"",1,1}; + soundImpactHard2[] = {"",1,1}; + soundImpactHard3[] = {"",1,1}; + soundImpactHard4[] = {"",1,1}; + soundImpactHard5[] = {"",1,1}; + soundImpactHard6[] = {"",1,1}; + soundImpactHard7[] = {"",1,1}; + soundImpactIron1[] = {"",1,1}; + soundImpactIron2[] = {"",1,1}; + soundImpactIron3[] = {"",1,1}; + soundImpactIron4[] = {"",1,1}; + soundImpactIron5[] = {"",1,1}; + soundImpactSoft1[] = {"",1,1}; + soundImpactSoft2[] = {"",1,1}; + soundImpactSoft3[] = {"",1,1}; + soundImpactSoft4[] = {"",1,1}; + soundImpactSoft5[] = {"",1,1}; + soundImpactSoft6[] = {"",1,1}; + soundImpactSoft7[] = {"",1,1}; + soundImpactWater1[] = {"",1,1}; + soundImpactWater2[] = {"",1,1}; + soundImpactWater3[] = {"",1,1}; + soundImpactWoodExt1[] = {"",1,1}; + soundImpactWoodExt2[] = {"",1,1}; + soundImpactWoodExt3[] = {"",1,1}; + soundImpactWoodExt4[] = {"",1,1}; }; - + class ACE_FlashlightProxy_Red: ACE_FlashlightProxy_White { - intensity = 1; - lightColor[] = {1,0,0,1}; + effectsSmoke = "ACE_FlashlightEffect_Red"; }; - - class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White { - intensity = 1; - lightColor[] = {0,1,0,1}; - }; - + class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White { - intensity = 1.5; - lightColor[] = {0.25,0.25,1,1}; + effectsSmoke = "ACE_FlashlightEffect_Blue"; }; - + + class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White { + effectsSmoke = "ACE_FlashlightEffect_Green"; + }; + class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White { - intensity = 1; - lightColor[] = {1,1,0.5,1}; + effectsSmoke = "ACE_FlashlightEffect_Yellow"; }; -}; +}; \ No newline at end of file diff --git a/addons/map/CfgLights.hpp b/addons/map/CfgLights.hpp new file mode 100644 index 0000000000..bd69f9acbf --- /dev/null +++ b/addons/map/CfgLights.hpp @@ -0,0 +1,35 @@ +class CfgLights { + + class Chemlight_Blue; + + class ACE_FlashlightLight_White: Chemlight_Blue { + brightness = 100; + color[] = {1,1,1,1}; + diffuse[] = {1,1,1}; + intensity = 100; + position[] = {0,0,0}; + + class Attenuation { + constant = 0; + linear = 0; + quadratic = 10000; + start = 0.075; + }; + }; + + class ACE_FlashlightLight_Red: ACE_FlashlightLight_White { + diffuse[] = {1,0,0}; + }; + + class ACE_FlashlightLight_Blue: ACE_FlashlightLight_White { + diffuse[] = {0.25,0.25,1}; + }; + + class ACE_FlashlightLight_Green: ACE_FlashlightLight_White { + diffuse[] = {0,1,0}; + }; + + class ACE_FlashlightLight_Yellow: ACE_FlashlightLight_White { + diffuse[] = {1,1,0.4}; + }; +}; \ No newline at end of file diff --git a/addons/map/Effects.hpp b/addons/map/Effects.hpp new file mode 100644 index 0000000000..1dc9b4c993 --- /dev/null +++ b/addons/map/Effects.hpp @@ -0,0 +1,36 @@ +// "Smoke" effect classes for global flashlight glow + +class ACE_FlashlightEffect_White { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_White"; + }; +}; + +class ACE_FlashlightEffect_Red { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Red"; + }; +}; + +class ACE_FlashlightEffect_Blue { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Blue"; + }; +}; + +class ACE_FlashlightEffect_Green { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Green"; + }; +}; + +class ACE_FlashlightEffect_Yellow { + class Light1 { + simulation = "light"; + type = "ACE_FlashlightLight_Yellow"; + }; +}; \ No newline at end of file diff --git a/addons/map/XEH_postInitClient.sqf b/addons/map/XEH_postInitClient.sqf index f3b3ba6106..18bc8793cc 100644 --- a/addons/map/XEH_postInitClient.sqf +++ b/addons/map/XEH_postInitClient.sqf @@ -9,6 +9,7 @@ if (isServer) then { { if (_x isKindOf "ACE_FlashlightProxy_White") then { // ACE_LOGINFO_2("Deleting leftover light [%1:%2] from DC player [%3]", _x, typeOf _x, _disconnectedPlayer); + detach _x; deleteVehicle _x; }; } forEach attachedObjects _disconnectedPlayer; diff --git a/addons/map/config.cpp b/addons/map/config.cpp index 6d6b4030ec..e8a38d1222 100644 --- a/addons/map/config.cpp +++ b/addons/map/config.cpp @@ -29,6 +29,8 @@ class RscEdit; #include "CfgVehicles.hpp" #include "CfgAmmo.hpp" #include "CfgSounds.hpp" +#include "CfgLights.hpp" +#include "Effects.hpp" class RscMapControl { maxSatelliteAlpha = 0.5; @@ -160,4 +162,4 @@ class RscDisplayServerGetReady: RscDisplayGetReady { #include "MapControls.hpp" }; }; -}; +}; \ No newline at end of file diff --git a/addons/map/functions/fnc_flashlightGlow.sqf b/addons/map/functions/fnc_flashlightGlow.sqf index 011489f321..799b99e3d2 100644 --- a/addons/map/functions/fnc_flashlightGlow.sqf +++ b/addons/map/functions/fnc_flashlightGlow.sqf @@ -20,7 +20,10 @@ private ["_light", "_color", "_class"]; params ["_flashlight"]; _light = GVAR(glow); -if (!isNull _light) then {deleteVehicle _light}; +if (!isNull _light) then { + detach _light; + deleteVehicle _light; +}; if (_flashlight != "") then { _color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); @@ -28,9 +31,9 @@ if (_flashlight != "") then { _class = format["ACE_FlashlightProxy_%1", _color]; _light = _class createVehicle [0,0,0]; - _light attachTo [ACE_player, [0,0.5,-0.1], "head"]; + _light attachTo [ACE_player, [0,0.1,-0.05], "neck"]; } else { _light = objNull; }; -GVAR(glow) = _light; +GVAR(glow) = _light; \ No newline at end of file