Formatting + beginnings of editor enhanced map preview mode. Currently supports light switch sector effectors

git-svn-id: https://svn.eduke32.com/eduke32@763 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-06-05 02:29:18 +00:00
parent 0602988743
commit 97f98dcdfc
13 changed files with 364 additions and 247 deletions

View file

@ -213,8 +213,8 @@ int loadsetup(const char *fn)
if (readconfig(fp, "turndecel", val, VL) > 0) pk_turndecel = Batoi(val); if (readconfig(fp, "turndecel", val, VL) > 0) pk_turndecel = Batoi(val);
if (readconfig(fp, "autosave", val, VL) > 0) autosave = Batoi(val)*60; if (readconfig(fp, "autosave", val, VL) > 0) autosave = Batoi(val)*60;
if (readconfig(fp, "autosavesec", val, VL) > 0) autosave = Batoi(val); if (readconfig(fp, "autosavesec", val, VL) > 0) autosave = Batoi(val);
for (i=0;i<256;i++)remap[i]=i; for (i=0;i<256;i++)remap[i]=i;
remapinit=1; remapinit=1;
@ -343,9 +343,9 @@ int writesetup(const char *fn)
"; Turning deceleration\n" "; Turning deceleration\n"
"turndecel = %d\n" "turndecel = %d\n"
"\n" "\n"
"; Autosave map interval (seconds)\n" "; Autosave map interval (seconds)\n"
"autosavesec = %d\n" "autosavesec = %d\n"
"\n" "\n"
#if 1 #if 1
"; Key Settings\n" "; Key Settings\n"
"; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n" "; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex!\n"
@ -406,7 +406,7 @@ int writesetup(const char *fn)
option[7]>>4, option[2], option[7]>>4, option[2],
#endif #endif
option[3], msens, unrealedlook, pk_uedaccel, quickmapcycling, option[3], msens, unrealedlook, pk_uedaccel, quickmapcycling,
revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave, revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave,
#if 1 #if 1
keys[0], keys[1], keys[2], keys[3], keys[4], keys[5], keys[0], keys[1], keys[2], keys[3], keys[4], keys[5],
keys[6], keys[7], keys[8], keys[9], keys[10], keys[11], keys[6], keys[7], keys[8], keys[9], keys[10], keys[11],

View file

