shapeBase.h
Classes:
class
class
An image mounted on a shapebase.
class
Represent the state of a specific particle emitter on the image.
class
class
class
class
class
Public Typedefs
void *
Light
ShapeBaseImageLightType
ShapeBaseImageLoadedState
ShapeBaseImageRecoilState
ShapeBaseImageSpinState
Public Functions
Detailed Description
Public Typedefs
typedef void * Light
typedef ShapeBaseImageData::LightType ShapeBaseImageLightType
typedef ShapeBaseImageData::StateData::LoadedState ShapeBaseImageLoadedState
typedef ShapeBaseImageData::StateData::RecoilState ShapeBaseImageRecoilState
typedef ShapeBaseImageData::StateData::SpinState ShapeBaseImageSpinState
Public Functions
collisionFilter(SceneObject * object, S32 key)
defaultFilter(SceneObject * object, S32 key)
DefineEnumType(ShapeBaseImageLightType )
DefineEnumType(ShapeBaseImageLoadedState )
DefineEnumType(ShapeBaseImageRecoilState )
DefineEnumType(ShapeBaseImageSpinState )
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 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 24#ifndef _SHAPEBASE_H_ 25#define _SHAPEBASE_H_ 26 27#ifndef __RESOURCE_H__ 28 #include "core/resource.h" 29#endif 30#ifndef _GAMEBASE_H_ 31 #include "T3D/gameBase/gameBase.h" 32#endif 33#ifndef _MOVEMANAGER_H_ 34 #include "T3D/gameBase/moveManager.h" 35#endif 36#ifndef _COLOR_H_ 37 #include "core/color.h" 38#endif 39#ifndef _CONVEX_H_ 40 #include "collision/convex.h" 41#endif 42#ifndef _SCENERENDERSTATE_H_ 43 #include "scene/sceneRenderState.h" 44#endif 45#ifndef _NETSTRINGTABLE_H_ 46 #include "sim/netStringTable.h" 47#endif 48#ifndef _RENDERPASSMANAGER_H_ 49 #include "renderInstance/renderPassManager.h" 50#endif 51#ifndef _TSSHAPE_H_ 52 #include "ts/tsShape.h" 53#endif 54#ifndef _BITVECTOR_H_ 55 #include "core/bitVector.h" 56#endif 57#ifndef _LIGHTINFO_H_ 58 #include "lighting/lightInfo.h" 59#endif 60#ifndef _REFLECTOR_H_ 61 #include "scene/reflector.h" 62#endif 63#ifndef _DYNAMIC_CONSOLETYPES_H_ 64 #include "console/dynamicTypes.h" 65#endif 66 67// Need full definition visible for SimObjectPtr<ParticleEmitter> 68#include "T3D/fx/particleEmitter.h" 69 70class GFXCubemap; 71class TSShapeInstance; 72class SceneRenderState; 73class TSThread; 74class GameConnection; 75struct CameraScopeQuery; 76class ProjectileData; 77class ExplosionData; 78struct DebrisData; 79class ShapeBase; 80class SFXSource; 81class SFXTrack; 82class SFXProfile; 83 84typedef void* Light; 85 86 87//-------------------------------------------------------------------------- 88 89extern void collisionFilter(SceneObject* object,S32 key); 90extern void defaultFilter(SceneObject* object,S32 key); 91 92 93//-------------------------------------------------------------------------- 94class ShapeBaseConvex : public Convex 95{ 96 typedef Convex Parent; 97 friend class ShapeBase; 98 friend class Vehicle; 99 friend class RigidShape; 100 101 protected: 102 ShapeBase* pShapeBase; 103 MatrixF* nodeTransform; 104 105 public: 106 MatrixF* transform; 107 U32 hullId; 108 Box3F box; 109 110 public: 111 ShapeBaseConvex() { mType = ShapeBaseConvexType; nodeTransform = 0; } 112 ShapeBaseConvex(const ShapeBaseConvex& cv) { 113 mObject = cv.mObject; 114 pShapeBase = cv.pShapeBase; 115 hullId = cv.hullId; 116 nodeTransform = cv.nodeTransform; 117 box = cv.box; 118 transform = 0; 119 } 120 121 void findNodeTransform(); 122 const MatrixF& getTransform() const; 123 Box3F getBoundingBox() const; 124 Box3F getBoundingBox(const MatrixF& mat, const Point3F& scale) const; 125 Point3F support(const VectorF& v) const; 126 void getFeatures(const MatrixF& mat,const VectorF& n, ConvexFeature* cf); 127 void getPolyList(AbstractPolyList* list); 128}; 129 130//-------------------------------------------------------------------------- 131 132struct ShapeBaseImageData: public GameBaseData { 133 private: 134 typedef GameBaseData Parent; 135 136 public: 137 enum Constants { 138 MaxStates = 31, ///< We get one less than state bits because of 139 /// the way data is packed. 140 141 MaxShapes = 2, ///< The number of allowed shapes per image. Only 142 /// the first shape is required. 143 144 MaxGenericTriggers = 4, ///< The number of generic triggers for the image. 145 146 StandardImageShape = 0, ///< Shape index used for the standard image shape 147 FirstPersonImageShape = 1, ///< Shape index used for the optional first person image shape 148 149 NumStateBits = 5, 150 }; 151 enum LightType { 152 NoLight = 0, 153 ConstantLight, 154 SpotLight, 155 PulsingLight, 156 WeaponFireLight, 157 NumLightTypes 158 }; 159 struct StateData { 160 StateData(); 161 const char* name; ///< State name 162 163 /// @name Transition states 164 /// 165 /// @{ 166 167 /// 168 struct Transition { 169 S32 loaded[2]; ///< NotLoaded/Loaded 170 S32 ammo[2]; ///< Noammo/ammo 171 S32 target[2]; ///< target/noTarget 172 S32 trigger[2]; ///< Trigger up/down 173 S32 altTrigger[2]; ///< Second trigger up/down 174 S32 wet[2]; ///< wet/notWet 175 S32 motion[2]; ///< NoMotion/Motion 176 S32 timeout; ///< Transition after delay 177 S32 genericTrigger[ShapeBaseImageData::MaxGenericTriggers][2]; ///< Generic trigger Out/In 178 } transition; 179 bool ignoreLoadedForReady; 180 181 /// @} 182 183 /// @name State attributes 184 /// @{ 185 186 bool fire; ///< Can only have one fire state 187 bool altFire; ///< Can only have one alternate fire state 188 bool reload; ///< Can only have one reload state 189 bool ejectShell; ///< Should we eject a shell casing in this state? 190 bool allowImageChange; ///< Can we switch to another image while in this state? 191 /// 192 /// For instance, if we have a rocket launcher, the player 193 /// shouldn't be able to switch out <i>while</i> firing. So, 194 /// you'd set allowImageChange to false in firing states, and 195 /// true the rest of the time. 196 bool scaleAnimation; ///< Scale animation to fit the state timeout 197 bool scaleAnimationFP; ///< Scale animation to fit the state timeout while in first person 198 bool direction; ///< Animation direction 199 bool sequenceTransitionIn; ///< Do we transition to the state's sequence when we enter the state? 200 bool sequenceTransitionOut; ///< Do we transition to the new state's sequence when we leave the state? 201 bool sequenceNeverTransition; ///< Never allow a transition to this sequence. Often used for a fire sequence. 202 F32 sequenceTransitionTime; ///< The time to transition in or out of a sequence. 203 bool waitForTimeout; ///< Require the timeout to pass before advancing to the next 204 /// state. 205 F32 timeoutValue; ///< A timeout value; the effect of this value is determined 206 /// by the flags scaleAnimation and waitForTimeout 207 F32 energyDrain; ///< Sets the energy drain rate per second of this state. 208 /// 209 /// Energy is drained at energyDrain units/sec as long as 210 /// we are in this state. 211 enum LoadedState { 212 IgnoreLoaded, ///< Don't change loaded state. 213 Loaded, ///< Set us as loaded. 214 NotLoaded, ///< Set us as not loaded. 215 NumLoadedBits = 3 ///< How many bits to allocate to representing this state. (3 states needs 2 bits) 216 } loaded; ///< Is the image considered loaded? 217 enum SpinState { 218 IgnoreSpin, ///< Don't change spin state. 219 NoSpin, ///< Mark us as having no spin (ie, stop spinning). 220 SpinUp, ///< Mark us as spinning up. 221 SpinDown, ///< Mark us as spinning down. 222 FullSpin, ///< Mark us as being at full spin. 223 NumSpinBits = 3 ///< How many bits to allocate to representing this state. (5 states needs 3 bits) 224 } spin; ///< Spin thread state. (Used to control spinning weapons, e.g. chainguns) 225 enum RecoilState { 226 NoRecoil, 227 LightRecoil, 228 MediumRecoil, 229 HeavyRecoil, 230 NumRecoilBits = 3 231 } recoil; ///< Recoil thread state. 232 /// 233 /// @note At this point, the only check being done is to see if we're in a 234 /// state which isn't NoRecoil; ie, no differentiation is made between 235 /// Light/Medium/Heavy recoils. Player::onImageRecoil() is the place 236 /// where this is handled. 237 bool flashSequence[MaxShapes];///< Is this a muzzle flash sequence? 238 /// 239 /// A muzzle flash sequence is used as a source to randomly display frames from, 240 /// so if this is a flashSequence, we'll display a random piece each frame. 241 S32 sequence[MaxShapes]; ///< Main thread sequence ID. 242 /// 243 /// 244 S32 sequenceVis[MaxShapes]; ///< Visibility thread sequence. 245 246 StringTableEntry shapeSequence; ///< Sequence that is played on mounting shape 247 bool shapeSequenceScale; ///< Should the mounting shape's sequence playback be scaled 248 /// to the length of the state. 249 250 const char* script; ///< Function on datablock to call when we enter this state; passed the id of 251 /// the imageSlot. 252 ParticleEmitterData* emitter; ///< A particle emitter; this emitter will emit as long as the gun is in this 253 /// this state. 254 SFXTrack* sound; 255 F32 emitterTime; ///< 256 S32 emitterNode[MaxShapes]; ///< Node ID on the shape to emit from 257 }; 258 259 /// @name State Data 260 /// Individual state data used to initialize struct array 261 /// @{ 262 const char* fireStateName; 263 264 const char* stateName [MaxStates]; 265 266 const char* stateTransitionLoaded [MaxStates]; 267 const char* stateTransitionNotLoaded [MaxStates]; 268 const char* stateTransitionAmmo [MaxStates]; 269 const char* stateTransitionNoAmmo [MaxStates]; 270 const char* stateTransitionTarget [MaxStates]; 271 const char* stateTransitionNoTarget [MaxStates]; 272 const char* stateTransitionWet [MaxStates]; 273 const char* stateTransitionNotWet [MaxStates]; 274 const char* stateTransitionMotion [MaxStates]; 275 const char* stateTransitionNoMotion [MaxStates]; 276 const char* stateTransitionTriggerUp [MaxStates]; 277 const char* stateTransitionTriggerDown [MaxStates]; 278 const char* stateTransitionAltTriggerUp[MaxStates]; 279 const char* stateTransitionAltTriggerDown[MaxStates]; 280 const char* stateTransitionGeneric0In [MaxStates]; 281 const char* stateTransitionGeneric0Out [MaxStates]; 282 const char* stateTransitionGeneric1In [MaxStates]; 283 const char* stateTransitionGeneric1Out [MaxStates]; 284 const char* stateTransitionGeneric2In [MaxStates]; 285 const char* stateTransitionGeneric2Out [MaxStates]; 286 const char* stateTransitionGeneric3In [MaxStates]; 287 const char* stateTransitionGeneric3Out [MaxStates]; 288 const char* stateTransitionTimeout [MaxStates]; 289 F32 stateTimeoutValue [MaxStates]; 290 bool stateWaitForTimeout [MaxStates]; 291 292 bool stateFire [MaxStates]; 293 bool stateAlternateFire [MaxStates]; 294 bool stateReload [MaxStates]; 295 bool stateEjectShell [MaxStates]; 296 F32 stateEnergyDrain [MaxStates]; 297 bool stateAllowImageChange [MaxStates]; 298 bool stateScaleAnimation [MaxStates]; 299 bool stateScaleAnimationFP [MaxStates]; 300 bool stateSequenceTransitionIn [MaxStates]; 301 bool stateSequenceTransitionOut [MaxStates]; 302 bool stateSequenceNeverTransition [MaxStates]; 303 F32 stateSequenceTransitionTime [MaxStates]; 304 bool stateDirection [MaxStates]; 305 StateData::LoadedState stateLoaded [MaxStates]; 306 StateData::SpinState stateSpin [MaxStates]; 307 StateData::RecoilState stateRecoil [MaxStates]; 308 const char* stateSequence [MaxStates]; 309 bool stateSequenceRandomFlash [MaxStates]; 310 311 const char* stateShapeSequence [MaxStates]; 312 bool stateScaleShapeSequence [MaxStates]; 313 314 bool stateIgnoreLoadedForReady [MaxStates]; 315 316 SFXTrack* stateSound [MaxStates]; 317 const char* stateScript [MaxStates]; 318 319 ParticleEmitterData* stateEmitter [MaxStates]; 320 F32 stateEmitterTime [MaxStates]; 321 const char* stateEmitterNode [MaxStates]; 322 /// @} 323 324 /// @name Camera Shake ( while firing ) 325 /// @{ 326 bool shakeCamera; 327 VectorF camShakeFreq; 328 VectorF camShakeAmp; 329 F32 camShakeDuration; 330 F32 camShakeRadius; 331 F32 camShakeFalloff; 332 /// @} 333 334 /// Maximum number of sounds this image can play at a time. 335 /// Any value <= 0 indicates that it can play an infinite number of sounds. 336 S32 maxConcurrentSounds; 337 338 /// If true it we will allow multiple timeout transitions to occur within 339 /// a single tick ( eg. they have a very small timeout ). 340 bool useRemainderDT; 341 342 // 343 bool emap; ///< Environment mapping on? 344 bool correctMuzzleVector; ///< Adjust 1st person firing vector to eye's LOS point? 345 bool correctMuzzleVectorTP; ///< Adjust 3rd person firing vector to camera's LOS point? 346 bool firstPerson; ///< Render the image when in first person? 347 bool useFirstPersonShape; ///< Indicates the special first person shape should be used (true when shapeNameFP and useEyeOffset are defined) 348 bool useEyeOffset; ///< In first person, should we use the eyeTransform? 349 bool useEyeNode; ///< In first person, should we attach the camera to the image's eye node? Player still ultimately decides on what to do, 350 /// especially for multiple mounted images. 351 352 bool animateAllShapes; ///< Indicates that all shapes should be animated in sync. 353 bool animateOnServer; ///< Indicates that the image should be animated on the server. In most cases 354 /// you'll want this set if you're using useEyeNode. You may also want to 355 /// set this if the muzzlePoint is animated while it shoots. You can set this 356 /// to false even if these previous cases are true if the image's shape is set 357 /// up in the correct position and orientation in the 'root' pose and none of 358 /// the nodes are animated at key times, such as the muzzlePoint essentially 359 /// remaining at the same position at the start of the fire state (it could 360 /// animate just fine after the projectile is away as the muzzle vector is only 361 /// calculated at the start of the state). You'll also want to set this to true 362 /// if you're animating the camera using an image's 'eye' node -- unless the movement 363 /// is very subtle and doesn't need to be reflected on the server. 364 365 F32 scriptAnimTransitionTime; ///< The amount of time to transition between the previous sequence and new sequence 366 ///< when the script prefix has changed. 367 368 StringTableEntry shapeName; ///< Name of shape to render. 369 StringTableEntry shapeNameFP; ///< Name of shape to render in first person (optional). 370 371 StringTableEntry imageAnimPrefix; ///< Passed along to the mounting shape to modify 372 /// animation sequences played in 3rd person. [optional] 373 StringTableEntry imageAnimPrefixFP; ///< Passed along to the mounting shape to modify 374 /// animation sequences played in first person. [optional] 375 376 U32 mountPoint; ///< Mount point for the image. 377 MatrixF mountOffset; ///< Mount point offset, so we know where the image is. 378 MatrixF eyeOffset; ///< Offset from eye for first person. 379 380 ProjectileData* projectile; ///< Information about what projectile this 381 /// image fires. 382 383 F32 mass; ///< Mass! 384 bool usesEnergy; ///< Does this use energy instead of ammo? 385 F32 minEnergy; ///< Minimum energy for the weapon to be operable. 386 bool accuFire; ///< Should we automatically make image's aim converge with the crosshair? 387 bool cloakable; ///< Is this image cloakable when mounted? 388 389 /// @name Lighting 390 /// @{ 391 S32 lightType; ///< Indicates the type of the light. 392 /// 393 /// One of: ConstantLight, PulsingLight, WeaponFireLight. 394 ColorF lightColor; 395 S32 lightDuration; ///< The duration in SimTime of Pulsing or WeaponFire type lights. 396 F32 lightRadius; ///< Extent of light. 397 F32 lightBrightness; ///< Brightness of the light ( if it is WeaponFireLight ). 398 /// @} 399 400 /// @name Shape Data 401 /// @{ 402 Resource<TSShape> shape[MaxShapes]; ///< Shape handle 403 bool shapeIsValid[MaxShapes]; ///< Indicates that the shape has been loaded and is valid 404 405 U32 mCRC[MaxShapes]; ///< Checksum of shape. 406 /// 407 /// Calculated by the ResourceManager, see 408 /// ResourceManager::load(). 409 bool computeCRC; ///< Should the shape's CRC be checked? 410 MatrixF mountTransform[MaxShapes]; ///< Transformation to get to the mountNode. 411 /// @} 412 413 /// @name Nodes 414 /// @{ 415 S32 retractNode[MaxShapes]; ///< Retraction node ID. 416 /// 417 /// When the player bumps against an object and the image is retracted to 418 /// avoid having it interpenetrating the object, it is retracted towards 419 /// this node. 420 S32 muzzleNode[MaxShapes]; ///< Muzzle node ID. 421 /// 422 /// 423 S32 ejectNode[MaxShapes]; ///< Ejection node ID. 424 /// 425 /// The eject node is the node on the image from which shells are ejected. 426 S32 emitterNode[MaxShapes]; ///< Emitter node ID. 427 /// 428 /// The emitter node is the node from which particles are emitted. 429 S32 eyeMountNode[MaxShapes]; ///< eyeMount node ID. Optionally used to mount an image to the player's 430 /// eye node for first person. 431 S32 eyeNode[MaxShapes]; ///< Eye node ID. Optionally used to attach the camera to for camera motion 432 /// control from the image. 433 /// @} 434 435 /// @name Animation 436 /// @{ 437 S32 spinSequence[MaxShapes]; ///< ID of the spin animation sequence. 438 S32 ambientSequence[MaxShapes]; ///< ID of the ambient animation sequence. 439 440 bool isAnimated[MaxShapes]; ///< This image contains at least one animated states 441 bool hasFlash[MaxShapes]; ///< This image contains at least one muzzle flash animation state 442 S32 fireState; ///< The ID of the fire state. 443 S32 altFireState; ///< The ID of the alternate fire state. 444 S32 reloadState; ///< The ID of the reload state 445 /// @} 446 447 /// @name Shell casing data 448 /// @{ 449 DebrisData * casing; ///< Information about shell casings. 450 451 S32 casingID; ///< ID of casing datablock. 452 /// 453 /// When the network tells the client about the casing, it 454 /// it transmits the ID of the datablock. The datablocks 455 /// having previously been transmitted, all the client 456 /// needs to do is call Sim::findObject() and look up the 457 /// the datablock. 458 459 Point3F shellExitDir; ///< Vector along which to eject shells from the image. 460 F32 shellExitVariance; ///< Variance from this vector in degrees. 461 F32 shellVelocity; ///< Velocity with which to eject shell casings. 462 /// @} 463 464 /// @name State Array 465 /// 466 /// State array is initialized onAdd from the individual state 467 /// struct array elements. 468 /// 469 /// @{ 470 StateData state[MaxStates]; ///< Array of states. 471 bool statesLoaded; ///< Are the states loaded yet? 472 /// @} 473 474 /// @name Infrastructure 475 /// 476 /// Miscellaneous inherited methods. 477 /// @{ 478 479 DECLARE_CONOBJECT(ShapeBaseImageData); 480 ShapeBaseImageData(); 481 ~ShapeBaseImageData(); 482 bool onAdd(); 483 bool preload(bool server, String &errorStr); 484 S32 lookupState(const char* name); ///< Get a state by name. 485 static void initPersistFields(); 486 virtual void packData(BitStream* stream); 487 virtual void unpackData(BitStream* stream); 488 489 void inspectPostApply(); 490 491 /// @} 492 493 /// @name Callbacks 494 /// @{ 495 DECLARE_CALLBACK( void, onMount, ( SceneObject* obj, S32 slot, F32 dt ) ); 496 DECLARE_CALLBACK( void, onUnmount, ( SceneObject* obj, S32 slot, F32 dt ) ); 497 /// @} 498}; 499 500typedef ShapeBaseImageData::LightType ShapeBaseImageLightType; 501typedef ShapeBaseImageData::StateData::LoadedState ShapeBaseImageLoadedState; 502typedef ShapeBaseImageData::StateData::SpinState ShapeBaseImageSpinState; 503typedef ShapeBaseImageData::StateData::RecoilState ShapeBaseImageRecoilState; 504 505DefineEnumType( ShapeBaseImageLightType ); 506DefineEnumType( ShapeBaseImageLoadedState ); 507DefineEnumType( ShapeBaseImageSpinState ); 508DefineEnumType( ShapeBaseImageRecoilState ); 509 510//-------------------------------------------------------------------------- 511/// @nosubgrouping 512struct ShapeBaseData : public GameBaseData { 513 private: 514 typedef GameBaseData Parent; 515 516 static bool _setMass( void* object, const char* index, const char* data ); 517 518public: 519 /// Various constants relating to the ShapeBaseData 520 enum Constants { 521 MaxCollisionShapes = 8, 522 AIRepairNode = 31 523 }; 524 525 // TODO: These are only really used in Basic Lighting 526 // mode... we should probably move them somewhere else. 527 bool shadowEnable; 528 U32 shadowSize; 529 F32 shadowMaxVisibleDistance; 530 F32 shadowProjectionDistance; 531 F32 shadowSphereAdjust; 532 533 534 StringTableEntry shapeName; 535 StringTableEntry cloakTexName; 536 537 String cubeDescName; 538 U32 cubeDescId; 539 ReflectorDesc *reflectorDesc; 540 541 /// @name Destruction 542 /// 543 /// Everyone likes to blow things up! 544 /// @{ 545 DebrisData * debris; 546 S32 debrisID; 547 StringTableEntry debrisShapeName; 548 Resource<TSShape> debrisShape; 549 550 ExplosionData* explosion; 551 S32 explosionID; 552 553 ExplosionData* underwaterExplosion; 554 S32 underwaterExplosionID; 555 /// @} 556 557 /// @name Physical Properties 558 /// @{ 559 F32 mass; 560 F32 drag; 561 F32 density; 562 F32 maxEnergy; 563 F32 maxDamage; 564 F32 repairRate; ///< Rate per tick. 565 566 F32 disabledLevel; 567 F32 destroyedLevel; 568 /// @} 569 570 /// @name 3rd Person Camera 571 /// @{ 572 F32 cameraMaxDist; ///< Maximum distance from eye 573 F32 cameraMinDist; ///< Minumumistance from eye 574 /// @} 575 576 /// @name Camera FOV 577 /// 578 /// These are specified in degrees. 579 /// @{ 580 F32 cameraDefaultFov; ///< Default vertical FOV in degrees. 581 F32 cameraMinFov; ///< Min vertical FOV allowed in degrees. 582 F32 cameraMaxFov; ///< Max vertical FOV allowed in degrees. 583 /// @} 584 585 /// @name Camera Misc 586 /// @{ 587 bool cameraCanBank; ///< If the derrived class supports it, allow the camera to bank 588 bool mountedImagesBank; ///< Do mounted images bank along with the camera? 589 /// @} 590 591 /// @name Data initialized on preload 592 /// @{ 593 594 Resource<TSShape> mShape; ///< Shape handle 595 U32 mCRC; 596 bool computeCRC; 597 598 S32 eyeNode; ///< Shape's eye node index 599 S32 earNode; ///< Shape's ear node index 600 S32 cameraNode; ///< Shape's camera node index 601 S32 mountPointNode[SceneObject::NumMountPoints]; ///< Node index of mountPoint 602 S32 debrisDetail; ///< Detail level used to generate debris 603 S32 damageSequence; ///< Damage level decals 604 S32 hulkSequence; ///< Destroyed hulk 605 606 bool observeThroughObject; // observe this object through its camera transform and default fov 607 608 /// @name Collision Data 609 /// @{ 610 Vector<S32> collisionDetails; ///< Detail level used to collide with. 611 /// 612 /// These are detail IDs, see TSShape::findDetail() 613 Vector<Box3F> collisionBounds; ///< Detail level bounding boxes. 614 615 Vector<S32> LOSDetails; ///< Detail level used to perform line-of-sight queries against. 616 /// 617 /// These are detail IDs, see TSShape::findDetail() 618 /// @} 619 620 /// @name Misc. Settings 621 /// @{ 622 bool firstPersonOnly; ///< Do we allow only first person view of this image? 623 bool useEyePoint; ///< Do we use this object's eye point to view from? 624 bool isInvincible; ///< If set, object cannot take damage (won't show up with damage bar either) 625 bool renderWhenDestroyed; ///< If set, will not render this object when destroyed. 626 627 bool inheritEnergyFromMount; 628 629 /// @} 630 631 virtual bool preload(bool server, String &errorStr); 632 void computeAccelerator(U32 i); 633 S32 findMountPoint(U32 n); 634 635 /// @name Infrastructure 636 /// The derived class should provide the following: 637 /// @{ 638 DECLARE_CONOBJECT(ShapeBaseData); 639 ShapeBaseData(); 640 ~ShapeBaseData(); 641 static void initPersistFields(); 642 virtual void packData(BitStream* stream); 643 virtual void unpackData(BitStream* stream); 644 /// @} 645 646 /// @name Callbacks 647 /// @{ 648 DECLARE_CALLBACK( void, onEnabled, ( ShapeBase* obj, const char* lastState ) ); 649 DECLARE_CALLBACK( void, onDisabled, ( ShapeBase* obj, const char* lastState ) ); 650 DECLARE_CALLBACK( void, onDestroyed, ( ShapeBase* obj, const char* lastState ) ); 651 DECLARE_CALLBACK( void, onImpact, ( ShapeBase* obj, SceneObject* collObj, VectorF vec, F32 len ) ); 652 DECLARE_CALLBACK( void, onCollision, ( ShapeBase* obj, SceneObject* collObj, VectorF vec, F32 len ) ); 653 DECLARE_CALLBACK( void, onDamage, ( ShapeBase* obj, F32 delta ) ); 654 DECLARE_CALLBACK( void, onTrigger, ( ShapeBase* obj, S32 index, bool state ) ); 655 DECLARE_CALLBACK(void, onEndSequence, (ShapeBase* obj, S32 slot, const char* name)); 656 DECLARE_CALLBACK( void, onForceUncloak, ( ShapeBase* obj, const char* reason ) ); 657 /// @} 658}; 659 660 661//---------------------------------------------------------------------------- 662 663class WaterObject; 664class CameraShake; 665 666/// ShapeBase is the renderable shape from which most of the scriptable objects 667/// are derived, including the player, vehicle and items classes. ShapeBase 668/// provides basic shape loading, audio channels, and animation as well as damage 669/// (and damage states), energy, and the ability to mount images and objects. 670/// 671/// @nosubgrouping 672class ShapeBase : public GameBase, public ISceneLight 673{ 674 friend class ShapeBaseConvex; 675 friend struct ShapeBaseImageData; 676 friend void waterFind(SceneObject*, void*); 677 friend void physicalZoneFind(SceneObject*, void*); 678 679public: 680 typedef GameBase Parent; 681 682 enum PublicConstants { 683 ThreadSequenceBits = 6, 684 MaxSequenceIndex = (1 << ThreadSequenceBits) - 1, 685 EnergyLevelBits = 5, 686 DamageLevelBits = 6, 687 DamageStateBits = 2, 688 // The thread and image limits should not be changed without 689 // also changing the ShapeBaseMasks enum values declared 690 // further down. 691 MaxSoundThreads = 4, ///< Should be a power of 2 692 MaxScriptThreads = 4, ///< Should be a power of 2 693 MaxMountedImages = 4, ///< Should be a power of 2 694 MaxImageEmitters = 3, 695 NumImageBits = 3, 696 CollisionTimeoutValue = 250 ///< Timeout in ms. 697 }; 698 699 /// This enum indexes into the sDamageStateName array 700 enum DamageState { 701 Enabled, 702 Disabled, 703 Destroyed, 704 NumDamageStates, 705 NumDamageStateBits = 2, ///< Should be log2 of the number of states. 706 }; 707 708protected: 709 ShapeBaseData* mDataBlock; ///< Datablock 710 bool mIsAiControlled; ///< Is this object AI controlled? 711 //GameConnection* mControllingClient; ///< Controlling client 712 ShapeBase* mControllingObject; ///< Controlling object 713 bool mTrigger[MaxTriggerKeys]; ///< What triggers are set, if any. 714 715 716 /// @name Scripted Sound 717 /// @{ 718 struct Sound { 719 bool play; ///< Are we playing this sound? 720 SimTime timeout; ///< Time until we stop playing this sound. 721 SFXTrack* profile; ///< Profile on server 722 SFXSource* sound; ///< Sound on client 723 }; 724 Sound mSoundThread[MaxSoundThreads]; 725 /// @} 726 727 /// @name Scripted Animation Threads 728 /// @{ 729 730 struct Thread { 731 /// State of the animation thread. 732 enum State { 733 Play, Stop, Pause, Destroy 734 }; 735 TSThread* thread; ///< Pointer to 3space data. 736 State state; ///< State of the thread 737 S32 sequence; ///< The animation sequence which is running in this thread. 738 F32 timescale; ///< Timescale 739 bool atEnd; ///< Are we at the end of this thread? 740 F32 position; 741 }; 742 Thread mScriptThread[MaxScriptThreads]; 743 744 /// @} 745 746 /// @name Motion 747 /// @{ 748 bool mMoveMotion; ///< Indicates that a Move has come in requesting x, y or z motion 749 /// @} 750 751protected: 752 753 // ShapeBase pointer to our mount object if it is ShapeBase, else it is NULL. 754 ShapeBase *mShapeBaseMount; 755 756 /// @name Mounted Images 757 /// @{ 758 759 /// An image mounted on a shapebase. 760 struct MountedImage { 761 ShapeBaseImageData* dataBlock; 762 ShapeBaseImageData::StateData *state; 763 ShapeBaseImageData* nextImage; 764 NetStringHandle skinNameHandle; 765 NetStringHandle nextSkinNameHandle; 766 String appliedSkinName; 767 NetStringHandle scriptAnimPrefix; ///< The script based anim prefix 768 769 /// @name State 770 /// 771 /// Variables tracking the state machine 772 /// representing this specific mounted image. 773 /// @{ 774 775 bool loaded; ///< Is the image loaded? 776 bool nextLoaded; ///< Is the next state going to result in the image being loaded? 777 F32 delayTime; ///< Time till next state. 778 F32 rDT; ///< Remainder delta time. Used internally. 779 U32 fireCount; ///< Fire skip count. 780 /// 781 /// This is incremented every time the triggerDown bit is changed, 782 /// so that the engine won't be too confused if the player toggles the 783 /// trigger a bunch of times in a short period. 784 /// 785 /// @note The network deals with this variable at 3-bit precision, so it 786 /// can only range 0-7. 787 /// 788 /// @see ShapeBase::setImageState() 789 U32 altFireCount; ///< Alternate fire skip count. 790 ///< @see fireCount 791 792 U32 reloadCount; ///< Reload skip count. 793 ///< @see fireCount 794 795 bool triggerDown; ///< Is the trigger down? 796 bool altTriggerDown; ///< Is the second trigger down? 797 798 bool ammo; ///< Do we have ammo? 799 /// 800 /// May be true based on either energy OR ammo. 801 802 bool target; ///< Have we acquired a targer? 803 bool wet; ///< Is the weapon wet? 804 805 bool motion; ///< Is the player in motion? 806 807 bool genericTrigger[ShapeBaseImageData::MaxGenericTriggers]; ///< Generic triggers not assigned to anything in particular. These 808 /// may be used to indicate some transition should occur. 809 /// @} 810 811 /// @name 3space 812 /// 813 /// Handles to threads and shapeinstances in the 3space system. 814 /// @{ 815 TSShapeInstance* shapeInstance[ShapeBaseImageData::MaxShapes]; 816 TSThread *ambientThread[ShapeBaseImageData::MaxShapes]; 817 TSThread *visThread[ShapeBaseImageData::MaxShapes]; 818 TSThread *animThread[ShapeBaseImageData::MaxShapes]; 819 TSThread *flashThread[ShapeBaseImageData::MaxShapes]; 820 TSThread *spinThread[ShapeBaseImageData::MaxShapes]; 821 822 bool doAnimateAllShapes; ///< Should all threads animate across all shapes to keep them in sync? 823 bool forceAnimateAllShapes; ///< If the mounted image's owner is being controlled by the client 824 /// and the image's datablock animateAllShapes field is true 825 /// then set this to true and pass along to the client. This will help 826 /// in the cases where the client's control object is ghosted but does 827 /// not yet have its controlling client set correctly due to networking 828 /// order of operations. All this for the MountedImage::updateDoAnimateAllShapes() 829 /// optimization. 830 U32 lastShapeIndex; ///< Tracks the last shape index. 831 /// @} 832 833 /// @name Effects 834 /// 835 /// Variables relating to lights, sounds, and particles. 836 /// @{ 837 SimTime lightStart; ///< Starting time for light flashes. 838 LightInfo* lightInfo; ///< The real light (if any) associated with this weapon image. 839 840 Vector<SFXSource*> mSoundSources; ///< Vector of currently playing sounds 841 void updateSoundSources(const MatrixF& renderTransform); 842 void addSoundSource(SFXSource* source); 843 844 /// Represent the state of a specific particle emitter on the image. 845 struct ImageEmitter { 846 S32 node; 847 F32 time; 848 SimObjectPtr<ParticleEmitter> emitter; 849 }; 850 ImageEmitter emitter[MaxImageEmitters]; 851 852 /// @} 853 854 // 855 MountedImage(); 856 ~MountedImage(); 857 858 void updateDoAnimateAllShapes(const ShapeBase* owner); 859 }; 860 MountedImage mMountedImageList[MaxMountedImages]; 861 862 /// @} 863 864 /// @name Render settings 865 /// @{ 866 867 TSShapeInstance* mShapeInstance; 868 Convex * mConvexList; 869 NetStringHandle mSkinNameHandle; 870 String mAppliedSkinName; 871 872 NetStringHandle mShapeNameHandle; ///< Name sent to client 873 /// @} 874 875 /// @name Physical Properties 876 /// @{ 877 878 S32 mAiPose; ///< Current pose. 879 F32 mEnergy; ///< Current enery level. 880 F32 mRechargeRate; ///< Energy recharge rate (in units/tick). 881 882 F32 mMass; ///< Mass. 883 F32 mOneOverMass; ///< Inverse of mass. 884 /// @note This is used to optimize certain physics calculations. 885 886 /// @} 887 888 /// @name Physical Properties 889 /// 890 /// Properties for the current object, which are calculated 891 /// based on the container we are in. 892 /// 893 /// @see ShapeBase::updateContainer() 894 /// @see ShapeBase::mContainer 895 /// @{ 896 F32 mDrag; ///< Drag. 897 F32 mBuoyancy; ///< Buoyancy factor. 898 String mLiquidType; ///< Type of liquid (if any) we are in. 899 F32 mLiquidHeight; ///< Height of liquid around us (from 0..1). 900 F32 mWaterCoverage; ///< Percent of this object covered by water 901 902 Point3F mAppliedForce; 903 F32 mGravityMod; 904 /// @} 905 906 F32 mDamageFlash; 907 F32 mWhiteOut; 908 909 bool mFlipFadeVal; 910 911 public: 912 913 /// @name Collision Notification 914 /// This is used to keep us from spamming collision notifications. When 915 /// a collision occurs, we add to this list; then we don't notify anyone 916 /// of the collision until the CollisionTimeout expires (which by default 917 /// occurs in 1/10 of a second). 918 /// 919 /// @see notifyCollision(), queueCollision() 920 /// @{ 921 struct CollisionTimeout 922 { 923 CollisionTimeout* next; 924 SceneObject* object; 925 U32 objectNumber; 926 SimTime expireTime; 927 VectorF vector; 928 }; 929 CollisionTimeout* mTimeoutList; 930 static CollisionTimeout* sFreeTimeoutList; 931 932 /// Go through all the items in the collision queue and call onCollision on them all 933 /// @see onCollision 934 void notifyCollision(); 935 936 /// Add a collision to the queue of collisions waiting to be handled @see onCollision 937 /// @param object Object collision occurs with 938 /// @param vec Vector along which collision occurs 939 void queueCollision( SceneObject *object, const VectorF &vec); 940 941 /// @see SceneObject 942 virtual void onCollision( SceneObject *object, const VectorF &vec ); 943 944 /// @} 945 protected: 946 947 /// @name Damage 948 /// @{ 949 F32 mDamage; 950 F32 mRepairRate; 951 F32 mRepairReserve; 952 DamageState mDamageState; 953 TSThread *mDamageThread; 954 TSThread *mHulkThread; 955 VectorF damageDir; 956 /// @} 957 958 /// @name Cloaking 959 /// @{ 960 bool mCloaked; 961 F32 mCloakLevel; 962// TextureHandle mCloakTexture; 963 /// @} 964 965 /// @name Fading 966 /// @{ 967 bool mFadeOut; 968 bool mFading; 969 F32 mFadeVal; 970 F32 mFadeElapsedTime; 971 F32 mFadeTime; 972 F32 mFadeDelay; 973public: 974 F32 getFadeVal() { return mFadeVal; } 975 /// @} 976protected: 977 978 /// @name Control info 979 /// @{ 980 F32 mCameraFov; ///< The camera vertical FOV in degrees. 981 bool mIsControlled; ///< Client side controlled flag 982 983 /// @} 984public: 985 static U32 sLastRenderFrame; 986 987protected: 988 989 U32 mLastRenderFrame; 990 F32 mLastRenderDistance; 991 992 /// Do a reskin if necessary. 993 virtual void reSkin(); 994 995 /// This recalculates the total mass of the object, and all mounted objects 996 void updateMass(); 997 998 /// @name Image Manipulation 999 /// @{ 1000 1001 /// Utility function to call script functions which have to do with ShapeBase 1002 /// objects. 1003 /// @param imageSlot Image Slot id 1004 /// @param function Function 1005 void scriptCallback(U32 imageSlot,const char* function); 1006 1007 /// Assign a ShapeBaseImage to an image slot 1008 /// @param imageSlot Image Slot ID 1009 /// @param imageData ShapeBaseImageData to assign 1010 /// @param skinNameHandle Skin texture name 1011 /// @param loaded Is the image loaded? 1012 /// @param ammo Does the image have ammo? 1013 /// @param triggerDown Is the trigger on this image down? 1014 /// @param altTriggerDown Is the second trigger on this image down? 1015 /// @param target Does the image have a target? 1016 virtual void setImage( U32 imageSlot, 1017 ShapeBaseImageData* imageData, 1018 NetStringHandle &skinNameHandle, 1019 bool loaded = true, bool ammo = false, 1020 bool triggerDown = false, 1021 bool altTriggerDown = false, 1022 bool motion = false, 1023 bool genericTrigger0 = false, 1024 bool genericTrigger1 = false, 1025 bool genericTrigger2 = false, 1026 bool genericTrigger3 = false, 1027 bool target = false ); 1028 1029 /// Clear out an image slot 1030 /// @param imageSlot Image slot id 1031 void resetImageSlot(U32 imageSlot); 1032 1033 /// Get the firing action state of the image 1034 /// @param imageSlot Image slot id 1035 U32 getImageFireState(U32 imageSlot); 1036 1037 /// Get the alternate firing action state of the image 1038 /// @param imageSlot Image slot id 1039 U32 getImageAltFireState(U32 imageSlot); 1040 1041 /// Get the reload action state of the image 1042 /// @param imageSlot Image slot id 1043 U32 getImageReloadState(U32 imageSlot); 1044 1045 /// Sets the state of the image by state index 1046 /// @param imageSlot Image slot id 1047 /// @param state State id 1048 /// @param force Force image to state or let it finish then change 1049 void setImageState(U32 imageSlot, U32 state, bool force = false); 1050 1051 void updateAnimThread(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState=<a href="/coding/file/types_8lint_8h/#types_8lint_8h_1a070d2ce7b6bb7e5c05602aa8c308d0c4">NULL</a>); 1052 1053 /// Get the animation prefix for the image 1054 /// @param imageSlot Image slot id 1055 /// @param imageShapeIndex Shape index (1st person, etc.) used to look up the prefix text 1056 virtual const char* getImageAnimPrefix(U32 imageSlot, S32 imageShapeIndex) { return ""; } 1057 1058 /// Advance animation on a image 1059 /// @param imageSlot Image slot id 1060 /// @param dt Change in time since last animation update 1061 void updateImageAnimation(U32 imageSlot, F32 dt); 1062 1063 /// Advance state of image 1064 /// @param imageSlot Image slot id 1065 /// @param dt Change in time since last state update 1066 void updateImageState(U32 imageSlot,F32 dt); 1067 1068 /// Start up the particle emitter for the this shapebase 1069 /// @param image Mounted image 1070 /// @param state State of shape base image 1071 void startImageEmitter(MountedImage &image,ShapeBaseImageData::StateData &state); 1072 1073 /// Get light information for a mounted image 1074 /// @param imageSlot Image slot id 1075 Light* getImageLight(U32 imageSlot); 1076 1077 /// Get the shape index to use for a mounted image 1078 /// @param image Mounted image 1079 U32 getImageShapeIndex(const MountedImage& image) const; 1080 1081 /// @} 1082 1083 /// Prune out non looping sounds from the sound manager which have expired 1084 void updateServerAudio(); 1085 1086 /// Updates the audio state of the supplied sound 1087 /// @param st Sound 1088 void updateAudioState(Sound& st); 1089 1090 /// Recalculates the spacial sound based on the current position of the object 1091 /// emitting the sound. 1092 void updateAudioPos(); 1093 1094 /// Update bouyency and drag properties 1095 void updateContainer(); 1096 1097 /// @name Events 1098 /// @{ 1099 virtual void onDeleteNotify(SimObject*); 1100 virtual void onImage(U32 imageSlot, bool unmount); 1101 virtual void onImageRecoil(U32 imageSlot,ShapeBaseImageData::StateData::RecoilState); 1102 virtual void onImageStateAnimation(U32 imageSlot, const char* seqName, bool direction, bool scaleToState, F32 stateTimeOutValue); 1103 virtual void onImageAnimThreadChange(U32 imageSlot, S32 imageShapeIndex, ShapeBaseImageData::StateData* lastState, const char* anim, F32 pos, F32 timeScale, bool reset=false); 1104 virtual void onImageAnimThreadUpdate(U32 imageSlot, S32 imageShapeIndex, F32 dt); 1105 virtual void ejectShellCasing( U32 imageSlot ); 1106 virtual void shakeCamera( U32 imageSlot ); 1107 virtual void updateDamageLevel(); 1108 virtual void updateDamageState(); 1109 virtual void onImpact(SceneObject* obj, const VectorF& vec); 1110 virtual void onImpact(const VectorF& vec); 1111 /// @} 1112 1113 /// The inner prep render function that does the 1114 /// standard work to render the shapes. 1115 void _prepRenderImage( SceneRenderState* state, 1116 bool renderSelf, 1117 bool renderMountedImages ); 1118 1119 /// Renders the shape bounds as well as the 1120 /// bounds of all mounted shape images. 1121 void _renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance* ); 1122 1123 void emitDust( ParticleEmitter* emitter, F32 triggerHeight, const Point3F& offset, U32 numMilliseconds, const Point3F& axis = Point3F::Zero ); 1124 1125public: 1126 ShapeBase(); 1127 ~ShapeBase(); 1128 1129 TSShapeInstance* getShapeInstance() { return mShapeInstance; } 1130 1131 static void initPersistFields(); 1132 static bool _setFieldSkin( void *object, const char *index, const char *data ); 1133 static const char *_getFieldSkin( void *object, const char *data ); 1134 1135 /// @name Network state masks 1136 /// @{ 1137 1138 /// 1139 enum ShapeBaseMasks { 1140 NameMask = Parent::NextFreeMask, 1141 DamageMask = Parent::NextFreeMask << 1, 1142 NoWarpMask = Parent::NextFreeMask << 2, 1143 CloakMask = Parent::NextFreeMask << 3, 1144 SkinMask = Parent::NextFreeMask << 4, 1145 MeshHiddenMask = Parent::NextFreeMask << 5, 1146 SoundMaskN = Parent::NextFreeMask << 6, ///< Extends + MaxSoundThreads bits 1147 ThreadMaskN = SoundMaskN << MaxSoundThreads, ///< Extends + MaxScriptThreads bits 1148 ImageMaskN = ThreadMaskN << MaxScriptThreads, ///< Extends + MaxMountedImage bits 1149 NextFreeMask = ImageMaskN << MaxMountedImages 1150 }; 1151 1152 enum BaseMaskConstants { 1153 SoundMask = (SoundMaskN << MaxSoundThreads) - SoundMaskN, 1154 ThreadMask = (ThreadMaskN << MaxScriptThreads) - ThreadMaskN, 1155 ImageMask = (ImageMaskN << MaxMountedImages) - ImageMaskN 1156 }; 1157 1158 /// @} 1159 1160 static F32 sWhiteoutDec; 1161 static F32 sDamageFlashDec; 1162 static F32 sFullCorrectionDistance; 1163 static F32 sCloakSpeed; // Time to cloak, in seconds 1164 1165 CubeReflector mCubeReflector; 1166 1167 /// @name Initialization 1168 /// @{ 1169 1170 bool onAdd(); 1171 void onRemove(); 1172 void onSceneRemove(); 1173 static void consoleInit(); 1174 bool onNewDataBlock( GameBaseData *dptr, bool reload ); 1175 1176 /// @} 1177 1178 /// @name Name & Skin tags 1179 /// @{ 1180 void setShapeName(const char*); 1181 const char* getShapeName(); 1182 void setSkinName(const char*); 1183 const char* getSkinName(); 1184 /// @} 1185 1186 /// @name Mesh Visibility 1187 /// @{ 1188 1189protected: 1190 1191 /// A bit vector of the meshes forced to be hidden. 1192 BitVector mMeshHidden; 1193 1194 /// Sync the shape instance with the hidden mesh bit vector. 1195 void _updateHiddenMeshes(); 1196 1197public: 1198 1199 /// Change the hidden state on all the meshes. 1200 void setAllMeshesHidden( bool forceHidden ); 1201 1202 /// Set the force hidden state on a mesh. 1203 void setMeshHidden( S32 meshIndex, bool forceHidden ); 1204 1205 /// Set the force hidden state on a named mesh. 1206 void setMeshHidden( const char *meshName, bool forceHidden ); 1207 1208#ifndef TORQUE_SHIPPING 1209 1210 /// Prints the list of meshes and their visibility state 1211 /// to the console for debugging purposes. 1212 void dumpMeshVisibility(); 1213 1214#endif 1215 1216 /// @} 1217 1218public: 1219 1220 /// @name Basic attributes 1221 /// @{ 1222 1223 /// Sets the amount of damage on this object. 1224 void setDamageLevel(F32 damage); 1225 1226 /// Changes the object's damage state. 1227 /// @param state New state of the object 1228 void setDamageState(DamageState state); 1229 1230 /// Changes the object's damage state, based on a named state. 1231 /// @see setDamageState 1232 /// @param state New state of the object as a string. 1233 bool setDamageState(const char* state); 1234 1235 /// Returns the name of the current damage state as a string. 1236 const char* getDamageStateName(); 1237 1238 /// Returns the current damage state. 1239 DamageState getDamageState() { return mDamageState; } 1240 1241 /// Returns true if the object is destroyed. 1242 bool isDestroyed() { return mDamageState == Destroyed; } 1243 1244 /// Sets the rate at which the object regenerates damage. 1245 /// 1246 /// @param rate Repair rate in units/second. 1247 void setRepairRate(F32 rate) { mRepairRate = rate; } 1248 1249 /// Returns damage amount. 1250 F32 getDamageLevel() { return mDamage; } 1251 1252 /// Returns the damage percentage. 1253 /// 1254 /// @return Damage factor, between 0.0 - 1.0 1255 F32 getDamageValue(); 1256 1257 /// Returns the datablock.maxDamage value 1258 F32 getMaxDamage(); 1259 1260 /// Returns the rate at which the object regenerates damage 1261 F32 getRepairRate() { return mRepairRate; } 1262 1263 /// Adds damage to an object 1264 /// @param amount Amount of of damage to add 1265 void applyDamage(F32 amount); 1266 1267 /// Removes damage to an object 1268 /// @param amount Amount to repair object by 1269 void applyRepair(F32 amount); 1270 1271 /// Sets the direction from which the damage is coming 1272 /// @param vec Vector indicating the direction of the damage 1273 void setDamageDir(const VectorF& vec) { damageDir = vec; } 1274 1275 /// Sets the level of energy for this object 1276 /// @param energy Level of energy to assign to this object 1277 virtual void setEnergyLevel(F32 energy); 1278 1279 /// Sets the rate at which the energy replentishes itself 1280 /// @param rate Rate at which energy restores 1281 void setRechargeRate(F32 rate) { mRechargeRate = rate; } 1282 1283 /// Returns the amount of energy in the object 1284 F32 getEnergyLevel(); 1285 1286 /// Returns the percentage of energy, 0.0 - 1.0 1287 F32 getEnergyValue(); 1288 1289 /// Returns the recharge rate 1290 F32 getRechargeRate() { return mRechargeRate; } 1291 1292 /// Makes the shape explode. 1293 virtual void blowUp(); 1294 1295 /// @} 1296 1297 /// @name Script sounds 1298 /// @{ 1299 1300 /// Plays an audio sound from a mounted object 1301 /// @param slot Mount slot ID 1302 /// @param track Audio track to play 1303 void playAudio(U32 slot,SFXTrack* track); 1304 void playAudio( U32 slot, SFXProfile* profile ) { playAudio( slot, ( SFXTrack* ) profile ); } 1305 1306 /// Stops audio from a mounted object 1307 /// @param slot Mount slot ID 1308 void stopAudio(U32 slot); 1309 /// @} 1310 1311 /// @name Script animation 1312 /// @{ 1313 1314 const char *getThreadSequenceName( U32 slot ); 1315 1316 /// Sets the animation thread for a mounted object 1317 /// @param slot Mount slot ID 1318 /// @param seq Sequence id 1319 /// @param reset Reset the sequence 1320 bool setThreadSequence(U32 slot, S32 seq, bool reset = true); 1321 1322 /// Update the animation thread 1323 /// @param st Thread to update 1324 void updateThread(Thread& st); 1325 1326 /// Stop the current thread from playing on a mounted object 1327 /// @param slot Mount slot ID 1328 bool stopThread(U32 slot); 1329 1330 /// Destroys the given animation thread 1331 /// @param slot Mount slot ID 1332 bool destroyThread(U32 slot); 1333 1334 /// Pause the running animation thread 1335 /// @param slot Mount slot ID 1336 bool pauseThread(U32 slot); 1337 1338 /// Start playing the running animation thread again 1339 /// @param slot Mount slot ID 1340 bool playThread(U32 slot); 1341 1342 /// Set the thread position 1343 /// @param slot Mount slot ID 1344 /// @param pos Position 1345 bool setThreadPosition( U32 slot, F32 pos ); 1346 1347 /// Toggle the thread as reversed or normal (For example, sidestep-right reversed is sidestep-left) 1348 /// @param slot Mount slot ID 1349 /// @param forward True if the animation is to be played normally 1350 bool setThreadDir(U32 slot,bool forward); 1351 1352 /// Set the thread time scale 1353 /// @param slot Mount slot ID 1354 /// @param timescale Timescale 1355 bool setThreadTimeScale( U32 slot, F32 timeScale ); 1356 1357 /// Advance all animation threads attached to this shapebase 1358 /// @param dt Change in time from last call to this function 1359 void advanceThreads(F32 dt); 1360 /// @} 1361 1362 /// @name Cloaking 1363 /// @{ 1364 1365 /// Force uncloaking of object 1366 /// @param reason Reason this is being forced to uncloak, this is passed directly to script control 1367 void forceUncloak(const char *reason); 1368 1369 /// Set cloaked state of object 1370 /// @param cloaked True if object is cloaked 1371 void setCloakedState(bool cloaked); 1372 1373 /// Returns true if object is cloaked 1374 bool getCloakedState(); 1375 1376 /// Returns level of cloaking, as it's not an instant "now you see it, now you don't" 1377 F32 getCloakLevel(); 1378 /// @} 1379 1380 /// @name Mounted objects 1381 /// @{ 1382 virtual void onMount( SceneObject *obj, S32 node ); 1383 virtual void onUnmount( SceneObject *obj,S32 node ); 1384 virtual void getMountTransform( S32 index, const MatrixF &xfm, MatrixF *outMat ); 1385 virtual void getRenderMountTransform( F32 delta, S32 index, const MatrixF &xfm, MatrixF *outMat ); 1386 /// @} 1387 1388 /// Returns where the AI should be to repair this object 1389 /// 1390 /// @note Legacy code from Tribes 2, but still works 1391 Point3F getAIRepairPoint(); 1392 1393 /// @name Mounted Images 1394 /// @{ 1395 1396 /// Mount an image (ShapeBaseImage) onto an image slot 1397 /// @param image ShapeBaseImage to mount 1398 /// @param imageSlot Image mount point 1399 /// @param loaded True if weapon is loaded (it assumes it's a weapon) 1400 /// @param skinNameHandle Skin name for object 1401 virtual bool mountImage(ShapeBaseImageData* image,U32 imageSlot,bool loaded, NetStringHandle &skinNameHandle); 1402 1403 /// Unmount an image from a slot 1404 /// @param imageSlot Mount point 1405 virtual bool unmountImage(U32 imageSlot); 1406 1407 /// Gets the information on the image mounted in a slot 1408 /// @param imageSlot Mount point 1409 ShapeBaseImageData* getMountedImage(U32 imageSlot); 1410 1411 /// Gets the mounted image on on a slot 1412 /// @param imageSlot Mount Point 1413 MountedImage* getImageStruct(U32 imageSlot); 1414 1415 TSShapeInstance* getImageShapeInstance(U32 imageSlot) 1416 { 1417 const MountedImage &image = mMountedImageList[imageSlot]; 1418 U32 imageShapeIndex = getImageShapeIndex(image); 1419 if(image.dataBlock && image.shapeInstance[imageShapeIndex]) 1420 return image.shapeInstance[imageShapeIndex]; 1421 return NULL; 1422 } 1423 1424 /// Gets the next image which will be put in an image slot 1425 /// @see setImageState 1426 /// @param imageSlot mount Point 1427 ShapeBaseImageData* getPendingImage(U32 imageSlot); 1428 1429 1430 /// Returns true if the mounted image is firing 1431 /// @param imageSlot Mountpoint 1432 bool isImageFiring(U32 imageSlot); 1433 1434 /// Returns true if the mounted image is alternate firing 1435 /// @param imageSlot Mountpoint 1436 bool isImageAltFiring(U32 imageSlot); 1437 1438 /// Returns true if the mounted image is reloading 1439 /// @param imageSlot Mountpoint 1440 bool isImageReloading(U32 imageSlot); 1441 1442 /// This will return true if, when triggered, the object will fire. 1443 /// @param imageSlot mount point 1444 /// @param ns Used internally for recursion, do not mess with 1445 /// @param depth Used internally for recursion, do not mess with 1446 bool isImageReady(U32 imageSlot,U32 ns = (U32)-1,U32 depth = 0); 1447 1448 /// Returns true if the specified image is mounted 1449 /// @param image ShapeBase image 1450 bool isImageMounted(ShapeBaseImageData* image); 1451 1452 /// Returns the slot which the image specified is mounted on 1453 /// @param image Image to test for 1454 S32 getMountSlot(ShapeBaseImageData* image); 1455 1456 /// Returns the skin for the image in a slot 1457 /// @param imageSlot Image slot to get the skin from 1458 NetStringHandle getImageSkinTag(U32 imageSlot); 1459 1460 /// Check if the given state exists on the mounted Image 1461 /// @param imageSlot Image slot id 1462 /// @param state Image state to check for 1463 bool hasImageState(U32 imageSlot, const char* state); 1464 1465 /// Returns the image state as a string 1466 /// @param imageSlot Image slot to check state 1467 const char* getImageState(U32 imageSlot); 1468 1469 /// Sets the generic trigger state of the image 1470 /// @param imageSlot Image slot 1471 /// @param trigger Generic trigger number 0-3 1472 /// @param state True if generic trigger is down 1473 void setImageGenericTriggerState(U32 imageSlot, U32 trigger, bool state); 1474 1475 /// Returns the generic trigger state of the image 1476 /// @param imageSlot Image slot 1477 /// @param trigger Generic trigger number 0-3 1478 bool getImageGenericTriggerState(U32 imageSlot, U32 trigger); 1479 1480 /// Sets the trigger state of the image (Ie trigger pulled down on gun) 1481 /// @param imageSlot Image slot 1482 /// @param trigger True if trigger is down 1483 void setImageTriggerState(U32 imageSlot,bool trigger); 1484 1485 /// Returns the trigger state of the image 1486 /// @param imageSlot Image slot 1487 bool getImageTriggerState(U32 imageSlot); 1488 1489 /// Sets the alt trigger state of the image (Ie trigger pulled down on gun) 1490 /// @param imageSlot Image slot 1491 /// @param trigger True if trigger is down 1492 void setImageAltTriggerState( U32 imageSlot, bool trigger ); 1493 1494 /// Returns the alt trigger state of the image 1495 /// @param imageSlot Image slot 1496 bool getImageAltTriggerState( U32 imageSlot ); 1497 1498 /// Sets the flag if the image uses ammo or energy 1499 /// @param imageSlot Image slot 1500 /// @param ammo True if the weapon uses ammo, not energy 1501 void setImageAmmoState(U32 imageSlot,bool ammo); 1502 1503 /// Returns true if the image uses ammo, not energy 1504 /// @param imageSlot Image slot 1505 bool getImageAmmoState(U32 imageSlot); 1506 1507 /// Sets the image as wet or not, IE if you wanted a gun not to function underwater 1508 /// @param imageSlot Image slot 1509 /// @param wet True if image is wet 1510 void setImageWetState(U32 imageSlot,bool wet); 1511 1512 /// Returns true if image is wet 1513 /// @param imageSlot image slot 1514 bool getImageWetState(U32 imageSlot); 1515 1516 /// Sets the image as in motion or not, IE if you wanted a gun not to sway while the player is in motion 1517 /// @param imageSlot Image slot 1518 /// @param motion True if image is in motion 1519 void setImageMotionState(U32 imageSlot,bool motion); 1520 1521 /// Returns true if image is in motion 1522 /// @param imageSlot image slot 1523 bool getImageMotionState(U32 imageSlot); 1524 1525 /// Sets the flag if the image has a target 1526 /// @param imageSlot Image slot 1527 /// @param ammo True if the weapon has a target 1528 void setImageTargetState(U32 imageSlot,bool ammo); 1529 1530 /// Returns true if the image has a target 1531 /// @param imageSlot Image slot 1532 bool getImageTargetState(U32 imageSlot); 1533 1534 /// Sets the flag of if the image is loaded with ammo 1535 /// @param imageSlot Image slot 1536 /// @param loaded True if object is loaded with ammo 1537 void setImageLoadedState(U32 imageSlot,bool loaded); 1538 1539 /// Returns true if object is loaded with ammo 1540 /// @param imageSlot Image slot 1541 bool getImageLoadedState(U32 imageSlot); 1542 1543 /// Set the script animation prefix for the image 1544 /// @param imageSlot Image slot id 1545 /// @param prefix The prefix applied to the image 1546 void setImageScriptAnimPrefix(U32 imageSlot, NetStringHandle prefix); 1547 1548 /// Get the script animation prefix for the image 1549 /// @param imageSlot Image slot id 1550 /// @param imageShapeIndex Shape index (1st person, etc.) used to look up the prefix text 1551 NetStringHandle getImageScriptAnimPrefix(U32 imageSlot); 1552 1553 /// Modify muzzle, if needed, to aim at whatever is straight in front of eye. 1554 /// Returns true if result is actually modified. 1555 /// @param muzMat Muzzle transform (in/out) 1556 /// @param result Corrected muzzle vector (out) 1557 bool getCorrectedAim(const MatrixF& muzMat, VectorF* result); 1558 1559 /// Gets the muzzle vector of a specified slot 1560 /// @param imageSlot Image slot to check transform for 1561 /// @param vec Muzzle vector (out) 1562 virtual void getMuzzleVector(U32 imageSlot,VectorF* vec); 1563 1564 /// Gets the point of the muzzle of the image 1565 /// @param imageSlot Image slot 1566 /// @param pos Muzzle point (out) 1567 void getMuzzlePoint(U32 imageSlot,Point3F* pos); 1568 1569 /// @} 1570 1571 /// @name Transforms 1572 /// @{ 1573 1574 /// Gets the minimum viewing distance, maximum viewing distance, camera offsetand rotation 1575 /// for this object, if the world were to be viewed through its eyes 1576 /// @param min Minimum viewing distance 1577 /// @param max Maximum viewing distance 1578 /// @param offset Offset of the camera from the origin in local space 1579 /// @param rot Rotation matrix 1580 virtual void getCameraParameters(F32 *min,F32* max,Point3F* offset,MatrixF* rot); 1581 1582 /// Gets the camera to world space transform matrix 1583 /// @todo Find out what pos does 1584 /// @param pos TODO: Find out what this does 1585 /// @param mat Camera transform (out) 1586 virtual void getCameraTransform(F32* pos,MatrixF* mat); 1587 1588 /// Gets the view transform for a particular eye, taking into account the current absolute 1589 /// orient and position values of the display device. 1590 virtual void getEyeCameraTransform( IDisplayDevice *display, U32 eyeId, MatrixF *outMat ); 1591 1592 /// Gets the index of a node inside a mounted image given the name 1593 /// @param imageSlot Image slot 1594 /// @param nodeName Node name 1595 S32 getNodeIndex(U32 imageSlot,StringTableEntry nodeName); 1596 1597 /// @} 1598 1599 /// @name Object Transforms 1600 /// @{ 1601 1602 /// Returns the eye transform of this shape, IE the eyes of a player 1603 /// @param mat Eye transform (out) 1604 virtual void getEyeTransform(MatrixF* mat); 1605 1606 /// Returns the eye transform of this shape without including mounted images, IE the eyes of a player 1607 /// @param mat Eye transform (out) 1608 virtual void getEyeBaseTransform(MatrixF* mat, bool includeBank); 1609 1610 /// The retraction transform is the muzzle transform in world space. 1611 /// 1612 /// If the gun is pushed back, for instance, if the player ran against something, 1613 /// the muzzle of the gun gets pushed back towards the player, towards this location. 1614 /// @param imageSlot Image slot 1615 /// @param mat Transform (out) 1616 virtual void getRetractionTransform(U32 imageSlot,MatrixF* mat); 1617 1618 /// Muzzle transform of mounted object in world space 1619 /// @param imageSlot Image slot 1620 /// @param mat Muzzle transform (out) 1621 virtual void getMuzzleTransform(U32 imageSlot,MatrixF* mat); 1622 1623 /// Gets the transform of a mounted image in world space 1624 /// @param imageSlot Image slot 1625 /// @param mat Transform (out) 1626 virtual void getImageTransform(U32 imageSlot,MatrixF* mat); 1627 1628 /// Gets the transform of a node on a mounted image in world space 1629 /// @param imageSlot Image Slot 1630 /// @param node node on image 1631 /// @param mat Transform (out) 1632 virtual void getImageTransform(U32 imageSlot,S32 node, MatrixF* mat); 1633 1634 /// Gets the transform of a node on a mounted image in world space 1635 /// @param imageSlot Image Slot 1636 /// @param nodeName Name of node on image 1637 /// @param mat Transform (out) 1638 virtual void getImageTransform(U32 imageSlot, StringTableEntry nodeName, MatrixF* mat); 1639 1640 ///@} 1641 1642 /// @name Render transforms 1643 /// Render transforms are different from object transforms in that the render transform of an object 1644 /// is where, in world space, the object is actually rendered. The object transform is the 1645 /// absolute position of the object, as in where it should be. 1646 /// 1647 /// The render transforms typically vary from object transforms due to client side prediction. 1648 /// 1649 /// Other than that, these functions are identical to their object-transform counterparts 1650 /// 1651 /// @note These are meaningless on the server. 1652 /// @{ 1653 virtual void getRenderRetractionTransform(U32 index,MatrixF* mat); 1654 virtual void getRenderMuzzleTransform(U32 index,MatrixF* mat); 1655 virtual void getRenderImageTransform(U32 imageSlot,MatrixF* mat,bool noEyeOffset=false); 1656 virtual void getRenderImageTransform(U32 index,S32 node, MatrixF* mat); 1657 virtual void getRenderImageTransform(U32 index, StringTableEntry nodeName, MatrixF* mat); 1658 virtual void getRenderMuzzleVector(U32 imageSlot,VectorF* vec); 1659 virtual void getRenderMuzzlePoint(U32 imageSlot,Point3F* pos); 1660 virtual void getRenderEyeTransform(MatrixF* mat); 1661 virtual void getRenderEyeBaseTransform(MatrixF* mat, bool includeBank); 1662 /// @} 1663 1664 1665 1666 /// @name Screen Flashing 1667 /// @{ 1668 1669 /// Returns the level of screenflash that should be used 1670 virtual F32 getDamageFlash() const; 1671 1672 /// Sets the flash level 1673 /// @param amt Level of flash 1674 virtual void setDamageFlash(const F32 amt); 1675 1676 /// White out is the flash-grenade blindness effect 1677 /// This returns the level of flash to create 1678 virtual F32 getWhiteOut() const; 1679 1680 /// Set the level of flash blindness 1681 virtual void setWhiteOut(const F32); 1682 /// @} 1683 1684 /// @name Movement & velocity 1685 /// @{ 1686 1687 /// Sets the velocity of this object 1688 /// @param vel Velocity vector 1689 virtual void setVelocity(const VectorF& vel); 1690 1691 /// Applies an impulse force to this object 1692 /// @param pos Position where impulse came from in world space 1693 /// @param vec Velocity vector (Impulse force F = m * v) 1694 virtual void applyImpulse(const Point3F& pos,const VectorF& vec); 1695 1696 /// @} 1697 1698 /// @name Cameras and Control 1699 /// @{ 1700 1701 /// Returns the object controlling this object 1702 ShapeBase* getControllingObject() { return mControllingObject; } 1703 1704 /// Sets the controlling object 1705 /// @param obj New controlling object 1706 virtual void setControllingObject(ShapeBase* obj); 1707 1708 /// 1709 virtual void setControllingClient( GameConnection* connection ); 1710 1711 /// Returns the object this is controlling 1712 virtual ShapeBase* getControlObject(); 1713 1714 /// sets the object this is controlling 1715 /// @param obj New controlled object 1716 virtual void setControlObject(ShapeBase *obj); 1717 1718 /// Returns true if this object is controlling by something 1719 bool isControlled() { return(mIsControlled); } 1720 1721 /// Returns true if this object is being used as a camera in first person 1722 bool isFirstPerson() const; 1723 1724 /// Returns true if the camera uses this objects eye point (defined by modeler) 1725 bool useObjsEyePoint() const; 1726 1727 /// Returns true if this object can only be used as a first person camera 1728 bool onlyFirstPerson() const; 1729 1730 /// Returns the vertical field of view in degrees for 1731 /// this object if used as a camera. 1732 virtual F32 getCameraFov() { return mCameraFov; } 1733 1734 /// Returns the default vertical field of view in degrees 1735 /// if this object is used as a camera. 1736 virtual F32 getDefaultCameraFov() { return mDataBlock->cameraDefaultFov; } 1737 1738 /// Sets the vertical field of view in degrees for this 1739 /// object if used as a camera. 1740 /// @param yfov The vertical FOV in degrees to test. 1741 virtual void setCameraFov(F32 fov); 1742 1743 /// Returns true if the vertical FOV in degrees is within 1744 /// allowable parameters of the datablock. 1745 /// @param yfov The vertical FOV in degrees to test. 1746 /// @see ShapeBaseData::cameraMinFov 1747 /// @see ShapeBaseData::cameraMaxFov 1748 virtual bool isValidCameraFov(F32 fov); 1749 /// @} 1750 1751 1752 void processTick(const Move *move); 1753 void advanceTime(F32 dt); 1754 1755 /// @name Rendering 1756 /// @{ 1757 1758 /// Returns the renderable shape of this object 1759 TSShape const* getShape(); 1760 1761 /// @see SceneObject 1762 virtual void prepRenderImage( SceneRenderState* state ); 1763 1764 /// Used from ShapeBase::_prepRenderImage() to submit render 1765 /// instances for the main shape or its mounted elements. 1766 virtual void prepBatchRender( SceneRenderState *state, S32 mountedImageIndex ); 1767 1768 /// Preprender logic 1769 virtual void calcClassRenderData() { } 1770 1771 /// Virtualize this so other classes may override it for custom reasons. 1772 virtual void renderMountedImage( U32 imageSlot, TSRenderState &rstate, SceneRenderState *state ); 1773 /// @} 1774 1775 /// Control object scoping 1776 void onCameraScopeQuery(NetConnection *cr, CameraScopeQuery *camInfo); 1777 1778 bool castRay(const Point3F &start, const Point3F &end, RayInfo* info); 1779 bool castRayRendered(const Point3F &start, const Point3F &end, RayInfo* info); 1780 bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere); 1781 void buildConvex(const Box3F& box, Convex* convex); 1782 1783 /// @name Rendering 1784 /// @{ 1785 1786 /// Increments the last rendered frame number 1787 static void incRenderFrame() { sLastRenderFrame++; } 1788 1789 /// Returns true if the last frame calculated rendered 1790 bool didRenderLastRender() { return mLastRenderFrame == sLastRenderFrame; } 1791 1792 /// Sets the state of this object as hidden or not. If an object is hidden 1793 /// it is removed entirely from collisions, it is not ghosted and is 1794 /// essentially "non existant" as far as simulation is concerned. 1795 /// @param hidden True if object is to be hidden 1796 virtual void setHidden(bool hidden); 1797 1798 /// Returns true if this object can be damaged 1799 bool isInvincible(); 1800 1801 /// Start fade of object in/out 1802 /// @param fadeTime Time fade should take 1803 /// @param fadeDelay Delay before starting fade 1804 /// @param fadeOut True if object is fading out, false if fading in. 1805 void startFade( F32 fadeTime, F32 fadeDelay = 0.0, bool fadeOut = true ); 1806 1807 /// Traverses mounted objects and registers light sources with the light manager 1808 /// @param lightManager Light manager to register with 1809 /// @param lightingScene Set to true if the scene is being lit, in which case these lights will not be used 1810 //void registerLights(LightManager * lightManager, bool lightingScene); 1811 1812 // ISceneLight 1813 virtual void submitLights( LightManager *lm, bool staticLighting ); 1814 virtual LightInfo* getLight() { return NULL; } 1815 1816 /// @} 1817 1818 /// Returns true if the point specified is in the water 1819 /// @param point Point to test in world space 1820 bool pointInWater( Point3F &point ); 1821 1822 /// Returns the percentage of this object covered by water 1823 F32 getWaterCoverage() { return mWaterCoverage; } 1824 1825 /// Returns the height of the liquid on this object 1826 F32 getLiquidHeight() { return mLiquidHeight; } 1827 1828 virtual WaterObject* getCurrentWaterObject(); 1829 1830 void setCurrentWaterObject( WaterObject *obj ); 1831 1832 virtual F32 getMass() const { return mMass; } 1833 1834 /// @name Network 1835 /// @{ 1836 1837 F32 getUpdatePriority(CameraScopeQuery *focusObject, U32 updateMask, S32 updateSkips); 1838 U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream); 1839 void unpackUpdate(NetConnection *conn, BitStream *stream); 1840 void writePacketData(GameConnection *conn, BitStream *stream); 1841 void readPacketData(GameConnection *conn, BitStream *stream); 1842 1843 /// @} 1844 1845 DECLARE_CONOBJECT(ShapeBase); 1846 1847protected: 1848 DECLARE_CALLBACK( F32, validateCameraFov, (F32 fov) ); 1849 1850}; 1851 1852 1853//------------------------------------------------------------------------------ 1854// inlines 1855//------------------------------------------------------------------------------ 1856 1857inline bool ShapeBase::getCloakedState() 1858{ 1859 return(mCloaked); 1860} 1861 1862inline F32 ShapeBase::getCloakLevel() 1863{ 1864 return(mCloakLevel); 1865} 1866 1867inline const char* ShapeBase::getShapeName() 1868{ 1869 return mShapeNameHandle.getString(); 1870} 1871 1872inline const char* ShapeBase::getSkinName() 1873{ 1874 return mSkinNameHandle.getString(); 1875} 1876 1877inline WaterObject* ShapeBase::getCurrentWaterObject() 1878{ 1879 if ( isMounted() && mShapeBaseMount ) 1880 return mShapeBaseMount->getCurrentWaterObject(); 1881 1882 return mCurrentWaterObject; 1883} 1884 1885#endif // _H_SHAPEBASE_ 1886
