- made forwardmove and sidemove defaults configurable through the gameinfo section.

This commit is contained in:
Christoph Oelckers 2019-01-05 08:48:57 +01:00
parent d898cadda5
commit bfbf7ff9c9
8 changed files with 114 additions and 86 deletions

View file

@ -71,6 +71,7 @@
#include "serializer.h"
#include "vm.h"
#include "dobjgc.h"
#include "gi.h"
#include "g_hub.h"
#include "g_levellocals.h"
@ -181,8 +182,6 @@ short consistancy[MAXPLAYERS][BACKUPTICS];
#define TURBOTHRESHOLD 12800
float normforwardmove[2] = {0x19, 0x32}; // [RH] For setting turbo from console
float normsidemove[2] = {0x18, 0x28}; // [RH] Ditto
int forwardmove[2], sidemove[2];
int angleturn[4] = {640, 1280, 320, 320}; // + slow turn
@ -224,7 +223,7 @@ EXTERN_CVAR (Int, team)
CVAR (Bool, teamplay, false, CVAR_SERVERINFO)
// [RH] Allow turbo setting anytime during game
CUSTOM_CVAR (Float, turbo, 100.f, 0)
CUSTOM_CVAR (Float, turbo, 100.f, CVAR_NOINITCALL)
{
if (self < 10.f)
{
@ -238,10 +237,10 @@ CUSTOM_CVAR (Float, turbo, 100.f, 0)
{
double scale = self * 0.01;
forwardmove[0] = (int)(normforwardmove[0]*scale);
forwardmove[1] = (int)(normforwardmove[1]*scale);
sidemove[0] = (int)(normsidemove[0]*scale);
sidemove[1] = (int)(normsidemove[1]*scale);
forwardmove[0] = (int)(gameinfo.normforwardmove[0]*scale);
forwardmove[1] = (int)(gameinfo.normforwardmove[1]*scale);
sidemove[0] = (int)(gameinfo.normsidemove[0]*scale);
sidemove[1] = (int)(gameinfo.normsidemove[1]*scale);
}
}

View file

@ -40,9 +40,13 @@
#include "v_video.h"
#include "g_level.h"
#include "vm.h"
#include "c_cvars.h"
gameinfo_t gameinfo;
EXTERN_CVAR(Float, turbo)
DEFINE_GLOBAL(gameinfo)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, backpacktype)
DEFINE_FIELD_X(GameInfoStruct, gameinfo_t, Armor2Percent)
@ -186,6 +190,16 @@ const char* GameInfoBorders[] =
gameinfo.key = sc.Float; \
}
#define GAMEINFOKEY_TWODOUBLES(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
sc.MustGetValue(true); \
gameinfo.key[0] = sc.Float; \
sc.MustGetToken(','); \
sc.MustGetValue(true); \
gameinfo.key[1] = sc.Float; \
}
#define GAMEINFOKEY_COLOR(key, variable) \
else if(nextKey.CompareNoCase(variable) == 0) \
{ \
@ -250,7 +264,7 @@ void FMapInfoParser::ParseGameInfo()
sc.MustGetToken('{');
while(sc.GetToken())
{
if (sc.TokenType == '}') return;
if (sc.TokenType == '}') break;
sc.TokenMustBe(TK_Identifier);
FString nextKey = sc.String;
@ -415,6 +429,8 @@ void FMapInfoParser::ParseGameInfo()
GAMEINFOKEY_STRING(statusscreen_single, "statscreen_single")
GAMEINFOKEY_STRING(statusscreen_coop, "statscreen_coop")
GAMEINFOKEY_STRING(statusscreen_dm, "statscreen_dm")
GAMEINFOKEY_TWODOUBLES(normforwardmove, "normforwardmove")
GAMEINFOKEY_TWODOUBLES(normsidemove, "normsidemove")
else
{
@ -425,6 +441,7 @@ void FMapInfoParser::ParseGameInfo()
SkipToNext();
}
}
turbo.Callback();
}
const char *gameinfo_t::GetFinalePage(unsigned int num) const

View file

@ -193,6 +193,8 @@ struct gameinfo_t
FName statusscreen_dm;
int healthpic; // These get filled in from ALTHUDCF
int berserkpic;
double normforwardmove[2];
double normsidemove[2];
const char *GetFinalePage(unsigned int num) const;
};

View file

@ -71,6 +71,8 @@ gameinfo
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"
messageboxclass = "MessageBoxMenu"
normforwardmove = 0x19, 0x32
normsidemove = 0x18, 0x28
}
DoomEdNums

View file

@ -71,6 +71,8 @@ gameinfo
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "DoomStatusScreen"
messageboxclass = "MessageBoxMenu"
normforwardmove = 0x19, 0x32
normsidemove = 0x18, 0x28
}
spawnnums

View file

@ -70,6 +70,8 @@ gameinfo
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"
messageboxclass = "MessageBoxMenu"
normforwardmove = 0x19, 0x32
normsidemove = 0x18, 0x28
}
DoomEdNums

View file

@ -68,6 +68,8 @@ gameinfo
statscreen_dm = "DeathmatchStatusScreen"
statscreen_single = "RavenStatusScreen"
messageboxclass = "MessageBoxMenu"
normforwardmove = 0x19, 0x32
normsidemove = 0x18, 0x28
}
DoomEdNums

View file

@ -35,6 +35,8 @@ gameinfo
endoom = "ENDOOM"
pickupcolor = "c0 c0 c0"
quitmessages = "Do you want to quit?"
normforwardmove = 0x19, 0x32
normsidemove = 0x18, 0x28
menufontcolor_title = "purple"
menufontcolor_label = "default"