Skip to content

Commit

Permalink
Removed grenade messaging, it causes too many problems
Browse files Browse the repository at this point in the history
  • Loading branch information
darkshade9 committed Jul 2, 2024
1 parent 19adf88 commit cc47874
Showing 1 changed file with 0 additions and 42 deletions.
42 changes: 0 additions & 42 deletions src/action/g_combat.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,40 +957,13 @@ void T_RadiusDamage (edict_t * inflictor, edict_t * attacker, float damage,
edict_t *ent = NULL;
vec3_t v;
vec3_t dir;
char ent_name_list[1024] = ""; // Buffer to hold the names
int ent_count = 0; // Counter for the number of entities
qboolean selfharm = false;


while ((ent = findradius (ent, inflictor->s.origin, radius)) != NULL)
{
if (ent == ignore)
continue;
if (!ent->takedamage)
continue;
if (ent == attacker)
selfharm = true;

// Messaging addition
if ((ent->client || ent->is_bot) && IS_ALIVE(ent) && ent != attacker){
// Only add the name to the list if there are less than 4 names
if (ent_count < 4)
{
// Calculate the length of the new string
int new_length = strlen(ent_name_list) + strlen(" and ") + strlen(ent->client->pers.netname);

// Check if the new string would fit in ent_name_list
if (new_length < sizeof(ent_name_list))
{
if (ent_count > 0)
strncat(ent_name_list, " and ", sizeof(ent_name_list) - strlen(ent_name_list) - 1);
strncat(ent_name_list, ent->client->pers.netname, sizeof(ent_name_list) - strlen(ent_name_list) - 1);
}
}
ent_count++;
}

// End messaging addition

VectorAdd (ent->mins, ent->maxs, v);
VectorMA (ent->s.origin, 0.5, v, v);
Expand Down Expand Up @@ -1022,19 +995,4 @@ void T_RadiusDamage (edict_t * inflictor, edict_t * attacker, float damage,
}
}
}

// Grenade splash damage messaging
// Checks for attacker being NULL (this causes a cprintf segfault if NULL), and if the attacker is a client
// Also checks if the mod is a grenade splash. The game uses T_RadiusDamage for a variety of damaging effects
// so we only want to print the grenade splash messages if the mod is a grenade splash
if (attacker && attacker->client && mod == MOD_HG_SPLASH){
if (ent_count > 3)
gi.cprintf(attacker, PRINT_HIGH, "You nailed several players with that grenade, nicely done!\n");
else if (selfharm && ent_count > 0)
gi.cprintf(attacker, PRINT_HIGH, "You were blasted by your own grenade, along with %s\n", ent_name_list);
else if (selfharm)
gi.cprintf(attacker, PRINT_HIGH, "You were blasted by your own grenade, throw farther next time?\n");
else if (ent_count > 0)
gi.cprintf(attacker, PRINT_HIGH, "%s was blasted by your grenade.\n", ent_name_list);
}
}

0 comments on commit cc47874

Please sign in to comment.