diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index c2513f213..22855bcc9 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -3124,7 +3124,7 @@ static void drawsprite(long snum) //============================================================================= //POLYMOST BEGINS #ifdef POLYMOST if (rendmode) { - polymost_drawsprite(snum); + polymost_drawsprite(snum); #ifdef USE_OPENGL bglDepthMask(1); #endif @@ -5817,7 +5817,7 @@ _equation equation(long x1, long y1, long x2, long y2) } else // vertical { - ret.a = 1; + ret.a = 1; ret.b = 0; ret.c = -x1; } @@ -5825,7 +5825,7 @@ _equation equation(long x1, long y1, long x2, long y2) return (ret); } -// returns the intersection point between two lines +// returns the intersection point between two lines _point2d intersection(_equation eq1, _equation eq2) { _point2d ret; @@ -6118,26 +6118,26 @@ killsprite: i = l; while (i > 0) { - i--; - indexes[i] = --spritesortcnt; - depths[i] = (tspriteptr[spritesortcnt]->x - globalposx) * (tspriteptr[spritesortcnt]->x - globalposx) + - (tspriteptr[spritesortcnt]->y - globalposy) * (tspriteptr[spritesortcnt]->y - globalposy); + i--; + indexes[i] = --spritesortcnt; + depths[i] = (tspriteptr[spritesortcnt]->x - globalposx) * (tspriteptr[spritesortcnt]->x - globalposx) + + (tspriteptr[spritesortcnt]->y - globalposy) * (tspriteptr[spritesortcnt]->y - globalposy); } // second pass (and possibly more) to z-sort j = 0; while (j == 0) { - j = 1; - for(i=l-1;i>0;i--) - { - if (depths[i] < depths[i-1]) - { - swaplong(&indexes[i-1], &indexes[i]); - swaplong(&depths[i-1], &depths[i]); - j = 0; - } - } + j = 1; + for(i=l-1;i>0;i--) + { + if (depths[i] < depths[i-1]) + { + swaplong(&indexes[i-1], &indexes[i]); + swaplong(&depths[i-1], &depths[i]); + j = 0; + } + } }*/ // MASKS PREPROCESSING @@ -6147,45 +6147,45 @@ killsprite: /*i = k; while (i > 0) { - i--; + i--; - // leaf index - maskleaves[i].index = --maskwallcnt; + // leaf index + maskleaves[i].index = --maskwallcnt; - // leaf boundaries - 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].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; - - // 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); + // leaf boundaries + 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].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; - // drawing flag - maskleaves[i].drawing = 0; + // 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); - //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 i = k; while (i > 0) { - i--; + i--; - m = 0; - j = k; - while (j > 0) - { - j--; + m = 0; + j = k; + while (j > 0) + { + j--; - if ((i != j) && (wallobstructswall(&maskleaves[i], &maskleaves[j]))) - maskleaves[i].branch[m++] = &maskleaves[j]; - } - maskleaves[i].branch[m] = NULL; - //OSD_Printf("Processed parents for mask %i\n", i); + if ((i != j) && (wallobstructswall(&maskleaves[i], &maskleaves[j]))) + maskleaves[i].branch[m++] = &maskleaves[j]; + } + maskleaves[i].branch[m] = NULL; + //OSD_Printf("Processed parents for mask %i\n", i); }*/ // DRAWING @@ -6193,18 +6193,18 @@ killsprite: /*i = l - 1; while (i >= 0) { - //OSD_Printf("sprite - %i\n", depths[i]); - drawsprite(indexes[i]); - i--; + //OSD_Printf("sprite - %i\n", depths[i]); + drawsprite(indexes[i]); + i--; } // this codes draws the remaining (if any) masked walls, meaning those that are directly before the player while (k > 0) { - k--; - //OSD_Printf("Beginning drawing process for mask %i\n", k); - //drawmaskleaf(&maskleaves[k]); - drawmaskwall(k); + k--; + //OSD_Printf("Beginning drawing process for mask %i\n", k); + //drawmaskleaf(&maskleaves[k]); + drawmaskwall(k); } free(indexes); free(depths);*/ diff --git a/polymer/build/src/glbuild.c b/polymer/build/src/glbuild.c index ba9dd66e4..c460920e1 100644 --- a/polymer/build/src/glbuild.c +++ b/polymer/build/src/glbuild.c @@ -47,9 +47,9 @@ void (APIENTRY * bglPushMatrix)( void ); void (APIENTRY * bglPopMatrix)( void ); void (APIENTRY * bglLoadIdentity)( void ); void (APIENTRY * bglLoadMatrixf)( const GLfloat *m ); -void (APIENTRY * bglRotatef)(GLfloat angle, 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 * bglRotatef)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY * bglScalef)(GLfloat x, GLfloat y, GLfloat z); +void (APIENTRY * bglTranslatef)(GLfloat x, GLfloat y, GLfloat z); // Drawing 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 * bglVertex3d)( GLdouble x, GLdouble y, GLdouble z ); 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 * bglColor4ub)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); 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 * bglCompressedTexImage2DARB)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const 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 void (APIENTRY * bglFogf)( GLenum pname, GLfloat param ); @@ -148,7 +148,7 @@ int loadgldriver(const char *driver) #ifdef _WIN32 driver = "OPENGL32.DLL"; #elif defined __APPLE__ - driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; + driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL"; #else driver = "libGL.so"; #endif @@ -243,7 +243,7 @@ int loadgldriver(const char *driver) bglTexParameterf = GETPROC("glTexParameterf"); bglTexParameteri = GETPROC("glTexParameteri"); bglGetTexLevelParameteriv = GETPROC("glGetTexLevelParameteriv"); - bglTexGenfv = GETPROC("glTexGenfv"); + bglTexGenfv = GETPROC("glTexGenfv"); // Fog bglFogf = GETPROC("glFogf"); diff --git a/polymer/build/src/polymer.c b/polymer/build/src/polymer.c index 17c035cb7..632d5ae22 100644 --- a/polymer/build/src/polymer.c +++ b/polymer/build/src/polymer.c @@ -1,6 +1,6 @@ // blah - -#include "polymer.h" + +#include "polymer.h" _prsector* prsectors[MAXSECTORS]; @@ -13,8 +13,8 @@ int tempverticescount; GLdouble* tempvertices; // Polymer cvars -char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood -char pr_wireframe = 0; +char pr_verbosity = 1; // 0: silent, 1: errors and one-times, 2: multiple-times, 3: flood +char pr_wireframe = 0; int polymer_init(void) { @@ -77,89 +77,89 @@ void polymer_glinit(void) bglMatrixMode(GL_MODELVIEW); bglLoadIdentity(); } - -int polymer_updategeometry(short sectnum) -{ - _prsector* s; + +int polymer_updategeometry(short sectnum) +{ + _prsector* s; sectortype *sec; - walltype *wal; - int i, ret; - - s = prsectors[sectnum]; - sec = §or[sectnum]; - wal = &wall[sec->wallptr]; - - if (s == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum); - return (-1); - } - - if (sec->wallnum != s->wallcount) - { - s->wallcount = sec->wallnum; - s->verts = realloc(s->verts, sizeof(_prvertex) * s->wallcount); - memset(s->verts, 0, sizeof(_prvertex) * s->wallcount); - ret = 1; - } - else - ret = 0; - - i = 0; - while (i < s->wallcount) - { - s->verts[i].wallnum = sec->wallptr + i; - s->verts[i].v[2] = -wal->x; - s->verts[i].v[0] = wal->y; - s->verts[i].v[1] = -sec->floorz; - - i++; - wal = &wall[sec->wallptr + i]; - } - - if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum); - - return (ret); -} - -// 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. -void polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out) -{ - GLdouble *ptr; - - tempverticescount++; - tempvertices = realloc(tempvertices, tempverticescount * sizeof(GLdouble) * 3); - tempvertices[(tempverticescount * 3) - 3] = v[0]; - tempvertices[(tempverticescount * 3) - 2] = v[1]; - tempvertices[(tempverticescount * 3) - 1] = v[2]; - - ptr = &tempvertices[(tempverticescount - 1) * 3]; - *out = ptr; - - 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. -void polymer_tesserror(GLenum error) -{ - 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. -int polymer_buildfloor(short sectnum) -{ - _prsector* s; + walltype *wal; + int i, ret; + + s = prsectors[sectnum]; + sec = §or[sectnum]; + wal = &wall[sec->wallptr]; + + if (s == NULL) + { + if (pr_verbosity >= 1) OSD_Printf("PR : Can't update uninitialized sector %i.\n", sectnum); + return (-1); + } + + if (sec->wallnum != s->wallcount) + { + s->wallcount = sec->wallnum; + s->verts = realloc(s->verts, sizeof(_prvertex) * s->wallcount); + memset(s->verts, 0, sizeof(_prvertex) * s->wallcount); + ret = 1; + } + else + ret = 0; + + i = 0; + while (i < s->wallcount) + { + s->verts[i].wallnum = sec->wallptr + i; + s->verts[i].v[2] = -wal->x; + s->verts[i].v[0] = wal->y; + s->verts[i].v[1] = -sec->floorz; + + i++; + wal = &wall[sec->wallptr + i]; + } + + if (pr_verbosity >= 3) OSD_Printf("PR : Updated sector %i.\n", sectnum); + + return (ret); +} + +// 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. +void polymer_tesscombine(GLdouble v[3], GLdouble *data[4], GLfloat weight[4], GLdouble **out) +{ + GLdouble *ptr; + + tempverticescount++; + tempvertices = realloc(tempvertices, tempverticescount * sizeof(GLdouble) * 3); + tempvertices[(tempverticescount * 3) - 3] = v[0]; + tempvertices[(tempverticescount * 3) - 2] = v[1]; + tempvertices[(tempverticescount * 3) - 1] = v[2]; + + ptr = &tempvertices[(tempverticescount - 1) * 3]; + *out = ptr; + + 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. +void polymer_tesserror(GLenum error) +{ + 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. +int polymer_buildfloor(short sectnum) +{ + _prsector* s; sectortype *sec; - int i; - - if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum); - - s = prsectors[sectnum]; - sec = §or[sectnum]; - - if (s == NULL) - return (-1); + int i; + + if (pr_verbosity >= 2) OSD_Printf("PR : Tesselating floor of sector %i...\n", sectnum); + + s = prsectors[sectnum]; + sec = §or[sectnum]; + + if (s == NULL) + return (-1); bglNewList(sectnum + 1, GL_COMPILE); @@ -186,7 +186,7 @@ int polymer_buildfloor(short sectnum) gluTessEndContour(prtess); gluTessBeginContour(prtess); } - i++; + i++; } gluTessEndContour(prtess); gluTessEndPolygon(prtess); @@ -200,47 +200,47 @@ int polymer_buildfloor(short sectnum) 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); -} - -int polymer_initsector(short sectnum) -{ +} + +int polymer_initsector(short sectnum) +{ sectortype *sec; - _prsector* s; - - if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing sector %i...\n", sectnum); - - sec = §or[sectnum]; - s = malloc(sizeof(_prsector)); - if (s == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : malloc failed.\n", sectnum); - return (0); - } - - s->invalidate = 0; - s->wallcount = sec->wallnum; - s->verts = malloc(s->wallcount * sizeof(_prvertex)); - if (s->verts == NULL) - { - if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum); - return (0); - } - - prsectors[sectnum] = s; - - if (pr_verbosity >= 2) OSD_Printf("PR : Initalized sector %i.\n", sectnum); - - return (1); -} - + _prsector* s; + + if (pr_verbosity >= 2) OSD_Printf("PR : Initalizing sector %i...\n", sectnum); + + sec = §or[sectnum]; + s = malloc(sizeof(_prsector)); + if (s == NULL) + { + if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize sector %i : malloc failed.\n", sectnum); + return (0); + } + + s->invalidate = 0; + s->wallcount = sec->wallnum; + s->verts = malloc(s->wallcount * sizeof(_prvertex)); + if (s->verts == NULL) + { + if (pr_verbosity >= 1) OSD_Printf("PR : Cannot initialize geometry of sector %i : malloc failed.\n", sectnum); + return (0); + } + + prsectors[sectnum] = s; + + if (pr_verbosity >= 2) OSD_Printf("PR : Initalized sector %i.\n", sectnum); + + return (1); +} + void polymer_drawsector(long daposx, long daposy, long daposz, short daang, long dahoriz, short sectnum) { sectortype *sec, *nextsec; walltype *wal; - _prsector* s; + _prsector* s; float ang; double pos[3]; int i; @@ -265,8 +265,8 @@ void polymer_drawsector(long daposx, long daposy, long daposz, short } sec = §or[sectnum]; - wal = &wall[sec->wallptr]; - s = prsectors[sectnum]; + wal = &wall[sec->wallptr]; + s = prsectors[sectnum]; ang = (float)(daang) / (2048.0f / 360.0f); @@ -296,65 +296,65 @@ void polymer_drawsector(long daposx, long daposy, long daposz, short bglPopMatrix(); // walls - i = 0; - while (i < sec->wallnum) - { - if (wal->nextsector == -1) - { // limit of the map + i = 0; + while (i < sec->wallnum) + { + if (wal->nextsector == -1) + { // limit of the map pth = gltexcache(wal->picnum,wal->pal,0); bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); bglColor4f(0.0f, 1.0f, 0.0f, 1.0f); - bglBegin(GL_QUADS); - 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] + (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]); - bglEnd(); - } - else - { - nextsec = §or[wal->nextsector]; - zdiff = sec->floorz - nextsec->floorz; - if (zdiff > 0) - { // floor polymerization + bglBegin(GL_QUADS); + 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] + (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]); + bglEnd(); + } + else + { + nextsec = §or[wal->nextsector]; + zdiff = sec->floorz - nextsec->floorz; + if (zdiff > 0) + { // floor polymerization pth = gltexcache(wal->picnum,wal->pal,0); bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); bglColor4f(0.0f, 0.0f, 1.0f, 1.0f); - bglBegin(GL_QUADS); - 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] + 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]); - bglEnd(); - } - zdiff = sec->ceilingz - nextsec->ceilingz; - if (zdiff > 0) - { // ceiling polymerization + bglBegin(GL_QUADS); + 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] + 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]); + bglEnd(); + } + zdiff = sec->ceilingz - nextsec->ceilingz; + if (zdiff > 0) + { // ceiling polymerization pth = gltexcache(wal->picnum,wal->pal,0); bglBindTexture(GL_TEXTURE_2D, pth ? pth->glpic : 0); bglColor4f(1.0f, 0.0f, 1.0f, 1.0f); - 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[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[i].v[0], s->verts[i].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[i].v[2]); - bglEnd(); - } - } - - - i++; - wal = &wall[sec->wallptr + i]; + 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[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[i].v[0], s->verts[i].v[1] + zdiff + (sec->floorz - sec->ceilingz), s->verts[i].v[2]); + bglEnd(); + } + } + + + 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) { int i; - if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n"); + if (pr_verbosity >= 3) OSD_Printf("PR : Drawing rooms...\n"); polymer_glinit(); @@ -370,5 +370,5 @@ void polymer_drawrooms(long daposx, long daposy, long daposz, short daang, lo bglMatrixMode(GL_MODELVIEW); bglLoadMatrixf(polymostmodelmatrix); - if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n"); + if (pr_verbosity >= 3) OSD_Printf("PR : Rooms drawn.\n"); } diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index a7b75e2af..a0cbefbfd 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -320,7 +320,7 @@ float alphahackarray[MAXTILES]; float scalex, scaley; struct pthtyp_t *wofb; // without fullbright struct pthtyp_t *ofb; // only fullbright -} pthtyp;*/ +} pthtyp;*/ #define GLTEXCACHEADSIZ 8192 static pthtyp *gltexcachead[GLTEXCACHEADSIZ]; @@ -2879,11 +2879,11 @@ static void polymost_drawalls (long bunch) if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy); else if ((oy < cy0) != (oy < cy1)) { /* cy1 cy0 - // / \ - //oy---------- oy--------- - // / \ - // cy0 cy1 - */ + // / \ + //oy---------- oy--------- + // / \ + // cy0 cy1 + */ ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0; if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,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; } 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); + if (((tspr->cstat&2) || (gltexmayhavealpha(tspr->picnum,tspr->pal))) && ((tspr->cstat&48) != 0)) + bglDepthMask(0); #endif switch((globalorientation>>4)&3) @@ -4228,16 +4228,16 @@ void polymost_dorotatesprite (long sx, long sy, long z, short a, short picnum, } #if 0 - if(!nofog) - { - i = klabs(tspr.shade); + if(!nofog) + { + 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)))); - } + } mddraw(&tspr); #else - if(!nofog) bglDisable(GL_FOG); + if(!nofog) bglDisable(GL_FOG); mddraw(&tspr); - if(!nofog) bglEnable(GL_FOG); + if(!nofog) bglEnable(GL_FOG); #endif viewingrange = oldviewingrange; gxyaspect = ogxyaspect; diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 80a2ecf2e..389840f60 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -1786,7 +1786,7 @@ int setvideomode(int x, int y, int c, int fs) initprintf("Setting video mode %dx%d (%d-bit %s)\n", x,y,c, ((fs&1) ? "fullscreen" : "windowed")); - if (CreateAppWindow(modenum)) return -1; + if (CreateAppWindow(modenum)) return -1; if (!gammabrightness) { float f = 1.0 + ((float)curbrightness / 10.0); @@ -2035,7 +2035,6 @@ void showframe(int w) bglPushMatrix(); bglLoadIdentity(); - bglDisable(GL_ALPHA_TEST); bglDisable(GL_DEPTH_TEST); bglDisable(GL_ALPHA_TEST); bglDisable(GL_TEXTURE_2D); @@ -2957,7 +2956,7 @@ static BOOL CreateAppWindow(int modenum) } SetWindowPos(hWindow, HWND_TOP, x, y, w, h, 0); - SetWindowText(hWindow, apptitle); + SetWindowText(hWindow, apptitle); ShowWindow(hWindow, SW_SHOWNORMAL); SetForegroundWindow(hWindow); SetFocus(hWindow);