@ -6845,7 +6845,7 @@ int loadboard(char *filename, char fromwhere, int *daposx, int *daposy, int *dap
if (sprite[i].sectnum<0||sprite[i].sectnum>=MYMAXSECTORS) if (sprite[i].sectnum<0||sprite[i].sectnum>=MYMAXSECTORS)
{ {
initprintf("Map error: sprite #%d(%d,%d) with an illegal sector(%d)\n",i,sprite[i].x,sprite[i].y,sprite[i].sectnum); initprintf("Map error: sprite #%d(%d,%d) with an illegal sector(%d)\n",i,sprite[i].x,sprite[i].y,sprite[i].sectnum);
sprite[i].sectnum=MYMAXSECTORS-1; sprite[i].sectnum=MYMAXSECTORS-1;
} }
} }
@ -7594,11 +7594,11 @@ int saveboard(char *filename, int *daposx, int *daposy, int *daposz,
if ((fil = Bopen(filename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1) if ((fil = Bopen(filename,BO_BINARY|BO_TRUNC|BO_CREAT|BO_WRONLY,BS_IREAD|BS_IWRITE)) == -1)
return(-1); return(-1);
for (j=0;j<MAXSPRITES;j++)if((unsigned)sprite[j].statnum>MAXSTATUS) for (j=0;j<MAXSPRITES;j++)if ((unsigned)sprite[j].statnum>MAXSTATUS)
{ {
initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",j,sprite[j].x,sprite[j].y,sprite[j].statnum); initprintf("Map error: sprite #%d(%d,%d) with an illegal statnum(%d)\n",j,sprite[j].x,sprite[j].y,sprite[j].statnum);
changespritestat(j,0); changespritestat(j,0);
} }
numsprites = 0; numsprites = 0;
for (j=0;j<MAXSTATUS;j++) for (j=0;j<MAXSTATUS;j++)

View file

@ -1960,7 +1960,7 @@ static int kgifrend(const char *kfilebuf, int kfilelength,
int lzcols, dat, blocklen, bitcnt, xoff, transcol, backcol, *lptr; int lzcols, dat, blocklen, bitcnt, xoff, transcol, backcol, *lptr;
char numbits, startnumbits, chunkind, ilacefirst; char numbits, startnumbits, chunkind, ilacefirst;
const unsigned char *ptr, *cptr = 0; const unsigned char *ptr, *cptr = 0;
intptr_t yoff; intptr_t yoff;
UNREFERENCED_PARAMETER(kfilelength); UNREFERENCED_PARAMETER(kfilelength);
coltype = 3; bitdepth = 8; //For PNGOUT coltype = 3; bitdepth = 8; //For PNGOUT

View file

@ -96,194 +96,194 @@
*/ */
unsigned int unsigned int
lzf_compress (const void *const in_data, unsigned int in_len, lzf_compress(const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len void *out_data, unsigned int out_len
#if LZF_STATE_ARG #if LZF_STATE_ARG
, LZF_STATE htab , LZF_STATE htab
#endif #endif
) )
{ {
#if !LZF_STATE_ARG #if !LZF_STATE_ARG
LZF_STATE htab; LZF_STATE htab;
#endif #endif
const u8 **hslot; const u8 **hslot;
const u8 *ip = (const u8 *)in_data; const u8 *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data; u8 *op = (u8 *)out_data;
const u8 *in_end = ip + in_len; const u8 *in_end = ip + in_len;
u8 *out_end = op + out_len; u8 *out_end = op + out_len;
const u8 *ref; const u8 *ref;
/* off requires a type wide enough to hold a general pointer difference. /* off requires a type wide enough to hold a general pointer difference.
* ISO C doesn't have that (size_t might not be enough and ptrdiff_t only * ISO C doesn't have that (size_t might not be enough and ptrdiff_t only
* works for differences within a single object). We also assume that no * works for differences within a single object). We also assume that no
* no bit pattern traps. Since the only platform that is both non-POSIX * no bit pattern traps. Since the only platform that is both non-POSIX
* and fails to support both assumptions is windows 64 bit, we make a * and fails to support both assumptions is windows 64 bit, we make a
* special workaround for it. * special workaround for it.
*/ */
#if defined (WIN32) && defined (_M_X64) #if defined (WIN32) && defined (_M_X64)
unsigned _int64 off; /* workaround for missing POSIX compliance */ unsigned _int64 off; /* workaround for missing POSIX compliance */
#else #else
unsigned long off; unsigned long off;
#endif #endif
unsigned int hval; unsigned int hval;
int lit; int lit;
if (!in_len || !out_len) if (!in_len || !out_len)
return 0; return 0;
#if INIT_HTAB #if INIT_HTAB
memset (htab, 0, sizeof (htab)); memset(htab, 0, sizeof(htab));
# if 0 # if 0
for (hslot = htab; hslot < htab + HSIZE; hslot++) for (hslot = htab; hslot < htab + HSIZE; hslot++)
*hslot++ = ip; *hslot++ = ip;
# endif # endif
#endif #endif
lit = 0; op++; /* start run */ lit = 0; op++; /* start run */
hval = FRST (ip); hval = FRST(ip);
while (ip < in_end - 2) while (ip < in_end - 2)
{ {
hval = NEXT (hval, ip); hval = NEXT(hval, ip);
hslot = htab + IDX (hval); hslot = htab + IDX(hval);
ref = *hslot; *hslot = ip; ref = *hslot; *hslot = ip;
if (1 if (1
#if INIT_HTAB #if INIT_HTAB
&& ref < ip /* the next test will actually take care of this, but this is faster */ && ref < ip /* the next test will actually take care of this, but this is faster */
#endif #endif
&& (off = ip - ref - 1) < MAX_OFF && (off = ip - ref - 1) < MAX_OFF
&& ip + 4 < in_end && ip + 4 < in_end
&& ref > (u8 *)in_data && ref > (u8 *)in_data
#if STRICT_ALIGN #if STRICT_ALIGN
&& ref[0] == ip[0] && ref[0] == ip[0]
&& ref[1] == ip[1] && ref[1] == ip[1]
&& ref[2] == ip[2] && ref[2] == ip[2]
#else #else
&& *(u16 *)ref == *(u16 *)ip && *(u16 *)ref == *(u16 *)ip
&& ref[2] == ip[2] && ref[2] == ip[2]
#endif #endif
) )
{ {
/* match found at *ref++ */ /* match found at *ref++ */
unsigned int len = 2; unsigned int len = 2;
unsigned int maxlen = in_end - ip - len; unsigned int maxlen = in_end - ip - len;
maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; maxlen = maxlen > MAX_REF ? MAX_REF : maxlen;
op [- lit - 1] = lit - 1; /* stop run */ op [- lit - 1] = lit - 1; /* stop run */
op -= !lit; /* undo run if length is zero */ op -= !lit; /* undo run if length is zero */
if (expect_false (op + 3 + 1 >= out_end)) if (expect_false(op + 3 + 1 >= out_end))
return 0; return 0;
for (;;) for (;;)
{ {
if (expect_true (maxlen > 16)) if (expect_true(maxlen > 16))
{ {
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
len++; if (ref [len] != ip [len]) break; len++; if (ref [len] != ip [len]) break;
} }
do do
len++; len++;
while (len < maxlen && ref[len] == ip[len]); while (len < maxlen && ref[len] == ip[len]);
break; break;
} }
len -= 2; len -= 2;
ip++; ip++;
if (len < 7) if (len < 7)
{ {
*op++ = (off >> 8) + (len << 5); *op++ = (off >> 8) + (len << 5);
} }
else else
{ {
*op++ = (off >> 8) + ( 7 << 5); *op++ = (off >> 8) + (7 << 5);
*op++ = len - 7; *op++ = len - 7;
} }
*op++ = off; *op++ = off;
#if ULTRA_FAST || VERY_FAST #if ULTRA_FAST || VERY_FAST
ip += len; ip += len;
#if VERY_FAST && !ULTRA_FAST #if VERY_FAST && !ULTRA_FAST
--ip; --ip;
#endif #endif
hval = FRST (ip); hval = FRST(ip);
hval = NEXT (hval, ip); hval = NEXT(hval, ip);
htab[IDX (hval)] = ip; htab[IDX(hval)] = ip;
ip++; ip++;
#if VERY_FAST && !ULTRA_FAST #if VERY_FAST && !ULTRA_FAST
hval = NEXT (hval, ip); hval = NEXT(hval, ip);
htab[IDX (hval)] = ip; htab[IDX(hval)] = ip;
ip++; ip++;
#endif #endif
#else #else
do do
{ {
hval = NEXT (hval, ip); hval = NEXT(hval, ip);
htab[IDX (hval)] = ip; htab[IDX(hval)] = ip;
ip++; ip++;
} }
while (len--); while (len--);
#endif #endif
lit = 0; op++; /* start run */ lit = 0; op++; /* start run */
} }
else else
{ {
/* one more literal byte we must copy */ /* one more literal byte we must copy */
if (expect_false (op >= out_end)) if (expect_false(op >= out_end))
return 0; return 0;
lit++; *op++ = *ip++; lit++; *op++ = *ip++;
if (expect_false (lit == MAX_LIT)) if (expect_false(lit == MAX_LIT))
{ {
op [- lit - 1] = lit - 1; /* stop run */ op [- lit - 1] = lit - 1; /* stop run */
lit = 0; op++; /* start run */ lit = 0; op++; /* start run */
} }
} }
} }
if (op + 3 > out_end) /* at most 3 bytes can be missing here */ if (op + 3 > out_end) /* at most 3 bytes can be missing here */
return 0; return 0;
while (ip < in_end) while (ip < in_end)
{ {
lit++; *op++ = *ip++; lit++; *op++ = *ip++;
if (expect_false (lit == MAX_LIT)) if (expect_false(lit == MAX_LIT))
{ {
op [- lit - 1] = lit - 1; /* stop run */ op [- lit - 1] = lit - 1; /* stop run */
lit = 0; op++; /* start run */ lit = 0; op++; /* start run */
} }
} }
op [- lit - 1] = lit - 1; /* end run */ op [- lit - 1] = lit - 1; /* end run */
op -= !lit; /* undo run if length is zero */ op -= !lit; /* undo run if length is zero */
return op - (u8 *)out_data; return op - (u8 *)out_data;
} }

View file

@ -51,98 +51,98 @@
#endif #endif
unsigned int unsigned int
lzf_decompress (const void *const in_data, unsigned int in_len, lzf_decompress(const void *const in_data, unsigned int in_len,
void *out_data, unsigned int out_len) void *out_data, unsigned int out_len)
{ {
u8 const *ip = (const u8 *)in_data; u8 const *ip = (const u8 *)in_data;
u8 *op = (u8 *)out_data; u8 *op = (u8 *)out_data;
u8 const *const in_end = ip + in_len; u8 const *const in_end = ip + in_len;
u8 *const out_end = op + out_len; u8 *const out_end = op + out_len;
do do
{ {
unsigned int ctrl = *ip++; unsigned int ctrl = *ip++;
if (ctrl < (1 << 5)) /* literal run */ if (ctrl < (1 << 5)) /* literal run */
{ {
ctrl++; ctrl++;
if (op + ctrl > out_end) if (op + ctrl > out_end)
{ {
SET_ERRNO (E2BIG); SET_ERRNO(E2BIG);
return 0; return 0;
} }
#if CHECK_INPUT #if CHECK_INPUT
if (ip + ctrl > in_end) if (ip + ctrl > in_end)
{ {
SET_ERRNO (EINVAL); SET_ERRNO(EINVAL);
return 0; return 0;
} }
#endif #endif
#ifdef lzf_movsb #ifdef lzf_movsb
lzf_movsb (op, ip, ctrl); lzf_movsb(op, ip, ctrl);
#else #else
do do
*op++ = *ip++; *op++ = *ip++;
while (--ctrl); while (--ctrl);
#endif #endif
} }
else /* back reference */ else /* back reference */
{ {
unsigned int len = ctrl >> 5; unsigned int len = ctrl >> 5;
u8 *ref = op - ((ctrl & 0x1f) << 8) - 1; u8 *ref = op - ((ctrl & 0x1f) << 8) - 1;
#if CHECK_INPUT #if CHECK_INPUT
if (ip >= in_end) if (ip >= in_end)
{ {
SET_ERRNO (EINVAL); SET_ERRNO(EINVAL);
return 0; return 0;
} }
#endif #endif
if (len == 7) if (len == 7)
{ {
len += *ip++; len += *ip++;
#if CHECK_INPUT #if CHECK_INPUT
if (ip >= in_end) if (ip >= in_end)
{ {
SET_ERRNO (EINVAL); SET_ERRNO(EINVAL);
return 0; return 0;
} }
#endif #endif
} }
ref -= *ip++; ref -= *ip++;
if (op + len + 2 > out_end) if (op + len + 2 > out_end)
{ {
SET_ERRNO (E2BIG); SET_ERRNO(E2BIG);
return 0; return 0;
} }
if (ref < (u8 *)out_data) if (ref < (u8 *)out_data)
{ {
SET_ERRNO (EINVAL); SET_ERRNO(EINVAL);
return 0; return 0;
} }
#ifdef lzf_movsb #ifdef lzf_movsb
len += 2; len += 2;
lzf_movsb (op, ref, len); lzf_movsb(op, ref, len);
#else #else
*op++ = *ref++;
*op++ = *ref++;
do
*op++ = *ref++; *op++ = *ref++;
while (--len); *op++ = *ref++;
do
*op++ = *ref++;
while (--len);
#endif #endif
} }
} }
while (ip < in_end); while (ip < in_end);
return op - (u8 *)out_data; return op - (u8 *)out_data;
} }

View file

@ -1178,7 +1178,9 @@ static md2model *md2load(int fil, const char *filnam)
s->xyzn[(k*s->numverts) + (i*3) + j].x = f->verts[m->tris[i].v[j]].v[0]; s->xyzn[(k*s->numverts) + (i*3) + j].x = f->verts[m->tris[i].v[j]].v[0];
s->xyzn[(k*s->numverts) + (i*3) + j].y = f->verts[m->tris[i].v[j]].v[1]; s->xyzn[(k*s->numverts) + (i*3) + j].y = f->verts[m->tris[i].v[j]].v[1];
s->xyzn[(k*s->numverts) + (i*3) + j].z = f->verts[m->tris[i].v[j]].v[2]; s->xyzn[(k*s->numverts) + (i*3) + j].z = f->verts[m->tris[i].v[j]].v[2];
} else { }
else
{
s->xyzn[(k*s->numverts) + (i*3) + j].x = ((f->verts[m->tris[i].v[j]].v[0] * f->mul.x) + f->add.x) * 64; s->xyzn[(k*s->numverts) + (i*3) + j].x = ((f->verts[m->tris[i].v[j]].v[0] * f->mul.x) + f->add.x) * 64;
s->xyzn[(k*s->numverts) + (i*3) + j].y = ((f->verts[m->tris[i].v[j]].v[1] * f->mul.y) + f->add.y) * 64; s->xyzn[(k*s->numverts) + (i*3) + j].y = ((f->verts[m->tris[i].v[j]].v[1] * f->mul.y) + f->add.y) * 64;
s->xyzn[(k*s->numverts) + (i*3) + j].z = ((f->verts[m->tris[i].v[j]].v[2] * f->mul.z) + f->add.z) * 64; s->xyzn[(k*s->numverts) + (i*3) + j].z = ((f->verts[m->tris[i].v[j]].v[2] * f->mul.z) + f->add.z) * 64;
@ -1568,7 +1570,7 @@ static int md3draw(md3model *m, spritetype *tspr)
pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups); pc[0] = pc[1] = pc[2] = ((float)(numpalookups-min(max((globalshade * shadescale)+m->shadeoff,0),numpalookups)))/((float)numpalookups);
if (!(hictinting[globalpal].f&4)) if (!(hictinting[globalpal].f&4))
{ {
if ( !(m->flags&1) || ( !(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0 ) ) if (!(m->flags&1) || (!(tspr->owner >= MAXSPRITES) && sector[sprite[tspr->owner].sectnum].floorpal!=0))
{ {
pc[0] *= (float)hictinting[globalpal].r / 255.0; pc[0] *= (float)hictinting[globalpal].r / 255.0;
pc[1] *= (float)hictinting[globalpal].g / 255.0; pc[1] *= (float)hictinting[globalpal].g / 255.0;

View file

@ -368,8 +368,8 @@ void polymer_drawsprite(int snum)
pth = gltexcache(curpicnum, tspr->pal, 0); pth = gltexcache(curpicnum, tspr->pal, 0);
spriteplane.color[0] = spriteplane.color[0] =
spriteplane.color[1] = spriteplane.color[1] =
spriteplane.color[2] = ((float)(numpalookups-min(max(tspr->shade,0),numpalookups)))/((float)numpalookups); spriteplane.color[2] = ((float)(numpalookups-min(max(tspr->shade,0),numpalookups)))/((float)numpalookups);
if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal)) if (pth && (pth->flags & 2) && (pth->palnum != tspr->pal))
{ {
@ -766,9 +766,12 @@ static void polymer_drawplane(short sectnum, short wallnum, _prplane* pl
bglStencilOp(GL_KEEP, GL_KEEP, GL_INCR); bglStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
bglStencilFunc(GL_EQUAL, 0, 0xffffffff); bglStencilFunc(GL_EQUAL, 0, 0xffffffff);
if (plane->vbo && (pr_vbos > 0)) { if (plane->vbo && (pr_vbos > 0))
{
OMGDRAWSHITVBO; OMGDRAWSHITVBO;
} else { }
else
{
OMGDRAWSHIT; OMGDRAWSHIT;
} }
@ -860,9 +863,12 @@ static void polymer_drawplane(short sectnum, short wallnum, _prplane* pl
bglColor4f(plane->color[0], plane->color[1], plane->color[2], plane->color[3]); bglColor4f(plane->color[0], plane->color[1], plane->color[2], plane->color[3]);
bglBindTexture(GL_TEXTURE_2D, plane->glpic); bglBindTexture(GL_TEXTURE_2D, plane->glpic);
if (plane->vbo && (pr_vbos > 0)) { if (plane->vbo && (pr_vbos > 0))
{
OMGDRAWSHITVBO; OMGDRAWSHITVBO;
} else { }
else
{
OMGDRAWSHIT; OMGDRAWSHIT;
} }
@ -1213,7 +1219,8 @@ finish:
if (needfloor) if (needfloor)
{ {
polymer_buildfloor(sectnum); polymer_buildfloor(sectnum);
if ((pr_vbos > 0)) { if ((pr_vbos > 0))
{
if (s->oldindicescount < s->indicescount) if (s->oldindicescount < s->indicescount)
{ {
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->floor.ivbo); bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, s->floor.ivbo);
@ -1520,7 +1527,7 @@ static void polymer_updatewall(short wallnum)
w->wall.fbglpic = 0; w->wall.fbglpic = 0;
w->wall.color[0] = w->wall.color[1] = w->wall.color[2] = w->wall.color[0] = w->wall.color[1] = w->wall.color[2] =
((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups);
w->wall.color[3] = 1.0f; w->wall.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
@ -1576,9 +1583,9 @@ static void polymer_updatewall(short wallnum)
nnwallnum = wall[nwallnum].point2; nnwallnum = wall[nwallnum].point2;
if (((s->floor.buffer[((wallnum - sec->wallptr) * 5) + 1] != ns->floor.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || if (((s->floor.buffer[((wallnum - sec->wallptr) * 5) + 1] != ns->floor.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) ||
(s->floor.buffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floor.buffer[((nwallnum - nsec->wallptr) * 5) + 1])) && (s->floor.buffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->floor.buffer[((nwallnum - nsec->wallptr) * 5) + 1])) &&
((s->floor.buffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floor.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || ((s->floor.buffer[((wallnum - sec->wallptr) * 5) + 1] <= ns->floor.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) ||
(s->floor.buffer[((wal->point2 - sec->wallptr) * 5) + 1] <= ns->floor.buffer[((nwallnum - nsec->wallptr) * 5) + 1]))) (s->floor.buffer[((wal->point2 - sec->wallptr) * 5) + 1] <= ns->floor.buffer[((nwallnum - nsec->wallptr) * 5) + 1])))
underwall = 1; underwall = 1;
if ((underwall) || (wal->cstat & 16)) if ((underwall) || (wal->cstat & 16))
@ -1617,7 +1624,7 @@ static void polymer_updatewall(short wallnum)
w->wall.fbglpic = 0; w->wall.fbglpic = 0;
w->wall.color[0] = w->wall.color[1] = w->wall.color[2] = w->wall.color[0] = w->wall.color[1] = w->wall.color[2] =
((float)(numpalookups-min(max(curshade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(curshade,0),numpalookups)))/((float)numpalookups);
w->wall.color[3] = 1.0f; w->wall.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != curpal)) if (pth && (pth->flags & 2) && (pth->palnum != curpal))
@ -1674,9 +1681,9 @@ static void polymer_updatewall(short wallnum)
} }
if (((s->ceil.buffer[((wallnum - sec->wallptr) * 5) + 1] != ns->ceil.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || if (((s->ceil.buffer[((wallnum - sec->wallptr) * 5) + 1] != ns->ceil.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) ||
(s->ceil.buffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1])) && (s->ceil.buffer[((wal->point2 - sec->wallptr) * 5) + 1] != ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1])) &&
((s->ceil.buffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceil.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) || ((s->ceil.buffer[((wallnum - sec->wallptr) * 5) + 1] >= ns->ceil.buffer[((nnwallnum - nsec->wallptr) * 5) + 1]) ||
(s->ceil.buffer[((wal->point2 - sec->wallptr) * 5) + 1] >= ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1]))) (s->ceil.buffer[((wal->point2 - sec->wallptr) * 5) + 1] >= ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1])))
overwall = 1; overwall = 1;
if ((overwall) || (wal->cstat & 16)) if ((overwall) || (wal->cstat & 16))
@ -1707,7 +1714,7 @@ static void polymer_updatewall(short wallnum)
w->mask.glpic = pth ? pth->glpic : 0; w->mask.glpic = pth ? pth->glpic : 0;
w->mask.color[0] = w->mask.color[1] = w->mask.color[2] = w->mask.color[0] = w->mask.color[1] = w->mask.color[2] =
((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups);
w->mask.color[3] = 1.0f; w->mask.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
@ -1736,7 +1743,7 @@ static void polymer_updatewall(short wallnum)
w->over.fbglpic = 0; w->over.fbglpic = 0;
w->over.color[0] = w->over.color[1] = w->over.color[2] = w->over.color[0] = w->over.color[1] = w->over.color[2] =
((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups); ((float)(numpalookups-min(max(wal->shade,0),numpalookups)))/((float)numpalookups);
w->over.color[3] = 1.0f; w->over.color[3] = 1.0f;
if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) if (pth && (pth->flags & 2) && (pth->palnum != wal->pal))
@ -2199,7 +2206,9 @@ static void polymer_drawmdsprite(spritetype *tspr)
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
} else { }
else
{
bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), v0); bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), v0);
bglTexCoordPointer(2, GL_FLOAT, 0, s->uv); bglTexCoordPointer(2, GL_FLOAT, 0, s->uv);
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris); bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris);

View file

@ -138,7 +138,7 @@ static char *Help3d[]=
" ' D = CYCLE SPRITE SKILL DISPLAY", " ' D = CYCLE SPRITE SKILL DISPLAY",
" ' R = TOGGLE FRAMERATE DISPLAY", " ' R = TOGGLE FRAMERATE DISPLAY",
" ' W = TOGGLE SPRITE DISPLAY", " ' W = TOGGLE SPRITE DISPLAY",
" ' X = SPRITE SHADE PREVIEW", " ' X = MAP SHADE PREVIEW",
" ' Y = TOGGLE PURPLE BACKGROUND", " ' Y = TOGGLE PURPLE BACKGROUND",
"", "",
" ' T = CHANGE LOTAG", " ' T = CHANGE LOTAG",
@ -4256,8 +4256,8 @@ static void Keys3d(void)
{ {
keystatus[KEYSC_X] = 0; keystatus[KEYSC_X] = 0;
shadepreview=!shadepreview; shadepreview=!shadepreview;
if (shadepreview) message("Sprite shade preview ON"); if (shadepreview) message("Map shade preview ON");
else message("Sprite shade preview OFF"); else message("Map shade preview OFF");
} }
@ -7405,10 +7405,70 @@ void ExtUnInit(void)
} }
} }
static char wallshades[MAXWALLS];
static char sectorshades[MAXSECTORS][2];
static char spriteshades[MAXSPRITES];
static char wallpals[MAXWALLS];
static char sectorpals[MAXSECTORS][2];
static char spritepals[MAXSPRITES];
static char wallflag[MAXWALLS];
void ExtPreCheckKeys(void) // just before drawrooms void ExtPreCheckKeys(void) // just before drawrooms
{ {
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode
{ {
if (shadepreview)
{
int i = 0;
for (i=0;i<numsprites;i++)
if (sprite[i].picnum == SECTOREFFECTOR && (sprite[i].lotag == 12 || sprite[i].lotag == 3))
{
int w;
int start_wall = sector[sprite[i].sectnum].wallptr;
int end_wall = start_wall + sector[sprite[i].sectnum].wallnum;
for (w = start_wall; w < end_wall; w++)
{
if (!wallflag[w])
{
wallshades[w] = wall[w].shade;
wall[w].shade = sprite[i].shade;
wallpals[w] = wall[w].pal;
wall[w].pal = sprite[i].pal;
wallflag[w] = 1;
}
if (wall[w].nextwall >= 0)
{
if (!wallflag[wall[w].nextwall])
{
wallshades[wall[w].nextwall] = wall[wall[w].nextwall].shade;
wall[wall[w].nextwall].shade = sprite[i].shade;
wallpals[wall[w].nextwall] = wall[wall[w].nextwall].pal;
wall[wall[w].nextwall].pal = sprite[i].pal;
wallflag[wall[w].nextwall] = 1;
}
}
}
sectorshades[sprite[i].sectnum][0] = sector[sprite[i].sectnum].floorshade;
sectorshades[sprite[i].sectnum][1] = sector[sprite[i].sectnum].ceilingshade;
sector[sprite[i].sectnum].floorshade = sprite[i].shade;
sector[sprite[i].sectnum].ceilingshade = sprite[i].shade;
sectorpals[sprite[i].sectnum][0] = sector[sprite[i].sectnum].floorpal;
sectorpals[sprite[i].sectnum][1] = sector[sprite[i].sectnum].ceilingpal;
sector[sprite[i].sectnum].floorpal = sprite[i].pal;
sector[sprite[i].sectnum].ceilingpal = sprite[i].pal;
w = headspritesect[sprite[i].sectnum];
while (w >= 0)
{
if (w == i) { w = nextspritesect[w]; continue; }
spriteshades[w] = sprite[w].shade;
sprite[w].shade = sprite[i].shade;
spritepals[w] = sprite[w].pal;
sprite[w].pal = sprite[i].pal;
w = nextspritesect[w];
}
}
}
if (floor_over_floor) SE40Code(posx,posy,posz,ang,horiz); if (floor_over_floor) SE40Code(posx,posy,posz,ang,horiz);
if (purpleon) clearview(255); if (purpleon) clearview(255);
if (sidemode != 0) if (sidemode != 0)
@ -7749,6 +7809,52 @@ static void Keys2d3d(void)
void ExtCheckKeys(void) void ExtCheckKeys(void)
{ {
if (qsetmode == 200)
{
if (shadepreview)
{
int i = 0;
for (i=0;i<numsprites;i++)
if (sprite[i].picnum == SECTOREFFECTOR && (sprite[i].lotag == 12 || sprite[i].lotag == 3))
{
int w;
int start_wall = sector[sprite[i].sectnum].wallptr;
int end_wall = start_wall + sector[sprite[i].sectnum].wallnum;
for (w = start_wall; w < end_wall; w++)
{
if (wallflag[w])
{
wall[w].shade = wallshades[w];
wall[w].pal = wallpals[w];
wallflag[w] = 0;
}
if (wall[w].nextwall >= 0)
{
if (wallflag[wall[w].nextwall])
{
wall[wall[w].nextwall].shade = wallshades[wall[w].nextwall];
wall[wall[w].nextwall].pal = wallpals[wall[w].nextwall];
wallflag[wall[w].nextwall] = 0;
}
}
}
sector[sprite[i].sectnum].floorshade = sectorshades[sprite[i].sectnum][0];
sector[sprite[i].sectnum].ceilingshade = sectorshades[sprite[i].sectnum][1];
sector[sprite[i].sectnum].floorpal = sectorpals[sprite[i].sectnum][0];
sector[sprite[i].sectnum].ceilingpal = sectorpals[sprite[i].sectnum][1];
w = headspritesect[sprite[i].sectnum];
while (w >= 0)
{
if (w == i) { w = nextspritesect[w]; continue; }
sprite[w].shade = spriteshades[w];
sprite[w].pal = spritepals[w];
w = nextspritesect[w];
}
}
}
}
readmousebstatus(&bstatus); readmousebstatus(&bstatus);
Keys2d3d(); Keys2d3d();
if (qsetmode == 200) //In 3D mode if (qsetmode == 200) //In 3D mode

View file

@ -12709,7 +12709,7 @@ FRAGBONUS:
} }
} }
else break; else break;
OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
nextpage(); nextpage();
} }
} }

