Skip to content

Commit

Permalink
Explore removing text messages from gen5 games
Browse files Browse the repository at this point in the history
  • Loading branch information
Hejsil committed Jan 10, 2022
1 parent 5c13dc9 commit 91b1c26
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/core/gen5.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const unicode = std.unicode;

const nds = rom.nds;

const li32 = rom.int.li32;
const lu128 = rom.int.lu128;
const lu16 = rom.int.lu16;
const lu32 = rom.int.lu32;
Expand Down Expand Up @@ -1327,6 +1328,43 @@ pub const Game = struct {
};
while (decoder.next() catch continue) |command| : (command_offset = decoder.i) {
switch (command.toZigUnion()) {
.wait_button,
.message,
.message2,
.message3,
.bubble_message,
.close_bubble_message,
.bordered_message,
.close_bordered_message,
.close_message_k_p,
.close_message_k_p2,
.event_grey_message,
.closed_event_grey_message,
.multi2,
.close_multi,
.set_text_script_message,
.angry_message,
.close_angry_message,
.double_message,
.show_message_at,
.close_show_message_at,
=> {
const bytes = mem.asBytes(command);
const len = @import("script.zig").packedLength(command.*) catch
unreachable;
if (len % 2 == 0) {
mem.set(u8, bytes[0..len], 0);
} else if (len == 3) {
unreachable;
} else if (len == 5) {
command.tag = .@"if";
command.data().@"if".value = 0;
command.data().@"if".offset = li32.init(0);
} else {
command.tag = .jump;
command.data().jump.offset = li32.init(@intCast(i32, len) - 6);
}
},
.wild_battle => |battle| try static_pokemons.append(.{
.species = &battle.species,
.level = &battle.level,
Expand Down

0 comments on commit 91b1c26

Please sign in to comment.