Merge remote-tracking branch 'GarageGames/development' into physx3_basic

This commit is contained in:
rextimmy 2014-06-06 22:40:14 +10:00
commit d58a69e76c
527 changed files with 9928 additions and 5548 deletions

10
.gitignore vendored
View file

@ -40,6 +40,11 @@ local.properties
*.suo *.suo
*.user *.user
*.sln.docstates *.sln.docstates
*.sln
*.vcxproj
*.vcxproj.filters
*.vcproj
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
@ -62,6 +67,11 @@ local.properties
*.vspscc *.vspscc
.builds .builds
*.dotCover *.dotCover
*.dll
*.lib
*.exp
*.exe
## TODO: If you have NuGet Package Restore enabled, uncomment this ## TODO: If you have NuGet Package Restore enabled, uncomment this
#packages/ #packages/

11
CMakeLists.txt Normal file
View file

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.8.3)
set(TORQUE_APP_NAME "" CACHE STRING "the app name")
if("${TORQUE_APP_NAME}" STREQUAL "")
message(FATAL_ERROR "Please set TORQUE_APP_NAME first")
endif()
project(${TORQUE_APP_NAME})
add_subdirectory(Tools/CMake)

View file

@ -21,6 +21,7 @@
#include <assert.h> #include <assert.h>
#include <wchar.h> #include <wchar.h>
#include <string.h> #include <string.h>
#include <algorithm>
#include <dae/daeError.h> #include <dae/daeError.h>

View file

@ -63,7 +63,7 @@ AIClient::AIClient() {
mMoveTolerance = 0.25f; mMoveTolerance = 0.25f;
// Clear the triggers // Clear the triggers
for( int i = 0; i < MaxTriggerKeys; i++ ) for( S32 i = 0; i < MaxTriggerKeys; i++ )
mTriggers[i] = false; mTriggers[i] = false;
mAimToDestination = true; mAimToDestination = true;
@ -369,7 +369,7 @@ U32 AIClient::getMoveList( Move **movePtr,U32 *numMoves ) {
} }
// Copy over the trigger status // Copy over the trigger status
for( int i = 0; i < MaxTriggerKeys; i++ ) { for( S32 i = 0; i < MaxTriggerKeys; i++ ) {
mMove.trigger[i] = mTriggers[i]; mMove.trigger[i] = mTriggers[i];
mTriggers[i] = false; mTriggers[i] = false;
} }

View file

@ -443,7 +443,7 @@ bool AIPlayer::getAIMove(Move *movePtr)
// Replicate the trigger state into the move so that // Replicate the trigger state into the move so that
// triggers can be controlled from scripts. // triggers can be controlled from scripts.
for( int i = 0; i < MaxTriggerKeys; i++ ) for( S32 i = 0; i < MaxTriggerKeys; i++ )
movePtr->trigger[i] = getImageTriggerState(i); movePtr->trigger[i] = getImageTriggerState(i);
mLastLocation = location; mLastLocation = location;

View file

