2001-12-31 16:16:59 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// $Log$
|
2002-06-23 21:44:08 +00:00
|
|
|
// Revision 1.16 2002/06/23 21:44:08 jbravo
|
|
|
|
// Fixed shots fired stats for non TP modes and some cleanups
|
|
|
|
//
|
2002-06-23 19:27:52 +00:00
|
|
|
// Revision 1.15 2002/06/23 19:24:19 niceass
|
|
|
|
// bandage bug fix
|
|
|
|
//
|
2002-06-16 20:06:15 +00:00
|
|
|
// Revision 1.14 2002/06/16 20:06:14 jbravo
|
|
|
|
// Reindented all the source files with "indent -kr -ut -i8 -l120 -lc120 -sob -bad -bap"
|
|
|
|
//
|
2002-03-18 19:19:08 +00:00
|
|
|
// Revision 1.13 2002/03/18 19:18:39 slicer
|
|
|
|
// Fixed bandage bugs ( i hope )
|
|
|
|
//
|
2002-01-11 19:48:33 +00:00
|
|
|
// Revision 1.12 2002/01/11 19:48:30 jbravo
|
|
|
|
// Formatted the source in non DOS format.
|
|
|
|
//
|
2001-12-31 16:28:42 +00:00
|
|
|
// Revision 1.11 2001/12/31 16:28:42 jbravo
|
|
|
|
// I made a Booboo with the Log tag.
|
|
|
|
//
|
2001-12-31 16:16:59 +00:00
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
2001-05-06 20:50:27 +00:00
|
|
|
#include "g_local.h"
|
|
|
|
|
2001-07-09 00:32:10 +00:00
|
|
|
//Elder: someone should comment this b/c it's hard to follow
|
|
|
|
//Makes the damage "non-instant" like AQ2
|
2002-06-16 20:06:15 +00:00
|
|
|
void CheckBleeding(gentity_t * targ)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
|
|
|
int damage;
|
|
|
|
int temp;
|
2001-09-01 16:14:14 +00:00
|
|
|
int realBleedTime;
|
|
|
|
gentity_t *tent;
|
|
|
|
|
|
|
|
// Elder: use the server's FPS as a basis for bleed time
|
2002-06-16 20:06:15 +00:00
|
|
|
realBleedTime = trap_Cvar_VariableIntegerValue("sv_fps");
|
2001-09-01 16:14:14 +00:00
|
|
|
// just safety check it
|
|
|
|
if (realBleedTime <= 0)
|
|
|
|
realBleedTime = BLEED_TIME;
|
2001-11-25 23:04:08 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (!(targ->client->bleeding) || (targ->health <= 0))
|
2001-11-25 23:04:08 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
// NiceAss: (10.0f / realBleedTime) is just (Q2 FPS / Q3 FPS)
|
2002-06-16 20:06:15 +00:00
|
|
|
temp = (int) (targ->client->bleeding * 0.2f * (10.0f / realBleedTime));
|
2001-11-25 23:04:08 +00:00
|
|
|
targ->client->bleeding -= temp;
|
|
|
|
|
2001-09-01 16:14:14 +00:00
|
|
|
if (temp <= 0)
|
2001-11-25 23:04:08 +00:00
|
|
|
temp = 1;
|
2001-07-09 00:32:10 +00:00
|
|
|
|
2001-11-25 23:04:08 +00:00
|
|
|
targ->client->bleed_remain += temp;
|
2002-06-16 20:06:15 +00:00
|
|
|
damage = (int) (targ->client->bleed_remain / realBleedTime);
|
2001-11-25 23:04:08 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (targ->client->bleed_remain >= realBleedTime) {
|
2001-09-01 16:14:14 +00:00
|
|
|
//G_Printf("Bleed Remain: %i Server Time: %i\n", targ->client->bleed_remain, level.time);
|
2002-06-16 20:06:15 +00:00
|
|
|
// if ( (targ->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK) == RQ3_BANDAGE_WORK &&
|
2002-06-23 19:27:52 +00:00
|
|
|
targ->health -= damage;
|
2001-07-09 00:32:10 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (targ->health <= 0) {
|
|
|
|
player_die(targ, &g_entities[targ->client->lasthurt_client],
|
|
|
|
&g_entities[targ->client->lasthurt_client], damage, targ->client->lasthurt_mod);
|
|
|
|
} else {
|
2001-09-01 16:14:14 +00:00
|
|
|
targ->client->bleed_remain %= realBleedTime;
|
|
|
|
}
|
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
if (g_RQ3_ejectBlood.integer && targ->client->bleed_delay <= level.time) {
|
|
|
|
vec3_t bleedOrigin;
|
2001-11-25 23:04:08 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
targ->client->bleed_delay = level.time + 2000; // 2 seconds
|
|
|
|
VectorAdd(targ->client->bleedloc_offset, targ->client->ps.origin, bleedOrigin);
|
|
|
|
//gi.cprintf(ent, PRINT_HIGH, "Bleeding now.\n");
|
|
|
|
//EjectBlooder(ent, pos, pos);
|
2001-11-25 23:04:08 +00:00
|
|
|
|
2002-06-16 20:06:15 +00:00
|
|
|
// do bleeding
|
|
|
|
tent = G_TempEntity(bleedOrigin, EV_EJECTBLOOD);
|
|
|
|
tent->s.otherEntityNum = targ->s.clientNum;
|
2001-05-06 20:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-09 00:32:10 +00:00
|
|
|
//Elder: apparently does nothing and is unused
|
2002-06-16 20:06:15 +00:00
|
|
|
void StartBandage(gentity_t * ent)
|
2001-05-06 20:50:27 +00:00
|
|
|
{
|
|
|
|
ent->client->bleeding = 0;
|
2002-06-23 21:44:08 +00:00
|
|
|
}
|