Skip to content

Commit

Permalink
New tweaks: powerup disable options
Browse files Browse the repository at this point in the history
  • Loading branch information
CK authored and CK committed Aug 30, 2023
1 parent 2ef5cef commit 88b3c1c
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 119 deletions.
162 changes: 61 additions & 101 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,114 +106,74 @@ server game variable: `g_start_with_shotgun`

Give newly-spawned players a fighting chance. Give them a shotgun and 10 shells when they spawn!

### No BFG 10k

server game variable: `g_no_bfg`

Don't spawn the BFG 10k, even if `g_dm_random_items` is set.
### No Chainfist

server game variable: `g_no_chainfist`

Don't spawn the Chainfist, even if `g_dm_random_items` is set.
### No Chaingun

server game variable: `g_no_chaingun`

Don't spawn the Chaingun, even if `g_dm_random_items` is set.
### No Disruptor

server game variable: `g_no_disruptor`

Don't spawn the Disruptor, even if `g_dm_random_items` is set.
### No ETF Rifle

server game variable: `g_no_etf_rifle`

Don't spawn the ETF Rifle, even if `g_dm_random_items` is set.
### No Grenade Launcher

server game variable: `g_no_glauncher`

Don't spawn the Grenade Launcher, even if `g_dm_random_items` is set.
### No Hyperblaster

server game variable: `g_no_hyperblaster`

Don't spawn the Hyperblaster, even if `g_dm_random_items` is set.
### No Ionripper

server game variable: `g_no_ionripper`

Don't spawn the Ionripper, even if `g_dm_random_items` is set.
### No Machinegun

server game variable: `g_no_machinegun`

Don't spawn the Machinegun, even if `g_dm_random_items` is set.
### No Phalanx

server game variable: `g_no_phalanx`

Don't spawn the Phalanx, even if `g_dm_random_items` is set.
### No Plasmabeam

server game variable: `g_no_plasmabeam`

Don't spawn the Plasmabeam, even if `g_dm_random_items` is set.
### No Proximity Launcher

server game variable: `g_no_proxlauncher`

Don't spawn the Proximity Launcher, even if `g_dm_random_items` is set.
### No Railgun

server game variable: `g_no_railgun`

Don't spawn the Railgun, even if `g_dm_random_items` is set.
### No Rocket Launcher

server game variable: `g_no_rlauncher`

Don't spawn the Rocket Launcher, even if `g_dm_random_items` is set.
### No Shotgun

server game variable: `g_no_shotgun`

Don't spawn the Shotgun, even if `g_dm_random_items` is set.
### No Super Shotgun

server game variable: `g_no_sshotgun`

Don't spawn the Super Shotgun, even if `g_dm_random_items` is set.
### Powerup Disables

server game variables:

```
g_no_powerups
g_no_quad
g_no_dualfire
g_no_invulnerability
g_no_invisibility
```

Disable all powerups (overrides everything and includes all minor powerups), or individually disable, Quad Damage, DualFire Damage, Invulnerability, Invisibility.

### Weapon Disables

server game variables:

```
g_no_bfg
g_no_chainfist
g_no_chaingun
g_no_disruptor
g_no_etf_rifle
g_no_glauncher
g_no_hyperblaster
g_no_ionripper
g_no_machinegun
g_no_phalanx
g_no_plasmabeam
g_no_proxlauncher
g_no_railgun
g_no_rlauncher
g_no_shotgun
g_no_sshotgun
```

Don't spawn the given weapon, even if `g_dm_random_items` is set.

### Only Weapon

server game variable: `g_only_weapon`

Disables weapon and ammo spawns and gives this player the specified weapon with infinite ammo.

valid values: One weapon name in quotes, e.g. `"Chaingun"` or `"Rocket Launcher"` or `""` to disable mode.

- `"Grapple"`
- `"Blaster"`
- `"Chainfist"`
- `"Shotgun"`
- `"Super Shotgun"`
- `"Machinegun"`
- `"ETF Rifle"`
- `"Chaingun"`
- `"Grenades"`
- `"Grenade Launcher"`
- `"Prox Launcher"`
- `"Rocket Launcher"`
- `"HyperBlaster"`
- `"Ionripper"`
- `"Plasma Beam"`
- `"Railgun"`
- `"Phalanx"`
- `"BFG10K"`
- `"Disruptor"`
valid values: One weapon name in quotes, e.g. `"Chaingun"` or `"Rocket Launcher"` or `""` to disable only weapon mode.

