Skip to content

Commit

Permalink
Merge pull request #239 from actionquake/tng/raptor007-patch-1
Browse files Browse the repository at this point in the history
Cherry picked some nice features from upstream TNG
  • Loading branch information
darkshade9 authored Jan 10, 2025
2 parents d2af296 + f37212e commit 39d90cd
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 2 deletions.
3 changes: 2 additions & 1 deletion action/doc/manual.txt
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ Features
stats [#] - this will display the stats for the player with the id given. (client side)
stats_mode [0/1/2] - when set to 1, it will automatically display the stats of the player at the end of each
round. When set to 2, it will automatically display the stats of the player at the end of the map. By default
this is set to 0 (off). (client side)
this is set to 0 (off). (client side) // This is a legacy entry that has no code associated with it, I'm
only keeping it in this doc for historical reasons.

* Automatic Joining/Equipping
For the lazy players under us, we have created two new client commands to make things easier.
Expand Down
2 changes: 2 additions & 0 deletions doc/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ To see how well players are doing, we have implemented statistics into TNG. This
- `stats list` - this will display a list of all players and their ID. (client side)
- `stats [#]` - this will display the stats for the player with the id given. (client side)
- `stats_mode [0/1/2]` - when set to 1, it will automatically display the stats of the player at the end of each round. When set to 2, it will automatically display the stats of the player at the end of the map. By default this is set to 0 (off). (client side)
- ^ This is a legacy entry that has no code associated with it, I'm only keeping it in this doc for historical reasons.

### Automatic Joining/Equipping/Menu
For the lazy players under us, we have created three new commands to make things easier.
Expand Down Expand Up @@ -708,6 +709,7 @@ Inspired by AQ2:ETE, these additions are optional server vars to create a differ
- `gun_dualmk23_enhance [0/1]` - server cvar, default 0. If enabled, this allows both the silencer and the laser sight to be used on the Dual MK23 Pistols.
- `use_gren_bonk [0/1]` - server cvar, default 0. If enabled, this enables impact damage of the grenade to cause damage on direct contact with a player. The speed of which the grenade is thrown will determine the damage dealt. Thanks to JukS for the idea and the code.
- `lca_grenade` - server cvar, default 0. If enabled, players can pull the grenade pin during Lights Camera Action, but they still cannot throw it until Action!
- `grenade_drop [0/#]` - server cvar, default 0. If enabled, players who have grenades in their inventory when they die will drop unspent grenades on the ground. This value can be set to any number, but it probably makes sense to keep it below 3

### Highscores
Borrowing code from OpenTDM (thank you Skuller!), high scores are stored in a local file on the server. Each time a new high score is achieved, it is registered in this file. The high scores are separated by map and by game mode. For example, `highscores/dm/wizs.txt` is the highscores file for the map `wizs` in `dm` mode.
Expand Down
8 changes: 8 additions & 0 deletions src/action/a_vote.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ int _numclients (void)
{
if (!other->inuse || !other->client || !other->client->pers.connected || other->client->pers.mvdspec)
continue;

// Idle players do not count towards voting pool (unless they already voted). -- Raptor007
if (sv_idleremove->value && ! (other->client->resp.mapvote || other->client->resp.cvote)){
int idleframes = other->client->resp.idletime ? (level.framenum - other->client->resp.idletime) : 0;
if (idleframes > sv_idleremove->value * HZ)
continue;
}

#ifndef NO_BOTS
// If bot_countashuman is enabled, then do not continue/ignore bots
if(!bot_countashuman->value) {
Expand Down
1 change: 1 addition & 0 deletions src/action/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,7 @@ extern cvar_t *g_highscores_countbots; // Toggles if we save highscores achieved
extern cvar_t *lca_grenade; // Allows grenade pin pulling during LCA
extern cvar_t *breakableglass; // Moved from cgf_sfx_glass, enables breakable glass (0,1,2)
extern cvar_t *glassfragmentlimit; // Moved from cgf_sfx_glass, sets glass fragment limit
extern cvar_t *grenade_drop; // Allows grenades to be dropped on death

#ifdef AQTION_EXTENSION
extern int (*engine_Client_GetVersion)(edict_t *ent);
Expand Down
2 changes: 2 additions & 0 deletions src/action/g_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@ cvar_t *g_highscores_countbots; // Toggles if we save highscores achieved by bot
cvar_t *lca_grenade; // Allows grenade pin pulling during LCA
cvar_t *breakableglass; // Moved from cgf_sfx_glass, enables breakable glass (0,1,2)
cvar_t *glassfragmentlimit; // Moved from cgf_sfx_glass, sets glass fragment limit
cvar_t *grenade_drop; // Allows grenades to be dropped on death


#ifdef AQTION_EXTENSION
cvar_t *use_newirvision;
Expand Down
2 changes: 2 additions & 0 deletions src/action/g_save.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ void InitGame( void )
glassfragmentlimit = gi.cvar("glassfragmentlimit", "30", 0);
//CGF_SFX_InstallGlassSupport(); // william for CGF (glass fx)

grenade_drop = gi.cvar( "grenade_drop", "0", 0 ); // Raptor007 - added grenade drop

g_select_empty = gi.cvar( "g_select_empty", "0", CVAR_ARCHIVE );
g_protocol_extensions = gi.cvar("g_protocol_extensions", "0", CVAR_LATCH);

Expand Down
11 changes: 11 additions & 0 deletions src/action/p_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1704,6 +1704,17 @@ void TossItemsOnDeath(edict_t * ent)
if (ent->client->inventory[ITEM_INDEX(item)] > 0) {
EjectItem(ent, item);
}

// Grenade drop option -- Raptor007
if (grenade_drop->value > 0) {
item = GET_ITEM(GRENADE_NUM);
int drop_count = ent->client->inventory[ITEM_INDEX(item)];
if (grenade_drop->value < drop_count)
drop_count = grenade_drop->value;
for(i = 0; i < drop_count; i++) {
EjectItem(ent, item);
}
}
// special items

// Quad is unused in AQ2
Expand Down
2 changes: 1 addition & 1 deletion src/action/p_weapon.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ qboolean Pickup_Weapon(edict_t* ent, edict_t* other)
return false;

case GRENADE_NUM:
if (!(gameSettings & GS_DEATHMATCH) && ctf->value != 2 && !band)
if (!(gameSettings & GS_DEATHMATCH) && ctf->value != 2 && !band && !(grenade_drop->value))
return false;

if (other->client->inventory[index] >= other->client->grenade_max)
Expand Down

0 comments on commit 39d90cd

Please sign in to comment.