Skip to content

Commit

Permalink
Add an option to limit bingo goals selected within a configurable number
Browse files Browse the repository at this point in the history
of missions
  • Loading branch information
theastropath committed Jul 7, 2023
1 parent f2d85e7 commit 8562767
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 26 deletions.
59 changes: 37 additions & 22 deletions DXRCore/DeusEx/Classes/DXRMenuSetupRando.uc
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,31 @@ function BindControls(optional string action)
combatDifficulty = float(iDifficulty) / 100.0;
}

//Make sure the starting map values match those in DXRStartMap
NewMenuItem("Starting Map", "What level you will start in");
EnumOption("Liberty Island", 0, f.settings.starting_map);
EnumOption("NSF Defection", 40, f.settings.starting_map);
EnumOption("MJ12 Jail", 50, f.settings.starting_map);
EnumOption("Wan Chai Market", 61, f.settings.starting_map);
EnumOption("Return to NYC", 81, f.settings.starting_map);
EnumOption("Graveyard", 99, f.settings.starting_map);
EnumOption("Everett's House", 119, f.settings.starting_map);
EnumOption("Ocean Lab", 140, f.settings.starting_map);
if(EnumOption("Random", -1)) {
f.SetGlobalSeed("random starting map");
f.settings.starting_map = class'DXRStartMap'.static.ChooseRandomStartMap(f.dxr);
}

BreakLine();

NewMenuItem("Player Health", "Max health for each body part of the player.");
Slider(f.settings.health, 1, 10000);

NewMenuItem("Player Energy", "Max bioelectric energy for the player.");
Slider(f.settings.energy, 0, 10000);

BreakLine();

#ifndef hx
NewMenuItem("", "Randomize starting locations on certain maps");
EnumOption("Randomize Starting Locations", 100, f.settings.startinglocations);
Expand All @@ -39,21 +58,7 @@ function BindControls(optional string action)
EnumOption("Randomize Goal Locations", 100, f.settings.goals);
EnumOption("Unchanged Goal Locations", 0, f.settings.goals);

//Make sure the starting map values match those in DXRStartMap
NewMenuItem("Starting Map", "What level you will start in");
EnumOption("Liberty Island", 0, f.settings.starting_map);
EnumOption("NSF Defection", 40, f.settings.starting_map);
EnumOption("MJ12 Jail", 50, f.settings.starting_map);
EnumOption("Wan Chai Market", 61, f.settings.starting_map);
EnumOption("Return to NYC", 81, f.settings.starting_map);
EnumOption("Graveyard", 99, f.settings.starting_map);
EnumOption("Everett's House", 119, f.settings.starting_map);
EnumOption("Ocean Lab", 140, f.settings.starting_map);
if(EnumOption("Random", -1)) {
f.SetGlobalSeed("random starting map");
f.settings.starting_map = class'DXRStartMap'.static.ChooseRandomStartMap(f.dxr);
}

BreakLine();
#ifndef hx
NewMenuItem("The Merchant Chance %", "The chance for The Merchant to appear in each map."$BR$"If The Merchant dies then he stays dead for the rest of the game.");
Slider(f.settings.merchants, 0, 100);
Expand All @@ -62,6 +67,16 @@ function BindControls(optional string action)
NewMenuItem("Dancing %", "How many characters should be dancing.");
Slider(f.settings.dancingpercent, 0, 100);

NewMenuItem("Spoiler Buttons", "Allow the use of spoiler buttons (Spoilers remain hidden until you choose to view them)");
EnumOption("Available", 1, f.settings.spoilers);
EnumOption("Disallowed", 0, f.settings.spoilers);

NewMenuItem("Menus Pause Game", "Should the game keep playing while a menu is open?");
EnumOption("Pause", 1, f.settings.menus_pause);
EnumOption("Don't Pause", 0, f.settings.menus_pause);

NewGroup("Bingo");

