Release builds of the game should hide the debug console by default and instead log to a debugging file. Release Build 8413.

mac-build
sigonasr2 8 months ago
parent df0d7d680f
commit 412a88d294
  1. 2
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 77
      Adventures in Lestoria/AdventuresInLestoria.cpp
  3. 2
      Adventures in Lestoria/Animation.cpp
  4. 15
      Adventures in Lestoria/Error.h
  5. 2
      Adventures in Lestoria/GameSettings.cpp
  6. 6
      Adventures in Lestoria/Item.cpp
  7. 4
      Adventures in Lestoria/Key.cpp
  8. 6
      Adventures in Lestoria/Merchant.cpp
  9. 2
      Adventures in Lestoria/Player.cpp
  10. 34
      Adventures in Lestoria/SaveFile.cpp
  11. 4
      Adventures in Lestoria/ScrollableWindowComponent.h
  12. 12
      Adventures in Lestoria/TMXParser.h
  13. 4
      Adventures in Lestoria/TODO.txt
  14. 8
      Adventures in Lestoria/TSXParser.h
  15. 2
      Adventures in Lestoria/Test.cpp
  16. 2
      Adventures in Lestoria/Version.h
  17. 5
      Adventures in Lestoria/olcPGEX_TTF.h
  18. BIN
      x64/Release/Adventures in Lestoria.exe

@ -193,7 +193,7 @@
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\steam;C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\OneDrive\Documents\include</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>

