Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 51 additions & 2 deletions RandomizerCore/Hyrule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2936,8 +2936,6 @@ private void UpdateRom()
palace.WriteConnections(ROMData);
}

ROMData.AddCredits();

ROMData.Put(0x1CD3A, (byte)palGraphics[(int)westHyrule.locationAtPalace1.PalaceNumber!]);
ROMData.Put(0x1CD3B, (byte)palGraphics[(int)westHyrule.locationAtPalace2.PalaceNumber!]);
ROMData.Put(0x1CD3C, (byte)palGraphics[(int)westHyrule.locationAtPalace3.PalaceNumber!]);
Expand Down Expand Up @@ -3937,6 +3935,56 @@ public void StatTracking(Assembler asm)
a.Code(Util.ReadResource("Z2Randomizer.RandomizerCore.Asm.StatTracking.s"), "stat_tracking.s");
}

public void AddCredits(Assembler asm)
{
byte[] CmdText(int x, int y, string text)
{
byte pos = (byte)((y << 5) + (x & 0b00011111));
var stringByte = ROM.StringToZ2Bytes(text);
byte stringLen = (byte)stringByte.Length;
return [0x22, pos, stringLen, .. stringByte];
}

byte[] header = [
.. CmdText(7, 1, "THANKS FOR PLAYING"),
.. CmdText(7, 2, " "), // clear previous credit line
.. CmdText(7, 3, "ZELDA 2 RANDOMIZER"),
0xff];
byte[] body = [
.. CmdText(11, 4, " "), // clear previous credit line
.. CmdText(15, 5, "BY"),
.. CmdText(5, 6, "DIGSHAKE"), .. CmdText(19, 6, "ELLENDAR"),
.. CmdText(5, 7, "JROWEBOY"), .. CmdText(21, 7, "INITSU"),
0xff];

var a = asm.Module();
a.Segment("PRG5");
a.Reloc();
a.Label("NewCreditsHeader");
a.Byt(header);
a.Reloc();
a.Label("NewCreditsBody");
a.Byt(body);

a.Code("""
.include "z2r.inc"

.segment "PRG5"

bank5_Pointer_table_for_End_Credits:
.org $9259 ; first entry
.org $9279
.word NewCreditsHeader
.org $927b
.word NewCreditsBody

.org $934F
FREE_UNTIL $9364
.org $9364
FREE_UNTIL $937E
""", "add_credits.s");
}

private void ChangeMapperToMMC5(Assembler asm, bool preventFlash, bool enableZ2Ft)
{
var a = asm.Module();
Expand Down Expand Up @@ -3965,6 +4013,7 @@ private void ApplyAsmPatches(RandomizerProperties props, Assembler engine, Rando
rom.FixMinibossGlitchyAppearance(engine);
rom.FixBossKillPaletteGlitch(engine);
StatTracking(engine);
AddCredits(engine);

if (props.ShuffleEnemyHP)
{
Expand Down
9 changes: 0 additions & 9 deletions RandomizerCore/ROM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,6 @@ public void WritePalacePalettes(List<int[]> bricks, List<int[]> curtains, List<i
}
}

public void AddCredits()
{
var randoby = Util.ToGameText("RANDO BY ", false);
Put(creditsLineOneAddr, randoby);

var digshake = Util.ToGameText("DIGSHAKE ", true);
Put(creditsLineTwoAddr, digshake);
}

public void AddRandomizerToTitle(Assembler asm)
{
// This is just updating the macro commands used to draw the title screen tiles
Expand Down
Loading