Housekeeping of ace_flashlights and ace_map.

ace_map now handles flashlights independently of ace_flashlights.
ace_map searches for flashlight beam textures directly from weapon configs.
ace_map has acc_flashlight config (so vanilla ace_map will have at least one flashlight to use).
This commit is contained in:
voiper
2016-06-12 15:31:11 -07:00
parent f0b0b49f3c
commit f3fc99f3b8
13 changed files with 76 additions and 55 deletions

View File

@ -26,7 +26,7 @@ if (!isNull _light) then {
};
if (_flashlight != "") then {
_color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
_color = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> QGVAR(Flashlight) >> QGVAR(Flashlight_Color));
if !(_color in ["white", "red", "green", "blue", "yellow"]) then {_color = "white"};
_class = format["ACE_FlashlightProxy_%1", _color];

View File

@ -21,8 +21,8 @@ params ["_unit"];
private _flashlights = [];
{
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour")) && !(_x in _flashlights)) then {
_flashlights pushBack _x;
if ((isText (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> QGVAR(flashlight) >> QGVAR(Flashlight_Color))) then {
_flashlights pushBackUnique _x;
};
} forEach (items _unit);

View File

@ -51,16 +51,14 @@ if (_flashlight == "") then {
//ambient shade fill
_mapCtrl drawIcon [_fillTex, [1,1,1,_shadeAlpha], _mapCentre, _screenSize, _screenSize, 0, "", 0];
} else {
private ["_mousePos", "_colour", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"];
private ["_mousePos", "_cfg", "_size", "_flashTex", "_beamSize", "_viewPortRatioFixY", "_offsetX", "_offsetYDown", "_offsetYUp"];
//mouse pos
_mousePos = GVAR(mousePos);
//flashlight settings
_colour = getText (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Colour");
if !(_colour in ["white", "red", "green", "blue", "yellow"]) then {_colour = "white"};
_size = getNumber (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> "FlashLight" >> "ACE_Flashlight_Size");
_flashTex = format[QUOTE(PATHTOF_SYS(ace,flashlights,UI\Flashlight_Beam_%1_ca.paa)), _colour];
_beamSize = (safeZoneW/safeZoneWAbs) * _screenSize / _size;
_cfg = (configFile >> "CfgWeapons" >> _flashlight >> "ItemInfo" >> QGVAR(Flashlight));
_flashTex = getText (_cfg >> QGVAR(Flashlight_Beam));
_size = getNumber (_cfg >> QGVAR(Flashlight_Size));
//after 5x zoom, it's simulated to be fixed (it actually gets bigger relative to zoom)
if (_mapScale < 0.2) then {_beamSize = _beamSize / (_mapScale * (1 / 0.2))};

View File

@ -1,9 +1,9 @@
/*
* Author: voioper
* Switch flashlight.
* Switch flashlight on/off.
*
* Arguments:
* 0: Flashlight classname ("" for off) <STRING>
* 0: New flashlight classname ("" for off) <STRING>
*
* Return value:
* None
@ -16,10 +16,18 @@
#include "script_component.hpp"
params ["_flashlight"];
params ["_newFlashlight"];
private _oldFlashlight = GVAR(flashlightInUse);
GVAR(flashlightInUse) = _flashlight;
if (GVAR(mapGlow)) then {
[GVAR(flashlightInUse)] call FUNC(flashlightGlow);
[_newFlashlight] call FUNC(flashlightGlow);
};
playSound "ACE_map_flashlightClick";
if (
(getNumber (configFile >> "CfgWeapons" >> _newFlashlight >> "ItemInfo" >> QGVAR(Flashlight) >> QGVAR(Flashlight_Sound)) > 0) ||
{getNumber (configFile >> "CfgWeapons" >> _oldFlashlight >> "ItemInfo" >> QGVAR(Flashlight) >> QGVAR(Flashlight_Sound)) > 0}
) then {
playSound QGVAR(flashlightClick);
};
GVAR(flashlightInUse) = _newFlashlight;