Merge branch 'Preview4_0' of https://github.com/TorqueGameEngines/Torque3D into kermithelpme

This commit is contained in:
AzaezelX 2021-10-09 11:32:13 -05:00
commit e2e1c491ac
68 changed files with 171 additions and 167 deletions

View file

@ -195,7 +195,7 @@ private:
daeRawRefCache rawRefCache;
daeSidRefCache sidRefCache;
std::auto_ptr<charEncoding> localCharEncoding;
std::unique_ptr<charEncoding> localCharEncoding;
static charEncoding globalCharEncoding;
};

View file

@ -60,7 +60,7 @@ public:
private:
static daeErrorHandler *_instance;
static std::auto_ptr<daeErrorHandler> _defaultInstance;
static std::unique_ptr<daeErrorHandler> _defaultInstance;
};
#endif

View file

@ -12,7 +12,7 @@
*/
#ifndef __DAE_STANDARD_URI_RESOLVER__
#define __DAE_STANDARD_URI_RESOVLER__
#define __DAE_STANDARD_URI_RESOLVER__
#include <string>
#include "dae/daeURI.h"

View file

@ -15,7 +15,7 @@
#include <modules/stdErrPlugin.h>
daeErrorHandler *daeErrorHandler::_instance = NULL;
std::auto_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
std::unique_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
daeErrorHandler::daeErrorHandler() {
}

View file

@ -19,7 +19,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#pragma once
#ifndef MATERIALASSET_H
#include "MaterialAsset.h"
@ -168,13 +167,29 @@ void MaterialAsset::initializeAsset()
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (mMatDefinitionName == StringTable->EmptyString())
{
mLoadedState = Failed;
return;
}
if (Torque::FS::IsScriptFile(mScriptPath))
{
if (!Sim::findObject(mMatDefinitionName))
if (Con::executeFile(mScriptPath, false, false))
mLoadedState = ScriptLoaded;
else
mLoadedState = Failed;
{
if (Con::executeFile(mScriptPath, false, false))
{
mLoadedState = ScriptLoaded;
}
else
{
mLoadedState = Failed;
}
}
else
{
mLoadedState = DefinitionAlreadyExists;
}
}
loadMaterial();
@ -184,6 +199,12 @@ void MaterialAsset::onAssetRefresh()
{
mScriptPath = getOwned() ? expandAssetFilePath(mScriptFile) : mScriptPath;
if (mMatDefinitionName == StringTable->EmptyString())
{
mLoadedState = Failed;
return;
}
if (Torque::FS::IsScriptFile(mScriptPath))
{
//Since we're refreshing, we can assume that the file we're executing WILL have an existing definition.
@ -199,7 +220,6 @@ void MaterialAsset::onAssetRefresh()
//And now that we've executed, switch back to the prior behavior
Con::setVariable("$Con::redefineBehavior", redefineBehaviorPrev.c_str());
}
loadMaterial();
@ -227,7 +247,7 @@ void MaterialAsset::loadMaterial()
if (mMaterialDefinition)
SAFE_DELETE(mMaterialDefinition);
if (mLoadedState == ScriptLoaded && mMatDefinitionName != StringTable->EmptyString())
if ((mLoadedState == ScriptLoaded || mLoadedState == DefinitionAlreadyExists) && mMatDefinitionName != StringTable->EmptyString())
{
Material* matDef;
if (!Sim::findObject(mMatDefinitionName, matDef))

View file

@ -73,6 +73,7 @@ public:
enum MaterialAssetErrCode
{
ScriptLoaded = AssetErrCode::Extended,
DefinitionAlreadyExists,
Extended
};

View file

@ -1409,7 +1409,7 @@ void AssetImporter::processImportAssets(AssetImportObject* assetItem)
Con::executef(this, processCommand.c_str(), item);
}
item->importStatus == AssetImportObject::Processed;
item->importStatus = AssetImportObject::Processed;
//try recusing on the children(if any)
processImportAssets(item);
@ -2018,7 +2018,7 @@ void AssetImporter::validateAsset(AssetImportObject* assetItem)
AssetQuery aQuery;
U32 numAssetsFound = AssetDatabase.findAllAssets(&aQuery);
bool hasCollision = false;
hasCollision = false;
for (U32 i = 0; i < numAssetsFound; i++)
{
StringTableEntry assetId = aQuery.mAssetList[i];

View file

@ -931,15 +931,6 @@ public:
return imagePath;
}
static inline const char* makeFullPath(const String& path)
{
char qualifiedFilePath[2048];
Platform::makeFullPathName(path.c_str(), qualifiedFilePath, sizeof(qualifiedFilePath));
return qualifiedFilePath;
}
//
void setTargetModuleId(const String& moduleId) { targetModuleId = moduleId; }
const String& getTargetModuleId() { return targetModuleId; }

View file

@ -318,10 +318,10 @@ void ConvexShape::initPersistFields()
addGroup( "Internal" );
addProtectedField( "surface", TypeRealString, NULL, &protectedSetSurface, &defaultProtectedGetFn,
addProtectedField( "surface", TypeRealString, 0, &protectedSetSurface, &defaultProtectedGetFn,
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
addProtectedField( "surfaceTexture", TypeRealString, NULL, &protectedSetSurfaceTexture, &defaultProtectedGetFn,
addProtectedField( "surfaceTexture", TypeRealString, 0, &protectedSetSurfaceTexture, &defaultProtectedGetFn,
"Do not modify, for internal use.", AbstractClassRep::FIELD_HideInInspectors );
endGroup( "Internal" );

View file

@ -1908,42 +1908,21 @@ void ParticleEmitter::copyToVB( const Point3F &camPos, const LinearColorF &ambie
if (mDataBlock->reverseOrder)
{
buffPtr += 4 * (n_parts - 1);
// do sorted-oriented particles
if (mDataBlock->sortParticles)
{
SortParticle* partPtr = orderedVector.address();
for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr -= 4)
setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr);
}
// do unsorted-oriented particles
else
{
Particle* oldPtr = NULL;
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4) {
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr -= 4)
{
setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr);
oldPtr = partPtr;
}
}
}
else
{
// do sorted-oriented particles
if (mDataBlock->sortParticles)
{
SortParticle* partPtr = orderedVector.address();
for (U32 i = 0; i < n_parts - 1; i++, partPtr++, buffPtr += 4)
setupRibbon(partPtr->p, partPtr++->p, partPtr--->p, camPos, ambientColor, buffPtr);
}
// do unsorted-oriented particles
else
{
Particle* oldPtr = NULL;
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4) {
for (Particle* partPtr = part_list_head.next; partPtr != NULL; partPtr = partPtr->next, buffPtr += 4)
{
setupRibbon(partPtr, partPtr->next, oldPtr, camPos, ambientColor, buffPtr);
oldPtr = partPtr;
}
}
}
PROFILE_END();
}

