From 5bb2a9002c8ae0a06de3984baa1cbddb4ac46a8b Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Sat, 28 Oct 2000 07:11:37 +0000 Subject: [PATCH] Change fires to a more visually-appealing red-orange color. Looks *killer* Add -brighten arg to GL targets, to replace -gamma but still look nice. "-brighten 2.5" brightens the palette by 2.5 times, to give a similar effect to the brightness cvar, but without the dithering brightness gives. This is a palette hack, which means it _can't_ be a cvar. --- include/glquake.h | 2 +- source/cd_linux.c | 2 +- source/cvar.c | 2 +- source/gl_part.c | 6 +++--- source/gl_rmain.c | 37 +++++++++++++++++++++++++++++++++++++ source/vid_common_gl.c | 1 + source/vid_glx.c | 1 + source/vid_sgl.c | 9 ++++++--- source/vid_wgl.c | 4 +++- 9 files changed, 54 insertions(+), 10 deletions(-) diff --git a/include/glquake.h b/include/glquake.h index e7eeadc..a164a90 100644 --- a/include/glquake.h +++ b/include/glquake.h @@ -289,7 +289,7 @@ void GL_Set2D (void); // // gl_rmain.c // -void GL_CheckGamma (unsigned char *pal); +void GL_CheckBrightness (unsigned char *pal); //qboolean R_CullBox (vec3_t mins, vec3_t maxs); void R_RotateForEntity (entity_t *e); diff --git a/source/cd_linux.c b/source/cd_linux.c index 313f536..d3a7948 100644 --- a/source/cd_linux.c +++ b/source/cd_linux.c @@ -353,7 +353,7 @@ static void CD_f (void) Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack); else if (wasPlaying) Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack); - Con_Printf("Volume is %f\n", cdvolume); + Con_Printf("Volume is %g\n", cdvolume); return; } } diff --git a/source/cvar.c b/source/cvar.c index 76e5630..36515a6 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -81,7 +81,7 @@ cvar_t *Cvar_FindAlias (char *alias_name) void Cvar_Alias_Get (char *name, cvar_t *cvar) { cvar_alias_t *alias; - cvar_t *var; + cvar_t *var; if (Cmd_Exists (name)) { diff --git a/source/gl_part.c b/source/gl_part.c index 3f2bcd7..9d9ed63 100644 --- a/source/gl_part.c +++ b/source/gl_part.c @@ -662,8 +662,8 @@ void R_DrawParticles (void) Nifty ball of fire GL effect. Kinda a meshing of the dlight and particle engine code. */ -float r_firecolor_flame[3]={0.9,0.7,0.3}; -float r_firecolor_light[3]={0.9,0.7,0.3}; +float r_firecolor_flame[3]={0.9,0.4,0}; +float r_firecolor_light[3]={0.9,0.4,0}; void R_AddFire (vec3_t start, vec3_t end, entity_t *ent) @@ -835,7 +835,7 @@ R_FireColor_f (void) int i; if (Cmd_Argc() == 1) { - Con_Printf ("r_firecolor %f %f %f\n", + Con_Printf ("r_firecolor %g %g %g\n", r_firecolor_flame[0], r_firecolor_flame[1], r_firecolor_flame[2]); diff --git a/source/gl_rmain.c b/source/gl_rmain.c index 5c900f8..22dbb83 100644 --- a/source/gl_rmain.c +++ b/source/gl_rmain.c @@ -127,6 +127,43 @@ void glrmain_init() { }; +/* + GL_CheckBrightness + + This is something like the brightness cvar, except it hacks the palette + directly instead of brightening the screen afterward. +*/ +void +GL_CheckBrightness (unsigned char *pal) +{ + int i, inf; + float brightness; + + if ((i = COM_CheckParm ("-brighten"))) { + brightness = atof (com_argv[i + 1]); + brightness = bound (1, brightness, 5); + } else { + brightness = 1.0; + } + + // Build gamma table + if (brightness == 1.0) { // screw the math + for (i = 0; i < 256; i++) { + gammatable[i] = i; + } + } else { + for (i = 0; i < 256; i++) { // brighten up the palette + inf = (i * brightness); + inf = bound (0, inf, 255); + gammatable[i] = inf; + } + } + + // correct the palette + for (i = 0; i < 768; i++) { + pal[i] = gammatable[pal[i]]; + } +} /* ================= diff --git a/source/vid_common_gl.c b/source/vid_common_gl.c index f353e20..ee86cf0 100644 --- a/source/vid_common_gl.c +++ b/source/vid_common_gl.c @@ -261,6 +261,7 @@ GL_Init_Common (void) glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); CheckMultiTextureExtensions (); + } /* diff --git a/source/vid_glx.c b/source/vid_glx.c index f2ec36d..aff88dc 100644 --- a/source/vid_glx.c +++ b/source/vid_glx.c @@ -198,6 +198,7 @@ VID_Init (unsigned char *palette) GL_Init (); + GL_CheckBrightness (palette); VID_SetPalette (palette); // Check for 8-bit extension and initialize if present diff --git a/source/vid_sgl.c b/source/vid_sgl.c index f508bc1..bef624a 100644 --- a/source/vid_sgl.c +++ b/source/vid_sgl.c @@ -108,7 +108,7 @@ GL_Init (void) void GL_EndRendering (void) { - glFlush(); + glFlush (); SDL_GL_SwapBuffers (); } @@ -182,12 +182,14 @@ VID_Init (unsigned char *palette) vid.aspect = ((float) vid.height / (float) vid.width) * (320.0 / 240.0); vid.numpages = 2; + #ifndef WIN32 InitSig (); // trap evil signals #endif GL_Init(); + GL_CheckBrightness (palette); VID_SetPalette (palette); // Check for 3DFX Extensions and initialize them. @@ -197,6 +199,7 @@ VID_Init (unsigned char *palette) scr_width, scr_height); vid_initialized = true; + #ifdef WIN32 // FIXME: EVIL thing - but needed for win32 until we get // SDL_sound ready - without this DirectSound fails. @@ -211,9 +214,9 @@ VID_SetCaption (char *text) { if (text && *text) { char *temp = strdup (text); - SDL_WM_SetCaption(va ("%s %s: %s", PROGRAM, VERSION, temp), NULL); + SDL_WM_SetCaption (va ("%s %s: %s", PROGRAM, VERSION, temp), NULL); free (temp); } else { - SDL_WM_SetCaption(va ("%s %s", PROGRAM, VERSION), NULL); + SDL_WM_SetCaption (va ("%s %s", PROGRAM, VERSION), NULL); } } diff --git a/source/vid_wgl.c b/source/vid_wgl.c index 962d371..d6498b7 100644 --- a/source/vid_wgl.c +++ b/source/vid_wgl.c @@ -705,7 +705,8 @@ void GL_EndRendering (void) Sbar_Changed(); } -void VID_SetPalette (unsigned char *palette) +void +VID_SetPalette (unsigned char *palette) { byte *pal; unsigned int r,g,b; @@ -1787,6 +1788,7 @@ void VID_Init (unsigned char *palette) DestroyWindow (hwnd_dialog); + GL_CheckBrightness (palette); VID_SetPalette (palette); VID_SetMode (vid_default, palette);