Browse Source

Merge remote-tracking branch 'devhead/Preview4_0' into tsneo

# Conflicts:
#	Engine/source/console/test/ScriptTest.cpp
#	Engine/source/console/test/consoleTest.cpp
Jeff Hutchinson 4 years ago
parent
commit
69d7a2f4a1

+ 7 - 1
Engine/source/T3D/assets/assetImporter.cpp

@@ -599,7 +599,13 @@ AssetImportObject* AssetImporter::addImportingAsset(String assetType, Torque::Pa
    assetImportObj->registerObject();
    assetImportObj->registerObject();
 
 
    //sanitize
    //sanitize
-   assetName.replace(" ", "_");
+   assetName.replace(' ', '_');
+   assetName.replace('~', '_');
+   assetName.replace('`', '_');
+   assetName.replace('-', '_');
+   assetName.replace('*', '_');
+   assetName.replace('-', '_');
+   assetName.replace('+', '_');
 
 
    assetImportObj->assetType = assetType;
    assetImportObj->assetType = assetType;
    assetImportObj->filePath = filePath;
    assetImportObj->filePath = filePath;

+ 1 - 1
Engine/source/app/version.h

@@ -41,7 +41,7 @@
 /// code version, the game name, and which type of game it is (TGB, TGE, TGEA, etc.).
 /// code version, the game name, and which type of game it is (TGB, TGE, TGEA, etc.).
 ///
 ///
 /// Version number is major * 1000 + minor * 100 + revision * 10.
 /// Version number is major * 1000 + minor * 100 + revision * 10.
-#define TORQUE_GAME_ENGINE          3900
+#define TORQUE_GAME_ENGINE          4000
 
 
 /// Human readable engine version string.
 /// Human readable engine version string.
 #define TORQUE_GAME_ENGINE_VERSION_STRING  "3.9.0"
 #define TORQUE_GAME_ENGINE_VERSION_STRING  "3.9.0"

+ 1 - 1
Engine/source/core/util/str.h

@@ -187,7 +187,7 @@ public:
    static inline String ToString( S32 v ) { return ToString( "%d", v ); }
    static inline String ToString( S32 v ) { return ToString( "%d", v ); }
    static inline String ToString( F32 v ) { return ToString( "%g", v ); }
    static inline String ToString( F32 v ) { return ToString( "%g", v ); }
    static inline String ToString( F64 v ) { return ToString( "%Lg", v ); }
    static inline String ToString( F64 v ) { return ToString( "%Lg", v ); }
-
+   inline operator const char* () { return c_str(); }
    static String SpanToString(const char* start, const char* end);
    static String SpanToString(const char* start, const char* end);
 
 
    static String ToLower(const String &string);
    static String ToLower(const String &string);

+ 1 - 1
Engine/source/gfx/gfxTextureManager.cpp

@@ -271,7 +271,7 @@ GFXTextureObject *GFXTextureManager::_lookupTexture( const char *hashName, const
    if (ret && (ret->mProfile->compareFlags(*profile)))
    if (ret && (ret->mProfile->compareFlags(*profile)))
       return ret;
       return ret;
    else if (ret)
    else if (ret)
-      Con::warnf("GFXTextureManager::_lookupTexture: Cached texture %s has a different profile flag", hashName);
+      Con::warnf("GFXTextureManager::_lookupTexture: Cached texture %s has different profile flags: (%s,%s) ", hashName, ret->mProfile->getName().c_str(), profile->getName().c_str());
 
 
    return NULL;
    return NULL;
 }
 }

+ 10 - 1
Engine/source/gfx/gl/sdl/gfxGLDevice.sdl.cpp

@@ -58,7 +58,16 @@ void EnumerateVideoModes(Vector<GFXVideoMode>& outModes)
       GFXVideoMode outMode;
       GFXVideoMode outMode;
       outMode.resolution.set( mode.w, mode.h );
       outMode.resolution.set( mode.w, mode.h );
       outMode.refreshRate = mode.refresh_rate;
       outMode.refreshRate = mode.refresh_rate;
-      outMode.bitDepth = SDL_BYTESPERPIXEL( mode.format );
+
+      // BBP = 32 for some reason the engine knows it should be 32, but then we
+      // add some extra code to break what the engine knows.
+      //outMode.bitDepth = SDL_BYTESPERPIXEL( mode.format );     // sets bitdepths to 4
+      //outMode.bitDepth = SDL_BITSPERPIXEL(mode.format);        // sets bitdepth to 24
+      
+      // hardcoded magic numbers ftw
+      // This value is hardcoded in DX, probably to avoid the shenanigans going on here
+      outMode.bitDepth = 32;                                   
+
       outMode.wideScreen = (mode.w / mode.h) > (4 / 3);
       outMode.wideScreen = (mode.w / mode.h) > (4 / 3);
       outMode.fullScreen = true;
       outMode.fullScreen = true;
       
       

+ 29 - 0
Engine/source/math/mConsoleFunctions.cpp