@ -153,6 +153,7 @@ float AiL::SIZE_CHANGE_SPEED=1;
AiL::AiL()
{
debugLogger.open("debug.log");
utils::datafile::Read(DATA,"assets/config/configuration.txt");
std::filesystem::create_directories("save_file_path"_S);
@ -207,7 +208,7 @@ AiL::AiL()
std::vector<std::string>values=DATA.GetProperty("class_list").GetValues();
for(const std::string&cl:values){
std::cout<<cl<<std::endl;
LOG(cl);
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
}
@ -303,7 +304,7 @@ bool AiL::OnUserCreate(){
#ifdef __EMSCRIPTEN__
emscripten_idb_async_load("/assets",("save_file_path"_S+"system.conf").c_str(),0,[](void*arg,void*data,int length){
std::cout<<"Loaded System Save File successfully!"<<std::endl;
LOG("Loaded System Save File successfully!");
std::string rawMetadata=(char*)data;
std::ofstream file("save_file_path"_S+"system.conf");
@ -313,7 +314,7 @@ bool AiL::OnUserCreate(){
file.close();
GameSettings::Initialize();
},[](void*arg){
std::cout<<"Failed to load System Save File!"<<std::endl;
LOG("Failed to load System Save File!");
});
#else
GameSettings::Initialize();
@ -328,9 +329,9 @@ bool AiL::OnUserCreate(){
SetupDiscord();
if(SteamAPI_RestartAppIfNecessary(2895980U))return false; //Immediately quit if steam is detected and can be started through it.
if(Steam_Init()){
std::cout<<"Steam API Initialized successfully!"<<std::endl;
LOG("Steam API Initialized successfully!");
}else{
std::cout<<"Steam API failed to initialize!"<<std::endl;
LOG("Steam API failed to initialize!");
}
#endif
@ -339,7 +340,7 @@ bool AiL::OnUserCreate(){
if(!gamepack.Loaded()&&"GENERATE_GAMEPACK"_B){
gamepack.SavePack("assets/"+"gamepack_file"_S,PACK_KEY);
std::cout<<"Game Pack has been generated!"<<std::endl<<"========================"<<std::endl<<std::endl;
LOG("Game Pack has been generated!"<<std::endl<<"========================"<<std::endl);
}
return true;
@ -381,7 +382,7 @@ bool AiL::OnUserUpdate(float fElapsedTime){
if(Discord){
auto result=Discord->RunCallbacks();
if(result!=::discord::Result::Ok){
std::cout<<"Discord Error Code "<<int(result)<<std::endl;
LOG("Discord Error Code "<<int(result));
delete Discord;
Discord=nullptr;
}
@ -1948,7 +1949,7 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
MAP_TILESETS["assets/maps/"+baseSourceDir].reflectiveData=tileset.GetData().ReflectiveData;
MAP_TILESETS["assets/maps/"+baseSourceDir].isTerrain=tileset.GetData().isTerrain;
MAP_TILESETS["assets/maps/"+baseSourceDir].collision.SetInitialized();
std::cout<<"assets/maps/"+baseSourceDir<<" Animation Data Size: "<<MAP_TILESETS["assets/maps/"+baseSourceDir].animationData.size()<<std::endl;
LOG("assets/maps/"+baseSourceDir<<" Animation Data Size: "<<MAP_TILESETS["assets/maps/"+baseSourceDir].animationData.size());
std::string mapPath="assets/maps/"+tileset.GetData().ImageData.data["source"];
if(gamepack.Loaded()){
r->Load(mapPath,&gamepack);
@ -1959,7 +1960,7 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
gamepack.AddFile(mapPath);
}
}else{
std::cout<<"WARNING! "<<mapPath<<" does not exist, auto-generating mock-up texture"<<std::endl;
LOG("WARNING! "<<mapPath<<" does not exist, auto-generating mock-up texture");
r->Create(tileset.GetData().imagewidth,tileset.GetData().imageheight);
SetDrawTarget(r->Sprite());
int tileXCount=tileset.GetData().imagewidth/tileset.GetData().tilewidth;
@ -2001,7 +2002,7 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
}
if(MAP_DATA[map].MapData.optimized){
std::cout<<"Generating optimized map for Map "<<map<<std::endl;
LOG("Generating optimized map for Map "<<map);
MAP_DATA[map].optimizedTile=NEW Renderable();
MAP_DATA[map].optimizedTile->Create(MAP_DATA[map].MapData.width*MAP_DATA[map].MapData.tilewidth,MAP_DATA[map].MapData.height*MAP_DATA[map].MapData.tileheight);
SetDrawTarget(MAP_DATA[map].optimizedTile->Sprite());
@ -2028,7 +2029,7 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
SetPixelMode(prevMode);
MAP_DATA[map].optimizedTile->Decal()->Update();
SetDrawTarget(nullptr);
std::cout<<" Clearing Layer Data..."<<std::endl;
LOG(" Clearing Layer Data...");
MAP_DATA[map].LayerData.clear();
}
}
@ -2695,11 +2696,11 @@ int main()
if(line.find("AiL\\")!=std::string::npos){
if(!leaked){
leaked=true;
std::cout<<std::endl<<std::endl<<std::endl<<"Memory leak detected!"<<std::endl;
LOG(std::endl<<std::endl<<std::endl<<"Memory leak detected!");
}
std::cout<<line<<std::endl;
LOG(line);
std::getline(file,line);
std::cout<<line<<std::endl;
LOG(line);
}
}
if(leaked)ERR("")
@ -2710,6 +2711,14 @@ int main()
return 0;
}
#ifndef _DEBUG
#ifdef _WIN32
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){
main();
}
#endif
#endif
datafilestringdata operator ""_s(const char*key,std::size_t len){
AiL::OutputDebugInfo(key,len);
return {DATA,std::string(key,len)};
@ -2783,7 +2792,7 @@ void AiL::OutputDebugInfo(const char*key,std::size_t len){
if(utils::datafile::DEBUG_ACCESS_OPTIONS){
std::string k=std::string(key);
if(!k.starts_with("debug_")){
std::cout<<"Reading "<<k<<std::endl;
LOG("Reading "<<k);
}
}
#endif
@ -3152,7 +3161,7 @@ void AiL::InitializeGraphics(){
for(auto&val:DATA["Images"].GetKeys()){
std::string key=val.first;
std::string imgFile=DATA["Images"][key].GetString(0);
std::cout<<"Loading image "+imgFile+"..."<<std::endl;
LOG("Loading image "+imgFile+"...");
bool filtering=false;
bool clamping=false;
if(DATA["Images"][key].GetValueCount()>1){
@ -3196,11 +3205,11 @@ void AiL::InitializeGraphics(){
}
SetPixelMode(prevMode);
std::cout<<"Theme "<<themeName<<" Loaded."<<std::endl;
LOG("Theme "<<themeName<<" Loaded.");
if(DATA["Themes"][themeName].HasProperty("CustomBack")){
std::string backPath=DATA["Themes"][themeName]["CustomBack"].GetString();
std::cout<<" Custom background detected, Loading "<<backPath<<"..."<<std::endl;
LOG(" Custom background detected, Loading "<<backPath<<"...");
if(!GFX.count(backPath)){
Renderable&background=GFX[backPath];
LoadResource(background,"GFX_Prefix"_S+backPath,false,false);
@ -3215,15 +3224,15 @@ void AiL::InitializeGraphics(){
Renderable&image=GFX[img];
LoadResource(image,"GFX_Prefix"_S+img);
}
std::cout<<VisualNovel::graphicsToLoad.size()<<" images for visual novel engine have been loaded."<<std::endl;
LOG(VisualNovel::graphicsToLoad.size()<<" images for visual novel engine have been loaded.");
SetFontSprite("GFX_Prefix"_S+"font.png",&gamepack,"GENERATE_GAMEPACK"_B);
std::cout<<"Custom font loaded."<<std::endl;
LOG("Custom font loaded.");
Menu::themes.SetInitialized();
std::cout<<Menu::themes.size()<<" themes have been loaded."<<std::endl;
LOG(Menu::themes.size()<<" themes have been loaded.");
GFX.SetInitialized();
std::cout<<GFX.size()<<" images have been loaded."<<std::endl;
LOG(GFX.size()<<" images have been loaded.");
}
const Map&AiL::GetCurrentMap()const{
@ -3273,12 +3282,12 @@ void AiL::ValidateGameStatus(){
monsterCounts[monsterName]++;
}
}
std::cout<<"Spawns Report for "<<map<<":"<<std::endl;
LOG("Spawns Report for "<<map<<":");
for(auto&[monster,count]:monsterCounts){
std::cout<<"\t"<<count<<"x "<<monster<<std::endl;
LOG("\t"<<count<<"x "<<monster);
}
std::map<ItemInfo*,long>totalDrops;
std::cout<<"Monte Carlo Test: 100000 tries:"<<std::endl;
LOG("Monte Carlo Test: 100000 tries:");
for(int i=0;i<100000;i++){
//Try to kill every single monster and see what drops.
for(auto&[monster,count]:monsterCounts){
@ -3292,9 +3301,9 @@ void AiL::ValidateGameStatus(){
}
}
}
std::cout<<"Average: "<<std::endl;
LOG("Average: ");
for(auto&[itemInfo,count]:totalDrops){
std::cout<<"\t"<<itemInfo->Name()<<" x"<<std::format("{:.3}",count/100000.)<<std::endl;
LOG("\t"<<itemInfo->Name()<<" x"<<std::format("{:.3}",count/100000.));
}
}
}
@ -3531,10 +3540,10 @@ void AiL::EndGame(){
discord::LogLevel::Debug, [](discord::LogLevel level, const char* message) {
std::cerr << "Log(" << static_cast<uint32_t>(level) << "): " << message << "\n";
});
std::cout<<"Connected to Discord!"<<std::endl;
LOG("Connected to Discord!");
UpdateDiscordStatus("Main Menu",player.get()->GetClassName());
}else{
std::cout<<"Could not connect to Discord. Error Code "<<int(result)<<std::endl;
LOG("Could not connect to Discord. Error Code "<<int(result));
}
return result;
}
@ -3562,9 +3571,9 @@ void AiL::UpdateDiscordStatus(std::string levelName,std::string className){
}
Discord->ActivityManager().UpdateActivity(newActivity,[](::discord::Result result){
if(result==::discord::Result::Ok){
std::cout<<"Discord Activity successfully updated!"<<std::endl;
LOG("Discord Activity successfully updated!");
}else{
std::cout<<"Could not update Discord Activity. Error Code "<<int(result)<<std::endl;
LOG("Could not update Discord Activity. Error Code "<<int(result));
}
});
}else{
@ -3583,7 +3592,7 @@ void AiL::UpdateDiscordStatus(std::string levelName,std::string className){
}else{
if(Steam_Init()){
retry=true;
std::cout<<"Steam API Initialized successfully!"<<std::endl;
LOG("Steam API Initialized successfully!");
}
}
if(retry){
@ -3597,7 +3606,7 @@ void AiL::InitializePlayerLevelCap(){
player->levelCap++;
}
if(player->levelCap<=1)ERR("Could not detect level cap properly!")
std::cout<<"Level cap detected as "<<int(player->levelCap)<<std::endl;
LOG("Level cap detected as "<<int(player->levelCap));
}
void AiL::ResetGame(bool changeToMainMenu){
@ -3796,7 +3805,7 @@ bool AiL::Steam_Init(){
if(SteamAPI_Init()){
if(SteamUtils()!=nullptr){
SteamUtils()->SetWarningMessageHook([](int severity,const char*message){
std::cout<<std::format("STEAM[{}]: {}",severity,std::string(message))<<std::endl;
LOG(std::format("STEAM[{}]: {}",severity,std::string(message)));
});
if(steamKeyboardCallbackListener==nullptr){
steamKeyboardCallbackListener=new SteamKeyboardCallbackHandler();

@ -250,7 +250,7 @@ void sig::Animation::InitializeAnimations(){
for(auto&dat:GFX){
std::string imgFile=dat.first;
if(!ANIMATION_DATA.count(imgFile)){
std::cout<<"WARNING! Animation data for "<<imgFile<<" not found! Auto-generating..."<<std::endl;
LOG("WARNING! Animation data for "<<imgFile<<" not found! Auto-generating...");
CreateStillAnimation(imgFile,GFX[imgFile].Sprite()->Size());
}
}

@ -42,6 +42,9 @@ All rights reserved.
#include <any>
#include <memory>
#include <source_location>
#include <fstream>
inline std::ofstream debugLogger;
#ifdef _DEBUG
#ifndef __EMSCRIPTEN__
@ -67,10 +70,18 @@ All rights reserved.
std::stringstream errStream; \
errStream<<err; \
Error::log(errStream,std::source_location::current());}
#define LOG(msg) { \
std::stringstream debugStream; \
debugStream<<msg; \
Error::debug(debugStream,std::source_location::current());}
class Error{
public:
inline static void debug(std::stringstream&str,std::source_location loc){
debugLogger<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str()<<std::endl;
std::cout<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str()<<std::endl;
}
inline static void log(std::stringstream&str,std::source_location loc){
debugLogger<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str()<<std::endl;
std::cout<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str()<<std::endl;
throw;
}
@ -84,7 +95,7 @@ All rights reserved.
class Error{
public:
inline static void log(std::stringstream&str,std::source_location loc){
std::cout<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str()<<std::endl;
LOG(loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str());
#ifdef __DEBUG__
throw;
#endif

@ -111,7 +111,7 @@ void GameSettings::Initialize(){
std::string loadSystemFilename="save_file_path"_S+"system.conf";
if(std::filesystem::exists(loadSystemFilename)){
std::cout<<"Reading system data file..."<<std::endl;
LOG("Reading system data file...");
utils::datafile::Read(loadSystemFile,loadSystemFilename);
}

@ -335,8 +335,8 @@ void ItemInfo::InitializeItems(){
if(tempItem.Description().length()==0)ERR("WARNING! Item "<<info.name<<" does not have a description!");
}
std::cout<<ITEM_DATA.size()<<" items have been loaded."<<std::endl;
std::cout<<ITEM_CATEGORIES.size()<<" item categories have been loaded."<<std::endl;
LOG(ITEM_DATA.size()<<" items have been loaded.");
LOG(ITEM_CATEGORIES.size()<<" item categories have been loaded.");
}
ItemProps::ItemProps(utils::datafile*scriptProps,utils::datafile*customProps)
@ -423,7 +423,7 @@ void ItemInfo::InitializeScripts(){
};
ITEM_SCRIPTS.SetInitialized();
std::cout<<ITEM_SCRIPTS.size()<<" item scripts have been loaded."<<std::endl;
LOG(ITEM_SCRIPTS.size()<<" item scripts have been loaded.");
}
Item::Item()

@ -174,13 +174,13 @@ void Input::Initialize(){
void Input::LoadSteamButtonIcons(){
GFX.Unlock();
std::cout<<std::format("Steam Icons may be required... Loading in {} icons",int(k_EInputActionOrigin_Count))<<std::endl;
LOG(std::format("Steam Icons may be required... Loading in {} icons",int(k_EInputActionOrigin_Count)));
for(int i=1;i<k_EInputActionOrigin_Count;i++){
const char*imageName{SteamInput()->GetGlyphPNGForActionOrigin(EInputActionOrigin(i),k_ESteamInputGlyphSize_Small,0U)};
if(imageName!=nullptr){
std::string loadImage{imageName};
if(loadImage.length()>0&&!GFX.count(loadImage)){
std::cout<<std::format("Loading steam image {}",loadImage)<<std::endl;
LOG(std::format("Loading steam image {}",loadImage));
GFX[loadImage].Load(loadImage);
}
}

@ -129,7 +129,7 @@ void Merchant::Initialize(){
merchantCount++;
}
if(merchantCount==0)ERR(std::format("WARNING! No merchants available for Chapter {}!",chapter));
std::cout<<std::format("Added {} merchants to Chapter {}",merchantCount,chapter)<<std::endl;
LOG(std::format("Added {} merchants to Chapter {}",merchantCount,chapter));
}
Merchant::RandomizeTravelingMerchant();
}
@ -255,7 +255,7 @@ void Merchant::SetTravelingMerchant(std::string_view key){
return;
}
}
std::cout<<std::format("WARNING! Could not set traveling merchant with key {}!",std::string(key))<<std::endl;
std::cout<<"Falling back to a randomized merchant."<<std::endl;
LOG(std::format("WARNING! Could not set traveling merchant with key {}!",std::string(key)));
LOG("Falling back to a randomized merchant.");
RandomizeTravelingMerchant();
}

@ -724,7 +724,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
float finalPctDmgTaken=armorDmgTaken*otherDmgTaken;
if(finalPctDmgTaken<=6._Pct){
std::cout<<"WARNING! Damage Reduction has somehow ended up below 6%, which is over the cap!"<<std::endl;
LOG("WARNING! Damage Reduction has somehow ended up below 6%, which is over the cap!");
}
finalPctDmgTaken=std::max(6.25_Pct,finalPctDmgTaken);//Apply Damage Cap.

@ -208,11 +208,11 @@ const void SaveFile::SaveGame(){
if(response!="ERR"){
Server_SaveFile([](std::string_view response){
if(response=="ERR"){
std::cout<<"WARNING! Could not save data to server!"<<std::endl;
LOG("WARNING! Could not save data to server!");
}
});
}else{
std::cout<<"WARNING! Could not save metadata to server!"<<std::endl;
LOG("WARNING! Could not save metadata to server!");
}
};
Server_SaveMetadataFile(RetryResponse);
@ -227,9 +227,9 @@ const void SaveFile::SaveGame(){
}
std::string contents=fileContents.str();
emscripten_idb_async_store("/assets",("save_file_path"_S+std::format("save.{:04}",saveFileID)).c_str(),contents.data(),contents.length(),0,[](void*arg){
std::cout<<"Successfully saved save file "<<saveFileID<<"!"<<std::endl;
LOG("Successfully saved save file "<<saveFileID<<"!");
},[](void*arg){
std::cout<<"Failed to save save file "<<saveFileID<<"!"<<std::endl;
LOG("Failed to save save file "<<saveFileID<<"!");
});
file.close();
@ -245,9 +245,9 @@ const void SaveFile::SaveGame(){
}
std::string metaContents=metafileContents.str();
emscripten_idb_async_store("/assets",("save_file_path"_S+"metadata.dat").c_str(),metaContents.data(),metaContents.length(),0,[](void*arg){
std::cout<<"Successfully saved metafile!"<<std::endl;
LOG("Successfully saved metafile!");
},[](void*arg){
std::cout<<"Failed to save save metafile!"<<std::endl;
LOG("Failed to save save metafile!");
});
metafile.close();
@ -262,9 +262,9 @@ const void SaveFile::SaveGame(){
}
std::string systemContents=systemFileContents.str();
emscripten_idb_async_store("/assets",("save_file_path"_S+"system.conf").c_str(),systemContents.data(),systemContents.length(),0,[](void*arg){
std::cout<<"Successfully saved system file!"<<std::endl;
LOG("Successfully saved system file!");
},[](void*arg){
std::cout<<"Failed to save system file!"<<std::endl;
LOG("Failed to save system file!");
});
systemfile.close();
@ -366,7 +366,7 @@ void SaveFile::LoadFile(){
GameState::ChangeState(States::OVERWORLD_MAP,0.5f);
}else{
std::cout<<std::format("WARNING! File {} does not exist for loading!","save_file_path"_S+std::format("save.{:04}",saveFileID))<<std::endl;
LOG(std::format("WARNING! File {} does not exist for loading!","save_file_path"_S+std::format("save.{:04}",saveFileID)));
}
};
@ -382,12 +382,12 @@ const void SaveFile::LoadGame(){
file.close();
LoadFile();
}else{
std::cout<<"WARNING! Could not load save file!"<<std::endl;
LOG("WARNING! Could not load save file!");
}
});
}else{
emscripten_idb_async_load("/assets",("save_file_path"_S+std::format("save.{:04}",saveFileID)).c_str(),0,[](void*arg,void*data,int length){
std::cout<<"Loaded Save File "<<saveFileID<<" successfully!"<<std::endl;
LOG("Loaded Save File "<<saveFileID<<" successfully!");
std::string rawMetadata=(char*)data;
std::ofstream file("save_file_path"_S+std::format("save.{:04}",saveFileID));
@ -397,7 +397,7 @@ const void SaveFile::LoadGame(){
file.close();
LoadFile();
},[](void*arg){
std::cout<<"Failed to load Save File "<<saveFileID<<"!"<<std::endl;
LOG("Failed to load Save File "<<saveFileID<<"!");
});
}
#else
@ -433,7 +433,7 @@ const void SaveFile::SetSaveFileOfflineID_TransitionToOverworldMap(){
SaveFile::saveFileID=saveFileCount;
GameState::ChangeState(States::OVERWORLD_MAP);
},[](void*arg){
std::cout<<"Failed to load metadata! Initializing as save file 0."<<std::endl;
LOG("Failed to load metadata! Initializing as save file 0.");
SaveFile::saveFileID=0; //Since we couldn't find metadata, we are assuming we start at save file 0.
GameState::ChangeState(States::OVERWORLD_MAP);
});
@ -494,7 +494,7 @@ const void SaveFile::UpdateSaveGameData(std::function<void()>afterSaveGameDataUp
gameFilesList->RemoveAllComponents();
#ifdef __EMSCRIPTEN__
emscripten_idb_async_load("/assets",("save_file_path"_S+"metadata.dat").c_str(),0,[](void*arg,void*data,int length){
std::cout<<"Loaded metadata successfully!"<<std::endl;
LOG("Loaded metadata successfully!");
auto gameFilesList=Component<ScrollableWindowComponent>(LOAD_GAME,"Game Files List");
std::string rawMetadata=(char*)data;
@ -521,7 +521,7 @@ const void SaveFile::UpdateSaveGameData(std::function<void()>afterSaveGameDataUp
}
SaveFile::afterSaveGameDataUpdate();
},[](void*arg){
std::cout<<"Failed to load metadata!"<<std::endl;
LOG("Failed to load metadata!");
SaveFile::afterSaveGameDataUpdate();
});
#endif
@ -632,9 +632,9 @@ const void SaveFile::Server_SaveMetadataFile(std::function<void(std::string_view
std::string contents=fileContents.str();
#ifdef __EMSCRIPTEN__
emscripten_idb_async_store("/assets",("save_file_path"_S+"metadata.dat"+"_online").c_str(),contents.data(),contents.length(),0,[](void*arg){
std::cout<<"Saved metadata successfully!"<<std::endl;
LOG("Saved metadata successfully!");
},[](void*arg){
std::cout<<"Failed to save metadata!"<<std::endl;
LOG("Failed to save metadata!");
});
#endif
game->SendRequest("save_server"_S,CreateServerRequest(SaveFileOperation::SAVE_METADATA_FILE,fileContents.str()));

@ -87,7 +87,7 @@ public:
removedCount+=Menu::menus[parentMenu]->components.erase(componentName);
if(removedCount!=1){
std::cout<<"WARNING! Attempted to remove subbuttons from button listing, but not found!";
LOG("WARNING! Attempted to remove subbuttons from button listing, but not found!");
}
}
}
@ -103,7 +103,7 @@ public:
removedCount+=Menu::menus[parentMenu]->components.erase(button.lock()->GetName());
if(removedCount!=1){
std::cout<<"WARNING! Attempted to remove buttons from button listing, but not found!";
LOG("WARNING! Attempted to remove buttons from button listing, but not found!");
}
CalculateBounds();
}

@ -390,7 +390,7 @@ class TMXParser{
if (newTag.tag.length()==0) { //Tag's empty, so first line is the tag.
newTag.tag=data;
#if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Tag: "<<newTag.tag<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("Tag: "<<newTag.tag<<"\n";
#endif
} else {
std::string key = data.substr(0,data.find("="));
@ -402,7 +402,7 @@ class TMXParser{
newTag.data[key]=value;
#if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<" "<<key<<":"<<newTag.data[key]<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG(" "<<key<<":"<<newTag.data[key]<<"\n";
#endif
}
}
@ -534,11 +534,11 @@ class TMXParser{
prevZoneData=&zones.back();
}else{
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Unsupported tag format! Ignoring."<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("Unsupported tag format! Ignoring."<<"\n";
#endif
}
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("\n"<<"=============\n";
#endif
}
TMXParser::TMXParser(std::string file){
@ -596,7 +596,7 @@ class TMXParser{
if(infiniteMap){
#if _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Infinite map detected. Parsing stopped early."<<std::endl;
if(_DEBUG_MAP_LOAD_INFO)LOG("Infinite map detected. Parsing stopped early.");
#endif
}
@ -682,7 +682,7 @@ class TMXParser{
}
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Parsed Map Data:\n"<<parsedMapInfo<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("Parsed Map Data:\n"<<parsedMapInfo<<"\n";
#endif
}
#endif

@ -19,10 +19,6 @@ Remove Unlock All Button
Sword attack should linger
Add game file debug logging
Controller Vibration
PS5 LED color support
============================================
Make another actions config file for the main build (The app # is different)

@ -116,7 +116,7 @@ class TSXParser{
if(valid&&data.length()>0){
if (newTag.tag.length()==0) { //Tag's empty, so first line is the tag.
newTag.tag=data;
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Tag: "<<newTag.tag<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("Tag: "<<newTag.tag<<"\n");
} else {
std::string key = data.substr(0,data.find("="));
std::string value = data.substr(data.find("=")+1,std::string::npos);
@ -126,7 +126,7 @@ class TSXParser{
value = value.substr(0,value.length()-1);
newTag.data[key]=value;
if(_DEBUG_MAP_LOAD_INFO)std::cout<<" "<<key<<":"<<newTag.data[key]<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG(" "<<key<<":"<<newTag.data[key]<<"\n");
}
}
}
@ -194,7 +194,7 @@ class TSXParser{
}
}
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"\n"<<"=============\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("\n"<<"=============\n";
#endif
}
TSXParser::TSXParser(std::string file)
@ -228,7 +228,7 @@ class TSXParser{
}
}
#ifdef _DEBUG
if(_DEBUG_MAP_LOAD_INFO)std::cout<<"Parsed Tileset Data:\n"<<parsedTilesetInfo<<"\n";
if(_DEBUG_MAP_LOAD_INFO)LOG("Parsed Tileset Data:\n"<<parsedTilesetInfo<<"\n");
#endif
}
#endif

@ -45,7 +45,7 @@ INCLUDE_game
int Test::totalTests=0;
void Test::is(std::string conditionStr,bool testResult){
std::cout<<"Running test "<<Test::totalTests<<std::endl;
LOG("Running test "<<Test::totalTests);
if(!testResult){
ERR(("\t"+conditionStr+" returned FALSE"));
}

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_PATCH 0
#define VERSION_BUILD 8399
#define VERSION_BUILD 8413
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -52,6 +52,7 @@ All rights reserved.
#include <limits>
#include <string>
#include <vector>
#include "Error.h"
#include FT_FREETYPE_H
#include FT_GLYPH_H
@ -160,7 +161,7 @@ namespace olc {
FT_Set_Transform(toUse->fontFace, &rotMat, &pen);
FT_Error error = FT_Load_Char(toUse->fontFace, chr, FT_LOAD_RENDER);
if(error){
std::cout<<"FT Error: "<<error<<std::endl;
LOG("FT Error: "<<error);
continue;
}
@ -168,7 +169,7 @@ namespace olc {
FT_Glyph glyph;
error = FT_Get_Glyph(slot, &glyph);
if(error){
std::cout<<"FT Error: "<<error<<std::endl;
LOG("FT Error: "<<error);
continue;
}

Loading…
Cancel
Save