mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Whitespace cleanup
git-svn-id: https://svn.eduke32.com/eduke32@286 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
138a4ab95f
commit
d7a133eefd
5 changed files with 239 additions and 240 deletions
|
@ -3124,7 +3124,7 @@ static void drawsprite(long snum)
|
||||||
//============================================================================= //POLYMOST BEGINS
|
//============================================================================= //POLYMOST BEGINS
|
||||||
#ifdef POLYMOST
|
#ifdef POLYMOST
|
||||||
if (rendmode) {
|
if (rendmode) {
|
||||||
polymost_drawsprite(snum);
|
polymost_drawsprite(snum);
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
bglDepthMask(1);
|
bglDepthMask(1);
|
||||||
#endif
|
#endif
|
||||||
|
@ -5817,7 +5817,7 @@ _equation equation(long x1, long y1, long x2, long y2)
|
||||||
}
|
}
|
||||||
else // vertical
|
else // vertical
|
||||||
{
|
{
|
||||||
ret.a = 1;
|
ret.a = 1;
|
||||||
ret.b = 0;
|
ret.b = 0;
|
||||||
ret.c = -x1;
|
ret.c = -x1;
|
||||||
}
|
}
|
||||||
|
@ -5825,7 +5825,7 @@ _equation equation(long x1, long y1, long x2, long y2)
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns the intersection point between two lines
|
// returns the intersection point between two lines
|
||||||
_point2d intersection(_equation eq1, _equation eq2)
|
_point2d intersection(_equation eq1, _equation eq2)
|
||||||
{
|
{
|
||||||
_point2d ret;
|
_point2d ret;
|
||||||
|
@ -6118,26 +6118,26 @@ killsprite:
|
||||||
i = l;
|
i = l;
|
||||||
while (i > 0)
|
while (i > 0)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
indexes[i] = --spritesortcnt;
|
indexes[i] = --spritesortcnt;
|
||||||
depths[i] = (tspriteptr[spritesortcnt]->x - globalposx) * (tspriteptr[spritesortcnt]->x - globalposx) +
|
depths[i] = (tspriteptr[spritesortcnt]->x - globalposx) * (tspriteptr[spritesortcnt]->x - globalposx) +
|
||||||
(tspriteptr[spritesortcnt]->y - globalposy) * (tspriteptr[spritesortcnt]->y - globalposy);
|
(tspriteptr[spritesortcnt]->y - globalposy) * (tspriteptr[spritesortcnt]->y - globalposy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// second pass (and possibly more) to z-sort
|
// second pass (and possibly more) to z-sort
|
||||||
j = 0;
|
j = 0;
|
||||||
while (j == 0)
|
while (j == 0)
|
||||||
{
|
{
|
||||||
j = 1;
|
j = 1;
|
||||||
for(i=l-1;i>0;i--)
|
for(i=l-1;i>0;i--)
|
||||||
{
|
{
|
||||||
if (depths[i] < depths[i-1])
|
if (depths[i] < depths[i-1])
|
||||||
{
|
{
|
||||||
swaplong(&indexes[i-1], &indexes[i]);
|
swaplong(&indexes[i-1], &indexes[i]);
|
||||||
swaplong(&depths[i-1], &depths[i]);
|
swaplong(&depths[i-1], &depths[i]);
|
||||||
j = 0;
|
j = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// MASKS PREPROCESSING
|
// MASKS PREPROCESSING
|
||||||
|
@ -6147,45 +6147,45 @@ killsprite:
|
||||||
/*i = k;
|
/*i = k;
|
||||||
while (i > 0)
|
while (i > 0)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
// leaf index
|
// leaf index
|
||||||
maskleaves[i].index = --maskwallcnt;
|
maskleaves[i].index = --maskwallcnt;
|
||||||
|
|
||||||
// leaf boundaries
|
// leaf boundaries
|
||||||
maskleaves[i].p1.x = wall[thewall[maskwall[maskleaves[i].index]]].x - globalposx;
|
maskleaves[i].p1.x = wall[thewall[maskwall[maskleaves[i].index]]].x - globalposx;
|
||||||
maskleaves[i].p1.y = wall[thewall[maskwall[maskleaves[i].index]]].y - globalposy;
|
maskleaves[i].p1.y = wall[thewall[maskwall[maskleaves[i].index]]].y - globalposy;
|
||||||
maskleaves[i].p2.x = wall[wall[thewall[maskwall[maskleaves[i].index]]].point2].x - globalposx;
|
maskleaves[i].p2.x = wall[wall[thewall[maskwall[maskleaves[i].index]]].point2].x - globalposx;
|
||||||
maskleaves[i].p2.y = wall[wall[thewall[maskwall[maskleaves[i].index]]].point2].y - globalposy;
|
maskleaves[i].p2.y = wall[wall[thewall[maskwall[maskleaves[i].index]]].point2].y - globalposy;
|
||||||
|
|
||||||
// leaf equations
|
|
||||||
maskleaves[i].maskeq = equation(maskleaves[i].p1.x, maskleaves[i].p1.y, maskleaves[i].p2.x, maskleaves[i].p2.y);
|
|
||||||
maskleaves[i].p1eq = equation(0, 0, maskleaves[i].p1.x, maskleaves[i].p1.y);
|
|
||||||
maskleaves[i].p2eq = equation(0, 0, maskleaves[i].p2.x, maskleaves[i].p2.y);
|
|
||||||
|
|
||||||
// drawing flag
|
// leaf equations
|
||||||
maskleaves[i].drawing = 0;
|
maskleaves[i].maskeq = equation(maskleaves[i].p1.x, maskleaves[i].p1.y, maskleaves[i].p2.x, maskleaves[i].p2.y);
|
||||||
|
maskleaves[i].p1eq = equation(0, 0, maskleaves[i].p1.x, maskleaves[i].p1.y);
|
||||||
|
maskleaves[i].p2eq = equation(0, 0, maskleaves[i].p2.x, maskleaves[i].p2.y);
|
||||||
|
|
||||||
//OSD_Printf("Processed mask - %i\n", i);
|
// drawing flag
|
||||||
|
maskleaves[i].drawing = 0;
|
||||||
|
|
||||||
|
//OSD_Printf("Processed mask - %i\n", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// second pass to connect the leaves together
|
// second pass to connect the leaves together
|
||||||
i = k;
|
i = k;
|
||||||
while (i > 0)
|
while (i > 0)
|
||||||
{
|
{
|
||||||
i--;
|
i--;
|
||||||
|
|
||||||
m = 0;
|
m = 0;
|
||||||
j = k;
|
j = k;
|
||||||
while (j > 0)
|
while (j > 0)
|
||||||
{
|
{
|
||||||
j--;
|
j--;
|
||||||
|
|
||||||
if ((i != j) && (wallobstructswall(&maskleaves[i], &maskleaves[j])))
|
if ((i != j) && (wallobstructswall(&maskleaves[i], &maskleaves[j])))
|
||||||
maskleaves[i].branch[m++] = &maskleaves[j];
|
maskleaves[i].branch[m++] = &maskleaves[j];
|
||||||
}
|
}
|
||||||
maskleaves[i].branch[m] = NULL;
|
maskleaves[i].branch[m] = NULL;
|
||||||
//OSD_Printf("Processed parents for mask %i\n", i);
|
//OSD_Printf("Processed parents for mask %i\n", i);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// DRAWING
|
// DRAWING
|
||||||
|
@ -6193,18 +6193,18 @@ killsprite:
|
||||||
/*i = l - 1;
|
/*i = l - 1;
|
||||||
while (i >= 0)
|
while (i >= 0)
|
||||||
{
|
{
|
||||||
//OSD_Printf("sprite - %i\n", depths[i]);
|
//OSD_Printf("sprite - %i\n", depths[i]);
|
||||||
drawsprite(indexes[i]);
|
drawsprite(indexes[i]);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
||||||
// this codes draws the remaining (if any) masked walls, meaning those that are directly before the player
|
// this codes draws the remaining (if any) masked walls, meaning those that are directly before the player
|
||||||
while (k > 0)
|
while (k > 0)
|
||||||
{
|
{
|
||||||
k--;
|
k--;
|
||||||
//OSD_Printf("Beginning drawing process for mask %i\n", k);
|
//OSD_Printf("Beginning drawing process for mask %i\n", k);
|
||||||
//drawmaskleaf(&maskleaves[k]);
|
//drawmaskleaf(&maskleaves[k]);
|
||||||
drawmaskwall(k);
|
drawmaskwall(k);
|
||||||
}
|
}
|
||||||
free(indexes);
|
free(indexes);
|
||||||
free(depths);*/
|
free(depths);*/
|
||||||
|
|
|
@ -47,9 +47,9 @@ void (APIENTRY * bglPushMatrix)( void );
|
||||||
void (APIENTRY * bglPopMatrix)( void );
|
void (APIENTRY * bglPopMatrix)( void );
|
||||||
void (APIENTRY * bglLoadIdentity)( void );
|
void (APIENTRY * bglLoadIdentity)( void );
|
||||||
void (APIENTRY * bglLoadMatrixf)( const GLfloat *m );
|
void (APIENTRY * bglLoadMatrixf)( const GLfloat *m );
|
||||||
void (APIENTRY * bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
void (APIENTRY * bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
|
||||||
void (APIENTRY * bglScalef)(GLfloat x, GLfloat y, GLfloat z);
|
void (APIENTRY * bglScalef)(GLfloat x, GLfloat y, GLfloat z);
|
||||||
void (APIENTRY * bglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
|
void (APIENTRY * bglTranslatef)(GLfloat x, GLfloat y, GLfloat z);
|
||||||
|
|
||||||
// Drawing
|
// Drawing
|
||||||
void (APIENTRY * bglBegin)( GLenum mode );
|
void (APIENTRY * bglBegin)( GLenum mode );
|
||||||
|
@ -58,7 +58,7 @@ void (APIENTRY * bglVertex2f)( GLfloat x, GLfloat y );
|
||||||
void (APIENTRY * bglVertex2i)( GLint x, GLint y );
|
void (APIENTRY * bglVertex2i)( GLint x, GLint y );
|
||||||
void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z );
|
void (APIENTRY * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z );
|
||||||
void (APIENTRY * bglVertex3fv)( const GLfloat *v );
|
void (APIENTRY * bglVertex3fv)( const GLfloat *v );
|
||||||
void (APIENTRY * bglVertex3dv)( const GLdouble *v );
|
void (APIENTRY * bglVertex3dv)( const GLdouble *v );
|
||||||
void (APIENTRY * bglColor4f)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
|
void (APIENTRY * bglColor4f)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
|
||||||
void (APIENTRY * bglColor4ub)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
|
void (APIENTRY * bglColor4ub)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
|
||||||
void (APIENTRY * bglTexCoord2d)( GLdouble s, GLdouble t );
|
void (APIENTRY * bglTexCoord2d)( GLdouble s, GLdouble t );
|
||||||
|
@ -82,7 +82,7 @@ void (APIENTRY * bglTexParameteri)( GLenum target, GLenum pname, GLint param );
|
||||||
void (APIENTRY * bglGetTexLevelParameteriv)( GLenum target, GLint level, GLenum pname, GLint *params );
|
void (APIENTRY * bglGetTexLevelParameteriv)( GLenum target, GLint level, GLenum pname, GLint *params );
|
||||||
void (APIENTRY * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
void (APIENTRY * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||||
void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
|
void (APIENTRY * bglGetCompressedTexImageARB)(GLenum, GLint, GLvoid *);
|
||||||
void (APIENTRY * bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
|
void (APIENTRY * bglTexGenfv)(GLenum coord, GLenum pname, const GLfloat *params);
|
||||||
|
|
||||||
// Fog
|
// Fog
|
||||||
void (APIENTRY * bglFogf)( GLenum pname, GLfloat param );
|
void (APIENTRY * bglFogf)( GLenum pname, GLfloat param );
|
||||||
|
@ -148,7 +148,7 @@ int loadgldriver(const char *driver)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
driver = "OPENGL32.DLL";
|
driver = "OPENGL32.DLL";
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
||||||
#else
|
#else
|
||||||
driver = "libGL.so";
|
driver = "libGL.so";
|
||||||
#endif
|
#endif
|
||||||
|
@ -243,7 +243,7 @@ int loadgldriver(const char *driver)
|
||||||
bglTexParameterf = GETPROC("glTexParameterf");
|
bglTexParameterf = GETPROC("glTexParameterf");
|
||||||
bglTexParameteri = GETPROC("glTexParameteri");
|
bglTexParameteri = GETPROC("glTexParameteri");
|
||||||
bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv");
|
bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv");
|
||||||
bglTexGenfv = GETPROC("glTexGenfv");
|
bglTexGenfv = GETPROC("glTexGenfv");
|
||||||
|
|
||||||
// Fog
|
// Fog
|
||||||
bglFogf = GETPROC("glFogf");
|
bglFogf = GETPROC("glFogf");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// blah
|
// blah
|
||||||
|
|
||||||
#include "polymer.h"
|
#include "polymer.h"
|
||||||
|
|
||||||
_prsector* prsectors[MAXSECTORS];
|
_prsector* prsectors[MAXSECTORS];
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@ int tempverticescount;
|
||||||
GLdouble* tempvertices;
|
GLdouble* tempvertices;
|
||||||
|
|
||||||
// Polymer cvars
|
// Polymer cvars
|
||||||
char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood
|
||||||
char pr_wireframe = 0;
|
char pr_wireframe = 0;
|
||||||
|
|
||||||
int polymer_init(void)
|
int polymer_init(void)
|
||||||
{
|
{
|
||||||
|
@ -77,89 +77,89 @@ void polymer_glinit(void)
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
}
|
}
|
||||||
|
|
||||||
int polymer_updategeometry(short sectnum)
|
int polymer_updategeometry(short sectnum)
|
||||||
{
|
{
|
||||||
_prsector* s;
|
_prsector* s;
|
||||||
sectortype *sec;
|
sectortype *sec;
|
||||||
walltype *wal;
|
walltype *wal;
|
||||||
int i, ret;
|
int i, ret;
|
||||||
|
|
||||||
s = prsectors[sectnum];
|
s = prsectors[sectnum];
|
||||||
sec = §or[sectnum];
|
sec = §or[sectnum];
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum);
|
if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec->wallnum != s->wallcount)
|
if (sec->wallnum != s->wallcount)
|
||||||
{
|
{
|
||||||
s->wallcount = sec->wallnum;
|
s->wallcount = sec->wallnum;
|
||||||
s->verts = realloc(s->verts, sizeof(_prvertex) * s->wallcount);
|
s->verts = realloc(s->verts, sizeof(_prvertex) * s->wallcount);
|
||||||
memset(s->verts, 0, sizeof(_prvertex) * s->wallcount);
|
memset(s->verts, 0, sizeof(_prvertex) * s->wallcount);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < s->wallcount)
|
while (i < s->wallcount)
|
||||||
{
|
{
|
||||||
s->verts[i].wallnum = sec->wallptr + i;
|
s->verts[i].wallnum = sec->wallptr + i;
|
||||||
s->verts[i].v[2] = -wal->x;
|
s->verts[i].v[2] = -wal->x;
|
||||||
s->verts[i].v[0] = wal->y;
|
s->verts[i].v[0] = wal->y;
|
||||||
s->verts[i].v[1] = -sec->floorz;
|
s->verts[i].v[1] = -sec->floorz;
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
wal = &wall[sec->wallptr + i];
|
wal = &wall[sec->wallptr + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum);
|
if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This callback is called by the tesselator when it detects an intersection between contours (HELLO ROTATING SPOTLIGHT IN E1L1).
|
// This callback is called by the tesselator when it detects an intersection between contours (HELLO ROTATING SPOTLIGHT IN E1L1).
|
||||||
// In this case, we create a new temporary vertex at the intersection point which will be freed after the polygon is drawn.
|
// In this case, we create a new temporary vertex at the intersection point which will be freed after the polygon is drawn.
|
||||||
void polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out)
|
void polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out)
|
||||||
{
|
{
|
||||||
GLdouble *ptr;
|
GLdouble *ptr;
|
||||||
|
|
||||||
tempverticescount++;
|
tempverticescount++;
|
||||||
tempvertices = realloc(tempvertices, tempverticescount * sizeof(GLdouble) * 3);
|
tempvertices = realloc(tempvertices, tempverticescount * sizeof(GLdouble) * 3);
|
||||||
tempvertices[(tempverticescount * 3) - 3] = v[0];
|
tempvertices[(tempverticescount * 3) - 3] = v[0];
|
||||||
tempvertices[(tempverticescount * 3) - 2] = v[1];
|
tempvertices[(tempverticescount * 3) - 2] = v[1];
|
||||||
tempvertices[(tempverticescount * 3) - 1] = v[2];
|
tempvertices[(tempverticescount * 3) - 1] = v[2];
|
||||||
|
|
||||||
ptr = &tempvertices[(tempverticescount - 1) * 3];
|
ptr = &tempvertices[(tempverticescount - 1) * 3];
|
||||||
*out = ptr;
|
*out = ptr;
|
||||||
|
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Created additional geometry for sector tesselation.\n");
|
if (pr_verbosity >= 2) OSD_Printf("PR : Created additional geometry for sector tesselation.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// This callback is called by the tesselator whenever it raises an error.
|
// This callback is called by the tesselator whenever it raises an error.
|
||||||
void polymer_tesserror(GLenum error)
|
void polymer_tesserror(GLenum error)
|
||||||
{
|
{
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Tesselation error number %i reported : %s.\n", error, gluErrorString(errno));
|
if (pr_verbosity >= 1) OSD_Printf("PR : Tesselation error number %i reported : %s.\n", error, gluErrorString(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function tesselates the floor/ceiling of a sector and stores the triangles in a display list.
|
// This function tesselates the floor/ceiling of a sector and stores the triangles in a display list.
|
||||||
int polymer_buildfloor(short sectnum)
|
int polymer_buildfloor(short sectnum)
|
||||||
{
|
{
|
||||||
_prsector* s;
|
_prsector* s;
|
||||||
sectortype *sec;
|
sectortype *sec;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum);
|
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum);
|
||||||
|
|
||||||
s = prsectors[sectnum];
|
s = prsectors[sectnum];
|
||||||
sec = §or[sectnum];
|
sec = §or[sectnum];
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
bglNewList(sectnum + 1, GL_COMPILE);
|
bglNewList(sectnum + 1, GL_COMPILE);
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ int polymer_buildfloor(short sectnum)
|
||||||
gluTessEndContour(prtess);
|
gluTessEndContour(prtess);
|
||||||
gluTessBeginContour(prtess);
|
gluTessBeginContour(prtess);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
gluTessEndContour(prtess);
|
gluTessEndContour(prtess);
|
||||||
gluTessEndPolygon(prtess);
|
gluTessEndPolygon(prtess);
|
||||||
|
@ -200,47 +200,47 @@ int polymer_buildfloor(short sectnum)
|
||||||
tempverticescount = 0;
|
tempverticescount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselated floor of sector %i.\n", sectnum);
|
if (pr_verbosity >= 2) OSD_Printf("PR : Tesselated floor of sector %i.\n", sectnum);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int polymer_initsector(short sectnum)
|
int polymer_initsector(short sectnum)
|
||||||
{
|
{
|
||||||
sectortype *sec;
|
sectortype *sec;
|
||||||
_prsector* s;
|
_prsector* s;
|
||||||
|
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing sector %i...\n", sectnum);
|
if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing sector %i...\n", sectnum);
|
||||||
|
|
||||||
sec = §or[sectnum];
|
sec = §or[sectnum];
|
||||||
s = malloc(sizeof(_prsector));
|
s = malloc(sizeof(_prsector));
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : malloc failed.\n", sectnum);
|
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : malloc failed.\n", sectnum);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
s->invalidate = 0;
|
s->invalidate = 0;
|
||||||
s->wallcount = sec->wallnum;
|
s->wallcount = sec->wallnum;
|
||||||
s->verts = malloc(s->wallcount * sizeof(_prvertex));
|
s->verts = malloc(s->wallcount * sizeof(_prvertex));
|
||||||
if (s->verts == NULL)
|
if (s->verts == NULL)
|
||||||
{
|
{
|
||||||
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum);
|
if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
prsectors[sectnum] = s;
|
prsectors[sectnum] = s;
|
||||||
|
|
||||||
if (pr_verbosity >= 2) OSD_Printf("PR : Initalized sector %i.\n", sectnum);
|
if (pr_verbosity >= 2) OSD_Printf("PR : Initalized sector %i.\n", sectnum);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void polymer_drawsector(long daposx, long daposy, long daposz, short daang, long dahoriz, short sectnum)
|
void polymer_drawsector(long daposx, long daposy, long daposz, short daang, long dahoriz, short sectnum)
|
||||||
{
|
{
|
||||||
sectortype *sec, *nextsec;
|
sectortype *sec, *nextsec;
|
||||||
walltype *wal;
|
walltype *wal;
|
||||||
_prsector* s;
|
_prsector* s;
|
||||||
float ang;
|
float ang;
|
||||||
double pos[3];
|
double pos[3];
|
||||||
int i;
|
int i;
|
||||||
|
@ -265,8 +265,8 @@ void polymer_drawsector(long daposx, long daposy, long daposz, short
|
||||||
}
|
}
|
||||||
|
|
||||||
sec = §or[sectnum];
|
sec = §or[sectnum];
|
||||||
wal = &wall[sec->wallptr];
|
wal = &wall[sec->wallptr];
|
||||||
s = prsectors[sectnum];
|
s = prsectors[sectnum];
|
||||||
|
|
||||||
ang = (float)(daang) / (2048.0f / 360.0f);
|
ang = (float)(daang) / (2048.0f / 360.0f);
|
||||||
|
|
||||||
|
@ -296,65 +296,65 @@ void polymer_drawsector(long daposx, long daposy, long daposz, short
|
||||||
bglPopMatrix();
|
bglPopMatrix();
|
||||||
|
|
||||||
// walls
|
// walls
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < sec->wallnum)
|
while (i < sec->wallnum)
|
||||||
{
|
{
|
||||||
if (wal->nextsector == -1)
|
if (wal->nextsector == -1)
|
||||||
{ // limit of the map
|
{ // limit of the map
|
||||||
pth = gltexcache(wal->picnum,wal->pal,0);
|
pth = gltexcache(wal->picnum,wal->pal,0);
|
||||||
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
||||||
bglColor4f(0.0f, 1.0f, 0.0f, 1.0f);
|
bglColor4f(0.0f, 1.0f, 0.0f, 1.0f);
|
||||||
bglBegin(GL_QUADS);
|
bglBegin(GL_QUADS);
|
||||||
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1], s->verts[i].v[2]);
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1], s->verts[i].v[2]);
|
||||||
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1], s->verts[wal->point2 - sec->wallptr].v[2]);
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1], s->verts[wal->point2 - sec->wallptr].v[2]);
|
||||||
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
||||||
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
||||||
bglEnd();
|
bglEnd();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextsec = §or[wal->nextsector];
|
nextsec = §or[wal->nextsector];
|
||||||
zdiff = sec->floorz - nextsec->floorz;
|
zdiff = sec->floorz - nextsec->floorz;
|
||||||
if (zdiff > 0)
|
if (zdiff > 0)
|
||||||
{ // floor polymerization
|
{ // floor polymerization
|
||||||
pth = gltexcache(wal->picnum,wal->pal,0);
|
pth = gltexcache(wal->picnum,wal->pal,0);
|
||||||
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
||||||
bglColor4f(0.0f, 0.0f, 1.0f, 1.0f);
|
bglColor4f(0.0f, 0.0f, 1.0f, 1.0f);
|
||||||
bglBegin(GL_QUADS);
|
bglBegin(GL_QUADS);
|
||||||
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1], s->verts[i].v[2]);
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1], s->verts[i].v[2]);
|
||||||
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1], s->verts[wal->point2 - sec->wallptr].v[2]);
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1], s->verts[wal->point2 - sec->wallptr].v[2]);
|
||||||
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + zdiff, s->verts[wal->point2 - sec->wallptr].v[2]);
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + zdiff, s->verts[wal->point2 - sec->wallptr].v[2]);
|
||||||
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + zdiff, s->verts[i].v[2]);
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + zdiff, s->verts[i].v[2]);
|
||||||
bglEnd();
|
bglEnd();
|
||||||
}
|
}
|
||||||
zdiff = sec->ceilingz - nextsec->ceilingz;
|
zdiff = sec->ceilingz - nextsec->ceilingz;
|
||||||
if (zdiff > 0)
|
if (zdiff > 0)
|
||||||
{ // ceiling polymerization
|
{ // ceiling polymerization
|
||||||
pth = gltexcache(wal->picnum,wal->pal,0);
|
pth = gltexcache(wal->picnum,wal->pal,0);
|
||||||
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0);
|
||||||
bglColor4f(1.0f, 0.0f, 1.0f, 1.0f);
|
bglColor4f(1.0f, 0.0f, 1.0f, 1.0f);
|
||||||
bglBegin(GL_QUADS);
|
bglBegin(GL_QUADS);
|
||||||
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
||||||
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
||||||
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
bglVertex3d(s->verts[wal->point2 - sec->wallptr].v[0], s->verts[wal->point2 - sec->wallptr].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[wal->point2 - sec->wallptr].v[2]);
|
||||||
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
bglVertex3d(s->verts[i].v[0], s->verts[i].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[i].v[2]);
|
||||||
bglEnd();
|
bglEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
wal = &wall[sec->wallptr + i];
|
wal = &wall[sec->wallptr + i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing sector %i...\n", sectnum);
|
if (pr_verbosity >= 3) OSD_Printf("PR : Finished drawing sector %i...\n", sectnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum)
|
void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, long dahoriz, short dacursectnum)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n");
|
||||||
|
|
||||||
polymer_glinit();
|
polymer_glinit();
|
||||||
|
|
||||||
|
@ -370,5 +370,5 @@ void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, lo
|
||||||
bglMatrixMode(GL_MODELVIEW);
|
bglMatrixMode(GL_MODELVIEW);
|
||||||
bglLoadMatrixf(polymostmodelmatrix);
|
bglLoadMatrixf(polymostmodelmatrix);
|
||||||
|
|
||||||
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,7 +320,7 @@ float alphahackarray[MAXTILES];
|
||||||
float scalex, scaley;
|
float scalex, scaley;
|
||||||
struct pthtyp_t *wofb; // without fullbright
|
struct pthtyp_t *wofb; // without fullbright
|
||||||
struct pthtyp_t *ofb; // only fullbright
|
struct pthtyp_t *ofb; // only fullbright
|
||||||
} pthtyp;*/
|
} pthtyp;*/
|
||||||
|
|
||||||
#define GLTEXCACHEADSIZ 8192
|
#define GLTEXCACHEADSIZ 8192
|
||||||
static pthtyp *gltexcachead[GLTEXCACHEADSIZ];
|
static pthtyp *gltexcachead[GLTEXCACHEADSIZ];
|
||||||
|
@ -2879,11 +2879,11 @@ static void polymost_drawalls (long bunch)
|
||||||
if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy);
|
if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy);
|
||||||
else if ((oy < cy0) != (oy < cy1))
|
else if ((oy < cy0) != (oy < cy1))
|
||||||
{ /* cy1 cy0
|
{ /* cy1 cy0
|
||||||
// / \
|
// / \
|
||||||
//oy---------- oy---------
|
//oy---------- oy---------
|
||||||
// / \
|
// / \
|
||||||
// cy0 cy1
|
// cy0 cy1
|
||||||
*/
|
*/
|
||||||
ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0;
|
ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0;
|
||||||
if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,ox,oy); }
|
if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,ox,oy); }
|
||||||
else { domost(ox,oy,x0,cy0); domost(x1,oy,ox,oy); }
|
else { domost(ox,oy,x0,cy0); domost(x1,oy,ox,oy); }
|
||||||
|
@ -3840,8 +3840,8 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0))
|
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0))
|
||||||
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0))
|
if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0))
|
||||||
bglDepthMask(0);
|
bglDepthMask(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch((globalorientation>>4)&3)
|
switch((globalorientation>>4)&3)
|
||||||
|
@ -4228,16 +4228,16 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum,
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if(!nofog)
|
if(!nofog)
|
||||||
{
|
{
|
||||||
i = klabs(tspr.shade);
|
i = klabs(tspr.shade);
|
||||||
bglFogf(GL_FOG_DENSITY,gvisibility/(tspr.shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(tspr.shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sector[tspr.sectnum].visibility<240?sector[tspr.sectnum].visibility+16:sector[tspr.sectnum].visibility-239))));
|
bglFogf(GL_FOG_DENSITY,gvisibility/(tspr.shade<0?(shadetable[i]-glnegshadeoffset)*glnegshadescale:1)*(tspr.shade<0?1:shadetable[i]*glshadescale)*((float)((unsigned char)(sector[tspr.sectnum].visibility<240?sector[tspr.sectnum].visibility+16:sector[tspr.sectnum].visibility-239))));
|
||||||
}
|
}
|
||||||
mddraw(&tspr);
|
mddraw(&tspr);
|
||||||
#else
|
#else
|
||||||
if(!nofog) bglDisable(GL_FOG);
|
if(!nofog) bglDisable(GL_FOG);
|
||||||
mddraw(&tspr);
|
mddraw(&tspr);
|
||||||
if(!nofog) bglEnable(GL_FOG);
|
if(!nofog) bglEnable(GL_FOG);
|
||||||
#endif
|
#endif
|
||||||
viewingrange = oldviewingrange;
|
viewingrange = oldviewingrange;
|
||||||
gxyaspect = ogxyaspect;
|
gxyaspect = ogxyaspect;
|
||||||
|
|
|
@ -1786,7 +1786,7 @@ int setvideomode(int x, int y, int c, int fs)
|
||||||
initprintf("Setting video mode %dx%d (%d-bit %s)\n",
|
initprintf("Setting video mode %dx%d (%d-bit %s)\n",
|
||||||
x,y,c, ((fs&1) ? "fullscreen" : "windowed"));
|
x,y,c, ((fs&1) ? "fullscreen" : "windowed"));
|
||||||
|
|
||||||
if (CreateAppWindow(modenum)) return -1;
|
if (CreateAppWindow(modenum)) return -1;
|
||||||
|
|
||||||
if (!gammabrightness) {
|
if (!gammabrightness) {
|
||||||
float f = 1.0 + ((float)curbrightness / 10.0);
|
float f = 1.0 + ((float)curbrightness / 10.0);
|
||||||
|
@ -2035,7 +2035,6 @@ void showframe(int w)
|
||||||
bglPushMatrix();
|
bglPushMatrix();
|
||||||
bglLoadIdentity();
|
bglLoadIdentity();
|
||||||
|
|
||||||
bglDisable(GL_ALPHA_TEST);
|
|
||||||
bglDisable(GL_DEPTH_TEST);
|
bglDisable(GL_DEPTH_TEST);
|
||||||
bglDisable(GL_ALPHA_TEST);
|
bglDisable(GL_ALPHA_TEST);
|
||||||
bglDisable(GL_TEXTURE_2D);
|
bglDisable(GL_TEXTURE_2D);
|
||||||
|
@ -2957,7 +2956,7 @@ static BOOL CreateAppWindow(int modenum)
|
||||||
}
|
}
|
||||||
SetWindowPos(hWindow, HWND_TOP, x, y, w, h, 0);
|
SetWindowPos(hWindow, HWND_TOP, x, y, w, h, 0);
|
||||||
|
|
||||||
SetWindowText(hWindow, apptitle);
|
SetWindowText(hWindow, apptitle);
|
||||||
ShowWindow(hWindow, SW_SHOWNORMAL);
|
ShowWindow(hWindow, SW_SHOWNORMAL);
|
||||||
SetForegroundWindow(hWindow);
|
SetForegroundWindow(hWindow);
|
||||||
SetFocus(hWindow);
|
SetFocus(hWindow);
|
||||||
|
|
Loading…
Reference in a new issue