View file

@ -1162,10 +1162,10 @@ static int CheckEventSync(int iEventID)
case EVENT_CHEATGETFIRSTAID: case EVENT_CHEATGETFIRSTAID:
case EVENT_DISPLAYCROSSHAIR: case EVENT_DISPLAYCROSSHAIR:
case EVENT_DISPLAYREST: case EVENT_DISPLAYREST:
case EVENT_DISPLAYBONUSSCREEN: case EVENT_DISPLAYBONUSSCREEN:
case EVENT_DISPLAYMENU: case EVENT_DISPLAYMENU:
case EVENT_DISPLAYMENUREST: case EVENT_DISPLAYMENUREST:
case EVENT_DISPLAYLOADINGSCREEN: case EVENT_DISPLAYLOADINGSCREEN:
case EVENT_DISPLAYROOMS: case EVENT_DISPLAYROOMS:
case EVENT_DISPLAYSBAR: case EVENT_DISPLAYSBAR:
case EVENT_DISPLAYWEAPON: case EVENT_DISPLAYWEAPON:
@ -3111,25 +3111,25 @@ static int parsecommand(void)
} }
textptr++; textptr++;
if (scriptptr[-1] == g_iThisActorID) // convert to "setvarvar" if (scriptptr[-1] == g_iThisActorID) // convert to "setvarvar"
{ {
scriptptr--; scriptptr--;
scriptptr[-1]=CON_SETVARVAR; scriptptr[-1]=CON_SETVARVAR;
if (tw == CON_SETACTORVAR || tw == CON_SETPLAYERVAR) if (tw == CON_SETACTORVAR || tw == CON_SETPLAYERVAR)
{ {
transvartype(GAMEVAR_FLAG_READONLY); transvartype(GAMEVAR_FLAG_READONLY);
transvar(); transvar();
} }
else else
{ {
scriptptr++; scriptptr++;
transvar(); transvar();
scriptptr-=2; scriptptr-=2;
transvartype(GAMEVAR_FLAG_READONLY); transvartype(GAMEVAR_FLAG_READONLY);
scriptptr++; scriptptr++;
} }
break; break;
} }
/// now pointing at 'xxx' /// now pointing at 'xxx'
@ -4890,10 +4890,10 @@ static void AddDefaultDefinitions(void)
AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE); AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE);
AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE);

