Skip to content

Commit

Permalink
Doom|Menu: Added Fast Monsters menu option, cvar “game-monsters-fast”
Browse files Browse the repository at this point in the history
IssueID #2207
  • Loading branch information
skyjake committed Mar 4, 2017
1 parent cb78e9a commit 550dd50
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions doomsday/apps/plugins/common/include/config.h
Expand Up @@ -53,6 +53,7 @@ typedef struct libcommon_config_s {

// Gameplay:
byte switchSoundOrigin;
byte defaultRuleFastMonsters;

// Weapons:
byte weaponCycleSequential; // if true multiple next/prev weapon impulses can be chained to allow the user to "count-click-switch".
Expand Down
1 change: 1 addition & 0 deletions doomsday/apps/plugins/common/include/g_common.h
Expand Up @@ -221,6 +221,7 @@ byte G_Ruleset_RandomClasses();
#else
byte G_Ruleset_RespawnMonsters();
#endif
void G_Ruleset_UpdateDefaults();

/// @todo remove me
void G_SetGameActionMapCompletedAndSetNextMap(void);
Expand Down
10 changes: 10 additions & 0 deletions doomsday/apps/plugins/common/src/common.c
Expand Up @@ -36,6 +36,13 @@ int Common_GetInteger(int id)
return 0;
}

#ifdef __JDOOM__
void fastMonstersChanged()
{
G_Ruleset_UpdateDefaults();
}
#endif

void Common_Register()
{
// Movement
Expand All @@ -46,4 +53,7 @@ void Common_Register()

// Gameplay
C_VAR_BYTE ("sound-switch-origin", &cfg.common.switchSoundOrigin, 0, 0, 1);
#ifdef __JDOOM__
C_VAR_BYTE2("game-monsters-fast", &cfg.common.defaultRuleFastMonsters, 0, 0, 1, fastMonstersChanged);
#endif
}
7 changes: 7 additions & 0 deletions doomsday/apps/plugins/common/src/game/g_game.cpp
Expand Up @@ -1929,6 +1929,13 @@ byte G_Ruleset_RespawnMonsters()
}
#endif

void G_Ruleset_UpdateDefaults()
{
#if !__JHEXEN__
defaultGameRules.fast = cfg.common.defaultRuleFastMonsters;
#endif
}

/**
* Lookup the debriefing Finale for the current episode and map (if any).
*/
Expand Down
6 changes: 6 additions & 0 deletions doomsday/apps/plugins/common/src/hu_menu.cpp
Expand Up @@ -1008,6 +1008,12 @@ void Hu_MenuInitGameplayOptionsPage()
.setShortcut('j');
#endif

#if __JDOOM__
page->addWidget(new LabelWidget("Fast Monsters"));
page->addWidget(new CVarToggleWidget("game-monsters-fast"))
.setShortcut('f');
#endif

#if __JDOOM64__
page->addWidget(new LabelWidget("Weapon Recoil"));
page->addWidget(new CVarToggleWidget("player-weapon-recoil"));
Expand Down
2 changes: 2 additions & 0 deletions doomsday/apps/plugins/doom/src/d_main.cpp
Expand Up @@ -421,6 +421,8 @@ void D_PostInit()
::cfg.common.netDeathmatch = 1;
}

::defaultGameRules.fast = cfg.common.defaultRuleFastMonsters;

// Apply these rules.
::defaultGameRules.noMonsters = cmdLine.check("-nomonsters")? true : false;
::defaultGameRules.respawnMonsters = cmdLine.check("-respawn") ? true : false;
Expand Down

0 comments on commit 550dd50

Please sign in to comment.