```
"Grapple"
"Blaster"
"Chainfist"
"Shotgun"
"Super Shotgun"
"Machinegun"
"ETF Rifle"
"Chaingun"
"Grenades"
"Grenade Launcher"
"Prox Launcher"
"Rocket Launcher"
"HyperBlaster"
"Ionripper"
"Plasma Beam"
"Railgun"
"Phalanx"
"BFG10K"
"Disruptor"
```

## Installing

Expand Down
11 changes: 11 additions & 0 deletions src/g_items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,17 @@ void SpawnItem(edict_t *ent, gitem_t *item)
return;
}

// Q2Eaks powerup disable cvar handling
if ((g_no_powerups->integer && (item->flags & IF_POWERUP)) ||
(g_no_quad->integer && item->id == IT_ITEM_QUAD) ||
(g_no_dualfire->integer && item->id == IT_ITEM_QUADFIRE) ||
(g_no_invulnerability->integer && item->id == IT_ITEM_INVULNERABILITY) ||
(g_no_invisibility->integer && item->id == IT_ITEM_INVISIBILITY))
{
G_FreeEdict(ent);
return;
}

//==========
// ROGUE
if (g_no_mines->integer)
Expand Down
5 changes: 5 additions & 0 deletions src/g_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,11 @@ extern cvar_t* g_no_railgun;
extern cvar_t* g_no_rlauncher;
extern cvar_t* g_no_shotgun;
extern cvar_t* g_no_sshotgun;
extern cvar_t* g_no_powerups;
extern cvar_t* g_no_quad;
extern cvar_t* g_no_dualfire;
extern cvar_t* g_no_invulnerability;
extern cvar_t* g_no_invisibility;
extern cvar_t* g_start_with_chainfist;
extern cvar_t* g_start_with_shotgun;
extern cvar_t* g_only_weapon;
Expand Down
10 changes: 10 additions & 0 deletions src/g_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ cvar_t* g_no_railgun;
cvar_t* g_no_rlauncher;
cvar_t* g_no_shotgun;
cvar_t* g_no_sshotgun;
cvar_t* g_no_powerups;
cvar_t* g_no_quad;
cvar_t* g_no_dualfire;
cvar_t* g_no_invulnerability;
cvar_t* g_no_invisibility;
cvar_t* g_start_with_chainfist;
cvar_t* g_start_with_shotgun;
cvar_t* g_only_weapon;
Expand Down Expand Up @@ -306,6 +311,11 @@ void InitGame()
g_no_rlauncher = gi.cvar("g_no_rlauncher", "0", CVAR_LATCH);
g_no_shotgun = gi.cvar("g_no_shotgun", "0", CVAR_LATCH);
g_no_sshotgun = gi.cvar("g_no_sshotgun", "0", CVAR_LATCH);
g_no_powerups = gi.cvar("g_no_powerups", "0", CVAR_LATCH);
g_no_quad = gi.cvar("g_no_quad", "0", CVAR_LATCH);
g_no_dualfire = gi.cvar("g_no_dualfire", "0", CVAR_LATCH);
g_no_invulnerability = gi.cvar("g_no_invulnerability", "0", CVAR_LATCH);
g_no_invisibility = gi.cvar("g_no_invisibility", "0", CVAR_LATCH);
g_start_with_chainfist = gi.cvar("g_start_with_chainfist", "0", CVAR_LATCH);
g_start_with_shotgun = gi.cvar("g_start_with_shotgun", "0", CVAR_LATCH);
g_only_weapon = gi.cvar("g_only_weapon", "", CVAR_LATCH);
Expand Down
7 changes: 6 additions & 1 deletion src/p_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2346,7 +2346,7 @@ void ClientBeginDeathmatch(edict_t *ent)
gi.LocBroadcast_Print(PRINT_HIGH, "$g_entered_game", ent->client->pers.netname);

// Q2Eaks version string
const char *Q2EAKS_VERSION = "v0.14";
const char *Q2EAKS_VERSION = "v0.16";

// Q2Eaks map cvars to player-friendly strings
std::unordered_map<cvar_t*, const char*> Q2EAKS_CVAR_TO_STRING = {
Expand Down Expand Up @@ -2379,6 +2379,11 @@ void ClientBeginDeathmatch(edict_t *ent)
{ g_no_rlauncher, "No Rocket Launcher"},
{ g_no_shotgun, "No Shotgun"},
{ g_no_sshotgun, "No Super Shotgun"},
{ g_no_powerups, "No Powerups"},
{ g_no_quad, "No Quad Damage"},
{ g_no_dualfire, "No DualFire Damage"},
{ g_no_invulnerability, "No Invulnerability"},
{ g_no_invisibility, "No Invisibility"},
};

