Bläddra i källkod

Merge pull request #1391 from Azaezel/addTypeS16

add typeS16
Brian Roberts 7 månader sedan
förälder
incheckning
0ebb2e9115

+ 1 - 1
Engine/source/T3D/tsStatic.cpp

@@ -239,7 +239,7 @@ void TSStatic::initPersistFields()
    endGroup("Reflection");
    endGroup("Reflection");
 
 
    addGroup("Collision");
    addGroup("Collision");
-   addField("collisionLOD", TypeS32, Offset(mCollisionLOD, TSStatic),
+   addField("collisionLOD", TypeS16, Offset(mCollisionLOD, TSStatic),
       "The level of detail to use for 'Visible Mesh' collision queries.");
       "The level of detail to use for 'Visible Mesh' collision queries.");
    addField("collisionType", TypeTSMeshType, Offset(mCollisionType, TSStatic),
    addField("collisionType", TypeTSMeshType, Offset(mCollisionType, TSStatic),
       "The type of mesh data to use for collision queries.");
       "The type of mesh data to use for collision queries.");

+ 21 - 0
Engine/source/console/consoleTypes.cpp

@@ -330,6 +330,27 @@ ConsoleSetType( TypeS8 )
       Con::printf("(TypeU8) Cannot set multiple args to a single S8.");
       Con::printf("(TypeU8) Cannot set multiple args to a single S8.");
 }
 }
 
 
+//-----------------------------------------------------------------------------
+// TypeS16
+//-----------------------------------------------------------------------------
+ConsoleType(char, TypeS16, S16, "")
+ImplementConsoleTypeCasters(TypeS16, S16)
+
+ConsoleGetType(TypeS16)
+{
+   static const U32 bufSize = 256;
+   char* returnBuffer = Con::getReturnBuffer(bufSize);
+   dSprintf(returnBuffer, bufSize, "%d", *((S16*)dptr));
+   return returnBuffer;
+}
+
+ConsoleSetType(TypeS16)
+{
+   if (argc == 1)
+      *((S16*)dptr) = dAtoi(argv[0]);
+   else
+      Con::printf("(TypeU8) Cannot set multiple args to a single S8.");
+}
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // TypeS32
 // TypeS32
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------

+ 1 - 0
Engine/source/console/consoleTypes.h

@@ -64,6 +64,7 @@ class SimPersistID;
 DefineConsoleType( TypeBool, bool )
 DefineConsoleType( TypeBool, bool )
 DefineConsoleType( TypeBoolVector, Vector<bool>)
 DefineConsoleType( TypeBoolVector, Vector<bool>)
 DefineConsoleType( TypeS8,  S8 )
 DefineConsoleType( TypeS8,  S8 )
+DefineConsoleType( TypeS16, S16)
 DefineConsoleType( TypeS32, S32 )
 DefineConsoleType( TypeS32, S32 )
 DefineConsoleType( TypeS32Vector, Vector<S32> )
 DefineConsoleType( TypeS32Vector, Vector<S32> )
 DefineConsoleType( TypeF64, F64 )
 DefineConsoleType( TypeF64, F64 )

+ 4 - 4
Engine/source/gui/editor/inspector/field.cpp

@@ -275,7 +275,7 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool
          const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
          const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
 
 
          S32 type = mField->type;
          S32 type = mField->type;
-         if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
+         if (type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
             || type == TypeF32Vector
             || type == TypeF32Vector
             || type == TypeColorI
             || type == TypeColorI
             || type == TypeColorF
             || type == TypeColorF
@@ -323,7 +323,7 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool
          const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
          const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
 
 
          S32 type = mField->type;
          S32 type = mField->type;
-         if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
+         if (type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
             || type == TypeF32Vector
             || type == TypeF32Vector
             || type == TypeColorI
             || type == TypeColorI
             || type == TypeColorF
             || type == TypeColorF
@@ -396,7 +396,7 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool
          const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
          const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
 
 
          S32 type = mField->type;
          S32 type = mField->type;
-         if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
+         if (type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
             || type == TypeF32Vector
             || type == TypeF32Vector
             || type == TypeColorI
             || type == TypeColorI
             || type == TypeColorF
             || type == TypeColorF
@@ -544,7 +544,7 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
          String newValue = strData;
          String newValue = strData;
          S32 type= mField->type;
          S32 type= mField->type;
          ConsoleValue evaluationResult;
          ConsoleValue evaluationResult;
-         if( type == TypeS8 || type == TypeS32 || type == TypeF32 )
+         if( type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 )
          {
          {
             char buffer[ 2048 ];
             char buffer[ 2048 ];
             expandEscape( buffer, newValue );
             expandEscape( buffer, newValue );

+ 1 - 1
Engine/source/persistence/taml/taml.cpp

@@ -1118,7 +1118,7 @@ ImplementEnumType(_TamlFormatMode,
       {
       {
          pFieldTypeDescription = "xs:float";
          pFieldTypeDescription = "xs:float";
       }
       }
-      else if (fieldType == TypeS8 || fieldType == TypeS32)
+      else if (fieldType == TypeS8 || fieldType == TypeS16 || fieldType == TypeS32)
       {
       {
          pFieldTypeDescription = "xs:int";
          pFieldTypeDescription = "xs:int";
       }
       }