Skip to content
Open
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
114 changes: 114 additions & 0 deletions rust/maprando/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2685,6 +2685,120 @@ impl Patcher<'_> {
Ok(())
}

fn write_longbooster_item_graphics(&mut self) -> Result<()> {
let w = 0xc;
let frame_1: [[u8; 16]; 16] = [
[0, 0, 7, 6, 5, 4, 4, w, 4, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 7, 7, 6, 6, 5, 6, 6, 7, 7, 7, 0, 0, 0],
[0, 0, 0, 7, 6, 5, 5, 4, 5, 5, 6, 7, 0, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 4, 9, 4, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 9, 1, 9, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 9, 1, 9, 9, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 9, 1, w, 1, 9, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 9, 1, 1, w, 9, 9, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 9, 1, 1, 1, 1, 1, 9, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 9, 1, 9, 9, 9, 1, 9, 9, 7, 0, 0, 0],
[0, 0, 7, 9, 1, 9, 9, w, 9, 9, 1, 9, 7, 0, 0, 0],
[0, 0, 7, 9, 9, 9, 4, w, 4, 9, 9, 9, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 4, w, 4, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 0, 7, 7, 6, 6, 5, 6, 6, 7, 7, 0, 0, 0, 0],
[0, 0, 7, 5, 6, 5, 4, w, 4, 5, 6, 5, 7, 0, 0, 0],
[0, 0, 7, 6, 7, 7, 5, 4, 5, 7, 7, 6, 7, 0, 0, 0],
];
let frame_2: [[u8; 16]; 16] = [
[0, 0, 7, 6, 5, 4, 4, w, 4, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 7, 7, 6, 6, 5, 6, 6, 7, 7, 7, 0, 0, 0],
[0, 0, 0, 7, 6, 5, 5, 4, 5, 5, 6, 7, 0, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 4, 9, 4, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 9, w, 9, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 9, 1, 9, 9, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 9, 1, w, w, 9, 5, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 9, w, 1, w, 9, 9, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 9, w, 1, w, 1, w, 9, 6, 7, 0, 0, 0],
[0, 0, 7, 6, 9, w, 9, 9, 9, w, 9, 9, 7, 0, 0, 0],
[0, 0, 7, 9, w, 9, 9, w, 9, 9, w, 9, 7, 0, 0, 0],
[0, 0, 7, 9, 9, 9, 4, w, 4, 9, 9, 9, 7, 0, 0, 0],
[0, 0, 7, 6, 5, 4, 4, w, 4, 4, 5, 6, 7, 0, 0, 0],
[0, 0, 0, 7, 7, 6, 6, 5, 6, 6, 7, 7, 0, 0, 0, 0],
[0, 0, 7, 5, 6, 5, 4, w, 4, 5, 6, 5, 7, 0, 0, 0],
[0, 0, 7, 6, 7, 7, 5, 4, 5, 7, 7, 6, 7, 0, 0, 0],
];
let frames: [[[u8; 16]; 16]; 2] = [frame_1, frame_2];
let mut addr = snes2pc(0x899100);
for f in &frames {
for tile_y in 0..2 {
for tile_x in 0..2 {
let mut tile: [[u8; 8]; 8] = [[0; 8]; 8];
for y in 0..8 {
for x in 0..8 {
tile[y][x] = f[tile_y * 8 + y][tile_x * 8 + x];
}
}
write_tile_4bpp(self.rom, addr, tile)?;
addr += 32;
}
}
}
Ok(())
}

fn write_bluebooster_item_graphics(&mut self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],
[3, 1, 2, 1, 2, 1, 3, 1, w, 2, 1, w, 1, 0, 0, 0],
[0, 3, 3, 2, 1, 2, 3, 3, 1, 2, 2, w, 1, 1, 0, 0],
[0, 0, 0, 3, 3, 1, 1, 3, 3, 1, 2, 2, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 3, 3, 1, 3, 2, w, 2, 1, w, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 7, 7, 6, 6, 6, 6, 6, 6, 7, 7, 0, 0, 0],
[0, 0, 0, 0, 6, 5, 4, w, w, 4, 5, 6, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 7, 7, 6, 6, 7, 7, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 6, 5, 4, w, w, 4, 5, 6, 0, 0, 0, 0],
[0, 0, 0, 7, 7, 6, 6, 6, 6, 6, 6, 7, 7, 0, 0, 0],
[0, 7, 4, 5, 6, 5, 4, w, w, 4, 5, 6, 5, 4, 7, 0],
[0, 7, 5, 7, 7, 7, 7, 4, 4, 7, 7, 7, 7, 5, 7, 0],
];
let frames: [[[u8; 16]; 16]; 2] = [frame_1, frame_2];
let mut addr = snes2pc(0x899100);
for f in &frames {
for tile_y in 0..2 {
for tile_x in 0..2 {
let mut tile: [[u8; 8]; 8] = [[0; 8]; 8];
for y in 0..8 {
for x in 0..8 {
tile[y][x] = f[tile_y * 8 + y][tile_x * 8 + x];
}
}
write_tile_4bpp(self.rom, addr, tile)?;
addr += 32;
}
}
}
Ok(())
}

fn apply_room_outline(&mut self, room_idx: usize, room_ptr: usize) -> Result<()> {
let room = &self.game_data.room_geometry[room_idx];
let room_x = self.rom.read_u8(room.rom_address + 2)?;
Expand Down
Loading