mirror of
https://github.com/nzp-team/glquake.git
synced 2025-02-18 01:31:36 +00:00
Improved MAX AMMO animation
This commit is contained in:
parent
44600071d6
commit
3493853fc2
2 changed files with 37 additions and 13 deletions
|
@ -70,6 +70,8 @@ void M_DrawPic (int x, int y, qpic_t *pic);
|
||||||
double HUD_Change_time;//hide hud when not chagned
|
double HUD_Change_time;//hide hud when not chagned
|
||||||
double bettyprompt_time;
|
double bettyprompt_time;
|
||||||
double nameprint_time;
|
double nameprint_time;
|
||||||
|
double hud_maxammo_starttime;
|
||||||
|
double hud_maxammo_endtime;
|
||||||
|
|
||||||
char player_name[16];
|
char player_name[16];
|
||||||
|
|
||||||
|
@ -564,14 +566,38 @@ int maxammoopac;
|
||||||
|
|
||||||
void HUD_MaxAmmo(void)
|
void HUD_MaxAmmo(void)
|
||||||
{
|
{
|
||||||
maxammoy -= cl.time * 0.003;
|
char* maxammo_string = "Max Ammo!";
|
||||||
maxammoopac -= 5;
|
|
||||||
|
|
||||||
Draw_ColoredStringCentered(maxammoy, "MAX AMMO!", 255, 255, 255, maxammoopac, 1);
|
int start_y = 55;
|
||||||
|
int end_y = 45;
|
||||||
|
int diff_y = end_y - start_y;
|
||||||
|
|
||||||
if (maxammoopac <= 0) {
|
float text_alpha = 1.0f;
|
||||||
domaxammo = false;
|
|
||||||
|
int pos_y;
|
||||||
|
|
||||||
|
double start_time, end_time;
|
||||||
|
|
||||||
|
// For the first 0.5s, stay still while we fade in
|
||||||
|
if (hud_maxammo_endtime > sv.time + 1.5) {
|
||||||
|
start_time = hud_maxammo_starttime;
|
||||||
|
end_time = hud_maxammo_starttime + 0.5;
|
||||||
|
|
||||||
|
text_alpha = (sv.time - start_time) / (end_time - start_time);
|
||||||
|
pos_y = start_y;
|
||||||
}
|
}
|
||||||
|
// For the remaining 1.5s, fade out while we fly upwards.
|
||||||
|
else {
|
||||||
|
start_time = hud_maxammo_starttime + 0.5;
|
||||||
|
end_time = hud_maxammo_endtime;
|
||||||
|
|
||||||
|
float percent_time = (sv.time - start_time) / (end_time - start_time);
|
||||||
|
|
||||||
|
pos_y = start_y + diff_y * percent_time;
|
||||||
|
text_alpha = 1 - percent_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw_ColoredStringCentered(pos_y, maxammo_string, 255, 255, 255, (int)(255 * text_alpha), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1554,13 +1580,8 @@ void HUD_Draw (void)
|
||||||
HUD_Point_Change();
|
HUD_Point_Change();
|
||||||
HUD_Achievement();
|
HUD_Achievement();
|
||||||
|
|
||||||
if (domaxammo == true) {
|
if (hud_maxammo_endtime > sv.time)
|
||||||
if (maxammoopac <= 0) {
|
|
||||||
maxammoopac = 255;
|
|
||||||
maxammoy = 100;
|
|
||||||
}
|
|
||||||
HUD_MaxAmmo();
|
HUD_MaxAmmo();
|
||||||
}
|
|
||||||
|
|
||||||
// This should always come last!
|
// This should always come last!
|
||||||
if (screenflash_duration > sv.time)
|
if (screenflash_duration > sv.time)
|
||||||
|
|
|
@ -21,7 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
|
||||||
extern qboolean domaxammo;
|
extern double hud_maxammo_starttime;
|
||||||
|
extern double hud_maxammo_endtime;
|
||||||
|
|
||||||
qboolean crosshair_pulse_grenade;
|
qboolean crosshair_pulse_grenade;
|
||||||
|
|
||||||
extern int EN_Find(int num,char *string);
|
extern int EN_Find(int num,char *string);
|
||||||
|
@ -1193,7 +1195,8 @@ void CL_ParseServerMessage (void)
|
||||||
SCR_UsePrint (MSG_ReadByte (),MSG_ReadShort (),MSG_ReadByte ());
|
SCR_UsePrint (MSG_ReadByte (),MSG_ReadShort (),MSG_ReadByte ());
|
||||||
break;
|
break;
|
||||||
case svc_maxammo:
|
case svc_maxammo:
|
||||||
domaxammo = true;
|
hud_maxammo_starttime = sv.time;
|
||||||
|
hud_maxammo_endtime = sv.time + 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case svc_pulse:
|
case svc_pulse:
|
||||||
|
|
Loading…
Reference in a new issue