Skip to content

Commit

Permalink
Merge pull request #5953 from acemod/arsenal-main-menu
Browse files Browse the repository at this point in the history
add ace arsenal button to main menu
  • Loading branch information
commy2 authored Dec 27, 2017
2 parents e66e9c2 + 542849c commit 37e42de
Show file tree
Hide file tree
Showing 21 changed files with 628 additions and 5 deletions.
36 changes: 36 additions & 0 deletions addons/arsenal/RscDisplayMain.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class RscStandardDisplay;
class RscDisplayMain: RscStandardDisplay {
class controls {
class GroupSingleplayer: RscControlsGroupNoScrollbars {
class Controls;
};
class GroupTutorials: GroupSingleplayer {
h = "(6 * 1.5) * (pixelH * pixelGrid * 2)";

class Controls: Controls {
class Bootcamp;
class VRTraining;
class Arsenal;
class GVAR(mission): Arsenal {
idc = -1;
text = CSTRING(Mission);
tooltip = CSTRING(Mission_tooltip);
y = "(3 * 1.5) * (pixelH * pixelGrid * 2) + (pixelH)";
onbuttonclick = QUOTE(playMission [ARR_2('','PATHTOF(missions\Arsenal.VR)')]);
animTextureNormal = QPATHTOF(data\buttonMissionMainMenu_ca.paa)
animTextureDisabled = QPATHTOF(data\buttonMissionMainMenu_ca.paa)
animTextureOver = QPATHTOF(data\buttonMissionMainMenuHover_ca.paa)
animTextureFocused = QPATHTOF(data\buttonMissionMainMenuHover_ca.paa)
animTexturePressed = QPATHTOF(data\buttonMissionMainMenu_ca.paa)
animTextureDefault = QPATHTOF(data\buttonMissionMainMenu_ca.paa)
};
class FieldManual: Bootcamp {
y = "(4 * 1.5) * (pixelH * pixelGrid * 2) + (pixelH)";
};
class CommunityGuides: Bootcamp {
y = "(5 * 1.5) * (pixelH * pixelGrid * 2) + (pixelH)";
};
};
};
};
};
3 changes: 2 additions & 1 deletion addons/arsenal/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ class Cfg3DEN {
};

#include "ui\RscAttributes.hpp"
#include "CfgEventHandlers.hpp"
#include "CfgEventHandlers.hpp"
#include "RscDisplayMain.hpp"
Binary file not shown.
Binary file added addons/arsenal/data/buttonMissionMainMenu_ca.paa
Binary file not shown.
3 changes: 2 additions & 1 deletion addons/arsenal/defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#define IDC_totalWeightText 801
#define IDC_message 9
#define IDC_menuBar 10
#define IDC_menuBarClose 1001
#define IDC_infoBox 11
#define IDC_infoBackground 1101
#define IDC_infoName 1102
Expand Down Expand Up @@ -329,4 +330,4 @@ _buttonCurrentMag2Ctrl ctrlCommit FADE_DELAY;\
_contentPanelCtrl lnbSetPicture [[_newRow, 6], getText (configFile >> "cfgWeapons" >> ((_loadout select 4) select 0) >> "picture")];\
_contentPanelCtrl lnbSetPicture [[_newRow, 7], getText (configFile >> "cfgVehicles" >> ((_loadout select 5) select 0) >> "picture")];\
_contentPanelCtrl lnbSetPicture [[_newRow, 8], getText (configFile >> "cfgWeapons" >> (_loadout select 6) >> "picture")];\
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
_contentPanelCtrl lnbSetPicture [[_newRow, 9], getText (configFile >> "cfgGlasses" >> (_loadout select 7) >> "picture")];
11 changes: 11 additions & 0 deletions addons/arsenal/missions/Arsenal.VR/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Extended_PreInit_EventHandlers {
class ADDON {
init = QUOTE(call compile preprocessFileLineNumbers 'XEH_preInit.sqf');
};
};

class Extended_PostInit_EventHandlers {
class ADDON {
init = QUOTE(call compile preprocessFileLineNumbers 'XEH_postInit.sqf');
};
};
113 changes: 113 additions & 0 deletions addons/arsenal/missions/Arsenal.VR/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#include "script_component.hpp"
#include "\z\ace\addons\arsenal\defines.hpp"
#include "\a3\ui_f\hpp\defineDIKCodes.inc"

enableSaving [false, false];
cba_diagnostic_projectileMaxLines = 10;

[QGVAR(displayOpened), {
private _player = player;

// player pose
[{
switch (true) do {
case (primaryWeapon _this != ""): {
_this switchMove "amovpercmstpslowwrfldnon";
};
case (handgunWeapon _this != ""): {
_this switchMove "amovpercmstpslowwpstdnon";
};
default {
_this switchMove "amovpercmstpsnonwnondnon";
};
};
}, _player] call CBA_fnc_execNextFrame;

// hide everything except the player
{
_x enableSimulation false;
_x hideObject true;
} forEach (allMissionObjects "" - [_player]);

_player call CBA_fnc_removeUnitTrackProjectiles;
_player setFatigue 0;

// Esc to close mission
{
private _display = findDisplay IDD_ace_arsenal;

_display displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift"];

if (_key isEqualTo DIK_ESCAPE && {!_shift}) then {
[_display] spawn {
disableSerialization;
params ["_display"];

private _return = [
localize "str_sure",
localize "str_a3_rscdisplaymain_buttonexit",
true, false,
_display, false, true
] call BIS_fnc_GUImessage;

if (_return) then {
profileNamespace setVariable [QGVAR(missionLastLoadout), getUnitLoadout player];
_display closeDisplay 2;
findDisplay 46 closeDisplay 0;
};
};
true
};
}];

private _buttonClose = _display displayCtrl IDC_menuBarClose;
_buttonClose ctrlSetText localize "str_a3_rscdisplayarsenal_buttonok";
} call CBA_fnc_execNextFrame;
}] call CBA_fnc_addEventHandler;

