LADX: AP egg title screen (#1683)

This commit is contained in:
zig-for
2023-04-11 00:18:33 -07:00
committed by GitHub
parent b02b329181
commit 70ff19ac8c
10 changed files with 119 additions and 31 deletions

View File

@@ -1,11 +1,9 @@
from ..backgroundEditor import BackgroundEditor
import subprocess
import binascii
from .aesthetics import rgb_to_bin, bin_to_rgb, prepatch
import copy
import pkgutil
CHAR_MAP = {'z': 0x3E, '-': 0x3F, '.': 0x39, ':': 0x42, '?': 0x3C, '!': 0x3D}
def _encode(s):
result = bytearray()
for char in s:
@@ -82,3 +80,68 @@ def setRomInfo(rom, seed, seed_name, settings, player_name, player_id):
ba.tiles[0x9820 + n] = 0x08 | pal
be.store(rom)
ba.store(rom)
def setTitleGraphics(rom):
BASE = 0x9800
ROW_SIZE = 0x20
be = BackgroundEditor(rom, 0x11, attributes=True)
for tile in be.tiles:
if be.tiles[tile] == 7:
be.tiles[tile] = 3
be.tiles[BASE + 10 * ROW_SIZE + 8] = 7
be.tiles[BASE + 10 * ROW_SIZE + 10] = 2
be.tiles[BASE + 10 * ROW_SIZE + 11] = 5
be.tiles[BASE + 11 * ROW_SIZE + 10] = 6
be.tiles[BASE + 11 * ROW_SIZE + 11] = 6
be.tiles[BASE + 12 * ROW_SIZE + 11] = 6
be.tiles[BASE + 11 * ROW_SIZE + 9] = 1
be.tiles[BASE + 12 * ROW_SIZE + 9] = 1
be.tiles[BASE + 12 * ROW_SIZE + 10] = 1
be.tiles[BASE + 13 * ROW_SIZE + 9] = 1
be.tiles[BASE + 13 * ROW_SIZE + 10] = 1
be.store(rom)
SKIP_INTRO = True
if SKIP_INTRO:
# Skip intro as it's causing problems
rom.banks[1][0x2F5B : 0x2F5B + 3] = [0xC3, 0x39, 0x6E]
# Disable initial music
rom.banks[1][0x2F03 : 0x2F03 + 5] = [0] * 5
# Disable music fade on reset
rom.banks[1][0x3436 : 0x3436 + 3] = [0] * 3
# Set egg palette
BASE = 0x3DEE
palettes = []
BANK = 0x21
for i in range(8):
palette = []
for c in range(4):
address = BASE + i * 8 + c * 2
packed = (rom.banks[BANK][address + 1] << 8) | rom.banks[BANK][address]
r,g,b = bin_to_rgb(packed)
palette.append([r, g, b])
palettes.append(palette)
for i in [1, 2, 5, 6, 7]:
palettes[i] = copy.copy(palettes[3])
def to_5_bit(r, g, b):
return [r >> 3, g >> 3, b >> 3]
palettes[1][3] = to_5_bit(0xFF, 0x80, 145)
palettes[2][2] = to_5_bit(119, 198, 155)
palettes[5][3] = to_5_bit(119, 198, 155)
palettes[6][3] = to_5_bit(192, 139, 215)
palettes[7][3] = to_5_bit(229, 196, 139)
for i in range(8):
for c in range(4):
address = BASE + i * 8 + c * 2
packed = rgb_to_bin(*palettes[i][c])
rom.banks[BANK][address] = packed & 0xFF
rom.banks[BANK][address + 1] = packed >> 8