diff --git a/doomsday/apps/plugins/common/include/p_user.h b/doomsday/apps/plugins/common/include/p_user.h index c2f3d77ac8..8a6c7ccc1d 100644 --- a/doomsday/apps/plugins/common/include/p_user.h +++ b/doomsday/apps/plugins/common/include/p_user.h @@ -25,11 +25,11 @@ #include "dd_types.h" -#define PLAYER_REBORN_TICS (1*TICSPERSEC) +#define PLAYER_REBORN_TICS (1 * TICSPERSEC) DENG_EXTERN_C dd_bool onground; - -DENG_EXTERN_C int maxHealth; +DENG_EXTERN_C float turboMul; // Multiplier for running speed. +DENG_EXTERN_C int maxHealth; #if __JDOOM__ || __JDOOM64__ DENG_EXTERN_C int healthLimit; diff --git a/doomsday/apps/plugins/common/src/game/g_game.cpp b/doomsday/apps/plugins/common/src/game/g_game.cpp index 1956b99a28..1b95d27e2e 100644 --- a/doomsday/apps/plugins/common/src/game/g_game.cpp +++ b/doomsday/apps/plugins/common/src/game/g_game.cpp @@ -801,6 +801,25 @@ void G_CommonPostInit() G_RegisterCheats(); #endif + // Change the turbo multiplier. + { + auto &cmdLine = CommandLine::get(); + + turboMul = 1.0f; + if (int arg = cmdLine.check("-turbo")) + { + int scale = 200; // Default to 2x without a numeric value. + + if (arg + 1 < cmdLine.count() && !cmdLine.isOption(arg + 1)) + { + scale = cmdLine.at(arg + 1).toInt(); + } + scale = de::clamp(10, scale, 400); + turboMul = scale / 100.f; + LOG_NOTE("Turbo speed: %i%%") << scale; + } + } + // From this point on, the shortcuts are always active. DD_Execute(true, "activatebcontext shortcut"); diff --git a/doomsday/apps/plugins/common/src/p_user.c b/doomsday/apps/plugins/common/src/p_user.c index c8e4276775..1bc75991b8 100644 --- a/doomsday/apps/plugins/common/src/p_user.c +++ b/doomsday/apps/plugins/common/src/p_user.c @@ -57,6 +57,7 @@ #define ANG5 (ANG90/18) dd_bool onground; +float turboMul = 1.0f; // Multiplier for running speed. int maxHealth; // 100 #if __JDOOM__ || __JDOOM64__ diff --git a/doomsday/apps/plugins/doom/include/d_main.h b/doomsday/apps/plugins/doom/include/d_main.h index 7d4ff16132..981a2a0e5e 100644 --- a/doomsday/apps/plugins/doom/include/d_main.h +++ b/doomsday/apps/plugins/doom/include/d_main.h @@ -27,8 +27,6 @@ #include "doomdef.h" -DENG_EXTERN_C float turboMul; // Multiplier for turbo. - DENG_EXTERN_C gamemode_t gameMode; DENG_EXTERN_C int gameModeBits; diff --git a/doomsday/apps/plugins/doom/include/p_local.h b/doomsday/apps/plugins/doom/include/p_local.h index 8da1d71371..8bd3bad884 100644 --- a/doomsday/apps/plugins/doom/include/p_local.h +++ b/doomsday/apps/plugins/doom/include/p_local.h @@ -77,7 +77,6 @@ #define sentient(mobj) ((mobj)->health > 0 && P_GetState((mobj)->type, SN_SEE)) -DENG_EXTERN_C float turboMul; DENG_EXTERN_C int maxAmmo[NUM_AMMO_TYPES]; DENG_EXTERN_C int clipAmmo[NUM_AMMO_TYPES]; diff --git a/doomsday/apps/plugins/doom/src/d_main.cpp b/doomsday/apps/plugins/doom/src/d_main.cpp index fd740a57d5..ffd0ceaf8d 100644 --- a/doomsday/apps/plugins/doom/src/d_main.cpp +++ b/doomsday/apps/plugins/doom/src/d_main.cpp @@ -39,8 +39,6 @@ using namespace de; using namespace common; -float turboMul; // Multiplier for turbo. - gamemode_t gameMode; int gameModeBits; @@ -441,21 +439,6 @@ void D_PostInit() } } - // Change the turbo multiplier? - ::turboMul = 1.0f; - if (int arg = cmdLine.check("-turbo")) - { - int scale = 200; - if (arg + 1 < cmdLine.count() && !cmdLine.isOption(arg + 1)) - { - scale = cmdLine.at(arg + 1).toInt(); - } - scale = de::clamp(10, scale, 400); - - LOG_NOTE("Turbo scale: %i%%") << scale; - ::turboMul = scale / 100.f; - } - // Load a saved game? if (int arg = cmdLine.check("-loadgame", 1)) { diff --git a/doomsday/apps/plugins/doom64/include/d_main.h b/doomsday/apps/plugins/doom64/include/d_main.h index a31168593f..6d38480ef1 100644 --- a/doomsday/apps/plugins/doom64/include/d_main.h +++ b/doomsday/apps/plugins/doom64/include/d_main.h @@ -27,8 +27,6 @@ #include "doomdef.h" -DENG_EXTERN_C float turboMul; // Multiplier for turbo. - DENG_EXTERN_C gamemode_t gameMode; DENG_EXTERN_C int gameModeBits; diff --git a/doomsday/apps/plugins/doom64/src/d_main.cpp b/doomsday/apps/plugins/doom64/src/d_main.cpp index 8f164626a0..bf28df9fc5 100644 --- a/doomsday/apps/plugins/doom64/src/d_main.cpp +++ b/doomsday/apps/plugins/doom64/src/d_main.cpp @@ -40,8 +40,6 @@ using namespace de; using namespace common; -float turboMul; // Multiplier for turbo. - gamemode_t gameMode; int gameModeBits; @@ -363,21 +361,6 @@ void D_PostInit() } } - // Change the turbo multiplier? - ::turboMul = 1.0f; - if(int arg = cmdLine.check("-turbo")) - { - int scale = 200; - if(arg + 1 < cmdLine.count() && !cmdLine.isOption(arg + 1)) - { - scale = cmdLine.at(arg + 1).toInt(); - } - scale = de::clamp(10, scale, 400); - - LOG_NOTE("Turbo scale: %i%%") << scale; - ::turboMul = scale / 100.f; - } - // Load a saved game? if(int arg = cmdLine.check("-loadgame", 1)) { diff --git a/doomsday/apps/plugins/heretic/include/h_main.h b/doomsday/apps/plugins/heretic/include/h_main.h index c8971eab02..4acd558f5c 100644 --- a/doomsday/apps/plugins/heretic/include/h_main.h +++ b/doomsday/apps/plugins/heretic/include/h_main.h @@ -27,8 +27,6 @@ #include "doomdef.h" -DENG_EXTERN_C float turboMul; // Multiplier for turbo. - DENG_EXTERN_C gamemode_t gameMode; DENG_EXTERN_C int gameModeBits; diff --git a/doomsday/apps/plugins/heretic/include/p_local.h b/doomsday/apps/plugins/heretic/include/p_local.h index cfaf28bc58..ef23425204 100644 --- a/doomsday/apps/plugins/heretic/include/p_local.h +++ b/doomsday/apps/plugins/heretic/include/p_local.h @@ -94,7 +94,6 @@ #define USE_MACE_AMMO_2 5 DENG_EXTERN_C mobj_t *missileMobj; -DENG_EXTERN_C float turboMul; #ifdef __cplusplus extern "C" { diff --git a/doomsday/apps/plugins/heretic/src/h_main.cpp b/doomsday/apps/plugins/heretic/src/h_main.cpp index ae80d34253..777c438329 100644 --- a/doomsday/apps/plugins/heretic/src/h_main.cpp +++ b/doomsday/apps/plugins/heretic/src/h_main.cpp @@ -40,8 +40,6 @@ using namespace de; using namespace common; -float turboMul; // Multiplier for turbo. - gamemode_t gameMode; int gameModeBits; @@ -383,21 +381,6 @@ void H_PostInit() gfw_SetDefaultRule(noMonsters, cmdLine.check("-nomonsters")? true : false); gfw_SetDefaultRule(respawnMonsters, cmdLine.check("-respawn") ? true : false); - // Change the turbo multiplier? - ::turboMul = 1.0f; - if (int arg = cmdLine.check("-turbo")) - { - int scale = 200; - if (arg + 1 < cmdLine.count() && !cmdLine.isOption(arg + 1)) - { - scale = cmdLine.at(arg + 1).toInt(); - } - scale = de::clamp(10, scale, 400); - - LOG_NOTE("Turbo scale: %i%%") << scale; - ::turboMul = scale / 100.f; - } - // Load a saved game? if (auto arg = cmdLine.check("-loadgame", 1)) { diff --git a/doomsday/apps/plugins/hexen/include/x_main.h b/doomsday/apps/plugins/hexen/include/x_main.h index 7a00e19b3f..505c2303e3 100644 --- a/doomsday/apps/plugins/hexen/include/x_main.h +++ b/doomsday/apps/plugins/hexen/include/x_main.h @@ -27,8 +27,6 @@ #include "h2def.h" -DENG_EXTERN_C float turboMul; // Multiplier for turbo. - DENG_EXTERN_C gamemode_t gameMode; DENG_EXTERN_C int gameModeBits; diff --git a/doomsday/apps/plugins/hexen/src/h2_main.cpp b/doomsday/apps/plugins/hexen/src/h2_main.cpp index 62c67f830d..75cc2d227b 100644 --- a/doomsday/apps/plugins/hexen/src/h2_main.cpp +++ b/doomsday/apps/plugins/hexen/src/h2_main.cpp @@ -43,8 +43,6 @@ using namespace de; using namespace common; -float turboMul; // Multiplier for turbo. - gamemode_t gameMode; int gameModeBits; @@ -317,21 +315,6 @@ void X_PostInit() gfw_SetDefaultRule(noMonsters, cmdLine.check("-nomonsters")? true : false); gfw_SetDefaultRule(randomClasses, cmdLine.check("-randclass") ? true : false); - // Change the turbo multiplier? - ::turboMul = 1.0f; - if (int arg = cmdLine.check("-turbo")) - { - int scale = 200; - if (arg + 1 < cmdLine.count() && !cmdLine.isOption(arg + 1)) - { - scale = cmdLine.at(arg + 1).toInt(); - } - scale = de::clamp(10, scale, 400); - - LOG_NOTE("Turbo scale: %i%%") << scale; - ::turboMul = scale / 100.f; - } - // Process sound definitions. SndInfoParser(AutoStr_FromText("Lumps:SNDINFO"));