Move group icons to separate slower loop

This commit is contained in:
ebaydayz
2017-01-22 19:09:02 -05:00
parent ff6463473f
commit b148293920
9 changed files with 114 additions and 107 deletions

View File

@@ -651,13 +651,13 @@ class RscTitles
};
};
};
class DZ_GroupIcons
class DZ_GroupTags
{
idd = -1;
movingEnable = 1;
enableSimulation = 1;
enableDisplay = 1;
onLoad = "uiNamespace setVariable ['DZ_GroupIcons',_this select 0];";
onLoad = "uiNamespace setVariable ['DZ_GroupTags',_this select 0];";
duration = 99999999999999999;
fadein = 0;
fadeout = 0;

View File

@@ -98,7 +98,7 @@ DZE_doorManagementMaxFriends = 10; //Max friends allowed on a door. There is no
DZE_doorManagementHarderPenalty = true; //Enforce an exponential wait on attempts between unlocking a door from a failed code.
// Group System
dayz_groupSystem = true; // Enable group system
dayz_groupSystem = false; // Enable group system
dayz_markGroup = 1; // Players can see their group members on the map 0=never, 1=always, 2=With GPS only
dayz_markSelf = 0; // Players can see their own position on the map 0=never, 1=always, 2=With GPS only
dayz_markBody = 0; // Players can see their corpse position on the map 0=never, 1=always, 2=With GPS only

View File

@@ -1,42 +0,0 @@
// OnEachFrame loop
private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text"];
_group = player call dayz_filterGroup;
if (!visibleMap && count _group > 1 && cameraView in ["INTERNAL","EXTERNAL","GUNNER"]) then {
80000 cutRsc ["DZ_GroupIcons","PLAIN"];
_display = uiNamespace getVariable "DZ_GroupIcons";
_index = 0;
{
_pos = [_x] call FNC_GetPos;
_distance = _pos distance player;
_icon = _display displayCtrl (100 + _index);
if (_distance > 1 && _distance < 2500 && vehicle _x != vehicle player) then {
_pos set [2,(_pos select 2) + 1.5];
_screen = worldToScreen _pos;
_text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}];
if (count _screen > 1) then {
_scale = if (_distance < 200) then {.3} else {1 min ((1 - (_distance - 3) / 15) max .3)};
_icon ctrlSetStructuredText _text;
_icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65];
_icon ctrlSetScale _scale;
_icon ctrlSetFade ((1 - _scale) / 2);
_icon ctrlCommit 0;
_icon ctrlShow true;
} else {
_icon ctrlShow false;
};
} else {
_icon ctrlShow false;
};
_index = _index + 1;
} count _group;
if (dayz_oldGroupCount > count _group) then {
_display displayCtrl (100 + _index) ctrlShow false;
};
dayz_oldGroupCount = count _group;
} else {
80000 cutText ["","PLAIN"];
};

View File

