You are not logged in.
I'm still having trouble with coloring the party menu sprites by species, instead of all being red.
There's this section in wram.asm:
SECTION "Sprites", WRAM0 [$c400] Sprites:: ; c400 ; 4 bytes per sprite ; 40 sprites ; struct: ; y (px) ; x (px) ; tile id ; attributes: ; bit 7: priority ; bit 6: y flip ; bit 5: x flip ; bit 4: pal # (non-cgb) ; bit 3: vram bank (cgb only) ; bit 2-0: pal # (cgb only) ds 4 * 40 SpritesEnd::
As far as I can tell, the leaked Pokémon Prism code achieves its colored party sprites by directly editing this data. (Check out its engine/mon_icons.asm routines, in particular LoadPartyColors and ProcessPokemonColor.) My attempt to adapt these routines isn't working. And the simplest thing I can think of that should work still doesn't:
InitPartyMenuGFX: ; 503e0 ld hl, PartyCount ld a, [hli] and a ret z ld c, a xor a ld [hObjectStructIndexBuffer], a .loop push bc push hl ld e, $0 farcall LoadPartyIcons ; Prism assigns colors here ld a, [hObjectStructIndexBuffer] inc a ld [hObjectStructIndexBuffer], a pop hl pop bc dec c jr nz, .loop ; simple test - force the top corner of the first sprite to be green? ld hl, Sprites + 3 ld a, PAL_OW_GREEN ld [hl], a farcall PlaySpriteAnimations ret
I know that engine/sprites.asm:GetSpriteOAMAttr is ultimately responsible for getting the current OAM sprite color, and modifying it works to force all sprites to be a certain color. But modifying it to know when it's being called by the party menu, and get the species-specific color there, seems convoluted and wrong. The "correct" place to assign the sprite color is along with the other sprite properties, in mon_icons.asm. What could I be doing wrong?
Last edited by Rangi (2016-12-22 12:02:32)
engine/pokegear.asm:_Area is a more tractable example. There's a section ".HideNestsShowPlayer" that runs if you hold Select while looking at a Pokédex Area map. It clearly loads the appropriate data into the first 16 bytes of the Sprites WRAM section. When I add extra code for the next 16 bytes, the icon appears correctly.
; add at the end of _Area, after "call ByteFill" ; begin example ld hl, Sprites + 4 * 4 ld de, .ExampleOAM .example_loop ld a, [de] cp $ff jr z, .example_done inc de ld [hli], a jr .example_loop .example_done ; end example ret .ExampleOAM: ; y x tid attr db 45 - 8, 42 - 8, $7f, PAL_OW_RED db 45 - 8, 42, $7f, PAL_OW_BLUE db 45, 42 - 8, $7f, PAL_OW_GREEN db 45, 42, $7f, PAL_OW_BROWN db $ff
What confuses me is when it's possible to do this. Either there's a precondition I need to set up for the party menu, or something runs afterward that resets it. Any tips?
Last edited by Rangi (2016-12-23 01:02:12)