mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
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:
parent
0602988743
commit
97f98dcdfc
13 changed files with 364 additions and 247 deletions
|
@ -7594,7 +7594,7 @@ 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;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);
|
||||
changespritestat(j,0);
|
||||
|
|
|
@ -1960,7 +1960,7 @@ static int kgifrend(const char *kfilebuf, int kfilelength,
|
|||
int lzcols, dat, blocklen, bitcnt, xoff, transcol, backcol, *lptr;
|
||||
char numbits, startnumbits, chunkind, ilacefirst;
|
||||
const unsigned char *ptr, *cptr = 0;
|
||||
intptr_t yoff;
|
||||
intptr_t yoff;
|
||||
UNREFERENCED_PARAMETER(kfilelength);
|
||||
|
||||
coltype = 3; bitdepth = 8; //For PNGOUT
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
*/
|
||||
|
||||
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
|
||||
#if LZF_STATE_ARG
|
||||
, LZF_STATE htab
|
||||
|
@ -132,7 +132,7 @@ lzf_compress (const void *const in_data, unsigned int in_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;
|
||||
|
@ -141,11 +141,11 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||
|
||||
lit = 0; op++; /* start run */
|
||||
|
||||
hval = FRST (ip);
|
||||
hval = FRST(ip);
|
||||
while (ip < in_end - 2)
|
||||
{
|
||||
hval = NEXT (hval, ip);
|
||||
hslot = htab + IDX (hval);
|
||||
hval = NEXT(hval, ip);
|
||||
hslot = htab + IDX(hval);
|
||||
ref = *hslot; *hslot = ip;
|
||||
|
||||
if (1
|
||||
|
@ -173,12 +173,12 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||
op [- lit - 1] = lit - 1; /* stop run */
|
||||
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;
|
||||
|
||||
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;
|
||||
|
@ -217,7 +217,7 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||
}
|
||||
else
|
||||
{
|
||||
*op++ = (off >> 8) + ( 7 << 5);
|
||||
*op++ = (off >> 8) + (7 << 5);
|
||||
*op++ = len - 7;
|
||||
}
|
||||
|
||||
|
@ -228,22 +228,22 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||
#if VERY_FAST && !ULTRA_FAST
|
||||
--ip;
|
||||
#endif
|
||||
hval = FRST (ip);
|
||||
hval = FRST(ip);
|
||||
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
hval = NEXT(hval, ip);
|
||||
htab[IDX(hval)] = ip;
|
||||
ip++;
|
||||
|
||||
#if VERY_FAST && !ULTRA_FAST
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
hval = NEXT(hval, ip);
|
||||
htab[IDX(hval)] = ip;
|
||||
ip++;
|
||||
#endif
|
||||
#else
|
||||
do
|
||||
{
|
||||
hval = NEXT (hval, ip);
|
||||
htab[IDX (hval)] = ip;
|
||||
hval = NEXT(hval, ip);
|
||||
htab[IDX(hval)] = ip;
|
||||
ip++;
|
||||
}
|
||||
while (len--);
|
||||
|
@ -254,12 +254,12 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||
else
|
||||
{
|
||||
/* one more literal byte we must copy */
|
||||
if (expect_false (op >= out_end))
|
||||
if (expect_false(op >= out_end))
|
||||
return 0;
|
||||
|
||||
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 */
|
||||
|
@ -274,7 +274,7 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||
{
|
||||
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 */
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#endif
|
||||
|
||||
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)
|
||||
{
|
||||
u8 const *ip = (const u8 *)in_data;
|
||||
|
@ -69,20 +69,20 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
|
|||
|
||||
if (op + ctrl > out_end)
|
||||
{
|
||||
SET_ERRNO (E2BIG);
|
||||
SET_ERRNO(E2BIG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CHECK_INPUT
|
||||
if (ip + ctrl > in_end)
|
||||
{
|
||||
SET_ERRNO (EINVAL);
|
||||
SET_ERRNO(EINVAL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef lzf_movsb
|
||||
lzf_movsb (op, ip, ctrl);
|
||||
lzf_movsb(op, ip, ctrl);
|
||||
#else
|
||||
do
|
||||
*op++ = *ip++;
|
||||
|
@ -98,7 +98,7 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
|
|||
#if CHECK_INPUT
|
||||
if (ip >= in_end)
|
||||
{
|
||||
SET_ERRNO (EINVAL);
|
||||
SET_ERRNO(EINVAL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -108,7 +108,7 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
|
|||
#if CHECK_INPUT
|
||||
if (ip >= in_end)
|
||||
{
|
||||
SET_ERRNO (EINVAL);
|
||||
SET_ERRNO(EINVAL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -118,19 +118,19 @@ lzf_decompress (const void *const in_data, unsigned int in_len,
|
|||
|
||||
if (op + len + 2 > out_end)
|
||||
{
|
||||
SET_ERRNO (E2BIG);
|
||||
SET_ERRNO(E2BIG);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ref < (u8 *)out_data)
|
||||
{
|
||||
SET_ERRNO (EINVAL);
|
||||
SET_ERRNO(EINVAL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef lzf_movsb
|
||||
len += 2;
|
||||
lzf_movsb (op, ref, len);
|
||||
lzf_movsb(op, ref, len);
|
||||
#else
|
||||
*op++ = *ref++;
|
||||
*op++ = *ref++;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
@ -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);
|
||||
|
|
|
@ -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<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 (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<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);
|
||||
Keys2d3d();
|
||||
if (qsetmode == 200) //In 3D mode
|
||||
|
|
|
@ -2143,7 +2143,7 @@ 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:
|
||||
/* case PLAYER_NAME:
|
||||
if (iSet)
|
||||
{
|
||||
g_player[iPlayer].ps->name[32]=lValue;
|
||||
|
|
Loading…
Reference in a new issue