mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
Allow scripts to change MAXSPRITESONSCREEN before calls to drawrooms() and friends
git-svn-id: https://svn.eduke32.com/eduke32@6347 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4c981137be
commit
3706ac1b43
10 changed files with 27 additions and 18 deletions
|
@ -675,7 +675,7 @@ EXTERN uint8_t paletteloaded;
|
|||
EXTERN char *blendtable[MAXBLENDTABS];
|
||||
EXTERN uint8_t whitecol, redcol;
|
||||
|
||||
int32_t maxspritesonscreen;
|
||||
EXTERN int32_t maxspritesonscreen;
|
||||
|
||||
enum {
|
||||
PALETTE_MAIN = 1<<0,
|
||||
|
|
|
@ -838,7 +838,7 @@ static void yax_copytsprites()
|
|||
}
|
||||
}
|
||||
|
||||
if (spritesortcnt >= MAXSPRITESONSCREEN)
|
||||
if (spritesortcnt >= maxspritesonscreen)
|
||||
break;
|
||||
|
||||
Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype));
|
||||
|
@ -1492,7 +1492,7 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum)
|
|||
if (numyaxbunches==0)
|
||||
{
|
||||
#endif
|
||||
if (spritesortcnt >= MAXSPRITESONSCREEN)
|
||||
if (spritesortcnt >= maxspritesonscreen)
|
||||
return 1;
|
||||
|
||||
Bmemcpy(&tsprite[spritesortcnt], spr, sizeof(spritetype));
|
||||
|
@ -1507,7 +1507,7 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum)
|
|||
{
|
||||
int16_t *sortcnt = &yax_spritesortcnt[yax_globallev];
|
||||
|
||||
if (*sortcnt >= MAXSPRITESONSCREEN)
|
||||
if (*sortcnt >= maxspritesonscreen)
|
||||
return 1;
|
||||
|
||||
yax_tsprite[yax_globallev][*sortcnt] = z;
|
||||
|
@ -1535,7 +1535,7 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum)
|
|||
if (cb>=0 && spr->z+spzofs-spheight < sector[sectnum].ceilingz)
|
||||
{
|
||||
sortcnt = &yax_spritesortcnt[yax_globallev-1];
|
||||
if (*sortcnt < MAXSPRITESONSCREEN)
|
||||
if (*sortcnt < maxspritesonscreen)
|
||||
{
|
||||
yax_tsprite[yax_globallev-1][*sortcnt] = z|MAXSPRITES;
|
||||
(*sortcnt)++;
|
||||
|
@ -1544,7 +1544,7 @@ int32_t engine_addtsprite(int16_t z, int16_t sectnum)
|
|||
if (fb>=0 && spr->z+spzofs > sector[sectnum].floorz)
|
||||
{
|
||||
sortcnt = &yax_spritesortcnt[yax_globallev+1];
|
||||
if (*sortcnt < MAXSPRITESONSCREEN)
|
||||
if (*sortcnt < maxspritesonscreen)
|
||||
{
|
||||
yax_tsprite[yax_globallev+1][*sortcnt] = z|(MAXSPRITES<<1);
|
||||
(*sortcnt)++;
|
||||
|
@ -7732,6 +7732,8 @@ int32_t initengine(void)
|
|||
g_visibility = 512;
|
||||
parallaxvisibility = 512;
|
||||
|
||||
maxspritesonscreen = MAXSPRITESONSCREEN;
|
||||
|
||||
loadpalette();
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
|
|
|
@ -3827,7 +3827,7 @@ static inline void polymer_scansprites(int16_t sectnum, uspritetype* localtspri
|
|||
spr = &sprite[i];
|
||||
if ((((spr->cstat&0x8000) == 0) || (showinvisibility)) &&
|
||||
(spr->xrepeat > 0) && (spr->yrepeat > 0) &&
|
||||
(*localspritesortcnt < MAXSPRITESONSCREEN))
|
||||
(*localspritesortcnt < maxspritesonscreen))
|
||||
{
|
||||
// this function's localtsprite is either the tsprite global or
|
||||
// polymer_drawroom's locattsprite, so no aliasing
|
||||
|
@ -4358,7 +4358,7 @@ static void polymer_drawmdsprite(uspritetype *tspr)
|
|||
polymer_loadmodelvbos(m);
|
||||
|
||||
// Hackish, but that means it's a model drawn by rotatesprite.
|
||||
if (tspriteptr[MAXSPRITESONSCREEN] == tspr) {
|
||||
if (tspriteptr[maxspritesonscreen] == tspr) {
|
||||
float x, y, z;
|
||||
|
||||
spos[0] = fglobalposy;
|
||||
|
@ -4397,7 +4397,7 @@ static void polymer_drawmdsprite(uspritetype *tspr)
|
|||
scale *= m->bscale;
|
||||
}
|
||||
|
||||
if (tspriteptr[MAXSPRITESONSCREEN] == tspr) {
|
||||
if (tspriteptr[maxspritesonscreen] == tspr) {
|
||||
float playerang, radplayerang, cosminusradplayerang, sinminusradplayerang, hudzoom;
|
||||
|
||||
playerang = (globalang & 2047) * (360.f/2048.f) - 90.0f;
|
||||
|
|
|
@ -2455,7 +2455,7 @@ void polymost_editorfunc(void)
|
|||
|
||||
if (preview_mouseaim)
|
||||
{
|
||||
if (spritesortcnt == MAXSPRITESONSCREEN)
|
||||
if (spritesortcnt == maxspritesonscreen)
|
||||
spritesortcnt--;
|
||||
|
||||
uspritetype *tsp = &tsprite[spritesortcnt];
|
||||
|
@ -5134,7 +5134,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
|
|||
{
|
||||
int32_t fov;
|
||||
|
||||
tspriteptr[MAXSPRITESONSCREEN] = &tspr;
|
||||
tspriteptr[maxspritesonscreen] = &tspr;
|
||||
|
||||
bglEnable(GL_ALPHA_TEST);
|
||||
bglEnable(GL_BLEND);
|
||||
|
@ -5152,7 +5152,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
|
|||
|
||||
polymer_setaspect(fov);
|
||||
|
||||
polymer_drawsprite(MAXSPRITESONSCREEN);
|
||||
polymer_drawsprite(maxspritesonscreen);
|
||||
|
||||
polymer_setaspect(pr_fov);
|
||||
|
||||
|
|
|
@ -417,7 +417,7 @@ static void G_OROR_DupeSprites(const spritetype *sp)
|
|||
|
||||
for (SPRITES_OF_SECT(sp->sectnum, k))
|
||||
{
|
||||
if (spritesortcnt >= MAXSPRITESONSCREEN)
|
||||
if (spritesortcnt >= maxspritesonscreen)
|
||||
break;
|
||||
|
||||
if (sprite[k].picnum != SECTOREFFECTOR && sprite[k].z >= sp->z)
|
||||
|
@ -3800,7 +3800,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
{
|
||||
// this exposes a sprite sorting issue which needs to be debugged further...
|
||||
#if 0
|
||||
if (spritesortcnt < MAXSPRITESONSCREEN)
|
||||
if (spritesortcnt < maxspritesonscreen)
|
||||
{
|
||||
spritetype *const newt = &tsprite[spritesortcnt++];
|
||||
|
||||
|
@ -3903,7 +3903,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
if ((g_netServer || ud.multimode > 1) && (display_mirror || screenpeek != playerNum || pSprite->owner == -1))
|
||||
{
|
||||
if (ud.showweapons && sprite[g_player[playerNum].ps->i].extra > 0 && g_player[playerNum].ps->curr_weapon > 0
|
||||
&& spritesortcnt < MAXSPRITESONSCREEN)
|
||||
&& spritesortcnt < maxspritesonscreen)
|
||||
{
|
||||
uspritetype *const newTspr = &tsprite[spritesortcnt];
|
||||
int const currentWeapon = g_player[playerNum].ps->curr_weapon;
|
||||
|
@ -3920,7 +3920,7 @@ void G_DoSpriteAnimations(int32_t ourx, int32_t oury, int32_t oura, int32_t smoo
|
|||
spritesortcnt++;
|
||||
}
|
||||
|
||||
if (g_player[playerNum].inputBits->extbits & (1 << 7) && !ud.pause_on && spritesortcnt < MAXSPRITESONSCREEN)
|
||||
if (g_player[playerNum].inputBits->extbits & (1 << 7) && !ud.pause_on && spritesortcnt < maxspritesonscreen)
|
||||
{
|
||||
uspritetype *const playerTyping = t;
|
||||
|
||||
|
@ -4191,7 +4191,7 @@ skip:
|
|||
if (actor[i].flags & SFLAG_NOFLOORSHADOW)
|
||||
continue;
|
||||
|
||||
if (ud.shadows && spritesortcnt < (MAXSPRITESONSCREEN-2) && getrendermode() != REND_POLYMER)
|
||||
if (ud.shadows && spritesortcnt < (maxspritesonscreen-2) && getrendermode() != REND_POLYMER)
|
||||
{
|
||||
int const shadowZ = ((sector[sect].lotag & 0xff) > 2 || pSprite->statnum == STAT_PROJECTILE ||
|
||||
pSprite->statnum == STAT_MISC || pSprite->picnum == DRONE || pSprite->picnum == COMMANDER)
|
||||
|
|
|
@ -1198,6 +1198,7 @@ const memberlabel_t UserdefsLabels[]=
|
|||
{ "gametext_tracking", USERDEFS_GAMETEXT_TRACKING, 0, 0 },
|
||||
{ "mgametext_tracking", USERDEFS_MGAMETEXT_TRACKING, 0, 0 },
|
||||
{ "menutext_tracking", USERDEFS_MENUTEXT_TRACKING, 0, 0 },
|
||||
{ "maxspritesonscreen", USERDEFS_MAXSPRITESONSCREEN, 0, 0 },
|
||||
{ "", -1, 0, 0 } // END OF LIST
|
||||
};
|
||||
|
||||
|
@ -6244,6 +6245,8 @@ static void C_AddDefaultDefinitions(void)
|
|||
C_AddDefinition("PROJ_YREPEAT", PROJ_YREPEAT, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("GAMEARRAY_RESTORE", GAMEARRAY_RESTORE, LABEL_DEFINE);
|
||||
|
||||
C_AddDefinition("MAXSPRITESONSCREEN", MAXSPRITESONSCREEN, LABEL_DEFINE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -523,6 +523,7 @@ enum UserdefsLabel_t
|
|||
USERDEFS_GAMETEXT_TRACKING,
|
||||
USERDEFS_MGAMETEXT_TRACKING,
|
||||
USERDEFS_MENUTEXT_TRACKING,
|
||||
USERDEFS_MAXSPRITESONSCREEN,
|
||||
USERDEFS_END
|
||||
};
|
||||
|
||||
|
|
|
@ -172,6 +172,7 @@ int32_t __fastcall VM_GetUserdef(int32_t labelNum)
|
|||
case USERDEFS_GAMETEXT_TRACKING: labelNum = MF_BluefontGame.between.x; break;
|
||||
case USERDEFS_MGAMETEXT_TRACKING: labelNum = MF_Bluefont.between.x; break;
|
||||
case USERDEFS_MENUTEXT_TRACKING: labelNum = MF_Redfont.between.x; break;
|
||||
case USERDEFS_MAXSPRITESONSCREEN: labelNum = maxspritesonscreen; break;
|
||||
default: labelNum = -1; break;
|
||||
}
|
||||
|
||||
|
@ -294,6 +295,7 @@ void __fastcall VM_SetUserdef(int32_t const labelNum, int32_t const iSet)
|
|||
case USERDEFS_GAMETEXT_TRACKING: MF_BluefontGame.between.x = iSet; break;
|
||||
case USERDEFS_MGAMETEXT_TRACKING: MF_BluefontRed.between.x = MF_Bluefont.between.x = iSet; break;
|
||||
case USERDEFS_MENUTEXT_TRACKING: MF_Redfont.between.x = iSet; break;
|
||||
case USERDEFS_MAXSPRITESONSCREEN: maxspritesonscreen = clamp(iSet, MAXSPRITESONSCREEN>>2, MAXSPRITESONSCREEN); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1539,6 +1539,7 @@ static void Gv_AddSystemVars(void)
|
|||
Gv_NewVar("Numsprites",(intptr_t)&Numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
|
||||
|
||||
Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR);
|
||||
|
||||
# ifdef USE_OPENGL
|
||||
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
|
||||
# else
|
||||
|
|
|
@ -1725,7 +1725,7 @@ badindex:
|
|||
M32_ERROR("Tried to duplicate nonexistent sprite %d", ospritenum);
|
||||
}
|
||||
if ((tw==CON_DUPSPRITE && Numsprites >= MAXSPRITES) ||
|
||||
(tw==CON_DUPSPRITE && spritesortcnt >= MAXSPRITESONSCREEN))
|
||||
(tw==CON_DUPSPRITE && spritesortcnt >= maxspritesonscreen))
|
||||
{
|
||||
M32_ERROR("Maximum number of sprites reached.");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue