Merge branch 'master' of https://github.com/KoffeinFlummi/ACE3 into ModuleIcons

This commit is contained in:
bux578 2015-03-23 18:43:00 +01:00
commit cdb6a1f947
4 changed files with 46 additions and 48 deletions

View File

@ -258,6 +258,9 @@ if (hasInterface) then {
}, 0, []] call cba_fnc_addPerFrameHandler;
};
// Init toHex
[0] call FUNC(toHex);
ADDON = true;
isHC = !(hasInterface || isDedicated);

View File

@ -1,47 +1,48 @@
/*
Author: commy2
Author: commy2, CAA-Picard
Description:
Converts number to hexadecimal number
Arguments:
A number
A number between 0 and 255 <NUMBER>
Return Value:
A hexadecimal number, String
*/
#include "script_component.hpp"
private ["_number", "_minLength", "_sign", "_hex", "_rest"];
private ["_number"];
_number = ((round abs (_this select 0)) max 0) min 255;
_number = _this select 0;
_minLength = _this select 1;
if (isNil QGVAR(hexArray)) then {
private ["_minLength", "_i", "_num", "_hex", "_rest"];
if (isNil "_minLength") then {_minLength = 1};
GVAR(hexArray) = [];
_minLength = 2;
for [{_i = 0;}, {_i < 256}, {_i = _i + 1}] do {
_num = _i;
_hex = ["", "0"] select (_i == 0);
_sign = ["", "-"] select (_number < 0);
_number = round abs _number;
_hex = ["", "0"] select (_number == 0);
while {_number > 0} do {
_rest = _number mod 16;
_rest = switch _rest do {
case 10 : {"A"};
case 11 : {"B"};
case 12 : {"C"};
case 13 : {"D"};
case 14 : {"E"};
case 15 : {"F"};
default {str _rest};
};
_number = floor (_number / 16);
_hex = _rest + _hex;
while {_num > 0} do {
_rest = _num mod 16;
_rest = switch _rest do {
case 10 : {"A"};
case 11 : {"B"};
case 12 : {"C"};
case 13 : {"D"};
case 14 : {"E"};
case 15 : {"F"};
default {str _rest};
};
_num = floor (_num / 16);
_hex = _rest + _hex;
};
while {count toArray _hex < _minLength} do {
_hex = "0" + _hex;
};
GVAR(hexArray) pushBack _hex;
};
};
while {count toArray _hex < _minLength} do {
_hex = "0" + _hex;
};
_sign + _hex
(GVAR(hexArray) select _number)

View File

@ -27,7 +27,6 @@ _icon = _this select 6;
//systemChat format ["Icon %1 - %2,%3,%4", _text, _pos select 0, _pos select 1, _pos select 2];
_sPos = worldToScreen _pos;
// _sPos = _pos;
if(count _sPos > 0) then {
if(GVAR(iconCount) > (count GVAR(iconCtrls))-1) then {
@ -44,6 +43,5 @@ if(count _sPos > 0) then {
_ctrl ctrlSetStructuredText (parseText _text);
_ctrl ctrlSetPosition [(_sPos select 0)-(0.2*SafeZoneW), (_sPos select 1)-(0.0095*SafeZoneW), 0.4*SafeZoneW, 0.035*SafeZoneW];
//_ctrl ctrlSetBackgroundColor [1, 0, 0, 0.1];
//_ctrl ctrlSetBackgroundColor [1,0,0,1];
_ctrl ctrlCommit 0;
};

View File

@ -56,37 +56,37 @@ GVAR(currentOptions) pushBack [_this, _pos, _path];
// Exit without rendering children if it isn't
if !(_menuInSelectedPath) exitWith {true};
private ["_angleSpan","_angle","_angleInterval","_scale"];
_angleSpan = _maxAngleSpan min (55 * ((count _activeChildren) - 1));
private ["_numChildren","_angleSpan","_angle","_angleInterval","_scale","_offset"];
_numChildren = count _activeChildren;
_angleSpan = _maxAngleSpan min (55 * ((_numChildren) - 1));
if (_angleSpan >= 305) then {
_angleSpan = 360;
};
_angleInterval = 55;
if (_angleSpan < 360) then {
if (count _activeChildren > 1) then {
_angleInterval = _angleSpan / (count _activeChildren - 1);
if (_numChildren > 1) then {
_angleInterval = _angleSpan / (_numChildren - 1);
};
} else {
_angleSpan / (count _activeChildren);
_angleSpan / (_numChildren);
};
if (count _activeChildren == 1) then {
if (_numChildren == 1) then {
_angleInterval = 60;
};
// Scale menu based on distance
_scale = (0.15 max (0.15 * ((positionCameraToWorld [0, 0, 0]) distance _pos))) / GVAR(selfMenuScale);
// Scale menu based on the amount of children
_scale = _scale * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.4) max 0.5);
_scale = GVAR(menuScale) * (((0.8 * (0.46 / sin (0.5 * _angleInterval))) min 1.4) max 0.5);
// Animate menu scale
if (_menuInSelectedPath && (_menuDepth == count _path)) then {
_scale = _scale * (0.3 + 0.7 * (((diag_tickTime - GVAR(expandedTime)) * 8) min 1));
};
_target = _actionObject;
_player = ACE_player;
_angle = _centerAngle - _angleSpan / 2;
{
_target = _actionObject;
_player = ACE_player;
private ["_offset","_newPos"];
_offset = ((GVAR(refSystem) select 1) vectorMultiply (-_scale * cos _angle)) vectorAdd
((GVAR(refSystem) select 2) vectorMultiply (-_scale * sin _angle));
_newPos = ((_pos call EFUNC(common,positionToASL)) vectorAdd _offset) call EFUNC(common,ASLToPosition);
@ -95,11 +95,7 @@ _angle = _centerAngle - _angleSpan / 2;
[_path, _x, _newPos, [_angle, 140]] call FUNC(renderMenu);
if (_angleSpan == 360) then {
_angle = _angle + _angleSpan / (count _activeChildren);
} else {
_angle = _angle + _angleSpan / (((count _activeChildren)-1) max 1);
};
_angle = _angle + _angleInterval;
} forEach _activeChildren;
true