gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > rpg text system

#8324 - antysix - Tue Jul 08, 2003 12:33 pm

How is the text system done in many rpg's, where you have a rectangle at the bottom that appears with text when you talk to someone (like in Pokemon)?

I took a look at Pokemon in an emulator and when I'm standing in a field bg1,2,3 form the surroundings and bg0 is empty. Then when I talk to someone (the rectangle appears) and I take a look at the bg's the text rectangle is in bg0. Is it done with windowing?
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age

Currently developping: Project ~ [ Phail ]

#8334 - DekuTree64 - Tue Jul 08, 2003 3:54 pm

You can do it with windowing, but then you have to keep a spare BG layer for it. In my RPG, I have one screen block for BG3's map data, and another one that I draw the text into. Then use the VCount (also called Y-trigger) interrupt to disable all layers but BG3 and switch its screen data to the text one when you get to the line of screen where the text box starts. Don't forget to set the scrolling regs too. Then just set everything back how it was with another VCount interrupt at the end of the box (the first interrupt sets up DISPSTAT for the second one, and the second one sets it up for the first one on next frame).
But if you don't plan to use all BGs for map layers, then use the windowing style. Or even easier, just fill with transparent tiles and then draw the textbox onto that.

#8339 - antysix - Tue Jul 08, 2003 6:11 pm

Thanks for the info DekuTree64, I think I'll be using the windowing style.
While there isn't very much info in the CowBit specs., does anybody know some docs about windowing?
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age

Currently developping: Project ~ [ Phail ]

#8340 - niltsair - Tue Jul 08, 2003 6:17 pm

Why do you want to use a transparent window? You could achieve the same result in a much more easier way(unless i'm missing something) by using transparent tiles. Any pixel using color 0 is transparent, so you define a tile filled with color 0, and use it for where you want to see the backbround and not some text area. For the text area, just make a nice border tileset and write your text in it.

#8376 - antysix - Wed Jul 09, 2003 12:01 pm

I'm not sure I fully inderstand you, niltsair.
So you mean, I just use bg1,2,3 for the surroundings, and I fill bg0 with transparent tiles and on the bottom I have my text border.
But this way my text border will be visible all the time, or do I need to switch priorities on the right time, to put bg0 as the most far away bg-layer to not see the text border when I'm not using it?
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age

Currently developping: Project ~ [ Phail ]

#8379 - tepples - Wed Jul 09, 2003 12:29 pm

You can keep your text layer hidden (turned off in DISPCNT) when you're not using it. Or, for a smoother effect, you can just keep your text layer scrolled out of the way most of the time and then scroll it in when you want to display text.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#8386 - niltsair - Wed Jul 09, 2003 2:56 pm

No, what you need to do is :

1. You build one map for the text, putting borders and content(text).
2. You setup one background(while not displayed) it's position, transparence setting, alpha setting, top layer
3. You assign the created map to the background
4. You display it, using some effect if you'd like (scrolling, slowly making it less and less transparent, etc..)

Note: The transparent effect i'm talking about here is not the same one i talked in the previous post. Tiles can all have seethrough pixels and on top of that, layer can have 16 levels of transparence that allow to see the background underneath.

#8393 - antysix - Wed Jul 09, 2003 4:37 pm

I fully understand it now. Thanks to you all!
_________________
Currently playing: NGC: Metroid Prime
GBA: Golden Sun: The Lost Age

Currently developping: Project ~ [ Phail ]