Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Map Engine to work with BG2 #173

Open
mbh21 opened this issue Feb 8, 2023 · 3 comments
Open

Add support for Map Engine to work with BG2 #173

mbh21 opened this issue Feb 8, 2023 · 3 comments

Comments

@mbh21
Copy link

mbh21 commented Feb 8, 2023

Current problem:

Currently, the map engine works only with BG1. This causes issues when trying to use BG2 for a HUD because of the following layered order:

BG1 - Priority 1
BG2 - Priority 1
BG1 - Priority 0
BG2 - Priority 0

The problem is that if the HUD is on BG2, then any tiles on BG1 with high priority set, get shown over top of the HUD.

Therefore, a basic RPG-style game cannot currently be created with the following features:

  1. Using map engine with both tiles that can be walked on (priority 0) and tiles you can go behind (priority 1)
  2. A static HUD layer with 16 colors per tile and also include dialog background graphics
  3. Text to be displayed over top of the dialog background graphic

The only current way around this and still use the map engine is to use BG3 in high priority for both the HUD and text, but then you are restricted to 3 colors per tile. Which in my case will not be ideal.

Secondary Problem

Currently, if we try to set the map engine to use BG2 it works visually, but the map scrolling ends up still scrolling BG1 instead of BG2 so the wrong background gets scrolled when the player moves.

Solution:

Provide the option to allow the map engine to work on BG2. It would be good to have a flag specified to allow either the choosing of BG1 or BG2. Not sure if this would be better to be specified in Tiled or in .c code.

@jeffythedragonslayer
Copy link
Contributor

How did you try to set the map engine to use BG2?

@mbh21
Copy link
Author

mbh21 commented Feb 16, 2023

How did you try to set the map engine to use BG2?

I switched the first parameter in each of the following lines:

bgInitTileSet(0, &tileset, &tilepal, 0, (&tilesetend - &tileset), 16 * 2, BG_16COLORS, 0x2000);
bgSetMapPtr(0, 0x6800, SC_64x32);

bgInitTileSet(1, &hud_tiles, &hud_pal, 4, (&hud_tiles_end - &hud_tiles), 16 * 4, BG_16COLORS, 0x3000);
bgSetMapPtr(1,0x7000, SC_32x32);

to:

bgInitTileSet(1, &tileset, &tilepal, 0, (&tilesetend - &tileset), 16 * 2, BG_16COLORS, 0x2000);
bgSetMapPtr(1, 0x6800, SC_64x32);

bgInitTileSet(0, &hud_tiles, &hud_pal, 4, (&hud_tiles_end - &hud_tiles), 16 * 4, BG_16COLORS, 0x3000);
bgSetMapPtr(0,0x7000, SC_32x32);

Changing the code does position them correctly so they look correct. However, when the player moves, it is the HUD layer that scrolls (BG1) instead of the map layer (BG2).

@alekmaul
Copy link
Owner

normal, it is hard coded, I need to change the map engine code to manage BG1 or BG2.
You will have to wait, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants