mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
Changed FOV from a CCMD to a CVar, allowing players' FOV settings to persist. Also exported SetFOV to PlayerInfo for ZScript.
This commit is contained in:
parent
4a87a598fb
commit
bb1709228c
5 changed files with 47 additions and 29 deletions
|
@ -732,34 +732,6 @@ CCMD (dir)
|
||||||
chdir (curdir);
|
chdir (curdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMD (fov)
|
|
||||||
{
|
|
||||||
player_t *player = who ? who->player : &players[consoleplayer];
|
|
||||||
|
|
||||||
if (argv.argc() != 2)
|
|
||||||
{
|
|
||||||
Printf ("fov is %g\n", player->DesiredFOV);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (dmflags & DF_NO_FOV)
|
|
||||||
{
|
|
||||||
if (consoleplayer == Net_Arbitrator)
|
|
||||||
{
|
|
||||||
Net_WriteByte (DEM_FOV);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Printf ("A setting controller has disabled FOV changes.\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Net_WriteByte (DEM_MYFOV);
|
|
||||||
}
|
|
||||||
Net_WriteByte (clamp (atoi (argv[1]), 5, 179));
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// CCMD warp
|
// CCMD warp
|
||||||
|
|
|
@ -529,6 +529,9 @@ public:
|
||||||
DPSprite *GetPSprite(PSPLayers layer);
|
DPSprite *GetPSprite(PSPLayers layer);
|
||||||
|
|
||||||
bool GetPainFlash(FName type, PalEntry *color) const;
|
bool GetPainFlash(FName type, PalEntry *color) const;
|
||||||
|
|
||||||
|
// [Nash] set player FOV
|
||||||
|
void SetFOV(float fov);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Bookkeeping on players - state.
|
// Bookkeeping on players - state.
|
||||||
|
|
|
@ -5305,6 +5305,7 @@ DEFINE_ACTION_FUNCTION(AActor, AdjustFloorClip)
|
||||||
//
|
//
|
||||||
EXTERN_CVAR (Bool, chasedemo)
|
EXTERN_CVAR (Bool, chasedemo)
|
||||||
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
|
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
|
||||||
|
EXTERN_CVAR(Float, fov)
|
||||||
|
|
||||||
extern bool demonew;
|
extern bool demonew;
|
||||||
|
|
||||||
|
@ -5442,7 +5443,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
|
||||||
mobj->sprite = Skins[p->userinfo.GetSkin()].sprite;
|
mobj->sprite = Skins[p->userinfo.GetSkin()].sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
p->DesiredFOV = p->FOV = 90.f;
|
p->DesiredFOV = p->FOV = fov;
|
||||||
p->camera = p->mo;
|
p->camera = p->mo;
|
||||||
p->playerstate = PST_LIVE;
|
p->playerstate = PST_LIVE;
|
||||||
p->refire = 0;
|
p->refire = 0;
|
||||||
|
|
|
@ -88,6 +88,13 @@ CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00f, CVAR_ARCHIVE | CVAR_GLOBALCO
|
||||||
ColorSetList ColorSets;
|
ColorSetList ColorSets;
|
||||||
PainFlashList PainFlashes;
|
PainFlashList PainFlashes;
|
||||||
|
|
||||||
|
// [Nash] FOV cvar setting
|
||||||
|
CUSTOM_CVAR(Float, fov, 90.f, CVAR_ARCHIVE | CVAR_USERINFO | CVAR_NOINITCALL)
|
||||||
|
{
|
||||||
|
player_t *p = &players[consoleplayer];
|
||||||
|
p->SetFOV(fov);
|
||||||
|
}
|
||||||
|
|
||||||
struct PredictPos
|
struct PredictPos
|
||||||
{
|
{
|
||||||
int gametic;
|
int gametic;
|
||||||
|
@ -550,6 +557,40 @@ int player_t::GetSpawnClass()
|
||||||
return static_cast<APlayerPawn*>(GetDefaultByType(type))->SpawnMask;
|
return static_cast<APlayerPawn*>(GetDefaultByType(type))->SpawnMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// [Nash] Set FOV
|
||||||
|
void player_t::SetFOV(float fov)
|
||||||
|
{
|
||||||
|
player_t *p = &players[consoleplayer];
|
||||||
|
if (p != nullptr && p->mo != nullptr)
|
||||||
|
{
|
||||||
|
if (dmflags & DF_NO_FOV)
|
||||||
|
{
|
||||||
|
if (consoleplayer == Net_Arbitrator)
|
||||||
|
{
|
||||||
|
Net_WriteByte(DEM_MYFOV);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Printf("A setting controller has disabled FOV changes.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Net_WriteByte(DEM_MYFOV);
|
||||||
|
}
|
||||||
|
Net_WriteByte((BYTE)clamp<float>(fov, 5.f, 179.f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFINE_ACTION_FUNCTION(_PlayerInfo, SetFOV)
|
||||||
|
{
|
||||||
|
PARAM_SELF_STRUCT_PROLOGUE(player_t);
|
||||||
|
PARAM_FLOAT(fov);
|
||||||
|
self->SetFOV((float)fov);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// EnumColorsets
|
// EnumColorsets
|
||||||
|
|
|
@ -320,6 +320,7 @@ usercmd_t original_cmd;
|
||||||
native int GetGender();
|
native int GetGender();
|
||||||
native int GetTeam();
|
native int GetTeam();
|
||||||
native float GetAutoaim();
|
native float GetAutoaim();
|
||||||
|
native void SetFOV(float fov);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct PlayerClass native
|
struct PlayerClass native
|
||||||
|
|
Loading…
Reference in a new issue