diff --git a/Engine/source/.gitattributes b/Engine/source/.gitattributes new file mode 100644 index 000000000..abf67ea1d --- /dev/null +++ b/Engine/source/.gitattributes @@ -0,0 +1,5 @@ +*.cpp filter=tabspace +*.h filter=tabspace +*.l filter=tabspace +*.y filter=tabspace +*.mm filter=tabspace diff --git a/Engine/source/T3D/aiPlayer.cpp b/Engine/source/T3D/aiPlayer.cpp index e952c2a8c..38a3133e6 100644 --- a/Engine/source/T3D/aiPlayer.cpp +++ b/Engine/source/T3D/aiPlayer.cpp @@ -35,9 +35,9 @@ static U32 sAIPlayerLoSMask = TerrainObjectType | StaticShapeObjectType | Static IMPLEMENT_CO_NETOBJECT_V1(AIPlayer); ConsoleDocClass( AIPlayer, - "@brief A Player object not controlled by conventional input, but by an AI engine.\n\n" + "@brief A Player object not controlled by conventional input, but by an AI engine.\n\n" - "The AIPlayer provides a Player object that may be controlled from script. You control " + "The AIPlayer provides a Player object that may be controlled from script. You control " "where the player moves and how fast. You may also set where the AIPlayer is aiming at " "-- either a location or another game object.\n\n" @@ -70,19 +70,19 @@ ConsoleDocClass( AIPlayer, "position to the center of the target's bounding box. The LOS ray test only checks against interiors, " "statis shapes, and terrain.\n\n" - "@tsexample\n" - "// Create the demo player object\n" - "%player = new AiPlayer()\n" - "{\n" - " dataBlock = DemoPlayer;\n" - " path = \"\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create the demo player object\n" + "%player = new AiPlayer()\n" + "{\n" + " dataBlock = DemoPlayer;\n" + " path = \"\";\n" + "};\n" + "@endtsexample\n\n" - "@see Player for a list of all inherited functions, variables, and base description\n" + "@see Player for a list of all inherited functions, variables, and base description\n" - "@ingroup AI\n" - "@ingroup gameObjects\n"); + "@ingroup AI\n" + "@ingroup gameObjects\n"); /** * Constructor */ @@ -147,7 +147,7 @@ void AIPlayer::initPersistFields() addField( "AttackRadius", TypeF32, Offset( mAttackRadius, AIPlayer ), "@brief Distance considered in firing range for callback purposes."); - + endGroup( "AI" ); #ifdef TORQUE_NAVIGATION_ENABLED @@ -399,11 +399,11 @@ bool AIPlayer::getAIMove(Move *movePtr) { clearPath(); mMoveState = ModeStop; - throwCallback("onTargetInRange"); + throwCallback("onTargetInRange"); } else if((getPosition() - mFollowData.object->getPosition()).len() < mAttackRadius) { - throwCallback("onTargetInFiringRange"); + throwCallback("onTargetInFiringRange"); } } } @@ -854,7 +854,7 @@ DefineEngineMethod(AIPlayer, getPathDestination, Point3F, (),, "@see setPathDestination()\n") { - return object->getPathDestination(); + return object->getPathDestination(); } void AIPlayer::followNavPath(NavPath *path) @@ -1148,7 +1148,7 @@ DefineEngineMethod( AIPlayer, setMoveSpeed, void, ( F32 speed ),, "@see getMoveDestination()\n") { - object->setMoveSpeed(speed); + object->setMoveSpeed(speed); } DefineEngineMethod( AIPlayer, getMoveSpeed, F32, ( ),, @@ -1186,7 +1186,7 @@ DefineEngineMethod( AIPlayer, getMoveDestination, Point3F, (),, "@see setMoveDestination()\n") { - return object->getMoveDestination(); + return object->getMoveDestination(); } DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),, @@ -1196,7 +1196,7 @@ DefineEngineMethod( AIPlayer, setAimLocation, void, ( Point3F target ),, "@see getAimLocation()\n") { - object->setAimLocation(target); + object->setAimLocation(target); } DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),, @@ -1212,7 +1212,7 @@ DefineEngineMethod( AIPlayer, getAimLocation, Point3F, (),, "@see setAimLocation()\n" "@see setAimObject()\n") { - return object->getAimLocation(); + return object->getAimLocation(); } ConsoleDocFragment _setAimObject( @@ -1240,7 +1240,7 @@ ConsoleDocFragment _setAimObject( DefineConsoleMethod( AIPlayer, setAimObject, void, ( const char * objName, Point3F offset ), (Point3F::Zero), "( GameBase obj, [Point3F offset] )" "Sets the bot's target object. Optionally set an offset from target location." - "@hide") + "@hide") { // Find the target @@ -1262,7 +1262,7 @@ DefineEngineMethod( AIPlayer, getAimObject, S32, (),, "@see setAimObject()\n") { - GameBase* obj = object->getAimObject(); + GameBase* obj = object->getAimObject(); return obj? obj->getId(): -1; } diff --git a/Engine/source/T3D/camera.cpp b/Engine/source/T3D/camera.cpp index a2acc3838..3a3fb9e4d 100644 --- a/Engine/source/T3D/camera.cpp +++ b/Engine/source/T3D/camera.cpp @@ -1351,7 +1351,7 @@ void Camera::consoleInit() // ExtendedMove support Con::addVariable("$camera::extendedMovePosRotIndex", TypeS32, &smExtendedMovePosRotIndex, "@brief The ExtendedMove position/rotation index used for camera movements.\n\n" - "@ingroup BaseCamera\n"); + "@ingroup BaseCamera\n"); } //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index 2d2491a7f..812fa099d 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -546,7 +546,7 @@ void DecalManager::removeDecal( DecalInstance *inst ) // Remove the decal from the instance vector. - if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() ) + if( inst->mId != -1 && inst->mId < mDecalInstanceVec.size() ) mDecalInstanceVec[ inst->mId ] = NULL; // Release its geometry (if it has any). @@ -674,23 +674,23 @@ DecalInstance* DecalManager::raycast( const Point3F &start, const Point3F &end, if ( !worldSphere.intersectsRay( start, end ) ) continue; - - RayInfo ri; - bool containsPoint = false; - if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) ) - { - Point2F poly[4]; - poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); - poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); - poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); - poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); - - if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) ) - containsPoint = true; - } + + RayInfo ri; + bool containsPoint = false; + if ( gServerContainer.castRayRendered( start, end, STATIC_COLLISION_TYPEMASK, &ri ) ) + { + Point2F poly[4]; + poly[0].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); + poly[1].set( inst->mPosition.x - (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); + poly[2].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y - (inst->mSize / 2)); + poly[3].set( inst->mPosition.x + (inst->mSize / 2), inst->mPosition.y + (inst->mSize / 2)); + + if ( MathUtils::pointInPolygon( poly, 4, Point2F(ri.point.x, ri.point.y) ) ) + containsPoint = true; + } - if( !containsPoint ) - continue; + if( !containsPoint ) + continue; hitDecals.push_back( inst ); } @@ -1406,7 +1406,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) query.init( rootFrustum.getPosition(), rootFrustum.getTransform().getForwardVector(), rootFrustum.getFarDist() ); - query.getLights( baseRenderInst.lights, 8 ); + query.getLights( baseRenderInst.lights, 8 ); } // Submit render inst... @@ -1575,7 +1575,7 @@ void DecalManager::clearData() } mData = NULL; - mDecalInstanceVec.clear(); + mDecalInstanceVec.clear(); _freePools(); } @@ -1758,7 +1758,7 @@ DefineEngineFunction( decalManagerEditDecal, bool, ( S32 decalID, Point3F pos, P { DecalInstance *decalInstance = gDecalManager->getDecal( decalID ); if( !decalInstance ) - return false; + return false; //Internally we need Point3F tangent instead of the user friendly F32 rotAroundNormal MatrixF mat( true ); diff --git a/Engine/source/T3D/fx/lightning.cpp b/Engine/source/T3D/fx/lightning.cpp index 027b329e5..767cb44f1 100644 --- a/Engine/source/T3D/fx/lightning.cpp +++ b/Engine/source/T3D/fx/lightning.cpp @@ -540,8 +540,8 @@ void Lightning::renderObject(ObjectRenderInst *ri, SceneRenderState *state, Base } //GFX->setZWriteEnable(true); - //GFX->setAlphaTestEnable(false); - //GFX->setAlphaBlendEnable(false); + //GFX->setAlphaTestEnable(false); + //GFX->setAlphaBlendEnable(false); } void Lightning::scheduleThunder(Strike* newStrike) @@ -743,9 +743,9 @@ void Lightning::warningFlashes() { LightningStrikeEvent* pEvent = new LightningStrikeEvent; pEvent->mLightning = this; - - pEvent->mStart.x = strikePoint.x; - pEvent->mStart.y = strikePoint.y; + + pEvent->mStart.x = strikePoint.x; + pEvent->mStart.y = strikePoint.y; nc->postNetEvent(pEvent); } @@ -905,7 +905,7 @@ void Lightning::strikeObject(ShapeBase* targetObj) { LightningStrikeEvent* pEvent = new LightningStrikeEvent; pEvent->mLightning = this; - + pEvent->mStart.x = strikePoint.x; pEvent->mStart.y = strikePoint.y; pEvent->mTarget = targetObj; @@ -1100,7 +1100,7 @@ void LightningBolt::render( const Point3F &camPos ) renderSegment(mMinorNodes[i], camPos, false); } - PrimBuild::end(); + PrimBuild::end(); for(LightingBoltList::Iterator i = splitList.begin(); i != splitList.end(); ++i) { @@ -1230,7 +1230,7 @@ void LightningBolt::createSplit( const Point3F &startingPoint, const Point3F &en { if( depth == 0 ) return; - + F32 chanceToEnd = gRandGen.randF(); if( chanceToEnd > 0.70f ) return; @@ -1275,7 +1275,7 @@ void LightningBolt::startSplits() for( U32 i=0; i 0.3f ) - continue; + continue; Node node = mMajorNodes.nodeList[i]; Node node2 = mMajorNodes.nodeList[i+1]; diff --git a/Engine/source/T3D/physics/bullet/btBody.cpp b/Engine/source/T3D/physics/bullet/btBody.cpp index 33d0240a4..32e8945c9 100644 --- a/Engine/source/T3D/physics/bullet/btBody.cpp +++ b/Engine/source/T3D/physics/bullet/btBody.cpp @@ -76,7 +76,7 @@ bool BtBody::init( PhysicsCollision *shape, AssertFatal( shape, "BtBody::init - Got a null collision shape!" ); AssertFatal( dynamic_cast( shape ), "BtBody::init - The collision shape is the wrong type!" ); AssertFatal( ((BtCollision*)shape)->getShape(), "BtBody::init - Got empty collision shape!" ); - + // Cleanup any previous actor. _releaseActor(); @@ -97,20 +97,20 @@ bool BtBody::init( PhysicsCollision *shape, btScalar *masses = new btScalar[ btCompound->getNumChildShapes() ]; for ( U32 j=0; j < btCompound->getNumChildShapes(); j++ ) - masses[j] = mass / btCompound->getNumChildShapes(); + masses[j] = mass / btCompound->getNumChildShapes(); btVector3 principalInertia; btTransform principal; btCompound->calculatePrincipalAxisTransform( masses, principal, principalInertia ); delete [] masses; - // Create a new compound with the shifted children. - btColShape = mCompound = new btCompoundShape(); - for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ ) - { - btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i); - mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) ); - } + // Create a new compound with the shifted children. + btColShape = mCompound = new btCompoundShape(); + for ( U32 i=0; i < btCompound->getNumChildShapes(); i++ ) + { + btTransform newChildTransform = principal.inverse() * btCompound->getChildTransform(i); + mCompound->addChildShape( newChildTransform, btCompound->getChildShape(i) ); + } localXfm = btCast( principal ); } diff --git a/Engine/source/T3D/physics/bullet/btWorld.cpp b/Engine/source/T3D/physics/bullet/btWorld.cpp index 0ad7418b8..0e71666d1 100644 --- a/Engine/source/T3D/physics/bullet/btWorld.cpp +++ b/Engine/source/T3D/physics/bullet/btWorld.cpp @@ -53,7 +53,7 @@ bool BtWorld::initWorld( bool isServer, ProcessList *processList ) { // Collision configuration contains default setup for memory, collision setup. mCollisionConfiguration = new btDefaultCollisionConfiguration(); - mDispatcher = new btCollisionDispatcher( mCollisionConfiguration ); + mDispatcher = new btCollisionDispatcher( mCollisionConfiguration ); btVector3 worldMin( -2000, -2000, -1000 ); btVector3 worldMax( 2000, 2000, 1000 ); diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index 627b38a35..662fa9769 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -242,7 +242,7 @@ void PhysicsShapeData::onRemove() void PhysicsShapeData::_onResourceChanged( const Torque::Path &path ) { - if ( path != Path( shapeName ) ) + if ( path != Path( shapeName ) ) return; // Reload the changed shape. @@ -360,8 +360,8 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer ) Vector mHulls; }; - DecompDesc d; - d.mVcount = polyList.mVertexList.size(); + DecompDesc d; + d.mVcount = polyList.mVertexList.size(); d.mVertices = doubleVerts.address(); d.mTcount = polyList.mIndexList.size() / 3; d.mIndices = polyList.mIndexList.address(); @@ -659,7 +659,7 @@ void PhysicsShape::onRemove() PhysicsPlugin::getPhysicsResetSignal().remove( this, &PhysicsShape::_onPhysicsReset ); if ( mDestroyedShape ) - mDestroyedShape->deleteObject(); + mDestroyedShape->deleteObject(); } // Remove the resource change signal. diff --git a/Engine/source/T3D/physics/physx3/px3Body.cpp b/Engine/source/T3D/physics/physx3/px3Body.cpp index 2d5fb46f7..ec4e3b979 100644 --- a/Engine/source/T3D/physics/physx3/px3Body.cpp +++ b/Engine/source/T3D/physics/physx3/px3Body.cpp @@ -80,7 +80,7 @@ bool Px3Body::init( PhysicsCollision *shape, AssertFatal( shape, "Px3Body::init - Got a null collision shape!" ); AssertFatal( dynamic_cast( shape ), "Px3Body::init - The collision shape is the wrong type!" ); AssertFatal( !((Px3Collision*)shape)->getShapes().empty(), "Px3Body::init - Got empty collision shape!" ); - + // Cleanup any previous actor. _releaseActor(); @@ -94,10 +94,10 @@ bool Px3Body::init( PhysicsCollision *shape, if ( isKinematic ) { - mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); - physx::PxRigidDynamic *actor = mActor->is(); - actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true); - actor->setMass(getMax( mass, 1.0f )); + mActor = gPhysics3SDK->createRigidDynamic(physx::PxTransform(physx::PxIDENTITY())); + physx::PxRigidDynamic *actor = mActor->is(); + actor->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, true); + actor->setMass(getMax( mass, 1.0f )); } else if ( mass > 0.0f ) { @@ -107,7 +107,7 @@ bool Px3Body::init( PhysicsCollision *shape, { mActor = gPhysics3SDK->createRigidStatic(physx::PxTransform(physx::PxIDENTITY())); mIsStatic = true; - } + } mMaterial = gPhysics3SDK->createMaterial(0.6f,0.4f,0.1f); @@ -115,22 +115,22 @@ bool Px3Body::init( PhysicsCollision *shape, const Vector &shapes = mColShape->getShapes(); for ( U32 i=0; i < shapes.size(); i++ ) { - Px3CollisionDesc* desc = shapes[i]; - if( mass > 0.0f ) - { - if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH) - { - Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); - } - } - physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial); - physx::PxFilterData colData; - if(isDebris) - colData.word0 = PX3_DEBRIS; - else if(isTrigger) + Px3CollisionDesc* desc = shapes[i]; + if( mass > 0.0f ) + { + if(desc->pGeometry->getType() == physx::PxGeometryType::eTRIANGLEMESH) + { + Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); + } + } + physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial); + physx::PxFilterData colData; + if(isDebris) + colData.word0 = PX3_DEBRIS; + else if(isTrigger) colData.word0 = PX3_TRIGGER; - else - colData.word0 = PX3_DEFAULT; + else + colData.word0 = PX3_DEFAULT; //set local pose - actor->createShape with a local pose is deprecated in physx 3.3 pShape->setLocalPose(desc->pose); @@ -145,8 +145,8 @@ bool Px3Body::init( PhysicsCollision *shape, //mass & intertia has to be set after creating the shape if ( mass > 0.0f ) { - physx::PxRigidDynamic *actor = mActor->is(); - physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); + physx::PxRigidDynamic *actor = mActor->is(); + physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); } // This sucks, but it has to happen if we want @@ -178,9 +178,9 @@ void Px3Body::setMaterial( F32 restitution, actor->wakeUp(); } - mMaterial->setRestitution(restitution); - mMaterial->setStaticFriction(staticFriction); - mMaterial->setDynamicFriction(friction); + mMaterial->setRestitution(restitution); + mMaterial->setStaticFriction(staticFriction); + mMaterial->setDynamicFriction(friction); } @@ -189,7 +189,7 @@ void Px3Body::setSleepThreshold( F32 linear, F32 angular ) AssertFatal( mActor, "Px3Body::setSleepThreshold - The actor is null!" ); if(mIsStatic) - return; + return; physx::PxRigidDynamic *actor = mActor->is(); physx::PxF32 massNormalized= (linear*linear+angular*angular)/2.0f; @@ -200,7 +200,7 @@ void Px3Body::setDamping( F32 linear, F32 angular ) { AssertFatal( mActor, "Px3Body::setDamping - The actor is null!" ); if(mIsStatic) - return; + return; physx::PxRigidDynamic *actor = mActor->is(); actor->setLinearDamping( linear ); @@ -227,7 +227,7 @@ F32 Px3Body::getMass() const { AssertFatal( mActor, "PxBody::getCMassPosition - The actor is null!" ); if(mIsStatic) - return 0; + return 0; const physx::PxRigidDynamic *actor = mActor->is(); return actor->getMass(); @@ -237,7 +237,7 @@ Point3F Px3Body::getCMassPosition() const { AssertFatal( mActor, "Px3Body::getCMassPosition - The actor is null!" ); if(mIsStatic) - return px3Cast(mActor->getGlobalPose().p); + return px3Cast(mActor->getGlobalPose().p); physx::PxRigidDynamic *actor = mActor->is(); physx::PxTransform pose = actor->getGlobalPose() * actor->getCMassLocalPose(); @@ -326,11 +326,11 @@ Box3F Px3Body::getWorldBounds() U32 shapeCount = mActor->getNbShapes(); - physx::PxShape **shapes = new physx::PxShape*[shapeCount]; - mActor->getShapes(shapes, shapeCount); + physx::PxShape **shapes = new physx::PxShape*[shapeCount]; + mActor->getShapes(shapes, shapeCount); for ( U32 i = 0; i < shapeCount; i++ ) { - // Get the shape's bounds. + // Get the shape's bounds. shapeBounds = physx::PxShapeExt::getWorldBounds(*shapes[i],*mActor); // Combine them into the total bounds. bounds.include( shapeBounds ); @@ -355,11 +355,11 @@ void Px3Body::setSimulationEnabled( bool enabled ) mWorld->releaseWriteLock(); U32 shapeCount = mActor->getNbShapes(); - physx::PxShape **shapes = new physx::PxShape*[shapeCount]; - mActor->getShapes(shapes, shapeCount); + physx::PxShape **shapes = new physx::PxShape*[shapeCount]; + mActor->getShapes(shapes, shapeCount); for ( S32 i = 0; i < mActor->getNbShapes(); i++ ) { - shapes[i]->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,!mIsEnabled);//????? + shapes[i]->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE,!mIsEnabled);//????? } delete [] shapes; @@ -377,10 +377,10 @@ void Px3Body::setTransform( const MatrixF &transform ) mActor->setGlobalPose(px3Cast(transform),false); if(mIsStatic) - return; + return; - physx::PxRigidDynamic *actor = mActor->is(); - bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; + physx::PxRigidDynamic *actor = mActor->is(); + bool kinematic = actor->getRigidDynamicFlags() & physx::PxRigidDynamicFlag::eKINEMATIC; // If its dynamic we have more to do. if ( isDynamic() && !kinematic ) { @@ -412,8 +412,8 @@ void Px3Body::applyImpulse( const Point3F &origin, const Point3F &force ) physx::PxRigidDynamic *actor = mActor->is(); if ( mIsEnabled && isDynamic() ) physx::PxRigidBodyExt::addForceAtPos(*actor,px3Cast(force), - px3Cast(origin), - physx::PxForceMode::eIMPULSE); + px3Cast(origin), + physx::PxForceMode::eIMPULSE); } diff --git a/Engine/source/T3D/physics/physx3/px3Body.h b/Engine/source/T3D/physics/physx3/px3Body.h index 7873293bc..30f6f8895 100644 --- a/Engine/source/T3D/physics/physx3/px3Body.h +++ b/Engine/source/T3D/physics/physx3/px3Body.h @@ -41,9 +41,9 @@ class Px3Collision; struct Px3CollisionDesc; namespace physx{ - class PxRigidActor; - class PxMaterial; - class PxShape; + class PxRigidActor; + class PxMaterial; + class PxShape; } diff --git a/Engine/source/T3D/physics/physx3/px3World.cpp b/Engine/source/T3D/physics/physx3/px3World.cpp index 026d77832..a3732634e 100644 --- a/Engine/source/T3D/physics/physx3/px3World.cpp +++ b/Engine/source/T3D/physics/physx3/px3World.cpp @@ -71,113 +71,113 @@ Px3World::~Px3World() physx::PxCooking *Px3World::getCooking() { - return smCooking; + return smCooking; } bool Px3World::restartSDK( bool destroyOnly, Px3World *clientWorld, Px3World *serverWorld) { - // If either the client or the server still exist - // then we cannot reset the SDK. - if ( clientWorld || serverWorld ) - return false; + // If either the client or the server still exist + // then we cannot reset the SDK. + if ( clientWorld || serverWorld ) + return false; - if(smPvdConnection) - smPvdConnection->release(); + if(smPvdConnection) + smPvdConnection->release(); - if(smCooking) - smCooking->release(); + if(smCooking) + smCooking->release(); - if(smCpuDispatcher) - smCpuDispatcher->release(); + if(smCpuDispatcher) + smCpuDispatcher->release(); // Destroy the existing SDK. - if ( gPhysics3SDK ) - { - PxCloseExtensions(); - gPhysics3SDK->release(); - } + if ( gPhysics3SDK ) + { + PxCloseExtensions(); + gPhysics3SDK->release(); + } if(smErrorCallback) { SAFE_DELETE(smErrorCallback); } - if(smFoundation) - { - smFoundation->release(); - SAFE_DELETE(smErrorCallback); - } + if(smFoundation) + { + smFoundation->release(); + SAFE_DELETE(smErrorCallback); + } - // If we're not supposed to restart... return. - if ( destroyOnly ) + // If we're not supposed to restart... return. + if ( destroyOnly ) return true; - bool memTrack = false; + bool memTrack = false; #ifdef TORQUE_DEBUG - memTrack = true; + memTrack = true; #endif - smErrorCallback = new Px3ConsoleStream; - smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback); - smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation); - gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager); + smErrorCallback = new Px3ConsoleStream; + smFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, smMemoryAlloc, *smErrorCallback); + smProfileZoneManager = &physx::PxProfileZoneManager::createProfileZoneManager(smFoundation); + gPhysics3SDK = PxCreatePhysics(PX_PHYSICS_VERSION, *smFoundation, physx::PxTolerancesScale(),memTrack,smProfileZoneManager); - if ( !gPhysics3SDK ) - { - Con::errorf( "PhysX3 failed to initialize!" ); - Platform::messageBox( Con::getVariable( "$appName" ), + if ( !gPhysics3SDK ) + { + Con::errorf( "PhysX3 failed to initialize!" ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); - Platform::forceShutdown( -1 ); + Platform::forceShutdown( -1 ); - // We shouldn't get here, but this shuts up - // source diagnostic tools. - return false; - } + // We shouldn't get here, but this shuts up + // source diagnostic tools. + return false; + } - if(!PxInitExtensions(*gPhysics3SDK)) - { - Con::errorf( "PhysX3 failed to initialize extensions!" ); - Platform::messageBox( Con::getVariable( "$appName" ), + if(!PxInitExtensions(*gPhysics3SDK)) + { + Con::errorf( "PhysX3 failed to initialize extensions!" ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); - Platform::forceShutdown( -1 ); - return false; - } + Platform::forceShutdown( -1 ); + return false; + } - smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale())); - if(!smCooking) - { - Con::errorf( "PhysX3 failed to initialize cooking!" ); - Platform::messageBox( Con::getVariable( "$appName" ), + smCooking = PxCreateCooking(PX_PHYSICS_VERSION, *smFoundation, physx::PxCookingParams(physx::PxTolerancesScale())); + if(!smCooking) + { + Con::errorf( "PhysX3 failed to initialize cooking!" ); + Platform::messageBox( Con::getVariable( "$appName" ), avar("PhysX3 could not be started!\r\n"), MBOk, MIStop ); - Platform::forceShutdown( -1 ); - return false; - } + Platform::forceShutdown( -1 ); + return false; + } #ifdef TORQUE_DEBUG - physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags()); - smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(), - "localhost", 5425, 100, connectionFlags); + physx::PxVisualDebuggerConnectionFlags connectionFlags(physx::PxVisualDebuggerExt::getAllConnectionFlags()); + smPvdConnection = physx::PxVisualDebuggerExt::createConnection(gPhysics3SDK->getPvdConnectionManager(), + "localhost", 5425, 100, connectionFlags); #endif - return true; + return true; } void Px3World::destroyWorld() { - getPhysicsResults(); + getPhysicsResults(); mRenderBuffer = NULL; - // Release the tick processing signals. - if ( mProcessList ) - { - mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults ); - mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics ); - mProcessList = NULL; - } + // Release the tick processing signals. + if ( mProcessList ) + { + mProcessList->preTickSignal().remove( this, &Px3World::getPhysicsResults ); + mProcessList->postTickSignal().remove( this, &Px3World::tickPhysics ); + mProcessList = NULL; + } if(mControllerManager) { @@ -185,13 +185,13 @@ void Px3World::destroyWorld() mControllerManager = NULL; } - // Destroy the scene. - if ( mScene ) - { - // Release the scene. - mScene->release(); - mScene = NULL; - } + // Destroy the scene. + if ( mScene ) + { + // Release the scene. + mScene->release(); + mScene = NULL; + } } bool Px3World::initWorld( bool isServer, ProcessList *processList ) @@ -203,7 +203,7 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList ) } mIsServer = isServer; - + physx::PxSceneDesc sceneDesc(gPhysics3SDK->getTolerancesScale()); sceneDesc.gravity = px3Cast(mGravity); @@ -217,26 +217,26 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList ) sceneDesc.cpuDispatcher = smCpuDispatcher; Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount()); } - + sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD; sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS; sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader; - mScene = gPhysics3SDK->createScene(sceneDesc); + mScene = gPhysics3SDK->createScene(sceneDesc); //cache renderbuffer for use with debug drawing mRenderBuffer = const_cast(&mScene->getRenderBuffer()); - physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f ); - mScene->setDominanceGroupPair(0,31,debrisDominance); + physx::PxDominanceGroupPair debrisDominance( 0.0f, 1.0f ); + mScene->setDominanceGroupPair(0,31,debrisDominance); mControllerManager = PxCreateControllerManager(*mScene); - AssertFatal( processList, "Px3World::init() - We need a process list to create the world!" ); - mProcessList = processList; - mProcessList->preTickSignal().notify( this, &Px3World::getPhysicsResults ); - mProcessList->postTickSignal().notify( this, &Px3World::tickPhysics, 1000.0f ); + AssertFatal( processList, "Px3World::init() - We need a process list to create the world!" ); + mProcessList = processList; + mProcessList->preTickSignal().notify( this, &Px3World::getPhysicsResults ); + mProcessList->postTickSignal().notify( this, &Px3World::tickPhysics, 1000.0f ); - return true; + return true; } // Most of this borrowed from bullet physics library, see btDiscreteDynamicsWorld.cpp bool Px3World::_simulate(const F32 dt) @@ -249,21 +249,21 @@ bool Px3World::_simulate(const F32 dt) numSimulationSubSteps = S32(mAccumulator / smPhysicsStepTime); mAccumulator -= numSimulationSubSteps * smPhysicsStepTime; } - if (numSimulationSubSteps) - { - //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt - S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps; - - for (S32 i=0;ifetchResults(true); - mScene->simulate(smPhysicsStepTime); - } - } - - mIsSimulating = true; + if (numSimulationSubSteps) + { + //clamp the number of substeps, to prevent simulation grinding spiralling down to a halt + S32 clampedSimulationSteps = (numSimulationSubSteps > smPhysicsMaxSubSteps)? smPhysicsMaxSubSteps : numSimulationSubSteps; + + for (S32 i=0;ifetchResults(true); + mScene->simulate(smPhysicsStepTime); + } + } + + mIsSimulating = true; - return true; + return true; } void Px3World::tickPhysics( U32 elapsedMs ) @@ -290,45 +290,45 @@ void Px3World::tickPhysics( U32 elapsedMs ) void Px3World::getPhysicsResults() { - if ( !mScene || !mIsSimulating ) - return; + if ( !mScene || !mIsSimulating ) + return; - PROFILE_SCOPE(Px3World_GetPhysicsResults); + PROFILE_SCOPE(Px3World_GetPhysicsResults); - // Get results from scene. - mScene->fetchResults(true); - mIsSimulating = false; - mTickCount++; + // Get results from scene. + mScene->fetchResults(true); + mIsSimulating = false; + mTickCount++; // Con::printf( "%s PhysXWorld::getPhysicsResults!", this == smClientWorld ? "Client" : "Server" ); } void Px3World::releaseWriteLocks() { - Px3World *world = dynamic_cast( PHYSICSMGR->getWorld( "server" ) ); + Px3World *world = dynamic_cast( PHYSICSMGR->getWorld( "server" ) ); - if ( world ) - world->releaseWriteLock(); + if ( world ) + world->releaseWriteLock(); - world = dynamic_cast( PHYSICSMGR->getWorld( "client" ) ); + world = dynamic_cast( PHYSICSMGR->getWorld( "client" ) ); - if ( world ) - world->releaseWriteLock(); + if ( world ) + world->releaseWriteLock(); } void Px3World::releaseWriteLock() { - if ( !mScene || !mIsSimulating ) - return; + if ( !mScene || !mIsSimulating ) + return; - PROFILE_SCOPE(PxWorld_ReleaseWriteLock); + PROFILE_SCOPE(PxWorld_ReleaseWriteLock); - // We use checkResults here to release the write lock - // but we do not change the simulation flag or increment - // the tick count... we may have gotten results, but the - // simulation hasn't really ticked! - mScene->checkResults( true ); - //AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" ); + // We use checkResults here to release the write lock + // but we do not change the simulation flag or increment + // the tick count... we may have gotten results, but the + // simulation hasn't really ticked! + mScene->checkResults( true ); + //AssertFatal( mScene->isWritable(), "PhysX3World::releaseWriteLock() - We should have been writable now!" ); } void Px3World::lockScenes() @@ -390,7 +390,7 @@ void Px3World::unlockScene() bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ) { - physx::PxVec3 orig = px3Cast( startPnt ); + physx::PxVec3 orig = px3Cast( startPnt ); physx::PxVec3 dir = px3Cast( endPnt - startPnt ); physx::PxF32 maxDist = dir.magnitude(); dir.normalize(); @@ -404,11 +404,11 @@ bool Px3World::castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo physx::PxRaycastBuffer buf; if(!mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData)) - return false; + return false; if(!buf.hasBlock) - return false; + return false; - const physx::PxRaycastHit hit = buf.block; + const physx::PxRaycastHit hit = buf.block; physx::PxRigidActor *actor = hit.actor; PhysicsUserData *userData = PhysicsUserData::cast( actor->userData ); @@ -456,15 +456,15 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo physx::PxHitFlags outFlags(physx::PxHitFlag::eDISTANCE | physx::PxHitFlag::eIMPACT | physx::PxHitFlag::eNORMAL); physx::PxQueryFilterData filterData; if(bodyTypes & BT_Static) - filterData.flags |= physx::PxQueryFlag::eSTATIC; + filterData.flags |= physx::PxQueryFlag::eSTATIC; if(bodyTypes & BT_Dynamic) - filterData.flags |= physx::PxQueryFlag::eDYNAMIC; + filterData.flags |= physx::PxQueryFlag::eDYNAMIC; filterData.data.word0 = groups; physx::PxRaycastBuffer buf; if( !mScene->raycast(orig,dir,maxDist,buf,outFlags,filterData) ) - return NULL; + return NULL; if(!buf.hasBlock) return NULL; @@ -478,7 +478,7 @@ PhysicsBody* Px3World::castRay( const Point3F &start, const Point3F &end, U32 bo void Px3World::explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ) { - physx::PxVec3 nxPos = px3Cast( pos ); + physx::PxVec3 nxPos = px3Cast( pos ); const physx::PxU32 bufferSize = 10; physx::PxSphereGeometry worldSphere(radius); physx::PxTransform pose(nxPos); @@ -520,14 +520,14 @@ void Px3World::setEnabled( bool enabled ) physx::PxController* Px3World::createController( physx::PxControllerDesc &desc ) { - if ( !mScene ) - return NULL; + if ( !mScene ) + return NULL; - // We need the writelock! - releaseWriteLock(); - physx::PxController* pController = mControllerManager->createController(desc); - AssertFatal( pController, "Px3World::createController - Got a null!" ); - return pController; + // We need the writelock! + releaseWriteLock(); + physx::PxController* pController = mControllerManager->createController(desc); + AssertFatal( pController, "Px3World::createController - Got a null!" ); + return pController; } static ColorI getDebugColor( physx::PxU32 packed ) diff --git a/Engine/source/T3D/physics/physx3/px3World.h b/Engine/source/T3D/physics/physx3/px3World.h index 72e67ddb9..5399c3f0a 100644 --- a/Engine/source/T3D/physics/physx3/px3World.h +++ b/Engine/source/T3D/physics/physx3/px3World.h @@ -42,66 +42,66 @@ class FixedStepper; enum Px3CollisionGroup { - PX3_DEFAULT = BIT(0), - PX3_PLAYER = BIT(1), - PX3_DEBRIS = BIT(2), - PX3_TRIGGER = BIT(3), + PX3_DEFAULT = BIT(0), + PX3_PLAYER = BIT(1), + PX3_DEBRIS = BIT(2), + PX3_TRIGGER = BIT(3), }; class Px3World : public PhysicsWorld { protected: - physx::PxScene* mScene; - bool mIsEnabled; - bool mIsSimulating; - bool mIsServer; + physx::PxScene* mScene; + bool mIsEnabled; + bool mIsSimulating; + bool mIsServer; bool mIsSceneLocked; - U32 mTickCount; - ProcessList *mProcessList; - F32 mEditorTimeScale; - bool mErrorReport; + U32 mTickCount; + ProcessList *mProcessList; + F32 mEditorTimeScale; + bool mErrorReport; physx::PxRenderBuffer *mRenderBuffer; - physx::PxControllerManager* mControllerManager; - static Px3ConsoleStream *smErrorCallback; - static physx::PxDefaultAllocator smMemoryAlloc; - static physx::PxFoundation* smFoundation; - static physx::PxCooking *smCooking; - static physx::PxProfileZoneManager* smProfileZoneManager; - static physx::PxDefaultCpuDispatcher* smCpuDispatcher; - static physx::PxVisualDebuggerConnection* smPvdConnection; - F32 mAccumulator; - bool _simulate(const F32 dt); + physx::PxControllerManager* mControllerManager; + static Px3ConsoleStream *smErrorCallback; + static physx::PxDefaultAllocator smMemoryAlloc; + static physx::PxFoundation* smFoundation; + static physx::PxCooking *smCooking; + static physx::PxProfileZoneManager* smProfileZoneManager; + static physx::PxDefaultCpuDispatcher* smCpuDispatcher; + static physx::PxVisualDebuggerConnection* smPvdConnection; + F32 mAccumulator; + bool _simulate(const F32 dt); public: - Px3World(); - virtual ~Px3World(); + Px3World(); + virtual ~Px3World(); - virtual bool initWorld( bool isServer, ProcessList *processList ); - virtual void destroyWorld(); - virtual void onDebugDraw( const SceneRenderState *state ); - virtual void reset() {} - virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); - virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); - virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); - virtual bool isEnabled() const { return mIsEnabled; } - physx::PxScene* getScene(){ return mScene;} - void setEnabled( bool enabled ); - U32 getTick() { return mTickCount; } + virtual bool initWorld( bool isServer, ProcessList *processList ); + virtual void destroyWorld(); + virtual void onDebugDraw( const SceneRenderState *state ); + virtual void reset() {} + virtual bool castRay( const Point3F &startPnt, const Point3F &endPnt, RayInfo *ri, const Point3F &impulse ); + virtual PhysicsBody* castRay( const Point3F &start, const Point3F &end, U32 bodyTypes = BT_All ); + virtual void explosion( const Point3F &pos, F32 radius, F32 forceMagnitude ); + virtual bool isEnabled() const { return mIsEnabled; } + physx::PxScene* getScene(){ return mScene;} + void setEnabled( bool enabled ); + U32 getTick() { return mTickCount; } void tickPhysics( U32 elapsedMs ); - void getPhysicsResults(); - void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } - const F32 getEditorTimeScale() const { return mEditorTimeScale; } - void releaseWriteLock(); - bool isServer(){return mIsServer;} - physx::PxController* createController( physx::PxControllerDesc &desc ); + void getPhysicsResults(); + void setEditorTimeScale( F32 timeScale ) { mEditorTimeScale = timeScale; } + const F32 getEditorTimeScale() const { return mEditorTimeScale; } + void releaseWriteLock(); + bool isServer(){return mIsServer;} + physx::PxController* createController( physx::PxControllerDesc &desc ); void lockScene(); void unlockScene(); - //static - static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); - static void releaseWriteLocks(); - static physx::PxCooking *getCooking(); + //static + static bool restartSDK( bool destroyOnly = false, Px3World *clientWorld = NULL, Px3World *serverWorld = NULL ); + static void releaseWriteLocks(); + static physx::PxCooking *getCooking(); static void lockScenes(); static void unlockScenes(); }; diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 7ae902ed8..627e8e433 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -80,7 +80,7 @@ EndImplementEnumType; ImplementEnumType( ShapeBaseImageLightType, "@brief The type of light to attach to this ShapeBaseImage.\n\n" "@ingroup gameObjects\n\n") - { ShapeBaseImageData::NoLight, "NoLight", "No light is attached.\n" }, + { ShapeBaseImageData::NoLight, "NoLight", "No light is attached.\n" }, { ShapeBaseImageData::ConstantLight, "ConstantLight", "A constant emitting light is attached.\n" }, { ShapeBaseImageData::SpotLight, "SpotLight", "A spotlight is attached.\n" }, { ShapeBaseImageData::PulsingLight, "PulsingLight", "A pusling light is attached.\n" }, @@ -1532,7 +1532,7 @@ bool ShapeBase::unmountImage(U32 imageSlot) { AssertFatal(imageSlotcreateSource( stateData.sound, &getRenderTransform(), &velocity )); + image.addSoundSource(SFX->createSource( stateData.sound, &getRenderTransform(), &velocity )); } // Play animation diff --git a/Engine/source/T3D/staticShape.cpp b/Engine/source/T3D/staticShape.cpp index c48a96aa1..6548e2161 100644 --- a/Engine/source/T3D/staticShape.cpp +++ b/Engine/source/T3D/staticShape.cpp @@ -45,48 +45,48 @@ static const U32 sgAllowedDynamicTypes = 0xffffff; IMPLEMENT_CO_DATABLOCK_V1(StaticShapeData); ConsoleDocClass( StaticShapeData, - "@brief The most basic ShapeBaseData derrived shape datablock available in Torque 3D.\n\n" + "@brief The most basic ShapeBaseData derrived shape datablock available in Torque 3D.\n\n" - "When it comes to placing 3D objects in the scene, you effectively have two options:\n\n" - "1. TSStatic objects\n\n" - "2. ShapeBase derived objects\n\n" + "When it comes to placing 3D objects in the scene, you effectively have two options:\n\n" + "1. TSStatic objects\n\n" + "2. ShapeBase derived objects\n\n" - "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " - "will use one of its child classes instead. Several game related objects are derived " - "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" + "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " + "will use one of its child classes instead. Several game related objects are derived " + "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" - "When you need a 3D object with datablock capabilities, you will use an object derived " - "from ShapeBase. When you need an object with extremely low overhead, and with no other " - "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" + "When you need a 3D object with datablock capabilities, you will use an object derived " + "from ShapeBase. When you need an object with extremely low overhead, and with no other " + "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" - "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " - "additional functionality you see in Player, Item, Vehicle or the other game play " - "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " + "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " + "additional functionality you see in Player, Item, Vehicle or the other game play " + "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " "a datablock provides a location for common variables as well as having access to " "various ShapeBaseData, GameBaseData and SimDataBlock callbacks.\n\n" - "@tsexample\n" - "// Create a StaticShape using a datablock\n" - "datablock StaticShapeData(BasicShapeData)\n" - "{\n" - " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" - " testVar = \"Simple string, not a stock variable\";\n" - "};\n\n" - "new StaticShape()\n" - "{\n" - " dataBlock = \"BasicShapeData\";\n" - " position = \"0.0 0.0 0.0\";\n" - " rotation = \"1 0 0 0\";\n" - " scale = \"1 1 1\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create a StaticShape using a datablock\n" + "datablock StaticShapeData(BasicShapeData)\n" + "{\n" + " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" + " testVar = \"Simple string, not a stock variable\";\n" + "};\n\n" + "new StaticShape()\n" + "{\n" + " dataBlock = \"BasicShapeData\";\n" + " position = \"0.0 0.0 0.0\";\n" + " rotation = \"1 0 0 0\";\n" + " scale = \"1 1 1\";\n" + "};\n" + "@endtsexample\n\n" - "@see StaticShape\n" + "@see StaticShape\n" "@see ShapeBaseData\n" - "@see TSStatic\n\n" + "@see TSStatic\n\n" - "@ingroup gameObjects\n" - "@ingroup Datablocks"); + "@ingroup gameObjects\n" + "@ingroup Datablocks"); StaticShapeData::StaticShapeData() { @@ -128,47 +128,47 @@ void StaticShapeData::unpackData(BitStream* stream) IMPLEMENT_CO_NETOBJECT_V1(StaticShape); ConsoleDocClass( StaticShape, - "@brief The most basic 3D shape with a datablock available in Torque 3D.\n\n" + "@brief The most basic 3D shape with a datablock available in Torque 3D.\n\n" - "When it comes to placing 3D objects in the scene, you technically have two options:\n\n" - "1. TSStatic objects\n\n" - "2. ShapeBase derived objects\n\n" + "When it comes to placing 3D objects in the scene, you technically have two options:\n\n" + "1. TSStatic objects\n\n" + "2. ShapeBase derived objects\n\n" - "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " - "will use one of its child classes instead. Several game related objects are derived " - "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" + "Since ShapeBase and ShapeBaseData are not meant to be instantiated in script, you " + "will use one of its child classes instead. Several game related objects are derived " + "from ShapeBase: Player, Vehicle, Item, and so on.\n\n" - "When you need a 3D object with datablock capabilities, you will use an object derived " - "from ShapeBase. When you need an object with extremely low overhead, and with no other " - "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" + "When you need a 3D object with datablock capabilities, you will use an object derived " + "from ShapeBase. When you need an object with extremely low overhead, and with no other " + "purpose than to be a 3D object in the scene, you will use TSStatic.\n\n" - "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " - "additional functionality you see in Player, Item, Vehicle or the other game play " - "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " + "The most basic child of ShapeBase is StaticShape. It does not introduce any of the " + "additional functionality you see in Player, Item, Vehicle or the other game play " + "heavy classes. At its core, it is comparable to a TSStatic, but with a datbalock. Having " "a datablock provides a location for common variables as well as having access to " "various ShapeBaseData, GameBaseData and SimDataBlock callbacks.\n\n" - "@tsexample\n" - "// Create a StaticShape using a datablock\n" - "datablock StaticShapeData(BasicShapeData)\n" - "{\n" - " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" - " testVar = \"Simple string, not a stock variable\";\n" - "};\n\n" - "new StaticShape()\n" - "{\n" - " dataBlock = \"BasicShapeData\";\n" - " position = \"0.0 0.0 0.0\";\n" - " rotation = \"1 0 0 0\";\n" - " scale = \"1 1 1\";\n" - "};\n" - "@endtsexample\n\n" + "@tsexample\n" + "// Create a StaticShape using a datablock\n" + "datablock StaticShapeData(BasicShapeData)\n" + "{\n" + " shapeFile = \"art/shapes/items/kit/healthkit.dts\";\n" + " testVar = \"Simple string, not a stock variable\";\n" + "};\n\n" + "new StaticShape()\n" + "{\n" + " dataBlock = \"BasicShapeData\";\n" + " position = \"0.0 0.0 0.0\";\n" + " rotation = \"1 0 0 0\";\n" + " scale = \"1 1 1\";\n" + "};\n" + "@endtsexample\n\n" - "@see StaticShapeData\n" - "@see ShapeBase\n" - "@see TSStatic\n\n" + "@see StaticShapeData\n" + "@see ShapeBase\n" + "@see TSStatic\n\n" - "@ingroup gameObjects\n"); + "@ingroup gameObjects\n"); StaticShape::StaticShape() { @@ -303,7 +303,7 @@ void StaticShape::unpackUpdate(NetConnection *connection, BitStream *bstream) // Marked internal, as this is flagged to be deleted // [8/1/2010 mperry] DefineConsoleMethod( StaticShape, setPoweredState, void, (bool isPowered), , "(bool isPowered)" - "@internal") + "@internal") { if(!object->isServerObject()) return; diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 0f7b69ef3..84b3b0797 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1222,17 +1222,17 @@ DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0), "@return the name of the indexed material.\n" "@see getTargetCount()\n") { - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetName(index); - } + return obj->getShapeInstance()->getTargetName(index); + } - return ""; + return ""; } DefineEngineMethod( TSStatic, getTargetCount, S32,(),, @@ -1240,17 +1240,17 @@ DefineEngineMethod( TSStatic, getTargetCount, S32,(),, "@return the number of materials in the shape.\n" "@see getTargetName()\n") { - TSStatic *obj = dynamic_cast< TSStatic* > ( object ); - if(obj) - { - // Try to use the client object (so we get the reskinned targets in the Material Editor) - if ((TSStatic*)obj->getClientObject()) - obj = (TSStatic*)obj->getClientObject(); + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); - return obj->getShapeInstance()->getTargetCount(); - } + return obj->getShapeInstance()->getTargetCount(); + } - return -1; + return -1; } // This method is able to change materials per map to with others. The material that is being replaced is being mapped to @@ -1317,10 +1317,10 @@ DefineEngineMethod( TSStatic, getModelFile, const char *, (),, "@return the shape filename\n\n" "@tsexample\n" - "// Acquire the model filename used on this shape.\n" - "%modelFilename = %obj.getModelFile();\n" + "// Acquire the model filename used on this shape.\n" + "%modelFilename = %obj.getModelFile();\n" "@endtsexample\n" ) { - return object->getShapeFileName(); + return object->getShapeFileName(); } diff --git a/Engine/source/T3D/tsStatic.cpp.orig b/Engine/source/T3D/tsStatic.cpp.orig new file mode 100644 index 000000000..11848499e --- /dev/null +++ b/Engine/source/T3D/tsStatic.cpp.orig @@ -0,0 +1,1330 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "platform/platform.h" +#include "T3D/tsStatic.h" + +#include "core/resourceManager.h" +#include "core/stream/bitStream.h" +#include "scene/sceneRenderState.h" +#include "scene/sceneManager.h" +#include "scene/sceneObjectLightingPlugin.h" +#include "lighting/lightManager.h" +#include "math/mathIO.h" +#include "ts/tsShapeInstance.h" +#include "ts/tsMaterialList.h" +#include "console/consoleTypes.h" +#include "T3D/shapeBase.h" +#include "sim/netConnection.h" +#include "gfx/gfxDevice.h" +#include "gfx/gfxTransformSaver.h" +#include "ts/tsRenderState.h" +#include "collision/boxConvex.h" +#include "T3D/physics/physicsPlugin.h" +#include "T3D/physics/physicsBody.h" +#include "T3D/physics/physicsCollision.h" +#include "materials/materialDefinition.h" +#include "materials/materialManager.h" +#include "materials/matInstance.h" +#include "materials/materialFeatureData.h" +#include "materials/materialFeatureTypes.h" +#include "console/engineAPI.h" +#include "T3D/accumulationVolume.h" + +using namespace Torque; + +extern bool gEditingMission; + +IMPLEMENT_CO_NETOBJECT_V1(TSStatic); + +ConsoleDocClass( TSStatic, + "@brief A static object derived from a 3D model file and placed within the game world.\n\n" + + "TSStatic is the most basic 3D shape in Torque. Unlike StaticShape it doesn't make use of " + "a datablock. It derrives directly from SceneObject. This makes TSStatic extremely light " + "weight, which is why the Tools use this class when you want to drop in a DTS or DAE object.\n\n" + + "While a TSStatic doesn't provide any motion -- it stays were you initally put it -- it does allow for " + "a single ambient animation sequence to play when the object is first added to the scene.\n\n" + + "@tsexample\n" + "new TSStatic(Team1Base) {\n" + " shapeName = \"art/shapes/desertStructures/station01.dts\";\n" + " playAmbient = \"1\";\n" + " receiveSunLight = \"1\";\n" + " receiveLMLighting = \"1\";\n" + " useCustomAmbientLighting = \"0\";\n" + " customAmbientLighting = \"0 0 0 1\";\n" + " collisionType = \"Visible Mesh\";\n" + " decalType = \"Collision Mesh\";\n" + " allowPlayerStep = \"1\";\n" + " renderNormals = \"0\";\n" + " forceDetail = \"-1\";\n" + " position = \"315.18 -180.418 244.313\";\n" + " rotation = \"0 0 1 195.952\";\n" + " scale = \"1 1 1\";\n" + " isRenderEnabled = \"true\";\n" + " canSaveDynamicFields = \"1\";\n" + "};\n" + "@endtsexample\n" + + "@ingroup gameObjects\n" +); + +TSStatic::TSStatic() +: + cubeDescId( 0 ), + reflectorDesc( NULL ) +{ + mNetFlags.set(Ghostable | ScopeAlways); + + mTypeMask |= StaticObjectType | StaticShapeObjectType; + + mShapeName = ""; + mShapeInstance = NULL; + + mPlayAmbient = true; + mAmbientThread = NULL; + + mAllowPlayerStep = false; + + mConvexList = new Convex; + + mRenderNormalScalar = 0; + mForceDetail = -1; + + mMeshCulling = false; + mUseOriginSort = false; + + mUseAlphaFade = false; + mAlphaFadeStart = 100.0f; + mAlphaFadeEnd = 150.0f; + mInvertAlphaFade = false; + mAlphaFade = 1.0f; + mPhysicsRep = NULL; + + mCollisionType = CollisionMesh; + mDecalType = CollisionMesh; +} + +TSStatic::~TSStatic() +{ + delete mConvexList; + mConvexList = NULL; +} + +ImplementEnumType( TSMeshType, + "Type of mesh data available in a shape.\n" + "@ingroup gameObjects" ) + { TSStatic::None, "None", "No mesh data." }, + { TSStatic::Bounds, "Bounds", "Bounding box of the shape." }, + { TSStatic::CollisionMesh, "Collision Mesh", "Specifically desingated \"collision\" meshes." }, + { TSStatic::VisibleMesh, "Visible Mesh", "Rendered mesh polygons." }, +EndImplementEnumType; + + +void TSStatic::initPersistFields() +{ + addGroup("Media"); + + addField("shapeName", TypeShapeFilename, Offset( mShapeName, TSStatic ), + "%Path and filename of the model file (.DTS, .DAE) to use for this TSStatic." ); + + addProtectedField( "skin", TypeRealString, Offset( mAppliedSkinName, TSStatic ), &_setFieldSkin, &_getFieldSkin, + "@brief The skin applied to the shape.\n\n" + + "'Skinning' the shape effectively renames the material targets, allowing " + "different materials to be used on different instances of the same model.\n\n" + + "Any material targets that start with the old skin name have that part " + "of the name replaced with the new skin name. The initial old skin name is " + "\"base\". For example, if a new skin of \"blue\" was applied to a model " + "that had material targets base_body and face, the new targets " + "would be blue_body and face. Note that face was not " + "renamed since it did not start with the old skin name of \"base\".\n\n" + + "To support models that do not use the default \"base\" naming convention, " + "you can also specify the part of the name to replace in the skin field " + "itself. For example, if a model had a material target called shapemat, " + "we could apply a new skin \"shape=blue\", and the material target would be " + "renamed to bluemat (note \"shape\" has been replaced with \"blue\").\n\n" + + "Multiple skin updates can also be applied at the same time by separating " + "them with a semicolon. For example: \"base=blue;face=happy_face\".\n\n" + + "Material targets are only renamed if an existing Material maps to that " + "name, or if there is a diffuse texture in the model folder with the same " + "name as the new target.\n\n" ); + + endGroup("Media"); + + addGroup("Rendering"); + + addField( "playAmbient", TypeBool, Offset( mPlayAmbient, TSStatic ), + "Enables automatic playing of the animation sequence named \"ambient\" (if it exists) when the TSStatic is loaded."); + addField( "meshCulling", TypeBool, Offset( mMeshCulling, TSStatic ), + "Enables detailed culling of meshes within the TSStatic. Should only be used " + "with large complex shapes like buildings which contain many submeshes." ); + addField( "originSort", TypeBool, Offset( mUseOriginSort, TSStatic ), + "Enables translucent sorting of the TSStatic by its origin instead of the bounds." ); + + endGroup("Rendering"); + + addGroup( "Reflection" ); + addField( "cubeReflectorDesc", TypeRealString, Offset( cubeDescName, TSStatic ), + "References a ReflectorDesc datablock that defines performance and quality properties for dynamic reflections.\n"); + endGroup( "Reflection" ); + + addGroup("Collision"); + + addField( "collisionType", TypeTSMeshType, Offset( mCollisionType, TSStatic ), + "The type of mesh data to use for collision queries." ); + addField( "decalType", TypeTSMeshType, Offset( mDecalType, TSStatic ), + "The type of mesh data used to clip decal polygons against." ); + addField( "allowPlayerStep", TypeBool, Offset( mAllowPlayerStep, TSStatic ), + "@brief Allow a Player to walk up sloping polygons in the TSStatic (based on the collisionType).\n\n" + "When set to false, the slightest bump will stop the player from walking on top of the object.\n"); + + endGroup("Collision"); + + addGroup( "AlphaFade" ); + addField( "alphaFadeEnable", TypeBool, Offset(mUseAlphaFade, TSStatic), "Turn on/off Alpha Fade" ); + addField( "alphaFadeStart", TypeF32, Offset(mAlphaFadeStart, TSStatic), "Distance of start Alpha Fade" ); + addField( "alphaFadeEnd", TypeF32, Offset(mAlphaFadeEnd, TSStatic), "Distance of end Alpha Fade" ); + addField( "alphaFadeInverse", TypeBool, Offset(mInvertAlphaFade, TSStatic), "Invert Alpha Fade's Start & End Distance" ); + endGroup( "AlphaFade" ); + + addGroup("Debug"); + + addField( "renderNormals", TypeF32, Offset( mRenderNormalScalar, TSStatic ), + "Debug rendering mode shows the normals for each point in the TSStatic's mesh." ); + addField( "forceDetail", TypeS32, Offset( mForceDetail, TSStatic ), + "Forces rendering to a particular detail level." ); + + endGroup("Debug"); + + Parent::initPersistFields(); +} + +bool TSStatic::_setFieldSkin( void *object, const char *index, const char *data ) +{ + TSStatic *ts = static_cast( object ); + if ( ts ) + ts->setSkinName( data ); + return false; +} + +const char *TSStatic::_getFieldSkin( void *object, const char *data ) +{ + TSStatic *ts = static_cast( object ); + return ts ? ts->mSkinNameHandle.getString() : ""; +} + +void TSStatic::inspectPostApply() +{ + // Apply any transformations set in the editor + Parent::inspectPostApply(); + + if(isServerObject()) + { + setMaskBits(AdvancedStaticOptionsMask); + prepCollision(); + } + + _updateShouldTick(); +} + +bool TSStatic::onAdd() +{ + PROFILE_SCOPE(TSStatic_onAdd); + + if ( isServerObject() ) + { + // Handle the old "usePolysoup" field + SimFieldDictionary* fieldDict = getFieldDictionary(); + + if ( fieldDict ) + { + StringTableEntry slotName = StringTable->insert( "usePolysoup" ); + + SimFieldDictionary::Entry * entry = fieldDict->findDynamicField( slotName ); + + if ( entry ) + { + // Was "usePolysoup" set? + bool usePolysoup = dAtob( entry->value ); + + // "usePolysoup" maps to the new VisibleMesh type + if ( usePolysoup ) + mCollisionType = VisibleMesh; + + // Remove the field in favor on the new "collisionType" field + fieldDict->setFieldValue( slotName, "" ); + } + } + } + + if ( !Parent::onAdd() ) + return false; + + // Setup the shape. + if ( !_createShape() ) + { + Con::errorf( "TSStatic::onAdd() - Shape creation failed!" ); + return false; + } + + setRenderTransform(mObjToWorld); + + // Register for the resource change signal. + ResourceManager::get().getChangedSignal().notify( this, &TSStatic::_onResourceChanged ); + + addToScene(); + + if ( isClientObject() ) + { + mCubeReflector.unregisterReflector(); + + if ( reflectorDesc ) + mCubeReflector.registerReflector( this, reflectorDesc ); + } + + _updateShouldTick(); + + // Accumulation and environment mapping + if (isClientObject() && mShapeInstance) + { + AccumulationVolume::addObject(this); + } + + return true; +} + +bool TSStatic::_createShape() +{ + // Cleanup before we create. + mCollisionDetails.clear(); + mLOSDetails.clear(); + SAFE_DELETE( mPhysicsRep ); + SAFE_DELETE( mShapeInstance ); + mAmbientThread = NULL; + mShape = NULL; + + if (!mShapeName || mShapeName[0] == '\0') + { + Con::errorf( "TSStatic::_createShape() - No shape name!" ); + return false; + } + + mShapeHash = _StringTable::hashString(mShapeName); + + mShape = ResourceManager::get().load(mShapeName); + if ( bool(mShape) == false ) + { + Con::errorf( "TSStatic::_createShape() - Unable to load shape: %s", mShapeName ); + return false; + } + + if ( isClientObject() && + !mShape->preloadMaterialList(mShape.getPath()) && + NetConnection::filesWereDownloaded() ) + return false; + + mObjBox = mShape->bounds; + resetWorldBox(); + + mShapeInstance = new TSShapeInstance( mShape, isClientObject() ); + + if( isGhost() ) + { + // Reapply the current skin + mAppliedSkinName = ""; + reSkin(); + } + + prepCollision(); + + // Find the "ambient" animation if it exists + S32 ambientSeq = mShape->findSequence("ambient"); + + if ( ambientSeq > -1 && !mAmbientThread ) + mAmbientThread = mShapeInstance->addThread(); + + if ( mAmbientThread ) + mShapeInstance->setSequence( mAmbientThread, ambientSeq, 0); + + // Resolve CubeReflectorDesc. + if ( cubeDescName.isNotEmpty() ) + { + Sim::findObject( cubeDescName, reflectorDesc ); + } + else if( cubeDescId > 0 ) + { + Sim::findObject( cubeDescId, reflectorDesc ); + } + + return true; +} + +void TSStatic::prepCollision() +{ + // Let the client know that the collision was updated + setMaskBits( UpdateCollisionMask ); + + // Allow the ShapeInstance to prep its collision if it hasn't already + if ( mShapeInstance ) + mShapeInstance->prepCollision(); + + // Cleanup any old collision data + mCollisionDetails.clear(); + mLOSDetails.clear(); + mConvexList->nukeList(); + + if ( mCollisionType == CollisionMesh || mCollisionType == VisibleMesh ) + mShape->findColDetails( mCollisionType == VisibleMesh, &mCollisionDetails, &mLOSDetails ); + + _updatePhysics(); +} + +void TSStatic::_updatePhysics() +{ + SAFE_DELETE( mPhysicsRep ); + + if ( !PHYSICSMGR || mCollisionType == None ) + return; + + PhysicsCollision *colShape = NULL; + if ( mCollisionType == Bounds ) + { + MatrixF offset( true ); + offset.setPosition( mShape->center ); + colShape = PHYSICSMGR->createCollision(); + colShape->addBox( getObjBox().getExtents() * 0.5f * mObjScale, offset ); + } + else + colShape = mShape->buildColShape( mCollisionType == VisibleMesh, getScale() ); + + if ( colShape ) + { + PhysicsWorld *world = PHYSICSMGR->getWorld( isServerObject() ? "server" : "client" ); + mPhysicsRep = PHYSICSMGR->createBody(); + mPhysicsRep->init( colShape, 0, 0, this, world ); + mPhysicsRep->setTransform( getTransform() ); + } +} + +void TSStatic::onRemove() +{ + SAFE_DELETE( mPhysicsRep ); + + // Accumulation + if ( isClientObject() && mShapeInstance ) + { + if ( mShapeInstance->hasAccumulation() ) + AccumulationVolume::removeObject(this); + } + + mConvexList->nukeList(); + + removeFromScene(); + + // Remove the resource change signal. + ResourceManager::get().getChangedSignal().remove( this, &TSStatic::_onResourceChanged ); + + delete mShapeInstance; + mShapeInstance = NULL; + + mAmbientThread = NULL; + if ( isClientObject() ) + mCubeReflector.unregisterReflector(); + + Parent::onRemove(); +} + +void TSStatic::_onResourceChanged( const Torque::Path &path ) +{ + if ( path != Path( mShapeName ) ) + return; + + _createShape(); + _updateShouldTick(); +} + +void TSStatic::setSkinName( const char *name ) +{ + if ( !isGhost() ) + { + if ( name[0] != '\0' ) + { + // Use tags for better network performance + // Should be a tag, but we'll convert to one if it isn't. + if ( name[0] == StringTagPrefixByte ) + mSkinNameHandle = NetStringHandle( U32(dAtoi(name + 1)) ); + else + mSkinNameHandle = NetStringHandle( name ); + } + else + mSkinNameHandle = NetStringHandle(); + + setMaskBits( SkinMask ); + } +} + +void TSStatic::reSkin() +{ + if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) + { + Vector skins; + String(mSkinNameHandle.getString()).split( ";", skins ); + + for (S32 i = 0; i < skins.size(); i++) + { + String oldSkin( mAppliedSkinName.c_str() ); + String newSkin( skins[i] ); + + // Check if the skin handle contains an explicit "old" base string. This + // allows all models to support skinning, even if they don't follow the + // "base_xxx" material naming convention. + S32 split = newSkin.find( '=' ); // "old=new" format skin? + if ( split != String::NPos ) + { + oldSkin = newSkin.substr( 0, split ); + newSkin = newSkin.erase( 0, split+1 ); + } + + mShapeInstance->reSkin( newSkin, oldSkin ); + mAppliedSkinName = newSkin; + } + } +} + +void TSStatic::processTick( const Move *move ) +{ + if ( isServerObject() && mPlayAmbient && mAmbientThread ) + mShapeInstance->advanceTime( TickSec, mAmbientThread ); + + if ( isMounted() ) + { + MatrixF mat( true ); + mMount.object->getMountTransform(mMount.node, mMount.xfm, &mat ); + setTransform( mat ); + } +} + +void TSStatic::interpolateTick( F32 delta ) +{ +} + +void TSStatic::advanceTime( F32 dt ) +{ + if ( mPlayAmbient && mAmbientThread ) + mShapeInstance->advanceTime( dt, mAmbientThread ); + + if ( isMounted() ) + { + MatrixF mat( true ); + mMount.object->getRenderMountTransform( dt, mMount.node, mMount.xfm, &mat ); + setRenderTransform( mat ); + } +} + +void TSStatic::_updateShouldTick() +{ + bool shouldTick = (mPlayAmbient && mAmbientThread) || isMounted(); + + if ( isTicking() != shouldTick ) + setProcessTick( shouldTick ); +} + +void TSStatic::prepRenderImage( SceneRenderState* state ) +{ + if( !mShapeInstance ) + return; + + Point3F cameraOffset; + getRenderTransform().getColumn(3,&cameraOffset); + cameraOffset -= state->getDiffuseCameraPosition(); + F32 dist = cameraOffset.len(); + if (dist < 0.01f) + dist = 0.01f; + + if (mUseAlphaFade) + { + mAlphaFade = 1.0f; + if ((mAlphaFadeStart < mAlphaFadeEnd) && mAlphaFadeStart > 0.1f) + { + if (mInvertAlphaFade) + { + if (dist <= mAlphaFadeStart) + { + return; + } + if (dist < mAlphaFadeEnd) + { + mAlphaFade = ((dist - mAlphaFadeStart) / (mAlphaFadeEnd - mAlphaFadeStart)); + } + } + else + { + if (dist >= mAlphaFadeEnd) + { + return; + } + if (dist > mAlphaFadeStart) + { + mAlphaFade -= ((dist - mAlphaFadeStart) / (mAlphaFadeEnd - mAlphaFadeStart)); + } + } + } + } + + F32 invScale = (1.0f/getMax(getMax(mObjScale.x,mObjScale.y),mObjScale.z)); + + // If we're currently rendering our own reflection we + // don't want to render ourselves into it. + if ( mCubeReflector.isRendering() ) + return; + + + if ( mForceDetail == -1 ) + mShapeInstance->setDetailFromDistance( state, dist * invScale ); + else + mShapeInstance->setCurrentDetail( mForceDetail ); + + if ( mShapeInstance->getCurrentDetail() < 0 ) + return; + + GFXTransformSaver saver; + + // Set up our TS render state. + TSRenderState rdata; + rdata.setSceneState( state ); + rdata.setFadeOverride( 1.0f ); + rdata.setOriginSort( mUseOriginSort ); + + if ( mCubeReflector.isEnabled() ) + rdata.setCubemap( mCubeReflector.getCubemap() ); + + // Acculumation + rdata.setAccuTex(mAccuTex); + + // If we have submesh culling enabled then prepare + // the object space frustum to pass to the shape. + Frustum culler; + if ( mMeshCulling ) + { + culler = state->getCullingFrustum(); + MatrixF xfm( true ); + xfm.scale( Point3F::One / getScale() ); + xfm.mul( getRenderWorldTransform() ); + xfm.mul( culler.getTransform() ); + culler.setTransform( xfm ); + rdata.setCuller( &culler ); + } + + // We might have some forward lit materials + // so pass down a query to gather lights. + LightQuery query; + query.init( getWorldSphere() ); + rdata.setLightQuery( &query ); + + MatrixF mat = getRenderTransform(); + mat.scale( mObjScale ); + GFX->setWorldMatrix( mat ); + + if ( state->isDiffusePass() && mCubeReflector.isEnabled() && mCubeReflector.getOcclusionQuery() ) + { + RenderPassManager *pass = state->getRenderPass(); + OccluderRenderInst *ri = pass->allocInst(); + + ri->type = RenderPassManager::RIT_Occluder; + ri->query = mCubeReflector.getOcclusionQuery(); + mObjToWorld.mulP( mObjBox.getCenter(), &ri->position ); + ri->scale.set( mObjBox.getExtents() ); + ri->orientation = pass->allocUniqueXform( mObjToWorld ); + ri->isSphere = false; + state->getRenderPass()->addInst( ri ); + } + + mShapeInstance->animate(); + if(mShapeInstance) + { + if (mUseAlphaFade) + { + mShapeInstance->setAlphaAlways(mAlphaFade); + S32 s = mShapeInstance->mMeshObjects.size(); + + for(S32 x = 0; x < s; x++) + { + mShapeInstance->mMeshObjects[x].visible = mAlphaFade; + } + } + } + mShapeInstance->render( rdata ); + + if ( mRenderNormalScalar > 0 ) + { + ObjectRenderInst *ri = state->getRenderPass()->allocInst(); + ri->renderDelegate.bind( this, &TSStatic::_renderNormals ); + ri->type = RenderPassManager::RIT_Editor; + state->getRenderPass()->addInst( ri ); + } +} + +void TSStatic::_renderNormals( ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat ) +{ + PROFILE_SCOPE( TSStatic_RenderNormals ); + + GFXTransformSaver saver; + + MatrixF mat = getRenderTransform(); + mat.scale( mObjScale ); + GFX->multWorld( mat ); + + S32 dl = mShapeInstance->getCurrentDetail(); + mShapeInstance->renderDebugNormals( mRenderNormalScalar, dl ); +} + +void TSStatic::onScaleChanged() +{ + Parent::onScaleChanged(); + + if ( mPhysicsRep ) + { + // If the editor is enabled delay the scale operation + // by a few milliseconds so that we're not rebuilding + // during an active scale drag operation. + if ( gEditingMission ) + mPhysicsRep->queueCallback( 500, Delegate( this, &TSStatic::_updatePhysics ) ); + else + _updatePhysics(); + } + + setMaskBits( ScaleMask ); +} + +void TSStatic::setTransform(const MatrixF & mat) +{ + Parent::setTransform(mat); + if ( !isMounted() ) + setMaskBits( TransformMask ); + + if ( mPhysicsRep ) + mPhysicsRep->setTransform( mat ); + + // Accumulation + if ( isClientObject() && mShapeInstance ) + { + if ( mShapeInstance->hasAccumulation() ) + AccumulationVolume::updateObject(this); + } + + // Since this is a static it's render transform changes 1 + // to 1 with it's collision transform... no interpolation. + setRenderTransform(mat); +} + +U32 TSStatic::packUpdate(NetConnection *con, U32 mask, BitStream *stream) +{ + U32 retMask = Parent::packUpdate(con, mask, stream); + + if ( stream->writeFlag( mask & TransformMask ) ) + mathWrite( *stream, getTransform() ); + + if ( stream->writeFlag( mask & ScaleMask ) ) + { + // Only write one bit if the scale is one. + if ( stream->writeFlag( mObjScale != Point3F::One ) ) + mathWrite( *stream, mObjScale ); + } + + if ( stream->writeFlag( mask & UpdateCollisionMask ) ) + stream->write( (U32)mCollisionType ); + + if ( stream->writeFlag( mask & SkinMask ) ) + con->packNetStringHandleU( stream, mSkinNameHandle ); + + if (stream->writeFlag(mask & AdvancedStaticOptionsMask)) + { + stream->writeString(mShapeName); + stream->write((U32)mDecalType); + + stream->writeFlag(mAllowPlayerStep); + stream->writeFlag(mMeshCulling); + stream->writeFlag(mUseOriginSort); + + stream->write(mRenderNormalScalar); + + stream->write(mForceDetail); + + stream->writeFlag(mPlayAmbient); + } + + if ( stream->writeFlag(mUseAlphaFade) ) + { + stream->write(mAlphaFadeStart); + stream->write(mAlphaFadeEnd); + stream->write(mInvertAlphaFade); + } + + if ( mLightPlugin ) + retMask |= mLightPlugin->packUpdate(this, AdvancedStaticOptionsMask, con, mask, stream); + + if( stream->writeFlag( reflectorDesc != NULL ) ) + { + stream->writeRangedU32( reflectorDesc->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast ); + } + return retMask; +} + +void TSStatic::unpackUpdate(NetConnection *con, BitStream *stream) +{ + Parent::unpackUpdate(con, stream); + + if ( stream->readFlag() ) // TransformMask + { + MatrixF mat; + mathRead( *stream, &mat ); + setTransform(mat); + setRenderTransform(mat); + } + + if ( stream->readFlag() ) // ScaleMask + { + if ( stream->readFlag() ) + { + VectorF scale; + mathRead( *stream, &scale ); + setScale( scale ); + } + else + setScale( Point3F::One ); + } + + if ( stream->readFlag() ) // UpdateCollisionMask + { + U32 collisionType = CollisionMesh; + + stream->read( &collisionType ); + + // Handle it if we have changed CollisionType's + if ( (MeshType)collisionType != mCollisionType ) + { + mCollisionType = (MeshType)collisionType; + + if ( isProperlyAdded() && mShapeInstance ) + prepCollision(); + } + } + + if (stream->readFlag()) // SkinMask + { + NetStringHandle skinDesiredNameHandle = con->unpackNetStringHandleU(stream);; + if (mSkinNameHandle != skinDesiredNameHandle) + { + mSkinNameHandle = skinDesiredNameHandle; + reSkin(); + } + } + + if (stream->readFlag()) // AdvancedStaticOptionsMask + { + mShapeName = stream->readSTString(); + + stream->read((U32*)&mDecalType); + + mAllowPlayerStep = stream->readFlag(); + mMeshCulling = stream->readFlag(); + mUseOriginSort = stream->readFlag(); + + stream->read(&mRenderNormalScalar); + + stream->read(&mForceDetail); + mPlayAmbient = stream->readFlag(); + } + + mUseAlphaFade = stream->readFlag(); + if (mUseAlphaFade) + { + stream->read(&mAlphaFadeStart); + stream->read(&mAlphaFadeEnd); + stream->read(&mInvertAlphaFade); + } + + if ( mLightPlugin ) + { + mLightPlugin->unpackUpdate(this, con, stream); + } + + if( stream->readFlag() ) + { + cubeDescId = stream->readRangedU32( DataBlockObjectIdFirst, DataBlockObjectIdLast ); + } + + if ( isProperlyAdded() ) + _updateShouldTick(); +} + +//---------------------------------------------------------------------------- +bool TSStatic::castRay(const Point3F &start, const Point3F &end, RayInfo* info) +{ + if ( mCollisionType == None ) + return false; + + if ( !mShapeInstance ) + return false; + + if ( mCollisionType == Bounds ) + { + F32 fst; + if (!mObjBox.collideLine(start, end, &fst, &info->normal)) + return false; + + info->t = fst; + info->object = this; + info->point.interpolate( start, end, fst ); + info->material = NULL; + return true; + } + else + { + RayInfo shortest = *info; + RayInfo localInfo; + shortest.t = 1e8f; + localInfo.generateTexCoord = info->generateTexCoord; + + for ( U32 i = 0; i < mLOSDetails.size(); i++ ) + { + mShapeInstance->animate( mLOSDetails[i] ); + + if ( mShapeInstance->castRayOpcode( mLOSDetails[i], start, end, &localInfo ) ) + { + localInfo.object = this; + + if (localInfo.t < shortest.t) + shortest = localInfo; + } + } + + if (shortest.object == this) + { + // Copy out the shortest time... + *info = shortest; + return true; + } + } + + return false; +} + +bool TSStatic::castRayRendered(const Point3F &start, const Point3F &end, RayInfo *info) +{ + if ( !mShapeInstance ) + return false; + + // Cast the ray against the currently visible detail + RayInfo localInfo; + bool res = mShapeInstance->castRayOpcode( mShapeInstance->getCurrentDetail(), start, end, &localInfo ); + + if ( res ) + { + *info = localInfo; + info->object = this; + return true; + } + + return false; +} + +bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF &) +{ + if ( !mShapeInstance ) + return false; + + // This is safe to set even if we're not outputing + polyList->setTransform( &mObjToWorld, mObjScale ); + polyList->setObject( this ); + + if ( context == PLC_Export ) + { + // Use highest detail level + S32 dl = 0; + + // Try to call on the client so we can export materials + if ( isServerObject() && getClientObject() ) + dynamic_cast(getClientObject())->mShapeInstance->buildPolyList( polyList, dl ); + else + mShapeInstance->buildPolyList( polyList, dl ); + } + else if ( context == PLC_Selection ) + { + // Use the last rendered detail level + S32 dl = mShapeInstance->getCurrentDetail(); + mShapeInstance->buildPolyListOpcode( dl, polyList, box ); + } + else + { + // Figure out the mesh type we're looking for. + MeshType meshType = ( context == PLC_Decal ) ? mDecalType : mCollisionType; + + if ( meshType == None ) + return false; + else if ( meshType == Bounds ) + polyList->addBox( mObjBox ); + else if ( meshType == VisibleMesh ) + mShapeInstance->buildPolyList( polyList, 0 ); + else + { + // Everything else is done from the collision meshes + // which may be built from either the visual mesh or + // special collision geometry. + for ( U32 i = 0; i < mCollisionDetails.size(); i++ ) + mShapeInstance->buildPolyListOpcode( mCollisionDetails[i], polyList, box ); + } + } + + return true; +} + +void TSStatic::buildConvex(const Box3F& box, Convex* convex) +{ + if ( mCollisionType == None ) + return; + + if ( mShapeInstance == NULL ) + return; + + // These should really come out of a pool + mConvexList->collectGarbage(); + + if ( mCollisionType == Bounds ) + { + // Just return a box convex for the entire shape... + Convex* cc = 0; + CollisionWorkingList& wl = convex->getWorkingList(); + for (CollisionWorkingList* itr = wl.wLink.mNext; itr != &wl; itr = itr->wLink.mNext) + { + if (itr->mConvex->getType() == BoxConvexType && + itr->mConvex->getObject() == this) + { + cc = itr->mConvex; + break; + } + } + if (cc) + return; + + // Create a new convex. + BoxConvex* cp = new BoxConvex; + mConvexList->registerObject(cp); + convex->addToWorkingList(cp); + cp->init(this); + + mObjBox.getCenter(&cp->mCenter); + cp->mSize.x = mObjBox.len_x() / 2.0f; + cp->mSize.y = mObjBox.len_y() / 2.0f; + cp->mSize.z = mObjBox.len_z() / 2.0f; + } + else // CollisionMesh || VisibleMesh + { + TSStaticPolysoupConvex::smCurObject = this; + + for (U32 i = 0; i < mCollisionDetails.size(); i++) + mShapeInstance->buildConvexOpcode( mObjToWorld, mObjScale, mCollisionDetails[i], box, convex, mConvexList ); + + TSStaticPolysoupConvex::smCurObject = NULL; + } +} + +SceneObject* TSStaticPolysoupConvex::smCurObject = NULL; + +TSStaticPolysoupConvex::TSStaticPolysoupConvex() +: box( 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f ), + normal( 0.0f, 0.0f, 0.0f, 0.0f ), + idx( 0 ), + mesh( NULL ) +{ + mType = TSPolysoupConvexType; + + for ( U32 i = 0; i < 4; ++i ) + { + verts[i].set( 0.0f, 0.0f, 0.0f ); + } +} + +Point3F TSStaticPolysoupConvex::support(const VectorF& vec) const +{ + F32 bestDot = mDot( verts[0], vec ); + + const Point3F *bestP = &verts[0]; + for(S32 i=1; i<4; i++) + { + F32 newD = mDot(verts[i], vec); + if(newD > bestDot) + { + bestDot = newD; + bestP = &verts[i]; + } + } + + return *bestP; +} + +Box3F TSStaticPolysoupConvex::getBoundingBox() const +{ + Box3F wbox = box; + wbox.minExtents.convolve( mObject->getScale() ); + wbox.maxExtents.convolve( mObject->getScale() ); + mObject->getTransform().mul(wbox); + return wbox; +} + +Box3F TSStaticPolysoupConvex::getBoundingBox(const MatrixF& mat, const Point3F& scale) const +{ + AssertISV(false, "TSStaticPolysoupConvex::getBoundingBox(m,p) - Not implemented. -- XEA"); + return box; +} + +void TSStaticPolysoupConvex::getPolyList(AbstractPolyList *list) +{ + // Transform the list into object space and set the pointer to the object + MatrixF i( mObject->getTransform() ); + Point3F iS( mObject->getScale() ); + list->setTransform(&i, iS); + list->setObject(mObject); + + // Add only the original collision triangle + S32 base = list->addPoint(verts[0]); + list->addPoint(verts[2]); + list->addPoint(verts[1]); + + list->begin(0, (U32)idx ^ (uintptr_t)mesh); + list->vertex(base + 2); + list->vertex(base + 1); + list->vertex(base + 0); + list->plane(base + 0, base + 1, base + 2); + list->end(); +} + +void TSStaticPolysoupConvex::getFeatures(const MatrixF& mat,const VectorF& n, ConvexFeature* cf) +{ + cf->material = 0; + cf->object = mObject; + + // For a tetrahedron this is pretty easy... first + // convert everything into world space. + Point3F tverts[4]; + mat.mulP(verts[0], &tverts[0]); + mat.mulP(verts[1], &tverts[1]); + mat.mulP(verts[2], &tverts[2]); + mat.mulP(verts[3], &tverts[3]); + + // points... + S32 firstVert = cf->mVertexList.size(); + cf->mVertexList.increment(); cf->mVertexList.last() = tverts[0]; + cf->mVertexList.increment(); cf->mVertexList.last() = tverts[1]; + cf->mVertexList.increment(); cf->mVertexList.last() = tverts[2]; + cf->mVertexList.increment(); cf->mVertexList.last() = tverts[3]; + + // edges... + cf->mEdgeList.increment(); + cf->mEdgeList.last().vertex[0] = firstVert+0; + cf->mEdgeList.last().vertex[1] = firstVert+1; + + cf->mEdgeList.increment(); + cf->mEdgeList.last().vertex[0] = firstVert+1; + cf->mEdgeList.last().vertex[1] = firstVert+2; + + cf->mEdgeList.increment(); + cf->mEdgeList.last().vertex[0] = firstVert+2; + cf->mEdgeList.last().vertex[1] = firstVert+0; + + cf->mEdgeList.increment(); + cf->mEdgeList.last().vertex[0] = firstVert+3; + cf->mEdgeList.last().vertex[1] = firstVert+0; + + cf->mEdgeList.increment(); + cf->mEdgeList.last().vertex[0] = firstVert+3; + cf->mEdgeList.last().vertex[1] = firstVert+1; + + cf->mEdgeList.increment(); + cf->mEdgeList.last().vertex[0] = firstVert+3; + cf->mEdgeList.last().vertex[1] = firstVert+2; + + // triangles... + cf->mFaceList.increment(); + cf->mFaceList.last().normal = PlaneF(tverts[2], tverts[1], tverts[0]); + cf->mFaceList.last().vertex[0] = firstVert+2; + cf->mFaceList.last().vertex[1] = firstVert+1; + cf->mFaceList.last().vertex[2] = firstVert+0; + + cf->mFaceList.increment(); + cf->mFaceList.last().normal = PlaneF(tverts[1], tverts[0], tverts[3]); + cf->mFaceList.last().vertex[0] = firstVert+1; + cf->mFaceList.last().vertex[1] = firstVert+0; + cf->mFaceList.last().vertex[2] = firstVert+3; + + cf->mFaceList.increment(); + cf->mFaceList.last().normal = PlaneF(tverts[2], tverts[1], tverts[3]); + cf->mFaceList.last().vertex[0] = firstVert+2; + cf->mFaceList.last().vertex[1] = firstVert+1; + cf->mFaceList.last().vertex[2] = firstVert+3; + + cf->mFaceList.increment(); + cf->mFaceList.last().normal = PlaneF(tverts[0], tverts[2], tverts[3]); + cf->mFaceList.last().vertex[0] = firstVert+0; + cf->mFaceList.last().vertex[1] = firstVert+2; + cf->mFaceList.last().vertex[2] = firstVert+3; + + // All done! +} + +void TSStatic::onMount( SceneObject *obj, S32 node ) +{ + Parent::onMount(obj, node); + _updateShouldTick(); +} + +void TSStatic::onUnmount( SceneObject *obj, S32 node ) +{ + Parent::onUnmount( obj, node ); + setMaskBits( TransformMask ); + _updateShouldTick(); +} + +//------------------------------------------------------------------------ +//These functions are duplicated in tsStatic and shapeBase. +//They each function a little differently; but achieve the same purpose of gathering +//target names/counts without polluting simObject. + +DefineEngineMethod( TSStatic, getTargetName, const char*, ( S32 index ),(0), + "Get the name of the indexed shape material.\n" + "@param index index of the material to get (valid range is 0 - getTargetCount()-1).\n" + "@return the name of the indexed material.\n" + "@see getTargetCount()\n") +{ + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); + + return obj->getShapeInstance()->getTargetName(index); + } + + return ""; +} + +DefineEngineMethod( TSStatic, getTargetCount, S32,(),, + "Get the number of materials in the shape.\n" + "@return the number of materials in the shape.\n" + "@see getTargetName()\n") +{ + TSStatic *obj = dynamic_cast< TSStatic* > ( object ); + if(obj) + { + // Try to use the client object (so we get the reskinned targets in the Material Editor) + if ((TSStatic*)obj->getClientObject()) + obj = (TSStatic*)obj->getClientObject(); + + return obj->getShapeInstance()->getTargetCount(); + } + + return -1; +} + +// This method is able to change materials per map to with others. The material that is being replaced is being mapped to +// unmapped_mat as a part of this transition + +DefineEngineMethod( TSStatic, changeMaterial, void, ( const char* mapTo, Material* oldMat, Material* newMat ),("",nullAsType(),nullAsType()), + "@brief Change one of the materials on the shape.\n\n" + + "This method changes materials per mapTo with others. The material that " + "is being replaced is mapped to unmapped_mat as a part of this transition.\n" + + "@note Warning, right now this only sort of works. It doesn't do a live " + "update like it should.\n" + + "@param mapTo the name of the material target to remap (from getTargetName)\n" + "@param oldMat the old Material that was mapped \n" + "@param newMat the new Material to map\n\n" + + "@tsexample\n" + "// remap the first material in the shape\n" + "%mapTo = %obj.getTargetName( 0 );\n" + "%obj.changeMaterial( %mapTo, 0, MyMaterial );\n" + "@endtsexample\n" ) +{ + // if no valid new material, theres no reason for doing this + if( !newMat ) + { + Con::errorf("TSShape::changeMaterial failed: New material does not exist!"); + return; + } + + TSMaterialList* shapeMaterialList = object->getShape()->materialList; + + // Check the mapTo name exists for this shape + S32 matIndex = shapeMaterialList->getMaterialNameList().find_next(String(mapTo)); + if (matIndex < 0) + { + Con::errorf("TSShape::changeMaterial failed: Invalid mapTo name '%s'", mapTo); + return; + } + + // Lets remap the old material off, so as to let room for our current material room to claim its spot + if( oldMat ) + oldMat->mMapTo = String("unmapped_mat"); + + newMat->mMapTo = mapTo; + + // Map the material by name in the matmgr + MATMGR->mapMaterial( mapTo, newMat->getName() ); + + // Replace instances with the new material being traded in. Lets make sure that we only + // target the specific targets per inst, this is actually doing more than we thought + delete shapeMaterialList->mMatInstList[matIndex]; + shapeMaterialList->mMatInstList[matIndex] = newMat->createMatInstance(); + + // Finish up preparing the material instances for rendering + const GFXVertexFormat *flags = getGFXVertexFormat(); + FeatureSet features = MATMGR->getDefaultFeatures(); + shapeMaterialList->getMaterialInst(matIndex)->init(features, flags); +} + +DefineEngineMethod( TSStatic, getModelFile, const char *, (),, + "@brief Get the model filename used by this shape.\n\n" + + "@return the shape filename\n\n" + "@tsexample\n" + "// Acquire the model filename used on this shape.\n" + "%modelFilename = %obj.getModelFile();\n" + "@endtsexample\n" + ) +{ +<<<<<<< HEAD + return object->getShapeFileName(); +======= + return object->getShapeFileName(); +>>>>>>> garagegames/development +} diff --git a/Engine/source/T3D/vehicles/guiSpeedometer.cpp b/Engine/source/T3D/vehicles/guiSpeedometer.cpp index b43f65951..847c24a8c 100644 --- a/Engine/source/T3D/vehicles/guiSpeedometer.cpp +++ b/Engine/source/T3D/vehicles/guiSpeedometer.cpp @@ -156,7 +156,7 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect) if (!conn) return; - // Requires either a vehicle control object or a vehicle-mounted player + // Requires either a vehicle control object or a vehicle-mounted player Vehicle* vehicle = dynamic_cast(conn->getControlObject()); if(!vehicle){ Player * player = dynamic_cast(conn->getControlObject()); @@ -183,20 +183,20 @@ void GuiSpeedometerHud::onRender(Point2I offset, const RectI &updateRect) F32 fillOffset = GFX->getFillConventionOffset(); // Find the fill offset Point2F viewCenter(offset.x + fillOffset + center.x, offset.y + fillOffset + center.y); - // Handle rotation calculations + // Handle rotation calculations F32 rotation, spinAngle; rotation = mMinAngle + (mMaxAngle - mMinAngle) * (mSpeed / mMaxSpeed); spinAngle = mDegToRad(rotation); MatrixF rotMatrix(EulerF(0.0, 0.0, spinAngle)); - // Set up the needle vertex list - Point3F vertList[5]; - vertList[0].set(+mNeedleLength,-mNeedleWidth,0); - vertList[1].set(+mNeedleLength,+mNeedleWidth,0); - vertList[2].set(-mTailLength ,+mNeedleWidth,0); - vertList[3].set(-mTailLength ,-mNeedleWidth,0); - vertList[4].set(+mNeedleLength,-mNeedleWidth,0); //// Get back to the start! - + // Set up the needle vertex list + Point3F vertList[5]; + vertList[0].set(+mNeedleLength,-mNeedleWidth,0); + vertList[1].set(+mNeedleLength,+mNeedleWidth,0); + vertList[2].set(-mTailLength ,+mNeedleWidth,0); + vertList[3].set(-mTailLength ,-mNeedleWidth,0); + vertList[4].set(+mNeedleLength,-mNeedleWidth,0); //// Get back to the start! + // Create a GFXStateBlock description if one has not been set. if (mBlendSB.isNull()) { diff --git a/Engine/source/app/badWordFilter.cpp b/Engine/source/app/badWordFilter.cpp index e267f5032..d0547e5ee 100644 --- a/Engine/source/app/badWordFilter.cpp +++ b/Engine/source/app/badWordFilter.cpp @@ -65,7 +65,7 @@ void BadWordFilter::create() { Con::addVariable("pref::enableBadWordFilter", TypeBool, &filteringEnabled, "@brief If true, the bad word filter will be enabled.\n\n" - "@ingroup Game"); + "@ingroup Game"); gBadWordFilter = new BadWordFilter; gBadWordFilter->addBadWord("shit"); gBadWordFilter->addBadWord("fuck"); @@ -251,7 +251,7 @@ DefineEngineFunction(addBadWord, bool, (const char* badWord),, "@ingroup Game") { - return gBadWordFilter->addBadWord(badWord); + return gBadWordFilter->addBadWord(badWord); } DefineEngineFunction(filterString, const char *, (const char* baseString, const char* replacementChars), (nullAsType(), nullAsType()), @@ -279,17 +279,17 @@ DefineEngineFunction(filterString, const char *, (const char* baseString, const "@ingroup Game") { - const char *replaceStr = NULL; + const char *replaceStr = NULL; - if(replacementChars) - replaceStr = replacementChars; - else - replaceStr = gBadWordFilter->getDefaultReplaceStr(); + if(replacementChars) + replaceStr = replacementChars; + else + replaceStr = gBadWordFilter->getDefaultReplaceStr(); - char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); - dStrcpy(ret, baseString); - gBadWordFilter->filterString(ret, replaceStr); - return ret; + char *ret = Con::getReturnBuffer(dStrlen(baseString) + 1); + dStrcpy(ret, baseString); + gBadWordFilter->filterString(ret, replaceStr); + return ret; } DefineEngineFunction(containsBadWords, bool, (const char* text),, @@ -316,17 +316,17 @@ DefineEngineFunction(containsBadWords, bool, (const char* text),, "// Otherwise print the original text\n" "if(containsBadWords(%userText))\n" "{\n" - " // Filter the string\n" - " %filteredText = filterString(%userText, %replacementChars);\n\n" - " // Print filtered text\n" - " echo(%filteredText);\n" + " // Filter the string\n" + " %filteredText = filterString(%userText, %replacementChars);\n\n" + " // Print filtered text\n" + " echo(%filteredText);\n" "}\n" "else\n" - " echo(%userText);\n\n" + " echo(%userText);\n\n" "@endtsexample\n" "@ingroup Game") { - return gBadWordFilter->containsBadWords(text); + return gBadWordFilter->containsBadWords(text); } diff --git a/Engine/source/console/CMDscan.cpp b/Engine/source/console/CMDscan.cpp index 6aedd587f..4a1c132b9 100644 --- a/Engine/source/console/CMDscan.cpp +++ b/Engine/source/console/CMDscan.cpp @@ -49,15 +49,15 @@ /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch @@ -128,10 +128,10 @@ extern FILE *yyin, *yyout; * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all @@ -141,14 +141,14 @@ extern FILE *yyin, *yyout; /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) @@ -160,61 +160,61 @@ typedef unsigned int yy_size_t; struct yy_buffer_state - { - FILE *yy_input_file; + { + FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; + }; static YY_BUFFER_STATE yy_current_buffer = 0; @@ -228,15 +228,15 @@ static YY_BUFFER_STATE yy_current_buffer = 0; /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... @@ -264,18 +264,18 @@ static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) @@ -294,11 +294,11 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; #define YY_NUM_RULES 94 #define YY_END_OF_BUFFER 95 @@ -715,21 +715,21 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -770,280 +770,280 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION YY_DECL - { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + { + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; #line 105 "CMDscan.l" ; #line 785 "CMDscan.cpp" - if ( yy_init ) - { - yy_init = 0; + if ( yy_init ) + { + yy_init = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! yy_start ) + yy_start = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! yyin ) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! yyout ) + yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_load_buffer_state(); - } + yy_load_buffer_state(); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; - /* Support of yytext. */ - *yy_cp = yy_hold_char; + /* Support of yytext. */ + *yy_cp = yy_hold_char; - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; yy_match: - do - { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 338 ); + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 338 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + yy_act = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; -do_action: /* This label is used only to access EOF actions. */ +do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; case 1: YY_RULE_SETUP #line 107 "CMDscan.l" { } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP #line 108 "CMDscan.l" { return(Sc_ScanDocBlock()); } - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP #line 109 "CMDscan.l" ; - YY_BREAK + YY_BREAK case 4: YY_RULE_SETUP #line 110 "CMDscan.l" ; - YY_BREAK + YY_BREAK case 5: YY_RULE_SETUP #line 111 "CMDscan.l" {lineIndex++;} - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP #line 112 "CMDscan.l" { return(Sc_ScanString(STRATOM)); } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP #line 113 "CMDscan.l" { return(Sc_ScanString(TAGATOM)); } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP #line 114 "CMDscan.l" { CMDlval.i = MakeToken< int >( opEQ, lineIndex ); return opEQ; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP #line 115 "CMDscan.l" { CMDlval.i = MakeToken< int >( opNE, lineIndex ); return opNE; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP #line 116 "CMDscan.l" { CMDlval.i = MakeToken< int >( opGE, lineIndex ); return opGE; } - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP #line 117 "CMDscan.l" { CMDlval.i = MakeToken< int >( opLE, lineIndex ); return opLE; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP #line 118 "CMDscan.l" { CMDlval.i = MakeToken< int >( opAND, lineIndex ); return opAND; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP #line 119 "CMDscan.l" { CMDlval.i = MakeToken< int >( opOR, lineIndex ); return opOR; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP #line 120 "CMDscan.l" { CMDlval.i = MakeToken< int >( opCOLONCOLON, lineIndex ); return opCOLONCOLON; } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP #line 121 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMINUSMINUS, lineIndex ); return opMINUSMINUS; } - YY_BREAK + YY_BREAK case 16: YY_RULE_SETUP #line 122 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLUSPLUS, lineIndex ); return opPLUSPLUS; } - YY_BREAK + YY_BREAK case 17: YY_RULE_SETUP #line 123 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTREQ, lineIndex ); return opSTREQ; } - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP #line 124 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSTRNE, lineIndex ); return opSTRNE; } - YY_BREAK + YY_BREAK case 19: YY_RULE_SETUP #line 125 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHL, lineIndex ); return opSHL; } - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP #line 126 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSHR, lineIndex ); return opSHR; } - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP #line 127 "CMDscan.l" { CMDlval.i = MakeToken< int >( opPLASN, lineIndex ); return opPLASN; } - YY_BREAK + YY_BREAK case 22: YY_RULE_SETUP #line 128 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMIASN, lineIndex ); return opMIASN; } - YY_BREAK + YY_BREAK case 23: YY_RULE_SETUP #line 129 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMLASN, lineIndex ); return opMLASN; } - YY_BREAK + YY_BREAK case 24: YY_RULE_SETUP #line 130 "CMDscan.l" { CMDlval.i = MakeToken< int >( opDVASN, lineIndex ); return opDVASN; } - YY_BREAK + YY_BREAK case 25: YY_RULE_SETUP #line 131 "CMDscan.l" { CMDlval.i = MakeToken< int >( opMODASN, lineIndex ); return opMODASN; } - YY_BREAK + YY_BREAK case 26: YY_RULE_SETUP #line 132 "CMDscan.l" { CMDlval.i = MakeToken< int >( opANDASN, lineIndex ); return opANDASN; } - YY_BREAK + YY_BREAK case 27: YY_RULE_SETUP #line 133 "CMDscan.l" { CMDlval.i = MakeToken< int >( opXORASN, lineIndex ); return opXORASN; } - YY_BREAK + YY_BREAK case 28: YY_RULE_SETUP #line 134 "CMDscan.l" { CMDlval.i = MakeToken< int >( opORASN, lineIndex ); return opORASN; } - YY_BREAK + YY_BREAK case 29: YY_RULE_SETUP #line 135 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSLASN, lineIndex ); return opSLASN; } - YY_BREAK + YY_BREAK case 30: YY_RULE_SETUP #line 136 "CMDscan.l" { CMDlval.i = MakeToken< int >( opSRASN, lineIndex ); return opSRASN; } - YY_BREAK + YY_BREAK case 31: YY_RULE_SETUP #line 137 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAME, lineIndex ); return opINTNAME; } - YY_BREAK + YY_BREAK case 32: YY_RULE_SETUP #line 138 "CMDscan.l" { CMDlval.i = MakeToken< int >( opINTNAMER, lineIndex ); return opINTNAMER; } - YY_BREAK + YY_BREAK case 33: YY_RULE_SETUP #line 139 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\n', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 34: YY_RULE_SETUP #line 140 "CMDscan.l" { CMDlval.i = MakeToken< int >( '\t', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 35: YY_RULE_SETUP #line 141 "CMDscan.l" { CMDlval.i = MakeToken< int >( ' ', lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 36: YY_RULE_SETUP #line 142 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return '@'; } - YY_BREAK + YY_BREAK case 37: YY_RULE_SETUP #line 143 "CMDscan.l" @@ -1070,7 +1070,7 @@ YY_RULE_SETUP break; } } - YY_BREAK + YY_BREAK case 38: #line 167 "CMDscan.l" case 39: @@ -1121,475 +1121,475 @@ case 61: YY_RULE_SETUP #line 189 "CMDscan.l" { CMDlval.i = MakeToken< int >( CMDtext[ 0 ], lineIndex ); return CMDtext[ 0 ]; } - YY_BREAK + YY_BREAK case 62: YY_RULE_SETUP #line 190 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIN, lineIndex ); return(rwIN); } - YY_BREAK + YY_BREAK case 63: YY_RULE_SETUP #line 191 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASEOR, lineIndex ); return(rwCASEOR); } - YY_BREAK + YY_BREAK case 64: YY_RULE_SETUP #line 192 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwBREAK, lineIndex ); return(rwBREAK); } - YY_BREAK + YY_BREAK case 65: YY_RULE_SETUP #line 193 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwRETURN, lineIndex ); return(rwRETURN); } - YY_BREAK + YY_BREAK case 66: YY_RULE_SETUP #line 194 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwELSE, lineIndex ); return(rwELSE); } - YY_BREAK + YY_BREAK case 67: YY_RULE_SETUP #line 195 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwASSERT, lineIndex ); return(rwASSERT); } - YY_BREAK + YY_BREAK case 68: YY_RULE_SETUP #line 196 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwWHILE, lineIndex ); return(rwWHILE); } - YY_BREAK + YY_BREAK case 69: YY_RULE_SETUP #line 197 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDO, lineIndex ); return(rwDO); } - YY_BREAK + YY_BREAK case 70: YY_RULE_SETUP #line 198 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwIF, lineIndex ); return(rwIF); } - YY_BREAK + YY_BREAK case 71: YY_RULE_SETUP #line 199 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACHSTR, lineIndex ); return(rwFOREACHSTR); } - YY_BREAK + YY_BREAK case 72: YY_RULE_SETUP #line 200 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOREACH, lineIndex ); return(rwFOREACH); } - YY_BREAK + YY_BREAK case 73: YY_RULE_SETUP #line 201 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwFOR, lineIndex ); return(rwFOR); } - YY_BREAK + YY_BREAK case 74: YY_RULE_SETUP #line 202 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCONTINUE, lineIndex ); return(rwCONTINUE); } - YY_BREAK + YY_BREAK case 75: YY_RULE_SETUP #line 203 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFINE, lineIndex ); return(rwDEFINE); } - YY_BREAK + YY_BREAK case 76: YY_RULE_SETUP #line 204 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARE, lineIndex ); return(rwDECLARE); } - YY_BREAK + YY_BREAK case 77: YY_RULE_SETUP #line 205 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDECLARESINGLETON, lineIndex ); return(rwDECLARESINGLETON); } - YY_BREAK + YY_BREAK case 78: YY_RULE_SETUP #line 206 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDATABLOCK, lineIndex ); return(rwDATABLOCK); } - YY_BREAK + YY_BREAK case 79: YY_RULE_SETUP #line 207 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwCASE, lineIndex ); return(rwCASE); } - YY_BREAK + YY_BREAK case 80: YY_RULE_SETUP #line 208 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCHSTR, lineIndex ); return(rwSWITCHSTR); } - YY_BREAK + YY_BREAK case 81: YY_RULE_SETUP #line 209 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwSWITCH, lineIndex ); return(rwSWITCH); } - YY_BREAK + YY_BREAK case 82: YY_RULE_SETUP #line 210 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwDEFAULT, lineIndex ); return(rwDEFAULT); } - YY_BREAK + YY_BREAK case 83: YY_RULE_SETUP #line 211 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwPACKAGE, lineIndex ); return(rwPACKAGE); } - YY_BREAK + YY_BREAK case 84: YY_RULE_SETUP #line 212 "CMDscan.l" { CMDlval.i = MakeToken< int >( rwNAMESPACE, lineIndex ); return(rwNAMESPACE); } - YY_BREAK + YY_BREAK case 85: YY_RULE_SETUP #line 213 "CMDscan.l" { CMDlval.i = MakeToken< int >( 1, lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 86: YY_RULE_SETUP #line 214 "CMDscan.l" { CMDlval.i = MakeToken< int >( 0, lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 87: YY_RULE_SETUP #line 215 "CMDscan.l" { return(Sc_ScanVar()); } - YY_BREAK + YY_BREAK case 88: YY_RULE_SETUP #line 216 "CMDscan.l" { return Sc_ScanIdent(); } - YY_BREAK + YY_BREAK case 89: YY_RULE_SETUP #line 217 "CMDscan.l" return(Sc_ScanHex()); - YY_BREAK + YY_BREAK case 90: YY_RULE_SETUP #line 218 "CMDscan.l" { CMDtext[CMDleng] = 0; CMDlval.i = MakeToken< int >( dAtoi(CMDtext), lineIndex ); return INTCONST; } - YY_BREAK + YY_BREAK case 91: YY_RULE_SETUP #line 219 "CMDscan.l" return Sc_ScanNum(); - YY_BREAK + YY_BREAK case 92: YY_RULE_SETUP #line 220 "CMDscan.l" return(ILLEGAL_TOKEN); - YY_BREAK + YY_BREAK case 93: YY_RULE_SETUP #line 221 "CMDscan.l" return(ILLEGAL_TOKEN); - YY_BREAK + YY_BREAK case 94: YY_RULE_SETUP #line 222 "CMDscan.l" ECHO; - YY_BREAK + YY_BREAK #line 1291 "CMDscan.cpp" case YY_STATE_EOF(INITIAL): - yyterminate(); + yyterminate(); - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = yytext_ptr + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state(); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of yylex */ + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() - { - char *dest = yy_current_buffer->yy_ch_buf; - char *source = yytext_ptr; - int number_to_move, i; - int ret_val; + { + char *dest = yy_current_buffer->yy_ch_buf; + char *source = yytext_ptr; + int number_to_move, i; + int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a singled characater, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a singled characater, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } - /* Try to read more data. */ + /* Try to read more data. */ - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_n_chars = 0; + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_n_chars = 0; - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT - YY_FATAL_ERROR( + YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; #endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); - } + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - return ret_val; - } + return ret_val; + } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() - { - yy_state_type yy_current_state; - char *yy_cp; + { + yy_state_type yy_current_state; + char *yy_cp; - yy_current_state = yy_start; + yy_current_state = yy_start; - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } - return yy_current_state; - } + return yy_current_state; + } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS @@ -1598,27 +1598,27 @@ static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif - { - int yy_is_jam; - char *yy_cp = yy_c_buf_p; + { + int yy_is_jam; + char *yy_cp = yy_c_buf_p; - YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 224 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 223); + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 224 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 223); - return yy_is_jam ? 0 : yy_current_state; - } + return yy_is_jam ? 0 : yy_current_state; + } #ifndef YY_NO_UNPUT @@ -1629,40 +1629,40 @@ static void yyunput( c, yy_bp ) int c; char *yy_bp; #endif - { - char *yy_cp = yy_c_buf_p; + { + char *yy_cp = yy_c_buf_p; - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = yy_n_chars + 2; - char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = yy_n_chars + 2; + char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_n_chars = yy_current_buffer->yy_buf_size; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_n_chars = yy_current_buffer->yy_buf_size; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - *--yy_cp = (char) c; + *--yy_cp = (char) c; - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } +#endif /* ifndef YY_NO_UNPUT */ #ifdef __cplusplus @@ -1670,69 +1670,69 @@ static int yyinput() #else static int input() #endif - { - int c; + { + int c; - *yy_c_buf_p = yy_hold_char; + *yy_c_buf_p = yy_hold_char; - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; - else - { /* need more input */ - yytext_ptr = yy_c_buf_p; - ++yy_c_buf_p; + else + { /* need more input */ + yytext_ptr = yy_c_buf_p; + ++yy_c_buf_p; - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - { - yy_c_buf_p = - yytext_ptr + YY_MORE_ADJ; - return EOF; - } + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + { + yy_c_buf_p = + yytext_ptr + YY_MORE_ADJ; + return EOF; + } - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; #ifdef __cplusplus - return yyinput(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; - break; + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + break; - case EOB_ACT_LAST_MATCH: + case EOB_ACT_LAST_MATCH: #ifdef __cplusplus - YY_FATAL_ERROR( - "unexpected last match in yyinput()" ); + YY_FATAL_ERROR( + "unexpected last match in yyinput()" ); #else - YY_FATAL_ERROR( - "unexpected last match in input()" ); + YY_FATAL_ERROR( + "unexpected last match in input()" ); #endif - } - } - } + } + } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; - return c; - } + return c; + } #ifdef YY_USE_PROTOS @@ -1741,13 +1741,13 @@ void yyrestart( FILE *input_file ) void yyrestart( input_file ) FILE *input_file; #endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } #ifdef YY_USE_PROTOS @@ -1756,28 +1756,28 @@ void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif - { - if ( yy_current_buffer == new_buffer ) - return; + { + if ( yy_current_buffer == new_buffer ) + return; - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + yy_current_buffer = new_buffer; + yy_load_buffer_state(); - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } #ifdef YY_USE_PROTOS @@ -1785,12 +1785,12 @@ void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } #ifdef YY_USE_PROTOS @@ -1800,28 +1800,28 @@ YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif - { - YY_BUFFER_STATE b; + { + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = size; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - b->yy_is_our_buffer = 1; + b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer( b, file ); - return b; - } + return b; + } #ifdef YY_USE_PROTOS @@ -1830,18 +1830,18 @@ void yy_delete_buffer( YY_BUFFER_STATE b ) void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif - { - if ( ! b ) - return; + { + if ( ! b ) + return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + yy_flex_free( (void *) b ); + } #ifndef YY_ALWAYS_INTERACTIVE @@ -1859,22 +1859,22 @@ FILE *file; #endif - { - yy_flush_buffer( b ); + { + yy_flush_buffer( b ); - b->yy_input_file = file; - b->yy_fill_buffer = 1; + b->yy_input_file = file; + b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; + b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; + b->yy_is_interactive = 0; #else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif - } + } #ifdef YY_USE_PROTOS @@ -1884,24 +1884,24 @@ void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif - { - b->yy_n_chars = 0; + { + b->yy_n_chars = 0; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); - } + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } #ifndef YY_NO_SCAN_BUFFER @@ -1912,33 +1912,33 @@ YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif - { - YY_BUFFER_STATE b; + { + YY_BUFFER_STATE b; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer( b ); - return b; - } + return b; + } #endif @@ -1949,13 +1949,13 @@ YY_BUFFER_STATE yy_scan_string( yyconst char *str ) YY_BUFFER_STATE yy_scan_string( str ) yyconst char *str; #endif - { - int len; - for ( len = 0; str[len]; ++len ) - ; + { + int len; + for ( len = 0; str[len]; ++len ) + ; - return yy_scan_bytes( str, len ); - } + return yy_scan_bytes( str, len ); + } #endif @@ -1967,34 +1967,34 @@ YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - return b; - } + return b; + } #endif @@ -2005,49 +2005,49 @@ static void yy_push_state( int new_state ) static void yy_push_state( new_state ) int new_state; #endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } - yy_start_stack[yy_start_stack_ptr++] = YY_START; + yy_start_stack[yy_start_stack_ptr++] = YY_START; - BEGIN(new_state); - } + BEGIN(new_state); + } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } #endif #ifndef YY_EXIT_FAILURE @@ -2060,10 +2060,10 @@ static void yy_fatal_error( yyconst char msg[] ) static void yy_fatal_error( msg ) char msg[]; #endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } @@ -2071,16 +2071,16 @@ char msg[]; #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n - YY_MORE_ADJ; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) /* Internal utility routines. */ @@ -2094,11 +2094,11 @@ char *s1; yyconst char *s2; int n; #endif - { - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } + { + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } #endif @@ -2108,9 +2108,9 @@ static void *yy_flex_alloc( yy_size_t size ) static void *yy_flex_alloc( size ) yy_size_t size; #endif - { - return (void *) malloc( size ); - } + { + return (void *) malloc( size ); + } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) @@ -2119,16 +2119,16 @@ static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) @@ -2136,16 +2136,16 @@ static void yy_flex_free( void *ptr ) static void yy_flex_free( ptr ) void *ptr; #endif - { - free( ptr ); - } + { + free( ptr ); + } #if YY_MAIN int main() - { - yylex(); - return 0; - } + { + yylex(); + return 0; + } #endif #line 222 "CMDscan.l" diff --git a/Engine/source/console/SimXMLDocument.h b/Engine/source/console/SimXMLDocument.h index 3f6e2661c..342917cff 100644 --- a/Engine/source/console/SimXMLDocument.h +++ b/Engine/source/console/SimXMLDocument.h @@ -45,7 +45,7 @@ class SimXMLDocument: public SimObject { // This typedef is required for tie ins with the script language. // -------------------------------------------------------------------------- - protected: + protected: typedef SimObject Parent; // -------------------------------------------------------------------------- @@ -85,8 +85,8 @@ class SimXMLDocument: public SimObject bool nextSiblingElement(const char* rName); // push child element at index onto stack. bool pushChildElement(S32 index); - // Get element value - const char* elementValue(); + // Get element value + const char* elementValue(); // Pop last element off of stack. void popElement(void); @@ -94,16 +94,16 @@ class SimXMLDocument: public SimObject // Get attribute from top element on element stack. const char* attribute(const char* rAttribute); - // Does the attribute exist in the current element + // Does the attribute exist in the current element bool attributeExists(const char* rAttribute); - // Obtain the name of the current element's first or last attribute - const char* firstAttribute(); - const char* lastAttribute(); + // Obtain the name of the current element's first or last attribute + const char* firstAttribute(); + const char* lastAttribute(); - // Move through the current element's attributes to obtain their names - const char* nextAttribute(); - const char* prevAttribute(); + // Move through the current element's attributes to obtain their names + const char* nextAttribute(); + const char* prevAttribute(); // Set attribute of top element on element stack. void setAttribute(const char* rAttribute, const char* rVal); @@ -139,8 +139,8 @@ class SimXMLDocument: public SimObject TiXmlDocument* m_qDocument; // Stack of nodes. Vector m_paNode; - // The current attribute - TiXmlAttribute* m_CurrentAttribute; + // The current attribute + TiXmlAttribute* m_CurrentAttribute; public: DECLARE_CONOBJECT(SimXMLDocument); diff --git a/Engine/source/console/arrayObject.h b/Engine/source/console/arrayObject.h index caab6dbd5..81531b6c2 100644 --- a/Engine/source/console/arrayObject.h +++ b/Engine/source/console/arrayObject.h @@ -102,7 +102,7 @@ public: /// Returns the value for a given index. /// Will return a null value for an invalid index - const String& getValueFromIndex( S32 index ) const; + const String& getValueFromIndex( S32 index ) const; /// S32 getIndexFromKeyValue( const String &key, const String &value ) const; diff --git a/Engine/source/console/cmdgram.cpp b/Engine/source/console/cmdgram.cpp index 064394aaa..39fe8d3c3 100644 --- a/Engine/source/console/cmdgram.cpp +++ b/Engine/source/console/cmdgram.cpp @@ -11,78 +11,78 @@ #define yychar CMDchar #define yydebug CMDdebug #define yynerrs CMDnerrs -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 #line 1 "cmdgram.y" @@ -182,9 +182,9 @@ typedef -#define YYFINAL 388 -#define YYFLAG -32768 -#define YYNTBASE 100 +#define YYFINAL 388 +#define YYFLAG -32768 +#define YYNTBASE 100 #define YYTRANSLATE(x) ((unsigned)(x) <= 329 ? yytranslate[x] : 140) @@ -502,7 +502,7 @@ static const short yypgoto[] = {-32768, }; -#define YYLAST 3042 +#define YYLAST 3042 static const short yytable[] = { 47, @@ -1183,50 +1183,50 @@ void *alloca (); It is replaced by the list of actions, each action as one case of the switch. */ -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT return(0) -#define YYABORT return(1) -#define YYERROR goto yyerrlab1 +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY -2 +#define YYEOF 0 +#define YYACCEPT return(0) +#define YYABORT return(1) +#define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ -#define YYFAIL goto yyerrlab +#define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ -do \ - if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 #ifndef YYPURE -#define YYLEX yylex() +#define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval, &yylloc) +#define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) +#define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif @@ -1235,27 +1235,27 @@ while (0) #ifndef YYPURE -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ #ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ #endif -int yynerrs; /* number of parse errors so far */ +int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ +int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif -/* YYINITDEPTH indicates the initial size of the parser's stacks */ +/* YYINITDEPTH indicates the initial size of the parser's stacks */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif @@ -1275,9 +1275,9 @@ int yydebug; /* nonzero means print parse trace */ int yyparse (void); #endif -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(FROM,TO,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities @@ -1337,17 +1337,17 @@ yyparse(YYPARSE_PARAM) int yyn; short *yyssp; YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; @@ -1367,9 +1367,9 @@ yyparse(YYPARSE_PARAM) #endif #endif - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ int yylen; @@ -1381,7 +1381,7 @@ yyparse(YYPARSE_PARAM) yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack @@ -1416,20 +1416,20 @@ yynewstate: #ifdef yyoverflow /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ + the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ + but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); #else yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; @@ -1439,13 +1439,13 @@ yynewstate: #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - return 2; - } + { + yyerror("parser stack overflow"); + return 2; + } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; + yystacksize = YYMAXDEPTH; yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); @@ -1464,11 +1464,11 @@ yynewstate: #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); + fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) - YYABORT; + YYABORT; } #if YYDEBUG != 0 @@ -1498,21 +1498,21 @@ yynewstate: { #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Reading a token: "); + fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ - if (yychar <= 0) /* This means end of input. */ + if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ + yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Now at end of input.\n"); + fprintf(stderr, "Now at end of input.\n"); #endif } else @@ -1521,15 +1521,15 @@ yynewstate: #if YYDEBUG != 0 if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ #ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); + YYPRINT (stderr, yychar, yylval); #endif - fprintf (stderr, ")\n"); - } + fprintf (stderr, ")\n"); + } #endif } @@ -1549,7 +1549,7 @@ yynewstate: if (yyn < 0) { if (yyn == YYFLAG) - goto yyerrlab; + goto yyerrlab; yyn = -yyn; goto yyreduce; } @@ -1600,11 +1600,11 @@ yyreduce: int i; fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); + yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif @@ -2265,7 +2265,7 @@ case 162: short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif @@ -2315,44 +2315,44 @@ yyerrlab: /* here on detecting error */ yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; + { + int size = 0; + char *msg; + int x, count; - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); + count = 0; + /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + size += strlen(yytname[x]) + 15, count++; + msg = (char *) malloc(size + 15); + if (msg != 0) + { + strcpy(msg, "parse error"); - if (count < 5) - { - count = 0; - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - { - strcat(msg, count == 0 ? ", expecting `" : " or `"); - strcat(msg, yytname[x]); - strcat(msg, "'"); - count++; - } - } - yyerror(msg); - free(msg); - } - else - yyerror ("parse error; also virtual memory exceeded"); - } + if (count < 5) + { + count = 0; + for (x = (yyn < 0 ? -yyn : 0); + x < (sizeof(yytname) / sizeof(char *)); x++) + if (yycheck[x + yyn] == x) + { + strcat(msg, count == 0 ? ", expecting `" : " or `"); + strcat(msg, yytname[x]); + strcat(msg, "'"); + count++; + } + } + yyerror(msg); + free(msg); + } + else + yyerror ("parse error; also virtual memory exceeded"); + } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); + yyerror("parse error"); } goto yyerrlab1; @@ -2364,11 +2364,11 @@ yyerrlab1: /* here on error raised explicitly by an action */ /* return failure if at end of input */ if (yychar == YYEOF) - YYABORT; + YYABORT; #if YYDEBUG != 0 if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); + fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; @@ -2377,7 +2377,7 @@ yyerrlab1: /* here on error raised explicitly by an action */ /* Else will try to reuse lookahead token after shifting the error token. */ - yyerrstatus = 3; /* Each real token shifted decrements this */ + yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; @@ -2405,7 +2405,7 @@ yyerrpop: /* pop the current state because it cannot handle the error token */ short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif @@ -2424,7 +2424,7 @@ yyerrhandle: if (yyn < 0) { if (yyn == YYFLAG) - goto yyerrpop; + goto yyerrpop; yyn = -yyn; goto yyreduce; } diff --git a/Engine/source/console/cmdgram.h b/Engine/source/console/cmdgram.h index 83736a565..fc22f3df2 100644 --- a/Engine/source/console/cmdgram.h +++ b/Engine/source/console/cmdgram.h @@ -15,78 +15,78 @@ typedef union { AssignDecl asn; IfStmtNode* ifnode; } YYSTYPE; -#define rwDEFINE 258 -#define rwENDDEF 259 -#define rwDECLARE 260 -#define rwDECLARESINGLETON 261 -#define rwBREAK 262 -#define rwELSE 263 -#define rwCONTINUE 264 -#define rwGLOBAL 265 -#define rwIF 266 -#define rwNIL 267 -#define rwRETURN 268 -#define rwWHILE 269 -#define rwDO 270 -#define rwENDIF 271 -#define rwENDWHILE 272 -#define rwENDFOR 273 -#define rwDEFAULT 274 -#define rwFOR 275 -#define rwFOREACH 276 -#define rwFOREACHSTR 277 -#define rwIN 278 -#define rwDATABLOCK 279 -#define rwSWITCH 280 -#define rwCASE 281 -#define rwSWITCHSTR 282 -#define rwCASEOR 283 -#define rwPACKAGE 284 -#define rwNAMESPACE 285 -#define rwCLASS 286 -#define rwASSERT 287 -#define ILLEGAL_TOKEN 288 -#define CHRCONST 289 -#define INTCONST 290 -#define TTAG 291 -#define VAR 292 -#define IDENT 293 -#define TYPEIDENT 294 -#define DOCBLOCK 295 -#define STRATOM 296 -#define TAGATOM 297 -#define FLTCONST 298 -#define opINTNAME 299 -#define opINTNAMER 300 -#define opMINUSMINUS 301 -#define opPLUSPLUS 302 -#define STMT_SEP 303 -#define opSHL 304 -#define opSHR 305 -#define opPLASN 306 -#define opMIASN 307 -#define opMLASN 308 -#define opDVASN 309 -#define opMODASN 310 -#define opANDASN 311 -#define opXORASN 312 -#define opORASN 313 -#define opSLASN 314 -#define opSRASN 315 -#define opCAT 316 -#define opEQ 317 -#define opNE 318 -#define opGE 319 -#define opLE 320 -#define opAND 321 -#define opOR 322 -#define opSTREQ 323 -#define opCOLONCOLON 324 -#define opMDASN 325 -#define opNDASN 326 -#define opNTASN 327 -#define opSTRNE 328 -#define UNARY 329 +#define rwDEFINE 258 +#define rwENDDEF 259 +#define rwDECLARE 260 +#define rwDECLARESINGLETON 261 +#define rwBREAK 262 +#define rwELSE 263 +#define rwCONTINUE 264 +#define rwGLOBAL 265 +#define rwIF 266 +#define rwNIL 267 +#define rwRETURN 268 +#define rwWHILE 269 +#define rwDO 270 +#define rwENDIF 271 +#define rwENDWHILE 272 +#define rwENDFOR 273 +#define rwDEFAULT 274 +#define rwFOR 275 +#define rwFOREACH 276 +#define rwFOREACHSTR 277 +#define rwIN 278 +#define rwDATABLOCK 279 +#define rwSWITCH 280 +#define rwCASE 281 +#define rwSWITCHSTR 282 +#define rwCASEOR 283 +#define rwPACKAGE 284 +#define rwNAMESPACE 285 +#define rwCLASS 286 +#define rwASSERT 287 +#define ILLEGAL_TOKEN 288 +#define CHRCONST 289 +#define INTCONST 290 +#define TTAG 291 +#define VAR 292 +#define IDENT 293 +#define TYPEIDENT 294 +#define DOCBLOCK 295 +#define STRATOM 296 +#define TAGATOM 297 +#define FLTCONST 298 +#define opINTNAME 299 +#define opINTNAMER 300 +#define opMINUSMINUS 301 +#define opPLUSPLUS 302 +#define STMT_SEP 303 +#define opSHL 304 +#define opSHR 305 +#define opPLASN 306 +#define opMIASN 307 +#define opMLASN 308 +#define opDVASN 309 +#define opMODASN 310 +#define opANDASN 311 +#define opXORASN 312 +#define opORASN 313 +#define opSLASN 314 +#define opSRASN 315 +#define opCAT 316 +#define opEQ 317 +#define opNE 318 +#define opGE 319 +#define opLE 320 +#define opAND 321 +#define opOR 322 +#define opSTREQ 323 +#define opCOLONCOLON 324 +#define opMDASN 325 +#define opNDASN 326 +#define opNTASN 327 +#define opSTRNE 328 +#define UNARY 329 extern YYSTYPE CMDlval; diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index d61a8f353..f189d6268 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -242,7 +242,7 @@ inline void ExprEvalState::setCurVarName(StringTableEntry name) else if( getStackDepth() > 0 ) currentVariable = getCurrentFrame().lookup(name); if(!currentVariable && gWarnUndefinedScriptVariables) - Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name); + Con::warnf(ConsoleLogEntry::Script, "Variable referenced before assignment: %s", name); } inline void ExprEvalState::setCurVarNameCreate(StringTableEntry name) @@ -316,7 +316,7 @@ inline void ExprEvalState::setCopyVariable() default: currentVariable->setStringValue(copyVariable->getStringValue()); break; - } + } } } @@ -398,7 +398,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const // Ensure that the variable has a value if (!prevVal) - return; + return; static const StringTableEntry xyzw[] = { @@ -419,7 +419,7 @@ static void setFieldComponent( SimObject* object, StringTableEntry field, const // Insert the value into the specified // component of the string. if ( subField == xyzw[0] || subField == rgba[0] ) - dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") ); + dStrcpy( val, StringUnit::setUnit( prevVal, 0, strValue, " \t\n") ); else if ( subField == xyzw[1] || subField == rgba[1] ) dStrcpy( val, StringUnit::setUnit( prevVal, 1, strValue, " \t\n") ); @@ -1020,7 +1020,7 @@ breakContinue: dataBlock->deleteObject(); currentNewObject = NULL; ip = failJump; - + // Prevent stack value corruption CSTK.popFrame(); STR.popFrame(); @@ -1164,8 +1164,8 @@ breakContinue: // This fixes a bug when not explicitly returning a value. case OP_RETURN_VOID: - STR.setStringValue(""); - // We're falling thru here on purpose. + STR.setStringValue(""); + // We're falling thru here on purpose. case OP_RETURN: retValue = STR.getStringValuePtr(); @@ -1437,7 +1437,7 @@ breakContinue: case OP_SAVEVAR_STR: gEvalState.setStringVariable(STR.getStringValue()); break; - + case OP_SAVEVAR_VAR: // this basically handles %var1 = %var2 gEvalState.setCopyVariable(); diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index d6e8908b4..2a070814b 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -278,8 +278,8 @@ bool useTimestamp = false; ConsoleFunctionGroupBegin( Clipboard, "Miscellaneous functions to control the clipboard and clear the console."); DefineConsoleFunction( cls, void, (), , "()" - "@brief Clears the console output.\n\n" - "@ingroup Console") + "@brief Clears the console output.\n\n" + "@ingroup Console") { if(consoleLogLocked) return; @@ -288,17 +288,17 @@ DefineConsoleFunction( cls, void, (), , "()" }; DefineConsoleFunction( getClipboard, const char*, (), , "()" - "@brief Get text from the clipboard.\n\n" - "@internal") + "@brief Get text from the clipboard.\n\n" + "@internal") { - return Platform::getClipboard(); + return Platform::getClipboard(); }; DefineConsoleFunction( setClipboard, bool, (const char* text), , "(string text)" "@brief Set the system clipboard.\n\n" - "@internal") + "@internal") { - return Platform::setClipboard(text); + return Platform::setClipboard(text); }; ConsoleFunctionGroupEnd( Clipboard ); @@ -332,25 +332,25 @@ void init() // Variables setVariable("Con::prompt", "% "); addVariable("Con::logBufferEnabled", TypeBool, &logBufferEnabled, "If true, the log buffer will be enabled.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable("Con::printLevel", TypeS32, &printLevel, "@brief This is deprecated.\n\n" "It is no longer in use and does nothing.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable("Con::warnUndefinedVariables", TypeBool, &gWarnUndefinedScriptVariables, "If true, a warning will be displayed in the console whenever a undefined variable is used in script.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable( "instantGroup", TypeRealString, &gInstantGroup, "The group that objects will be added to when they are created.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); addVariable("Con::objectCopyFailures", TypeS32, &gObjectCopyFailures, "If greater than zero then it counts the number of object creation " "failures based on a missing copy object and does not report an error..\n" - "@ingroup Console\n"); + "@ingroup Console\n"); // Current script file name and root addVariable( "Con::File", TypeString, &gCurrentFile, "The currently executing script file.\n" - "@ingroup FileSystem\n"); + "@ingroup FileSystem\n"); addVariable( "Con::Root", TypeString, &gCurrentRoot, "The mod folder for the currently executing script file.\n" - "@ingroup FileSystem\n" ); + "@ingroup FileSystem\n" ); // alwaysUseDebugOutput determines whether to send output to the platform's // "debug" system. see winConsole for an example. @@ -364,14 +364,14 @@ void init() addVariable("Con::alwaysUseDebugOutput", TypeBool, &alwaysUseDebugOutput, "@brief Determines whether to send output to the platform's \"debug\" system.\n\n" "@note This is disabled in shipping builds.\n" - "@ingroup Console"); + "@ingroup Console"); #else alwaysUseDebugOutput = false; #endif // controls whether a timestamp is prepended to every console message addVariable("Con::useTimestamp", TypeBool, &useTimestamp, "If true a timestamp is prepended to every console message.\n" - "@ingroup Console\n"); + "@ingroup Console\n"); // Plug us into the journaled console input signal. smConsoleInput.notify(postConsoleInput); @@ -599,7 +599,7 @@ static void log(const char *string) static void _printf(ConsoleLogEntry::Level level, ConsoleLogEntry::Type type, const char* fmt, va_list argptr) { if (!active) - return; + return; Con::active = false; char buffer[8192]; @@ -781,7 +781,7 @@ Dictionary::Entry *getAddVariableEntry(const char *name) StringTableEntry stName = StringTable->insert(name); Dictionary::Entry *entry = gEvalState.globalVars.lookup(stName); if (!entry) - entry = gEvalState.globalVars.add(stName); + entry = gEvalState.globalVars.add(stName); return entry; } @@ -791,7 +791,7 @@ Dictionary::Entry *getAddLocalVariableEntry(const char *name) StringTableEntry stName = StringTable->insert(name); Dictionary::Entry *entry = gEvalState.getCurrentFrame().lookup(stName); if (!entry) - entry = gEvalState.getCurrentFrame().add(stName); + entry = gEvalState.getCurrentFrame().add(stName); return entry; } @@ -802,7 +802,7 @@ void setVariable(const char *name, const char *value) if (getVariableObjectField(name, &obj, &objField)) { - obj->setDataField(StringTable->insert(objField), 0, value); + obj->setDataField(StringTable->insert(objField), 0, value); } else { @@ -824,13 +824,13 @@ void setBoolVariable(const char *varName, bool value) if (getVariableObjectField(varName, &obj, &objField)) { - obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0"); + obj->setDataField(StringTable->insert(objField), 0, value ? "1" : "0"); } else { varName = prependDollar(varName); Dictionary::Entry *entry = getAddVariableEntry(varName); - entry->setStringValue(value ? "1" : "0"); + entry->setStringValue(value ? "1" : "0"); } } @@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char scratchBuffer[32]; + dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value); + obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); } else { @@ -860,15 +860,15 @@ void setFloatVariable(const char *varName, F32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char scratchBuffer[32]; + dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value); + obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); } else { varName = prependDollar(varName); Dictionary::Entry *entry = getAddVariableEntry(varName); - entry->setFloatValue(value); + entry->setFloatValue(value); } } @@ -1020,7 +1020,7 @@ F32 getFloatVariable(const char *varName, F32 def) else { Dictionary::Entry *entry = getVariableEntry(varName); - return entry ? entry->getFloatValue() : def; + return entry ? entry->getFloatValue() : def; } } @@ -1308,8 +1308,8 @@ bool executeFile(const char* fileName, bool noCalls, bool journalScript) // Let's do a sanity check to complain about DSOs in the future. // - // MM: This doesn't seem to be working correctly for now so let's just not issue - // the warning until someone knows how to resolve it. + // MM: This doesn't seem to be working correctly for now so let's just not issue + // the warning until someone knows how to resolve it. // //if(compiled && rCom && rScr && Platform::compareFileTimes(comModifyTime, scrModifyTime) < 0) //{ @@ -1515,7 +1515,7 @@ ConsoleValueRef execute(S32 argc, ConsoleValueRef argv[]) #endif ConsoleStackFrameSaver stackSaver; stackSaver.save(); - return _internalExecute(argc, argv); + return _internalExecute(argc, argv); #ifdef TORQUE_MULTITHREAD } else @@ -2616,7 +2616,7 @@ const char *ConsoleValue::getStringValue() U32 stringLen = dStrlen(internalValue); U32 newLen = ((stringLen + 1) + 15) & ~15; // pad upto next cache line - + if (bufferLen == 0) sval = (char *) dMalloc(newLen); else if(newLen > bufferLen) diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index 41c5e8027..b442841a4 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -45,7 +45,7 @@ DefineConsoleFunction( dumpConsoleClasses, void, (bool dumpScript, bool dumpEngi "@brief Dumps all declared console classes to the console.\n\n" "@param dumpScript Optional parameter specifying whether or not classes defined in script should be dumped.\n" "@param dumpEngine Optional parameter specifying whether or not classes defined in the engine should be dumped.\n" - "@ingroup Logging") + "@ingroup Logging") { Namespace::dumpClasses( dumpScript, dumpEngine ); } @@ -54,7 +54,7 @@ DefineConsoleFunction(dumpConsoleFunctions, void, ( bool dumpScript, bool dumpEn "@brief Dumps all declared console functions to the console.\n" "@param dumpScript Optional parameter specifying whether or not functions defined in script should be dumped.\n" "@param dumpEngine Optional parameter specitying whether or not functions defined in the engine should be dumped.\n" - "@ingroup Logging") + "@ingroup Logging") { Namespace::dumpFunctions( dumpScript, dumpEngine ); } diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index 76b3f3d9f..bdf1d5cfe 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -463,12 +463,12 @@ DefineConsoleFunction( strposr, S32, ( const char* haystack, const char* needle, U32 sublen = dStrlen( needle ); U32 strlen = dStrlen( haystack ); S32 start = strlen - offset; - + if(start < 0 || start > strlen) return -1; if (start + sublen > strlen) - start = strlen - sublen; + start = strlen - sublen; for(; start >= 0; start--) if(!dStrncmp(haystack + start, needle, sublen)) return start; @@ -1022,15 +1022,15 @@ DefineConsoleFunction( strrchrpos, S32, ( const char* str, const char* chr, S32 //---------------------------------------------------------------- DefineConsoleFunction(ColorFloatToInt, ColorI, (ColorF color), , - "Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n" - "@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n" - "@return Converted color value (0 - 255)\n\n" - "@tsexample\n" - "ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n" - "@endtsexample\n" - "@ingroup Strings") + "Convert from a float color to an integer color (0.0 - 1.0 to 0 to 255).\n" + "@param color Float color value to be converted in the form \"R G B A\", where R is red, G is green, B is blue, and A is alpha.\n" + "@return Converted color value (0 - 255)\n\n" + "@tsexample\n" + "ColorFloatToInt( \"0 0 1 0.5\" ) // Returns \"0 0 255 128\".\n" + "@endtsexample\n" + "@ingroup Strings") { - return (ColorI)color; + return (ColorI)color; } DefineConsoleFunction(ColorIntToFloat, ColorF, (ColorI color), , @@ -1201,8 +1201,8 @@ DefineConsoleFunction( isValidIP, bool, ( const char* str),, ConsoleFunction(addCaseSensitiveStrings,void,2,0,"[string1, string2, ...]" "Adds case sensitive strings to the StringTable.") { - for(int i = 1; i < argc; i++) - StringTable->insert(argv[i], true); + for(int i = 1; i < argc; i++) + StringTable->insert(argv[i], true); } //============================================================================= @@ -1645,7 +1645,7 @@ DefineConsoleFunction( nextToken, const char*, ( const char* str1, const char* t "@endtsexample\n\n" "@ingroup Strings" ) { - char buffer[4096]; + char buffer[4096]; dStrncpy(buffer, str1, 4096); char *str = buffer; @@ -1812,7 +1812,7 @@ DefineEngineFunction( detag, const char*, ( const char* str ),, "{\n" " onChatMessage(detag(%msgString), %voice, %pitch);\n" "}\n" - "@endtsexample\n\n" + "@endtsexample\n\n" "@see \\ref syntaxDataTypes under Tagged %Strings\n" "@see getTag()\n" @@ -2017,8 +2017,8 @@ DefineConsoleFunction( collapseEscape, const char*, ( const char* text ),, //----------------------------------------------------------------------------- DefineEngineFunction( setLogMode, void, ( S32 mode ),, - "@brief Determines how log files are written.\n\n" - "Sets the operational mode of the console logging system.\n\n" + "@brief Determines how log files are written.\n\n" + "Sets the operational mode of the console logging system.\n\n" "@param mode Parameter specifying the logging mode. This can be:\n" "- 1: Open and close the console log file for each seperate string of output. This will ensure that all " "parts get written out to disk and that no parts remain in intermediate buffers even if the process crashes.\n" @@ -2030,8 +2030,8 @@ DefineEngineFunction( setLogMode, void, ( S32 mode ),, "combined by binary OR with 0x4 to cause the logging system to flush all console log messages that had already been " "issued to the console system into the newly created log file.\n\n" - "@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead." - "@ingroup Logging" ) + "@note Xbox 360 does not support logging to a file. Use Platform::OutputDebugStr in C++ instead." + "@ingroup Logging" ) { Con::setLogMode( mode ); } @@ -2144,7 +2144,7 @@ DefineEngineFunction( gotoWebPage, void, ( const char* address ),, DefineEngineFunction( displaySplashWindow, bool, (const char* path), (""), "Display a startup splash window suitable for showing while the engine still starts up.\n\n" "@note This is currently only implemented on Windows.\n\n" - "@param path relative path to splash screen image to display.\n" + "@param path relative path to splash screen image to display.\n" "@return True if the splash window could be successfully initialized.\n\n" "@ingroup Platform" ) { @@ -2395,19 +2395,19 @@ DefineConsoleFunction( setVariable, void, ( const char* varName, const char* val } DefineConsoleFunction( isFunction, bool, ( const char* funcName ), , "(string funcName)" - "@brief Determines if a function exists or not\n\n" - "@param funcName String containing name of the function\n" - "@return True if the function exists, false if not\n" - "@ingroup Scripting") + "@brief Determines if a function exists or not\n\n" + "@param funcName String containing name of the function\n" + "@return True if the function exists, false if not\n" + "@ingroup Scripting") { return Con::isFunction(funcName); } DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ), , "(string funcName)" - "@brief Provides the name of the package the function belongs to\n\n" - "@param funcName String containing name of the function\n" - "@return The name of the function's package\n" - "@ingroup Packages") + "@brief Provides the name of the package the function belongs to\n\n" + "@param funcName String containing name of the function\n" + "@return The name of the function's package\n" + "@ingroup Packages") { Namespace::Entry* nse = Namespace::global()->lookup( StringTable->insert( funcName ) ); if( !nse ) @@ -2417,11 +2417,11 @@ DefineConsoleFunction( getFunctionPackage, const char*, ( const char* funcName ) } DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" - "@brief Determines if a class/namespace method exists\n\n" - "@param namespace Class or namespace, such as Player\n" - "@param method Name of the function to search for\n" - "@return True if the method exists, false if not\n" - "@ingroup Scripting\n") + "@brief Determines if a class/namespace method exists\n\n" + "@param namespace Class or namespace, such as Player\n" + "@param method Name of the function to search for\n" + "@return True if the method exists, false if not\n" + "@ingroup Scripting\n") { Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) ); Namespace::Entry* nse = ns->lookup( StringTable->insert( method ) ); @@ -2432,11 +2432,11 @@ DefineConsoleFunction( isMethod, bool, ( const char* nameSpace, const char* meth } DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, const char* method ), , "(string namespace, string method)" - "@brief Provides the name of the package the method belongs to\n\n" - "@param namespace Class or namespace, such as Player\n" - "@param method Name of the funciton to search for\n" - "@return The name of the method's package\n" - "@ingroup Packages") + "@brief Provides the name of the package the method belongs to\n\n" + "@param namespace Class or namespace, such as Player\n" + "@param method Name of the funciton to search for\n" + "@return The name of the method's package\n" + "@ingroup Packages") { Namespace* ns = Namespace::find( StringTable->insert( nameSpace ) ); if( !ns ) @@ -2450,13 +2450,13 @@ DefineConsoleFunction( getMethodPackage, const char*, ( const char* nameSpace, c } DefineConsoleFunction( isDefined, bool, ( const char* varName, const char* varValue ), ("") , "(string varName)" - "@brief Determines if a variable exists and contains a value\n" - "@param varName Name of the variable to search for\n" - "@return True if the variable was defined in script, false if not\n" + "@brief Determines if a variable exists and contains a value\n" + "@param varName Name of the variable to search for\n" + "@return True if the variable was defined in script, false if not\n" "@tsexample\n" "isDefined( \"$myVar\" );\n" "@endtsexample\n\n" - "@ingroup Scripting") + "@ingroup Scripting") { if(String::isEmpty(varName)) { @@ -2595,10 +2595,10 @@ DefineConsoleFunction( isCurrentScriptToolScript, bool, (), , "()" } DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , "(string path)" - "@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n" - "@param File path of mod folder\n" - "@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n" - "@internal") + "@brief Attempts to extract a mod directory from path. Returns empty string on failure.\n\n" + "@param File path of mod folder\n" + "@note This is no longer relevant in Torque 3D (which does not use mod folders), should be deprecated\n" + "@internal") { StringTableEntry modPath = Con::getModNameFromPath(path); return modPath ? modPath : ""; @@ -2607,11 +2607,11 @@ DefineConsoleFunction( getModNameFromPath, const char *, ( const char* path ), , //----------------------------------------------------------------------------- DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group])" - "@brief Pushes the current $instantGroup on a stack " - "and sets it to the given value (or clears it).\n\n" - "@note Currently only used for editors\n" - "@ingroup Editors\n" - "@internal") + "@brief Pushes the current $instantGroup on a stack " + "and sets it to the given value (or clears it).\n\n" + "@note Currently only used for editors\n" + "@ingroup Editors\n" + "@internal") { if( group.size() > 0 ) Con::pushInstantGroup( group ); @@ -2620,10 +2620,10 @@ DefineConsoleFunction( pushInstantGroup, void, ( String group ),("") , "([group] } DefineConsoleFunction( popInstantGroup, void, (), , "()" - "@brief Pop and restore the last setting of $instantGroup off the stack.\n\n" - "@note Currently only used for editors\n\n" - "@ingroup Editors\n" - "@internal") + "@brief Pop and restore the last setting of $instantGroup off the stack.\n\n" + "@note Currently only used for editors\n\n" + "@ingroup Editors\n" + "@internal") { Con::popInstantGroup(); } @@ -2631,8 +2631,8 @@ DefineConsoleFunction( popInstantGroup, void, (), , "()" //----------------------------------------------------------------------------- DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileName ), (""), "([relativeFileName])" - "@note Appears to be useless in Torque 3D, should be deprecated\n" - "@internal") + "@note Appears to be useless in Torque 3D, should be deprecated\n" + "@internal") { const char *filename = Platform::getPrefsPath(relativeFileName); if(filename == NULL || *filename == 0) @@ -2644,13 +2644,13 @@ DefineConsoleFunction( getPrefsPath, const char *, ( const char* relativeFileNam //----------------------------------------------------------------------------- ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )" - "@brief Manually execute a special script file that contains game or editor preferences\n\n" - "@param relativeFileName Name and path to file from project folder\n" - "@param noCalls Deprecated\n" - "@param journalScript Deprecated\n" - "@return True if script was successfully executed\n" - "@note Appears to be useless in Torque 3D, should be deprecated\n" - "@ingroup Scripting") + "@brief Manually execute a special script file that contains game or editor preferences\n\n" + "@param relativeFileName Name and path to file from project folder\n" + "@param noCalls Deprecated\n" + "@param journalScript Deprecated\n" + "@return True if script was successfully executed\n" + "@note Appears to be useless in Torque 3D, should be deprecated\n" + "@ingroup Scripting") { const char *filename = Platform::getPrefsPath(argv[1]); if(filename == NULL || *filename == 0) @@ -2791,8 +2791,8 @@ DefineEngineFunction( isToolBuild, bool, (),, } DefineEngineFunction( getMaxDynamicVerts, S32, (),, - "Get max number of allowable dynamic vertices in a single vertex buffer.\n\n" - "@return the max number of allowable dynamic vertices in a single vertex buffer" ) + "Get max number of allowable dynamic vertices in a single vertex buffer.\n\n" + "@return the max number of allowable dynamic vertices in a single vertex buffer" ) { return MAX_DYNAMIC_VERTS / 2; } diff --git a/Engine/source/console/consoleInternal.cpp b/Engine/source/console/consoleInternal.cpp index c562b85c0..c9016e8dc 100644 --- a/Engine/source/console/consoleInternal.cpp +++ b/Engine/source/console/consoleInternal.cpp @@ -510,7 +510,7 @@ void ConsoleValue::setStringValue(const char * value) return; } */ - if (value == typeValueEmpty) + if (value == typeValueEmpty) { if (bufferLen > 0) { @@ -544,7 +544,7 @@ void ConsoleValue::setStringValue(const char * value) // may as well pad to the next cache line U32 newLen = ((stringLen + 1) + 15) & ~15; - + if(bufferLen == 0) sval = (char *) dMalloc(newLen); else if(newLen > bufferLen) @@ -573,7 +573,7 @@ void ConsoleValue::setStackStringValue(const char *value) bufferLen = 0; } - if (value == typeValueEmpty) + if (value == typeValueEmpty) { sval = typeValueEmpty; fval = 0.f; @@ -607,7 +607,7 @@ void ConsoleValue::setStringStackPtrValue(StringStackPtr ptrValue) if(type <= ConsoleValue::TypeInternalString) { const char *value = StringStackPtrRef(ptrValue).getPtr(&STR); - if (bufferLen > 0) + if (bufferLen > 0) { dFree(sval); bufferLen = 0; @@ -1418,14 +1418,14 @@ ConsoleValueRef Namespace::Entry::execute(S32 argc, ConsoleValueRef *argv, ExprE case StringCallbackType: return ConsoleValueRef::fromValue(CSTK.pushStackString(cb.mStringCallbackFunc(state->thisObject, argc, argv))); case IntCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case FloatCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushFLT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); case VoidCallbackType: cb.mVoidCallbackFunc(state->thisObject, argc, argv); return ConsoleValueRef(); case BoolCallbackType: - return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); + return ConsoleValueRef::fromValue(CSTK.pushUINT((U32)cb.mBoolCallbackFunc(state->thisObject, argc, argv))); } return ConsoleValueRef(); diff --git a/Engine/source/console/consoleLogger.cpp b/Engine/source/console/consoleLogger.cpp index cc0e2afaf..84347a332 100644 --- a/Engine/source/console/consoleLogger.cpp +++ b/Engine/source/console/consoleLogger.cpp @@ -226,20 +226,20 @@ void ConsoleLogger::log( const char *consoleLine ) //----------------------------------------------------------------------------- DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger to the console and begins writing to file" - "@tsexample\n" - "// Create the logger\n" - "// Will automatically start writing to testLogging.txt with normal priority\n" - "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" - "// Send something to the console, with the logger consumes and writes to file\n" - "echo(\"This is logged to the file\");\n\n" - "// Stop logging, but do not delete the logger\n" - "logger.detach();\n\n" - "echo(\"This is not logged to the file\");\n\n" - "// Attach the logger to the console again\n" - "logger.attach();\n\n" - "// Logging has resumed\n" - "echo(\"Logging has resumed\");" - "@endtsexample\n\n") + "@tsexample\n" + "// Create the logger\n" + "// Will automatically start writing to testLogging.txt with normal priority\n" + "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" + "// Send something to the console, with the logger consumes and writes to file\n" + "echo(\"This is logged to the file\");\n\n" + "// Stop logging, but do not delete the logger\n" + "logger.detach();\n\n" + "echo(\"This is not logged to the file\");\n\n" + "// Attach the logger to the console again\n" + "logger.attach();\n\n" + "// Logging has resumed\n" + "echo(\"Logging has resumed\");" + "@endtsexample\n\n") { ConsoleLogger *logger = static_cast( object ); return logger->attach(); @@ -248,20 +248,20 @@ DefineConsoleMethod( ConsoleLogger, attach, bool, (), , "() Attaches the logger //----------------------------------------------------------------------------- DefineConsoleMethod( ConsoleLogger, detach, bool, (), , "() Detaches the logger from the console and stops writing to file" - "@tsexample\n" - "// Create the logger\n" - "// Will automatically start writing to testLogging.txt with normal priority\n" - "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" - "// Send something to the console, with the logger consumes and writes to file\n" - "echo(\"This is logged to the file\");\n\n" - "// Stop logging, but do not delete the logger\n" - "logger.detach();\n\n" - "echo(\"This is not logged to the file\");\n\n" - "// Attach the logger to the console again\n" - "logger.attach();\n\n" - "// Logging has resumed\n" - "echo(\"Logging has resumed\");" - "@endtsexample\n\n") + "@tsexample\n" + "// Create the logger\n" + "// Will automatically start writing to testLogging.txt with normal priority\n" + "new ConsoleLogger(logger, \"testLogging.txt\", false);\n\n" + "// Send something to the console, with the logger consumes and writes to file\n" + "echo(\"This is logged to the file\");\n\n" + "// Stop logging, but do not delete the logger\n" + "logger.detach();\n\n" + "echo(\"This is not logged to the file\");\n\n" + "// Attach the logger to the console again\n" + "logger.attach();\n\n" + "// Logging has resumed\n" + "echo(\"Logging has resumed\");" + "@endtsexample\n\n") { ConsoleLogger *logger = static_cast( object ); return logger->detach(); diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 43ffda293..2d9ba2a1e 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -334,15 +334,15 @@ AbstractClassRep *AbstractClassRep::getCommonParent( const AbstractClassRep *oth static char replacebuf[1024]; static char* suppressSpaces(const char* in_pname) { - U32 i = 0; - char chr; - do - { - chr = in_pname[i]; - replacebuf[i++] = (chr != 32) ? chr : '_'; - } while(chr); + U32 i = 0; + char chr; + do + { + chr = in_pname[i]; + replacebuf[i++] = (chr != 32) ? chr : '_'; + } while(chr); - return replacebuf; + return replacebuf; } void ConsoleObject::addGroup(const char* in_pGroupname, const char* in_pGroupDocs) @@ -740,8 +740,8 @@ static const char* returnClassList( Vector< AbstractClassRep* >& classes, U32 bu //------------------------------------------------------------------------------ DefineEngineFunction( isClass, bool, ( const char* identifier ),, - "@brief Returns true if the passed identifier is the name of a declared class.\n\n" - "@ingroup Console") + "@brief Returns true if the passed identifier is the name of a declared class.\n\n" + "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( identifier ); return rep != NULL; @@ -765,10 +765,10 @@ DefineEngineFunction( isMemberOfClass, bool, ( const char* className, const char } DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* className ),, - "@brief Returns the description string for the named class.\n\n" - "@param className The name of the class.\n" - "@return The class description in string format.\n" - "@ingroup Console") + "@brief Returns the description string for the named class.\n\n" + "@param className The name of the class.\n" + "@return The class description in string format.\n" + "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( className ); if( rep ) @@ -779,9 +779,9 @@ DefineEngineFunction( getDescriptionOfClass, const char*, ( const char* classNam } DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className ),, - "@brief Returns the category of the given class.\n\n" - "@param className The name of the class.\n" - "@ingroup Console") + "@brief Returns the category of the given class.\n\n" + "@param className The name of the class.\n" + "@ingroup Console") { AbstractClassRep* rep = AbstractClassRep::findClassRep( className ); if( rep ) @@ -792,12 +792,12 @@ DefineEngineFunction( getCategoryOfClass, const char*, ( const char* className } DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* className ), ( "" ), - "@brief Returns a list of classes that derive from the named class.\n\n" + "@brief Returns a list of classes that derive from the named class.\n\n" "If the named class is omitted this dumps all the classes.\n" "@param className The optional base class name.\n" - "@return A tab delimited list of classes.\n" + "@return A tab delimited list of classes.\n" "@ingroup Editors\n" - "@internal") + "@internal") { AbstractClassRep *base = NULL; if(className && *className) @@ -822,11 +822,11 @@ DefineEngineFunction( enumerateConsoleClasses, const char*, ( const char* classN } DefineEngineFunction( enumerateConsoleClassesByCategory, const char*, ( String category ),, - "@brief Provide a list of classes that belong to the given category.\n\n" - "@param category The category name.\n" - "@return A tab delimited list of classes.\n" - "@ingroup Editors\n" - "@internal") + "@brief Provide a list of classes that belong to the given category.\n\n" + "@param category The category name.\n" + "@return A tab delimited list of classes.\n" + "@ingroup Editors\n" + "@internal") { U32 categoryLength = category.length(); @@ -914,10 +914,10 @@ DefineEngineFunction( dumpNetStats, void, (),, } DefineEngineFunction( sizeof, S32, ( const char *objectOrClass ),, - "@brief Determines the memory consumption of a class or object.\n\n" - "@param objectOrClass The object or class being measured.\n" - "@return Returns the total size of an object in bytes.\n" - "@ingroup Debugging\n") + "@brief Determines the memory consumption of a class or object.\n\n" + "@param objectOrClass The object or class being measured.\n" + "@return Returns the total size of an object in bytes.\n" + "@ingroup Debugging\n") { AbstractClassRep *acr = NULL; SimObject *obj = Sim::findObject(objectOrClass); diff --git a/Engine/source/console/consoleParser.cpp b/Engine/source/console/consoleParser.cpp index 2491ea738..e2dd339f5 100644 --- a/Engine/source/console/consoleParser.cpp +++ b/Engine/source/console/consoleParser.cpp @@ -35,21 +35,21 @@ static ConsoleParser *gDefaultParser = NULL; void freeConsoleParserList(void) { - while(gParserList) - { + while(gParserList) + { ConsoleParser * pParser = gParserList; - gParserList = pParser->next; - delete pParser; - } + gParserList = pParser->next; + delete pParser; + } - gDefaultParser = NULL; + gDefaultParser = NULL; } bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnParse p, fnRestart r, fnSetScanBuffer ssb, bool def) { - AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments"); + AssertFatal(ext && gcf && gcl && p && r, "AddConsoleParser called with one or more NULL arguments"); - ConsoleParser * pParser = new ConsoleParser; + ConsoleParser * pParser = new ConsoleParser; pParser->ext = ext; pParser->getCurrentFile = gcf; @@ -69,23 +69,23 @@ bool addConsoleParser(char *ext, fnGetCurrentFile gcf, fnGetCurrentLine gcl, fnP ConsoleParser * getParserForFile(const char *filename) { - if(filename == NULL) - return gDefaultParser; + if(filename == NULL) + return gDefaultParser; - char *ptr = dStrrchr((char *)filename, '.'); - if(ptr != NULL) - { - ptr++; + char *ptr = dStrrchr((char *)filename, '.'); + if(ptr != NULL) + { + ptr++; - ConsoleParser *p; - for(p = gParserList; p; p = p->next) - { - if(dStricmp(ptr, p->ext) == 0) - return p; - } - } + ConsoleParser *p; + for(p = gParserList; p; p = p->next) + { + if(dStricmp(ptr, p->ext) == 0) + return p; + } + } - return gDefaultParser; + return gDefaultParser; } } // end namespace Con diff --git a/Engine/source/console/consoleParser.h b/Engine/source/console/consoleParser.h index d033f75f4..ac1badaae 100644 --- a/Engine/source/console/consoleParser.h +++ b/Engine/source/console/consoleParser.h @@ -57,15 +57,15 @@ typedef void (*fnSetScanBuffer)(const char *sb, const char *fn); //----------------------------------------------------------------------------- struct ConsoleParser { - struct ConsoleParser *next; //!< Next object in list or NULL + struct ConsoleParser *next; //!< Next object in list or NULL - char *ext; //!< Filename extension handled by this parser - - fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function - fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function - fnParse parse; //!< Parse lexer function - fnRestart restart; //!< Restart lexer function - fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function + char *ext; //!< Filename extension handled by this parser + + fnGetCurrentFile getCurrentFile; //!< GetCurrentFile lexer function + fnGetCurrentLine getCurrentLine; //!< GetCurrentLine lexer function + fnParse parse; //!< Parse lexer function + fnRestart restart; //!< Restart lexer function + fnSetScanBuffer setScanBuffer; //!< SetScanBuffer lexer function }; // Macros @@ -74,18 +74,18 @@ struct ConsoleParser /// \brief Declare a parser's function prototypes //----------------------------------------------------------------------------- #define CON_DECLARE_PARSER(prefix) \ - const char * prefix##GetCurrentFile(); \ - S32 prefix##GetCurrentLine(); \ - void prefix##SetScanBuffer(const char *sb, const char *fn); \ - S32 prefix##parse(); \ - void prefix##restart(FILE *input_file) + const char * prefix##GetCurrentFile(); \ + S32 prefix##GetCurrentLine(); \ + void prefix##SetScanBuffer(const char *sb, const char *fn); \ + S32 prefix##parse(); \ + void prefix##restart(FILE *input_file) //----------------------------------------------------------------------------- /// \brief Helper macro to add console parsers //----------------------------------------------------------------------------- #define CON_ADD_PARSER(prefix, ext, def) \ - Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \ - prefix##restart, prefix##SetScanBuffer, def) + Compiler::addConsoleParser(ext, prefix##GetCurrentFile, prefix##GetCurrentLine, prefix##parse, \ + prefix##restart, prefix##SetScanBuffer, def) //----------------------------------------------------------------------------- /// \brief Free the console parser list diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index 06027cdfe..4f12fa85f 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -99,7 +99,7 @@ U32 postEvent(SimObject *destObject, SimEvent* event,U32 time) Mutex::lockMutex(gEventQueueMutex); - if( time == -1 ) + if( time == -1 ) // FIXME: a smart compiler will remove this check. - see http://garagegames.com/community/resources/view/19785 for a fix time = gCurrentTime; event->time = time; diff --git a/Engine/source/gfx/bitmap/gBitmap.cpp b/Engine/source/gfx/bitmap/gBitmap.cpp index 9e20d6951..019e92a57 100644 --- a/Engine/source/gfx/bitmap/gBitmap.cpp +++ b/Engine/source/gfx/bitmap/gBitmap.cpp @@ -611,31 +611,31 @@ bool GBitmap::checkForTransparency() //------------------------------------------------------------------------------ ColorF GBitmap::sampleTexel(F32 u, F32 v) const { - ColorF col(0.5f, 0.5f, 0.5f); - // normally sampling wraps all the way around at 1.0, - // but locking doesn't support this, and we seem to calc - // the uv based on a clamped 0 - 1... - Point2F max((F32)(getWidth()-1), (F32)(getHeight()-1)); - Point2F posf; - posf.x = mClampF(((u) * max.x), 0.0f, max.x); - posf.y = mClampF(((v) * max.y), 0.0f, max.y); - Point2I posi((S32)posf.x, (S32)posf.y); + ColorF col(0.5f, 0.5f, 0.5f); + // normally sampling wraps all the way around at 1.0, + // but locking doesn't support this, and we seem to calc + // the uv based on a clamped 0 - 1... + Point2F max((F32)(getWidth()-1), (F32)(getHeight()-1)); + Point2F posf; + posf.x = mClampF(((u) * max.x), 0.0f, max.x); + posf.y = mClampF(((v) * max.y), 0.0f, max.y); + Point2I posi((S32)posf.x, (S32)posf.y); - const U8 *buffer = getBits(); - U32 lexelindex = ((posi.y * getWidth()) + posi.x) * mBytesPerPixel; + const U8 *buffer = getBits(); + U32 lexelindex = ((posi.y * getWidth()) + posi.x) * mBytesPerPixel; - if(mBytesPerPixel == 2) - { - //U16 *buffer = (U16 *)lockrect->pBits; - } - else if(mBytesPerPixel > 2) - { - col.red = F32(buffer[lexelindex + 0]) / 255.0f; + if(mBytesPerPixel == 2) + { + //U16 *buffer = (U16 *)lockrect->pBits; + } + else if(mBytesPerPixel > 2) + { + col.red = F32(buffer[lexelindex + 0]) / 255.0f; col.green = F32(buffer[lexelindex + 1]) / 255.0f; - col.blue = F32(buffer[lexelindex + 2]) / 255.0f; - } + col.blue = F32(buffer[lexelindex + 2]) / 255.0f; + } - return col; + return col; } //-------------------------------------------------------------------------- diff --git a/Engine/source/module/moduleDefinition.cpp b/Engine/source/module/moduleDefinition.cpp index 093d90e59..523dffe02 100644 --- a/Engine/source/module/moduleDefinition.cpp +++ b/Engine/source/module/moduleDefinition.cpp @@ -51,7 +51,7 @@ mModuleId(StringTable->EmptyString()), mSynchronized( false ), mDeprecated( false ), mCriticalMerge( false ), - mOverrideExitingObjects(false), + mOverrideExistingObjects(false), mModuleDescription( StringTable->EmptyString() ), mAuthor(StringTable->EmptyString()), mModuleGroup(StringTable->EmptyString()), @@ -92,7 +92,7 @@ void ModuleDefinition::initPersistFields() addProtectedField( "Synchronized", TypeBool, Offset(mSynchronized, ModuleDefinition), &setSynchronized, &defaultProtectedGetFn, &writeSynchronized, "Whether the module should be synchronized or not. Optional: If not specified then the module is not synchronized." ); addProtectedField( "Deprecated", TypeBool, Offset(mDeprecated, ModuleDefinition), &setDeprecated, &defaultProtectedGetFn, &writeDeprecated, "Whether the module is deprecated or not. Optional: If not specified then the module is not deprecated." ); addProtectedField( "CriticalMerge", TypeBool, Offset(mCriticalMerge, ModuleDefinition), &setDeprecated, &defaultProtectedGetFn, &writeCriticalMerge, "Whether the merging of a module prior to a restart is critical or not. Optional: If not specified then the module is not merge critical." ); - addProtectedField( "OverrideExistingObjects", TypeBool, Offset(mOverrideExitingObjects, ModuleDefinition), &setOverrideExistingObjects, &defaultProtectedGetFn, &writeOverrideExistingObjects, "Controls if when this module is loaded and the create function is executed, it will replace existing objects that share names or not."); + addProtectedField( "OverrideExistingObjects", TypeBool, Offset(mOverrideExistingObjects, ModuleDefinition), &setOverrideExistingObjects, &defaultProtectedGetFn, &writeOverrideExistingObjects, "Controls if when this module is loaded and the create function is executed, it will replace existing objects that share names or not."); addProtectedField( "Description", TypeString, Offset(mModuleDescription, ModuleDefinition), &setModuleDescription, &defaultProtectedGetFn, &writeModuleDescription, "The description typically used for debugging purposes but can be used for anything." ); addProtectedField( "Author", TypeString, Offset(mAuthor, ModuleDefinition), &setAuthor, &defaultProtectedGetFn, &writeAuthor, "The author of the module." ); addProtectedField( "Group", TypeString, Offset(mModuleGroup, ModuleDefinition), &setModuleGroup, &defaultProtectedGetFn, "The module group used typically when loading modules as a group." ); diff --git a/Engine/source/module/moduleDefinition.h b/Engine/source/module/moduleDefinition.h index 30c089637..2ebb3f99a 100644 --- a/Engine/source/module/moduleDefinition.h +++ b/Engine/source/module/moduleDefinition.h @@ -89,7 +89,7 @@ private: bool mSynchronized; bool mDeprecated; bool mCriticalMerge; - bool mOverrideExitingObjects; + bool mOverrideExistingObjects; StringTableEntry mModuleDescription; StringTableEntry mAuthor;; StringTableEntry mModuleGroup; @@ -142,8 +142,8 @@ public: inline bool getDeprecated( void ) const { return mDeprecated; } inline void setCriticalMerge( const bool mergeCritical ) { if ( checkUnlocked() ) { mCriticalMerge = mergeCritical; } } inline bool getCriticalMerge( void ) const { return mCriticalMerge; } - inline void setOverrideExistingObjects(const bool overrideExistingObj) { if (checkUnlocked()) { mOverrideExitingObjects = overrideExistingObj; } } - inline bool getOverrideExistingObjects(void) const { return mOverrideExitingObjects; } + inline void setOverrideExistingObjects(const bool overrideExistingObj) { if (checkUnlocked()) { mOverrideExistingObjects = overrideExistingObj; } } + inline bool getOverrideExistingObjects(void) const { return mOverrideExistingObjects; } inline void setModuleDescription( const char* pModuleDescription ) { if ( checkUnlocked() ) { mModuleDescription = StringTable->insert(pModuleDescription); } } inline StringTableEntry getModuleDescription( void ) const { return mModuleDescription; } inline void setAuthor( const char* pAuthor ) { if ( checkUnlocked() ) { mAuthor = StringTable->insert(pAuthor); } } diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index 4d5b6ca18..f2464b9bc 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -492,10 +492,10 @@ template T ReservedSocketList::resolve(NetSocket socketToResolve) return entry.used ? entry.value : -1; } -static ConnectionNotifyEvent* smConnectionNotify = NULL; -static ConnectionAcceptedEvent* smConnectionAccept = NULL; -static ConnectionReceiveEvent* smConnectionReceive = NULL; -static PacketReceiveEvent* smPacketReceive = NULL; +ConnectionNotifyEvent* Net::smConnectionNotify = NULL; +ConnectionAcceptedEvent* Net::smConnectionAccept = NULL; +ConnectionReceiveEvent* Net::smConnectionReceive = NULL; +PacketReceiveEvent* Net::smPacketReceive = NULL; ConnectionNotifyEvent& Net::getConnectionNotifyEvent() { diff --git a/Engine/source/platform/platformNet.h b/Engine/source/platform/platformNet.h index 50a2c1d4c..c07c2d9f6 100644 --- a/Engine/source/platform/platformNet.h +++ b/Engine/source/platform/platformNet.h @@ -214,6 +214,12 @@ struct Net static bool smMulticastEnabled; static bool smIpv4Enabled; static bool smIpv6Enabled; + + static ConnectionNotifyEvent* smConnectionNotify; + static ConnectionAcceptedEvent* smConnectionAccept; + static ConnectionReceiveEvent* smConnectionReceive; + static PacketReceiveEvent* smPacketReceive; + static bool init(); static void shutdown(); diff --git a/Engine/source/platform/profiler.cpp b/Engine/source/platform/profiler.cpp index 1083b6d08..444679284 100644 --- a/Engine/source/platform/profiler.cpp +++ b/Engine/source/platform/profiler.cpp @@ -54,9 +54,9 @@ Profiler *gProfiler = NULL; Vector gProfilerNodeStack; #define TORQUE_PROFILE_AT_ENGINE_START true #define PROFILER_DEBUG_PUSH_NODE( nodename ) \ -gProfilerNodeStack.push_back( nodename ); + gProfilerNodeStack.push_back( nodename ); #define PROFILER_DEBUG_POP_NODE() \ -gProfilerNodeStack.pop_back(); + gProfilerNodeStack.pop_back(); #else #define TORQUE_PROFILE_AT_ENGINE_START false #define PROFILER_DEBUG_PUSH_NODE( nodename ) ; @@ -68,7 +68,7 @@ gProfilerNodeStack.pop_back(); void startHighResolutionTimer(U32 time[2]) { //time[0] = Platform::getRealMilliseconds(); - + __asm { push eax @@ -89,7 +89,7 @@ U32 endHighResolutionTimer(U32 time[2]) U32 ticks; //ticks = Platform::getRealMilliseconds() - time[0]; //return ticks; - + __asm { push eax @@ -176,7 +176,7 @@ Profiler::Profiler() { mMaxStackDepth = MaxStackDepth; mCurrentHash = 0; - + mCurrentProfilerData = (ProfilerData *) malloc(sizeof(ProfilerData)); mCurrentProfilerData->mRoot = NULL; mCurrentProfilerData->mNextForRoot = NULL; @@ -195,12 +195,12 @@ Profiler::Profiler() mCurrentProfilerData->mPath = ""; #endif mRootProfilerData = mCurrentProfilerData; - + for(U32 i = 0; i < ProfilerData::HashTableSize; i++) mCurrentProfilerData->mChildHash[i] = 0; - + mProfileList = NULL; - + mEnabled = TORQUE_PROFILE_AT_ENGINE_START; mNextEnable = TORQUE_PROFILE_AT_ENGINE_START; mStackDepth = 0; @@ -222,20 +222,20 @@ void Profiler::reset() mEnabled = false; // in case we're in a profiler call. ProfilerData * head = mProfileList; ProfilerData * curr = head; - + while ( curr ) { head = curr->mNextProfilerData; free( curr ); - + if ( head ) curr = head; else curr = NULL; } - + mProfileList = NULL; - + for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot) { walk->mFirstProfilerData = 0; @@ -262,7 +262,7 @@ ProfilerRootData::ProfilerRootData(const char *name) for(ProfilerRootData *walk = sRootList; walk; walk = walk->mNextRoot) if(!dStrcmp(walk->mName, name)) AssertFatal( false, avar( "Duplicate profile name: %s", name ) ); - + mName = name; mNameHash = _StringTable::hashString(name); mNextRoot = sRootList; @@ -306,7 +306,7 @@ const char * Profiler::getProfilePath() if( !ThreadManager::isMainThread() ) return "[non-main thread]"; #endif - + return (mEnabled && mCurrentProfilerData) ? mCurrentProfilerData->mPath : "na"; } #endif @@ -318,14 +318,14 @@ const char * Profiler::constructProfilePath(ProfilerData * pd) { const bool saveEnable = gProfiler->mEnabled; gProfiler->mEnabled = false; - + const char * connector = " -> "; U32 len = dStrlen(pd->mParent->mPath); if (!len) connector = ""; len += dStrlen(connector); len += dStrlen(pd->mRoot->mName); - + U32 mark = FrameAllocator::getWaterMark(); char * buf = (char*)FrameAllocator::alloc(len+1); dStrcpy(buf,pd->mParent->mPath); @@ -348,25 +348,25 @@ void Profiler::hashPush(ProfilerRootData *root) if( !ThreadManager::isMainThread() ) return; #endif - + mStackDepth++; PROFILER_DEBUG_PUSH_NODE(root->mName); AssertFatal(mStackDepth <= mMaxStackDepth, "Stack overflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs"); if(!mEnabled) return; - + ProfilerData *nextProfiler = NULL; if(!root->mEnabled || mCurrentProfilerData->mRoot == root) { mCurrentProfilerData->mSubDepth++; return; } - + if(mCurrentProfilerData->mLastSeenProfiler && mCurrentProfilerData->mLastSeenProfiler->mRoot == root) nextProfiler = mCurrentProfilerData->mLastSeenProfiler; - + if(!nextProfiler) { // first see if it's in the hash table... @@ -383,17 +383,17 @@ void Profiler::hashPush(ProfilerRootData *root) nextProfiler = (ProfilerData *) malloc(sizeof(ProfilerData)); for(U32 i = 0; i < ProfilerData::HashTableSize; i++) nextProfiler->mChildHash[i] = 0; - + nextProfiler->mRoot = root; nextProfiler->mNextForRoot = root->mFirstProfilerData; root->mFirstProfilerData = nextProfiler; - + nextProfiler->mNextProfilerData = mProfileList; mProfileList = nextProfiler; - + nextProfiler->mNextHash = mCurrentProfilerData->mChildHash[index]; mCurrentProfilerData->mChildHash[index] = nextProfiler; - + nextProfiler->mParent = mCurrentProfilerData; nextProfiler->mNextSibling = mCurrentProfilerData->mFirstChild; mCurrentProfilerData->mFirstChild = nextProfiler; @@ -443,7 +443,7 @@ void Profiler::hashPop(ProfilerRootData *expected) if( !ThreadManager::isMainThread() ) return; #endif - + mStackDepth--; PROFILER_DEBUG_POP_NODE(); AssertFatal(mStackDepth >= 0, "Stack underflow in profiler. You may have mismatched PROFILE_START and PROFILE_ENDs"); @@ -459,15 +459,15 @@ void Profiler::hashPop(ProfilerRootData *expected) { AssertISV(expected == mCurrentProfilerData->mRoot, "Profiler::hashPop - didn't get expected ProfilerRoot!"); } - + F64 fElapsed = endHighResolutionTimer(mCurrentProfilerData->mStartTime); - + mCurrentProfilerData->mTotalTime += fElapsed; mCurrentProfilerData->mParent->mSubTime += fElapsed; // mark it in the parent as well... mCurrentProfilerData->mRoot->mTotalTime += fElapsed; if(mCurrentProfilerData->mParent->mRoot) mCurrentProfilerData->mParent->mRoot->mSubTime += fElapsed; // mark it in the parent as well... - + mCurrentProfilerData = mCurrentProfilerData->mParent; } if(mStackDepth == 0) @@ -480,13 +480,13 @@ void Profiler::hashPop(ProfilerRootData *expected) } if(!mEnabled && mNextEnable) startHighResolutionTimer(mCurrentProfilerData->mStartTime); - + #if defined(TORQUE_OS_WIN) // The high performance counters under win32 are unreliable when running on multiple // processors. When the profiler is enabled, we restrict Torque to a single processor. if(mNextEnable != mEnabled) { - + if(mNextEnable) { Con::warnf("Warning: forcing the Torque profiler thread to run only on cpu 1."); @@ -502,7 +502,7 @@ void Profiler::hashPop(ProfilerRootData *expected) } } #endif - + mEnabled = mNextEnable; } } @@ -520,15 +520,15 @@ static void profilerDataDumpRecurse(ProfilerData *data, char *buffer, U32 buffer { // dump out this one: Con::printf("%7.3f %7.3f %8d %s%s", - 100 * data->mTotalTime / totalTime, - 100 * (data->mTotalTime - data->mSubTime) / totalTime, - data->mInvokeCount, - buffer, - data->mRoot ? data->mRoot->mName : "ROOT" ); + 100 * data->mTotalTime / totalTime, + 100 * (data->mTotalTime - data->mSubTime) / totalTime, + data->mInvokeCount, + buffer, + data->mRoot ? data->mRoot->mName : "ROOT" ); data->mTotalTime = 0; data->mSubTime = 0; data->mInvokeCount = 0; - + buffer[bufferLen] = ' '; buffer[bufferLen+1] = ' '; buffer[bufferLen+2] = 0; @@ -558,16 +558,16 @@ static void profilerDataDumpRecurseFile(ProfilerData *data, char *buffer, U32 bu { char pbuffer[256]; dSprintf(pbuffer, 255, "%7.3f %7.3f %8d %s%s\n", - 100 * data->mTotalTime / totalTime, - 100 * (data->mTotalTime - data->mSubTime) / totalTime, - data->mInvokeCount, - buffer, - data->mRoot ? data->mRoot->mName : "ROOT" ); + 100 * data->mTotalTime / totalTime, + 100 * (data->mTotalTime - data->mSubTime) / totalTime, + data->mInvokeCount, + buffer, + data->mRoot ? data->mRoot->mName : "ROOT" ); fws.write(dStrlen(pbuffer), pbuffer); data->mTotalTime = 0; data->mSubTime = 0; data->mInvokeCount = 0; - + buffer[bufferLen] = ' '; buffer[bufferLen+1] = ' '; buffer[bufferLen+2] = 0; @@ -599,7 +599,7 @@ void Profiler::dump() mEnabled = false; mStackDepth++; // may have some profiled calls... gotta turn em off. - + Vector rootVector; F64 totalTime = 0; for(ProfilerRootData *walk = ProfilerRootData::sRootList; walk; walk = walk->mNextRoot) @@ -608,8 +608,8 @@ void Profiler::dump() rootVector.push_back(walk); } dQsort((void *) &rootVector[0], rootVector.size(), sizeof(ProfilerRootData *), rootDataCompare); - - + + if (mDumpToConsole == true) { Con::printf("Profiler Data Dump:"); @@ -618,10 +618,10 @@ void Profiler::dump() for(U32 i = 0; i < rootVector.size(); i++) { Con::printf("%7.3f %7.3f %8d %s", - 100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime, - 100 * rootVector[i]->mTotalTime / totalTime, - rootVector[i]->mTotalInvokeCount, - rootVector[i]->mName); + 100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime, + 100 * rootVector[i]->mTotalTime / totalTime, + rootVector[i]->mTotalInvokeCount, + rootVector[i]->mName); rootVector[i]->mTotalInvokeCount = 0; rootVector[i]->mTotalTime = 0; rootVector[i]->mSubTime = 0; @@ -629,9 +629,9 @@ void Profiler::dump() Con::printf(""); Con::printf("Ordered by stack trace total time -"); Con::printf("%% Time %% NSTime Invoke # Name"); - + mCurrentProfilerData->mTotalTime = endHighResolutionTimer(mCurrentProfilerData->mStartTime); - + char depthBuffer[MaxStackDepth * 2 + 1]; depthBuffer[0] = 0; profilerDataDumpRecurse(mCurrentProfilerData, depthBuffer, 0, totalTime); @@ -643,44 +643,44 @@ void Profiler::dump() FileStream fws; bool success = fws.open(mDumpFileName, Torque::FS::File::Write); AssertFatal(success, "Cannot write profile dump to specified file!"); - char buffer[1024]; - - dStrcpy(buffer, "Profiler Data Dump:\n"); - fws.write(dStrlen(buffer), buffer); - dStrcpy(buffer, "Ordered by non-sub total time -\n"); - fws.write(dStrlen(buffer), buffer); - dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n"); - fws.write(dStrlen(buffer), buffer); - - for(U32 i = 0; i < rootVector.size(); i++) - { - dSprintf(buffer, 1023, "%7.3f %7.3f %8d %s\n", - 100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime, - 100 * rootVector[i]->mTotalTime / totalTime, - rootVector[i]->mTotalInvokeCount, - rootVector[i]->mName); + char buffer[1024]; + + dStrcpy(buffer, "Profiler Data Dump:\n"); fws.write(dStrlen(buffer), buffer); - - rootVector[i]->mTotalInvokeCount = 0; - rootVector[i]->mTotalTime = 0; - rootVector[i]->mSubTime = 0; - } - dStrcpy(buffer, "\nOrdered by non-sub total time -\n"); - fws.write(dStrlen(buffer), buffer); - dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n"); - fws.write(dStrlen(buffer), buffer); - + dStrcpy(buffer, "Ordered by non-sub total time -\n"); + fws.write(dStrlen(buffer), buffer); + dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n"); + fws.write(dStrlen(buffer), buffer); + + for(U32 i = 0; i < rootVector.size(); i++) + { + dSprintf(buffer, 1023, "%7.3f %7.3f %8d %s\n", + 100 * (rootVector[i]->mTotalTime - rootVector[i]->mSubTime) / totalTime, + 100 * rootVector[i]->mTotalTime / totalTime, + rootVector[i]->mTotalInvokeCount, + rootVector[i]->mName); + fws.write(dStrlen(buffer), buffer); + + rootVector[i]->mTotalInvokeCount = 0; + rootVector[i]->mTotalTime = 0; + rootVector[i]->mSubTime = 0; + } + dStrcpy(buffer, "\nOrdered by non-sub total time -\n"); + fws.write(dStrlen(buffer), buffer); + dStrcpy(buffer, "%%NSTime %% Time Invoke # Name\n"); + fws.write(dStrlen(buffer), buffer); + mCurrentProfilerData->mTotalTime = endHighResolutionTimer(mCurrentProfilerData->mStartTime); - + char depthBuffer[MaxStackDepth * 2 + 1]; depthBuffer[0] = 0; profilerDataDumpRecurseFile(mCurrentProfilerData, depthBuffer, 0, totalTime, fws); mEnabled = enableSave; mStackDepth--; - + fws.close(); } - + mDumpToConsole = false; mDumpToFile = false; mDumpFileName[0] = '\0'; @@ -716,12 +716,12 @@ void Profiler::enableMarker(const char *marker, bool enable) //----------------------------------------------------------------------------- DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool enable ), ( true ), - "@brief Enable or disable a specific profile.\n\n" - "@param enable Optional paramater to enable or disable the profile.\n" - "@param markerName Name of a specific marker to enable or disable.\n" - "@note Calling this function will first call profilerReset(), clearing all data from profiler. " - "All profile markers are enabled by default.\n\n" - "@ingroup Debugging") + "@brief Enable or disable a specific profile.\n\n" + "@param enable Optional paramater to enable or disable the profile.\n" + "@param markerName Name of a specific marker to enable or disable.\n" + "@note Calling this function will first call profilerReset(), clearing all data from profiler. " + "All profile markers are enabled by default.\n\n" + "@ingroup Debugging") { if( gProfiler ) gProfiler->enableMarker( markerName, enable ); @@ -730,47 +730,47 @@ DefineEngineFunction( profilerMarkerEnable, void, ( const char* markerName, bool //----------------------------------------------------------------------------- DefineEngineFunction( profilerEnable, void, ( bool enable ),, - "@brief Enables or disables the profiler.\n\n" - "Data is only gathered while the profiler is enabled.\n\n" - "@note Profiler is not available in shipping builds.\n" - "T3D has predefined profiling areas surrounded by markers, " - "but you may need to define additional markers (in C++) around areas you wish to profile," - " by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n" - "@ingroup Debugging\n" ) + "@brief Enables or disables the profiler.\n\n" + "Data is only gathered while the profiler is enabled.\n\n" + "@note Profiler is not available in shipping builds.\n" + "T3D has predefined profiling areas surrounded by markers, " + "but you may need to define additional markers (in C++) around areas you wish to profile," + " by using the PROFILE_START( markerName ); and PROFILE_END(); macros.\n\n" + "@ingroup Debugging\n" ) { if(gProfiler) gProfiler->enable(enable); } DefineEngineFunction(profilerDump, void, (),, - "@brief Dumps current profiling stats to the console window.\n\n" - "@note Markers disabled with profilerMarkerEnable() will be skipped over. " - "If the profiler is currently running, it will be disabled.\n" - "@ingroup Debugging") + "@brief Dumps current profiling stats to the console window.\n\n" + "@note Markers disabled with profilerMarkerEnable() will be skipped over. " + "If the profiler is currently running, it will be disabled.\n" + "@ingroup Debugging") { if(gProfiler) gProfiler->dumpToConsole(); } DefineEngineFunction( profilerDumpToFile, void, ( const char* fileName ),, - "@brief Dumps current profiling stats to a file.\n\n" - "@note If the profiler is currently running, it will be disabled.\n" - "@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). " - "Will attempt to create the file if it does not already exist.\n" - "@tsexample\n" - "profilerDumpToFile( \"C:/Torque/log1.txt\" );\n" - "@endtsexample\n\n" - "@ingroup Debugging" ) + "@brief Dumps current profiling stats to a file.\n\n" + "@note If the profiler is currently running, it will be disabled.\n" + "@param fileName Name and path of file to save profiling stats to. Must use forward slashes (/). " + "Will attempt to create the file if it does not already exist.\n" + "@tsexample\n" + "profilerDumpToFile( \"C:/Torque/log1.txt\" );\n" + "@endtsexample\n\n" + "@ingroup Debugging" ) { if(gProfiler) gProfiler->dumpToFile(fileName); } DefineEngineFunction( profilerReset, void, (),, - "@brief Resets the profiler, clearing it of all its data.\n\n" - "If the profiler is currently running, it will first be disabled. " - "All markers will retain their current enabled/disabled status.\n\n" - "@ingroup Debugging" ) + "@brief Resets the profiler, clearing it of all its data.\n\n" + "If the profiler is currently running, it will first be disabled. " + "All markers will retain their current enabled/disabled status.\n\n" + "@ingroup Debugging" ) { if(gProfiler) gProfiler->reset(); diff --git a/Engine/source/platform/test/netTest.cpp b/Engine/source/platform/test/netTest.cpp index 889d150f2..741e89ce0 100644 --- a/Engine/source/platform/test/netTest.cpp +++ b/Engine/source/platform/test/netTest.cpp @@ -76,8 +76,8 @@ TEST(Net, TCPRequest) handler.mDataReceived = 0; // Hook into the signals. - Net::smConnectionNotify .notify(&handler, &TcpHandle::notify); - Net::smConnectionReceive.notify(&handler, &TcpHandle::receive); + Net::smConnectionNotify ->notify(&handler, &TcpHandle::notify); + Net::smConnectionReceive->notify(&handler, &TcpHandle::receive); // Open a TCP connection to garagegames.com handler.mSocket = Net::openConnectTo("72.246.107.193:80"); @@ -85,8 +85,8 @@ TEST(Net, TCPRequest) while(Process::processEvents() && (Platform::getRealMilliseconds() < limit) ) {} // Unhook from the signals. - Net::smConnectionNotify .remove(&handler, &TcpHandle::notify); - Net::smConnectionReceive.remove(&handler, &TcpHandle::receive); + Net::smConnectionNotify ->remove(&handler, &TcpHandle::notify); + Net::smConnectionReceive->remove(&handler, &TcpHandle::receive); EXPECT_GT(handler.mDataReceived, 0) << "Didn't get any data back!"; @@ -139,8 +139,8 @@ struct JournalHandle mDataReceived = 0; // Hook into the signals. - Net::smConnectionNotify .notify(this, &JournalHandle::notify); - Net::smConnectionReceive.notify(this, &JournalHandle::receive); + Net::smConnectionNotify ->notify(this, &JournalHandle::notify); + Net::smConnectionReceive->notify(this, &JournalHandle::receive); // Open a TCP connection to garagegames.com mSocket = Net::openConnectTo("72.246.107.193:80"); @@ -149,8 +149,8 @@ struct JournalHandle while(Process::processEvents()) {} // Unhook from the signals. - Net::smConnectionNotify .remove(this, &JournalHandle::notify); - Net::smConnectionReceive.remove(this, &JournalHandle::receive); + Net::smConnectionNotify ->remove(this, &JournalHandle::notify); + Net::smConnectionReceive->remove(this, &JournalHandle::receive); EXPECT_GT(mDataReceived, 0) << "Didn't get any data back!"; diff --git a/Engine/source/windowManager/sdl/sdlSplashScreen.cpp b/Engine/source/windowManager/sdl/sdlSplashScreen.cpp index 08d095d5c..ffa09df8a 100644 --- a/Engine/source/windowManager/sdl/sdlSplashScreen.cpp +++ b/Engine/source/windowManager/sdl/sdlSplashScreen.cpp @@ -98,7 +98,7 @@ bool Platform::displaySplashWindow( String path ) SDL_RenderPresent(gSplashRenderer); } - return true; + return true; } bool Platform::closeSplashWindow() diff --git a/Engine/source/windowManager/sdl/sdlWindow.cpp b/Engine/source/windowManager/sdl/sdlWindow.cpp index 3c819248b..a48e3743d 100644 --- a/Engine/source/windowManager/sdl/sdlWindow.cpp +++ b/Engine/source/windowManager/sdl/sdlWindow.cpp @@ -104,37 +104,37 @@ mShouldLockMouse(false), mSuppressReset(false), mMenuHandle(NULL) { - mCursorController = new PlatformCursorControllerSDL( this ); + mCursorController = new PlatformCursorControllerSDL( this ); - mVideoMode.bitDepth = 32; - mVideoMode.fullScreen = false; - mVideoMode.refreshRate = 60; - mVideoMode.resolution.set(800,600); + mVideoMode.bitDepth = 32; + mVideoMode.fullScreen = false; + mVideoMode.refreshRate = 60; + mVideoMode.resolution.set(800,600); } PlatformWindowSDL::~PlatformWindowSDL() { - // delete our sdl handle.. - SDL_DestroyWindow(mWindowHandle); + // delete our sdl handle.. + SDL_DestroyWindow(mWindowHandle); - // unlink ourselves from the window list... - AssertFatal(mOwningManager, "PlatformWindowSDL::~PlatformWindowSDL - orphan window, cannot unlink!"); - mOwningManager->unlinkWindow(this); + // unlink ourselves from the window list... + AssertFatal(mOwningManager, "PlatformWindowSDL::~PlatformWindowSDL - orphan window, cannot unlink!"); + mOwningManager->unlinkWindow(this); } GFXDevice * PlatformWindowSDL::getGFXDevice() { - return mDevice; + return mDevice; } GFXWindowTarget * PlatformWindowSDL::getGFXTarget() { - return mTarget; + return mTarget; } const GFXVideoMode & PlatformWindowSDL::getVideoMode() { - return mVideoMode; + return mVideoMode; } void* PlatformWindowSDL::getSystemWindow(const WindowSystem system) @@ -162,41 +162,41 @@ void PlatformWindowSDL::setVideoMode( const GFXVideoMode &mode ) mVideoMode = mode; mSuppressReset = true; - // Set our window to have the right style based on the mode + // Set our window to have the right style based on the mode if(mode.fullScreen && !Platform::getWebDeployment() && !mOffscreenRender) - { + { setSize(mode.resolution); SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN); // When switching to Fullscreen, reset device after setting style - if(mTarget.isValid()) - mTarget->resetMode(); - } - else - { + if(mTarget.isValid()) + mTarget->resetMode(); + } + else + { // Reset device *first*, so that when we call setSize() and let it - // access the monitor settings, it won't end up with our fullscreen - // geometry that is just about to change. + // access the monitor settings, it won't end up with our fullscreen + // geometry that is just about to change. - if(mTarget.isValid()) - mTarget->resetMode(); + if(mTarget.isValid()) + mTarget->resetMode(); if (!mOffscreenRender) { - SDL_SetWindowFullscreen( mWindowHandle, 0); + SDL_SetWindowFullscreen( mWindowHandle, 0); } setSize(mode.resolution); centerWindow(); - } + } - mSuppressReset = false; + mSuppressReset = false; } bool PlatformWindowSDL::clearFullscreen() { - return true; + return true; } bool PlatformWindowSDL::isFullscreen() @@ -210,32 +210,32 @@ bool PlatformWindowSDL::isFullscreen() void PlatformWindowSDL::_setFullscreen(const bool fullscreen) { - if( isFullscreen() ) - return; + if( isFullscreen() ) + return; - if(fullscreen && !mOffscreenRender) - { - Con::printf("PlatformWindowSDL::setFullscreen (full) enter"); - SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN); - } - else - { - Con::printf("PlatformWindowSDL::setFullscreen (windowed) enter"); + if(fullscreen && !mOffscreenRender) + { + Con::printf("PlatformWindowSDL::setFullscreen (full) enter"); + SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN); + } + else + { + Con::printf("PlatformWindowSDL::setFullscreen (windowed) enter"); if (!mOffscreenRender) { - SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN_DESKTOP); + SDL_SetWindowFullscreen( mWindowHandle, SDL_WINDOW_FULLSCREEN_DESKTOP); } setSize(mVideoMode.resolution); - } - Con::printf("PlatformWindowSDL::setFullscreen exit"); + } + Con::printf("PlatformWindowSDL::setFullscreen exit"); } bool PlatformWindowSDL::setCaption( const char *cap ) { SDL_SetWindowTitle(mWindowHandle, cap); - return true; + return true; } const char * PlatformWindowSDL::getCaption() @@ -250,45 +250,45 @@ void PlatformWindowSDL::setFocus() void PlatformWindowSDL::setClientExtent( const Point2I newExtent ) { - Point2I oldExtent = getClientExtent(); - if (oldExtent == newExtent) - return; + Point2I oldExtent = getClientExtent(); + if (oldExtent == newExtent) + return; SDL_SetWindowSize(mWindowHandle, newExtent.x, newExtent.y); } const Point2I PlatformWindowSDL::getClientExtent() { - // Fetch Client Rect from Windows + // Fetch Client Rect from Windows Point2I size; - SDL_GetWindowSize(mWindowHandle, &size.x, &size.y); + SDL_GetWindowSize(mWindowHandle, &size.x, &size.y); - return size; + return size; } void PlatformWindowSDL::setBounds( const RectI &newBounds ) { - // TODO SDL + // TODO SDL } const RectI PlatformWindowSDL::getBounds() const { - // TODO SDL - return RectI(0, 0, 0, 0); + // TODO SDL + return RectI(0, 0, 0, 0); } void PlatformWindowSDL::setPosition( const Point2I newPosition ) { - SDL_SetWindowPosition( mWindowHandle, newPosition.x, newPosition.y ); + SDL_SetWindowPosition( mWindowHandle, newPosition.x, newPosition.y ); } const Point2I PlatformWindowSDL::getPosition() { - Point2I position; - SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y ); + Point2I position; + SDL_GetWindowPosition( mWindowHandle, &position.x, &position.y ); - // Return position - return position; + // Return position + return position; } Point2I PlatformWindowSDL::clientToScreen( const Point2I& pos ) @@ -311,7 +311,7 @@ void PlatformWindowSDL::centerWindow() SDL_GetWindowSize(mWindowHandle, &sizeX, &sizeY); SDL_DisplayMode mode; - SDL_GetDesktopDisplayMode(0, &mode); + SDL_GetDesktopDisplayMode(0, &mode); U32 posX = (mode.w/2) - (sizeX/2); U32 posY = (mode.h/2) - (sizeY/2); @@ -325,21 +325,21 @@ bool PlatformWindowSDL::setSize( const Point2I &newSize ) // Let GFX get an update about the new resolution if (mTarget.isValid()) - mTarget->resetMode(); + mTarget->resetMode(); - return true; + return true; } bool PlatformWindowSDL::isOpen() { - return mWindowHandle; + return mWindowHandle; } bool PlatformWindowSDL::isVisible() { - // Is the window open and visible, ie. not minimized? - if(!mWindowHandle) - return false; + // Is the window open and visible, ie. not minimized? + if(!mWindowHandle) + return false; if (mOffscreenRender) return true; @@ -348,7 +348,7 @@ bool PlatformWindowSDL::isVisible() if( flags & SDL_WINDOW_SHOWN) return true; - return false; + return false; } bool PlatformWindowSDL::isFocused() @@ -389,7 +389,7 @@ bool PlatformWindowSDL::isMaximized() WindowId PlatformWindowSDL::getWindowId() { - return mWindowId; + return mWindowId; } void PlatformWindowSDL::minimize() @@ -397,7 +397,7 @@ void PlatformWindowSDL::minimize() if (mOffscreenRender) return; - SDL_MinimizeWindow( mWindowHandle ); + SDL_MinimizeWindow( mWindowHandle ); } void PlatformWindowSDL::maximize() @@ -405,7 +405,7 @@ void PlatformWindowSDL::maximize() if (mOffscreenRender) return; - SDL_MaximizeWindow( mWindowHandle ); + SDL_MaximizeWindow( mWindowHandle ); } void PlatformWindowSDL::restore() @@ -413,7 +413,7 @@ void PlatformWindowSDL::restore() if (mOffscreenRender) return; - SDL_RestoreWindow( mWindowHandle ); + SDL_RestoreWindow( mWindowHandle ); } void PlatformWindowSDL::hide() @@ -421,7 +421,7 @@ void PlatformWindowSDL::hide() if (mOffscreenRender) return; - SDL_HideWindow( mWindowHandle ); + SDL_HideWindow( mWindowHandle ); } void PlatformWindowSDL::show() @@ -429,17 +429,17 @@ void PlatformWindowSDL::show() if (mOffscreenRender) return; - SDL_ShowWindow( mWindowHandle ); + SDL_ShowWindow( mWindowHandle ); } void PlatformWindowSDL::close() { - delete this; + delete this; } void PlatformWindowSDL::defaultRender() { - // TODO SDL + // TODO SDL } void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt) @@ -615,7 +615,7 @@ void PlatformWindowSDL::setMouseLocked( bool enable ) if (mOffscreenRender) return; - mMouseLocked = enable; + mMouseLocked = enable; SDL_SetWindowGrab( mWindowHandle, SDL_bool(enable) ); SDL_SetRelativeMouseMode( SDL_bool(enable) );