]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
Merge commit 'e155ebe99481333af4a7660d174db490e2a75fb5' into master-merge
authorThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:18:48 +0000 (06:18 +0200)
committerThomas Debesse <dev@illwieckz.net>
Tue, 21 Jun 2022 04:18:48 +0000 (06:18 +0200)
include/ientity.h
plugins/entity/entity.cpp
plugins/entity/entity.h
plugins/entity/namedentity.h
radiant/mainframe.cpp
radiant/xywindow.cpp

index dd3f253c8082be09116f28f25c213f776adae627..797e00a196da857ddb4ff91facb436d7bdd3fdbe 100644 (file)
@@ -127,6 +127,8 @@ virtual void setLightRadii( bool lightRadii ) = 0;
 virtual bool getLightRadii() const = 0;
 virtual void setShowNames( bool showNames ) = 0;
 virtual bool getShowNames() = 0;
+virtual void setShowTargetNames( bool showNames ) = 0;
+virtual bool getShowTargetNames() = 0;
 virtual void setShowAngles( bool showAngles ) = 0;
 virtual bool getShowAngles() = 0;
 
index a251bde5c442be67c0438e89cf3ff56ef945932d..77ad814349c6f50a02b9f4e28466eba3b0e04b2b 100644 (file)
@@ -111,6 +111,7 @@ EntityCreator::KeyValueChangedFunc KeyValue::m_entityKeyValueChanged = 0;
 Counter* EntityKeyValues::m_counter = 0;
 
 bool g_showNames = true;
+bool g_showTargetNames = false;
 bool g_showAngles = true;
 bool g_newLightDraw = true;
 bool g_lightRadii = true;
@@ -264,6 +265,12 @@ void setShowNames( bool showNames ){
 bool getShowNames(){
        return g_showNames;
 }
+void setShowTargetNames( bool showNames ){
+       g_showTargetNames = showNames;
+}
+bool getShowTargetNames(){
+       return g_showTargetNames;
+}
 void setShowAngles( bool showAngles ){
        g_showAngles = showAngles;
 }
@@ -368,6 +375,7 @@ void Entity_Construct( EGameType gameType ){
        }
 
        GlobalPreferenceSystem().registerPreference( "SI_ShowNames", make_property_string( g_showNames ) );
+       GlobalPreferenceSystem().registerPreference( "SI_ShowTargetNames", make_property_string( g_showTargetNames ) );
        GlobalPreferenceSystem().registerPreference( "SI_ShowAngles", make_property_string( g_showAngles ) );
        GlobalPreferenceSystem().registerPreference( "NewLightStyle", make_property_string( g_newLightDraw ) );
        GlobalPreferenceSystem().registerPreference( "LightRadiuses", make_property_string( g_lightRadii ) );
index ae294ab7c262004fc1058b92eef25d7297977327..ba5f991fcf0288c16d4b383badf97513980d78c0 100644 (file)
@@ -39,6 +39,7 @@ void Entity_Construct( EGameType gameType = eGameTypeQuake3 );
 void Entity_Destroy();
 
 extern bool g_showNames;
+extern bool g_showTargetNames;
 extern bool g_showAngles;
 extern bool g_newLightDraw;
 extern bool g_lightRadii;
index 857b10b44a5e41a0066da12e01fc5fc8feb0a08a..8e604ec58341af392d07719eaebb5f5c09463e63 100644 (file)
@@ -26,6 +26,7 @@
 #include "eclasslib.h"
 #include "generic/callback.h"
 #include "nameable.h"
+#include "entity.h" //g_showTargetNames
 
 #include <set>
 
@@ -62,6 +63,9 @@ const char* name() const {
        }
        return m_name.c_str();
 }
+const char* classname() const {
+       return m_entity.getEntityClass().name();
+}
 void attach( const NameCallback& callback ){
        m_changed.insert( callback );
 }
@@ -92,7 +96,7 @@ RenderableNamedEntity( const NamedEntity& named, const Vector3& position )
 }
 void render( RenderStateFlags state ) const {
        glRasterPos3fv( vector3_to_array( m_position ) );
-       GlobalOpenGL().drawString( m_named.name() );
+       GlobalOpenGL().drawString( g_showTargetNames ? m_named.name() : m_named.classname() );
 }
 };
 
index 37e496a828758b119b47f4453eb6c0f38293a376..ffd40db9b1bab1a42b722ffe23034f2c4c60d3ac 100644 (file)
@@ -2224,6 +2224,7 @@ ui::MenuItem create_view_menu( MainFrame::EViewStyle style ){
                }
                create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Angles", "ShowAngles" );
                create_check_menu_item_with_mnemonic( menu_in_menu, "Show Entity _Names", "ShowNames" );
+               create_check_menu_item_with_mnemonic( menu_in_menu, "Entity Names = Targetnames", "ShowTargetNames" );
                create_check_menu_item_with_mnemonic( menu_in_menu, "Show Light Radiuses", "ShowLightRadiuses" );
 
                menu_separator( menu_in_menu );
index 6b3d893b7f44dfcfe73264ac538c9c0db9cc7cd6..381f5b072d81edc0c0b1475ca544dea027bba96d 100644 (file)
@@ -2869,7 +2869,6 @@ void unrealise(){
 EntityClassMenu g_EntityClassMenu;
 
 
-
 // Names
 void ShowNamesToggle(){
        GlobalEntityCreator().setShowNames( !GlobalEntityCreator().getShowNames() );
@@ -2884,6 +2883,20 @@ void ShowNamesExport( const Callback<void(bool)> & importer ){
 
 typedef FreeCaller<void(const Callback<void(bool)> &), ShowNamesExport> ShowNamesExportCaller;
 
+// TargetNames
+void ShowTargetNamesToggle(){
+       GlobalEntityCreator().setShowTargetNames( !GlobalEntityCreator().getShowTargetNames() );
+       XY_UpdateAllWindows();
+}
+
+typedef FreeCaller<void(), ShowTargetNamesToggle> ShowTargetNamesToggleCaller;
+
+void ShowTargetNamesExport( const Callback<void(bool)> & importer ){
+       importer( GlobalEntityCreator().getShowTargetNames() );
+}
+
+typedef FreeCaller<void(const Callback<void(bool)> &), ShowTargetNamesExport> ShowTargetNamesExportCaller;
+
 // Angles
 void ShowAnglesToggle(){
        GlobalEntityCreator().setShowAngles( !GlobalEntityCreator().getShowAngles() );
@@ -3013,6 +3026,10 @@ ShowNamesExportCaller g_show_names_caller;
 Callback<void(const Callback<void(bool)> &)> g_show_names_callback( g_show_names_caller );
 ToggleItem g_show_names( g_show_names_callback );
 
+ShowTargetNamesExportCaller g_show_targetnames_caller;
+Callback<void(const Callback<void(bool)> &)> g_show_targetnames_callback( g_show_targetnames_caller );
+ToggleItem g_show_targetnames( g_show_targetnames_callback );
+
 ShowAnglesExportCaller g_show_angles_caller;
 Callback<void(const Callback<void(bool)> &)> g_show_angles_callback( g_show_angles_caller );
 ToggleItem g_show_angles( g_show_angles_callback );
@@ -3057,6 +3074,7 @@ void XYShow_registerCommands(){
 
        GlobalToggles_insert( "ShowAngles", ShowAnglesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_angles ) );
        GlobalToggles_insert( "ShowNames", ShowNamesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_names ) );
+       GlobalToggles_insert( "ShowTargetNames", ShowTargetNamesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_targetnames ) );
        GlobalToggles_insert( "ShowBlocks", ShowBlocksToggleCaller(), ToggleItem::AddCallbackCaller( g_show_blocks ) );
        GlobalToggles_insert( "ShowCoordinates", ShowCoordinatesToggleCaller(), ToggleItem::AddCallbackCaller( g_show_coordinates ) );
        GlobalToggles_insert( "ShowWindowOutline", ShowOutlineToggleCaller(), ToggleItem::AddCallbackCaller( g_show_outline ) );