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

# Conflicts:
#	Engine/source/console/test/ScriptTest.cpp
#	Engine/source/console/test/consoleTest.cpp
This commit is contained in:
Jeff Hutchinson 2021-05-06 21:08:53 -04:00
commit 69d7a2f4a1
12 changed files with 90 additions and 12 deletions

View file

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

View file

@ -41,7 +41,7 @@
/// 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 3900
#define TORQUE_GAME_ENGINE 4000
/// Human readable engine version string.
#define TORQUE_GAME_ENGINE_VERSION_STRING "3.9.0"

View file

@ -187,7 +187,7 @@ public:
static inline String ToString( S32 v ) { return ToString( "%d", v ); }
static inline String ToString( F32 v ) { return ToString( "%g", 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 ToLower(const String &string);

View file

@ -271,7 +271,7 @@ GFXTextureObject *GFXTextureManager::_lookupTexture( const char *hashName, const
if (ret && (ret->mProfile->compareFlags(*profile)))
return 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;
}

View file

@ -58,7 +58,16 @@ void EnumerateVideoModes(Vector<GFXVideoMode>& outModes)
GFXVideoMode outMode;
outMode.resolution.set( mode.w, mode.h );
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.fullScreen = true;

View file

@ -424,3 +424,32 @@ DefineEngineFunction(mGetSignedAngleBetweenVectors, F32, (VectorF vecA, VectorF
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();
}