-
Notifications
You must be signed in to change notification settings - Fork 1
/
fn_respawnInit.sqf
153 lines (126 loc) · 7.41 KB
/
fn_respawnInit.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#include "macros.hpp"
/**
* OurAltis_Mission - fn_respawnInit
*
* Author: Raven
*
* Description:
* Initializes the respawn system. Can only be called if the map has already been initialized...
*
* Parameter(s):
* 0: None <Any>
*
* Return Value:
* None <Any>
*
*/
RGVAR(RespawnPositions) = [];
RGVAR(RespawnRoles) = [];
RGVAR(NewPositionID) = 0;
RGVAR(NewRoleID) = 0;
RGVAR(RespawnTime) = 0;
RGVAR(RespawnButtonEnabled) = false;
RGVAR(DeadGroup) = createGroup civilian;
RGVAR(PreOpenRespawnMenuHandlerIsPresent) = !(isNil {getMissionConfigValue "respawnMenuAboutToOpen"});
RGVAR(PostOpenRespawnMenuHandlerIsPresent) = !(isNil {getMissionConfigValue "respawnMenuOpened"});
RGVAR(PreCloseRespawnMenuHandlerIsPresent) = !(isNil {getMissionConfigValue "respawnMenuAboutToClose"});
RGVAR(PostCloseRespawnMenuHandlerIsPresent) = !(isNil {getMissionConfigValue "respawnMenuClosed"});
// create the respective controls
disableSerialization;
with uiNamespace do {
private _mapDisplay = findDisplay 12;
RGVAR(RespawnMenuControlsGroup) = _mapDisplay ctrlCreate ["RscControlsGroup", 1200];
RGVAR(RespawnMenuControlsGroup) ctrlSetPosition [0.22 * safeZoneW + safeZoneX, 0.7 * safeZoneH + safeZoneY , 0.555 * safeZoneW, 0.29 * safeZoneH];
RGVAR(RespawnMenuControlsGroup) ctrlCommit 0;
private _tempPos = ctrlPosition RGVAR(RespawnMenuControlsGroup);
totalHeight = _tempPos select 3;
totalWidth = _tempPos select 2;
// Background
private _currentControl = _mapDisplay ctrlCreate ["IGUIBack", 1100, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetPosition [0,0, totalWidth, totalHeight];
// _currentControl ctrlSetBackgroundColor [0.08,0.168,0.137,0.3];
_currentControl ctrlSetBackgroundColor [0,0,0,0.3];
_currentControl ctrlCommit 0;
// Reinforcements background
_currentControl = _mapDisplay ctrlCreate ["IGUIBack", 1101, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetPosition [0.7289 * totalWidth, 0.1465 * totalHeight, 0.258276 * totalWidth, 0.2491 * totalHeight];
_currentControl ctrlSetBackgroundColor [0,0,1,0.2];
_currentControl ctrlCommit 0;
// position selection background
_currentControl = _mapDisplay ctrlCreate ["IGUIBack", 1107, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetPosition [0.011479 * totalWidth, 0.146558 * totalHeight, 0.3443688 * totalWidth, 0.80607 * totalHeight];
_currentControl ctrlSetBackgroundColor [0,0,0,0.2];
_currentControl ctrlCommit 0;
// No respawn position text
RGVAR(RespawnMenuNoPositionText) = _mapDisplay ctrlCreate ["RscText", 1105, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuNoPositionText) ctrlSetText "No respawn position available";
RGVAR(RespawnMenuNoPositionText) ctrlSetPosition [0.011479 * totalWidth, 0.50563 * totalHeight, 0.3443688 * totalWidth, 0.087935 * totalHeight];
RGVAR(RespawnMenuNoPositionText) ctrlSetTextColor [1,1,1,0.5];
RGVAR(RespawnMenuNoPositionText) ctrlCommit 0;
// Position selection
RGVAR(RespawnMenuPositionSelection) = _mapDisplay ctrlCreate ["RscListbox", 1201, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuPositionSelection) ctrlSetPosition [0.011479 * totalWidth, 0.146558 * totalHeight, 0.3443688 * totalWidth, 0.80607 * totalHeight];
RGVAR(RespawnMenuPositionSelection) ctrlSetTextColor [0.7,0.4,0,1];
RGVAR(RespawnMenuPositionSelection) ctrlSetEventHandler ["LBSelChanged", QUOTE([] call FUNC(selectedPositionChanged))];
RGVAR(RespawnMenuPositionSelection) ctrlCommit 0;
// Role selection background
_currentControl = _mapDisplay ctrlCreate ["IGUIBack", 1106, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetPosition [0.367327 * totalWidth, 0.146558 * totalHeight, 0.3443688 * totalWidth, 0.80607 * totalHeight];
_currentControl ctrlSetBackgroundColor [0,0,0,0.2];
_currentControl ctrlCommit 0;
// No respawn role text
RGVAR(RespawnMenuNoRoleText) = _mapDisplay ctrlCreate ["RscText", 1106, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuNoRoleText) ctrlSetText "No respawn role available";
RGVAR(RespawnMenuNoRoleText) ctrlSetPosition [0.367327 * totalWidth, 0.50563 * totalHeight, 0.3443688 * totalWidth, 0.087935 * totalHeight];
RGVAR(RespawnMenuNoRoleText) ctrlSetTextColor [1,1,1,0.5];
RGVAR(RespawnMenuNoRoleText) ctrlCommit 0;
// Role selection
RGVAR(RespawnMenuRoleSelection) = _mapDisplay ctrlCreate ["RscListbox", 1202, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuRoleSelection) ctrlSetPosition [0.367327 * totalWidth, 0.146558 * totalHeight, 0.3443688 * totalWidth, 0.80607 * totalHeight];
RGVAR(RespawnMenuRoleSelection) ctrlSetTextColor [0.607,0.729,0,1];
RGVAR(RespawnMenuRoleSelection) ctrlSetEventHandler ["LBSelChanged", QUOTE([] call FUNC(selectedRoleChanged))];
RGVAR(RespawnMenuRoleSelection) ctrlCommit 0;
//Position text
_currentControl = _mapDisplay ctrlCreate ["RscText", 1102, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetPosition [0.011479 * totalWidth, 0.0292859 * totalHeight];
_currentControl ctrlSetText "Position:";
_currentControl ctrlCommit 0;
//Role text
_currentControl = _mapDisplay ctrlCreate ["RscText", 1103, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetPosition [0.3673267 * totalWidth, 0.0292859 * totalHeight];
_currentControl ctrlSetText "Role:";
_currentControl ctrlCommit 0;
// Reinforcements text
_currentControl = _mapDisplay ctrlCreate ["RscText", 1104, RGVAR(RespawnMenuControlsGroup)];
_currentControl ctrlSetText "Role-Reinforcements:";
_currentControl ctrlSetPosition [0.734653 * totalWidth, 0.17587 * totalHeight, 0.252537 * totalWidth, 0.087935 * totalHeight];
_currentControl ctrlSetTooltip "The available reinforcements for the currently selected role";
_currentControl ctrlCommit 0;
// Reinforcements value
RGVAR(RespawnMenuReinforcements) = _mapDisplay ctrlCreate ["RscText", 1203, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuReinforcements) ctrlSetText "-1";
RGVAR(RespawnMenuReinforcements) ctrlSetPosition [0.734653 * totalWidth, 0.278461 * totalHeight, 0.252537 * totalWidth, 0.087935 * totalHeight];
RGVAR(RespawnMenuReinforcements) ctrlSetTooltip "The available reinforcements for the currently selected role";
RGVAR(RespawnMenuReinforcements) ctrlCommit 0;
// respawn button
RGVAR(RespawnMenuRespawnButton) = _mapDisplay ctrlCreate ["RscButton", 1204, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuRespawnButton) ctrlSetText "Respawn";
RGVAR(RespawnMenuRespawnButton) ctrlSetPosition [0.7289 * totalWidth, 0.534938 * totalHeight, 0.129138 * totalWidth, 0.1245746 * totalHeight];
RGVAR(RespawnMenuRespawnButton) ctrlSetScale 2;
RGVAR(RespawnMenuRespawnButton) ctrlSetTextColor [0.93, 0.576, 0.082, 1];
RGVAR(RespawnMenuRespawnButton) ctrlSetEventHandler ["ButtonClick", QUOTE([] call FUNC(respawnButtonPressed))];
RGVAR(RespawnMenuRespawnButton) ctrlEnable false;
RGVAR(RespawnMenuRespawnButton) ctrlCommit 0;
// spectate button
RGVAR(RespawnMenuSpectateButton) = _mapDisplay ctrlCreate ["RscButton", 1205, RGVAR(RespawnMenuControlsGroup)];
RGVAR(RespawnMenuSpectateButton) ctrlSetText "Spectate";
RGVAR(RespawnMenuSpectateButton) ctrlSetPosition [0.7289 * totalWidth, 0.8280548 * totalHeight, 0.258276 * totalWidth, 0.1245746 * totalHeight];
RGVAR(RespawnMenuSpectateButton) ctrlSetTextColor [0,1,0,1];
RGVAR(RespawnMenuSpectateButton) ctrlEnable false;
RGVAR(RespawnMenuSpectateButton) ctrlSetTooltip "Not yet implemented!";
RGVAR(RespawnMenuSpectateButton) ctrlCommit 0;
// hide controls
RGVAR(RespawnMenuControlsGroup) ctrlShow false;
RGVAR(RespawnMenuControlsGroup) ctrlCommit 0;
};
nil;