Skip to content

Commit

Permalink
Merge pull request #20 from gruppe-adler/blackforest-improvements
Browse files Browse the repository at this point in the history
Blackforest II improvements
  • Loading branch information
McDiod authored Nov 20, 2018
2 parents 46b6932 + b8c1143 commit a5ffc3e
Show file tree
Hide file tree
Showing 136 changed files with 6,861 additions and 2,046 deletions.
13 changes: 13 additions & 0 deletions description.ext
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,22 @@ class CfgGradCivs {
debugMode = 0;
};

class GRAD_Replay {
precision = 3; // precision of replay, 5 means every 5 seconds one snapshot (number)
trackedSides[] = {"west","east","independent"}; // defines the sides that will be tracked (possible are "west", "east", "independant", "civilian") (array)
stepsPerTick = 1; // defines steps played back at once (number)
trackedVehicles = 1; // defines if empty and AI steered vehicles will be tracked (0/1)
trackedAI = 1; // defines if AI will be tracked (0/1)
sendingChunkSize = 10; // higher number means replay loading is faster, but might cause instability / lags during loading
trackShots = 1; // defines if shots will be tracked (0/1)
};


//DIALOGS ======================================================================
#include "node_modules\grad-listBuymenu\grad_listBuymenu.hpp"
#include "node_modules\grad-fortifications\grad_fortifications.hpp"
#include "node_modules\@gruppe-adler\replay\ui\defines.hpp"
#include "node_modules\@gruppe-adler\replay\ui\dialog.hpp"

