mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Implement r_flatlightstyles from fitzquake.
This commit is contained in:
parent
7299ca7bec
commit
e730608dd7
6 changed files with 46 additions and 4 deletions
|
@ -75,6 +75,8 @@ typedef struct
|
|||
{
|
||||
int length;
|
||||
char map[MAX_STYLESTRING];
|
||||
char average;
|
||||
char peak;
|
||||
} lightstyle_t;
|
||||
|
||||
//===============
|
||||
|
|
|
@ -65,6 +65,7 @@ extern struct cvar_s *r_dynamic;
|
|||
extern struct cvar_s *r_explosionclip;
|
||||
extern struct cvar_s *r_farclip;
|
||||
extern struct cvar_s *r_firecolor;
|
||||
extern struct cvar_s *r_flatlightstyles;
|
||||
extern struct cvar_s *r_fullbright;
|
||||
extern struct cvar_s *r_graphheight;
|
||||
extern struct cvar_s *r_lightmap;
|
||||
|
|
|
@ -68,6 +68,7 @@ cvar_t *r_dynamic;
|
|||
cvar_t *r_explosionclip;
|
||||
cvar_t *r_farclip;
|
||||
cvar_t *r_firecolor;
|
||||
cvar_t *r_flatlightstyles;
|
||||
cvar_t *r_graphheight;
|
||||
cvar_t *r_lightmap_components;
|
||||
cvar_t *r_maxedges;
|
||||
|
@ -236,6 +237,9 @@ R_Init_Cvars (void)
|
|||
"player.");
|
||||
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.7 0.0", CVAR_ARCHIVE, NULL,
|
||||
"color of rocket and lava ball fires");
|
||||
r_flatlightstyles = Cvar_Get ("r_flatlightstyles", "0", CVAR_NONE, NULL,
|
||||
"Disable animated lightmaps. 2 = use peak, "
|
||||
"1 = use average, anything else = normal");
|
||||
r_graphheight = Cvar_Get ("r_graphheight", "32", CVAR_NONE, NULL,
|
||||
"Set the number of lines displayed in the "
|
||||
"various graphs");
|
||||
|
|
|
@ -132,10 +132,15 @@ R_AnimateLight (void)
|
|||
d_lightstylevalue[j] = 256;
|
||||
continue;
|
||||
}
|
||||
if (r_flatlightstyles->int_val == 2) {
|
||||
k = vr_data.lightstyle[j].peak - 'a';
|
||||
} else if (r_flatlightstyles->int_val == 1) {
|
||||
k = vr_data.lightstyle[j].average - 'a';
|
||||
} else {
|
||||
k = i % vr_data.lightstyle[j].length;
|
||||
k = vr_data.lightstyle[j].map[k] - 'a';
|
||||
k = k * 22;
|
||||
d_lightstylevalue[j] = k;
|
||||
}
|
||||
d_lightstylevalue[j] = k * 22;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -974,6 +974,21 @@ CL_ParseServerMessage (void)
|
|||
Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
strcpy (cl.lightstyle[i].map, MSG_ReadString (net_message));
|
||||
cl.lightstyle[i].length = strlen (cl.lightstyle[i].map);
|
||||
if (cl.lightstyle[i].length) {
|
||||
int total = 0;
|
||||
|
||||
cl.lightstyle[i].peak = 'a';
|
||||
for (j = 0; j < cl.lightstyle[i].length; j++) {
|
||||
total += cl.lightstyle[i].map[j] - 'a';
|
||||
cl.lightstyle[i].peak = max (cl.lightstyle[i].peak,
|
||||
cl.lightstyle[i].map[j]);
|
||||
}
|
||||
total /= cl.lightstyle[i].length;
|
||||
cl.lightstyle[i].average = total + 'a';
|
||||
} else {
|
||||
cl.lightstyle[i].average = 'm';
|
||||
cl.lightstyle[i].peak = 'm';
|
||||
}
|
||||
break;
|
||||
|
||||
case svc_updatename:
|
||||
|
|
|
@ -1444,6 +1444,21 @@ CL_ParseServerMessage (void)
|
|||
Host_Error ("svc_lightstyle > MAX_LIGHTSTYLES");
|
||||
strcpy (cl.lightstyle[i].map, MSG_ReadString (net_message));
|
||||
cl.lightstyle[i].length = strlen (cl.lightstyle[i].map);
|
||||
if (cl.lightstyle[i].length) {
|
||||
int total = 0;
|
||||
|
||||
cl.lightstyle[i].peak = 'a';
|
||||
for (j = 0; j < cl.lightstyle[i].length; j++) {
|
||||
total += cl.lightstyle[i].map[j] - 'a';
|
||||
cl.lightstyle[i].peak = max (cl.lightstyle[i].peak,
|
||||
cl.lightstyle[i].map[j]);
|
||||
}
|
||||
total /= cl.lightstyle[i].length;
|
||||
cl.lightstyle[i].average = total + 'a';
|
||||
} else {
|
||||
cl.lightstyle[i].average = 'm';
|
||||
cl.lightstyle[i].peak = 'm';
|
||||
}
|
||||
break;
|
||||
|
||||
// svc_updatename
|
||||
|
|
Loading…
Reference in a new issue