Skip to content

Commit

Permalink
Forgot to add a flag for the last feature I added
Browse files Browse the repository at this point in the history
Forgot to add a flag for the last feature I added
  • Loading branch information
Fenyx4 committed Jul 29, 2021
1 parent 584a526 commit 2601b18
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Options:
--townSaves Enable saving in towns.
--daemonTrigger Fix daemon spawn in Abyss
--awakenUpgrade Awaken spell awakens all characters.
--shopOverflow Don't allow overflow exploit in shops.
--shopOverflow Don't allow overflow exploit in shops.
--other Allow other gender like in Ultima III.
--vgaPatch VGA patch compatibility. Run randomizer after applying VGA patch.
--spoilerLog Output a spoiler log.
-? | -h | --help Show help information
Expand Down
3 changes: 3 additions & 0 deletions U4DosRandomizer/Flags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public Flags(int seed, int version)
public bool DaemonTrigger { get; internal set; }
public bool AwakenUpgrade { get; internal set; }
public bool ShopOverflowFix { get; internal set; }
public bool Other { get; internal set; }

public List<int> SupportedVersions = new List<int>() { 9 };

Expand Down Expand Up @@ -96,6 +97,7 @@ public string GetEncoded()
mask = SET_MSK(mask, DaemonTrigger, 0);
mask = SET_MSK(mask, AwakenUpgrade, 1);
mask = SET_MSK(mask, ShopOverflowFix, 2);
mask = SET_MSK(mask, Other, 3);
encoded.Add((byte)mask);

// Add another one just for a bit of future proofing
Expand Down Expand Up @@ -167,6 +169,7 @@ public void DecodeAndSet(string encodedString)
DaemonTrigger = TST_MSK(mask, 0);
AwakenUpgrade = TST_MSK(mask, 1);
ShopOverflowFix = TST_MSK(mask, 2);
Other = TST_MSK(mask, 3);

mask = encoded[9];

Expand Down
5 changes: 5 additions & 0 deletions U4DosRandomizer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ static void Main(string[] args)
"--shopOverflow",
"Don't allow overflow exploit in shops.",
CommandOptionType.NoValue);
CommandOption otherArg = commandLineApplication.Option(
"--other",
"Allow other gender like in Ultima III.",
CommandOptionType.NoValue);
CommandOption vgaPatchArg = commandLineApplication.Option(
"--vgaPatch",
"VGA patch compatibility. Run randomizer after applying VGA patch.",
Expand Down Expand Up @@ -313,6 +317,7 @@ static void Main(string[] args)
flags.DaemonTrigger = daemonTriggerArg.HasValue();
flags.AwakenUpgrade = awakenUpgradeArg.HasValue();
flags.ShopOverflowFix = shopOverflowArg.HasValue();
flags.Other = otherArg.HasValue();
flags.SpoilerLog = spoilerLogArg.HasValue();
flags.VGAPatch = vgaPatchArg.HasValue();

Expand Down
2 changes: 2 additions & 0 deletions U4DosRandomizer/Title.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ public void Update(UltimaData data, Flags flags, string encode)

titleBytes[ENABLE_KARMA_OVERRIDE_OFFSET] = flags.KarmaSetPercentage > 0 ? (byte)0x0 : (byte)0x9;

titleBytes[ENABLE_OTHER] = flags.Other ? (byte)0x0 : (byte)0x8;

for (int offset = 0; offset < 8; offset++)
{
titleBytes[KARMA_OVERRIDE_VALUES_OFFSET + offset] = (data.StartingKarma[offset] == 100 ? (byte)0 : data.StartingKarma[offset]);
Expand Down

0 comments on commit 2601b18

Please sign in to comment.