PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llcommon/llagentconstants.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 159 lines | 106 code | 22 blank | 31 comment | 0 complexity | 3cd7e9837d22f47aebe74a38023abc46 MD5 | raw file
  1/** 
  2 * @file llagentconstants.h
  3 * @author James Cook, Andrew Meadows, Richard Nelson
  4 * @brief Shared constants through the system for agents.
  5 *
  6 * $LicenseInfo:firstyear=2006&license=viewerlgpl$
  7 * Second Life Viewer Source Code
  8 * Copyright (C) 2010, Linden Research, Inc.
  9 * 
 10 * This library is free software; you can redistribute it and/or
 11 * modify it under the terms of the GNU Lesser General Public
 12 * License as published by the Free Software Foundation;
 13 * version 2.1 of the License only.
 14 * 
 15 * This library is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 18 * Lesser General Public License for more details.
 19 * 
 20 * You should have received a copy of the GNU Lesser General Public
 21 * License along with this library; if not, write to the Free Software
 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 23 * 
 24 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 25 * $/LicenseInfo$
 26 */
 27
 28#ifndef LL_LLAGENTCONSTANTS_H
 29#define LL_LLAGENTCONSTANTS_H
 30
 31const U32 CONTROL_AT_POS_INDEX				= 0;
 32const U32 CONTROL_AT_NEG_INDEX				= 1;
 33const U32 CONTROL_LEFT_POS_INDEX			= 2;
 34const U32 CONTROL_LEFT_NEG_INDEX			= 3;
 35const U32 CONTROL_UP_POS_INDEX				= 4;
 36const U32 CONTROL_UP_NEG_INDEX				= 5;
 37const U32 CONTROL_PITCH_POS_INDEX			= 6;
 38const U32 CONTROL_PITCH_NEG_INDEX			= 7;
 39const U32 CONTROL_YAW_POS_INDEX				= 8;
 40const U32 CONTROL_YAW_NEG_INDEX				= 9;
 41const U32 CONTROL_FAST_AT_INDEX				= 10;
 42const U32 CONTROL_FAST_LEFT_INDEX			= 11;
 43const U32 CONTROL_FAST_UP_INDEX				= 12;
 44const U32 CONTROL_FLY_INDEX					= 13;
 45const U32 CONTROL_STOP_INDEX				= 14;
 46const U32 CONTROL_FINISH_ANIM_INDEX			= 15;
 47const U32 CONTROL_STAND_UP_INDEX			= 16;
 48const U32 CONTROL_SIT_ON_GROUND_INDEX		= 17;
 49const U32 CONTROL_MOUSELOOK_INDEX			= 18;
 50const U32 CONTROL_NUDGE_AT_POS_INDEX		= 19;
 51const U32 CONTROL_NUDGE_AT_NEG_INDEX		= 20;
 52const U32 CONTROL_NUDGE_LEFT_POS_INDEX		= 21;
 53const U32 CONTROL_NUDGE_LEFT_NEG_INDEX		= 22;
 54const U32 CONTROL_NUDGE_UP_POS_INDEX		= 23;
 55const U32 CONTROL_NUDGE_UP_NEG_INDEX		= 24;
 56const U32 CONTROL_TURN_LEFT_INDEX			= 25;
 57const U32 CONTROL_TURN_RIGHT_INDEX			= 26;
 58const U32 CONTROL_AWAY_INDEX				= 27;
 59const U32 CONTROL_LBUTTON_DOWN_INDEX		= 28;
 60const U32 CONTROL_LBUTTON_UP_INDEX			= 29;
 61const U32 CONTROL_ML_LBUTTON_DOWN_INDEX		= 30;
 62const U32 CONTROL_ML_LBUTTON_UP_INDEX		= 31;
 63const U32 TOTAL_CONTROLS					= 32;
 64
 65const U32 AGENT_CONTROL_AT_POS              = 0x1 << CONTROL_AT_POS_INDEX;			// 0x00000001
 66const U32 AGENT_CONTROL_AT_NEG              = 0x1 << CONTROL_AT_NEG_INDEX;			// 0x00000002
 67const U32 AGENT_CONTROL_LEFT_POS            = 0x1 << CONTROL_LEFT_POS_INDEX;		// 0x00000004
 68const U32 AGENT_CONTROL_LEFT_NEG            = 0x1 << CONTROL_LEFT_NEG_INDEX;		// 0x00000008
 69const U32 AGENT_CONTROL_UP_POS              = 0x1 << CONTROL_UP_POS_INDEX;			// 0x00000010
 70const U32 AGENT_CONTROL_UP_NEG              = 0x1 << CONTROL_UP_NEG_INDEX;			// 0x00000020
 71const U32 AGENT_CONTROL_PITCH_POS           = 0x1 << CONTROL_PITCH_POS_INDEX;		// 0x00000040
 72const U32 AGENT_CONTROL_PITCH_NEG           = 0x1 << CONTROL_PITCH_NEG_INDEX;		// 0x00000080
 73const U32 AGENT_CONTROL_YAW_POS             = 0x1 << CONTROL_YAW_POS_INDEX;			// 0x00000100
 74const U32 AGENT_CONTROL_YAW_NEG             = 0x1 << CONTROL_YAW_NEG_INDEX;			// 0x00000200
 75
 76const U32 AGENT_CONTROL_FAST_AT             = 0x1 << CONTROL_FAST_AT_INDEX;			// 0x00000400
 77const U32 AGENT_CONTROL_FAST_LEFT           = 0x1 << CONTROL_FAST_LEFT_INDEX;		// 0x00000800
 78const U32 AGENT_CONTROL_FAST_UP             = 0x1 << CONTROL_FAST_UP_INDEX;			// 0x00001000
 79
 80const U32 AGENT_CONTROL_FLY					= 0x1 << CONTROL_FLY_INDEX;				// 0x00002000
 81const U32 AGENT_CONTROL_STOP				= 0x1 << CONTROL_STOP_INDEX;			// 0x00004000
 82const U32 AGENT_CONTROL_FINISH_ANIM			= 0x1 << CONTROL_FINISH_ANIM_INDEX;		// 0x00008000
 83const U32 AGENT_CONTROL_STAND_UP			= 0x1 << CONTROL_STAND_UP_INDEX;		// 0x00010000
 84const U32 AGENT_CONTROL_SIT_ON_GROUND		= 0x1 << CONTROL_SIT_ON_GROUND_INDEX;	// 0x00020000
 85const U32 AGENT_CONTROL_MOUSELOOK			= 0x1 << CONTROL_MOUSELOOK_INDEX;		// 0x00040000
 86
 87const U32 AGENT_CONTROL_NUDGE_AT_POS        = 0x1 << CONTROL_NUDGE_AT_POS_INDEX;	// 0x00080000
 88const U32 AGENT_CONTROL_NUDGE_AT_NEG        = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX;	// 0x00100000
 89const U32 AGENT_CONTROL_NUDGE_LEFT_POS      = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX;	// 0x00200000
 90const U32 AGENT_CONTROL_NUDGE_LEFT_NEG      = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX;	// 0x00400000
 91const U32 AGENT_CONTROL_NUDGE_UP_POS        = 0x1 << CONTROL_NUDGE_UP_POS_INDEX;	// 0x00800000
 92const U32 AGENT_CONTROL_NUDGE_UP_NEG        = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX;	// 0x01000000
 93const U32 AGENT_CONTROL_TURN_LEFT	        = 0x1 << CONTROL_TURN_LEFT_INDEX;		// 0x02000000
 94const U32 AGENT_CONTROL_TURN_RIGHT	        = 0x1 << CONTROL_TURN_RIGHT_INDEX;		// 0x04000000
 95
 96const U32 AGENT_CONTROL_AWAY				= 0x1 << CONTROL_AWAY_INDEX;			// 0x08000000
 97
 98const U32 AGENT_CONTROL_LBUTTON_DOWN		= 0x1 << CONTROL_LBUTTON_DOWN_INDEX;	// 0x10000000
 99const U32 AGENT_CONTROL_LBUTTON_UP			= 0x1 << CONTROL_LBUTTON_UP_INDEX;		// 0x20000000