View file

@ -996,7 +996,7 @@ void Precipitation::initRenderObjects()
// entire or a partially filled vb.
mRainIB.set(GFX, mMaxVBDrops * 6, 0, GFXBufferTypeStatic);
U16 *idxBuff;
mRainIB.lock(&idxBuff, NULL, NULL, NULL);
mRainIB.lock(&idxBuff, NULL, 0, 0);
for( U32 i=0; i < mMaxVBDrops; i++ )
{
//

View file

@ -807,7 +807,7 @@ bool GameConnection::isValidControlCameraFov(F32 fov)
return cObj->isValidCameraFov(fov);
}
return NULL;
return false;
}
bool GameConnection::setControlCameraFov(F32 fov)

View file

@ -116,7 +116,7 @@ class ShapeBaseConvex : public Convex
Box3F box;
public:
ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(NULL), nodeTransform(0) { mType = ShapeBaseConvexType; }
ShapeBaseConvex() :pShapeBase(NULL), transform(NULL), hullId(0), nodeTransform(0) { mType = ShapeBaseConvexType; }
ShapeBaseConvex(const ShapeBaseConvex& cv) {
mObject = cv.mObject;
pShapeBase = cv.pShapeBase;

View file

@ -56,7 +56,7 @@ class afxAnimCurve
public:
afxAnimCurve();
~afxAnimCurve();
virtual ~afxAnimCurve();
void addKey( Point2F &v );
void addKey( F32 time, F32 value );

View file

@ -32,6 +32,7 @@
class afxCurveEval
{
public:
virtual ~afxCurveEval() { }
virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, F32 t)=0;
virtual Point2F evaluateCurve(Point2F& v0, Point2F& v1, Point2F& t0, Point2F& t1, F32 t)=0;
virtual Point2F evaluateCurveTangent(Point2F& v0, Point2F& v1, F32 t)=0;

View file

@ -81,6 +81,7 @@ public:
class afxXM_WaveInterp
{
public:
virtual ~afxXM_WaveInterp() { }
virtual void interpolate(F32 t, afxXM_Params& params)=0;
virtual void pulse()=0;
@ -250,7 +251,7 @@ protected:
public:
/*C*/ afxXM_WaveBase(afxXM_WaveBaseData*, afxEffectWrapper*, afxXM_WaveInterp*);
/*D*/ ~afxXM_WaveBase();
/*D*/ virtual ~afxXM_WaveBase();
virtual void updateParams(F32 dt, F32 elapsed, afxXM_Params& params);
};

View file

@ -87,7 +87,7 @@ class OptimizedPolyList : public AbstractPolyList
Poly()
: plane( -1 ),
material( NULL ),
material( 0 ),
vertexStart(0),
vertexCount( 0 ),
surfaceKey(0),

View file

@ -76,7 +76,7 @@ public:
Collision()
{
object = NULL;
material = NULL;
material = 0;
distance = 0.0;
}
};