class RscTitles {
#include "node_modules\grad-fortifications\dialog\hint\title.hpp"
Expand Down Expand Up @@ -115,6 +127,7 @@ class CfgFunctions {
#include "node_modules\grad-loadout\cfgFunctions.hpp"
#include "node_modules\grad-listbuymenu\cfgFunctions.hpp"
#include "node_modules\grad-fortifications\cfgFunctions.hpp"
#include "node_modules\@gruppe-adler\replay\cfgFunctions.hpp"
#include "node_modules\grad-civs\cfgFunctions.hpp"
};

Expand Down
30 changes: 3 additions & 27 deletions functions/endings/fn_endMissionClient.sqf
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
#include "component.hpp"

_this spawn {
params ["_configName","_winText","_winners","_winTextParams"];
private ["_winText","_winners","_winTextParams"];
params [["_winners",[]]];

if (isNil "_winText") then {
_winText = [missionConfigFile >> "CfgWinConditions" >> _configName,"winText",""] call BIS_fnc_returnConfigEntry;
};
if (isNil "_winners") then {
_winners = ([missionConfigFile >> "CfgWinConditions" >> _configName,"winners",[]] call BIS_fnc_returnConfigEntry) apply {call compile _x};
};
private _winTextParams = ([missionConfigFile >> "CfgWinConditions" >> _configName,"winTextParams",[]] call BIS_fnc_returnConfigEntry) apply {call compile _x};

_winText = "<img size= '6' style='vertical-align:middle' shadow='false' image='data\gruppe-adler.paa'/><br/><t size='.9' color='#FFFFFF'>" + _winText + "</t>";

_text = format ([_winText] + _winTextParams);
[_text,0,0,4,2] spawn BIS_fnc_dynamicText;

INFO_3("%1 %2 %3",_winText,_text,_winners);

sleep 5;

if (({[_x] call grad_points_fnc_getPoints > 0} count [WEST,EAST,INDEPENDENT,CIVILIAN]) > 0) then {
[] call grad_points_fnc_displayPoints;
sleep 16;
};

["end1",playerSide in _winners,true,true,true] spawn BIS_fnc_endMission;
};
waitUntil {missionNamespace getVariable ["REPLAY_FINISHED",false]};
["end1",playerSide in _winners,true,true,true] spawn BIS_fnc_endMission;
37 changes: 33 additions & 4 deletions functions/endings/fn_endMissionServer.sqf
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
#include "component.hpp"

params ["_configName","_winText","_winners","_winTextParams"];

if (missionNamespace getVariable ["grad_endings_endingInProgress",false]) exitWith {};
missionNamespace setVariable ["grad_endings_endingInProgress",true];
INFO_1("Ending %1 in progress.",_configName);

[_configName,_winText,_winners,_winTextParams] remoteExec ["grad_endings_fnc_endMissionClient",0,false];
_this spawn {
params ["_configName","_winText","_winners","_winTextParams"];
private ["_winText","_winners","_winTextParams"];

INFO_1("Ending %1 in progress.",_configName);

if (isNil "_winText") then {
_winText = [missionConfigFile >> "CfgWinConditions" >> _configName,"winText",""] call BIS_fnc_returnConfigEntry;
};
if (isNil "_winners") then {
_winners = ([missionConfigFile >> "CfgWinConditions" >> _configName,"winners",[]] call BIS_fnc_returnConfigEntry) apply {call compile _x};
};
_winTextParams = ([missionConfigFile >> "CfgWinConditions" >> _configName,"winTextParams",[]] call BIS_fnc_returnConfigEntry) apply {call compile _x};

_winText = "<img size= '6' style='vertical-align:middle' shadow='false' image='data\gruppe-adler.paa'/><br/><t size='.9' color='#FFFFFF'>" + _winText + "</t>";

_text = format ([_winText] + _winTextParams);

// show end title
[_text,0,0,4,2] remoteExec ["BIS_fnc_dynamicText",0,false];
INFO_3("%1 %2 %3",_winText,_text,_winners);
sleep 5;

// show points
if (({[_x] call grad_points_fnc_getPoints > 0} count [WEST,EAST,INDEPENDENT,CIVILIAN]) > 0) then {
[] remoteExecCall ["grad_points_fnc_displayPoints",0,false];
sleep 16;
};

// show replay
[] call GRAD_replay_fnc_stopRecord;
[_winners] remoteExec ["grad_endings_fnc_endMissionClient",0,false];
};
67 changes: 45 additions & 22 deletions functions/endings/fn_presetElimination.sqf
Original file line number Diff line number Diff line change
@@ -1,45 +1,68 @@
#include "component.hpp"
#define PLAYABLE_UNITS (playableUnits + switchableUnits)

params ["_winName","_sides"];
_sides = _sides apply {call compile _x};
params ["_winName","_sides",["_isRecursion",false],["_taskID","taskElimination"]];

private _winners = [missionConfigFile >> "CfgWinConditions" >> _winName, "winners",[]] call BIS_fnc_returnConfigEntry;
_winners = _winners apply {call compile _x};

//CREATE TASK ==================================================================
private _taskID = "taskElimination";
{_taskID = _taskID + "_w" + str _x} forEach _winners;
{_taskID = _taskID + "_l" + str _x} forEach _sides;
if (!_isRecursion) then {
_sides = _sides apply {call compile _x};

private _taskDesc = format ["Eliminate all players of side %1",[_sides select 0] call grad_common_fnc_getSideDisplayName];
_winners = [missionConfigFile >> "CfgWinConditions" >> _winName, "winners",[]] call BIS_fnc_returnConfigEntry;
_winners = _winners apply {call compile _x};

//CREATE TASK ==================================================================
{_taskID = _taskID + "_w" + str _x} forEach _winners;
{_taskID = _taskID + "_l" + str _x} forEach _sides;

_taskDesc = format ["Eliminate all players of side %1",[_sides select 0] call grad_common_fnc_getSideDisplayName];
{
if (_forEachIndex > 0) then {
_taskDesc = _taskDesc + "and " + ([_x] call grad_common_fnc_getSideDisplayName);
};
} forEach _sides;
_taskDesc = _taskDesc + ".";

[_taskID,_winners,[_taskDesc,"Eliminate Enemies",""],objNull,"AUTOASSIGNED",3,true,true,"kill"] call BIS_fnc_setTask;
};

//PFH ==========================================================================
private _respawningPlayersArrays = [];
{
if (_forEachIndex > 0) then {
_taskDesc = _taskDesc + "and " + ([_x] call grad_common_fnc_getSideDisplayName);
_array = switch (_x) do {
case (WEST): {waitingPlayersBlu};
case (EAST): {waitingPlayersOpf};
case (INDEPENDENT): {waitingPlayersInd};
default {[]};
};
_respawningPlayersArrays pushBack _array;
} forEach _sides;
_taskDesc = _taskDesc + ".";

[_taskID,_winners,[_taskDesc,"Eliminate Enemies",""],objNull,"AUTOASSIGNED",3,true,true,"kill"] call BIS_fnc_setTask;
private _fnc_check = [
{
{(side _x) in _sides} count playableUnits == 0
},
{
{(side _x) in _sides} count playableUnits == 0 &&
{{({!isNull _x} count _x) > 0} count _respawningPlayersArrays == 0}
}
] select (([missionConfigFile >> "missionsettings","waveRespawnEnabled",0] call BIS_fnc_returnConfigEntry) == 1);

//PFH ==========================================================================
[{
params ["_args","_handle"];
_args params ["_winName","_sides","_taskID"];
_args params ["_winName","_sides","_taskID","_fnc_check","_respawningPlayersArrays"];

if ({_side = _x; ({side _x == _side} count PLAYABLE_UNITS) > 0} count _sides == 0) exitWith {
if (call _fnc_check) exitWith {

[{
params ["_winName","_sides","_taskID"];
if ({_side = _x; ({side _x == _side} count PLAYABLE_UNITS) > 0} count _sides == 0) then {
params ["_winName","_sides","_taskID","_fnc_check","_respawningPlayersArrays"];
if (call _fnc_check) then {

[_taskID,"SUCCEEDED",true] call BIS_fnc_taskSetState;
[_winName] call grad_endings_fnc_endMissionServer;
} else {
_this call grad_endings_fnc_presetElimination;
[_winName,_sides,true,_taskID] call grad_endings_fnc_presetElimination;
};
}, [_winName,_sides,_taskID], 10] call CBA_fnc_waitAndExecute;
}, [_winName,_sides,_taskID,_fnc_check,_respawningPlayersArrays], 10] call CBA_fnc_waitAndExecute;

[_handle] call CBA_fnc_removePerFrameHandler;
};
},10,[_winName,_sides,_taskID]] call CBA_fnc_addPerFrameHandler;
},10,[_winName,_sides,_taskID,_fnc_check,_respawningPlayersArrays]] call CBA_fnc_addPerFrameHandler;
2 changes: 1 addition & 1 deletion functions/endings/fn_startPreset.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
params ["_winCondition"];

