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

@ -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;

View file

@ -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);
@ -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