From 840b5e402451476a8502c06796d6677058ee3a3f Mon Sep 17 00:00:00 2001 From: Duff Man Date: Mon, 25 Jun 2001 23:47:33 +0000 Subject: [PATCH] added CG_DMRewardEvent --- reaction/cgame/cg_event.c | 68 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/reaction/cgame/cg_event.c b/reaction/cgame/cg_event.c index 66a705fa..54d72122 100644 --- a/reaction/cgame/cg_event.c +++ b/reaction/cgame/cg_event.c @@ -465,6 +465,69 @@ void CG_PainEvent( centity_t *cent, int health ) { } +/* +============= +CG_DMRewardEvent + +Used to display the frag rewards for getting many frags in a row during a DM game. + +============= +*/ + +static void CG_DMRewardEvent( entityState_t *ent ) { + + int mod; + int target, attacker; + char *message; + char *message2; + const char *targetInfo; + const char *attackerInfo; + char targetName[32]; + char attackerName[32]; + gender_t gender; + clientInfo_t *ci; + + target = ent->otherEntityNum; + attacker = ent->otherEntityNum2; + mod = ent->eventParm; + + if ( target < 0 || target >= MAX_CLIENTS ) { + CG_Error( "CG_Obituary: target out of range" ); + } + ci = &cgs.clientinfo[target]; + + if ( attacker < 0 || attacker >= MAX_CLIENTS ) { + attacker = ENTITYNUM_WORLD; + attackerInfo = NULL; + } else { + attackerInfo = CG_ConfigString( CS_PLAYERS + attacker ); + } + + targetInfo = CG_ConfigString( CS_PLAYERS + target ); + if ( !targetInfo ) { + return; + } + + Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof(targetName) - 2); + strcat( targetName, S_COLOR_WHITE ); + if ((mod > 3) && (mod < 8)) + message = "2"; + else if (mod < 16) + message = "4"; + else if (mod < 32) + message = "8"; + else + message = "16"; + + if (message) { + CG_Printf( "%s has %d kills in a row and receives %s frags for the kill!\n", + targetName, mod, message); + return; + } + + +} + /* ============== @@ -1025,6 +1088,11 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) { } break; + case EV_DMREWARD: + DEBUGNAME("EV_DMREWARD"); + CG_DMRewardEvent( es ); + break; + case EV_GLOBAL_TEAM_SOUND: // play from the player's head so it never diminishes { DEBUGNAME("EV_GLOBAL_TEAM_SOUND");