From ad45708178b7e014faad753fab00cd9cd58df5a7 Mon Sep 17 00:00:00 2001
From: McCabe Maxsted
Date: Sun, 6 Sep 2009 20:53:19 -0700
Subject: Ported phantom avatar option from Emerald viewer

---
 linden/indra/newview/llagent.cpp                   | 30 ++++++++++++++++++++
 linden/indra/newview/llagent.h                     |  7 +++++
 linden/indra/newview/llappviewer.cpp               |  7 ++++-
 linden/indra/newview/llviewermenu.cpp              | 32 ++++++++++++++++++++++
 .../skins/default/xui/en-us/menu_viewer.xml        |  5 ++++
 5 files changed, 80 insertions(+), 1 deletion(-)

(limited to 'linden/indra')

diff --git a/linden/indra/newview/llagent.cpp b/linden/indra/newview/llagent.cpp
index 5f0a875..7a70316 100644
--- a/linden/indra/newview/llagent.cpp
+++ b/linden/indra/newview/llagent.cpp
@@ -232,6 +232,7 @@ LLAgent gAgent;
 // Statics
 //
 BOOL LLAgent::sDebugDisplayTarget = FALSE;
+BOOL LLAgent::sPhantom = FALSE;
 
 const F32 LLAgent::TYPING_TIMEOUT_SECS = 5.f;
 
@@ -835,6 +836,35 @@ void LLAgent::toggleFlying()
 
 
 //-----------------------------------------------------------------------------
+// togglePhantom()
+//-----------------------------------------------------------------------------
+void LLAgent::togglePhantom()
+{
+	BOOL phan = !(sPhantom);
+
+	setPhantom( phan );
+}
+
+
+//-----------------------------------------------------------------------------
+// setPhantom()  lgg
+//-----------------------------------------------------------------------------
+void LLAgent::setPhantom(BOOL phantom)
+{
+	sPhantom = phantom;
+}
+
+
+//-----------------------------------------------------------------------------
+// getPhantom()  lgg
+//-----------------------------------------------------------------------------
+BOOL LLAgent::getPhantom()
+{
+	return sPhantom;
+}
+
+
+//-----------------------------------------------------------------------------
 // setRegion()
 //-----------------------------------------------------------------------------
 void LLAgent::setRegion(LLViewerRegion *regionp)
diff --git a/linden/indra/newview/llagent.h b/linden/indra/newview/llagent.h
index a4a930f..0b8463f 100644
--- a/linden/indra/newview/llagent.h
+++ b/linden/indra/newview/llagent.h
@@ -371,6 +371,11 @@ public:
 	// Does this parcel allow you to fly?
 	BOOL canFly();
 
+	//lgg crap
+	static BOOL			getPhantom();// const				{ return emeraldPhantom; }
+	static void			setPhantom(BOOL phantom);
+	static void			togglePhantom();
+
 	// Animation functions
 	void                    stopCurrentAnimations();
 	void			requestStopMotion( LLMotion* motion );
@@ -801,6 +806,8 @@ private:
 	LLVector3d      mCameraSmoothingLastPositionGlobal;    
 	LLVector3d      mCameraSmoothingLastPositionAgent;
 	BOOL            mCameraSmoothingStop;
+	
+	static BOOL		sPhantom;
 
 	
 	//Ventrella
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index 4d53c88..0f1bfb4 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -3126,7 +3126,12 @@ void LLAppViewer::idle()
 	    {
 		    // Send avatar and camera info
 		    last_control_flags = gAgent.getControlFlags();
-		    send_agent_update(TRUE);
+
+		    if(!gAgent.getPhantom())
+			{
+				send_agent_update(TRUE);
+			}
+
 		    agent_update_timer.reset();
 	    }
 	}
diff --git a/linden/indra/newview/llviewermenu.cpp b/linden/indra/newview/llviewermenu.cpp
index 727f357..3be857e 100644
--- a/linden/indra/newview/llviewermenu.cpp
+++ b/linden/indra/newview/llviewermenu.cpp
@@ -7583,6 +7583,36 @@ class LLAdvancedToggleSit: public view_listener_t
 };
 
 
+/////////////
+// PHANTOM //
+/////////////
+
+class LLAdvancedTogglePhantom: public view_listener_t
+{
+	bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+	{
+		LLAgent::togglePhantom();
+		BOOL ph = LLAgent::getPhantom();
+		LLChat chat;
+		chat.mSourceType = CHAT_SOURCE_SYSTEM;
+		chat.mText = llformat("%s%s","Phantom ",(ph ? "On" : "Off"));
+		LLFloaterChat::addChat(chat);
+		//gMenuHolder->findControl(userdata["control"].asString())->setValue(ph);
+		return true;
+	}
+
+};
+
+class LLAdvancedCheckPhantom: public view_listener_t
+{
+	bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
+	{
+		gMenuHolder->findControl(userdata["control"].asString())->setValue(LLAgent::getPhantom());
+		return true;
+	}
+};
+
+
 ///////////////////////
 // CLEAR GROUP CACHE //
 ///////////////////////
@@ -9599,6 +9629,8 @@ void initialize_menus()
 	addMenu(new LLWorldSetAway(), "World.SetAway");
 	addMenu(new LLWorldSetBusy(), "World.SetBusy");
 	addMenu(new LLAdvancedToggleSit(), "Advanced.ToggleSit");
+	addMenu(new LLAdvancedTogglePhantom(), "Advanced.TogglePhantom");
+	addMenu(new LLAdvancedCheckPhantom(), "Advanced.CheckPhantom");
 
 	addMenu(new LLWorldEnableCreateLandmark(), "World.EnableCreateLandmark");
 	addMenu(new LLWorldEnableSetHomeLocation(), "World.EnableSetHomeLocation");
diff --git a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
index 5ac1620..86b5315 100644
--- a/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/menu_viewer.xml
@@ -888,6 +888,11 @@
                     shortcut="control|alt|s">
       <on_click function="Advanced.ToggleSit" userdata="" />
     </menu_item_call>
+    <menu_item_check label="Phantom Avatar" name="Phantom" 
+                     shortcut="control|alt|p">
+      <on_click function="Advanced.TogglePhantom" userdata="" />
+      <on_check function="Advanced.CheckPhantom" userdata="" />
+    </menu_item_check>
     <menu_item_check name="Show Mouselook Crosshairs"
                      label="Show Mouselook Crosshairs">
       <on_click function="ToggleControl"
-- 
cgit v1.1