// Q2Eaks centerprint a welcome message showing which tweaks are enabled
Expand Down
40 changes: 24 additions & 16 deletions src/rogue/g_rogue_newdm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,30 @@ inline item_id_t FindSubstituteItem(edict_t *ent)
itflags = GetSubstituteItemFlags(i);

// Q2Eaks respect g_no_<weapon> setting even in g_dm_random_items
if ((g_no_bfg->integer && it->id == IT_WEAPON_BFG) ||
(g_no_chainfist->integer && it->id == IT_WEAPON_CHAINFIST) ||
(g_no_chaingun->integer && it->id == IT_WEAPON_CHAINGUN) ||
(g_no_disruptor->integer && it->id == IT_WEAPON_DISRUPTOR) ||
(g_no_etf_rifle->integer && it->id == IT_WEAPON_ETF_RIFLE) ||
(g_no_glauncher->integer && it->id == IT_WEAPON_GLAUNCHER) ||
(g_no_hyperblaster->integer && it->id == IT_WEAPON_HYPERBLASTER) ||
(g_no_ionripper->integer && it->id == IT_WEAPON_IONRIPPER) ||
(g_no_machinegun->integer && it->id == IT_WEAPON_MACHINEGUN) ||
(g_no_phalanx->integer && it->id == IT_WEAPON_PHALANX) ||
(g_no_plasmabeam->integer && it->id == IT_WEAPON_PLASMABEAM) ||
(g_no_proxlauncher->integer && it->id == IT_WEAPON_PROXLAUNCHER) ||
(g_no_railgun->integer && it->id == IT_WEAPON_RAILGUN) ||
(g_no_rlauncher->integer && it->id == IT_WEAPON_RLAUNCHER) ||
(g_no_shotgun->integer && it->id == IT_WEAPON_SHOTGUN) ||
(g_no_sshotgun->integer && it->id == IT_WEAPON_SSHOTGUN))
if ((g_no_bfg->integer && i == IT_WEAPON_BFG) ||
(g_no_chainfist->integer && i == IT_WEAPON_CHAINFIST) ||
(g_no_chaingun->integer && i == IT_WEAPON_CHAINGUN) ||
(g_no_disruptor->integer && i == IT_WEAPON_DISRUPTOR) ||
(g_no_etf_rifle->integer && i == IT_WEAPON_ETF_RIFLE) ||
(g_no_glauncher->integer && i == IT_WEAPON_GLAUNCHER) ||
(g_no_hyperblaster->integer && i == IT_WEAPON_HYPERBLASTER) ||
(g_no_ionripper->integer && i == IT_WEAPON_IONRIPPER) ||
(g_no_machinegun->integer && i == IT_WEAPON_MACHINEGUN) ||
(g_no_phalanx->integer && i == IT_WEAPON_PHALANX) ||
(g_no_plasmabeam->integer && i == IT_WEAPON_PLASMABEAM) ||
(g_no_proxlauncher->integer && i == IT_WEAPON_PROXLAUNCHER) ||
(g_no_railgun->integer && i == IT_WEAPON_RAILGUN) ||
(g_no_rlauncher->integer && i == IT_WEAPON_RLAUNCHER) ||
(g_no_shotgun->integer && i == IT_WEAPON_SHOTGUN) ||
(g_no_sshotgun->integer && i == IT_WEAPON_SSHOTGUN))
continue;

// Q2Eaks respect powerup disable cvars even in g_dm_random_items
if ((g_no_powerups->integer && (it->flags & IF_POWERUP)) ||
(g_no_quad->integer && i == IT_ITEM_QUAD) ||
(g_no_dualfire->integer && i == IT_ITEM_QUADFIRE) ||
(g_no_invulnerability->integer && i == IT_ITEM_INVULNERABILITY) ||
(g_no_invisibility->integer && i == IT_ITEM_INVISIBILITY))
continue;

// don't respawn spheres if they're dmflag disabled.
Expand Down
2 changes: 1 addition & 1 deletion src/rogue/p_rogue_weapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ void weapon_etf_rifle_fire(edict_t *ent)
// Q2Eaks make this a local variable so we can adjust it
int speed = 1150;

// Q2Eaks make all blaster projectiles even faster
// Q2Eaks make flechettes faster, if configured
if (g_faster_flechettes->integer)
speed = 2750;

Expand Down

0 comments on commit 88b3c1c

Please sign in to comment.