Skeetendo

’Cause all games were better on the GBC

You are not logged in.

#1 2016-09-02 23:50:56

Rangi
Member
Registered: 2016-05-09
Post 148/831

[pokecrystal] Individual colors for party menu sprites

I've been studying what seem like the appropriate routines in engine/party_menu.asm and engine/color.asm: InitPartyMenuLayout → LoadPartyMenuGFX → InitPartyMenuPalettes → InitPartyMenuOBPals → Palettes_b681 loads two sprite palette entries, with the first (red) applying to all six Pokémon and the second (blue) applying to Kris on the Fly map.

But try as I might, I cannot figure out how the colors get assigned to sprites. It could be that when the sprites are set up they're zeroed out and so automatically get the first palette entry, but I can't find exactly how they're initialized either.

If someone could help me set an arbitrary palette entry for a menu sprite, I'm sure I can take it from there to load appropriate colors from a table of species. Thank you.


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

#2 2016-09-08 17:53:55

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 398/437
Website

Re: [pokecrystal] Individual colors for party menu sprites

It used to be Function8d0de in pokecrystal. It returns the fourth attribute of the sprite in register a. The lower 3 bits is the palette number and they're always 0 (sprite palette 0, usullay red), so just add between 0 and 7 to a, right before returning from the function to select the palette to use. You can check which is the pokemon id, and choose the palette based on that.

Function8d0de: ; 8d0de
ld a, [wc3b8]
ld b, a
ld a, [hl]
xor b
and $e0
ld b, a
ld a, [hl]
and $1f
or b
; check pokemon id, get its sprite palette
; add sprite palette number to a
ret

Offline

#3 2016-09-09 00:41:51

Rangi
Member
Registered: 2016-05-09
Post 188/831

Re: [pokecrystal] Individual colors for party menu sprites

Excellent, Crystal_! Looks like _GetSpritePalette;142c4 determines the palettes of overworld sprites, and GetSpriteOAMAttr;8d0de determines them for the party menu, and also for the Town Map when Flying and some slot machine sprites like the reel-shaking Golems (and maybe some other ones too). I should be able to add this feature in the next major release. Thank you very much!


ROM hack: Pokémon Polished Crystal (GitHub) — version 2.2.0 released!

Offline

Board footer

Powered by FluxBB