add unlimited sprites (range)

This commit is contained in:
tryal-star 2019-11-13 03:25:56 +00:00
parent 20f6dab047
commit c064706aad
2 changed files with 9 additions and 7 deletions

12
gfx.cpp
View File

@ -604,6 +604,7 @@ static void SetupOBJ (void)
int Height; int Height;
uint8 S; uint8 S;
int sprite_limit = (Settings.MaxSpriteTilesPerLine == 128) ? 128 : 32;
if (!PPU.OAMPriorityRotation || !(PPU.OAMFlip & PPU.OAMAddr & 1)) // normal case if (!PPU.OAMPriorityRotation || !(PPU.OAMFlip & PPU.OAMAddr & 1)) // normal case
{ {
@ -614,7 +615,7 @@ static void SetupOBJ (void)
{ {
GFX.OBJLines[i].RTOFlags = 0; GFX.OBJLines[i].RTOFlags = 0;
GFX.OBJLines[i].Tiles = Settings.MaxSpriteTilesPerLine; GFX.OBJLines[i].Tiles = Settings.MaxSpriteTilesPerLine;
for (int j = 0; j < 32; j++) for (int j = 0; j < sprite_limit; j++)
GFX.OBJLines[i].OBJ[j].Sprite = -1; GFX.OBJLines[i].OBJ[j].Sprite = -1;
} }
@ -653,7 +654,7 @@ static void SetupOBJ (void)
if (Y >= SNES_HEIGHT_EXTENDED) if (Y >= SNES_HEIGHT_EXTENDED)
continue; continue;
if (LineOBJ[Y] >= 32) if (LineOBJ[Y] >= sprite_limit)
{ {
GFX.OBJLines[Y].RTOFlags |= 0x40; GFX.OBJLines[Y].RTOFlags |= 0x40;
continue; continue;
@ -757,7 +758,7 @@ static void SetupOBJ (void)
{ {
if (OBJOnLine[Y][S]) if (OBJOnLine[Y][S])
{ {
if (j >= 32) if (j >= sprite_limit)
{ {
GFX.OBJLines[Y].RTOFlags |= 0x40; GFX.OBJLines[Y].RTOFlags |= 0x40;
break; break;
@ -774,7 +775,7 @@ static void SetupOBJ (void)
} while (S != FirstSprite); } while (S != FirstSprite);
} }
if (j < 32) if (j < sprite_limit)
GFX.OBJLines[Y].OBJ[j].Sprite = -1; GFX.OBJLines[Y].OBJ[j].Sprite = -1;
} }
} }
@ -794,13 +795,14 @@ static void DrawOBJS (int D)
int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1; int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1;
BG.InterlaceLine = GFX.InterlaceFrame ? 8 : 0; BG.InterlaceLine = GFX.InterlaceFrame ? 8 : 0;
GFX.Z1 = 2; GFX.Z1 = 2;
int sprite_limit = (Settings.MaxSpriteTilesPerLine == 128) ? 128 : 32;
for (uint32 Y = GFX.StartY, Offset = Y * GFX.PPL; Y <= GFX.EndY; Y++, Offset += GFX.PPL) for (uint32 Y = GFX.StartY, Offset = Y * GFX.PPL; Y <= GFX.EndY; Y++, Offset += GFX.PPL)
{ {
int I = 0; int I = 0;
int tiles = GFX.OBJLines[Y].Tiles; int tiles = GFX.OBJLines[Y].Tiles;
for (int S = GFX.OBJLines[Y].OBJ[I].Sprite; S >= 0 && I < 32; S = GFX.OBJLines[Y].OBJ[++I].Sprite) for (int S = GFX.OBJLines[Y].OBJ[I].Sprite; S >= 0 && I < sprite_limit; S = GFX.OBJLines[Y].OBJ[++I].Sprite)
{ {
tiles += GFX.OBJVisibleTiles[S]; tiles += GFX.OBJVisibleTiles[S];
if (tiles <= 0) if (tiles <= 0)

2
gfx.h
View File

@ -47,7 +47,7 @@ struct SGFX
{ {
int8 Sprite; int8 Sprite;
uint8 Line; uint8 Line;
} OBJ[32]; } OBJ[128];
} OBJLines[SNES_HEIGHT_EXTENDED]; } OBJLines[SNES_HEIGHT_EXTENDED];
void (*DrawBackdropMath) (uint32, uint32, uint32); void (*DrawBackdropMath) (uint32, uint32, uint32);