Skip to content

Commit

Permalink
preview 47
Browse files Browse the repository at this point in the history
  • Loading branch information
igorseabra4 committed Jul 27, 2019
1 parent 608af20 commit f856913
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ private void ShufflePKUPPositions(Random r)
}
}
break;
case "bb01":
if (ContainsAsset(new AssetID("SHINY_RED_019")))
assets.Remove((AssetPKUP)GetFromAssetID(new AssetID("SHINY_RED_019")));
break;
case "gl01":
if (ContainsAsset(new AssetID("SHINY_YELLOW_004")))
assets.Remove((AssetPKUP)GetFromAssetID(new AssetID("SHINY_YELLOW_004")));
Expand Down
4 changes: 2 additions & 2 deletions IndustrialPark/Other/IPversion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
public class IPversion
{
public string version = "preview46";
public string versionName = "Preview 46";
public string version = "preview47";
public string versionName = "Preview 47";
}
}
4 changes: 2 additions & 2 deletions IndustrialPark/Research/Randomizer.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 31 additions & 27 deletions IndustrialPark/Research/Randomizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ private void Randomizer_Load(object sender, EventArgs e)
RandomizerFlags.Tiki_Models |
RandomizerFlags.Tiki_Allow_Any_Type |
RandomizerFlags.Enemy_Types |
RandomizerFlags.Enemies_Allow_Any_Type |
RandomizerFlags.MovePoint_Radius |
RandomizerFlags.Platform_Speeds |
RandomizerFlags.Boulder_Settings |
Expand Down Expand Up @@ -109,27 +110,9 @@ private void buttonPerform_Click(object sender, EventArgs e)
RandomizerFlagsP2 flags2 = GetActiveFlagsP2();
RandomizerFlagsP3 flags3 = GetActiveFlagsP3();

