Move SE40 floor/ceilingstat and Z coordinate backups to global variables instead of allocating them on the stack.

git-svn-id: https://svn.eduke32.com/eduke32@6998 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-07 05:20:00 +00:00
parent 7eb3436bad
commit 2cb5d948e8

View file

@ -438,6 +438,9 @@ static void G_OROR_DupeSprites(const spritetype *sp)
}
}
static int16_t SE40backupStat[MAXSECTORS];
static int32_t SE40backupZ[MAXSECTORS];
static void G_SE40(int32_t smoothratio)
{
if ((unsigned)ror_sprite < MAXSPRITES)
@ -465,8 +468,6 @@ static void G_SE40(int32_t smoothratio)
{
int32_t renderz, picnum;
// XXX: PK: too large stack allocation for my taste
int16_t backupstat[MAXSECTORS];
int32_t backupz[MAXSECTORS];
int32_t i;
int32_t pix_diff, newz;
// initprintf("drawing ror\n");
@ -484,8 +485,8 @@ static void G_SE40(int32_t smoothratio)
for (i = 0; i < numsectors; i++)
{
backupstat[i] = sector[i].ceilingstat;
backupz[i] = sector[i].ceilingz;
SE40backupStat[i] = sector[i].ceilingstat;
SE40backupZ[i] = sector[i].ceilingz;
if (!ror_protectedsectors[i] || (ror_protectedsectors[i] && sp->lotag == 41))
{
sector[i].ceilingstat = 1;
@ -506,8 +507,8 @@ static void G_SE40(int32_t smoothratio)
for (i = 0; i < numsectors; i++)
{
backupstat[i] = sector[i].floorstat;
backupz[i] = sector[i].floorz;
SE40backupStat[i] = sector[i].floorstat;
SE40backupZ[i] = sector[i].floorz;
if (!ror_protectedsectors[i] || (ror_protectedsectors[i] && sp->lotag == 41))
{
sector[i].floorstat = 1;
@ -535,8 +536,8 @@ static void G_SE40(int32_t smoothratio)
sector[sprite[sprite2].sectnum].ceilingpicnum = picnum;
for (i = 0; i < numsectors; i++)
{
sector[i].ceilingstat = backupstat[i];
sector[i].ceilingz = backupz[i];
sector[i].ceilingstat = SE40backupStat[i];
sector[i].ceilingz = SE40backupZ[i];
}
}
else
@ -545,8 +546,8 @@ static void G_SE40(int32_t smoothratio)
for (i = 0; i < numsectors; i++)
{
sector[i].floorstat = backupstat[i];
sector[i].floorz = backupz[i];
sector[i].floorstat = SE40backupStat[i];
sector[i].floorz = SE40backupZ[i];
}
}
}