mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Clean up parallaxed sky functionality, part 1.
- Consolidate psky* arrays into a "typedef struct psky_t" "g_psky" and "multipsky[]". - Factor out getting parallaxed sky properties into getpsky(). - Condense initial multi-psky setup by memcpy'ing from multipsky[]. - New function: MultiPsky_TileToIdx(). - Add new define PSKYOFF_MAX and related consistency-checking assertions. - Lower MAXPSKYTILES to 8 to reflect current usage (was 256). - Game: make multi-pskies consider dynamically-remapped MOONSKY1, BIGORBIT1 and LA. (Not very useful as the editor will still only act for the static values -- 80, 84 and 89, respectively.) An attempt has been made to preserve behavior even in strange cases, so this commit is unlikely to introduce regressions. Because of point 6, BYTEVERSION had to be bumped. git-svn-id: https://svn.eduke32.com/eduke32@3975 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
97dce0fe63
commit
46e8549b5e
15 changed files with 195 additions and 196 deletions
|
@ -77,8 +77,10 @@ enum rendmode_t {
|
||||||
#define MAXPLAYERS 16
|
#define MAXPLAYERS 16
|
||||||
#define MAXBASEPALS 8
|
#define MAXBASEPALS 8
|
||||||
#define MAXPALOOKUPS 256
|
#define MAXPALOOKUPS 256
|
||||||
|
// Maximum number of defined multi-pskies:
|
||||||
#define MAXPSKYMULTIS 8
|
#define MAXPSKYMULTIS 8
|
||||||
#define MAXPSKYTILES 256
|
// Maximum number of component tiles in a multi-psky:
|
||||||
|
#define MAXPSKYTILES 8
|
||||||
#define MAXSPRITESONSCREEN 4096
|
#define MAXSPRITESONSCREEN 4096
|
||||||
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
#define MAXUNIQHUDID 256 //Extra slots so HUD models can store animation state without messing game sprites
|
||||||
|
|
||||||
|
@ -740,21 +742,39 @@ EXTERN uint8_t palette[768];
|
||||||
EXTERN int16_t numshades;
|
EXTERN int16_t numshades;
|
||||||
EXTERN char *palookup[MAXPALOOKUPS];
|
EXTERN char *palookup[MAXPALOOKUPS];
|
||||||
EXTERN uint8_t **basepaltableptr;
|
EXTERN uint8_t **basepaltableptr;
|
||||||
EXTERN char parallaxtype, showinvisibility;
|
EXTERN char showinvisibility;
|
||||||
EXTERN int32_t parallaxyoffs, parallaxyscale;
|
|
||||||
EXTERN int32_t g_visibility, parallaxvisibility;
|
EXTERN int32_t g_visibility, parallaxvisibility;
|
||||||
EXTERN int32_t g_rotatespriteNoWidescreen;
|
EXTERN int32_t g_rotatespriteNoWidescreen;
|
||||||
|
|
||||||
EXTERN int32_t windowx1, windowy1, windowx2, windowy2;
|
EXTERN int32_t windowx1, windowy1, windowx2, windowy2;
|
||||||
EXTERN int16_t startumost[MAXXDIM], startdmost[MAXXDIM];
|
EXTERN int16_t startumost[MAXXDIM], startdmost[MAXXDIM];
|
||||||
|
|
||||||
// original multi-psky handling (only one per map)
|
// The maximum tile offset ever used in any tiled parallaxed multi-sky.
|
||||||
EXTERN int16_t pskyoff[MAXPSKYTILES], pskybits;
|
#define PSKYOFF_MAX 4
|
||||||
// new multi-psky -- up to MAXPSKYMULTIS
|
|
||||||
EXTERN int16_t pskynummultis;
|
typedef struct {
|
||||||
EXTERN int32_t pskymultiyscale[MAXPSKYMULTIS];
|
// The proportion at which looking up/down affects the apparent 'horiz' of
|
||||||
EXTERN int16_t pskymultilist[MAXPSKYMULTIS], pskymultibits[MAXPSKYMULTIS];
|
// a parallaxed sky, scaled by 65536 (so, a value of 65536 makes it align
|
||||||
EXTERN int16_t pskymultioff[MAXPSKYMULTIS][MAXPSKYTILES];
|
// with the drawn surrounding scene):
|
||||||
|
int32_t horizfrac;
|
||||||
|
|
||||||
|
// The texel index offset in the y direction of a parallaxed sky:
|
||||||
|
// XXX: currently always 0.
|
||||||
|
int32_t yoffs;
|
||||||
|
|
||||||
|
int8_t lognumtiles; // 1<<bits: number of tiles in multi-sky
|
||||||
|
int8_t tileofs[MAXPSKYTILES]; // for 0 <= j < (1<<bits): tile offset relative to basetile
|
||||||
|
} psky_t;
|
||||||
|
|
||||||
|
// Original multi-psky handling, only one per map:
|
||||||
|
EXTERN psky_t g_psky;
|
||||||
|
// New multi-psky -- up to MAXPSKYMULTIS (effectively constant after initialization):
|
||||||
|
EXTERN int32_t pskynummultis;
|
||||||
|
EXTERN psky_t multipsky[MAXPSKYMULTIS];
|
||||||
|
// Mapping of multi-sky index to base sky tile number:
|
||||||
|
EXTERN int32_t multipskytile[MAXPSKYMULTIS];
|
||||||
|
|
||||||
|
EXTERN char parallaxtype;
|
||||||
|
|
||||||
// last sprite in the freelist, that is the spritenum for which
|
// last sprite in the freelist, that is the spritenum for which
|
||||||
// .statnum==MAXSTATUS && nextspritestat[spritenum]==-1
|
// .statnum==MAXSTATUS && nextspritestat[spritenum]==-1
|
||||||
|
|
|
@ -77,6 +77,23 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows);
|
||||||
#define EDUKE32_TMRTIC t[ti++]=getticks()
|
#define EDUKE32_TMRTIC t[ti++]=getticks()
|
||||||
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
|
#define EDUKE32_TMRPRN do { int ii=0; fprintf(stderr,"%s: ",tmrstr); for (ii=1; ii<ti; ii++) fprintf(stderr,"%d ", t[ii]-t[ii-1]); fprintf(stderr,"\n"); } while (0)
|
||||||
|
|
||||||
|
// Get the multi-psky index corresponding to a base tile number of the sky (for
|
||||||
|
// the game: the *static* value!), or -1 if it's not a multi-psky base tile.
|
||||||
|
static inline int32_t MultiPsky_TileToIdx(int32_t tilenum)
|
||||||
|
{
|
||||||
|
switch (tilenum)
|
||||||
|
{
|
||||||
|
case 80: // MOONSKY1__STATIC:
|
||||||
|
return 0;
|
||||||
|
case 84: // BIGORBIT1__STATIC:
|
||||||
|
return 1;
|
||||||
|
case 89: // LA__STATIC:
|
||||||
|
return 2;
|
||||||
|
default:
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef EXTERNC
|
#ifdef EXTERNC
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4439,10 +4439,8 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
|
||||||
int32_t j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak;
|
int32_t j, k, l, m, n, x, z, wallnum, nextsectnum, globalhorizbak;
|
||||||
int16_t *topptr, *botptr;
|
int16_t *topptr, *botptr;
|
||||||
|
|
||||||
int32_t dapyscale;
|
int32_t dapyscale, dapskybits;
|
||||||
int16_t dapskybits;
|
const int8_t *dapskyoff;
|
||||||
static const int16_t zeropskyoff[MAXPSKYTILES] = { 0 };
|
|
||||||
const int16_t *dapskyoff;
|
|
||||||
|
|
||||||
int32_t logtilesizy, tsizy;
|
int32_t logtilesizy, tsizy;
|
||||||
|
|
||||||
|
@ -4499,32 +4497,19 @@ static void parascan(int32_t dax1, int32_t dax2, int32_t sectnum, char dastat, i
|
||||||
globaltilesizy = tsizy;
|
globaltilesizy = tsizy;
|
||||||
globalyscale = 65536 / tsizy;
|
globalyscale = 65536 / tsizy;
|
||||||
globalshiftval = 0;
|
globalshiftval = 0;
|
||||||
globalzd = divscale32(((tsizy>>1)+parallaxyoffs), tsizy) + ((uint32_t)globalypanning<<24);
|
globalzd = divscale32(((tsizy>>1)+g_psky.yoffs), tsizy) + ((uint32_t)globalypanning<<24);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
globalshiftval = 32-globalshiftval;
|
globalshiftval = 32-globalshiftval;
|
||||||
globalyscale = (8<<(globalshiftval-19));
|
globalyscale = (8<<(globalshiftval-19));
|
||||||
globalzd = (((tsizy>>1)+parallaxyoffs)<<globalshiftval) + ((uint32_t)globalypanning<<24);
|
globalzd = (((tsizy>>1)+g_psky.yoffs)<<globalshiftval) + ((uint32_t)globalypanning<<24);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd;
|
//if (globalorientation&256) globalyscale = -globalyscale, globalzd = -globalzd;
|
||||||
|
|
||||||
dapskyoff = zeropskyoff;
|
dapskyoff = getpsky(&dapyscale, &dapskybits);
|
||||||
dapskybits = pskybits;
|
|
||||||
dapyscale = parallaxyscale;
|
|
||||||
|
|
||||||
for (j=0; j<pskynummultis; j++)
|
|
||||||
{
|
|
||||||
if (globalpicnum == pskymultilist[j])
|
|
||||||
{
|
|
||||||
dapskybits = pskymultibits[j];
|
|
||||||
dapskyoff = pskymultioff[j];
|
|
||||||
dapyscale = pskymultiyscale[j];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dapyscale != 65536)
|
if (dapyscale != 65536)
|
||||||
globalhoriz = mulscale16(globalhoriz-(ydimen>>1),dapyscale) + (ydimen>>1);
|
globalhoriz = mulscale16(globalhoriz-(ydimen>>1),dapyscale) + (ydimen>>1);
|
||||||
|
@ -8646,10 +8631,7 @@ int32_t initengine(void)
|
||||||
|
|
||||||
xyaspect = -1;
|
xyaspect = -1;
|
||||||
|
|
||||||
pskyoff[0] = 0; pskybits = 0;
|
parallaxtype = 2; g_psky.horizfrac = 65536;
|
||||||
pskynummultis = 0;
|
|
||||||
|
|
||||||
parallaxtype = 2; parallaxyoffs = 0L; parallaxyscale = 65536;
|
|
||||||
showinvisibility = 0;
|
showinvisibility = 0;
|
||||||
|
|
||||||
for (i=1; i<1024; i++)
|
for (i=1; i<1024; i++)
|
||||||
|
|
|
@ -212,4 +212,30 @@ static inline void bricolor(palette_t *wpptr, int32_t dacol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get properties of parallaxed sky to draw.
|
||||||
|
// Returns: pointer to tile offset array. Sets-by-pointer the other two.
|
||||||
|
static inline const int8_t *getpsky(int32_t *dapyscale, int32_t *dapskybits)
|
||||||
|
{
|
||||||
|
int32_t j;
|
||||||
|
static const int8_t zeropskyoff[MAXPSKYTILES] = { 0 };
|
||||||
|
|
||||||
|
// First, try a multi-sky.
|
||||||
|
for (j=0; j<pskynummultis; j++)
|
||||||
|
{
|
||||||
|
if (globalpicnum == multipskytile[j])
|
||||||
|
{
|
||||||
|
// Have a match.
|
||||||
|
*dapskybits = multipsky[j].lognumtiles;
|
||||||
|
if (dapyscale)
|
||||||
|
*dapyscale = multipsky[j].horizfrac;
|
||||||
|
return multipsky[j].tileofs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fall back to map-global sky.
|
||||||
|
*dapskybits = g_psky.lognumtiles;
|
||||||
|
if (dapyscale)
|
||||||
|
*dapyscale = g_psky.horizfrac;
|
||||||
|
return zeropskyoff;
|
||||||
|
}
|
||||||
#endif /* ENGINE_PRIV_H */
|
#endif /* ENGINE_PRIV_H */
|
||||||
|
|
|
@ -3874,16 +3874,15 @@ static void polymer_initartsky(void)
|
||||||
static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shade)
|
static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shade)
|
||||||
{
|
{
|
||||||
pthtyp* pth;
|
pthtyp* pth;
|
||||||
GLuint glpics[5];
|
GLuint glpics[PSKYOFF_MAX+1];
|
||||||
GLfloat glcolors[5][3];
|
GLfloat glcolors[PSKYOFF_MAX+1][3];
|
||||||
int32_t i, j;
|
int32_t i, j;
|
||||||
GLfloat height = 2.45f / 2.0f;
|
GLfloat height = 2.45f / 2.0f;
|
||||||
int16_t picnum;
|
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < 5)
|
while (i <= PSKYOFF_MAX)
|
||||||
{
|
{
|
||||||
picnum = tilenum + i;
|
int16_t picnum = tilenum + i;
|
||||||
DO_TILE_ANIM(picnum, 0);
|
DO_TILE_ANIM(picnum, 0);
|
||||||
if (!waloff[picnum])
|
if (!waloff[picnum])
|
||||||
loadtile(picnum);
|
loadtile(picnum);
|
||||||
|
@ -3915,13 +3914,14 @@ static void polymer_drawartsky(int16_t tilenum, char palnum, int8_t shad
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = (1<<pskybits);
|
j = (1<<g_psky.lognumtiles);
|
||||||
while (i < j)
|
while (i < j)
|
||||||
{
|
{
|
||||||
GLint oldswrap;
|
GLint oldswrap;
|
||||||
|
const int8_t tileofs = g_psky.tileofs[i];
|
||||||
|
|
||||||
bglColor4f(glcolors[pskyoff[i]][0], glcolors[pskyoff[i]][1], glcolors[pskyoff[i]][2], 1.0f);
|
bglColor4f(glcolors[tileofs][0], glcolors[tileofs][1], glcolors[tileofs][2], 1.0f);
|
||||||
bglBindTexture(GL_TEXTURE_2D, glpics[pskyoff[i]]);
|
bglBindTexture(GL_TEXTURE_2D, glpics[tileofs]);
|
||||||
|
|
||||||
bglGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &oldswrap);
|
bglGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &oldswrap);
|
||||||
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
|
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
|
||||||
|
|
|
@ -2299,9 +2299,8 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
double oguo, ogux, oguy;
|
double oguo, ogux, oguy;
|
||||||
int32_t i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum;
|
int32_t i, x, y, z, cz, fz, wallnum, sectnum, nextsectnum;
|
||||||
|
|
||||||
int16_t dapskybits;
|
int32_t dapskybits;
|
||||||
static const int16_t zeropskyoff[MAXPSKYTILES] = { 0 };
|
const int8_t *dapskyoff;
|
||||||
const int16_t *dapskyoff;
|
|
||||||
|
|
||||||
alpha = 0.f;
|
alpha = 0.f;
|
||||||
|
|
||||||
|
@ -2369,20 +2368,7 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
|
|
||||||
DO_TILE_ANIM(globalpicnum, sectnum);
|
DO_TILE_ANIM(globalpicnum, sectnum);
|
||||||
|
|
||||||
// multi-psky stuff
|
dapskyoff = getpsky(NULL, &dapskybits);
|
||||||
dapskyoff = zeropskyoff;
|
|
||||||
dapskybits = pskybits;
|
|
||||||
|
|
||||||
for (i=0; i<pskynummultis; i++)
|
|
||||||
{
|
|
||||||
if (globalpicnum == pskymultilist[i])
|
|
||||||
{
|
|
||||||
dapskybits = pskymultibits[i];
|
|
||||||
dapskyoff = pskymultioff[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
|
global_cf_shade = sec->floorshade, global_cf_pal = sec->floorpal; global_cf_z = sec->floorz; // REFACT
|
||||||
global_cf_xpanning = sec->floorxpanning; global_cf_ypanning = sec->floorypanning, global_cf_heinum = sec->floorheinum;
|
global_cf_xpanning = sec->floorxpanning; global_cf_ypanning = sec->floorypanning, global_cf_heinum = sec->floorheinum;
|
||||||
|
@ -2414,7 +2400,7 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size!
|
dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size!
|
||||||
t = (double)((1<<(picsiz[globalpicnum]&15))<<dapskybits);
|
t = (double)((1<<(picsiz[globalpicnum]&15))<<dapskybits);
|
||||||
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
|
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
|
||||||
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+parallaxyoffs)) - vv[1]*ghoriz;
|
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+g_psky.yoffs)) - vv[1]*ghoriz;
|
||||||
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
|
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
|
||||||
|
|
||||||
//Hack to draw black rectangle below sky when looking down...
|
//Hack to draw black rectangle below sky when looking down...
|
||||||
|
@ -2649,20 +2635,7 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
|
|
||||||
DO_TILE_ANIM(globalpicnum, sectnum);
|
DO_TILE_ANIM(globalpicnum, sectnum);
|
||||||
|
|
||||||
// multi-psky stuff
|
dapskyoff = getpsky(NULL, &dapskybits);
|
||||||
dapskyoff = zeropskyoff;
|
|
||||||
dapskybits = pskybits;
|
|
||||||
|
|
||||||
for (i=0; i<pskynummultis; i++)
|
|
||||||
{
|
|
||||||
if (globalpicnum == pskymultilist[i])
|
|
||||||
{
|
|
||||||
dapskybits = pskymultibits[i];
|
|
||||||
dapskyoff = pskymultioff[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
|
||||||
|
|
||||||
global_cf_shade = sec->ceilingshade, global_cf_pal = sec->ceilingpal; global_cf_z = sec->ceilingz; // REFACT
|
global_cf_shade = sec->ceilingshade, global_cf_pal = sec->ceilingpal; global_cf_z = sec->ceilingz; // REFACT
|
||||||
global_cf_xpanning = sec->ceilingxpanning; global_cf_ypanning = sec->ceilingypanning, global_cf_heinum = sec->ceilingheinum;
|
global_cf_xpanning = sec->ceilingxpanning; global_cf_ypanning = sec->ceilingypanning, global_cf_heinum = sec->ceilingheinum;
|
||||||
|
@ -2695,7 +2668,7 @@ static void polymost_drawalls(int32_t bunch)
|
||||||
dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size!
|
dd[0] = (float)xdimen*.0000001; //Adjust sky depth based on screen size!
|
||||||
t = (double)((1<<(picsiz[globalpicnum]&15))<<dapskybits);
|
t = (double)((1<<(picsiz[globalpicnum]&15))<<dapskybits);
|
||||||
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
|
vv[1] = dd[0]*((double)xdimscale*(double)viewingrange)/(65536.0*65536.0);
|
||||||
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+parallaxyoffs)) - vv[1]*ghoriz;
|
vv[0] = dd[0]*((double)((tilesizy[globalpicnum]>>1)+g_psky.yoffs)) - vv[1]*ghoriz;
|
||||||
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
|
i = (1<<(picsiz[globalpicnum]>>4)); if (i != tilesizy[globalpicnum]) i += i;
|
||||||
|
|
||||||
//Hack to draw black rectangle below sky when looking down...
|
//Hack to draw black rectangle below sky when looking down...
|
||||||
|
|
|
@ -723,7 +723,7 @@ void ExtSetupMapFilename(const char *mapname)
|
||||||
void ExtLoadMap(const char *mapname)
|
void ExtLoadMap(const char *mapname)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
int32_t sky=0;
|
int32_t mskyidx=0;
|
||||||
|
|
||||||
getmessageleng = 0;
|
getmessageleng = 0;
|
||||||
getmessagetimeoff = 0;
|
getmessagetimeoff = 0;
|
||||||
|
@ -732,39 +732,20 @@ void ExtLoadMap(const char *mapname)
|
||||||
|
|
||||||
// old-fashioned multi-psky handling
|
// old-fashioned multi-psky handling
|
||||||
|
|
||||||
Bmemset(pskyoff, 0, sizeof(pskyoff));
|
Bmemset(g_psky.tileofs, 0, sizeof(g_psky.tileofs));
|
||||||
|
|
||||||
for (i=0; i<numsectors; i++)
|
for (i=0; i<numsectors; i++)
|
||||||
{
|
{
|
||||||
switch (sector[i].ceilingpicnum)
|
mskyidx = MultiPsky_TileToIdx(sector[i].ceilingpicnum);
|
||||||
{
|
if (mskyidx >= 0)
|
||||||
case MOONSKY1 :
|
|
||||||
case BIGORBIT1 : // orbit
|
|
||||||
case LA : // la city
|
|
||||||
sky=sector[i].ceilingpicnum;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (sky)
|
if (mskyidx >= 0)
|
||||||
{
|
Bmemcpy(g_psky.tileofs, multipsky[mskyidx].tileofs, sizeof(g_psky.tileofs));
|
||||||
case MOONSKY1 :
|
|
||||||
// keep in sync with G_MultiPskyInit
|
|
||||||
// -v-
|
|
||||||
Bmemcpy(pskyoff, pskymultioff[0], sizeof(pskymultioff[0]));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BIGORBIT1 : // orbit
|
g_psky.lognumtiles = 3;
|
||||||
Bmemcpy(pskyoff, pskymultioff[1], sizeof(pskymultioff[0]));
|
parallaxtype = 0;
|
||||||
break;
|
|
||||||
|
|
||||||
case LA : // la city
|
|
||||||
Bmemcpy(pskyoff, pskymultioff[2], sizeof(pskymultioff[0]));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pskybits=3;
|
|
||||||
parallaxtype=0;
|
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
#if M32_UNDO
|
#if M32_UNDO
|
||||||
|
@ -10489,7 +10470,7 @@ int32_t ExtInit(void)
|
||||||
|
|
||||||
ReadHelpFile("m32help.hlp");
|
ReadHelpFile("m32help.hlp");
|
||||||
|
|
||||||
G_MultiPskyInit();
|
G_MultiPskyInit(MOONSKY1, BIGORBIT1, LA);
|
||||||
|
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
if (Em_CreateState(&g_EmState) == 0)
|
if (Em_CreateState(&g_EmState) == 0)
|
||||||
|
|
|
@ -152,56 +152,72 @@ const char *G_ConFile(void)
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
void G_MultiPskyInit(void)
|
// Set up new-style multi-psky handling.
|
||||||
|
// NOTE: When adding more multi-pskies, take a look whether the engine-side
|
||||||
|
// MAXPSKYMULTIS needs to be increased.
|
||||||
|
void G_MultiPskyInit(int32_t MOONSKY1__DYN, int32_t BIGORBIT1__DYN, int32_t LA__DYN)
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
|
|
||||||
// new-style multi-psky handling
|
psky_t *moonsky = &multipsky[0];
|
||||||
pskymultilist[0] = MOONSKY1;
|
psky_t *spacesky = &multipsky[1];
|
||||||
pskymultilist[1] = BIGORBIT1;
|
psky_t *citysky = &multipsky[2];
|
||||||
pskymultilist[2] = LA;
|
|
||||||
|
|
||||||
pskymultiyscale[0] = 32768;
|
static int32_t inited;
|
||||||
pskymultiyscale[1] = 32768;
|
if (inited)
|
||||||
pskymultiyscale[2] = 16384+1024;
|
return;
|
||||||
|
inited = 1;
|
||||||
|
|
||||||
for (i=0; i<3; ++i)
|
multipskytile[0] = MOONSKY1__DYN;
|
||||||
{
|
multipskytile[1] = BIGORBIT1__DYN;
|
||||||
pskymultibits[i] = 3;
|
multipskytile[2] = LA__DYN;
|
||||||
Bmemset(pskymultioff[i], 0, sizeof(pskymultioff[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
// KEEPINSYNC with Polymer MAX OFFSET = 4
|
|
||||||
|
|
||||||
// MOONSKY1
|
|
||||||
// earth mountain mountain sun
|
|
||||||
pskymultioff[0][6]=1;
|
|
||||||
pskymultioff[0][1]=2;
|
|
||||||
pskymultioff[0][4]=2;
|
|
||||||
pskymultioff[0][2]=3;
|
|
||||||
|
|
||||||
// BIGORBIT1 // orbit
|
|
||||||
// earth1 2 3 moon/sun
|
|
||||||
pskymultioff[1][5]=1;
|
|
||||||
pskymultioff[1][6]=2;
|
|
||||||
pskymultioff[1][7]=3;
|
|
||||||
pskymultioff[1][2]=4;
|
|
||||||
|
|
||||||
// LA // la city
|
|
||||||
// earth1 2 3 moon/sun
|
|
||||||
pskymultioff[2][0]=1;
|
|
||||||
pskymultioff[2][1]=2;
|
|
||||||
pskymultioff[2][2]=1;
|
|
||||||
pskymultioff[2][3]=3;
|
|
||||||
pskymultioff[2][4]=4;
|
|
||||||
pskymultioff[2][5]=0;
|
|
||||||
pskymultioff[2][6]=2;
|
|
||||||
pskymultioff[2][7]=3;
|
|
||||||
|
|
||||||
pskynummultis = 3;
|
pskynummultis = 3;
|
||||||
|
|
||||||
|
// When adding other multi-skies, take care that the tileofs[] values are
|
||||||
|
// <= PSKYOFF_MAX. (It can be increased up to MAXPSKYTILES, but should be
|
||||||
|
// set as tight as possible.)
|
||||||
|
|
||||||
|
// MOONSKY1
|
||||||
|
// earth mountain mountain sun
|
||||||
|
moonsky->lognumtiles = 3;
|
||||||
|
moonsky->horizfrac = 32768;
|
||||||
|
moonsky->tileofs[6] = 1;
|
||||||
|
moonsky->tileofs[1] = 2;
|
||||||
|
moonsky->tileofs[4] = 2;
|
||||||
|
moonsky->tileofs[2] = 3;
|
||||||
|
|
||||||
|
// BIGORBIT1 // orbit
|
||||||
|
// earth1 2 3 moon/sun
|
||||||
|
spacesky->lognumtiles = 3;
|
||||||
|
spacesky->horizfrac = 32768;
|
||||||
|
spacesky->tileofs[5] = 1;
|
||||||
|
spacesky->tileofs[6] = 2;
|
||||||
|
spacesky->tileofs[7] = 3;
|
||||||
|
spacesky->tileofs[2] = 4;
|
||||||
|
|
||||||
|
// LA // la city
|
||||||
|
// earth1 2 3 moon/sun
|
||||||
|
citysky->lognumtiles = 3;
|
||||||
|
citysky->horizfrac = 16384+1024;
|
||||||
|
citysky->tileofs[0] = 1;
|
||||||
|
citysky->tileofs[1] = 2;
|
||||||
|
citysky->tileofs[2] = 1;
|
||||||
|
citysky->tileofs[3] = 3;
|
||||||
|
citysky->tileofs[4] = 4;
|
||||||
|
citysky->tileofs[5] = 0;
|
||||||
|
citysky->tileofs[6] = 2;
|
||||||
|
citysky->tileofs[7] = 3;
|
||||||
|
|
||||||
|
for (i=0; i<pskynummultis; ++i)
|
||||||
|
{
|
||||||
|
int32_t j;
|
||||||
|
for (j=0; j<(1<<multipsky[i].lognumtiles); ++j)
|
||||||
|
Bassert(multipsky[i].tileofs[j] <= PSKYOFF_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
// default in game:
|
// default in game:
|
||||||
parallaxyscale = 32768;
|
g_psky.horizfrac = 32768;
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
|
@ -58,7 +58,7 @@ extern void clearScriptNamePtr(void);
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
extern void G_MultiPskyInit(void);
|
extern void G_MultiPskyInit(int32_t MOONSKY1__DYN, int32_t BIGORBIT1__DYN, int32_t LA__DYN);
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
|
|
||||||
|
|
|
@ -59,10 +59,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
|
||||||
#ifdef LUNATIC
|
#ifdef LUNATIC
|
||||||
// Lunatic
|
// Lunatic
|
||||||
# define BYTEVERSION_JF 279
|
# define BYTEVERSION_JF 282
|
||||||
#else
|
#else
|
||||||
// Non-Lua build
|
// Non-Lua build
|
||||||
# define BYTEVERSION_JF 279
|
# define BYTEVERSION_JF 282
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define BYTEVERSION_13 27
|
#define BYTEVERSION_13 27
|
||||||
|
|
|
@ -10719,6 +10719,7 @@ static void G_Startup(void)
|
||||||
G_InitDynamicSounds();
|
G_InitDynamicSounds();
|
||||||
|
|
||||||
// These depend on having the dynamic tile and/or sound mappings set up:
|
// These depend on having the dynamic tile and/or sound mappings set up:
|
||||||
|
G_MultiPskyInit(MOONSKY1, BIGORBIT1, LA);
|
||||||
Gv_FinalizeWeaponDefaults();
|
Gv_FinalizeWeaponDefaults();
|
||||||
G_PostCreateGameState();
|
G_PostCreateGameState();
|
||||||
|
|
||||||
|
|
|
@ -5537,8 +5537,8 @@ void G_SaveMapState(void)
|
||||||
Bmemcpy(&save->clouds[0],&clouds[0],sizeof(clouds));
|
Bmemcpy(&save->clouds[0],&clouds[0],sizeof(clouds));
|
||||||
Bmemcpy(&save->cloudx[0],&cloudx[0],sizeof(cloudx));
|
Bmemcpy(&save->cloudx[0],&cloudx[0],sizeof(cloudx));
|
||||||
Bmemcpy(&save->cloudy[0],&cloudy[0],sizeof(cloudy));
|
Bmemcpy(&save->cloudy[0],&cloudy[0],sizeof(cloudy));
|
||||||
Bmemcpy(&save->pskyoff[0],&pskyoff[0],sizeof(pskyoff));
|
Bmemcpy(&save->pskyoff[0],g_psky.tileofs,sizeof(g_psky.tileofs));
|
||||||
Bmemcpy(&save->pskybits,&pskybits,sizeof(pskybits));
|
Bmemcpy(&save->pskybits,&g_psky.lognumtiles,sizeof(g_psky.lognumtiles));
|
||||||
Bmemcpy(&save->animategoal[0],&animategoal[0],sizeof(animategoal));
|
Bmemcpy(&save->animategoal[0],&animategoal[0],sizeof(animategoal));
|
||||||
Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel));
|
Bmemcpy(&save->animatevel[0],&animatevel[0],sizeof(animatevel));
|
||||||
Bmemcpy(&save->g_animateCount,&g_animateCount,sizeof(g_animateCount));
|
Bmemcpy(&save->g_animateCount,&g_animateCount,sizeof(g_animateCount));
|
||||||
|
@ -5643,8 +5643,8 @@ void G_RestoreMapState(void)
|
||||||
Bmemcpy(&clouds[0],&save->clouds[0],sizeof(clouds));
|
Bmemcpy(&clouds[0],&save->clouds[0],sizeof(clouds));
|
||||||
Bmemcpy(&cloudx[0],&save->cloudx[0],sizeof(cloudx));
|
Bmemcpy(&cloudx[0],&save->cloudx[0],sizeof(cloudx));
|
||||||
Bmemcpy(&cloudy[0],&save->cloudy[0],sizeof(cloudy));
|
Bmemcpy(&cloudy[0],&save->cloudy[0],sizeof(cloudy));
|
||||||
Bmemcpy(&pskyoff[0],&save->pskyoff[0],sizeof(pskyoff));
|
Bmemcpy(g_psky.tileofs,&save->pskyoff[0],sizeof(g_psky.tileofs));
|
||||||
Bmemcpy(&pskybits,&save->pskybits,sizeof(pskybits));
|
Bmemcpy(&g_psky.lognumtiles,&save->pskybits,sizeof(g_psky.lognumtiles));
|
||||||
Bmemcpy(&animategoal[0],&save->animategoal[0],sizeof(animategoal));
|
Bmemcpy(&animategoal[0],&save->animategoal[0],sizeof(animategoal));
|
||||||
Bmemcpy(&animatevel[0],&save->animatevel[0],sizeof(animatevel));
|
Bmemcpy(&animatevel[0],&save->animatevel[0],sizeof(animatevel));
|
||||||
Bmemcpy(&g_animateCount,&save->g_animateCount,sizeof(g_animateCount));
|
Bmemcpy(&g_animateCount,&save->g_animateCount,sizeof(g_animateCount));
|
||||||
|
|
|
@ -966,50 +966,31 @@ static void resetprestat(int32_t snum,int32_t g)
|
||||||
|
|
||||||
static inline void G_SetupBackdrop(int16_t sky)
|
static inline void G_SetupBackdrop(int16_t sky)
|
||||||
{
|
{
|
||||||
static int32_t multiskiesinited=0;
|
// Get the static value of the base sky tile number.
|
||||||
|
const int32_t ssky = DYNAMICTILEMAP(sky);
|
||||||
|
|
||||||
if (!multiskiesinited)
|
Bmemset(g_psky.tileofs, 0, sizeof(g_psky.tileofs));
|
||||||
|
|
||||||
|
// XXX: why the condition?
|
||||||
|
if (g_psky.horizfrac != 65536)
|
||||||
|
g_psky.horizfrac = 32768;
|
||||||
|
|
||||||
|
if (ssky == CLOUDYOCEAN__STATIC)
|
||||||
{
|
{
|
||||||
multiskiesinited = 1;
|
g_psky.horizfrac = 65536;
|
||||||
G_MultiPskyInit();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int32_t mskyidx = MultiPsky_TileToIdx(ssky);
|
||||||
|
if (mskyidx >= 0)
|
||||||
|
{
|
||||||
|
Bmemcpy(g_psky.tileofs, multipsky[mskyidx].tileofs, sizeof(g_psky.tileofs));
|
||||||
|
if (ssky == LA__STATIC)
|
||||||
|
g_psky.horizfrac = 16384+1024;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Bmemset(pskyoff, 0, sizeof(pskyoff));
|
g_psky.lognumtiles = 3;
|
||||||
|
|
||||||
if (parallaxyscale != 65536)
|
|
||||||
parallaxyscale = 32768;
|
|
||||||
|
|
||||||
switch (DYNAMICTILEMAP(sky))
|
|
||||||
{
|
|
||||||
case CLOUDYOCEAN__STATIC:
|
|
||||||
parallaxyscale = 65536L;
|
|
||||||
break;
|
|
||||||
case MOONSKY1__STATIC :
|
|
||||||
pskyoff[6]=1;
|
|
||||||
pskyoff[1]=2;
|
|
||||||
pskyoff[4]=2;
|
|
||||||
pskyoff[2]=3;
|
|
||||||
break;
|
|
||||||
case BIGORBIT1__STATIC: // orbit
|
|
||||||
pskyoff[5]=1;
|
|
||||||
pskyoff[6]=2;
|
|
||||||
pskyoff[7]=3;
|
|
||||||
pskyoff[2]=4;
|
|
||||||
break;
|
|
||||||
case LA__STATIC:
|
|
||||||
parallaxyscale = 16384+1024;
|
|
||||||
pskyoff[0]=1;
|
|
||||||
pskyoff[1]=2;
|
|
||||||
pskyoff[2]=1;
|
|
||||||
pskyoff[3]=3;
|
|
||||||
pskyoff[4]=4;
|
|
||||||
pskyoff[5]=0;
|
|
||||||
pskyoff[6]=2;
|
|
||||||
pskyoff[7]=3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pskybits=3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tweak moving sectors with these SE lotags
|
// tweak moving sectors with these SE lotags
|
||||||
|
@ -1451,7 +1432,7 @@ void G_NewGame(int32_t vn, int32_t ln, int32_t sk)
|
||||||
ud.player_skill = sk;
|
ud.player_skill = sk;
|
||||||
ud.secretlevel = 0;
|
ud.secretlevel = 0;
|
||||||
ud.from_bonus = 0;
|
ud.from_bonus = 0;
|
||||||
parallaxyscale = 0;
|
g_psky.horizfrac = 0;
|
||||||
|
|
||||||
ud.last_level = -1;
|
ud.last_level = -1;
|
||||||
g_lastSaveSlot = -1;
|
g_lastSaveSlot = -1;
|
||||||
|
|
|
@ -139,6 +139,8 @@ void ReadSaveGameHeaders(void)
|
||||||
|
|
||||||
savehead_t h;
|
savehead_t h;
|
||||||
|
|
||||||
|
EDUKE32_STATIC_ASSERT(sizeof(h.savename) == sizeof(ud.savegame[0]));
|
||||||
|
|
||||||
Bstrcpy(fn, "dukesav0.esv");
|
Bstrcpy(fn, "dukesav0.esv");
|
||||||
|
|
||||||
for (i=0; i<10; i++)
|
for (i=0; i<10; i++)
|
||||||
|
@ -1026,9 +1028,7 @@ static const dataspec_t svgm_anmisc[] =
|
||||||
{ 0, &clouds[0], sizeof(clouds), 1 },
|
{ 0, &clouds[0], sizeof(clouds), 1 },
|
||||||
{ 0, &cloudx[0], sizeof(cloudx), 1 },
|
{ 0, &cloudx[0], sizeof(cloudx), 1 },
|
||||||
{ 0, &cloudy[0], sizeof(cloudy), 1 },
|
{ 0, &cloudy[0], sizeof(cloudy), 1 },
|
||||||
{ DS_NOCHK, ¶llaxyscale, sizeof(parallaxyscale), 1 },
|
{ 0, &g_psky, sizeof(g_psky), 1 }, // DS_NOCHK?
|
||||||
{ 0, &pskybits, sizeof(pskybits), 1 },
|
|
||||||
{ 0, &pskyoff[0], sizeof(pskyoff[0]), MAXPSKYTILES },
|
|
||||||
{ 0, &g_earthquakeTime, sizeof(g_earthquakeTime), 1 },
|
{ 0, &g_earthquakeTime, sizeof(g_earthquakeTime), 1 },
|
||||||
|
|
||||||
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)sv_prequote, 0, 1 },
|
{ DS_SAVEFN|DS_LOADFN|DS_NOCHK, (void *)sv_prequote, 0, 1 },
|
||||||
|
|
|
@ -49,9 +49,11 @@ typedef struct
|
||||||
uint8_t numplayers, volnum, levnum, skill;
|
uint8_t numplayers, volnum, levnum, skill;
|
||||||
char boardfn[256]; // BMAX_PATH
|
char boardfn[256]; // BMAX_PATH
|
||||||
// 282 bytes
|
// 282 bytes
|
||||||
} savehead_t; // 310 bytes
|
} savehead_t;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
EDUKE32_STATIC_ASSERT(sizeof(savehead_t) == 310);
|
||||||
|
|
||||||
int32_t sv_updatestate(int32_t frominit);
|
int32_t sv_updatestate(int32_t frominit);
|
||||||
int32_t sv_readdiff(int32_t fil);
|
int32_t sv_readdiff(int32_t fil);
|
||||||
uint32_t sv_writediff(FILE *fil);
|
uint32_t sv_writediff(FILE *fil);
|
||||||
|
|
Loading…
Reference in a new issue