pvsneslib icon indicating copy to clipboard operation
pvsneslib copied to clipboard

Add support for Map Engine to work with BG2

Open mbh21 opened this issue 2 years ago • 3 comments

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.

mbh21 avatar Feb 08 '23 05:02 mbh21

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

jeffythedragonslayer avatar Feb 09 '23 07:02 jeffythedragonslayer

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

mbh21 avatar Feb 16 '23 16:02 mbh21

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

alekmaul avatar Feb 16 '23 16:02 alekmaul