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

14
gfx.cpp
View File

@ -604,6 +604,7 @@ static void SetupOBJ (void)
int Height;
uint8 S;
int sprite_limit = (Settings.MaxSpriteTilesPerLine == 128) ? 128 : 32;
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].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;
}
@ -653,7 +654,7 @@ static void SetupOBJ (void)
if (Y >= SNES_HEIGHT_EXTENDED)
continue;
if (LineOBJ[Y] >= 32)
if (LineOBJ[Y] >= sprite_limit)
{
GFX.OBJLines[Y].RTOFlags |= 0x40;
continue;
@ -757,7 +758,7 @@ static void SetupOBJ (void)
{
if (OBJOnLine[Y][S])
{
if (j >= 32)
if (j >= sprite_limit)
{
GFX.OBJLines[Y].RTOFlags |= 0x40;
break;
@ -774,7 +775,7 @@ static void SetupOBJ (void)
} while (S != FirstSprite);
}
if (j < 32)
if (j < sprite_limit)
GFX.OBJLines[Y].OBJ[j].Sprite = -1;
}
}
@ -794,13 +795,14 @@ static void DrawOBJS (int D)
int PixWidth = IPPU.DoubleWidthPixels ? 2 : 1;
BG.InterlaceLine = GFX.InterlaceFrame ? 8 : 0;
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)
{
int I = 0;
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];
if (tiles <= 0)

2
gfx.h
View File

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