Skip to content

Commit

Permalink
Add CVAR README notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
JadingTsunami committed Nov 9, 2023
1 parent f6e8957 commit b24807d
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Install [PrBoom-Plus](https://github.com/coelckers/prboom-plus) and place the bi
* Tab completion for commands/settings/cheats
* Command listing below
* "Buddha" cheat similar to GZDoom
* Also adds regeneration if you stand still, similar to modern FPS games
* Targeted massacre cheat: `tntsem`
* Kills only monsters currently targeting the player
* Optional uncapped framerate limiting
Expand Down Expand Up @@ -93,6 +92,16 @@ Install [PrBoom-Plus](https://github.com/coelckers/prboom-plus) and place the bi
- `summon <class>` (summon [class](https://github.com/JadingTsunami/prboomX#actor-names) enemy/thing/etc. to player's aim point position)
- `summonfriend <class>` (summon [class](https://github.com/JadingTsunami/prboomX#actor-names) friendly enemy/thing/etc. to player's aim point position)
- `freeze` (toggle freeze mode on/off)
- `set [variable] [value]` (set or create CVAR with given value)
- `unset [variable]` (delete CVAR)

# Default CVARs

CVARs are saved on exit. `unset` a CVAR to remove it from your personal config. `set` a CVAR to 1 to enable it.

* `allmap_always` (default: off) - Always have the Computer Area Map powerup.
* `regenerate` (default: off) - Regenerate health when standing still similar to modern FPS games.
* `plat_skip` (default: off) - Platform wait skipping when use key is pressed.

# Reference Material

Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/c_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ static void C_jds(char* cmd)

static void C_platskip(char* cmd)
{
dboolean plat_skip = C_CvarIsSet("plat_skip", NULL);
dboolean plat_skip = C_CvarIsSet("plat_skip");
plat_skip ? C_CvarClear("plat_skip") : C_CvarSet("plat_skip");
doom_printf("Platform wait skipping %s", !plat_skip ? "enabled" : "disabled");
}
Expand Down
5 changes: 1 addition & 4 deletions prboom2/src/c_cvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,16 +329,13 @@ void C_CvarExportToFile(FILE* f)
* and
* is a "nonzero"/non-null value, or is no-value type
*/
dboolean C_CvarIsSet(const char* key, cvarstatus_t* status)
dboolean C_CvarIsSet(const char* key)
{
cvarstatus_t s;
cvar_t* cvar;

cvar = C_CvarFind(key, &s);

if (status)
*status = s;

return cvar && cvar->is_set;
}

Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/c_cvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void C_CvarExportToFile(FILE* f);
* and
* is a "nonzero"/non-null value, or is no-value type
*/
dboolean C_CvarIsSet(const char* key, cvarstatus_t* status);
dboolean C_CvarIsSet(const char* key);

/* Set/Clear a CVAR (boolean flag), create if it does not exist */
cvarstatus_t C_CvarSet(const char* key);
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/g_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,7 @@ static void G_PlayerFinishLevel(int player)
p->fixedcolormap = 0; // cancel ir gogles
p->damagecount = 0; // no palette changes
p->bonuscount = 0;
if (C_CvarIsSet("allmap_always", NULL))
if (C_CvarIsSet("allmap_always"))
p->powers[pw_allmap] = true;
}

Expand Down Expand Up @@ -1413,7 +1413,7 @@ void G_PlayerReborn (int player)
int cheats = p->cheats;
memset (p, 0, sizeof(*p));
p->cheats = cheats;
if (C_CvarIsSet("allmap_always", NULL))
if (C_CvarIsSet("allmap_always"))
p->powers[pw_allmap] = true;
}

Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/p_inter.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ dboolean P_GivePower(player_t *player, int power)
player->mo->flags |= MF_SHADOW;
break;
case pw_allmap:
if (player->powers[pw_allmap] && !C_CvarIsSet("allmap_always", NULL))
if (player->powers[pw_allmap] && !C_CvarIsSet("allmap_always"))
return false;
break;
case pw_strength:
Expand Down
2 changes: 1 addition & 1 deletion prboom2/src/p_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ void P_UseLines (player_t* player)
S_StartSound (usething, sfx_noway);

/* JDS: check if we have plat-raise on space */
if (C_CvarIsSet("plat_skip", NULL)) {
if (C_CvarIsSet("plat_skip")) {
struct msecnode_s* ts = player->mo->touching_sectorlist;
sector_t* s = ts->m_sector;
while (s) {
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/p_mobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "r_demo.h"
#include "g_overflow.h"
#include "e6y.h"//e6y
#include "c_cvar.h"

// [FG] colored blood and gibs
dboolean colored_blood;
Expand Down Expand Up @@ -793,8 +794,7 @@ void P_MobjThinker (mobj_t* mobj)

static unsigned int regen = 0;
#define REGEN_STARTUP (35*2)
extern dboolean is_buddha();
if((mobj == players[consoleplayer].mo) && is_buddha()) {
if((mobj == players[consoleplayer].mo) && C_CvarIsSet("regenerate")) {
if(mobj->momx == 0 && mobj->momy == 0) {
regen++;
if(players[consoleplayer].health < 100 && (regen > REGEN_STARTUP) && (regen % 6 == 0)) {
Expand Down

0 comments on commit b24807d

Please sign in to comment.