You are not logged in.
The Area function of Crystal's Pokédex is implemented in engine/pokegear.asm:_Area. Since there are only two regions, it loads the Kanto map in VBGMap1 and the Johto map in VBGMap0, and then toggles [hWY] between $0 and $90 to quickly switch between the two when you press left/right. This is important because TownMapBGUpdate updates the screen in thirds, so the graphics need to change all at once.
I have added a third region map, and refactored the Area function to reload the graphics in VBGMap0 whenever you switch. Here's an example:
The problem is, when you switch maps the screen is updated one third at a time, so for one frame you see the bottom two-thirds with the previous map's palette, and the one frame the bottom third. This is especially noticeable because I'm using all the tile attributes: not just palette, but X/Y flip. So for example, here's the Kanto map with only the top third updated, and the bottom two still using Johto's tiles but Kanto's palette+flip attributes:
_Area.UpdateGFX is the part that updates the map. How can I edit it to avoid this sort of graphical glitch?
Edit: Actually, I have a similar issue with the battle interface. Loading CategoryIconGFX and TypeIconGFX takes time, so whether I call LoadBattleCategoryAndTypePals before or after loading the new graphics, there will be one frame where you notice the wrong palette-graphics correspondence.
Edit: For now I'm blacking out the screen while switching maps.
Last edited by Rangi (2017-06-02 18:09:00)
Track the third that is going to be updated in the next frame and only scroll the window in that third, then do the same for two more frames? Unless you can somehow fit an update of the whole screen in a single vblank I don't think there's much else you can do. Well, you can always stick to a blackout/whiteout/some sort of progressive fading animation. Actually, I think a fade out + fade in animation wouldn't look bad.
As for the issue in battle, I guess you can always just erase the content of the text box for 2-3 frames between refreshing palettes and redrawing the sprites.
Edit: It took me a while to get everything right and reworded the post in the process, but I think I did in the end. BG Map 0 is the Window one right? So you can scroll it in in a single frame while palettes and attributes take three (just like it would take redrawing the window tiles). I was thinking the opposite until I realized it didn't make sense. Anyway, I'm pretty sure you understand these low level things better than I do at this point. I'm pretty sure all the feasible solutions have gone through your head at some point, maybe it's just about being creative to get around the different limitations, like using a fading animation if a straight up blackout or whiteout doesn't look good to you.
Last edited by Crystal_ (2017-06-02 20:39:31)
For the type icon, write to hBGMapThird so that it gets to the middle on the same frame as the palette change.
Thank you both! I'll experiment with hBGMapThird and hBGMapMode, see what they can accomplish. Although the all-black transition is fast enough that I wouldn't mind just leaving it in, especially since it's consistent with the other Pokédex operations.