Skip to content

Commit

Permalink
RE CV: try new item pickup change
Browse files Browse the repository at this point in the history
  • Loading branch information
IntelOrca committed Mar 16, 2024
1 parent 22bb9f8 commit 9452419
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
9 changes: 9 additions & 0 deletions IntelOrca.Biohazard.BioRand/RECV/ReCvRandomiser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ public override void Generate(RandoConfig config, IRandoProgress progress, FileR
SetDoorSkip();
FixRifleStacking();
SetItemQuantityPickup(config, new Rng(config.Seed));
HackItemPickup();

// base.Generate(config, progress, fileRepository);

Expand Down Expand Up @@ -480,6 +481,14 @@ private void FixRifleStacking()
bw.Write((byte)0x16);
}

private void HackItemPickup()
{
var ms = new MemoryStream(_elf);
var bw = new BinaryWriter(ms);
ms.Position = ConvertAddress(0x266E30);
bw.Write((byte)0x06);
}

private void SetSpecialSlotItem(byte item)
{
var ms = new MemoryStream(_elf);
Expand Down
17 changes: 16 additions & 1 deletion IntelOrca.Biohazard.BioRand/Rdt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private void SetItem(byte id, byte? itemId, short? globalId, ushort type, ushort
if (rdtBuilder.Items.Count > itemId)
{
var item = rdtBuilder.Items[itemId.Value];
item.Type = type;
item.Type = (item.Type & 0xFFFF) | (type << 16);
rdtBuilder.Items[itemId.Value] = item;
RdtFile = rdtBuilder.ToRdt();
}
Expand Down Expand Up @@ -528,6 +528,21 @@ public void Save()
postMod();
}

if (Version == BioVersion.BiohazardCv)
{
var rdtCv = ((RdtCv)RdtFile).ToBuilder();
for (var i = 0; i < rdtCv.Items.Count; i++)
{
var item = rdtCv.Items[i];
if (((item.Type >> 16) & 0xFFFF) == 0)
{
item.Type |= (item.Type << 16);
}
rdtCv.Items[i] = item;
}
RdtFile = rdtCv.ToRdt();
}

if (ModifiedPath != null)
{
Directory.CreateDirectory(Path.GetDirectoryName(ModifiedPath)!);
Expand Down

0 comments on commit 9452419

Please sign in to comment.