Updated all references of Crawler project to now reference Adventures in Lestoria. Fixed a loading bug with the current connection point buttons and information not updating upon loading into the overworld map. Fix component count initialization bug (On Linux and Emscripten builds the component count would start uninitialized and would result in poor depth ordering sometimes.

pull/28/head
sigonasr2 11 months ago
parent 73289de3aa
commit 296ea1f2e6
  1. 1
      .gitignore
  2. 2
      Adventures in Lestoria.sln
  3. 2
      Adventures in Lestoria/Ability.cpp
  4. 0
      Adventures in Lestoria/Ability.h
  5. 77
      Adventures in Lestoria/Adventures in Lestoria.rc
  6. 33
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  7. 14
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  8. 210
      Adventures in Lestoria/AdventuresInLestoria.cpp
  9. 4
      Adventures in Lestoria/AdventuresInLestoria.h
  10. 2
      Adventures in Lestoria/Animation.cpp
  11. 0
      Adventures in Lestoria/Animation.h
  12. 2
      Adventures in Lestoria/Arrow.cpp
  13. 0
      Adventures in Lestoria/Attributable.h
  14. 0
      Adventures in Lestoria/AttributableStat.cpp
  15. 2
      Adventures in Lestoria/AttributableStat.h
  16. 0
      Adventures in Lestoria/BitwiseEnum.h
  17. 2
      Adventures in Lestoria/BlacksmithCraftingWindow.cpp
  18. 6
      Adventures in Lestoria/Buff.h
  19. 2
      Adventures in Lestoria/Bullet.cpp
  20. 2
      Adventures in Lestoria/Bullet.h
  21. 0
      Adventures in Lestoria/BulletTypes.h
  22. 0
      Adventures in Lestoria/BuyItemWindow.cpp
  23. 0
      Adventures in Lestoria/C++ Header File (OLC-3).zip
  24. 0
      Adventures in Lestoria/C++ Source File (OLC-3).zip
  25. 0
      Adventures in Lestoria/C++/scripts/build.sh
  26. 0
      Adventures in Lestoria/C++/scripts/commit.sh
  27. 0
      Adventures in Lestoria/C++/scripts/debug.sh
  28. 0
      Adventures in Lestoria/C++/scripts/filelist
  29. 0
      Adventures in Lestoria/C++/scripts/lines.sh
  30. 0
      Adventures in Lestoria/C++/scripts/md5
  31. 0
      Adventures in Lestoria/C++/scripts/release.sh
  32. 0
      Adventures in Lestoria/C++/scripts/temp
  33. 0
      Adventures in Lestoria/C++/scripts/web.sh
  34. 0
      Adventures in Lestoria/CREDITS
  35. 4
      Adventures in Lestoria/CharacterAbilityPreviewComponent.h
  36. 2
      Adventures in Lestoria/CharacterInfoWindow.cpp
  37. 2
      Adventures in Lestoria/CharacterMenuWindow.cpp
  38. 4
      Adventures in Lestoria/CharacterRotatingDisplay.h
  39. 2
      Adventures in Lestoria/ChargedArrow.cpp
  40. 0
      Adventures in Lestoria/Class.h
  41. 4
      Adventures in Lestoria/ClassDiagram2.cd
  42. 0
      Adventures in Lestoria/ClassDiagram2.png
  43. 0
      Adventures in Lestoria/ClassInfo.h
  44. 2
      Adventures in Lestoria/ClassSelectionWindow.cpp
  45. 0
      Adventures in Lestoria/ConnectionPoint.cpp
  46. 1
      Adventures in Lestoria/ConnectionPoint.h
  47. 0
      Adventures in Lestoria/ConsumableCraftItemWindow.cpp
  48. 2
      Adventures in Lestoria/ConsumableCraftingWindow.cpp
  49. 0
      Adventures in Lestoria/CraftItemWindow.cpp
  50. 0
      Adventures in Lestoria/CraftingRequirement.cpp
  51. 0
      Adventures in Lestoria/CraftingRequirement.h
  52. 0
      Adventures in Lestoria/Crawler
  53. 0
      Adventures in Lestoria/Crawler.tiled-project
  54. 0
      Adventures in Lestoria/Crawler_Slime_King_Encounter.txt
  55. 0
      Adventures in Lestoria/Crawler_System_Overview.txt
  56. 2
      Adventures in Lestoria/DEFINES.h
  57. 0
      Adventures in Lestoria/DamageNumber.cpp
  58. 0
      Adventures in Lestoria/DamageNumber.h
  59. 2
      Adventures in Lestoria/Effect.cpp
  60. 2
      Adventures in Lestoria/Effect.h
  61. 0
      Adventures in Lestoria/Emitter.cpp
  62. 2
      Adventures in Lestoria/Emitter.h
  63. 2
      Adventures in Lestoria/EncountersSpawnListScrollableWindowComponent.h
  64. 2
      Adventures in Lestoria/EnergyBolt.cpp
  65. 0
      Adventures in Lestoria/EnhancementStatsLabel.h
  66. 2
      Adventures in Lestoria/EquipSlotButton.h
  67. 0
      Adventures in Lestoria/Error.h
  68. 0
      Adventures in Lestoria/FallingDebris.h
  69. 2
      Adventures in Lestoria/FireBolt.cpp
  70. 0
      Adventures in Lestoria/FunctionPriming.h
  71. 2
      Adventures in Lestoria/GameState.cpp
  72. 8
      Adventures in Lestoria/GameState.h
  73. 0
      Adventures in Lestoria/InitialConcept.txt
  74. 2
      Adventures in Lestoria/InventoryConsumableWindow.cpp
  75. 0
      Adventures in Lestoria/InventoryCreator.cpp
  76. 0
      Adventures in Lestoria/InventoryCreator.h
  77. 4
      Adventures in Lestoria/InventoryScrollableWindowComponent.h
  78. 2
      Adventures in Lestoria/InventoryWindow.cpp
  79. 28
      Adventures in Lestoria/Item.cpp
  80. 6
      Adventures in Lestoria/Item.h
  81. 2
      Adventures in Lestoria/ItemDrop.cpp
  82. 4
      Adventures in Lestoria/ItemDrop.h
  83. 2
      Adventures in Lestoria/ItemLoadoutWindow.cpp
  84. 0
      Adventures in Lestoria/ItemMenuLabel.h
  85. 2
      Adventures in Lestoria/Key.cpp
  86. 0
      Adventures in Lestoria/Key.h
  87. 0
      Adventures in Lestoria/LICENSE
  88. 0
      Adventures in Lestoria/LICENSE_FT.txt
  89. 0
      Adventures in Lestoria/LICENSE_OLC-3.txt
  90. 2
      Adventures in Lestoria/LevelCompleteWindow.cpp
  91. 2
      Adventures in Lestoria/LightningBolt.cpp
  92. 2
      Adventures in Lestoria/LightningBoltEmitter.cpp
  93. 2
      Adventures in Lestoria/LoadFileButton.h
  94. 0
      Adventures in Lestoria/LoadGameWindow.cpp
  95. 2
      Adventures in Lestoria/MainMenuWindow.cpp
  96. 2
      Adventures in Lestoria/Map.cpp
  97. 0
      Adventures in Lestoria/Map.h
  98. 24
      Adventures in Lestoria/Menu.cpp
  99. 30
      Adventures in Lestoria/Menu.h
  100. 2
      Adventures in Lestoria/MenuAnimatedIconButton.h
  101. Some files were not shown because too many files have changed in this diff Show More

1
.gitignore vendored

@ -382,3 +382,4 @@ Crawler/pixelGameEngine_wasm.o
/cmake_install.cmake
/Makefile
Crawler/out
/Adventures in Lestoria/.vscode

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Crawler", "Crawler\Crawler.vcxproj", "{8E3067AF-CFE7-4B11-BC6B-B867C32753D7}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Adventures in Lestoria", "Adventures in Lestoria\Adventures in Lestoria.vcxproj", "{8E3067AF-CFE7-4B11-BC6B-B867C32753D7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -36,7 +36,7 @@ All rights reserved.
*/
#pragma endregion
#include "Ability.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
INCLUDE_game

@ -1,44 +1,52 @@
// Microsoft Visual C++ generated resource script.
//
// ... other stuff
#include "resource.h"
#include "Version.h"
#include <windows.h>
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILE_VERSION
PRODUCTVERSION VER_PRODUCT_VERSION
FILEFLAGSMASK 0x17L
FILEVERSION 0,2,1,5299
PRODUCTVERSION 0,2,1,5299
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "CompanyName", "Sig"
VALUE "FileDescription", "Crawler Game"
VALUE "FileVersion", VER_FILE_VERSION_STR "\0"
VALUE "InternalName", "Crawler.exe"
VALUE "LegalCopyright", "Copyright 2023"
VALUE "OriginalFilename", "Crawler.exe"
VALUE "ProductName", "Crawler"
VALUE "ProductVersion", VER_PRODUCT_VERSION_STR "\0"
END
END
BLOCK "VarFileInfo"
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
VALUE "Translation", 0x407, 1200
END
BLOCK "StringFileInfo"
BEGIN
BLOCK "040704b0"
BEGIN
VALUE "CompanyName", "Sig"
VALUE "FileDescription", "Crawler Game"
VALUE "FileVersion", "0.2.1.5299"
VALUE "InternalName", "Crawler.exe"
VALUE "LegalCopyright", "Copyright 2023"
VALUE "OriginalFilename", "Crawler.exe"
VALUE "ProductName", "Crawler"
VALUE "ProductVersion", "0.2.1.5299"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x407, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
@ -49,8 +57,6 @@ END
MAINICON ICON "assets\\heart.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
@ -75,6 +81,15 @@ END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// PNG
//
IDB_PNG1 PNG "assets\\AiL_512.png"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////

@ -38,8 +38,9 @@
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{8e3067af-cfe7-4b11-bc6b-b867c32753d7}</ProjectGuid>
<RootNamespace>Crawler</RootNamespace>
<RootNamespace>Adventures in Lestoria</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>Adventures in Lestoria</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@ -131,13 +132,13 @@
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Users\sigon\source\repos\Crawler\Crawler;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>discord_game_sdk.dll.lib;freetype.lib;$(CoreLibraryDependencies);%(AdditionalDependencies);</AdditionalDependencies>
</Link>
<PreBuildEvent>
@ -154,7 +155,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;C:\Users\sigon\Documents\include;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -177,7 +178,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;C:\Users\sigon\Documents\include;C:\Users\sigon\source\repos\Crawler\Crawler\discord-files</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -197,13 +198,13 @@
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>C:\Users\sigon\source\repos\Crawler\Crawler;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>discord_game_sdk.dll.lib;freetype.lib;$(CoreLibraryDependencies);%(AdditionalDependencies);</AdditionalDependencies>
</Link>
<PreBuildEvent>
@ -224,7 +225,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;C:\Users\sigon\Documents\include;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -250,7 +251,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalOptions>/MP8 %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;C:\Users\sigon\Documents\include;C:\Users\sigon\source\repos\Crawler\Crawler\discord-files</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\Documents\include;C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
@ -274,7 +275,7 @@
</Link>
<ClCompile>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;</AdditionalIncludeDirectories>
</ClCompile>
<PostBuildEvent>
<Command>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File ../emscripten_build.ps1</Command>
@ -290,7 +291,7 @@
</Link>
<ClCompile>
<LanguageStandard>stdcpp20</LanguageStandard>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\Crawler\Crawler\discord-files;</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;</AdditionalIncludeDirectories>
</ClCompile>
<PostBuildEvent>
<Command>powershell.exe -ExecutionPolicy Bypass -NoProfile -NonInteractive -File ../emscripten_build.ps1</Command>
@ -322,7 +323,7 @@
<ClInclude Include="config.h" />
<ClInclude Include="ConnectionPoint.h" />
<ClInclude Include="CraftingRequirement.h" />
<ClInclude Include="Crawler.h" />
<ClInclude Include="AdventuresInLestoria.h" />
<ClInclude Include="DamageNumber.h" />
<ClInclude Include="DEFINES.h" />
<ClInclude Include="discord-files\achievement_manager.h" />
@ -514,7 +515,7 @@
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="Crawler.cpp" />
<ClCompile Include="AdventuresInLestoria.cpp" />
<ClCompile Include="DamageNumber.cpp" />
<ClCompile Include="discord-files\achievement_manager.cpp" />
<ClCompile Include="discord-files\activity_manager.cpp" />
@ -657,8 +658,8 @@
<Text Include="assets\config\shops\Chapter 5 Merchants.txt" />
<Text Include="assets\config\shops\Chapter 6 Merchants.txt" />
<Text Include="assets\config\story\Chapter 1.txt" />
<Text Include="Crawler_Story_Chapter_1 (2).txt" />
<Text Include="Crawler_System_Overview.txt" />
<Text Include="Adventures in Lestoria_Story_Chapter_1 (2).txt" />
<Text Include="Adventures in Lestoria_System_Overview.txt" />
<Text Include="Merchant%27s Items.txt" />
<Text Include="NewClasses.txt" />
<Text Include="InitialConcept.txt" />
@ -671,7 +672,7 @@
<Image Include="assets\menus\Character_Info.png" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Crawler.rc" />
<ResourceCompile Include="Adventures in Lestoria.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

@ -108,7 +108,7 @@
<ClInclude Include="Animation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Crawler.h">
<ClInclude Include="AdventuresInLestoria.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Player.h">
@ -416,7 +416,7 @@
<ClCompile Include="Monster.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Crawler.cpp">
<ClCompile Include="AdventuresInLestoria.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DamageNumber.cpp">
@ -746,15 +746,9 @@
<Text Include="assets\config\items\items.txt">
<Filter>Configurations\Items</Filter>
</Text>
<Text Include="Crawler_System_Overview.txt">
<Filter>Documentation</Filter>
</Text>
<Text Include="assets\config\story\Chapter 1.txt">
<Filter>Configurations\Story</Filter>
</Text>
<Text Include="Crawler_Story_Chapter_1 (2).txt">
<Filter>Documentation\Story</Filter>
</Text>
<Text Include="assets\config\items\Equipment.txt">
<Filter>Configurations\Items</Filter>
</Text>
@ -797,6 +791,8 @@
<Text Include="assets\config\items\Accessories.txt">
<Filter>Configurations\Items</Filter>
</Text>
<Text Include="Adventures in Lestoria_Story_Chapter_1 (2).txt" />
<Text Include="Adventures in Lestoria_System_Overview.txt" />
</ItemGroup>
<ItemGroup>
<Image Include="assets\heart.ico">
@ -807,7 +803,7 @@
</Image>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Crawler.rc">
<ResourceCompile Include="Adventures in Lestoria.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>

@ -36,7 +36,7 @@ All rights reserved.
*/
#pragma endregion
#include "olcPGEX_TransformedView.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "olcUTIL_Camera2D.h"
#include "DamageNumber.h"
#include "Bullet.h"
@ -86,21 +86,21 @@ std::vector<std::unique_ptr<Bullet>>BULLET_LIST;
safemap<std::string,Renderable>GFX;
safemap<std::string,MapName>LEVEL_NAMES;
utils::datafile DATA;
Crawler*game;
InputGroup Crawler::KEY_LEFT;
InputGroup Crawler::KEY_RIGHT;
InputGroup Crawler::KEY_UP;
InputGroup Crawler::KEY_DOWN;
InputGroup Crawler::KEY_ATTACK;
InputGroup Crawler::KEY_CONFIRM;
InputGroup Crawler::KEY_MENU;
AiL*game;
InputGroup AiL::KEY_LEFT;
InputGroup AiL::KEY_RIGHT;
InputGroup AiL::KEY_UP;
InputGroup AiL::KEY_DOWN;
InputGroup AiL::KEY_ATTACK;
InputGroup AiL::KEY_CONFIRM;
InputGroup AiL::KEY_MENU;
#ifndef __EMSCRIPTEN__
::discord::Core*Discord{};
#endif
float Crawler::SIZE_CHANGE_SPEED=1;
float AiL::SIZE_CHANGE_SPEED=1;
Crawler::Crawler()
AiL::AiL()
{
utils::datafile::Read(DATA,"assets/config/configuration.txt");
@ -155,7 +155,7 @@ Crawler::Crawler()
gameStarted=time(NULL);
}
bool Crawler::OnUserCreate(){
bool AiL::OnUserCreate(){
Font::init();
InitializeDefaultKeybinds();
@ -242,7 +242,7 @@ bool Crawler::OnUserCreate(){
return true;
}
bool Crawler::OnUserUpdate(float fElapsedTime){
bool AiL::OnUserUpdate(float fElapsedTime){
levelTime+=fElapsedTime;
if(!GamePaused()){
GameState::STATE->OnUserUpdate(this);
@ -265,32 +265,32 @@ bool Crawler::OnUserUpdate(float fElapsedTime){
return !gameEnd;
}
bool Crawler::LeftHeld(){
bool AiL::LeftHeld(){
return KEY_LEFT.Held();
}
bool Crawler::RightHeld(){
bool AiL::RightHeld(){
return KEY_RIGHT.Held();
}
bool Crawler::UpHeld(){
bool AiL::UpHeld(){
return KEY_UP.Held();
}
bool Crawler::DownHeld(){
bool AiL::DownHeld(){
return KEY_DOWN.Held();
}
bool Crawler::LeftReleased(){
bool AiL::LeftReleased(){
return KEY_LEFT.Released();
}
bool Crawler::RightReleased(){
bool AiL::RightReleased(){
return KEY_RIGHT.Released();
}
bool Crawler::UpReleased(){
bool AiL::UpReleased(){
return KEY_UP.Released();
}
bool Crawler::DownReleased(){
bool AiL::DownReleased(){
return KEY_DOWN.Released();
}
void Crawler::HandleUserInput(float fElapsedTime){
void AiL::HandleUserInput(float fElapsedTime){
if(!Menu::stack.empty())return; //A window being opened means there's no user input allowed.
bool setIdleAnimation=true;
@ -492,7 +492,7 @@ void Crawler::HandleUserInput(float fElapsedTime){
}
}
void Crawler::UpdateCamera(float fElapsedTime){
void AiL::UpdateCamera(float fElapsedTime){
lastWorldShakeAdjust=std::max(0.f,lastWorldShakeAdjust-fElapsedTime);
if(worldShakeTime>0){
worldShakeTime-=fElapsedTime;
@ -510,7 +510,7 @@ void Crawler::UpdateCamera(float fElapsedTime){
view.SetWorldOffset(camera.GetViewPosition());
}
void Crawler::UpdateEffects(float fElapsedTime){
void AiL::UpdateEffects(float fElapsedTime){
for(auto it=EMITTER_LIST.begin();it!=EMITTER_LIST.end();++it){
auto ptr=(*it).get();
ptr->Update(fElapsedTime);
@ -538,7 +538,7 @@ void Crawler::UpdateEffects(float fElapsedTime){
foregroundEffectsToBeInserted.clear();
backgroundEffectsToBeInserted.clear();
}
void Crawler::UpdateBullets(float fElapsedTime){
void AiL::UpdateBullets(float fElapsedTime){
for(auto it=BULLET_LIST.begin();it!=BULLET_LIST.end();++it){
Bullet*b=(*it).get();
b->UpdateFadeTime(fElapsedTime);
@ -605,7 +605,7 @@ void Crawler::UpdateBullets(float fElapsedTime){
}
std::erase_if(BULLET_LIST,[](std::unique_ptr<Bullet>&b){return b->dead;});
}
void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z){
void AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z){
for(Monster&m:MONSTER_LIST){
if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){
m.Hurt(damage,upperLevel,z);
@ -613,7 +613,7 @@ void Crawler::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float
}
}
void Crawler::PopulateRenderLists(){
void AiL::PopulateRenderLists(){
monstersBeforeLower.clear();
monstersAfterLower.clear();
monstersBeforeUpper.clear();
@ -706,7 +706,7 @@ void Crawler::PopulateRenderLists(){
std::sort(monstersAfterLower.begin(),monstersAfterLower.end(),[](Monster*m1,Monster*m2){return m1->GetPos().y<m2->GetPos().y;});
}
void Crawler::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d tileSheetPos){
void AiL::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d tileSheetPos){
if(tileSheet.tileset->animationData.count(tileSheetIndex)){
int animationDuration_ms=int(tileSheet.tileset->animationData[tileSheetIndex].size()*"animation_tile_precision"_I);
int animatedIndex=tileSheet.tileset->animationData[tileSheetIndex][size_t(fmod(levelTime*1000.f,animationDuration_ms)/"animation_tile_precision"_I)];
@ -719,7 +719,7 @@ void Crawler::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2
}
}
void Crawler::RenderTile(TileRenderData&tileSheet,Pixel col){
void AiL::RenderTile(TileRenderData&tileSheet,Pixel col){
if(tileSheet.tileSheet.tileset->animationData.count(tileSheet.tileID%1000000)){
int animationDuration_ms=int(tileSheet.tileSheet.tileset->animationData[tileSheet.tileID%1000000].size()*"animation_tile_precision"_I);
int animatedIndex=tileSheet.tileSheet.tileset->animationData[tileSheet.tileID%1000000][size_t(fmod(levelTime*1000.f,animationDuration_ms)/"animation_tile_precision"_I)];
@ -732,7 +732,7 @@ void Crawler::RenderTile(TileRenderData&tileSheet,Pixel col){
}
}
void Crawler::RenderWorld(float fElapsedTime){
void AiL::RenderWorld(float fElapsedTime){
LayerTag*bridgeLayer=nullptr;
bool bridgeLayerFade=false;
@ -1235,11 +1235,11 @@ void Crawler::RenderWorld(float fElapsedTime){
}
}
Player*Crawler::GetPlayer(){
Player*AiL::GetPlayer(){
return player.get();
}
void Crawler::RenderHud(){
void AiL::RenderHud(){
ItemOverlay::Draw();
RenderCooldowns();
@ -1291,7 +1291,7 @@ void Crawler::RenderHud(){
DrawShadowStringDecal({0,12},"Button Hold Time: "+std::to_string(Menu::menus[INVENTORY_CONSUMABLES]->buttonHoldTime));
}}
void Crawler::RenderCooldowns(){
void AiL::RenderCooldowns(){
std::vector<Ability>cooldowns{
player->GetAbility1(),
player->GetAbility2(),
@ -1396,12 +1396,12 @@ void Crawler::RenderCooldowns(){
}
}
void Crawler::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){
void AiL::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){
AddEffect(std::move(background),true);
AddEffect(std::move(foreground));
}
void Crawler::AddEffect(std::unique_ptr<Effect> foreground,bool back){
void AiL::AddEffect(std::unique_ptr<Effect> foreground,bool back){
if(back){
backgroundEffectsToBeInserted.push_back(std::move(foreground));
} else {
@ -1409,11 +1409,11 @@ void Crawler::AddEffect(std::unique_ptr<Effect> foreground,bool back){
}
}
vf2d Crawler::GetWorldMousePos(){
vf2d AiL::GetWorldMousePos(){
return GetMousePos()+view.GetWorldOffset();
}
void Crawler::SetupWorldShake(float duration){
void AiL::SetupWorldShake(float duration){
worldShakeVel={13,-13};
worldShakeTime=duration;
worldShake=vf2d{player->GetPos()};
@ -1421,7 +1421,7 @@ void Crawler::SetupWorldShake(float duration){
}
void Crawler::InitializeLevel(std::string mapFile,MapName map){
void AiL::InitializeLevel(std::string mapFile,MapName map){
TMXParser level(mapFile);
size_t slashMarker = mapFile.find_last_of('/');
@ -1535,7 +1535,7 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){
}
}
void Crawler::LoadLevel(MapName map){
void AiL::LoadLevel(MapName map){
SPAWNER_LIST.clear();
foregroundTileGroups.clear();
upperForegroundTileGroups.clear();
@ -1772,15 +1772,15 @@ void Crawler::LoadLevel(MapName map){
pathfinder.Initialize();
}
bool Crawler::IsUpperForegroundTile(int tileID){
bool AiL::IsUpperForegroundTile(int tileID){
return tileID>=1000000;
}
bool Crawler::IsForegroundTile(TilesheetData sheet,int tileID){
bool AiL::IsForegroundTile(TilesheetData sheet,int tileID){
return sheet.tileset->foregroundTiles.find(tileID)!=sheet.tileset->foregroundTiles.end();
}
TilesheetData Crawler::GetTileSheet(MapName map,int tileID){
TilesheetData AiL::GetTileSheet(MapName map,int tileID){
std::vector<XMLTag>&tileData=MAP_DATA[map].TilesetData;
if(tileData.size()==1){
size_t slashMarkerSourceDir = tileData[0].data["source"].find_last_of('/');
@ -1800,18 +1800,18 @@ TilesheetData Crawler::GetTileSheet(MapName map,int tileID){
}
}
bool Crawler::HasTileCollision(MapName map,vf2d pos,bool upperLevel){
bool AiL::HasTileCollision(MapName map,vf2d pos,bool upperLevel){
geom2d::rect<int>collisionRect=GetTileCollision(map,pos,upperLevel);
vi2d collisionRectSnapPos=vi2d{pos/float(game->GetCurrentMap().tilewidth)}*game->GetCurrentMap().tilewidth;
collisionRect.pos+=collisionRectSnapPos;
return geom2d::overlaps(collisionRect,pos);
}
bool Crawler::IsBridgeLayer(LayerTag&layer){
bool AiL::IsBridgeLayer(LayerTag&layer){
return layer.tag.data.find("class")!=layer.tag.data.end()&&layer.tag.data["class"]=="Bridge";
}
geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel){
geom2d::rect<int>AiL::GetTileCollision(MapName map,vf2d pos,bool upperLevel){
if(pos.x<0||pos.y<0||pos.x>=GetCurrentMap().width*game->GetCurrentMap().tilewidth||pos.y>=GetCurrentMap().height*game->GetCurrentMap().tilewidth)return NO_COLLISION;
#pragma region Lower Bridge Collision Check
if(!upperLevel){ //We are looking for lower bridge collisions.
@ -1855,15 +1855,15 @@ geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel)
return foundRect;
}
MapName Crawler::GetCurrentLevel(){
MapName AiL::GetCurrentLevel(){
return currentLevel;
}
std::map<std::string,std::vector<ZoneData>>&Crawler::GetZoneData(MapName map){
std::map<std::string,std::vector<ZoneData>>&AiL::GetZoneData(MapName map){
return MAP_DATA[map].ZoneData;
}
void Crawler::ChangePlayerClass(Class cl){
void AiL::ChangePlayerClass(Class cl){
Ability itemAbility1=player->useItem1;
Ability itemAbility2=player->useItem2;
Ability itemAbility3=player->useItem3;
@ -1916,7 +1916,7 @@ void Crawler::ChangePlayerClass(Class cl){
Player::moneyListeners=moneyListeners;
}
void Crawler::InitializeClasses(){
void AiL::InitializeClasses(){
Warrior::Initialize();
Thief::Initialize();
Ranger::Initialize();
@ -1931,42 +1931,42 @@ void Crawler::InitializeClasses(){
Witch::InitializeClassAbilities();
}
std::string Crawler::GetString(std::string key){
std::string AiL::GetString(std::string key){
return DATA.GetProperty(key).GetString();
}
datafilestringdata Crawler::GetStringList(std::string key){
datafilestringdata AiL::GetStringList(std::string key){
return {DATA,key};
}
int Crawler::GetInt(std::string key){
int AiL::GetInt(std::string key){
return DATA.GetProperty(key).GetInt();
}
datafileintdata Crawler::GetIntList(std::string key){
datafileintdata AiL::GetIntList(std::string key){
return {DATA,key};
}
float Crawler::GetFloat(std::string key){
float AiL::GetFloat(std::string key){
return float(DATA.GetProperty(key).GetReal());
}
datafilefloatdata Crawler::GetFloatList(std::string key){
datafilefloatdata AiL::GetFloatList(std::string key){
return {DATA,key};
}
double Crawler::GetDouble(std::string key){
double AiL::GetDouble(std::string key){
return DATA.GetProperty(key).GetReal();
}
datafiledoubledata Crawler::GetDoubleList(std::string key){
datafiledoubledata AiL::GetDoubleList(std::string key){
return {DATA,key};
}
int main()
{
{
Crawler demo;
AiL demo;
if (demo.Construct(WINDOW_SIZE.x, WINDOW_SIZE.y, 4, 4))
demo.Start();
}
@ -1986,7 +1986,7 @@ int main()
while(file.good()){
std::string line;
std::getline(file,line);
if(line.find("Crawler\\")!=std::string::npos){
if(line.find("AiL\\")!=std::string::npos){
if(!leaked){
leaked=true;
std::cout<<std::endl<<std::endl<<std::endl<<"Memory leak detected!"<<std::endl;
@ -2003,47 +2003,47 @@ int main()
}
datafilestringdata operator ""_s(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return {DATA,std::string(key,len)};
}
datafileintdata operator ""_i(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return {DATA,std::string(key,len)};
}
datafilefloatdata operator ""_f(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return {DATA,std::string(key,len)};
}
datafiledoubledata operator ""_d(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return {DATA,std::string(key,len)};
}
Pixel operator ""_Pixel(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return {uint8_t(DATA.GetProperty(std::string(key,len)).GetInt(0)),uint8_t(DATA.GetProperty(std::string(key,len)).GetInt(1)),uint8_t(DATA.GetProperty(std::string(key,len)).GetInt(2)),uint8_t(DATA.GetProperty(std::string(key,len)).GetInt(3))};
}
std::string operator ""_S(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return DATA.GetProperty(std::string(key,len)).GetString();
}
int operator ""_I(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return DATA.GetProperty(std::string(key,len)).GetInt();
}
float operator ""_F(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return float(DATA.GetProperty(std::string(key,len)).GetReal());
}
float operator ""_FRange(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return float(util::random(float(DATA.GetProperty(std::string(key,len)).GetReal(1)-DATA.GetProperty(std::string(key,len)).GetReal(0)))+DATA.GetProperty(std::string(key,len)).GetReal(0));
}
float operator ""_Pct(long double pct){
@ -2051,16 +2051,16 @@ float operator ""_Pct(long double pct){
}
double operator ""_D(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return DATA.GetProperty(std::string(key,len)).GetReal();
}
datafile operator ""_A(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return DATA.GetProperty(std::string(key,len));
}
void Crawler::OutputDebugInfo(const char*key,std::size_t len){
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_")){
@ -2069,11 +2069,11 @@ void Crawler::OutputDebugInfo(const char*key,std::size_t len){
}
}
bool Crawler::IsReflectiveTile(TilesheetData tileSheet,int tileID){
bool AiL::IsReflectiveTile(TilesheetData tileSheet,int tileID){
return tileSheet.tileset->reflectiveData.find(tileID)!=tileSheet.tileset->reflectiveData.end();
}
bool Crawler::OnUserDestroy(){
bool AiL::OnUserDestroy(){
if(GameState::STATE!=GameState::states[States::MAIN_MENU]){ //If we're on the main menu, we don't have a save file loaded. So we would skip saving the game.
SaveFile::SaveGame();
}
@ -2097,7 +2097,7 @@ bool Crawler::OnUserDestroy(){
return true;
}
void Crawler::InitializeLevels(){
void AiL::InitializeLevels(){
#define INITLEVEL(map) \
LEVEL_NAMES[#map]=map; \
InitializeLevel("map_path"_S + "Levels."#map ## _S,map);
@ -2115,22 +2115,22 @@ void Crawler::InitializeLevels(){
LEVEL_NAMES.SetInitialized();
}
void Crawler::SpawnMonster(vf2d pos,MonsterData&data,bool upperLevel,bool isBossSpawn){
void AiL::SpawnMonster(vf2d pos,MonsterData&data,bool upperLevel,bool isBossSpawn){
monstersToBeSpawned.push_back(Monster(pos,data,upperLevel,isBossSpawn));
if(isBossSpawn){
totalBossEncounterMobs++;
}
}
void Crawler::DrawPie(vf2d center,float radius,float degreesCut,Pixel col){
void AiL::DrawPie(vf2d center,float radius,float degreesCut,Pixel col){
DrawPolygonDecal(nullptr,circleCooldownPoints,circleCooldownPoints,std::max(1,int(degreesCut/4)),center,radius,col);
}
void Crawler::DrawSquarePie(vf2d center,float radius,float degreesCut,Pixel col){
void AiL::DrawSquarePie(vf2d center,float radius,float degreesCut,Pixel col){
DrawPolygonDecal(nullptr,squareCircleCooldownPoints,squareCircleCooldownPoints,std::max(1,int(degreesCut/4)),center,radius,col);
}
void Crawler::InitializeDefaultKeybinds(){
void AiL::InitializeDefaultKeybinds(){
Player::KEY_ABILITY1.AddKeybind({KEY,Q});
Player::KEY_ABILITY2.AddKeybind({KEY,E});
Player::KEY_ABILITY3.AddKeybind({KEY,R});
@ -2153,16 +2153,16 @@ void Crawler::InitializeDefaultKeybinds(){
KEY_MENU.AddKeybind({KEY,ESCAPE});
}
void Crawler::SetBossNameDisplay(std::string name,float time){
void AiL::SetBossNameDisplay(std::string name,float time){
bossName=name;
bossDisplayTimer=time;
}
bool Crawler::InBossEncounter(){
bool AiL::InBossEncounter(){
return bossName!="";
}
void Crawler::StartBossEncounter(){
void AiL::StartBossEncounter(){
if(!encounterStarted){
encounterStarted=true;
totalDamageDealt=0;
@ -2170,7 +2170,7 @@ void Crawler::StartBossEncounter(){
}
}
void Crawler::DisplayBossEncounterInfo(){
void AiL::DisplayBossEncounterInfo(){
if(bossDisplayTimer>0){
std::string displayText="- "+bossName+" -";
@ -2202,18 +2202,18 @@ void Crawler::DisplayBossEncounterInfo(){
}
void Crawler::BossDamageDealt(int damage){
void AiL::BossDamageDealt(int damage){
totalDamageDealt+=damage;
}
void Crawler::ReduceBossEncounterMobCount(){
void AiL::ReduceBossEncounterMobCount(){
totalBossEncounterMobs--;
if(totalBossEncounterMobs<0){
ERR("WARNING! Boss Encounter mob count is less than zero, THIS SHOULD NOT BE HAPPENING!");
}
}
void Crawler::RenderMenu(){
void AiL::RenderMenu(){
if(!GamePaused()&&Menu::stack.size()>0){
Menu::stack.back()->Update(this);
}
@ -2225,7 +2225,7 @@ void Crawler::RenderMenu(){
}
}
void Crawler::InitializeGraphics(){
void AiL::InitializeGraphics(){
circleCooldownPoints.push_back({0,0});
squareCircleCooldownPoints.push_back({0,0});
for(int i=0;i<=360;i+=4){
@ -2313,11 +2313,11 @@ void Crawler::InitializeGraphics(){
std::cout<<GFX.size()<<" images have been loaded."<<std::endl;
}
MapTag Crawler::GetCurrentMap(){
MapTag AiL::GetCurrentMap(){
return MAP_DATA[GetCurrentLevel()].MapData;
}
void Crawler::ValidateGameStatus(){
void AiL::ValidateGameStatus(){
if(IToggleable::uninitializedToggleGroupItems.size()>0){
for(IToggleable*item:IToggleable::uninitializedToggleGroupItems){
std::cout<<"\tUninitialized Toggle Item Ptr: 0x"<<std::hex<<item<<std::endl;
@ -2335,28 +2335,28 @@ void Crawler::ValidateGameStatus(){
}
}
void Crawler::RenderVersionInfo(){
void AiL::RenderVersionInfo(){
std::string versionStr("v" + std::to_string(VERSION_MAJOR) + "." + std::to_string(VERSION_MINOR) + "." + std::to_string(VERSION_PATCH) + "." + std::to_string(VERSION_BUILD));
DrawShadowStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4f,versionStr,WHITE,BLACK,{0.4f,0.4f},std::numeric_limits<float>::max(),0.4f);
}
int Crawler::GetCurrentChapter(){
int AiL::GetCurrentChapter(){
return chapter;
}
void Crawler::SetChapter(int chapter){
void AiL::SetChapter(int chapter){
this->chapter=chapter;
for(MenuComponent*component:Menu::chapterListeners){
component->OnChapterUpdate(chapter);
}
}
const std::weak_ptr<Item>Crawler::GetLoadoutItem(int slot){
const std::weak_ptr<Item>AiL::GetLoadoutItem(int slot){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
return loadout[slot];
}
void Crawler::SetLoadoutItem(int slot,std::string itemName){
void AiL::SetLoadoutItem(int slot,std::string itemName){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
if(Inventory::GetItemCount(itemName)>0){
loadout[slot]=Inventory::CopyItem(itemName)[0];
@ -2405,7 +2405,7 @@ void Crawler::SetLoadoutItem(int slot,std::string itemName){
}
}
bool Crawler::UseLoadoutItem(int slot){
bool AiL::UseLoadoutItem(int slot){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
if(GetLoadoutItem(slot).lock()->Amt()>0){
Inventory::UseItem(GetLoadoutItem(slot).lock()->ActualName());
@ -2415,7 +2415,7 @@ bool Crawler::UseLoadoutItem(int slot){
return false;
}
void Crawler::ClearLoadoutItem(int slot){
void AiL::ClearLoadoutItem(int slot){
if(slot<0||slot>loadout.size()-1)ERR("Invalid inventory slot "+std::to_string(slot)+", please choose a slot in range (0-"+std::to_string(loadout.size()-1)+").");
loadout[slot].reset();
InputGroup*inputGroup=nullptr;
@ -2458,7 +2458,7 @@ void Crawler::ClearLoadoutItem(int slot){
}
}
void Crawler::RenderFadeout(){
void AiL::RenderFadeout(){
uint8_t alpha=0;
if(fadeOutDuration>0){
fadeOutDuration=std::max(0.f,fadeOutDuration-GetElapsedTime());
@ -2474,16 +2474,16 @@ void Crawler::RenderFadeout(){
FillRectDecal({0,0},GetScreenSize(),{0,0,0,alpha});
}
bool Crawler::GamePaused(){
bool AiL::GamePaused(){
return fadeOutDuration>0;
}
void Crawler::EndGame(){
void AiL::EndGame(){
gameEnd=true;
}
#ifndef __EMSCRIPTEN__
::discord::Result Crawler::SetupDiscord(){
::discord::Result AiL::SetupDiscord(){
auto result=::discord::Core::Create(1186719371750555780,DiscordCreateFlags_NoRequireDiscord,&Discord);
if(result==::discord::Result::Ok){
Discord->SetLogHook(
@ -2499,7 +2499,7 @@ void Crawler::EndGame(){
}
#endif
void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
void AiL::UpdateDiscordStatus(std::string levelName,std::string className){
#ifndef __EMSCRIPTEN__
if(Discord){
::discord::Activity newActivity{};
@ -2509,7 +2509,7 @@ void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
timestamps.SetStart(gameStarted);
newActivity.SetType(discord::ActivityType::Playing);
discord::ActivityAssets&assets=newActivity.GetAssets();
assets.SetLargeImage("heart_512");
assets.SetLargeImage("ail_512");
assets.SetLargeText(game->sAppName.c_str());
assets.SetSmallText(std::format("Level {} {}",player->Level(),className).c_str());
@ -2532,7 +2532,7 @@ void Crawler::UpdateDiscordStatus(std::string levelName,std::string className){
#endif
}
void Crawler::InitializePlayerLevelCap(){
void AiL::InitializePlayerLevelCap(){
while(DATA["PlayerXP"].HasProperty(std::format("LEVEL[{}]",player->levelCap+1))){
player->levelCap++;
}
@ -2540,7 +2540,7 @@ void Crawler::InitializePlayerLevelCap(){
std::cout<<"Level cap detected as "<<int(player->levelCap)<<std::endl;
}
void Crawler::ResetGame(){
void AiL::ResetGame(){
GameState::ChangeState(States::MAIN_MENU,0.5f);
for(int i=int(EquipSlot::HELMET);i<=int(EquipSlot::RING2);i<<=1){
Inventory::UnequipItem(EquipSlot(i));
@ -2564,11 +2564,11 @@ void Crawler::ResetGame(){
SaveFile::SetSaveFileName("");
}
void Crawler::OnRequestCompleted(const std::string_view receivedData)const{
void AiL::OnRequestCompleted(const std::string_view receivedData)const{
responseCallback(receivedData);
}
std::string operator ""_FS(const char*key,std::size_t len){
Crawler::OutputDebugInfo(key,len);
AiL::OutputDebugInfo(key,len);
return DATA.GetProperty(std::string(key,len)).GetFullString();
}

@ -54,7 +54,7 @@ All rights reserved.
#include "discord.h"
#endif
class Crawler : public olc::PixelGameEngine
class AiL : public olc::PixelGameEngine
{
friend class GameState;
friend class State_GameRun;
@ -122,7 +122,7 @@ private:
::discord::Result SetupDiscord();
#endif
public:
Crawler();
AiL();
bool OnUserCreate() override;
bool OnUserUpdate(float fElapsedTime) override;
bool OnUserDestroy() override;

@ -36,7 +36,7 @@ All rights reserved.
*/
#pragma endregion
#include "Animation.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "safemap.h"

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "BulletTypes.h"
#include "Effect.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"
#include "olcUTIL_Geometry2D.h"

@ -49,7 +49,7 @@ class Player;
class Monster;
class ItemAttribute{
friend class Crawler;
friend class AiL;
std::string name;
std::string originalName;
bool isPct;

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "Menu.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "MenuItemItemButton.h"
#include "PlayerMoneyLabel.h"
#include "RowInventoryScrollableWindowComponent.h"

@ -48,7 +48,7 @@ enum BuffType{
RESTORATION_DURING_CAST,
};
class Crawler;
class AiL;
struct Buff{
BuffType type;
@ -57,7 +57,7 @@ struct Buff{
float intensity=1;
float nextTick=0;
std::set<ItemAttribute> attr;
std::function<void(Crawler*,int)>repeatAction;
std::function<void(AiL*,int)>repeatAction;
inline Buff(BuffType type,float duration,float intensity)
:type(type),duration(duration),intensity(intensity){}
inline Buff(BuffType type,float duration,float intensity,std::set<ItemAttribute> attr)
@ -68,6 +68,6 @@ struct Buff{
this->attr.insert(ItemAttribute::attributes.at(s));
}
}
inline Buff(BuffType type,float duration,float intensity,float timeBetweenTicks,std::function<void(Crawler*,int)>repeatAction)
inline Buff(BuffType type,float duration,float intensity,float timeBetweenTicks,std::function<void(AiL*,int)>repeatAction)
:type(type),duration(duration),intensity(intensity),nextTick(duration-timeBetweenTicks),timeBetweenTicks(timeBetweenTicks),repeatAction(repeatAction){}
};

@ -36,7 +36,7 @@ All rights reserved.
*/
#pragma endregion
#include "Bullet.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "safemap.h"

@ -43,7 +43,7 @@ All rights reserved.
#include "DEFINES.h"
struct Bullet{
friend class Crawler;
friend class AiL;
vf2d vel;
vf2d pos;
float radius;

@ -38,7 +38,7 @@ All rights reserved.
#pragma once
#include "MenuLabel.h"
#include "DEFINES.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "util.h"
#include "Ability.h"
@ -51,7 +51,7 @@ public:
inline CharacterAbilityPreviewComponent(geom2d::rect<float>rect,Ability*ability)
:MenuLabel(rect,"",1,ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND),ability(ability){}
protected:
virtual void inline Update(Crawler*game)override{
virtual void inline Update(AiL*game)override{
MenuLabel::Update(game);
}
virtual void inline DrawDecal(ViewPort&window,bool focused)override{

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "Menu.h"
#include "CharacterRotatingDisplay.h"

@ -40,7 +40,7 @@ All rights reserved.
#include "PopupMenuLabel.h"
#include "StatLabel.h"
#include "CharacterRotatingDisplay.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "ClassInfo.h"
#include "MenuItemItemButton.h"
#include "EquipSlotButton.h"

@ -38,7 +38,7 @@ All rights reserved.
#pragma once
#include "MenuComponent.h"
#include "DEFINES.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
INCLUDE_game
@ -55,7 +55,7 @@ public:
this->icon=icon;
}
protected:
virtual inline void Update(Crawler*game)override{
virtual inline void Update(AiL*game)override{
MenuComponent::Update(game);
timer+=game->GetElapsedTime();
if(timer>=2*PI){

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "BulletTypes.h"
#include "Effect.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"
#include "olcUTIL_Geometry2D.h"

@ -4,7 +4,7 @@
<Position X="3.5" Y="13.75" Width="1.5" />
<TypeIdentifier>
<HashCode>OihgwhJkUjgrCYAAVgEdFoQkBECSBhEDncMJIEmEYAg=</HashCode>
<FileName>Crawler.h</FileName>
<FileName>AdventuresInLestoria.h</FileName>
</TypeIdentifier>
</Class>
<Class Name="Effect" Collapsed="true">
@ -548,7 +548,7 @@
<Position X="19" Y="7.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAIAAAAAAAAAA=</HashCode>
<FileName>Crawler.h</FileName>
<FileName>AdventuresInLestoria.h</FileName>
</TypeIdentifier>
</Struct>
<Struct Name="Trapper" Collapsed="true">

Before

Width:  |  Height:  |  Size: 164 KiB

After

Width:  |  Height:  |  Size: 164 KiB

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "Menu.h"
#include "MenuLabel.h"

@ -53,5 +53,4 @@ struct ConnectionPoint{
neighbors.fill(-1);
}
bool IsNeighbor(ConnectionPoint&testPoint);
static void UpdateCurrentConnectionPoint(const ConnectionPoint&connection);
};

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "Menu.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "MenuItemItemButton.h"
#include "PlayerMoneyLabel.h"
#include "RowInventoryScrollableWindowComponent.h"

@ -40,7 +40,7 @@ All rights reserved.
#define INCLUDE_MONSTER_LIST extern std::vector<Monster>MONSTER_LIST;
#define INCLUDE_SPAWNER_LIST extern std::vector<MonsterSpawner>SPAWNER_LIST;
#define INCLUDE_DAMAGENUMBER_LIST extern std::vector<std::shared_ptr<DamageNumber>>DAMAGENUMBER_LIST;
#define INCLUDE_game extern Crawler*game;
#define INCLUDE_game extern AiL*game;
#define INCLUDE_MONSTER_DATA extern std::map<std::string,MonsterData>MONSTER_DATA;
#define INCLUDE_BULLET_LIST extern std::vector<std::unique_ptr<Bullet>>BULLET_LIST;
#define INCLUDE_EMITTER_LIST extern std::vector<std::unique_ptr<Emitter>>EMITTER_LIST;

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "DEFINES.h"
#include "Effect.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "safemap.h"
INCLUDE_ANIMATION_DATA

@ -41,7 +41,7 @@ All rights reserved.
#include "olcUTIL_Animate2D.h"
struct Effect{
friend class Crawler;
friend class AiL;
vf2d pos={0,0};
float lifetime=0;
float fadeout=0;

@ -39,7 +39,7 @@ All rights reserved.
#include "olcPixelGameEngine.h"
struct Emitter{
friend class Crawler;
friend class AiL;
float frequency;
float timer;
float lastEmit=0;

@ -39,7 +39,7 @@ All rights reserved.
#include "State_OverworldMap.h"
#include "Menu.h"
#include "SpawnEncounterLabel.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "ScrollableWindowComponent.h"
#include "DEFINES.h"
#include "Error.h"

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "BulletTypes.h"
#include "Effect.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"

@ -38,7 +38,7 @@ All rights reserved.
#pragma once
#include "MenuItemItemButton.h"
#include "DEFINES.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
INCLUDE_game
INCLUDE_ITEM_DATA

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "BulletTypes.h"
#include "Effect.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "GameState.h"
#include "State_GameRun.h"
#include "State_OverworldMap.h"

@ -40,7 +40,7 @@ All rights reserved.
#include <iostream>
#include "Error.h"
class Crawler;
class AiL;
namespace States{
enum State{
@ -53,7 +53,7 @@ namespace States{
};
class GameState{
friend class Crawler;
friend class AiL;
private:
static void _ChangeState(States::State newState);
public:
@ -62,7 +62,7 @@ public:
virtual ~GameState();
static void Initialize();
virtual void OnStateChange(GameState*prevState)=0;
virtual void OnUserUpdate(Crawler*game)=0;
virtual void Draw(Crawler*game)=0;
virtual void OnUserUpdate(AiL*game)=0;
virtual void Draw(AiL*game)=0;
static void ChangeState(States::State newState,float fadeOutDuration=0);
};

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "olcPixelGameEngine.h"
#include "safemap.h"
#include "Item.h"

@ -39,7 +39,7 @@ All rights reserved.
#include "Menu.h"
#include "MenuComponent.h"
#include "MenuItemButton.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "ScrollableWindowComponent.h"
#include "InventoryCreator.h"
@ -77,7 +77,7 @@ public:
inline InventoryScrollableWindowComponent(geom2d::rect<float>rect,std::string itemNameLabelName,std::string itemDescriptionLabelName,std::function<bool(MenuFuncData)>inventoryButtonClickAction,std::function<bool(MenuFuncData)>inventoryButtonHoverAction,std::function<bool(MenuFuncData)>inventoryButtonMouseOutAction,const InventoryCreator&creator,InventoryWindowOptions options={.padding=8,.size={24,24}},bool inventoryButtonsActive=true,ComponentAttr attributes=ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)
:ScrollableWindowComponent(rect,attributes),inventoryButtonHoverAction(inventoryButtonHoverAction),inventoryButtonMouseOutAction(inventoryButtonMouseOutAction),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName),
options(options),inventoryButtonClickAction(inventoryButtonClickAction),inventoryButtonsActive(inventoryButtonsActive),addButtonOnSlotUpdate(creator.AddButtonOnSlotUpdate),onInventorySlotsUpdate(creator.InventorySlotsUpdate){}
virtual inline void Update(Crawler*game)override{
virtual inline void Update(AiL*game)override{
ScrollableWindowComponent::Update(game);
bool noneHovered=true;
for(MenuComponent*component:components){

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "Menu.h"
#include "MenuLabel.h"

@ -38,7 +38,7 @@ All rights reserved.
#include "Item.h"
#include "safemap.h"
#include "DEFINES.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "Menu.h"
#include "Ability.h"
#include "AttributableStat.h"
@ -307,24 +307,24 @@ const uint32_t ItemProps::PropCount(const std::string&prop)const{
void ItemInfo::InitializeScripts(){
ITEM_SCRIPTS["Restore"]=[](Crawler*game,ItemProps props){
auto ParseItemScriptData=[&](const std::string&propName,std::function<void(Crawler*,int)>action){
ITEM_SCRIPTS["Restore"]=[](AiL*game,ItemProps props){
auto ParseItemScriptData=[&](const std::string&propName,std::function<void(AiL*,int)>action){
int restoreAmt=props.GetIntProp(propName);
action(game,restoreAmt);
if(restoreAmt>0&&props.PropCount(propName)==3){
game->GetPlayer()->AddBuff(RESTORATION,props.GetFloatProp(propName,2),restoreAmt,props.GetFloatProp(propName,1),action);
}
};
ParseItemScriptData("HP Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("HP Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->Heal(restoreAmt);
});
ParseItemScriptData("HP % Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("HP % Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->Heal(int(game->GetPlayer()->GetMaxHealth()*restoreAmt/100.0f));
});
ParseItemScriptData("MP Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("MP Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->RestoreMana(restoreAmt);
});
ParseItemScriptData("MP % Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("MP % Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->RestoreMana(int(game->GetPlayer()->GetMaxMana()*props.GetIntProp("MP % Restore")/100.f));
});
return true;
@ -336,7 +336,7 @@ void ItemInfo::InitializeScripts(){
}
}
ITEM_SCRIPTS["Buff"]=[](Crawler*game,ItemProps props){
ITEM_SCRIPTS["Buff"]=[](AiL*game,ItemProps props){
for(auto&[key,value]:ItemAttribute::attributes){
float intensity=props.GetFloatProp(key,0);
if(ItemAttribute::Get(key).DisplayAsPercent())intensity/=100;
@ -344,24 +344,24 @@ void ItemInfo::InitializeScripts(){
}
return true;
};
ITEM_SCRIPTS["RestoreDuringCast"]=[&](Crawler*game,ItemProps props){
auto ParseItemScriptData=[&](const std::string&propName,std::function<void(Crawler*,int)>action){
ITEM_SCRIPTS["RestoreDuringCast"]=[&](AiL*game,ItemProps props){
auto ParseItemScriptData=[&](const std::string&propName,std::function<void(AiL*,int)>action){
int restoreAmt=props.GetIntProp(propName);
action(game,restoreAmt);
if(restoreAmt>0&&props.PropCount(propName)==3){
game->GetPlayer()->AddBuff(RESTORATION_DURING_CAST,props.GetFloatProp(propName,2),restoreAmt,props.GetFloatProp(propName,1),action);
}
};
ParseItemScriptData("HP Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("HP Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->Heal(restoreAmt);
});
ParseItemScriptData("HP % Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("HP % Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->Heal(int(game->GetPlayer()->GetMaxHealth()*restoreAmt/100.0f));
});
ParseItemScriptData("MP Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("MP Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->RestoreMana(restoreAmt);
});
ParseItemScriptData("MP % Restore",[&](Crawler*game,int restoreAmt){
ParseItemScriptData("MP % Restore",[&](AiL*game,int restoreAmt){
game->GetPlayer()->RestoreMana(int(game->GetPlayer()->GetMaxMana()*props.GetIntProp("MP % Restore")/100.f));
});
return true;

@ -48,14 +48,14 @@ All rights reserved.
#include "CraftingRequirement.h"
#include "FunctionPriming.h"
class Crawler;
class AiL;
class ItemInfo;
class ItemProps;
using IT=std::string;
using ITCategory=std::string;
using ItemScript=std::function<bool(Crawler*,ItemProps)>;
using ItemScript=std::function<bool(AiL*,ItemProps)>;
enum class EquipSlot{
HELMET= 0b0000'0001,
@ -154,7 +154,7 @@ public:
class Item{
friend class Inventory;
friend class Crawler;
friend class AiL;
friend class Menu;
friend class SaveFile;
friend void Merchant::PurchaseItem(IT item,uint32_t amt);

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "ItemDrop.h"
#include "olcUTIL_Geometry2D.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
INCLUDE_game
INCLUDE_GFX

@ -38,10 +38,10 @@ All rights reserved.
#include "olcPixelGameEngine.h"
#include "Item.h"
#include "util.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
class ItemDrop{
friend class Crawler;
friend class AiL;
vf2d pos;
vf2d speed{};
float zSpeed=0;

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "Menu.h"
#include "MenuLabel.h"

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "Key.h"
#include "DEFINES.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
INCLUDE_game

@ -36,7 +36,7 @@ All rights reserved.
*/
#pragma endregion
#include "Menu.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "MenuLabel.h"
#include "MenuComponent.h"
#include "InventoryScrollableWindowComponent.h"

@ -37,7 +37,7 @@ All rights reserved.
#pragma endregion
#include "BulletTypes.h"
#include "Effect.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "Emitter.h"
#include "util.h"

@ -38,7 +38,7 @@ All rights reserved.
#include "Emitter.h"
#include "olcUTIL_Geometry2D.h"
#include "util.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
INCLUDE_game

@ -56,7 +56,7 @@ public:
showDefaultLabel=false;
}
inline void Update(Crawler*game)override{
inline void Update(AiL*game)override{
MenuComponent::Update(game);
if(playTime==-1){
grayedOut=true;

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "Menu.h"
#include "MenuComponent.h"

@ -36,7 +36,7 @@ All rights reserved.
*/
#pragma endregion
#include "Map.h"
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "safemap.h"
INCLUDE_game

@ -35,7 +35,7 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Crawler.h"
#include "AdventuresInLestoria.h"
#include "MenuComponent.h"
#include "DEFINES.h"
#include "safemap.h"
@ -150,13 +150,13 @@ Menu*Menu::CreateMenu(MenuType type,vf2d pos,vf2d size){
return menus.at(type);
}
void Menu::CheckClickAndPerformMenuSelect(Crawler*game){
void Menu::CheckClickAndPerformMenuSelect(AiL*game){
if(game->GetMouse(Mouse::LEFT).bReleased||game->GetKey(SPACE).bReleased||game->GetKey(ENTER).bReleased){
MenuSelect(game);
}
}
void Menu::HoverMenuSelect(Crawler*game){
void Menu::HoverMenuSelect(AiL*game){
if(!game->IsFocused()||selection==vi2d{-1,-1}||buttons[selection.y][selection.x]->disabled)return;
if(buttons[selection.y][selection.x]->draggable){
if(buttonHoldTime<"ThemeGlobal.MenuHoldTime"_F){
@ -170,7 +170,7 @@ void Menu::HoverMenuSelect(Crawler*game){
}
}
void Menu::MenuSelect(Crawler*game){
void Menu::MenuSelect(AiL*game){
if(!game->IsFocused()||selection==vi2d{-1,-1}||(buttons[selection.y][selection.x]->disabled||buttons[selection.y][selection.x]->grayedOut))return;
bool buttonStillValid=buttons[selection.y][selection.x]->onClick(MenuFuncData{*this,game,buttons[selection.y][selection.x],(ScrollableWindowComponent*)buttons[selection.y][selection.x]->parentComponent});
if(buttonStillValid){
@ -184,7 +184,7 @@ void Menu::MenuSelect(Crawler*game){
}
}
void Menu::Update(Crawler*game){
void Menu::Update(AiL*game){
if(buttons.count(selection.y)==0)selection={-1,-1};
if(selection.x<0||selection.x>=buttons[selection.y].size()){selection={-1,-1};}
@ -302,7 +302,7 @@ void Menu::Update(Crawler*game){
}
};
void Menu::Draw(Crawler*game){
void Menu::Draw(AiL*game){
if(GetCurrentTheme().IsScaled()){
DrawScaledWindowBackground(game,pos,size,GetRenderColor());
}else{
@ -351,7 +351,7 @@ void Menu::OpenMenu(MenuType menu,bool cover){
stack.push_back(menus[menu]);
}
void Menu::KeyboardButtonNavigation(Crawler*game,vf2d menuPos){
void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
vi2d prevSelection=selection;
if(game->GetKey(RIGHT).bPressed){
if(selection==vi2d{-1,-1})return;
@ -489,7 +489,7 @@ void Menu::KeyboardButtonNavigation(Crawler*game,vf2d menuPos){
}
}
void Menu::DrawScaledWindowBorder(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor){
void Menu::DrawScaledWindowBorder(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor){
vf2d patchSize={"Interface.9PatchSize"_f[0],"Interface.9PatchSize"_f[1]};
//Upper-Left
@ -510,7 +510,7 @@ void Menu::DrawScaledWindowBorder(Crawler*game,vf2d menuPos,vf2d size,Pixel rend
game->DrawPartialDecal(menuPos+vf2d{0,size.y},vf2d{size.x,patchSize.y},GetPatchPart(1,2).Decal(),{patchSize.x*1,patchSize.y*2},patchSize,renderColor);
}
void Menu::DrawTiledWindowBorder(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor){
void Menu::DrawTiledWindowBorder(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor){
vf2d patchSize={"Interface.9PatchSize"_f[0],"Interface.9PatchSize"_f[1]};
//Upper-Left
@ -531,7 +531,7 @@ void Menu::DrawTiledWindowBorder(Crawler*game,vf2d menuPos,vf2d size,Pixel rende
game->DrawPartialDecal(menuPos+vf2d{0,size.y},vf2d{size.x,patchSize.y},GetPatchPart(1,2).Decal(),{0,0},vf2d{size.x,patchSize.y},renderColor);
}
void Menu::DrawScaledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor){
void Menu::DrawScaledWindowBackground(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor){
vf2d patchSize={"Interface.9PatchSize"_f[0],"Interface.9PatchSize"_f[1]};
//Center
@ -543,7 +543,7 @@ void Menu::DrawScaledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel
}
}
void Menu::DrawTiledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor){
void Menu::DrawTiledWindowBackground(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor){
vf2d patchSize={"Interface.9PatchSize"_f[0],"Interface.9PatchSize"_f[1]};
//Center
@ -722,5 +722,5 @@ void Menu::AddChapterListener(MenuComponent*component){
}
MenuFuncData::MenuFuncData(Menu&menu,Crawler*const game,MenuComponent*const component,ScrollableWindowComponent*const parentComponent)
MenuFuncData::MenuFuncData(Menu&menu,AiL*const game,MenuComponent*const component,ScrollableWindowComponent*const parentComponent)
:menu(menu),game(game),component(component),parentComponent(parentComponent){}

@ -44,7 +44,7 @@ All rights reserved.
#include "olcUTIL_Geometry2D.h"
#include "olcPGEX_ViewPort.h"
class Crawler;
class AiL;
class MenuComponent;
class ScrollableWindowComponent;
@ -107,7 +107,7 @@ class Menu:public IAttributable{
static void InitializeLoadGameWindow();
static void InitializeUserIDWindow();
friend class Crawler;
friend class AiL;
friend struct Player;
friend class ItemInfo;
friend class EntityStats;
@ -115,7 +115,7 @@ class Menu:public IAttributable{
float buttonHoldTime=0;
vi2d selection={-1,-1};
vi2d lastActiveMousePos={};
int componentCount;
int componentCount=0;
MenuComponent*draggingComponent=nullptr;
ViewPort window;
@ -183,8 +183,8 @@ public:
return component;
}
void Update(Crawler*game);
void Draw(Crawler*game);
void Update(AiL*game);
void Draw(AiL*game);
static void InitializeMenuListenerCategory(const std::string&category);
static void InitializeMenus();
static void LockInListeners();
@ -230,17 +230,17 @@ private:
Menu(vf2d pos,vf2d size);
static MenuType lastMenuTypeCreated;
static std::string lastRegisteredComponent;
void HoverMenuSelect(Crawler*game);
void MenuSelect(Crawler*game);
void CheckClickAndPerformMenuSelect(Crawler*game);
void HoverMenuSelect(AiL*game);
void MenuSelect(AiL*game);
void CheckClickAndPerformMenuSelect(AiL*game);
//Mandatory before any menu operations! This creates and sets up the menu in memory.
static Menu*CreateMenu(MenuType type,vf2d pos,vf2d size);
void KeyboardButtonNavigation(Crawler*game,vf2d menuPos);
static void DrawScaledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor);
static void DrawTiledWindowBackground(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor);
static void DrawScaledWindowBorder(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor);
static void DrawTiledWindowBorder(Crawler*game,vf2d menuPos,vf2d size,Pixel renderColor);
void KeyboardButtonNavigation(AiL*game,vf2d menuPos);
static void DrawScaledWindowBackground(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor);
static void DrawTiledWindowBackground(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor);
static void DrawScaledWindowBorder(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor);
static void DrawTiledWindowBorder(AiL*game,vf2d menuPos,vf2d size,Pixel renderColor);
//This triggers if we use a keyboard/controller input to try and select some off-screen menu item. We should ideally follow the menu cursor.
bool HandleOutsideDisabledButtonSelection(MenuComponent*disabledButton);
@ -260,10 +260,10 @@ T*Component(MenuType menu,std::string componentName){
struct MenuFuncData{
Menu&menu;
Crawler*const game;
AiL*const game;
MenuComponent*const component;
ScrollableWindowComponent*const parentComponent=nullptr;
MenuFuncData(Menu&menu,Crawler*const game,MenuComponent*const component,ScrollableWindowComponent*const parentComponent=nullptr);
MenuFuncData(Menu&menu,AiL*const game,MenuComponent*const component,ScrollableWindowComponent*const parentComponent=nullptr);
};
using MenuFunc=std::function<bool(MenuFuncData)>;

@ -51,7 +51,7 @@ public:
inline MenuAnimatedIconButton(geom2d::rect<float>rect,std::string animation,MenuFunc onClick,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuIconButton(rect,nullptr,onClick,attributes),animation(animation){}
protected:
virtual inline void Update(Crawler*game)override{
virtual inline void Update(AiL*game)override{
MenuIconButton::Update(game);
animationTime+=game->GetElapsedTime();
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save