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.
This commit is contained in:
voiperr 2016-05-27 10:16:15 -07:00 committed by jonpas
parent 9cccacd74d
commit 52ea640c4b
6 changed files with 126 additions and 43 deletions

View File

@ -1,48 +1,54 @@
class CfgAmmo { class CfgAmmo {
class FlareCore; class Chemlight_base;
class FlareBase: FlareCore {}; class ACE_FlashlightProxy_White: Chemlight_base {
class F_20mm_White: FlareBase {};
class ACE_FlashlightProxy_White: F_20mm_White {
model = "\A3\Weapons_f\empty"; model = "\A3\Weapons_f\empty";
effectFlare = "FlareShell"; effectsSmoke = "ACE_FlashlightEffect_White";
explosionTime = 0.01;
triggerTime = 0; timeToLive = 1e10;
intensity = 0.5;
flareSize = 1; soundImpactHard1[] = {"",1,1};
timeToLive = 10e10; soundImpactHard2[] = {"",1,1};
soundImpactHard3[] = {"",1,1};
lightColor[] = {1,1,1,1}; soundImpactHard4[] = {"",1,1};
soundImpactHard5[] = {"",1,1};
grenadeBurningSound[] = {}; soundImpactHard6[] = {"",1,1};
grenadeFireSound[] = {}; soundImpactHard7[] = {"",1,1};
soundTrigger[] = {}; soundImpactIron1[] = {"",1,1};
SmokeShellSoundHit1[] = {}; soundImpactIron2[] = {"",1,1};
SmokeShellSoundHit2[] = {}; soundImpactIron3[] = {"",1,1};
SmokeShellSoundHit3[] = {}; soundImpactIron4[] = {"",1,1};
SmokeShellSoundLoop1[] = {}; soundImpactIron5[] = {"",1,1};
SmokeShellSoundLoop2[] = {}; 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 { class ACE_FlashlightProxy_Red: ACE_FlashlightProxy_White {
intensity = 1; effectsSmoke = "ACE_FlashlightEffect_Red";
lightColor[] = {1,0,0,1};
}; };
class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White {
intensity = 1;
lightColor[] = {0,1,0,1};
};
class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White { class ACE_FlashlightProxy_Blue: ACE_FlashlightProxy_White {
intensity = 1.5; effectsSmoke = "ACE_FlashlightEffect_Blue";
lightColor[] = {0.25,0.25,1,1};
}; };
class ACE_FlashlightProxy_Green: ACE_FlashlightProxy_White {
effectsSmoke = "ACE_FlashlightEffect_Green";
};
class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White { class ACE_FlashlightProxy_Yellow: ACE_FlashlightProxy_White {
intensity = 1; effectsSmoke = "ACE_FlashlightEffect_Yellow";
lightColor[] = {1,1,0.5,1};
}; };
}; };

35
addons/map/CfgLights.hpp Normal file
View File

@ -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};
};
};

36
addons/map/Effects.hpp Normal file
View File

@ -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";
};
};

View File

@ -9,6 +9,7 @@ if (isServer) then {
{ {
if (_x isKindOf "ACE_FlashlightProxy_White") then { if (_x isKindOf "ACE_FlashlightProxy_White") then {
// ACE_LOGINFO_2("Deleting leftover light [%1:%2] from DC player [%3]", _x, typeOf _x, _disconnectedPlayer); // ACE_LOGINFO_2("Deleting leftover light [%1:%2] from DC player [%3]", _x, typeOf _x, _disconnectedPlayer);
detach _x;
deleteVehicle _x; deleteVehicle _x;
}; };
} forEach attachedObjects _disconnectedPlayer; } forEach attachedObjects _disconnectedPlayer;

View File

@ -29,6 +29,8 @@ class RscEdit;
#include "CfgVehicles.hpp" #include "CfgVehicles.hpp"
#include "CfgAmmo.hpp" #include "CfgAmmo.hpp"
#include "CfgSounds.hpp" #include "CfgSounds.hpp"
#include "CfgLights.hpp"
#include "Effects.hpp"
class RscMapControl { class RscMapControl {
maxSatelliteAlpha = 0.5; maxSatelliteAlpha = 0.5;
@ -160,4 +162,4 @@ class RscDisplayServerGetReady: RscDisplayGetReady {
#include "MapControls.hpp" #include "MapControls.hpp"
}; };
}; };
}; };

View File

@ -20,7 +20,10 @@ private ["_light", "_color", "_class"];
params ["_flashlight"]; params ["_flashlight"];
_light = GVAR(glow); _light = GVAR(glow);
if (!isNull _light) then {deleteVehicle _light}; if (!isNull _light) then {
detach _light;
deleteVehicle _light;
};
if (_flashlight != "") then { if (_flashlight != "") then {
_color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour"); _color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
@ -28,9 +31,9 @@ if (_flashlight != "") then {
_class = format["ACE_FlashlightProxy_%1", _color]; _class = format["ACE_FlashlightProxy_%1", _color];
_light = _class createVehicle [0,0,0]; _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 { } else {
_light = objNull; _light = objNull;
}; };
GVAR(glow) = _light; GVAR(glow) = _light;