diff --git a/Crawler/CREDITS b/Crawler/CREDITS new file mode 100644 index 00000000..37dfffac --- /dev/null +++ b/Crawler/CREDITS @@ -0,0 +1,22 @@ +*** Minifantasy - Tiny Overworld v1.0 *** + +Minifantasy is an original idea by Krishna Palacio + +ERA OF FANTASY - GRASSLANDS + +https://twitter.com/Namatnieks +https://aamatniekss.itch.io/grasslands-era-of-fantasy-pixelart-asset-pack + + +Portions of this software are copyright © 2023 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. + +Fonts used are public domain, however authors are credited as such: +c64esque by andraaspar +Habbo by Omni +Unknown by Anonymous + +Fonts obtained from: +Nb Pixel Font Bundle: https://nimblebeastscollective.itch.io/nb-pixel-font-bundle +Nb Pixel Font Bundle 2: https://nimblebeastscollective.itch.io/nb-pixel-font-bundle-2 \ No newline at end of file diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj index 1a4336cd..e10554d5 100644 --- a/Crawler/Crawler.vcxproj +++ b/Crawler/Crawler.vcxproj @@ -132,6 +132,7 @@ true stdcpp20 C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories) + /MP8 %(AdditionalOptions) Console @@ -152,6 +153,7 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 + /MP8 %(AdditionalOptions) Console @@ -172,6 +174,7 @@ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 + /MP8 %(AdditionalOptions) Console @@ -191,6 +194,7 @@ true stdcpp20 C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories) + /MP8 %(AdditionalOptions) Console @@ -215,6 +219,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 + /MP8 %(AdditionalOptions) Console @@ -238,6 +243,7 @@ NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpp20 + /MP8 %(AdditionalOptions) Console diff --git a/Crawler/LICENSE b/Crawler/LICENSE index 2eba1401..2d3bac43 100644 --- a/Crawler/LICENSE +++ b/Crawler/LICENSE @@ -32,4 +32,13 @@ SUCH DAMAGE. Portions of this software are copyright © 2023 The FreeType Project (www.freetype.org). Please see LICENSE_FT.txt for more information. All rights reserved. + +Fonts used are public domain, however authors are credited as such: +c64esque by andraaspar +Habbo by Omni +Unknown by Anonymous + +Fonts obtained from: +Nb Pixel Font Bundle: https://nimblebeastscollective.itch.io/nb-pixel-font-bundle +Nb Pixel Font Bundle 2: https://nimblebeastscollective.itch.io/nb-pixel-font-bundle-2 */ diff --git a/Crawler/Version.h b/Crawler/Version.h index 1052f3a8..4deef484 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 3285 +#define VERSION_BUILD 3298 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Crawler/VisualNovel.cpp b/Crawler/VisualNovel.cpp index 9327a793..acd670f3 100644 --- a/Crawler/VisualNovel.cpp +++ b/Crawler/VisualNovel.cpp @@ -245,8 +245,8 @@ void VisualNovel::Draw(){ vf2d dialogDisplaySize={game->GetScreenSize().x-48.f,20.f}; Menu::DrawThemedWindow(dialogDisplayPos,dialogDisplaySize); FontRect speakerTextSize=font.GetStringBounds(speakerDisplayName); - game->DrawShadowStringDecal(font,nameDisplayPos-vf2d{10,8}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize.size/2,speakerDisplayName); - game->DrawShadowStringDecal(font,dialogDisplayPos-vf2d{10,10},activeText); + game->DrawStringDecal(font,nameDisplayPos-vf2d{10,8}+(nameDisplayWindowSize+vf2d{24,0})/2-speakerTextSize.size/2,speakerDisplayName); + game->DrawStringDecal(font,dialogDisplayPos-vf2d{10,10},activeText); float yOffset=util::lerp(dialogDisplaySize.y+12,-8,textScrollTime/maxTextScrollTime); game->DrawPolygonDecal( Menu::GetPatchPart(1,1).Decal(), diff --git a/Crawler/assets/Habbo.ttf b/Crawler/assets/Habbo.ttf new file mode 100644 index 00000000..77075e4a Binary files /dev/null and b/Crawler/assets/Habbo.ttf differ diff --git a/Crawler/assets/LCDBlock.ttf b/Crawler/assets/LCDBlock.ttf new file mode 100644 index 00000000..cedde0b5 Binary files /dev/null and b/Crawler/assets/LCDBlock.ttf differ diff --git a/Crawler/assets/LessRoundBox.ttf b/Crawler/assets/LessRoundBox.ttf deleted file mode 100644 index d030f4b7..00000000 Binary files a/Crawler/assets/LessRoundBox.ttf and /dev/null differ diff --git a/Crawler/assets/Unknown.ttf b/Crawler/assets/Unknown.ttf new file mode 100644 index 00000000..81298e9a Binary files /dev/null and b/Crawler/assets/Unknown.ttf differ diff --git a/Crawler/assets/c64esque.ttf b/Crawler/assets/c64esque.ttf new file mode 100644 index 00000000..78de3a58 Binary files /dev/null and b/Crawler/assets/c64esque.ttf differ diff --git a/Crawler/assets/config/configuration.txt b/Crawler/assets/config/configuration.txt index 9d53622a..5f248e9c 100644 --- a/Crawler/assets/config/configuration.txt +++ b/Crawler/assets/config/configuration.txt @@ -61,7 +61,13 @@ story_background_image_location = backgrounds/ story_player_name = You # Dialog font and size. -dialog_font_size = LessRoundBox,12 +dialog_font_size = Habbo,12 + +# Location font and size. +location_font_size = Habbo,24 + +# Encrypted font and size. +encrypted_font_size = Unknown,16 # Whether or not to show individual data accesses from config data structure. debug_access_options = 0 diff --git a/Crawler/olcPGEX_TTF.h b/Crawler/olcPGEX_TTF.h index 32878234..43ae0701 100644 --- a/Crawler/olcPGEX_TTF.h +++ b/Crawler/olcPGEX_TTF.h @@ -365,6 +365,11 @@ namespace olc { fallbacks.emplace_back(path, fontSize); } + std::u32string GetFontName(){ + std::string name=fontFace->family_name; + return std::u32string(name.begin(),name.end()); + } + static bool init() { FT_Error error = FT_Init_FreeType(&library); diff --git a/Crawler/olcPixelGameEngine.h b/Crawler/olcPixelGameEngine.h index 46c50f28..a7d945c2 100644 --- a/Crawler/olcPixelGameEngine.h +++ b/Crawler/olcPixelGameEngine.h @@ -1026,6 +1026,7 @@ namespace olc // Specify which Sprite should be the target of drawing functions, use nullptr // to specify the primary screen void SetDrawTarget(Sprite* target); + float GetRuntime() const; // Gets the current Frames Per Second uint32_t GetFPS() const; // Gets last update of elapsed time @@ -1258,6 +1259,7 @@ namespace olc uint32_t nLastFPS = 0; bool bPixelCohesion = false; DecalMode nDecalMode = DecalMode::NORMAL; + float fRunTime = 0.0f; DecalStructure nDecalStructure = DecalStructure::FAN; std::function funcPixelMode; std::chrono::time_point m_tp1, m_tp2; @@ -2119,6 +2121,9 @@ namespace olc return 0; } + float PixelGameEngine::GetRuntime() const + { return fRunTime; } + uint32_t PixelGameEngine::GetFPS() const { return nLastFPS; } @@ -3339,30 +3344,54 @@ namespace olc } void PixelGameEngine::DrawStringDecal(Font&font, const olc::vf2d& pos, const std::u32string& sText, const Pixel col, const olc::vf2d& scale){ + struct DecalData{ + Decal*decal; + float expireTime=0.0f; + }; if(sText.length()==0)return; - static Decal*temp=nullptr; - if(temp!=nullptr){ - delete temp; - } - temp=font.RenderStringToDecal(sText,col); - DrawDecal(pos,temp,scale/4,col); + static std::mapgarbageCollector; + std::u32string key=font.GetFontName()+U"_"+sText; + if(!garbageCollector.count(key)){ //If the text key already exists, don't have to recreate the decal, just update the expire time. + garbageCollector[key].decal=font.RenderStringToDecal(sText,WHITE); + } + garbageCollector[key].expireTime=GetRuntime()+120.0f; + std::erase_if(garbageCollector,[&](auto&key){ + if(key.second.expireTimegarbageCollector; + std::u32string key=font.GetFontName()+U"_"+sText; + if(!garbageCollector.count(key)){ //If the text key already exists, don't have to recreate the decal, just update the expire time. + garbageCollector[key].decal=font.RenderStringToDecal(sText,WHITE); + } + garbageCollector[key].expireTime=GetRuntime()+120.0f; + std::erase_if(garbageCollector,[&](auto&key){ + if(key.second.expireTime #include "olcUTIL_Geometry2D.h" -#if defined(__EMSCRIPTEN__) - #include "olcPGEX_TTF.h" -#else - class olc::Font; -#endif -namespace util{ +namespace olc::util{ //Returns 0-range (as a float). float random(float range); //Returns a normalized vector pointing from posFrom towards posTo.