[QGVAR(displayClosed), {
private _player = player;

// unhide everthing
{
_x enableSimulation true;
_x hideObject false;
} forEach allMissionObjects "";

// update VR unit gear
{
private _unit = _x;

removeVest _unit;
_unit addVest vest _player;

removeBackpack _unit;
_unit addBackpack backpack _player;

removeHeadgear _unit;
_unit addHeadgear headgear _player;

removeGoggles _unit;
_unit addGoggles goggles _player;

removeAllWeapons _unit;
_unit addWeapon primaryWeapon _player;
{
_unit addPrimaryWeaponItem _x;
} forEach primaryWeaponItems _player;

_unit addWeapon secondaryWeapon _player;

{
_unit addSecondaryWeaponItem _x;
} forEach secondaryWeaponItems _player;

_unit addWeapon handgunWeapon _player;
{
_unit addHandgunItem _x;
} forEach handgunItems _player;
} forEach (entities [["B_Soldier_VR_F", "O_Soldier_VR_F", "I_Soldier_VR_F"], [], true]);

_player call CBA_fnc_addUnitTrackProjectiles;
}] call CBA_fnc_addEventHandler;
4 changes: 4 additions & 0 deletions addons/arsenal/missions/Arsenal.VR/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "script_component.hpp"

PREP(onPause);
PREP(createTarget);
17 changes: 17 additions & 0 deletions addons/arsenal/missions/Arsenal.VR/description.ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "script_component.hpp"

dev = "commy2";
author = ECSTRING(common,ACETeam);

onLoadName = CSTRING(Mission);
overviewText = CSTRING(Mission_overview);
overviewPicture = "logo_ca.paa";

briefing = 0;
debriefing = 0;
enableDebugConsoleSP = 1;

doneKeys[] = {"BIS_Arsenal.Map_VR_done"};
onPauseScript[] = {QFUNC(onPause)};

#include "CfgEventHandlers.hpp"
66 changes: 66 additions & 0 deletions addons/arsenal/missions/Arsenal.VR/fnc_createTarget.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "script_component.hpp"

params ["_type", "_position", ["_group", grpNull], "_varName"];
private _player = player;

if (isNull _group) then {
_group = creategroup east;
};

private _target = _group createUnit [_type, [10,10,0], [], 0, "NONE"];

if (isNil "_varName") then {
_varName = _target call BIS_fnc_netId;
};

_target setPos _position;
_target setDir (_position getDir _player);
_target doWatch position _player;
_target addRating -10e10;
_target setUnitPos "UP";
_target setBehaviour "CARELESS";
_target setCombatMode "BLUE";
_target setSpeedMode "LIMITED";
_target disableAI "TARGET";
_target disableAI "AUTOTARGET";
_target allowFleeing 0;
_target setSpeaker "BASE";

[{
params ["_target", "_time"];

if (speaker _target == "BASE") exitWith {time > _time};
_target setSpeaker "BASE";
false
}, {}, [_target, time + 1]] call CBA_fnc_waitUntilAndExecute;

_player reveal [_target, 4];

_target addVest vest _player;
_target addBackpack backpack _player;
_target addHeadgear headgear _player;
_target addGoggles goggles _player;
_target addWeapon primaryWeapon _player;
_target addWeapon secondaryWeapon _player;
_target addWeapon handgunWeapon _player;

_target setVehicleVarName _varName;
missionNamespace setvariable [_varName, _target];

_target switchMove "amovpercmstpslowwrfldnon";
_target setVariable ["origin", _position];

_target addEventHandler ["killed", {
params ["_target"];
private _position = _target getVariable ["origin", position _target];
private _varName = vehicleVarName _target;

[_target, true] spawn BIS_fnc_VREffectKilled;

[{isNull (_this select 0)}, {
(_this select 1) call FUNC(createTarget);
}, [_target, [typeOf _target, _position, group _target, _varName]]] call CBA_fnc_waitUntilAndExecute;
}];

_target call BIS_fnc_VRHitpart;
_target
16 changes: 16 additions & 0 deletions addons/arsenal/missions/Arsenal.VR/fnc_onPause.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "script_component.hpp"

params ["_display"];

private _ctrlButtonAbort = _display displayCtrl 104;
_ctrlButtonAbort ctrlSetText localize LSTRING(Mission);
_ctrlButtonAbort ctrlSetTooltip localize LSTRING(ReturnToArsenal);

_ctrlButtonAbort ctrlSetEventHandler ["ButtonClick", {
params ["_control"];
ctrlParent _control closeDisplay 2;
{[player, player, true] call FUNC(openBox)} call CBA_fnc_execNextFrame;
true
} call EFUNC(common,codeToString)];

true
Loading

0 comments on commit 37e42de

Please sign in to comment.