@@ -424,3 +424,32 @@ DefineEngineFunction(mGetSignedAngleBetweenVectors, F32, (VectorF vecA, VectorF
 
 
    return MathUtils::getSignedAngleBetweenVectors(vecA, vecB, norm);
    return MathUtils::getSignedAngleBetweenVectors(vecA, vecB, norm);
 }
 }
+
+DefineEngineFunction(mBinToDec, S32, (String n),,"convert a binary to decimal")
+{
+   String num = n;
+   int dec_value = 0;
+
+   // Initializing base value to 1, i.e 2^0
+   int base = 1;
+
+   int len = num.length();
+   for (int i = len - 1; i >= 0; i--) {
+      if (num[i] == '1')//pick out our 1s and concatenate
+         dec_value += base;
+      base = base * 2;//next power of 2
+   }
+
+   return dec_value;
+}
+
+DefineEngineFunction(mDecToBin, const char*, (S32 n), , "convert decimal to a binary")
+{
+   String ret;
+   while (n > 0) {
+      int r = n % 2;//modulus aka remainder of 2. nets you a 0 or a 1
+      n /= 2;//next power of 2
+      ret = String::ToString("%i",r) + ret;//add to the front of the stack
+   }
+   return ret.c_str();
+}

+ 1 - 1
Templates/BaseGame/game/core/clientServer/scripts/server/defaults.tscript

@@ -25,7 +25,7 @@
 // List of master servers to query, each one is tried in order
 // List of master servers to query, each one is tried in order
 // until one responds
 // until one responds
 $Pref::Server::RegionMask = 2;
 $Pref::Server::RegionMask = 2;
-$pref::Master[0] = "2:master.garagegames.com:28002";
+$pref::Master[0] = "2:master.torque3d.org:5664";
 
 
 // Information about the server
 // Information about the server
 $Pref::Server::Name = "Torque 3D Server";
 $Pref::Server::Name = "Torque 3D Server";

+ 19 - 5
Templates/BaseGame/game/core/gui/scripts/canvas.tscript

@@ -155,6 +155,10 @@ function GuiCanvas::prefsToModeStr(%this)
 
 
 function GuiCanvas::checkCanvasRes(%this, %mode, %deviceId, %deviceMode, %startup)
 function GuiCanvas::checkCanvasRes(%this, %mode, %deviceId, %deviceMode, %startup)
 {
 {
+   // Toggle for selecting the borderless window allowed sizes. Set true to allow
+   // borderless windows to be less than the device res.
+   %allowSmallBorderless = true;
+
    %resX = getWord(%mode, $WORD::RES_X);
    %resX = getWord(%mode, $WORD::RES_X);
    %resY = getWord(%mode, $WORD::RES_Y);
    %resY = getWord(%mode, $WORD::RES_Y);
 
 
@@ -175,6 +179,9 @@ function GuiCanvas::checkCanvasRes(%this, %mode, %deviceId, %deviceMode, %startu
       if ((%resX > %deviceRect.x) || (%resY > %deviceRect.y))
       if ((%resX > %deviceRect.x) || (%resY > %deviceRect.y))
          return false;
          return false;
 
 
+      if (!%allowSmallBorderless && ((%resX != %deviceRect.x) || (%resY != %deviceRect.y)))
+         return false;
+
       return true;
       return true;
    }
    }
 
 
@@ -202,7 +209,8 @@ function GuiCanvas::checkCanvasRes(%this, %mode, %deviceId, %deviceMode, %startu
    return false;
    return false;
 }
 }
 
 
-// Find the best video mode setting for the device and display mode
+// Find the best video mode setting for the device and display mode.
+// "Best" is the largest resolution that will fit at highest refresh rate.
 function GuiCanvas::getBestCanvasRes(%this, %deviceId, %deviceMode)
 function GuiCanvas::getBestCanvasRes(%this, %deviceId, %deviceMode)
 {
 {
    if (%deviceMode == $Video::ModeWindowed)
    if (%deviceMode == $Video::ModeWindowed)
@@ -210,19 +218,25 @@ function GuiCanvas::getBestCanvasRes(%this, %deviceId, %deviceMode)
    else
    else
       %deviceRect = getWords(%this.getMonitorRect(%deviceId), 2);
       %deviceRect = getWords(%this.getMonitorRect(%deviceId), 2);
 
 
+   %bestRes = "";
    %resCount = %this.getModeCount();
    %resCount = %this.getModeCount();
    for (%i = %resCount - 1; %i >= 0; %i--)
    for (%i = %resCount - 1; %i >= 0; %i--)
    {
    {
       %testRes = %this.getMode(%i);
       %testRes = %this.getMode(%i);
       %resX = getWord(%testRes, $WORD::RES_X);
       %resX = getWord(%testRes, $WORD::RES_X);
       %resY = getWord(%testRes, $WORD::RES_Y);
       %resY = getWord(%testRes, $WORD::RES_Y);
+      %rate = getWord(%testRes, $WORD::REFRESH);
 
 
-      if ((%resX > %deviceRect.x) || (%resY > %deviceRect.y))
+      if ((%resX > %deviceRect.x) || (%resY > %deviceRect.y) ||
+         (%resX < $Video::minimumXResolution) || (%resY < $Video::minimumYResolution))
          continue;
          continue;
 
 
-      return %testRes;
+      if (((%bestRes $= "") || (%resX > getWord(%bestRes, $WORD::RES_X)) ||
+            (%resY > getWord(%bestRes, $WORD::RES_Y))) ||
+         ((%resX == getWord(%bestRes, $WORD::RES_X)) && (%resY == getWord(%bestRes, $WORD::RES_Y)) &&
+            (%rate > getWord(%bestRes, $WORD::REFRESH))))
+         %bestRes = %testRes;
    }
    }
 
 
-   // Nothing found? return first mode
-   return %this.getMonitorMode(%deviceId, 0);
+   return %bestRes;
 }
 }

