Allow flying around lights by holding mouse2 in editLights mode

This commit is contained in:
Robert Beckebans 2025-01-20 21:24:31 +01:00
parent 4f778fcc9d
commit 427407ab68
9 changed files with 37 additions and 153 deletions

View file

@ -72,5 +72,4 @@ bind y "clientMessageMode 1"
//
bind MOUSE1 _attack
bind MOUSE2 _moveup

View file

@ -1,126 +0,0 @@
/*
Alternate Quake Tracks
----------------------
This is a compilation of alternate tracks.
They are to be used for streamers/YouTubers
as well as for those who lack the OST.
02. Often not Their Right Time Verbum Mentis
03. EoE intermission Markie Music
04. Yss Éskiuth Immorpher
05. Gwam Swolíst Immorpher
06. Feedback AlekswithaK
07. Thia Whythdyi Immorpher
08. Deeper Outside, pt 1 Verbum Mentis
09. Lingering Repetitive Agony Verbum Mentis
10. Architects of Enmity AlekswithaK
11. Scratch my surface Verbum Mentis
All music is either open source or permitted
to be used, when playing the game, by the
composer. Enjoy!
- Greenwood
*/
music/aqm/track02
{
description "Often not Their Right Time Verbum Mentis"
volume -5
global
looping
music/aqm/track02.ogg
}
music/aqm/track03
{
description "EoE intermission"
volume -5
global
looping
music/aqm/track03.ogg
}
music/aqm/track04
{
description "Yss Éskiuth"
volume -2
global
looping
music/aqm/track04.ogg
}
music/aqm/track05
{
description "Gwam Swolíst"
volume -2
global
looping
music/aqm/track05.ogg
}
music/aqm/track06
{
description "Feedback"
volume -3
global
looping
music/aqm/track06.ogg
}
music/aqm/track07
{
description "Thia Whythdyi"
volume -2
global
looping
music/aqm/track07.ogg
}
music/aqm/track08
{
description "Deeper Outside, pt 1"
volume -4
global
looping
music/aqm/track08.ogg
}
music/aqm/track09
{
description "Lingering Repetitive Agony"
volume -5
global
looping
music/aqm/track09.ogg
}
music/aqm/track10
{
description "Architects of Enmity"
volume -2
global
looping
music/aqm/track10.ogg
}
music/aqm/track11
{
description "Scratch my surface"
volume -2
global
looping
music/aqm/track11.ogg
}

View file

@ -2747,6 +2747,9 @@ void Cmd_EditLights_f( const idCmdArgs& args )
r_singleLight.SetInteger( -1 );
r_showLights.SetInteger( 0 );
}
// put player into fly mode
Cmd_Noclip_f( args );
}
// RB end

View file

@ -117,6 +117,23 @@ bool HandleKeyEvent( const sysEvent_t& keyEvent )
ImGuiIO& io = ImGui::GetIO();
if( keyNum == K_MOUSE2 )
{
// RB: allow navigation like in a level editor
g_MousePressed[1] = pressed;
ImGuiTools::SetReleaseToolMouse( !pressed );
//common->Printf( "mouse2 pressed %d\n", int( pressed ) );
return true;
}
if( g_MousePressed[1] )
{
return false;
}
if( keyNum < K_JOY1 )
{
// keyboard input as direct input scancodes
@ -230,7 +247,7 @@ bool ShowWindows()
bool UseInput()
{
return ImGuiTools::ReleaseMouseForTools() || imgui_showDemoWindow.GetBool();
return ( ImGuiTools::ReleaseMouseForTools() || imgui_showDemoWindow.GetBool() );
}
void StyleGruvboxDark()
@ -752,7 +769,7 @@ void NotifyDisplaySizeChanged( int width, int height )
// inject a sys event
bool InjectSysEvent( const sysEvent_t* event )
{
if( IsInitialized() && UseInput() )
if( IsInitialized() && ( UseInput() || RightMouseActive() ) )
{
if( event == NULL )
{
@ -795,6 +812,11 @@ bool InjectSysEvent( const sysEvent_t* event )
return false;
}
bool RightMouseActive()
{
return g_MousePressed[1];
}
bool InjectMouseWheel( int delta )
{
if( IsInitialized() && UseInput() && delta != 0 )

View file

@ -61,6 +61,8 @@ void Render();
void Destroy();
bool RightMouseActive();
} //namespace ImGuiHook

View file

@ -41,14 +41,8 @@ If you have questions concerning this license or the applicable additional terms
namespace ImGuiTools
{
// things in impl need to be used in at least one other file, but should generally not be touched
namespace impl
{
void SetReleaseToolMouse( bool doRelease );
} //namespace impl
bool ReleaseMouseForTools();
bool AreEditorsActive();

View file

@ -40,27 +40,16 @@ If you have questions concerning this license or the applicable additional terms
extern idCVar g_editEntityMode;
static bool releaseMouse = false;
#if 0 // currently this doesn't make too much sense
void ShowEditors_f( const idCmdArgs& args )
{
showToolWindows = true;
}
#endif // 0
namespace ImGuiTools
{
// things in impl need to be used in at least one other file, but should generally not be touched
namespace impl
{
void SetReleaseToolMouse( bool doRelease )
{
releaseMouse = doRelease;
}
} //namespace impl
bool AreEditorsActive()
{
// FIXME: this is not exactly clean and must be changed if we ever support game dlls
@ -69,7 +58,8 @@ bool AreEditorsActive()
bool ReleaseMouseForTools()
{
return AreEditorsActive() && releaseMouse;
// RB: ignore everything as long right mouse button is pressed
return AreEditorsActive() && releaseMouse && !ImGuiHook::RightMouseActive();
}
void DrawToolWindows()
@ -103,7 +93,7 @@ void LightEditorInit( const idDict* dict, idEntity* ent )
LightEditor::Instance().ShowIt( true );
impl::SetReleaseToolMouse( true );
SetReleaseToolMouse( true );
LightEditor::ReInit( dict, ent );
}
@ -111,7 +101,7 @@ void LightEditorInit( const idDict* dict, idEntity* ent )
void AfEditorInit()
{
AfEditor::Instance().ShowIt( true );
impl::SetReleaseToolMouse( true );
SetReleaseToolMouse( true );
}
} //namespace ImGuiTools

View file

@ -196,7 +196,7 @@ void AfEditor::Draw()
if( ImGui::Begin( "AF Editor", &showTool, ImGuiWindowFlags_MenuBar ) )
{
impl::SetReleaseToolMouse( true );
SetReleaseToolMouse( true );
bool changedAf = false;
bool openedAfBrowser = false;
@ -571,7 +571,7 @@ void AfEditor::Draw()
{
// TODO: do the same as when pressing cancel?
isShown = showTool;
impl::SetReleaseToolMouse( false );
SetReleaseToolMouse( false );
}
}

View file

@ -1229,7 +1229,7 @@ void LightEditor::Draw()
if( isShown && !showTool )
{
isShown = showTool;
impl::SetReleaseToolMouse( false );
SetReleaseToolMouse( false );
}
}