Restored fullbrights, improved depth peeling, tweaked MSVC support for JFAud.

git-svn-id: https://svn.eduke32.com/eduke32@454 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
Plagman 2007-01-14 07:00:29 +00:00
parent 197cf82051
commit 8a5a966cd0
12 changed files with 289 additions and 81 deletions

View file

@ -56,6 +56,8 @@ extern void (APIENTRY * bglPopAttrib)( void );
extern GLenum (APIENTRY * bglGetError)( void ); extern GLenum (APIENTRY * bglGetError)( void );
extern const GLubyte* (APIENTRY * bglGetString)( GLenum name ); extern const GLubyte* (APIENTRY * bglGetString)( GLenum name );
extern void (APIENTRY * bglHint)( GLenum target, GLenum mode ); extern void (APIENTRY * bglHint)( GLenum target, GLenum mode );
extern void (APIENTRY * bglDrawBuffer)(GLenum mode);
extern void (APIENTRY * bglReadBuffer)(GLenum mode);
// Depth // Depth
extern void (APIENTRY * bglDepthFunc)( GLenum func ); extern void (APIENTRY * bglDepthFunc)( GLenum func );

View file

@ -3151,9 +3151,9 @@ static void drawsprite(long snum)
#ifdef POLYMOST #ifdef POLYMOST
if (rendmode == 3) { if (rendmode == 3) {
polymost_drawsprite(snum); polymost_drawsprite(snum);
#ifdef USE_OPENGL # ifdef USE_OPENGL
//bglDepthMask(1); bglDisable(GL_POLYGON_OFFSET_FILL);
#endif # endif
return; return;
} }
if (rendmode == 4) { polymer_drawsprite(snum); return; } if (rendmode == 4) { polymer_drawsprite(snum); return; }
@ -6120,7 +6120,6 @@ if ((!r_depthpeeling) || (rendmode < 3))
if ((sameside(&maskeq, &spr, &pos) == 0) && sameside(&p1eq, &middle, &spr) && sameside(&p2eq, &middle, &spr)) if ((sameside(&maskeq, &spr, &pos) == 0) && sameside(&p1eq, &middle, &spr) && sameside(&p2eq, &middle, &spr))
{ {
bglDisable(GL_POLYGON_OFFSET_FILL);
drawsprite(i); drawsprite(i);
tspriteptr[i] = NULL; tspriteptr[i] = NULL;
} }
@ -6133,48 +6132,66 @@ if ((!r_depthpeeling) || (rendmode < 3))
{ {
spritesortcnt--; spritesortcnt--;
if (tspriteptr[spritesortcnt] != NULL) if (tspriteptr[spritesortcnt] != NULL)
{
bglDisable(GL_POLYGON_OFFSET_FILL);
drawsprite(spritesortcnt); drawsprite(spritesortcnt);
}
} }
bglDisable(GL_POLYGON_OFFSET_FILL);
} /* depthpeeling */ } /* depthpeeling */
#ifdef USE_OPENGL #ifdef USE_OPENGL
else else
{ {
curpolygonoffset = 0; curpolygonoffset = 0;
while (spritesortcnt > 0) j = spritesortcnt;
{ k = maskwallcnt;
bglDisable(GL_POLYGON_OFFSET_FILL);
drawsprite(--spritesortcnt); while (j > 0) drawsprite(--j);
} while (k > 0) drawmaskwall(--k);
bglDisable(GL_POLYGON_OFFSET_FILL);
while (maskwallcnt > 0) drawmaskwall(--maskwallcnt);
} }
#endif #endif
#ifdef USE_OPENGL #ifdef USE_OPENGL
if ((r_depthpeeling) && (rendmode >= 3)) if ((r_depthpeeling) && (rendmode >= 3))
{ {
bglEndList(); bglPopAttrib();
bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
bglNewList(1, GL_COMPILE);
peelcompiling = 1;
curpolygonoffset = 0;
while (spritesortcnt > 0) drawsprite(--spritesortcnt);
while (maskwallcnt > 0) drawmaskwall(--maskwallcnt);
peelcompiling = 0; peelcompiling = 0;
bglEndList();
bglDisable(GL_BLEND); bglDisable(GL_BLEND);
bglEnable(GL_ALPHA_TEST); bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER, 0.0f); bglAlphaFunc(GL_GREATER, 0.0f);
bglEnable(GL_FRAGMENT_PROGRAM_ARB);
i = 0; i = 0;
while (i < r_peelscount) while (i < r_peelscount)
{ {
if (i > 0) if (i > 0)
{ {
bglEnable(GL_FRAGMENT_PROGRAM_ARB); bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]);
bglActiveTextureARB(GL_TEXTURE1_ARB); bglActiveTextureARB(GL_TEXTURE1_ARB);
bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[(i - 1) % 2]); bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[(i - 1) % 2]);
bglActiveTextureARB(GL_TEXTURE2_ARB);
bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[2]);
bglActiveTextureARB(GL_TEXTURE0_ARB); bglActiveTextureARB(GL_TEXTURE0_ARB);
} }
else
{
bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[0]);
bglActiveTextureARB(GL_TEXTURE1_ARB);
bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[2]);
bglActiveTextureARB(GL_TEXTURE0_ARB);
}
if (i == (r_peelscount - 1)) if (i == (r_peelscount - 1))
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
@ -6188,14 +6205,10 @@ else
bglPopAttrib(); bglPopAttrib();
bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
if (i > 0)
bglDisable(GL_FRAGMENT_PROGRAM_ARB);
i++; i++;
} }
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); bglDisable(GL_FRAGMENT_PROGRAM_ARB);
bglEnable(GL_BLEND); bglEnable(GL_BLEND);
bglDisable(GL_DEPTH_TEST); bglDisable(GL_DEPTH_TEST);
@ -6211,6 +6224,9 @@ else
bglEnable(GL_TEXTURE_RECTANGLE); bglEnable(GL_TEXTURE_RECTANGLE);
// backbuffer
drawpeel(r_peelscount);
if (r_curpeel == -1) if (r_curpeel == -1)
{ {
i = r_peelscount - 1; i = r_peelscount - 1;

View file

@ -33,6 +33,8 @@ void (APIENTRY * bglPopAttrib)( void );
GLenum (APIENTRY * bglGetError)( void ); GLenum (APIENTRY * bglGetError)( void );
const GLubyte* (APIENTRY * bglGetString)( GLenum name ); const GLubyte* (APIENTRY * bglGetString)( GLenum name );
void (APIENTRY * bglHint)( GLenum target, GLenum mode ); void (APIENTRY * bglHint)( GLenum target, GLenum mode );
void (APIENTRY * bglDrawBuffer)(GLenum mode);
void (APIENTRY * bglReadBuffer)(GLenum mode);
// Depth // Depth
void (APIENTRY * bglDepthFunc)( GLenum func ); void (APIENTRY * bglDepthFunc)( GLenum func );
@ -213,23 +215,25 @@ int loadgldriver(const char *driver)
#endif #endif
bglClearColor = GETPROC("glClearColor"); bglClearColor = GETPROC("glClearColor");
bglClear = GETPROC("glClear"); bglClear = GETPROC("glClear");
bglColorMask = GETPROC("glColorMask"); bglColorMask = GETPROC("glColorMask");
bglAlphaFunc = GETPROC("glAlphaFunc"); bglAlphaFunc = GETPROC("glAlphaFunc");
bglBlendFunc = GETPROC("glBlendFunc"); bglBlendFunc = GETPROC("glBlendFunc");
bglCullFace = GETPROC("glCullFace"); bglCullFace = GETPROC("glCullFace");
bglFrontFace = GETPROC("glFrontFace"); bglFrontFace = GETPROC("glFrontFace");
bglPolygonOffset = GETPROC("glPolygonOffset"); bglPolygonOffset = GETPROC("glPolygonOffset");
bglPolygonMode = GETPROC("glPolygonMode"); bglPolygonMode = GETPROC("glPolygonMode");
bglEnable = GETPROC("glEnable"); bglEnable = GETPROC("glEnable");
bglDisable = GETPROC("glDisable"); bglDisable = GETPROC("glDisable");
bglGetFloatv = GETPROC("glGetFloatv"); bglGetFloatv = GETPROC("glGetFloatv");
bglGetIntegerv = GETPROC("glGetIntegerv"); bglGetIntegerv = GETPROC("glGetIntegerv");
bglPushAttrib = GETPROC("glPushAttrib"); bglPushAttrib = GETPROC("glPushAttrib");
bglPopAttrib = GETPROC("glPopAttrib"); bglPopAttrib = GETPROC("glPopAttrib");
bglGetError = GETPROC("glGetError"); bglGetError = GETPROC("glGetError");
bglGetString = GETPROC("glGetString"); bglGetString = GETPROC("glGetString");
bglHint = GETPROC("glHint"); bglHint = GETPROC("glHint");
bglDrawBuffer = GETPROC("glDrawBuffer");
bglReadBuffer = GETPROC("glDrawBuffer");
// Depth // Depth
bglDepthFunc = GETPROC("glDepthFunc"); bglDepthFunc = GETPROC("glDepthFunc");
@ -375,6 +379,8 @@ int unloadgldriver(void)
bglGetError = NULL; bglGetError = NULL;
bglGetString = NULL; bglGetString = NULL;
bglHint = NULL; bglHint = NULL;
bglDrawBuffer = NULL;
bglReadBuffer = NULL;
// Depth // Depth
bglDepthFunc = NULL; bglDepthFunc = NULL;

View file

@ -144,10 +144,10 @@ long peelcompiling = 0; // internal control var to disable blending when com
long newpeelscount = 0; // temporary var for peels count changing during the game long newpeelscount = 0; // temporary var for peels count changing during the game
// Depth peeling data // Depth peeling data
GLuint ztexture[2]; // secondary Z-buffer identifier GLuint ztexture[3]; // secondary Z-buffers identifier
GLuint *peels; // peels identifiers GLuint *peels; // peels identifiers
GLuint *peelfbos; // peels FBOs identifiers GLuint *peelfbos; // peels FBOs identifiers
GLuint peelprogram; // ARBfp peeling fragment program GLuint peelprogram[2]; // ARBfp peeling fragment program
float fogresult, ofogresult; float fogresult, ofogresult;
@ -610,10 +610,10 @@ void polymost_glreset ()
// Depth peeling cleanup // Depth peeling cleanup
if (peels) if (peels)
{ {
bglDeleteProgramsARB(1, &peelprogram); bglDeleteProgramsARB(2, peelprogram);
bglDeleteFramebuffersEXT(r_peelscount, peelfbos); bglDeleteFramebuffersEXT(r_peelscount + 1, peelfbos);
bglDeleteTextures(r_peelscount, peels); bglDeleteTextures(r_peelscount + 1, peels);
bglDeleteTextures(2, ztexture); bglDeleteTextures(3, ztexture);
free(peels); free(peels);
free(peelfbos); free(peelfbos);
@ -626,21 +626,34 @@ void polymost_glinit()
{ {
GLfloat col[4]; GLfloat col[4];
int i; int i;
char peelprogramstring[] = char notpeeledprogramstring[] =
"!!ARBfp1.0\n" "!!ARBfp1.0\n"
"OPTION ARB_fog_exp2;\n" "OPTION ARB_fog_exp2;\n"
"OPTION ARB_fragment_program_shadow;\n" "OPTION ARB_fragment_program_shadow;\n"
"TEMP texsample;\n" "TEMP texsample;\n"
"TEMP depthresult;\n" "TEMP depthresult;\n"
"TEMP tempresult;\n"
"TEX texsample, fragment.texcoord[0], texture[0], 2D;\n"
"TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n" "TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n"
"MUL tempresult, fragment.color, texsample;\n" "ADD depthresult.a, depthresult.a, -0.5;\n"
"MUL tempresult.a, tempresult.a, depthresult.a;\n" "KIL depthresult.a;\n"
"MOV result.color, tempresult;\n" "TEX texsample, fragment.texcoord[0], texture[0], 2D;\n"
"MUL result.color, fragment.color, texsample;\n"
"END\n";
char peeledprogramstring[] =
"!!ARBfp1.0\n"
"OPTION ARB_fog_exp2;\n"
"OPTION ARB_fragment_program_shadow;\n"
"TEMP texsample;\n"
"TEMP depthresult;\n"
"TEX depthresult, fragment.position, texture[2], SHADOWRECT;\n"
"ADD depthresult.a, depthresult.a, -0.5;\n"
"KIL depthresult.a;\n"
"TEX depthresult, fragment.position, texture[1], SHADOWRECT;\n"
"ADD depthresult.a, depthresult.a, -0.5;\n"
"KIL depthresult.a;\n"
"TEX texsample, fragment.texcoord[0], texture[0], 2D;\n"
"MUL result.color, fragment.color, texsample;\n"
"END\n"; "END\n";
bglGetIntegerv(GL_ALPHA_BITS, &i);
#if 1 #if 1
if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc.")) if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc."))
{ {
@ -687,11 +700,11 @@ void polymost_glinit()
r_peelscount = newpeelscount; r_peelscount = newpeelscount;
newpeelscount = 0; newpeelscount = 0;
} }
// create the secondary Z-buffer // create the secondary Z-buffers and the Z-backbuffer
bglGenTextures(2, ztexture); bglGenTextures(3, ztexture);
i = 0; i = 0;
while (i < 2) while (i < 3)
{ {
bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[i]); bglBindTexture(GL_TEXTURE_RECTANGLE, ztexture[i]);
bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_DEPTH_COMPONENT, 0, 0, xdim, ydim, 0); bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_DEPTH_COMPONENT, 0, 0, xdim, ydim, 0);
@ -700,21 +713,24 @@ void polymost_glinit()
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP); bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_S, GL_CLAMP);
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP); bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_WRAP_T, GL_CLAMP);
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB);
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_GREATER); if (i < 2)
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_GREATER);
else
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_TEXTURE_COMPARE_FUNC_ARB, GL_LESS);
bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA); bglTexParameteri(GL_TEXTURE_RECTANGLE, GL_DEPTH_TEXTURE_MODE_ARB, GL_ALPHA);
i++; i++;
} }
// create the various peeling layers as well as the FBOs to render to them // create the various peeling layers as well as the FBOs to render to them
peels = malloc(r_peelscount * sizeof(GLuint)); peels = malloc((r_peelscount + 1) * sizeof(GLuint));
bglGenTextures(r_peelscount, peels); bglGenTextures(r_peelscount + 1, peels);
peelfbos = malloc(r_peelscount * sizeof(GLuint)); peelfbos = malloc((r_peelscount + 1) * sizeof(GLuint));
bglGenFramebuffersEXT(r_peelscount, peelfbos); bglGenFramebuffersEXT(r_peelscount + 1, peelfbos);
i = 0; i = 0;
while (i < r_peelscount) while (i <= r_peelscount)
{ {
bglBindTexture(GL_TEXTURE_RECTANGLE, peels[i]); bglBindTexture(GL_TEXTURE_RECTANGLE, peels[i]);
bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, xdim, ydim, 0); bglCopyTexImage2D(GL_TEXTURE_RECTANGLE, 0, GL_RGBA, 0, 0, xdim, ydim, 0);
@ -725,7 +741,9 @@ void polymost_glinit()
bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[i]); bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[i]);
bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE, peels[i], 0); bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE, peels[i], 0);
if (i < (r_peelscount - 1)) if (i == r_peelscount) // bakcbuffer
bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[2], 0);
else if (i < (r_peelscount - 1))
bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[i % 2], 0); bglFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_RECTANGLE, ztexture[i % 2], 0);
if (bglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) if (bglCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT)
@ -738,10 +756,12 @@ void polymost_glinit()
i++; i++;
} }
// create the peeling fragment program // create the peeling fragment programs
bglGenProgramsARB(1, &peelprogram); bglGenProgramsARB(2, peelprogram);
bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram); bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[0]);
bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peelprogramstring), peelprogramstring); bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(notpeeledprogramstring), notpeeledprogramstring);
bglBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, peelprogram[1]);
bglProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(peeledprogramstring), peeledprogramstring);
} }
} }
@ -3567,12 +3587,6 @@ void polymost_drawrooms ()
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (rendmode >= 3)
{ {
if (r_depthpeeling)
{
bglNewList(1, GL_COMPILE);
peelcompiling = 1;
}
resizeglcheck(); resizeglcheck();
//bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); //bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
@ -3605,6 +3619,13 @@ void polymost_drawrooms ()
globalposy += cosglobalang/1024; globalposy += cosglobalang/1024;
} }
} }
if (r_depthpeeling)
{
bglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, peelfbos[r_peelscount]);
bglPushAttrib(GL_VIEWPORT_BIT);
bglViewport(0, 0, xdim, ydim);
//bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
} }
#endif #endif
@ -3786,7 +3807,7 @@ void polymost_drawrooms ()
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (rendmode >= 3) if (rendmode >= 3)
{ {
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS bglDepthFunc(GL_LEQUAL); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
//bglPolygonOffset(0,0); //bglPolygonOffset(0,0);
bglDepthRange(0.0,0.99999); //<- this is more widely supported than glPolygonOffset bglDepthRange(0.0,0.99999); //<- this is more widely supported than glPolygonOffset
@ -3818,6 +3839,16 @@ void polymost_drawmaskwall (long damaskwallcnt)
globalpal = (long)((unsigned char)wal->pal); globalpal = (long)((unsigned char)wal->pal);
globalorientation = (long)wal->cstat; globalorientation = (long)wal->cstat;
#ifdef USE_OPENGL
if (r_depthpeeling)
{
if ((((wal->cstat&128) || (gltexmayhavealpha(globalpicnum,globalpal)))) && !peelcompiling)
return; // discard translucent sprite if drawing the backbuffer when doing depth peeling
if (!(((wal->cstat&128) || (gltexmayhavealpha(globalpicnum,globalpal)))) && peelcompiling)
return; // discard opaque sprite when composing the depth peels
}
#endif
sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx); sx0 = (float)(wal->x-globalposx); sx1 = (float)(wal2->x-globalposx);
sy0 = (float)(wal->y-globalposy); sy1 = (float)(wal2->y-globalposy); sy0 = (float)(wal->y-globalposy); sy1 = (float)(wal2->y-globalposy);
yp0 = sx0*gcosang2 + sy0*gsinang2; yp0 = sx0*gcosang2 + sy0*gsinang2;
@ -3995,7 +4026,15 @@ void polymost_drawsprite (long snum)
method = 1+4; method = 1+4;
if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; } if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
#ifdef USE_OPENGL #ifdef USE_OPENGL
if (r_depthpeeling)
{
if ((((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && !peelcompiling)
return; // discard translucent sprite if drawing the backbuffer when doing depth peeling
if (!(((tspr->cstat&2) || (gltexmayhavealpha(globalpicnum,tspr->pal)))) && peelcompiling)
return; // discard opaque sprite when composing the depth peels
}
if (!nofog && rendmode >= 3) { if (!nofog && rendmode >= 3) {
float col[4]; float col[4];
col[0] = (float)palookupfog[sector[tspr->sectnum].floorpal].r / 63.f; col[0] = (float)palookupfog[sector[tspr->sectnum].floorpal].r / 63.f;
@ -4027,7 +4066,6 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) method = 2+4; else method = 3+4; }
curpolygonoffset += 0.01f; curpolygonoffset += 0.01f;
bglEnable(GL_POLYGON_OFFSET_FILL); bglEnable(GL_POLYGON_OFFSET_FILL);
bglPolygonOffset(-curpolygonoffset, -curpolygonoffset); bglPolygonOffset(-curpolygonoffset, -curpolygonoffset);
//bglDepthMask(0);
} }
#endif #endif

View file

@ -38,6 +38,11 @@ CFLAGS= /MD /J /nologo $(flags_cl) \
LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \ LIBS=user32.lib gdi32.lib shell32.lib dxguid.lib winmm.lib wsock32.lib comctl32.lib \
/NODEFAULTLIB:libFLAC.lib glu32.lib /NODEFAULTLIB:libFLAC.lib glu32.lib
!ifdef JFAUD
LIBS=$(LIBS) ../jfaud/jfaud.lib ../jfaud/mpadec/mpadec.lib
CFLAGS=$(CFLAGS) /DJFAUD
!endif
ASFLAGS=/nologo /coff ASFLAGS=/nologo /coff
ASFLAGS=/nologo /coff ASFLAGS=/nologo /coff
EXESUFFIX=.exe EXESUFFIX=.exe
@ -50,8 +55,8 @@ JMACTOBJ=$(OBJ)\util_lib.$o \
$(OBJ)\mathutil.$o \ $(OBJ)\mathutil.$o \
$(OBJ)\scriplib.$o $(OBJ)\scriplib.$o
#AUDIOLIB_FX=$(OBJ)\jaudiolib_fxstub.$o AUDIOLIB_FX_STUB=$(OBJ)\jaudiolib_fxstub.$o
#AUDIOLIB_MUSIC=$(OBJ)\jaudiolib_musicstub.$o AUDIOLIB_MUSIC_STUB=$(OBJ)\jaudiolib_musicstub.$o
#AUDIOLIB_FX=$(OBJ)\jaudiolib_fx_fmod.$o #AUDIOLIB_FX=$(OBJ)\jaudiolib_fx_fmod.$o
AUDIOLIB_JFAUD=$(OBJ)\jfaud_sounds.$o AUDIOLIB_JFAUD=$(OBJ)\jfaud_sounds.$o
AUDIOLIB_FX=$(OBJ)\mv_mix.$o \ AUDIOLIB_FX=$(OBJ)\mv_mix.$o \
@ -65,8 +70,12 @@ AUDIOLIB_FX=$(OBJ)\mv_mix.$o \
AUDIOLIB_MUSIC=$(OBJ)\midi.$o \ AUDIOLIB_MUSIC=$(OBJ)\midi.$o \
$(OBJ)\mpu401.$o \ $(OBJ)\mpu401.$o \
$(OBJ)\music.$o $(OBJ)\music.$o
!ifdef JFAUD
AUDIOLIBOBJ=$(AUDIOLIB_JFAUD)
!else
AUDIOLIBOBJ=$(AUDIOLIB_MUSIC) $(AUDIOLIB_FX) $(OBJ)\sounds.$o AUDIOLIBOBJ=$(AUDIOLIB_MUSIC) $(AUDIOLIB_FX) $(OBJ)\sounds.$o
#AUDIOLIBOBJ=$(AUDIOLIB_JFAUD) !endif
GAMEOBJS=$(OBJ)\game.$o \ GAMEOBJS=$(OBJ)\game.$o \
$(OBJ)\actors.$o \ $(OBJ)\actors.$o \

View file

@ -2,23 +2,78 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eduke32", "eduke32.vcproj", "{8E7A6179-0B72-4073-8A4C-E8682D481DAE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eduke32", "eduke32.vcproj", "{8E7A6179-0B72-4073-8A4C-E8682D481DAE}"
ProjectSection(ProjectDependencies) = postProject
{CD149A75-4507-404D-856C-E9DBC2E0B286} = {CD149A75-4507-404D-856C-E9DBC2E0B286}
{862365FE-811C-46B8-BB1E-B7189DA8D858} = {862365FE-811C-46B8-BB1E-B7189DA8D858}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jfaud", "..\jfaud\jfaud.vcproj", "{CD149A75-4507-404D-856C-E9DBC2E0B286}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpadec", "..\jfaud\mpadec\mpadec.vcproj", "{862365FE-811C-46B8-BB1E-B7189DA8D858}"
ProjectSection(ProjectDependencies) = postProject
{CD149A75-4507-404D-856C-E9DBC2E0B286} = {CD149A75-4507-404D-856C-E9DBC2E0B286}
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Classic JFAud|Win32 = Classic JFAud|Win32
Classic Release JFAud|Win32 = Classic Release JFAud|Win32
Classic Release|Win32 = Classic Release|Win32 Classic Release|Win32 = Classic Release|Win32
Classic|Win32 = Classic|Win32 Classic|Win32 = Classic|Win32
HRP SD JFAud|Win32 = HRP SD JFAud|Win32
HRP SD Release JFAud|Win32 = HRP SD Release JFAud|Win32
HRP SD Release|Win32 = HRP SD Release|Win32 HRP SD Release|Win32 = HRP SD Release|Win32
HRP SD|Win32 = HRP SD|Win32 HRP SD|Win32 = HRP SD|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic JFAud|Win32.ActiveCfg = Classic JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic JFAud|Win32.Build.0 = Classic JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release JFAud|Win32.ActiveCfg = Classic Release JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release JFAud|Win32.Build.0 = Classic Release JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release|Win32.ActiveCfg = Classic Release|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release|Win32.ActiveCfg = Classic Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release|Win32.Build.0 = Classic Release|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic Release|Win32.Build.0 = Classic Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic|Win32.ActiveCfg = Classic|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic|Win32.ActiveCfg = Classic|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic|Win32.Build.0 = Classic|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.Classic|Win32.Build.0 = Classic|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD JFAud|Win32.ActiveCfg = HRP SD JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD JFAud|Win32.Build.0 = HRP SD JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release JFAud|Win32.ActiveCfg = HRP SD Release JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release JFAud|Win32.Build.0 = HRP SD Release JFAud|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release|Win32.ActiveCfg = HRP SD Release|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release|Win32.ActiveCfg = HRP SD Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release|Win32.Build.0 = HRP SD Release|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD Release|Win32.Build.0 = HRP SD Release|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD|Win32.ActiveCfg = HRP SD|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD|Win32.ActiveCfg = HRP SD|Win32
{8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD|Win32.Build.0 = HRP SD|Win32 {8E7A6179-0B72-4073-8A4C-E8682D481DAE}.HRP SD|Win32.Build.0 = HRP SD|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic JFAud|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic JFAud|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic Release JFAud|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic Release JFAud|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic Release|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic Release|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.Classic|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD JFAud|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD JFAud|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD Release JFAud|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD Release JFAud|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD Release|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD Release|Win32.Build.0 = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD|Win32.ActiveCfg = Release|Win32
{CD149A75-4507-404D-856C-E9DBC2E0B286}.HRP SD|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic JFAud|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic JFAud|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic Release JFAud|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic Release JFAud|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic Release|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic Release|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.Classic|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD JFAud|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD JFAud|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD Release JFAud|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD Release JFAud|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD Release|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD Release|Win32.Build.0 = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD|Win32.ActiveCfg = Release|Win32
{862365FE-811C-46B8-BB1E-B7189DA8D858}.HRP SD|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -97,6 +97,88 @@
CompileAsManaged="" CompileAsManaged=""
/> />
</Configuration> </Configuration>
<Configuration
Name="Classic JFAud|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
BuildLogFile=""
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /f Makefile.msvc DEBUG=1 JFAUD=1"
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all DEBUG=1 JFAUD=1"
CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="HRP SD JFAud|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /f Makefile.msvc DEBUG=1 JFAUD=1"
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all DEBUG=1 JFAUD=1"
CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="Classic Release JFAud|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
BuildLogFile=""
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /f Makefile.msvc JFAUD=1"
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all JFAUD=1"
CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
<Configuration
Name="HRP SD Release JFAud|Win32"
OutputDirectory="$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="0"
>
<Tool
Name="VCNMakeTool"
BuildCommandLine="nmake /f Makefile.msvc JFAUD=1"
ReBuildCommandLine="nmake /f Makefile.msvc veryclean all JFAUD=1"
CleanCommandLine="nmake /f Makefile.msvc veryclean"
Output="eduke32.exe"
PreprocessorDefinitions="WIN32;_DEBUG;SUPERBUILD;POLYMOST;USE_OPENGL;NOCOPYPROTECT;RENDERTYPEWIN"
IncludeSearchPath=""
ForcedIncludes=""
AssemblySearchPath=""
ForcedUsingAssemblies=""
CompileAsManaged=""
/>
</Configuration>
</Configurations> </Configurations>
<References> <References>
</References> </References>
@ -612,11 +694,11 @@
> >
</File> </File>
<File <File
RelativePath=".\source\develop.h" RelativePath=".\source\jmact\develop.h"
> >
</File> </File>
<File <File
RelativePath=".\source\jmact\develop.h" RelativePath=".\source\develop.h"
> >
</File> </File>
<File <File

View file

@ -311,7 +311,7 @@ void playmusic(const char *fn)
if (!MusicToggle) return; if (!MusicToggle) return;
if (!jfaud) return; if (!jfaud) return;
dotpos = Bstrrchr(fn,'.'); dotpos = Bstrrchr((char *)fn,'.');
if (dotpos && Bstrcasecmp(dotpos,".mid")) { if (dotpos && Bstrcasecmp(dotpos,".mid")) {
// has extension but isn't midi // has extension but isn't midi
jfaud->PlayMusic(fn, NULL); jfaud->PlayMusic(fn, NULL);

View file

@ -21,7 +21,7 @@ VORBISDL=vorbisfile.dll
# FLAC # FLAC
# http://flac.sf.net/ # http://flac.sf.net/
USEFLAC=1 USEFLAC=0
LINKFLAC=0 LINKFLAC=0
FLACCFLAGS= FLACCFLAGS=
FLACLIBS=libflac.lib FLACLIBS=libflac.lib
@ -30,7 +30,7 @@ FLACDL=libflac.dll
# MPEG Audio via mpadec # MPEG Audio via mpadec
# http://mpadec.sf.net/ # http://mpadec.sf.net/
USEMPADEC=1 USEMPADEC=1
LINKMPADEC=0 LINKMPADEC=1
MPADECCFLAGS=/Impadec MPADECCFLAGS=/Impadec
MPADECLIBS=mpadec\mpadec.lib MPADECLIBS=mpadec\mpadec.lib
MPADECDL=mpadec.dll MPADECDL=mpadec.dll
@ -42,9 +42,9 @@ SDLLIBS=/LIBPATH:C:\sdks\SDL-msvc\lib SDL.lib
# Directories for library SDKs on Windows # Directories for library SDKs on Windows
# I keep my third-party libraries each in a directory on their own. # I keep my third-party libraries each in a directory on their own.
SDKDIRECTX=c:\sdks\directx\dx7 SDKDIRECTX=c:\sdks\dx6
SDKOPENAL=c:\sdks\OpenAL SDKOPENAL=c:\sdks\OpenAL
SDKVORBIS=c:\sdks\oggvorbis-win32sdk-1.0.1 SDKVORBIS=c:\sdks\oggvorbis
SDKFLAC=c:\sdks\flac SDKFLAC=c:\sdks\flac
obj=obj obj=obj
@ -69,7 +69,7 @@ FLACLIBS=/LIBPATH:$(SDKFLAC)\bin $(FLACLIBS)
MPADECCFLAGS=$(MPADECCFLAGS) /DMPADECDL=\"$(MPADECDL)\" MPADECCFLAGS=$(MPADECCFLAGS) /DMPADECDL=\"$(MPADECDL)\"
CFLAGS=/G6Fy /Ox /MD /DDEBUG /nologo /I$(inc) $(platformcflags) CFLAGS=/O2 /Ox /MD /DDEBUG /nologo /D "_CRT_SECURE_NO_DEPRECATE" -W0 /I$(inc) $(platformcflags)
LIBS=$(platformlibs) LIBS=$(platformlibs)
dependencies= dependencies=

View file

@ -1,4 +1,4 @@
CFLAGS=/I.. /I..\include /MD /Ox CFLAGS=/I.. /I..\include /MD /Ox /D "_CRT_SECURE_NO_DEPRECATE" -W0
OBJS=layer1.obj layer2.obj layer3.obj synth.obj tables.obj mpadec.obj mp3dec.obj OBJS=layer1.obj layer2.obj layer3.obj synth.obj tables.obj mpadec.obj mp3dec.obj

View file

@ -17,7 +17,7 @@
#endif #endif
#ifndef SCREWED_UP_CPP #ifndef SCREWED_UP_CPP
using namespace std; //using namespace std;
#endif #endif
DynamicLibrary::DynamicLibrary(const char *name) DynamicLibrary::DynamicLibrary(const char *name)

View file

@ -115,7 +115,7 @@ bool JFAud::InitWave(const char *name, int numvoices, int frequency)
if (wavemixer) return false; if (wavemixer) return false;
if (numvoices < 1) numvoices = 1; if (numvoices < 1) numvoices = 1;
if (name) devid = strchr(name, ':'); if (name) devid = strchr((char *)name, ':');
if (devid) devid++; if (devid) devid++;
if (!name) drv = 0; if (!name) drv = 0;