NewMenuItem("Bingo Win", "How many completed lines to instantly win");
Slider(f.settings.bingo_win, 0, 12);

Expand All @@ -73,13 +88,13 @@ function BindControls(optional string action)
EnumOption("4 Free Spaces", 4, f.settings.bingo_freespaces);
EnumOption("5 Free Spaces", 5, f.settings.bingo_freespaces);

NewMenuItem("Spoiler Buttons", "Allow the use of spoiler buttons (Spoilers remain hidden until you choose to view them)");
EnumOption("Available", 1, f.settings.spoilers);
EnumOption("Disallowed", 0, f.settings.spoilers);

NewMenuItem("Menus Pause Game", "Should the game keep playing while a menu is open?");
EnumOption("Pause", 1, f.settings.menus_pause);
EnumOption("Don't Pause", 0, f.settings.menus_pause);
NewMenuItem("Bingo Duration", "How many missions should the bingo goals last for?");
EnumOption("End of Game", 0, f.bingo_duration);
EnumOption("1 Mission", 1, f.bingo_duration);
EnumOption("2 Missions", 2, f.bingo_duration);
EnumOption("3 Missions", 3, f.bingo_duration);
EnumOption("4 Missions", 4, f.bingo_duration);
EnumOption("5 Missions", 5, f.bingo_duration);

NewGroup("Medical Bots and Repair Bots");

