Color adjustment bugfixes

git-svn-id: https://svn.eduke32.com/eduke32@893 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2008-07-24 02:07:22 +00:00
parent 18deaab4ca
commit b55d4f5d50
5 changed files with 26 additions and 20 deletions

View file

@ -137,8 +137,8 @@ int setgamma(void);
double vid_gamma, vid_contrast, vid_brightness; double vid_gamma, vid_contrast, vid_brightness;
#define DEFAULT_GAMMA 1.0 #define DEFAULT_GAMMA 1.0
#define DEFAULT_CONTRAST 1.2 #define DEFAULT_CONTRAST 1.0
#define DEFAULT_BRIGHTNESS 0.1 #define DEFAULT_BRIGHTNESS 0.0
int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit int switchrendermethod(int,int); // 0 = software, 1 = opengl | bool = reinit

View file

@ -9993,9 +9993,12 @@ void setbrightness(char dabrightness, char *dapal, char noapply)
lastbright = curbrightness; lastbright = curbrightness;
if (!(noapply&4)) if (!(noapply&4))
{
curbrightness = min(max((int)dabrightness,0),15); curbrightness = min(max((int)dabrightness,0),15);
if (lastbright != (unsigned)curbrightness) if (lastbright != (unsigned)curbrightness)
vid_gamma = 1.0 + ((float)curbrightness / 10.0); vid_gamma = 1.0 + ((float)curbrightness / 10.0);
}
if (setgamma()) j = curbrightness; else j = 0; if (setgamma()) j = curbrightness; else j = 0;
for (k=i=0;i<256;i++) for (k=i=0;i<256;i++)

View file

@ -2573,7 +2573,7 @@ cheat_for_port_credits:
break; break;
case 231: case 231:
rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1); rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,24,0,0,"BRIGHTNESS"); menutext(320>>1,24,0,0,"COLOR ADJUSTMENT");
c = (320>>1)-120; c = (320>>1)-120;
@ -2610,7 +2610,7 @@ cheat_for_port_credits:
vid_gamma = b/40960.f; vid_gamma = b/40960.f;
ud.brightness = min(max((float)((vid_gamma-1.0)*10.0),0),15); ud.brightness = min(max((float)((vid_gamma-1.0)*10.0),0),15);
ud.brightness <<= 2; ud.brightness <<= 2;
setgamma(); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
} }
b = (vid_contrast*40960.f); b = (vid_contrast*40960.f);
@ -2619,7 +2619,7 @@ cheat_for_port_credits:
if (b != (vid_contrast*40960.f)) if (b != (vid_contrast*40960.f))
{ {
vid_contrast = b/40960.f; vid_contrast = b/40960.f;
setgamma(); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
} }
b = (vid_brightness*40960.f); b = (vid_brightness*40960.f);
@ -2628,7 +2628,7 @@ cheat_for_port_credits:
if (b != (vid_brightness*40960.f)) if (b != (vid_brightness*40960.f))
{ {
vid_brightness = b/40960.f; vid_brightness = b/40960.f;
setgamma(); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
} }
if (x == 3) if (x == 3)
@ -2636,7 +2636,8 @@ cheat_for_port_credits:
vid_gamma = DEFAULT_GAMMA; vid_gamma = DEFAULT_GAMMA;
vid_contrast = DEFAULT_CONTRAST; vid_contrast = DEFAULT_CONTRAST;
vid_brightness = DEFAULT_BRIGHTNESS; vid_brightness = DEFAULT_BRIGHTNESS;
setgamma(); ud.brightness = 0;
setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
} }
} }
@ -3338,7 +3339,7 @@ cheat_for_port_credits:
menutext(c+16,50+16+16+22,MENUHIGHLIGHT(3),changesmade==0,"APPLY CHANGES"); menutext(c+16,50+16+16+22,MENUHIGHLIGHT(3),changesmade==0,"APPLY CHANGES");
menutext(c,50+62+16,MENUHIGHLIGHT(4),PHX(-6),"BRIGHTNESS"); menutext(c,50+62+16,MENUHIGHLIGHT(4),PHX(-6),"COLOR ADJUSTMENT");
/* { /* {
short ss = ud.brightness; short ss = ud.brightness;
bar(c+171,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));
@ -3351,8 +3352,8 @@ cheat_for_port_credits:
*/ */
if (bpp == 8) if (bpp == 8)
{ {
menutext(c,50+62+16+16,MENUHIGHLIGHT(5),0,"DETAIL"); menutext(c,50+62+16+16,MENUHIGHLIGHT(5),0,"PIXEL DOUBLING");
menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),0,ud.detail?"HIGH":"LOW"); menutext(c+154,50+62+16+16,MENUHIGHLIGHT(5),0,ud.detail?"OFF":"ON");
modval(0,1,(int *)&ud.detail,1,probey==5); modval(0,1,(int *)&ud.detail,1,probey==5);
} }
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)

