Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → [pokecrystal] Change the palette entry used by the pokepic macro's box

#1 2016-10-25 15:51:15

Rangi
Member
Registered: 2016-05-09
Post 262/790

[pokecrystal] Change the palette entry used by the pokepic macro's box

The 'pokepic' macro shows a Pokémon portrait, like when you look at the starters' balls. The portrait box is gray, palette entry 0. I'd like it to use entry 7, same as the Start menu and text boxes, because it would work even at night or in dark caves. Can someone please point me to where the color is coming from? Thank you.


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

Offline

#2 2016-10-27 11:42:34

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 404/431
Website

Re: [pokecrystal] Change the palette entry used by the pokepic macro's box

You know, I've never looked into how the g/s/c functions that handle these kind of things are, but I'd start be tracking down what sets the box area to palette 0. It's going to be something that is writting to the tile attribute area in Vram bank 1, between 9800 and 9fff, depending on which of the two backgroun maps is being used. Since the box is drawn in the middle of the screen you can just set a bp on 1:9a00 and 1:9e00 and you should notice the lower two bits of addresses around there being zeroed. You're probably going to end up in some vblank routine but you can use it to backtrack what requested that palette change and hopefully end up finding the game's "higher level" function that you can use for this kind of stuff instead of rewriting those values in vram in a dirty way.

Last edited by Crystal_ (2016-10-27 11:43:32)

Offline

#3 2016-10-27 13:14:46

Rangi
Member
Registered: 2016-05-09
Post 269/790

Re: [pokecrystal] Change the palette entry used by the pokepic macro's box

Okay, so when Pokepic calls MenuBox, it ends up calling TextBoxPalette, which fills "text box width c height b at hl with pal 7". But shortly after that, "ld b, SCGB_POKEPIC; call GetSGBLayout" sets it to 0.

SCGB_POKEPIC indexes into a jumptable which ends up doing "ld hl, PalPacket_9b96; ld de, BlkPacket_9b56; ld a, SCGB_08; ld [SGBPredef], a; [...] call Function9809". I haven't studied how Function9809 works yet.

I had traced this sequence before, but editing the bytes after PalPacket_9b96 didn't seem to have any effect, so I posted this question.

I'd be interested if you can explain how that works, but my immediate problem is solved. I've removed the GetSGBLayout layout call and replaced it with a call to a routine based on LoadOW_BGPal7 (which loads the palette for Flash in slot 7) but for a grayscale palette. Shouldn't be too hard to make this new routine load the Pokémon's palette, which would be even better than grayscale.

Thanks for your help!

Last edited by Rangi (2016-10-27 14:58:44)


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

Offline

  • Index
  • → Help/Question
  • → [pokecrystal] Change the palette entry used by the pokepic macro's box

Board footer

Powered by FluxBB