reaction/code/game/rxn_game.c

90 lines
2.7 KiB
C
Raw Normal View History

//-----------------------------------------------------------------------------
//
// $Id$
//
//-----------------------------------------------------------------------------
//
2001-12-31 16:28:42 +00:00
// $Log$
// 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
//
// 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 )
//
// 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-05-06 20:50:27 +00:00
#include "g_local.h"
//Elder: someone should comment this b/c it's hard to follow
//Makes the damage "non-instant" like AQ2
void CheckBleeding(gentity_t * targ)
2001-05-06 20:50:27 +00:00
{
int damage;
int temp;
int realBleedTime;
gentity_t *tent;
// Elder: use the server's FPS as a basis for bleed time
realBleedTime = trap_Cvar_VariableIntegerValue("sv_fps");
// just safety check it
if (realBleedTime <= 0)
realBleedTime = BLEED_TIME;
2001-11-25 23:04:08 +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)
temp = (int) (targ->client->bleeding * 0.2f * (10.0f / realBleedTime));
2001-11-25 23:04:08 +00:00
targ->client->bleeding -= temp;
if (temp <= 0)
2001-11-25 23:04:08 +00:00
temp = 1;
2001-11-25 23:04:08 +00:00
targ->client->bleed_remain += temp;
damage = (int) (targ->client->bleed_remain / realBleedTime);
2001-11-25 23:04:08 +00:00
if (targ->client->bleed_remain >= realBleedTime) {
//G_Printf("Bleed Remain: %i Server Time: %i\n", targ->client->bleed_remain, level.time);
// if ( (targ->client->ps.stats[STAT_RQ3] & RQ3_BANDAGE_WORK) == RQ3_BANDAGE_WORK &&
2002-06-23 19:27:52 +00:00
targ->health -= damage;
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 {
targ->client->bleed_remain %= realBleedTime;
}
if (g_RQ3_ejectBlood.integer && targ->client->bleed_delay <= level.time) {
vec3_t bleedOrigin;
2001-11-25 23:04:08 +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
// do bleeding
tent = G_TempEntity(bleedOrigin, EV_EJECTBLOOD);
tent->s.otherEntityNum = targ->s.clientNum;
2001-05-06 20:50:27 +00:00
}
}
}
//Elder: apparently does nothing and is unused
void StartBandage(gentity_t * ent)
2001-05-06 20:50:27 +00:00
{
ent->client->bleeding = 0;
}