- added 'classicflight' user cvar which allows players to move forward and backward without pitch when flying

This commit is contained in:
Rachael Alexanderson 2017-10-23 12:16:02 -04:00
parent 50d39771c0
commit 66773b6a1a
5 changed files with 15 additions and 1 deletions

View file

@ -73,6 +73,7 @@ CVAR (Float, movebob, 0.25f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, stillbob, 0.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Float, wbobspeed, 1.f, CVAR_USERINFO | CVAR_ARCHIVE); CVAR (Float, wbobspeed, 1.f, CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE); CVAR (String, playerclass, "Fighter", CVAR_USERINFO | CVAR_ARCHIVE);
CVAR (Bool, classicflight, false, CVAR_USERINFO | CVAR_ARCHIVE);
enum enum
{ {
@ -88,6 +89,7 @@ enum
INFO_WBobSpeed, INFO_WBobSpeed,
INFO_PlayerClass, INFO_PlayerClass,
INFO_ColorSet, INFO_ColorSet,
INFO_ClassicFlight,
}; };
const char *GenderNames[3] = { "male", "female", "other" }; const char *GenderNames[3] = { "male", "female", "other" };

View file

@ -330,6 +330,10 @@ struct userinfo_t : TMap<FName,FBaseCVar *>
{ {
return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass)); return *static_cast<FIntCVar *>(*CheckKey(NAME_PlayerClass));
} }
bool GetClassicFlight() const
{
return *static_cast<FBoolCVar *>(*CheckKey(NAME_ClassicFlight));
}
PClassActor *GetPlayerClassType() const PClassActor *GetPlayerClassType() const
{ {
return PlayerClasses[GetPlayerClassNum()].Type; return PlayerClasses[GetPlayerClassNum()].Type;

View file

@ -768,6 +768,7 @@ xx(ColorSet)
xx(NeverSwitchOnPickup) xx(NeverSwitchOnPickup)
xx(MoveBob) xx(MoveBob)
xx(StillBob) xx(StillBob)
xx(ClassicFlight)
xx(WBobSpeed) xx(WBobSpeed)
xx(PlayerClass) xx(PlayerClass)
xx(MonsterClass) xx(MonsterClass)

View file

@ -813,6 +813,12 @@ DEFINE_ACTION_FUNCTION(_PlayerInfo, GetNeverSwitch)
ACTION_RETURN_BOOL(self->userinfo.GetNeverSwitch()); ACTION_RETURN_BOOL(self->userinfo.GetNeverSwitch());
} }
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetClassicFlight)
{
PARAM_SELF_STRUCT_PROLOGUE(player_t);
ACTION_RETURN_BOOL(self->userinfo.GetClassicFlight());
}
DEFINE_ACTION_FUNCTION(_PlayerInfo, GetColor) DEFINE_ACTION_FUNCTION(_PlayerInfo, GetColor)
{ {
PARAM_SELF_STRUCT_PROLOGUE(player_t); PARAM_SELF_STRUCT_PROLOGUE(player_t);

View file

@ -746,7 +746,7 @@ class PlayerPawn : Actor native
void ForwardThrust (double move, double angle) void ForwardThrust (double move, double angle)
{ {
if ((waterlevel || bNoGravity) && Pitch != 0) if ((waterlevel || bNoGravity) && Pitch != 0 && !player.GetClassicFlight())
{ {
double zpush = move * sin(Pitch); double zpush = move * sin(Pitch);
if (waterlevel && waterlevel < 2 && zpush < 0) zpush = 0; if (waterlevel && waterlevel < 2 && zpush < 0) zpush = 0;
@ -1484,6 +1484,7 @@ struct PlayerInfo native play // this is what internally is known as player_t
native float GetAutoaim() const; native float GetAutoaim() const;
native bool GetNoAutostartMap() const; native bool GetNoAutostartMap() const;
native void SetFOV(float fov); native void SetFOV(float fov);
native bool GetClassicFlight() const;
native clearscope bool HasWeaponsInSlot(int slot) const; native clearscope bool HasWeaponsInSlot(int slot) const;
bool IsTotallyFrozen() bool IsTotallyFrozen()