View file

@ -774,9 +774,9 @@ YY_MALLOC_DECL
YY_DECL
{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
yy_state_type yy_current_state;
char *yy_cp, *yy_bp;
int yy_act;
#line 105 "CMDscan.l"
@ -823,7 +823,7 @@ YY_DECL
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
@ -1430,9 +1430,9 @@ case YY_STATE_EOF(INITIAL):
static int yy_get_next_buffer()
{
register char *dest = yy_current_buffer->yy_ch_buf;
register char *source = yytext_ptr;
register int number_to_move, i;
char *dest = yy_current_buffer->yy_ch_buf;
char *source = yytext_ptr;
int number_to_move, i;
int ret_val;
if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
@ -1560,14 +1560,14 @@ static int yy_get_next_buffer()
static yy_state_type yy_get_previous_state()
{
register yy_state_type yy_current_state;
register char *yy_cp;
yy_state_type yy_current_state;
char *yy_cp;
yy_current_state = yy_start;
for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
@ -1599,10 +1599,10 @@ static yy_state_type yy_try_NUL_trans( yy_current_state )
yy_state_type yy_current_state;
#endif
{
register int yy_is_jam;
register char *yy_cp = yy_c_buf_p;
int yy_is_jam;
char *yy_cp = yy_c_buf_p;
register YY_CHAR yy_c = 1;
YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yy_last_accepting_state = yy_current_state;
@ -1623,14 +1623,14 @@ yy_state_type yy_current_state;
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
static void yyunput( int c, register char *yy_bp )
static void yyunput( int c, char *yy_bp )
#else
static void yyunput( c, yy_bp )
int c;
register char *yy_bp;
char *yy_bp;
#endif
{
register char *yy_cp = yy_c_buf_p;
char *yy_cp = yy_c_buf_p;
/* undo effects of setting up yytext */
*yy_cp = yy_hold_char;
@ -1638,10 +1638,10 @@ register char *yy_bp;
if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
register int number_to_move = yy_n_chars + 2;
register char *dest = &yy_current_buffer->yy_ch_buf[
int number_to_move = yy_n_chars + 2;
char *dest = &yy_current_buffer->yy_ch_buf[
yy_current_buffer->yy_buf_size + 2];
register char *source =
char *source =
&yy_current_buffer->yy_ch_buf[number_to_move];
while ( source > yy_current_buffer->yy_ch_buf )
@ -2095,7 +2095,7 @@ yyconst char *s2;
int n;
#endif
{
register int i;
int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}

View file

@ -125,7 +125,7 @@ S32 QSORT_CALLBACK ArrayObject::_valueFunctionCompare( const void* a, const void
ArrayObject::ArrayObject()
: mCaseSensitive( false ),
mCurrentIndex( NULL )
mCurrentIndex( 0 )
{
}
@ -137,7 +137,7 @@ void ArrayObject::initPersistFields()
"Makes the keys and values case-sensitive.\n"
"By default, comparison of key and value strings will be case-insensitive." );
addProtectedField( "key", TypeCaseString, NULL, &_addKeyFromField, &emptyStringProtectedGetFn,
addProtectedField( "key", TypeCaseString, 0, &_addKeyFromField, &emptyStringProtectedGetFn,
"Helper field which allows you to add new key['keyname'] = value pairs." );
Parent::initPersistFields();

View file

@ -179,10 +179,10 @@ void SimObject::initPersistFields()
addGroup( "Editing" );
addProtectedField( "hidden", TypeBool, NULL,
addProtectedField( "hidden", TypeBool, 0,
&_setHidden, &_getHidden,
"Whether the object is visible." );
addProtectedField( "locked", TypeBool, NULL,
addProtectedField( "locked", TypeBool, 0,
&_setLocked, &_getLocked,
"Whether the object can be edited." );

View file

@ -371,7 +371,7 @@ void StringBuffer::getCopy(UTF16 *buff, const U32 buffSize) const
AssertFatal(mBuffer.last() == 0, "StringBuffer::get UTF8 - not a null terminated string!");
dMemcpy(buff, mBuffer.address(), sizeof(UTF16) * getMin(buffSize, (U32)mBuffer.size()));
// ensure null termination.
buff[buffSize-1] = NULL;
buff[buffSize-1] = 0;
}
UTF8* StringBuffer::createCopy8() const

View file

@ -236,8 +236,8 @@ U32 convertUTF16toUTF8DoubleNULL( const UTF16 *unistring, UTF8 *outbuffer, U32
}
nCodeunits = getMin(nCodeunits,len - 1);
outbuffer[nCodeunits] = NULL;
outbuffer[nCodeunits+1] = NULL;
outbuffer[nCodeunits] = '\0';
outbuffer[nCodeunits+1] = '\0';
PROFILE_END();
return nCodeunits;

View file

@ -48,8 +48,12 @@ Convert the byte ordering on the U16 to and from big/little endian format.
inline U16 endianSwap(const U16 in_swap)
{
#ifdef TORQUE_U16_ENDIANSWAP_BUILTIN
return TORQUE_U16_ENDIANSWAP_BUILTIN(in_swap);
#else
return U16(((in_swap >> 8) & 0x00ff) |
((in_swap << 8) & 0xff00));
#endif
}
inline S16 endianSwap(const S16 in_swap)
@ -64,10 +68,14 @@ Convert the byte ordering on the U32 to and from big/little endian format.
*/
inline U32 endianSwap(const U32 in_swap)
{
#ifdef TORQUE_U32_ENDIANSWAP_BUILTIN
return TORQUE_U32_ENDIANSWAP_BUILTIN(in_swap);
#else
return U32(((in_swap >> 24) & 0x000000ff) |
((in_swap >> 8) & 0x0000ff00) |
((in_swap << 8) & 0x00ff0000) |
((in_swap << 24) & 0xff000000));
#endif
}
inline S32 endianSwap(const S32 in_swap)
@ -77,12 +85,16 @@ inline S32 endianSwap(const S32 in_swap)
inline U64 endianSwap(const U64 in_swap)
{
#ifdef TORQUE_U64_ENDIANSWAP_BUILTIN
return TORQUE_U64_ENDIANSWAP_BUILTIN(in_swap);
#else
U32 *inp = (U32 *) &in_swap;
U64 ret;
U32 *outp = (U32 *) &ret;
outp[0] = endianSwap(inp[1]);
outp[1] = endianSwap(inp[0]);
return ret;
#endif
}
inline S64 endianSwap(const S64 in_swap)
@ -138,4 +150,3 @@ TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F32)
TORQUE_DECLARE_TEMPLATIZED_ENDIAN_CONV(F64)
#endif

View file

@ -30,9 +30,9 @@
namespace Torque
{
extern U32 hash(register const U8 *k, register U32 length, register U32 initval);
extern U32 hash(const U8 *k, U32 length, U32 initval);
extern U64 hash64(register const U8 *k, register U32 length, register U64 initval);
extern U64 hash64(const U8 *k, U32 length, U64 initval);
}

View file

@ -320,7 +320,7 @@ void DecalRoad::initPersistFields()
addGroup( "Internal" );
addProtectedField( "node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn,
addProtectedField( "node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn,
"Do not modify, for internal use." );
endGroup( "Internal" );

View file

@ -1757,7 +1757,7 @@ DefineEngineMethod( GuiMeshRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
{
MeshRoad *road = object->getSelectedRoad();
if ( !road )
return NULL;
return 0;
return road->getId();
}

View file

@ -1472,7 +1472,7 @@ DefineEngineMethod( GuiRiverEditorCtrl, getSelectedRiver, S32, (), , "" )
{
River *river = object->getSelectedRiver();
if ( !river )
return NULL;
return 0;
return river->getId();
}

View file

@ -1097,7 +1097,7 @@ DefineEngineMethod( GuiRoadEditorCtrl, getSelectedRoad, S32, (), , "" )
if ( road )
return road->getId();
return NULL;
return 0;
}
DefineEngineMethod( GuiRoadEditorCtrl, getSelectedNode, S32, (), , "" )

View file

@ -954,10 +954,10 @@ void MeshRoad::initPersistFields()
addGroup( "Internal" );
addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn,
addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn,
"Do not modify, for internal use." );
addProtectedField( "ProfileNode", TypeString, NULL, &addProfileNodeFromField, &emptyStringProtectedGetFn,
addProtectedField( "ProfileNode", TypeString, 0, &addProfileNodeFromField, &emptyStringProtectedGetFn,
"Do not modify, for internal use." );
endGroup( "Internal" );

View file

@ -647,7 +647,7 @@ void River::initPersistFields()
addGroup( "Internal" );
addProtectedField( "Node", TypeString, NULL, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." );
addProtectedField( "Node", TypeString, 0, &addNodeFromField, &emptyStringProtectedGetFn, "For internal use, do not modify." );
endGroup( "Internal" );

View file

@ -1199,7 +1199,7 @@ bool GBitmap::readBitmap( const String &bmType, Stream &ioStream )
if ( regInfo == NULL )
{
Con::errorf( "[GBitmap::readBitmap] unable to find registration for extension [%s]", bmType.c_str() );
return NULL;
return false;
}
return regInfo->readFunc( ioStream, this );
@ -1212,7 +1212,7 @@ bool GBitmap::writeBitmap( const String &bmType, Stream &ioStream, U32 compress
if ( regInfo == NULL )
{
Con::errorf( "[GBitmap::writeBitmap] unable to find registration for extension [%s]", bmType.c_str() );
return NULL;
return false;
}
return regInfo->writeFunc( this, ioStream, (compressionLevel == U32_MAX) ? regInfo->defaultCompression : compressionLevel );

View file

@ -143,7 +143,7 @@ static bool sReadPNG(Stream &stream, GBitmap *bitmap)
stream.read(cs_headerBytesChecked, header);
bool isPng = png_check_sig(header, cs_headerBytesChecked) != 0;
if (isPng == false)
if (!isPng)
{
AssertWarn(false, "GBitmap::readPNG: stream doesn't contain a PNG");
return false;

View file

@ -308,7 +308,7 @@ U8* GFXGLCubemap::getTextureData(U32 face, U32 mip)
GFXGLCubemapArray::GFXGLCubemapArray()
{
mCubemap = NULL;
mCubemap = 0;
}
GFXGLCubemapArray::~GFXGLCubemapArray()

View file

@ -101,8 +101,8 @@ void GFXGLStateBlock::activate(const GFXGLStateBlock* oldState)
// the state value even if that value is identical to the current value.
#define STATE_CHANGE(state) (!oldState || oldState->mDesc.state != mDesc.state)
#define TOGGLE_STATE(state, enum) if(mDesc.state) glEnable(enum); else glDisable(enum)
#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) if(mDesc.state) glEnable(enum); else glDisable(enum)
#define TOGGLE_STATE(state, enum) if(mDesc.state) { glEnable(enum); } else { glDisable(enum); }
#define CHECK_TOGGLE_STATE(state, enum) if(!oldState || oldState->mDesc.state != mDesc.state) { if(mDesc.state) { glEnable(enum); } else { glDisable(enum); }}
// Blending
CHECK_TOGGLE_STATE(blendEnable, GL_BLEND);

View file

@ -6,7 +6,7 @@
GFXGLTextureArray::GFXGLTextureArray()
{
mTextureArray = NULL;
mTextureArray = 0;
}
void GFXGLTextureArray::init()

View file

@ -13,7 +13,7 @@ public:
~GFXGLTextureArray() { Release(); };
void init();
void init() override;
void setToTexUnit(U32 tuNum) override;

View file

@ -46,7 +46,7 @@ GFXGLTextureObject::GFXGLTextureObject(GFXDevice * aDevice, GFXTextureProfile *p
{
#if TORQUE_DEBUG
mFrameAllocatorMarkGuard == FrameAllocator::getWaterMark();
mFrameAllocatorMarkGuard = FrameAllocator::getWaterMark();
#endif
dMemset(&mLockedRect, 0, sizeof(mLockedRect));

View file

@ -135,7 +135,7 @@ void CubemapData::createMap()
if( initSuccess )
{
mCubemap = GFX->createCubemap();
if (mCubeMapFace == NULL || mCubeMapFace->isNull())
if (!mCubeMapFace || mCubeMapFace->isNull())
return;
mCubemap->initStatic(mCubeMapFace);
}

View file

@ -226,7 +226,7 @@ public:
return setStatus(false);
}
ogg_stream_init(&to, Platform::getRandom() * S32_MAX);
ogg_stream_init(&to, Platform::getRandom() * double(S32_MAX));
ogg_packet op;

View file

@ -2438,7 +2438,7 @@ DefineEngineMethod( GuiCanvas, getMouseControl, S32, (),,
if (control)
return control->getId();
return NULL;
return 0;
}
DefineEngineFunction(excludeOtherInstance, bool, (const char* appIdentifer),,

View file

@ -908,12 +908,12 @@ DefineEngineMethod( GuiInspector, findByObject, S32, (SimObject* obj), ,
"@return id of an awake inspector that is inspecting the passed object if one exists, else NULL or 0.")
{
if ( !obj)
return NULL;
return 0;
SimObject *inspector = GuiInspector::findByObject(obj);
if ( !inspector )
return NULL;
return 0;
return inspector->getId();
}

View file

@ -160,11 +160,11 @@ void GuiShapeEdPreview::initPersistFields()
addGroup( "Animation" );
addField( "activeThread", TypeS32, Offset( mActiveThread, GuiShapeEdPreview ),
"Index of the active thread, or -1 if none" );
addProtectedField( "threadPos", TypeF32, NULL, &setFieldThreadPos, &getFieldThreadPos,
addProtectedField( "threadPos", TypeF32, 0, &setFieldThreadPos, &getFieldThreadPos,
"Current position of the active thread (0-1)" );
addProtectedField( "threadDirection", TypeS32, NULL, &setFieldThreadDir, &getFieldThreadDir,
addProtectedField( "threadDirection", TypeS32, 0, &setFieldThreadDir, &getFieldThreadDir,
"Playback direction of the active thread" );
addProtectedField( "threadPingPong", TypeBool, NULL, &setFieldThreadPingPong, &getFieldThreadPingPong,
addProtectedField( "threadPingPong", TypeBool, 0, &setFieldThreadPingPong, &getFieldThreadPingPong,
"'PingPong' mode of the active thread" );
endGroup( "Animation" );

View file

@ -248,7 +248,7 @@ class GuiConvexEditorUndoAction : public UndoAction
friend class GuiConvexEditorCtrl;
public:
GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(NULL)
GuiConvexEditorUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mEditor(NULL), mObjId(0)
{
}

View file

@ -145,7 +145,7 @@ class GuiMissionAreaUndoAction : public UndoAction
{
public:
GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(NULL)
GuiMissionAreaUndoAction( const UTF8* actionName ) : UndoAction( actionName ), mMissionAreaEditor(NULL), mObjId(0)
{
}

View file

@ -773,7 +773,7 @@ ConsoleDocClass( TerrainSmoothAction,
);
TerrainSmoothAction::TerrainSmoothAction()
: UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(NULL)
: UndoAction("Terrain Smoothing"), mFactor(1.0), mSteps(1), mTerrainId(0)
{
}

View file

@ -70,7 +70,7 @@ protected:
GFXStateBlockRef mLitState[NUM_LIT_STATES][2];
public:
LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false), mSpecialLight(NULL) {}
LightMatInstance(Material &mat) : Parent(mat), mLightMapParamsSC(NULL), mInternalPass(false), mSpecialLight(false) {}
virtual bool init( const FeatureSet &features, const GFXVertexFormat *vertexFormat );
virtual bool setupPass( SceneRenderState *state, const SceneData &sgData );

View file

@ -682,9 +682,9 @@ bool blTerrainSystem::createPersistChunkFromProxy(SceneLighting::ObjectProxy* ob
{
*ret = new blTerrainChunk();
return true;
} else {
return NULL;
}
return false;
}
// Given a ray, this will return the color from the lightmap of this object, return true if handled

View file

@ -218,7 +218,7 @@ Material::Material()
mPlanarReflection = false;
mCubemapData = NULL;
mDynamicCubemap = NULL;
mDynamicCubemap = false;
mLastUpdateTime = 0;

View file

@ -54,7 +54,7 @@ public:
inline F32 MRandomGenerator::randF()
{
// default: multiply by 1/(2^31)
return F32(randI()) * (1.0f / S32_MAX);
return F32(randI()) * (1.0f / F64(S32_MAX));
}
inline S32 MRandomGenerator::randI(S32 i, S32 n)

View file

@ -168,7 +168,7 @@ protected:
class GuiNavEditorUndoAction : public UndoAction
{
public:
GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(NULL)
GuiNavEditorUndoAction(const UTF8* actionName) : UndoAction(actionName), mNavEditor(NULL), mObjId(0)
{
}

View file

@ -335,7 +335,7 @@ ImplementEnumType(_TamlFormatMode,
// Write.
//return writer.write( stream, pRootNode );
return NULL;
return false;
}
/// Invalid.

View file

@ -241,7 +241,7 @@ namespace PlatformNetState
struct addrinfo* pickAddressByProtocol(struct addrinfo* addr, int protocol)
{
for (addr; addr != NULL; addr = addr->ai_next)
for (; addr != NULL; addr = addr->ai_next)
{
if (addr->ai_family == protocol)
return addr;

View file

@ -107,7 +107,7 @@ typedef unsigned long U64;
// This could be reconfigured for static builds, though minimal impact
//# define TORQUE_SUPPORTS_NASM
# endif
#else
#else
# error "GCC: Unsupported Operating System"
#endif
@ -169,5 +169,8 @@ typedef unsigned long U64;
#endif
#endif
#endif // INCLUDED_TYPES_GCC_H
#define TORQUE_U16_ENDIANSWAP_BUILTIN __builtin_bswap16
#define TORQUE_U32_ENDIANSWAP_BUILTIN __builtin_bswap32
#define TORQUE_U64_ENDIANSWAP_BUILTIN __builtin_bswap64
#endif // INCLUDED_TYPES_GCC_H

View file

@ -23,6 +23,7 @@
#ifndef INCLUDED_TYPES_VISUALC_H
#define INCLUDED_TYPES_VISUALC_H
#include <stdlib.h>
// For more information on VisualC++ predefined macros
// http://support.microsoft.com/default.aspx?scid=kb;EN-US;q65472
@ -69,7 +70,7 @@ typedef unsigned _int64 U64;
# define TORQUE_OS_WIN
# define TORQUE_OS_WIN64
# include "platform/types.win.h"
#else
#else
# error "VC: Unsupported Operating System"
#endif
@ -115,5 +116,8 @@ typedef unsigned _int64 U64;
#define TORQUE_UNLIKELY
#endif
#endif // INCLUDED_TYPES_VISUALC_H
#define TORQUE_U16_ENDIANSWAP_BUILTIN _byteswap_ushort
#define TORQUE_U32_ENDIANSWAP_BUILTIN _byteswap_ulong
#define TORQUE_U64_ENDIANSWAP_BUILTIN _byteswap_uint64
#endif // INCLUDED_TYPES_VISUALC_H

View file

@ -102,7 +102,7 @@ U16 Input::getKeyCode( U16 asciiCode )
char c[2];
c[0]= asciiCode;
c[1] = NULL;
c[1] = 0;
return KeyMapSDL::getTorqueScanCodeFromSDL( SDL_GetScancodeFromKey( SDL_GetKeyFromName(c) ) );
}

View file

@ -594,20 +594,20 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
return currentStatus;
U32 finalPos = 0;
switch (absolutePos)
if (absolutePos)
{
case true: // absolute position
AssertFatal(0 <= position, "File::setPosition: negative absolute position");
// position beyond EOS is OK
finalPos = lseek(*((int *)handle), position, SEEK_SET);
break;
case false: // relative position
}
else
{
AssertFatal((getPosition() >= (U32)abs(position) && 0 > position) || 0 <= position, "File::setPosition: negative relative position");
// position beyond EOS is OK
finalPos = lseek(*((int *)handle), position, SEEK_CUR);
break;
}
if (0xffffffff == finalPos)
@ -1110,7 +1110,7 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
if (dip == NULL)
return false;
while (d = readdir(dip))
while ((d = readdir(dip)))
{
bool isDir = false;
if (d->d_type == DT_UNKNOWN)
@ -1229,14 +1229,14 @@ bool dPathCopy(const char *fromName, const char *toName, bool nooverwrite)
// Iterate through and grab valid directories
//////////////////////////////////////////////////////////////////////////
while (d = readdir(dip))
while ((d = readdir(dip)))
{
bool isDir;
isDir = false;
if (d->d_type == DT_UNKNOWN)
{
char child [1024];
if ((Path[dStrlen(Path) - 1] == '/'))
if (Path[dStrlen(Path) - 1] == '/')
dSprintf(child, 1024, "%s%s", Path, d->d_name);
else
dSprintf(child, 1024, "%s/%s", Path, d->d_name);

View file

@ -24,6 +24,8 @@
#include "platformX86UNIX/x86UNIXState.h"
#include "platformX86UNIX/x86UNIXStdConsole.h"
#include "platform/platformInput.h"
#include "windowManager/platformWindow.h"
#include "windowManager/platformWindowMgr.h"
#include "console/console.h"
#include <stdlib.h>
@ -165,6 +167,15 @@ void Platform::debugBreak()
Con::errorf(ConsoleLogEntry::General,
"Platform::debugBreak: triggering SIGSEGV for core dump");
//kill(getpid(), SIGSEGV);
// On Linux, the mouse cursor will remain trapped when the SIGTRAP below triggers so we ensure the mouse
// locked state is disabled prior to dropping to debug
PlatformWindow* firstWindow = WindowManager->getFirstWindow();
if (firstWindow)
{
firstWindow->setMouseLocked(false);
}
kill(getpid(), SIGTRAP);
}

View file

@ -152,7 +152,7 @@ void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDefer
// Setup a static index buffer for rendering.
mIB.set( GFX, smImposterBatchSize * 6, 0, GFXBufferTypeStatic );
U16 *idxBuff;
mIB.lock(&idxBuff, NULL, NULL, NULL);
mIB.lock(&idxBuff, NULL, 0, 0);
for ( U32 i=0; i < smImposterBatchSize; i++ )
{
//

View file

@ -86,7 +86,7 @@ static const char *_get_enable(void* obj, const char* data)
void RenderPassStateToken::initPersistFields()
{
addProtectedField("enabled", TypeBool, NULL, &_set_enable, &_get_enable, "Enables or disables this token.");
addProtectedField("enabled", TypeBool, 0, &_set_enable, &_get_enable, "Enables or disables this token.");
Parent::initPersistFields();
}

View file

@ -44,15 +44,15 @@ void ScenePolyhedralObject< Base, P >::initPersistFields()
{
Parent::addGroup( "Internal" );
Parent::addProtectedField( "plane", TypeRealString, NULL,
Parent::addProtectedField( "plane", TypeRealString, 0,
&_setPlane, &defaultProtectedGetFn,
"For internal use only.",
AbstractClassRep::FIELD_HideInInspectors );
Parent::addProtectedField( "point", TypeRealString, NULL,
Parent::addProtectedField( "point", TypeRealString, 0,
&_setPoint, &defaultProtectedGetFn,
"For internal use only.",
AbstractClassRep::FIELD_HideInInspectors );
Parent::addProtectedField( "edge", TypeRealString, NULL,
Parent::addProtectedField( "edge", TypeRealString, 0,
&_setEdge, &defaultProtectedGetFn,
"For internal use only.",
AbstractClassRep::FIELD_HideInInspectors );

View file

@ -1962,7 +1962,7 @@ void ContextAction::processTick()
if (mActive)
{
F32 currTime = Sim::getCurrentTime();
static const char *argv[2];
static const char *argv[3];
//see if this key even is still active
if (!mBreakEvent)

View file

@ -92,7 +92,7 @@ class ActionMap : public SimObject
U32 deviceInst;
Vector<Node> nodeMap;
DeviceMap():deviceType(NULL), deviceInst(NULL){
DeviceMap():deviceType(0), deviceInst(0){
VECTOR_SET_ASSOCIATION(nodeMap);
}
~DeviceMap();

View file

@ -407,7 +407,7 @@ DefineEngineMethod( NetObject, getClientObject, S32, (),,
if ( obj )
return obj->getId();
return NULL;
return 0;
}
//ConsoleMethod( NetObject, getClientObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." )
@ -439,7 +439,7 @@ DefineEngineMethod( NetObject, getServerObject, S32, (),,
if ( obj )
return obj->getId();
return NULL;
return 0;
}
//ConsoleMethod( NetObject, getServerObject, S32, 2, 2, "Short-Circuit-Netorking: this is only valid for a local-client / singleplayer situation." )

View file

@ -74,7 +74,7 @@ TSShape::TSShape()
mRadius = 0;
mFlags = 0;
tubeRadius = 0;
data = NULL;
data = 0;
materialList = NULL;
mReadVersion = -1; // -1 means constructed from scratch (e.g., in exporter or no read yet)
mSequencesConstructed = false;
@ -225,11 +225,7 @@ const String& TSShape::getTargetName( S32 mapToNameIndex ) const
S32 TSShape::getTargetCount() const
{
if(!this)
return -1;
return materialList->getMaterialNameList().size();
}
S32 TSShape::findNode(S32 nameIndex) const

View file

@ -357,7 +357,7 @@ void TSShapeConstructor::initPersistFields()
endGroup("Collada");
addGroup("Sequences");
addProtectedField("sequence", TypeStringFilename, NULL, &addSequenceFromField, &emptyStringProtectedGetFn,
addProtectedField("sequence", TypeStringFilename, 0, &addSequenceFromField, &emptyStringProtectedGetFn,
"Legacy method of adding sequences to a DTS or DAE shape after loading.\n\n"
"@tsexample\n"
"singleton TSShapeConstructor(MyShapeDae)\n"

View file

@ -4,8 +4,7 @@ if (!isObject(ExecFilesList))
new ArrayObject(ExecFilesList);
function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3, %var4, %var5, %var6)
{
%maxvars = 7; // match this to i/o signature
{
//clear per module group file execution chain
ExecFilesList.empty();
//Get our modules so we can exec any specific client-side loading/handling
@ -19,22 +18,9 @@ function callOnModules(%functionName, %moduleGroup, %var0, %var1, %var2, %var3,
if(%module.group !$= %moduleGroup)
continue;
}
// match this to i/o signature
if(isObject(%module.scopeSet) && %module.scopeSet.isMethod(%functionName))
{
%stryng = %module.scopeSet @ "." @ %functionName @ "(";
for (%a=0;%a<%maxvars;%a++)
{
if (%var[%a] !$= "")
{
%stryng = %stryng @ %var[%a];
if (%a<%maxvars-1 && %var[%a+1] !$= "")
%stryng = %stryng @ ",";
}
}
%stryng = %stryng @ ");";
eval(%stryng);
}
%module.scopeSet.call(%functionName, %var0, %var1, %var2, %var3, %var4, %var5, %var6);
}
%execFilecount = ExecFilesList.count();

View file

@ -36,7 +36,7 @@ new Scene(EditorTemplateLevel) {
squareSize = "128";
scaleU = "25";
scaleV = "25";
MaterialFile = "FloorGray";
MaterialAsset = "Prototyping:FloorGray";
canSave = "1";
canSaveDynamicFields = "1";
Enabled = "1";