mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
code cleanup, fix a few things set as RESTRICT_RCON, attempt to fix up color lighting clamping problem, add r_lightstylesmooth_limit
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3776 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
84717bc230
commit
5cc7d591fd
12 changed files with 65 additions and 164 deletions
|
@ -5127,7 +5127,7 @@ void CL_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_sellscreen:
|
||||
Cmd_ExecuteString ("help", RESTRICT_RCON);
|
||||
Cmd_ExecuteString ("help", RESTRICT_SERVER);
|
||||
break;
|
||||
|
||||
case svc_smallkick:
|
||||
|
@ -5932,7 +5932,7 @@ void CLNQ_ParseServerMessage (void)
|
|||
break;
|
||||
|
||||
case svc_sellscreen: //pantsie
|
||||
Cmd_ExecuteString ("help 0", RESTRICT_RCON);
|
||||
Cmd_ExecuteString ("help 0", RESTRICT_SERVER);
|
||||
break;
|
||||
|
||||
case svc_damage:
|
||||
|
@ -5946,7 +5946,7 @@ void CLNQ_ParseServerMessage (void)
|
|||
}
|
||||
break;
|
||||
case svcfitz_bf:
|
||||
Cmd_ExecuteString("bf", RESTRICT_RCON);
|
||||
Cmd_ExecuteString("bf", RESTRICT_SERVER);
|
||||
break;
|
||||
case svcfitz_fog:
|
||||
cl.fog_density = MSG_ReadByte();
|
||||
|
|
|
@ -21,13 +21,6 @@ cvar_t r_dodgypcxfiles = SCVAR("r_dodgypcxfiles", "0"); //Quake 2's PCX loading
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
//the eye doesn't see different colours in the same proportion.
|
||||
//must add to slightly less than 1
|
||||
#define NTSC_RED 0.299
|
||||
#define NTSC_GREEN 0.587
|
||||
#define NTSC_BLUE 0.114
|
||||
#define NTSC_SUM (NTSC_RED + NTSC_GREEN + NTSC_BLUE)
|
||||
|
||||
typedef struct { //cm = colourmap
|
||||
char id_len; //0
|
||||
char cm_type; //1
|
||||
|
|
|
@ -271,7 +271,7 @@ void MSetupQ2_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
|
|||
|
||||
void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
|
||||
{
|
||||
extern qbyte translationTable[256];
|
||||
qbyte translationTable[256];
|
||||
setupmenu_t *info = menu->data;
|
||||
mpic_t *p;
|
||||
void *f;
|
||||
|
@ -316,7 +316,7 @@ void MSetup_TransDraw (int x, int y, menucustom_t *option, menu_t *menu)
|
|||
if (p)
|
||||
R2D_ScalePic (x-12, y-8, 72, 72, p);
|
||||
|
||||
M_BuildTranslationTable(info->topcolour, info->lowercolour);
|
||||
M_BuildTranslationTable(info->topcolour, info->lowercolour, translationTable);
|
||||
R2D_TransPicTranslate (x, y, info->tiwidth, info->tiheight, info->translationimage, translationTable);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,17 +30,6 @@ extern menu_t *menu_script;
|
|||
|
||||
qboolean m_recursiveDraw;
|
||||
|
||||
int m_return_state;
|
||||
qboolean m_return_onerror;
|
||||
char m_return_reason [32];
|
||||
|
||||
#define StartingGame (m_multiplayer_cursor == 1)
|
||||
#define JoiningGame (m_multiplayer_cursor == 0)
|
||||
#define SerialConfig (m_net_cursor == 0)
|
||||
#define DirectConfig (m_net_cursor == 1)
|
||||
#define IPXConfig (m_net_cursor == 2)
|
||||
#define TCPIPConfig (m_net_cursor == 3)
|
||||
|
||||
void M_ConfigureNetSubsystem(void);
|
||||
|
||||
cvar_t m_helpismedia = SCVAR("m_helpismedia", "0");
|
||||
|
@ -61,13 +50,11 @@ void M_DrawScalePic (int x, int y, int w, int h, mpic_t *pic)
|
|||
R2D_ScalePic (x + ((vid.width - 320)>>1), y, w, h, pic);
|
||||
}
|
||||
|
||||
qbyte identityTable[256];
|
||||
qbyte translationTable[256];
|
||||
|
||||
void M_BuildTranslationTable(int top, int bottom)
|
||||
void M_BuildTranslationTable(int top, int bottom, qbyte *translationTable)
|
||||
{
|
||||
int j;
|
||||
qbyte *dest, *source;
|
||||
qbyte identityTable[256];
|
||||
|
||||
int pc = Cvar_Get("cl_playerclass", "1", 0, "foo")->value;
|
||||
if (h2playertranslations && pc)
|
||||
|
|
|
@ -330,8 +330,6 @@ void M_Menu_Main_f (void);
|
|||
void M_Menu_Video_f (void);
|
||||
void M_Menu_Help_f (void);
|
||||
void M_Menu_Quit_f (void);
|
||||
void M_Menu_SerialConfig_f (void);
|
||||
void M_Menu_ModemConfig_f (void);
|
||||
void M_Menu_LanConfig_f (void);
|
||||
void M_Menu_GameOptions_f (void);
|
||||
void M_Menu_Search_f (void);
|
||||
|
@ -349,8 +347,6 @@ void M_Main_Draw (void);
|
|||
void M_Video_Draw (void);
|
||||
void M_Help_Draw (void);
|
||||
void M_Quit_Draw (void);
|
||||
void M_SerialConfig_Draw (void);
|
||||
void M_ModemConfig_Draw (void);
|
||||
void M_LanConfig_Draw (void);
|
||||
void M_GameOptions_Draw (void);
|
||||
void M_Search_Draw (void);
|
||||
|
@ -368,8 +364,6 @@ void M_Main_Key (int key);
|
|||
void M_Video_Key (int key);
|
||||
void M_Help_Key (int key);
|
||||
void M_Quit_Key (int key);
|
||||
void M_SerialConfig_Key (int key);
|
||||
void M_ModemConfig_Key (int key);
|
||||
void M_LanConfig_Key (int key);
|
||||
void M_GameOptions_Key (int key);
|
||||
void M_Search_Key (int key);
|
||||
|
@ -381,7 +375,7 @@ void M_DrawServers(void);
|
|||
void M_SListKey(int key);
|
||||
|
||||
//drawing funcs
|
||||
void M_BuildTranslationTable(int top, int bottom);
|
||||
void M_BuildTranslationTable(int top, int bottom, qbyte *translationTable);
|
||||
void M_DrawCharacter (int cx, int line, unsigned int num);
|
||||
void M_Print (int cx, int cy, qbyte *str);
|
||||
void M_PrintWhite (int cx, int cy, qbyte *str);
|
||||
|
|
|
@ -706,11 +706,11 @@ merges stains and oversaturates overbrights.
|
|||
*/
|
||||
static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shift, enum lm_mode lm_mode, stmap *stainsrc)
|
||||
{
|
||||
int r, g, b, t;
|
||||
int cr, cg, cb;
|
||||
int r, g, b, t, m;
|
||||
unsigned int i, j;
|
||||
unsigned int *bl;
|
||||
int stride;
|
||||
|
||||
switch (lm_mode)
|
||||
{
|
||||
case bgra4_os:
|
||||
|
@ -733,66 +733,30 @@ static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shi
|
|||
b = (127+b*(*stainsrc++)) >> 8;
|
||||
}
|
||||
|
||||
cr = 0;
|
||||
cg = 0;
|
||||
cb = 0;
|
||||
|
||||
if (r > 255) //ak too much red
|
||||
/*
|
||||
// quake 2 method, scale highest down to
|
||||
// maintain hue
|
||||
m = max(max(r, g), b);
|
||||
if (m > 255)
|
||||
{
|
||||
cr -= (255-r)/2;
|
||||
cg += (255-r)/4; //reduce it, and indicate to drop the others too.
|
||||
cb += (255-r)/4;
|
||||
r = 255;
|
||||
}
|
||||
|
||||
if (g > 255)
|
||||
{
|
||||
cr += (255-g)/4;
|
||||
cg -= (255-g)/2;
|
||||
cb += (255-g)/4;
|
||||
g = 255;
|
||||
}
|
||||
|
||||
if (b > 255)
|
||||
{
|
||||
cr += (255-b)/4;
|
||||
cg += (255-b)/4;
|
||||
cb -= (255-b)/2;
|
||||
b = 255;
|
||||
r *= 255.0/m;
|
||||
g *= 255.0/m;
|
||||
b *= 255.0/m;
|
||||
}
|
||||
*/
|
||||
|
||||
r+=cr;
|
||||
if (r > 255)
|
||||
dest[2] = 255;
|
||||
else if (r < 0)
|
||||
dest[2] = 0;
|
||||
else
|
||||
dest[2] = r;
|
||||
|
||||
g+=cg;
|
||||
if (g > 255)
|
||||
dest[1] = 255;
|
||||
else if (g < 0)
|
||||
dest[1] = 0;
|
||||
else
|
||||
dest[1] = g;
|
||||
|
||||
b+=cb;
|
||||
if (b > 255)
|
||||
dest[0] = 255;
|
||||
else if (b < 0)
|
||||
dest[0] = 0;
|
||||
else
|
||||
dest[0] = b;
|
||||
|
||||
dest[0] = min(b, 255);
|
||||
dest[1] = min(g, 255);
|
||||
dest[2] = min(r, 255);
|
||||
dest[3] = 255;
|
||||
|
||||
dest += 4;
|
||||
}
|
||||
if (stainsrc)
|
||||
stainsrc += (LMBLOCK_WIDTH - smax)*3;
|
||||
}
|
||||
break;
|
||||
|
||||
/*
|
||||
case bgra4:
|
||||
stride = LMBLOCK_WIDTH*4 - (smax<<2);
|
||||
|
||||
|
@ -841,7 +805,7 @@ static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shi
|
|||
stainsrc += (LMBLOCK_WIDTH - smax)*3;
|
||||
}
|
||||
break;
|
||||
|
||||
*/
|
||||
case rgb3_os:
|
||||
stride = LMBLOCK_WIDTH*3 - (smax*3);
|
||||
bl = blocklights;
|
||||
|
@ -861,57 +825,21 @@ static void Surf_StoreLightmap(qbyte *dest, int smax, int tmax, unsigned int shi
|
|||
b = (127+b*(*stainsrc++)) >> 8;
|
||||
}
|
||||
|
||||
cr = 0;
|
||||
cg = 0;
|
||||
cb = 0;
|
||||
|
||||
if (r > 255) //ak too much red
|
||||
/*
|
||||
// quake 2 method, scale highest down to
|
||||
// maintain hue
|
||||
m = max(max(r, g), b);
|
||||
if (m > 255)
|
||||
{
|
||||
cr -= (255-r)/2;
|
||||
cg += (255-r)/4; //reduce it, and indicate to drop the others too.
|
||||
cb += (255-r)/4;
|
||||
r = 255;
|
||||
}
|
||||
|
||||
if (g > 255)
|
||||
{
|
||||
cr += (255-g)/4;
|
||||
cg -= (255-g)/2;
|
||||
cb += (255-g)/4;
|
||||
g = 255;
|
||||
}
|
||||
|
||||
if (b > 255)
|
||||
{
|
||||
cr += (255-b)/4;
|
||||
cg += (255-b)/4;
|
||||
cb -= (255-b)/2;
|
||||
b = 255;
|
||||
r *= 255.0/m;
|
||||
g *= 255.0/m;
|
||||
b *= 255.0/m;
|
||||
}
|
||||
*/
|
||||
|
||||
r+=cr;
|
||||
if (r > 255)
|
||||
dest[0] = 255;
|
||||
else if (r < 0)
|
||||
dest[0] = 0;
|
||||
else
|
||||
dest[0] = (r+cr);
|
||||
|
||||
g+=cg;
|
||||
if (g > 255)
|
||||
dest[1] = 255;
|
||||
else if (g < 0)
|
||||
dest[1] = 0;
|
||||
else
|
||||
dest[1] = g;
|
||||
|
||||
b+=cb;
|
||||
if (b > 255)
|
||||
dest[2] = 255;
|
||||
else if (b < 0)
|
||||
dest[2] = 0;
|
||||
else
|
||||
dest[2] = b;
|
||||
dest[0] = min(r, 255);
|
||||
dest[1] = min(g, 255);
|
||||
dest[2] = min(b, 255);
|
||||
dest += 3;
|
||||
}
|
||||
if (stainsrc)
|
||||
|
@ -954,7 +882,6 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest,
|
|||
unsigned scale;
|
||||
int maps;
|
||||
unsigned *bl;
|
||||
extern cvar_t gl_lightmap_shift;
|
||||
|
||||
int stride = LMBLOCK_WIDTH*lightmap_bytes;
|
||||
|
||||
|
@ -1129,14 +1056,14 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest,
|
|||
if (surf->dlightframe == r_framecount)
|
||||
Surf_AddDynamicLightsColours (surf);
|
||||
|
||||
if (!r_stains.value || !surf->stained)
|
||||
stainsrc = NULL;
|
||||
|
||||
if (lightmap_bytes == 4)
|
||||
{
|
||||
if (lightmap_bgra)
|
||||
{
|
||||
if (!r_stains.value || !surf->stained)
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, bgra4_os, NULL);
|
||||
else
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, bgra4_os, stainsrc);
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, bgra4_os, stainsrc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1160,10 +1087,7 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!r_stains.value || !surf->stained)
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, rgb3_os, NULL);
|
||||
else
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, rgb3_os, stainsrc);
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, rgb3_os, stainsrc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1223,10 +1147,7 @@ static void Surf_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest,
|
|||
Surf_AddDynamicLights (surf);
|
||||
}
|
||||
|
||||
if (!r_stains.value || !surf->stained)
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, lum, NULL);
|
||||
else
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, lum, stainsrc);
|
||||
Surf_StoreLightmap(dest, smax, tmax, shift, lum, stainsrc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,13 @@ static const texid_t r_nulltex = {0};
|
|||
|
||||
//=============================================================================
|
||||
|
||||
//the eye doesn't see different colours in the same proportion.
|
||||
//must add to slightly less than 1
|
||||
#define NTSC_RED 0.299
|
||||
#define NTSC_GREEN 0.587
|
||||
#define NTSC_BLUE 0.114
|
||||
#define NTSC_SUM (NTSC_RED + NTSC_GREEN + NTSC_BLUE)
|
||||
|
||||
typedef enum {
|
||||
RT_MODEL,
|
||||
RT_POLY,
|
||||
|
@ -427,6 +434,7 @@ extern cvar_t gl_nohwblend;
|
|||
extern cvar_t gl_reporttjunctions;
|
||||
extern cvar_t r_flashblend;
|
||||
extern cvar_t r_lightstylesmooth;
|
||||
extern cvar_t r_lightstylesmooth_limit;
|
||||
extern cvar_t r_lightstylespeed;
|
||||
extern cvar_t gl_nocolors;
|
||||
extern cvar_t gl_load24bit;
|
||||
|
@ -435,9 +443,6 @@ extern cvar_t gl_finish;
|
|||
extern cvar_t gl_max_size;
|
||||
extern cvar_t gl_playermip;
|
||||
|
||||
extern cvar_t d_palconvwrite;
|
||||
extern cvar_t d_palremapsize;
|
||||
|
||||
extern cvar_t r_lightmap_saturation;
|
||||
|
||||
enum {
|
||||
|
|
|
@ -45,10 +45,6 @@ cvar_t _windowed_mouse = CVARF ("_windowed_mouse","1",
|
|||
|
||||
cvar_t con_ocranaleds = CVAR ("con_ocranaleds", "2");
|
||||
|
||||
cvar_t d_palconvwrite = CVAR ("d_palconvwrite", "1");
|
||||
cvar_t d_palremapsize = CVARF ("d_palremapsize", "64",
|
||||
CVAR_RENDERERLATCH);
|
||||
|
||||
cvar_t cl_cursor = CVAR ("cl_cursor", "");
|
||||
cvar_t cl_cursorsize = CVAR ("cl_cursorsize", "32");
|
||||
cvar_t cl_cursorbias = CVAR ("cl_cursorbias", "4");
|
||||
|
@ -101,6 +97,7 @@ cvar_t r_fullbrightSkins = SCVARF ("r_fullbrightSkins", "1",
|
|||
CVAR_SEMICHEAT|CVAR_SHADERSYSTEM);
|
||||
cvar_t r_lightmap_saturation = SCVAR ("r_lightmap_saturation", "1");
|
||||
cvar_t r_lightstylesmooth = SCVAR ("r_lightstylesmooth", "0");
|
||||
cvar_t r_lightstylesmooth_limit = SCVAR ("r_lightstylesmooth_limit", "2");
|
||||
cvar_t r_lightstylespeed = SCVAR ("r_lightstylespeed", "10");
|
||||
cvar_t r_loadlits = SCVAR ("r_loadlit", "1");
|
||||
cvar_t r_menutint = SCVARF ("r_menutint", "0.68 0.4 0.13",
|
||||
|
@ -532,6 +529,7 @@ void Renderer_Init(void)
|
|||
Cvar_Register(&r_dodgypcxfiles, "Bug fixes");
|
||||
Cvar_Register(&r_loadlits, GRAPHICALNICETIES);
|
||||
Cvar_Register(&r_lightstylesmooth, GRAPHICALNICETIES);
|
||||
Cvar_Register(&r_lightstylesmooth_limit, GRAPHICALNICETIES);
|
||||
Cvar_Register(&r_lightstylespeed, GRAPHICALNICETIES);
|
||||
|
||||
Cvar_Register(&r_stains, GRAPHICALNICETIES);
|
||||
|
|
|
@ -130,7 +130,7 @@ typedef struct cvar_group_s
|
|||
#define CVAR_RULESETLATCH (1<<15) //latched by the ruleset
|
||||
#define CVAR_SHADERSYSTEM (1<<16) //change flushes shaders.
|
||||
|
||||
#define CVAR_LASTFLAG CVAR_RULESETLATCH
|
||||
#define CVAR_LASTFLAG CVAR_SHADERSYSTEM
|
||||
|
||||
#define CVAR_LATCHMASK (CVAR_LATCH|CVAR_RENDERERLATCH|CVAR_SERVEROVERRIDE|CVAR_CHEAT|CVAR_SEMICHEAT) //you're only allowed one of these.
|
||||
#define CVAR_NEEDDEFAULT CVAR_CHEAT
|
||||
|
|
|
@ -1074,6 +1074,9 @@ static void (D3D9_Draw_Init) (void)
|
|||
}
|
||||
static void (D3D9_Draw_ReInit) (void)
|
||||
{
|
||||
#ifdef PLUGINS
|
||||
Plug_DrawReloadImages();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void (D3D9_R_Init) (void)
|
||||
|
|
|
@ -40,8 +40,6 @@ typedef struct
|
|||
|
||||
extern cvar_t gl_part_flame, r_fullbrightSkins, r_fb_models;
|
||||
extern cvar_t r_noaliasshadows;
|
||||
void R_TorchEffect (vec3_t pos, int type);
|
||||
void GLMod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight );
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ R_AnimateLight
|
|||
void R_AnimateLight (void)
|
||||
{
|
||||
int i,j;
|
||||
int v1, v2;
|
||||
float f;
|
||||
|
||||
//
|
||||
|
@ -46,13 +45,12 @@ void R_AnimateLight (void)
|
|||
if (f < 0)
|
||||
f = 0;
|
||||
i = (int)f;
|
||||
f -= i; //this can require updates at 1000 times a second.. Depends on your framerate of course
|
||||
|
||||
if (r_lightstylesmooth.ival)
|
||||
f -= i; //this can require updates at 1000 times a second.. Depends on your framerate of course
|
||||
else
|
||||
f = 0; //only update them 10 times a second
|
||||
for (j=0 ; j<MAX_LIGHTSTYLES ; j++)
|
||||
{
|
||||
int v1, v2, vd;
|
||||
|
||||
if (!cl_lightstyle[j].length)
|
||||
{
|
||||
d_lightstylevalue[j] = 256;
|
||||
|
@ -65,7 +63,11 @@ void R_AnimateLight (void)
|
|||
v2 = (i+1) % cl_lightstyle[j].length;
|
||||
v2 = cl_lightstyle[j].map[v2] - 'a';
|
||||
|
||||
d_lightstylevalue[j] = (v1*(1-f) + v2*(f))*22;
|
||||
vd = v1 - v2;
|
||||
if (!r_lightstylesmooth.ival || vd < -r_lightstylesmooth_limit.ival || vd > r_lightstylesmooth_limit.ival)
|
||||
d_lightstylevalue[j] = v1*22;
|
||||
else
|
||||
d_lightstylevalue[j] = (v1*(1-f) + v2*(f))*22;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue