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.

pull/28/head
sigonasr2 11 months ago
parent eae8239501
commit 9756cc4a78
  1. 2
      Crawler/CREDITS
  2. 32
      Crawler/Crawler.cpp
  3. 3
      Crawler/Crawler.h
  4. 3
      Crawler/Crawler.tiled-project
  5. 3
      Crawler/Map.h
  6. 2
      Crawler/State_OverworldMap.cpp
  7. 2
      Crawler/Version.h
  8. 8
      Crawler/assets/Campaigns/1_3.tmx
  9. 8
      Crawler/assets/Campaigns/1_4.tmx
  10. 8
      Crawler/assets/Campaigns/1_5.tmx
  11. 3
      Crawler/assets/Campaigns/World_Map.tmx
  12. 3
      Crawler/assets/config/levels.txt
  13. 2
      Crawler/discord-files/core.cpp

@ -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

@ -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 "<<int(result)<<std::endl;
delete Discord;
Discord=nullptr;
}
}
#endif
return !gameEnd;
@ -1959,6 +1965,9 @@ void Crawler::InitializeLevels(){
INITLEVEL(CAMPAIGN_1_1);
INITLEVEL(BOSS_1);
INITLEVEL(CAMPAIGN_1_2);
INITLEVEL(CAMPAIGN_1_3);
INITLEVEL(CAMPAIGN_1_4);
INITLEVEL(CAMPAIGN_1_5);
Test::RunMapTests();
@ -2293,10 +2302,9 @@ void Crawler::EndGame(){
gameEnd=true;
}
void Crawler::SetupDiscord(){
gameStarted=time(NULL);
::discord::Result Crawler::SetupDiscord(){
#ifndef __EMSCRIPTEN__
auto result = ::discord::Core::Create(1186719371750555780,DiscordCreateFlags_NoRequireDiscord,&Discord);
auto result=::discord::Core::Create(1186719371750555780,DiscordCreateFlags_NoRequireDiscord,&Discord);
if(result==::discord::Result::Ok){
Discord->SetLogHook(
discord::LogLevel::Debug, [](discord::LogLevel level, const char* message) {
@ -2304,7 +2312,10 @@ void Crawler::SetupDiscord(){
});
std::cout<<"Connected to Discord!"<<std::endl;
UpdateDiscordStatus("Main Menu",player.get()->GetClassName());
}else{
std::cout<<"Could not connect to Discord. Error Code "<<int(result)<<std::endl;
}
return result;
#endif
}
@ -2319,15 +2330,24 @@ void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
newActivity.SetType(discord::ActivityType::Playing);
discord::ActivityAssets&assets=newActivity.GetAssets();
assets.SetLargeImage("heart_512");
assets.SetLargeText(game->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){
if(result==::discord::Result::Ok){
std::cout<<"Discord Activity successfully updated!"<<std::endl;
}else{
std::cout<<"Could not update Discord Activity. Error Code "<<int(result)<<std::endl;
}
});
}else{
if(SetupDiscord()==::discord::Result::Ok){
UpdateDiscordStatus(levelName,className);
}
}
#endif
}

@ -50,6 +50,7 @@ All rights reserved.
#include "olcUTIL_DataFile.h"
#include "Key.h"
#include "GameState.h"
#include "discord.h"
class Crawler : public olc::PixelGameEngine
{
@ -113,7 +114,7 @@ private:
time_t gameStarted;
void ValidateGameStatus();
void SetupDiscord();
::discord::Result SetupDiscord();
public:
Crawler();
bool OnUserCreate() override;

@ -298,7 +298,7 @@
"name": "Type",
"propertyType": "StageType",
"type": "string",
"value": "DUNGEON"
"value": "NONE"
},
{
"name": "Unlock Condition",
@ -320,6 +320,7 @@
"storageType": "string",
"type": "enum",
"values": [
"NONE",
"DUNGEON",
"BOSS",
"STORY",

@ -45,6 +45,9 @@ struct XMLTag;
enum MapName{
CAMPAIGN_1_1,
CAMPAIGN_1_2,
CAMPAIGN_1_3,
CAMPAIGN_1_4,
CAMPAIGN_1_5,
BOSS_1,
WORLD_MAP
};

@ -120,7 +120,7 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
Component<MenuLabel>(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
Component<EncountersSpawnListScrollableWindowComponent>(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(currentConnectionPoint->levelDataExists&&!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
break;
}
}

@ -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

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="240" height="120" tilewidth="24" tileheight="24" infinite="0" nextlayerid="6" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="240" height="120" tilewidth="24" tileheight="24" infinite="0" nextlayerid="7" nextobjectid="2">
<properties>
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="2913" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<layer id="2" name="Layer 1" width="240" height="120">
@ -498,4 +501,7 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="6" name="Spawn Zones">
<object id="1" name="End Zone" type="EndZone" x="5136" y="2640" width="72" height="72"/>
</objectgroup>
</map>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="200" height="120" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="200" height="120" tilewidth="24" tileheight="24" infinite="0" nextlayerid="9" nextobjectid="2">
<properties>
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="2913" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<layer id="5" name="Layer 1" width="200" height="120">
@ -374,4 +377,7 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
</data>
</layer>
<objectgroup id="8" name="Spawn Zones">
<object id="1" name="End Zone" type="EndZone" x="1608" y="1464" width="72" height="72"/>
</objectgroup>
</map>

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" orientation="orthogonal" renderorder="right-down" width="200" height="250" tilewidth="24" tileheight="24" infinite="0" nextlayerid="6" nextobjectid="1">
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="200" height="250" tilewidth="24" tileheight="24" infinite="0" nextlayerid="7" nextobjectid="2">
<properties>
<property name="Level Type" propertytype="LevelType" value="Dungeon"/>
</properties>
<tileset firstgid="1" source="../maps/Tilesheet_No_Shadow24x24.tsx"/>
<tileset firstgid="2913" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<tileset firstgid="4533" source="../maps/24x24_Waterfall.tsx"/>
@ -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
</data>
</layer>
<objectgroup id="6" name="Spawn Zones">
<object id="1" name="End Zone" type="EndZone" x="2976" y="1608" width="72" height="72"/>
</objectgroup>
<layer id="3" name="Layer 2" width="200" height="250">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

@ -594,7 +594,7 @@
<properties>
<property name="Connection 1" type="object" value="6"/>
<property name="Map" propertytype="Level" value="STORY_1_2"/>
<property name="Type" propertytype="StageType" value="DUNGEON"/>
<property name="Type" propertytype="StageType" value="STORY"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_2"/>
</properties>
</object>
@ -618,6 +618,7 @@
<properties>
<property name="Connection 1" type="object" value="0"/>
<property name="Map" propertytype="Level" value="BOSS_1"/>
<property name="Type" propertytype="StageType" value="BOSS"/>
<property name="Unlock Condition" propertytype="Level" value="CAMPAIGN_1_8"/>
</properties>
</object>

@ -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
}

@ -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;
}
}

Loading…
Cancel
Save