• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Graphics] Can't call CreateTrainerSprite to display a sprite

ellabrella

PKMN Trainer
  • 57
    Posts
    6
    Years
    • She/It
    • Seen Feb 27, 2025
    hi all, i'm trying to make a sort of character creation menu for my hack. it's basically a copy-paste of the option menu code except it sets name and gender instead. i'm trying to use CreateTrainerSprite to display an image of the player character, but nothing shows up when it's supposed to be called.

    if i copy the exact CreateTrainerSprite line to main_menu.c, it displays the sprite exactly as it should. however, if i copy it to option_menu.c (along with the relevant includes) instead, it doesn't display anything. so my thought is that i have to enable something to allow sprites to show up, or something?

    i've compared the main menu init function to my new game menu init function and tried a bunch of things, but haven't made any progress, and i feel a bit out of my depth editing them anyway.

    if anyone knows what the problem might be, i'd be very grateful!

    also, here's a pastebin for my new_game_menu.c if it helps: https://pastebin.com/GAP7UQjQ
     
    sure! here is what it looked like: https://pastebin.com/wTqnT9AC

    i've changed it back to normal since then, as i was just testing and don't plan on actually changing the option menu to include a sprite. so it's just a few lines of difference from a regular option menu:

    Code:
    #include "field_effect.h"
    #include "decompress.h"
    #include "constants/trainers.h"
    #include "trainer_pokemon_sprites.h"

    at the top, and

    Code:
    CreateTrainerSprite(FacilityClassToPicIndex(FACILITY_CLASS_MAY), 140, 64, 0, &gDecompressionBuffer[0x800]);

    inside the DPAD_UP section of Task_OptionMenuProcessInput.

    i put that exact CreateTrainerSprite line in the DPAD_UP section of main menu's input handling (it doesn't need the includes as the birch intro already uses that function), and that worked, which is why i tried it in the same kinda place here.
     
    The sprite is not showing up in the options menu because it's using the GBA's window feature and the sprite layer bits are not set.
    These lines should be changed to:
    Code:
    SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | WININ_WIN0_OBJ);
    SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG0 | WINOUT_WIN01_BG1 | WINOUT_WIN01_CLR | WINOUT_WIN01_OBJ);
     
    Back
    Top