From 97f98dcdfca1fc9a944ece4debe19dfda2b950f3 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 5 Jun 2008 02:29:18 +0000 Subject: [PATCH] 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 --- polymer/build/src/config.c | 12 +- polymer/build/src/engine.c | 12 +- polymer/build/src/kplib.c | 2 +- polymer/build/src/lzf_c.c | 238 +++++++++++++++--------------- polymer/build/src/lzf_d.c | 104 ++++++------- polymer/build/src/mdsprite.c | 6 +- polymer/build/src/polymer.c | 45 +++--- polymer/eduke32/source/astub.c | 112 +++++++++++++- polymer/eduke32/source/game.c | 2 +- polymer/eduke32/source/gamedef.c | 54 +++---- polymer/eduke32/source/gameexec.c | 16 +- polymer/eduke32/source/menus.c | 4 +- polymer/eduke32/source/premap.c | 4 +- 13 files changed, 364 insertions(+), 247 deletions(-) diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c index 457e296c0..b06a448d1 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -213,8 +213,8 @@ int loadsetup(const char *fn) 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, "autosavesec", val, VL) > 0) autosave = Batoi(val); + if (readconfig(fp, "autosave", val, VL) > 0) autosave = Batoi(val)*60; + if (readconfig(fp, "autosavesec", val, VL) > 0) autosave = Batoi(val); for (i=0;i<256;i++)remap[i]=i; remapinit=1; @@ -343,9 +343,9 @@ int writesetup(const char *fn) "; Turning deceleration\n" "turndecel = %d\n" "\n" - "; Autosave map interval (seconds)\n" - "autosavesec = %d\n" - "\n" + "; Autosave map interval (seconds)\n" + "autosavesec = %d\n" + "\n" #if 1 "; Key Settings\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], #endif option[3], msens, unrealedlook, pk_uedaccel, quickmapcycling, - revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave, + revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave, #if 1 keys[0], keys[1], keys[2], keys[3], keys[4], keys[5], keys[6], keys[7], keys[8], keys[9], keys[10], keys[11], diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index e611f5ffb..5e5184664 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -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) { - 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; } } @@ -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) return(-1); - for (j=0;jMAXSTATUS) - { - 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); - } + for (j=0;jMAXSTATUS) + { + 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); + } numsprites = 0; for (j=0;j - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO @@ -96,194 +96,194 @@ */ unsigned int -lzf_compress (const void *const in_data, unsigned int in_len, - void *out_data, unsigned int out_len +lzf_compress(const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len #if LZF_STATE_ARG - , LZF_STATE htab + , LZF_STATE htab #endif - ) + ) { #if !LZF_STATE_ARG - LZF_STATE htab; + LZF_STATE htab; #endif - const u8 **hslot; - const u8 *ip = (const u8 *)in_data; - u8 *op = (u8 *)out_data; - const u8 *in_end = ip + in_len; - u8 *out_end = op + out_len; - const u8 *ref; + const u8 **hslot; + const u8 *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; + const u8 *in_end = ip + in_len; + u8 *out_end = op + out_len; + const u8 *ref; - /* 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 - * 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 - * and fails to support both assumptions is windows 64 bit, we make a - * special workaround for it. - */ + /* 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 + * 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 + * and fails to support both assumptions is windows 64 bit, we make a + * special workaround for it. + */ #if defined (WIN32) && defined (_M_X64) - unsigned _int64 off; /* workaround for missing POSIX compliance */ + unsigned _int64 off; /* workaround for missing POSIX compliance */ #else - unsigned long off; + unsigned long off; #endif - unsigned int hval; - int lit; + unsigned int hval; + int lit; - if (!in_len || !out_len) - return 0; + if (!in_len || !out_len) + return 0; #if INIT_HTAB - memset (htab, 0, sizeof (htab)); + memset(htab, 0, sizeof(htab)); # if 0 - for (hslot = htab; hslot < htab + HSIZE; hslot++) - *hslot++ = ip; + for (hslot = htab; hslot < htab + HSIZE; hslot++) + *hslot++ = ip; # endif #endif - lit = 0; op++; /* start run */ + lit = 0; op++; /* start run */ - hval = FRST (ip); - while (ip < in_end - 2) + hval = FRST(ip); + while (ip < in_end - 2) { - hval = NEXT (hval, ip); - hslot = htab + IDX (hval); - ref = *hslot; *hslot = ip; + hval = NEXT(hval, ip); + hslot = htab + IDX(hval); + ref = *hslot; *hslot = ip; - if (1 + if (1 #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 - && (off = ip - ref - 1) < MAX_OFF - && ip + 4 < in_end - && ref > (u8 *)in_data + && (off = ip - ref - 1) < MAX_OFF + && ip + 4 < in_end + && ref > (u8 *)in_data #if STRICT_ALIGN - && ref[0] == ip[0] - && ref[1] == ip[1] - && ref[2] == ip[2] + && ref[0] == ip[0] + && ref[1] == ip[1] + && ref[2] == ip[2] #else - && *(u16 *)ref == *(u16 *)ip - && ref[2] == ip[2] + && *(u16 *)ref == *(u16 *)ip + && ref[2] == ip[2] #endif - ) + ) { - /* match found at *ref++ */ - unsigned int len = 2; - unsigned int maxlen = in_end - ip - len; - maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; + /* match found at *ref++ */ + unsigned int len = 2; + unsigned int maxlen = in_end - ip - len; + maxlen = maxlen > MAX_REF ? MAX_REF : maxlen; - op [- lit - 1] = lit - 1; /* stop run */ - op -= !lit; /* undo run if length is zero */ + op [- lit - 1] = lit - 1; /* stop run */ + op -= !lit; /* undo run if length is zero */ - if (expect_false (op + 3 + 1 >= out_end)) - return 0; + if (expect_false(op + 3 + 1 >= out_end)) + 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 - len++; - while (len < maxlen && ref[len] == ip[len]); + do + len++; + while (len < maxlen && ref[len] == ip[len]); - break; + break; } - len -= 2; - ip++; + len -= 2; + 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++ = len - 7; + *op++ = (off >> 8) + (7 << 5); + *op++ = len - 7; } - *op++ = off; + *op++ = off; #if ULTRA_FAST || VERY_FAST - ip += len; + ip += len; #if VERY_FAST && !ULTRA_FAST - --ip; + --ip; #endif - hval = FRST (ip); + hval = FRST(ip); - hval = NEXT (hval, ip); - htab[IDX (hval)] = ip; - ip++; + hval = NEXT(hval, ip); + htab[IDX(hval)] = ip; + ip++; #if VERY_FAST && !ULTRA_FAST - hval = NEXT (hval, ip); - htab[IDX (hval)] = ip; - ip++; + hval = NEXT(hval, ip); + htab[IDX(hval)] = ip; + ip++; #endif #else - do + do { - hval = NEXT (hval, ip); - htab[IDX (hval)] = ip; - ip++; + hval = NEXT(hval, ip); + htab[IDX(hval)] = ip; + ip++; } - while (len--); + while (len--); #endif - lit = 0; op++; /* start run */ + lit = 0; op++; /* start run */ } - else + else { - /* one more literal byte we must copy */ - if (expect_false (op >= out_end)) - return 0; + /* one more literal byte we must copy */ + if (expect_false(op >= out_end)) + 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 */ - lit = 0; op++; /* start run */ + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ } } } - if (op + 3 > out_end) /* at most 3 bytes can be missing here */ - return 0; + if (op + 3 > out_end) /* at most 3 bytes can be missing here */ + 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 */ - lit = 0; op++; /* start run */ + op [- lit - 1] = lit - 1; /* stop run */ + lit = 0; op++; /* start run */ } } - op [- lit - 1] = lit - 1; /* end run */ - op -= !lit; /* undo run if length is zero */ + op [- lit - 1] = lit - 1; /* end run */ + op -= !lit; /* undo run if length is zero */ - return op - (u8 *)out_data; + return op - (u8 *)out_data; } diff --git a/polymer/build/src/lzf_d.c b/polymer/build/src/lzf_d.c index 9e2cd829c..6c4efce99 100644 --- a/polymer/build/src/lzf_d.c +++ b/polymer/build/src/lzf_d.c @@ -1,16 +1,16 @@ /* * Copyright (c) 2000-2007 Marc Alexander Lehmann - * + * * Redistribution and use in source and binary forms, with or without modifica- * tion, are permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO @@ -50,99 +50,99 @@ : "0" (dst), "1" (src), "2" (len)); #endif -unsigned int -lzf_decompress (const void *const in_data, unsigned int in_len, - void *out_data, unsigned int out_len) +unsigned int +lzf_decompress(const void *const in_data, unsigned int in_len, + void *out_data, unsigned int out_len) { - u8 const *ip = (const u8 *)in_data; - u8 *op = (u8 *)out_data; - u8 const *const in_end = ip + in_len; - u8 *const out_end = op + out_len; + u8 const *ip = (const u8 *)in_data; + u8 *op = (u8 *)out_data; + u8 const *const in_end = ip + in_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); - return 0; + SET_ERRNO(E2BIG); + return 0; } #if CHECK_INPUT - if (ip + ctrl > in_end) + if (ip + ctrl > in_end) { - SET_ERRNO (EINVAL); - return 0; + SET_ERRNO(EINVAL); + return 0; } #endif #ifdef lzf_movsb - lzf_movsb (op, ip, ctrl); + lzf_movsb(op, ip, ctrl); #else - do - *op++ = *ip++; - while (--ctrl); + do + *op++ = *ip++; + while (--ctrl); #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 (ip >= in_end) + if (ip >= in_end) { - SET_ERRNO (EINVAL); - return 0; + SET_ERRNO(EINVAL); + return 0; } #endif - if (len == 7) + if (len == 7) { - len += *ip++; + len += *ip++; #if CHECK_INPUT - if (ip >= in_end) + if (ip >= in_end) { - SET_ERRNO (EINVAL); - return 0; + SET_ERRNO(EINVAL); + return 0; } #endif } - ref -= *ip++; + ref -= *ip++; - if (op + len + 2 > out_end) + if (op + len + 2 > out_end) { - SET_ERRNO (E2BIG); - return 0; + SET_ERRNO(E2BIG); + return 0; } - if (ref < (u8 *)out_data) + if (ref < (u8 *)out_data) { - SET_ERRNO (EINVAL); - return 0; + SET_ERRNO(EINVAL); + return 0; } #ifdef lzf_movsb - len += 2; - lzf_movsb (op, ref, len); + len += 2; + lzf_movsb(op, ref, len); #else - *op++ = *ref++; - *op++ = *ref++; - - do *op++ = *ref++; - while (--len); + *op++ = *ref++; + + do + *op++ = *ref++; + while (--len); #endif } } - while (ip < in_end); + while (ip < in_end); - return op - (u8 *)out_data; + return op - (u8 *)out_data; } diff --git a/polymer/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index 4f6cff905..3d65997d8 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -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].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]; - } 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].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; @@ -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); 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[1] *= (float)hictinting[globalpal].g / 255.0; diff --git a/polymer/build/src/polymer.c b/polymer/build/src/polymer.c index 5faa0e72a..b70de81ae 100644 --- a/polymer/build/src/polymer.c +++ b/polymer/build/src/polymer.c @@ -368,8 +368,8 @@ void polymer_drawsprite(int snum) pth = gltexcache(curpicnum, tspr->pal, 0); spriteplane.color[0] = - spriteplane.color[1] = - spriteplane.color[2] = ((float)(numpalookups-min(max(tspr->shade,0),numpalookups)))/((float)numpalookups); + spriteplane.color[1] = + spriteplane.color[2] = ((float)(numpalookups-min(max(tspr->shade,0),numpalookups)))/((float)numpalookups); 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); bglStencilFunc(GL_EQUAL, 0, 0xffffffff); - if (plane->vbo && (pr_vbos > 0)) { + if (plane->vbo && (pr_vbos > 0)) + { OMGDRAWSHITVBO; - } else { + } + else + { 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]); bglBindTexture(GL_TEXTURE_2D, plane->glpic); - if (plane->vbo && (pr_vbos > 0)) { + if (plane->vbo && (pr_vbos > 0)) + { OMGDRAWSHITVBO; - } else { + } + else + { OMGDRAWSHIT; } @@ -1213,7 +1219,8 @@ finish: if (needfloor) { polymer_buildfloor(sectnum); - if ((pr_vbos > 0)) { + if ((pr_vbos > 0)) + { if (s->oldindicescount < s->indicescount) { 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.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; if (pth && (pth->flags & 2) && (pth->palnum != wal->pal)) @@ -1576,9 +1583,9 @@ static void polymer_updatewall(short wallnum) nnwallnum = wall[nwallnum].point2; 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[((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[((wal->point2 - sec->wallptr) * 5) + 1] <= ns->floor.buffer[((nwallnum - nsec->wallptr) * 5) + 1]))) underwall = 1; if ((underwall) || (wal->cstat & 16)) @@ -1617,7 +1624,7 @@ static void polymer_updatewall(short wallnum) w->wall.fbglpic = 0; 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; 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]) || - (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[((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[((wal->point2 - sec->wallptr) * 5) + 1] >= ns->ceil.buffer[((nwallnum - nsec->wallptr) * 5) + 1]))) overwall = 1; if ((overwall) || (wal->cstat & 16)) @@ -1707,7 +1714,7 @@ static void polymer_updatewall(short wallnum) w->mask.glpic = pth ? pth->glpic : 0; 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; 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.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; 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_ARRAY_BUFFER_ARB, 0); - } else { + } + else + { bglVertexPointer(3, GL_SHORT, sizeof(md3xyzn_t), v0); bglTexCoordPointer(2, GL_FLOAT, 0, s->uv); bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_INT, s->tris); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index db5ed27a4..c8d82be93 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -138,7 +138,7 @@ static char *Help3d[]= " ' D = CYCLE SPRITE SKILL DISPLAY", " ' R = TOGGLE FRAMERATE DISPLAY", " ' W = TOGGLE SPRITE DISPLAY", - " ' X = SPRITE SHADE PREVIEW", + " ' X = MAP SHADE PREVIEW", " ' Y = TOGGLE PURPLE BACKGROUND", "", " ' T = CHANGE LOTAG", @@ -4256,8 +4256,8 @@ static void Keys3d(void) { keystatus[KEYSC_X] = 0; shadepreview=!shadepreview; - if (shadepreview) message("Sprite shade preview ON"); - else message("Sprite shade preview OFF"); + if (shadepreview) message("Map shade preview ON"); + 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 { if (qsetmode == 200) //In 3D mode { + if (shadepreview) + { + int i = 0; + for (i=0;i= 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 (purpleon) clearview(255); if (sidemode != 0) @@ -7749,6 +7809,52 @@ static void Keys2d3d(void) void ExtCheckKeys(void) { + if (qsetmode == 200) + { + if (shadepreview) + { + int i = 0; + for (i=0;i= 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); Keys2d3d(); if (qsetmode == 200) //In 3D mode diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index d0b2a8d06..e657cbc3a 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -12709,7 +12709,7 @@ FRAGBONUS: } } else break; - OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); + OnEvent(EVENT_DISPLAYBONUSSCREEN, g_player[screenpeek].ps->i, screenpeek, -1); nextpage(); } } diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 7a7cf361b..557138a9d 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1162,10 +1162,10 @@ static int CheckEventSync(int iEventID) case EVENT_CHEATGETFIRSTAID: case EVENT_DISPLAYCROSSHAIR: case EVENT_DISPLAYREST: - case EVENT_DISPLAYBONUSSCREEN: - case EVENT_DISPLAYMENU: - case EVENT_DISPLAYMENUREST: - case EVENT_DISPLAYLOADINGSCREEN: + case EVENT_DISPLAYBONUSSCREEN: + case EVENT_DISPLAYMENU: + case EVENT_DISPLAYMENUREST: + case EVENT_DISPLAYLOADINGSCREEN: case EVENT_DISPLAYROOMS: case EVENT_DISPLAYSBAR: case EVENT_DISPLAYWEAPON: @@ -3111,25 +3111,25 @@ static int parsecommand(void) } textptr++; - if (scriptptr[-1] == g_iThisActorID) // convert to "setvarvar" - { - scriptptr--; - scriptptr[-1]=CON_SETVARVAR; - if (tw == CON_SETACTORVAR || tw == CON_SETPLAYERVAR) - { - transvartype(GAMEVAR_FLAG_READONLY); - transvar(); - } - else - { - scriptptr++; - transvar(); - scriptptr-=2; - transvartype(GAMEVAR_FLAG_READONLY); - scriptptr++; - } - break; - } + if (scriptptr[-1] == g_iThisActorID) // convert to "setvarvar" + { + scriptptr--; + scriptptr[-1]=CON_SETVARVAR; + if (tw == CON_SETACTORVAR || tw == CON_SETPLAYERVAR) + { + transvartype(GAMEVAR_FLAG_READONLY); + transvar(); + } + else + { + scriptptr++; + transvar(); + scriptptr-=2; + transvartype(GAMEVAR_FLAG_READONLY); + scriptptr++; + } + break; + } /// now pointing at 'xxx' @@ -4890,10 +4890,10 @@ static void AddDefaultDefinitions(void) AddDefinition("EVENT_CROUCH",EVENT_CROUCH,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYCROSSHAIR",EVENT_DISPLAYCROSSHAIR,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYREST",EVENT_DISPLAYREST,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); - AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); + AddDefinition("EVENT_DISPLAYBONUSSCREEN",EVENT_DISPLAYBONUSSCREEN,LABEL_DEFINE); + AddDefinition("EVENT_DISPLAYMENU",EVENT_DISPLAYMENU,LABEL_DEFINE); + AddDefinition("EVENT_DISPLAYMENUREST",EVENT_DISPLAYMENUREST,LABEL_DEFINE); + AddDefinition("EVENT_DISPLAYLOADINGSCREEN",EVENT_DISPLAYLOADINGSCREEN,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYROOMS",EVENT_DISPLAYROOMS,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYSBAR",EVENT_DISPLAYSBAR,LABEL_DEFINE); AddDefinition("EVENT_DISPLAYWEAPON",EVENT_DISPLAYWEAPON,LABEL_DEFINE); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 4a3a92aa3..2988a3813 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -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); return; -/* case PLAYER_NAME: - if (iSet) - { - g_player[iPlayer].ps->name[32]=lValue; - return; - } - SetGameVarID(lVar2, g_player[iPlayer].ps->name[32], g_i, g_p); - return;*/ + /* case PLAYER_NAME: + if (iSet) + { + g_player[iPlayer].ps->name[32]=lValue; + return; + } + SetGameVarID(lVar2, g_player[iPlayer].ps->name[32], g_i, g_p); + return;*/ case PLAYER_INVEN_ICON: if (iSet) diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index d9768f342..4d2ac9952 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -612,7 +612,7 @@ void menus(void) walock[TILE_LOADSHOT] = 1; 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->fta = 0; @@ -5041,7 +5041,7 @@ VOLUME_ALL_40x: 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) { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 5866db204..6e33f7c8e 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -361,7 +361,7 @@ static void dofrontscreens(char *statustext) 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(); if (!statustext) @@ -392,7 +392,7 @@ static void dofrontscreens(char *statustext) } menutext(160,105,0,0,"LOADING..."); 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(); } }