Skip to content

Commit

Permalink
Merge pull request #6402 from mharis001/explosives-timer
Browse files Browse the repository at this point in the history
Explosives - New Timer UI
  • Loading branch information
commy2 authored Sep 13, 2018
2 parents 0e98090 + f2a5779 commit 66da48f
Show file tree
Hide file tree
Showing 23 changed files with 238 additions and 156 deletions.
2 changes: 1 addition & 1 deletion addons/explosives/ACE_Arsenal_Stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class EGVAR(arsenal,stats) {
scope = 2;
priority = 1;
stats[] = {QGVAR(Range)};
displayName= CSTRING(statExploRange);
displayName = CSTRING(statExploRange);
showText = 1;
textStatement = QUOTE(params [ARR_2('_stat', '_config')]; private _exploRangeStat = getNumber (_config >> _stat select 0); format [ARR_3('%1m (%2ft)', _exploRangeStat, (_exploRangeStat / 0.3048) toFixed 1)]);
condition = QUOTE(params [ARR_2('', '_config')]; (getNumber (_config >> QQGVAR(Detonator))) > 0);
Expand Down
28 changes: 17 additions & 11 deletions addons/explosives/ACE_Triggers.hpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
class ACE_Triggers {
/* onPlace parameters:
0: OBJECT - unit placing
1: OBJECT - Placed explosive
2: STRING - Magazine classname
3: ARRAY - vars
Last Index: ACE_Triggers config of trigger type.
onSetup parameters:
0: STRING - Magazine Classname
*/
/* onPlace Parameters:
* 0: Unit placing <OBJECT>
* 1: Explosive <OBJECT>
* 2: Magazine classname <STRING>
* 3: Additional arguments <ARRAY>
* - Same as those passed to FUNC(placeExplosive) for specific trigger type
* - Last element is ACE_Triggers config of the trigger type <CONFIG>
*
* onSetup Parameters:
* 0: Explosive <OBJECT>
* 1: Magazine classname <STRING>
*
* For both, expected return type is BOOL.
* True indicates manual handling of explosive setup/placement.
*/
class Command {
isAttachable = 1;
displayName = CSTRING(clacker_displayName);
Expand Down Expand Up @@ -50,8 +56,8 @@ onSetup parameters:
isAttachable = 1;
displayName = CSTRING(timerName);
picture = QPATHTOF(data\UI\Timer.paa);
onPlace = QUOTE([ARR_2(_this select 1,(_this select 3) select 0)] call FUNC(startTimer);false);
onSetup = QUOTE(_this call FUNC(openTimerSetUI);true);
onPlace = QUOTE([ARR_2(_this select 1, _this select 3 select 0)] call FUNC(startTimer); false);
onSetup = QUOTE(_this call FUNC(openTimerUI));
};
class Tripwire {
isAttachable = 0;
Expand Down
1 change: 0 additions & 1 deletion addons/explosives/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
Expand Down
80 changes: 3 additions & 77 deletions addons/explosives/ExplosivesUI.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
#define GUI_GRID_X (0)
#define GUI_GRID_Y (0)
#define GUI_GRID_W (0.025)
#define GUI_GRID_H (0.04)

#define ST_CENTER 0x02
#define X_OFFSET 0.25

class RscText;
class RscButton;
class RscXSliderH;
class IGUIBack;
class RscPicture;
class RscEdit;

class Rsc_ACE_CallScreen_Edit:RscEdit {
class Rsc_ACE_CallScreen_Edit: RscEdit {
canModify = 1;
colorBackground[] = {0,0,0,0};
colorText[] = {0,0,0,1};
Expand All @@ -32,7 +17,7 @@ class Rsc_ACE_CallScreen_Edit:RscEdit {
w = 0.0825 * safezoneW;
h = 0.044 * safezoneH;
};
class Rsc_ACE_HiddenButton:RscButton {
class Rsc_ACE_HiddenButton: RscButton {
colorText[] = {0, 0, 0, 0};
colorDisabled[] = {0, 0, 0, 0};
colorBackground[] = {0, 0, 0, 0};
Expand All @@ -46,66 +31,7 @@ class Rsc_ACE_HiddenButton:RscButton {
shadow = 0;
};

class Rsc_ACE_Timer_Slider:RscXSliderH {
x = 0.4;
y = 0.2;
w = 0.3;
h = "1*((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
colorBackground[] = {0,0,0,0.5};
};

class RscACE_SelectTimeUI {
idd = 8854;
movingEnable = 0;
class controls {
class back:IGUIBack {
x = X_OFFSET;
y = 0;
w = 0.5;
h = 0.2;
colorBackground[] = {0, 0, 0, 0.5};
};
class header: RscText{
idc = 8870;
x = X_OFFSET + 0.005;
y = 0.005;
w = 0.49;
h = 0.05;
style = ST_CENTER;
text = "";
};
class slider: Rsc_ACE_Timer_Slider {
idc = 8845;
x = X_OFFSET + 0.005;
y = 0.06;
w = 0.49;
h = 0.025;
onSliderPosChanged = "_mins = floor((_this select 1)/60);_secs=floor((_this select 1) - (_mins*60));ctrlSetText [8870, format[localize 'STR_ACE_Explosives_TimerMenu',_mins, _secs]];";
};
class cancelBtn: RscButton {
idc = 8855;
x = X_OFFSET + 0.005;
w = 0.15;
h = 0.1;
y = 0.09;
style = ST_CENTER;
text = CSTRING(Cancel);
action = "closeDialog 0;";
};
class approveBtn: RscButton {
idc = 8860;
x = X_OFFSET + 0.345;
y = 0.09;
h = 0.1;
w = 0.15;
style = ST_CENTER;
text = CSTRING(SetTime);
action = "closeDialog 0;";
};
};
};

class Rsc_ACE_NumKeyButton: Rsc_ACE_HiddenButton{};
class Rsc_ACE_NumKeyButton: Rsc_ACE_HiddenButton {};
class Rsc_ACE_PhoneInterface {
idd = 8855;
movingEnable = 1;
Expand Down
97 changes: 97 additions & 0 deletions addons/explosives/TimerDialog.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
class GVAR(timerUI) {
idd = -1;
movingEnable = 1;
enableSimulation = 1;
onLoad = QUOTE(uiNamespace setVariable [ARR_2(QQGVAR(timerDisplay), _this select 0)]);
class controlsBackground {
class Header: RscText {
idc = -1;
text = CSTRING(ExplosiveTimer);
x = 13.5 * GUI_GRID_W + GUI_GRID_CENTER_X;
y = 5 * GUI_GRID_H + GUI_GRID_CENTER_Y;
w = 13 * GUI_GRID_W;
h = GUI_GRID_H;
colorBackground[] = GUI_BCG_COLOR;
moving = 1;
};
class Background: RscText {
idd = -1;
x = 13.5 * GUI_GRID_W + GUI_GRID_CENTER_X;
y = 6.1 * GUI_GRID_H + GUI_GRID_CENTER_Y;
w = 13 * GUI_GRID_W;
h = 6.5 * GUI_GRID_H;
colorBackground[] = {0, 0, 0, 0.8};
};
};
class controls {
class DigitBackground_1: RscPicture {
idc = -1;
text = QPATHTOF(UI\seven_segment_8.paa);
x = 14 * GUI_GRID_W + GUI_GRID_CENTER_X;
y = 6.6 * GUI_GRID_H + GUI_GRID_CENTER_Y;
w = 4 * GUI_GRID_W;
h = 4 * GUI_GRID_H;
colorText[] = {0.3, 0.3, 0.3, 0.5};
};
class DigitBackground_2: DigitBackground_1 {
x = 16.4 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
class DigitBackground_3: DigitBackground_1 {
x = 19.7 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
class DigitBackground_4: DigitBackground_1 {
x = 22.1 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
class DigitSeparator: DigitBackground_1 {
text = QPATHTOF(UI\seven_segment_separator.paa);
x = 18.025 * GUI_GRID_W + GUI_GRID_CENTER_X;
colorText[] = {1, 0.05, 0.05, 1};
};
class Digit_1: DigitBackground_1 {
idc = IDC_TIMER_DIGIT_1;
text = QPATHTOF(UI\seven_segment_0.paa);
colorText[] = {1, 0.05, 0.05, 1};
};
class Digit_2: Digit_1 {
idc = IDC_TIMER_DIGIT_2;
x = 16.4 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
class Digit_3: Digit_1 {
idc = IDC_TIMER_DIGIT_3;
x = 19.7 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
class Digit_4: Digit_1 {
idc = IDC_TIMER_DIGIT_4;
x = 22.1 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
class Slider: ctrlXSliderH {
idc = IDC_TIMER_SLIDER;
x = 14 * GUI_GRID_W + GUI_GRID_CENTER_X;
y = 11.1 * GUI_GRID_H + GUI_GRID_CENTER_Y;
w = 12 * GUI_GRID_W;
h = GUI_GRID_H;
color[] = {0.3, 0.3, 0.3, 0.7};
colorActive[] = {0.3, 0.3, 0.3, 0.7};
sliderRange[] = {TIMER_VALUE_MIN, TIMER_VALUE_MAX};
sliderPosition = TIMER_VALUE_DEFAULT;
};
class CancelButton: RscButton {
idc = -1;
text = CSTRING(Cancel);
onButtonClick = QUOTE(closeDialog 0);
x = 13.5 * GUI_GRID_W + GUI_GRID_CENTER_X;
y = 12.7 * GUI_GRID_H + GUI_GRID_CENTER_Y;
w = 5 * GUI_GRID_W;
h = GUI_GRID_H;
colorActive[] = {0, 0, 0, 1};
colorBackground[] = {0, 0, 0, 0.8};
colorFocused[] = {0, 0, 0, 0.8};
};
class ConfirmButton: CancelButton {
idc = IDC_TIMER_CONFIRM;
text = CSTRING(SetTime);
onButtonClick = "";
x = 21.5 * GUI_GRID_W + GUI_GRID_CENTER_X;
};
};
};
Binary file added addons/explosives/UI/seven_segment_0.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_1.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_2.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_3.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_4.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_5.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_6.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_7.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_8.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_9.paa
Binary file not shown.
Binary file added addons/explosives/UI/seven_segment_separator.paa
Binary file not shown.
12 changes: 1 addition & 11 deletions addons/explosives/XEH_PREP.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

PREP(addCellphoneIED);
PREP(addClacker);
PREP(addDetonateActions);
Expand All @@ -16,28 +15,19 @@ PREP(detonateExplosive);
PREP(detonateExplosiveAll);
PREP(dialPhone);
PREP(dialingPhone);

PREP(handleScrollWheel);

PREP(hasExplosives);
PREP(hasPlacedExplosives);

PREP(interactEH);

PREP(getDetonators);
PREP(getPlacedExplosives);
PREP(getSpeedDialExplosive);

PREP(module);

PREP(onIncapacitated);
PREP(onInventoryChanged);

PREP(openTimerSetUI);

PREP(openTimerUI);
PREP(placeExplosive);
PREP(removeFromSpeedDial);

PREP(scriptedExplosive);
PREP(selectTrigger);
PREP(setupExplosive);
Expand Down
14 changes: 10 additions & 4 deletions addons/explosives/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,32 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author = ECSTRING(common,ACETeam);
authors[] = {"Garth 'L-H' de Wet"};
authors[] = {"Garth 'L-H' de Wet", "mharis001"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
};

#include "ACE_Settings.hpp"

#include "CfgEventHandlers.hpp"

#include "CfgAmmo.hpp"
#include "CfgMagazines.hpp"
#include "CfgWeapons.hpp"
#include "CfgVehicles.hpp"
#include "CfgCloudlets.hpp"

#include "ACE_Triggers.hpp"
#include "ACE_Arsenal_Stats.hpp"

// UI stuff
class RscText;
class RscEdit;
class RscPicture;
class RscButton;
class ctrlXSliderH;
#include "ExplosivesUI.hpp"
#include "TimerDialog.hpp"
#include "GUI_VirtualAmmo.hpp"
#include "ACE_Arsenal_Stats.hpp"

class CfgActions {
class None;
Expand Down
44 changes: 0 additions & 44 deletions addons/explosives/functions/fnc_openTimerSetUI.sqf

This file was deleted.

Loading

0 comments on commit 66da48f

Please sign in to comment.