if ((flags & RandomizerFlags.Enemies_Allow_Any_Type) != 0)
{
if (currentPlatform == HipHopFile.Platform.GameCube)
{
if (!Directory.Exists(ArchiveEditorFunctions.editorFilesFolder))
{
DialogResult dialogResult = MessageBox.Show("The IndustrialPark-EditorFiles folder has not been found under Resources. You must download it first to be able to use Enemies_Allow_Any_Type. Do you wish to download it?", "Note", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
if ((flags & RandomizerFlags.Enemies_Allow_Any_Type) != 0 && currentGame != HipHopFile.Game.BFBB)
flags ^= RandomizerFlags.Enemies_Allow_Any_Type;

if (dialogResult == DialogResult.Yes)
AutomaticUpdater.DownloadEditorFiles();
else
flags ^= RandomizerFlags.Enemies_Allow_Any_Type;
}
}
else
{
MessageBox.Show("Enemies_Allow_Any_Type is only supported for GameCube. It will be disabled");
flags ^= RandomizerFlags.Enemies_Allow_Any_Type;
}
}

if (isDir)
PerformDirRandomizer(r, flags, flags2, flags3);
else
Expand Down Expand Up @@ -170,6 +153,8 @@ private void PerformDirRandomizer(Random r, RandomizerFlags flags, RandomizerFla
toSkip.AddRange(richTextBoxSkip.Lines);
toSkip.AddRange(richTextBox2.Lines);

bool platformVerified = false;

foreach (string dir in folderNames)
foreach (string hipPath in Directory.GetFiles(dir))
if (Path.GetExtension(hipPath).ToLower() == ".hip")
Expand All @@ -180,6 +165,29 @@ private void PerformDirRandomizer(Random r, RandomizerFlags flags, RandomizerFla
ArchiveEditorFunctions hip = new ArchiveEditorFunctions();
hip.OpenFile(hipPath, false, true);

if (!platformVerified && (flags & RandomizerFlags.Enemies_Allow_Any_Type) != 0)
{
if (currentPlatform == HipHopFile.Platform.GameCube)
{
if (!Directory.Exists(ArchiveEditorFunctions.editorFilesFolder))
{
DialogResult dialogResult = MessageBox.Show("The IndustrialPark-EditorFiles folder has not been found under Resources. You must download it first to be able to use Enemies_Allow_Any_Type. Do you wish to download it?", "Note", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

if (dialogResult == DialogResult.Yes)
AutomaticUpdater.DownloadEditorFiles();
else
flags ^= RandomizerFlags.Enemies_Allow_Any_Type;
}
}
else
{
MessageBox.Show("Enemies_Allow_Any_Type is only supported for GameCube. It will be disabled");
flags ^= RandomizerFlags.Enemies_Allow_Any_Type;
}

platformVerified = true;
}

if ((flags & RandomizerFlags.Warps) != 0 && !FileInSecondBox(hipPath))
hip.GetWarpNames(ref warpNames, toSkip);

Expand All @@ -205,7 +213,7 @@ private void PerformDirRandomizer(Random r, RandomizerFlags flags, RandomizerFla
}

string nameForBoot = Path.GetFileNameWithoutExtension(hipPath).ToUpper();
if (ShouldShuffle(flags3, RandomizerFlagsP3.RandomBootLevel) && !namesForBoot.Contains(nameForBoot))
if (ShouldShuffle(flags3, RandomizerFlagsP3.RandomBootLevel) && !FileInSecondBox(hipPath) && !namesForBoot.Contains(nameForBoot))
namesForBoot.Add(nameForBoot);

progressBar1.PerformStep();
Expand Down Expand Up @@ -496,11 +504,7 @@ private void ButtonSaveJson_Click(object sender, EventArgs e)
Filter = "JSON Files|*.json|All files|*.*"
};
if (saveFile.ShowDialog() == DialogResult.OK)
{
string file = JsonConvert.SerializeObject(FromInstance(), Formatting.Indented);

File.WriteAllText(saveFile.FileName, file);
}
File.WriteAllText(saveFile.FileName, JsonConvert.SerializeObject(FromInstance(), Formatting.Indented));
}

private void ButtonLoadJson_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -583,7 +587,7 @@ public class RandoSettings

public RandoSettings FromInstance() => new RandoSettings()
{
version = 46,
version = 47,
seedText = textBoxSeed.Text,
seedNum = seed,
flags = GetActiveFlags(),
Expand Down
28 changes: 14 additions & 14 deletions IndustrialPark/Research/RandomizerFlags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ public enum RandomizerFlags
Tiki_Models = 1 << 3,
Tiki_Allow_Any_Type = 1 << 4,
Enemy_Types = 1 << 5,
MovePoint_Radius = 1 << 6,
Platform_Speeds = 1 << 7,
Boulder_Settings = 1 << 8,
Marker_Positions = 1 << 9,
Pointer_Positions = 1 << 10,
Player_Start = 1 << 11,
Timers = 1 << 12,
Music = 1 << 13,
Disco_Floors = 1 << 14,
Textures = 1 << 15,
Sounds = 1 << 16,
Cameras = 1 << 17,
Reduce_Warps_To_HB01 = 1 << 18,
Enemies_Allow_Any_Type = 1 << 19,
Enemies_Allow_Any_Type = 1 << 6,
MovePoint_Radius = 1 << 7,
Platform_Speeds = 1 << 8,
Boulder_Settings = 1 << 9,
Marker_Positions = 1 << 10,
Pointer_Positions = 1 << 11,
Player_Start = 1 << 12,
Timers = 1 << 13,
Music = 1 << 14,
Disco_Floors = 1 << 15,
Textures = 1 << 16,
Sounds = 1 << 17,
Cameras = 1 << 18,
Reduce_Warps_To_HB01 = 1 << 19,
Double_BootHip_LODT = 1 << 20
}

Expand Down
4 changes: 2 additions & 2 deletions IndustrialPark/Resources/ip_version.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "preview46",
"versionName": "Preview 46:\nRandomizer update: fixes major issue with Warps randomizer.\n"
"version": "preview47",
"versionName": "Preview 47:\nRandomizer update: fixes more issues with Warps randomizer, adds proper Enemies_Allow_Any_Type method"
}

0 comments on commit f856913

Please sign in to comment.