mirror of
https://github.com/nzp-team/glquake.git
synced 2024-11-14 00:11:19 +00:00
Give crosshair control to the server
This commit is contained in:
parent
31d11bb075
commit
394fb14195
4 changed files with 85 additions and 17 deletions
|
@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
|
||||||
extern qboolean domaxammo;
|
extern qboolean domaxammo;
|
||||||
|
qboolean crosshair_pulse_grenade;
|
||||||
|
|
||||||
char *svc_strings[] =
|
char *svc_strings[] =
|
||||||
{
|
{
|
||||||
|
@ -75,7 +76,8 @@ char *svc_strings[] =
|
||||||
"svc_bspdecal", //42 // [string] name [byte] decal_size [coords] pos
|
"svc_bspdecal", //42 // [string] name [byte] decal_size [coords] pos
|
||||||
"svc_achievement", //43
|
"svc_achievement", //43
|
||||||
"svc_songegg", //44 [string] track name
|
"svc_songegg", //44 [string] track name
|
||||||
"svc_maxammo" //45
|
"svc_maxammo", //45
|
||||||
|
"svc_pulse" //46
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -1109,6 +1111,10 @@ void CL_ParseServerMessage (void)
|
||||||
domaxammo = true;
|
domaxammo = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case svc_pulse:
|
||||||
|
crosshair_pulse_grenade = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case svc_stufftext:
|
case svc_stufftext:
|
||||||
Cbuf_AddText (MSG_ReadString ());
|
Cbuf_AddText (MSG_ReadString ());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1068,6 +1068,7 @@ Draw_Crosshair
|
||||||
|
|
||||||
extern float crosshair_opacity;
|
extern float crosshair_opacity;
|
||||||
extern cvar_t cl_crosshair_debug;
|
extern cvar_t cl_crosshair_debug;
|
||||||
|
extern qboolean crosshair_pulse_grenade;
|
||||||
void Draw_Crosshair (void)
|
void Draw_Crosshair (void)
|
||||||
{
|
{
|
||||||
if (cl_crosshair_debug.value) {
|
if (cl_crosshair_debug.value) {
|
||||||
|
@ -1075,7 +1076,16 @@ void Draw_Crosshair (void)
|
||||||
Draw_FillByColor(0, vid.height/2, 400, 1, 0, 255, 0, 255);
|
Draw_FillByColor(0, vid.height/2, 400, 1, 0, 255, 0, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!crosshair.value)
|
if (cl.stats[STAT_HEALTH] <= 20)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (cl.stats[STAT_ZOOM] == 2)
|
||||||
|
Draw_Pic (-39, -15, sniper_scope);
|
||||||
|
if (Hitmark_Time > sv.time)
|
||||||
|
Draw_Pic ((vid.width - hitmark->width)/2,(vid.height - hitmark->height)/2, hitmark);
|
||||||
|
|
||||||
|
// Make sure to do this after hitmark drawing.
|
||||||
|
if (cl.stats[STAT_ZOOM] == 2 || cl.stats[STAT_ZOOM] == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!crosshair_opacity)
|
if (!crosshair_opacity)
|
||||||
|
@ -1110,14 +1120,12 @@ void Draw_Crosshair (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl.stats[STAT_ACTIVEWEAPON] == W_M2 || cl.stats[STAT_ACTIVEWEAPON] == W_TESLA || cl.stats[STAT_ACTIVEWEAPON] == W_DG3)
|
int x_value, y_value;
|
||||||
{
|
int crosshair_offset;
|
||||||
Draw_CharacterRGBA((vid.width)/2-4, (vid.height)/2, 'O', 255, col, col, crosshair_opacity, 1);
|
|
||||||
}
|
// Standard crosshair (+)
|
||||||
else if (crosshair.value == 1 && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2 && cl.stats[STAT_ACTIVEWEAPON] != W_PANZER)
|
if (crosshair.value == 1) {
|
||||||
{
|
crosshair_offset = CrossHairWeapon() + cur_spread;
|
||||||
int x_value, y_value;
|
|
||||||
int crosshair_offset = CrossHairWeapon() + cur_spread;
|
|
||||||
if (CrossHairMaxSpread() < crosshair_offset || croshhairmoving)
|
if (CrossHairMaxSpread() < crosshair_offset || croshhairmoving)
|
||||||
crosshair_offset = CrossHairMaxSpread();
|
crosshair_offset = CrossHairMaxSpread();
|
||||||
|
|
||||||
|
@ -1144,13 +1152,43 @@ void Draw_Crosshair (void)
|
||||||
x_value = (vid.width - 1)/2;
|
x_value = (vid.width - 1)/2;
|
||||||
y_value = (vid.height - 3)/2 + crosshair_offset_step;
|
y_value = (vid.height - 3)/2 + crosshair_offset_step;
|
||||||
Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col, 255);
|
Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col, 255);
|
||||||
}
|
}
|
||||||
else if (crosshair.value && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2)
|
// Area of Effect (o)
|
||||||
|
else if (crosshair.value == 2) {
|
||||||
|
Draw_CharacterRGBA((vid.width)/2-4, (vid.height)/2, 'O', 255, col, col, crosshair_opacity, 1);
|
||||||
|
}
|
||||||
|
// Dot crosshair (.)
|
||||||
|
else if (crosshair.value == 3) {
|
||||||
Draw_CharacterRGBA((vid.width - 8)/2, (vid.height - 8)/2, '.', 255, col, col, crosshair_opacity, 1);
|
Draw_CharacterRGBA((vid.width - 8)/2, (vid.height - 8)/2, '.', 255, col, col, crosshair_opacity, 1);
|
||||||
if (cl.stats[STAT_ZOOM] == 2)
|
}
|
||||||
Draw_Pic (-39, -15, sniper_scope);
|
// Grenade crosshair
|
||||||
if (Hitmark_Time > sv.time)
|
else if (crosshair.value == 4) {
|
||||||
Draw_Pic ((vid.width - hitmark->width)/2,(vid.height - hitmark->height)/2, hitmark);
|
if (crosshair_pulse_grenade) {
|
||||||
|
crosshair_offset_step = 0;
|
||||||
|
cur_spread = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
crosshair_pulse_grenade = false;
|
||||||
|
|
||||||
|
crosshair_offset = 12 + cur_spread;
|
||||||
|
crosshair_offset_step += (crosshair_offset - crosshair_offset_step) * 0.5;
|
||||||
|
|
||||||
|
x_value = (vid.width - 3)/2 - crosshair_offset_step;
|
||||||
|
y_value = (vid.height - 1)/2;
|
||||||
|
Draw_FillByColor(x_value, y_value, 3, 1, 255, 255, 255, 255);
|
||||||
|
|
||||||
|
x_value = (vid.width - 3)/2 + crosshair_offset_step;
|
||||||
|
y_value = (vid.height - 1)/2;
|
||||||
|
Draw_FillByColor(x_value, y_value, 3, 1, 255, 255, 255, 255);
|
||||||
|
|
||||||
|
x_value = (vid.width - 1)/2;
|
||||||
|
y_value = (vid.height - 3)/2 - crosshair_offset_step;
|
||||||
|
Draw_FillByColor(x_value, y_value, 1, 3, 255, 255, 255, 255);
|
||||||
|
|
||||||
|
x_value = (vid.width - 1)/2;
|
||||||
|
y_value = (vid.height - 3)/2 + crosshair_offset_step;
|
||||||
|
Draw_FillByColor(x_value, y_value, 1, 3, 255, 255, 255, 255);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3206,6 +3206,29 @@ void PF_MaxAmmo(void)
|
||||||
MSG_WriteByte(&sv.reliable_datagram, svc_maxammo);
|
MSG_WriteByte(&sv.reliable_datagram, svc_maxammo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
PF_GrenadePulse
|
||||||
|
|
||||||
|
pulses crosshair for grenades
|
||||||
|
|
||||||
|
grenade_pulse()
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void PF_GrenadePulse(void)
|
||||||
|
{
|
||||||
|
client_t *client;
|
||||||
|
int entnum;
|
||||||
|
|
||||||
|
entnum = G_EDICTNUM(OFS_PARM0);
|
||||||
|
|
||||||
|
if (entnum < 1 || entnum > svs.maxclients)
|
||||||
|
return;
|
||||||
|
|
||||||
|
client = &svs.clients[entnum-1];
|
||||||
|
MSG_WriteByte (&client->message,svc_pulse);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
|
@ -3804,7 +3827,7 @@ PF_Fixme,
|
||||||
PF_Fixme,
|
PF_Fixme,
|
||||||
PF_SongEgg, // #500
|
PF_SongEgg, // #500
|
||||||
PF_MaxAmmo, // #501
|
PF_MaxAmmo, // #501
|
||||||
PF_Fixme,
|
PF_GrenadePulse, // #502
|
||||||
PF_Fixme,
|
PF_Fixme,
|
||||||
PF_Fixme,
|
PF_Fixme,
|
||||||
};
|
};
|
||||||
|
|
|
@ -150,6 +150,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define svc_achievement 43 // [string] name [byte] decal_size [coords] pos
|
#define svc_achievement 43 // [string] name [byte] decal_size [coords] pos
|
||||||
#define svc_songegg 44 // [string] track name
|
#define svc_songegg 44 // [string] track name
|
||||||
#define svc_maxammo 45
|
#define svc_maxammo 45
|
||||||
|
#define svc_pulse 46
|
||||||
|
|
||||||
//
|
//
|
||||||
// client to server
|
// client to server
|
||||||
|
|
Loading…
Reference in a new issue