@@ -1,60 +1,63 @@
// Two second loop
private ["_count","_found","_group","_hasGPS","_index","_marker","_markBody","_markGroup","_markSelf","_pos","_self","_vehicle"];
_group = player call dayz_filterGroup;
while {true} do {
_group = player call dayz_filterGroup;
if (dayz_requireRadio && {count _group > 1} && {!("ItemRadio" in items player)}) exitWith {
[player] joinSilent grpNull;
_group = [];
if (!isNull findDisplay 80000) then {findDisplay 80000 closeDisplay 2;};
localize "STR_EPOCH_RADIO_CONTACT_LOST" call dayz_rollingMessages;
};
if (visibleMap or !isNull findDisplay 88890) then {
_hasGPS = "ItemGPS" in items player;
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS));
_markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && _hasGPS));
_markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && _hasGPS));
_index = 0;
{
_self = _x == player;
_vehicle = vehicle _x;
if ((_self or _markGroup) && (!_self or _markSelf) && (effectiveCommander _vehicle == _x)) then {
_pos = [_x] call FNC_GetPos;
deleteMarkerLocal format["groupMember%1",_index];
_marker = createMarkerLocal [format["groupMember%1",_index],_pos];
_marker setMarkerTypeLocal "DestroyedVehicle";
_marker setMarkerTextLocal format ["%1",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];
_marker setMarkerColorLocal "ColorGreen";
} else {
deleteMarkerLocal format["groupMember%1",_index];
};
_index = _index + 1;
} count _group;
// Remove markers for group members that left
_count = count _group;
if (dayz_oldMemberCount > _count) then {
for "_i" from _count to dayz_oldMemberCount do {deleteMarkerLocal format["groupMember%1",_i];};
};
dayz_oldMemberCount = _count;
if (_markBody) then {
_found = false;
{
if (_x getVariable["bodyName",""] == name player) exitWith {
_found = true;
_pos = [_x] call FNC_GetPos;
deleteMarkerLocal "MyBody";
_marker = createMarkerLocal ["MyBody",_pos];
_marker setMarkerTypeLocal "DestroyedVehicle";
_marker setMarkerTextLocal localize "STR_EPOCH_RIP";
_marker setMarkerColorLocal "ColorRed";
};
} count allDead;
if (!_found) then {deleteMarkerLocal "MyBody";}; //Body was deleted or hidden
if (dayz_requireRadio && {count _group > 1} && {!("ItemRadio" in items player)}) then {
[player] joinSilent grpNull;
_group = [];
if (!isNull findDisplay 80000) then {findDisplay 80000 closeDisplay 2;};
localize "STR_EPOCH_RADIO_CONTACT_LOST" call dayz_rollingMessages;
} else {
deleteMarkerLocal "MyBody";
if (visibleMap or !isNull findDisplay 88890) then {
_hasGPS = "ItemGPS" in items player;
_markBody = (dayz_markBody == 1 or (dayz_markBody == 2 && _hasGPS));
_markGroup = (dayz_markGroup == 1 or (dayz_markGroup == 2 && _hasGPS));
_markSelf = (dayz_markSelf == 1 or (dayz_markSelf == 2 && _hasGPS));
_index = 0;
{
_self = _x == player;
_vehicle = vehicle _x;
if ((_self or _markGroup) && (!_self or _markSelf) && (effectiveCommander _vehicle == _x)) then {
_pos = [_x] call FNC_GetPos;
deleteMarkerLocal format["groupMember%1",_index];
_marker = createMarkerLocal [format["groupMember%1",_index],_pos];
_marker setMarkerTypeLocal "DestroyedVehicle";
_marker setMarkerTextLocal format ["%1",if (_vehicle == _x) then {name _x} else {_vehicle call dayz_getCrew}];
_marker setMarkerColorLocal "ColorGreen";
} else {
deleteMarkerLocal format["groupMember%1",_index];
};
_index = _index + 1;
} count _group;
// Remove markers for group members that left
_count = count _group;
if (dayz_oldMemberCount > _count) then {
for "_i" from _count to dayz_oldMemberCount do {deleteMarkerLocal format["groupMember%1",_i];};
};
dayz_oldMemberCount = _count;
if (_markBody) then {
_found = false;
{
if (_x getVariable["bodyName",""] == name player) exitWith {
_found = true;
_pos = [_x] call FNC_GetPos;
deleteMarkerLocal "MyBody";
_marker = createMarkerLocal ["MyBody",_pos];
_marker setMarkerTypeLocal "DestroyedVehicle";
_marker setMarkerTextLocal localize "STR_EPOCH_RIP";
_marker setMarkerColorLocal "ColorRed";
};
} count allDead;
if (!_found) then {deleteMarkerLocal "MyBody";}; //Body was deleted or hidden
} else {
deleteMarkerLocal "MyBody";
};
};
};
uiSleep 1;
};

View File

@@ -0,0 +1,46 @@
private ["_display","_distance","_group","_icon","_index","_pos","_scale","_screen","_text"];
while {true} do {
_group = player call dayz_filterGroup;
if (!visibleMap && count _group > 1 && cameraView in ["INTERNAL","EXTERNAL","GUNNER"]) then {
80000 cutRsc ["DZ_GroupTags","PLAIN"];
_display = uiNamespace getVariable "DZ_GroupTags";
_index = 0;
{
_pos = [_x] call FNC_GetPos;
_distance = _pos distance player;
_icon = _display displayCtrl (100 + _index);
if (_distance > 1 && _distance < 2500 && vehicle _x != vehicle player) then {
_pos set [2,(_pos select 2) + 1.5];
_screen = worldToScreen _pos;
_text = composeText [image "\ca\ui\data\igui_side_unknown_ca.paa"," ",if (dayz_groupNameTags) then {name _x} else {""}];
if (count _screen > 1) then {
_scale = if (_distance < 200) then {.3} else {1 min ((1 - (_distance - 3) / 15) max .3)};
_icon ctrlSetStructuredText _text;
_icon ctrlSetPosition [(_screen select 0),(_screen select 1),.99,.65];
_icon ctrlSetScale _scale;
_icon ctrlSetFade ((1 - _scale) / 2);
_icon ctrlCommit 0;
_icon ctrlShow true;
} else {
_icon ctrlShow false;
};
} else {
_icon ctrlShow false;
};
_index = _index + 1;
} count _group;
if (dayz_oldGroupCount > count _group) then {
_display displayCtrl (100 + _index) ctrlShow false;
};
dayz_oldGroupCount = count _group;
} else {
80000 cutText ["","PLAIN"];
};
uiSleep 0.01;
};

