Added unit tests for new strip leading color and final render color engine rendering functions. Fixed rendering bug with text elements of different HTML color codes but with same content not having rendering with the correct color code. Fix potential memory leak errors occurring with rendering Font versions of shadow strings that would have different pulsating colors w/same text content. Added an admin console and added the ability to give the player items and accessories with enchants. Also added a help command. Change version number to appear red while in admin mode (as a visual). Unlock all button tied to admin mode. Release Build 10604.
Assert::AreEqual("Hello World!"s,std::string{u32noColCodeResult.begin(),u32noColCodeResult.end()},L"Function should not strip out any text when there's no color codes.");
Assert::AreEqual("Hello World!"s,std::string{u32leadingColCodeResult.begin(),u32leadingColCodeResult.end()},L"Function should strip out color code at beginning of text.");
Assert::AreEqual("Hello #00FF00World!"s,std::string{u32extraColCodesResult.begin(),u32extraColCodesResult.end()},L"Function should only strip out color code at beginning of text.");
}
TEST_METHOD(GetFinalRenderColorTest){
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,"Hello World!").n,L"Should use source color as there's no HTML color code.");
Assert::AreEqual(BLUE.n,testGame->GetFinalRenderColor(WHITE,"#0000FFHello World!").n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(BLUE.n,testGame->GetFinalRenderColor(WHITE,"#0000FFHello #00FF00World!").n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,"Hello #00FF00World!").n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(BLUE.n,testGame->GetFinalRenderColor(WHITE,extraColorCodeStr).n,L"Should use color in string since it has a leading HTML color code.");
Assert::AreEqual(WHITE.n,testGame->GetFinalRenderColor(WHITE,middleColorCodeStr).n,L"Should use color in string since it has a leading HTML color code.");
To open the admin console, press F12 in-game. The admin console is turned on via the ADMIN_MODE variable located in AdventuresInLestoria.cpp
Required arguments are in <>. Optional arguments are in [].
Items with spaces must be surrounded in quotation marks "".
Valid Commands are:
/help - Shows this help file.
/give <Item Name> [Amount] - Gives an item of type <Item Name> into the player's inventory. Optionally adds [Amount] amount of items to the player's inventory.
/accessory <Accessory Name> [Enchant Name] - Gives an accessory of type <Accessory Name> into the player's inventory. Optionally adds an enchant of type [Enchant Name].
if(!affectSlots.count(affectStr))ERR(std::format("WARNING! Could not find translate ability affect slot name {} to a valid slot! Valid slot names are: \"Auto Attack, Right Click Ability, Ability 1, Ability 2, Ability 3\"",affectStr));
trim(fileHash);//It's possible the expected file hash has a space at the end/beginning that gets stripped out. We want to trim and match that string.
if(expectedFileHash!=fileHash){
if(!ADMIN_MODE&&expectedFileHash!=fileHash){
LOG(std::format("WARNING! Filehash for file {} was not identified as proper! Will not load this file!","save_file_path"_S+std::format("save.{:04}",saveFileID)));
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=std::string(sText.begin(),sText.end())){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=std::string(sText.begin(),sText.end())){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||pge->garbageCollector[key].originalStr!=std::string(sText.begin(),sText.end())){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!pge->garbageCollector.count(key)||RerenderRequired){//If the text key already exists, don't have to recreate the decal, just update the expire time.
//If WHITE is provided as the blend color (as is the default), then we need to check the source string for a leading HTML color code. If we find one, return that as the final color we want to render the string as. Otherwise, return the original color.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=std::string(sText.begin(),sText.end())){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=std::string(sText.begin(),sText.end())){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=std::string(sText.begin(),sText.end())){//If the text key already exists, don't have to recreate the decal, just update the expire time.
if(!garbageCollector.count(key)||garbageCollector[key].originalStr!=sText){//If the text key already exists, don't have to recreate the decal, just update the expire time.
// User must override these functions as required. I have not made
@ -4726,11 +4770,12 @@ namespace olc
// Our time per frame coefficient
floatactualElapsedTime=elapsedTime.count();
floatfElapsedTime=std::clamp(elapsedTime.count(),0.f,1/30.f);//HACK fix. We can't have a negative time. Although using a more precise system clock should make this never occur. Also make sure if the game is too slow we advance by only 1/30th of a second.