Skip to content

Commit

Permalink
Cleanup|All Games: Common turbo speed multiplier
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Nov 5, 2018
1 parent bba7fae commit 3f90377
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 81 deletions.
6 changes: 3 additions & 3 deletions doomsday/apps/plugins/common/include/p_user.h
Expand Up @@ -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;
Expand Down
19 changes: 19 additions & 0 deletions doomsday/apps/plugins/common/src/game/g_game.cpp
Expand Up @@ -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");

Expand Down
1 change: 1 addition & 0 deletions doomsday/apps/plugins/common/src/p_user.c
Expand Up @@ -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__
Expand Down
2 changes: 0 additions & 2 deletions doomsday/apps/plugins/doom/include/d_main.h
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion doomsday/apps/plugins/doom/include/p_local.h
Expand Up @@ -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];

Expand Down
17 changes: 0 additions & 17 deletions doomsday/apps/plugins/doom/src/d_main.cpp
Expand Up @@ -39,8 +39,6 @@
using namespace de;
using namespace common;

float turboMul; // Multiplier for turbo.

gamemode_t gameMode;
int gameModeBits;

Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 0 additions & 2 deletions doomsday/apps/plugins/doom64/include/d_main.h
Expand Up @@ -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;

Expand Down
17 changes: 0 additions & 17 deletions doomsday/apps/plugins/doom64/src/d_main.cpp
Expand Up @@ -40,8 +40,6 @@
using namespace de;
using namespace common;

float turboMul; // Multiplier for turbo.

gamemode_t gameMode;
int gameModeBits;

Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 0 additions & 2 deletions doomsday/apps/plugins/heretic/include/h_main.h
Expand Up @@ -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;

Expand Down
1 change: 0 additions & 1 deletion doomsday/apps/plugins/heretic/include/p_local.h
Expand Up @@ -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" {
Expand Down
17 changes: 0 additions & 17 deletions doomsday/apps/plugins/heretic/src/h_main.cpp
Expand Up @@ -40,8 +40,6 @@
using namespace de;
using namespace common;

float turboMul; // Multiplier for turbo.

gamemode_t gameMode;
int gameModeBits;

Expand Down Expand Up @@ -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))
{
Expand Down
2 changes: 0 additions & 2 deletions doomsday/apps/plugins/hexen/include/x_main.h
Expand Up @@ -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;

Expand Down
17 changes: 0 additions & 17 deletions doomsday/apps/plugins/hexen/src/h2_main.cpp
Expand Up @@ -43,8 +43,6 @@
using namespace de;
using namespace common;

float turboMul; // Multiplier for turbo.

gamemode_t gameMode;
int gameModeBits;

Expand Down Expand Up @@ -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"));

Expand Down

0 comments on commit 3f90377

Please sign in to comment.