Added damage indicator.
This commit is contained in:
parent
628097eff9
commit
701f0e8737
5 changed files with 106 additions and 61 deletions
36
Source/Client/Damage.c
Normal file
36
Source/Client/Damage.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
var float g_flDamageAlpha;
|
||||
var vector g_vecDamageLocation;
|
||||
|
||||
void Damage_Draw(void)
|
||||
{
|
||||
if ( g_flDamageAlpha > 0.0f ) {
|
||||
vector vecMiddle = [ vVideoResolution[0] / 2, vVideoResolution[1] / 2 ];
|
||||
makevectors( getproperty( VF_CL_VIEWANGLES ) );
|
||||
|
||||
vector location = normalize( g_vecDamageLocation - getproperty( VF_ORIGIN ) );
|
||||
float fForward = dotproduct( location, v_forward );
|
||||
float fRight = dotproduct( location, v_right );
|
||||
|
||||
if ( fForward > 0.25 ) {
|
||||
drawpic( vecMiddle + [-64,-70 - 32], "sprites/640_pain.spr_0.tga", [128,48], [1,1,1], fabs( fForward ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
|
||||
} else if ( fForward < -0.25 ) {
|
||||
drawpic( vecMiddle + [-64,70], "sprites/640_pain.spr_2.tga", [128,48], [1,1,1], fabs( fForward ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
if ( fRight > 0.25 ) {
|
||||
drawpic( vecMiddle + [70,-64], "sprites/640_pain.spr_1.tga", [48,128], [1,1,1], fabs( fRight ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
|
||||
} else if ( fRight < -0.25 ) {
|
||||
drawpic( vecMiddle + [-70 - 32,-64], "sprites/640_pain.spr_3.tga", [48,128], [1,1,1], fabs( fRight ) * g_flDamageAlpha, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
g_flDamageAlpha -= frametime;
|
||||
}
|
||||
}
|
||||
|
||||
float CSQC_Parse_Damage(float save, float take, vector org)
|
||||
{
|
||||
if (org) {
|
||||
g_vecDamageLocation = org;
|
||||
g_flDamageAlpha = 1.0f;
|
||||
}
|
||||
sound(self, CHAN_VOICE, "player/pl_pain2.wav", 1, ATTN_NORM);
|
||||
return TRUE;
|
||||
}
|
|
@ -475,8 +475,9 @@ void HUD_Draw( void ) {
|
|||
} else {
|
||||
HUD_DrawCrosshair();
|
||||
}
|
||||
|
||||
|
||||
HUD_DrawFlash();
|
||||
Damage_Draw();
|
||||
HUD_DrawTimer();
|
||||
HUD_DrawHealth();
|
||||
HUD_DrawArmor();
|
||||
|
|
|
@ -33,81 +33,84 @@ Comparable to worldspawn in SSQC in that it's mostly used for precaches
|
|||
*/
|
||||
void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
||||
pSeat = &seats[0];
|
||||
precache_model( HUD_NUMFILE );
|
||||
precache_model(HUD_NUMFILE);
|
||||
|
||||
precache_model( "sprites/top_left.spr" );
|
||||
precache_model( "sprites/top.spr" );
|
||||
precache_model( "sprites/top_right.spr" );
|
||||
precache_model( "sprites/left.spr" );
|
||||
precache_model( "sprites/right.spr" );
|
||||
precache_model( "sprites/bottom_left.spr" );
|
||||
precache_model( "sprites/bottom.spr" );
|
||||
precache_model( "sprites/bottom_right.spr" );
|
||||
precache_model("sprites/top_left.spr");
|
||||
precache_model("sprites/top.spr");
|
||||
precache_model("sprites/top_right.spr");
|
||||
precache_model("sprites/left.spr");
|
||||
precache_model("sprites/right.spr");
|
||||
precache_model("sprites/bottom_left.spr");
|
||||
precache_model("sprites/bottom.spr");
|
||||
precache_model("sprites/bottom_right.spr");
|
||||
|
||||
precache_model( "sprites/sniper_scope.spr" );
|
||||
precache_model( "sprites/fexplo.spr" );
|
||||
precache_model( "sprites/muzzleflash1.spr" );
|
||||
precache_model( "sprites/radar640.spr" );
|
||||
precache_model( "sprites/640hud1.spr" );
|
||||
precache_model( "sprites/640hud16.spr" );
|
||||
precache_model("sprites/sniper_scope.spr");
|
||||
precache_model("sprites/fexplo.spr");
|
||||
precache_model("sprites/muzzleflash1.spr");
|
||||
precache_model("sprites/radar640.spr");
|
||||
precache_model("sprites/640hud1.spr");
|
||||
precache_model("sprites/640hud16.spr");
|
||||
|
||||
precache_model( "sprites/640hud2.spr" );
|
||||
precache_model( "sprites/640hud10.spr" );
|
||||
precache_model( "sprites/640hud12.spr" );
|
||||
precache_model( "sprites/640hud14.spr" );
|
||||
precache_model( "sprites/640hud3.spr" );
|
||||
precache_model("sprites/640hud2.spr");
|
||||
precache_model("sprites/640hud10.spr");
|
||||
precache_model("sprites/640hud12.spr");
|
||||
precache_model("sprites/640hud14.spr");
|
||||
precache_model("sprites/640hud3.spr");
|
||||
precache_model("sprites/640hud5.spr");
|
||||
precache_model("sprites/640_pain.spr");
|
||||
|
||||
precache_sound( "common/wpn_hudon.wav" );
|
||||
precache_sound( "common/wpn_hudoff.wav" );
|
||||
precache_sound( "common/wpn_moveselect.wav" );
|
||||
precache_sound( "common/wpn_select.wav" );
|
||||
precache_sound("common/wpn_hudon.wav");
|
||||
precache_sound("common/wpn_hudoff.wav");
|
||||
precache_sound("common/wpn_moveselect.wav");
|
||||
precache_sound("common/wpn_select.wav");
|
||||
|
||||
precache_sound( "debris/bustglass1.wav" );
|
||||
precache_sound( "debris/bustglass2.wav" );
|
||||
precache_sound( "debris/bustglass3.wav" );
|
||||
precache_sound( "debris/bustcrate1.wav" );
|
||||
precache_sound( "debris/bustcrate2.wav" );
|
||||
precache_sound( "debris/bustcrate3.wav" );
|
||||
precache_sound( "debris/bustmetal1.wav" );
|
||||
precache_sound( "debris/bustmetal2.wav" );
|
||||
precache_sound( "debris/bustflesh1.wav" );
|
||||
precache_sound( "debris/bustflesh2.wav" );
|
||||
precache_sound( "debris/bustconcrete1.wav" );
|
||||
precache_sound( "debris/bustconcrete2.wav" );
|
||||
precache_sound( "debris/bustceiling.wav" );
|
||||
precache_model( "sprites/iplayerred.spr" );
|
||||
precache_model( "sprites/iplayerblue.spr" );
|
||||
precache_model( "sprites/iplayervip.spr" );
|
||||
precache_model( "sprites/ihostage.spr" );
|
||||
precache_sound("debris/bustglass1.wav");
|
||||
precache_sound("debris/bustglass2.wav");
|
||||
precache_sound("debris/bustglass3.wav");
|
||||
precache_sound("debris/bustcrate1.wav");
|
||||
precache_sound("debris/bustcrate2.wav");
|
||||
precache_sound("debris/bustcrate3.wav");
|
||||
precache_sound("debris/bustmetal1.wav");
|
||||
precache_sound("debris/bustmetal2.wav");
|
||||
precache_sound("debris/bustflesh1.wav");
|
||||
precache_sound("debris/bustflesh2.wav");
|
||||
precache_sound("debris/bustconcrete1.wav");
|
||||
precache_sound("debris/bustconcrete2.wav");
|
||||
precache_sound("debris/bustceiling.wav");
|
||||
precache_sound("player/pl_pain2.wav");
|
||||
precache_model("sprites/iplayerred.spr");
|
||||
precache_model("sprites/iplayerblue.spr");
|
||||
precache_model("sprites/iplayervip.spr");
|
||||
precache_model("sprites/ihostage.spr");
|
||||
|
||||
precache_model( "models/pshell.mdl" );
|
||||
precache_model( "models/rshell.mdl" );
|
||||
precache_model( "models/rshell_big.mdl" );
|
||||
precache_model( "models/shotgunshell.mdl" );
|
||||
precache_model("models/pshell.mdl");
|
||||
precache_model("models/rshell.mdl");
|
||||
precache_model("models/rshell_big.mdl");
|
||||
precache_model("models/shotgunshell.mdl");
|
||||
|
||||
precache_pic( "gfx/vgui/icntlk_sv" );
|
||||
precache_pic( "gfx/vgui/icntlk_sv");
|
||||
precache_pic( sprintf( "overviews/%s.bmp", mapname ) );
|
||||
|
||||
precache_pic( "logos/lambda.bmp" );
|
||||
precache_pic( "logos/doug.bmp" );
|
||||
precache_pic( "logos/lambda.bmp");
|
||||
precache_pic( "logos/doug.bmp");
|
||||
|
||||
for ( int i = 0; i < ( CS_WEAPON_COUNT - 1 ); i++ ) {
|
||||
precache_model( sViewModels[ i ] );
|
||||
}
|
||||
|
||||
PARTICLE_SPARK = particleeffectnum( "part_spark" );
|
||||
PARTICLE_PIECES_BLACK = particleeffectnum( "part_pieces_black" );
|
||||
PARTICLE_SMOKE_GREY = particleeffectnum( "part_smoke_grey" );
|
||||
PARTICLE_SMOKE_BROWN = particleeffectnum( "part_smoke_brown" );
|
||||
PARTICLE_BLOOD = particleeffectnum( "part_blood" );
|
||||
DECAL_SHOT = particleeffectnum( "decal_shot" );
|
||||
DECAL_GLASS = particleeffectnum( "decal_glass" );
|
||||
PARTICLE_SMOKEGRENADE = particleeffectnum( "smokegren" );
|
||||
PARTICLE_SPARK = particleeffectnum("part_spark");
|
||||
PARTICLE_PIECES_BLACK = particleeffectnum("part_pieces_black");
|
||||
PARTICLE_SMOKE_GREY = particleeffectnum("part_smoke_grey");
|
||||
PARTICLE_SMOKE_BROWN = particleeffectnum("part_smoke_brown");
|
||||
PARTICLE_BLOOD = particleeffectnum("part_blood");
|
||||
DECAL_SHOT = particleeffectnum("decal_shot");
|
||||
DECAL_GLASS = particleeffectnum("decal_glass");
|
||||
PARTICLE_SMOKEGRENADE = particleeffectnum("smokegren");
|
||||
|
||||
FONT_16 = loadfont( "16", "fonts/default", "16", -1 );
|
||||
FONT_CON = loadfont( "font", "", "12", -1 );
|
||||
FONT_16 = loadfont("16", "fonts/default", "16", -1);
|
||||
FONT_CON = loadfont("font", "", "12", -1);
|
||||
|
||||
SHADER_CULLED = shaderforname( "mirror_cull" );
|
||||
SHADER_CULLED = shaderforname("mirror_cull");
|
||||
|
||||
Radio_InitSounds();
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ VGUIBuyMenu.c
|
|||
VGUITeamSelect.c
|
||||
VGUIRadio.c
|
||||
VGUI.c
|
||||
Damage.c
|
||||
Nightvision.c
|
||||
HUDCrosshair.c
|
||||
HUDScope.c
|
||||
|
|
|
@ -150,13 +150,17 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
|
|||
|
||||
if ( iSkipArmor == TRUE ) {
|
||||
eTarget.health = rint( eTarget.health -= iDamage );
|
||||
eTarget.dmg_take = (float)iDamage;
|
||||
} else {
|
||||
eTarget.health = rint( eTarget.health -= fNewDmg );
|
||||
eTarget.dmg_take = (float)fNewDmg;
|
||||
}
|
||||
} else {
|
||||
// No armor
|
||||
eTarget.health -= iDamage;
|
||||
eTarget.dmg_take = (float)iDamage;
|
||||
}
|
||||
eTarget.dmg_inflictor = eAttacker;
|
||||
|
||||
// Special monetary punishment for hostage murderers
|
||||
if ( eTarget.classname == "hostage_entity" ) {
|
||||
|
@ -166,7 +170,7 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos
|
|||
Money_AddMoney( eAttacker, autocvar_fcs_penalty_kill ); // Death
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Target is dead and a client....
|
||||
if ( eTarget.health <= 0 ) {
|
||||
if ( eTarget.flags & FL_CLIENT ) {
|
||||
|
|
Loading…
Reference in a new issue