Skip to content

Commit

Permalink
Merge pull request #4 from mrgriffin/partnertrainerproc
Browse files Browse the repository at this point in the history
TRAINER_BACK_PIC
  • Loading branch information
Bassoonian authored Apr 21, 2024
2 parents 1d16698 + 11d2aca commit 9cf58ee
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tools/trainerproc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ static bool is_literal_string(struct String s1, const char *s2)
}
}

static bool starts_with(struct String s, const char *prefix)
{
int n = strlen(prefix);
return strncmp((const char *)s.string, prefix, n) == 0;
}

static bool ends_with(struct String s, const char *suffix)
{
int n = strlen(suffix);
Expand Down Expand Up @@ -1614,7 +1620,10 @@ static void fprint_trainers(const char *output_path, FILE *f, struct Parsed *par
{
fprintf(f, "#line %d\n", trainer->pic_line);
fprintf(f, " .trainerPic = ");
fprint_constant(f, "TRAINER_PIC", trainer->pic);
if (starts_with(trainer->id, "PARTNER_"))
fprint_constant(f, "TRAINER_BACK_PIC", trainer->pic);
else
fprint_constant(f, "TRAINER_PIC", trainer->pic);
fprintf(f, ",\n");
}

Expand Down

0 comments on commit 9cf58ee

Please sign in to comment.