100const U32 AGENT_CONTROL_ML_LBUTTON_DOWN		= 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX;	// 0x40000000
101const U32 AGENT_CONTROL_ML_LBUTTON_UP		= ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX;	// 0x80000000
102
103const U32 AGENT_CONTROL_AT 		= AGENT_CONTROL_AT_POS 
104								  | AGENT_CONTROL_AT_NEG 
105								  | AGENT_CONTROL_NUDGE_AT_POS 
106								  | AGENT_CONTROL_NUDGE_AT_NEG;
107
108const U32 AGENT_CONTROL_LEFT 	= AGENT_CONTROL_LEFT_POS 
109								  | AGENT_CONTROL_LEFT_NEG 
110								  | AGENT_CONTROL_NUDGE_LEFT_POS 
111								  | AGENT_CONTROL_NUDGE_LEFT_NEG;
112
113const U32 AGENT_CONTROL_UP 		= AGENT_CONTROL_UP_POS 
114								  | AGENT_CONTROL_UP_NEG 
115								  | AGENT_CONTROL_NUDGE_UP_POS 
116								  | AGENT_CONTROL_NUDGE_UP_NEG;
117
118const U32 AGENT_CONTROL_HORIZONTAL = AGENT_CONTROL_AT 
119									 | AGENT_CONTROL_LEFT;
120
121const U32 AGENT_CONTROL_NOT_USED_BY_LSL = AGENT_CONTROL_FLY 
122										  | AGENT_CONTROL_STOP 
123										  | AGENT_CONTROL_FINISH_ANIM 
124										  | AGENT_CONTROL_STAND_UP 
125										  | AGENT_CONTROL_SIT_ON_GROUND 
126										  | AGENT_CONTROL_MOUSELOOK 
127										  | AGENT_CONTROL_AWAY;
128
129const U32 AGENT_CONTROL_MOVEMENT = AGENT_CONTROL_AT 
130								   | AGENT_CONTROL_LEFT 
131								   | AGENT_CONTROL_UP;
132
133const U32 AGENT_CONTROL_ROTATION = AGENT_CONTROL_PITCH_POS 
134								   | AGENT_CONTROL_PITCH_NEG 
135								   | AGENT_CONTROL_YAW_POS 
136								   | AGENT_CONTROL_YAW_NEG;
137
138const U32 AGENT_CONTROL_NUDGE = AGENT_CONTROL_NUDGE_AT_POS
139								| AGENT_CONTROL_NUDGE_AT_NEG
140								| AGENT_CONTROL_NUDGE_LEFT_POS
141								| AGENT_CONTROL_NUDGE_LEFT_NEG;
142
143
144// move these up so that we can hide them in "State" for object updates 
145// (for now)
146const U32 AGENT_ATTACH_OFFSET				= 4;
147const U32 AGENT_ATTACH_MASK					= 0xf << AGENT_ATTACH_OFFSET;
148const U32 AGENT_ATTACH_CLEAR				= 0x00;
149
150// RN: this method swaps the upper and lower nibbles to maintain backward 
151// compatibility with old objects that only used the upper nibble
152#define ATTACHMENT_ID_FROM_STATE(state) ((S32)((((U8)state & AGENT_ATTACH_MASK) >> 4) | (((U8)state & ~AGENT_ATTACH_MASK) << 4)))
153
154// test state for use in testing grabbing the camera
155const U32 AGENT_CAMERA_OBJECT				= 0x1 << 3;
156
157const F32 MAX_ATTACHMENT_DIST = 3.5f; // meters?
158
159#endif