+ 2 - 0
Templates/BaseGame/game/data/defaults.tscript

@@ -5,6 +5,8 @@ $pref::Player::zoomSpeed = 0;
 $pref::Net::LagThreshold = 400;
 $pref::Net::LagThreshold = 400;
 $pref::Net::Port = 28000;
 $pref::Net::Port = 28000;
 
 
+$pref::Master[0] = "2:master.torque3d.org:5664";
+
 $pref::HudMessageLogSize = 40;
 $pref::HudMessageLogSize = 40;
 $pref::ChatHudLength = 1;
 $pref::ChatHudLength = 1;
 
 

+ 4 - 1
Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript

@@ -2552,7 +2552,7 @@ function MaterialEditorGui::saveCompositeMap(%this)
     %saveAs = "";
     %saveAs = "";
     %dlg = new SaveFileDialog()
     %dlg = new SaveFileDialog()
     {
     {
-        Filters        = "png";
+        Filters        = "PNG File (*.png)|*.png";
         DefaultPath    = EditorSettings.value("data/");
         DefaultPath    = EditorSettings.value("data/");
         ChangePath     = false;
         ChangePath     = false;
         OverwritePrompt   = true;
         OverwritePrompt   = true;
@@ -2566,6 +2566,9 @@ function MaterialEditorGui::saveCompositeMap(%this)
         %saveAs = %dlg.FileName;
         %saveAs = %dlg.FileName;
     }
     }
     
     
+   if( fileExt( %saveAs ) !$= ".png" )
+      %saveAs = %saveAs @ ".png";
+    
     %material = %this.currentMaterial;
     %material = %this.currentMaterial;
     %layer = %this.currentLayer;
     %layer = %this.currentLayer;
    
    

+ 14 - 0
Templates/BaseGame/game/tools/worldEditor/gui/objectBuilderGui.ed.gui

@@ -1072,6 +1072,20 @@ function ObjectBuilderGui::buildObserverDropPoint(%this)
    %this.process();
    %this.process();
 }
 }
 
 
+function ObjectBuilderGui::buildGeneralDropPoint(%this)
+{
+   %this.objectClassName = "SpawnSphere";
+   %this.addField("dataBlock",    "TypeDataBlock", "dataBlock",   "MissionMarkerData SpawnSphereMarker");
+   %this.addField("radius",       "TypeFloat",     "Radius",        1);
+   %this.addField("sphereWeight", "TypeFloat",     "Sphere Weight", 1);
+
+   %this.addField("spawnClass",     "TypeString",    "Spawn Class", "");
+   %this.addField("spawnDatablock", "TypeString", "Spawn Data", "");
+   %this.addField("spawnTransform", "TypeBool", "Spawn Here", "true");
+   %this.addField("canSaveDynamicFields", "TypeBool", "Save metadata", "false");
+   %this.process();
+}
+
 function ObjectBuilderGui::buildNotesObject(%this)
 function ObjectBuilderGui::buildNotesObject(%this)
 {
 {
    %this.objectClassName = "NotesObject";
    %this.objectClassName = "NotesObject";

+ 1 - 0
Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript

@@ -87,6 +87,7 @@ function EWCreatorWindow::init( %this )
       %this.registerMissionObject( "Portal",       "Zone Portal" );
       %this.registerMissionObject( "Portal",       "Zone Portal" );
       %this.registerMissionObject( "SpawnSphere",  "Player Spawn Sphere", "PlayerDropPoint" );
       %this.registerMissionObject( "SpawnSphere",  "Player Spawn Sphere", "PlayerDropPoint" );
       %this.registerMissionObject( "SpawnSphere",  "Observer Spawn Sphere", "ObserverDropPoint" );
       %this.registerMissionObject( "SpawnSphere",  "Observer Spawn Sphere", "ObserverDropPoint" );
+      %this.registerMissionObject( "SpawnSphere",  "General Spawn Sphere", "GeneralDropPoint" );
       %this.registerMissionObject( "SFXSpace",      "Sound Space" );
       %this.registerMissionObject( "SFXSpace",      "Sound Space" );
       %this.registerMissionObject( "OcclusionVolume", "Occlusion Volume" );
       %this.registerMissionObject( "OcclusionVolume", "Occlusion Volume" );
       %this.registerMissionObject( "AccumulationVolume", "Accumulation Volume" );
       %this.registerMissionObject( "AccumulationVolume", "Accumulation Volume" );