-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDXRMenuSelectDifficulty.uc
337 lines (301 loc) · 10.8 KB
/
DXRMenuSelectDifficulty.uc
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
class DXRMenuSelectDifficulty extends DXRMenuBase;
var string MaxRandoBtnTitle, MaxRandoBtnMessage;
var string AdvancedBtnTitle, AdvancedBtnMessage;
var string ExtremeBtnTitle, ExtremeBtnMessage;
var string ImpossibleBtnTitle, ImpossibleBtnMessage;
var int gamemode_enum, autosave_enum;
enum ERandoMessageBoxModes
{
RMB_MaxRando,
RMB_Advanced,
RMB_Difficulty,// choosing Extreme or Impossible
};
var ERandoMessageBoxModes nextScreenNum;
event InitWindow()
{
Super.InitWindow();
GetDxr();
Init(GetDxr());
}
function BindControls(optional string action)
{
local float difficulty;
local DXRFlags f;
local string sseed, ts;
local DXRLoadouts loadout;
local DXRTelemetry t;
local DXRCrowdControl cc;
local int temp, i;
#ifdef injections
local DXRAutosave autosave;
local bool mirrored_maps_files_found;
#endif
f = GetFlags();
if(writing) {
f.InitAdvancedDefaults();
}
gamemode_enum = NewMenuItem("Game Mode", "Choose a game mode!");
for(i=0; i<20; i++) {
temp = f.GameModeIdForSlot(i);
if(temp==999999) continue;
ts = f.GameModeName(temp);
if(ts != "")
EnumOption(ts, temp, f.gamemode);
}
NewMenuItem("Loadout", "Which items and augs you start with and which are banned.");
foreach f.AllActors(class'DXRLoadouts', loadout) { break; }
if( loadout == None )
EnumOption("All Items Allowed", 0, f.loadout);
else {
for(i=0; i < 20; i++) {
temp = loadout.GetIdForSlot(i);
ts = loadout.GetName(temp);
if( ts == "" ) continue;
EnumOption(ts, temp, f.loadout);
}
}
if( #defined(vmd) )
NewMenuItem("Randomizer Difficulty", "Difficulty determines the default settings for the randomizer."$BR$"Hard is recommended for Deus Ex veterans.");
else
NewMenuItem("Difficulty", "Difficulty determines the default settings for the randomizer."$BR$"Hard is recommended for Deus Ex veterans.");
if( f.VersionIsStable() ) {
i=1;
if(f.difficulty == 0) {
f.difficulty = 1;
}
}
else {
i=0;
}
for( i=i; i < ArrayCount(f.difficulty_names); i++ ) {
if( f.difficulty_names[i] == "" ) continue;
EnumOption(f.difficulty_names[i], i, f.difficulty);
}// we write the difficulty and gamemode after setting the seed...
#ifdef injections
foreach f.AllActors(class'DXRAutosave', autosave) { break; }// need an object to access consts
autosave_enum = NewMenuItem("Save Behavior", "Saves the game in case you die!");
EnumOption("Autosave Every Entry", autosave.EveryEntry, f.autosave);
EnumOption("Autosave First Entry", autosave.FirstEntry, f.autosave);
EnumOption("Autosaves-Only (Hardcore)", autosave.Hardcore, f.autosave);
EnumOption("Extra Safe (1+GB per playthrough)", autosave.ExtraSafe, f.autosave);
EnumOption("Limited Saves", autosave.LimitedSaves, f.autosave);
EnumOption("Limited Fixed Saves", autosave.FixedSaves, f.autosave);
EnumOption("Unlimited Fixed Saves", autosave.UnlimitedFixedSaves, f.autosave);
EnumOption("Extreme Limited Fixed Saves", autosave.FixedSavesExtreme, f.autosave);
EnumOption("Autosaves Disabled", autosave.Disabled, f.autosave);
#endif
NewMenuItem("Crowd Control", "Let your Twitch/YouTube/Discord viewers troll you or help you!" $BR$ "See their website crowdcontrol.live");
//EnumOption("Enabled (Anonymous)", 2, f.crowdcontrol);
EnumOption("Enabled (Streaming)", 1, f.crowdcontrol);
EnumOption("Offline Simulated", 3, f.crowdcontrol);
EnumOption("Streaming and Simulated", 4, f.crowdcontrol);
EnumOption("Disabled", 0, f.crowdcontrol);
foreach f.AllActors(class'DXRTelemetry', t) { break; }
if( t == None ) t = f.Spawn(class'DXRTelemetry');
t.CheckConfig();
if(t.enabled && t.death_markers)
temp = 2;
else if(t.enabled)
temp = 1;
else
temp = 0;
NewMenuItem("Online Features", "Death Markers, send error reports,"$BR$" and get notified about updates!");
if( EnumOption("All Enabled", 2, temp) ) {
t.set_enabled(true, true);
}
if( EnumOption("Enabled, Death Markers Hidden", 1, temp) ) {
t.set_enabled(true, false);
}
if( EnumOption("Disabled", 0, temp) ) {
t.set_enabled(false, true);
}
#ifdef injections
mirrored_maps_files_found = class'DXRMapVariants'.static.MirrorMapsAvailable();
if(mirrored_maps_files_found) {
NewMenuItem("Mirrored Maps %", "Enable mirrored maps if you have the files downloaded for them.");
if(f.mirroredmaps == -1 && f.IsZeroRando()) {
f.mirroredmaps = 0; // default to 0% because of Zero Rando
} else if(f.mirroredmaps == -1) {
f.mirroredmaps = 50; // default to 50% when the files are installed
}
Slider(f.mirroredmaps, 0, 100);
} else {
// use -1 to indicate not installed, because this gets saved to the config
f.mirroredmaps = -1;
NewMenuItem("", "Use the installer to download the mirrored map files, or go to the unreal-map-flipper Releases page on Github");
EnumOption("Mirror Map Files Not Found", -1, f.mirroredmaps);
}
#else
//Disable mirrored maps entirely if map variants aren't supported
f.mirroredmaps=-1;
#endif
NewMenuItem("Seed", "Enter a seed if you want to play the same game again. Leave it blank for a random seed.");
sseed = EditBox("", "1234567890");
if( sseed != "" ) {
f.seed = int(sseed);
dxr.seed = f.seed;
f.bSetSeed = 1;
} else {
f.RollSeed();
}
if(writing) {
// need to call flags.SetDifficulty to apply the game mode's and difficulty's settings, after setting the seed and before going to the next screen
f.SetDifficulty(f.difficulty);
if( action == "ADVANCED" ) {
HandleAdvancedButton();
}
else if( action == "MAXRANDO" ) {
HandleMaxRandoButton();
}
else {
HandleNewGameButton();
}
}
}
function string SetEnumValue(int e, string text)
{
// HACK: this allows you to override the autosave option instead of SetDifficulty forcing it by game mode
Super.SetEnumValue(e, text);
if(e == gamemode_enum && #defined(injections)) {
if(InStr(text, "Halloween")!=-1)
{
Super.SetEnumValue(autosave_enum, "Limited Fixed Saves");
}
else if(InStr(text, "Hardcore")==-1 && InStr(text, "Horde")==-1)
{
Super.SetEnumValue(autosave_enum, "Autosave Every Entry");
}
}
}
function EnumListAddButton(DXREnumList list, string title, string val, string prev)
{
if(title == "Game Mode") {
if(InStr(prev, "WaltonWare")==-1 && InStr(val, "WaltonWare")!=-1) {
list.CreateLabel("Bingo modes");
}
else if(InStr(prev, "Zero Rando")==-1 && InStr(val, "Zero Rando")!=-1) {
list.CreateLabel("Reduced Randomization modes");
} else if(prev == "Randomizer Medium") {
list.CreateLabel("Other game modes");
}
}
list.AddButton(val);
}
function HandleNewGameButton()
{
local DXRFlags f;
f = GetFlags();
if(dxr.rando_beaten == 0 && f.DifficultyName(f.difficulty) ~= "Extreme") {
nextScreenNum=RMB_Difficulty;
root.MessageBox(ExtremeBtnTitle,ExtremeBtnMessage,0,False,Self);
}
else if(dxr.rando_beaten == 0 && f.DifficultyName(f.difficulty) ~= "Impossible") {
nextScreenNum=RMB_Difficulty;
root.MessageBox(ImpossibleBtnTitle,ImpossibleBtnMessage,0,False,Self);
}
else {
DoNewGameScreen();
}
}
function DoNewGameScreen()
{
local float difficulty;
local DXRFlags f;
f = GetFlags();
#ifndef hx
// TODO: menus for HX?
difficulty = f.settings.CombatDifficulty;
#endif
_InvokeNewGameScreen(difficulty);
}
function HandleMaxRandoButton()
{
if (dxr.rando_beaten != 0){
DoMaxRandoButtonConfirm();
} else {
nextScreenNum=RMB_MaxRando;
root.MessageBox(MaxRandoBtnTitle,MaxRandoBtnMessage,0,False,Self);
}
}
function DoMaxRandoButtonConfirm()
{
local DXRFlags f;
f = GetFlags();
f.ExecMaxRando();
DoNewGameScreen();
}
function HandleAdvancedButton()
{
if (dxr.rando_beaten != 0){
DoAdvancedButtonConfirm();
} else {
nextScreenNum=RMB_Advanced;
root.MessageBox(AdvancedBtnTitle,AdvancedBtnMessage,0,False,Self);
}
}
function DoAdvancedButtonConfirm()
{
#ifndef hx
NewGameSetup(GetFlags().settings.CombatDifficulty);
#endif
}
event bool BoxOptionSelected(Window button, int buttonNumber)
{
root.PopWindow();
switch (nextScreenNum){
case RMB_MaxRando:
if (buttonNumber==0){
DoMaxRandoButtonConfirm();
}
return true;
case RMB_Advanced:
if (buttonNumber==0){
DoAdvancedButtonConfirm();
}
return true;
case RMB_Difficulty:
if (buttonNumber==0){
DoNewGameScreen();
}
return true;
}
return Super.BoxOptionSelected(button,buttonNumber);
}
event DestroyWindow()
{
if(#defined(vmd)) {
Player.ConsoleCommand("Open DXOnly");
}
}
function NewGameSetup(float difficulty)
{
local DXRMenuSetupRando newGame;
newGame = DXRMenuSetupRando(root.InvokeMenuScreen(Class'DXRMenuSetupRando'));
if (newGame != None) {
newGame.SetDifficulty(difficulty);
newGame.Init(dxr);
}
}
defaultproperties
{
actionButtons(2)=(Align=HALIGN_Right,Action=AB_Other,Text="|&Advanced",Key="ADVANCED")
actionButtons(3)=(Align=HALIGN_Right,Action=AB_Other,Text="|&Max Rando",Key="MAXRANDO")
Title="DX Rando Options"
bUsesHelpWindow=False
bEscapeSavesSettings=False
num_rows=9
num_cols=2
col_width_odd=140
col_width_even=260
row_height=20
padding_width=20
padding_height=10
MaxRandoBtnTitle="Are you sure?"
MaxRandoBtnMessage="It appears you're new to DX Randomizer. Max Rando will randomize all the settings, which will likely result in a bad first time experience. Are you sure you want to proceed?"
AdvancedBtnTitle="Advanced Settings?"
AdvancedBtnMessage="It appears you're new to DX Randomizer. We recommend playing with default settings for a better first time experience. Are you sure you want to adjust advanced settings?"
ExtremeBtnTitle="Extreme Difficulty?"
ExtremeBtnMessage="It appears you're new to DX Randomizer. Extreme difficulty means fewer items, less ammo, more enemies, higher skill costs, fewer medbots, and many other challenges. Are you sure?"
ImpossibleBtnTitle="Impossible Difficulty?"
ImpossibleBtnMessage="It appears you're new to DX Randomizer. Impossible difficulty means fewer items, less ammo, more enemies, higher skill costs, fewer medbots, and many other challenges. Are you sure?"
}