PageRenderTime 54ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/rlvdefines.h

https://github.com/MattoDestiny/Zero-One
C Header | 322 lines | 232 code | 36 blank | 54 comment | 4 complexity | fe63e22ed76746ce5f2f6185d99bc6f3 MD5 | raw file
  1. /**
  2. *
  3. * Copyright (c) 2009-2010, Kitty Barnett
  4. *
  5. * The source code in this file is provided to you under the terms of the
  6. * GNU General Public License, version 2.0, but WITHOUT ANY WARRANTY;
  7. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  8. * PARTICULAR PURPOSE. Terms of the GPL can be found in doc/GPL-license.txt
  9. * in this distribution, or online at http://www.gnu.org/licenses/gpl-2.0.txt
  10. *
  11. * By copying, modifying or distributing this software, you acknowledge that
  12. * you have read and understood your obligations described above, and agree to
  13. * abide by those obligations.
  14. *
  15. */
  16. #ifndef RLV_DEFINES_H
  17. #define RLV_DEFINES_H
  18. // ============================================================================
  19. // Extensions
  20. //
  21. // Comment out if you don't want the Advanced / RLVa menu (may prevent enabling some extensions or experimental features - see below)
  22. #define RLV_ADVANCED_MENU
  23. // Comment out if you provide your own way to enable/disable RLVa
  24. #define RLV_ADVANCED_TOGGLE_RLVA
  25. // Provides access to "advanced" features through the RLVa debug menu
  26. #define RLV_EXTENSION_FLOATER_RESTRICTIONS // Enables the Advanced / RLVa / Restrictions... floater
  27. #define RLV_EXTENSION_HIDELOCKED // "Hide locked layers", "Hide locked attachments" and "Hide locked inventory"
  28. // Extensions
  29. #define RLV_EXTENSION_CMD_GETSETDEBUG_EX // Extends the debug variables accessible through @getdebug_xxx/@setdebug_xxx
  30. #define RLV_EXTENSION_CMD_FINDFOLDERS // @findfolders:<option>=<channel> - @findfolder with multiple results
  31. #define RLV_EXTENSION_FORCEWEAR_GESTURES // @attach*/detach* commands also (de)activate gestures
  32. #define RLV_EXTENSION_GIVETORLV_A2A // Allow "Give to #RLV" on avatar-to-avatar inventory offers
  33. #define RLV_EXTENSION_NOTIFY_BEHAVIOUR // Provides the option to show a customizable notification whenever a behaviour gets (un)set
  34. #define RLV_EXTENSION_STARTLOCATION // Reenables "Start Location" at login if not @tploc=n or @unsit=n restricted at last logoff
  35. #define RLV_EXPERIMENTAL // Enables/disables experimental features en masse
  36. #define RLV_EXPERIMENTAL_CMDS // Enables/disables experimental commands en masse
  37. // Experimental features
  38. #ifdef RLV_EXPERIMENTAL
  39. // Stable (will mature to RLV_EXTENSION_XXX in next release if no bugs are found)
  40. // Under testing (stable, but requires further testing - safe for public release but may be quirky)
  41. #define RLV_EXTENSION_FORCEWEAR_FOLDERLINKS // @attach*/detach* commands will collect from folder links as well
  42. // Under development (don't include in public release)
  43. #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
  44. // #define RLV_EXPERIMENTAL_COMPOSITEFOLDERS
  45. // #define RLV_EXPERIMENTAL_FIRSTUSE // Enables a number of "first use" popups
  46. #endif // LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
  47. #endif // RLV_EXPERIMENTAL
  48. // Experimental commands (not part of the RLV API spec, disabled on public releases)
  49. #ifdef RLV_EXPERIMENTAL_CMDS
  50. #define RLV_EXTENSION_CMD_ALLOWIDLE // Forces "Away" status when idle (effect is the same as setting AllowIdleAFK to TRUE)
  51. #define RLV_EXTENSION_CMD_GETCOMMAND // @getcommand:<option>=<channel>
  52. // #define RLV_EXTENSION_CMD_GETXXXNAMES // @get[add|rem]attachnames:<option>=<channel> and @get[add|rem]outfitnames=<channel>
  53. #define RLV_EXTENSION_CMD_INTERACT // @interact=n
  54. #define RLV_EXTENSION_CMD_TOUCHXXX // @touch:uuid=n|y, @touchworld[:<uuid>]=n|y, @touchattach[:<uuid>]=n|y, @touchud[:<uuid>]=n|y
  55. #endif // RLV_EXPERIMENTAL_CMDS
  56. // ============================================================================
  57. // Defines
  58. //
  59. // Version of the specifcation we support
  60. const S32 RLV_VERSION_MAJOR = 2;
  61. const S32 RLV_VERSION_MINOR = 2;
  62. const S32 RLV_VERSION_PATCH = 0;
  63. const S32 RLV_VERSION_BUILD = 1;
  64. // Implementation version
  65. const S32 RLVa_VERSION_MAJOR = 1;
  66. const S32 RLVa_VERSION_MINOR = 1;
  67. const S32 RLVa_VERSION_PATCH = 3;
  68. const S32 RLVa_VERSION_BUILD = 2;
  69. // Uncomment before a final release
  70. #define RLV_RELEASE
  71. // The official viewer version we're patching against
  72. #define RLV_MAKE_TARGET(x, y, z) ((x << 16) | (y << 8) | z)
  73. #define RLV_TARGET RLV_MAKE_TARGET(1, 23, 5)
  74. // Defining these makes it easier if we ever need to change our tag
  75. #define RLV_WARNS LL_WARNS("RLV")
  76. #define RLV_INFOS LL_INFOS("RLV")
  77. #define RLV_DEBUGS LL_DEBUGS("RLV")
  78. #define RLV_ENDL LL_ENDL
  79. #define RLV_VERIFY(f) if (!(f)) { RlvUtil::notifyFailedAssertion(#f, __FILE__, __LINE__); }
  80. #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
  81. // Turn on extended debugging information
  82. #define RLV_DEBUG
  83. // Make sure we halt execution on errors
  84. #define RLV_ERRS LL_ERRS("RLV")
  85. // Keep our asserts separate from LL's
  86. #define RLV_ASSERT(f) if (!(f)) { RLV_ERRS << "ASSERT (" << #f << ")" << RLV_ENDL; }
  87. #define RLV_ASSERT_DBG(f) RLV_ASSERT(f)
  88. #else
  89. // Don't halt execution on errors in release
  90. #define RLV_ERRS LL_WARNS("RLV")
  91. // We don't want to check assertions in release builds
  92. #ifndef RLV_RELEASE
  93. #define RLV_ASSERT(f) RLV_VERIFY(f)
  94. #define RLV_ASSERT_DBG(f)
  95. #else
  96. #define RLV_ASSERT(f)
  97. #define RLV_ASSERT_DBG(f)
  98. #endif // RLV_RELEASE
  99. #endif // LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
  100. #define RLV_ROOT_FOLDER "#RLV"
  101. #define RLV_CMD_PREFIX '@'
  102. #define RLV_PUTINV_PREFIX "#RLV/~"
  103. #define RLV_SETROT_OFFSET F_PI_BY_TWO // @setrot is off by 90° with the rest of SL
  104. #define RLV_FOLDER_FLAG_NOSTRIP "nostrip"
  105. #define RLV_FOLDER_PREFIX_HIDDEN '.'
  106. #define RLV_FOLDER_PREFIX_PUTINV '~'
  107. // ============================================================================
  108. // Enumeration declarations
  109. //
  110. // NOTE: any changes to this enumeration should be reflected in RlvCommand::initLookupTable()
  111. enum ERlvBehaviour {
  112. RLV_BHVR_DETACH = 0, // "detach"
  113. RLV_BHVR_ATTACH, // "attach"
  114. RLV_BHVR_ADDATTACH, // "addattach"
  115. RLV_BHVR_REMATTACH, // "remattach"
  116. RLV_BHVR_ADDOUTFIT, // "addoutfit"
  117. RLV_BHVR_REMOUTFIT, // "remoutfit"
  118. RLV_BHVR_EMOTE, // "emote"
  119. RLV_BHVR_SENDCHAT, // "sendchat"
  120. RLV_BHVR_RECVCHAT, // "recvchat"
  121. RLV_BHVR_RECVEMOTE, // "recvemote"
  122. RLV_BHVR_REDIRCHAT, // "redirchat"
  123. RLV_BHVR_REDIREMOTE, // "rediremote"
  124. RLV_BHVR_CHATWHISPER, // "chatwhisper"
  125. RLV_BHVR_CHATNORMAL, // "chatnormal"
  126. RLV_BHVR_CHATSHOUT, // "chatshout"
  127. RLV_BHVR_SENDCHANNEL, // "sendchannel"
  128. RLV_BHVR_SENDIM, // "sendim"
  129. RLV_BHVR_RECVIM, // "recvim"
  130. RLV_BHVR_PERMISSIVE, // "permissive"
  131. RLV_BHVR_NOTIFY, // "notify"
  132. RLV_BHVR_SHOWINV, // "showinv"
  133. RLV_BHVR_SHOWMINIMAP, // "showminimap"
  134. RLV_BHVR_SHOWWORLDMAP, // "showworldmap"
  135. RLV_BHVR_SHOWLOC, // "showloc"
  136. RLV_BHVR_SHOWNAMES, // "shownames"
  137. RLV_BHVR_SHOWHOVERTEXT, // "showhovertext"
  138. RLV_BHVR_SHOWHOVERTEXTHUD, // "showhovertexthud"
  139. RLV_BHVR_SHOWHOVERTEXTWORLD, // "showhovertextworld"
  140. RLV_BHVR_SHOWHOVERTEXTALL, // "showhovertextall"
  141. RLV_BHVR_TPLM, // "tplm"
  142. RLV_BHVR_TPLOC, // "tploc"
  143. RLV_BHVR_TPLURE, // "tplure"
  144. RLV_BHVR_VIEWNOTE, // "viewnote"
  145. RLV_BHVR_VIEWSCRIPT, // "viewscript"
  146. RLV_BHVR_VIEWTEXTURE, // "viewtexture"
  147. RLV_BHVR_ACCEPTPERMISSION, // "acceptpermission"
  148. RLV_BHVR_ACCEPTTP, // "accepttp"
  149. RLV_BHVR_ALLOWIDLE, // "allowidle"
  150. RLV_BHVR_EDIT, // "edit"
  151. RLV_BHVR_REZ, // "rez"
  152. RLV_BHVR_FARTOUCH, // "fartouch"
  153. RLV_BHVR_INTERACT, // "interact"
  154. RLV_BHVR_TOUCH, // "touch"
  155. RLV_BHVR_TOUCHATTACH, // "touchattach"
  156. RLV_BHVR_TOUCHHUD, // "touchhud"
  157. RLV_BHVR_TOUCHWORLD, // "touchworld"
  158. RLV_BHVR_FLY, // "fly"
  159. RLV_BHVR_UNSIT, // "unsit"
  160. RLV_BHVR_SIT, // "sit"
  161. RLV_BHVR_SITTP, // "sittp"
  162. RLV_BHVR_STANDTP, // "standtp"
  163. RLV_BHVR_SETDEBUG, // "setdebug"
  164. RLV_BHVR_SETENV, // "setenv"
  165. RLV_BHVR_DETACHME, // "detachme"
  166. RLV_BHVR_ATTACHOVER, // "attachover"
  167. RLV_BHVR_ATTACHTHIS, // "attachthis"
  168. RLV_BHVR_ATTACHTHISOVER, // "attachthisover"
  169. RLV_BHVR_DETACHTHIS, // "detachthis"
  170. RLV_BHVR_ATTACHALL, // "attachall"
  171. RLV_BHVR_ATTACHALLOVER, // "attachallover"
  172. RLV_BHVR_DETACHALL, // "detachall"
  173. RLV_BHVR_ATTACHALLTHIS, // "attachallthis"
  174. RLV_BHVR_ATTACHALLTHISOVER, // "attachallthisover"
  175. RLV_BHVR_DETACHALLTHIS, // "detachallthis"
  176. RLV_BHVR_TPTO, // "tpto"
  177. RLV_BHVR_VERSION, // "version"
  178. RLV_BHVR_VERSIONNEW, // "versionnew"
  179. RLV_BHVR_VERSIONNUM, // "versionnum"
  180. RLV_BHVR_GETATTACH, // "getattach"
  181. RLV_BHVR_GETATTACHNAMES, // "getattachnames"
  182. RLV_BHVR_GETADDATTACHNAMES, // "getaddattachnames"
  183. RLV_BHVR_GETREMATTACHNAMES, // "getremattachnames"
  184. RLV_BHVR_GETOUTFIT, // "getoutfit"
  185. RLV_BHVR_GETOUTFITNAMES, // "getoutfitnames"
  186. RLV_BHVR_GETADDOUTFITNAMES, // "getaddoutfitnames"
  187. RLV_BHVR_GETREMOUTFITNAMES, // "getremoutfitnames"
  188. RLV_BHVR_FINDFOLDER, // "findfolder"
  189. RLV_BHVR_FINDFOLDERS, // "findfolders"
  190. RLV_BHVR_GETPATH, // "getpath"
  191. RLV_BHVR_GETPATHNEW, // "getpathnew"
  192. RLV_BHVR_GETINV, // "getinv"
  193. RLV_BHVR_GETINVWORN, // "getinvworn"
  194. RLV_BHVR_GETSITID, // "getsitid"
  195. RLV_BHVR_GETCOMMAND, // "getcommand"
  196. RLV_BHVR_GETSTATUS, // "getstatus"
  197. RLV_BHVR_GETSTATUSALL, // "getstatusall"
  198. RLV_BHVR_COUNT,
  199. RLV_BHVR_UNKNOWN
  200. };
  201. enum ERlvParamType {
  202. RLV_TYPE_UNKNOWN,
  203. RLV_TYPE_ADD, // <param> == "n"|"add"
  204. RLV_TYPE_REMOVE, // <param> == "y"|"rem"
  205. RLV_TYPE_FORCE, // <param> == "force"
  206. RLV_TYPE_REPLY, // <param> == <number>
  207. RLV_TYPE_CLEAR
  208. };
  209. enum ERlvCmdRet {
  210. RLV_RET_UNKNOWN = 0x0000, // Unknown error (should only be used internally)
  211. RLV_RET_RETAINED, // Command was retained
  212. RLV_RET_SUCCESS = 0x0100, // Command executed succesfully
  213. RLV_RET_SUCCESS_UNSET, // Command executed succesfully (RLV_TYPE_REMOVE for an unrestricted behaviour)
  214. RLV_RET_SUCCESS_DUPLICATE, // Command executed succesfully (RLV_TYPE_ADD for an already restricted behaviour)
  215. RLV_RET_FAILED = 0x0200, // Command failed (general failure)
  216. RLV_RET_FAILED_SYNTAX, // Command failed (syntax error)
  217. RLV_RET_FAILED_OPTION, // Command failed (invalid option)
  218. RLV_RET_FAILED_PARAM, // Command failed (invalid param)
  219. RLV_RET_FAILED_LOCK, // Command failed (command is locked by another object)
  220. RLV_RET_FAILED_DISABLED, // Command failed (command disabled by user)
  221. RLV_RET_FAILED_UNKNOWN, // Command failed (unknown command)
  222. RLV_RET_FAILED_NOSHAREDROOT, // Command failed (missing #RLV)
  223. };
  224. enum ERlvExceptionCheck
  225. {
  226. RLV_CHECK_PERMISSIVE, // Exception can be set by any object
  227. RLV_CHECK_STRICT, // Exception must be set by all objects holding the restriction
  228. RLV_CHECK_DEFAULT // Permissive or strict will be determined by currently enforced restrictions
  229. };
  230. enum ERlvLockMask
  231. {
  232. RLV_LOCK_ADD = 0x01,
  233. RLV_LOCK_REMOVE = 0x02,
  234. RLV_LOCK_ANY = RLV_LOCK_ADD | RLV_LOCK_REMOVE
  235. };
  236. enum ERlvWearMask
  237. {
  238. RLV_WEAR_LOCKED = 0x00, // User can not wear the item at all
  239. RLV_WEAR_ADD = 0x01, // User can wear the item in addition to what's already worn
  240. RLV_WEAR_REPLACE = 0x02, // User can wear the item and replace what's currently worn
  241. RLV_WEAR = 0x03 // Convenience: combines RLV_WEAR_ADD and RLV_WEAR_REPLACE
  242. };
  243. enum ERlvAttachGroupType
  244. {
  245. RLV_ATTACHGROUP_HEAD = 0,
  246. RLV_ATTACHGROUP_TORSO,
  247. RLV_ATTACHGROUP_ARMS,
  248. RLV_ATTACHGROUP_LEGS,
  249. RLV_ATTACHGROUP_HUD,
  250. RLV_ATTACHGROUP_COUNT,
  251. RLV_ATTACHGROUP_INVALID
  252. };
  253. // ============================================================================
  254. // Settings
  255. //
  256. #define RLV_SETTING_MAIN "RestrainedLove"
  257. #define RLV_SETTING_DEBUG "RestrainedLoveDebug"
  258. #define RLV_SETTING_NOSETENV "RestrainedLoveNoSetEnv"
  259. #define RLV_SETTING_FORBIDGIVETORLV "RestrainedLoveForbidGiveToRLV"
  260. #define RLV_SETTING_WEARADDPREFIX "RestrainedLoveStackWhenFolderBeginsWith"
  261. #define RLV_SETTING_WEARREPLACEPREFIX "RestrainedLoveReplaceWhenFolderBeginsWith"
  262. #define RLV_SETTING_DEBUGHIDEUNSETDUP "RLVaDebugHideUnsetDuplicate"
  263. #define RLV_SETTING_ENABLECOMPOSITES "RLVaEnableCompositeFolders"
  264. #define RLV_SETTING_ENABLELEGACYNAMING "RLVaEnableLegacyNaming"
  265. #define RLV_SETTING_ENABLESHAREDWEAR "RLVaEnableSharedWear"
  266. #define RLV_SETTING_HIDELOCKEDLAYER "RLVaHideLockedLayers"
  267. #define RLV_SETTING_HIDELOCKEDATTACH "RLVaHideLockedAttachments"
  268. #define RLV_SETTING_HIDELOCKEDINVENTORY "RLVaHideLockedInventory"
  269. #define RLV_SETTING_LOGINLASTLOCATION "RLVaLoginLastLocation"
  270. #define RLV_SETTING_SHAREDINVAUTORENAME "RLVaSharedInvAutoRename"
  271. #define RLV_SETTING_SHOWNAMETAGS "RLVaShowNameTags"
  272. #define RLV_SETTING_FIRSTUSE_PREFIX "FirstRLV"
  273. #define RLV_SETTING_FIRSTUSE_GIVETORLV RLV_SETTING_FIRSTUSE_PREFIX"GiveToRLV"
  274. // ============================================================================
  275. // Strings
  276. //
  277. #define RLV_STRING_HIDDEN "hidden_generic"
  278. #define RLV_STRING_HIDDEN_PARCEL "hidden_parcel"
  279. #define RLV_STRING_HIDDEN_REGION "hidden_region"
  280. #define RLV_STRING_BLOCKED_RECVIM "blocked_recvim"
  281. #define RLV_STRING_BLOCKED_RECVIM_REMOTE "blocked_recvim_remote"
  282. #define RLV_STRING_BLOCKED_SENDIM "blocked_sendim"
  283. #define RLV_STRING_BLOCKED_VIEWXXX "blocked_viewxxx"
  284. #define RLV_STRING_BLOCKED_TPLURE_REMOTE "blocked_tplure_remote"
  285. // ============================================================================
  286. #endif // RLV_DEFINES_H