simplify stuff

This commit is contained in:
commy2 2015-01-20 01:34:26 +01:00
parent 70b642afc0
commit 599dc134d8
6 changed files with 54 additions and 89 deletions

View File

@ -15,8 +15,20 @@ class RscTitles {
enablesimulation = 1;
class controls {
// has to be first to be in the background
class Wheel: RscPicture {
idc = 3;
type = 0;
style = "48 + 0x800";
text = "";
x = "safeZoneX + 0.07";
y = "safeZoneY + safeZoneH - 0.76";
h = "0.15";
w = "0.15";
};
class Kestrel1: RscPicture {
idc = 10;
idc = 1;
text = PATHTOF(data\4500NV1.paa);
style = "48 + 0x800";
x = "safeZoneX - 0.25";
@ -25,13 +37,13 @@ class RscTitles {
w = "0.75";
};
class Kestrel2: Kestrel1 {
idc = 11;
idc = 2;
text = PATHTOF(data\4500NV2.paa);
colorText[] = {0,0,0,1-(sunOrMoon*sunOrMoon+(moonIntensity/5))};
};
class HUD1: RscText {
idc = 12;
idc = 11;
type = 0;
style = 1;
text = "";
@ -47,45 +59,20 @@ class RscTitles {
lineSpacing = 1;
};
class HUD2: HUD1 {
idc = 13;
idc = 12;
y = "safeZoneY + safeZoneH - 0.48";
};
class HUD3: HUD1 {
idc = 14;
idc = 13;
y = "safeZoneY + safeZoneH - 0.45";
};
class HUD4: HUD1 {
idc = 15;
idc = 14;
y = "safeZoneY + safeZoneH - 0.418";
};
};
};
class ACE_KestrelWheel {
onload = QUOTE(_this call FUNC(onLoadKestrelWheel));
//onunload = "";
idd = -1;
movingEnable = 0;
enableDisplay = 1;
duration = 1e+011;
fadein = 0;
fadeout = 0;
enablesimulation = 1;
class controls {
class Wheel: RscPicture {
idc = 1;
type = 0;
style = "48 + 0x800";
text = "";
x = "safeZoneX + 0.07";
y = "safeZoneY + safeZoneH - 0.76";
h = "0.15";
w = "0.15";
};
};
};
// helper class to prevent flickering. Used together with preloadTitleRsc command.
class ACE_Kestrel_Preload {
idd = -1;

View File

@ -3,7 +3,6 @@
ADDON = false;
PREP(onLoadKestrel);
PREP(onLoadKestrelWheel);
PREP(openKestrel);
PREP(closeKestrel);

View File

@ -2,7 +2,5 @@
#include "script_component.hpp"
GVAR(isKestrel) = false;
GVAR(isKestrelWheel) = false;
(["ACE_KestrelWheel"] call BIS_fnc_rscLayer) cutText ["", "PLAIN", 0, false];
(["ACE_Kestrel"] call BIS_fnc_rscLayer) cutText ["", "PLAIN", 0, false];
(["ACE_Kestrel"] call BIS_fnc_rscLayer) cutText ["", "PLAIN", 0, false];

View File

@ -2,31 +2,37 @@
#include "script_component.hpp"
GVAR(windHead) = 0;
GVAR(wheelState) = 1;
[{
// exit loop
if (!GVAR(isKestrel) || {!("ACE_Kestrel" in items ACE_player)}) exitWith {
call FUNC(closeKestrel);
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
private ["_dlgKestrel", "_ctrlKestrel1", "_ctrlKestrel2", "_ctrlHUD1", "_ctrlHUD2", "_ctrlHUD3", "_ctrlHUD4"];
// get controls
private ["_dlgKestrel", "_ctrlKestrel1", "_ctrlKestrelWheel", "_ctrlKestrel2", "_ctrlHUD1", "_ctrlHUD2", "_ctrlHUD3", "_ctrlHUD4"];
disableSerialization;
_dlgKestrel = _this select 0;
_ctrlKestrel1 = _dlgKestrel displayCtrl 10;
_ctrlKestrel2 = _dlgKestrel displayCtrl 11;
_ctrlHUD1 = _dlgKestrel displayCtrl 12;
_ctrlHUD2 = _dlgKestrel displayCtrl 13;
_ctrlHUD3 = _dlgKestrel displayCtrl 14;
_ctrlHUD4 = _dlgKestrel displayCtrl 15;
_ctrlKestrel1 = _dlgKestrel displayCtrl 1;
_ctrlKestrel2 = _dlgKestrel displayCtrl 2;
_ctrlKestrelWheel = _dlgKestrel displayCtrl 3;
_ctrlHUD1 = _dlgKestrel displayCtrl 11;
_ctrlHUD2 = _dlgKestrel displayCtrl 12;
_ctrlHUD3 = _dlgKestrel displayCtrl 13;
_ctrlHUD4 = _dlgKestrel displayCtrl 14;
// don't show the kestrel in gunner view
private "_show";
_show = cameraView != "GUNNER";
_ctrlKestrel1 ctrlShow _show;
_ctrlKestrel2 ctrlShow _show;
_ctrlKestrelWheel ctrlShow _show;
_ctrlHUD1 ctrlShow _show;
_ctrlHUD2 ctrlShow _show;
_ctrlHUD3 ctrlShow _show;
@ -34,6 +40,7 @@ GVAR(windHead) = 0;
if !(_show) exitWith {};
// handle shown values
private ["_position", "_directon", "_windC", "_windD", "_windR", "_windB", "_windA"];
_position = eyePos ACE_player;
@ -119,9 +126,28 @@ GVAR(windHead) = 0;
_ctrlHUD3 ctrlSetText str round _directon;
_ctrlHUD4 ctrlSetText str ((round (0 * 10)) / 10);
// adjust kestrel picture in the dark
private "_brightness";
_brightness = call EFUNC(common,ambientBrightness);
_ctrlKestrel2 ctrlsettextcolor [0, 0, 0, 1 - _brightness];
_ctrlKestrel2 ctrlSetTextColor [0, 0, 0, 1 - _brightness];
// handle wheel
private ["_wheelState", "_wheelStateAdd"];
_wheelState = GVAR(wheelState);
_wheelStateAdd = ((round GVAR(windHead) * 2) min 5) max -5;
_wheelState = _wheelState + _wheelStateAdd;
if (_wheelState < 0) then {_wheelState = _wheelState + 9};
if (_wheelState > 9) then {_wheelState = _wheelState - 9};
GVAR(wheelState) = _wheelState;
if (preloadTitleRsc ["ACE_Kestrel_Preload", "PLAIN"]) then {
_ctrlKestrelWheel ctrlSetText format [QUOTE(PATHTOF(data\kestrel_%1.paa)), _wheelState];
_ctrlKestrelWheel ctrlSetTextColor [_brightness, _brightness, _brightness, 1];
};
}, 0.01, _this select 0] call CBA_fnc_addPerFrameHandler;

View File

@ -1,43 +0,0 @@
// by Falke, commy2
#include "script_component.hpp"
GVAR(windHead) = 0;
GVAR(wheelState) = 1;
[{
if (!GVAR(isKestrelWheel)) exitWith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
private ["_dlgKestrelWheel", "_ctrlKestrelWheel"];
disableSerialization;
_dlgKestrelWheel = _this select 0;
_ctrlKestrelWheel = _dlgKestrelWheel displayCtrl 1;
_ctrlKestrelWheel ctrlShow (cameraView != "GUNNER");
private ["_wheelState", "_wheelStateAdd"];
_wheelState = GVAR(wheelState);
_wheelStateAdd = ((round GVAR(windHead) * 2) min 5) max -5;
_wheelState = _wheelState + _wheelStateAdd;
if (_wheelState < 0) then {_wheelState = _wheelState + 9};
if (_wheelState > 9) then {_wheelState = _wheelState - 9};
GVAR(wheelState) = _wheelState;
if (preloadTitleRsc ["ACE_Kestrel_Preload", "PLAIN"]) then {
private "_brightness";
_brightness = call EFUNC(common,ambientBrightness);
_ctrlKestrelWheel ctrlSetText format [QUOTE(PATHTOF(data\kestrel_%1.paa)), _wheelState];
_ctrlKestrelWheel ctrlSetTextColor [_brightness, _brightness, _brightness, 1];
};
}, 0.01, _this select 0] call CBA_fnc_addPerFrameHandler;

View File

@ -2,7 +2,5 @@
#include "script_component.hpp"
GVAR(isKestrel) = true;
GVAR(isKestrelWheel) = true;
(["ACE_KestrelWheel"] call BIS_fnc_rscLayer) cutRsc ["ACE_KestrelWheel", "PLAIN", 0, false];
(["ACE_Kestrel"] call BIS_fnc_rscLayer) cutRsc ["ACE_Kestrel", "PLAIN", 0, false];
(["ACE_Kestrel"] call BIS_fnc_rscLayer) cutRsc ["ACE_Kestrel", "PLAIN", 0, false];