diff --git a/Engine/source/T3D/decal/decalData.cpp b/Engine/source/T3D/decal/decalData.cpp index 30e61cf28..a75fa9d94 100644 --- a/Engine/source/T3D/decal/decalData.cpp +++ b/Engine/source/T3D/decal/decalData.cpp @@ -91,7 +91,7 @@ DecalData::DecalData() matInst = NULL; - renderPriority = 10; + mRenderPriority = 10; clippingMasks = STATIC_COLLISION_TYPEMASK; clippingAngle = 89.0f; @@ -169,7 +169,7 @@ void DecalData::initPersistFields() "fully faded out.\n\n" "This should be a smaller value than #fadeStartPixelSize." ); - addField( "renderPriority", TypeS8, Offset( renderPriority, DecalData ), + addField( "renderPriority", TypeS16, Offset( mRenderPriority, DecalData ), "Default renderPriority for decals of this type (determines draw " "order when decals overlap)." ); @@ -235,7 +235,7 @@ void DecalData::onStaticModified( const char *slotName, const char *newValue ) } else if ( dStricmp( slotName, "renderPriority" ) == 0 ) { - renderPriority = getMax( renderPriority, (U8)1 ); + mRenderPriority = getMax(mRenderPriority, (S16)1 ); } } @@ -270,7 +270,7 @@ void DecalData::packData( BitStream *stream ) stream->write( fadeStartPixelSize ); stream->write( fadeEndPixelSize ); - stream->write( renderPriority ); + stream->write( mRenderPriority ); stream->write( clippingMasks ); stream->write( clippingAngle ); @@ -300,7 +300,7 @@ void DecalData::unpackData( BitStream *stream ) stream->read( &fadeStartPixelSize ); stream->read( &fadeEndPixelSize ); - stream->read( &renderPriority ); + stream->read( &mRenderPriority); stream->read( &clippingMasks ); stream->read( &clippingAngle ); diff --git a/Engine/source/T3D/decal/decalData.h b/Engine/source/T3D/decal/decalData.h index 850aa7149..26a2d4269 100644 --- a/Engine/source/T3D/decal/decalData.h +++ b/Engine/source/T3D/decal/decalData.h @@ -85,7 +85,7 @@ class DecalData : public SimDataBlock String lookupName; - U8 renderPriority; + S16 mRenderPriority; S32 clippingMasks; diff --git a/Engine/source/T3D/decal/decalInstance.h b/Engine/source/T3D/decal/decalInstance.h index c13fb6ad9..5f4e87bc7 100644 --- a/Engine/source/T3D/decal/decalInstance.h +++ b/Engine/source/T3D/decal/decalInstance.h @@ -88,7 +88,7 @@ class DecalInstance U8 getRenderPriority() const { - return mRenderPriority == 0 ? mDataBlock->renderPriority : mRenderPriority; + return mRenderPriority == 0 ? mDataBlock->mRenderPriority : mRenderPriority; } /// Calculates the size of this decal onscreen in pixels, used for LOD. diff --git a/Engine/source/T3D/fx/particle.cpp b/Engine/source/T3D/fx/particle.cpp index 8e6962313..a41aa13e2 100644 --- a/Engine/source/T3D/fx/particle.cpp +++ b/Engine/source/T3D/fx/particle.cpp @@ -138,11 +138,11 @@ ParticleData::ParticleData() //----------------------------------------------------------------------------- -FRangeValidator dragCoefFValidator(0.f, 5.f); -FRangeValidator gravCoefFValidator(-10.f, 10.f); -FRangeValidator spinRandFValidator(-1000.f, 1000.f); -FRangeValidator particleTimeFValidator(0.0f, 1.0f, 1<<8); -FRangeValidator particleSizeFValidator(0.0f, MaxParticleSize, 1<<16); +FRangeValidator dragCoefFValidator(0.f, 5.f, BIT(10)); +FRangeValidator gravCoefFValidator(-10.f, 10.f, BIT(12)); +FRangeValidator spinRandFValidator(-1000.f, 1000.f, BIT(11)); +FRangeValidator particleTimeFValidator(0.0f, 1.0f, BIT(8)); +FRangeValidator particleSizeFValidator(0.0f, MaxParticleSize, BIT(16)); //----------------------------------------------------------------------------- // initPersistFields diff --git a/Engine/source/afx/afxEffectGroup.cpp b/Engine/source/afx/afxEffectGroup.cpp index b26550f6e..d16ec4a81 100644 --- a/Engine/source/afx/afxEffectGroup.cpp +++ b/Engine/source/afx/afxEffectGroup.cpp @@ -35,7 +35,7 @@ // When an effect is added using "addEffect", this validator intercepts the value // and adds it to the dynamic effects list. // -void afxEffectGroupData::egValidator::validateType(SimObject* object, void* typePtr) +void afxEffectGroupData::egValidator::validateType(SimObject* object, StringTableEntry varname, void* typePtr) { afxEffectGroupData* eff_data = dynamic_cast(object); afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); diff --git a/Engine/source/afx/afxEffectGroup.h b/Engine/source/afx/afxEffectGroup.h index 125cb7889..2c3ad480b 100644 --- a/Engine/source/afx/afxEffectGroup.h +++ b/Engine/source/afx/afxEffectGroup.h @@ -60,7 +60,7 @@ class afxEffectGroupData : public afxEffectBaseData U32 id; public: egValidator(U32 id) { this->id = id; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; }; bool do_id_convert; diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index c46f626be..43e0fa13b 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -39,7 +39,7 @@ // When an effect is added using "addEffect", this validator intercepts the value // and adds it to the dynamic effects list. // -void afxEffectronData::ewValidator::validateType(SimObject* object, void* typePtr) +void afxEffectronData::ewValidator::validateType(SimObject* object, StringTableEntry varname, void* typePtr) { afxEffectronData* eff_data = dynamic_cast(object); afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); diff --git a/Engine/source/afx/afxEffectron.h b/Engine/source/afx/afxEffectron.h index ec0921652..6391dd5dc 100644 --- a/Engine/source/afx/afxEffectron.h +++ b/Engine/source/afx/afxEffectron.h @@ -46,7 +46,7 @@ class afxEffectronData : public afxChoreographerData U32 id; public: ewValidator(U32 id) { this->id = id; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; }; bool do_id_convert; diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index e8c4a9d44..1d86f5303 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -43,7 +43,7 @@ // created for each effect list and an id is used to identify which list to add the effect // to. // -void afxMagicSpellData::ewValidator::validateType(SimObject* object, void* typePtr) +void afxMagicSpellData::ewValidator::validateType(SimObject* object, StringTableEntry varname, void* typePtr) { afxMagicSpellData* spelldata = dynamic_cast(object); afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); diff --git a/Engine/source/afx/afxMagicSpell.h b/Engine/source/afx/afxMagicSpell.h index a978303e0..7967ce1b3 100644 --- a/Engine/source/afx/afxMagicSpell.h +++ b/Engine/source/afx/afxMagicSpell.h @@ -65,7 +65,7 @@ class afxMagicSpellData : public afxChoreographerData, public afxMagicSpellDefs U32 id; public: ewValidator(U32 id) { this->id = id; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; }; bool mDo_id_convert; diff --git a/Engine/source/afx/afxSelectron.cpp b/Engine/source/afx/afxSelectron.cpp index fcc65ccb1..a7eb1d704 100644 --- a/Engine/source/afx/afxSelectron.cpp +++ b/Engine/source/afx/afxSelectron.cpp @@ -38,7 +38,7 @@ // When an effect is added using "addEffect", this validator intercepts the value // and adds it to the dynamic effects list. // -void afxSelectronData::ewValidator::validateType(SimObject* object, void* typePtr) +void afxSelectronData::ewValidator::validateType(SimObject* object, StringTableEntry varname, void* typePtr) { afxSelectronData* sele_data = dynamic_cast(object); afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); diff --git a/Engine/source/afx/afxSelectron.h b/Engine/source/afx/afxSelectron.h index 780322282..afd68124b 100644 --- a/Engine/source/afx/afxSelectron.h +++ b/Engine/source/afx/afxSelectron.h @@ -57,7 +57,7 @@ class afxSelectronData : public afxChoreographerData, public afxSelectronDefs U32 id; public: ewValidator(U32 id) { this->id = id; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; }; bool do_id_convert; diff --git a/Engine/source/afx/ce/afxPhraseEffect.cpp b/Engine/source/afx/ce/afxPhraseEffect.cpp index 00cda7df3..74228aef8 100644 --- a/Engine/source/afx/ce/afxPhraseEffect.cpp +++ b/Engine/source/afx/ce/afxPhraseEffect.cpp @@ -36,7 +36,7 @@ // When an effect is added using "addEffect", this validator intercepts the value // and adds it to the dynamic effects list. // -void afxPhraseEffectData::ewValidator::validateType(SimObject* object, void* typePtr) +void afxPhraseEffectData::ewValidator::validateType(SimObject* object, StringTableEntry varname, void* typePtr) { afxPhraseEffectData* eff_data = dynamic_cast(object); afxEffectBaseData** ew = (afxEffectBaseData**)(typePtr); diff --git a/Engine/source/afx/ce/afxPhraseEffect.h b/Engine/source/afx/ce/afxPhraseEffect.h index 5fd4c6ab6..bac8bf27a 100644 --- a/Engine/source/afx/ce/afxPhraseEffect.h +++ b/Engine/source/afx/ce/afxPhraseEffect.h @@ -42,7 +42,7 @@ class afxPhraseEffectData : public GameBaseData, public afxEffectDefs, public af U32 id; public: ewValidator(U32 id) { this->id = id; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; }; bool do_id_convert; diff --git a/Engine/source/console/consoleObject.cpp b/Engine/source/console/consoleObject.cpp index 71a9ed545..9156c1da7 100644 --- a/Engine/source/console/consoleObject.cpp +++ b/Engine/source/console/consoleObject.cpp @@ -507,6 +507,8 @@ void ConsoleObject::addField(const char* in_pFieldname, { AbstractClassRep::Field f; f.pFieldname = StringTable->insert(in_pFieldname); + ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); + AssertFatal(conType, avar("ConsoleObject::addProtectedField[%s] - invalid console type", in_pFieldname)); if (in_pFieldDocs) f.pFieldDocs = in_pFieldDocs; @@ -522,8 +524,6 @@ void ConsoleObject::addField(const char* in_pFieldname, f.writeDataFn = in_writeDataFn; f.networkMask = 0; - ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); - AssertFatal(conType, "ConsoleObject::addField - invalid console type"); f.table = conType->getEnumTable(); sg_tempFieldList.push_back(f); @@ -602,6 +602,8 @@ void ConsoleObject::addProtectedField(const char* in_pFieldname, { AbstractClassRep::Field f; f.pFieldname = StringTable->insert(in_pFieldname); + ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); + AssertFatal(conType, avar("ConsoleObject::addProtectedField[%s] - invalid console type", in_pFieldname)); if (in_pFieldDocs) f.pFieldDocs = in_pFieldDocs; @@ -616,9 +618,6 @@ void ConsoleObject::addProtectedField(const char* in_pFieldname, f.getDataFn = in_getDataFn; f.writeDataFn = in_writeDataFn; f.networkMask = 0; - - ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); - AssertFatal(conType, "ConsoleObject::addProtectedField - invalid console type"); f.table = conType->getEnumTable(); sg_tempFieldList.push_back(f); @@ -637,6 +636,8 @@ void ConsoleObject::addProtectedFieldV(const char* in_pFieldname, { AbstractClassRep::Field f; f.pFieldname = StringTable->insert(in_pFieldname); + ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); + AssertFatal(conType, avar("ConsoleObject::addProtectedField[%s] - invalid console type", in_pFieldname)); if (in_pFieldDocs) f.pFieldDocs = in_pFieldDocs; @@ -651,11 +652,6 @@ void ConsoleObject::addProtectedFieldV(const char* in_pFieldname, f.getDataFn = in_getDataFn; f.writeDataFn = in_writeDataFn; f.networkMask = 0; - - ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); - AssertFatal(conType, "ConsoleObject::addProtectedField - invalid console type"); - f.table = conType->getEnumTable(); - sg_tempFieldList.push_back(f); } @@ -704,30 +700,6 @@ void ConsoleObject::addProtectedFieldV(const char* in_pFieldname, flags); } -void ConsoleObject::addFieldV(const char* in_pFieldname, - const U32 in_fieldType, - const dsize_t in_fieldOffset, - TypeValidator *v, - const char* in_pFieldDocs) -{ - AbstractClassRep::Field f; - f.pFieldname = StringTable->insert(in_pFieldname); - if(in_pFieldDocs) - f.pFieldDocs = in_pFieldDocs; - f.type = in_fieldType; - f.offset = in_fieldOffset; - f.elementCount = 1; - f.table = NULL; - f.setDataFn = &defaultProtectedSetFn; - f.getDataFn = &defaultProtectedGetFn; - f.writeDataFn = &defaultProtectedWriteFn; - f.validator = v; - f.networkMask = 0; - v->fieldIndex = sg_tempFieldList.size(); - - sg_tempFieldList.push_back(f); -} - void ConsoleObject::addFieldV(const char* in_pFieldname, const U32 in_fieldType, const dsize_t in_fieldOffset, @@ -737,11 +709,12 @@ void ConsoleObject::addFieldV(const char* in_pFieldname, { AbstractClassRep::Field f; f.pFieldname = StringTable->insert(in_pFieldname); + ConsoleBaseType* conType = ConsoleBaseType::getType(in_fieldType); + AssertFatal(conType, avar("ConsoleObject::addProtectedField[%s] - invalid console type", in_pFieldname)); if (in_pFieldDocs) f.pFieldDocs = in_pFieldDocs; f.type = in_fieldType; f.offset = in_fieldOffset; - f.elementCount = 1; f.table = NULL; f.setDataFn = &defaultProtectedSetFn; f.getDataFn = &defaultProtectedGetFn; @@ -749,11 +722,23 @@ void ConsoleObject::addFieldV(const char* in_pFieldname, f.elementCount = in_elementCount; f.validator = v; f.networkMask = 0; - v->fieldIndex = sg_tempFieldList.size(); sg_tempFieldList.push_back(f); } +void ConsoleObject::addFieldV(const char* in_pFieldname, + const U32 in_fieldType, + const dsize_t in_fieldOffset, + TypeValidator* v, + const char* in_pFieldDocs) +{ + addFieldV(in_pFieldname, + in_fieldType, + in_fieldOffset, + v, + 1, + in_pFieldDocs); +} void ConsoleObject::addDeprecatedField(const char *fieldName) { AbstractClassRep::Field f; diff --git a/Engine/source/console/consoleTypes.h b/Engine/source/console/consoleTypes.h index ff7281d10..e91a51817 100644 --- a/Engine/source/console/consoleTypes.h +++ b/Engine/source/console/consoleTypes.h @@ -66,7 +66,7 @@ DefineConsoleType( TypeBoolVector, Vector) DefineConsoleType( TypeS8, S8 ) DefineConsoleType( TypeS16, S16) DefineConsoleType( TypeS32, S32 ) -DefineConsoleType(TypeRangedS32, S32) +DefineConsoleType( TypeRangedS32, S32) DefineConsoleType( TypeS32Vector, Vector ) DefineConsoleType( TypeF64, F64 ) DefineConsoleType( TypeF32, F32 ) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index e607fbcfa..fdbc13d72 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -1097,7 +1097,7 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const Con::setData(fld->type, (void *) (((const char *)this) + fld->offset), array1, 1, &value, fld->table); if(fld->validator) - fld->validator->validateType(this, (void *) (((const char *)this) + fld->offset)); + fld->validator->validateType(this, fld->pFieldname, (void *) (((const char *)this) + fld->offset)); if (fld->networkMask != 0) { @@ -1111,7 +1111,7 @@ void SimObject::setDataField(StringTableEntry slotName, const char *array, const } if(fld->validator) - fld->validator->validateType(this, (void *) (((const char *)this) + fld->offset)); + fld->validator->validateType(this, fld->pFieldname, (void *) (((const char *)this) + fld->offset)); onStaticModified( slotName, value ); return; diff --git a/Engine/source/console/typeValidators.cpp b/Engine/source/console/typeValidators.cpp index c34537fa1..0a8402461 100644 --- a/Engine/source/console/typeValidators.cpp +++ b/Engine/source/console/typeValidators.cpp @@ -28,7 +28,7 @@ #include "math/mPoint3.h" #include -void TypeValidator::consoleError(SimObject *object, const char *format, ...) +void TypeValidator::consoleError(SimObject *object, StringTableEntry varname, const char *format, ...) { char buffer[1024]; va_list argptr; @@ -37,22 +37,21 @@ void TypeValidator::consoleError(SimObject *object, const char *format, ...) va_end(argptr); AbstractClassRep *rep = object->getClassRep(); - AbstractClassRep::Field &fld = rep->mFieldList[fieldIndex]; const char *objectName = object->getName(); if(!objectName) objectName = "unnamed"; Con::warnf("%s - %s(%d) - invalid value for %s: %s", - rep->getClassName(), objectName, object->getId(), fld.pFieldname, buffer); + rep->getClassName(), objectName, object->getId(), varname, buffer); } -void FRangeValidator::validateType(SimObject *object, void *typePtr) +void FRangeValidator::validateType(SimObject *object, StringTableEntry varname, void *typePtr) { F32 *v = (F32 *) typePtr; if(*v < minV || *v > maxV) { - consoleError(object, "=(%g). Must be between %g and %g", *v, minV, maxV); + consoleError(object, varname, "=(%g). Must be between %g and %g", *v, minV, maxV); if(*v < minV) *v = minV; else if(*v > maxV) @@ -60,12 +59,12 @@ void FRangeValidator::validateType(SimObject *object, void *typePtr) } } -void IRangeValidator::validateType(SimObject *object, void *typePtr) +void IRangeValidator::validateType(SimObject *object, StringTableEntry varname, void *typePtr) { S32 *v = (S32 *) typePtr; if(*v < minV || *v > maxV) { - consoleError(object, "=(%d). Must be between %d and %d", *v, minV, maxV); + consoleError(object, varname, "=(%d). Must be between %d and %d", *v, minV, maxV); if(*v < minV) *v = minV; else if(*v > maxV) @@ -73,13 +72,13 @@ void IRangeValidator::validateType(SimObject *object, void *typePtr) } } -void IRangeValidatorScaled::validateType(SimObject *object, void *typePtr) +void IRangeValidatorScaled::validateType(SimObject *object, StringTableEntry varname, void *typePtr) { S32 *v = (S32 *) typePtr; *v /= factor; if(*v < minV || *v > maxV) { - consoleError(object, "=(%d). Scaled value must be between %d and %d", *v, minV, maxV); + consoleError(object, varname, "=(%d). Scaled value must be between %d and %d", *v, minV, maxV); if(*v < minV) *v = minV; else if(*v > maxV) @@ -87,28 +86,28 @@ void IRangeValidatorScaled::validateType(SimObject *object, void *typePtr) } } -void Point3NormalizeValidator::validateType(SimObject *object, void *typePtr) +void Point3NormalizeValidator::validateType(SimObject *object, StringTableEntry varname, void *typePtr) { Point3F *v = (Point3F *) typePtr; const F32 len = v->len(); if(!mIsEqual(len, 1.0f)) { - consoleError(object, "=(%g). Vector length must be %g", len, length); + consoleError(object, varname, "=(%g). Vector length must be %g", len, length); *v *= length / len; } } namespace CommonValidators { - FRangeValidator F32Range(F32_MIN, F32_MAX, F32_MAX); - FRangeValidator DirFloat(-1.0f, 1.0f); - FRangeValidator NegDefaultF32(-1.0f, F32_MAX, F32_MAX); - FRangeValidator PositiveFloat(0.0f, F32_MAX, F32_MAX); - FRangeValidator PositiveNonZeroFloat((F32)POINT_EPSILON, F32_MAX); + FRangeValidator F32Range(F32_MIN, F32_MAX, 1 / POINT_EPSILON); + FRangeValidator DirFloat(-1.0f, 1.0f, 1 / POINT_EPSILON); + FRangeValidator NegDefaultF32(-1.0f, F32_MAX, 1 / POINT_EPSILON); + FRangeValidator PositiveFloat(0.0f, F32_MAX, 1 / POINT_EPSILON); + FRangeValidator PositiveNonZeroFloat((F32)POINT_EPSILON, F32_MAX, 1 / POINT_EPSILON); FRangeValidator NormalizedFloat(0.0f, 1.0f); - FRangeValidator F32_8BitPercent(0.0f, 1.0f, 1 << 8); - FRangeValidator F32_16BitPercent(0.0f, 1.0f, 1 << 16); + FRangeValidator F32_8BitPercent(0.0f, 1.0f, BIT(8)); + FRangeValidator F32_16BitPercent(0.0f, 1.0f, BIT(16)); FRangeValidator ValidSlopeAngle(0.0f, 89.9f, 89.9f); FRangeValidator CornerAngle(0.0f, 90.0f, 90.0f); diff --git a/Engine/source/console/typeValidators.h b/Engine/source/console/typeValidators.h index f9bc57b6c..1b0920bce 100644 --- a/Engine/source/console/typeValidators.h +++ b/Engine/source/console/typeValidators.h @@ -23,11 +23,14 @@ #ifndef _TYPEVALIDATORS_H_ #define _TYPEVALIDATORS_H_ +#ifndef _MMATHFN_H_ +#include "math/mMathFn.h" +#endif + class TypeValidator { public: - S32 fieldIndex; - TypeValidator() : fieldIndex(0) {} + TypeValidator() {} ~TypeValidator() {} /// Prints a console error message for the validator. /// @@ -35,11 +38,11 @@ class TypeValidator /// @code /// className objectName (objectId) - invalid value for fieldName: msg /// @endcode - void consoleError(SimObject *object, const char *format, ...); + void consoleError(SimObject *object, StringTableEntry varname, const char *format, ...); /// validateType is called for each assigned value on the field this /// validator is attached to. - virtual void validateType(SimObject *object, void *typePtr) = 0; + virtual void validateType(SimObject *object, StringTableEntry varname, void *typePtr) = 0; }; @@ -50,11 +53,11 @@ class FRangeValidator : public TypeValidator public: FRangeValidator(F32 minValue, F32 maxValue, F32 fidelity = 0.0f) { - minV = minValue; - maxV = maxValue; + minV = mFabs(minValue) > F32_MIN ? minValue : 0.0f; + maxV = mFabs(maxValue) > F32_MIN ? maxValue : 0.0f; mFidelity = fidelity; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; F32 getMin() { return minV; }; F32 getMax() { return maxV; }; F32 getFidelity() { return mFidelity; }; @@ -71,7 +74,7 @@ public: maxV = maxValue; mFidelity = fidelity; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; S32 getMin() { return minV; }; S32 getMax() { return maxV; }; S32 getFidelity() { return mFidelity; }; @@ -92,7 +95,7 @@ public: maxV = maxValueScaled; factor = scaleFactor; } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; S32 getMin() { return minV; }; S32 getMax() { return maxV; }; S32 getScaleFactor() { return factor; }; @@ -104,7 +107,7 @@ class Point3NormalizeValidator : public TypeValidator F32 length; public: Point3NormalizeValidator(F32 normalizeLength = 1.0f) : length(normalizeLength) { } - void validateType(SimObject *object, void *typePtr) override; + void validateType(SimObject *object, StringTableEntry varname, void *typePtr) override; F32 getLength() { return length; }; }; diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index d11a02344..1eab59e14 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -312,10 +312,10 @@ void DecalRoad::initPersistFields() addProtectedFieldV("textureLength", TypeRangedF32, Offset(mTextureLength, DecalRoad), &DecalRoad::ptSetTextureLength, &defaultProtectedGetFn, &drTextureLengthV, "The length in meters of textures mapped to the DecalRoad" ); - addProtectedFieldV( "breakAngle", TypeF32, Offset( mBreakAngle, DecalRoad ), &DecalRoad::ptSetBreakAngle, &defaultProtectedGetFn, &CommonValidators::PosDegreeRange, + addProtectedFieldV( "breakAngle", TypeRangedF32, Offset( mBreakAngle, DecalRoad ), &DecalRoad::ptSetBreakAngle, &defaultProtectedGetFn, &CommonValidators::PosDegreeRange, "Angle in degrees - DecalRoad will subdivided the spline if its curve is greater than this threshold." ); - addField( "renderPriority", TypeS32, Offset( mRenderPriority, DecalRoad ), + addField( "renderPriority", TypeS16, Offset( mRenderPriority, DecalRoad ), "DecalRoad(s) are rendered in descending renderPriority order." ); endGroup( "DecalRoad" ); @@ -429,7 +429,7 @@ void DecalRoad::onStaticModified( const char* slotName, const char*newValue ) if ( dStricmp( slotName, "renderPriority" ) == 0 ) { - mRenderPriority = getMax( dAtoi(newValue), (S32)1 ); + mRenderPriority = getMax((S16)dAtoi(newValue), (S16)1 ); } } diff --git a/Engine/source/environment/decalRoad.h b/Engine/source/environment/decalRoad.h index 481e5b92a..e64c28256 100644 --- a/Engine/source/environment/decalRoad.h +++ b/Engine/source/environment/decalRoad.h @@ -249,7 +249,7 @@ protected: DECLARE_MATERIALASSET(DecalRoad, Material); DECLARE_ASSET_NET_SETGET(DecalRoad, Material, DecalRoadMask); - U32 mRenderPriority; + S16 mRenderPriority; // Static ConsoleVars for editor static bool smEditorOpen; diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index f8a6c544a..09e88659a 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -371,7 +371,7 @@ void GuiControlProfile::initPersistFields() addField("fillColorNA", TypeColorI, Offset(mFillColorNA, GuiControlProfile)); addField("fillColorERR", TypeColorI, Offset(mFillColorERR, GuiControlProfile)); addField("fillColorSEL", TypeColorI, Offset(mFillColorSEL, GuiControlProfile)); - addFieldV("border", TypeRangedS32, Offset(mBorder, GuiControlProfile), &CommonValidators::PositiveInt, + addFieldV("border", TypeRangedS32, Offset(mBorder, GuiControlProfile), &CommonValidators::S32Range, "Border type (0=no border)." ); addFieldV("borderThickness", TypeRangedS32, Offset(mBorderThickness, GuiControlProfile), &CommonValidators::PositiveInt, "Thickness of border in pixels." ); diff --git a/Engine/source/postFx/postEffect.cpp b/Engine/source/postFx/postEffect.cpp index 826219c0d..8026dd392 100644 --- a/Engine/source/postFx/postEffect.cpp +++ b/Engine/source/postFx/postEffect.cpp @@ -568,7 +568,7 @@ void PostEffect::initPersistFields() addField( "renderBin", TypeRealString, Offset( mRenderBin, PostEffect ), "Name of a renderBin, used if renderTime is PFXBeforeBin or PFXAfterBin." ); - addFieldV( "renderPriority", TypeRangedF32, Offset( mRenderPriority, PostEffect ), &CommonValidators::PositiveFloat, + addField( "renderPriority", TypeS16, Offset( mRenderPriority, PostEffect ), "PostEffects are processed in DESCENDING order of renderPriority if more than one has the same renderBin/Time." ); addField( "allowReflectPass", TypeBool, Offset( mAllowReflectPass, PostEffect ), diff --git a/Engine/source/postFx/postEffect.h b/Engine/source/postFx/postEffect.h index 702fed0a8..e485f14d2 100644 --- a/Engine/source/postFx/postEffect.h +++ b/Engine/source/postFx/postEffect.h @@ -202,7 +202,7 @@ protected: String mRenderBin; - F32 mRenderPriority; + S16 mRenderPriority; /// This is true if the effect has been succesfully /// initialized and all requirements are met for use. diff --git a/Engine/source/sfx/sfxDescription.cpp b/Engine/source/sfx/sfxDescription.cpp index 5a1eb0430..a0c5e1330 100644 --- a/Engine/source/sfx/sfxDescription.cpp +++ b/Engine/source/sfx/sfxDescription.cpp @@ -426,7 +426,7 @@ void SFXDescription::initPersistFields() "Reverb echo depth."); addFieldV("reverbModTime", TypeRangedF32, Offset(mReverb.flModulationTime, SFXDescription), &CommonValidators::PositiveFloat, "Reverb Modulation time."); - addFieldV("reverbModDepth", TypeRangedF32, Offset(mReverb.flModulationDepth, SFXDescription), &CommonValidators::PositiveFloat, + addFieldV("reverbModDepth", TypeRangedF32, Offset(mReverb.flModulationDepth, SFXDescription), &CommonValidators::NormalizedFloat, "Reverb Modulation Depth."); addFieldV("airAbsorbtionGainHF", TypeRangedF32, Offset(mReverb.flAirAbsorptionGainHF, SFXDescription), &CommonValidators::PositiveFloat, "High Frequency air absorbtion");