Original Post

How do you use BGMaps? I’m trying to make a world

copymem((void*)BGMap(3), (void*)GRASS, 4096);
vbSetWorld(28, WRLD_ON | 3, 0, 0, 0, 0, 0, 0, 384, 224);

where GRASS is a BGMap full of 0x0700 cells referencing a character in charseg 3 (I think… that’s why it goes into BGMap 3, right?). But I don’t see anything on the screen, apart from the other worlds. I’m doing everything just like KR155E’s introductory demo, but no success. Any ideas?

Also, what’s the best way to make a really long scrolling background as simple as possible? BGMaps are only 512×512 so I’d have to chain them, right?

4 Replies

HorvatM wrote:
How do you use BGMaps? I’m trying to make a world

copymem((void*)BGMap(3), (void*)GRASS, 4096);
vbSetWorld(28, WRLD_ON | 3, 0, 0, 0, 0, 0, 0, 384, 224);

where GRASS is a BGMap full of 0x0700 cells referencing a character in charseg 3 (I think… that’s why it goes into BGMap 3, right?). But I don’t see anything on the screen, apart from the other worlds. I’m doing everything just like KR155E’s introductory demo, but no success. Any ideas?

It’s all those zeros in vbSetWorld. The first three should be the X, parallax, and Y, respectively, at which to display the top-left corner of the “chunk” of BGMap (which, in this case, is 385x225 in size; note, you should pass 383 and 223 to get full-screen). The next three are the X, parallax, and Y, respectively, of the top-left corner of the “chunk” to cut from the BGMap.

Relevant Wiki Page

Also, what’s the best way to make a really long scrolling background as simple as possible? BGMaps are only 512×512 so I’d have to chain them, right?

Use the “SCX” and “SCY” parts of the World attributes (basically: vbSetWorld(28, WRLD_ON | 3 | WRLD_?x?, … replacing the ?’s with the right digits). See the above wiki page and your libgccvb.h header file.

HorvatM wrote:
(I think… that’s why it goes into BGMap 3, right?)

Wrong. There’s no special relation between BGMap 3 and charseg 3. Any BGMap can use any charseg equally.

RunnerPack wrote:
It’s all those zeros in vbSetWorld. The first three should be the X, parallax, and Y, respectively, at which to display the top-left corner of the “chunk” of BGMap (which, in this case, is 385x225 in size; note, you should pass 383 and 223 to get full-screen). The next three are the X, parallax, and Y, respectively, of the top-left corner of the “chunk” to cut from the BGMap.

I wanted to have the world cover the whole screen with the whole BGMap without parallax, so those zeros were justified. 🙂

Relevant Wiki Page

I did read the wiki. But it only gives a very general explanation of everything.

DanB wrote:
Wrong. There’s no special relation between BGMap 3 and charseg 3. Any BGMap can use any charseg equally.

I did figure that out, based on the 11-bit character index of BGMap cells. Apparently my code didn’t work because of VIDE assuming the charset used would be 0, whereas it was 3; when creating the BGMap it asks you what charset you’re going to use, but it has no idea where it will be loaded.

Eventually I got it to work by using charset 0 and BGMap 0 (for simplicity) though, so thanks anyway.

HorvatM wrote:
when creating the BGMap it asks you what charset you’re going to use, but it has no idea where it will be loaded.

If you use my replacement export plugin, it will also ask you what charseg you plan to load it into.

Of course, if you tell VIDE the BGMap should use chars from charseg 3, then it’s up to you to actually memcopy those chars into charseg 3 before displaying the map…

Glad you got it to work, though :thumpup:

 

Write a reply

You must be logged in to reply to this topic.