diff --git a/source/cl_parse.c b/source/cl_parse.c index c760cb0..a33076c 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" extern qboolean domaxammo; +qboolean crosshair_pulse_grenade; char *svc_strings[] = { @@ -75,7 +76,8 @@ char *svc_strings[] = "svc_bspdecal", //42 // [string] name [byte] decal_size [coords] pos "svc_achievement", //43 "svc_songegg", //44 [string] track name - "svc_maxammo" //45 + "svc_maxammo", //45 + "svc_pulse" //46 }; //============================================================================= @@ -1108,6 +1110,10 @@ void CL_ParseServerMessage (void) case svc_maxammo: domaxammo = true; break; + + case svc_pulse: + crosshair_pulse_grenade = true; + break; case svc_stufftext: Cbuf_AddText (MSG_ReadString ()); diff --git a/source/gl_draw.c b/source/gl_draw.c index 67548f2..add176c 100644 --- a/source/gl_draw.c +++ b/source/gl_draw.c @@ -1072,6 +1072,7 @@ Draw_Crosshair extern float crosshair_opacity; extern cvar_t cl_crosshair_debug; +extern qboolean crosshair_pulse_grenade; void Draw_Crosshair (void) { if (cl_crosshair_debug.value) { @@ -1079,7 +1080,16 @@ void Draw_Crosshair (void) Draw_FillByColor(0, vid.height/2, 400, 1, 0, 255, 0, 255); } - if (cl.stats[STAT_HEALTH] < 20) + 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; if (!crosshair_opacity) @@ -1114,14 +1124,12 @@ void Draw_Crosshair (void) } } - if (cl.stats[STAT_ACTIVEWEAPON] == W_M2 || cl.stats[STAT_ACTIVEWEAPON] == W_TESLA || cl.stats[STAT_ACTIVEWEAPON] == W_DG3) - { - Draw_CharacterRGBA((vid.width)/2-4, (vid.height)/2, 'O', 255, col, col, crosshair_opacity, 1); - } - else if (crosshair.value == 1 && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2 && cl.stats[STAT_ACTIVEWEAPON] != W_PANZER) - { - int x_value, y_value; - int crosshair_offset = CrossHairWeapon() + cur_spread; + int x_value, y_value; + int crosshair_offset; + + // Standard crosshair (+) + if (crosshair.value == 1) { + crosshair_offset = CrossHairWeapon() + cur_spread; if (CrossHairMaxSpread() < crosshair_offset || croshhairmoving) crosshair_offset = CrossHairMaxSpread(); @@ -1148,13 +1156,43 @@ void Draw_Crosshair (void) x_value = (vid.width - 1)/2; y_value = (vid.height - 3)/2 + crosshair_offset_step; 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); - 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); + } + // Grenade crosshair + else if (crosshair.value == 4) { + 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); + } } diff --git a/source/pr_cmds.c b/source/pr_cmds.c index f37a27f..a84b981 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -3206,6 +3206,29 @@ void PF_MaxAmmo(void) 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_SongEgg, // #500 PF_MaxAmmo, // #501 -PF_Fixme, +PF_GrenadePulse, // #502 PF_Fixme, PF_Fixme, }; diff --git a/source/protocol.h b/source/protocol.h index 72b4efa..fd73829 100644 --- a/source/protocol.h +++ b/source/protocol.h @@ -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_songegg 44 // [string] track name #define svc_maxammo 45 +#define svc_pulse 46 // // client to server