private _preset = [_winCondition,"preset",""] call BIS_fnc_returnConfigEntry;
private _presetParams = [_winCondition,"presetParams",[]] call BIS_fnc_returnConfigEntry;
private _presetParams = [_winCondition,"presetParams",[]] call BIS_fnc_returnConfigEntry;;
private _winName = configName _winCondition;

INFO_2("Initializing preset %1 (%2).",_preset,_winName);
Expand Down
12 changes: 9 additions & 3 deletions functions/missionSetup/fn_initMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ grad_missionsettings_canUseScopes = ([missionConfigFile >> "missionsettings","ca
[] call grad_missionSetup_fnc_intro;
[] call grad_missionSetup_fnc_initCivs;
[] call grad_groupsettings_fnc_setGroupSettings;

if (!isServer) then {[] call GRAD_replay_fnc_init};

[{!isNull player || isDedicated},{

if (isServer) then {
[["PREPARATION_TIME", 0] call BIS_fnc_getParamValue] call grad_missionSetup_fnc_startPreparationTime;
[{CBA_missionTime > 10 && {missionNamespace getVariable ["GRAD_MISSIONSTARTED",false]}}, {[] call grad_endings_fnc_init}, []] call CBA_fnc_waitUntilAndExecute;
[{CBA_missionTime > 10 && {missionNamespace getVariable ["GRAD_MISSIONSTARTED",false]}}, {
[] call grad_endings_fnc_init;
[] call GRAD_replay_fnc_init;
}, []] call CBA_fnc_waitUntilAndExecute;
};

if (hasInterface) then {
setViewDistance 3000;
setObjectViewDistance 2500;

if (hasInterface) then {

};
},[]] call CBA_fnc_waitUntilAndExecute;
6 changes: 2 additions & 4 deletions functions/points/fn_addPoints.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ if (!isServer) exitWith {_this remoteExec ["grad_points_fnc_addPoints",2,false]}
params ["_side","_points",["_category","Other"]];
private ["_newPoints","_categoriesVarName"];

if (_side == sideUnknown) exitWith {};

switch (_side) do {
case (WEST): {
_newPoints = (missionNamespace getVariable ["grad_common_points_west",0]) + _points;
Expand Down Expand Up @@ -32,13 +34,9 @@ switch (_side) do {
};
default {
_newPoints = 0;
_categoriesVarName = "none";
};
};

// fix for empty side
if (_categoriesVarName isEqualTo "none") exitWith { 0 };

private _categories = missionNamespace getVariable _categoriesVarName;

private _resultID = [_categories,_category] call BIS_fnc_findInPairs;
Expand Down
6 changes: 3 additions & 3 deletions functions/points/fn_displayPoints.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

if (!isServer && !isRemoteExecuted) exitWith {[] remoteExec ["grad_points_fnc_displayPoints",2,false]};

if (isServer && count _this == 0) then {
if (isServer && count _this == 0) exitWith {
[
[([WEST] call grad_points_fnc_getPointsCategorized),[],{_x select 1},"DESCEND"] call BIS_fnc_sortBy,
[([EAST] call grad_points_fnc_getPointsCategorized),[],{_x select 1},"DESCEND"] call BIS_fnc_sortBy,
Expand Down Expand Up @@ -64,15 +64,15 @@ if (hasInterface && count _this > 0) then {
_text = [parseText format ["<t size='1.5'>Points for <t color='%1'>%2</t>:</t>",[_side,"HTML"] call grad_common_fnc_getSideColor,[_side] call grad_common_fnc_getSideDisplayName],lineBreak,lineBreak];
{
_x params ["_category","_points"];
_text pushBack (parseText format ["%1: <t color='%2'>%3</t>",_category,if (_points > 0) then {"#00ff00"} else {"#ff0000"},_points]);
_text pushBack (parseText format ["%1: <t color='%2'>%3</t>",_category,if (_points > 0) then {"#00ff00"} else {"#ff0000"},round _points]);
_text pushBack lineBreak;
false
} count _x;
_textCtrl ctrlSetStructuredText composeText _text;

_sumCtrl = _display ctrlCreate ["RscStructuredText",-1];
_sumCtrl ctrlSetPosition [(0.5-_backgroundW/2) + PADDINGW + _columnCount * (PADDINGW + COLUMNW),BACKGROUNDY + PADDINGH + COLUMNH,COLUMNW,SUMH];
_sumCtrl ctrlSetStructuredText (parseText format ["Total: <t color = '#00ff00'>%1</t>",[_side] call grad_points_fnc_getPoints]);
_sumCtrl ctrlSetStructuredText (parseText format ["Total: <t color = '#00ff00'>%1</t>",round ([_side] call grad_points_fnc_getPoints)]);
_sumCtrl ctrlCommit 0;

if (_columnCount > 0) then {
Expand Down
4 changes: 1 addition & 3 deletions functions/sectors/fn_startPFH.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
params ["_trigger"];
INFO_1("PFH for %1 starting.",_trigger getVariable "grad_sectors_sectorName");

[_trigger] call grad_sectors_fnc_updateMarker;

[{
params ["_trigger","_handle"];
if (isNull _trigger) exitWith {
Expand All @@ -17,7 +15,7 @@ INFO_1("PFH for %1 starting.",_trigger getVariable "grad_sectors_sectorName");

_oldOwner = _trigger getVariable "grad_sectors_currentOwner";
_pps = _trigger getVariable "grad_sectors_pointsPerSecond";
if (_pps > 0) then {
if (_pps > 0 && {_oldOwner != sideUnknown}) then {
_categoryName = format ["Held %1",_trigger getVariable "grad_sectors_sectorName"];
[_oldOwner,_pps,_categoryName] call grad_points_fnc_addPoints;
};
Expand Down
2 changes: 2 additions & 0 deletions functions/waverespawn/cfgFunctions.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
class GRAD_waverespawn {
class waverespawn {
class addToWaiting {};
class addToWave {};
class canRespawn {};
class checkEnoughForWave {};
class getStatus {};
class init {postInit = 1;};
class onPlayerKilled {};
Expand Down
27 changes: 27 additions & 0 deletions functions/waverespawn/fn_addToWaiting.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include "component.hpp"

params ["_deadPlayer",["_deadPlayerSide", sideUnknown],["_add",true]];

if (isNil QGVAR(waitingPlayersBlu)) then {GVAR(waitingPlayersBlu) = []};
if (isNil QGVAR(waitingPlayersOpf)) then {GVAR(waitingPlayersOpf) = []};
if (isNil QGVAR(waitingPlayersInd)) then {GVAR(waitingPlayersInd) = []};

//add player to array
private _array = switch (_deadPlayerSide) do {
case (WEST): {GVAR(waitingPlayersBlu)};
case (EAST): {GVAR(waitingPlayersOpf)};
case (INDEPENDENT): {GVAR(waitingPlayersInd)};
default {[]};
};

if (_add) then {
_array pushBackUnique _deadPlayer
} else {
_id = _array find _deadPlayer;
while {_id >= 0} do {
_array deleteAt _id;
_id = _array find _deadPlayer;
};
};

[_deadPlayerSide] call FUNC(checkEnoughForWave);
36 changes: 17 additions & 19 deletions functions/waverespawn/fn_addToWave.sqf
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
#include "component.hpp"

params ["_deadPlayerName", ["_deadPlayerSide", sideUnknown]];
params ["_deadPlayer", ["_deadPlayerSide", sideUnknown]];

if (isNil "deadPlayersBlu") then {deadPlayersBlu = []};
if (isNil "deadPlayersOpf") then {deadPlayersOpf = []};
if (isNil "deadPlayersInd") then {deadPlayersInd = []};

_deadPlayerName = [_deadPlayerName] call BIS_fnc_filterString;
if (isNil QGVAR(wavePlayersBlu)) then {GVAR(wavePlayersBlu) = []};
if (isNil QGVAR(wavePlayersOpf)) then {GVAR(wavePlayersOpf) = []};
if (isNil QGVAR(wavePlayersInd)) then {GVAR(wavePlayersInd) = []};

//add player to array
switch (_deadPlayerSide) do {
case (WEST): {
deadPlayersBlu pushBackUnique _deadPlayerName;
INFO_2("Added player %1 to deadPlayersBlu. %2 dead blufor total.", _deadPlayerName, count deadPlayersBlu);
WAVERESPAWNPLAYERSLEFTBLU = BLUFORWAVESIZE - (count deadPlayersBlu);
publicVariable "WAVERESPAWNPLAYERSLEFTBLU";
GVAR(wavePlayersBlu) pushBackUnique _deadPlayer;
INFO_2("Added player %1 to wavePlayersBlu. %2 dead blufor total.", _deadPlayer, count GVAR(wavePlayersBlu));
GVAR(WAVERESPAWNPLAYERSLEFTBLU) = GVAR(BLUFORWAVESIZE) - (count GVAR(wavePlayersBlu));
publicVariable QGVAR(WAVERESPAWNPLAYERSLEFTBLU);
};
case (EAST): {
deadPlayersOpf pushBackUnique _deadPlayerName;
INFO_2("Added player %1 to deadPlayersOpf. %2 dead opfor total.", _deadPlayerName, count deadPlayersOpf);
WAVERESPAWNPLAYERSLEFTOPF = OPFORWAVESIZE - (count deadPlayersOpf);
publicVariable "WAVERESPAWNPLAYERSLEFTOPF";
GVAR(wavePlayersOpf) pushBackUnique _deadPlayer;
INFO_2("Added player %1 to wavePlayersOpf. %2 dead opfor total.", _deadPlayer, count GVAR(wavePlayersOpf));
GVAR(WAVERESPAWNPLAYERSLEFTOPF) = GVAR(OPFORWAVESIZE) - (count GVAR(wavePlayersOpf));
publicVariable QGVAR(WAVERESPAWNPLAYERSLEFTOPF);
};
case (INDEPENDENT): {
deadPlayersInd pushBackUnique _deadPlayerName;
INFO_2("Added player %1 to deadPlayersOpf. %2 dead opfor total.", _deadPlayerName, count deadPlayersInd);
WAVERESPAWNPLAYERSLEFTIND = INDEPWAVESIZE - (count deadPlayersInd);
publicVariable "WAVERESPAWNPLAYERSLEFTIND";
GVAR(wavePlayersInd) pushBackUnique _deadPlayer;
INFO_2("Added player %1 to wavePlayersOpf. %2 dead opfor total.", _deadPlayer, count GVAR(wavePlayersInd));
GVAR(WAVERESPAWNPLAYERSLEFTIND) = GVAR(INDEPWAVESIZE) - (count GVAR(wavePlayersInd));
publicVariable QGVAR(WAVERESPAWNPLAYERSLEFTIND);
};
default {
ERROR_1("Unknown side for player %1", _deadPlayerName);
ERROR_1("Unknown side for player %1", _deadPlayer);
};
};
Loading

0 comments on commit a5ffc3e

Please sign in to comment.