Double the size of clouds[] (holding sectors with CLOUDYSKIES ceilings).

Also, make cloudx[] and cloudy[] scalars, as the per-sector values were always
identical. In prelevel(), warn if some CLOUDYSKIES-ceiling sectors could not
be set up due to reaching the new 256 sector limit.

git-svn-id: https://svn.eduke32.com/eduke32@5156 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-04-18 21:59:18 +00:00
parent cf7de5b43a
commit 474efef336
7 changed files with 27 additions and 17 deletions

View file

@ -55,10 +55,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
#ifdef LUNATIC
// Lunatic
# define BYTEVERSION_JF 300
# define BYTEVERSION_JF 303
#else
// Non-Lua build
# define BYTEVERSION_JF 300
# define BYTEVERSION_JF 303
#endif
//#define BYTEVERSION_13 27

View file

@ -3020,13 +3020,13 @@ static inline void G_MoveClouds(void)
cloudtotalclock = totalclock+6;
cloudx += sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9;
cloudy += sintable[g_player[screenpeek].ps->ang&2047]>>9;
for (i=g_numClouds-1; i>=0; i--)
{
cloudx[i] += (sintable[(g_player[screenpeek].ps->ang+512)&2047]>>9);
cloudy[i] += (sintable[g_player[screenpeek].ps->ang&2047]>>9);
sector[clouds[i]].ceilingxpanning = cloudx[i]>>6;
sector[clouds[i]].ceilingypanning = cloudy[i]>>6;
sector[clouds[i]].ceilingxpanning = cloudx>>6;
sector[clouds[i]].ceilingypanning = cloudy>>6;
}
}

View file

@ -5643,8 +5643,8 @@ void G_SaveMapState(void)
Bmemcpy(&save->show2dsector[0],&show2dsector[0],sizeof(show2dsector));
Bmemcpy(&save->g_numClouds,&g_numClouds,sizeof(g_numClouds));
Bmemcpy(&save->clouds[0],&clouds[0],sizeof(clouds));
Bmemcpy(&save->cloudx[0],&cloudx[0],sizeof(cloudx));
Bmemcpy(&save->cloudy[0],&cloudy[0],sizeof(cloudy));
Bmemcpy(&save->cloudx,&cloudx,sizeof(cloudx));
Bmemcpy(&save->cloudy,&cloudy,sizeof(cloudy));
Bmemcpy(&save->pskyidx,&g_pskyidx,sizeof(g_pskyidx));
Bmemcpy(&save->animategoal[0],&animategoal[0],sizeof(animategoal));
Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel));
@ -5767,8 +5767,8 @@ void G_RestoreMapState(void)
Bmemcpy(&show2dsector[0],&save->show2dsector[0],sizeof(show2dsector));
Bmemcpy(&g_numClouds,&save->g_numClouds,sizeof(g_numClouds));
Bmemcpy(&clouds[0],&save->clouds[0],sizeof(clouds));
Bmemcpy(&cloudx[0],&save->cloudx[0],sizeof(cloudx));
Bmemcpy(&cloudy[0],&save->cloudy[0],sizeof(cloudy));
Bmemcpy(&cloudx,&save->cloudx,sizeof(cloudx));
Bmemcpy(&cloudy,&save->cloudy,sizeof(cloudy));
Bmemcpy(&g_pskyidx,&save->pskyidx,sizeof(g_pskyidx));
Bmemcpy(&animategoal[0],&save->animategoal[0],sizeof(animategoal));
Bmemcpy(&animatevel[0],&save->animatevel[0],sizeof(animatevel));

View file

@ -83,7 +83,7 @@ G_EXTERN int16_t cyclers[MAXCYCLERS][6],g_numCyclers;
G_EXTERN int16_t g_globalRandom;
G_EXTERN int16_t g_mirrorWall[64],g_mirrorSector[64],g_mirrorCount;
G_EXTERN int16_t g_numAnimWalls;
G_EXTERN int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
G_EXTERN int16_t g_numClouds,clouds[256],cloudx,cloudy;
G_EXTERN int16_t myang,omyang,mycursectnum,myjumpingcounter;
G_EXTERN int16_t myhoriz,omyhoriz,myhorizoff,omyhorizoff;
G_EXTERN int32_t *animateptr[MAXANIMATES];

View file

@ -1043,6 +1043,8 @@ static void prelevel(char g)
VM_OnEvent(EVENT_PRELEVEL, -1, -1);
int missedCloudSectors = 0;
for (i=0; i<numsectors; i++)
{
sector[i].extra = 256;
@ -1065,8 +1067,13 @@ static void prelevel(char g)
tloadtile(sector[i].ceilingpicnum+j, 0);
}
if (sector[i].ceilingpicnum == CLOUDYSKIES && g_numClouds < 127)
if (sector[i].ceilingpicnum == CLOUDYSKIES)
{
if (g_numClouds < ARRAY_SSIZE(clouds))
clouds[g_numClouds++] = i;
else
missedCloudSectors++;
}
if (g_player[0].ps->one_parallax_sectnum == -1)
g_player[0].ps->one_parallax_sectnum = i;
@ -1086,6 +1093,9 @@ static void prelevel(char g)
}
}
if (missedCloudSectors > 0)
OSD_Printf(OSDTEXT_RED "Map warning: have %d unhandled CLOUDYSKIES ceilings.\n", missedCloudSectors);
// NOTE: must be safe loop because callbacks could delete sprites.
for (SPRITES_OF_STAT_SAFE(STAT_DEFAULT, i, nexti))
{

View file

@ -1128,8 +1128,8 @@ static const dataspec_t svgm_anmisc[] =
{ 0, &show2dsector[0], sizeof(uint8_t), MAXSECTORS>>3 },
{ DS_NOCHK, &g_numClouds, sizeof(g_numClouds), 1 },
{ 0, &clouds[0], sizeof(clouds), 1 },
{ 0, &cloudx[0], sizeof(cloudx), 1 },
{ 0, &cloudy[0], sizeof(cloudy), 1 },
{ 0, &cloudx, sizeof(cloudx), 1 },
{ 0, &cloudy, sizeof(cloudy), 1 },
{ 0, &g_pskyidx, sizeof(g_pskyidx), 1 }, // DS_NOCHK?
{ 0, &g_earthquakeTime, sizeof(g_earthquakeTime), 1 },

View file

@ -57,7 +57,7 @@ typedef struct {
int16_t cyclers[MAXCYCLERS][6];
int16_t g_mirrorWall[64], g_mirrorSector[64], g_mirrorCount;
int16_t g_numAnimWalls;
int16_t g_numClouds,clouds[128],cloudx[128],cloudy[128];
int16_t g_numClouds,clouds[256],cloudx,cloudy;
int16_t g_numCyclers;
int32_t numsprites;