Expand Down
14 changes: 11 additions & 3 deletions DXRModules/DeusEx/Classes/DXREvents.uc
Original file line number Diff line number Diff line change
Expand Up @@ -1562,16 +1562,23 @@ simulated function _CreateBingoBoard(PlayerDataItem data)
{
local int x, y, i;
local string event, desc;
local int progress, max, missions, starting_mission_mask, starting_mission;
local int progress, max, missions, starting_mission_mask, starting_mission, end_mission_mask, end_mission, masked_missions;
local int options[ArrayCount(bingo_options)], num_options, slot, free_spaces;
local float f;

starting_mission = class'DXRStartMap'.static.GetStartMapMission(dxr.flags.settings.starting_map);
starting_mission_mask = class'DXRStartMap'.static.GetStartingMissionMask(dxr.flags.settings.starting_map);
if (dxr.flags.bingo_duration!=0){
end_mission = starting_mission+dxr.flags.bingo_duration-1; //The same mission is the first mission
} else {
end_mission = 15;
}
end_mission_mask = class'DXRStartMap'.static.GetEndMissionMask(end_mission);

num_options = 0;
for(x=0; x<ArrayCount(bingo_options); x++) {
if(bingo_options[x].event == "") continue;
if(bingo_options[x].missions!=0 && (bingo_options[x].missions & starting_mission_mask) == 0) continue;
if(bingo_options[x].missions!=0 && ((bingo_options[x].missions & starting_mission_mask & end_mission_mask) == 0)) continue;
if(class'DXRStartMap'.static.BingoGoalImpossible(bingo_options[x].event,dxr.flags.settings.starting_map)) continue;
options[num_options++] = x;
}
Expand Down Expand Up @@ -1626,11 +1633,12 @@ simulated function _CreateBingoBoard(PlayerDataItem data)
desc = bingo_options[i].desc;
desc = tweakBingoDescription(event,desc);
missions = bingo_options[i].missions;
masked_missions = missions & end_mission_mask; //Pre-mask the bingo endpoint
max = bingo_options[i].max;
// dynamic scaling based on starting mission (not current mission due to leaderboard exploits)
if(max > 1 && InStr(desc, "%s") != -1) {
f = rngrange(1, 0.8, 1);// 80% to 100%
f *= MissionsMaskAvailability(starting_mission, missions);
f *= MissionsMaskAvailability(starting_mission, masked_missions);
max = Ceil(float(max) * f);
max = self.Max(max, 1);
desc = sprintf(desc, max);
Expand Down
1 change: 1 addition & 0 deletions DXRModules/DeusEx/Classes/DXRFlags.uc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function InitDefaults()
crowdcontrol = 0;
mirroredmaps = 0;
}
bingo_duration=0;
newgameplus_loops = 0;
#ifdef hx
Expand Down
16 changes: 15 additions & 1 deletion DXRModules/DeusEx/Classes/DXRFlagsBase.uc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var #var(flagvarprefix) int maxrando;
var #var(flagvarprefix) int newgameplus_loops;
var #var(flagvarprefix) int crowdcontrol;
var #var(flagvarprefix) int mirroredmaps;
var #var(flagvarprefix) int bingo_duration;

var #var(flagvarprefix) int difficulty;// save which difficulty setting the game was started with, for nicer upgrading
var #var(flagvarprefix) int bSetSeed;// int because all our flags are ints?
Expand Down Expand Up @@ -82,7 +83,7 @@ replication
{
reliable if( Role==ROLE_Authority )
f, seed, playthrough_id, flagsversion, gamemode, loadout, maxrando, newgameplus_loops,
settings,
settings, bingo_duration,
flags_loaded;
}

Expand Down Expand Up @@ -296,6 +297,7 @@ simulated function string BindFlags(int mode, optional string str)
FlagInt('Rando_gamemode', gamemode, mode, str);
FlagInt('Rando_setseed', bSetSeed, mode, str);
FlagInt('Rando_mirroredmaps', mirroredmaps, mode, str);
FlagInt('Rando_bingo_duration', bingo_duration, mode, str);

if( FlagInt('Rando_difficulty', difficulty, mode, str) ) {
SetDifficulty(difficulty);
Expand Down Expand Up @@ -517,6 +519,8 @@ simulated function string flagNameToHumanName(name flagname){
return "Bingo Lines to Win";
case 'Rando_bingo_freespaces':
return "Bingo Free Spaces";
case 'Rando_bingo_duration':
return "Bingo Duration";
case 'Rando_spoilers':
return "Spoiler Buttons";
case 'Rando_menus_pause':
Expand Down Expand Up @@ -738,6 +742,16 @@ simulated function string flagValToHumanVal(name flagname, int val){
}
break;

case 'Rando_bingo_duration':
if(val == 0) {
return "End of Game";
} else if(val == 1) {
return "1 Mission";
} else {
return val $ " Missions";
}
break;

//Weird, handle later
case 'Rando_doorsmode':
switch(val/256*256) {
Expand Down
40 changes: 40 additions & 0 deletions DXRModules/DeusEx/Classes/DXRStartMap.uc
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,42 @@ static simulated function int GetStartingMissionMask(int start_map)
}
}

//This could certainly be done a much more clever way, but this is literally good enough
static simulated function int GetEndMissionMask(int end_mission)
{
switch(end_mission){
case 1:
return 2;
case 2:
return 6;
case 3:
return 14;
case 4:
return 30;
case 5:
return 62;
case 6:
return 126;
case 7://Doesn't exist, fall down to 8
case 8:
return 382;
case 9:
return 894;
case 10:
return 1918;
case 11:
return 3966;
case 12:
return 8062;
case 13: //Doesn't exist, fall down to 14
case 14:
return 24446;
case 15:
return 57214;
}
return 57214;
}

static function string GetStartingMapName(int val)
{
switch(val){
Expand Down Expand Up @@ -223,6 +259,10 @@ static function bool BingoGoalImpossible(string bingo_event, int start_map)
break;
case "MetSmuggler":
return start_map>=80; //Mission 8 and later starts you should already know Smuggler (see StartMapSpecificFlags)
case "KnowsGuntherKillphrase":
return start_map>=60; //Have to have told Jaime to meet you in Paris in mission 5 to get Gunther's killphrase
case "FordSchick_Dead":
return start_map>=20;
default:
return False;
}
Expand Down

0 comments on commit 8562767

Please sign in to comment.