From 8b9116d1a4575335faa710ca7587fbf7cb9decfd Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 26 Jul 2008 07:20:57 +0000 Subject: [PATCH] r_cullobstructedmodels 2: only cull if model texture has alpha git-svn-id: https://svn.eduke32.com/eduke32@908 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/engine.c | 6 +++--- polymer/build/src/polymost.c | 7 ++++--- polymer/eduke32/source/config.c | 4 ++-- polymer/eduke32/source/menus.c | 12 ++++++------ polymer/eduke32/source/osdcmds.c | 6 ++++-- polymer/eduke32/source/osdfuncs.c | 6 +++--- polymer/eduke32/source/osdfuncs.h | 2 +- 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 67675ae41..5f0958849 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -9994,13 +9994,13 @@ void setvgapalette(void) void setbrightness(char dabrightness, char *dapal, char noapply) { int i, k, j; - unsigned int lastbright = curbrightness; +// unsigned int lastbright = curbrightness; if (!(noapply&4)) { curbrightness = min(max((int)dabrightness,0),15); - if (lastbright != (unsigned)curbrightness) - vid_gamma = 1.0 + ((float)curbrightness / 10.0); +// if (lastbright != (unsigned)curbrightness) +// vid_gamma = 1.0 + ((float)curbrightness / 10.0); } if (setgamma()) j = curbrightness; else j = 0; diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 7f40973a2..fb3dd0337 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -4464,7 +4464,7 @@ void polymost_drawsprite(int snum) int posx,posy; int oldsizx, oldsizy; int tsizx, tsizy; - + md2model *modelptr = NULL; tspr = tspriteptr[snum]; if (tspr->owner < 0 || tspr->picnum < 0) return; @@ -4513,7 +4513,8 @@ void polymost_drawsprite(int snum) if (mddraw(tspr)) return; break; // else, render as flat sprite } - if (r_cullobstructedmodels) + modelptr = (md2model *)models[tile2model[Ptile2tile(tspr->picnum,tspr->pal)].modelid]; + if (r_cullobstructedmodels == 1 || (r_cullobstructedmodels == 2 && (modelptr->usesalpha))) { do // this is so gay { @@ -5965,7 +5966,7 @@ static int osdcmd_polymostvars(const osdfuncparm_t *parm) else if (!Bstrcasecmp(parm->name, "r_cullobstructedmodels")) { if (showval) { OSD_Printf("r_cullobstructedmodels is %d\n", r_cullobstructedmodels); } - else r_cullobstructedmodels = (val != 0); + else r_cullobstructedmodels = max(0,min(val,2)); return OSDCMD_OK; } else if (!Bstrcasecmp(parm->name, "r_fullbrights")) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 6a799154f..8fcd45180 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -713,7 +713,7 @@ int32 CONFIG_ReadSetup(void) #endif SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",&dummy); OSD_SetTextMode(dummy); - SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",&r_osdhightile); + SCRIPT_GetNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",&osdhightile); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "Executions",&ud.executions); SCRIPT_GetNumber(ud.config.scripthandle, "Setup", "ForceSetup",&ud.config.ForceSetup); SCRIPT_GetNumber(ud.config.scripthandle, "Misc", "RunMode",&ud.config.RunMode); @@ -944,7 +944,7 @@ void CONFIG_WriteSetup(void) SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "UseModels",usemodels,false,false); #endif SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDTextMode",OSD_GetTextMode(),false,false); - SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",r_osdhightile,false,false); + SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "OSDHightile",osdhightile,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "AmbienceToggle",ud.config.AmbienceToggle,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "FXVolume",ud.config.FXVolume,false,false); SCRIPT_PutNumber(ud.config.scripthandle, "Sound Setup", "MusicToggle",ud.config.MusicToggle,false,false); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index a33bef805..12f061ebf 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -367,7 +367,7 @@ static void _bar(int type, int x,int y,int *p,int dainc,int damodify,int s, int *p = min; sound(KICK_HIT); } - if (*p < 64 && (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || ((buttonstat&1) && minfo.dyaw < -256))) // && onbar) ) + if (*p < max && (KB_KeyPressed(sc_LeftArrow) || KB_KeyPressed(sc_kpad_4) || ((buttonstat&1) && minfo.dyaw < -256))) // && onbar) ) { KB_ClearKeyDown(sc_LeftArrow); KB_ClearKeyDown(sc_kpad_4); @@ -2618,12 +2618,12 @@ cheat_for_port_credits: rotatesprite(160<<16,27<<16,24576,0,3290,0,0,2+8+16,0,scale(ydim,35,200),xdim-1,scale(ydim,80,200)-1); { - int b = (vid_gamma*40960.f); + int b = (double)(vid_gamma*40960.f); _bar(0,c+177,98,&b,4096,x==0,MENUHIGHLIGHT(0),0,8192,163840); - if (b != (vid_gamma*40960.f)) + if (b != (double)(vid_gamma*40960.f)) { - vid_gamma = b/40960.f; + vid_gamma = (double)b/40960.f; ud.brightness = min(max((double)((vid_gamma-1.0)*10.0),0),15); ud.brightness <<= 2; setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0); @@ -2634,7 +2634,7 @@ cheat_for_port_credits: if (b != (vid_contrast*40960.f)) { - vid_contrast = b/40960.f; + vid_contrast = (double)b/40960.f; setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0); } @@ -2643,7 +2643,7 @@ cheat_for_port_credits: if (b != (vid_brightness*40960.f)) { - vid_brightness = b/40960.f; + vid_brightness = (double)b/40960.f; setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0); } diff --git a/polymer/eduke32/source/osdcmds.c b/polymer/eduke32/source/osdcmds.c index b9da0dec0..4a0a54be5 100644 --- a/polymer/eduke32/source/osdcmds.c +++ b/polymer/eduke32/source/osdcmds.c @@ -694,7 +694,7 @@ cvarmappings cvar[] = #endif #endif { "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 }, - { "r_osdhightile", "r_osdhightile: enable/disable hires art replacements for console text", (void*)&r_osdhightile, CVAR_BOOL, 0, 0, 1 }, + { "osdhightile", "osdhightile: enable/disable hires art replacements for console text", (void*)&osdhightile, CVAR_BOOL, 0, 0, 1 }, { "r_showfps", "r_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 }, { "r_shadows", "r_shadows: enable/disable sprite and model shadows", (void*)&ud.shadows, CVAR_BOOL, 0, 0, 1 }, { "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 }, @@ -790,6 +790,7 @@ static int osdcmd_sensitivity(const osdfuncparm_t *parm) return OSDCMD_OK; } +/* static int osdcmd_setbrightness(const osdfuncparm_t *parm) { if (parm->numparms != 1) @@ -802,6 +803,7 @@ static int osdcmd_setbrightness(const osdfuncparm_t *parm) OSD_Printf("setbrightness %d\n",ud.brightness>>2); return OSDCMD_OK; } +*/ static int osdcmd_give(const osdfuncparm_t *parm) { @@ -1351,7 +1353,7 @@ int registerosdcommands(void) OSD_RegisterFunction(t,Bstrdup(tempbuf),osdcmd_button); } - OSD_RegisterFunction("setbrightness","setbrightness : changes brightness (obsolete)", osdcmd_setbrightness); +// OSD_RegisterFunction("setbrightness","setbrightness : changes brightness (obsolete)", osdcmd_setbrightness); OSD_RegisterFunction("give","give : gives requested item", osdcmd_give); OSD_RegisterFunction("god","god: toggles god mode", osdcmd_god); diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index b7222bd47..099e5c13d 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -3,7 +3,7 @@ #include "namesdyn.h" #include "osdfuncs.h" -int r_osdhightile = 0; +int osdhightile = 0; void GAME_drawosdchar(int x, int y, char ch, int shade, int pal) { @@ -13,7 +13,7 @@ void GAME_drawosdchar(int x, int y, char ch, int shade, int pal) if (ch == 32) return; ac = ch-'!'+STARTALPHANUM; if (ac < STARTALPHANUM || ac > ENDALPHANUM) return; - usehightile = (r_osdhightile && ht); + usehightile = (osdhightile && ht); rotatesprite(((x<<3)+x)<<16, (y<<3)<<16, 65536l, 0, ac, shade, pal, 8|16, 0, 0, xdim-1, ydim-1); usehightile = ht; } @@ -25,7 +25,7 @@ void GAME_drawosdstr(int x, int y, char *ch, int len, int shade, int pal) char *fmt = OSD_GetFmtPtr(); int ht = usehightile; - usehightile = (r_osdhightile && ht); + usehightile = (osdhightile && ht); for (x = (x<<3)+x; len>0; len--, ch++, x++) { diff --git a/polymer/eduke32/source/osdfuncs.h b/polymer/eduke32/source/osdfuncs.h index d5c552a12..581437957 100644 --- a/polymer/eduke32/source/osdfuncs.h +++ b/polymer/eduke32/source/osdfuncs.h @@ -6,7 +6,7 @@ int GAME_getrowheight(int w); void GAME_clearbackground(int c, int r); void GAME_onshowosd(int shown); -extern int r_osdhightile; +extern int osdhightile; #define OSDCHAR_WIDTH 8