From 67efe33c1830eea4090a99641108317a9509055f Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 4 Mar 2007 19:52:57 +0000 Subject: [PATCH] Small things git-svn-id: https://svn.eduke32.com/eduke32@514 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/engine.c | 9 ++-- polymer/build/src/glbuild.c | 2 +- polymer/build/src/mdsprite.c | 70 ------------------------------- polymer/build/src/osd.c | 2 +- polymer/build/src/winlayer.c | 58 +++++++++++++++++++++++++ polymer/eduke32/source/anim.c | 13 +++++- polymer/eduke32/source/astub.c | 7 +++- polymer/eduke32/source/game.c | 12 ++++-- polymer/eduke32/source/gamevars.c | 1 + polymer/eduke32/source/menus.c | 12 +++--- polymer/eduke32/source/premap.c | 24 +++++++---- 11 files changed, 113 insertions(+), 97 deletions(-) diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 252bd4e84..8327dc1c3 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -6084,12 +6084,13 @@ if ((!r_depthpeeling) || (rendmode < 3)) drawline256(xs+65536,ys-65536,xs-65536,ys+65536,31); }*/ -#ifdef USE_OPENGL +#if defined(USE_OPENGL) && defined(POLYMOST) if ((!r_depthpeeling) || (rendmode < 3)) #endif { +#if defined(USE_OPENGL) && defined(POLYMOST) curpolygonoffset = 0; - +#endif pos.x = globalposx; pos.y = globalposy; @@ -6136,7 +6137,7 @@ if ((!r_depthpeeling) || (rendmode < 3)) } } /* depthpeeling */ -#ifdef USE_OPENGL +#if defined(USE_OPENGL) && defined(POLYMOST) else { curpolygonoffset = 0; @@ -6148,7 +6149,7 @@ else } #endif -#ifdef USE_OPENGL +#if defined(USE_OPENGL) && defined(POLYMOST) if ((r_depthpeeling) && (rendmode >= 3)) { bglPopAttrib(); diff --git a/polymer/build/src/glbuild.c b/polymer/build/src/glbuild.c index 6a9b45bd6..235169a9c 100644 --- a/polymer/build/src/glbuild.c +++ b/polymer/build/src/glbuild.c @@ -330,7 +330,7 @@ int loadgldriver(const char *driver) bglClearStencil = GETPROC("glClearStencil"); bglStencilOp = GETPROC("glStencilOp"); bglStencilFunc = GETPROC("glStencilFunc"); - + loadglextensions(); loadglulibrary(getenv("BUILD_GLULIB")); diff --git a/polymer/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index 538ff3760..2224ab248 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -1321,12 +1321,6 @@ static int md3draw (md3model *m, spritetype *tspr) if (m->head.flags == 1337) { // md2 - /*m0.x = m->scale * g * m->muladdframes[m->cframe*2].x; m1.x = m->scale * f * m->muladdframes[m->nframe*2].x; - m0.y = m->scale * g * m->muladdframes[m->cframe*2].y; m1.y = m->scale * f * m->muladdframes[m->nframe*2].y; - m0.z = m->scale * g * m->muladdframes[m->cframe*2].z; m1.z = m->scale * f * m->muladdframes[m->nframe*2].z; - a0.x = m->muladdframes[m->cframe*2+1].x * m->scale; a0.x = (m->muladdframes[m->nframe*2+1].x * m->scale - a0.x)*f+a0.x; - a0.y = m->muladdframes[m->cframe*2+1].y * m->scale; a0.y = (m->muladdframes[m->nframe*2+1].y * m->scale - a0.y)*f+a0.y; - a0.z = m->muladdframes[m->cframe*2+1].z * m->scale; a0.z = (m->muladdframes[m->nframe*2+1].z * m->scale - a0.z)*f+a0.z + m->zadd*m->scale;*/ m0.x = m->scale * g; m1.x = m->scale *f; m0.y = m->scale * g; m1.y = m->scale *f; m0.z = m->scale * g; m1.z = m->scale *f; @@ -1594,50 +1588,6 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } //PLAG: delayed polygon-level sorted rendering if (m->usesalpha && !(tspr->cstat & 1024) && !r_depthpeeling) { - // old sorting methods - dead code - /*for(i=s->numtris-1;i>=0;i--) - { - tempf = (vertlist[s->tris[i].i[0]].x * mat[2]) + (vertlist[s->tris[i].i[0]].y * mat[6]) + (vertlist[s->tris[i].i[0]].z * mat[10]) + mat[14]; - if (tempf < ((vertlist[s->tris[i].i[1]].x * mat[2]) + (vertlist[s->tris[i].i[1]].y * mat[6]) + (vertlist[s->tris[i].i[1]].z * mat[10]) + mat[14])) - tempf = (vertlist[s->tris[i].i[1]].x * mat[2]) + (vertlist[s->tris[i].i[1]].y * mat[6]) + (vertlist[s->tris[i].i[1]].z * mat[10]) + mat[14]; - if (tempf < ((vertlist[s->tris[i].i[2]].x * mat[2]) + (vertlist[s->tris[i].i[2]].y * mat[6]) + (vertlist[s->tris[i].i[2]].z * mat[10]) + mat[14])) - tempf = (vertlist[s->tris[i].i[2]].x * mat[2]) + (vertlist[s->tris[i].i[2]].y * mat[6]) + (vertlist[s->tris[i].i[2]].z * mat[10]) + mat[14]; - maxdepths[i] = tempf; - indexes[i] = i; - } - - for(i=s->numtris-1;i>=0;i--) - { - tempf = (vertlist[s->tris[i].i[0]].x * mat[2]) + (vertlist[s->tris[i].i[0]].y * mat[6]) + (vertlist[s->tris[i].i[0]].z * mat[10]) + mat[14]; - tempf += (vertlist[s->tris[i].i[1]].x * mat[2]) + (vertlist[s->tris[i].i[1]].y * mat[6]) + (vertlist[s->tris[i].i[1]].z * mat[10]) + mat[14]; - tempf += (vertlist[s->tris[i].i[2]].x * mat[2]) + (vertlist[s->tris[i].i[2]].y * mat[6]) + (vertlist[s->tris[i].i[2]].z * mat[10]) + mat[14]; - tempf /= 3.0f; - maxdepths[i] = tempf; - indexes[i] = i; - } - - for(i=s->numtris-1;i>=0;i--) - { - tempvec[0].x = (vertlist[s->tris[i].i[0]].x * mat[0]) + (vertlist[s->tris[i].i[0]].y * mat[4]) + (vertlist[s->tris[i].i[0]].z * mat[8]) + mat[12]; - tempvec[0].y = (vertlist[s->tris[i].i[0]].x * mat[1]) + (vertlist[s->tris[i].i[0]].y * mat[5]) + (vertlist[s->tris[i].i[0]].z * mat[9]) + mat[13]; - tempvec[0].z = (vertlist[s->tris[i].i[0]].x * mat[2]) + (vertlist[s->tris[i].i[0]].y * mat[6]) + (vertlist[s->tris[i].i[0]].z * mat[10]) + mat[14]; - - tempvec[1].x = (vertlist[s->tris[i].i[1]].x * mat[0]) + (vertlist[s->tris[i].i[1]].y * mat[4]) + (vertlist[s->tris[i].i[1]].z * mat[8]) + mat[12]; - tempvec[1].y = (vertlist[s->tris[i].i[1]].x * mat[1]) + (vertlist[s->tris[i].i[1]].y * mat[5]) + (vertlist[s->tris[i].i[1]].z * mat[9]) + mat[13]; - tempvec[1].z = (vertlist[s->tris[i].i[1]].x * mat[2]) + (vertlist[s->tris[i].i[1]].y * mat[6]) + (vertlist[s->tris[i].i[1]].z * mat[10]) + mat[14]; - - tempvec[2].x = (vertlist[s->tris[i].i[2]].x * mat[0]) + (vertlist[s->tris[i].i[2]].y * mat[4]) + (vertlist[s->tris[i].i[2]].z * mat[8]) + mat[12]; - tempvec[2].y = (vertlist[s->tris[i].i[2]].x * mat[1]) + (vertlist[s->tris[i].i[2]].y * mat[5]) + (vertlist[s->tris[i].i[2]].z * mat[9]) + mat[13]; - tempvec[2].z = (vertlist[s->tris[i].i[2]].x * mat[2]) + (vertlist[s->tris[i].i[2]].y * mat[6]) + (vertlist[s->tris[i].i[2]].z * mat[10]) + mat[14]; - - tempf = (tempvec[0].x * tempvec[0].x) + (tempvec[0].y * tempvec[0].y) + (tempvec[0].z * tempvec[0].z); - tempf += (tempvec[1].x * tempvec[1].x) + (tempvec[1].y * tempvec[1].y) + (tempvec[1].z * tempvec[1].z); - tempf += (tempvec[2].x * tempvec[2].x) + (tempvec[2].y * tempvec[2].y) + (tempvec[2].z * tempvec[2].z); - - maxdepths[i] = tempf; - indexes[i] = i; - }*/ - for (i=s->numtris-1;i>=0;i--) { // Matrix multiplication - ugly but clear @@ -1666,26 +1616,6 @@ if (tspr->cstat&2) { if (!(tspr->cstat&512)) pc[3] = 0.66; else pc[3] = 0.33; } m->indexes[i] = i; } - //bubble sort - dead code - /*test = 0; - j = 0; - while (j == 0) - { - j = 1; - for(i=s->numtris-1;i>0;i--) - if (maxdepths[i] < maxdepths[i-1]) - { - f = maxdepths[i]; - maxdepths[i] = maxdepths[i-1]; - maxdepths[i-1] = f; - k = indexes[i]; - indexes[i] = indexes[i-1]; - indexes[i-1] = k; - test++; - j = 0; - } - }*/ - // dichotomic recursive sorting - about 100x less iterations than bubblesort quicksort(m->indexes, m->maxdepths, 0, s->numtris - 1); diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index 4a4b101a1..9fb18625a 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -38,7 +38,7 @@ static void _internal_clearbackground(int,int); static int _internal_gettime(void); static void _internal_onshowosd(int); -#define TEXTSIZE 16384 +#define TEXTSIZE 32768 // history display static char osdtext[TEXTSIZE]; diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index c3faa9043..1eef6594e 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -399,6 +399,62 @@ static int set_maxrefreshfreq(const osdfuncparm_t *parm) // // initsystem() -- init systems // + +static void print_os_version(void) +{ + OSVERSIONINFO osv; + const char *ver; + // I was going to call this 'windows_9x_is_awful', but I couldn't justify ever setting it to 0 + int awful_windows_9x = 0; + + osv.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&osv); + + switch (osv.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + if (osv.dwMajorVersion == 5) + { + switch (osv.dwMinorVersion) + { + case 0: + ver = "2000"; + break; + case 1: + ver = "XP"; + break; + case 2: + ver = "Server 2003"; + break; + } + break; + } + if (osv.dwMajorVersion == 6 && osv.dwMinorVersion == 0) + ver = "Vista"; + break; + + case VER_PLATFORM_WIN32_WINDOWS: + awful_windows_9x = 1; + if (osv.dwMinorVersion < 10) + ver = "95"; + else if (osv.dwMinorVersion < 90) + ver = "98"; + else ver = "Me"; + break; + + default: + ver = "Unknown"; + initprintf("OS: Unknown OS\n"); + return; + } + + initprintf("OS: Windows %s (Version %lu.%lu.%lu)\n", ver, osv.dwMajorVersion, osv.dwMinorVersion, + awful_windows_9x?osv.dwBuildNumber&0xffff:osv.dwBuildNumber); + if (osv.szCSDVersion[0]) + initprintf(" - %s\n", osv.szCSDVersion); +} + + int initsystem(void) { DEVMODE desktopmode; @@ -425,6 +481,8 @@ int initsystem(void) frameplace=0; lockcount=0; + print_os_version(); + #if defined(USE_OPENGL) && defined(POLYMOST) if (loadgldriver(getenv("BUILD_GLDRV"))) { initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n"); diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index 0a6d2bc6b..59ae442a4 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -204,7 +204,9 @@ void playanm(const char *fn,char t) char *animbuf; unsigned char *palptr; long i, j, length=0, numframes=0; - +#if defined(POLYMOST) && defined(USE_OPENGL) + int ogltexfiltermode=gltexfiltermode; +#endif int32 handle=-1; // return; @@ -248,6 +250,11 @@ void playanm(const char *fn,char t) //setbrightness(ud.brightness>>2,tempbuf,2); setgamepalette(&ps[myconnectindex],animpal,10); +#if defined(POLYMOST) && defined(USE_OPENGL) + gltexfiltermode = 0; + gltexapplyprops(); +#endif + ototalclock = totalclock + 10; for (i=1;ilotag>skill+1) { tspr->xrepeat=0; + tspr->cstat=32768; break; } } if (nosprites==2||nosprites==3) { tspr->xrepeat=0; - // tspr->cstat|=32768; + tspr->cstat=32768; } // else tspr->cstat&=32767; +#if defined(USE_OPENGL) && defined(POLYMOST) if (!usemodels || md_tilehasmodel(tspr->picnum) < 0) +#endif { if (frames!=0) { diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 7c78ecb1b..87291d301 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -48,6 +48,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "util_lib.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include #include extern int getversionfromwebsite(char *buffer); #define BUILDDATE 20070125 @@ -3457,7 +3459,10 @@ void displayrest(long smoothratio) #if defined(POLYMOST) && defined(USE_OPENGL) { extern char mdpause; - mdpause = ud.pause_on; + + mdpause = 0; + if (ud.pause_on || (ps[myconnectindex].gm&MODE_MENU && numplayers < 2)) + mdpause = 1; } #endif @@ -7585,7 +7590,8 @@ FOUNDCHEAT: { if (ps[myconnectindex].cheat_phase >= 0 && numplayers < 2 && ud.recstat == 0) { - KB_ClearKeyDown((unsigned char)cheatkey[0]); + if (cheatkey[0] == cheatkey[1]) + KB_ClearKeyDown((unsigned char)cheatkey[0]); ps[myconnectindex].cheat_phase = -1; } } @@ -9739,7 +9745,7 @@ void app_main(int argc,char **argv) initprintf("%s (%s)\n",apptitle,datetimestring); initprintf("Copyright (c) 1996, 2003 3D Realms Entertainment\n"); - initprintf("Copyright (c) 2006 EDuke32 team\n"); + initprintf("Copyright (c) 2007 EDuke32 team\n"); #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) addsearchpath("/usr/share/games/jfduke3d"); diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index a484f15f9..0f800637d 100755 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" #include "gamedef.h" +#include "osd.h" extern int g_i,g_p; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 5c379dac1..17de220dc 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -3225,7 +3225,7 @@ cheat_for_port_credits: menutext(c,50+62+16,MENUHIGHLIGHT(4),PHX(-6),"BRIGHTNESS"); { short ss = ud.brightness; - bar(c+167,50+62+16,&ss,8,x==4,MENUHIGHLIGHT(4),PHX(-6)); + bar(c+171,50+62+16,&ss,8,x==4,MENUHIGHLIGHT(4),PHX(-6)); if (x==4) { ud.brightness = ss; @@ -4255,9 +4255,9 @@ cheat_for_port_credits: break; } - menutext(c+160+40,50,MENUHIGHLIGHT(0),(FXDevice<0),SoundToggle && FXDevice >= 0?"ON":"OFF"); + menutext(c+151+40,50,MENUHIGHLIGHT(0),(FXDevice<0),SoundToggle && FXDevice >= 0?"ON":"OFF"); - menutext(c+160+40,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),(MusicToggle && (MusicDevice >= 0))?"ON":"OFF"); + menutext(c+151+40,50+16,MENUHIGHLIGHT(1),(MusicDevice<0||(numplayers > 1 && !MusicToggle)),(MusicToggle && (MusicDevice >= 0))?"ON":"OFF"); menutext(c,50,MENUHIGHLIGHT(0),(FXDevice<0),"SOUND"); menutext(c,50+16+16,MENUHIGHLIGHT(2),(FXDevice<0)||SoundToggle==0,"SOUND VOLUME"); @@ -4291,12 +4291,12 @@ cheat_for_port_credits: { char *s[] = { "OFF", "LOCAL", "ALL" }; - menutext(c+160+40,50+16+16+16+16,MENUHIGHLIGHT(4),(FXDevice<0)||SoundToggle==0,s[VoiceToggle]); + menutext(c+151+40,50+16+16+16+16,MENUHIGHLIGHT(4),(FXDevice<0)||SoundToggle==0,s[VoiceToggle]); } - menutext(c+160+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,AmbienceToggle?"ON":"OFF"); + menutext(c+151+40,50+16+16+16+16+16,MENUHIGHLIGHT(5),(FXDevice<0)||SoundToggle==0,AmbienceToggle?"ON":"OFF"); - menutext(c+160+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(FXDevice<0)||SoundToggle==0,ReverseStereo?"ON":"OFF"); + menutext(c+151+40,50+16+16+16+16+16+16,MENUHIGHLIGHT(6),(FXDevice<0)||SoundToggle==0,ReverseStereo?"ON":"OFF"); break; diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index b45955dbb..ff272f973 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -25,6 +25,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "duke3d.h" #include "osd.h" +#ifdef RENDERTYPEWIN +#define WIN32_LEAN_AND_MEAN +#include +#endif + extern char pow2char[]; extern char everyothertime; @@ -1310,7 +1315,8 @@ static void resetpspritevars(char g) for (i=1;ipal == 0) { - int k; + int k = 0; - for (k=0;k