View file

@ -694,6 +694,7 @@ cvarmappings cvar[] =
#endif #endif
{ "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 }, { "r_drawweapon", "r_drawweapon: enable/disable weapon drawing", (void*)&ud.drawweapon, CVAR_INT, 0, 0, 2 },
{ "r_showfps", "r_showfps: show the frame rate counter", (void*)&ud.tickrate, 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 }, { "r_precache", "r_precache: enable/disable the pre-level caching routine", (void*)&ud.config.useprecache, CVAR_BOOL, 0, 0, 1 },
{ "r_visibility", "r_visibility: sets the global map visibility", (void*)&ud.const_visibility, CVAR_INT|128, 0, INT_MIN, INT_MAX }, { "r_visibility", "r_visibility: sets the global map visibility", (void*)&ud.const_visibility, CVAR_INT|128, 0, INT_MIN, INT_MAX },
@ -1261,10 +1262,10 @@ static int osdcmd_vid_gamma(const osdfuncparm_t *parm)
return OSDCMD_SHOWHELP; return OSDCMD_SHOWHELP;
} }
vid_gamma = atof(parm->parms[0]); vid_gamma = atof(parm->parms[0]);
ud.brightness = min(max((float)((vid_gamma-1.0)*10.0),0),15); ud.brightness = min(max((float)((vid_gamma-1.0)*10.0),0),15);
ud.brightness <<= 2; ud.brightness <<= 2;
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
setgamma(); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1277,7 +1278,7 @@ static int osdcmd_vid_brightness(const osdfuncparm_t *parm)
} }
vid_brightness = atof(parm->parms[0]); vid_brightness = atof(parm->parms[0]);
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
setgamma(); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
return OSDCMD_OK; return OSDCMD_OK;
} }
@ -1290,7 +1291,7 @@ static int osdcmd_vid_contrast(const osdfuncparm_t *parm)
} }
vid_contrast = atof(parm->parms[0]); vid_contrast = atof(parm->parms[0]);
OSD_Printf("%s\n",parm->raw); OSD_Printf("%s\n",parm->raw);
setgamma(); setbrightness(ud.brightness>>2,&g_player[myconnectindex].ps->palette[0],0);
return OSDCMD_OK; return OSDCMD_OK;
} }

View file

@ -659,14 +659,13 @@ int shoot(int i,int atwith)
{ {
k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4); k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,10,10,sa,0,0,i,4);
sprite[k].extra = projectile[atwith].extra; sprite[k].extra = projectile[atwith].extra;
if (projectile[atwith].extra_rand > 0)
sprite[k].extra += (TRAND%projectile[atwith].extra_rand);
sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1
hittype[k].temp_data[6] = hitwall; hittype[k].temp_data[6] = hitwall;
hittype[k].temp_data[7] = hitsect; hittype[k].temp_data[7] = hitsect;
hittype[k].temp_data[8] = hitspr; hittype[k].temp_data[8] = hitspr;
if (projectile[atwith].extra_rand > 0)
sprite[k].extra += (TRAND%projectile[atwith].extra_rand);
if (hitwall == -1 && hitspr == -1) if (hitwall == -1 && hitspr == -1)
{ {
if (zvel < 0) if (zvel < 0)
@ -826,6 +825,8 @@ DOSKIPBULLETHOLE:
{ {
k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,24,24,sa,0,0,i,4); k = EGS(hitsect,hitx,hity,hitz,SHOTSPARK1,-15,24,24,sa,0,0,i,4);
sprite[k].extra = projectile[atwith].extra; sprite[k].extra = projectile[atwith].extra;
if (projectile[atwith].extra_rand > 0)
sprite[k].extra += (TRAND%projectile[atwith].extra_rand);
sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1 sprite[k].yvel = atwith; // this is a hack to allow you to detect which weapon spawned a SHOTSPARK1
hittype[k].temp_data[6] = hitwall; hittype[k].temp_data[6] = hitwall;
hittype[k].temp_data[7] = hitsect; hittype[k].temp_data[7] = hitsect;