Skeetendo

’Cause all games were better on the GBC

You are not logged in.

  • Index
  • → Help/Question
  • → Crystal Pokédex area map loads in thirds; how to fix two bad frames?

#1 2017-06-02 17:41:21

Rangi
Member
Registered: 2016-05-09
Post 701/870

Crystal Pokédex area map loads in thirds; how to fix two bad frames?

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:

OeBpS2C.png

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:

NDMXNVg.png

_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.

828Bg3Q.png

Edit: For now I'm blacking out the screen while switching maps.

Last edited by Rangi (2017-06-02 18:09:00)


Pokémon Polished Crystal (GitHub) — version 2.2.0 released
Pokémon Red★ and Blue★: Space World Edition (GitHub) — updated August 19!
Polished Map: pokered+pokecrystal map, tileset, and palette editor — version 3.5.1 released!

Offline

#2 2017-06-02 20:16:10

Crystal_
Member
From: Spain
Registered: 2012-09-16
Post 422/450
Website

Re: Crystal Pokédex area map loads in thirds; how to fix two bad frames?

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)

Offline

#3 2017-06-03 02:42:46

comet
Member
Registered: 2012-04-09
Post 675/679

Re: Crystal Pokédex area map loads in thirds; how to fix two bad frames?

For the type icon, write to hBGMapThird so that it gets to the middle on the same frame as the palette change.

Offline

#4 2017-06-03 03:39:25

Rangi
Member
Registered: 2016-05-09
Post 702/870

Re: Crystal Pokédex area map loads in thirds; how to fix two bad frames?

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.


Pokémon Polished Crystal (GitHub) — version 2.2.0 released
Pokémon Red★ and Blue★: Space World Edition (GitHub) — updated August 19!
Polished Map: pokered+pokecrystal map, tileset, and palette editor — version 3.5.1 released!

Offline

  • Index
  • → Help/Question
  • → Crystal Pokédex area map loads in thirds; how to fix two bad frames?

Board footer

Powered by FluxBB