View File

@@ -30,8 +30,6 @@ dayz_disbandGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\group
dayz_filterGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\filter.sqf";
dayz_getCrew = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\getCrew.sqf";
dayz_getPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\getPlayer.sqf";
dayz_groupIcons = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\groupIcons.sqf";
dayz_groupMarkers = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\groupMarkers.sqf";
dayz_inviteToGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\invite.sqf";
dayz_joinGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\join.sqf";
dayz_kickFromGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\kick.sqf";
@@ -41,4 +39,10 @@ dayz_pickGroupMember = compile preprocessFileLineNumbers "\z\addons\dayz_code\gr
dayz_pickPlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\pickPlayer.sqf";
dayz_promotePlayer = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\promote.sqf";
dayz_rejectGroup = compile preprocessFileLineNumbers "\z\addons\dayz_code\groups\reject.sqf";
dayz_groupInit = true;
dayz_groupInit = true;
execVM "\z\addons\dayz_code\groups\groupTags.sqf";
if (dayz_requireRadio or {dayz_markGroup > 0} or {dayz_markSelf > 0} or {dayz_markBody > 0}) then {
execVM "\z\addons\dayz_code\groups\groupMarkers.sqf";
};

View File

@@ -202,8 +202,6 @@ while {1 == 1} do {
player setVariable["USEC_infected",true,true];
};
};
if (!isNil "dayz_groupInit") then {call dayz_groupMarkers;};
// Radiation zones rapid blood loss
if (DZE_InRadiationZone) then {

View File

@@ -30,8 +30,6 @@ sched_onEachFrame = {
diag_log format [ "h1nt: LOW FPS (%1)", diag_fpsmin ];
};
};
if (!isNil "dayz_groupIcons") then {call dayz_groupIcons;};
_ret
};

View File

@@ -22,7 +22,7 @@
5 displayRemoveAllEventHandlers
5 displaySetEventHandler
5 enableEnvironment
5 groupIcon !="uiNamespace setVariable ['DZ_GroupIcons',_this select 0];" !="80000 cutRsc [\"DZ_GroupIcons\",\"PLAIN\"];" !="_display = uiNamespace getVariable \"DZ_GroupIcons\";" !"if (!isNull (uiNamespace getVariable \"DZ_GroupIcons\")) then {" !"dayz_groupIcons = compile preprocessFileLineNumbers " !="if (!isNil \"dayz_groupIcons\") then {call dayz_groupIcons;};"
5 groupIcon
5 hideObject !"if (_VectorWorkAround) then {\n_object2 = _ghost2 createVehicleLocal [0,0,0];\nhideObject _object;\n};" !"\"setMarkerPosLocal\",\n\"hideObject\"\n];" !="rhideObject = 'hideObject'" !"rhideObjectcode" !"\"hideObject\", \"hint\","
5 lbCurSel !="_selectedMissionIndex = lbCurSel _lbMissionsControl;" !="_selectedUserIndex = lbCurSel _lbUsersControl;" !="profileNamespace setVariable ['streamerMode',(lbCurSel (_this select 0))];" !="_index = lbCurSel _lbcontrol;" !="_selected = lbCurSel _list;" !="_friendName = _userList lbText (lbCurSel _userList);" !")] call Z_" !"(lbCurSel 7421) call Z_fillCategoryList" !"] call Door" !"] call Plot" !")] spawn TraderDialog" !="[(lbCurSel 21000), ((ctrlParent (_this select 0)) displayCtrl 21001)] spawn EpochDeathBoardClick;" !"((ctrlParent (_this select 0)) closeDisplay 2);" !="_uid = _playerList lbData (lbCurSel _playerList);" !"_myGroup lbData (lbCurSel _myGroup);"
5 lbSet !="_lbUsersControl lbSetColor [_x, [1,0,0,1]];" !="_lbUsersControl lbSetValue [_x, _rating];" !="_control lbSetColor [_x, _color];" !"_weaponsLBSetFocus" !="(_this select 0) displayCtrl 140 lbSetCurSel (profileNamespace getVariable ['streamerMode',0]);" !="(_display displayCtrl 105) lbSetColor [_i, [0.06, 0.05, 0.03, 1]];" !"[7421," !"lbSetPicture [7422, _index" !"lbSetPicture [7402, _index" !"lbSetPicture [7401, _index" !="_userList lbSetData [(lbSize _userList) -1,_friendUID];" !" [TraderDialogItemList, _index, " !"_myGroup lbSetData [_index,getPlayerUID _x];"