From 9756cc4a78daef1e9f9c95acfd4b0076e85b0388 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Tue, 19 Dec 2023 22:40:53 -0600 Subject: [PATCH] Add map types to every stage plate and to new stages. Correctly handle Discord SDK disconnects when the app is closed or not started initially. --- Crawler/CREDITS | 2 ++ Crawler/Crawler.cpp | 34 ++++++++++++++++++++------ Crawler/Crawler.h | 3 ++- Crawler/Crawler.tiled-project | 3 ++- Crawler/Map.h | 3 +++ Crawler/State_OverworldMap.cpp | 2 +- Crawler/Version.h | 2 +- Crawler/assets/Campaigns/1_3.tmx | 8 +++++- Crawler/assets/Campaigns/1_4.tmx | 8 +++++- Crawler/assets/Campaigns/1_5.tmx | 8 +++++- Crawler/assets/Campaigns/World_Map.tmx | 3 ++- Crawler/assets/config/levels.txt | 3 +++ Crawler/discord-files/core.cpp | 2 +- 13 files changed, 65 insertions(+), 16 deletions(-) diff --git a/Crawler/CREDITS b/Crawler/CREDITS index 4971096a..f783f3a6 100644 --- a/Crawler/CREDITS +++ b/Crawler/CREDITS @@ -1,6 +1,8 @@ The inspiration that started it all, Pokemon-based Nico Yazawa sprite: https://www.deviantart.com/kirbysmith/art/Nico-Yazawa-Love-Live-Pokemon-Sprites-548007023 +olcPixelGameEngine Copyright 2023 OneLoneCoder.com under the OLC-3 License + *** Minifantasy - Tiny Overworld v1.0 *** Minifantasy is an original idea by Krishna Palacio diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 46b291ca..95c0a8ca 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -147,6 +147,7 @@ Crawler::Crawler() sAppName = "GAME_NAME"_S; game=this; + gameStarted=time(NULL); } bool Crawler::OnUserCreate(){ @@ -226,7 +227,12 @@ bool Crawler::OnUserUpdate(float fElapsedTime){ RenderVersionInfo(); #ifndef __EMSCRIPTEN__ if(Discord){ - Discord->RunCallbacks(); + auto result=Discord->RunCallbacks(); + if(result!=::discord::Result::Ok){ + std::cout<<"Discord Error Code "<SetLogHook( discord::LogLevel::Debug, [](discord::LogLevel level, const char* message) { @@ -2304,7 +2312,10 @@ void Crawler::SetupDiscord(){ }); std::cout<<"Connected to Discord!"<GetClassName()); + }else{ + std::cout<<"Could not connect to Discord. Error Code "<sAppName.c_str()); + assets.SetSmallText(className.c_str()); + if(levelName!="Main Menu"){ std::for_each(className.begin(),className.end(),[](char&c){c=std::tolower(c);}); assets.SetSmallImage(("nico-"+className+"_512").c_str()); } - assets.SetLargeText(game->sAppName.c_str()); - assets.SetSmallText(className.c_str()); Discord->ActivityManager().UpdateActivity(newActivity,[](::discord::Result result){ - std::cout<<"Discord Activity successfully updated!"<(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name); Component(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns); Component(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists); - Component(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP")); + Component(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(currentConnectionPoint->levelDataExists&&!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP")); break; } } diff --git a/Crawler/Version.h b/Crawler/Version.h index b9a24053..621ae255 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 4251 +#define VERSION_BUILD 4267 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/assets/Campaigns/1_3.tmx b/Crawler/assets/Campaigns/1_3.tmx index 8eac1135..5471f54e 100644 --- a/Crawler/assets/Campaigns/1_3.tmx +++ b/Crawler/assets/Campaigns/1_3.tmx @@ -1,5 +1,8 @@ - + + + + @@ -498,4 +501,7 @@ 0,0,0,0,0,0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,0,0 + + + diff --git a/Crawler/assets/Campaigns/1_5.tmx b/Crawler/assets/Campaigns/1_5.tmx index 150284d2..fbdaf36b 100644 --- a/Crawler/assets/Campaigns/1_5.tmx +++ b/Crawler/assets/Campaigns/1_5.tmx @@ -1,5 +1,8 @@ - + + + + @@ -257,6 +260,9 @@ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + + + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, diff --git a/Crawler/assets/Campaigns/World_Map.tmx b/Crawler/assets/Campaigns/World_Map.tmx index 7a6ce804..47f7f8dd 100644 --- a/Crawler/assets/Campaigns/World_Map.tmx +++ b/Crawler/assets/Campaigns/World_Map.tmx @@ -594,7 +594,7 @@ - + @@ -618,6 +618,7 @@ + diff --git a/Crawler/assets/config/levels.txt b/Crawler/assets/config/levels.txt index eb7843b3..400276b3 100644 --- a/Crawler/assets/config/levels.txt +++ b/Crawler/assets/config/levels.txt @@ -8,4 +8,7 @@ Levels BOSS_1 = Boss_1_v2.tmx CAMPAIGN_1_2 = 1_2.tmx + CAMPAIGN_1_3 = 1_3.tmx + CAMPAIGN_1_4 = 1_4.tmx + CAMPAIGN_1_5 = 1_5.tmx } \ No newline at end of file diff --git a/Crawler/discord-files/core.cpp b/Crawler/discord-files/core.cpp index 110c9ef6..e09f1048 100644 --- a/Crawler/discord-files/core.cpp +++ b/Crawler/discord-files/core.cpp @@ -43,7 +43,7 @@ Result Core::Create(ClientId clientId, std::uint64_t flags, Core** instance) Core::~Core() { if (internal_) { - internal_->destroy(internal_); + //internal_->destroy(internal_); internal_ = nullptr; } }