mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Merge remote-tracking branch 'GarageGames/development' into physx3_basic
This commit is contained in:
commit
d58a69e76c
10
.gitignore
vendored
10
.gitignore
vendored
|
|
@ -40,6 +40,11 @@ local.properties
|
|||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
*.sln
|
||||
*.vcxproj
|
||||
*.vcxproj.filters
|
||||
*.vcproj
|
||||
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
|
|
@ -62,6 +67,11 @@ local.properties
|
|||
*.vspscc
|
||||
.builds
|
||||
*.dotCover
|
||||
*.dll
|
||||
*.lib
|
||||
*.exp
|
||||
*.exe
|
||||
|
||||
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment this
|
||||
#packages/
|
||||
|
|
|
|||
11
CMakeLists.txt
Normal file
11
CMakeLists.txt
Normal 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)
|
||||
|
|
@ -21,6 +21,7 @@
|
|||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include <dae/daeError.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ AIClient::AIClient() {
|
|||
mMoveTolerance = 0.25f;
|
||||
|
||||
// Clear the triggers
|
||||
for( int i = 0; i < MaxTriggerKeys; i++ )
|
||||
for( S32 i = 0; i < MaxTriggerKeys; i++ )
|
||||
mTriggers[i] = false;
|
||||
|
||||
mAimToDestination = true;
|
||||
|
|
@ -369,7 +369,7 @@ U32 AIClient::getMoveList( Move **movePtr,U32 *numMoves ) {
|
|||
}
|
||||
|
||||
// Copy over the trigger status
|
||||
for( int i = 0; i < MaxTriggerKeys; i++ ) {
|
||||
for( S32 i = 0; i < MaxTriggerKeys; i++ ) {
|
||||
mMove.trigger[i] = mTriggers[i];
|
||||
mTriggers[i] = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ bool AIPlayer::getAIMove(Move *movePtr)
|
|||
|
||||
// Replicate the trigger state into the move so that
|
||||
// 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);
|
||||
|
||||
mLastLocation = location;
|
||||
|
|
|
|||
|
|
@ -1546,7 +1546,7 @@ void Camera::_validateEyePoint(F32 pos, MatrixF *mat)
|
|||
float dot = mDot(dir, collision.normal);
|
||||
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)
|
||||
colDist = pos;
|
||||
if (colDist < 0.0f)
|
||||
|
|
|
|||
|
|
@ -194,7 +194,7 @@ void CameraSpline::renderTimeMap()
|
|||
if(!ptr) return;
|
||||
|
||||
MRandomLCG random(1376312589 * (U32)this);
|
||||
int index = 0;
|
||||
S32 index = 0;
|
||||
for(Vector<TimeMap>::iterator itr=mTimeMap.begin(); itr != mTimeMap.end(); itr++)
|
||||
{
|
||||
Knot a;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "lighting/lightQuery.h"
|
||||
|
||||
|
||||
const U32 csmStaticCollisionMask = TerrainObjectType;
|
||||
const U32 csmStaticCollisionMask = TerrainObjectType | StaticShapeObjectType | StaticObjectType;
|
||||
|
||||
const U32 csmDynamicCollisionMask = StaticShapeObjectType;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ bool DebrisData::onAdd()
|
|||
if(!Parent::onAdd())
|
||||
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 )
|
||||
{
|
||||
|
|
@ -303,7 +303,7 @@ void DebrisData::packData(BitStream* stream)
|
|||
stream->writeString( textureName );
|
||||
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 ) )
|
||||
{
|
||||
|
|
@ -346,7 +346,7 @@ void DebrisData::unpackData(BitStream* stream)
|
|||
textureName = 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() )
|
||||
{
|
||||
|
|
@ -512,7 +512,7 @@ bool Debris::onAdd()
|
|||
}
|
||||
|
||||
// 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 )
|
||||
{
|
||||
|
|
@ -631,7 +631,7 @@ bool Debris::onAdd()
|
|||
|
||||
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] )
|
||||
{
|
||||
|
|
@ -848,7 +848,7 @@ void Debris::updateEmitters( Point3F &pos, Point3F &vel, U32 ms )
|
|||
|
||||
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] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ ConsoleDocClass( DecalManager,
|
|||
|
||||
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** 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));
|
||||
}
|
||||
|
||||
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 *pnt2 = (const Point3F*)p2;
|
||||
|
|
@ -142,7 +142,7 @@ int QSORT_CALLBACK cmpPointsXY( const void *p1, const void *p2 )
|
|||
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 *pnt2 = (const Point4F*)p2;
|
||||
|
|
@ -157,7 +157,7 @@ int QSORT_CALLBACK cmpQuadPointTheta( const void *p1, const void *p2 )
|
|||
|
||||
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** pd2 = (const DecalInstance**)p2;
|
||||
|
|
@ -168,7 +168,7 @@ int QSORT_CALLBACK cmpDecalDistance( const void *p1, const void *p2 )
|
|||
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** pd2 = (const DecalInstance**)p2;
|
||||
|
|
@ -179,14 +179,14 @@ int QSORT_CALLBACK cmpDecalRenderOrder( const void *p1, const void *p2 )
|
|||
return 1;
|
||||
else
|
||||
{
|
||||
int priority = (*pd1)->getRenderPriority() - (*pd2)->getRenderPriority();
|
||||
S32 priority = (*pd1)->getRenderPriority() - (*pd2)->getRenderPriority();
|
||||
|
||||
if ( priority != 0 )
|
||||
return priority;
|
||||
|
||||
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 )
|
||||
return id;
|
||||
|
||||
|
|
|
|||
|
|
@ -108,6 +108,9 @@ bool RenderMeshExample::onAdd()
|
|||
// Add this object to the scene
|
||||
addToScene();
|
||||
|
||||
// Refresh this object's material (if any)
|
||||
updateMaterial();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ protected:
|
|||
|
||||
public:
|
||||
CameraFX();
|
||||
virtual ~CameraFX() { }
|
||||
|
||||
MatrixF & getTrans(){ return mCamFXTrans; }
|
||||
virtual bool isExpired(){ return mElapsedTime >= mDuration; }
|
||||
|
|
|
|||
|
|
@ -106,18 +106,31 @@ ConsoleDocClass( Explosion,
|
|||
" lightEndBrightness = 0.0;\n"
|
||||
" lightNormalOffset = 2.0;\n"
|
||||
"};\n\n"
|
||||
"function createExplosion()\n"
|
||||
"function ServerPlayExplosion(%position, %datablock)\n"
|
||||
"{\n"
|
||||
" // Create a new explosion - it will explode automatically\n"
|
||||
" %pos = \"0 0 100\";\n"
|
||||
" %obj = new Explosion()\n"
|
||||
" // Play the given explosion on every client.\n"
|
||||
" // The explosion will be transmitted as an event, not attached to any object.\n"
|
||||
" for(%idx = 0; %idx < ClientGroup.getCount(); %idx++)\n"
|
||||
" {\n"
|
||||
" position = %pos;\n"
|
||||
" dataBlock = GrenadeLauncherExplosion;\n"
|
||||
" };\n"
|
||||
" %client = ClientGroup.getObject(%idx);\n"
|
||||
" commandToClient(%client, 'PlayExplosion', %position, %datablock.getId());\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"
|
||||
"// schedule an explosion\n"
|
||||
"schedule(1000, 0, createExplosion);\n"
|
||||
"schedule(1000, 0, ServerPlayExplosion, \"0 0 0\", GrenadeLauncherExplosion);\n"
|
||||
"@endtsexample"
|
||||
);
|
||||
|
||||
|
|
@ -736,9 +749,9 @@ bool ExplosionData::preload(bool server, String &errorStr)
|
|||
|
||||
if( !server )
|
||||
{
|
||||
String errorStr;
|
||||
if( !sfxResolve( &soundProfile, errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", errorStr.c_str());
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &soundProfile, sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load sound profile for explosion datablock: %s", sfxErrorStr.c_str());
|
||||
if (!particleEmitter && particleEmitterId != 0)
|
||||
if (Sim::findObject(particleEmitterId, particleEmitter) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "Error, unable to load particle emitter for explosion datablock");
|
||||
|
|
@ -929,7 +942,7 @@ bool Explosion::onAdd()
|
|||
|
||||
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] )
|
||||
{
|
||||
|
|
@ -1114,7 +1127,7 @@ void Explosion::updateEmitters( F32 dt )
|
|||
{
|
||||
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] )
|
||||
{
|
||||
|
|
@ -1134,7 +1147,7 @@ void Explosion::launchDebris( Point3F &axis )
|
|||
return;
|
||||
|
||||
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] )
|
||||
{
|
||||
|
|
@ -1160,7 +1173,7 @@ void Explosion::launchDebris( Point3F &axis )
|
|||
|
||||
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,
|
||||
|
|
@ -1249,7 +1262,7 @@ bool Explosion::explode()
|
|||
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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -287,14 +287,14 @@ bool LightningData::preload(bool server, String &errorStr)
|
|||
|
||||
if (server == false)
|
||||
{
|
||||
String errorStr;
|
||||
String sfxErrorStr;
|
||||
for (U32 i = 0; i < MaxThunders; i++) {
|
||||
if( !sfxResolve( &thunderSounds[ i ], errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str());
|
||||
if( !sfxResolve( &thunderSounds[ i ], sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
|
||||
}
|
||||
|
||||
if( !sfxResolve( &strikeSound, errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", errorStr.c_str());
|
||||
if( !sfxResolve( &strikeSound, sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "LightningData::preload: Invalid packet: %s", sfxErrorStr.c_str());
|
||||
|
||||
for (U32 i = 0; i < MaxTextures; i++)
|
||||
{
|
||||
|
|
@ -1139,7 +1139,7 @@ void LightningBolt::generateMinorNodes()
|
|||
{
|
||||
mMinorNodes.clear();
|
||||
|
||||
for( int i=0; i<mMajorNodes.numNodes - 1; i++ )
|
||||
for( S32 i=0; i<mMajorNodes.numNodes - 1; i++ )
|
||||
{
|
||||
NodeManager segment;
|
||||
segment.startPoint = mMajorNodes.nodeList[i].point;
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ ConsoleDocClass( ParticleData,
|
|||
"@see ParticleEmitterNode\n"
|
||||
);
|
||||
|
||||
static const float sgDefaultWindCoefficient = 0.0f;
|
||||
static const float sgDefaultConstantAcceleration = 0.f;
|
||||
static const float sgDefaultSpinSpeed = 1.f;
|
||||
static const float sgDefaultSpinRandomMin = 0.f;
|
||||
static const float sgDefaultSpinRandomMax = 0.f;
|
||||
static const F32 sgDefaultWindCoefficient = 0.0f;
|
||||
static const F32 sgDefaultConstantAcceleration = 0.f;
|
||||
static const F32 sgDefaultSpinSpeed = 1.f;
|
||||
static const F32 sgDefaultSpinRandomMin = 0.f;
|
||||
static const F32 sgDefaultSpinRandomMax = 0.f;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -622,7 +622,7 @@ bool ParticleData::reload(char errorBuffer[256])
|
|||
}
|
||||
/*
|
||||
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] )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -100,9 +100,9 @@ ConsoleDocClass( ParticleEmitterData,
|
|||
"@see ParticleEmitterNode\n"
|
||||
);
|
||||
|
||||
static const float sgDefaultEjectionOffset = 0.f;
|
||||
static const float sgDefaultPhiReferenceVel = 0.f;
|
||||
static const float sgDefaultPhiVariance = 360.f;
|
||||
static const F32 sgDefaultEjectionOffset = 0.f;
|
||||
static const F32 sgDefaultPhiReferenceVel = 0.f;
|
||||
static const F32 sgDefaultPhiVariance = 360.f;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ParticleEmitterData
|
||||
|
|
@ -929,7 +929,7 @@ void ParticleEmitter::prepRenderImage(SceneRenderState* state)
|
|||
//-----------------------------------------------------------------------------
|
||||
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];
|
||||
}
|
||||
|
|
@ -940,7 +940,7 @@ void ParticleEmitter::setSizes( F32 *sizeList )
|
|||
//-----------------------------------------------------------------------------
|
||||
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];
|
||||
}
|
||||
|
|
@ -1455,7 +1455,7 @@ struct SortParticle
|
|||
};
|
||||
|
||||
// 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* sp2 = (const SortParticle*)p2;
|
||||
|
|
|
|||
|
|
@ -614,7 +614,7 @@ void GameBase::onUnmount( SceneObject *obj, S32 node )
|
|||
|
||||
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" );
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ void StdMoveList::clientWriteMovePacket(BitStream *bstream)
|
|||
bstream->writeInt(start,32);
|
||||
bstream->writeInt(count,MoveCountBits);
|
||||
Move * prevMove = NULL;
|
||||
for (int i = 0; i < count; i++)
|
||||
for (S32 i = 0; i < count; i++)
|
||||
{
|
||||
move[offset + i].sendCount++;
|
||||
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
|
||||
// we already have.
|
||||
int skip = mLastMoveAck - start;
|
||||
S32 skip = mLastMoveAck - start;
|
||||
if (skip < 0)
|
||||
{
|
||||
mLastMoveAck = start;
|
||||
|
|
@ -121,7 +121,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
|
|||
{
|
||||
if (skip > count)
|
||||
skip = count;
|
||||
for (int i = 0; i < skip; i++)
|
||||
for (S32 i = 0; i < skip; i++)
|
||||
{
|
||||
prevMoveHolder.unpack(bstream,prevMove);
|
||||
prevMoveHolder.checksum = bstream->readInt(Move::ChecksumBits);
|
||||
|
|
@ -141,7 +141,7 @@ void StdMoveList::serverReadMovePacket(BitStream *bstream)
|
|||
}
|
||||
|
||||
// Put the rest on the move list.
|
||||
int index = mMoveVec.size();
|
||||
S32 index = mMoveVec.size();
|
||||
mMoveVec.increment(count);
|
||||
while (index < mMoveVec.size())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -893,7 +893,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
|
|||
// Pick the most resistant surface
|
||||
F32 bd = 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];
|
||||
F32 dot = -mDot(mVelocity,cp.normal);
|
||||
if (dot > bd) {
|
||||
|
|
@ -1204,7 +1204,7 @@ DefineEngineMethod( Item, isRotating, bool, (),,
|
|||
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"
|
||||
|
||||
"This is useful to prevent a player from immediately picking up an Item they have "
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ DefineEngineMethod( MissionArea, getArea, const char *, (),,
|
|||
char* returnBuffer = Con::getReturnBuffer(48);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ U32 PathCamera::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
if (stream->writeFlag(mask & WindowMask)) {
|
||||
stream->write(mNodeBase);
|
||||
stream->write(mNodeCount);
|
||||
for (int i = 0; i < mNodeCount; i++) {
|
||||
for (S32 i = 0; i < mNodeCount; i++) {
|
||||
CameraSpline::Knot *knot = mSpline.getKnot(i);
|
||||
mathWrite(*stream, knot->mPosition);
|
||||
mathWrite(*stream, knot->mRotation);
|
||||
|
|
@ -477,7 +477,7 @@ void PathCamera::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
mSpline.removeAll();
|
||||
stream->read(&mNodeBase);
|
||||
stream->read(&mNodeCount);
|
||||
for (int i = 0; i < mNodeCount; i++)
|
||||
for (S32 i = 0; i < mNodeCount; i++)
|
||||
{
|
||||
CameraSpline::Knot *knot = new CameraSpline::Knot();
|
||||
mathRead(*stream, &knot->mPosition);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ private:
|
|||
S32 mNodeBase;
|
||||
S32 mNodeCount;
|
||||
F32 mPosition;
|
||||
int mState;
|
||||
S32 mState;
|
||||
F32 mTarget;
|
||||
bool mTargetSet;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#define _BULLET_H_
|
||||
|
||||
// NOTE: We set these defines which bullet needs here.
|
||||
#ifdef TORQUE_OS_WIN32
|
||||
#ifdef TORQUE_OS_WIN
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
#define __APPLE__
|
||||
#elif defined(TORQUE_OS_LINUX) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(TORQUE_OS_WIN32) && !defined(WIN32)
|
||||
#elif defined(TORQUE_OS_WIN) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ bool PxMultiActorData::preload( bool server, String &errorBuffer )
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!shapeName || shapeName == '\0')
|
||||
if (!shapeName || shapeName[0] == '\0')
|
||||
{
|
||||
errorBuffer = "PxMultiActorDatas::preload: no shape name!";
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ AFTER_MODULE_INIT( Sim )
|
|||
{
|
||||
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 );
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -29,25 +29,25 @@
|
|||
#define __APPLE__
|
||||
#elif defined(TORQUE_OS_LINUX) && !defined(LINUX)
|
||||
#define LINUX
|
||||
#elif defined(TORQUE_OS_WIN32) && !defined(WIN32)
|
||||
#elif defined(TORQUE_OS_WIN) && !defined(WIN32)
|
||||
#define WIN32
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
#include <PxPhysicsAPI.h>
|
||||
#include <extensions/PxExtensionsAPI.h>
|
||||
#include <extensions/PxDefaultErrorCallback.h>
|
||||
#include <extensions/PxDefaultAllocator.h>
|
||||
#include <extensions/PxDefaultSimulationFilterShader.h>
|
||||
#include <extensions/PxDefaultCpuDispatcher.h>
|
||||
#include <extensions/PxShapeExt.h>
|
||||
#include <extensions/PxSimpleFactory.h>
|
||||
#include <foundation/PxFoundation.h>
|
||||
#include <characterkinematic/PxController.h>
|
||||
#include <common/PxIO.h>
|
||||
#include <PxExtensionsAPI.h>
|
||||
#include <PxDefaultErrorCallback.h>
|
||||
#include <PxDefaultAllocator.h>
|
||||
#include <PxDefaultSimulationFilterShader.h>
|
||||
#include <PxDefaultCpuDispatcher.h>
|
||||
#include <PxShapeExt.h>
|
||||
#include <PxSimpleFactory.h>
|
||||
#include <PxFoundation.h>
|
||||
#include <PxController.h>
|
||||
#include <PxIO.h>
|
||||
|
||||
|
||||
extern physx::PxPhysics* gPhysics3SDK;
|
||||
|
||||
#endif
|
||||
#endif // _PHYSX3_
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "T3D/physics/physx3/px3Body.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/px3Collision.h"
|
||||
|
||||
|
|
@ -123,24 +123,23 @@ bool Px3Body::init( PhysicsCollision *shape,
|
|||
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;
|
||||
if(isDebris)
|
||||
colData.word0 = PX3_DEBRIS;
|
||||
else if(isTrigger)
|
||||
{
|
||||
//We don't want trigger shapes taking part in shape pair intersection tests
|
||||
pShape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, false);
|
||||
colData.word0 = PX3_TRIGGER;
|
||||
}
|
||||
colData.word0 = PX3_TRIGGER;
|
||||
else
|
||||
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
|
||||
pShape->setContactOffset(0.01f);
|
||||
pShape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, !isTrigger);
|
||||
pShape->setFlag(physx::PxShapeFlag::eSCENE_QUERY_SHAPE,true);
|
||||
pShape->setSimulationFilterData(colData);
|
||||
pShape->setQueryFilterData(colData);
|
||||
pShape->setSimulationFilterData(colData);
|
||||
pShape->setQueryFilterData(colData);
|
||||
}
|
||||
|
||||
//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::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
|
||||
|
|
@ -366,6 +369,23 @@ void Px3Body::setSimulationEnabled( bool enabled )
|
|||
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 )
|
||||
{
|
||||
AssertFatal( mActor, "Px3Body::setTransform - The actor is null!" );
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3BODY_H_
|
||||
#define _T3D_PHYSICS_PX3BODY_H_
|
||||
#ifndef _PX3BODY_H_
|
||||
#define _PX3BODY_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSBODY_H_
|
||||
#include "T3D/physics/physicsBody.h"
|
||||
|
|
@ -88,6 +88,7 @@ public:
|
|||
// PhysicsObject
|
||||
virtual PhysicsWorld* getWorld();
|
||||
virtual void setTransform( const MatrixF &xfm );
|
||||
virtual void moveKinematicTo( const MatrixF &xfm );
|
||||
virtual MatrixF& getTransform( MatrixF *outMatrix );
|
||||
virtual Box3F getWorldBounds();
|
||||
virtual void setSimulationEnabled( bool enabled );
|
||||
|
|
@ -118,4 +119,4 @@ public:
|
|||
virtual void applyImpulse( const Point3F &origin, const Point3F &force );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3BODY_H_
|
||||
|
|
|
|||
137
Engine/source/T3D/physics/physx3/px3Casts.h
Normal file
137
Engine/source/T3D/physics/physx3/px3Casts.h
Normal 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_
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
#include "math/mPoint3.h"
|
||||
#include "math/mMatrix.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/px3Stream.h"
|
||||
|
||||
|
|
@ -105,7 +105,10 @@ bool Px3Collision::addConvex( const Point3F *points,
|
|||
convexMesh = gPhysics3SDK->createConvexMesh(in);
|
||||
|
||||
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);
|
||||
mColShapes.push_back(desc);
|
||||
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
|
||||
{
|
||||
currentSample->materialIndex0 = 0;
|
||||
currentSample->materialIndex1 = 0;
|
||||
currentSample->materialIndex0 = physx::PxHeightFieldMaterial::eHOLE;
|
||||
currentSample->materialIndex1 = physx::PxHeightFieldMaterial::eHOLE;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentSample->materialIndex0 = 1;
|
||||
currentSample->materialIndex1 = 1;
|
||||
currentSample->materialIndex0 = 0;
|
||||
currentSample->materialIndex1 = 0;
|
||||
}
|
||||
|
||||
int flag = ( column + tess ) % 2;
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3COLLISION_H_
|
||||
#define _T3D_PHYSICS_PX3COLLISION_H_
|
||||
#ifndef _PX3COLLISION_H_
|
||||
#define _PX3COLLISION_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSCOLLISION_H_
|
||||
#include "T3D/physics/physicsCollision.h"
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
#ifndef _MMATRIX_H_
|
||||
#include "math/mMatrix.h"
|
||||
#endif
|
||||
//nasty hate doing this!
|
||||
|
||||
#include <foundation/PxTransform.h>
|
||||
|
||||
//forward declare
|
||||
|
|
@ -84,4 +84,4 @@ public:
|
|||
const MatrixF &localXfm );
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3COLLISION_H_
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "T3D/physics/physx3/px3Player.h"
|
||||
#include "T3D/physics/physicsPlugin.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 "collision/collision.h"
|
||||
|
||||
|
|
@ -322,7 +322,10 @@ void Px3Player::setScale( const Point3F &scale )
|
|||
|
||||
Box3F Px3Player::getWorldBounds()
|
||||
{
|
||||
Con::warnf( "Px3Player::getWorldBounds - not implemented" );
|
||||
return Box3F::Invalid;
|
||||
physx::PxBounds3 bounds;
|
||||
physx::PxRigidDynamic *actor = mController->getActor();
|
||||
physx::PxShape *shape = px3GetFirstShape(actor);
|
||||
bounds = physx::PxShapeExt::getWorldBounds(*shape,*actor);
|
||||
return px3Cast<Box3F>( bounds );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -101,4 +101,4 @@ public:
|
|||
};
|
||||
|
||||
|
||||
#endif // _PXPLAYER_H
|
||||
#endif // _PX3PLAYER_H_
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ AFTER_MODULE_INIT( Sim )
|
|||
{
|
||||
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 );
|
||||
#endif
|
||||
}
|
||||
|
|
@ -224,4 +224,3 @@ U32 Px3Plugin::getWorldCount() const
|
|||
{
|
||||
return mPhysicsWorldLookup.size();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,13 +20,15 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3PLUGIN_H_
|
||||
#define _T3D_PHYSICS_PX3PLUGIN_H_
|
||||
#ifndef _PX3PLUGIN_H_
|
||||
#define _PX3PLUGIN_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSPLUGIN_H_
|
||||
#include "T3D/physics/physicsPlugin.h"
|
||||
#endif
|
||||
|
||||
class Px3ClothShape;
|
||||
|
||||
class Px3Plugin : public PhysicsPlugin
|
||||
{
|
||||
public:
|
||||
|
|
@ -52,7 +54,6 @@ public:
|
|||
virtual PhysicsWorld* getWorld( const String &worldName ) const;
|
||||
virtual PhysicsWorld* getWorld() const;
|
||||
virtual U32 getWorldCount() const;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3PLUGIN_H_
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _T3D_PHYSICS_PX3STREAM_H_
|
||||
#define _T3D_PHYSICS_PX3STREAM_H_
|
||||
#ifndef _PX3STREAM_H_
|
||||
#define _PX3STREAM_H_
|
||||
|
||||
#ifndef _PHYSX3_H_
|
||||
#include "T3D/physics/physx3/px3.h"
|
||||
|
|
@ -74,4 +74,4 @@ public:
|
|||
virtual ~Px3ConsoleStream();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // _PX3STREAM_H_
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _PHYSX3_UTILS_H_
|
||||
#define _PHYSX3_UTILS_H_
|
||||
#ifndef _PX3UTILS_H_
|
||||
#define _PX3UTILS_H_
|
||||
|
||||
namespace physx
|
||||
{
|
||||
|
|
@ -31,5 +31,4 @@ namespace physx
|
|||
|
||||
extern physx::PxShape* px3GetFirstShape(physx::PxRigidActor *actor);
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _PX3UTILS_H_
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include "T3D/physics/physx3/px3.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/physicsUserData.h"
|
||||
|
||||
|
|
@ -54,6 +54,23 @@ physx::PxDefaultAllocator Px3World::smMemoryAlloc;
|
|||
F32 Px3World::smPhysicsStepTime = 1.0f/(F32)TickMs;
|
||||
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 ),
|
||||
mProcessList( NULL ),
|
||||
mIsSimulating( false ),
|
||||
|
|
@ -198,7 +215,6 @@ void Px3World::destroyWorld()
|
|||
mScene->release();
|
||||
mScene = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
||||
|
|
@ -221,10 +237,12 @@ bool Px3World::initWorld( bool isServer, ProcessList *processList )
|
|||
sceneDesc.cpuDispatcher = smCpuDispatcher;
|
||||
Con::printf("PhysX3 using Cpu: %d workers", smCpuDispatcher->getWorkerCount());
|
||||
}
|
||||
|
||||
|
||||
|
||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_CCD;
|
||||
sceneDesc.flags |= physx::PxSceneFlag::eENABLE_ACTIVETRANSFORMS;
|
||||
|
||||
sceneDesc.filterShader = physx::PxDefaultSimulationFilterShader;
|
||||
sceneDesc.filterShader = sCcdFilterShader;
|
||||
|
||||
mScene = gPhysics3SDK->createScene(sceneDesc);
|
||||
|
||||
|
|
@ -559,7 +577,6 @@ void Px3World::onDebugDraw( const SceneRenderState *state )
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
//set simulation timing via script
|
||||
DefineEngineFunction( physx3SetSimulationTiming, void, ( F32 stepTime, U32 maxSteps ),, "Set simulation timing of the PhysX 3 plugin" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@
|
|||
// IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _PHYSX3_WORLD_H_
|
||||
#define _PHYSX3_WORLD_H_
|
||||
#ifndef _PX3WORLD_H_
|
||||
#define _PX3WORLD_H_
|
||||
|
||||
#ifndef _T3D_PHYSICS_PHYSICSWORLD_H_
|
||||
#include "T3D/physics/physicsWorld.h"
|
||||
|
|
@ -53,7 +53,6 @@ class Px3World : public PhysicsWorld
|
|||
protected:
|
||||
|
||||
physx::PxScene* mScene;
|
||||
|
||||
bool mIsEnabled;
|
||||
bool mIsSimulating;
|
||||
bool mIsServer;
|
||||
|
|
@ -71,7 +70,6 @@ protected:
|
|||
static physx::PxVisualDebuggerConnection* smPvdConnection;
|
||||
static F32 smPhysicsStepTime;
|
||||
static U32 smPhysicsMaxIterations;
|
||||
|
||||
F32 mAccumulator;
|
||||
bool _simulate(const F32 dt);
|
||||
|
||||
|
|
@ -105,6 +103,4 @@ public:
|
|||
static void setTiming(F32 stepTime,U32 maxIterations);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#endif // _PX3WORLD_H_
|
||||
|
|
|
|||
|
|
@ -427,9 +427,9 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
{
|
||||
for( U32 i = 0; i < MaxSounds; ++ i )
|
||||
{
|
||||
String errorStr;
|
||||
if( !sfxResolve( &sound[ i ], errorStr ) )
|
||||
Con::errorf( "PlayerData::preload: %s", errorStr.c_str() );
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &sound[ i ], sfxErrorStr ) )
|
||||
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
|
||||
// Get the named ones first so they can be indexed directly.
|
||||
ActionAnimation *dp = &actionList[0];
|
||||
for (int i = 0; i < NumTableActionAnims; i++,dp++)
|
||||
for (S32 i = 0; i < NumTableActionAnims; i++,dp++)
|
||||
{
|
||||
ActionAnimationDef *sp = &ActionAnimationList[i];
|
||||
dp->name = sp->name;
|
||||
|
|
@ -492,7 +492,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
if (dStricmp(sp->name, "jet") != 0)
|
||||
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))
|
||||
{
|
||||
|
|
@ -509,7 +509,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
// Resolve lookAction index
|
||||
dp = &actionList[0];
|
||||
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 )
|
||||
lookAction = c;
|
||||
|
||||
|
|
@ -557,7 +557,7 @@ bool PlayerData::preload(bool server, String &errorStr)
|
|||
if (!Sim::findObject(dustID, dustEmitter))
|
||||
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( Sim::findObject( splashEmitterIDList[i], splashEmitterList[i] ) == false)
|
||||
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());
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if(server)
|
||||
mCRCFP[i] = fileRef->getChecksum();
|
||||
|
|
@ -647,7 +650,7 @@ bool PlayerData::isTableSequence(S32 seq)
|
|||
{
|
||||
// The sequences from the table must already have
|
||||
// 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)
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -1944,7 +1947,7 @@ void Player::reSkin()
|
|||
Vector<String> 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 newSkin( skins[i] );
|
||||
|
|
@ -1961,7 +1964,7 @@ void Player::reSkin()
|
|||
|
||||
// Apply skin to both 3rd person and 1st person shape instances
|
||||
mShapeInstance->reSkin( newSkin, oldSkin );
|
||||
for ( int j = 0; j < ShapeBase::MaxMountedImages; j++ )
|
||||
for ( S32 j = 0; j < ShapeBase::MaxMountedImages; j++ )
|
||||
{
|
||||
if (mShapeFPInstance[j])
|
||||
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 *ei = &end.x;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (S32 i = 0; i < 3; i++) {
|
||||
if (*si < *ei) {
|
||||
if (*si > *bmax || *ei < *bmin)
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -320,9 +320,9 @@ bool ProjectileData::preload(bool server, String &errorStr)
|
|||
if (Sim::findObject(decalId, decal) == false)
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId);
|
||||
|
||||
String errorStr;
|
||||
if( !sfxResolve( &sound, errorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", errorStr.c_str());
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &sound, sfxErrorStr ) )
|
||||
Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet: %s", sfxErrorStr.c_str());
|
||||
|
||||
if (!lightDesc && lightDescId != 0)
|
||||
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.
|
||||
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
|
||||
updateSound();
|
||||
|
|
|
|||
|
|
@ -215,9 +215,9 @@ public:
|
|||
|
||||
void updateSound();
|
||||
|
||||
virtual bool calculateImpact( float simTime,
|
||||
virtual bool calculateImpact( F32 simTime,
|
||||
Point3F &pointOfImpact,
|
||||
float &impactTime );
|
||||
F32 &impactTime );
|
||||
|
||||
void setInitialPosition( const Point3F& pos );
|
||||
void setInitialVelocity( const Point3F& vel );
|
||||
|
|
|
|||
|
|
@ -136,11 +136,11 @@ bool ProximityMineData::preload( bool server, String& errorStr )
|
|||
if ( !server )
|
||||
{
|
||||
// Resolve sounds
|
||||
String errorStr;
|
||||
if( !sfxResolve( &armingSound, errorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() );
|
||||
if( !sfxResolve( &triggerSound, errorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", errorStr.c_str() );
|
||||
String sfxErrorStr;
|
||||
if( !sfxResolve( &armingSound, sfxErrorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
|
||||
if( !sfxResolve( &triggerSound, sfxErrorStr ) )
|
||||
Con::errorf( ConsoleLogEntry::General, "ProximityMineData::preload: Invalid packet: %s", sfxErrorStr.c_str() );
|
||||
}
|
||||
|
||||
if ( mShape )
|
||||
|
|
@ -451,7 +451,7 @@ void ProximityMine::processTick( const Move* move )
|
|||
SimpleQueryList sql;
|
||||
getContainer()->findObjects( triggerBox, sTriggerCollisionMask,
|
||||
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
|
||||
if ( ( sql.mList[i] == mOwner && !mDataBlock->triggerOnOwner ) ||
|
||||
|
|
|
|||
|
|
@ -265,8 +265,8 @@ void Rigid::translateCenterOfMass(const Point3F &oldPos,const Point3F &newPos)
|
|||
MatrixF oldx,newx;
|
||||
oldx.setCrossProduct(oldPos);
|
||||
newx.setCrossProduct(newPos);
|
||||
for (int row = 0; row < 3; row++)
|
||||
for (int col = 0; col < 3; col++) {
|
||||
for (S32 row = 0; row < 3; row++)
|
||||
for (S32 col = 0; col < 3; col++) {
|
||||
F32 n = newx(row,col), o = oldx(row,col);
|
||||
objectInertia(row,col) += mass * ((o * o) - (n * n));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ namespace {
|
|||
|
||||
// Physics and collision constants
|
||||
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 |
|
||||
StaticShapeObjectType | VehicleObjectType |
|
||||
|
|
@ -302,6 +302,7 @@ bool RigidShapeData::preload(bool server, String &errorStr)
|
|||
if (!collisionDetails.size() || collisionDetails[0] == -1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -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 );
|
||||
|
||||
// Collision points...
|
||||
for (int i = 0; i < mCollisionList.getCount(); i++)
|
||||
for (S32 i = 0; i < mCollisionList.getCount(); i++)
|
||||
{
|
||||
const Collision& collision = mCollisionList[i];
|
||||
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...
|
||||
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];
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ class RigidShape: public ShapeBase
|
|||
CollisionList mContacts;
|
||||
Rigid mRigid;
|
||||
ShapeBaseConvex mConvex;
|
||||
int restCount;
|
||||
S32 restCount;
|
||||
|
||||
SimObjectPtr<ParticleEmitter> mDustEmitterList[RigidShapeData::VC_NUM_DUST_EMITTERS];
|
||||
SimObjectPtr<ParticleEmitter> mSplashEmitterList[RigidShapeData::VC_NUM_SPLASH_EMITTERS];
|
||||
|
|
|
|||
|
|
@ -306,7 +306,10 @@ bool ShapeBaseData::preload(bool server, String &errorStr)
|
|||
Torque::FS::FileNodeRef fileRef = Torque::FS::GetFileNode(mShape.getPath());
|
||||
|
||||
if (!fileRef)
|
||||
{
|
||||
errorStr = String::ToString("ShapeBaseData: Couldn't load shape \"%s\"",shapeName);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(server)
|
||||
mCRC = fileRef->getChecksum();
|
||||
|
|
@ -898,17 +901,9 @@ ShapeBase::ShapeBase()
|
|||
mCloakLevel( 0.0f ),
|
||||
mDamageFlash( 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 ),
|
||||
mConvexList( new Convex ),
|
||||
mCameraFov( 90.0f ),
|
||||
mShieldNormal( 0.0f, 0.0f, 1.0f ),
|
||||
mFadeOut( true ),
|
||||
mFading( false ),
|
||||
mFadeVal( 1.0f ),
|
||||
|
|
@ -1282,7 +1277,7 @@ void ShapeBase::processTick(const Move* move)
|
|||
{
|
||||
mMoveMotion = true;
|
||||
}
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
{
|
||||
setImageMotionState(i, mMoveMotion);
|
||||
}
|
||||
|
|
@ -1305,7 +1300,7 @@ void ShapeBase::processTick(const Move* move)
|
|||
// Advance images
|
||||
if (isServerObject())
|
||||
{
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
{
|
||||
if (mMountedImageList[i].dataBlock)
|
||||
updateImageState(i, TickSec);
|
||||
|
|
@ -1347,7 +1342,7 @@ void ShapeBase::advanceTime(F32 dt)
|
|||
// advanced at framerate.
|
||||
advanceThreads(dt);
|
||||
updateAudioPos();
|
||||
for (int i = 0; i < MaxMountedImages; i++)
|
||||
for (S32 i = 0; i < MaxMountedImages; i++)
|
||||
if (mMountedImageList[i].dataBlock)
|
||||
{
|
||||
updateImageState(i, dt);
|
||||
|
|
@ -1382,9 +1377,6 @@ void ShapeBase::advanceTime(F32 dt)
|
|||
mCloakLevel = 0.0;
|
||||
}
|
||||
}
|
||||
if(mInvincibleOn)
|
||||
updateInvincibleEffect(dt);
|
||||
|
||||
if(mFading)
|
||||
{
|
||||
mFadeElapsedTime += dt;
|
||||
|
|
@ -1987,119 +1979,6 @@ void ShapeBase::getCameraTransform(F32* pos,MatrixF* mat)
|
|||
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)
|
||||
{
|
||||
*min = mDataBlock->cameraMinDist;
|
||||
|
|
@ -2153,52 +2032,6 @@ bool ShapeBase::useObjsEyePoint() const
|
|||
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&)
|
||||
{
|
||||
|
|
@ -2240,7 +2073,7 @@ void ShapeBase::stopAudio(U32 slot)
|
|||
void ShapeBase::updateServerAudio()
|
||||
{
|
||||
// Timeout non-looping sounds
|
||||
for (int i = 0; i < MaxSoundThreads; i++) {
|
||||
for (S32 i = 0; i < MaxSoundThreads; i++) {
|
||||
Sound& st = mSoundThread[i];
|
||||
if (st.play && st.timeout && st.timeout < Sim::getCurrentTime()) {
|
||||
clearMaskBits(SoundMaskN << i);
|
||||
|
|
@ -2280,7 +2113,7 @@ void ShapeBase::updateAudioState(Sound& st)
|
|||
|
||||
void ShapeBase::updateAudioPos()
|
||||
{
|
||||
for (int i = 0; i < MaxSoundThreads; i++)
|
||||
for (S32 i = 0; i < MaxSoundThreads; i++)
|
||||
{
|
||||
SFXSource* source = mSoundThread[i].sound;
|
||||
if ( source )
|
||||
|
|
@ -3102,8 +2935,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if(!stream->writeFlag(mask & (NameMask | DamageMask | SoundMask | MeshHiddenMask |
|
||||
ThreadMask | ImageMask | CloakMask | InvincibleMask |
|
||||
ShieldMask | SkinMask)))
|
||||
ThreadMask | ImageMask | CloakMask | SkinMask)))
|
||||
return retMask;
|
||||
|
||||
if (stream->writeFlag(mask & DamageMask)) {
|
||||
|
|
@ -3113,7 +2945,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if (stream->writeFlag(mask & ThreadMask)) {
|
||||
for (int i = 0; i < MaxScriptThreads; i++) {
|
||||
for (S32 i = 0; i < MaxScriptThreads; i++) {
|
||||
Thread& st = mScriptThread[i];
|
||||
if (stream->writeFlag( (st.sequence != -1 || st.state == Thread::Destroy) && (mask & (ThreadMaskN << i)) ) ) {
|
||||
stream->writeInt(st.sequence,ThreadSequenceBits);
|
||||
|
|
@ -3126,7 +2958,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
if (stream->writeFlag(mask & SoundMask)) {
|
||||
for (int i = 0; i < MaxSoundThreads; i++) {
|
||||
for (S32 i = 0; i < MaxSoundThreads; i++) {
|
||||
Sound& st = mSoundThread[i];
|
||||
if (stream->writeFlag(mask & (SoundMaskN << i)))
|
||||
if (stream->writeFlag(st.play))
|
||||
|
|
@ -3136,7 +2968,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
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))) {
|
||||
MountedImage& image = mMountedImageList[i];
|
||||
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.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);
|
||||
|
|
@ -3173,7 +3005,7 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
}
|
||||
|
||||
// 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))
|
||||
{
|
||||
|
|
@ -3194,14 +3026,6 @@ U32 ShapeBase::packUpdate(NetConnection *con, U32 mask, BitStream *stream)
|
|||
if (stream->writeFlag(mask & NameMask)) {
|
||||
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 ) )
|
||||
stream->writeBits( mMeshHidden );
|
||||
|
|
@ -3271,7 +3095,7 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
|
||||
// Mounted Images
|
||||
if (stream->readFlag()) {
|
||||
for (int i = 0; i < MaxMountedImages; i++) {
|
||||
for (S32 i = 0; i < MaxMountedImages; i++) {
|
||||
if (stream->readFlag()) {
|
||||
MountedImage& image = mMountedImageList[i];
|
||||
ShapeBaseImageData* imageData = 0;
|
||||
|
|
@ -3303,14 +3127,14 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
image.triggerDown = 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);
|
||||
int altCount = stream->readInt(3);
|
||||
int reloadCount = stream->readInt(3);
|
||||
S32 count = stream->readInt(3);
|
||||
S32 altCount = stream->readInt(3);
|
||||
S32 reloadCount = stream->readInt(3);
|
||||
|
||||
bool datablockChange = image.dataBlock != imageData;
|
||||
if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle))
|
||||
|
|
@ -3443,25 +3267,6 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream)
|
|||
if (stream->readFlag()) { // NameMask
|
||||
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
|
||||
{
|
||||
|
|
@ -3742,7 +3547,7 @@ void ShapeBase::reSkin()
|
|||
Vector<String> 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 newSkin( skins[i] );
|
||||
|
|
@ -4826,18 +4631,6 @@ DefineEngineMethod( ShapeBase, setCameraFov, void, ( F32 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 ),,
|
||||
"@brief Fade the object in or out without removing it from the scene.\n\n"
|
||||
|
||||
|
|
|
|||
|
|
@ -689,7 +689,6 @@ public:
|
|||
MaxMountedImages = 4, ///< Should be a power of 2
|
||||
MaxImageEmitters = 3,
|
||||
NumImageBits = 3,
|
||||
ShieldNormalBits = 8,
|
||||
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
|
||||
/// @{
|
||||
bool mMoveMotion; ///< Indicates that a Move has come in requesting x, y or z motion
|
||||
|
|
@ -918,9 +906,6 @@ protected:
|
|||
|
||||
bool mFlipFadeVal;
|
||||
|
||||
/// Last shield direction (cur. unused)
|
||||
Point3F mShieldNormal;
|
||||
|
||||
/// Camera shake caused by weapon fire.
|
||||
CameraShake *mWeaponCamShake;
|
||||
|
||||
|
|
@ -1156,11 +1141,9 @@ public:
|
|||
DamageMask = Parent::NextFreeMask << 1,
|
||||
NoWarpMask = Parent::NextFreeMask << 2,
|
||||
CloakMask = Parent::NextFreeMask << 3,
|
||||
ShieldMask = Parent::NextFreeMask << 4,
|
||||
InvincibleMask = Parent::NextFreeMask << 5,
|
||||
SkinMask = Parent::NextFreeMask << 6,
|
||||
MeshHiddenMask = Parent::NextFreeMask << 7,
|
||||
SoundMaskN = Parent::NextFreeMask << 8, ///< Extends + MaxSoundThreads bits
|
||||
SkinMask = Parent::NextFreeMask << 4,
|
||||
MeshHiddenMask = Parent::NextFreeMask << 5,
|
||||
SoundMaskN = Parent::NextFreeMask << 6, ///< Extends + MaxSoundThreads bits
|
||||
ThreadMaskN = SoundMaskN << MaxSoundThreads, ///< Extends + MaxScriptThreads bits
|
||||
ImageMaskN = ThreadMaskN << MaxScriptThreads, ///< Extends + MaxMountedImage bits
|
||||
NextFreeMask = ImageMaskN << MaxMountedImages
|
||||
|
|
@ -1702,26 +1685,6 @@ public:
|
|||
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
|
||||
/// @{
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ ShapeBaseImageData::ShapeBaseImageData()
|
|||
scriptAnimTransitionTime = 0.25f;
|
||||
|
||||
//
|
||||
for (int i = 0; i < MaxStates; i++) {
|
||||
for (S32 i = 0; i < MaxStates; i++) {
|
||||
stateName[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());
|
||||
|
||||
if (!fileRef)
|
||||
{
|
||||
errorStr = String::ToString("ShapeBaseImageData: Couldn't load shape \"%s\"",name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(server)
|
||||
{
|
||||
|
|
@ -3057,7 +3060,7 @@ TICKAGAIN:
|
|||
|
||||
if (image.spinThread[i])
|
||||
{
|
||||
float timeScale;
|
||||
F32 timeScale;
|
||||
|
||||
switch (stateData.spin)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ bool Trigger::castRay(const Point3F &start, const Point3F &end, RayInfo* info)
|
|||
F32 const *si = &start.x;
|
||||
F32 const *ei = &end.x;
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (S32 i = 0; i < 3; i++)
|
||||
{
|
||||
if (*si < *ei)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -442,7 +442,7 @@ void TSStatic::reSkin()
|
|||
Vector<String> 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 newSkin( skins[i] );
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ AITurretShapeData::AITurretShapeData()
|
|||
|
||||
weaponLeadVelocity = 0;
|
||||
|
||||
for (int i = 0; i < MaxStates; i++) {
|
||||
for (S32 i = 0; i < MaxStates; i++) {
|
||||
stateName[i] = 0;
|
||||
stateTransitionAtRest[i] = 0;
|
||||
stateTransitionNotAtRest[i] = 0;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ const F32 sVehicleGravity = -20;
|
|||
|
||||
// Physics and collision constants
|
||||
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 {}
|
||||
|
||||
|
|
@ -218,6 +218,7 @@ bool VehicleData::preload(bool server, String &errorStr)
|
|||
if (!collisionDetails.size() || collisionDetails[0] == -1)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -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].y );
|
||||
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] );
|
||||
}
|
||||
|
|
@ -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].y );
|
||||
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] );
|
||||
}
|
||||
|
|
@ -718,7 +719,7 @@ bool Vehicle::onAdd()
|
|||
{
|
||||
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]->onNewDataBlock( mDataBlock->dustEmitter, false );
|
||||
|
|
@ -1804,7 +1805,7 @@ void Vehicle::updateDamageSmoke( F32 dt )
|
|||
F32 damagePercent = mDamage / mDataBlock->maxDamage;
|
||||
if( damagePercent >= mDataBlock->damageLevelTolerance[j] )
|
||||
{
|
||||
for( int i=0; i<mDataBlock->numDmgEmitterAreas; i++ )
|
||||
for( S32 i=0; i<mDataBlock->numDmgEmitterAreas; i++ )
|
||||
{
|
||||
MatrixF trans = getTransform();
|
||||
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);
|
||||
|
||||
// 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];
|
||||
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.
|
||||
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];
|
||||
PrimBuild::color3f(1, 1, 1);
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ class Vehicle: public ShapeBase
|
|||
CollisionList mContacts;
|
||||
Rigid mRigid;
|
||||
ShapeBaseConvex mConvex;
|
||||
int restCount;
|
||||
S32 restCount;
|
||||
|
||||
SimObjectPtr<ParticleEmitter> mDustEmitterList[VehicleData::VC_NUM_DUST_EMITTERS];
|
||||
SimObjectPtr<ParticleEmitter> mDamageEmitterList[VehicleData::VC_NUM_DAMAGE_EMITTERS];
|
||||
|
|
|
|||
|
|
@ -298,7 +298,7 @@ void HTTPObject::onDisconnect()
|
|||
Parent::onDisconnect();
|
||||
}
|
||||
|
||||
bool HTTPObject::processLine(U8 *line)
|
||||
bool HTTPObject::processLine(UTF8 *line)
|
||||
{
|
||||
if(mParseState == ParsingStatusLine)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
virtual void onConnected();
|
||||
virtual void onConnectFailed();
|
||||
virtual void onDisconnect();
|
||||
bool processLine(U8 *line);
|
||||
bool processLine(UTF8 *line);
|
||||
|
||||
DECLARE_CONOBJECT(HTTPObject);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ DefineEngineMethod(TCPObject, send, void, (const char *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"
|
||||
|
||||
"This method starts a listener which looks for incoming TCP connections to a port. "
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@
|
|||
/// 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.
|
||||
#define TORQUE_GAME_ENGINE 3500
|
||||
#define TORQUE_GAME_ENGINE 3501
|
||||
|
||||
/// 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
|
||||
U32 getVersionNumber();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ extern "C" {
|
|||
return so->getClassName();
|
||||
}
|
||||
|
||||
void *SimObject_GetFieldList(SimObject *so, int &outNumFields)
|
||||
void *SimObject_GetFieldList(SimObject *so, S32 &outNumFields)
|
||||
{
|
||||
const AbstractClassRep::FieldList &fl = so->getFieldList();
|
||||
outNumFields = fl.size();
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
// 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/winDispatch.h"
|
||||
#endif
|
||||
|
|
@ -164,7 +164,7 @@ extern "C" {
|
|||
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 );
|
||||
if( object )
|
||||
|
|
@ -222,7 +222,7 @@ extern "C" {
|
|||
{
|
||||
// maxArgs improper on a number of console function/methods
|
||||
if (argc < entry->mMinArgs)// || argc > entry->mMaxArgs)
|
||||
return "";
|
||||
return false;
|
||||
|
||||
SimObject* o = NULL;
|
||||
|
||||
|
|
@ -230,7 +230,7 @@ extern "C" {
|
|||
{
|
||||
o = Sim::findObject(dAtoi(argv[1]));
|
||||
if (!o)
|
||||
return "";
|
||||
return false;
|
||||
}
|
||||
|
||||
return entry->cb.mBoolCallbackFunc(o, argc, argv);
|
||||
|
|
@ -291,12 +291,12 @@ extern "C" {
|
|||
entry->cb.mVoidCallbackFunc(o, argc, argv);
|
||||
}
|
||||
|
||||
int script_simobject_get_id(SimObject* so)
|
||||
S32 script_simobject_get_id(SimObject* so)
|
||||
{
|
||||
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;
|
||||
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())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
#include "windowManager/platformWindow.h"
|
||||
#include "windowManager/platformWindowMgr.h"
|
||||
|
||||
#ifdef TORQUE_OS_WIN32
|
||||
#ifdef TORQUE_OS_WIN
|
||||
#include "windowManager/win32/win32Window.h"
|
||||
#include "windowManager/win32/winDispatch.h"
|
||||
extern void createFontInit(void);
|
||||
|
|
@ -37,7 +37,7 @@ extern void createFontShutdown(void);
|
|||
#endif
|
||||
|
||||
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
|
||||
extern INT CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo);
|
||||
extern S32 CreateMiniDump(LPEXCEPTION_POINTERS ExceptionInfo);
|
||||
#endif
|
||||
|
||||
static HashTable<StringTableEntry,StringTableEntry> gSecureScript;
|
||||
|
|
@ -47,7 +47,7 @@ static HashTable<StringTableEntry,StringTableEntry> gSecureScript;
|
|||
// ObjC hooks for shared library support
|
||||
// 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_engineshutdown();
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
// 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 )
|
||||
|
|
@ -105,7 +105,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
// tick Torque 3D's main loop
|
||||
int torque_enginetick()
|
||||
S32 torque_enginetick()
|
||||
{
|
||||
|
||||
#if defined( TORQUE_MINIDUMP ) && defined( TORQUE_RELEASE )
|
||||
|
|
@ -139,7 +139,7 @@ extern "C" {
|
|||
}
|
||||
|
||||
// shutdown the engine
|
||||
int torque_engineshutdown()
|
||||
S32 torque_engineshutdown()
|
||||
{
|
||||
|
||||
#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);
|
||||
}
|
||||
|
|
@ -303,7 +303,7 @@ extern "C" {
|
|||
Namespace::Entry* entry = GetEntry(nameSpace, name);
|
||||
|
||||
if (!entry)
|
||||
return "";
|
||||
return false;
|
||||
|
||||
return entry->cb.mBoolCallbackFunc(NULL, argc, argv);
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@ extern "C" {
|
|||
PlatformWindowManager::get()->getFirstWindow()->setSize(Point2I(width,height));
|
||||
}
|
||||
|
||||
#ifdef TORQUE_OS_WIN32
|
||||
#ifdef TORQUE_OS_WIN
|
||||
// retrieve the hwnd of our render window
|
||||
void* torque_gethwnd()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ public:
|
|||
}
|
||||
|
||||
// Accessors
|
||||
int getCount() const { return mCount; }
|
||||
S32 getCount() const { return mCount; }
|
||||
F32 getTime() const { return mT; }
|
||||
F32 getMaxHeight() const { return mMaxHeight; }
|
||||
|
||||
|
|
|
|||
|
|
@ -69,21 +69,21 @@ void GjkCollisionState::swap()
|
|||
void GjkCollisionState::compute_det()
|
||||
{
|
||||
// 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)
|
||||
dp[i][last] = dp[last][i] = mDot(y[i], y[last]);
|
||||
dp[last][last] = mDot(y[last], y[last]);
|
||||
|
||||
// Calulate the determinent
|
||||
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) {
|
||||
int s2 = sj | last_bit;
|
||||
S32 s2 = sj | last_bit;
|
||||
det[s2][j] = dp[last][last] - dp[last][j];
|
||||
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) {
|
||||
int s3 = sk | s2;
|
||||
S32 s3 = sk | s2;
|
||||
det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) +
|
||||
det[s2][last] * (dp[last][j] - dp[last][k]);
|
||||
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;
|
||||
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) {
|
||||
sum += 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 (s & bit) {
|
||||
if (det[s][i] <= 0)
|
||||
|
|
@ -152,7 +152,7 @@ inline bool GjkCollisionState::valid(int s)
|
|||
inline bool GjkCollisionState::closest(VectorF& v)
|
||||
{
|
||||
compute_det();
|
||||
for (int s = bits; s; --s) {
|
||||
for (S32 s = bits; s; --s) {
|
||||
if ((s & bits) == s) {
|
||||
if (valid(s | last_bit)) {
|
||||
bits = s | last_bit;
|
||||
|
|
@ -175,7 +175,7 @@ inline bool GjkCollisionState::closest(VectorF& v)
|
|||
|
||||
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)
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -256,7 +256,7 @@ void GjkCollisionState::getClosestPoints(Point3F& p1, Point3F& p2)
|
|||
F32 sum = 0;
|
||||
p1.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) {
|
||||
sum += det[bits][i];
|
||||
p1 += p[i] * det[bits][i];
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ struct GjkCollisionState: public CollisionState
|
|||
|
||||
///
|
||||
void compute_det();
|
||||
bool valid(int s);
|
||||
void compute_vector(int bits, VectorF& v);
|
||||
bool valid(S32 s);
|
||||
void compute_vector(S32 bits, VectorF& v);
|
||||
bool closest(VectorF& v);
|
||||
bool degenerate(const VectorF& w);
|
||||
void nextBit();
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
out->mVertexList.clear();
|
||||
|
|
@ -373,7 +373,7 @@ bool Polytope::findCollision(const VectorF& vec,Polytope::Collision *best)
|
|||
return false;
|
||||
if (!best->object)
|
||||
best->distance = 1.0E30f;
|
||||
int bestVertex = -1;
|
||||
S32 bestVertex = -1;
|
||||
Polytope::Volume* bestVolume = NULL;
|
||||
sideCount++;
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ public:
|
|||
void buildBox(const MatrixF& transform,const Box3F& box);
|
||||
void intersect(SimObject*, const BSPNode* node);
|
||||
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);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ const char *DynamicConsoleMethodComponent::_callMethod( U32 argc, const char *ar
|
|||
if( getComponentCount() > 0 )
|
||||
{
|
||||
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-- )
|
||||
{
|
||||
argv[0] = cbName;
|
||||
|
|
|
|||
|
|
@ -1910,8 +1910,7 @@ extern int isatty (int );
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -2355,7 +2354,7 @@ void CMDerror(char *format, ...)
|
|||
char tempBuf[BUFMAX];
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
#ifdef TORQUE_OS_WIN32
|
||||
#ifdef TORQUE_OS_WIN
|
||||
_vsnprintf( tempBuf, BUFMAX, format, args );
|
||||
#else
|
||||
vsnprintf( tempBuf, BUFMAX, format, args );
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ void CMDerror(char *format, ...)
|
|||
char tempBuf[BUFMAX];
|
||||
va_list args;
|
||||
va_start( args, format );
|
||||
#ifdef TORQUE_OS_WIN32
|
||||
#ifdef TORQUE_OS_WIN
|
||||
_vsnprintf( tempBuf, BUFMAX, format, args );
|
||||
#else
|
||||
vsnprintf( tempBuf, BUFMAX, format, args );
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ bool SimXMLDocument::pushFirstChildElement(const char* rName)
|
|||
TiXmlElement* pElement;
|
||||
if(!m_paNode.empty())
|
||||
{
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -412,7 +412,7 @@ bool SimXMLDocument::pushChildElement(S32 index)
|
|||
TiXmlElement* pElement;
|
||||
if(!m_paNode.empty())
|
||||
{
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -472,7 +472,7 @@ bool SimXMLDocument::nextSiblingElement(const char* rName)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement*& pElement = m_paNode[iLastElement];
|
||||
if(!pElement)
|
||||
{
|
||||
|
|
@ -506,7 +506,7 @@ const char* SimXMLDocument::elementValue()
|
|||
{
|
||||
return StringTable->insert("");
|
||||
}
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -547,7 +547,7 @@ const char* SimXMLDocument::attribute(const char* rAttribute)
|
|||
{
|
||||
return StringTable->insert("");
|
||||
}
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -597,7 +597,7 @@ bool SimXMLDocument::attributeExists(const char* rAttribute)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -630,7 +630,7 @@ const char* SimXMLDocument::firstAttribute()
|
|||
{
|
||||
return StringTable->insert("");
|
||||
}
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -667,7 +667,7 @@ const char* SimXMLDocument::lastAttribute()
|
|||
{
|
||||
return StringTable->insert("");
|
||||
}
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -766,7 +766,7 @@ void SimXMLDocument::setAttribute(const char* rAttribute, const char* rVal)
|
|||
return;
|
||||
}
|
||||
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pElement = m_paNode[iLastElement];
|
||||
if(!pElement)
|
||||
{
|
||||
|
|
@ -798,7 +798,7 @@ void SimXMLDocument::setObjectAttributes(const char* objectID)
|
|||
if( pObject == NULL )
|
||||
return;
|
||||
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pElement = m_paNode[iLastElement];
|
||||
if(!pElement)
|
||||
return;
|
||||
|
|
@ -925,7 +925,7 @@ void SimXMLDocument::pushNewElement(const char* rName)
|
|||
}
|
||||
else
|
||||
{
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -975,7 +975,7 @@ void SimXMLDocument::addNewElement(const char* rName)
|
|||
return;
|
||||
}
|
||||
|
||||
const int iParentElement = m_paNode.size() - 2;
|
||||
const S32 iParentElement = m_paNode.size() - 2;
|
||||
if(iParentElement < 0)
|
||||
{
|
||||
pStackTop = dynamic_cast<TiXmlElement*>
|
||||
|
|
@ -1002,7 +1002,7 @@ void SimXMLDocument::addNewElement(const char* rName)
|
|||
}
|
||||
|
||||
// Overwrite top stack position.
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
m_paNode[iFinalElement] = 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
|
||||
if(!m_paNode.empty())
|
||||
{
|
||||
const int iLastElement = m_paNode.size() - 1;
|
||||
const S32 iLastElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iLastElement];
|
||||
if(!pNode)
|
||||
{
|
||||
|
|
@ -1159,7 +1159,7 @@ void SimXMLDocument::addText(const char* text)
|
|||
if(m_paNode.empty())
|
||||
return;
|
||||
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return;
|
||||
|
|
@ -1204,7 +1204,7 @@ const char* SimXMLDocument::getText()
|
|||
if(m_paNode.empty())
|
||||
return "";
|
||||
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return "";
|
||||
|
|
@ -1264,7 +1264,7 @@ void SimXMLDocument::removeText()
|
|||
if(m_paNode.empty())
|
||||
return;
|
||||
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return;
|
||||
|
|
@ -1300,7 +1300,7 @@ void SimXMLDocument::addData(const char* text)
|
|||
if(m_paNode.empty())
|
||||
return;
|
||||
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlElement* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return;
|
||||
|
|
@ -1346,7 +1346,7 @@ const char* SimXMLDocument::getData()
|
|||
if(m_paNode.empty())
|
||||
return "";
|
||||
|
||||
const int iFinalElement = m_paNode.size() - 1;
|
||||
const S32 iFinalElement = m_paNode.size() - 1;
|
||||
TiXmlNode* pNode = m_paNode[iFinalElement];
|
||||
if(!pNode)
|
||||
return "";
|
||||
|
|
|
|||
|
|
@ -250,8 +250,8 @@ struct StreqExprNode : BinaryExprNode
|
|||
|
||||
struct StrcatExprNode : BinaryExprNode
|
||||
{
|
||||
int appendChar;
|
||||
static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, int appendChar );
|
||||
S32 appendChar;
|
||||
static StrcatExprNode *alloc( S32 lineNumber, ExprNode *left, ExprNode *right, S32 appendChar );
|
||||
U32 precompile(TypeReq type);
|
||||
U32 compile(U32 *codeStream, U32 ip, TypeReq type);
|
||||
TypeReq getPreferredType();
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ StreqExprNode *StreqExprNode::alloc( S32 lineNumber, ExprNode *left, ExprNode *r
|
|||
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));
|
||||
constructInPlace(ret);
|
||||
|
|
|
|||
|
|
@ -2059,12 +2059,6 @@ yydestruct (yymsg, yytype, yyvaluep)
|
|||
yymsg = "Deleting";
|
||||
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
|
||||
|
||||
switch (yytype)
|
||||
{
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -403,14 +403,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
for(U32 i = 0; i < size; i++)
|
||||
st.read(&functionFloats[i]);
|
||||
}
|
||||
U32 codeSize;
|
||||
st.read(&codeSize);
|
||||
U32 codeLength;
|
||||
st.read(&codeLength);
|
||||
st.read(&lineBreakPairCount);
|
||||
|
||||
U32 totSize = codeSize + lineBreakPairCount * 2;
|
||||
U32 totSize = codeLength + lineBreakPairCount * 2;
|
||||
code = new U32[totSize];
|
||||
|
||||
for(i = 0; i < codeSize; i++)
|
||||
for(i = 0; i < codeLength; i++)
|
||||
{
|
||||
U8 b;
|
||||
st.read(&b);
|
||||
|
|
@ -420,10 +420,10 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st)
|
|||
code[i] = b;
|
||||
}
|
||||
|
||||
for(i = codeSize; i < totSize; i++)
|
||||
for(i = codeLength; i < totSize; i++)
|
||||
st.read(&code[i]);
|
||||
|
||||
lineBreakPairs = code + codeSize;
|
||||
lineBreakPairs = code + codeLength;
|
||||
|
||||
// StringTable-ize our identifiers.
|
||||
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
|
||||
char *string;
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ public:
|
|||
/// -1 a new frame is created. If the index is out of range the
|
||||
/// top stack frame is used.
|
||||
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
|
||||
/// result of the code executed, if any, or an empty string.
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ static bool active = false;
|
|||
static bool newLogFile;
|
||||
static const char *logFileName;
|
||||
|
||||
static const int MaxCompletionBufferSize = 4096;
|
||||
static const S32 MaxCompletionBufferSize = 4096;
|
||||
static char completionBuffer[MaxCompletionBufferSize];
|
||||
static char tabBuffer[MaxCompletionBufferSize] = {0};
|
||||
static SimObjectPtr<SimObject> tabObject;
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ void Namespace::printNamespaceEntries(Namespace * g, bool dumpScript, bool dumpE
|
|||
// Iterate through the methods of the namespace...
|
||||
for(Entry *ewalk = g->mEntryList; ewalk; ewalk = ewalk->mNext)
|
||||
{
|
||||
int eType = ewalk->mType;
|
||||
S32 eType = ewalk->mType;
|
||||
const char * funcName = ewalk->mFunctionName;
|
||||
|
||||
if( ( eType == Entry::ConsoleFunctionType ) && !dumpScript )
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
"@param haystack The string to search.\n"
|
||||
"@param needle The string to search for.\n"
|
||||
|
|
@ -479,7 +479,7 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char
|
|||
if(!scan)
|
||||
{
|
||||
dStrcpy(ret + dstp, source + scanp);
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
U32 len = scan - (source + scanp);
|
||||
dStrncpy(ret + dstp, source + scanp, len);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ bool ConsoleLogger::detach()
|
|||
mStream.close();
|
||||
|
||||
// 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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "core/color.h"
|
||||
#include "console/simBase.h"
|
||||
#include "math/mRect.h"
|
||||
#include "core/strings/stringUnit.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// TypeString
|
||||
|
|
@ -567,7 +568,17 @@ ImplementConsoleTypeCasters( TypeColorF, ColorF )
|
|||
|
||||
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);
|
||||
dSprintf(returnBuffer, 256, "%g %g %g %g", color->red, color->green, color->blue, color->alpha);
|
||||
return(returnBuffer);
|
||||
|
|
@ -578,6 +589,22 @@ ConsoleSetType( TypeColorF )
|
|||
ColorF *tmpColor = (ColorF *) dptr;
|
||||
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);
|
||||
F32 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]);
|
||||
}
|
||||
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 )
|
||||
{
|
||||
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);
|
||||
dSprintf(returnBuffer, 256, "%d %d %d %d", color->red, color->green, color->blue, color->alpha);
|
||||
return returnBuffer;
|
||||
|
|
@ -624,6 +661,22 @@ ConsoleSetType( TypeColorI )
|
|||
ColorI *tmpColor = (ColorI *) dptr;
|
||||
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);
|
||||
S32 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]);
|
||||
}
|
||||
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 }");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ namespace Con {
|
|||
mXML->pushNewElement("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");
|
||||
|
||||
|
|
@ -267,7 +267,7 @@ namespace Con {
|
|||
|
||||
mXML->pushNewElement("Enums");
|
||||
|
||||
for (int j = 0; j < table->size; j++)
|
||||
for (S32 j = 0; j < table->size; j++)
|
||||
{
|
||||
mXML->pushNewElement("Enum");
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
|
||||
|
||||
// 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 : 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.
|
||||
|
||||
template< int startArgc, typename T >
|
||||
template< S32 startArgc, typename T >
|
||||
struct _EngineConsoleThunk {};
|
||||
|
||||
template< int startArgc, typename R >
|
||||
template< S32 startArgc, typename R >
|
||||
struct _EngineConsoleThunk< startArgc, R() >
|
||||
{
|
||||
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() >& )
|
||||
{
|
||||
return _EngineConsoleThunkReturnValue( fn() );
|
||||
|
|
@ -1401,11 +1402,11 @@ struct _EngineConsoleThunk< startArgc, R() >
|
|||
return _EngineConsoleThunkReturnValue( ( frame->*fn )() );
|
||||
}
|
||||
};
|
||||
template< int startArgc >
|
||||
template< S32 startArgc >
|
||||
struct _EngineConsoleThunk< startArgc, void() >
|
||||
{
|
||||
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() >& )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
template< int startArgc, typename A >
|
||||
template< S32 startArgc, typename A >
|
||||
struct _EngineConsoleThunk< startArgc, void( A ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
template< int startArgc, typename A, typename B >
|
||||
template< S32 startArgc, typename A, typename B >
|
||||
struct _EngineConsoleThunk< startArgc, void( A, B ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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 ) );
|
||||
}
|
||||
};
|
||||
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 ) >
|
||||
{
|
||||
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 )
|
||||
{
|
||||
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.
|
||||
#pragma warning( default : 4510 )
|
||||
#pragma warning( default : 4610 )
|
||||
#pragma warning( pop ) // 4510 and 4610
|
||||
|
||||
#endif // !_ENGINEAPI_H_
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ static void dumpNamespaceEntries( Stream &stream, Namespace *g, bool callbacks =
|
|||
// Go through all the entries in the namespace.
|
||||
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.
|
||||
if( eType == Namespace::Entry::ConsoleFunctionType
|
||||
|
|
|
|||
|
|
@ -599,10 +599,10 @@ DefineEngineFunction(fileExt, 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"
|
||||
"@return String containing the file name, minus extension\n"
|
||||
"@return String containing the file name, minus extension and path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
|
||||
|
|
@ -626,10 +626,10 @@ DefineEngineFunction(fileBase, 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"
|
||||
"@return String containing the file name, minus extension and path\n"
|
||||
"@return String containing the file name, minus the path\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
S32 pathLen = dStrlen( fileName );
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
"@param index The index of the dynamic field.\n"
|
||||
"@return The value of the dynamic field at the given index or \"\"." )
|
||||
|
|
@ -2702,7 +2702,7 @@ DefineConsoleMethod( SimObject, getFieldCount, S32, (),,
|
|||
const AbstractClassRep::Field* f;
|
||||
U32 numDummyEntries = 0;
|
||||
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
for(S32 i = 0; i < list.size(); 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"
|
||||
"@param index The index of the static field.\n"
|
||||
"@return The value of the static field with the given index or \"\"." )
|
||||
|
|
|
|||
|
|
@ -781,7 +781,7 @@ class SimObject: public ConsoleObject
|
|||
void setCanSaveDynamicFields( bool bCanSave ) { mCanSaveFieldDictionary = bCanSave; }
|
||||
|
||||
/// 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.
|
||||
SimObject* getCopySource() const { return mCopySource; }
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
void breakProcess();
|
||||
|
||||
virtual void executionStopped(CodeBlock *code, U32 lineNumber);
|
||||
void executionStopped(CodeBlock *code, U32 lineNumber);
|
||||
void send(const char *s);
|
||||
void setDebugParameters(S32 port, const char *password, bool waitForClient);
|
||||
void processConsoleLine(const char *consoleLine);
|
||||
|
|
|
|||
|
|
@ -799,7 +799,7 @@ void BitRender::bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim)
|
|||
#if defined(TORQUE_BIG_ENDIAN)
|
||||
#define MAX_SHADOW_TEXELS (256 + 4) //256 seems big enough, +4 so we can run off end of buffer.
|
||||
// slow fake gaussian
|
||||
int i, j, c;
|
||||
S32 i, j, c;
|
||||
U8 tmpLine[3][MAX_SHADOW_TEXELS];
|
||||
U8 *src0, *src1, *src2;
|
||||
U8 *s0, *s1, *s2;
|
||||
|
|
@ -809,7 +809,7 @@ void BitRender::bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim)
|
|||
U32 currVal;
|
||||
U32 sampleVal;
|
||||
U8 c00, c01, c02, c10, c11, c12, c20, c21, c22;
|
||||
int openBuf;
|
||||
S32 openBuf;
|
||||
|
||||
src0 = tmpLine[0];
|
||||
src1 = tmpLine[1];
|
||||
|
|
@ -902,9 +902,9 @@ void BitRender::bitTo8Bit_3(U32 * bits, U32 * eightBits, S32 dim)
|
|||
sampleVal = 0; //c12; // take end.
|
||||
else // inner pixel
|
||||
{
|
||||
const int wXP = 3; // corners
|
||||
const int wPP = 4; // plus/NSEW
|
||||
const int wCP = 4; // center
|
||||
const S32 wXP = 3; // corners
|
||||
const S32 wPP = 4; // plus/NSEW
|
||||
const S32 wCP = 4; // center
|
||||
sampleVal = (c00+c02+c20+c22)*wXP + (c01+c10+c12+c21)*wPP + c11*wCP;
|
||||
sampleVal >>= 5; // div by 32 subsamples
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,3 +38,507 @@ const ColorI ColorI::BLACK( 0, 0, 0 );
|
|||
const ColorI ColorI::RED( 255, 0, 0 );
|
||||
const ColorI ColorI::GREEN( 0, 255, 0 );
|
||||
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);
|
||||
}
|
||||
|
|
@ -49,11 +49,18 @@ class ColorF
|
|||
const F32 in_b,
|
||||
const F32 in_a = 1.0f);
|
||||
|
||||
ColorF( const char* pStockColorName );
|
||||
|
||||
void set(const F32 in_r,
|
||||
const F32 in_g,
|
||||
const F32 in_b,
|
||||
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) const;
|
||||
ColorF& operator+=(const ColorF& in_rAdd);
|
||||
|
|
@ -123,6 +130,8 @@ class ColorI
|
|||
const U8 in_a = U8(255));
|
||||
ColorI(const ColorI& in_rCopy, const U8 in_a);
|
||||
|
||||
ColorI( const char* pStockColorName );
|
||||
|
||||
void set(const U8 in_r,
|
||||
const U8 in_g,
|
||||
const U8 in_b,
|
||||
|
|
@ -131,6 +140,11 @@ class ColorI
|
|||
void set(const ColorI& in_rCopy,
|
||||
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) const;
|
||||
|
||||
|
|
@ -175,6 +189,53 @@ class ColorI
|
|||
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)
|
||||
//
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class File
|
|||
{
|
||||
public:
|
||||
/// What is the status of our file handle?
|
||||
enum Status
|
||||
enum FileStatus
|
||||
{
|
||||
Ok = 0, ///< Ok!
|
||||
IOError, ///< Read or Write error
|
||||
|
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
private:
|
||||
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.
|
||||
|
||||
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
|
||||
///
|
||||
/// @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
|
||||
///
|
||||
|
|
@ -99,7 +99,7 @@ public:
|
|||
/// @endcode
|
||||
///
|
||||
/// @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
|
||||
U32 getSize() const;
|
||||
|
|
@ -107,25 +107,25 @@ public:
|
|||
/// Make sure everything that's supposed to be written to the file gets written.
|
||||
///
|
||||
/// @returns The status of the file.
|
||||
Status flush();
|
||||
FileStatus flush();
|
||||
|
||||
/// Closes the file
|
||||
///
|
||||
/// @returns The status of the file.
|
||||
Status close();
|
||||
FileStatus close();
|
||||
|
||||
/// Gets the status of the file
|
||||
Status getStatus() const;
|
||||
FileStatus getStatus() const;
|
||||
|
||||
/// Reads "size" bytes from the file, and dumps data into "dst".
|
||||
/// The number of actual bytes read is returned in bytesRead
|
||||
/// @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".
|
||||
/// The number of actual bytes written is returned in bytesWritten
|
||||
/// @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.
|
||||
bool hasCapability(Capability cap) const;
|
||||
|
|
@ -133,8 +133,8 @@ public:
|
|||
const void* getHandle() { return handle; }
|
||||
|
||||
protected:
|
||||
Status setStatus(); ///< Called after error encountered.
|
||||
Status setStatus(Status status); ///< Setter for the current status.
|
||||
FileStatus setStatus(); ///< Called after error encountered.
|
||||
FileStatus setStatus(FileStatus status); ///< Setter for the current status.
|
||||
};
|
||||
|
||||
#endif // _FILE_IO_H_
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ public:
|
|||
mWaterMark = FrameAllocator::getWaterMark();
|
||||
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] );
|
||||
}
|
||||
|
||||
|
|
@ -242,7 +242,7 @@ public:
|
|||
~FrameTemp()
|
||||
{
|
||||
// Call destructor
|
||||
for( int i = 0; i < mNumObjectsInMemory; i++ )
|
||||
for( S32 i = 0; i < mNumObjectsInMemory; i++ )
|
||||
destructInPlace<T>( &mMemory[i] );
|
||||
|
||||
FrameAllocator::setWaterMark( mWaterMark );
|
||||
|
|
|
|||
|
|
@ -324,7 +324,7 @@ namespace Torque
|
|||
return mFileData->mPath;
|
||||
}
|
||||
|
||||
FileNode::Status MemFile::getStatus() const
|
||||
FileNode::NodeStatus MemFile::getStatus() const
|
||||
{
|
||||
return mStatus;
|
||||
}
|
||||
|
|
@ -502,7 +502,7 @@ namespace Torque
|
|||
return mDirectoryData->getAttributes(attr);
|
||||
}
|
||||
|
||||
FileNode::Status MemDirectory::getStatus() const
|
||||
FileNode::NodeStatus MemDirectory::getStatus() const
|
||||
{
|
||||
return mStatus;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Torque
|
|||
virtual ~MemFile();
|
||||
|
||||
Path getName() const;
|
||||
Status getStatus() const;
|
||||
NodeStatus getStatus() const;
|
||||
bool getAttributes(Attributes*);
|
||||
|
||||
U32 getPosition();
|
||||
|
|
@ -91,7 +91,7 @@ namespace Torque
|
|||
|
||||
MemFileSystem* mFileSystem;
|
||||
MemFileData* mFileData;
|
||||
Status mStatus;
|
||||
NodeStatus mStatus;
|
||||
U32 mCurrentPos;
|
||||
|
||||
bool _updateInfo();
|
||||
|
|
@ -108,7 +108,7 @@ namespace Torque
|
|||
~MemDirectory();
|
||||
|
||||
Path getName() const;
|
||||
Status getStatus() const;
|
||||
NodeStatus getStatus() const;
|
||||
bool getAttributes(Attributes*);
|
||||
|
||||
bool open();
|
||||
|
|
@ -122,7 +122,7 @@ namespace Torque
|
|||
|
||||
U32 calculateChecksum();
|
||||
|
||||
Status mStatus;
|
||||
NodeStatus mStatus;
|
||||
U32 mSearchIndex;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ bool OggDecoder::_readNextPacket( ogg_packet* packet )
|
|||
|
||||
while( 1 )
|
||||
{
|
||||
int result = ogg_stream_packetout( &mOggStreamState, packet );
|
||||
S32 result = ogg_stream_packetout( &mOggStreamState, packet );
|
||||
if( result == 0 )
|
||||
{
|
||||
if( !mOggStream->_requestData() )
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ bool OggTheoraDecoder::_init()
|
|||
break;
|
||||
}
|
||||
|
||||
int result = th_decode_headerin( &mTheoraInfo, &mTheoraComment, &mTheoraSetup, &nextPacket );
|
||||
S32 result = th_decode_headerin( &mTheoraInfo, &mTheoraComment, &mTheoraSetup, &nextPacket );
|
||||
if( result < 0 )
|
||||
{
|
||||
haveTheoraHeader = false;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ bool OggVorbisDecoder::_init()
|
|||
break;
|
||||
}
|
||||
|
||||
int result = vorbis_synthesis_headerin( &mVorbisInfo, &mVorbisComment, &nextPacket );
|
||||
S32 result = vorbis_synthesis_headerin( &mVorbisInfo, &mVorbisComment, &nextPacket );
|
||||
if( result != 0 )
|
||||
{
|
||||
haveVorbisHeader = false;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
case Ok:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Stream
|
|||
// Public structs and enumerations...
|
||||
public:
|
||||
/// Status constants for the stream
|
||||
enum Status {
|
||||
enum StreamStatus {
|
||||
Ok = 0, ///< Ok!
|
||||
IOError, ///< Read or Write error
|
||||
EOS, ///< End of Stream reached (mostly for reads)
|
||||
|
|
@ -74,20 +74,20 @@ public:
|
|||
|
||||
// Accessible only through inline accessors
|
||||
private:
|
||||
Status m_streamStatus;
|
||||
StreamStatus m_streamStatus;
|
||||
|
||||
// Derived accessible data modifiers...
|
||||
protected:
|
||||
void setStatus(const Status in_newStatus) { m_streamStatus = in_newStatus; }
|
||||
void setStatus(const StreamStatus in_newStatus) { m_streamStatus = in_newStatus; }
|
||||
|
||||
public:
|
||||
Stream();
|
||||
virtual ~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
|
||||
static const char* getStatusString(const Status in_status);
|
||||
static const char* getStatusString(const StreamStatus in_status);
|
||||
|
||||
// Derived classes must override these...
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -438,7 +438,7 @@ void StringBufferManager::updateStats()
|
|||
request8 = 0;
|
||||
request16 = 0;
|
||||
U32 nstrings = strings.size();
|
||||
for(int i=0; i < nstrings; i++)
|
||||
for(S32 i=0; i < nstrings; i++)
|
||||
{
|
||||
request8 += strings[i]->rc->requestCount8;
|
||||
request16 += strings[i]->rc->requestCount16;
|
||||
|
|
@ -459,7 +459,7 @@ void StringBufferManager::dumpAllStrings()
|
|||
U32 nstrings = strings.size();
|
||||
Con::printf("===== String Manager: All Strings =====");
|
||||
Con::printf(" utf8 | utf16 | string");
|
||||
for(int i=0; i < nstrings; i++)
|
||||
for(S32 i=0; i < nstrings; i++)
|
||||
{
|
||||
UTF8* tmp = strings[i]->createCopy8();
|
||||
strings[i]->rc->requestCount8--;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue