VPathObject.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. //-----------------------------------------------------------------------------
  2. // Verve
  3. // Copyright (C) 2014 - Violent Tulip
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to
  7. // deal in the Software without restriction, including without limitation the
  8. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9. // sell copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. // IN THE SOFTWARE.
  22. //-----------------------------------------------------------------------------
  23. #include "VPathObject.h"
  24. #include "VPath.h"
  25. #include "core/stream/bitStream.h"
  26. #include "sim/netConnection.h"
  27. //-----------------------------------------------------------------------------
  28. static U32 gOrientationTypeBits = getBinLog2( getNextPow2( VPathObject::k_OrientationTypeSize ) );
  29. //-----------------------------------------------------------------------------
  30. VPathObject::VPathObject( void ) :
  31. mActive( false ),
  32. mLastTime( 0 ),
  33. mLastDelta( 0.f ),
  34. mObject( NULL ),
  35. mTimeInterp( 0.f ),
  36. mPathInterp( 0.f ),
  37. mPosition( 0.f, 0.f, 0.f ),
  38. mOffset( 0.f, 0.f, 0.f ),
  39. mOrientation( 0.f, 1.f, 0.f ),
  40. mForward( true ),
  41. mSpeed( 10.f ),
  42. mSourceNode( 0 ),
  43. mDestinationNode( 0 ),
  44. mStartNode( 0 ),
  45. mEndNode( 0 )
  46. {
  47. // Init.
  48. mOrientationMode.Type = k_OrientationToPath;
  49. mOrientationMode.Object = NULL;
  50. mOrientationMode.Point = Point3F::Zero;
  51. // Set the initial mask.
  52. mNetState.setMaskBits( k_StateInit );
  53. // Reset Time.
  54. resetTime();
  55. // Reset Delta.
  56. resetDelta();
  57. VECTOR_SET_ASSOCIATION( mNetState );
  58. }
  59. VPathObject::~VPathObject( void )
  60. {
  61. // Void.
  62. }
  63. //-----------------------------------------------------------------------------
  64. //
  65. // Network Methods.
  66. //
  67. //-----------------------------------------------------------------------------
  68. U32 VPathObject::packUpdate( NetConnection *pConnection, BitStream *pStream )
  69. {
  70. // Init Return Mask.
  71. U32 retMask = 0;
  72. // Fetch State.
  73. VNetStateInfo *state = getState( pConnection );
  74. // Write Active.
  75. pStream->writeFlag( mActive );
  76. // Send Object Update?
  77. if ( pStream->writeFlag( state->Mask & k_StateUpdateObject ) )
  78. {
  79. // Successful Send?
  80. bool success = false;
  81. // Valid Object?
  82. if ( !mObject )
  83. {
  84. // No Object.
  85. pStream->writeFlag( false );
  86. }
  87. else
  88. {
  89. // Write Ghost Index.
  90. const S32 ghostIndex = pConnection->getGhostIndex( mObject );
  91. if ( pStream->writeFlag( ghostIndex != -1 ) )
  92. {
  93. // Write Ghost Id.
  94. pStream->writeInt( ghostIndex, NetConnection::GhostIdBitSize );
  95. // Success!
  96. success = true;
  97. // Clear Update.
  98. state->Mask &= ~k_StateUpdateObject;
  99. }
  100. }
  101. if ( !success )
  102. {
  103. // Try Again Later.
  104. retMask |= VPath::ObjectUpdateMask;
  105. }
  106. }
  107. // Send Mount Update?
  108. if ( pStream->writeFlag( state->Mask & k_StateUpdateMount ) )
  109. {
  110. // Successful Send?
  111. bool success = false;
  112. // Valid Objects?
  113. if ( !mObject || !mObject->getObjectMount() || ( state->Mask & k_StateUpdateObject ) )
  114. {
  115. // No Object.
  116. pStream->writeFlag( false );
  117. }
  118. else
  119. {
  120. // Write Ghost Index.
  121. const S32 ghostIndex = pConnection->getGhostIndex( mObject->getObjectMount() );
  122. if ( pStream->writeFlag( ghostIndex != -1 ) )
  123. {
  124. // Write Ghost Id.
  125. pStream->writeInt( ghostIndex, NetConnection::GhostIdBitSize );
  126. // Write Mount Node.
  127. pStream->writeInt( mObject->getMountNode(), SceneObject::NumMountPointBits );
  128. // Success!
  129. success = true;
  130. // Clear Update.
  131. state->Mask &= ~k_StateUpdateMount;
  132. }
  133. }
  134. if ( !success )
  135. {
  136. // Try Again Later.
  137. retMask |= VPath::ObjectUpdateMask;
  138. }
  139. }
  140. // Send Position Update?
  141. if ( pStream->writeFlag( state->Mask & k_StateUpdatePosition ) )
  142. {
  143. // Write Position.
  144. pStream->write( mTimeInterp );
  145. pStream->write( mPathInterp );
  146. pStream->write( mPosition.x );
  147. pStream->write( mPosition.y );
  148. pStream->write( mPosition.z );
  149. pStream->write( mOrientation.x );
  150. pStream->write( mOrientation.y );
  151. pStream->write( mOrientation.z );
  152. pStream->writeInt( mSourceNode, VPath::gMaxNodeBits );
  153. pStream->writeInt( mDestinationNode, VPath::gMaxNodeBits );
  154. // Clear Update.
  155. state->Mask &= ~k_StateUpdatePosition;
  156. }
  157. // Send State Update?
  158. if ( pStream->writeFlag( state->Mask & k_StateUpdateState ) )
  159. {
  160. // Successful Send?
  161. bool success = true;
  162. // Write State.
  163. pStream->writeInt( mOrientationMode.Type, gOrientationTypeBits );
  164. switch ( mOrientationMode.Type )
  165. {
  166. case k_OrientationToObject :
  167. {
  168. // Write Ghost Index.
  169. const S32 ghostIndex = pConnection->getGhostIndex( mOrientationMode.Object );
  170. if ( pStream->writeFlag( ghostIndex != -1 ) )
  171. {
  172. pStream->writeInt( ghostIndex, NetConnection::GhostIdBitSize );
  173. }
  174. else
  175. {
  176. // Failed.
  177. success = false;
  178. }
  179. } break;
  180. case k_OrientationToPoint :
  181. {
  182. // Write Point.
  183. pStream->write( mOrientationMode.Point.x );
  184. pStream->write( mOrientationMode.Point.y );
  185. pStream->write( mOrientationMode.Point.z );
  186. } break;
  187. }
  188. pStream->writeFlag( mForward );
  189. pStream->write( mSpeed );
  190. // Write Offset.
  191. pStream->write( mOffset.x );
  192. pStream->write( mOffset.y );
  193. pStream->write( mOffset.z );
  194. pStream->writeInt( mStartNode, VPath::gMaxNodeBits );
  195. pStream->writeInt( mEndNode, VPath::gMaxNodeBits );
  196. if ( success )
  197. {
  198. // Clear Update.
  199. state->Mask &= ~k_StateUpdateState;
  200. }
  201. else
  202. {
  203. // Try Again Later.
  204. retMask |= VPath::ObjectUpdateMask;
  205. }
  206. }
  207. // Return Mask.
  208. return retMask;
  209. }
  210. void VPathObject::unpackUpdate( NetConnection *pConnection, BitStream *pStream )
  211. {
  212. // Read Active.
  213. setActive( pStream->readFlag() );
  214. // Update Object?
  215. if ( pStream->readFlag() )
  216. {
  217. if ( pStream->readFlag() )
  218. {
  219. // Read Ghost Index.
  220. const S32 ghostIndex = pStream->readInt( NetConnection::GhostIdBitSize );
  221. // Resolve Object.
  222. setObject( static_cast<SceneObject*>( pConnection->resolveGhost( ghostIndex ) ) );
  223. // Reset Delta.
  224. resetDelta();
  225. }
  226. else
  227. {
  228. // Clear Object.
  229. mObject = NULL;
  230. }
  231. }
  232. // Update Mount?
  233. if ( pStream->readFlag() )
  234. {
  235. if ( pStream->readFlag() )
  236. {
  237. // Read Ghost Index.
  238. const S32 ghostIndex = pStream->readInt( NetConnection::GhostIdBitSize );
  239. // Read Mount Node.
  240. const S32 nodeIndex = pStream->readInt( SceneObject::NumMountPointBits );
  241. // Resolve Object.
  242. SceneObject *mountObject = static_cast<SceneObject*>( pConnection->resolveGhost( ghostIndex ) );
  243. // Mount Object.
  244. mountObject->mountObject( mObject, nodeIndex );
  245. }
  246. else
  247. {
  248. // ... unmount?
  249. }
  250. }
  251. // Update Position?
  252. if ( pStream->readFlag() )
  253. {
  254. // Read Updates.
  255. pStream->read( &mTimeInterp );
  256. pStream->read( &mPathInterp );
  257. pStream->read( &mPosition.x );
  258. pStream->read( &mPosition.y );
  259. pStream->read( &mPosition.z );
  260. pStream->read( &mOrientation.x );
  261. pStream->read( &mOrientation.y );
  262. pStream->read( &mOrientation.z );
  263. mSourceNode = pStream->readInt( VPath::gMaxNodeBits );
  264. mDestinationNode = pStream->readInt( VPath::gMaxNodeBits );
  265. }
  266. // Update Heading?
  267. if ( pStream->readFlag() )
  268. {
  269. // Read Orientation Mode.
  270. mOrientationMode.Type = ( eOrientationType )pStream->readInt( gOrientationTypeBits );
  271. switch ( mOrientationMode.Type )
  272. {
  273. case VPathObject::k_OrientationToObject :
  274. {
  275. if ( pStream->readFlag() )
  276. {
  277. // Read Ghost Index.
  278. const S32 ghostIndex = pStream->readInt( NetConnection::GhostIdBitSize );
  279. // Resolve Object.
  280. mOrientationMode.Object = static_cast<SceneObject*>( pConnection->resolveGhost( ghostIndex ) );
  281. }
  282. } break;
  283. case VPathObject::k_OrientationToPoint :
  284. {
  285. // Read Point.
  286. pStream->read( &mOrientationMode.Point.x );
  287. pStream->read( &mOrientationMode.Point.y );
  288. pStream->read( &mOrientationMode.Point.z );
  289. } break;
  290. }
  291. // Read Updates.
  292. mForward = pStream->readFlag();
  293. pStream->read( &mSpeed );
  294. pStream->read( &mOffset.x );
  295. pStream->read( &mOffset.y );
  296. pStream->read( &mOffset.z );
  297. mStartNode = pStream->readInt( VPath::gMaxNodeBits );
  298. mEndNode = pStream->readInt( VPath::gMaxNodeBits );
  299. }
  300. }
  301. //-----------------------------------------------------------------------------
  302. //
  303. // Property Methods.
  304. //
  305. //-----------------------------------------------------------------------------
  306. Point3F VPathObject::getWorldPosition( void )
  307. {
  308. return ( mPosition + mOffset );
  309. }
  310. Point3F VPathObject::getRenderWorldPosition( const F32 &pDelta )
  311. {
  312. return ( getPositionDelta( pDelta ) + mOffset );
  313. }
  314. MatrixF VPathObject::getTransform( void )
  315. {
  316. MatrixF mat( true );
  317. switch ( mOrientationMode.Type )
  318. {
  319. case k_OrientationInterpolate :
  320. case k_OrientationToObject :
  321. case k_OrientationToPoint :
  322. case k_OrientationToPath :
  323. {
  324. // Y-Axis.
  325. VectorF yVec = mOrientation;
  326. yVec.normalize();
  327. // X-Axis.
  328. VectorF xVec = mCross( yVec, VPath::gBezierUp );
  329. xVec.normalize();
  330. // Z-Axis.
  331. VectorF zVec = mCross( xVec, yVec );
  332. zVec.normalize();
  333. // Setup Object Transform.
  334. mat.setColumn( 0, xVec );
  335. mat.setColumn( 1, yVec );
  336. mat.setColumn( 2, zVec );
  337. mat.setColumn( 3, getWorldPosition() );
  338. } break;
  339. case k_OrientationFree :
  340. {
  341. // Fetch Current Transform.
  342. mat = mObject->getTransform();
  343. mat.setPosition( getWorldPosition() );
  344. } break;
  345. }
  346. // Return.
  347. return mat;
  348. }
  349. MatrixF VPathObject::getRenderTransform( const F32 &pDelta )
  350. {
  351. MatrixF mat( true );
  352. switch ( mOrientationMode.Type )
  353. {
  354. case k_OrientationInterpolate :
  355. case k_OrientationToObject :
  356. case k_OrientationToPoint :
  357. case k_OrientationToPath :
  358. {
  359. // Y-Axis.
  360. VectorF yVec = getOrientationDelta( pDelta );
  361. yVec.normalize();
  362. // X-Axis.
  363. VectorF xVec = mCross( yVec, VPath::gBezierUp );
  364. xVec.normalize();
  365. // Z-Axis.
  366. VectorF zVec = mCross( xVec, yVec );
  367. zVec.normalize();
  368. // Setup Object Transform.
  369. mat.setColumn( 0, xVec );
  370. mat.setColumn( 1, yVec );
  371. mat.setColumn( 2, zVec );
  372. mat.setColumn( 3, getRenderWorldPosition( pDelta ) );
  373. } break;
  374. case k_OrientationFree :
  375. {
  376. // Fetch Current Transform.
  377. mat = mObject->getRenderTransform();
  378. mat.setPosition( getRenderWorldPosition( pDelta ) );
  379. } break;
  380. }
  381. // Return.
  382. return mat;
  383. }
  384. void VPathObject::setActive( const bool &pActive )
  385. {
  386. // Update?
  387. if ( pActive != mActive )
  388. {
  389. // Apply.
  390. mActive = pActive;
  391. // Flag Update.
  392. setMaskBits( k_StateUpdatePosition );
  393. }
  394. }
  395. void VPathObject::setObject( SceneObject *pObject )
  396. {
  397. // Update?
  398. if ( pObject != mObject )
  399. {
  400. // Apply.
  401. mObject = pObject;
  402. // Flag Update.
  403. setMaskBits( k_StateUpdateObject );
  404. }
  405. }
  406. void VPathObject::setTimeInterp( const F32 &pInterp )
  407. {
  408. // Update?
  409. if ( mTimeInterp != pInterp )
  410. {
  411. // Apply.
  412. mTimeInterp = pInterp;
  413. // Flag Update.
  414. setMaskBits( k_StateUpdatePosition );
  415. }
  416. }
  417. void VPathObject::setPathInterp( const F32 &pInterp )
  418. {
  419. // Update?
  420. if ( mPathInterp != pInterp )
  421. {
  422. // Apply.
  423. mPathInterp = pInterp;
  424. // Flag Update.
  425. setMaskBits( k_StateUpdatePosition );
  426. }
  427. }
  428. void VPathObject::setPosition( const Point3F &pPosition )
  429. {
  430. // Update?
  431. if ( mPosition != pPosition )
  432. {
  433. // Update.
  434. mPosition = pPosition;
  435. // Flag Update.
  436. setMaskBits( k_StateUpdatePosition );
  437. }
  438. }
  439. void VPathObject::setOffset( const Point3F &pOffset )
  440. {
  441. // Update?
  442. if ( mOffset != pOffset )
  443. {
  444. // Update.
  445. mOffset = pOffset;
  446. // Flag Update.
  447. setMaskBits( k_StateUpdateState );
  448. }
  449. }
  450. void VPathObject::setOrientation( const VectorF &pOrientation )
  451. {
  452. // Update?
  453. if ( mOrientation != pOrientation )
  454. {
  455. // Update.
  456. mOrientation = pOrientation;
  457. // Flag Update.
  458. setMaskBits( k_StateUpdatePosition );
  459. }
  460. }
  461. void VPathObject::setOrientationMode( const eOrientationType &pType )
  462. {
  463. // Update?
  464. if ( mOrientationMode.Type != pType )
  465. {
  466. // Update.
  467. mOrientationMode.Type = pType;
  468. // Flag Update.
  469. setMaskBits( k_StateUpdateState );
  470. }
  471. }
  472. void VPathObject::setOrientationMode( const eOrientationType &pType, SceneObject *pObject )
  473. {
  474. AssertFatal( ( pType == k_OrientationToObject ) && ( pObject != NULL ), "VPathObject::setOrientationMode() - Invalid mOrientation Type." );
  475. // Update?
  476. if ( ( mOrientationMode.Type != pType ) || ( mOrientationMode.Object != pObject ) )
  477. {
  478. // Update.
  479. mOrientationMode.Type = pType;
  480. mOrientationMode.Object = pObject;
  481. // Flag Update.
  482. setMaskBits( k_StateUpdateState );
  483. }
  484. }
  485. void VPathObject::setOrientationMode( const eOrientationType &pType, const Point3F &pPoint )
  486. {
  487. AssertFatal( pType == k_OrientationToPoint, "VPathObject::setOrientationMode() - Invalid mOrientation Type." );
  488. // Update?
  489. if ( ( mOrientationMode.Type != pType ) || ( mOrientationMode.Point != pPoint ) )
  490. {
  491. // Update.
  492. mOrientationMode.Type = pType;
  493. mOrientationMode.Point = pPoint;
  494. // Flag Update.
  495. setMaskBits( k_StateUpdateState );
  496. }
  497. }
  498. void VPathObject::setForward( const bool &pForward )
  499. {
  500. // Update?
  501. if ( mForward != pForward )
  502. {
  503. // Update.
  504. mForward = pForward;
  505. // Flag Update.
  506. setMaskBits( k_StateUpdateState );
  507. }
  508. }
  509. void VPathObject::setSpeed( const F32 &pSpeed )
  510. {
  511. // Update?
  512. if ( mSpeed != pSpeed )
  513. {
  514. // Update.
  515. mSpeed = pSpeed;
  516. // Flag Update.
  517. setMaskBits( k_StateUpdateState );
  518. }
  519. }
  520. void VPathObject::setNode( const S32 &pSourceNodeIndex, const S32 &pDestinationNodeIndex )
  521. {
  522. // Update?
  523. if ( ( mSourceNode != pSourceNodeIndex ) || ( mDestinationNode != pDestinationNodeIndex ) )
  524. {
  525. // Update.
  526. mSourceNode = pSourceNodeIndex;
  527. mDestinationNode = pDestinationNodeIndex;
  528. // Flag Update.
  529. setMaskBits( k_StateUpdatePosition );
  530. }
  531. }
  532. void VPathObject::setStartNode( const S32 &pNodeIndex )
  533. {
  534. // Update?
  535. if ( mStartNode != pNodeIndex )
  536. {
  537. // Update.
  538. mStartNode = pNodeIndex;
  539. // Flag Update.
  540. setMaskBits( k_StateUpdateState );
  541. }
  542. }
  543. void VPathObject::setEndNode( const S32 &pNodeIndex )
  544. {
  545. // Update?
  546. if ( mEndNode != pNodeIndex )
  547. {
  548. // Update.
  549. mEndNode = pNodeIndex;
  550. // Flag Update.
  551. setMaskBits( k_StateUpdateState );
  552. }
  553. }
  554. //-----------------------------------------------------------------------------
  555. //
  556. // Delta Methods.
  557. //
  558. //-----------------------------------------------------------------------------
  559. void VPathObject::resetDelta( void )
  560. {
  561. mDelta.Position[0] = mPosition;
  562. mDelta.Position[1] = mPosition;
  563. mDelta.Orientation[0] = mOrientation;
  564. mDelta.Orientation[1] = mOrientation;
  565. }
  566. void VPathObject::resetDelta( const Point3F &pPosition, const VectorF &pOrientation )
  567. {
  568. mDelta.Position[0] = pPosition;
  569. mDelta.Position[1] = pPosition;
  570. mDelta.Orientation[0] = pOrientation;
  571. mDelta.Orientation[1] = pOrientation;
  572. }
  573. void VPathObject::popDelta( void )
  574. {
  575. mDelta.Position[0] = mDelta.Position[1];
  576. mDelta.Orientation[0] = mDelta.Orientation[1];
  577. }
  578. void VPathObject::pushDelta( const Point3F &pPosition, const VectorF &pOrientation )
  579. {
  580. mDelta.Position[1] = pPosition;
  581. mDelta.Orientation[1] = pOrientation;
  582. }
  583. Point3F VPathObject::getPositionDelta( const F32 &pInterp )
  584. {
  585. Point3F interpPosition;
  586. interpPosition.interpolate( mDelta.Position[1], mDelta.Position[0], pInterp );
  587. return interpPosition;
  588. }
  589. VectorF VPathObject::getOrientationDelta( const F32 &pInterp )
  590. {
  591. VectorF interpOrientation;
  592. interpOrientation.interpolate( mDelta.Orientation[1], mDelta.Orientation[0], pInterp );
  593. interpOrientation.normalize();
  594. return interpOrientation;
  595. }
  596. //-----------------------------------------------------------------------------
  597. //
  598. // Enumeration Methods.
  599. //
  600. //-----------------------------------------------------------------------------
  601. // Implement the Orientation Type enum list.
  602. ImplementEnumType( VPathObjectOrientationType, "" )
  603. { VPathObject::k_OrientationFree, "FREE" },
  604. { VPathObject::k_OrientationInterpolate, "INTERPOLATE" },
  605. { VPathObject::k_OrientationToPath, "TOPATH" },
  606. { VPathObject::k_OrientationToObject, "TOOBJECT" },
  607. { VPathObject::k_OrientationToPoint, "TOPOINT" },
  608. EndImplementEnumType;
  609. VPathObject::eOrientationType VPathObject::getOrientationTypeEnum( const char *pLabel )
  610. {
  611. VPathObject::eOrientationType out;
  612. if ( !castConsoleTypeFromString( out, pLabel ) )
  613. {
  614. // Bah!
  615. return VPathObject::k_OrientationFree;
  616. }
  617. // Return.
  618. return out;
  619. }
  620. StringTableEntry VPathObject::getOrientationTypeLabel( const eOrientationType &pType )
  621. {
  622. // Return.
  623. return castConsoleTypeToString( pType );
  624. }