@ -1546,7 +1546,7 @@ void Camera::_validateEyePoint(F32 pos, MatrixF *mat)
float dot = mDot(dir, collision.normal); float dot = mDot(dir, collision.normal);
if (dot > 0.01f) if (dot > 0.01f)
{ {
float colDist = mDot(startPos - collision.point, dir) - (1 / dot) * CameraRadius; F32 colDist = mDot(startPos - collision.point, dir) - (1 / dot) * CameraRadius;
if (colDist > pos) if (colDist > pos)
colDist = pos; colDist = pos;
if (colDist < 0.0f) if (colDist < 0.0f)

View file

@ -194,7 +194,7 @@ void CameraSpline::renderTimeMap()
if(!ptr) return; if(!ptr) return;
MRandomLCG random(1376312589 * (U32)this); MRandomLCG random(1376312589 * (U32)this);
int index = 0; S32 index = 0;
for(Vector<TimeMap>::iterator itr=mTimeMap.begin(); itr != mTimeMap.end(); itr++) for(Vector<TimeMap>::iterator itr=mTimeMap.begin(); itr != mTimeMap.end(); itr++)
{ {
Knot a; Knot a;

View file

@ -41,7 +41,7 @@
#include "lighting/lightQuery.h" #include "lighting/lightQuery.h"
const U32 csmStaticCollisionMask = TerrainObjectType; const U32 csmStaticCollisionMask = TerrainObjectType | StaticShapeObjectType | StaticObjectType;
const U32 csmDynamicCollisionMask = StaticShapeObjectType; const U32 csmDynamicCollisionMask = StaticShapeObjectType;
@ -122,7 +122,7 @@ bool DebrisData::onAdd()
if(!Parent::onAdd()) if(!Parent::onAdd())
return false; return false;
for( int i=0; i<DDC_NUM_EMITTERS; i++ ) for( S32 i=0; i<DDC_NUM_EMITTERS; i++ )
{ {
if( !emitterList[i] && emitterIDList[i] != 0 ) if( !emitterList[i] && emitterIDList[i] != 0 )
{ {
@ -303,7 +303,7 @@ void DebrisData::packData(BitStream* stream)
stream->writeString( textureName ); stream->writeString( textureName );
stream->writeString( shapeName ); stream->writeString( shapeName );
for( int i=0; i<DDC_NUM_EMITTERS; i++ ) for( S32 i=0; i<DDC_NUM_EMITTERS; i++ )
{ {
if( stream->writeFlag( emitterList[i] != NULL ) ) if( stream->writeFlag( emitterList[i] != NULL ) )
{ {
@ -346,7 +346,7 @@ void DebrisData::unpackData(BitStream* stream)
textureName = stream->readSTString(); textureName = stream->readSTString();
shapeName = stream->readSTString(); shapeName = stream->readSTString();
for( int i=0; i<DDC_NUM_EMITTERS; i++ ) for( S32 i=0; i<DDC_NUM_EMITTERS; i++ )
{ {
if( stream->readFlag() ) if( stream->readFlag() )
{ {
@ -512,7 +512,7 @@ bool Debris::onAdd()
} }
// create emitters // create emitters
for( int i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ ) for( S32 i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
{ {
if( mDataBlock->emitterList[i] != NULL ) if( mDataBlock->emitterList[i] != NULL )
{ {
@ -631,7 +631,7 @@ bool Debris::onAdd()
void Debris::onRemove() void Debris::onRemove()
{ {
for( int i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ ) for( S32 i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
{ {
if( mEmitterList[i] ) if( mEmitterList[i] )
{ {
@ -848,7 +848,7 @@ void Debris::updateEmitters( Point3F &pos, Point3F &vel, U32 ms )
Point3F lastPos = mLastPos; Point3F lastPos = mLastPos;
for( int i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ ) for( S32 i=0; i<DebrisData::DDC_NUM_EMITTERS; i++ )
{ {
if( mEmitterList[i] ) if( mEmitterList[i] )
{ {

View file

@ -117,7 +117,7 @@ ConsoleDocClass( DecalManager,
namespace { namespace {
int QSORT_CALLBACK cmpDecalInstance(const void* p1, const void* p2) S32 QSORT_CALLBACK cmpDecalInstance(const void* p1, const void* p2)
{ {
const DecalInstance** pd1 = (const DecalInstance**)p1; const DecalInstance** pd1 = (const DecalInstance**)p1;
const DecalInstance** pd2 = (const DecalInstance**)p2; const DecalInstance** pd2 = (const DecalInstance**)p2;
@ -125,7 +125,7 @@ int QSORT_CALLBACK cmpDecalInstance(const void* p1, const void* p2)
return int(((char *)(*pd1)->mDataBlock) - ((char *)(*pd2)->mDataBlock)); return int(((char *)(*pd1)->mDataBlock) - ((char *)(*pd2)->mDataBlock));
} }
int QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 ) S32 QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 )
{ {
const Point3F *pnt1 = (const Point3F*)p1; const Point3F *pnt1 = (const Point3F*)p1;
const Point3F *pnt2 = (const Point3F*)p2; const Point3F *pnt2 = (const Point3F*)p2;
@ -142,7 +142,7 @@ int QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 )
return 0; return 0;
} }
int QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 ) S32 QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 )
{ {
const Point4F *pnt1 = (const Point4F*)p1; const Point4F *pnt1 = (const Point4F*)p1;
const Point4F *pnt2 = (const Point4F*)p2; const Point4F *pnt2 = (const Point4F*)p2;
@ -157,7 +157,7 @@ int QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 )
static Point3F gSortPoint; static Point3F gSortPoint;
int QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 ) S32 QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 )
{ {
const DecalInstance** pd1 = (const DecalInstance**)p1; const DecalInstance** pd1 = (const DecalInstance**)p1;
const DecalInstance** pd2 = (const DecalInstance**)p2; const DecalInstance** pd2 = (const DecalInstance**)p2;
@ -168,7 +168,7 @@ int QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 )
return mSign( dist1 - dist2 ); return mSign( dist1 - dist2 );
} }
int QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 ) S32 QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 )
{ {
const DecalInstance** pd1 = (const DecalInstance**)p1; const DecalInstance** pd1 = (const DecalInstance**)p1;
const DecalInstance** pd2 = (const DecalInstance**)p2; const DecalInstance** pd2 = (const DecalInstance**)p2;
@ -179,14 +179,14 @@ int QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 )
return 1; return 1;
else else
{ {
int priority = (*pd1)->getRenderPriority() - (*pd2)->getRenderPriority(); S32 priority = (*pd1)->getRenderPriority() - (*pd2)->getRenderPriority();
if ( priority != 0 ) if ( priority != 0 )
return priority; return priority;
if ( (*pd2)->mFlags & SaveDecal ) if ( (*pd2)->mFlags & SaveDecal )
{ {
int id = ( (*pd1)->mDataBlock->getMaterial()->getId() - (*pd2)->mDataBlock->getMaterial()->getId() ); S32 id = ( (*pd1)->mDataBlock->getMaterial()->getId() - (*pd2)->mDataBlock->getMaterial()->getId() );
if ( id != 0 ) if ( id != 0 )
return id; return id;

View file

@ -108,6 +108,9 @@ bool RenderMeshExample::onAdd()
// Add this object to the scene // Add this object to the scene
addToScene(); addToScene();
// Refresh this object's material (if any)
updateMaterial();
return true; return true;
} }

View file

@ -45,6 +45,7 @@ protected:
public: public:
CameraFX(); CameraFX();
virtual ~CameraFX() { }
MatrixF & getTrans(){ return mCamFXTrans; } MatrixF & getTrans(){ return mCamFXTrans; }
virtual bool isExpired(){ return mElapsedTime >= mDuration; } virtual bool isExpired(){ return mElapsedTime >= mDuration; }

View file

@ -106,18 +106,31 @@ ConsoleDocClass( Explosion,
" lightEndBrightness = 0.0;\n" " lightEndBrightness = 0.0;\n"
" lightNormalOffset = 2.0;\n" " lightNormalOffset = 2.0;\n"
"};\n\n" "};\n\n"
"function createExplosion()\n" "function ServerPlayExplosion(%position, %datablock)\n"
"{\n" "{\n"
" // Create a new explosion - it will explode automatically\n" " // Play the given explosion on every client.\n"
" %pos = \"0 0 100\";\n" " // The explosion will be transmitted as an event, not attached to any object.\n"
" %obj = new Explosion()\n" " for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)\n"
" {\n" " {\n"
" position = %pos;\n" " %client = ClientGroup.getObject(%idx);\n"
" dataBlock = GrenadeLauncherExplosion;\n" " commandToClient(%client, 'PlayExplosion', %position, %datablock.getId());\n"
" };\n" " }\n"
"}\n\n"
"function clientCmdPlayExplosion(%position, %effectDataBlock)\n"
"{\n"
" // Play an explosion sent by the server. Make sure this function is defined\n"
" // on the client.\n"
" if (isObject(%effectDataBlock))\n"
" {\n"
" new Explosion()\n"
" {\n"
" position = %position;\n"
" dataBlock = %effectDataBlock;\n"
" };\n"
" }\n"
"}\n\n" "}\n\n"
"// schedule an explosion\n" "// schedule an explosion\n"
"schedule(1000, 0, createExplosion);\n" "schedule(1000, 0, ServerPlayExplosion, \"0 0 0\", GrenadeLauncherExplosion);\n"
"@endtsexample" "@endtsexample"
); );
@ -736,9 +749,9 @@ bool ExplosionData::preload(bool server, String &errorStr)
if( !server ) if( !server )
{ {
String errorStr; String sfxErrorStr;
if( !sfxResolve( &soundProfile, errorStr ) ) if( !sfxResolve( &soundProfile, sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", sfxErrorStr.c_str());
if (!particleEmitter && particleEmitterId != 0) if (!particleEmitter && particleEmitterId != 0)
if (Sim::findObject(particleEmitterId, particleEmitter) == false) if (Sim::findObject(particleEmitterId, particleEmitter) == false)
Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock"); Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock");
@ -929,7 +942,7 @@ bool Explosion::onAdd()
void Explosion::onRemove() void Explosion::onRemove()
{ {
for( int i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ ) for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
{ {
if( mEmitterList[i] ) if( mEmitterList[i] )
{ {
@ -1114,7 +1127,7 @@ void Explosion::updateEmitters( F32 dt )
{ {
Point3F pos = getPosition(); Point3F pos = getPosition();
for( int i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ ) for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
{ {
if( mEmitterList[i] ) if( mEmitterList[i] )
{ {
@ -1134,7 +1147,7 @@ void Explosion::launchDebris( Point3F &axis )
return; return;
bool hasDebris = false; bool hasDebris = false;
for( int j=0; j<ExplosionData::EC_NUM_DEBRIS_TYPES; j++ ) for( S32 j=0; j<ExplosionData::EC_NUM_DEBRIS_TYPES; j++ )
{ {
if( mDataBlock->debrisList[j] ) if( mDataBlock->debrisList[j] )
{ {
@ -1160,7 +1173,7 @@ void Explosion::launchDebris( Point3F &axis )
U32 numDebris = mDataBlock->debrisNum + sgRandom.randI( -mDataBlock->debrisNumVariance, mDataBlock->debrisNumVariance ); U32 numDebris = mDataBlock->debrisNum + sgRandom.randI( -mDataBlock->debrisNumVariance, mDataBlock->debrisNumVariance );
for( int i=0; i<numDebris; i++ ) for( S32 i=0; i<numDebris; i++ )
{ {
Point3F launchDir = MathUtils::randomDir( axis, mDataBlock->debrisThetaMin, mDataBlock->debrisThetaMax, Point3F launchDir = MathUtils::randomDir( axis, mDataBlock->debrisThetaMin, mDataBlock->debrisThetaMax,
@ -1249,7 +1262,7 @@ bool Explosion::explode()
Point3F::Zero, U32(mDataBlock->particleDensity * mFade)); Point3F::Zero, U32(mDataBlock->particleDensity * mFade));
} }
for( int i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ ) for( S32 i=0; i<ExplosionData::EC_NUM_EMITTERS; i++ )
{ {
if( mDataBlock->emitterList[i] != NULL ) if( mDataBlock->emitterList[i] != NULL )
{ {

View file

@ -287,14 +287,14 @@ bool LightningData::preload(bool server, String &errorStr)
if (server == false) if (server == false)
{ {
String errorStr; String sfxErrorStr;
for (U32 i = 0; i < MaxThunders; i++) { for (U32 i = 0; i < MaxThunders; i++) {
if( !sfxResolve( &thunderSounds[ i ], errorStr ) ) if( !sfxResolve( &thunderSounds[ i ], sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
} }
if( !sfxResolve( &strikeSound, errorStr ) ) if( !sfxResolve( &strikeSound, sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
for (U32 i = 0; i < MaxTextures; i++) for (U32 i = 0; i < MaxTextures; i++)
{ {
@ -1139,7 +1139,7 @@ void LightningBolt::generateMinorNodes()
{ {
mMinorNodes.clear(); mMinorNodes.clear();
for( int i=0; i<mMajorNodes.numNodes - 1; i++ ) for( S32 i=0; i<mMajorNodes.numNodes - 1; i++ )
{ {
NodeManager segment; NodeManager segment;
segment.startPoint = mMajorNodes.nodeList[i].point; segment.startPoint = mMajorNodes.nodeList[i].point;

View file

@ -66,11 +66,11 @@ ConsoleDocClass( ParticleData,
"@see ParticleEmitterNode\n" "@see ParticleEmitterNode\n"
); );
static const float sgDefaultWindCoefficient = 0.0f; static const F32 sgDefaultWindCoefficient = 0.0f;
static const float sgDefaultConstantAcceleration = 0.f; static const F32 sgDefaultConstantAcceleration = 0.f;
static const float sgDefaultSpinSpeed = 1.f; static const F32 sgDefaultSpinSpeed = 1.f;
static const float sgDefaultSpinRandomMin = 0.f; static const F32 sgDefaultSpinRandomMin = 0.f;
static const float sgDefaultSpinRandomMax = 0.f; static const F32 sgDefaultSpinRandomMax = 0.f;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -622,7 +622,7 @@ bool ParticleData::reload(char errorBuffer[256])
} }
/* /*
numFrames = 0; numFrames = 0;
for( int i=0; i<PDC_MAX_TEX; i++ ) for( S32 i=0; i<PDC_MAX_TEX; i++ )
{ {
if( textureNameList[i] && textureNameList[i][0] ) if( textureNameList[i] && textureNameList[i][0] )
{ {

View file

@ -100,9 +100,9 @@ ConsoleDocClass( ParticleEmitterData,
"@see ParticleEmitterNode\n" "@see ParticleEmitterNode\n"
); );
static const float sgDefaultEjectionOffset = 0.f; static const F32 sgDefaultEjectionOffset = 0.f;
static const float sgDefaultPhiReferenceVel = 0.f; static const F32 sgDefaultPhiReferenceVel = 0.f;
static const float sgDefaultPhiVariance = 360.f; static const F32 sgDefaultPhiVariance = 360.f;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// ParticleEmitterData // ParticleEmitterData
@ -929,7 +929,7 @@ void ParticleEmitter::prepRenderImage(SceneRenderState* state)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ParticleEmitter::setSizes( F32 *sizeList ) void ParticleEmitter::setSizes( F32 *sizeList )
{ {
for( int i=0; i<ParticleData::PDC_NUM_KEYS; i++ ) for( S32 i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
{ {
sizes[i] = sizeList[i]; sizes[i] = sizeList[i];
} }
@ -940,7 +940,7 @@ void ParticleEmitter::setSizes( F32 *sizeList )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void ParticleEmitter::setColors( ColorF *colorList ) void ParticleEmitter::setColors( ColorF *colorList )
{ {
for( int i=0; i<ParticleData::PDC_NUM_KEYS; i++ ) for( S32 i=0; i<ParticleData::PDC_NUM_KEYS; i++ )
{ {
colors[i] = colorList[i]; colors[i] = colorList[i];
} }
@ -1455,7 +1455,7 @@ struct SortParticle
}; };
// qsort callback function for particle sorting // qsort callback function for particle sorting
int QSORT_CALLBACK cmpSortParticles(const void* p1, const void* p2) S32 QSORT_CALLBACK cmpSortParticles(const void* p1, const void* p2)
{ {
const SortParticle* sp1 = (const SortParticle*)p1; const SortParticle* sp1 = (const SortParticle*)p1;
const SortParticle* sp2 = (const SortParticle*)p2; const SortParticle* sp2 = (const SortParticle*)p2;

View file

@ -614,7 +614,7 @@ void GameBase::onUnmount( SceneObject *obj, S32 node )
bool GameBase::setDataBlockProperty( void *obj, const char *index, const char *db) bool GameBase::setDataBlockProperty( void *obj, const char *index, const char *db)
{ {
if( db == NULL || !db || !db[ 0 ] ) if( db == NULL || !db[ 0 ] )
{ {
Con::errorf( "GameBase::setDataBlockProperty - Can't unset datablock on GameBase objects" ); Con::errorf( "GameBase::setDataBlockProperty - Can't unset datablock on GameBase objects" );
return false; return false;

View file

@ -92,7 +92,7 @@ void StdMoveList::clientWriteMovePacket(BitStream *bstream)
bstream->writeInt(start,32); bstream->writeInt(start,32);
bstream->writeInt(count,MoveCountBits); bstream->writeInt(count,MoveCountBits);
Move * prevMove = NULL; Move * prevMove = NULL;
for (int i = 0; i < count; i++) for (S32 i = 0; i < count; i++)
{ {
move[offset + i].sendCount++; move[offset + i].sendCount++;
move[offset + i].pack(bstream,prevMove); move[offset + i].pack(bstream,prevMove);
@ -112,7 +112,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
// Skip forward (must be starting up), or over the moves // Skip forward (must be starting up), or over the moves
// we already have. // we already have.
int skip = mLastMoveAck - start; S32 skip = mLastMoveAck - start;
if (skip < 0) if (skip < 0)
{ {
mLastMoveAck = start; mLastMoveAck = start;
@ -121,7 +121,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
{ {
if (skip > count) if (skip > count)
skip = count; skip = count;
for (int i = 0; i < skip; i++) for (S32 i = 0; i < skip; i++)
{ {
prevMoveHolder.unpack(bstream,prevMove); prevMoveHolder.unpack(bstream,prevMove);
prevMoveHolder.checksum = bstream->readInt(Move::ChecksumBits); prevMoveHolder.checksum = bstream->readInt(Move::ChecksumBits);
@ -141,7 +141,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
} }
// Put the rest on the move list. // Put the rest on the move list.
int index = mMoveVec.size(); S32 index = mMoveVec.size();
mMoveVec.increment(count); mMoveVec.increment(count);
while (index < mMoveVec.size()) while (index < mMoveVec.size())
{ {

View file

@ -893,7 +893,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
// Pick the most resistant surface // Pick the most resistant surface
F32 bd = 0; F32 bd = 0;
const Collision* collision = 0; const Collision* collision = 0;
for (int c = 0; c < collisionList.getCount(); c++) { for (S32 c = 0; c < collisionList.getCount(); c++) {
const Collision &cp = collisionList[c]; const Collision &cp = collisionList[c];
F32 dot = -mDot(mVelocity,cp.normal); F32 dot = -mDot(mVelocity,cp.normal);
if (dot > bd) { if (dot > bd) {
@ -1204,7 +1204,7 @@ DefineEngineMethod( Item, isRotating, bool, (),,
return object->isRotating(); return object->isRotating();
} }
DefineEngineMethod( Item, setCollisionTimeout, bool, (int ignoreColObj),(NULL), DefineEngineMethod( Item, setCollisionTimeout, bool, (S32 ignoreColObj),(NULL),
"@brief Temporarily disable collisions against a specific ShapeBase object.\n\n" "@brief Temporarily disable collisions against a specific ShapeBase object.\n\n"
"This is useful to prevent a player from immediately picking up an Item they have " "This is useful to prevent a player from immediately picking up an Item they have "

View file

@ -179,7 +179,7 @@ DefineEngineMethod( MissionArea, getArea, const char *, (),,
char* returnBuffer = Con::getReturnBuffer(48); char* returnBuffer = Con::getReturnBuffer(48);
RectI area = object->getArea(); RectI area = object->getArea();
dSprintf(returnBuffer, sizeof(returnBuffer), "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y); dSprintf(returnBuffer, 48, "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y);
return(returnBuffer); return(returnBuffer);
} }

View file

@ -429,7 +429,7 @@ U32 PathCamera::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
if (stream->writeFlag(mask & WindowMask)) { if (stream->writeFlag(mask & WindowMask)) {
stream->write(mNodeBase); stream->write(mNodeBase);
stream->write(mNodeCount); stream->write(mNodeCount);
for (int i = 0; i < mNodeCount; i++) { for (S32 i = 0; i < mNodeCount; i++) {
CameraSpline::Knot *knot = mSpline.getKnot(i); CameraSpline::Knot *knot = mSpline.getKnot(i);
mathWrite(*stream, knot->mPosition); mathWrite(*stream, knot->mPosition);
mathWrite(*stream, knot->mRotation); mathWrite(*stream, knot->mRotation);
@ -477,7 +477,7 @@ void PathCamera::unpackUpdate(NetConnection *con, BitStream *stream)
mSpline.removeAll(); mSpline.removeAll();
stream->read(&mNodeBase); stream->read(&mNodeBase);
stream->read(&mNodeCount); stream->read(&mNodeCount);
for (int i = 0; i < mNodeCount; i++) for (S32 i = 0; i < mNodeCount; i++)
{ {
CameraSpline::Knot *knot = new CameraSpline::Knot(); CameraSpline::Knot *knot = new CameraSpline::Knot();
mathRead(*stream, &knot->mPosition); mathRead(*stream, &knot->mPosition);

View file

@ -83,7 +83,7 @@ private:
S32 mNodeBase; S32 mNodeBase;
S32 mNodeCount; S32 mNodeCount;
F32 mPosition; F32 mPosition;
int mState; S32 mState;
F32 mTarget; F32 mTarget;
bool mTargetSet; bool mTargetSet;

View file

@ -24,7 +24,7 @@
#define _BULLET_H_ #define _BULLET_H_
// NOTE: We set these defines which bullet needs here. // NOTE: We set these defines which bullet needs here.
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
#define WIN32 #define WIN32
#endif #endif

View file

@ -46,7 +46,7 @@
#define __APPLE__ #define __APPLE__
#elif defined(TORQUE_OS_LINUX) && !defined(LINUX) #elif defined(TORQUE_OS_LINUX) && !defined(LINUX)
#define LINUX #define LINUX
#elif defined(TORQUE_OS_WIN32) && !defined(WIN32) #elif defined(TORQUE_OS_WIN) && !defined(WIN32)
#define WIN32 #define WIN32
#endif #endif

View file

@ -527,7 +527,7 @@ bool PxMultiActorData::preload( bool server, String &errorBuffer )
return false; return false;
} }
if (!shapeName || shapeName == '\0') if (!shapeName || shapeName[0] == '\0')
{ {
errorBuffer = "PxMultiActorDatas::preload: no shape name!"; errorBuffer = "PxMultiActorDatas::preload: no shape name!";
return false; return false;

View file

@ -39,7 +39,7 @@ AFTER_MODULE_INIT( Sim )
{ {
NamedFactory<PhysicsPlugin>::add( "PhysX", &PxPlugin::create ); NamedFactory<PhysicsPlugin>::add( "PhysX", &PxPlugin::create );
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON) #if defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
NamedFactory<PhysicsPlugin>::add( "default", &PxPlugin::create ); NamedFactory<PhysicsPlugin>::add( "default", &PxPlugin::create );
#endif #endif

View file

@ -29,25 +29,25 @@
#define __APPLE__ #define __APPLE__
#elif defined(TORQUE_OS_LINUX) && !defined(LINUX) #elif defined(TORQUE_OS_LINUX) && !defined(LINUX)
#define LINUX #define LINUX
#elif defined(TORQUE_OS_WIN32) && !defined(WIN32) #elif defined(TORQUE_OS_WIN) && !defined(WIN32)
#define WIN32 #define WIN32
#endif #endif
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include <PxPhysicsAPI.h> #include <PxPhysicsAPI.h>
#include <extensions/PxExtensionsAPI.h> #include <PxExtensionsAPI.h>
#include <extensions/PxDefaultErrorCallback.h> #include <PxDefaultErrorCallback.h>
#include <extensions/PxDefaultAllocator.h> #include <PxDefaultAllocator.h>
#include <extensions/PxDefaultSimulationFilterShader.h> #include <PxDefaultSimulationFilterShader.h>
#include <extensions/PxDefaultCpuDispatcher.h> #include <PxDefaultCpuDispatcher.h>
#include <extensions/PxShapeExt.h> #include <PxShapeExt.h>
#include <extensions/PxSimpleFactory.h> #include <PxSimpleFactory.h>
#include <foundation/PxFoundation.h> #include <PxFoundation.h>
#include <characterkinematic/PxController.h> #include <PxController.h>
#include <common/PxIO.h> #include <PxIO.h>
extern physx::PxPhysics* gPhysics3SDK; extern physx::PxPhysics* gPhysics3SDK;
#endif #endif // _PHYSX3_

View file

@ -24,7 +24,7 @@
#include "T3D/physics/physx3/px3Body.h" #include "T3D/physics/physx3/px3Body.h"
#include "T3D/physics/physx3/px3.h" #include "T3D/physics/physx3/px3.h"
#include "T3D/physics/physx3/px3Cast.h" #include "T3D/physics/physx3/px3Casts.h"
#include "T3D/physics/physx3/px3World.h" #include "T3D/physics/physx3/px3World.h"
#include "T3D/physics/physx3/px3Collision.h" #include "T3D/physics/physx3/px3Collision.h"
@ -123,24 +123,23 @@ bool Px3Body::init( PhysicsCollision *shape,
Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported."); Con::errorf("PhysX3 Dynamic Triangle Mesh is not supported.");
} }
} }
physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial,desc->pose); physx::PxShape * pShape = mActor->createShape(*desc->pGeometry,*mMaterial);
physx::PxFilterData colData; physx::PxFilterData colData;
if(isDebris) if(isDebris)
colData.word0 = PX3_DEBRIS; colData.word0 = PX3_DEBRIS;
else if(isTrigger) else if(isTrigger)
{ colData.word0 = PX3_TRIGGER;
//We don't want trigger shapes taking part in shape pair intersection tests
pShape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, false);
colData.word0 = PX3_TRIGGER;
}
else else
colData.word0 = PX3_DEFAULT; colData.word0 = PX3_DEFAULT;
//set local pose - actor->createShape with a local pose is deprecated in physx 3.3
pShape->setLocalPose(desc->pose);
//set the skin width //set the skin width
pShape->setContactOffset(0.01f); pShape->setContactOffset(0.01f);
pShape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, !isTrigger);
pShape->setFlag(physx::PxShapeFlag::eSCENE_QUERY_SHAPE,true); pShape->setFlag(physx::PxShapeFlag::eSCENE_QUERY_SHAPE,true);
pShape->setSimulationFilterData(colData); pShape->setSimulationFilterData(colData);
pShape->setQueryFilterData(colData); pShape->setQueryFilterData(colData);
} }
//mass & intertia has to be set after creating the shape //mass & intertia has to be set after creating the shape
@ -148,6 +147,10 @@ bool Px3Body::init( PhysicsCollision *shape,
{ {
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>(); physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass); physx::PxRigidBodyExt::setMassAndUpdateInertia(*actor,mass);
if(mBodyFlags & BF_CCD)
actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eENABLE_CCD, true);
else
actor->setRigidBodyFlag(physx::PxRigidBodyFlag::eENABLE_CCD, false);
} }
// This sucks, but it has to happen if we want // This sucks, but it has to happen if we want
@ -366,6 +369,23 @@ void Px3Body::setSimulationEnabled( bool enabled )
delete [] shapes; delete [] shapes;
} }
void Px3Body::moveKinematicTo( const MatrixF &transform )
{
AssertFatal( mActor, "Px3Body::moveKinematicTo - The actor is null!" );
const bool isKinematic = mBodyFlags & BF_KINEMATIC;
if (!isKinematic )
{
Con::errorf("Px3Body::moveKinematicTo is only for kinematic bodies.");
return;
}
mWorld->releaseWriteLock();
physx::PxRigidDynamic *actor = mActor->is<physx::PxRigidDynamic>();
actor->setKinematicTarget(px3Cast<physx::PxTransform>(transform));
}
void Px3Body::setTransform( const MatrixF &transform ) void Px3Body::setTransform( const MatrixF &transform )
{ {
AssertFatal( mActor, "Px3Body::setTransform - The actor is null!" ); AssertFatal( mActor, "Px3Body::setTransform - The actor is null!" );

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _T3D_PHYSICS_PX3BODY_H_ #ifndef _PX3BODY_H_
#define _T3D_PHYSICS_PX3BODY_H_ #define _PX3BODY_H_
#ifndef _T3D_PHYSICS_PHYSICSBODY_H_ #ifndef _T3D_PHYSICS_PHYSICSBODY_H_
#include "T3D/physics/physicsBody.h" #include "T3D/physics/physicsBody.h"
@ -88,6 +88,7 @@ public:
// PhysicsObject // PhysicsObject
virtual PhysicsWorld* getWorld(); virtual PhysicsWorld* getWorld();
virtual void setTransform( const MatrixF &xfm ); virtual void setTransform( const MatrixF &xfm );
virtual void moveKinematicTo( const MatrixF &xfm );
virtual MatrixF& getTransform( MatrixF *outMatrix ); virtual MatrixF& getTransform( MatrixF *outMatrix );
virtual Box3F getWorldBounds(); virtual Box3F getWorldBounds();
virtual void setSimulationEnabled( bool enabled ); virtual void setSimulationEnabled( bool enabled );
@ -118,4 +119,4 @@ public:
virtual void applyImpulse( const Point3F &origin, const Point3F &force ); virtual void applyImpulse( const Point3F &origin, const Point3F &force );
}; };
#endif #endif // _PX3BODY_H_

View file

@ -0,0 +1,137 @@
//-----------------------------------------------------------------------------
// 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.
//-----------------------------------------------------------------------------
#ifndef _PX3CASTS_H_
#define _PX3CASTS_H_
#ifndef _MPOINT3_H_
#include "math/mPoint3.h"
#endif
#ifndef _MMATRIX_H_
#include "math/mMatrix.h"
#endif
#ifndef _MBOX_H_
#include "math/mBox.h"
#endif
#ifndef _MQUAT_H_
#include "math/mQuat.h"
#endif
#ifndef _MTRANSFORM_H_
#include "math/mTransform.h"
#endif
template <class T, class F> inline T px3Cast( const F &from );
//-------------------------------------------------------------------------
template<>
inline Point3F px3Cast( const physx::PxVec3 &vec )
{
return Point3F( vec.x, vec.y, vec.z );
}
template<>
inline physx::PxVec3 px3Cast( const Point3F &point )
{
return physx::PxVec3( point.x, point.y, point.z );
}
//-------------------------------------------------------------------------
template<>
inline QuatF px3Cast( const physx::PxQuat &quat )
{
/// The Torque quat has the opposite winding order.
return QuatF( -quat.x, -quat.y, -quat.z, quat.w );
}
template<>
inline physx::PxQuat px3Cast( const QuatF &quat )
{
/// The Torque quat has the opposite winding order.
physx::PxQuat result( -quat.x, -quat.y, -quat.z, quat.w );
return result;
}
//-------------------------------------------------------------------------
template<>
inline physx::PxExtendedVec3 px3Cast( const Point3F &point )
{
return physx::PxExtendedVec3( point.x, point.y, point.z );
}
template<>
inline Point3F px3Cast( const physx::PxExtendedVec3 &xvec )
{
return Point3F( xvec.x, xvec.y, xvec.z );
}
//-------------------------------------------------------------------------
template<>
inline physx::PxBounds3 px3Cast( const Box3F &box )
{
physx::PxBounds3 bounds(px3Cast<physx::PxVec3>(box.minExtents),
px3Cast<physx::PxVec3>(box.maxExtents));
return bounds;
}
template<>
inline Box3F px3Cast( const physx::PxBounds3 &bounds )
{
return Box3F( bounds.minimum.x,
bounds.minimum.y,
bounds.minimum.z,
bounds.maximum.x,
bounds.maximum.y,
bounds.maximum.z );
}
//-------------------------------------------------------------------------
template<>
inline physx::PxTransform px3Cast( const MatrixF &xfm )
{
physx::PxTransform out;
QuatF q;
q.set(xfm);
out.q = px3Cast<physx::PxQuat>(q);
out.p = px3Cast<physx::PxVec3>(xfm.getPosition());
return out;
}
template<>
inline TransformF px3Cast(const physx::PxTransform &xfm)
{
TransformF out(px3Cast<Point3F>(xfm.p),AngAxisF(px3Cast<QuatF>(xfm.q)));
return out;
}
template<>
inline MatrixF px3Cast( const physx::PxTransform &xfm )
{
MatrixF out;
TransformF t = px3Cast<TransformF>(xfm);
out = t.getMatrix();
return out;
}
#endif //_PX3CASTS_H_

View file

@ -26,7 +26,7 @@
#include "math/mPoint3.h" #include "math/mPoint3.h"
#include "math/mMatrix.h" #include "math/mMatrix.h"
#include "T3D/physics/physx3/px3.h" #include "T3D/physics/physx3/px3.h"
#include "T3D/physics/physx3/px3Cast.h" #include "T3D/physics/physx3/px3Casts.h"
#include "T3D/physics/physx3/px3World.h" #include "T3D/physics/physx3/px3World.h"
#include "T3D/physics/physx3/px3Stream.h" #include "T3D/physics/physx3/px3Stream.h"
@ -105,7 +105,10 @@ bool Px3Collision::addConvex( const Point3F *points,
convexMesh = gPhysics3SDK->createConvexMesh(in); convexMesh = gPhysics3SDK->createConvexMesh(in);
Px3CollisionDesc *desc = new Px3CollisionDesc; Px3CollisionDesc *desc = new Px3CollisionDesc;
desc->pGeometry = new physx::PxConvexMeshGeometry(convexMesh); physx::PxVec3 scale = px3Cast<physx::PxVec3>(localXfm.getScale());
physx::PxQuat rotation = px3Cast<physx::PxQuat>(QuatF(localXfm));
physx::PxMeshScale meshScale(scale,rotation);
desc->pGeometry = new physx::PxConvexMeshGeometry(convexMesh,meshScale);
desc->pose = px3Cast<physx::PxTransform>(localXfm); desc->pose = px3Cast<physx::PxTransform>(localXfm);
mColShapes.push_back(desc); mColShapes.push_back(desc);
return true; return true;
@ -177,13 +180,13 @@ bool Px3Collision::addHeightfield( const U16 *heights,
if ( holes && holes[ getMax( (S32)index - 1, 0 ) ] ) // row index for holes adjusted so PhysX collision shape better matches rendered terrain if ( holes && holes[ getMax( (S32)index - 1, 0 ) ] ) // row index for holes adjusted so PhysX collision shape better matches rendered terrain
{ {
currentSample->materialIndex0 = 0; currentSample->materialIndex0 = physx::PxHeightFieldMaterial::eHOLE;
currentSample->materialIndex1 = 0; currentSample->materialIndex1 = physx::PxHeightFieldMaterial::eHOLE;
} }
else else
{ {
currentSample->materialIndex0 = 1; currentSample->materialIndex0 = 0;
currentSample->materialIndex1 = 1; currentSample->materialIndex1 = 0;
} }
int flag = ( column + tess ) % 2; int flag = ( column + tess ) % 2;

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _T3D_PHYSICS_PX3COLLISION_H_ #ifndef _PX3COLLISION_H_
#define _T3D_PHYSICS_PX3COLLISION_H_ #define _PX3COLLISION_H_
#ifndef _T3D_PHYSICS_PHYSICSCOLLISION_H_ #ifndef _T3D_PHYSICS_PHYSICSCOLLISION_H_
#include "T3D/physics/physicsCollision.h" #include "T3D/physics/physicsCollision.h"
@ -32,7 +32,7 @@
#ifndef _MMATRIX_H_ #ifndef _MMATRIX_H_
#include "math/mMatrix.h" #include "math/mMatrix.h"
#endif #endif
//nasty hate doing this!
#include <foundation/PxTransform.h> #include <foundation/PxTransform.h>
//forward declare //forward declare
@ -84,4 +84,4 @@ public:
const MatrixF &localXfm ); const MatrixF &localXfm );
}; };
#endif #endif // _PX3COLLISION_H_

View file

@ -24,7 +24,7 @@
#include "T3D/physics/physx3/px3Player.h" #include "T3D/physics/physx3/px3Player.h"
#include "T3D/physics/physicsPlugin.h" #include "T3D/physics/physicsPlugin.h"
#include "T3D/physics/physx3/px3World.h" #include "T3D/physics/physx3/px3World.h"
#include "T3D/physics/physx3/px3Cast.h" #include "T3D/physics/physx3/px3Casts.h"
#include "T3D/physics/physx3/px3Utils.h" #include "T3D/physics/physx3/px3Utils.h"
#include "collision/collision.h" #include "collision/collision.h"
@ -322,7 +322,10 @@ void Px3Player::setScale( const Point3F &scale )
Box3F Px3Player::getWorldBounds() Box3F Px3Player::getWorldBounds()
{ {
Con::warnf( "Px3Player::getWorldBounds - not implemented" ); physx::PxBounds3 bounds;
return Box3F::Invalid; physx::PxRigidDynamic *actor = mController->getActor();
physx::PxShape *shape = px3GetFirstShape(actor);
bounds = physx::PxShapeExt::getWorldBounds(*shape,*actor);
return px3Cast<Box3F>( bounds );
} }

View file

@ -101,4 +101,4 @@ public:
}; };
#endif // _PXPLAYER_H #endif // _PX3PLAYER_H_

View file

@ -37,7 +37,7 @@ AFTER_MODULE_INIT( Sim )
{ {
NamedFactory<PhysicsPlugin>::add( "PhysX3", &Px3Plugin::create ); NamedFactory<PhysicsPlugin>::add( "PhysX3", &Px3Plugin::create );
#if defined(TORQUE_OS_WIN32) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON) #if defined(TORQUE_OS_WIN) || defined(TORQUE_OS_XBOX) || defined(TORQUE_OS_XENON)
NamedFactory<PhysicsPlugin>::add( "default", &Px3Plugin::create ); NamedFactory<PhysicsPlugin>::add( "default", &Px3Plugin::create );
#endif #endif
} }
@ -224,4 +224,3 @@ U32 Px3Plugin::getWorldCount() const
{ {
return mPhysicsWorldLookup.size(); return mPhysicsWorldLookup.size();
} }

View file

@ -20,13 +20,15 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _T3D_PHYSICS_PX3PLUGIN_H_ #ifndef _PX3PLUGIN_H_
#define _T3D_PHYSICS_PX3PLUGIN_H_ #define _PX3PLUGIN_H_
#ifndef _T3D_PHYSICS_PHYSICSPLUGIN_H_ #ifndef _T3D_PHYSICS_PHYSICSPLUGIN_H_
#include "T3D/physics/physicsPlugin.h" #include "T3D/physics/physicsPlugin.h"
#endif #endif
class Px3ClothShape;
class Px3Plugin : public PhysicsPlugin class Px3Plugin : public PhysicsPlugin
{ {
public: public:
@ -52,7 +54,6 @@ public:
virtual PhysicsWorld* getWorld( const String &worldName ) const; virtual PhysicsWorld* getWorld( const String &worldName ) const;
virtual PhysicsWorld* getWorld() const; virtual PhysicsWorld* getWorld() const;
virtual U32 getWorldCount() const; virtual U32 getWorldCount() const;
}; };
#endif #endif // _PX3PLUGIN_H_

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _T3D_PHYSICS_PX3STREAM_H_ #ifndef _PX3STREAM_H_
#define _T3D_PHYSICS_PX3STREAM_H_ #define _PX3STREAM_H_
#ifndef _PHYSX3_H_ #ifndef _PHYSX3_H_
#include "T3D/physics/physx3/px3.h" #include "T3D/physics/physx3/px3.h"
@ -74,4 +74,4 @@ public:
virtual ~Px3ConsoleStream(); virtual ~Px3ConsoleStream();
}; };
#endif #endif // _PX3STREAM_H_

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _PHYSX3_UTILS_H_ #ifndef _PX3UTILS_H_
#define _PHYSX3_UTILS_H_ #define _PX3UTILS_H_
namespace physx namespace physx
{ {
@ -31,5 +31,4 @@ namespace physx
extern physx::PxShape* px3GetFirstShape(physx::PxRigidActor *actor); extern physx::PxShape* px3GetFirstShape(physx::PxRigidActor *actor);
#endif // _PX3UTILS_H_
#endif

View file

@ -25,7 +25,7 @@
#include "T3D/physics/physx3/px3.h" #include "T3D/physics/physx3/px3.h"
#include "T3D/physics/physx3/px3Plugin.h" #include "T3D/physics/physx3/px3Plugin.h"
#include "T3D/physics/physx3/px3Cast.h" #include "T3D/physics/physx3/px3Casts.h"
#include "T3D/physics/physx3/px3Stream.h" #include "T3D/physics/physx3/px3Stream.h"
#include "T3D/physics/physicsUserData.h" #include "T3D/physics/physicsUserData.h"
@ -54,6 +54,23 @@ physx::PxDefaultAllocator Px3World::smMemoryAlloc;
F32 Px3World::smPhysicsStepTime = 1.0f/(F32)TickMs; F32 Px3World::smPhysicsStepTime = 1.0f/(F32)TickMs;
U32 Px3World::smPhysicsMaxIterations = 4; U32 Px3World::smPhysicsMaxIterations = 4;
//filter shader with support for CCD pairs
static physx::PxFilterFlags sCcdFilterShader(
physx::PxFilterObjectAttributes attributes0,
physx::PxFilterData filterData0,
physx::PxFilterObjectAttributes attributes1,
physx::PxFilterData filterData1,
physx::PxPairFlags& pairFlags,
const void* constantBlock,
physx::PxU32 constantBlockSize)
{
pairFlags = physx::PxPairFlag::eRESOLVE_CONTACTS;
pairFlags |= physx::PxPairFlag::eCCD_LINEAR;
return physx::PxFilterFlags();
}
Px3World::Px3World(): mScene( NULL ), Px3World::Px3World(): mScene( NULL ),
mProcessList( NULL ), mProcessList( NULL ),
mIsSimulating( false ), mIsSimulating( false ),
@ -198,7 +215,6 @@ void Px3World::destroyWorld()
mScene->release(); mScene->release();
mScene = NULL; mScene = NULL;
} }
} }
bool Px3World::initWorld( bool isServer, ProcessList *processList ) bool Px3World::initWorld( bool isServer, ProcessList *processList )
@ -222,9 +238,11 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList )
Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount()); Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount());
} }
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS; sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader; sceneDesc.filterShader = sCcdFilterShader;
mScene = gPhysics3SDK->createScene(sceneDesc); mScene = gPhysics3SDK->createScene(sceneDesc);
@ -559,7 +577,6 @@ void Px3World::onDebugDraw( const SceneRenderState *state )
} }
} }
//set simulation timing via script //set simulation timing via script
DefineEngineFunction( physx3SetSimulationTiming, void, ( F32 stepTime, U32 maxSteps ),, "Set simulation timing of the PhysX 3 plugin" ) DefineEngineFunction( physx3SetSimulationTiming, void, ( F32 stepTime, U32 maxSteps ),, "Set simulation timing of the PhysX 3 plugin" )
{ {

View file

@ -20,8 +20,8 @@
// IN THE SOFTWARE. // IN THE SOFTWARE.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#ifndef _PHYSX3_WORLD_H_ #ifndef _PX3WORLD_H_
#define _PHYSX3_WORLD_H_ #define _PX3WORLD_H_
#ifndef _T3D_PHYSICS_PHYSICSWORLD_H_ #ifndef _T3D_PHYSICS_PHYSICSWORLD_H_
#include "T3D/physics/physicsWorld.h" #include "T3D/physics/physicsWorld.h"
@ -53,7 +53,6 @@ class Px3World : public PhysicsWorld
protected: protected:
physx::PxScene* mScene; physx::PxScene* mScene;
bool mIsEnabled; bool mIsEnabled;
bool mIsSimulating; bool mIsSimulating;
bool mIsServer; bool mIsServer;
@ -71,7 +70,6 @@ protected:
static physx::PxVisualDebuggerConnection* smPvdConnection; static physx::PxVisualDebuggerConnection* smPvdConnection;
static F32 smPhysicsStepTime; static F32 smPhysicsStepTime;
static U32 smPhysicsMaxIterations; static U32 smPhysicsMaxIterations;
F32 mAccumulator; F32 mAccumulator;
bool _simulate(const F32 dt); bool _simulate(const F32 dt);
@ -105,6 +103,4 @@ public:
static void setTiming(F32 stepTime,U32 maxIterations); static void setTiming(F32 stepTime,U32 maxIterations);
}; };
#endif // _PX3WORLD_H_
#endif

View file

@ -427,9 +427,9 @@ bool PlayerData::preload(bool server, String &errorStr)
{ {
for( U32 i = 0; i < MaxSounds; ++ i ) for( U32 i = 0; i < MaxSounds; ++ i )
{ {
String errorStr; String sfxErrorStr;
if( !sfxResolve( &sound[ i ], errorStr ) ) if( !sfxResolve( &sound[ i ], sfxErrorStr ) )
Con::errorf( "PlayerData::preload: %s", errorStr.c_str() ); Con::errorf( "PlayerData::preload: %s", sfxErrorStr.c_str() );
} }
} }
@ -467,7 +467,7 @@ bool PlayerData::preload(bool server, String &errorStr)
// Extract ground transform velocity from animations // Extract ground transform velocity from animations
// Get the named ones first so they can be indexed directly. // Get the named ones first so they can be indexed directly.
ActionAnimation *dp = &actionList[0]; ActionAnimation *dp = &actionList[0];
for (int i = 0; i < NumTableActionAnims; i++,dp++) for (S32 i = 0; i < NumTableActionAnims; i++,dp++)
{ {
ActionAnimationDef *sp = &ActionAnimationList[i]; ActionAnimationDef *sp = &ActionAnimationList[i];
dp->name = sp->name; dp->name = sp->name;
@ -492,7 +492,7 @@ bool PlayerData::preload(bool server, String &errorStr)
if (dStricmp(sp->name, "jet") != 0) if (dStricmp(sp->name, "jet") != 0)
AssertWarn(dp->sequence != -1, avar("PlayerData::preload - Unable to find named animation sequence '%s'!", sp->name)); AssertWarn(dp->sequence != -1, avar("PlayerData::preload - Unable to find named animation sequence '%s'!", sp->name));
} }
for (int b = 0; b < mShape->sequences.size(); b++) for (S32 b = 0; b < mShape->sequences.size(); b++)
{ {
if (!isTableSequence(b)) if (!isTableSequence(b))
{ {
@ -509,7 +509,7 @@ bool PlayerData::preload(bool server, String &errorStr)
// Resolve lookAction index // Resolve lookAction index
dp = &actionList[0]; dp = &actionList[0];
String lookName("look"); String lookName("look");
for (int c = 0; c < actionCount; c++,dp++) for (S32 c = 0; c < actionCount; c++,dp++)
if( dStricmp( dp->name, lookName ) == 0 ) if( dStricmp( dp->name, lookName ) == 0 )
lookAction = c; lookAction = c;
@ -557,7 +557,7 @@ bool PlayerData::preload(bool server, String &errorStr)
if (!Sim::findObject(dustID, dustEmitter)) if (!Sim::findObject(dustID, dustEmitter))
Con::errorf(ConsoleLogEntry::General, "PlayerData::preload - Invalid packet, bad datablockId(dustEmitter): 0x%x", dustID); Con::errorf(ConsoleLogEntry::General, "PlayerData::preload - Invalid packet, bad datablockId(dustEmitter): 0x%x", dustID);
for (int i=0; i<NUM_SPLASH_EMITTERS; i++) for (S32 i=0; i<NUM_SPLASH_EMITTERS; i++)
if( !splashEmitterList[i] && splashEmitterIDList[i] != 0 ) if( !splashEmitterList[i] && splashEmitterIDList[i] != 0 )
if( Sim::findObject( splashEmitterIDList[i], splashEmitterList[i] ) == false) if( Sim::findObject( splashEmitterIDList[i], splashEmitterList[i] ) == false)
Con::errorf(ConsoleLogEntry::General, "PlayerData::onAdd - Invalid packet, bad datablockId(particle emitter): 0x%x", splashEmitterIDList[i]); Con::errorf(ConsoleLogEntry::General, "PlayerData::onAdd - Invalid packet, bad datablockId(particle emitter): 0x%x", splashEmitterIDList[i]);
@ -586,7 +586,10 @@ bool PlayerData::preload(bool server, String &errorStr)
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath()); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShapeFP[i].getPath());
if (!fileRef) if (!fileRef)
{
errorStr = String::ToString("PlayerData: Mounted image %d loading failed, shape \"%s\" is not found.",i,mShapeFP[i].getPath().getFullPath().c_str());
return false; return false;
}
if(server) if(server)
mCRCFP[i] = fileRef->getChecksum(); mCRCFP[i] = fileRef->getChecksum();
@ -647,7 +650,7 @@ bool PlayerData::isTableSequence(S32 seq)
{ {
// The sequences from the table must already have // The sequences from the table must already have
// been loaded for this to work. // been loaded for this to work.
for (int i = 0; i < NumTableActionAnims; i++) for (S32 i = 0; i < NumTableActionAnims; i++)
if (actionList[i].sequence == seq) if (actionList[i].sequence == seq)
return true; return true;
return false; return false;
@ -1944,7 +1947,7 @@ void Player::reSkin()
Vector<String> skins; Vector<String> skins;
String(mSkinNameHandle.getString()).split( ";", skins ); String(mSkinNameHandle.getString()).split( ";", skins );
for ( int i = 0; i < skins.size(); i++ ) for ( S32 i = 0; i < skins.size(); i++ )
{ {
String oldSkin( mAppliedSkinName.c_str() ); String oldSkin( mAppliedSkinName.c_str() );
String newSkin( skins[i] ); String newSkin( skins[i] );
@ -1961,7 +1964,7 @@ void Player::reSkin()
// Apply skin to both 3rd person and 1st person shape instances // Apply skin to both 3rd person and 1st person shape instances
mShapeInstance->reSkin( newSkin, oldSkin ); mShapeInstance->reSkin( newSkin, oldSkin );
for ( int j = 0; j < ShapeBase::MaxMountedImages; j++ ) for ( S32 j = 0; j < ShapeBase::MaxMountedImages; j++ )
{ {
if (mShapeFPInstance[j]) if (mShapeFPInstance[j])
mShapeFPInstance[j]->reSkin( newSkin, oldSkin ); mShapeFPInstance[j]->reSkin( newSkin, oldSkin );
@ -5822,7 +5825,7 @@ bool Player::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
F32 const *si = &start.x; F32 const *si = &start.x;
F32 const *ei = &end.x; F32 const *ei = &end.x;
for (int i = 0; i < 3; i++) { for (S32 i = 0; i < 3; i++) {
if (*si < *ei) { if (*si < *ei) {
if (*si > *bmax || *ei < *bmin) if (*si > *bmax || *ei < *bmin)
return false; return false;

View file

@ -320,9 +320,9 @@ bool ProjectileData::preload(bool server, String &errorStr)
if (Sim::findObject(decalId, decal) == false) if (Sim::findObject(decalId, decal) == false)
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
String errorStr; String sfxErrorStr;
if( !sfxResolve( &sound, errorStr ) ) if( !sfxResolve( &sound, sfxErrorStr ) )
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", errorStr.c_str()); Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
if (!lightDesc && lightDescId != 0) if (!lightDesc && lightDescId != 0)
if (Sim::findObject(lightDescId, lightDesc) == false) if (Sim::findObject(lightDescId, lightDesc) == false)
@ -1011,7 +1011,7 @@ void Projectile::explode( const Point3F &p, const Point3F &n, const U32 collideT
// Client (impact) decal. // Client (impact) decal.
if ( mDataBlock->decal ) if ( mDataBlock->decal )
gDecalManager->addDecal( p, n, 0.0f, mDataBlock->decal ); gDecalManager->addDecal(p, n, mRandF(0.0f, M_2PI_F), mDataBlock->decal);
// Client object // Client object
updateSound(); updateSound();

View file

@ -215,9 +215,9 @@ public:
void updateSound(); void updateSound();
virtual bool calculateImpact( float simTime, virtual bool calculateImpact( F32 simTime,
Point3F &pointOfImpact, Point3F &pointOfImpact,
float &impactTime ); F32 &impactTime );
void setInitialPosition( const Point3F& pos ); void setInitialPosition( const Point3F& pos );
void setInitialVelocity( const Point3F& vel ); void setInitialVelocity( const Point3F& vel );

View file

@ -136,11 +136,11 @@ bool ProximityMineData::preload( bool server, String& errorStr )
if ( !server ) if ( !server )
{ {
// Resolve sounds // Resolve sounds
String errorStr; String sfxErrorStr;
if( !sfxResolve( &armingSound, errorStr ) ) if( !sfxResolve( &armingSound, sfxErrorStr ) )
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() ); Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
if( !sfxResolve( &triggerSound, errorStr ) ) if( !sfxResolve( &triggerSound, sfxErrorStr ) )
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() ); Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
} }
if ( mShape ) if ( mShape )
@ -451,7 +451,7 @@ void ProximityMine::processTick( const Move* move )
SimpleQueryList sql; SimpleQueryList sql;
getContainer()->findObjects( triggerBox, sTriggerCollisionMask, getContainer()->findObjects( triggerBox, sTriggerCollisionMask,
SimpleQueryList::insertionCallback, &sql ); SimpleQueryList::insertionCallback, &sql );
for ( int i = 0; i < sql.mList.size(); i++ ) for ( S32 i = 0; i < sql.mList.size(); i++ )
{ {
// Detect movement in the trigger area // Detect movement in the trigger area
if ( ( sql.mList[i] == mOwner && !mDataBlock->triggerOnOwner ) || if ( ( sql.mList[i] == mOwner && !mDataBlock->triggerOnOwner ) ||

View file

@ -265,8 +265,8 @@ void Rigid::translateCenterOfMass(const Point3F &oldPos,const Point3F &newPos)
MatrixF oldx,newx; MatrixF oldx,newx;
oldx.setCrossProduct(oldPos); oldx.setCrossProduct(oldPos);
newx.setCrossProduct(newPos); newx.setCrossProduct(newPos);
for (int row = 0; row < 3; row++) for (S32 row = 0; row < 3; row++)
for (int col = 0; col < 3; col++) { for (S32 col = 0; col < 3; col++) {
F32 n = newx(row,col), o = oldx(row,col); F32 n = newx(row,col), o = oldx(row,col);
objectInertia(row,col) += mass * ((o * o) - (n * n)); objectInertia(row,col) += mass * ((o * o) - (n * n));
} }

View file

@ -196,7 +196,7 @@ namespace {
// Physics and collision constants // Physics and collision constants
static F32 sRestTol = 0.5; // % of gravity energy to be at rest static F32 sRestTol = 0.5; // % of gravity energy to be at rest
static int sRestCount = 10; // Consecutive ticks before comming to rest static S32 sRestCount = 10; // Consecutive ticks before comming to rest
const U32 sCollisionMoveMask = ( TerrainObjectType | PlayerObjectType | const U32 sCollisionMoveMask = ( TerrainObjectType | PlayerObjectType |
StaticShapeObjectType | VehicleObjectType | StaticShapeObjectType | VehicleObjectType |
@ -302,6 +302,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
if (!collisionDetails.size() || collisionDetails[0] == -1) if (!collisionDetails.size() || collisionDetails[0] == -1)
{ {
Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail"); Con::errorf("RigidShapeData::preload failed: Rigid shapes must define a collision-1 detail");
errorStr = String::ToString("RigidShapeData: Couldn't load shape \"%s\"",shapeName);
return false; return false;
} }
@ -1652,7 +1653,7 @@ void RigidShape::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState
GFX->getDrawUtil()->drawCube( desc, Point3F(0.1f,0.1f,0.1f), mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld ); GFX->getDrawUtil()->drawCube( desc, Point3F(0.1f,0.1f,0.1f), mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld );
// Collision points... // Collision points...
for (int i = 0; i < mCollisionList.getCount(); i++) for (S32 i = 0; i < mCollisionList.getCount(); i++)
{ {
const Collision& collision = mCollisionList[i]; const Collision& collision = mCollisionList[i];
GFX->getDrawUtil()->drawCube( desc, Point3F(0.05f,0.05f,0.05f), collision.point, ColorI(0, 0, 255) ); GFX->getDrawUtil()->drawCube( desc, Point3F(0.05f,0.05f,0.05f), collision.point, ColorI(0, 0, 255) );
@ -1660,7 +1661,7 @@ void RigidShape::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState
// Render the normals as one big batch... // Render the normals as one big batch...
PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2); PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2);
for (int i = 0; i < mCollisionList.getCount(); i++) for (S32 i = 0; i < mCollisionList.getCount(); i++)
{ {
const Collision& collision = mCollisionList[i]; const Collision& collision = mCollisionList[i];

View file

@ -195,7 +195,7 @@ class RigidShape: public ShapeBase
CollisionList mContacts; CollisionList mContacts;
Rigid mRigid; Rigid mRigid;
ShapeBaseConvex mConvex; ShapeBaseConvex mConvex;
int restCount; S32 restCount;
SimObjectPtr<ParticleEmitter> mDustEmitterList[RigidShapeData::VC_NUM_DUST_EMITTERS]; SimObjectPtr<ParticleEmitter> mDustEmitterList[RigidShapeData::VC_NUM_DUST_EMITTERS];
SimObjectPtr<ParticleEmitter> mSplashEmitterList[RigidShapeData::VC_NUM_SPLASH_EMITTERS]; SimObjectPtr<ParticleEmitter> mSplashEmitterList[RigidShapeData::VC_NUM_SPLASH_EMITTERS];

View file

@ -306,7 +306,10 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShape.getPath()); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShape.getPath());
if (!fileRef) if (!fileRef)
{
errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"",shapeName);
return false; return false;
}
if(server) if(server)
mCRC = fileRef->getChecksum(); mCRC = fileRef->getChecksum();
@ -898,17 +901,9 @@ ShapeBase::ShapeBase()
mCloakLevel( 0.0f ), mCloakLevel( 0.0f ),
mDamageFlash( 0.0f ), mDamageFlash( 0.0f ),
mWhiteOut( 0.0f ), mWhiteOut( 0.0f ),
mInvincibleEffect( 0.0f ),
mInvincibleDelta( 0.0f ),
mInvincibleCount( 0.0f ),
mInvincibleSpeed( 0.0f ),
mInvincibleTime( 0.0f ),
mInvincibleFade( 0.1f ),
mInvincibleOn( false ),
mIsControlled( false ), mIsControlled( false ),
mConvexList( new Convex ), mConvexList( new Convex ),
mCameraFov( 90.0f ), mCameraFov( 90.0f ),
mShieldNormal( 0.0f, 0.0f, 1.0f ),
mFadeOut( true ), mFadeOut( true ),
mFading( false ), mFading( false ),
mFadeVal( 1.0f ), mFadeVal( 1.0f ),
@ -1282,7 +1277,7 @@ void ShapeBase::processTick(const Move* move)
{ {
mMoveMotion = true; mMoveMotion = true;
} }
for (int i = 0; i < MaxMountedImages; i++) for (S32 i = 0; i < MaxMountedImages; i++)
{ {
setImageMotionState(i, mMoveMotion); setImageMotionState(i, mMoveMotion);
} }
@ -1305,7 +1300,7 @@ void ShapeBase::processTick(const Move* move)
// Advance images // Advance images
if (isServerObject()) if (isServerObject())
{ {
for (int i = 0; i < MaxMountedImages; i++) for (S32 i = 0; i < MaxMountedImages; i++)
{ {
if (mMountedImageList[i].dataBlock) if (mMountedImageList[i].dataBlock)
updateImageState(i, TickSec); updateImageState(i, TickSec);
@ -1347,7 +1342,7 @@ void ShapeBase::advanceTime(F32 dt)
// advanced at framerate. // advanced at framerate.
advanceThreads(dt); advanceThreads(dt);
updateAudioPos(); updateAudioPos();
for (int i = 0; i < MaxMountedImages; i++) for (S32 i = 0; i < MaxMountedImages; i++)
if (mMountedImageList[i].dataBlock) if (mMountedImageList[i].dataBlock)
{ {
updateImageState(i, dt); updateImageState(i, dt);
@ -1382,9 +1377,6 @@ void ShapeBase::advanceTime(F32 dt)
mCloakLevel = 0.0; mCloakLevel = 0.0;
} }
} }
if(mInvincibleOn)
updateInvincibleEffect(dt);
if(mFading) if(mFading)
{ {
mFadeElapsedTime += dt; mFadeElapsedTime += dt;
@ -1987,119 +1979,6 @@ void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
mat->mul( gCamFXMgr.getTrans() ); mat->mul( gCamFXMgr.getTrans() );
} }
// void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
// {
// // Returns camera to world space transform
// // Handles first person / third person camera position
// if (isServerObject() && mShapeInstance)
// mShapeInstance->animateNodeSubtrees(true);
// if (*pos != 0) {
// F32 min,max;
// Point3F offset;
// MatrixF eye,rot;
// getCameraParameters(&min,&max,&offset,&rot);
// getRenderEyeTransform(&eye);
// mat->mul(eye,rot);
// // Use the eye transform to orient the camera
// VectorF vp,vec;
// vp.x = vp.z = 0;
// vp.y = -(max - min) * *pos;
// eye.mulV(vp,&vec);
// // Use the camera node's pos.
// Point3F osp,sp;
// if (mDataBlock->cameraNode != -1) {
// mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp);
// getRenderTransform().mulP(osp,&sp);
// }
// else
// getRenderTransform().getColumn(3,&sp);
// // Make sure we don't extend the camera into anything solid
// Point3F ep = sp + vec;
// ep += offset;
// disableCollision();
// if (isMounted())
// getObjectMount()->disableCollision();
// RayInfo collision;
// if (mContainer->castRay(sp,ep,(0xFFFFFFFF & ~(WaterObjectType|ForceFieldObjectType|GameBaseObjectType|DefaultObjectType)),&collision)) {
// *pos = collision.t *= 0.9;
// if (*pos == 0)
// eye.getColumn(3,&ep);
// else
// ep = sp + vec * *pos;
// }
// mat->setColumn(3,ep);
// if (isMounted())
// getObjectMount()->enableCollision();
// enableCollision();
// }
// else
// {
// getRenderEyeTransform(mat);
// }
// }
// void ShapeBase::getRenderCameraTransform(F32* pos,MatrixF* mat)
// {
// // Returns camera to world space transform
// // Handles first person / third person camera position
// if (isServerObject() && mShapeInstance)
// mShapeInstance->animateNodeSubtrees(true);
// if (*pos != 0) {
// F32 min,max;
// Point3F offset;
// MatrixF eye,rot;
// getCameraParameters(&min,&max,&offset,&rot);
// getRenderEyeTransform(&eye);
// mat->mul(eye,rot);
// // Use the eye transform to orient the camera
// VectorF vp,vec;
// vp.x = vp.z = 0;
// vp.y = -(max - min) * *pos;
// eye.mulV(vp,&vec);
// // Use the camera node's pos.
// Point3F osp,sp;
// if (mDataBlock->cameraNode != -1) {
// mShapeInstance->mNodeTransforms[mDataBlock->cameraNode].getColumn(3,&osp);
// getRenderTransform().mulP(osp,&sp);
// }
// else
// getRenderTransform().getColumn(3,&sp);
// // Make sure we don't extend the camera into anything solid
// Point3F ep = sp + vec;
// ep += offset;
// disableCollision();
// if (isMounted())
// getObjectMount()->disableCollision();
// RayInfo collision;
// if (mContainer->castRay(sp,ep,(0xFFFFFFFF & ~(WaterObjectType|ForceFieldObjectType|GameBaseObjectType|DefaultObjectType)),&collision)) {
// *pos = collision.t *= 0.9;
// if (*pos == 0)
// eye.getColumn(3,&ep);
// else
// ep = sp + vec * *pos;
// }
// mat->setColumn(3,ep);
// if (isMounted())
// getObjectMount()->enableCollision();
// enableCollision();
// }
// else
// {
// getRenderEyeTransform(mat);
// }
// }
void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot) void ShapeBase::getCameraParameters(F32 *min,F32* max,Point3F* off,MatrixF* rot)
{ {
*min = mDataBlock->cameraMinDist; *min = mDataBlock->cameraMinDist;
@ -2153,52 +2032,6 @@ bool ShapeBase::useObjsEyePoint() const
return mDataBlock->useEyePoint; return mDataBlock->useEyePoint;
} }
//----------------------------------------------------------------------------
F32 ShapeBase::getInvincibleEffect() const
{
return mInvincibleEffect;
}
void ShapeBase::setupInvincibleEffect(F32 time, F32 speed)
{
if(isClientObject())
{
mInvincibleCount = mInvincibleTime = time;
mInvincibleSpeed = mInvincibleDelta = speed;
mInvincibleEffect = 0.0f;
mInvincibleOn = true;
mInvincibleFade = 1.0f;
}
else
{
mInvincibleTime = time;
mInvincibleSpeed = speed;
setMaskBits(InvincibleMask);
}
}
void ShapeBase::updateInvincibleEffect(F32 dt)
{
if(mInvincibleCount > 0.0f )
{
if(mInvincibleEffect >= ((0.3 * mInvincibleFade) + 0.05f) && mInvincibleDelta > 0.0f)
mInvincibleDelta = -mInvincibleSpeed;
else if(mInvincibleEffect <= 0.05f && mInvincibleDelta < 0.0f)
{
mInvincibleDelta = mInvincibleSpeed;
mInvincibleFade = mInvincibleCount / mInvincibleTime;
}
mInvincibleEffect += mInvincibleDelta;
mInvincibleCount -= dt;
}
else
{
mInvincibleEffect = 0.0f;
mInvincibleOn = false;
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ShapeBase::setVelocity(const VectorF&) void ShapeBase::setVelocity(const VectorF&)
{ {
@ -2240,7 +2073,7 @@ void ShapeBase::stopAudio(U32 slot)
void ShapeBase::updateServerAudio() void ShapeBase::updateServerAudio()
{ {
// Timeout non-looping sounds // Timeout non-looping sounds
for (int i = 0; i < MaxSoundThreads; i++) { for (S32 i = 0; i < MaxSoundThreads; i++) {
Sound& st = mSoundThread[i]; Sound& st = mSoundThread[i];
if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) { if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) {
clearMaskBits(SoundMaskN << i); clearMaskBits(SoundMaskN << i);
@ -2280,7 +2113,7 @@ void ShapeBase::updateAudioState(Sound& st)
void ShapeBase::updateAudioPos() void ShapeBase::updateAudioPos()
{ {
for (int i = 0; i < MaxSoundThreads; i++) for (S32 i = 0; i < MaxSoundThreads; i++)
{ {
SFXSource* source = mSoundThread[i].sound; SFXSource* source = mSoundThread[i].sound;
if ( source ) if ( source )
@ -3102,8 +2935,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
} }
if(!stream->writeFlag(mask & (NameMask | DamageMask | SoundMask | MeshHiddenMask | if(!stream->writeFlag(mask & (NameMask | DamageMask | SoundMask | MeshHiddenMask |
ThreadMask | ImageMask | CloakMask | InvincibleMask | ThreadMask | ImageMask | CloakMask | SkinMask)))
ShieldMask | SkinMask)))
return retMask; return retMask;
if (stream->writeFlag(mask & DamageMask)) { if (stream->writeFlag(mask & DamageMask)) {
@ -3113,7 +2945,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
} }
if (stream->writeFlag(mask & ThreadMask)) { if (stream->writeFlag(mask & ThreadMask)) {
for (int i = 0; i < MaxScriptThreads; i++) { for (S32 i = 0; i < MaxScriptThreads; i++) {
Thread& st = mScriptThread[i]; Thread& st = mScriptThread[i];
if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) { if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) {
stream->writeInt(st.sequence,ThreadSequenceBits); stream->writeInt(st.sequence,ThreadSequenceBits);
@ -3126,7 +2958,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
} }
if (stream->writeFlag(mask & SoundMask)) { if (stream->writeFlag(mask & SoundMask)) {
for (int i = 0; i < MaxSoundThreads; i++) { for (S32 i = 0; i < MaxSoundThreads; i++) {
Sound& st = mSoundThread[i]; Sound& st = mSoundThread[i];
if (stream->writeFlag(mask & (SoundMaskN << i))) if (stream->writeFlag(mask & (SoundMaskN << i)))
if (stream->writeFlag(st.play)) if (stream->writeFlag(st.play))
@ -3136,7 +2968,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
} }
if (stream->writeFlag(mask & ImageMask)) { if (stream->writeFlag(mask & ImageMask)) {
for (int i = 0; i < MaxMountedImages; i++) for (S32 i = 0; i < MaxMountedImages; i++)
if (stream->writeFlag(mask & (ImageMaskN << i))) { if (stream->writeFlag(mask & (ImageMaskN << i))) {
MountedImage& image = mMountedImageList[i]; MountedImage& image = mMountedImageList[i];
if (stream->writeFlag(image.dataBlock)) if (stream->writeFlag(image.dataBlock))
@ -3158,9 +2990,9 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
stream->writeFlag(image.triggerDown); stream->writeFlag(image.triggerDown);
stream->writeFlag(image.altTriggerDown); stream->writeFlag(image.altTriggerDown);
for (U32 i=0; i<ShapeBaseImageData::MaxGenericTriggers; ++i) for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
{ {
stream->writeFlag(image.genericTrigger[i]); stream->writeFlag(image.genericTrigger[j]);
} }
stream->writeInt(image.fireCount,3); stream->writeInt(image.fireCount,3);
@ -3173,7 +3005,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
} }
// Group some of the uncommon stuff together. // Group some of the uncommon stuff together.
if (stream->writeFlag(mask & (NameMask | ShieldMask | CloakMask | InvincibleMask | SkinMask | MeshHiddenMask ))) { if (stream->writeFlag(mask & (NameMask | CloakMask | SkinMask | MeshHiddenMask ))) {
if (stream->writeFlag(mask & CloakMask)) if (stream->writeFlag(mask & CloakMask))
{ {
@ -3194,14 +3026,6 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
if (stream->writeFlag(mask & NameMask)) { if (stream->writeFlag(mask & NameMask)) {
con->packNetStringHandleU(stream, mShapeNameHandle); con->packNetStringHandleU(stream, mShapeNameHandle);
} }
if (stream->writeFlag(mask & ShieldMask)) {
stream->writeNormalVector(mShieldNormal, ShieldNormalBits);
stream->writeFloat( getEnergyValue(), EnergyLevelBits );
}
if (stream->writeFlag(mask & InvincibleMask)) {
stream->write(mInvincibleTime);
stream->write(mInvincibleSpeed);
}
if ( stream->writeFlag( mask & MeshHiddenMask ) ) if ( stream->writeFlag( mask & MeshHiddenMask ) )
stream->writeBits( mMeshHidden ); stream->writeBits( mMeshHidden );
@ -3271,7 +3095,7 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
// Mounted Images // Mounted Images
if (stream->readFlag()) { if (stream->readFlag()) {
for (int i = 0; i < MaxMountedImages; i++) { for (S32 i = 0; i < MaxMountedImages; i++) {
if (stream->readFlag()) { if (stream->readFlag()) {
MountedImage& image = mMountedImageList[i]; MountedImage& image = mMountedImageList[i];
ShapeBaseImageData* imageData = 0; ShapeBaseImageData* imageData = 0;
@ -3303,14 +3127,14 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
image.triggerDown = stream->readFlag(); image.triggerDown = stream->readFlag();
image.altTriggerDown = stream->readFlag(); image.altTriggerDown = stream->readFlag();
for (U32 i=0; i<ShapeBaseImageData::MaxGenericTriggers; ++i) for (U32 j=0; j<ShapeBaseImageData::MaxGenericTriggers; ++j)
{ {
image.genericTrigger[i] = stream->readFlag(); image.genericTrigger[j] = stream->readFlag();
} }
int count = stream->readInt(3); S32 count = stream->readInt(3);
int altCount = stream->readInt(3); S32 altCount = stream->readInt(3);
int reloadCount = stream->readInt(3); S32 reloadCount = stream->readInt(3);
bool datablockChange = image.dataBlock != imageData; bool datablockChange = image.dataBlock != imageData;
if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle)) if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
@ -3443,25 +3267,6 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
if (stream->readFlag()) { // NameMask if (stream->readFlag()) { // NameMask
mShapeNameHandle = con->unpackNetStringHandleU(stream); mShapeNameHandle = con->unpackNetStringHandleU(stream);
} }
if(stream->readFlag()) // ShieldMask
{
// Cloaking, Shield, and invul masking
Point3F shieldNormal;
stream->readNormalVector(&shieldNormal, ShieldNormalBits);
// CodeReview [bjg 4/6/07] This is our energy level - why aren't we storing it? Was in a
// local variable called energyPercent.
stream->readFloat(EnergyLevelBits);
}
if (stream->readFlag())
{
// InvincibleMask
F32 time, speed;
stream->read(&time);
stream->read(&speed);
setupInvincibleEffect(time, speed);
}
if ( stream->readFlag() ) // MeshHiddenMask if ( stream->readFlag() ) // MeshHiddenMask
{ {
@ -3742,7 +3547,7 @@ void ShapeBase::reSkin()
Vector<String> skins; Vector<String> skins;
String(mSkinNameHandle.getString()).split( ";", skins ); String(mSkinNameHandle.getString()).split( ";", skins );
for (int i = 0; i < skins.size(); i++) for (S32 i = 0; i < skins.size(); i++)
{ {
String oldSkin( mAppliedSkinName.c_str() ); String oldSkin( mAppliedSkinName.c_str() );
String newSkin( skins[i] ); String newSkin( skins[i] );
@ -4826,18 +4631,6 @@ DefineEngineMethod( ShapeBase, setCameraFov, void, ( F32 fov ),,
object->setCameraFov( fov ); object->setCameraFov( fov );
} }
DefineEngineMethod( ShapeBase, setInvincibleMode, void, ( F32 time, F32 speed ),,
"@brief Setup the invincible effect.\n\n"
"This effect is used for HUD feedback to the user that they are invincible.\n"
"@note Currently not implemented\n"
"@param time duration in seconds for the invincible effect\n"
"@param speed speed at which the invincible effect progresses\n" )
{
object->setupInvincibleEffect( time, speed );
}
DefineEngineMethod( ShapeBase, startFade, void, ( S32 time, S32 delay, bool fadeOut ),, DefineEngineMethod( ShapeBase, startFade, void, ( S32 time, S32 delay, bool fadeOut ),,
"@brief Fade the object in or out without removing it from the scene.\n\n" "@brief Fade the object in or out without removing it from the scene.\n\n"

View file

@ -689,7 +689,6 @@ public:
MaxMountedImages = 4, ///< Should be a power of 2 MaxMountedImages = 4, ///< Should be a power of 2
MaxImageEmitters = 3, MaxImageEmitters = 3,
NumImageBits = 3, NumImageBits = 3,
ShieldNormalBits = 8,
CollisionTimeoutValue = 250 ///< Timeout in ms. CollisionTimeoutValue = 250 ///< Timeout in ms.
}; };
@ -743,17 +742,6 @@ protected:
/// @} /// @}
/// @name Invincibility
/// @{
F32 mInvincibleCount;
F32 mInvincibleTime;
F32 mInvincibleSpeed;
F32 mInvincibleDelta;
F32 mInvincibleEffect;
F32 mInvincibleFade;
bool mInvincibleOn;
/// @}
/// @name Motion /// @name Motion
/// @{ /// @{
bool mMoveMotion; ///< Indicates that a Move has come in requesting x, y or z motion bool mMoveMotion; ///< Indicates that a Move has come in requesting x, y or z motion
@ -918,9 +906,6 @@ protected:
bool mFlipFadeVal; bool mFlipFadeVal;
/// Last shield direction (cur. unused)
Point3F mShieldNormal;
/// Camera shake caused by weapon fire. /// Camera shake caused by weapon fire.
CameraShake *mWeaponCamShake; CameraShake *mWeaponCamShake;
@ -1156,11 +1141,9 @@ public:
DamageMask = Parent::NextFreeMask << 1, DamageMask = Parent::NextFreeMask << 1,
NoWarpMask = Parent::NextFreeMask << 2, NoWarpMask = Parent::NextFreeMask << 2,
CloakMask = Parent::NextFreeMask << 3, CloakMask = Parent::NextFreeMask << 3,
ShieldMask = Parent::NextFreeMask << 4, SkinMask = Parent::NextFreeMask << 4,
InvincibleMask = Parent::NextFreeMask << 5, MeshHiddenMask = Parent::NextFreeMask << 5,
SkinMask = Parent::NextFreeMask << 6, SoundMaskN = Parent::NextFreeMask << 6, ///< Extends + MaxSoundThreads bits
MeshHiddenMask = Parent::NextFreeMask << 7,
SoundMaskN = Parent::NextFreeMask << 8, ///< Extends + MaxSoundThreads bits
ThreadMaskN = SoundMaskN << MaxSoundThreads, ///< Extends + MaxScriptThreads bits ThreadMaskN = SoundMaskN << MaxSoundThreads, ///< Extends + MaxScriptThreads bits
ImageMaskN = ThreadMaskN << MaxScriptThreads, ///< Extends + MaxMountedImage bits ImageMaskN = ThreadMaskN << MaxScriptThreads, ///< Extends + MaxMountedImage bits
NextFreeMask = ImageMaskN << MaxMountedImages NextFreeMask = ImageMaskN << MaxMountedImages
@ -1702,26 +1685,6 @@ public:
virtual void setWhiteOut(const F32); virtual void setWhiteOut(const F32);
/// @} /// @}
/// @name Invincibility effect
/// This is the screen effect when invincible in the HUD
/// @see GameRenderFilters()
/// @{
/// Returns the level of invincibility effect
virtual F32 getInvincibleEffect() const;
/// Initializes invincibility effect and interpolation parameters
///
/// @param time Time it takes to become invincible
/// @param speed Speed at which invincibility effects progress
virtual void setupInvincibleEffect(F32 time, F32 speed);
/// Advance invincibility effect animation
/// @param dt Time since last call of this function
virtual void updateInvincibleEffect(F32 dt);
/// @}
/// @name Movement & velocity /// @name Movement & velocity
/// @{ /// @{

View file

@ -203,7 +203,7 @@ ShapeBaseImageData::ShapeBaseImageData()
scriptAnimTransitionTime = 0.25f; scriptAnimTransitionTime = 0.25f;
// //
for (int i = 0; i < MaxStates; i++) { for (S32 i = 0; i < MaxStates; i++) {
stateName[i] = 0; stateName[i] = 0;
stateTransitionLoaded[i] = 0; stateTransitionLoaded[i] = 0;
@ -462,7 +462,10 @@ bool ShapeBaseImageData::preload(bool server, String &errorStr)
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(shape[i].getPath()); Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(shape[i].getPath());
if (!fileRef) if (!fileRef)
{
errorStr = String::ToString("ShapeBaseImageData: Couldn't load shape \"%s\"",name);
return false; return false;
}
if(server) if(server)
{ {
@ -3057,7 +3060,7 @@ TICKAGAIN:
if (image.spinThread[i]) if (image.spinThread[i])
{ {
float timeScale; F32 timeScale;
switch (stateData.spin) switch (stateData.spin)
{ {

View file

@ -188,7 +188,7 @@ bool Trigger::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
F32 const *si = &start.x; F32 const *si = &start.x;
F32 const *ei = &end.x; F32 const *ei = &end.x;
for (int i = 0; i < 3; i++) for (S32 i = 0; i < 3; i++)
{ {
if (*si < *ei) if (*si < *ei)
{ {

View file

@ -442,7 +442,7 @@ void TSStatic::reSkin()
Vector<String> skins; Vector<String> skins;
String(mSkinNameHandle.getString()).split( ";", skins ); String(mSkinNameHandle.getString()).split( ";", skins );
for (int i = 0; i < skins.size(); i++) for (S32 i = 0; i < skins.size(); i++)
{ {
String oldSkin( mAppliedSkinName.c_str() ); String oldSkin( mAppliedSkinName.c_str() );
String newSkin( skins[i] ); String newSkin( skins[i] );

View file

@ -99,7 +99,7 @@ AITurretShapeData::AITurretShapeData()
weaponLeadVelocity = 0; weaponLeadVelocity = 0;
for (int i = 0; i < MaxStates; i++) { for (S32 i = 0; i < MaxStates; i++) {
stateName[i] = 0; stateName[i] = 0;
stateTransitionAtRest[i] = 0; stateTransitionAtRest[i] = 0;
stateTransitionNotAtRest[i] = 0; stateTransitionNotAtRest[i] = 0;

View file

@ -69,7 +69,7 @@ const F32 sVehicleGravity = -20;
// Physics and collision constants // Physics and collision constants
static F32 sRestTol = 0.5; // % of gravity energy to be at rest static F32 sRestTol = 0.5; // % of gravity energy to be at rest
static int sRestCount = 10; // Consecutive ticks before comming to rest static S32 sRestCount = 10; // Consecutive ticks before comming to rest
} // namespace {} } // namespace {}
@ -218,6 +218,7 @@ bool VehicleData::preload(bool server, String &errorStr)
if (!collisionDetails.size() || collisionDetails[0] == -1) if (!collisionDetails.size() || collisionDetails[0] == -1)
{ {
Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail"); Con::errorf("VehicleData::preload failed: Vehicle models must define a collision-1 detail");
errorStr = String::ToString("VehicleData: Couldn't load shape \"%s\"",shapeName);
return false; return false;
} }
@ -341,14 +342,14 @@ void VehicleData::packData(BitStream* stream)
} }
} }
for (int j = 0; j < VC_NUM_DAMAGE_EMITTER_AREAS; j++) for (S32 j = 0; j < VC_NUM_DAMAGE_EMITTER_AREAS; j++)
{ {
stream->write( damageEmitterOffset[j].x ); stream->write( damageEmitterOffset[j].x );
stream->write( damageEmitterOffset[j].y ); stream->write( damageEmitterOffset[j].y );
stream->write( damageEmitterOffset[j].z ); stream->write( damageEmitterOffset[j].z );
} }
for (int k = 0; k < VC_NUM_DAMAGE_LEVELS; k++) for (S32 k = 0; k < VC_NUM_DAMAGE_LEVELS; k++)
{ {
stream->write( damageLevelTolerance[k] ); stream->write( damageLevelTolerance[k] );
} }
@ -440,14 +441,14 @@ void VehicleData::unpackData(BitStream* stream)
} }
} }
for( int j=0; j<VC_NUM_DAMAGE_EMITTER_AREAS; j++ ) for( S32 j=0; j<VC_NUM_DAMAGE_EMITTER_AREAS; j++ )
{ {
stream->read( &damageEmitterOffset[j].x ); stream->read( &damageEmitterOffset[j].x );
stream->read( &damageEmitterOffset[j].y ); stream->read( &damageEmitterOffset[j].y );
stream->read( &damageEmitterOffset[j].z ); stream->read( &damageEmitterOffset[j].z );
} }
for( int k=0; k<VC_NUM_DAMAGE_LEVELS; k++ ) for( S32 k=0; k<VC_NUM_DAMAGE_LEVELS; k++ )
{ {
stream->read( &damageLevelTolerance[k] ); stream->read( &damageLevelTolerance[k] );
} }
@ -718,7 +719,7 @@ bool Vehicle::onAdd()
{ {
if( mDataBlock->dustEmitter ) if( mDataBlock->dustEmitter )
{ {
for( int i=0; i<VehicleData::VC_NUM_DUST_EMITTERS; i++ ) for( S32 i=0; i<VehicleData::VC_NUM_DUST_EMITTERS; i++ )
{ {
mDustEmitterList[i] = new ParticleEmitter; mDustEmitterList[i] = new ParticleEmitter;
mDustEmitterList[i]->onNewDataBlock( mDataBlock->dustEmitter, false ); mDustEmitterList[i]->onNewDataBlock( mDataBlock->dustEmitter, false );
@ -1804,7 +1805,7 @@ void Vehicle::updateDamageSmoke( F32 dt )
F32 damagePercent = mDamage / mDataBlock->maxDamage; F32 damagePercent = mDamage / mDataBlock->maxDamage;
if( damagePercent >= mDataBlock->damageLevelTolerance[j] ) if( damagePercent >= mDataBlock->damageLevelTolerance[j] )
{ {
for( int i=0; i<mDataBlock->numDmgEmitterAreas; i++ ) for( S32 i=0; i<mDataBlock->numDmgEmitterAreas; i++ )
{ {
MatrixF trans = getTransform(); MatrixF trans = getTransform();
Point3F offset = mDataBlock->damageEmitterOffset[i]; Point3F offset = mDataBlock->damageEmitterOffset[i];
@ -1935,7 +1936,7 @@ void Vehicle::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState *st
GFX->getDrawUtil()->drawCube(desc, Point3F(0.1f,0.1f,0.1f),mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld); GFX->getDrawUtil()->drawCube(desc, Point3F(0.1f,0.1f,0.1f),mDataBlock->massCenter, ColorI(255, 255, 255), &mRenderObjToWorld);
// Now render all the contact points. // Now render all the contact points.
for (int i = 0; i < mCollisionList.getCount(); i++) for (S32 i = 0; i < mCollisionList.getCount(); i++)
{ {
const Collision& collision = mCollisionList[i]; const Collision& collision = mCollisionList[i];
GFX->getDrawUtil()->drawCube(desc, Point3F(0.05f,0.05f,0.05f),collision.point, ColorI(0, 0, 255)); GFX->getDrawUtil()->drawCube(desc, Point3F(0.05f,0.05f,0.05f),collision.point, ColorI(0, 0, 255));
@ -1943,7 +1944,7 @@ void Vehicle::_renderMassAndContacts( ObjectRenderInst *ri, SceneRenderState *st
// Finally render the normals as one big batch. // Finally render the normals as one big batch.
PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2); PrimBuild::begin(GFXLineList, mCollisionList.getCount() * 2);
for (int i = 0; i < mCollisionList.getCount(); i++) for (S32 i = 0; i < mCollisionList.getCount(); i++)
{ {
const Collision& collision = mCollisionList[i]; const Collision& collision = mCollisionList[i];
PrimBuild::color3f(1, 1, 1); PrimBuild::color3f(1, 1, 1);

View file

@ -202,7 +202,7 @@ class Vehicle: public ShapeBase
CollisionList mContacts; CollisionList mContacts;
Rigid mRigid; Rigid mRigid;
ShapeBaseConvex mConvex; ShapeBaseConvex mConvex;
int restCount; S32 restCount;
SimObjectPtr<ParticleEmitter> mDustEmitterList[VehicleData::VC_NUM_DUST_EMITTERS]; SimObjectPtr<ParticleEmitter> mDustEmitterList[VehicleData::VC_NUM_DUST_EMITTERS];
SimObjectPtr<ParticleEmitter> mDamageEmitterList[VehicleData::VC_NUM_DAMAGE_EMITTERS]; SimObjectPtr<ParticleEmitter> mDamageEmitterList[VehicleData::VC_NUM_DAMAGE_EMITTERS];

View file

@ -298,7 +298,7 @@ void HTTPObject::onDisconnect()
Parent::onDisconnect(); Parent::onDisconnect();
} }
bool HTTPObject::processLine(U8 *line) bool HTTPObject::processLine(UTF8 *line)
{ {
if(mParseState == ParsingStatusLine) if(mParseState == ParsingStatusLine)
{ {

View file

@ -72,7 +72,7 @@ public:
virtual void onConnected(); virtual void onConnected();
virtual void onConnectFailed(); virtual void onConnectFailed();
virtual void onDisconnect(); virtual void onDisconnect();
bool processLine(U8 *line); bool processLine(UTF8 *line);
DECLARE_CONOBJECT(HTTPObject); DECLARE_CONOBJECT(HTTPObject);
}; };

View file

@ -421,7 +421,7 @@ DefineEngineMethod(TCPObject, send, void, (const char *data),,
object->send( (const U8*)data, dStrlen(data) ); object->send( (const U8*)data, dStrlen(data) );
} }
DefineEngineMethod(TCPObject, listen, void, (int port),, DefineEngineMethod(TCPObject, listen, void, (U32 port),,
"@brief Start listening on the specified port for connections.\n\n" "@brief Start listening on the specified port for connections.\n\n"
"This method starts a listener which looks for incoming TCP connections to a port. " "This method starts a listener which looks for incoming TCP connections to a port. "

View file

@ -41,10 +41,10 @@
/// code version, the game name, and which type of game it is (TGB, TGE, TGEA, etc.). /// code version, the game name, and which type of game it is (TGB, TGE, TGEA, etc.).
/// ///
/// Version number is major * 1000 + minor * 100 + revision * 10. /// Version number is major * 1000 + minor * 100 + revision * 10.
#define TORQUE_GAME_ENGINE 3500 #define TORQUE_GAME_ENGINE 3501
/// Human readable engine version string. /// Human readable engine version string.
#define TORQUE_GAME_ENGINE_VERSION_STRING "3.5" #define TORQUE_GAME_ENGINE_VERSION_STRING "3.5.1"
/// Gets the engine version number. The version number is specified as a global in version.cc /// Gets the engine version number. The version number is specified as a global in version.cc
U32 getVersionNumber(); U32 getVersionNumber();

View file

@ -43,7 +43,7 @@ extern "C" {
return so->getClassName(); return so->getClassName();
} }
void *SimObject_GetFieldList(SimObject *so, int &outNumFields) void *SimObject_GetFieldList(SimObject *so, S32 &outNumFields)
{ {
const AbstractClassRep::FieldList &fl = so->getFieldList(); const AbstractClassRep::FieldList &fl = so->getFieldList();
outNumFields = fl.size(); outNumFields = fl.size();

View file

@ -29,7 +29,7 @@
// External scripting cinterface, suitable for import into any scripting system which support "C" interfaces (C#, Python, Lua, Java, etc) // External scripting cinterface, suitable for import into any scripting system which support "C" interfaces (C#, Python, Lua, Java, etc)
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
#include "windowManager/win32/win32Window.h" #include "windowManager/win32/win32Window.h"
#include "windowManager/win32/winDispatch.h" #include "windowManager/win32/winDispatch.h"
#endif #endif
@ -164,7 +164,7 @@ extern "C" {
return false; return false;
} }
void script_simobject_setfield_int(U32 objectId, const char* fieldName, int v) void script_simobject_setfield_int(U32 objectId, const char* fieldName, S32 v)
{ {
SimObject *object = Sim::findObject( objectId ); SimObject *object = Sim::findObject( objectId );
if( object ) if( object )
@ -222,7 +222,7 @@ extern "C" {
{ {
// maxArgs improper on a number of console function/methods // maxArgs improper on a number of console function/methods
if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs) if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs)
return ""; return false;
SimObject* o = NULL; SimObject* o = NULL;
@ -230,7 +230,7 @@ extern "C" {
{ {
o = Sim::findObject(dAtoi(argv[1])); o = Sim::findObject(dAtoi(argv[1]));
if (!o) if (!o)
return ""; return false;
} }
return entry->cb.mBoolCallbackFunc(o, argc, argv); return entry->cb.mBoolCallbackFunc(o, argc, argv);
@ -291,12 +291,12 @@ extern "C" {
entry->cb.mVoidCallbackFunc(o, argc, argv); entry->cb.mVoidCallbackFunc(o, argc, argv);
} }
int script_simobject_get_id(SimObject* so) S32 script_simobject_get_id(SimObject* so)
{ {
return so->getId(); return so->getId();
} }
int script_simobject_find(const char* classname, const char* name) S32 script_simobject_find(const char* classname, const char* name)
{ {
SimObject *object; SimObject *object;
if( Sim::findObject( name, object ) ) if( Sim::findObject( name, object ) )
@ -383,9 +383,9 @@ extern "C" {
} }
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
void script_input_event(int type, int value1, int value2) void script_input_event(S32 type, S32 value1, S32 value2)
{ {
if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow()) if (PlatformWindowManager::get() && PlatformWindowManager::get()->getFirstWindow())
{ {

View file

@ -29,7 +29,7 @@
#include "windowManager/platformWindow.h" #include "windowManager/platformWindow.h"
#include "windowManager/platformWindowMgr.h" #include "windowManager/platformWindowMgr.h"
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
#include "windowManager/win32/win32Window.h" #include "windowManager/win32/win32Window.h"
#include "windowManager/win32/winDispatch.h" #include "windowManager/win32/winDispatch.h"
extern void createFontInit(void); extern void createFontInit(void);
@ -37,7 +37,7 @@ extern void createFontShutdown(void);
#endif #endif
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) #if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
extern INT CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo); extern S32 CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo);
#endif #endif
static HashTable<StringTableEntry,StringTableEntry> gSecureScript; static HashTable<StringTableEntry,StringTableEntry> gSecureScript;
@ -47,7 +47,7 @@ static HashTable<StringTableEntry,StringTableEntry> gSecureScript;
// ObjC hooks for shared library support // ObjC hooks for shared library support
// See: macMain.mm // See: macMain.mm
void torque_mac_engineinit(int argc, const char **argv); void torque_mac_engineinit(S32 argc, const char **argv);
void torque_mac_enginetick(); void torque_mac_enginetick();
void torque_mac_engineshutdown(); void torque_mac_engineshutdown();
@ -64,7 +64,7 @@ extern "C" {
} }
// initialize Torque 3D including argument handling // initialize Torque 3D including argument handling
int torque_engineinit(S32 argc, const char **argv) S32 torque_engineinit(S32 argc, const char **argv)
{ {
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) #if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
@ -105,7 +105,7 @@ extern "C" {
} }
// tick Torque 3D's main loop // tick Torque 3D's main loop
int torque_enginetick() S32 torque_enginetick()
{ {
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) #if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
@ -139,7 +139,7 @@ extern "C" {
} }
// shutdown the engine // shutdown the engine
int torque_engineshutdown() S32 torque_engineshutdown()
{ {
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE ) #if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
@ -181,7 +181,7 @@ extern "C" {
} }
int torque_getconsolebool(const char* name) S32 torque_getconsolebool(const char* name)
{ {
return Con::getBoolVariable(name); return Con::getBoolVariable(name);
} }
@ -303,7 +303,7 @@ extern "C" {
Namespace::Entry* entry = GetEntry(nameSpace, name); Namespace::Entry* entry = GetEntry(nameSpace, name);
if (!entry) if (!entry)
return ""; return false;
return entry->cb.mBoolCallbackFunc(NULL, argc, argv); return entry->cb.mBoolCallbackFunc(NULL, argc, argv);
} }
@ -415,7 +415,7 @@ extern "C" {
PlatformWindowManager::get()->getFirstWindow()->setSize(Point2I(width,height)); PlatformWindowManager::get()->getFirstWindow()->setSize(Point2I(width,height));
} }
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
// retrieve the hwnd of our render window // retrieve the hwnd of our render window
void* torque_gethwnd() void* torque_gethwnd()
{ {

View file

@ -96,7 +96,7 @@ public:
} }
// Accessors // Accessors
int getCount() const { return mCount; } S32 getCount() const { return mCount; }
F32 getTime() const { return mT; } F32 getTime() const { return mT; }
F32 getMaxHeight() const { return mMaxHeight; } F32 getMaxHeight() const { return mMaxHeight; }

View file

@ -69,21 +69,21 @@ void GjkCollisionState::swap()
void GjkCollisionState::compute_det() void GjkCollisionState::compute_det()
{ {
// Dot new point with current set // Dot new point with current set
for (int i = 0, bit = 1; i < 4; ++i, bit <<=1) for (S32 i = 0, bit = 1; i < 4; ++i, bit <<=1)
if (bits & bit) if (bits & bit)
dp[i][last] = dp[last][i] = mDot(y[i], y[last]); dp[i][last] = dp[last][i] = mDot(y[i], y[last]);
dp[last][last] = mDot(y[last], y[last]); dp[last][last] = mDot(y[last], y[last]);
// Calulate the determinent // Calulate the determinent
det[last_bit][last] = 1; det[last_bit][last] = 1;
for (int j = 0, sj = 1; j < 4; ++j, sj <<= 1) { for (S32 j = 0, sj = 1; j < 4; ++j, sj <<= 1) {
if (bits & sj) { if (bits & sj) {
int s2 = sj | last_bit; S32 s2 = sj | last_bit;
det[s2][j] = dp[last][last] - dp[last][j]; det[s2][j] = dp[last][last] - dp[last][j];
det[s2][last] = dp[j][j] - dp[j][last]; det[s2][last] = dp[j][j] - dp[j][last];
for (int k = 0, sk = 1; k < j; ++k, sk <<= 1) { for (S32 k = 0, sk = 1; k < j; ++k, sk <<= 1) {
if (bits & sk) { if (bits & sk) {
int s3 = sk | s2; S32 s3 = sk | s2;
det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) + det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) +
det[s2][last] * (dp[last][j] - dp[last][k]); det[s2][last] * (dp[last][j] - dp[last][k]);
det[s3][j] = det[sk | last_bit][k] * (dp[k][k] - dp[k][j]) + det[s3][j] = det[sk | last_bit][k] * (dp[k][k] - dp[k][j]) +
@ -114,11 +114,11 @@ void GjkCollisionState::compute_det()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline void GjkCollisionState::compute_vector(int bits, VectorF& v) inline void GjkCollisionState::compute_vector(S32 bits, VectorF& v)
{ {
F32 sum = 0; F32 sum = 0;
v.set(0, 0, 0); v.set(0, 0, 0);
for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) {
if (bits & bit) { if (bits & bit) {
sum += det[bits][i]; sum += det[bits][i];
v += y[i] * det[bits][i]; v += y[i] * det[bits][i];
@ -130,9 +130,9 @@ inline void GjkCollisionState::compute_vector(int bits, VectorF& v)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
inline bool GjkCollisionState::valid(int s) inline bool GjkCollisionState::valid(S32 s)
{ {
for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) {
if (all_bits & bit) { if (all_bits & bit) {
if (s & bit) { if (s & bit) {
if (det[s][i] <= 0) if (det[s][i] <= 0)
@ -152,7 +152,7 @@ inline bool GjkCollisionState::valid(int s)
inline bool GjkCollisionState::closest(VectorF& v) inline bool GjkCollisionState::closest(VectorF& v)
{ {
compute_det(); compute_det();
for (int s = bits; s; --s) { for (S32 s = bits; s; --s) {
if ((s & bits) == s) { if ((s & bits) == s) {
if (valid(s | last_bit)) { if (valid(s | last_bit)) {
bits = s | last_bit; bits = s | last_bit;
@ -175,7 +175,7 @@ inline bool GjkCollisionState::closest(VectorF& v)
inline bool GjkCollisionState::degenerate(const VectorF& w) inline bool GjkCollisionState::degenerate(const VectorF& w)
{ {
for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1)
if ((all_bits & bit) && y[i] == w) if ((all_bits & bit) && y[i] == w)
return true; return true;
return false; return false;
@ -256,7 +256,7 @@ void GjkCollisionState::getClosestPoints(Point3F& p1, Point3F& p2)
F32 sum = 0; F32 sum = 0;
p1.set(0, 0, 0); p1.set(0, 0, 0);
p2.set(0, 0, 0); p2.set(0, 0, 0);
for (int i = 0, bit = 1; i < 4; ++i, bit <<= 1) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) {
if (bits & bit) { if (bits & bit) {
sum += det[bits][i]; sum += det[bits][i];
p1 += p[i] * det[bits][i]; p1 += p[i] * det[bits][i];

View file

@ -58,8 +58,8 @@ struct GjkCollisionState: public CollisionState
/// ///
void compute_det(); void compute_det();
bool valid(int s); bool valid(S32 s);
void compute_vector(int bits, VectorF& v); void compute_vector(S32 bits, VectorF& v);
bool closest(VectorF& v); bool closest(VectorF& v);
bool degenerate(const VectorF& w); bool degenerate(const VectorF& w);
void nextBit(); void nextBit();

View file

@ -280,7 +280,7 @@ bool Polytope::intersect(const PlaneF& plane,const Point3F& sp,const Point3F& ep
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void Polytope::extrudeFace(int faceIdx,const VectorF& vec,Polytope* out) void Polytope::extrudeFace(S32 faceIdx,const VectorF& vec,Polytope* out)
{ {
// Assumes the face belongs to the first volume. // Assumes the face belongs to the first volume.
out->mVertexList.clear(); out->mVertexList.clear();
@ -373,7 +373,7 @@ bool Polytope::findCollision(const VectorF& vec,Polytope::Collision *best)
return false; return false;
if (!best->object) if (!best->object)
best->distance = 1.0E30f; best->distance = 1.0E30f;
int bestVertex = -1; S32 bestVertex = -1;
Polytope::Volume* bestVolume = NULL; Polytope::Volume* bestVolume = NULL;
sideCount++; sideCount++;

View file

@ -102,7 +102,7 @@ public:
void buildBox(const MatrixF& transform,const Box3F& box); void buildBox(const MatrixF& transform,const Box3F& box);
void intersect(SimObject*, const BSPNode* node); void intersect(SimObject*, const BSPNode* node);
inline bool didIntersect() { return mVolumeList.size() > 1; } inline bool didIntersect() { return mVolumeList.size() > 1; }
void extrudeFace(int fi,const VectorF& vec,Polytope* out); void extrudeFace(S32 fi,const VectorF& vec,Polytope* out);
bool findCollision(const VectorF& vec,Polytope::Collision *best); bool findCollision(const VectorF& vec,Polytope::Collision *best);
}; };

View file

@ -139,7 +139,7 @@ const char *DynamicConsoleMethodComponent::_callMethod( U32 argc, const char *ar
if( getComponentCount() > 0 ) if( getComponentCount() > 0 )
{ {
lockComponentList(); lockComponentList();
for( int i = getComponentCount() - 1; i >= 0; i-- ) for( S32 i = getComponentCount() - 1; i >= 0; i-- )
//for( SimComponentIterator nItr = componentList.end(); nItr != componentList.begin(); nItr-- ) //for( SimComponentIterator nItr = componentList.end(); nItr != componentList.begin(); nItr-- )
{ {
argv[0] = cbName; argv[0] = cbName;

View file

@ -1910,8 +1910,7 @@ extern int isatty (int );
b->yy_bs_column = 0; b->yy_bs_column = 0;
} }
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
errno = oerrno; errno = oerrno;
} }
@ -2355,7 +2354,7 @@ void CMDerror(char *format, ...)
char tempBuf[BUFMAX]; char tempBuf[BUFMAX];
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
_vsnprintf( tempBuf, BUFMAX, format, args ); _vsnprintf( tempBuf, BUFMAX, format, args );
#else #else
vsnprintf( tempBuf, BUFMAX, format, args ); vsnprintf( tempBuf, BUFMAX, format, args );

View file

@ -245,7 +245,7 @@ void CMDerror(char *format, ...)
char tempBuf[BUFMAX]; char tempBuf[BUFMAX];
va_list args; va_list args;
va_start( args, format ); va_start( args, format );
#ifdef TORQUE_OS_WIN32 #ifdef TORQUE_OS_WIN
_vsnprintf( tempBuf, BUFMAX, format, args ); _vsnprintf( tempBuf, BUFMAX, format, args );
#else #else
vsnprintf( tempBuf, BUFMAX, format, args ); vsnprintf( tempBuf, BUFMAX, format, args );

View file

@ -348,7 +348,7 @@ bool SimXMLDocument::pushFirstChildElement(const char* rName)
TiXmlElement* pElement; TiXmlElement* pElement;
if(!m_paNode.empty()) if(!m_paNode.empty())
{ {
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -412,7 +412,7 @@ bool SimXMLDocument::pushChildElement(S32 index)
TiXmlElement* pElement; TiXmlElement* pElement;
if(!m_paNode.empty()) if(!m_paNode.empty())
{ {
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -472,7 +472,7 @@ bool SimXMLDocument::nextSiblingElement(const char* rName)
{ {
return false; return false;
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement*& pElement = m_paNode[iLastElement]; TiXmlElement*& pElement = m_paNode[iLastElement];
if(!pElement) if(!pElement)
{ {
@ -506,7 +506,7 @@ const char* SimXMLDocument::elementValue()
{ {
return StringTable->insert(""); return StringTable->insert("");
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -547,7 +547,7 @@ const char* SimXMLDocument::attribute(const char* rAttribute)
{ {
return StringTable->insert(""); return StringTable->insert("");
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -597,7 +597,7 @@ bool SimXMLDocument::attributeExists(const char* rAttribute)
{ {
return false; return false;
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -630,7 +630,7 @@ const char* SimXMLDocument::firstAttribute()
{ {
return StringTable->insert(""); return StringTable->insert("");
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -667,7 +667,7 @@ const char* SimXMLDocument::lastAttribute()
{ {
return StringTable->insert(""); return StringTable->insert("");
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -766,7 +766,7 @@ void SimXMLDocument::setAttribute(const char* rAttribute, const char* rVal)
return; return;
} }
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pElement = m_paNode[iLastElement]; TiXmlElement* pElement = m_paNode[iLastElement];
if(!pElement) if(!pElement)
{ {
@ -798,7 +798,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
if( pObject == NULL ) if( pObject == NULL )
return; return;
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pElement = m_paNode[iLastElement]; TiXmlElement* pElement = m_paNode[iLastElement];
if(!pElement) if(!pElement)
return; return;
@ -925,7 +925,7 @@ void SimXMLDocument::pushNewElement(const char* rName)
} }
else else
{ {
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iFinalElement]; TiXmlElement* pNode = m_paNode[iFinalElement];
if(!pNode) if(!pNode)
{ {
@ -975,7 +975,7 @@ void SimXMLDocument::addNewElement(const char* rName)
return; return;
} }
const int iParentElement = m_paNode.size() - 2; const S32 iParentElement = m_paNode.size() - 2;
if(iParentElement < 0) if(iParentElement < 0)
{ {
pStackTop = dynamic_cast<TiXmlElement*> pStackTop = dynamic_cast<TiXmlElement*>
@ -1002,7 +1002,7 @@ void SimXMLDocument::addNewElement(const char* rName)
} }
// Overwrite top stack position. // Overwrite top stack position.
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
m_paNode[iFinalElement] = pStackTop; m_paNode[iFinalElement] = pStackTop;
//pNode = pStackTop; //pNode = pStackTop;
} }
@ -1091,7 +1091,7 @@ const char* SimXMLDocument::readComment( S32 index )
// Push the first element found under the current element of the given name // Push the first element found under the current element of the given name
if(!m_paNode.empty()) if(!m_paNode.empty())
{ {
const int iLastElement = m_paNode.size() - 1; const S32 iLastElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iLastElement]; TiXmlElement* pNode = m_paNode[iLastElement];
if(!pNode) if(!pNode)
{ {
@ -1159,7 +1159,7 @@ void SimXMLDocument::addText(const char* text)
if(m_paNode.empty()) if(m_paNode.empty())
return; return;
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iFinalElement]; TiXmlElement* pNode = m_paNode[iFinalElement];
if(!pNode) if(!pNode)
return; return;
@ -1204,7 +1204,7 @@ const char* SimXMLDocument::getText()
if(m_paNode.empty()) if(m_paNode.empty())
return ""; return "";
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
TiXmlNode* pNode = m_paNode[iFinalElement]; TiXmlNode* pNode = m_paNode[iFinalElement];
if(!pNode) if(!pNode)
return ""; return "";
@ -1264,7 +1264,7 @@ void SimXMLDocument::removeText()
if(m_paNode.empty()) if(m_paNode.empty())
return; return;
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iFinalElement]; TiXmlElement* pNode = m_paNode[iFinalElement];
if(!pNode) if(!pNode)
return; return;
@ -1300,7 +1300,7 @@ void SimXMLDocument::addData(const char* text)
if(m_paNode.empty()) if(m_paNode.empty())
return; return;
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
TiXmlElement* pNode = m_paNode[iFinalElement]; TiXmlElement* pNode = m_paNode[iFinalElement];
if(!pNode) if(!pNode)
return; return;
@ -1346,7 +1346,7 @@ const char* SimXMLDocument::getData()
if(m_paNode.empty()) if(m_paNode.empty())
return ""; return "";
const int iFinalElement = m_paNode.size() - 1; const S32 iFinalElement = m_paNode.size() - 1;
TiXmlNode* pNode = m_paNode[iFinalElement]; TiXmlNode* pNode = m_paNode[iFinalElement];
if(!pNode) if(!pNode)
return ""; return "";

View file

@ -250,8 +250,8 @@ struct StreqExprNode : BinaryExprNode
struct StrcatExprNode : BinaryExprNode struct StrcatExprNode : BinaryExprNode
{ {
int appendChar; S32 appendChar;
static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, int appendChar ); static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar );
U32 precompile(TypeReq type); U32 precompile(TypeReq type);
U32 compile(U32 *codeStream, U32 ip, TypeReq type); U32 compile(U32 *codeStream, U32 ip, TypeReq type);
TypeReq getPreferredType(); TypeReq getPreferredType();

View file

@ -149,7 +149,7 @@ StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *r
return ret; return ret;
} }
StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, int appendChar ) StrcatExprNode *StrcatExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar )
{ {
StrcatExprNode *ret = (StrcatExprNode *) consoleAlloc(sizeof(StrcatExprNode)); StrcatExprNode *ret = (StrcatExprNode *) consoleAlloc(sizeof(StrcatExprNode));
constructInPlace(ret); constructInPlace(ret);

View file

@ -2059,12 +2059,6 @@ yydestruct (yymsg, yytype, yyvaluep)
yymsg = "Deleting"; yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
switch (yytype)
{
default:
break;
}
} }

View file

@ -403,14 +403,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
for(U32 i = 0; i < size; i++) for(U32 i = 0; i < size; i++)
st.read(&functionFloats[i]); st.read(&functionFloats[i]);
} }
U32 codeSize; U32 codeLength;
st.read(&codeSize); st.read(&codeLength);
st.read(&lineBreakPairCount); st.read(&lineBreakPairCount);
U32 totSize = codeSize + lineBreakPairCount * 2; U32 totSize = codeLength + lineBreakPairCount * 2;
code = new U32[totSize]; code = new U32[totSize];
for(i = 0; i < codeSize; i++) for(i = 0; i < codeLength; i++)
{ {
U8 b; U8 b;
st.read(&b); st.read(&b);
@ -420,10 +420,10 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
code[i] = b; code[i] = b;
} }
for(i = codeSize; i < totSize; i++) for(i = codeLength; i < totSize; i++)
st.read(&code[i]); st.read(&code[i]);
lineBreakPairs = code + codeSize; lineBreakPairs = code + codeLength;
// StringTable-ize our identifiers. // StringTable-ize our identifiers.
U32 identCount; U32 identCount;
@ -559,7 +559,7 @@ bool CodeBlock::compile(const char *codeFileName, StringTableEntry fileName, con
} }
const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, int setFrame) const char *CodeBlock::compileExec(StringTableEntry fileName, const char *inString, bool noCalls, S32 setFrame)
{ {
// Check for a UTF8 script file // Check for a UTF8 script file
char *string; char *string;

View file

@ -129,7 +129,7 @@ public:
/// -1 a new frame is created. If the index is out of range the /// -1 a new frame is created. If the index is out of range the
/// top stack frame is used. /// top stack frame is used.
const char *compileExec(StringTableEntry fileName, const char *script, const char *compileExec(StringTableEntry fileName, const char *script,
bool noCalls, int setFrame = -1 ); bool noCalls, S32 setFrame = -1 );
/// Executes the existing code in the CodeBlock. The return string is any /// Executes the existing code in the CodeBlock. The return string is any
/// result of the code executed, if any, or an empty string. /// result of the code executed, if any, or an empty string.

View file

@ -248,7 +248,7 @@ static bool active = false;
static bool newLogFile; static bool newLogFile;
static const char *logFileName; static const char *logFileName;
static const int MaxCompletionBufferSize = 4096; static const S32 MaxCompletionBufferSize = 4096;
static char completionBuffer[MaxCompletionBufferSize]; static char completionBuffer[MaxCompletionBufferSize];
static char tabBuffer[MaxCompletionBufferSize] = {0}; static char tabBuffer[MaxCompletionBufferSize] = {0};
static SimObjectPtr<SimObject> tabObject; static SimObjectPtr<SimObject> tabObject;

View file

@ -223,7 +223,7 @@ void Namespace::printNamespaceEntries(Namespace * g, bool dumpScript, bool dumpE
// Iterate through the methods of the namespace... // Iterate through the methods of the namespace...
for(Entry *ewalk = g->mEntryList; ewalk; ewalk = ewalk->mNext) for(Entry *ewalk = g->mEntryList; ewalk; ewalk = ewalk->mNext)
{ {
int eType = ewalk->mType; S32 eType = ewalk->mType;
const char * funcName = ewalk->mFunctionName; const char * funcName = ewalk->mFunctionName;
if( ( eType == Entry::ConsoleFunctionType ) && !dumpScript ) if( ( eType == Entry::ConsoleFunctionType ) && !dumpScript )

View file

@ -259,7 +259,7 @@ DefineConsoleFunction( strstr, S32, ( const char* string, const char* substring
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
DefineConsoleFunction( strpos, S32, ( const char* haystack, const char* needle, int offset ), ( 0 ), DefineConsoleFunction( strpos, S32, ( const char* haystack, const char* needle, S32 offset ), ( 0 ),
"Find the start of @a needle in @a haystack searching from left to right beginning at the given offset.\n" "Find the start of @a needle in @a haystack searching from left to right beginning at the given offset.\n"
"@param haystack The string to search.\n" "@param haystack The string to search.\n"
"@param needle The string to search for.\n" "@param needle The string to search for.\n"
@ -479,7 +479,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
if(!scan) if(!scan)
{ {
dStrcpy(ret + dstp, source + scanp); dStrcpy(ret + dstp, source + scanp);
return ret; break;
} }
U32 len = scan - (source + scanp); U32 len = scan - (source + scanp);
dStrncpy(ret + dstp, source + scanp, len); dStrncpy(ret + dstp, source + scanp, len);

View file

@ -175,7 +175,7 @@ bool ConsoleLogger::detach()
mStream.close(); mStream.close();
// Remove this object from the list of active loggers // Remove this object from the list of active loggers
for( int i = 0; i < mActiveLoggers.size(); i++ ) for( S32 i = 0; i < mActiveLoggers.size(); i++ )
{ {
if( mActiveLoggers[i] == this ) if( mActiveLoggers[i] == this )
{ {

View file

@ -29,6 +29,7 @@
#include "core/color.h" #include "core/color.h"
#include "console/simBase.h" #include "console/simBase.h"
#include "math/mRect.h" #include "math/mRect.h"
#include "core/strings/stringUnit.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// TypeString // TypeString
@ -567,7 +568,17 @@ ImplementConsoleTypeCasters( TypeColorF, ColorF )
ConsoleGetType( TypeColorF ) ConsoleGetType( TypeColorF )
{ {
ColorF * color = (ColorF*)dptr; // Fetch color.
const ColorF* color = (ColorF*)dptr;
// Fetch stock color name.
StringTableEntry colorName = StockColor::name( *color );
// Write as color name if was found.
if ( colorName != StringTable->EmptyString() )
return colorName;
// Format as color components.
char* returnBuffer = Con::getReturnBuffer(256); char* returnBuffer = Con::getReturnBuffer(256);
dSprintf(returnBuffer, 256, "%g %g %g %g", color->red, color->green, color->blue, color->alpha); dSprintf(returnBuffer, 256, "%g %g %g %g", color->red, color->green, color->blue, color->alpha);
return(returnBuffer); return(returnBuffer);
@ -578,6 +589,22 @@ ConsoleSetType( TypeColorF )
ColorF *tmpColor = (ColorF *) dptr; ColorF *tmpColor = (ColorF *) dptr;
if(argc == 1) if(argc == 1)
{ {
// Is only a single argument passed?
if ( StringUnit::getUnitCount( argv[0], " " ) == 1 )
{
// Is this a stock color name?
if ( !StockColor::isColor(argv[0]) )
{
// No, so warn.
Con::warnf( "TypeColorF() - Invalid single argument of '%s' could not be interpreted as a stock color name. Using default.", argv[0] );
}
// Set stock color (if it's invalid we'll get the default.
tmpColor->set( argv[0] );
return;
}
tmpColor->set(0, 0, 0, 1); tmpColor->set(0, 0, 0, 1);
F32 r,g,b,a; F32 r,g,b,a;
S32 args = dSscanf(argv[0], "%g %g %g %g", &r, &g, &b, &a); S32 args = dSscanf(argv[0], "%g %g %g %g", &r, &g, &b, &a);
@ -602,7 +629,7 @@ ConsoleSetType( TypeColorF )
tmpColor->alpha = dAtof(argv[3]); tmpColor->alpha = dAtof(argv[3]);
} }
else else
Con::printf("Color must be set as { r, g, b [,a] }"); Con::printf("Color must be set as { r, g, b [,a] }, { r g b [b] } or { stockColorName }");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -613,7 +640,17 @@ ImplementConsoleTypeCasters( TypeColorI, ColorI )
ConsoleGetType( TypeColorI ) ConsoleGetType( TypeColorI )
{ {
ColorI *color = (ColorI *) dptr; // Fetch color.
ColorI* color = (ColorI*)dptr;
// Fetch stock color name.
StringTableEntry colorName = StockColor::name( *color );
// Write as color name if was found.
if ( colorName != StringTable->EmptyString() )
return colorName;
// Format as color components.
char* returnBuffer = Con::getReturnBuffer(256); char* returnBuffer = Con::getReturnBuffer(256);
dSprintf(returnBuffer, 256, "%d %d %d %d", color->red, color->green, color->blue, color->alpha); dSprintf(returnBuffer, 256, "%d %d %d %d", color->red, color->green, color->blue, color->alpha);
return returnBuffer; return returnBuffer;
@ -624,6 +661,22 @@ ConsoleSetType( TypeColorI )
ColorI *tmpColor = (ColorI *) dptr; ColorI *tmpColor = (ColorI *) dptr;
if(argc == 1) if(argc == 1)
{ {
// Is only a single argument passed?
if ( StringUnit::getUnitCount( argv[0], " " ) == 1 )
{
// Is this a stock color name?
if ( !StockColor::isColor(argv[0]) )
{
// No, so warn.
Con::warnf( "TypeColorF() - Invalid single argument of '%s' could not be interpreted as a stock color name. Using default.", argv[0] );
}
// Set stock color (if it's invalid we'll get the default.
tmpColor->set( argv[0] );
return;
}
tmpColor->set(0, 0, 0, 255); tmpColor->set(0, 0, 0, 255);
S32 r,g,b,a; S32 r,g,b,a;
S32 args = dSscanf(argv[0], "%d %d %d %d", &r, &g, &b, &a); S32 args = dSscanf(argv[0], "%d %d %d %d", &r, &g, &b, &a);
@ -648,7 +701,7 @@ ConsoleSetType( TypeColorI )
tmpColor->alpha = dAtoi(argv[3]); tmpColor->alpha = dAtoi(argv[3]);
} }
else else
Con::printf("Color must be set as { r, g, b [,a] }"); Con::printf("Color must be set as { r, g, b [,a] }, { r g b [b] } or { stockColorName }");
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -255,7 +255,7 @@ namespace Con {
mXML->pushNewElement("EnumTables"); mXML->pushNewElement("EnumTables");
// write out the used EnumTables // write out the used EnumTables
for (int i = 0; i < enumTables.size(); i++) for (S32 i = 0; i < enumTables.size(); i++)
{ {
mXML->pushNewElement("EnumTable"); mXML->pushNewElement("EnumTable");
@ -267,7 +267,7 @@ namespace Con {
mXML->pushNewElement("Enums"); mXML->pushNewElement("Enums");
for (int j = 0; j < table->size; j++) for (S32 j = 0; j < table->size; j++)
{ {
mXML->pushNewElement("Enum"); mXML->pushNewElement("Enum");

View file

@ -76,6 +76,7 @@
// Disable some VC warnings that are irrelevant to us. // Disable some VC warnings that are irrelevant to us.
#pragma warning( push )
#pragma warning( disable : 4510 ) // default constructor could not be generated; all the Args structures are never constructed by us #pragma warning( disable : 4510 ) // default constructor could not be generated; all the Args structures are never constructed by us
#pragma warning( disable : 4610 ) // can never be instantiated; again Args is never constructed by us #pragma warning( disable : 4610 ) // can never be instantiated; again Args is never constructed by us
@ -1383,14 +1384,14 @@ struct _EngineConsoleThunkCountArgs
// Encapsulation of a legacy console function invocation. // Encapsulation of a legacy console function invocation.
template< int startArgc, typename T > template< S32 startArgc, typename T >
struct _EngineConsoleThunk {}; struct _EngineConsoleThunk {};
template< int startArgc, typename R > template< S32 startArgc, typename R >
struct _EngineConsoleThunk< startArgc, R() > struct _EngineConsoleThunk< startArgc, R() >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 0; static const S32 NUM_ARGS = 0;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )(), const _EngineFunctionDefaultArguments< void() >& ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )(), const _EngineFunctionDefaultArguments< void() >& )
{ {
return _EngineConsoleThunkReturnValue( fn() ); return _EngineConsoleThunkReturnValue( fn() );
@ -1401,11 +1402,11 @@ struct _EngineConsoleThunk< startArgc, R() >
return _EngineConsoleThunkReturnValue( ( frame->*fn )() ); return _EngineConsoleThunkReturnValue( ( frame->*fn )() );
} }
}; };
template< int startArgc > template< S32 startArgc >
struct _EngineConsoleThunk< startArgc, void() > struct _EngineConsoleThunk< startArgc, void() >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 0; static const S32 NUM_ARGS = 0;
static void thunk( S32 argc, const char** argv, void ( *fn )(), const _EngineFunctionDefaultArguments< void() >& ) static void thunk( S32 argc, const char** argv, void ( *fn )(), const _EngineFunctionDefaultArguments< void() >& )
{ {
fn(); fn();
@ -1417,11 +1418,11 @@ struct _EngineConsoleThunk< startArgc, void() >
} }
}; };
template< int startArgc, typename R, typename A > template< S32 startArgc, typename R, typename A >
struct _EngineConsoleThunk< startArgc, R( A ) > struct _EngineConsoleThunk< startArgc, R( A ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 1 + startArgc; static const S32 NUM_ARGS = 1 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A ), const _EngineFunctionDefaultArguments< void( A ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A ), const _EngineFunctionDefaultArguments< void( A ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1434,11 +1435,11 @@ struct _EngineConsoleThunk< startArgc, R( A ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a ) );
} }
}; };
template< int startArgc, typename A > template< S32 startArgc, typename A >
struct _EngineConsoleThunk< startArgc, void( A ) > struct _EngineConsoleThunk< startArgc, void( A ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 1 + startArgc; static const S32 NUM_ARGS = 1 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A ), const _EngineFunctionDefaultArguments< void( A ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A ), const _EngineFunctionDefaultArguments< void( A ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1452,11 +1453,11 @@ struct _EngineConsoleThunk< startArgc, void( A ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B > template< S32 startArgc, typename R, typename A, typename B >
struct _EngineConsoleThunk< startArgc, R( A, B ) > struct _EngineConsoleThunk< startArgc, R( A, B ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 2 + startArgc; static const S32 NUM_ARGS = 2 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B ), const _EngineFunctionDefaultArguments< void( A, B ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B ), const _EngineFunctionDefaultArguments< void( A, B ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1471,11 +1472,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b ) );
} }
}; };
template< int startArgc, typename A, typename B > template< S32 startArgc, typename A, typename B >
struct _EngineConsoleThunk< startArgc, void( A, B ) > struct _EngineConsoleThunk< startArgc, void( A, B ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 2 + startArgc; static const S32 NUM_ARGS = 2 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B ), const _EngineFunctionDefaultArguments< void( A, B ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B ), const _EngineFunctionDefaultArguments< void( A, B ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1491,11 +1492,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C > template< S32 startArgc, typename R, typename A, typename B, typename C >
struct _EngineConsoleThunk< startArgc, R( A, B, C ) > struct _EngineConsoleThunk< startArgc, R( A, B, C ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 3 + startArgc; static const S32 NUM_ARGS = 3 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C ), const _EngineFunctionDefaultArguments< void( A, B, C ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C ), const _EngineFunctionDefaultArguments< void( A, B, C ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1512,11 +1513,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C > template< S32 startArgc, typename A, typename B, typename C >
struct _EngineConsoleThunk< startArgc, void( A, B, C ) > struct _EngineConsoleThunk< startArgc, void( A, B, C ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 3 + startArgc; static const S32 NUM_ARGS = 3 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C ), const _EngineFunctionDefaultArguments< void( A, B, C ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C ), const _EngineFunctionDefaultArguments< void( A, B, C ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1534,11 +1535,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 4 + startArgc; static const S32 NUM_ARGS = 4 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D ), const _EngineFunctionDefaultArguments< void( A, B, C, D ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D ), const _EngineFunctionDefaultArguments< void( A, B, C, D ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1557,11 +1558,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D > template< S32 startArgc, typename A, typename B, typename C, typename D >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 4 + startArgc; static const S32 NUM_ARGS = 4 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D ), const _EngineFunctionDefaultArguments< void( A, B, C, D ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D ), const _EngineFunctionDefaultArguments< void( A, B, C, D ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1581,11 +1582,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 5 + startArgc; static const S32 NUM_ARGS = 5 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1606,11 +1607,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 5 + startArgc; static const S32 NUM_ARGS = 5 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1632,11 +1633,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 6 + startArgc; static const S32 NUM_ARGS = 6 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1659,11 +1660,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E, typename F > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 6 + startArgc; static const S32 NUM_ARGS = 6 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1687,11 +1688,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 7 + startArgc; static const S32 NUM_ARGS = 7 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1716,11 +1717,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 7 + startArgc; static const S32 NUM_ARGS = 7 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1746,11 +1747,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 8 + startArgc; static const S32 NUM_ARGS = 8 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1777,11 +1778,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 8 + startArgc; static const S32 NUM_ARGS = 8 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1809,11 +1810,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 9 + startArgc; static const S32 NUM_ARGS = 9 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H, I ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H, I ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1842,11 +1843,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 9 + startArgc; static const S32 NUM_ARGS = 9 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H, I ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H, I ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1876,11 +1877,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I ) >
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 10 + startArgc; static const S32 NUM_ARGS = 10 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1911,11 +1912,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 10 + startArgc; static const S32 NUM_ARGS = 10 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1946,11 +1947,11 @@ struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J ) >
( frame->*fn )( a, b, c, d, e, f, g, h, i, j ); ( frame->*fn )( a, b, c, d, e, f, g, h, i, j );
} }
}; };
template< int startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > template< S32 startArgc, typename R, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K >
struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J, K ) > struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J, K ) >
{ {
typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType; typedef typename _EngineConsoleThunkType< R >::ReturnType ReturnType;
static const int NUM_ARGS = 11 + startArgc; static const S32 NUM_ARGS = 11 + startArgc;
static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs ) static ReturnType thunk( S32 argc, const char** argv, R ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -1983,11 +1984,11 @@ struct _EngineConsoleThunk< startArgc, R( A, B, C, D, E, F, G, H, I, J, K ) >
return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j, k ) ); return _EngineConsoleThunkReturnValue( ( frame->*fn )( a, b, c, d, e, f, g, h, i, j, k ) );
} }
}; };
template< int startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K > template< S32 startArgc, typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I, typename J, typename K >
struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J, K ) > struct _EngineConsoleThunk< startArgc, void( A, B, C, D, E, F, G, H, I, J, K ) >
{ {
typedef void ReturnType; typedef void ReturnType;
static const int NUM_ARGS = 11 + startArgc; static const S32 NUM_ARGS = 11 + startArgc;
static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs ) static void thunk( S32 argc, const char** argv, void ( *fn )( A, B, C, D, E, F, G, H, I, J, K ), const _EngineFunctionDefaultArguments< void( A, B, C, D, E, F, G, H, I, J, K ) >& defaultArgs )
{ {
A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) ); A a = ( startArgc < argc ? EngineUnmarshallData< A >()( argv[ startArgc ] ) : A( defaultArgs.a ) );
@ -2788,7 +2789,6 @@ struct _EngineConsoleCallbackHelper
// Re-enable some VC warnings we disabled for this file. // Re-enable some VC warnings we disabled for this file.
#pragma warning( default : 4510 ) #pragma warning( pop ) // 4510 and 4610
#pragma warning( default : 4610 )
#endif // !_ENGINEAPI_H_ #endif // !_ENGINEAPI_H_

View file

@ -307,7 +307,7 @@ static void dumpNamespaceEntries( Stream &stream, Namespace *g, bool callbacks =
// Go through all the entries in the namespace. // Go through all the entries in the namespace.
for ( Namespace::Entry *ewalk = g->mEntryList; ewalk; ewalk = ewalk->mNext ) for ( Namespace::Entry *ewalk = g->mEntryList; ewalk; ewalk = ewalk->mNext )
{ {
int eType = ewalk->mType; S32 eType = ewalk->mType;
// We do not dump script defined functions... only engine exports. // We do not dump script defined functions... only engine exports.
if( eType == Namespace::Entry::ConsoleFunctionType if( eType == Namespace::Entry::ConsoleFunctionType

View file

@ -599,10 +599,10 @@ DefineEngineFunction(fileExt, String, ( const char* fileName ),,
} }
DefineEngineFunction(fileBase, String, ( const char* fileName ),, DefineEngineFunction(fileBase, String, ( const char* fileName ),,
"@brief Get the base of a file name (removes extension)\n\n" "@brief Get the base of a file name (removes extension and path)\n\n"
"@param fileName Name and path of file to check\n" "@param fileName Name and path of file to check\n"
"@return String containing the file name, minus extension\n" "@return String containing the file name, minus extension and path\n"
"@ingroup FileSystem") "@ingroup FileSystem")
{ {
@ -626,10 +626,10 @@ DefineEngineFunction(fileBase, String, ( const char* fileName ),,
} }
DefineEngineFunction(fileName, String, ( const char* fileName ),, DefineEngineFunction(fileName, String, ( const char* fileName ),,
"@brief Get the file name of a file (removes extension and path)\n\n" "@brief Get only the file name of a path and file name string (removes path)\n\n"
"@param fileName Name and path of file to check\n" "@param fileName Name and path of file to check\n"
"@return String containing the file name, minus extension and path\n" "@return String containing the file name, minus the path\n"
"@ingroup FileSystem") "@ingroup FileSystem")
{ {
S32 pathLen = dStrlen( fileName ); S32 pathLen = dStrlen( fileName );

View file

@ -2663,7 +2663,7 @@ DefineConsoleMethod( SimObject, getDynamicFieldCount, S32, (),,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
DefineConsoleMethod( SimObject, getDynamicField, const char*, ( int index ),, DefineConsoleMethod( SimObject, getDynamicField, const char*, ( S32 index ),,
"Get a value of a dynamic field by index.\n" "Get a value of a dynamic field by index.\n"
"@param index The index of the dynamic field.\n" "@param index The index of the dynamic field.\n"
"@return The value of the dynamic field at the given index or \"\"." ) "@return The value of the dynamic field at the given index or \"\"." )
@ -2702,7 +2702,7 @@ DefineConsoleMethod( SimObject, getFieldCount, S32, (),,
const AbstractClassRep::Field* f; const AbstractClassRep::Field* f;
U32 numDummyEntries = 0; U32 numDummyEntries = 0;
for(int i = 0; i < list.size(); i++) for(S32 i = 0; i < list.size(); i++)
{ {
f = &list[i]; f = &list[i];
@ -2716,7 +2716,7 @@ DefineConsoleMethod( SimObject, getFieldCount, S32, (),,
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
DefineConsoleMethod( SimObject, getField, const char*, ( int index ),, DefineConsoleMethod( SimObject, getField, const char*, ( S32 index ),,
"Retrieve the value of a static field by index.\n" "Retrieve the value of a static field by index.\n"
"@param index The index of the static field.\n" "@param index The index of the static field.\n"
"@return The value of the static field with the given index or \"\"." ) "@return The value of the static field with the given index or \"\"." )

View file

@ -781,7 +781,7 @@ class SimObject: public ConsoleObject
void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; } void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; }
/// Get whether fields created at runtime should be saved. Default is true. /// Get whether fields created at runtime should be saved. Default is true.
bool getCanSaveDynamicFields( bool bCanSave ) { return mCanSaveFieldDictionary;} bool getCanSaveDynamicFields( ) { return mCanSaveFieldDictionary;}
/// Return the object that this object is copying fields from. /// Return the object that this object is copying fields from.
SimObject* getCopySource() const { return mCopySource; } SimObject* getCopySource() const { return mCopySource; }

View file

@ -127,7 +127,7 @@ public:
void breakProcess(); void breakProcess();
virtual void executionStopped(CodeBlock *code, U32 lineNumber); void executionStopped(CodeBlock *code, U32 lineNumber);
void send(const char *s); void send(const char *s);
void setDebugParameters(S32 port, const char *password, bool waitForClient); void setDebugParameters(S32 port, const char *password, bool waitForClient);
void processConsoleLine(const char *consoleLine); void processConsoleLine(const char *consoleLine);

View file

@ -799,7 +799,7 @@ void BitRender::bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim)
#if defined(TORQUE_BIG_ENDIAN) #if defined(TORQUE_BIG_ENDIAN)
#define MAX_SHADOW_TEXELS (256 + 4) //256 seems big enough, +4 so we can run off end of buffer. #define MAX_SHADOW_TEXELS (256 + 4) //256 seems big enough, +4 so we can run off end of buffer.
// slow fake gaussian // slow fake gaussian
int i, j, c; S32 i, j, c;
U8 tmpLine[3][MAX_SHADOW_TEXELS]; U8 tmpLine[3][MAX_SHADOW_TEXELS];
U8 *src0, *src1, *src2; U8 *src0, *src1, *src2;
U8 *s0, *s1, *s2; U8 *s0, *s1, *s2;
@ -809,7 +809,7 @@ void BitRender::bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim)
U32 currVal; U32 currVal;
U32 sampleVal; U32 sampleVal;
U8 c00, c01, c02, c10, c11, c12, c20, c21, c22; U8 c00, c01, c02, c10, c11, c12, c20, c21, c22;
int openBuf; S32 openBuf;
src0 = tmpLine[0]; src0 = tmpLine[0];
src1 = tmpLine[1]; src1 = tmpLine[1];
@ -902,9 +902,9 @@ void BitRender::bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim)
sampleVal = 0; //c12; // take end. sampleVal = 0; //c12; // take end.
else // inner pixel else // inner pixel
{ {
const int wXP = 3; // corners const S32 wXP = 3; // corners
const int wPP = 4; // plus/NSEW const S32 wPP = 4; // plus/NSEW
const int wCP = 4; // center const S32 wCP = 4; // center
sampleVal = (c00+c02+c20+c22)*wXP + (c01+c10+c12+c21)*wPP + c11*wCP; sampleVal = (c00+c02+c20+c22)*wXP + (c01+c10+c12+c21)*wPP + c11*wCP;
sampleVal >>= 5; // div by 32 subsamples sampleVal >>= 5; // div by 32 subsamples
} }

View file

@ -38,3 +38,507 @@ const ColorI ColorI::BLACK( 0, 0, 0 );
const ColorI ColorI::RED( 255, 0, 0 ); const ColorI ColorI::RED( 255, 0, 0 );
const ColorI ColorI::GREEN( 0, 255, 0 ); const ColorI ColorI::GREEN( 0, 255, 0 );
const ColorI ColorI::BLUE( 0, 0, 255 ); const ColorI ColorI::BLUE( 0, 0, 255 );
#include "console/console.h"
#include "console/consoleTypes.h"
#ifndef _STRINGUNIT_H_
#include "core/strings/stringUnit.h"
#endif
#ifndef _TDICTIONARY_H_
#include "core/util/tDictionary.h"
#endif
#include "console/consoleInternal.h"
//-----------------------------------------------------------------------------
typedef HashTable<StringTableEntry, ColorF> typeNameToColorFHash;
typedef HashTable<StringTableEntry, ColorI> typeNameToColorIHash;
typedef HashTable<ColorF, StringTableEntry> typeColorFToNameHash;
typedef HashTable<ColorI, StringTableEntry> typeColorIToNameHash;
static typeNameToColorFHash mNameToColorF;
static typeNameToColorIHash mNameToColorI;
static typeColorFToNameHash mColorFToName;
static typeColorIToNameHash mColorIToName;
#define DEFAULT_UNKNOWN_STOCK_COLOR_NAME "White"
MODULE_BEGIN( StockColors )
MODULE_INIT_AFTER( GFX )
MODULE_INIT
{
// Create the stock colors.
StockColor::create();
}
MODULE_SHUTDOWN
{
// Destroy the stock colors.
StockColor::destroy();
}
MODULE_END;
//-----------------------------------------------------------------------------
StockColorItem StockColorTable[] =
{
StockColorItem( "InvisibleBlack", 0, 0, 0, 0 ),
StockColorItem( "TransparentWhite", 255, 255, 255, 0 ),
StockColorItem( "AliceBlue", 240, 248, 255 ),
StockColorItem( "AntiqueWhite", 250, 235, 215 ),
StockColorItem( "Aqua", 0, 255, 255 ),
StockColorItem( "Aquamarine", 127, 255, 212 ),
StockColorItem( "Azure", 240, 255, 255 ),
StockColorItem( "Beige", 245, 245, 220 ),
StockColorItem( "Bisque", 255, 228, 196 ),
StockColorItem( "Black", 0, 0, 0, 255 ),
StockColorItem( "BlanchedAlmond", 255, 235, 205, 255 ),
StockColorItem( "Blue", 0, 0, 255 ),
StockColorItem( "BlueViolet", 138, 43, 226 ),
StockColorItem( "Brown", 165, 42, 42, 255 ),
StockColorItem( "BurlyWood", 222, 184, 135 ),
StockColorItem( "CadetBlue", 95, 158, 160 ),
StockColorItem( "Chartreuse", 127, 255, 0 ),
StockColorItem( "Chocolate", 210, 105, 30 ),
StockColorItem( "Coral", 255, 127, 80 ),
StockColorItem( "CornflowerBlue", 100, 149, 237 ),
StockColorItem( "Cornsilk", 255, 248, 220 ),
StockColorItem( "Crimson", 220, 20, 60 ),
StockColorItem( "Cyan", 0, 255, 255 ),
StockColorItem( "DarkBlue", 0, 0, 139 ),
StockColorItem( "DarkCyan", 0, 139, 139 ),
StockColorItem( "DarkGoldenrod", 184, 134, 11 ),
StockColorItem( "DarkGray", 169, 169, 169),
StockColorItem( "DarkGreen", 0, 100, 0 ),
StockColorItem( "DarkKhaki", 189, 183, 107 ),
StockColorItem( "DarkMagenta", 139, 0, 139 ),
StockColorItem( "DarkOliveGreen", 85, 107, 47 ),
StockColorItem( "DarkOrange", 255, 140, 0 ),
StockColorItem( "DarkOrchid", 153, 50, 204 ),
StockColorItem( "DarkRed", 139, 0, 0 ),
StockColorItem( "DarkSalmon", 233, 150, 122 ),
StockColorItem( "DarkSeaGreen", 143, 188, 139 ),
StockColorItem( "DarkSlateBlue", 72, 61, 139 ),
StockColorItem( "DarkSlateGray", 47, 79, 79 ),
StockColorItem( "DarkTurquoise", 0, 206, 209 ),
StockColorItem( "DarkViolet", 148, 0, 211 ),
StockColorItem( "DeepPink", 255, 20, 147 ),
StockColorItem( "DeepSkyBlue", 0, 191, 255 ),
StockColorItem( "DimGray", 105, 105, 105 ),
StockColorItem( "DodgerBlue", 30, 144, 255 ),
StockColorItem( "Firebrick", 178, 34, 34 ),
StockColorItem( "FloralWhite", 255, 250, 240 ),
StockColorItem( "ForestGreen", 34, 139, 34 ),
StockColorItem( "Fuchsia", 255, 0, 255 ),
StockColorItem( "Gainsboro", 220, 220, 220 ),
StockColorItem( "GhostWhite", 248, 248, 255 ),
StockColorItem( "Gold", 255, 215, 0 ),
StockColorItem( "Goldenrod", 218, 165, 32 ),
StockColorItem( "Gray", 128, 128, 128 ),
StockColorItem( "Green", 0, 128, 0 ),
StockColorItem( "GreenYellow", 173, 255, 47 ),
StockColorItem( "Honeydew", 240, 255, 24 ),
StockColorItem( "HotPink", 255, 105, 180 ),
StockColorItem( "IndianRed", 205, 92, 92 ),
StockColorItem( "Indigo", 75, 0, 130 ),
StockColorItem( "Ivory", 255, 255, 240 ),
StockColorItem( "Khaki", 240, 230, 140 ),
StockColorItem( "Lavender", 230, 230, 250 ),
StockColorItem( "LavenderBlush", 255, 240, 245 ),
StockColorItem( "LawnGreen", 124, 252, 0 ),
StockColorItem( "LemonChiffon", 255, 250, 205 ),
StockColorItem( "LightBlue", 173, 216, 230 ),
StockColorItem( "LightCoral", 240, 128, 128 ),
StockColorItem( "LightCyan", 224, 255, 255),
StockColorItem( "LightGoldenrodYellow", 250, 250, 210 ),
StockColorItem( "LightGray", 211, 211, 211),
StockColorItem( "LightGreen", 144, 238, 144 ),
StockColorItem( "LightPink", 255, 182, 193 ),
StockColorItem( "LightSalmon", 255, 160, 122 ),
StockColorItem( "LightSeaGreen", 32, 178, 170 ),
StockColorItem( "LightSkyBlue",135, 206, 250 ),
StockColorItem( "LightSlateGray", 119, 136, 153 ),
StockColorItem( "LightSteelBlue", 176, 196, 222 ),
StockColorItem( "LightYellow", 255, 255, 224 ),
StockColorItem( "Lime", 0, 255, 0 ),
StockColorItem( "LimeGreen", 50, 205, 50 ),
StockColorItem( "Linen", 250, 240, 230 ),
StockColorItem( "Magenta", 255, 0, 255 ),
StockColorItem( "Maroon", 128, 0, 0 ),
StockColorItem( "MediumAquamarine", 102, 205, 170 ),
StockColorItem( "MediumBlue", 0, 0, 205 ),
StockColorItem( "MediumOrchid", 186, 85, 211 ),
StockColorItem( "MediumPurple", 147, 112, 219 ),
StockColorItem( "MediumSeaGreen", 60, 179, 113 ),
StockColorItem( "MediumSlateBlue", 123, 104, 238 ),
StockColorItem( "MediumSpringGreen", 0, 250, 154 ),
StockColorItem( "MediumTurquoise", 72, 209, 204 ),
StockColorItem( "MediumVioletRed", 199, 21, 133 ),
StockColorItem( "MidnightBlue", 25, 25, 112 ),
StockColorItem( "MintCream", 245, 255, 250 ),
StockColorItem( "MistyRose", 255, 228, 225 ),
StockColorItem( "Moccasin", 255, 228, 181 ),
StockColorItem( "NavajoWhite", 255, 222, 173 ),
StockColorItem( "Navy", 0, 0, 128 ),
StockColorItem( "OldLace", 253, 245, 230 ),
StockColorItem( "Olive", 128, 128, 0 ),
StockColorItem( "OliveDrab", 107, 142, 35 ),
StockColorItem( "Orange", 255, 165, 0 ),
StockColorItem( "OrangeRed", 255, 69, 0 ),
StockColorItem( "Orchid", 218, 112, 214 ),
StockColorItem( "PaleGoldenrod", 238, 232, 170 ),
StockColorItem( "PaleGreen", 152, 251, 152 ),
StockColorItem( "PaleTurquoise", 175, 238, 238 ),
StockColorItem( "PaleVioletRed", 219, 112, 147 ),
StockColorItem( "PapayaWhip", 255, 239, 213 ),
StockColorItem( "PeachPuff", 255, 218, 185 ),
StockColorItem( "Peru", 205, 133, 63 ),
StockColorItem( "Pink", 55, 192, 203 ),
StockColorItem( "Plum", 221, 160, 221 ),
StockColorItem( "PowderBlue", 176, 224, 230 ),
StockColorItem( "Purple", 128, 0, 128 ),
StockColorItem( "Red", 255, 0, 0 ),
StockColorItem( "RosyBrown", 188, 143, 143 ),
StockColorItem( "RoyalBlue", 65, 105, 225 ),
StockColorItem( "SaddleBrown", 139, 69, 19 ),
StockColorItem( "Salmon", 250, 128, 114 ),
StockColorItem( "SandyBrown", 244, 164, 96 ),
StockColorItem( "SeaGreen", 46, 139, 87 ),
StockColorItem( "SeaShell", 255, 245, 238 ),
StockColorItem( "Sienna", 160, 82, 45 ),
StockColorItem( "Silver", 192, 192, 192 ),
StockColorItem( "SkyBlue", 135, 206, 235 ),
StockColorItem( "SlateBlue", 106, 90, 205 ),
StockColorItem( "SlateGray", 112, 128, 144 ),
StockColorItem( "Snow", 255, 250, 250 ),
StockColorItem( "SpringGreen", 0, 255, 127 ),
StockColorItem( "SteelBlue", 70, 130, 180 ),
StockColorItem( "Tan", 210, 180, 140 ),
StockColorItem( "Teal", 0, 128, 128 ),
StockColorItem( "Thistle", 216, 191, 216 ),
StockColorItem( "Tomato", 255, 99, 71 ),
StockColorItem( "Turquoise", 64, 224, 208 ),
StockColorItem( "Violet", 238, 130, 238 ),
StockColorItem( "Wheat", 245, 222, 179 ),
StockColorItem( "White", 255, 255, 255 ),
StockColorItem( "WhiteSmoke", 245, 245, 245 ),
StockColorItem( "Yellow", 255, 255, 0 ),
StockColorItem( "YellowGreen", 154, 205, 50 )
};
//-----------------------------------------------------------------------------
static bool stockColorsCreated = false;
void StockColor::create( void )
{
// Finish if already created.
if ( stockColorsCreated )
return;
// Fetch stock color count.
const S32 stockColorCount = sizeof(StockColorTable) / sizeof(StockColorItem);
// Insert all stock colors.
for( S32 index = 0; index < stockColorCount; ++index )
{
// Fetch stock color item.
StockColorItem& stockColor = StockColorTable[index];
// Fetch stock color item.
StringTableEntry colorName = StringTable->insert( stockColor.mColorName );
// Insert stock color mappings.
mNameToColorF.insertUnique(colorName, stockColor.mColorF);
mNameToColorI.insertUnique(colorName, stockColor.mColorI);
mColorFToName.insertUnique(stockColor.mColorF, colorName);
mColorIToName.insertUnique(stockColor.mColorI, colorName);
}
// Flag as created.
stockColorsCreated = true;
}
//-----------------------------------------------------------------------------
void StockColor::destroy( void )
{
// Finish if not created.
if ( !stockColorsCreated )
return;
// Clear stock color mappings.
mNameToColorF.clear();
mNameToColorI.clear();
mColorFToName.clear();
mColorIToName.clear();
// Flag as not created.
stockColorsCreated = false;
}
//-----------------------------------------------------------------------------
bool StockColor::isColor( const char* pStockColorName )
{
// Sanity!
AssertFatal( pStockColorName != NULL, "Cannot fetch a NULL stock color name." );
// Fetch color name.
StringTableEntry colorName = StringTable->insert( pStockColorName );
// Find if color name exists or not.
return mNameToColorF.find( colorName ) != mNameToColorF.end();
}
//-----------------------------------------------------------------------------
const ColorF& StockColor::colorF( const char* pStockColorName )
{
// Sanity!
AssertFatal( pStockColorName != NULL, "Cannot fetch a NULL stock color name." );
// Fetch color name.
StringTableEntry colorName = StringTable->insert( pStockColorName );
// Find stock color.
typeNameToColorFHash::Iterator colorItr = mNameToColorF.find( colorName );
// Return color if found.
if ( colorItr != mNameToColorF.end() )
return colorItr->value;
// Warn.
Con::warnf( "Could not find stock color name '%s'.", pStockColorName );
// Return default stock color.
return mNameToColorF.find( DEFAULT_UNKNOWN_STOCK_COLOR_NAME )->value;
}
//-----------------------------------------------------------------------------
const ColorI& StockColor::colorI( const char* pStockColorName )
{
// Sanity!
AssertFatal( pStockColorName != NULL, "Cannot fetch a NULL stock color name." );
// Fetch color name.
StringTableEntry colorName = StringTable->insert( pStockColorName );
// Find stock color.
typeNameToColorIHash::Iterator colorItr = mNameToColorI.find( colorName );
// Return color if found.
if ( colorItr != mNameToColorI.end() )
return colorItr->value;
// Warn.
Con::warnf( "Could not find stock color name '%s'.", colorName );
// Return default stock color.
return mNameToColorI.find( DEFAULT_UNKNOWN_STOCK_COLOR_NAME )->value;
}
//-----------------------------------------------------------------------------
StringTableEntry StockColor::name( const ColorF& color )
{
// Find stock color name.
typeColorFToNameHash::Iterator colorNameItr = mColorFToName.find( color );
// Return name if found.
if ( colorNameItr != mColorFToName.end() )
return colorNameItr->value;
// Return empty string.
return StringTable->EmptyString();
}
//-----------------------------------------------------------------------------
StringTableEntry StockColor::name( const ColorI& color )
{
// Find stock color name.
typeColorIToNameHash::Iterator colorNameItr = mColorIToName.find( color );
// Return name if found.
if ( colorNameItr != mColorIToName.end() )
return colorNameItr->value;
// Return empty string.
return StringTable->EmptyString();
}
//-----------------------------------------------------------------------------
S32 StockColor::getCount( void )
{
return sizeof(StockColorTable) / sizeof(StockColorItem);
}
//-----------------------------------------------------------------------------
const StockColorItem* StockColor::getColorItem( const S32 index )
{
// Fetch stock color count.
const S32 stockColorCount = StockColor::getCount();
// Is the stock color index in range?
if ( index < 0 || index >= stockColorCount )
{
// No, so warn.
Con::warnf("StockColor::getName() - Specified color index '%d' is out of range. Range is 0 to %d.", index, stockColorCount-1 );
return NULL;
}
// Return color name.
return &(StockColorTable[index]);
}
//-----------------------------------------------------------------------------
ColorF::ColorF( const char* pStockColorName )
{
// Set stock color.
*this = StockColor::colorF( pStockColorName );
}
//-----------------------------------------------------------------------------
void ColorF::set( const char* pStockColorName )
{
// Set stock color.
*this = StockColor::colorF( pStockColorName );
}
//-----------------------------------------------------------------------------
const ColorF& ColorF::StockColor( const char* pStockColorName )
{
return StockColor::colorF( pStockColorName );
}
//-----------------------------------------------------------------------------
StringTableEntry ColorF::StockColor( void )
{
// Return stock color name.
return StockColor::name( *this );
}
//-----------------------------------------------------------------------------
ColorI::ColorI( const char* pStockColorName )
{
// Set stock color.
*this = StockColor::colorI( pStockColorName );
}
//-----------------------------------------------------------------------------
void ColorI::set( const char* pStockColorName )
{
// Set stock color.
*this = StockColor::colorI( pStockColorName );
}
//-----------------------------------------------------------------------------
const ColorI& ColorI::StockColor( const char* pStockColorName )
{
return StockColor::colorI( pStockColorName );
}
//-----------------------------------------------------------------------------
StringTableEntry ColorI::StockColor( void )
{
// Return stock color name.
return StockColor::name( *this );
}
//-----------------------------------------------------------------------------
ConsoleFunction( getStockColorCount, S32, 1, 1, "() - Gets a count of available stock colors.\n"
"@return A count of available stock colors." )
{
return StockColor::getCount();
}
//-----------------------------------------------------------------------------
ConsoleFunction( getStockColorName, const char*, 2, 2, "(stockColorIndex) - Gets the stock color name at the specified index.\n"
"@param stockColorIndex The zero-based index of the stock color name to retrieve.\n"
"@return The stock color name at the specified index or nothing if the string is invalid." )
{
// Fetch stock color index.
const S32 stockColorIndex = dAtoi(argv[1]);
// Fetch the color item.
const StockColorItem* pColorItem = StockColor::getColorItem( stockColorIndex );
return pColorItem == NULL ? NULL : pColorItem->getColorName();
}
//-----------------------------------------------------------------------------
ConsoleFunction( isStockColor, bool, 2, 2, "(stockColorName) - Gets whether the specified name is a stock color or not.\n"
"@param stockColorName - The stock color name to test for.\n"
"@return Whether the specified name is a stock color or not.\n" )
{
// Fetch stock color name.
const char* pStockColorName = argv[1];
// Return whether this is a stock color name or not.
return StockColor::isColor( pStockColorName );
}
//-----------------------------------------------------------------------------
ConsoleFunction( getStockColorF, const char*, 2, 2, "(stockColorName) - Gets a floating-point-based stock color by name.\n"
"@param stockColorName - The stock color name to retrieve.\n"
"@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n" )
{
// Fetch stock color name.
const char* pStockColorName = argv[1];
// Return nothing if stock color name is invalid.
if ( !StockColor::isColor( pStockColorName ) )
return StringTable->EmptyString();
// Fetch stock color.
const ColorF& color = StockColor::colorF( pStockColorName );
// Format stock color.
char* returnBuffer = Con::getReturnBuffer(256);
dSprintf(returnBuffer, 256, "%g %g %g %g", color.red, color.green, color.blue, color.alpha);
return(returnBuffer);
}
//-----------------------------------------------------------------------------
ConsoleFunction( getStockColorI, const char*, 2, 2, "(stockColorName) - Gets a byte-based stock color by name.\n"
"@param stockColorName - The stock color name to retrieve.\n"
"@return The stock color that matches the specified color name. Returns nothing if the color name is not found.\n" )
{
// Fetch stock color name.
const char* pStockColorName = argv[1];
// Return nothing if stock color name is invalid.
if ( !StockColor::isColor( pStockColorName ) )
return StringTable->EmptyString();
// Fetch stock color.
const ColorI& color = StockColor::colorI( pStockColorName );
// Format stock color.
char* returnBuffer = Con::getReturnBuffer(256);
dSprintf(returnBuffer, 256, "%d %d %d %d", color.red, color.green, color.blue, color.alpha);
return(returnBuffer);
}

View file

@ -49,11 +49,18 @@ class ColorF
const F32 in_b, const F32 in_b,
const F32 in_a = 1.0f); const F32 in_a = 1.0f);
ColorF( const char* pStockColorName );
void set(const F32 in_r, void set(const F32 in_r,
const F32 in_g, const F32 in_g,
const F32 in_b, const F32 in_b,
const F32 in_a = 1.0f); const F32 in_a = 1.0f);
void set( const char* pStockColorName );
static const ColorF& StockColor( const char* pStockColorName );
StringTableEntry StockColor( void );
ColorF& operator*=(const ColorF& in_mul); // Can be useful for lighting ColorF& operator*=(const ColorF& in_mul); // Can be useful for lighting
ColorF operator*(const ColorF& in_mul) const; ColorF operator*(const ColorF& in_mul) const;
ColorF& operator+=(const ColorF& in_rAdd); ColorF& operator+=(const ColorF& in_rAdd);
@ -123,6 +130,8 @@ class ColorI
const U8 in_a = U8(255)); const U8 in_a = U8(255));
ColorI(const ColorI& in_rCopy, const U8 in_a); ColorI(const ColorI& in_rCopy, const U8 in_a);
ColorI( const char* pStockColorName );
void set(const U8 in_r, void set(const U8 in_r,
const U8 in_g, const U8 in_g,
const U8 in_b, const U8 in_b,
@ -131,6 +140,11 @@ class ColorI
void set(const ColorI& in_rCopy, void set(const ColorI& in_rCopy,
const U8 in_a); const U8 in_a);
void set( const char* pStockColorName );
static const ColorI& StockColor( const char* pStockColorName );
StringTableEntry StockColor( void );
ColorI& operator*=(const F32 in_mul); ColorI& operator*=(const F32 in_mul);
ColorI operator*(const F32 in_mul) const; ColorI operator*(const F32 in_mul) const;
@ -175,6 +189,53 @@ class ColorI
static const ColorI BLUE; static const ColorI BLUE;
}; };
//-----------------------------------------------------------------------------
class StockColorItem
{
private:
StockColorItem() {}
public:
StockColorItem( const char* pName, const U8 red, const U8 green, const U8 blue, const U8 alpha = 255 )
{
// Sanity!
AssertFatal( pName != NULL, "Stock color name cannot be NULL." );
// Set stock color.
// NOTE:- We'll use the char pointer here. We can yet use the string-table unfortunately.
mColorName = pName;
mColorI.set( red, green, blue, alpha );
mColorF = mColorI;
}
inline const char* getColorName( void ) const { return mColorName; }
inline const ColorF& getColorF( void ) const { return mColorF; }
inline const ColorI& getColorI( void ) const { return mColorI; }
const char* mColorName;
ColorF mColorF;
ColorI mColorI;
};
//-----------------------------------------------------------------------------
class StockColor
{
public:
static bool isColor( const char* pStockColorName );
static const ColorF& colorF( const char* pStockColorName );
static const ColorI& colorI( const char* pStockColorName );
static StringTableEntry name( const ColorF& color );
static StringTableEntry name( const ColorI& color );
static S32 getCount( void );
static const StockColorItem* getColorItem( const S32 index );
static void create( void );
static void destroy( void );
};
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
//-------------------------------------- INLINES (ColorF) //-------------------------------------- INLINES (ColorF)
// //

View file

@ -31,7 +31,7 @@ class File
{ {
public: public:
/// What is the status of our file handle? /// What is the status of our file handle?
enum Status enum FileStatus
{ {
Ok = 0, ///< Ok! Ok = 0, ///< Ok!
IOError, ///< Read or Write error IOError, ///< Read or Write error
@ -59,7 +59,7 @@ public:
private: private:
void *handle; ///< Pointer to the file handle. void *handle; ///< Pointer to the file handle.
Status currentStatus; ///< Current status of the file (Ok, IOError, etc.). FileStatus currentStatus; ///< Current status of the file (Ok, IOError, etc.).
U32 capability; ///< Keeps track of file capabilities. U32 capability; ///< Keeps track of file capabilities.
File(const File&); ///< This is here to disable the copy constructor. File(const File&); ///< This is here to disable the copy constructor.
@ -72,7 +72,7 @@ public:
/// Opens a file for access using the specified AccessMode /// Opens a file for access using the specified AccessMode
/// ///
/// @returns The status of the file /// @returns The status of the file
Status open(const char *filename, const AccessMode openMode); FileStatus open(const char *filename, const AccessMode openMode);
/// Gets the current position in the file /// Gets the current position in the file
/// ///
@ -99,7 +99,7 @@ public:
/// @endcode /// @endcode
/// ///
/// @returns The status of the file /// @returns The status of the file
Status setPosition(S32 position, bool absolutePos = true); FileStatus setPosition(S32 position, bool absolutePos = true);
/// Returns the size of the file /// Returns the size of the file
U32 getSize() const; U32 getSize() const;
@ -107,25 +107,25 @@ public:
/// Make sure everything that's supposed to be written to the file gets written. /// Make sure everything that's supposed to be written to the file gets written.
/// ///
/// @returns The status of the file. /// @returns The status of the file.
Status flush(); FileStatus flush();
/// Closes the file /// Closes the file
/// ///
/// @returns The status of the file. /// @returns The status of the file.
Status close(); FileStatus close();
/// Gets the status of the file /// Gets the status of the file
Status getStatus() const; FileStatus getStatus() const;
/// Reads "size" bytes from the file, and dumps data into "dst". /// Reads "size" bytes from the file, and dumps data into "dst".
/// The number of actual bytes read is returned in bytesRead /// The number of actual bytes read is returned in bytesRead
/// @returns The status of the file /// @returns The status of the file
Status read(U32 size, char *dst, U32 *bytesRead = NULL); FileStatus read(U32 size, char *dst, U32 *bytesRead = NULL);
/// Writes "size" bytes into the file from the pointer "src". /// Writes "size" bytes into the file from the pointer "src".
/// The number of actual bytes written is returned in bytesWritten /// The number of actual bytes written is returned in bytesWritten
/// @returns The status of the file /// @returns The status of the file
Status write(U32 size, const char *src, U32 *bytesWritten = NULL); FileStatus write(U32 size, const char *src, U32 *bytesWritten = NULL);
/// Returns whether or not this file is capable of the given function. /// Returns whether or not this file is capable of the given function.
bool hasCapability(Capability cap) const; bool hasCapability(Capability cap) const;
@ -133,8 +133,8 @@ public:
const void* getHandle() { return handle; } const void* getHandle() { return handle; }
protected: protected:
Status setStatus(); ///< Called after error encountered. FileStatus setStatus(); ///< Called after error encountered.
Status setStatus(Status status); ///< Setter for the current status. FileStatus setStatus(FileStatus status); ///< Setter for the current status.
}; };
#endif // _FILE_IO_H_ #endif // _FILE_IO_H_

View file

@ -234,7 +234,7 @@ public:
mWaterMark = FrameAllocator::getWaterMark(); mWaterMark = FrameAllocator::getWaterMark();
mMemory = reinterpret_cast<T *>( FrameAllocator::alloc( sizeof( T ) * count ) ); mMemory = reinterpret_cast<T *>( FrameAllocator::alloc( sizeof( T ) * count ) );
for( int i = 0; i < mNumObjectsInMemory; i++ ) for( S32 i = 0; i < mNumObjectsInMemory; i++ )
constructInPlace<T>( &mMemory[i] ); constructInPlace<T>( &mMemory[i] );
} }
@ -242,7 +242,7 @@ public:
~FrameTemp() ~FrameTemp()
{ {
// Call destructor // Call destructor
for( int i = 0; i < mNumObjectsInMemory; i++ ) for( S32 i = 0; i < mNumObjectsInMemory; i++ )
destructInPlace<T>( &mMemory[i] ); destructInPlace<T>( &mMemory[i] );
FrameAllocator::setWaterMark( mWaterMark ); FrameAllocator::setWaterMark( mWaterMark );

View file

@ -324,7 +324,7 @@ namespace Torque
return mFileData->mPath; return mFileData->mPath;
} }
FileNode::Status MemFile::getStatus() const FileNode::NodeStatus MemFile::getStatus() const
{ {
return mStatus; return mStatus;
} }
@ -502,7 +502,7 @@ namespace Torque
return mDirectoryData->getAttributes(attr); return mDirectoryData->getAttributes(attr);
} }
FileNode::Status MemDirectory::getStatus() const FileNode::NodeStatus MemDirectory::getStatus() const
{ {
return mStatus; return mStatus;
} }

View file

@ -74,7 +74,7 @@ namespace Torque
virtual ~MemFile(); virtual ~MemFile();
Path getName() const; Path getName() const;
Status getStatus() const; NodeStatus getStatus() const;
bool getAttributes(Attributes*); bool getAttributes(Attributes*);
U32 getPosition(); U32 getPosition();
@ -91,7 +91,7 @@ namespace Torque
MemFileSystem* mFileSystem; MemFileSystem* mFileSystem;
MemFileData* mFileData; MemFileData* mFileData;
Status mStatus; NodeStatus mStatus;
U32 mCurrentPos; U32 mCurrentPos;
bool _updateInfo(); bool _updateInfo();
@ -108,7 +108,7 @@ namespace Torque
~MemDirectory(); ~MemDirectory();
Path getName() const; Path getName() const;
Status getStatus() const; NodeStatus getStatus() const;
bool getAttributes(Attributes*); bool getAttributes(Attributes*);
bool open(); bool open();
@ -122,7 +122,7 @@ namespace Torque
U32 calculateChecksum(); U32 calculateChecksum();
Status mStatus; NodeStatus mStatus;
U32 mSearchIndex; U32 mSearchIndex;
}; };

View file

@ -55,7 +55,7 @@ bool OggDecoder::_readNextPacket( ogg_packet* packet )
while( 1 ) while( 1 )
{ {
int result = ogg_stream_packetout( &mOggStreamState, packet ); S32 result = ogg_stream_packetout( &mOggStreamState, packet );
if( result == 0 ) if( result == 0 )
{ {
if( !mOggStream->_requestData() ) if( !mOggStream->_requestData() )

View file

@ -169,7 +169,7 @@ bool OggTheoraDecoder::_init()
break; break;
} }
int result = th_decode_headerin( &mTheoraInfo, &mTheoraComment, &mTheoraSetup, &nextPacket ); S32 result = th_decode_headerin( &mTheoraInfo, &mTheoraComment, &mTheoraSetup, &nextPacket );
if( result < 0 ) if( result < 0 )
{ {
haveTheoraHeader = false; haveTheoraHeader = false;

View file

@ -89,7 +89,7 @@ bool OggVorbisDecoder::_init()
break; break;
} }
int result = vorbis_synthesis_headerin( &mVorbisInfo, &mVorbisComment, &nextPacket ); S32 result = vorbis_synthesis_headerin( &mVorbisInfo, &mVorbisComment, &nextPacket );
if( result != 0 ) if( result != 0 )
{ {
haveVorbisHeader = false; haveVorbisHeader = false;

View file

@ -91,7 +91,7 @@ Stream::Stream()
{ {
} }
const char* Stream::getStatusString(const Status in_status) const char* Stream::getStatusString(const StreamStatus in_status)
{ {
switch (in_status) { switch (in_status) {
case Ok: case Ok:

View file

@ -57,7 +57,7 @@ class Stream
// Public structs and enumerations... // Public structs and enumerations...
public: public:
/// Status constants for the stream /// Status constants for the stream
enum Status { enum StreamStatus {
Ok = 0, ///< Ok! Ok = 0, ///< Ok!
IOError, ///< Read or Write error IOError, ///< Read or Write error
EOS, ///< End of Stream reached (mostly for reads) EOS, ///< End of Stream reached (mostly for reads)
@ -74,20 +74,20 @@ public:
// Accessible only through inline accessors // Accessible only through inline accessors
private: private:
Status m_streamStatus; StreamStatus m_streamStatus;
// Derived accessible data modifiers... // Derived accessible data modifiers...
protected: protected:
void setStatus(const Status in_newStatus) { m_streamStatus = in_newStatus; } void setStatus(const StreamStatus in_newStatus) { m_streamStatus = in_newStatus; }
public: public:
Stream(); Stream();
virtual ~Stream() {} virtual ~Stream() {}
/// Gets the status of the stream /// Gets the status of the stream
Stream::Status getStatus() const { return m_streamStatus; } Stream::StreamStatus getStatus() const { return m_streamStatus; }
/// Gets a printable string form of the status /// Gets a printable string form of the status
static const char* getStatusString(const Status in_status); static const char* getStatusString(const StreamStatus in_status);
// Derived classes must override these... // Derived classes must override these...
protected: protected:

View file

@ -438,7 +438,7 @@ void StringBufferManager::updateStats()
request8 = 0; request8 = 0;
request16 = 0; request16 = 0;
U32 nstrings = strings.size(); U32 nstrings = strings.size();
for(int i=0; i < nstrings; i++) for(S32 i=0; i < nstrings; i++)
{ {
request8 += strings[i]->rc->requestCount8; request8 += strings[i]->rc->requestCount8;
request16 += strings[i]->rc->requestCount16; request16 += strings[i]->rc->requestCount16;
@ -459,7 +459,7 @@ void StringBufferManager::dumpAllStrings()
U32 nstrings = strings.size(); U32 nstrings = strings.size();
Con::printf("===== String Manager: All Strings ====="); Con::printf("===== String Manager: All Strings =====");
Con::printf(" utf8 | utf16 | string"); Con::printf(" utf8 | utf16 | string");
for(int i=0; i < nstrings; i++) for(S32 i=0; i < nstrings; i++)
{ {
UTF8* tmp = strings[i]->createCopy8(); UTF8* tmp = strings[i]->createCopy8();
strings[i]->rc->requestCount8--; strings[i]->rc->requestCount8--;

Some files were not shown because too many files have changed in this diff Show more