View file

@ -2143,14 +2143,14 @@ static void DoPlayer(int iSet, int lVar1, int lLabelID, int lVar2, int lParm2)
SetGameVarID(lVar2, g_player[iPlayer].ps->on_ground, g_i, g_p); SetGameVarID(lVar2, g_player[iPlayer].ps->on_ground, g_i, g_p);
return; return;
/* case PLAYER_NAME: /* case PLAYER_NAME:
if (iSet) if (iSet)
{ {
g_player[iPlayer].ps->name[32]=lValue; g_player[iPlayer].ps->name[32]=lValue;
return; return;
} }
SetGameVarID(lVar2, g_player[iPlayer].ps->name[32], g_i, g_p); SetGameVarID(lVar2, g_player[iPlayer].ps->name[32], g_i, g_p);
return;*/ return;*/
case PLAYER_INVEN_ICON: case PLAYER_INVEN_ICON:
if (iSet) if (iSet)

View file

@ -612,7 +612,7 @@ void menus(void)
walock[TILE_LOADSHOT] = 1; walock[TILE_LOADSHOT] = 1;
return; return;
} }
OnEvent(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, -1); OnEvent(EVENT_DISPLAYMENU, g_player[screenpeek].ps->i, screenpeek, -1);
g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE); g_player[myconnectindex].ps->gm &= (0xff-MODE_TYPE);
g_player[myconnectindex].ps->fta = 0; g_player[myconnectindex].ps->fta = 0;
@ -5041,7 +5041,7 @@ VOLUME_ALL_40x:
break; break;
} }
OnEvent(EVENT_DISPLAYMENUREST, g_player[screenpeek].ps->i, screenpeek, -1); OnEvent(EVENT_DISPLAYMENUREST, g_player[screenpeek].ps->i, screenpeek, -1);
if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) if ((g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU)
{ {

View file

@ -361,7 +361,7 @@ static void dofrontscreens(char *statustext)
if (statustext) gametext(160,180,statustext,0,2+8+16); if (statustext) gametext(160,180,statustext,0,2+8+16);
OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
nextpage(); nextpage();
if (!statustext) if (!statustext)
@ -392,7 +392,7 @@ static void dofrontscreens(char *statustext)
} }
menutext(160,105,0,0,"LOADING..."); menutext(160,105,0,0,"LOADING...");
if (statustext) gametext(160,180,statustext,0,2+8+16); if (statustext) gametext(160,180,statustext,0,2+8+16);
OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); OnEvent(EVENT_DISPLAYLOADINGSCREEN, g_player[screenpeek].ps->i, screenpeek, -1);
nextpage(); nextpage();
} }
} }