Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/game/client/hl2mp/clientmode_hl2mpnormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,7 @@ ClientModeHL2MPNormal::ClientModeHL2MPNormal()
m_pViewport = new CHudViewport();
m_pViewport->Start(gameuifuncs, gameeventmanager);
#ifdef NEO
ConVarRef cl_software_cursor( "cl_software_cursor" );
Assert(cl_software_cursor.IsValid());
if (cl_software_cursor.IsValid())
{
if (auto* surface = vgui::surface())
{
surface->SetSoftwareCursor(cl_software_cursor.GetBool());
}
else
{
Assert(false);
}
}
SwCursorHack_RestoreValue();
#endif
}

Expand Down
4 changes: 1 addition & 3 deletions src/game/client/neo/ui/neo_loading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,9 @@ void CNeoLoading::OnMessage(const KeyValues *params, vgui::VPANEL fromPanel)
else if (V_strcmp(pSzMsgName, "deactivate") == 0)
{
g_pNeoRoot->m_bOnLoadingScreen = false;
static ConVarRef cl_software_cursor( "cl_software_cursor" );

// Revert the software cursor option back to user preference once we exit the loading screen.
Assert(cl_software_cursor.IsValid());
vgui::surface()->SetSoftwareCursor(cl_software_cursor.GetBool());
SwCursorHack_RestoreValue();

if (engine->IsConnected() && !engine->IsLevelMainMenuBackground())
{
Expand Down
9 changes: 6 additions & 3 deletions src/game/client/neo/ui/neo_root_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <vgui_controls/Controls.h>
#include <vgui/ISurface.h>
#include "vgui/ISystem.h"
#include "view.h"
#include "voice_status.h"

#include "neo_ui.h"
Expand Down Expand Up @@ -662,7 +663,7 @@ void NeoSettingsRestore(NeoSettings *ns, const NeoSettings::Keys::Flags flagsKey
pVideo->flGamma = cvr->mat_monitorgamma.GetFloat();
pVideo->iFov = cvr->neo_fov.GetInt();
pVideo->iViewmodelFov = cvr->neo_viewmodel_fov_offset.GetInt();
pVideo->bSoftwareCursor = cvr->cl_software_cursor.GetBool();
pVideo->iSoftwareCursor = cvr->cl_software_cursor.GetInt();
}
{
NeoSettings::Crosshair *pCrosshair = &ns->crosshair;
Expand Down Expand Up @@ -933,7 +934,7 @@ void NeoSettingsSave(const NeoSettings *ns)
cvr->mat_monitorgamma.SetValue(pVideo->flGamma);
cvr->neo_fov.SetValue(pVideo->iFov);
cvr->neo_viewmodel_fov_offset.SetValue(pVideo->iViewmodelFov);
cvr->cl_software_cursor.SetValue(pVideo->bSoftwareCursor);
cvr->cl_software_cursor.SetValue(pVideo->iSoftwareCursor);
}
{
const NeoSettings::Crosshair *pCrosshair = &ns->crosshair;
Expand Down Expand Up @@ -1353,7 +1354,9 @@ void NeoSettings_Video(NeoSettings *ns)
NeoUI::Slider(L"Gamma", &pVideo->flGamma, 1.6, 2.6, 2, 0.1f);
NeoUI::SliderInt(L"FOV", &pVideo->iFov, MIN_FOV, MAX_FOV);
NeoUI::SliderInt(L"Viewmodel FOV Offset", &pVideo->iViewmodelFov, -20, 40);
NeoUI::RingBoxBool(L"Software Cursor", &pVideo->bSoftwareCursor);
#ifndef LINUX // disabled on Linux for now, see bug #2114
NeoUI::RingBoxFlag(L"Software Cursor", ESoftwareCursor::EnabledForPlatform, &pVideo->iSoftwareCursor);
#endif

NeoUI::Divider(L"VISUALS");
NeoUI::RingBox(L"Model detail", QUALITY_LABELS, 3, &pVideo->iModelDetail);
Expand Down
2 changes: 1 addition & 1 deletion src/game/client/neo/ui/neo_root_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ struct NeoSettings
float flGamma;
int iFov;
int iViewmodelFov;
bool bSoftwareCursor;
int iSoftwareCursor;

// Video modes
int iVMListSize;
Expand Down
19 changes: 15 additions & 4 deletions src/game/client/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,24 @@ static ConVar r_farz( "r_farz", "-1", FCVAR_CHEAT, "Override the far clipping pl
static ConVar cl_demoviewoverride( "cl_demoviewoverride", "0", 0, "Override view during demo playback" );


#ifdef NEO
static ConVar cl_software_cursor( "cl_software_cursor", "1", FCVAR_ARCHIVE,
"Switches the game to use a larger software cursor instead of the normal OS cursor. "
"Set as bitflags. 1: enabled for Windows, 2: enabled for Linux, 3: enabled for both",
true, ESoftwareCursor::Disabled, true, ESoftwareCursor::Maximum,
[](IConVar*, const char*, float) { SwCursorHack_RestoreValue(); });
void SwCursorHack_RestoreValue()
{
bool enabled = (cl_software_cursor.GetInt() & ESoftwareCursor::EnabledForPlatform);
vgui::surface()->SetSoftwareCursor(enabled || UseVR());
}
#else
static ConVar cl_software_cursor ( "cl_software_cursor", "0", FCVAR_ARCHIVE, "Switches the game to use a larger software cursor instead of the normal OS cursor", SoftwareCursorChangedCB );
void SoftwareCursorChangedCB( IConVar *pVar, const char *pOldValue, float fOldValue )
{
ConVar *pConVar = (ConVar *)pVar;
vgui::surface()->SetSoftwareCursor( pConVar->GetBool() || UseVR() );
}
#ifdef NEO
static ConVar cl_software_cursor ( "cl_software_cursor", "1", FCVAR_ARCHIVE, "Switches the game to use a larger software cursor instead of the normal OS cursor", SoftwareCursorChangedCB );
#else
static ConVar cl_software_cursor ( "cl_software_cursor", "0", FCVAR_ARCHIVE, "Switches the game to use a larger software cursor instead of the normal OS cursor", SoftwareCursorChangedCB );
#endif


Expand Down Expand Up @@ -343,6 +352,8 @@ void CViewRender::Init( void )
#endif

#ifdef NEO
SwCursorHack_RestoreValue();

ITexture *pDepthOld = materials->FindTexture("_rt_FullFrameDepth", TEXTURE_GROUP_RENDER_TARGET);
const bool bDepthTexOk = ((pDepthOld != NULL) && (!pDepthOld->IsError()));
const int flags = (bDepthTexOk ? pDepthOld->GetFlags() : TEXTUREFLAGS_NOMIP |
Expand Down
19 changes: 19 additions & 0 deletions src/game/client/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ class Vector;
class QAngle;
class VPlane;

#ifdef NEO
enum ESoftwareCursor // stored in user configs, don't reorder
{
Disabled = 0,
EnabledForWindows = (1 << 0),
EnabledForLinux = (1 << 1),

#ifdef _WIN32
EnabledForPlatform = EnabledForWindows,
#elif defined(LINUX)
EnabledForPlatform = EnabledForLinux,
#else
EnabledForPlatform = 0,
#endif
Maximum = (EnabledForWindows | EnabledForLinux)
};

void SwCursorHack_RestoreValue();
#endif

// near and far Z it uses to render the world.
#ifdef NEO
Expand Down