From 991d785e73d687777ad954feea6f4c6e9d4287da Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 12 Dec 2006 09:28:37 +0000 Subject: [PATCH] Add an extra noapply flag to setbrightness() so we can invalidate just the 8 bit textures. git-svn-id: https://svn.eduke32.com/eduke32@415 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/include/baselayer.h | 2 +- polymer/build/src/engine.c | 3 ++- polymer/build/src/polymost.c | 21 ++++++++++++++++++++- polymer/build/src/sdlayer.c | 2 +- polymer/build/src/winlayer.c | 2 +- polymer/eduke32/source/anim.c | 4 ++-- polymer/eduke32/source/game.c | 18 +++++++++--------- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/polymer/build/include/baselayer.h b/polymer/build/include/baselayer.h index b3b5d74e8..818e84355 100644 --- a/polymer/build/include/baselayer.h +++ b/polymer/build/include/baselayer.h @@ -69,7 +69,7 @@ void initprintf(const char *, ...); void debugprintf(const char *,...); int handleevents(void); -void idle(void); +inline void idle(void); typedef void (*KeyPressCallback)(long,long); typedef void (*MousePressCallback)(long,long); diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index c9bc0003c..6a0e27e14 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -9642,7 +9642,8 @@ void setbrightness(char dabrightness, char *dapal, char noapply) // changed and we couldn't set it using hardware gamma if (!(noapply&2) && (newpalettesum != lastpalettesum)) gltexinvalidateall(); - + if (!(noapply&8) && (newpalettesum != lastpalettesum)) + gltexinvalidate8(); lastpalettesum = newpalettesum; } #endif diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index f800b0547..35d5aaf73 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -466,6 +466,25 @@ void gltexinvalidateall () #endif } +void gltexinvalidate8 () +{ + long j; + pthtyp *pth; + + for (j=GLTEXCACHEADSIZ-1;j>=0;j--) + for (pth=gltexcachead[j];pth;pth=pth->next) + { + if (pth->hicr == NULL) + { + pth->flags |= 128; + if (pth->flags & 16) + pth->ofb->flags |= 128; + } + } +#ifdef DEBUGGINGAIDS + OSD_Printf("gltexinvalidate8()\n"); +#endif +} void gltexapplyprops (void) { @@ -580,7 +599,7 @@ void polymost_glinit() { GLfloat col[4]; -#if 0 +#if 1 if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc.")) { initprintf("polymost_glinit(): ATI detected, GL_FOG_HINT = GL_DONT_CARE\n"); diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 0b2c9d140..0f6a375cd 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -1499,7 +1499,7 @@ int handleevents(void) return rv; } -void idle(void) +inline void idle(void) { usleep(1); } diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 746bf5889..627f91889 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -528,7 +528,7 @@ int handleevents(void) return rv; } -void idle(void) +inline void idle(void) { Sleep(1); } diff --git a/polymer/eduke32/source/anim.c b/polymer/eduke32/source/anim.c index 01c231dae..87a9d067d 100644 --- a/polymer/eduke32/source/anim.c +++ b/polymer/eduke32/source/anim.c @@ -244,7 +244,7 @@ void playanm(char *fn,char t) //setpalette(0L,256L,tempbuf); //setbrightness(ud.brightness>>2,tempbuf,2); - setgamepalette(&ps[myconnectindex],animpal,2); + setgamepalette(&ps[myconnectindex],animpal,10); ototalclock = totalclock + 10; @@ -258,7 +258,7 @@ void playanm(char *fn,char t) getpackets(); if (restorepalette == 1) { - setgamepalette(&ps[myconnectindex],animpal,2); + setgamepalette(&ps[myconnectindex],animpal,0); restorepalette = 0; } idle(); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index ee030def0..9585e1734 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3250,7 +3250,7 @@ void displayrest(long smoothratio) else if (restorepalette) { //setbrightness(ud.brightness>>2,&pp->palette[0],0); - setgamepalette(pp,pp->palette,0); + setgamepalette(pp,pp->palette,2); restorepalette = 0; } // loogies courtesy of being snotted on @@ -8936,7 +8936,7 @@ static void Logo(void) //palto(0,0,0,63); if (logoflags & LOGO_FLAG_3DRSCREEN) { - setgamepalette(&ps[myconnectindex], drealms, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], drealms, 11); // JBF 20040308 rotatesprite(0,0,65536L,0,DREALMS,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); nextpage(); fadepal(0,0,0, 63,0,-7); @@ -8962,7 +8962,7 @@ static void Logo(void) if (logoflags & LOGO_FLAG_TITLESCREEN) { //ps[myconnectindex].palette = titlepal; - setgamepalette(&ps[myconnectindex], titlepal, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], titlepal, 11); // JBF 20040308 flushperms(); rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); KB_FlushKeyboardQueue(); @@ -9042,7 +9042,7 @@ static void Logo(void) if (ud.multimode > 1) { - setgamepalette(&ps[myconnectindex], titlepal, 3); + setgamepalette(&ps[myconnectindex], titlepal, 11); rotatesprite(0,0,65536L,0,BETASCREEN,0,0,2+8+16+64,0,0,xdim-1,ydim-1); rotatesprite(160<<16,(104)<<16,60<<10,0,DUKENUKEM,0,0,2+8,0,0,xdim-1,ydim-1); @@ -11462,7 +11462,7 @@ void dobonus(char bonusonly) case 0: if (ud.lockout == 0) { - setgamepalette(&ps[myconnectindex], endingpal, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], endingpal, 11); // JBF 20040308 clearview(0L); rotatesprite(0,50<<16,65536L,0,VICTORY1,0,0,2+8+16+64+128,0,0,xdim-1,ydim-1); nextpage(); @@ -11525,7 +11525,7 @@ void dobonus(char bonusonly) KB_FlushKeyboardQueue(); //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 rotatesprite(0,0,65536L,0,3292,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-1); @@ -11559,7 +11559,7 @@ void dobonus(char bonusonly) setview(0,0,xdim-1,ydim-1); KB_FlushKeyboardQueue(); //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 rotatesprite(0,0,65536L,0,3293,0,0,2+8+16+64, 0,0,xdim-1,ydim-1); IFISSOFTMODE fadepal(0,0,0, 63,0,-1); else nextpage(); @@ -11600,7 +11600,7 @@ void dobonus(char bonusonly) KB_FlushKeyBoardQueue(); //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 IFISSOFTMODE palto(0,0,0,63); clearview(0L); menutext(160,60,0,0,"THANKS TO ALL OUR"); @@ -11730,7 +11730,7 @@ ENDANM: FRAGBONUS: //ps[myconnectindex].palette = palette; - setgamepalette(&ps[myconnectindex], palette, 3); // JBF 20040308 + setgamepalette(&ps[myconnectindex], palette, 11); // JBF 20040308 IFISSOFTMODE palto(0,0,0,63); // JBF 20031228 KB_FlushKeyboardQueue(); totalclock = 0;