mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-31 23:41:25 +00:00
Merge remote-tracking branch 'yquake2/master'
This commit is contained in:
commit
c385789a87
6 changed files with 141 additions and 26 deletions
|
@ -142,7 +142,12 @@ Set `0` by default.
|
|||
|
||||
* **cl_showfps**: Shows the framecounter. Set to `2` for more and to
|
||||
`3` for even more informations.
|
||||
|
||||
|
||||
* **cl_showspeed**: Shows the players speed. Set to `1` to display both
|
||||
overall speed and (horizontal speed) in Quake Units (QU) respectfully at
|
||||
the top right corner of the screen. Set to `2` to show only the horizontal
|
||||
speed under the crosshair.
|
||||
|
||||
* **cl_model_preview_start**: start frame value in multiplayer model preview.
|
||||
`-1` - don't show animation. Defaults to `84` for show salute animation.
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ cvar_t *cl_footsteps;
|
|||
cvar_t *cl_timeout;
|
||||
cvar_t *cl_predict;
|
||||
cvar_t *cl_showfps;
|
||||
cvar_t *cl_showspeed;
|
||||
cvar_t *cl_gun;
|
||||
cvar_t *cl_add_particles;
|
||||
cvar_t *cl_add_lights;
|
||||
|
@ -514,6 +515,7 @@ CL_InitLocal(void)
|
|||
cl_noskins = Cvar_Get("cl_noskins", "0", 0);
|
||||
cl_predict = Cvar_Get("cl_predict", "1", 0);
|
||||
cl_showfps = Cvar_Get("cl_showfps", "0", CVAR_ARCHIVE);
|
||||
cl_showspeed = Cvar_Get("cl_showspeed", "0", CVAR_ARCHIVE);
|
||||
|
||||
cl_upspeed = Cvar_Get("cl_upspeed", "200", 0);
|
||||
cl_forwardspeed = Cvar_Get("cl_forwardspeed", "200", 0);
|
||||
|
|
|
@ -66,6 +66,8 @@ int crosshair_width, crosshair_height;
|
|||
|
||||
extern cvar_t *cl_showfps;
|
||||
extern cvar_t *crosshair_scale;
|
||||
extern cvar_t *cl_showspeed;
|
||||
extern float GetPlayerSpeed();
|
||||
|
||||
void SCR_TimeRefresh_f(void);
|
||||
void SCR_Loading_f(void);
|
||||
|
@ -1448,6 +1450,57 @@ SCR_DrawLayout(void)
|
|||
|
||||
// ----
|
||||
|
||||
void
|
||||
SCR_DrawSpeed(void)
|
||||
{
|
||||
if (cl_showspeed->value < 1) //Disabled, do nothing
|
||||
return;
|
||||
|
||||
char spd_str[32];
|
||||
float speed, speedxy;
|
||||
float scale = SCR_GetConsoleScale();
|
||||
int str_len, xPos, yPos = 0;
|
||||
|
||||
GetPlayerSpeed(&speed, &speedxy);
|
||||
snprintf(spd_str, sizeof(spd_str), "%6.2f (%6.2f) QU/s", speed, speedxy);
|
||||
str_len = scale * (strlen(spd_str) * 8 + 2);
|
||||
|
||||
if (cl_showspeed->value == 1) //Draw speed and xy speed at top right
|
||||
{
|
||||
xPos = viddef.width - str_len;
|
||||
|
||||
if (cl_showfps->value == 1 || cl_showfps->value == 2) // If showfps is enabled, draw it underneath
|
||||
{
|
||||
yPos = scale * 10;
|
||||
}
|
||||
else if (cl_showfps->value > 2)
|
||||
{
|
||||
yPos = scale * 20;
|
||||
}
|
||||
|
||||
DrawStringScaled(xPos, yPos, spd_str, scale);
|
||||
SCR_AddDirtyPoint(xPos, yPos);
|
||||
SCR_AddDirtyPoint(viddef.width, yPos);
|
||||
}
|
||||
|
||||
else if (cl_showspeed->value > 1) //Draw only xy speed under the crosshair
|
||||
{
|
||||
if (scale != 1) // Check if low resolution
|
||||
{
|
||||
scale -= 1;
|
||||
}
|
||||
|
||||
snprintf(spd_str, sizeof(spd_str), "%6.2f", speedxy);
|
||||
str_len = scale * (strlen(spd_str) * 8 + 2);
|
||||
yPos = scr_vrect.y + (scr_vrect.height / 2) + (scale * 10);
|
||||
xPos = scr_vrect.x + (scr_vrect.width / 2) - (str_len / 2);
|
||||
|
||||
DrawStringScaled(xPos, yPos, spd_str, scale);
|
||||
SCR_AddDirtyPoint(xPos, yPos);
|
||||
SCR_AddDirtyPoint(xPos + str_len, yPos);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SCR_Framecounter(void) {
|
||||
long long newtime;
|
||||
|
@ -1649,6 +1702,7 @@ SCR_UpdateScreen(void)
|
|||
V_RenderView(separation[i]);
|
||||
|
||||
SCR_DrawStats();
|
||||
SCR_DrawSpeed();
|
||||
|
||||
if (cl.frame.playerstate.stats[STAT_LAYOUTS] & 1)
|
||||
{
|
||||
|
|
|
@ -189,17 +189,33 @@ ResetDefaults(void *unused)
|
|||
static void
|
||||
ApplyFilter(void* unused)
|
||||
{
|
||||
if (s_filter_list.curvalue == 0)
|
||||
if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 ||
|
||||
Q_stricmp(vid_renderer->string, "gl1") == 0)
|
||||
{
|
||||
Cvar_Set("gl_texturemode", "GL_NEAREST");
|
||||
if (s_filter_list.curvalue == 0)
|
||||
{
|
||||
Cvar_Set("gl_texturemode", "GL_NEAREST");
|
||||
}
|
||||
else if (s_filter_list.curvalue == 1)
|
||||
{
|
||||
Cvar_Set("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST");
|
||||
}
|
||||
else if (s_filter_list.curvalue == 2)
|
||||
{
|
||||
Cvar_Set("gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR");
|
||||
}
|
||||
}
|
||||
else if (s_filter_list.curvalue == 1)
|
||||
|
||||
if (Q_stricmp(vid_renderer->string, "soft") == 0)
|
||||
{
|
||||
Cvar_Set("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST");
|
||||
}
|
||||
else if (s_filter_list.curvalue == 2)
|
||||
{
|
||||
Cvar_Set("gl_texturemode", "GL_LINEAR_MIPMAP_LINEAR");
|
||||
if (s_filter_list.curvalue == 0)
|
||||
{
|
||||
Cvar_Set("sw_texture_filtering", "0");
|
||||
}
|
||||
else if (s_filter_list.curvalue == 1)
|
||||
{
|
||||
Cvar_Set("sw_texture_filtering", "1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -404,6 +420,12 @@ VID_MenuInit(void)
|
|||
0
|
||||
};
|
||||
|
||||
static const char *onoff_names[] = {
|
||||
"off",
|
||||
"on",
|
||||
0
|
||||
};
|
||||
|
||||
static const char *yesno_names[] = {
|
||||
"no",
|
||||
"yes",
|
||||
|
@ -699,29 +721,51 @@ VID_MenuInit(void)
|
|||
pow(2, s_msaa_list.curvalue) <= gl_msaa_samples->value);
|
||||
s_msaa_list.curvalue--;
|
||||
}
|
||||
|
||||
|
||||
s_filter_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_filter_list.generic.name = "texture filter";
|
||||
s_filter_list.generic.x = 0;
|
||||
s_filter_list.generic.y = (y += 10);
|
||||
s_filter_list.itemnames = filter_names;
|
||||
s_filter_list.curvalue = 0;
|
||||
s_filter_list.generic.callback = ApplyFilter;
|
||||
|
||||
const char* filter = Cvar_VariableString("gl_texturemode");
|
||||
int mode = 3;
|
||||
const char* filter = NULL;
|
||||
int mode = 0;
|
||||
|
||||
if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 ||
|
||||
Q_stricmp(vid_renderer->string, "gl1") == 0)
|
||||
{
|
||||
s_filter_list.generic.x = 0;
|
||||
s_filter_list.generic.y = (y += 10);
|
||||
s_filter_list.itemnames = filter_names;
|
||||
|
||||
filter = Cvar_VariableString("gl_texturemode");
|
||||
mode = 3;
|
||||
|
||||
if (Q_stricmp(filter, "GL_NEAREST") == 0)
|
||||
if (Q_stricmp(filter, "GL_NEAREST") == 0)
|
||||
{
|
||||
mode = 0;
|
||||
}
|
||||
else if (Q_stricmp(filter, "GL_LINEAR_MIPMAP_NEAREST") == 0)
|
||||
{
|
||||
mode = 1;
|
||||
}
|
||||
else if (Q_stricmp(filter, "GL_LINEAR_MIPMAP_LINEAR") == 0)
|
||||
{
|
||||
mode = 2;
|
||||
}
|
||||
}
|
||||
else if (Q_stricmp(vid_renderer->string, "soft") == 0)
|
||||
{
|
||||
s_filter_list.generic.x = 0;
|
||||
s_filter_list.generic.y = (y += 10);
|
||||
s_filter_list.itemnames = onoff_names;
|
||||
|
||||
filter = Cvar_VariableString("sw_texture_filtering");
|
||||
mode = 0;
|
||||
}
|
||||
else if (Q_stricmp(filter, "GL_LINEAR_MIPMAP_NEAREST") == 0)
|
||||
{
|
||||
mode = 1;
|
||||
}
|
||||
else if (Q_stricmp(filter, "GL_LINEAR_MIPMAP_LINEAR") == 0)
|
||||
{
|
||||
mode = 2;
|
||||
|
||||
if (Q_stricmp(filter, "1") == 0)
|
||||
{
|
||||
mode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
s_filter_list.curvalue = mode;
|
||||
|
@ -772,7 +816,11 @@ VID_MenuInit(void)
|
|||
Menu_AddItem(&s_opengl_menu, (void *)&s_vsync_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_af_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_filter_list);
|
||||
if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 ||
|
||||
Q_stricmp(vid_renderer->string, "gl1") == 0 || Q_stricmp(vid_renderer->string, "soft") == 0)
|
||||
{
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_filter_list);
|
||||
}
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_defaults_action);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_apply_action);
|
||||
|
||||
|
|
|
@ -1345,7 +1345,7 @@ RE_RenderFrame (refdef_t *fd)
|
|||
// compare current position with old
|
||||
if (vid_buffer_width <= 640 ||
|
||||
!VectorCompareRound(fd->vieworg, lastvieworg) ||
|
||||
!VectorCompare(fd->viewangles, lastviewangles))
|
||||
!VectorCompareRound(fd->viewangles, lastviewangles))
|
||||
{
|
||||
fastmoving = true;
|
||||
}
|
||||
|
|
|
@ -336,6 +336,12 @@ PM_Friction(void)
|
|||
vel[2] = vel[2] * newspeed;
|
||||
}
|
||||
|
||||
//Used for speedoomter display.
|
||||
void GetPlayerSpeed(float* speed, float* speedxy) {
|
||||
*speedxy = sqrt(pml.velocity[0] * pml.velocity[0] + pml.velocity[1] * pml.velocity[1]);
|
||||
*speed = VectorLength(pml.velocity);
|
||||
}
|
||||
|
||||
/*
|
||||
* Handles user intended acceleration
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue