• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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
5
Years
  • Age 24
  • Seen Apr 17, 2024
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
 
247
Posts
6
Years
  • Age 25
  • Seen yesterday
Could you share a pastebin for your option_menu.c so that we can see how and where you're currently using CreateTrainerSprite in that file?
 

ellabrella

PKMN Trainer
57
Posts
5
Years
  • Age 24
  • Seen Apr 17, 2024
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.
 
444
Posts
6
Years
  • Age 37
  • Seen today
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