-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from gruppe-adler/saving-rework
Saving Rework
- Loading branch information
Showing
26 changed files
with
1,003 additions
and
854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,22 @@ | ||
params ["_array", "_index"]; | ||
#include "script_component.hpp" | ||
|
||
// hintsilent format ["appending array %1", count GRAD_REPLAY_DATABASE_LOCAL]; | ||
// diag_log format ["appending array %1", count GRAD_REPLAY_DATABASE_LOCAL]; | ||
params ["_chunk", "_startIndex"]; | ||
|
||
GRAD_REPLAY_DATABASE_LOCAL set [_index, (parseSimpleArray _array)]; | ||
// add all received parts to database | ||
{ | ||
GRAD_REPLAY_DATABASE_LOCAL set [_startIndex + _forEachIndex, _x]; | ||
} forEach _chunk; | ||
|
||
// start assembling, if everything has been received | ||
private _targetCount = missionNamespace getVariable ["GRAD_REPLAY_DATABASE_TARGET_COUNT_LOCAL",9999999]; | ||
if ({!isNil "_x"} count GRAD_REPLAY_DATABASE_LOCAL >= _targetCount) then { | ||
|
||
// apparently function can run multiple times in parallel --> exit here if other instance was first | ||
if (player getVariable ["grad_replay_playerReceiptComplete",false]) exitWith {}; | ||
player setVariable ["grad_replay_playerReceiptComplete",true,true]; | ||
|
||
INFO_1("Client replay receipt completed at serverTime %1",serverTime); | ||
diag_log [{!isNil "_x"} count GRAD_REPLAY_DATABASE_LOCAL,count GRAD_REPLAY_DATABASE_LOCAL,_targetCount,_startIndex,count _chunk]; | ||
|
||
[{[] call grad_replay_fnc_assembleReplayData},[],1] call CBA_fnc_waitAndExecute; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include "script_component.hpp" | ||
|
||
params [["_part",0],["_startIndex",0],["_startTime",diag_tickTime],["_currentUnitsDataStates",[]]]; | ||
|
||
if (_part == 0) then { | ||
INFO("Assembling replay data."); | ||
} else { | ||
INFO_2("Continuing assembly at index %1 (recursion %2).",_startIndex,_part); | ||
}; | ||
|
||
if (isNil "GRAD_REPLAY_DATABASE_LOCAL_ASSEMBLED") then { | ||
GRAD_REPLAY_DATABASE_LOCAL_ASSEMBLED = []; | ||
}; | ||
|
||
private _typeDefaults = [ | ||
"", // icon | ||
-1, // color ID | ||
[0,0], // pos2D | ||
-1, // dir | ||
"", // name | ||
"" // group name | ||
]; | ||
|
||
private _interrupt = false; | ||
private _startTimePart = diag_tickTime; | ||
private _continueAt = 0; | ||
|
||
for [{_i=_startIndex},{_i< count GRAD_REPLAY_DATABASE_LOCAL},{_i=_i+1}] do { | ||
|
||
_compressedIntervalData = GRAD_REPLAY_DATABASE_LOCAL select _i; | ||
_intervalData = []; | ||
|
||
{ | ||
// catch nil entries, not sure what's causing them | ||
if (!isNil "_x") then { | ||
|
||
// timestamp | ||
if (_x isEqualType 0) exitWith { | ||
_intervalData pushBack _x; | ||
}; | ||
|
||
// data array | ||
if (_x isEqualType []) then { | ||
_unitData = []; | ||
_compressedUnitData = _x; | ||
|
||
if (_forEachIndex >= count _currentUnitsDataStates) then { | ||
_currentUnitsDataStates pushBack []; | ||
}; | ||
_currentUnitDataState = _currentUnitsDataStates select _forEachIndex; | ||
|
||
{ | ||
if (isNil "_x") then { | ||
_unitData pushBack (_currentUnitDataState param [_forEachIndex,_typeDefaults select _forEachIndex]); | ||
} else { | ||
_currentUnitDataState set [_forEachIndex,_x]; | ||
_unitData pushBack _x; | ||
}; | ||
} forEach _compressedUnitData; | ||
|
||
_intervalData pushBack _unitData; | ||
}; | ||
}; | ||
} forEach _compressedIntervalData; | ||
|
||
GRAD_REPLAY_DATABASE_LOCAL_ASSEMBLED pushBack _intervalData; | ||
|
||
if ((diag_tickTime - _startTimePart) > 0.2) exitWith {_interrupt = true; _continueAt = _i + 1}; | ||
}; | ||
|
||
if (_interrupt) then { | ||
[{_this call grad_replay_fnc_assembleReplayData},[_part + 1,_continueAt,_startTime,_currentUnitsDataStates]] call CBA_fnc_execNextFrame; | ||
} else { | ||
player setVariable ["grad_replay_playerAssemblyComplete",true,true]; | ||
INFO_1("Assembling completed in %1s",diag_tickTime - _startTime); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
params ["_map", "_index"]; | ||
|
||
private _positionData = GRAD_REPLAY_DATABASE_LOCAL param [grad_replay_playbackPosition,[]]; | ||
private _positionData = GRAD_REPLAY_DATABASE_LOCAL_ASSEMBLED param [grad_replay_playbackPosition,[]]; | ||
if !(_positionData isEqualType []) exitWith {}; | ||
|
||
private _iconData = _positionData param [_index,[]]; | ||
if !(_iconData isEqualType []) exitWith {}; | ||
|
||
_scale = ctrlMapScale _map; | ||
_showName = _scale < 0.03; | ||
|
||
_iconData params [ | ||
["_icon", ""], | ||
["_color", [0,0,0,0]], | ||
["_colorID", -1], | ||
["_pos", [0,0,0]], | ||
["_dir", 0], | ||
["_name", ""], | ||
["_groupname", ""] | ||
]; | ||
|
||
|
||
_name = if (_showName) then { _name + " " + _groupname } else { "" }; | ||
private _showName = (ctrlMapScale _map) < 0.03; | ||
private _name = if (_showName) then { _name + " " + _groupname } else { "" }; | ||
private _color = [_colorID] call grad_replay_fnc_getColorFromID; | ||
|
||
_map drawIcon [ | ||
_icon, | ||
_color, | ||
_pos, | ||
24, | ||
24, | ||
_dir, | ||
_name, | ||
1, | ||
0.03, | ||
'TahomaB', | ||
'right' | ||
_icon, | ||
_color, | ||
_pos, | ||
24, | ||
24, | ||
_dir, | ||
_name, | ||
1, | ||
0.03, | ||
'TahomaB', | ||
'right' | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* Color lookup table to reduce variable size when saving. | ||
* | ||
*/ | ||
|
||
|
||
#define DEFAULT_COLOR [0.7,0.6,0,1] | ||
|
||
params [["_colorID",-1]]; | ||
|
||
private _colors = [ | ||
|
||
// side color IDs | ||
[0,0.3,0.6,1], // 0: WEST | ||
[0.5,0,0,1], // 1: EAST | ||
[0,0.5,0,1], // 2: INDEPENDENT | ||
[0.4,0,0.5,1], // 3: CIVILIAN | ||
[0.7,0.6,0,1], // 4: SIDEEMPTY | ||
|
||
// unconscious IDs are currently hardcoded to be exactly +5 in fn_startRecord! | ||
[0,0.3,0.6,0.5], // 5: WEST unconscious | ||
[0.5,0,0,0.5], // 6: EAST unconscious | ||
[0,0.5,0,0.5], // 7: INDEPENDENT unconscious | ||
[0.4,0,0.5,0.5], // 8: CIVILIAN unconscious | ||
[0.7,0.6,0,0.5], // 9: SIDEEMPTY unconscious | ||
|
||
// other | ||
[0.2,0.2,0.2,0.5], // 10: dead unit | ||
[1,0,0,1] // 11: funkwagen-red when sending, speciality for mission "breaking contact" | ||
]; | ||
|
||
_colors param [_colorID,DEFAULT_COLOR] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
#include "\z\ace\addons\main\script_component.hpp" | ||
|
||
{_x setMarkerAlphaLocal 0;} forEach allMapMarkers; // hide all markers for replay --> to be tested | ||
|
||
if (dialog) then {closeDialog 0;}; | ||
|
||
[ "TIMER", "onEachFrame" ] call BIS_fnc_removeStackedEventHandler; | ||
ctrlDelete (uiNamespace getVariable "GRAD_replay_rsc_loadingBar"); | ||
ctrlDelete (uiNamespace getVariable "GRAD_replay_txt_loading"); | ||
ctrlDelete (uiNamespace getVariable "GRAD_replay_txt_loadingInfo"); | ||
|
||
[] spawn GRAD_replay_fnc_startPlaybackClient; | ||
[] spawn GRAD_replay_fnc_startPlaybackClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
params ["_position"]; | ||
|
||
disableSerialization; | ||
_time = GRAD_REPLAY_DATABASE_LOCAL select _position select (count (GRAD_REPLAY_DATABASE_LOCAL select _position) - 1); | ||
private _time = GRAD_REPLAY_DATABASE_LOCAL_ASSEMBLED select _position select (count (GRAD_REPLAY_DATABASE_LOCAL_ASSEMBLED select _position) - 1); | ||
|
||
// if (_time find ".paa" > -1) exitWith { diag_log format ["grad-replay: catch unvalid time display: %1", _position]; }; | ||
|
||
((findDisplay 80000) displayCtrl 80004) ctrlSetText _time; | ||
((findDisplay 80000) displayCtrl 80004) ctrlSetText ([_time,"HH:MM:SS"] call BIS_fnc_timeToString); |
Oops, something went wrong.