Skip to content

Commit

Permalink
Merge pull request #649 from Ansible2/(#642)-update-kiska
Browse files Browse the repository at this point in the history
(#642) update kiska
  • Loading branch information
Ansible2 authored Jan 24, 2025
2 parents 0984749 + d3f7d6e commit a522d9a
Show file tree
Hide file tree
Showing 56 changed files with 1,651 additions and 2,016 deletions.
64 changes: 64 additions & 0 deletions Functions/CBAP/fn_addPerFrameHandler.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* ----------------------------------------------------------------------------
Function: CBAP_fnc_addPerFrameHandler
Description:
A cheap imitation of CBAP_fnc_addPerFrameHandler that uses scheduled environment.
The actual code to run (_function) will be executed in an unscheduled environment.
Avoid using this.
Parameters:
0: _function <CODE> - The function you wish to execute.
1: _delay <NUMBER> - The amount of time in seconds between executions, 0 for every frame. (optional, default: 0)
2: _args <ANY> - Parameters passed to the function executing. This will be the same array every execution. (optional)
Returns:
_handle - A number representing the handle of the function. Use this to remove the handler. <NUMBER>
Example:
(begin example)
_handle = [
{player sideChat format ["every frame! _this: %1", _this];},
0,
["some","params",1,2,3]
] call CBAP_fnc_addPerFrameHandler;
(end)
Author(s):
Ansible2
---------------------------------------------------------------------------- */
if (["cba_common"] call KISKA_fnc_isPatchLoaded) exitWith {
_this call CBA_fnc_addPerFrameHandler;
};

params [
["_function", {}, [{}]],
["_delay", 0, [0]],
["_args", []]
];

if (_function isEqualTo {}) exitWith {-1};

private _id = localNamespace getVariable ['CBAP_perFrameHandlerIdCount',0];
localNamespace setVariable ['CBAP_perFrameHandlerIdCount',_id + 1];
localNamespace setVariable ['CBAP_runPerFrameHandler_' + (str _id),true];

[_function,_delay,_args,_id] spawn {
private _runVar = 'CBAP_runPerFrameHandler_' + (str _id);
waitUntil {
[
_function,
_args
] call CBAP_fnc_directCall;

if (_delay > 0) then {
sleep _delay;
};

localNamespace getVariable [_runVar,false]
};
};


_id
41 changes: 41 additions & 0 deletions Functions/CBAP/fn_removePerFrameHandler.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* ----------------------------------------------------------------------------
Function: CBAP_fnc_removePerFrameHandler
Description:
A cheap imitation of CBAP_fnc_removePerFrameHandler that uses scheduled environment.
Remove a handler that you have added using CBAP_fnc_addPerFrameHandler.
Parameters:
_handle - The function handle you wish to remove. <NUMBER>
Returns:
true if removed successful, false otherwise <BOOLEAN>
Examples:
(begin example)
_handle = [{player sideChat format["every frame! _this: %1", _this];}, 0, ["some","params",1,2,3]] call CBA_fnc_addPerFrameHandler;
sleep 10;
[_handle] call CBA_fnc_removePerFrameHandler;
(end)
Author:
Nou & Jaynus, donated from ACRE project code for use by the community; commy2
---------------------------------------------------------------------------- */
params [
["_handle", -1, [0]]
];

[
{
params ["_handle"];

private _runningVar = 'CBAP_runPerFrameHandler_' + (str _handle);
private _isRunning = localNamespace getVariable [_runningVar,false];
if (!_isRunning) exitWith { false };

localNamespace setVariable [_runningVar,nil];
true
},
_handle
] call CBAP_fnc_directCall
61 changes: 30 additions & 31 deletions Functions/CBAP/fn_waitUntilAndExecute.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,39 @@ Function: CBAP_fnc_waitUntilAndExecute
Description:
A cheap imitation of CBA_fnc_waitUntilAndExecute that uses scheduled environment.
The actual code to run (_function) will be executed in an unscheduled environment.
The actual code to run (_function) will be executed in an unscheduled environment.
Avoid using this.
Avoid using this.
Parameters:
0: _condition <CODE> - The function to evaluate as condition
1: _statement <CODE> - The function to run once the condition is true
2: _args <ANY> - Parameters passed to the functions (statement and condition) executing
3: _timeout <NUMBER> - If >= 0, timeout for the condition in seconds. If < 0, no timeout.
Exactly 0 means timeout immediately on the next iteration
4: _timeoutCode <CODE> - Will execute instead of _statement if the condition times out
2: _args <ANY> - Parameters passed to the functions (statement and condition) executing
3: _timeout <NUMBER> - If >= 0, timeout for the condition in seconds. If < 0, no timeout.
Exactly 0 means timeout immediately on the next iteration
4: _timeoutCode <CODE> - Will execute instead of _statement if the condition times out
Returns:
NOTHING
Example:
(begin example)
[
{
(_this select 0) == vehicle (_this select 0)
},
{
(_this select 0) setDamage 1;
},
[player]
] call CBAP_fnc_waitUntilAndExecute;
[
{
(_this select 0) == vehicle (_this select 0)
},
{
(_this select 0) setDamage 1;
},
[player]
] call CBAP_fnc_waitUntilAndExecute;
(end)
Author(s):
Ansible2
---------------------------------------------------------------------------- */

if (["cba_common"] call KISKA_fnc_isPatchLoaded) exitWith {
_this call CBA_fnc_waitUntilAndExecute;
_this call CBA_fnc_waitUntilAndExecute;
};

params [
Expand All @@ -49,23 +48,23 @@ params [
];

_this spawn {
params ["_condition","_statement","_args","_timeout","_timeoutCode"];
params ["_condition","_statement","_args","_timeout","_timeoutCode"];

private _hasTimeout = _timeout >= 0;
private _timeoutTime = time + _timeout;
waitUntil {
if (_args call _condition) exitWith {
[_statement, _args] call CBAP_fnc_directCall;
true
};
private _hasTimeout = _timeout >= 0;
private _timeoutTime = time + _timeout;
waitUntil {
if (_args call _condition) exitWith {
[_statement, _args] call CBAP_fnc_directCall;
true
};

if (_hasTimeout AND (time >= _timeoutTime)) exitWith {
[_timeoutCode, _args] call CBAP_fnc_directCall;
true
};
if (_hasTimeout AND (time >= _timeoutTime)) exitWith {
[_timeoutCode, _args] call CBAP_fnc_directCall;
true
};

false
};
false
};
};


Expand Down
2 changes: 1 addition & 1 deletion Functions/Stalking/fn_stalking_start.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ _stalkerGroup setVariable ["BLWK_stalking_emptyEventId",_emptyEventId];
// _x move _playerPosition;
// };
_stalkerGroup move _playerPosition;
[_stalkerGroup,["told to move ",_playerPosition] joinString ""] call _fn_add3dLog;
// [_stalkerGroup,["told to move ",_playerPosition] joinString ""] call _fn_add3dLog;

} else {

Expand Down
5 changes: 5 additions & 0 deletions Headers/descriptionEXT/GUI/imports.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import RscButtonMenu;
import RscCheckBox;
import RscPicture;
import ctrlListNBox;
import RscListbox;
import RscControlsGroupNoHScrollbars;
import RscControlsGroupNoScrollbars;
import ctrlButtonPicture;
import ctrlButton;

// import RscControlsGroup;
// import RscControlsGroupNoScrollbars;
Expand Down
7 changes: 6 additions & 1 deletion Headers/descriptionEXT/functions.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class BLWK{
class BLWK
{
class AiPathing
{
file = "functions\AI Pathing";
Expand Down Expand Up @@ -568,6 +569,8 @@ class CBAP //ported CBA functions
file = "functions\CBAP";
class addWaypoint
{};
class addPerFrameHandler
{};
class directCall
{};
class getArea
Expand All @@ -586,6 +589,8 @@ class CBAP //ported CBA functions
{};
class randPosArea
{};
class removePerFrameHandler
{};
class shuffle
{};
class simplifyAngle
Expand Down
27 changes: 1 addition & 26 deletions KISKA Systems/KISKA Functions.hpp
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
class KISKA
{
#include "KISKA Parameter Menu\Headers\param menu functions.hpp"
#include "KISKA View DIstance Limiter\Headers\View Distance Limiter Functions.hpp"

class DynamicViewDistance
{
file = "KISKA Systems\View Distance Limiter\Functions";
class addOpenVdlGuiDiary
{
postInit = 1;
};
class adjustVdlControls
{};
class findVdlPartnerControl
{};
class handleVdlDialogOpen
{};
class handleVdlGuiCheckbox
{};
class isVdlSystemRunning
{};
class openVdlDialog
{};
class setAllVdlButton
{};
class setVdlValue
{};
class viewDistanceLimiter
{};
};
class KISKA_RandomMusic
{
file = "KISKA Systems\KISKA Music Functions\Random Music";
Expand Down
28 changes: 28 additions & 0 deletions KISKA Systems/KISKA Headers/GUI/KISKA GUI Classes.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "KISKA GUI Colors.hpp"
#include "KISKA GUI Grid.hpp"

class KISKA_RscCloseButton : RscButtonMenu
{
idc = -1;
text = "";
x = KISKA_POS_X(7.5);
y = KISKA_POS_Y(-10);
w = KISKA_POS_W(1);
h = KISKA_POS_H(1);
colorText[] = KISKA_GREY_COLOR(0,1);
colorActive[] = KISKA_GREY_COLOR(0,1);
textureNoShortcut = "\A3\3den\Data\Displays\Display3DEN\search_END_ca.paa";
class ShortcutPos
{
left = 0;
top = 0;
w = KISKA_POS_W(1);
h = KISKA_POS_H(1);
};
animTextureNormal = "#(argb,8,8,3)color(1,0,0,0.57)";
animTextureDisabled = "";
animTextureOver = "#(argb,8,8,3)color(1,0,0,0.57)";
animTextureFocused = "";
animTexturePressed = "#(argb,8,8,3)color(1,0,0,0.57)";
animTextureDefault = "";
};
15 changes: 15 additions & 0 deletions KISKA Systems/KISKA Headers/GUI/KISKA GUI Colors.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef KISKA_COLORS

#define KISKA_COLORS 1

#define KISKA_PROFILE_BACKGROUND_COLOR(ALPHA)\
{\
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",\
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",\
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",\
ALPHA\
}

#define KISKA_GREY_COLOR(PERCENT,ALPHA) {PERCENT,PERCENT,PERCENT,ALPHA}

#endif
17 changes: 17 additions & 0 deletions KISKA Systems/KISKA Headers/GUI/KISKA GUI Grid.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#ifndef KISKA_GUI_GRID

#define KISKA_GUI_GRID 1

#define KISKA_UI_GRID_X (0.5)
#define KISKA_UI_GRID_Y (0.5)
#define KISKA_UI_GRID_W (2.5 * pixelW * pixelGrid)
#define KISKA_UI_GRID_H (2.5 * pixelH * pixelGrid)

#define KISKA_POS_X(N) N * KISKA_UI_GRID_W + KISKA_UI_GRID_X
#define KISKA_POS_Y(N) N * KISKA_UI_GRID_H + KISKA_UI_GRID_Y
#define KISKA_POS_W(N) N * KISKA_UI_GRID_W
#define KISKA_POS_H(N) N * KISKA_UI_GRID_H

#define KISKA_GUI_TEXT_SIZE(MULTIPLIER) (pixelH * pixelGrid) * MULTIPLIER

#endif
Loading

0 comments on commit a522d9a

Please sign in to comment.