Compare commits

...

31 Commits

Author SHA1 Message Date
a6378c1339 Forgot quotation marks for folder with spaces.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m11s
Emscripten Build / UnitTesting (push) Failing after 9m14s
2026-06-03 17:00:12 -05:00
2614f6493f Pack key secret direct injecting into checked out source code.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m20s
Emscripten Build / UnitTesting (push) Failing after 9m15s
2026-06-03 16:40:56 -05:00
2d59c12327 testing result
Some checks failed
Emscripten Build / Test_Variable (push) Successful in 1s
Emscripten Build / UnitTesting (push) Has been cancelled
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
2026-06-03 16:34:19 -05:00
7a0028d9aa Secret
Some checks failed
Emscripten Build / Test_Variable (push) Successful in 1s
Emscripten Build / UnitTesting (push) Has been cancelled
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
2026-06-03 16:32:18 -05:00
ae10749a8a Attempt to have pack key in an external runner variable.
Some checks failed
Emscripten Build / Test_Variable (push) Successful in 1s
Emscripten Build / UnitTesting (push) Has been cancelled
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
2026-06-03 16:29:51 -05:00
c4ed2e7afe Untrack gamepack
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m28s
Emscripten Build / UnitTesting (push) Failing after 9m23s
2026-06-03 15:43:13 -05:00
4ead99e5ad Remove error message when trying to set loadout item if the number of loadout items reaches zero. Gamepack generating redone. All unit tests fixed. Release Build 13868.
Some checks failed
Emscripten Build / UnitTesting (push) Has been cancelled
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
2026-06-03 15:40:35 -05:00
d8f4bf9c4c Fix a bug with a rare chance to crash the game whenever transitioning to the overworld map stage. Fix asset references to point to new assets locations. Release Build 13843.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m31s
Emscripten Build / UnitTesting (push) Failing after 9m11s
2026-06-03 11:56:15 -05:00
39866bd973 Full refactor and implementation of new GraphicsManager class.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m37s
Emscripten Build / UnitTesting (push) Failing after 9m20s
2026-05-30 04:23:06 -05:00
7a8bbdbe3c Start building out skeleton for a new GraphicsManager implementation.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 3m2s
Emscripten Build / UnitTesting (push) Failing after 2m56s
2026-05-27 15:39:16 -05:00
030f1061d7 Fix ingame dialog dynamic image loading for Visual Novel engine. Release Build 13671.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m28s
Emscripten Build / UnitTesting (push) Failing after 15m56s
2026-05-26 14:37:31 -05:00
195924932b Dynamically load Visual Novel assets. Release Build 13670.
Some checks failed
Emscripten Build / UnitTesting (push) Has been cancelled
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
2026-05-26 14:31:08 -05:00
9d097e3cdd Corrected and migrated the Ground Slam ability to be handled via the Entity system. Updated damage numbers system to keep drawing during death transition screen. Release Build 13664.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m54s
Emscripten Build / UnitTesting (push) Successful in 9m54s
2026-05-19 22:11:20 -05:00
a9b63001eb Witch dynamic ability descriptions implemented. Made ability descriptions on class selection window display proper damag values based on a level 1 character of that class instead of defaulting to Warrior's base attack. Release Build 13643.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m7s
Emscripten Build / UnitTesting (push) Failing after 9m12s
2026-05-19 15:32:21 -05:00
48529d8c54 Moved array parsing for ability descriptions from being its own symbol to being integrated with the other symbols when they are parsed. Updated Trapper skill descriptions with dynamic text. Release Build 13641.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 10m44s
Emscripten Build / UnitTesting (push) Has been cancelled
2026-05-19 15:13:56 -05:00
10c949779d size_t needs stoul not stoull
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 7m25s
Emscripten Build / UnitTesting (push) Failing after 8m35s
2026-05-15 19:52:40 -05:00
65e7520dab Implemented new description variable text for Thief. Release Build 13630.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 1m25s
Emscripten Build / UnitTesting (push) Failing after 8m16s
2026-05-15 16:23:22 -05:00
4eed7d722d Wizard spell text descriptions updated. Formatter handles decimals properly. Release Build 13627.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 7m11s
Emscripten Build / UnitTesting (push) Failing after 8m17s
2026-05-15 15:58:02 -05:00
a77008b67b Remove invalid mutable keyword (Stupid msvc) and replace with macro label.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 7m24s
Emscripten Build / UnitTesting (push) Failing after 8m8s
2026-05-13 08:32:27 -05:00
c9db9209d7 Implemented util::Tokenize and appropriate unit test. Refactored ability description parsing function slightly to handle future delimiters. Release Build 13626.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Failing after 1m23s
Emscripten Build / UnitTesting (push) Failing after 1m25s
2026-05-13 01:59:43 -05:00
4862652593 Complete ability tooltip modifications for Warrior, Ranger, Wizard. Leave new proposed syntax involving multiplication of two items. Release Build 13607.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 7m13s
Emscripten Build / UnitTesting (push) Failing after 7m59s
2026-05-11 23:10:49 -05:00
443434c30c Fix up MonsterStrategy ambiguous naming. Added operator<< overload for the enum for safemap compatibility. Release Build 13582.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 7m4s
Emscripten Build / UnitTesting (push) Failing after 7m38s
2026-05-11 00:55:11 -05:00
ffeab76719 Isolate Ground Slam into its own effect. Prepped effect for implementation. Release Build 13575.
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 7m55s
Emscripten Build / UnitTesting (push) Failing after 9m26s
2026-05-05 17:27:00 -05:00
fdd37280f1 Remove verbose logging while running tests.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 17m46s
Emscripten Build / UnitTesting (push) Successful in 8m39s
2026-05-05 01:43:40 -05:00
00704856b0 Finished converting Battle Cry to Entity compatibility. Add unit test to ensure block works for monsters.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 13m57s
Emscripten Build / UnitTesting (push) Successful in 8m21s
2026-05-04 22:40:14 -05:00
81774b55f0 Merge with master
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 14m4s
Emscripten Build / UnitTesting (push) Successful in 8m8s
2026-05-04 15:51:07 -05:00
Noemi
65d4e3f7a8 Fix case-sensitivity for Molotov.png for linux systems
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m4s
2026-04-20 03:00:50 -05:00
588aa55bdc Merge pull request 'linux-fix' (#122) from linux-fix into ShadowBoss
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 15m29s
Reviewed-on: #122
2026-04-16 03:17:07 -05:00
71423a2102 Merge branch 'ShadowBoss' into linux-fix
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 15m29s
2026-04-16 03:16:36 -05:00
Noemi
f4317ab558 Added static C++ library linking flag
Some checks failed
Emscripten Build / Build_and_Deploy_Web_Build (push) Has been cancelled
2026-04-16 03:15:09 -05:00
Noemi
2827064176 Add stacktrace requirement to linux CMake build and use nproc to determine number of processors to use.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m30s
2026-04-16 01:20:02 -05:00
199 changed files with 10183 additions and 1292 deletions

View File

@ -45,6 +45,10 @@ jobs:
apt-get install -y nodejs git libfreetype6-dev cmake
- name: Check out repository code
uses: actions/checkout@v4
- name: Insert Pack Key Secret
run: |
echo "#include<string>
std::string PACK_KEY=\"${{ secrets.PACKKEY }}\";" > "/workspace/AMay/AdventuresInLestoria/Adventures in Lestoria/packkey.cpp"
- name: Build Unit Tests
run: |
./test.sh

2
.gitignore vendored
View File

@ -432,3 +432,5 @@ desktop.ini
tools
/dotnet-tools.json
/Adventures in Lestoria/assets.zip
gamepack.pak
/Adventures in Lestoria/assets/gamepack.pak

View File

@ -37,6 +37,7 @@ All rights reserved.
#pragma endregion
#include "Ability.h"
#include "AdventuresInLestoria.h"
#include<ranges>
INCLUDE_game
@ -102,45 +103,100 @@ const std::string Ability::GetDescriptionWithPlayerModifiers()const{
std::unordered_map<SpecialKey,TranslateFunc>specialPrefixes{
#define TranslateFunc [&](const datafile&data,const std::string&val)->std::string
{"DamageMult",TranslateFunc{
float damageMult{stof(data.at(val).GetString())};
float damageMult{stof(val)};
int finalDmg{int(damageMult*game->GetPlayer()->GetAttack())};
return std::format("{}",finalDmg);
}},
{"Pct",TranslateFunc{
float percentage{stof(val)};
return std::format("{}%",percentage*100);
}},
};
const Pixel specialValCol{69,249,255};
#define OUT
const auto FindAndParse=[&specialPrefixes,&specialValCol](datafile&data,OUT std::string&finalText,OUT bool&bracesFound,OUT std::string&variableName)->bool{
const auto GetPairStringProperty=[&data](const std::string&variableName)->std::optional<std::string>{
const bool IS_ARRAY_VARIABLE{variableName.contains('[')};
std::vector<std::string>parsedArrVariable{util::Tokenize(variableName,'[')};
const std::string&key{parsedArrVariable[0]};
if(parsedArrVariable.size()>1){
const size_t&index{std::stoul(parsedArrVariable[1])};
if(const datafile&propData{data.GetProperty(key)};IS_ARRAY_VARIABLE&&index<data.GetKeys().size())return propData.GetString(index);
}else if(data.HasProperty(key))return data.GetProperty(key).GetFullString();
return {};
};
enum SymbolIndicator{
MULTIPLICATION, //*
KEY_VALUE_PAIR,
NOT_FOUND,
};
const auto AddToDescription=[&finalText,&bracesFound,&variableName](const std::string&descriptionTextAddon){
finalText+=descriptionTextAddon;
bracesFound=false;
variableName="";
};
SymbolIndicator indicator{NOT_FOUND};
safemap<char,SymbolIndicator>recognizedSymbols;
recognizedSymbols[':']=KEY_VALUE_PAIR;
recognizedSymbols['*']=MULTIPLICATION;
recognizedSymbols.SetInitialized();
for(auto&[c,symbolIndicator]:recognizedSymbols){
if(variableName.find(c)!=std::string::npos){
indicator=symbolIndicator;
break;
}
}
switch(indicator){
case MULTIPLICATION:{
std::vector<std::string>tokens{util::Tokenize(variableName,'*')};
std::optional<float>numb{};
for(const std::string&token:tokens){
if(!numb)numb=std::stof(*GetPairStringProperty(token));
else *numb*=std::stof(*GetPairStringProperty(token));
}
if(!numb)ERR("WARNING! Somehow did not populate a number. Variable: "<<variableName);
AddToDescription(specialValCol.toHTMLColorCode()+std::format("{:.2f}",*numb)+WHITE.toHTMLColorCode());
return true;
}break;
case KEY_VALUE_PAIR:{
std::vector<std::string>tokens{util::Tokenize(variableName,':')};
if(tokens.size()!=2)ERR(": variable syntax only allows 2 arguments. Ex. Key:Value. Arguments found: "<<tokens.size());
std::string separatorKey{tokens.at(0)};
std::string separatorVal{*GetPairStringProperty(tokens.at(1))};
if(!specialPrefixes.count(separatorKey))ERR(std::format("Could not find translation function for key {} inside special prefixes map!",separatorKey))
else {
AddToDescription(specialValCol.toHTMLColorCode()+specialPrefixes[separatorKey](data,separatorVal)+WHITE.toHTMLColorCode());
return true;
}
}break;
}
if(std::optional<std::string>unpackedVar{GetPairStringProperty(variableName)};unpackedVar){
finalText+=specialValCol.toHTMLColorCode()+*unpackedVar+WHITE.toHTMLColorCode();
bracesFound=false;
variableName="";
return true;
}
return false;
};
const auto ParseVariables=[&](const std::string_view abilityText)->std::string{
std::string finalText{};
size_t marker{};
std::string variableName{};
bool bracesFound{false};
const auto FindAndParse=[&finalText,&bracesFound,&variableName,&specialPrefixes,&specialValCol](datafile&data)->bool{
if(data.HasProperty(variableName)){
finalText+=specialValCol.toHTMLColorCode()+data.GetProperty(variableName).GetFullString()+WHITE.toHTMLColorCode();
bracesFound=false;
variableName="";
return true;
}else if(size_t separatorMarker{std::string::npos};(separatorMarker=variableName.find(':'))!=std::string::npos){
std::string separatorKey{variableName.substr(0,separatorMarker)};
std::string separatorVal{variableName.substr(separatorMarker+1)};
if(!specialPrefixes.count(separatorKey))ERR(std::format("Could not find translation function for key {} inside special prefixes map!",separatorKey))
else {
if(!data.HasProperty(separatorVal))return false; //Could not be found in this section, will need to seek in another location.
finalText+=specialValCol.toHTMLColorCode()+specialPrefixes[separatorKey](data,separatorVal)+WHITE.toHTMLColorCode();
bracesFound=false;
return true;
}
}
return false;
};
while(marker<abilityText.length()){
const char c{abilityText[marker]};
if(!bracesFound&&c=='{')bracesFound=true;
else if(bracesFound&&c=='}'){ //Parse the variable.
if(!FindAndParse((*abilityConfig).get()))
ERR(std::format("Could not find variable {} for Ability {}",variableName,GetName()));
if(!FindAndParse((*abilityConfig).get(),finalText,bracesFound,variableName))ERR(std::format("Could not find variable {} for Ability {}",variableName,GetName()));
}else if(bracesFound)variableName+=c;
else finalText+=c;
marker++;
@ -166,34 +222,16 @@ const std::string Ability::GetDescriptionWithPlayerModifiers()const{
std::string variableName{};
bool bracesFound{false};
const auto FindAndParse=[&finalText,&bracesFound,&variableName,&specialPrefixes,&specialValCol](datafile&data)->bool{
if(data.HasProperty(variableName)){
finalText+=specialValCol.toHTMLColorCode()+data.GetProperty(variableName).GetFullString()+WHITE.toHTMLColorCode();
bracesFound=false;
variableName="";
return true;
}else if(size_t separatorMarker{std::string::npos};(separatorMarker=variableName.find(':'))!=std::string::npos){
std::string separatorKey{variableName.substr(0,separatorMarker)};
std::string separatorVal{variableName.substr(separatorMarker+1)};
if(!specialPrefixes.count(separatorKey))ERR(std::format("Could not find translation function for key {} inside special prefixes map!",separatorKey))
else {
if(!data.HasProperty(separatorVal))return false; //Could not be found in this section, will need to seek in another location.
finalText+=specialValCol.toHTMLColorCode()+specialPrefixes[separatorKey](data,separatorVal)+WHITE.toHTMLColorCode();
bracesFound=false;
return true;
}
}
return false;
};
while(marker<abilityText.length()){
const char c{abilityText[marker]};
if(!bracesFound&&c=='{')bracesFound=true;
else if(bracesFound&&c=='}'){ //Parse the variable.
if(!FindAndParse(enchant.get().GetData()["Ability Settings"]))
if(!FindAndParse(enchant.get().GetData()))
if(!FindAndParse((*(*enchant.get().GetAbility())->abilityConfig).get()))
ERR(std::format("Could not find variable {} for enchant Ability Settings of enchantment {}",variableName,enchant.get().Name()));
const bool FoundVariable{
FindAndParse(enchant.get().GetData()["Ability Settings"],finalText,bracesFound,variableName)||
FindAndParse(enchant.get().GetData(),finalText,bracesFound,variableName)||
FindAndParse((*(*enchant.get().GetAbility())->abilityConfig).get(),finalText,bracesFound,variableName)
};
if(!FoundVariable)ERR(std::format("Could not find variable {} for enchant Ability Settings of enchantment {}",variableName,enchant.get().Name()));
}else if(bracesFound)variableName+=c;
else finalText+=c;
marker++;

View File

@ -79,7 +79,7 @@ struct Ability{
PrecastData precastInfo;
bool canCancelCast=false;
InputGroup*input;
std::string icon{"pixel.png"};
std::string icon{"assets/pixel.png"};
//If set to true, this ability is tied to using an item.
bool itemAbility=false;
//If set to true, this ability instead activates immediately when a cast occurs. When the cast finishes, nothing happens instead.

View File

@ -41,7 +41,7 @@ All rights reserved.
#include "MenuIconButton.h"
INCLUDE_game
INCLUDE_GFX
class AccessoryRowItemDisplay:public RowItemDisplay{
std::weak_ptr<MenuIconButton>lockButton;
@ -57,7 +57,7 @@ public:
}
}
inline void AfterCreate()override final{
lockButton=parentComponent.lock()->ADDSUB(std::format("{}_lock",name),MenuIconButton)(geom2d::rect<float>{rect.pos+vf2d{rect.size.x-10.f,rect.size.y-10.f},vf2d{10.f,10.f}},GFX["unlock.png"].Decal(),[](MenuFuncData data){
lockButton=parentComponent.lock()->ADDSUB(std::format("{}_lock",name),MenuIconButton)(geom2d::rect<float>{rect.pos+vf2d{rect.size.x-10.f,rect.size.y-10.f},vf2d{10.f,10.f}},"assets/unlock.png",[](MenuFuncData data){
std::weak_ptr<AccessoryRowItemDisplay>accessoryParent=DYNAMIC_POINTER_CAST<AccessoryRowItemDisplay>(data.component.lock()->GetSubcomponentParent());
accessoryParent.lock()->SetLocked(!accessoryParent.lock()->IsLocked());
if(accessoryParent.lock()->IsLocked()){
@ -71,10 +71,12 @@ public:
}
inline void Update(AiL*game)override final{
MenuComponent::Update(game);
if(itemRef.lock()->IsLocked()){
lockButton.lock()->SetIcon(GFX["lock.png"].Decal());
}else{
lockButton.lock()->SetIcon(GFX["unlock.png"].Decal());
if(!itemRef.expired()){
if(itemRef.lock()->IsLocked()){
lockButton.lock()->SetIcon("assets/lock.png");
}else{
lockButton.lock()->SetIcon("assets/unlock.png");
}
}
}
inline const bool IsLocked()const{

View File

@ -416,12 +416,16 @@
</SubType>
</ClInclude>
<ClInclude Include="Effect.h" />
<ClInclude Include="EffectData.h" />
<ClInclude Include="EffectManager.h" />
<ClInclude Include="EffectRef.h" />
<ClInclude Include="Entity.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="FriendlyType.h" />
<ClInclude Include="GameHelper.h" />
<ClInclude Include="GraphicsManager.h" />
<ClInclude Include="HurtDamageInfo.h">
<SubType>
</SubType>
@ -547,6 +551,7 @@
</SubType>
</ClInclude>
<ClInclude Include="MenuDefinitions.h" />
<ClInclude Include="MenuFragmentItemButton.h" />
<ClInclude Include="MenuItemLabel.h">
<SubType>
</SubType>
@ -888,6 +893,8 @@
</SubType>
</ClCompile>
<ClCompile Include="GiantOctopus.cpp" />
<ClCompile Include="GraphicsManager.cpp" />
<ClCompile Include="GroundSlamEffect.cpp" />
<ClCompile Include="HomingBullet.cpp">
<SubType>
</SubType>
@ -1094,30 +1101,39 @@
<ClCompile Include="Spider.cpp" />
<ClCompile Include="tests\BuffTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\EffectTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\EnchantTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\EngineTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\FileTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\GeometryTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\ItemTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\MonsterTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="tests\PlayerTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Desktop|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="ThunderOrb.cpp" />
<ClCompile Include="TileGroup.cpp" />

View File

@ -264,9 +264,6 @@
<ClInclude Include="Error.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EncountersSpawnListScrollableWindowComponent.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SpawnEncounterLabel.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
@ -741,6 +738,24 @@
<ClInclude Include="GameHelper.h">
<Filter>Header Files\Unit Testing</Filter>
</ClInclude>
<ClInclude Include="EffectRef.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EffectManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EffectData.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GraphicsManager.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="EncountersSpawnListScrollableWindowComponent.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
<ClInclude Include="MenuFragmentItemButton.h">
<Filter>Header Files\Interface</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">
@ -1421,6 +1436,12 @@
<ClCompile Include="tests\PlayerTests.cpp">
<Filter>Source Files\Unit Tests</Filter>
</ClCompile>
<ClCompile Include="GroundSlamEffect.cpp">
<Filter>Source Files\Effects</Filter>
</ClCompile>
<ClCompile Include="GraphicsManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

View File

@ -90,11 +90,10 @@ All rights reserved.
#include <ranges>
#include"TileGroupDataFile.h"
#include<iostream>
#include"GraphicsManager.h"
INCLUDE_EMITTER_LIST
INCLUDE_ITEM_CATEGORIES
INCLUDE_BACKDROP_DATA
INCLUDE_FOREDROP_DATA
INCLUDE_MONSTER_DATA
INCLUDE_PACK_KEY
@ -109,7 +108,6 @@ std::unordered_map<MonsterSpawnerID,MonsterSpawner>SPAWNER_LIST;
std::vector<std::shared_ptr<DamageNumber>>DAMAGENUMBER_LIST;
std::vector<std::unique_ptr<IBullet>>BULLET_LIST{MAX_BULLETS};
std::optional<std::queue<MonsterSpawnerID>>SPAWNER_CONTROLLER;
safemap<std::string,Renderable>GFX;
utils::datafile DATA;
AiL*game;
#undef KEY_LEFT //Stupid Linux
@ -171,6 +169,29 @@ InputGroup AiL::KEY_TOGGLE_MAP;
float AiL::SIZE_CHANGE_SPEED=1;
void AddAllItemsToResourcePack(const std::string_view prefix,const std::string_view filepath){
const auto IsAllowed=[](const std::string_view filename){
return filename.ends_with(".png")||
filename.ends_with(".ogg")||
filename.ends_with(".tmx")||
filename.ends_with(".tsx")||
filename.ends_with(".txt")||
filename.ends_with(".data");
};
for(auto&path:std::filesystem::recursive_directory_iterator(std::filesystem::path{filepath})){
try{
if(path.is_regular_file()&&IsAllowed(path.path().filename().string())){
std::string filepath{path.path().string()};
std::replace(filepath.begin(),filepath.end(),'\\','/');
if(!game->gamepack.FileExists(filepath)){
LOG("Added "<<filepath<<" to gamepack")
game->gamepack.AddFile(filepath);
}
}
}catch(std::exception&e){}
}
}
AiL::AiL(bool testingMode){
game=this;
olc_SetTestingMode(testingMode);
@ -194,6 +215,10 @@ AiL::AiL(bool testingMode){
}
DEBUG_PATHFINDING="debug_pathfinding"_I;
#pragma endregion
if(PACK_KEY=="INSERT_PACK_KEY_HERE"||PACK_KEY=="INSERT PACK KEY HERE")ERR("ERROR! Starting the game with the default pack ID is not allowed!");
gamepack.LoadPack("assets/"+"gamepack_file"_S,PACK_KEY);
AddAllItemsToResourcePack("assets/","assets/");
Warrior::ResetToOriginalAbilities();
@ -296,8 +321,6 @@ void InitializeGameConfigurations(){
}
bool AiL::OnUserCreate(){
if(PACK_KEY=="INSERT_PACK_KEY_HERE"||PACK_KEY=="INSERT PACK KEY HERE")ERR("ERROR! Starting the game with the default pack ID is not allowed!");
gamepack.LoadPack("assets/"+"gamepack_file"_S,PACK_KEY);
#ifndef OLC_PGE_HEADLESS
GamePad::init();
#endif
@ -376,7 +399,6 @@ bool AiL::OnUserCreate(){
State_OverworldMap::SetStageMarker("Player.Starting Location"_S);
STEAMINPUT(
SteamInput()->Init(false);
Input::LoadSteamButtonIcons();
Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls");
)
@ -488,6 +510,7 @@ bool AiL::OnUserUpdate(float fElapsedTime){
AdminConsole();
TileGroupDataFile::RunMapCacheQueue();
GFX.LoadImageInQueue();
Audio::Update();
if(!IsConsoleShowing()||MapCacheIsRunning){
@ -999,7 +1022,7 @@ void AiL::PopulateRenderLists(){
std::ranges::sort(MONSTER_LIST,[](std::shared_ptr<Monster>&m1,std::shared_ptr<Monster>&m2){return m1->GetPos().y<m2->GetPos().y;});
std::ranges::sort(ItemDrop::drops,[](ItemDrop&id1,ItemDrop&id2){return id1.GetPos().y<id2.GetPos().y;});
std::ranges::sort(BULLET_LIST,[](std::unique_ptr<IBullet>&b1,std::unique_ptr<IBullet>&b2){return b1->pos.y<b2->pos.y;});
std::ranges::sort(BULLET_LIST,[](std::unique_ptr<IBullet>&b1,std::unique_ptr<IBullet>&b2){return b1&&b2&&b1->pos.y<b2->pos.y;});
}
void AiL::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d tileSheetPos){
@ -1008,25 +1031,25 @@ void AiL::RenderTile(vi2d pos,TilesheetData tileSheet,int tileSheetIndex,vi2d ti
if(MAP_TILESETS.at(tileSheet.tilesetName).animationData.count(tileSheetIndex)){
int animationDuration_ms=int(MAP_TILESETS.at(tileSheet.tilesetName).animationData.at(tileSheetIndex).size()*"animation_tile_precision"_I);
int animatedIndex=MAP_TILESETS.at(tileSheet.tilesetName).animationData.at(tileSheetIndex)[size_t(fmod(levelTime*1000.f,animationDuration_ms)/"animation_tile_precision"_I)];
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetX=animatedIndex%tileSheetWidth;
int tileSheetY=animatedIndex/tileSheetWidth;
if(MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.count(tileSheetIndex)){
for(int y=0;y<MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex).y;y++){
for(int x=0;x<MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex).x;x++){
view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth+vf2d{float(x),float(y)}*game->GetCurrentMapData().tilewidth/vf2d{MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex)},vf2d{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)}/vf2d{MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex)},MAP_TILESETS.at(tileSheet.tilesetName).tileset->Decal(),vi2d{tileSheetX,tileSheetY}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},tempCol);
view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth+vf2d{float(x),float(y)}*game->GetCurrentMapData().tilewidth/vf2d{MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex)},vf2d{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)}/vf2d{MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Decal(),vi2d{tileSheetX,tileSheetY}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},tempCol);
}
}
}else view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tilesetName).tileset->Decal(),vi2d{tileSheetX,tileSheetY}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},tempCol);
}else view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Decal(),vi2d{tileSheetX,tileSheetY}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},tempCol);
}else{
if(MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.count(tileSheetIndex)){
for(int y=0;y<MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex).y;y++){
for(int x=0;x<MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex).x;x++){
view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth+vi2d{x,y}*game->GetCurrentMapData().tilewidth/MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex),{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tilesetName).tileset->Decal(),tileSheetPos*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,vf2d{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)}/MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex),tempCol);
view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth+vi2d{x,y}*game->GetCurrentMapData().tilewidth/MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex),{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Decal(),tileSheetPos*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,vf2d{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)}/MAP_TILESETS.at(tileSheet.tilesetName).tileRepeatData.at(tileSheetIndex),tempCol);
}
}
}else{
view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tilesetName).tileset->Decal(),tileSheetPos*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},tempCol);
view.DrawPartialDecal(pos*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Decal(),tileSheetPos*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},tempCol);
if("debug_tileIDs"_I)view.DrawStringDecal(pos*game->GetCurrentMapData().tilewidth,std::to_string(tileSheetIndex));
}
}
@ -1036,24 +1059,24 @@ void AiL::RenderTile(TileRenderData&tileSheet,Pixel col){
if(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).animationData.count(tileSheet.tileID%1000000)){
int animationDuration_ms=int(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).animationData.at(tileSheet.tileID%1000000).size()*"animation_tile_precision"_I);
int animatedIndex=MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).animationData.at(tileSheet.tileID%1000000)[size_t(fmod(levelTime*1000.f,animationDuration_ms)/"animation_tile_precision"_I)];
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth;
int tileSheetX=animatedIndex%tileSheetWidth;
int tileSheetY=animatedIndex/tileSheetWidth;
if(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.count(animatedIndex)){
for(int y=0;y<MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(animatedIndex).y;y++){
for(int x=0;x<MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(animatedIndex).x;x++){
view.DrawPartialDecal(tileSheet.pos+vi2d{x,y}*game->GetCurrentMapData().tilewidth/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(animatedIndex),{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset->Decal(),vi2d{tileSheetX,tileSheetY}*vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)}/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(animatedIndex),col);
view.DrawPartialDecal(tileSheet.pos+vi2d{x,y}*game->GetCurrentMapData().tilewidth/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(animatedIndex),{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset].Decal(),vi2d{tileSheetX,tileSheetY}*vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)}/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(animatedIndex),col);
}
}
}else view.DrawPartialDecal(tileSheet.pos,{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset->Decal(),vi2d{tileSheetX,tileSheetY}*vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},col);
}else view.DrawPartialDecal(tileSheet.pos,{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset].Decal(),vi2d{tileSheetX,tileSheetY}*vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},col);
}else{
if(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.count(tileSheet.tileID)){
for(int y=0;y<MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(tileSheet.tileID).y;y++){
for(int x=0;x<MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(tileSheet.tileID).x;x++){
view.DrawPartialDecal(tileSheet.pos+vi2d{x,y}*game->GetCurrentMapData().tilewidth/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(tileSheet.tileID),{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset->Decal(),tileSheet.tileSheetPos,vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)}/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(tileSheet.tileID),col);
view.DrawPartialDecal(tileSheet.pos+vi2d{x,y}*game->GetCurrentMapData().tilewidth/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(tileSheet.tileID),{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset].Decal(),tileSheet.tileSheetPos,vf2d{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)}/MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileRepeatData.at(tileSheet.tileID),col);
}
}
}else view.DrawPartialDecal(tileSheet.pos,{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset->Decal(),tileSheet.tileSheetPos,{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},col);
}else view.DrawPartialDecal(tileSheet.pos,{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},GFX_FORCE[MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileset].Decal(),tileSheet.tileSheetPos,{float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tileSheet.tilesetName).tileheight)},col);
}
}
@ -1073,8 +1096,8 @@ void AiL::RenderWorld(float fElapsedTime){
auto dropsBeforeLower{ItemDrop::drops|std::views::filter([&pl](const ItemDrop&drop){return drop.GetPos().y<pl->GetPos().y&&!drop.OnUpperLevel();})};
auto dropsAfterUpper{ItemDrop::drops|std::views::filter([&pl](const ItemDrop&drop){return drop.GetPos().y>=pl->GetPos().y&&drop.OnUpperLevel();})};
auto dropsAfterLower{ItemDrop::drops|std::views::filter([&pl](const ItemDrop&drop){return drop.GetPos().y>=pl->GetPos().y&&!drop.OnUpperLevel();})};
auto bulletsUpper{BULLET_LIST|std::views::filter([](const std::unique_ptr<IBullet>&bullet){return bullet->OnUpperLevel();})};
auto bulletsLower{BULLET_LIST|std::views::filter([](const std::unique_ptr<IBullet>&bullet){return !bullet->OnUpperLevel();})};
auto bulletsUpper{BULLET_LIST|std::views::filter([](const std::unique_ptr<IBullet>&bullet){return bullet&&bullet->OnUpperLevel();})};
auto bulletsLower{BULLET_LIST|std::views::filter([](const std::unique_ptr<IBullet>&bullet){return bullet&&!bullet->OnUpperLevel();})};
std::vector<std::reference_wrapper<EffectT>>activeForegroundEffects,activeBackgroundEffects;
std::ranges::for_each(EffectManager::foregroundEffectList,[&activeForegroundEffects=activeForegroundEffects](EffectData&eff){if(eff.effect)activeForegroundEffects.emplace_back(std::ref(*eff.effect));});
std::ranges::for_each(EffectManager::backgroundEffectList,[&activeBackgroundEffects=activeBackgroundEffects](EffectData&eff){if(eff.effect)activeBackgroundEffects.emplace_back(std::ref(*eff.effect));});
@ -1096,7 +1119,7 @@ void AiL::RenderWorld(float fElapsedTime){
if(player->CatFormActive())animationFrame=player->GetCatFrame();
for(vf2d&pos:player->ghostPositions){
view.DrawPartialRotatedDecal(pos,animationFrame.get().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},animationFrame.get().GetSourceRect().pos,animationFrame.get().GetSourceRect().size,playerScale,{0,0,0,uint8_t(float(count)/player->RETREAT_GHOST_FRAMES*255)});
view.DrawPartialRotatedDecal(pos,animationFrame.get().GetSourceImage().Decal(),player->GetSpinAngle(),{12,12},animationFrame.get().GetSourceRect().pos,animationFrame.get().GetSourceRect().size,playerScale,{0,0,0,uint8_t(float(count)/player->RETREAT_GHOST_FRAMES*255)});
count++;
}
if(player->teleportAnimationTimer>0){
@ -1119,37 +1142,37 @@ void AiL::RenderWorld(float fElapsedTime){
if(player->HasBuff(BuffType::DAMAGE_REDUCTION))view.DrawPartialSquishedRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->playerOutline.Decal(),player->GetSpinAngle(),{12,12},animationFrame.get().GetSourceRect().pos,animationFrame.get().GetSourceRect().size,playerScale*scale+0.1f,{1.f,player->ySquishFactor},{210,210,210,uint8_t(util::lerp(0,255,abs(sin((PI*GetRunTime())/1.25f))))});
view.DrawPartialSquishedRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},animationFrame.get().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},animationFrame.get().GetSourceRect().pos,animationFrame.get().GetSourceRect().size,playerScale*scale,{1.f,player->ySquishFactor},playerCol);
view.DrawPartialSquishedRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},animationFrame.get().GetSourceImage().Decal(),player->GetSpinAngle(),{12,12},animationFrame.get().GetSourceRect().pos,animationFrame.get().GetSourceRect().size,playerScale*scale,{1.f,player->ySquishFactor},playerCol);
DrawAfterImage:view.DrawRotatedDecal(player->afterImagePos,player->afterImage.Decal(),0.f,player->afterImage.Sprite()->Size()/2,{player->GetSizeMult(),player->GetSizeMult()},Pixel{0xFFDCDA});
SetDecalMode(DecalMode::NORMAL);
if(player->GetState()==State::BLOCK||player->GetShield()>0){
view.DrawDecal(player->GetPos()+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)}-vf2d{12,12},GFX["block.png"].Decal());
view.DrawDecal(player->GetPos()+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)}-vf2d{12,12},GFX["assets/block.png"].Decal());
}
if(player->PoisonArrowAutoAttackReady()&&player->poisonArrowLastParticleTimer==0.f){
const float particleSize{fmod(game->GetRunTime(),0.4f)<0.2f?1.f:1.5f};
game->AddEffect(Effect{player->GetPos()-vf2d{0,4.f}-player->GetFacingDirVector()*6.f,0.2f,"energy_particle.png",player->OnUpperLevel(),vf2d{particleSize,particleSize}*1.2f,0.05f,vf2d{},Pixel{0,255,255,120},util::random(2*PI),0.f,true},false);
game->AddEffect(Effect{player->GetPos()-vf2d{0,4.f}-player->GetFacingDirVector()*6.f,0.2f,"energy_particle.png",player->OnUpperLevel(),vf2d{particleSize,particleSize},0.05f,vf2d{},DARK_GREEN,util::random(2*PI)},false);
game->AddEffect(Effect{player->GetPos()-vf2d{0,4.f}-player->GetFacingDirVector()*6.f,0.2f,"assets/energy_particle.png",player->OnUpperLevel(),vf2d{particleSize,particleSize}*1.2f,0.05f,vf2d{},Pixel{0,255,255,120},util::random(2*PI),0.f,true},false);
game->AddEffect(Effect{player->GetPos()-vf2d{0,4.f}-player->GetFacingDirVector()*6.f,0.2f,"assets/energy_particle.png",player->OnUpperLevel(),vf2d{particleSize,particleSize},0.05f,vf2d{},DARK_GREEN,util::random(2*PI)},false);
player->poisonArrowLastParticleTimer=0.15f;
}
if(displayCoinSymbol){
view.DrawRotatedDecal(pos+vf2d{0,(-player->GetZ()-16.f-sinf(PI*GetRunTime())*2.f)*(std::signbit(scale.y)?-1:1)},GFX["coin.png"].Decal(),0.f,GFX["coin.png"].Sprite()->Size()/2,{0.5f,0.5f});
view.DrawRotatedDecal(pos+vf2d{0,(-player->GetZ()-16.f-sinf(PI*GetRunTime())*2.f)*(std::signbit(scale.y)?-1:1)},GFX["assets/coin.png"].Decal(),0.f,GFX["assets/coin.png"].Sprite()->Size()/2,{0.5f,0.5f});
}
};
auto RenderZone=[&](const geom2d::rect<int>&zone){
game->SetDecalMode(DecalMode::ADDITIVE);
Pixel ringColor={128,128,128,uint8_t(abs(sin(game->levelTime))*255)};
Decal*ringDecal=GFX["finishring_green.png"].Decal();
Decal*ringDecal=GFX["assets/finishring_green.png"].Decal();
if(!player->IsOutOfCombat()){
game->SetDecalMode(DecalMode::NORMAL);
ringColor.r=ringColor.g=ringColor.b=64;
ringDecal=GFX["finishring.png"].Decal();
ringDecal=GFX["assets/finishring.png"].Decal();
}
view.DrawDecal(zone.pos,ringDecal,vf2d(zone.size)/vf2d(GFX["finishring.png"].Sprite()->Size()),ringColor);
view.DrawDecal(zone.pos,ringDecal,vf2d(zone.size)/vf2d(GFX["assets/finishring.png"].Sprite()->Size()),ringColor);
game->SetDecalMode(DecalMode::NORMAL);
};
@ -1175,16 +1198,18 @@ void AiL::RenderWorld(float fElapsedTime){
vf2d foregroundToMapRatio;
const vf2d mapPixelSize=currentMap.MapSize*currentMap.TileSize;
if(GetCurrentMap().backdrop.length()>0){
backgroundSize=BACKDROP_DATA[GetCurrentMap().backdrop].Sprite()->Size();
const std::string backdropFilename{"backdrop_directory"_S+DATA.GetProperty(std::format("Backdrops.{}",GetCurrentMap().backdrop)).GetString()};
backgroundSize=GFX[backdropFilename].Sprite()->Size();
backgroundExcessAmount=backgroundSize-vf2d(WINDOW_SIZE); //Extends outside the boundaries of the screen. Essentially the background size minus the size of the screen and take half to get the amount that extends in any one direction.
backgroundToMapRatio=1-(backgroundExcessAmount/mapPixelSize); //Expected range is from -half map size to +half map size.
DrawPartialDecal({},BACKDROP_DATA[GetCurrentMap().backdrop].Decal(),backgroundToMapRatio*-camera.GetPosition()+view.GetWorldOffset()+WINDOW_SIZE/2,WINDOW_SIZE);
if(FOREDROP_DATA.count(GetCurrentMap().backdrop)){
foregroundSize=FOREDROP_DATA[GetCurrentMap().backdrop].Sprite()->Size();
DrawPartialDecal({},GFX[backdropFilename].Decal(),backgroundToMapRatio*-camera.GetPosition()+view.GetWorldOffset()+WINDOW_SIZE/2,WINDOW_SIZE);
if(const std::string foredropName{std::format("Foredrops.{}",GetCurrentMap().backdrop)};DATA.HasProperty(foredropName)){
const std::string foredropFileName{"backdrop_directory"_S+DATA.GetProperty(foredropName).GetString()};
foregroundSize=GFX[foredropFileName].Sprite()->Size();
foregroundExcessAmount=foregroundSize-vf2d(WINDOW_SIZE); //Extends outside the boundaries of the screen. Essentially the background size minus the size of the screen and take half to get the amount that extends in any one direction.
foregroundToMapRatio=1-(foregroundExcessAmount/mapPixelSize);
DrawPartialDecal({},FOREDROP_DATA[GetCurrentMap().backdrop].Decal(),foregroundToMapRatio*-camera.GetPosition()+view.GetWorldOffset()+WINDOW_SIZE/2,WINDOW_SIZE);
DrawPartialDecal({},GFX[foredropFileName].Decal(),foregroundToMapRatio*-camera.GetPosition()+view.GetWorldOffset()+WINDOW_SIZE/2,WINDOW_SIZE);
}
}else{
FillRectDecal({0,0},GetScreenSize(),{100,180,100});
@ -1233,8 +1258,8 @@ void AiL::RenderWorld(float fElapsedTime){
int tileID=layer.tiles[y][x]-1;
if(tileID!=-1){
TilesheetData tileSheet=GetTileSheet(currentLevel,tileID);
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int tileSheetX=tileSheetIndex%tileSheetWidth;
int tileSheetY=tileSheetIndex/tileSheetWidth;
@ -1264,8 +1289,8 @@ void AiL::RenderWorld(float fElapsedTime){
int tileID=layer.tiles[y][x]-1;
if(tileID!=-1){
TilesheetData tileSheet=GetTileSheet(currentLevel,tileID);
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int tileSheetX=tileSheetIndex%tileSheetWidth;
int tileSheetY=tileSheetIndex/tileSheetWidth;
@ -1291,9 +1316,13 @@ void AiL::RenderWorld(float fElapsedTime){
#pragma region Render Backdrop
if(GetCurrentMap().backdrop.length()>0){
vf2d tileWorldPos=vi2d{x,y}*GetCurrentMapData().tilewidth;
view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},BACKDROP_DATA[GetCurrentMap().backdrop].Decal(),backgroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
if(FOREDROP_DATA.count(GetCurrentMap().backdrop))view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},FOREDROP_DATA[GetCurrentMap().backdrop].Decal(),foregroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
}else{
const std::string backdropFilename{"backdrop_directory"_S+DATA.GetProperty(std::format("Backdrops.{}",GetCurrentMap().backdrop)).GetString()};
view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},GFX[backdropFilename].Decal(),backgroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
if(const std::string foredropName{std::format("Foredrops.{}",GetCurrentMap().backdrop)};DATA.HasProperty(foredropName)){
const std::string foredropFileName{"backdrop_directory"_S+DATA.GetProperty(foredropName).GetString()};
view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},GFX[foredropFileName].Decal(),foregroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
}
}else{
view.FillRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},{100,180,100});
}
#pragma endregion
@ -1322,8 +1351,9 @@ void AiL::RenderWorld(float fElapsedTime){
}else{
if(GetCurrentMap().backdrop.length()>0){
vf2d tileWorldPos=vi2d{x,y}*GetCurrentMapData().tilewidth;
view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},BACKDROP_DATA[GetCurrentMap().backdrop].Decal(),backgroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
if(FOREDROP_DATA.count(GetCurrentMap().backdrop))view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},FOREDROP_DATA[GetCurrentMap().backdrop].Decal(),foregroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
const std::string backdropFilename{"backdrop_directory"_S+DATA.GetProperty(std::format("Backdrops.{}",GetCurrentMap().backdrop)).GetString()};
view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},GFX[backdropFilename].Decal(),backgroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
if(const std::string foredropName{std::format("Foredrops.{}",GetCurrentMap().backdrop)};DATA.HasProperty(foredropName))view.DrawPartialDecal(tileWorldPos,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},GFX["backdrop_directory"_S+DATA.GetProperty(foredropName).GetString()].Decal(),foregroundToMapRatio*-camera.GetPosition()+tileWorldPos+WINDOW_SIZE/2,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)});
}else{
view.FillRectDecal(vi2d{x,y}*GetCurrentMapData().tilewidth,{float(GetCurrentMapData().tilewidth),float(GetCurrentMapData().tilewidth)},{100,180,100});
}
@ -1347,22 +1377,22 @@ void AiL::RenderWorld(float fElapsedTime){
float precastSize=GetPlayer()->castPrepAbility->precastInfo.size;
float precastRange=GetPlayer()->castPrepAbility->precastInfo.range;
vf2d scale=vf2d{precastSize,precastSize}*2/3.f;
vf2d centerPoint=GetPlayer()->GetWorldAimingLocation()-vf2d{GFX["circle.png"].Sprite()->width*scale.x/2,GFX["circle.png"].Sprite()->height*scale.y/2};
vf2d centerPoint=GetPlayer()->GetWorldAimingLocation()-vf2d{GFX["assets/circle.png"].Sprite()->width*scale.x/2,GFX["assets/circle.png"].Sprite()->height*scale.y/2};
float distance=float(sqrt(pow(player->GetX()-GetPlayer()->GetWorldAimingLocation().x,2)+pow(player->GetY()-GetPlayer()->GetWorldAimingLocation().y,2)));
if(distance>precastRange){//Clamp the distance.
vf2d pointToCursor = {GetPlayer()->GetWorldAimingLocation().x-player->GetX(),GetPlayer()->GetWorldAimingLocation().y-player->GetY()};
pointToCursor=pointToCursor.norm()*precastRange;
vf2d centerPoint=player->GetPos()+pointToCursor-vf2d{GFX["circle.png"].Sprite()->width*scale.x/2,GFX["circle.png"].Sprite()->height*scale.y/2};
view.DrawDecal(centerPoint,GFX["circle.png"].Decal(),scale,{255,0,0,96});
vf2d centerPoint=player->GetPos()+pointToCursor-vf2d{GFX["assets/circle.png"].Sprite()->width*scale.x/2,GFX["assets/circle.png"].Sprite()->height*scale.y/2};
view.DrawDecal(centerPoint,GFX["assets/circle.png"].Decal(),scale,{255,0,0,96});
} else {
view.DrawDecal(centerPoint,GFX["circle.png"].Decal(),scale,{255,0,0,96});
view.DrawDecal(centerPoint,GFX["assets/circle.png"].Decal(),scale,{255,0,0,96});
}
}
};
if(!player->OnUpperLevel()){
RenderPrecastTargetingIndicator();
}
#pragma region Foreground Rendering Preparation
for(TileGroup&group:foregroundTileGroups){
if(view.IsRectVisible(group.GetRange().pos,group.GetRange().size)){
@ -1469,7 +1499,7 @@ void AiL::RenderWorld(float fElapsedTime){
player->rendered=true;
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
if(player->IsUsingAdditiveBlending())SetDecalMode(DecalMode::ADDITIVE);
else SetDecalMode(DecalMode::NORMAL);
@ -1514,7 +1544,7 @@ void AiL::RenderWorld(float fElapsedTime){
player->rendered=true;
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
RenderPlayer(player->GetPos(),{1,1});
}
@ -1574,7 +1604,7 @@ void AiL::RenderWorld(float fElapsedTime){
player->rendered=true;
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
if(player->IsUsingAdditiveBlending())SetDecalMode(DecalMode::ADDITIVE);
else SetDecalMode(DecalMode::NORMAL);
@ -1630,12 +1660,12 @@ void AiL::RenderWorld(float fElapsedTime){
int tileID=bridgeLayer->tiles[y][x]-1;
if(tileID!=-1){
TilesheetData tileSheet=GetTileSheet(currentLevel,tileID);
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int tileSheetX=tileSheetIndex%tileSheetWidth;
int tileSheetY=tileSheetIndex/tileSheetWidth;
view.DrawPartialDecal(vi2d{x,y}*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},MAP_TILESETS.at(tileSheet.tilesetName).tileset->Decal(),vi2d{tileSheetX,tileSheetY}*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},{255,255,255,uint8_t(255-bridgeFadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
view.DrawPartialDecal(vi2d{x,y}*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},GFX[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Decal(),vi2d{tileSheetX,tileSheetY}*game->GetCurrentMapData().tilewidth,{float(MAP_TILESETS.at(tileSheet.tilesetName).tilewidth),float(MAP_TILESETS.at(tileSheet.tilesetName).tileheight)},{255,255,255,uint8_t(255-bridgeFadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
#ifdef _DEBUG
if("debug_collision_boxes"_I){
if(MAP_TILESETS.at(tileSheet.tilesetName).collision.find(tileSheetIndex)!=MAP_TILESETS.at(tileSheet.tilesetName).collision.end()){
@ -1764,7 +1794,7 @@ void AiL::RenderWorld(float fElapsedTime){
player->rendered=true;
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
if(player->IsUsingAdditiveBlending())SetDecalMode(DecalMode::ADDITIVE);
else SetDecalMode(DecalMode::NORMAL);
@ -1827,7 +1857,7 @@ void AiL::RenderWorld(float fElapsedTime){
player->rendered=true;
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
if(player->IsUsingAdditiveBlending())SetDecalMode(DecalMode::ADDITIVE);
else SetDecalMode(DecalMode::NORMAL);
@ -1881,7 +1911,7 @@ void AiL::RenderWorld(float fElapsedTime){
player->rendered=true;
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
RenderPlayer(player->GetPos(),{1,1});
}
@ -1954,11 +1984,11 @@ void AiL::RenderHud(){
geom2d::line<float>aimingLine=geom2d::line<float>(view.WorldToScreen(player->GetPos()),aimingLocation);
DrawRotatedDecal(aimingLocation,GFX["aiming_target.png"].Decal(),0.f,GFX["aiming_target.png"].Sprite()->Size()/2,{1.0f,1.0f},{255,255,255,128});
DrawRotatedDecal(aimingLocation,GFX["assets/aiming_target.png"].Decal(),0.f,GFX["assets/aiming_target.png"].Sprite()->Size()/2,{1.0f,1.0f},{255,255,255,128});
vf2d lineScale=vf2d(GFX["aiming_line.png"].Sprite()->Size())*vf2d{aimingDist/GFX["aiming_line.png"].Sprite()->width,1};
vf2d lineScale=vf2d(GFX["assets/aiming_line.png"].Sprite()->Size())*vf2d{aimingDist/GFX["assets/aiming_line.png"].Sprite()->width,1};
DrawPartialRotatedDecal(view.WorldToScreen(player->GetPos()),GFX["aiming_line.png"].Decal(),aimingLine.vector().polar().y,{0,0},{0,0},lineScale,vf2d{aimingDist,1.f}/lineScale,{255,255,255,192});
DrawPartialRotatedDecal(view.WorldToScreen(player->GetPos()),GFX["assets/aiming_line.png"].Decal(),aimingLine.vector().polar().y,{0,0},{0,0},lineScale,vf2d{aimingDist,1.f}/lineScale,{255,255,255,192});
}
}
};
@ -1974,20 +2004,20 @@ void AiL::RenderHud(){
const float yPos{std::clamp(view.WorldToScreen(bossIndicator).y,0.f,view.GetWorldVisibleArea().y)};
if(bossIndicator.x<view.GetWorldTL().x){ //Left-side indicator
DrawRotatedDecal({0,yPos},GFX["bossIndicator.png"].Decal(),0.f,{0,16},{8,1},flicker?RED:DARK_RED);
DrawRotatedDecal({0,yPos},GFX["assets/bossIndicator.png"].Decal(),0.f,{0,16},{8,1},flicker?RED:DARK_RED);
}else
if(bossIndicator.x>view.GetWorldBR().x){
DrawRotatedDecal({float(ScreenWidth()-8),yPos},GFX["bossIndicator.png"].Decal(),0.f,{0,16},{8,1},flicker?RED:DARK_RED);
DrawRotatedDecal({float(ScreenWidth()-8),yPos},GFX["assets/bossIndicator.png"].Decal(),0.f,{0,16},{8,1},flicker?RED:DARK_RED);
}
#pragma endregion
#pragma region Top+Bottom Indicators
const float xPos{std::clamp(view.WorldToScreen(bossIndicator).x,0.f,view.GetWorldVisibleArea().x)};
if(bossIndicator.y<view.GetWorldTL().y){ //Left-side indicator
DrawRotatedDecal({xPos,4},GFX["bossIndicator.png"].Decal(),PI/2,{0.5f,16.f},{8,1},flicker?RED:DARK_RED);
DrawRotatedDecal({xPos,4},GFX["assets/bossIndicator.png"].Decal(),PI/2,{0.5f,16.f},{8,1},flicker?RED:DARK_RED);
}else
if(bossIndicator.y>view.GetWorldBR().y){
DrawRotatedDecal({xPos,float(ScreenHeight()-4)},GFX["bossIndicator.png"].Decal(),PI/2,{0.5f,16.f},{8,1},flicker?RED:DARK_RED);
DrawRotatedDecal({xPos,float(ScreenHeight()-4)},GFX["assets/bossIndicator.png"].Decal(),PI/2,{0.5f,16.f},{8,1},flicker?RED:DARK_RED);
}
#pragma endregion
}
@ -2032,14 +2062,14 @@ void AiL::RenderHud(){
Input::SetLightbar(healthOutlineCol);
}
DrawDecal({2,2},GFX["heart_outline.png"].Decal(),{1.f,1.f},healthOutlineCol);
const Decal*heartImg{GFX["heart.png"].Decal()};
if(player->GetShield()>0)heartImg=GFX["shield_heart.png"].Decal();
DrawDecal({2,2},GFX["assets/heart_outline.png"].Decal(),{1.f,1.f},healthOutlineCol);
const Decal*heartImg{GFX["assets/heart.png"].Decal()};
if(player->GetShield()>0)heartImg=GFX["assets/shield_heart.png"].Decal();
int healthRatio{int((float(healthCounter.GetDisplayValue())/player->GetMaxHealth())*100)};
int manaRatio{int((float(manaCounter.GetDisplayValue())/player->GetMaxMana())*100)};
DrawPartialDecal(vi2d{2,2+int((15*(100-healthRatio))/100.f)},const_cast<Decal*>(heartImg),vi2d{0,int(15*(100-healthRatio)/100.f)},vi2d{17,int(15*healthRatio/100.f)});
DrawDecal({2,20},GFX["mana_outline.png"].Decal());
DrawPartialDecal(vi2d{2,20+int((15*(100-manaRatio))/100.f)},GFX["mana.png"].Decal(),vi2d{0,int(15*(100-manaRatio)/100.f)},vi2d{17,int(15*manaRatio/100.f)});
DrawDecal({2,20},GFX["assets/mana_outline.png"].Decal());
DrawPartialDecal(vi2d{2,20+int((15*(100-manaRatio))/100.f)},GFX["assets/mana.png"].Decal(),vi2d{0,int(15*(100-manaRatio)/100.f)},vi2d{17,int(15*manaRatio/100.f)});
std::string text=player->GetHealth()>0?std::to_string(healthCounter.GetDisplayValue()+shieldCounter.GetDisplayValue()):"X";
std::string text_mana=std::to_string(manaCounter.GetDisplayValue());
@ -2096,7 +2126,7 @@ void AiL::RenderHud(){
const float vignetteTotalDisplayTime="Interface.Vignette Appearance Time"_F+"Interface.Vignette Fadeout Time"_F;
if(vignetteDisplayTime<"Interface.Vignette Fadeout Time"_F)vignetteOverlayCol.a=util::lerp(0,255,vignetteDisplayTime/"Interface.Vignette Fadeout Time"_F);
DrawDecal({0,0},GFX["vignette.png"].Decal(),{1.f,1.f},vignetteOverlayCol);
DrawDecal({0,0},GFX["assets/vignette.png"].Decal(),{1.f,1.f},vignetteOverlayCol);
}
void AiL::RenderCooldowns(){
@ -2133,7 +2163,7 @@ void AiL::RenderCooldowns(){
DrawRotatedDecal(iconPos,GFX[a.icon].Decal(),0,{12,12},iconScale,{255,255,255,uint8_t(a.charges==0?64:255)});
if(circle){
if(a.charges==0)DrawPie(iconPos,12,360-(a.cooldown/a.GetCooldownTime())*360,PixelLerp(a.barColor1,a.barColor2,(a.cooldown/a.GetCooldownTime())));
else DrawPieArc("safeIndicatorGradient.png",iconPos,11.5f,360-(a.cooldown/a.GetCooldownTime())*360,WHITE);
else DrawPieArc("assets/safeIndicatorGradient.png",iconPos,11.5f,360-(a.cooldown/a.GetCooldownTime())*360,WHITE);
}else{
DrawSquarePie(iconPos,10,360-(a.cooldown/a.GetCooldownTime())*360,PixelLerp(a.barColor1,a.barColor2,(a.cooldown/a.GetCooldownTime())));
}
@ -2146,8 +2176,8 @@ void AiL::RenderCooldowns(){
DrawRotatedDecal(iconPos,GFX[a.icon].Decal(),0,{12,12},iconScale,WHITE);
}
Decal*overlayIcon=GFX["skill_overlay_icon.png"].Decal();
if(!circle)overlayIcon=GFX["square_skill_overlay_icon.png"].Decal();
Decal*overlayIcon=GFX["assets/skill_overlay_icon.png"].Decal();
if(!circle)overlayIcon=GFX["assets/square_skill_overlay_icon.png"].Decal();
DrawDecal(pos,overlayIcon);
if(a.input->Held()){
if(circle){
@ -2162,8 +2192,8 @@ void AiL::RenderCooldowns(){
if(HasEnchantWithAbilityAffected)shortNameCol={255,255,0};
if(player->GetMana()<a.manaCost){
Decal*overlayOverlayIcon=GFX["skill_overlay_icon_overlay.png"].Decal();
if(!circle)overlayOverlayIcon=GFX["square_skill_overlay_icon_empty.png"].Decal();
Decal*overlayOverlayIcon=GFX["assets/skill_overlay_icon_overlay.png"].Decal();
if(!circle)overlayOverlayIcon=GFX["assets/square_skill_overlay_icon_empty.png"].Decal();
DrawDecal(pos,overlayOverlayIcon,{1,1},DARK_RED);
shortNameCol=RED;
manaCostShadowCol=DARK_RED;
@ -2184,7 +2214,7 @@ void AiL::RenderCooldowns(){
vf2d qtySize=vf2d{GetTextSize(amtString)}*vf2d{0.5f,0.75f};
DrawShadowStringDecal(iconPos+vf2d{8,8}-qtySize/2,amtString,Pixel{0xE0E0E0},BLACK,{0.5f,0.75f},{0.5f,0.75f});
}else{
DrawDecal(pos,GFX["square_skill_overlay_icon_empty.png"].Decal(),{1,1},DARK_RED);
DrawDecal(pos,GFX["assets/square_skill_overlay_icon_empty.png"].Decal(),{1,1},DARK_RED);
shortNameCol=RED;
manaCostShadowCol=DARK_RED;
keyDisplayCol=RED;
@ -2294,17 +2324,16 @@ void AiL::InitializeLevel(std::string mapFile,MapName map){
void AiL::LoadLevel(MapName map,MusicChange changeMusic){
LoadingScreen::loading=true;
LoadingScreen::Reset();
game->loadingWaitTime=0.f;
_PrepareLevel(map,changeMusic);
}
void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
LoadingScreen::Reset();
previousLevel=currentLevel;
currentLevel=map;
game->loadingWaitTime=0.f;
#pragma region Reset all data (Loading phase 1)
LoadingScreen::AddPhase([&](){
LoadingScreen::AddPhase([&,map=map](){
previousLevel=currentLevel;
currentLevel=map;
if(game->MAP_DATA.count(GetCurrentLevel())==0)ERR(std::format("WARNING! Could not load map {}! Does not exist! Refer to levels.txt for valid maps.",map));
if(game->MAP_DATA[GetCurrentLevel()].GetMapType()==Map::MapType::HUB&&GameState::STATE!=GameState::states[States::GAME_HUB]&&!game->MapCacheIsRunning)ERR("WARNING! A hub level should only be initiated in the GAME_HUB game state!");
@ -2317,7 +2346,6 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
ResetLevelStates();
STEAMINPUT( //This is kind of a hack to refresh the in-game controls handle and button icons if for some reason it's not setup correctly.
Input::LoadSteamButtonIcons();
Input::ingameControlsHandle=SteamInput()->GetActionSetHandle("InGameControls");
)
@ -2326,6 +2354,10 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
return true;
});
#pragma endregion
LoadingScreen::AddPhase([&](){
GFX.FreeUpMemory();
return true;
});
#ifdef __EMSCRIPTEN__
LoadingScreen::AddPhase([&](){
@ -2425,8 +2457,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
int tileID=layer.tiles[y][x]-1;
if(tileID!=-1){
TilesheetData tileSheet=GetTileSheet(currentLevel,tileID);
int tileSheetWidth=MAP_TILESETS[tileSheet.tilesetName].tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=MAP_TILESETS[tileSheet.tilesetName].tileset->Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS[tileSheet.tilesetName].tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=GFX_FORCE[MAP_TILESETS[tileSheet.tilesetName].tileset].Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int realTileSheetIndex=(tileID%1000000)-(tileSheet.firstgid-1);
int tileSheetX=realTileSheetIndex%tileSheetWidth;
@ -2451,8 +2483,8 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
if(!loopAll&&&layer==&layer2){layer2ID++;continue;};
int tileID=layer2.tiles[pos.y][pos.x]-1;
TilesheetData tileSheet=GetTileSheet(currentLevel,tileID%1000000);
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int realTileSheetIndex=(tileID%1000000)-(tileSheet.firstgid-1);
int tileSheetX=realTileSheetIndex%tileSheetWidth;
@ -2543,7 +2575,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
if(tile.tileSheet.tilesetName==foundTile.tileSheet.tilesetName){ //Let's first see if they are even in the same tileset.
//Let's get how many tiles wide this tile sheet is.
int tileWidth=MAP_TILESETS.at(tile.tileSheet.tilesetName).tilewidth;
int tileSheetWidth=MAP_TILESETS.at(tile.tileSheet.tilesetName).tileset->Sprite()->width/tileWidth;
int tileSheetWidth=GFX[MAP_TILESETS.at(tile.tileSheet.tilesetName).tileset].Sprite()->width/tileWidth;
if(IsAdjacent(tile.tileID,foundTile.tileID,tileSheetWidth)){
group.insert({loc,tile});//We add this tile to the group! It is adjacent!
groupFound=true;
@ -2653,10 +2685,12 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
#pragma endregion
//Until the audio has stopped (by waiting for a set amount of time), we will respect the audio engine's wishes and not proceed.
LoadingScreen::DeferLoad([&](){return audioEngine.playBGMWaitTime==0.f;}); //This is the wait time for the audio engine to finish.
LoadingScreen::DeferLoad(
[&](){return audioEngine.playBGMWaitTime==0.f;}
); //This is the wait time for the audio engine to finish.
#pragma region Audio Channel Loading (Count based on Audio::GetPrepareBGMLoopIterations)
if(MAP_DATA[GetCurrentLevel()].bgmSongName.length()>0){
for(int i=0;i<Audio::GetPrepareBGMLoopIterations(MAP_DATA[GetCurrentLevel()].bgmSongName);i++){
if(MAP_DATA[map].bgmSongName.length()>0){
for(int i=0;i<Audio::GetPrepareBGMLoopIterations(MAP_DATA[map].bgmSongName);i++){
LoadingScreen::AddPhase([&](){
Audio::UpdateLoop();
return true;
@ -3264,18 +3298,10 @@ bool AiL::OnUserDestroy(){
delete map.optimizedTile;
}
}
for(auto&[key,value]:MAP_TILESETS){
delete value.tileset;
}
for(auto&[key,value]:GameState::states){
delete value;
}
Menu::CleanupAllMenus();
for(auto&[key,value]:MonsterData::imgs){
delete value;
}
BACKDROP_DATA.clear();
FOREDROP_DATA.clear();
return true;
}else{
return false; //Something is preventing us from quitting. We wait patiently...
@ -3283,6 +3309,16 @@ bool AiL::OnUserDestroy(){
}
void AiL::InitializeLevels(){
ZONE_LIST["LowerZone"];
ZONE_LIST["UpperZone"];
ZONE_LIST["EndZone"];
ZONE_LIST["BossArena"];
ZONE_LIST["Focus Area"];
ZONE_LIST["TrialClock"];
ZONE_LIST["LowerBridgeCollision"];
ZONE_LIST["Hiding Spot"];
for(auto&[key,size]:DATA["Levels"]){
InitializeLevel("map_path"_S+DATA["Levels"][key]["Map File"].GetString(),key);
}
@ -3317,15 +3353,6 @@ void AiL::InitializeLevels(){
}
}
for(auto&[key,size]:DATA["Backdrops"]){
Renderable&backdrop=BACKDROP_DATA[key];
LoadResource(backdrop,"backdrop_directory"_S+DATA["Backdrops"][key].GetString(),false,false);
}
for(auto&[key,size]:DATA["Foredrops"]){
Renderable&backdrop=FOREDROP_DATA[key];
LoadResource(backdrop,"backdrop_directory"_S+DATA["Foredrops"][key].GetString(),false,false);
}
Test::RunMapTests();
}
@ -3643,6 +3670,7 @@ void AiL::InitializeGraphics(){
circleCooldownPoints.clear();
squareCircleCooldownPoints.clear();
GFX.Reset();
THEME_DATA.Reset();
Menu::themes.Reset();
const float innerArcRatio{0.85f};
@ -3662,23 +3690,6 @@ void AiL::InitializeGraphics(){
#pragma endregion
}
for(auto&val:DATA["Images"].GetKeys()){
std::string key=val.first;
std::string imgFile=DATA["Images"][key].GetString(0);
LOG("Loading image "+imgFile+"...");
bool filtering=false;
bool clamping=false;
if(DATA["Images"][key].GetValueCount()>1){
filtering=bool(DATA["Images"][key].GetInt(1));
}
if(DATA["Images"][key].GetValueCount()>2){
clamping=bool(DATA["Images"][key].GetInt(2));
}
if(!GFX.count(imgFile)&&LoadResource(GFX[imgFile],"GFX_Prefix"_S+imgFile,filtering,clamping)!=rcode::OK){
ERR(" WARNING! Failed to load "+imgFile+" from game pack!")
}
}
//Specifically split up the 9 patch image into multiple pieces for each theme.
const auto&unordered_map=DATA["Themes"].GetKeys();
std::vector<std::pair<std::string,size_t>>mappedKeys;
@ -3690,19 +3701,17 @@ void AiL::InitializeGraphics(){
for(auto&[key,value]:mappedKeys){
std::string themeName=key;
std::string imgPath=DATA["Themes"][themeName]["filename"].GetString();
Renderable&img=GFX["theme_img_directory"_S+imgPath+".png"];
LoadResource(img,"GFX_Prefix"_S+"theme_img_directory"_S+imgPath+".png");
Renderable&sourceImg=img;
const Renderable&img=GFX_FORCE["assets/"+"theme_img_directory"_S+imgPath+".png"];
Pixel::Mode prevMode=GetPixelMode();
SetPixelMode(Pixel::Mode::MASK);
for(int x=0;x<3;x++){
for(int y=0;y<3;y++){
std::string patchKey=themeName+"_"+std::to_string(x)+std::to_string(y)+".png";
Renderable&patchImg=GFX[patchKey];
Renderable&patchImg=THEME_DATA[patchKey];
patchImg.Create("Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1],false,false);
SetDrawTarget(patchImg.Sprite());
Clear(BLANK);
DrawPartialSprite({0,0},sourceImg.Sprite(),{x*"Interface.9PatchSize"_i[0],y*"Interface.9PatchSize"_i[1]},{"Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1]});
DrawPartialSprite({0,0},img.Sprite(),{x*"Interface.9PatchSize"_i[0],y*"Interface.9PatchSize"_i[1]},{"Interface.9PatchSize"_i[0],"Interface.9PatchSize"_i[1]});
patchImg.Decal()->Update();
SetDrawTarget(nullptr);
}
@ -3714,33 +3723,22 @@ void AiL::InitializeGraphics(){
if(DATA["Themes"][themeName].HasProperty("CustomBack")){
std::string backPath=DATA["Themes"][themeName]["CustomBack"].GetString();
LOG(" Custom background detected, Loading "<<backPath<<"...");
if(!GFX.count(backPath)){
Renderable&background=GFX[backPath];
LoadResource(background,"GFX_Prefix"_S+backPath,false,false);
}
Menu::themes[themeName]=Theme{themeName,imgPath,bool(DATA["Themes"][themeName]["Tiled"].GetInt()),DATA["Themes"][themeName]["ButtonColor"].GetPixel(),DATA["Themes"][themeName]["HighlightColor"].GetPixel(),GFX.at(backPath).Decal()};
Menu::themes[themeName]=Theme{themeName,imgPath,bool(DATA["Themes"][themeName]["Tiled"].GetInt()),DATA["Themes"][themeName]["ButtonColor"].GetPixel(),DATA["Themes"][themeName]["HighlightColor"].GetPixel(),"assets/"+backPath};
}else{
Menu::themes[themeName]=Theme{themeName,imgPath,bool(DATA["Themes"][themeName]["Tiled"].GetInt()),DATA["Themes"][themeName]["ButtonColor"].GetPixel(),DATA["Themes"][themeName]["HighlightColor"].GetPixel()};
}
}
THEME_DATA.SetInitialized();
//These two create item graphics, so they should be after the GFX structure gets reset!
ItemAttribute::Initialize();
ItemInfo::InitializeItems();
for(std::string img:VisualNovel::graphicsToLoad){
Renderable&image=GFX[img];
LoadResource(image,"GFX_Prefix"_S+img);
}
LOG(VisualNovel::graphicsToLoad.size()<<" images for visual novel engine have been loaded.");
SetFontSprite("GFX_Prefix"_S+"font.png","GFX_Prefix"_S+"font_shadow.png",&gamepack,"GENERATE_GAMEPACK"_B);
LOG("Custom font loaded.");
Menu::themes.SetInitialized();
LOG(Menu::themes.size()<<" themes have been loaded.");
GFX.SetInitialized();
LOG(GFX.size()<<" images have been loaded.");
}
const Map&AiL::GetCurrentMap()const{
@ -3897,7 +3895,7 @@ void AiL::SetLoadoutItem(int slot,std::string itemName){
inputGroup=&Player::KEY_ITEM3;
}break;
}
Ability itemAbility{itemName,"",GetLoadoutItem(slot).lock()->Description(),"Item.Item Cooldown Time"_F,0,inputGroup,"items/"+itemName+".png",VERY_DARK_RED,DARK_RED,PrecastData{GetLoadoutItem(slot).lock()->CastTime(),GetLoadoutItem(slot).lock()->CastRange(),GetLoadoutItem(slot).lock()->CastSize()},true};
Ability itemAbility{itemName,"",GetLoadoutItem(slot).lock()->Description(),"Item.Item Cooldown Time"_F,0,inputGroup,"assets/items/"+itemName+".png",VERY_DARK_RED,DARK_RED,PrecastData{GetLoadoutItem(slot).lock()->CastTime(),GetLoadoutItem(slot).lock()->CastRange(),GetLoadoutItem(slot).lock()->CastSize()},true};
itemAbility.actionPerformedDuringCast=GetLoadoutItem(slot).lock()->UseDuringCast();
itemAbility.itemAbility=true;
@ -3928,8 +3926,6 @@ void AiL::SetLoadoutItem(int slot,std::string itemName){
}break;
}
}else{
ERR("Trying to set item "+itemName+" in Loadout slot "+std::to_string(slot)+" when said item does not exist in our inventory!");
}
}
@ -4014,7 +4010,7 @@ void AiL::RenderFadeout(){
fadeOutDuration=std::max(0.f,fadeOutDuration-GetElapsedTime());
if(fadeOutDuration==0){
SetMosaicEffect(1U);
GameState::_ChangeState(transitionState);
fadeOutComplete=true;
}else{
SetMosaicEffect(util::lerp(uint8_t(1),mosaicEffectTransition,1-(fadeOutDuration/fadeOutTotalTime)));
alpha=uint8_t(util::lerp(0,255,1-(fadeOutDuration/fadeOutTotalTime)));
@ -4306,19 +4302,6 @@ const bool AiL::GameInitialized()const {
return gameInitialized;
}
rcode AiL::LoadResource(Renderable&renderable,std::string_view imgPath,bool filter,bool clamp){
rcode returnCode;
if(gamepack.Loaded()){
returnCode=renderable.Load(std::string(imgPath),&gamepack,filter,clamp);
}else{
returnCode=renderable.Load(std::string(imgPath),nullptr,filter,clamp);
if("GENERATE_GAMEPACK"_B){
gamepack.AddFile(std::string(imgPath));
}
}
return returnCode;
}
void AiL::UpdateMonsters(){
for(std::shared_ptr<Monster>&m:MONSTER_LIST){
if(m->markedForDeletion){
@ -4368,6 +4351,11 @@ void AiL::ShowDamageVignetteOverlay(const Pixel col){
}
void AiL::GlobalGameUpdates(){
if(fadeOutComplete){
fadeOutComplete=false;
GameState::_ChangeState(transitionState);
}
bossIndicatorPos={};
levelTime+=GetElapsedTime();
@ -4463,8 +4451,8 @@ void AiL::ResetCompletedStageFlag(){
prevStageCompleted=false;
}
void AiL::ComputeModeColors(TilesetData&tileset){
for(int y=0;y<tileset.tileset->Sprite()->height/tileset.tileheight;y++){
for(int x=0;x<tileset.tileset->Sprite()->width/tileset.tilewidth;x++){
for(int y=0;y<GFX_FORCE[tileset.tileset].Sprite()->height/tileset.tileheight;y++){
for(int x=0;x<GFX_FORCE[tileset.tileset].Sprite()->width/tileset.tilewidth;x++){
#pragma region Individual tile iteration
std::unordered_map<uint32_t,int>pixelCounts;
Pixel modeCol=BLANK;
@ -4473,7 +4461,7 @@ void AiL::ComputeModeColors(TilesetData&tileset){
for(int pixelY=0;pixelY<tileset.tileheight;pixelY++){
for(int pixelX=0;pixelX<tileset.tilewidth;pixelX++){
vi2d targetPixel=vi2d{pixelX,pixelY}+pixelOffset;
Pixel tileCol=tileset.tileset->Sprite()->GetPixel(targetPixel);
Pixel tileCol=GFX_FORCE[tileset.tileset].Sprite()->GetPixel(targetPixel);
pixelCounts[tileCol.n]++;
if(pixelCounts[tileCol.n]>maxCount){
modeCol=tileCol;
@ -4717,12 +4705,11 @@ void AiL::SetupLevel(Map&map){
std::string baseSourceDir=tag.data["source"].substr(slashMarkerSourceDir+1);
if(MAP_TILESETS.find("assets/maps/"+baseSourceDir)==MAP_TILESETS.end()){
TSXParser tileset("map_path"_S+tag.data["source"]);
Renderable*r=NEW Renderable();
std::string mapPath="assets/maps/"+tileset.GetData().ImageData.data["source"];
if(tileset.GetData().tilewidth==0||tileset.GetData().tileheight==0)ERR(std::format("WARNING! Failed to load map {}! Found a tileset {} with a width of {} and height of {}. Zero values are not allowed!",map.GetMapStageName(),"assets/maps/"+baseSourceDir,tileset.GetData().tilewidth,tileset.GetData().tileheight));
MAP_TILESETS["assets/maps/"+baseSourceDir].tilewidth=tileset.GetData().tilewidth;
MAP_TILESETS["assets/maps/"+baseSourceDir].tileheight=tileset.GetData().tileheight;
MAP_TILESETS["assets/maps/"+baseSourceDir].tileset=r;
MAP_TILESETS["assets/maps/"+baseSourceDir].tileset=mapPath;
MAP_TILESETS["assets/maps/"+baseSourceDir].foregroundTiles=tileset.GetData().ForegroundTileData;
MAP_TILESETS["assets/maps/"+baseSourceDir].upperForegroundTiles=tileset.GetData().UpperForegroundTileData;
MAP_TILESETS["assets/maps/"+baseSourceDir].collision=tileset.GetData().CollisionData;
@ -4733,55 +4720,7 @@ void AiL::SetupLevel(Map&map){
MAP_TILESETS["assets/maps/"+baseSourceDir].isTerrain=tileset.GetData().isTerrain;
MAP_TILESETS["assets/maps/"+baseSourceDir].collision.SetInitialized();
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);
}else
if(std::filesystem::exists(mapPath)){
r->Load(mapPath);
if("GENERATE_GAMEPACK"_B){
gamepack.AddFile(mapPath);
}
}else{
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;
int tileYCount=tileset.GetData().imageheight/tileset.GetData().tileheight;
vi2d tileSize={tileset.GetData().tilewidth,tileset.GetData().tileheight};
const int colorCombinations=255*6;
for(int y=0;y<tileYCount;y++){
for(int x=0;x<tileXCount;x++){
int colorCycleIndex=(y*255+x)%colorCombinations;
Pixel tileCol=WHITE;
if(colorCycleIndex<255){
tileCol={uint8_t(colorCycleIndex%255),0,0};
}else
if(colorCycleIndex<255*2){
tileCol={0,uint8_t(colorCycleIndex%255),0};
}else
if(colorCycleIndex<255*3){
tileCol={0,0,uint8_t(colorCycleIndex%255)};
}else
if(colorCycleIndex<255*4){
tileCol={uint8_t(colorCycleIndex%255),uint8_t(colorCycleIndex%255),0};
}else
if(colorCycleIndex<255*5){
tileCol={0,uint8_t(colorCycleIndex%255),uint8_t(colorCycleIndex%255)};
}else{
tileCol={uint8_t(colorCycleIndex%255),0,uint8_t(colorCycleIndex%255)};
}
FillRect(vi2d{x,y}*tileSize,tileSize,tileCol);
DrawRect(vi2d{x,y}*tileSize,tileSize,GREY);
DrawString(vi2d{x,y}*tileSize+vi2d{1,1},std::to_string(y*255+x),DARK_GREY);
}
}
SetDrawTarget(nullptr);
r->Decal()->Update();
}
ComputeModeColors(MAP_TILESETS["assets/maps/"+baseSourceDir]);
}
}
@ -4800,13 +4739,13 @@ void AiL::SetupLevel(Map&map){
int tileID=layer.tiles[y][x]-1;
if(tileID!=-1){
TilesheetData tileSheet=GetTileSheet(map.GetMapKeyName(),tileID);
int tileSheetWidth=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetWidth=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->width/MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
int tileSheetHeight=GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite()->height/MAP_TILESETS.at(tileSheet.tilesetName).tileheight;
int tileSheetIndex=tileID-(tileSheet.firstgid-1);
int tileSheetX=tileSheetIndex%tileSheetWidth;
int tileSheetY=tileSheetIndex/tileSheetWidth;
vi2d pos=vi2d{x,y}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth;
DrawPartialSprite(pos,MAP_TILESETS.at(tileSheet.tilesetName).tileset->Sprite(),vi2d{tileSheetX,tileSheetY}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,MAP_TILESETS.at(tileSheet.tilesetName).tileheight});
DrawPartialSprite(pos,GFX_FORCE[MAP_TILESETS.at(tileSheet.tilesetName).tileset].Sprite(),vi2d{tileSheetX,tileSheetY}*MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,{MAP_TILESETS.at(tileSheet.tilesetName).tilewidth,MAP_TILESETS.at(tileSheet.tilesetName).tileheight});
}
}
}

View File

@ -103,6 +103,7 @@ class AiL : public olc::PixelGameEngine
{
friend class GameState;
friend class State_GameRun;
friend class VisualNovel;
friend class SaveFile;
friend class sig::Animation;
friend class Audio;
@ -179,6 +180,7 @@ public:
double levelTime=0.;
Camera2D camera;
safeunorderedmap<MapName,Map>MAP_DATA;
safeunorderedmap<std::string,Renderable>THEME_DATA;
ResourcePack gamepack;
public:
@ -311,7 +313,6 @@ public:
//Returns the last time the mouse was moved or interacted with.
const float LastMouseMovement()const;
const bool GameInitialized()const;
rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true);
void UpdateMonsters();
void ActivateActionSetForAllControllers(InputActionSetHandle_t actionSetHandle);
const float GetEncounterDuration()const;
@ -445,6 +446,7 @@ private:
bool prevStageCompleted=false;
vf2d windSpd{};
bool MapCacheIsRunning{false};
bool fadeOutComplete{false};
void ValidateGameStatus();
void _PrepareLevel(MapName map,MusicChange changeMusic);
@ -460,7 +462,7 @@ private:
SteamStatsReceivedHandler*steamStatsReceivedHandlerListener=nullptr;
std::optional<vf2d>bossIndicatorPos{};
bool steamAPIEnabled{true};
Overlay hudOverlay{"pixel.png",BLANK};
Overlay hudOverlay{"assets/pixel.png",BLANK};
float targetZoom{1.f};
float zoomAdjustSpeed{0.1f};
std::vector<std::tuple<std::weak_ptr<Monster>,StackCount,MarkTime>>lockOnTargets;

View File

@ -36,90 +36,90 @@ All rights reserved.
*/
#pragma endregion
#include "Animation.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "safemap.h"
#include <ranges>
#include"AdventuresInLestoria.h"
#include"DEFINES.h"
#include"safemap.h"
#include<ranges>
#include"GraphicsManager.h"
INCLUDE_game
INCLUDE_ANIMATION_DATA
INCLUDE_DATA
INCLUDE_GFX
void sig::Animation::InitializeAnimations(){
ANIMATION_DATA.Reset();
auto CreateStillAnimation=[&](std::string imgName,vf2d size,AnimationData data={}){
auto CreateStillAnimation=[&](std::string imgName,AnimationData data={}){
Animate2D::FrameSequence anim(data.frameDuration,data.style);
anim.AddFrame({&GFX[imgName],{{0,0},size}});
anim.AddFrame({imgName});
ANIMATION_DATA[imgName]=anim;
};
auto CreateHorizontalAnimationSequence=[&](std::string imgName,int frameCount,vf2d size,AnimationData data={}){
Animate2D::FrameSequence anim(data.frameDuration,data.style);
for(int i=0;i<frameCount;i++){
anim.AddFrame({&GFX[imgName],{{int(i*size.x),0},size}});
anim.AddFrame({imgName,geom2d::rect<int32_t>{{int(i*size.x),0},size}});
}
ANIMATION_DATA[imgName]=anim;
};
auto SetupClassWalkIdleAnimations=[&](Renderable&sheet,std::string className){
auto SetupClassWalkIdleAnimations=[&](const ImgFilename&sheetFilename,std::string className){
Animate2D::FrameSequence pl_walk_s{"Player.WalkingFrameSpd"_F};
pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{1,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{2,0}*24,{24,24}}});
pl_walk_s.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{1,0}*24,{24,24}}});
pl_walk_s.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{2,0}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_S"]=pl_walk_s;
Animate2D::FrameSequence pl_walk_e{"Player.WalkingFrameSpd"_F};
pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{1,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{2,3}*24,{24,24}}});
pl_walk_e.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{1,3}*24,{24,24}}});
pl_walk_e.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{2,3}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_E"]=pl_walk_e;
Animate2D::FrameSequence pl_walk_w{"Player.WalkingFrameSpd"_F};
pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{1,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{2,2}*24,{24,24}}});
pl_walk_w.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{1,2}*24,{24,24}}});
pl_walk_w.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{2,2}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_W"]=pl_walk_w;
Animate2D::FrameSequence pl_walk_n{"Player.WalkingFrameSpd"_F};
pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{1,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{2,1}*24,{24,24}}});
pl_walk_n.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{1,1}*24,{24,24}}});
pl_walk_n.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{2,1}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_N"]=pl_walk_n;
Animate2D::FrameSequence pl_idle_s;
pl_idle_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_idle_s.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,0}*24,{24,24}}});
ANIMATION_DATA[className+"_IDLE_S"]=pl_idle_s;
Animate2D::FrameSequence pl_idle_e;
pl_idle_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_idle_e.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,3}*24,{24,24}}});
ANIMATION_DATA[className+"_IDLE_E"]=pl_idle_e;
Animate2D::FrameSequence pl_idle_w;
pl_idle_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_idle_w.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,2}*24,{24,24}}});
ANIMATION_DATA[className+"_IDLE_W"]=pl_idle_w;
Animate2D::FrameSequence pl_idle_n;
pl_idle_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
pl_idle_n.AddFrame({sheetFilename,geom2d::rect<int32_t>{vi2d{0,1}*24,{24,24}}});
ANIMATION_DATA[className+"_IDLE_N"]=pl_idle_n;
};
//Warrior animations.
SetupClassWalkIdleAnimations(GFX["nico-warrior.png"],"WARRIOR");
SetupClassWalkIdleAnimations("assets/nico-warrior.png","WARRIOR");
Animate2D::FrameSequence pl_warrior_swing_s(0.05f),pl_warrior_swing_n(0.05f),pl_warrior_swing_e(0.05f),pl_warrior_swing_w(0.05f);
Animate2D::FrameSequence pl_warrior_sonic_swing_s(0.1f,Animate2D::Style::OneShot),pl_warrior_sonic_swing_n(0.1f,Animate2D::Style::OneShot),pl_warrior_sonic_swing_e(0.1f,Animate2D::Style::OneShot),pl_warrior_sonic_swing_w(0.1f,Animate2D::Style::OneShot);
for (int i=0;i<4;i++){
pl_warrior_swing_s.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,0}*24,{24,24}}});
pl_warrior_sonic_swing_s.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,4}*24,{24,24}}});
pl_warrior_swing_s.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,0}*24,{24,24}}});
pl_warrior_sonic_swing_s.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,4}*24,{24,24}}});
}
for (int i=0;i<4;i++){
pl_warrior_swing_n.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,1}*24,{24,24}}});
pl_warrior_sonic_swing_n.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,5}*24,{24,24}}});
pl_warrior_swing_n.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,1}*24,{24,24}}});
pl_warrior_sonic_swing_n.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,5}*24,{24,24}}});
}
for (int i=0;i<4;i++){
pl_warrior_swing_w.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,2}*24,{24,24}}});
pl_warrior_sonic_swing_w.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,6}*24,{24,24}}});
pl_warrior_swing_w.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,2}*24,{24,24}}});
pl_warrior_sonic_swing_w.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,6}*24,{24,24}}});
}
for (int i=0;i<4;i++){
pl_warrior_swing_e.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,3}*24,{24,24}}});
pl_warrior_sonic_swing_e.AddFrame({&GFX["nico-warrior.png"],{vi2d{4+i,7}*24,{24,24}}});
pl_warrior_swing_e.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,3}*24,{24,24}}});
pl_warrior_sonic_swing_e.AddFrame({"assets/nico-warrior.png",geom2d::rect<int32_t>{vi2d{4+i,7}*24,{24,24}}});
}
ANIMATION_DATA["WARRIOR_SWINGSWORD_N"]=pl_warrior_swing_n;
ANIMATION_DATA["WARRIOR_SWINGSWORD_E"]=pl_warrior_swing_e;
@ -131,13 +131,13 @@ void sig::Animation::InitializeAnimations(){
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_W"]=pl_warrior_sonic_swing_w;
//Ranger animations
SetupClassWalkIdleAnimations(GFX["nico-ranger.png"],"RANGER");
SetupClassWalkIdleAnimations("assets/nico-ranger.png","RANGER");
Animate2D::FrameSequence pl_ranger_shoot_s,pl_ranger_shoot_n,pl_ranger_shoot_e,pl_ranger_shoot_w;
for(int i=0;i<3;i++){
pl_ranger_shoot_s.AddFrame({&GFX["nico-ranger.png"],{vi2d{3+i,0}*24,{24,24}}});
pl_ranger_shoot_n.AddFrame({&GFX["nico-ranger.png"],{vi2d{3+i,1}*24,{24,24}}});
pl_ranger_shoot_e.AddFrame({&GFX["nico-ranger.png"],{vi2d{3+i,3}*24,{24,24}}});
pl_ranger_shoot_w.AddFrame({&GFX["nico-ranger.png"],{vi2d{3+i,2}*24,{24,24}}});
pl_ranger_shoot_s.AddFrame({"assets/nico-ranger.png",geom2d::rect<int32_t>{vi2d{3+i,0}*24,{24,24}}});
pl_ranger_shoot_n.AddFrame({"assets/nico-ranger.png",geom2d::rect<int32_t>{vi2d{3+i,1}*24,{24,24}}});
pl_ranger_shoot_e.AddFrame({"assets/nico-ranger.png",geom2d::rect<int32_t>{vi2d{3+i,3}*24,{24,24}}});
pl_ranger_shoot_w.AddFrame({"assets/nico-ranger.png",geom2d::rect<int32_t>{vi2d{3+i,2}*24,{24,24}}});
}
ANIMATION_DATA["RANGER_SHOOT_S"]=pl_ranger_shoot_s;
ANIMATION_DATA["RANGER_SHOOT_N"]=pl_ranger_shoot_n;
@ -145,91 +145,91 @@ void sig::Animation::InitializeAnimations(){
ANIMATION_DATA["RANGER_SHOOT_W"]=pl_ranger_shoot_w;
//Wizard animations
SetupClassWalkIdleAnimations(GFX["nico-wizard.png"],"WIZARD");
SetupClassWalkIdleAnimations("assets/nico-wizard.png","WIZARD");
Animate2D::FrameSequence pl_wizard_idle_attack_s;
pl_wizard_idle_attack_s.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,0}*24,{24,24}}});
pl_wizard_idle_attack_s.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,0}*24,{24,24}}});
ANIMATION_DATA["WIZARD_IDLE_ATTACK_S"]=pl_wizard_idle_attack_s;
Animate2D::FrameSequence pl_wizard_idle_attack_e;
pl_wizard_idle_attack_e.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,3}*24,{24,24}}});
pl_wizard_idle_attack_e.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,3}*24,{24,24}}});
ANIMATION_DATA["WIZARD_IDLE_ATTACK_E"]=pl_wizard_idle_attack_e;
Animate2D::FrameSequence pl_wizard_idle_attack_w;
pl_wizard_idle_attack_w.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,2}*24,{24,24}}});
pl_wizard_idle_attack_w.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,2}*24,{24,24}}});
ANIMATION_DATA["WIZARD_IDLE_ATTACK_W"]=pl_wizard_idle_attack_w;
Animate2D::FrameSequence pl_wizard_idle_attack_n;
pl_wizard_idle_attack_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,1}*24,{24,24}}});
pl_wizard_idle_attack_n.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,1}*24,{24,24}}});
ANIMATION_DATA["WIZARD_IDLE_ATTACK_N"]=pl_wizard_idle_attack_n;
Animate2D::FrameSequence pl_wizard_attack_s(0.2f);
for(int i=0;i<3;i++){
pl_wizard_attack_s.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,0}*24,{24,24}}});
pl_wizard_attack_s.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4+i,0}*24,{24,24}}});
if(i==1){
pl_wizard_attack_s.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,0}*24,{24,24}}});
pl_wizard_attack_s.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,0}*24,{24,24}}});
}
}
ANIMATION_DATA["WIZARD_ATTACK_S"]=pl_wizard_attack_s;
Animate2D::FrameSequence pl_wizard_attack_e(0.2f);
for(int i=0;i<3;i++){
pl_wizard_attack_e.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,3}*24,{24,24}}});
pl_wizard_attack_e.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4+i,3}*24,{24,24}}});
if(i==1){
pl_wizard_attack_e.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,3}*24,{24,24}}});
pl_wizard_attack_e.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,3}*24,{24,24}}});
}
}
ANIMATION_DATA["WIZARD_ATTACK_E"]=pl_wizard_attack_e;
Animate2D::FrameSequence pl_wizard_attack_w(0.2f);
for(int i=0;i<3;i++){
pl_wizard_attack_w.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,2}*24,{24,24}}});
pl_wizard_attack_w.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4+i,2}*24,{24,24}}});
if(i==1){
pl_wizard_attack_w.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,2}*24,{24,24}}});
pl_wizard_attack_w.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,2}*24,{24,24}}});
}
}
ANIMATION_DATA["WIZARD_ATTACK_W"]=pl_wizard_attack_w;
Animate2D::FrameSequence pl_wizard_attack_n(0.2f);
for(int i=0;i<3;i++){
pl_wizard_attack_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{4+i,1}*24,{24,24}}});
pl_wizard_attack_n.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4+i,1}*24,{24,24}}});
if(i==1){
pl_wizard_attack_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{4,1}*24,{24,24}}});
pl_wizard_attack_n.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{4,1}*24,{24,24}}});
}
}
ANIMATION_DATA["WIZARD_ATTACK_N"]=pl_wizard_attack_n;
Animate2D::FrameSequence pl_wizard_cast_s(0.1f);
for(int i=0;i<2;i++){
pl_wizard_cast_s.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,0}*24,{24,24}}});
pl_wizard_cast_s.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{7+i,0}*24,{24,24}}});
}
ANIMATION_DATA["WIZARD_CAST_S"]=pl_wizard_cast_s;
Animate2D::FrameSequence pl_wizard_cast_e(0.1f);
for(int i=0;i<2;i++){
pl_wizard_cast_e.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,3}*24,{24,24}}});
pl_wizard_cast_e.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{7+i,3}*24,{24,24}}});
}
ANIMATION_DATA["WIZARD_CAST_E"]=pl_wizard_cast_e;
Animate2D::FrameSequence pl_wizard_cast_n(0.1f);
for(int i=0;i<2;i++){
pl_wizard_cast_n.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,1}*24,{24,24}}});
pl_wizard_cast_n.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{7+i,1}*24,{24,24}}});
}
ANIMATION_DATA["WIZARD_CAST_N"]=pl_wizard_cast_n;
Animate2D::FrameSequence pl_wizard_cast_w(0.1f);
for(int i=0;i<2;i++){
pl_wizard_cast_w.AddFrame({&GFX["nico-wizard.png"],{vi2d{7+i,2}*24,{24,24}}});
pl_wizard_cast_w.AddFrame({"assets/nico-wizard.png",geom2d::rect<int32_t>{vi2d{7+i,2}*24,{24,24}}});
}
ANIMATION_DATA["WIZARD_CAST_W"]=pl_wizard_cast_w;
//Thief animations.
SetupClassWalkIdleAnimations(GFX["nico-thief.png"],"THIEF");
SetupClassWalkIdleAnimations("assets/nico-thief.png","THIEF");
Animate2D::FrameSequence pl_thief_swing_s(0.05f),pl_thief_swing_n(0.05f),pl_thief_swing_e(0.05f),pl_thief_swing_w(0.05f);
Animate2D::FrameSequence pl_thief_deadlydash_s(0.1f,Animate2D::Style::Repeat),pl_thief_deadlydash_n(0.1f,Animate2D::Style::Repeat),pl_thief_deadlydash_e(0.1f,Animate2D::Style::Repeat),pl_thief_deadlydash_w(0.1f,Animate2D::Style::Repeat);
for (int i=0;i<4;i++){
pl_thief_swing_s.AddFrame({&GFX["nico-thief.png"],{vi2d{4+i,0}*24,{24,24}}});
pl_thief_deadlydash_s.AddFrame({&GFX["nico-thief.png"],{vi2d{i,4}*24,{24,24}}});
pl_thief_swing_s.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{4+i,0}*24,{24,24}}});
pl_thief_deadlydash_s.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{i,4}*24,{24,24}}});
}
for (int i=0;i<4;i++){
pl_thief_swing_n.AddFrame({&GFX["nico-thief.png"],{vi2d{4+i,1}*24,{24,24}}});
pl_thief_deadlydash_n.AddFrame({&GFX["nico-thief.png"],{vi2d{i,5}*24,{24,24}}});
pl_thief_swing_n.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{4+i,1}*24,{24,24}}});
pl_thief_deadlydash_n.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{i,5}*24,{24,24}}});
}
for (int i=0;i<4;i++){
pl_thief_swing_w.AddFrame({&GFX["nico-thief.png"],{vi2d{4+i,2}*24,{24,24}}});
pl_thief_deadlydash_w.AddFrame({&GFX["nico-thief.png"],{vi2d{i,6}*24,{24,24}}});
pl_thief_swing_w.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{4+i,2}*24,{24,24}}});
pl_thief_deadlydash_w.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{i,6}*24,{24,24}}});
}
for (int i=0;i<4;i++){
pl_thief_swing_e.AddFrame({&GFX["nico-thief.png"],{vi2d{4+i,3}*24,{24,24}}});
pl_thief_deadlydash_e.AddFrame({&GFX["nico-thief.png"],{vi2d{i,7}*24,{24,24}}});
pl_thief_swing_e.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{4+i,3}*24,{24,24}}});
pl_thief_deadlydash_e.AddFrame({"assets/nico-thief.png",geom2d::rect<int32_t>{vi2d{i,7}*24,{24,24}}});
}
ANIMATION_DATA["THIEF_SWINGSWORD_N"]=pl_thief_swing_n;
ANIMATION_DATA["THIEF_SWINGSWORD_E"]=pl_thief_swing_e;
@ -241,22 +241,22 @@ void sig::Animation::InitializeAnimations(){
ANIMATION_DATA["THIEF_DEADLYDASH_W"]=pl_thief_deadlydash_w;
//Trapper animations
SetupClassWalkIdleAnimations(GFX["nico-trapper.png"],"TRAPPER");
SetupClassWalkIdleAnimations("assets/nico-trapper.png","TRAPPER");
Animate2D::FrameSequence pl_trapper_shoot_s,pl_trapper_shoot_n,pl_trapper_shoot_e,pl_trapper_shoot_w;
Animate2D::FrameSequence pl_trapper_setTrap_s,pl_trapper_setTrap_n,pl_trapper_setTrap_e,pl_trapper_setTrap_w;
for(int i=0;i<3;i++){
pl_trapper_shoot_s.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,0}*24,{24,24}}});
pl_trapper_shoot_n.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,1}*24,{24,24}}});
pl_trapper_shoot_e.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,3}*24,{24,24}}});
pl_trapper_shoot_w.AddFrame({&GFX["nico-trapper.png"],{vi2d{3+i,2}*24,{24,24}}});
pl_trapper_shoot_s.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{3+i,0}*24,{24,24}}});
pl_trapper_shoot_n.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{3+i,1}*24,{24,24}}});
pl_trapper_shoot_e.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{3+i,3}*24,{24,24}}});
pl_trapper_shoot_w.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{3+i,2}*24,{24,24}}});
}
for(int i:std::ranges::iota_view(0,5)){
pl_trapper_setTrap_s.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+i,4}*24,{24,24}}});
pl_trapper_setTrap_n.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+i,5}*24,{24,24}}});
pl_trapper_setTrap_s.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{1+i,4}*24,{24,24}}});
pl_trapper_setTrap_n.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{1+i,5}*24,{24,24}}});
int frameInd{i};
if(i==4)frameInd--; //One less frame for East and West facing sprites.
pl_trapper_setTrap_e.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+frameInd,6}*24,{24,24}}});
pl_trapper_setTrap_w.AddFrame({&GFX["nico-trapper.png"],{vi2d{1+frameInd,7}*24,{24,24}}});
pl_trapper_setTrap_e.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{1+frameInd,6}*24,{24,24}}});
pl_trapper_setTrap_w.AddFrame({"assets/nico-trapper.png",geom2d::rect<int32_t>{vi2d{1+frameInd,7}*24,{24,24}}});
}
ANIMATION_DATA["TRAPPER_SHOOT_S"]=pl_trapper_shoot_s;
ANIMATION_DATA["TRAPPER_SHOOT_N"]=pl_trapper_shoot_n;
@ -268,79 +268,79 @@ void sig::Animation::InitializeAnimations(){
ANIMATION_DATA["TRAPPER_SETTRAP_W"]=pl_trapper_setTrap_w;
//Witch animations
SetupClassWalkIdleAnimations(GFX["nico-witch.png"],"WITCH");
SetupClassWalkIdleAnimations("assets/nico-witch.png","WITCH");
Animate2D::FrameSequence pl_witch_idle_attack_s;
pl_witch_idle_attack_s.AddFrame({&GFX["nico-witch.png"],{vi2d{4,0}*24,{24,24}}});
pl_witch_idle_attack_s.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,0}*24,{24,24}}});
ANIMATION_DATA["WITCH_IDLE_ATTACK_S"]=pl_witch_idle_attack_s;
Animate2D::FrameSequence pl_witch_idle_attack_e;
pl_witch_idle_attack_e.AddFrame({&GFX["nico-witch.png"],{vi2d{4,3}*24,{24,24}}});
pl_witch_idle_attack_e.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,3}*24,{24,24}}});
ANIMATION_DATA["WITCH_IDLE_ATTACK_E"]=pl_witch_idle_attack_e;
Animate2D::FrameSequence pl_witch_idle_attack_w;
pl_witch_idle_attack_w.AddFrame({&GFX["nico-witch.png"],{vi2d{4,2}*24,{24,24}}});
pl_witch_idle_attack_w.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,2}*24,{24,24}}});
ANIMATION_DATA["WITCH_IDLE_ATTACK_W"]=pl_witch_idle_attack_w;
Animate2D::FrameSequence pl_witch_idle_attack_n;
pl_witch_idle_attack_n.AddFrame({&GFX["nico-witch.png"],{vi2d{4,1}*24,{24,24}}});
pl_witch_idle_attack_n.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,1}*24,{24,24}}});
ANIMATION_DATA["WITCH_IDLE_ATTACK_N"]=pl_witch_idle_attack_n;
Animate2D::FrameSequence pl_witch_attack_s(0.2f);
for(int i=0;i<3;i++){
pl_witch_attack_s.AddFrame({&GFX["nico-witch.png"],{vi2d{4+i,0}*24,{24,24}}});
pl_witch_attack_s.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4+i,0}*24,{24,24}}});
if(i==1){
pl_witch_attack_s.AddFrame({&GFX["nico-witch.png"],{vi2d{4,0}*24,{24,24}}});
pl_witch_attack_s.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,0}*24,{24,24}}});
}
}
ANIMATION_DATA["WITCH_ATTACK_S"]=pl_witch_attack_s;
Animate2D::FrameSequence pl_witch_attack_e(0.2f);
for(int i=0;i<3;i++){
pl_witch_attack_e.AddFrame({&GFX["nico-witch.png"],{vi2d{4+i,3}*24,{24,24}}});
pl_witch_attack_e.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4+i,3}*24,{24,24}}});
if(i==1){
pl_witch_attack_e.AddFrame({&GFX["nico-witch.png"],{vi2d{4,3}*24,{24,24}}});
pl_witch_attack_e.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,3}*24,{24,24}}});
}
}
ANIMATION_DATA["WITCH_ATTACK_E"]=pl_witch_attack_e;
Animate2D::FrameSequence pl_witch_attack_w(0.2f);
for(int i=0;i<3;i++){
pl_witch_attack_w.AddFrame({&GFX["nico-witch.png"],{vi2d{4+i,2}*24,{24,24}}});
pl_witch_attack_w.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4+i,2}*24,{24,24}}});
if(i==1){
pl_witch_attack_w.AddFrame({&GFX["nico-witch.png"],{vi2d{4,2}*24,{24,24}}});
pl_witch_attack_w.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,2}*24,{24,24}}});
}
}
ANIMATION_DATA["WITCH_ATTACK_W"]=pl_witch_attack_w;
Animate2D::FrameSequence pl_witch_attack_n(0.2f);
for(int i=0;i<3;i++){
pl_witch_attack_n.AddFrame({&GFX["nico-witch.png"],{vi2d{4+i,1}*24,{24,24}}});
pl_witch_attack_n.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4+i,1}*24,{24,24}}});
if(i==1){
pl_witch_attack_n.AddFrame({&GFX["nico-witch.png"],{vi2d{4,1}*24,{24,24}}});
pl_witch_attack_n.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{4,1}*24,{24,24}}});
}
}
ANIMATION_DATA["WITCH_ATTACK_N"]=pl_witch_attack_n;
Animate2D::FrameSequence pl_witch_cast_s(0.1f);
for(int i=0;i<2;i++){
pl_witch_cast_s.AddFrame({&GFX["nico-witch.png"],{vi2d{7+i,0}*24,{24,24}}});
pl_witch_cast_s.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{7+i,0}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAST_S"]=pl_witch_cast_s;
Animate2D::FrameSequence pl_witch_cast_e(0.1f);
for(int i=0;i<2;i++){
pl_witch_cast_e.AddFrame({&GFX["nico-witch.png"],{vi2d{7+i,3}*24,{24,24}}});
pl_witch_cast_e.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{7+i,3}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAST_E"]=pl_witch_cast_e;
Animate2D::FrameSequence pl_witch_cast_n(0.1f);
for(int i=0;i<2;i++){
pl_witch_cast_n.AddFrame({&GFX["nico-witch.png"],{vi2d{7+i,1}*24,{24,24}}});
pl_witch_cast_n.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{7+i,1}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAST_N"]=pl_witch_cast_n;
Animate2D::FrameSequence pl_witch_cast_w(0.1f);
for(int i=0;i<2;i++){
pl_witch_cast_w.AddFrame({&GFX["nico-witch.png"],{vi2d{7+i,2}*24,{24,24}}});
pl_witch_cast_w.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{7+i,2}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAST_W"]=pl_witch_cast_w;
Animate2D::FrameSequence pl_witch_transform_s(0.1f);
pl_witch_transform_s.AddFrame({&GFX["nico-witch.png"],{vi2d{0,4}*24,{24,24}}});
pl_witch_transform_s.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0,4}*24,{24,24}}});
Animate2D::FrameSequence pl_witch_transform_n(0.1f);
pl_witch_transform_n.AddFrame({&GFX["nico-witch.png"],{vi2d{0,5}*24,{24,24}}});
pl_witch_transform_n.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0,5}*24,{24,24}}});
Animate2D::FrameSequence pl_witch_transform_w(0.1f);
pl_witch_transform_w.AddFrame({&GFX["nico-witch.png"],{vi2d{0,6}*24,{24,24}}});
pl_witch_transform_w.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0,6}*24,{24,24}}});
Animate2D::FrameSequence pl_witch_transform_e(0.1f);
pl_witch_transform_e.AddFrame({&GFX["nico-witch.png"],{vi2d{0,7}*24,{24,24}}});
pl_witch_transform_e.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0,7}*24,{24,24}}});
ANIMATION_DATA["WITCH_TRANSFORM_S"]=pl_witch_transform_s;
ANIMATION_DATA["WITCH_TRANSFORM_N"]=pl_witch_transform_n;
ANIMATION_DATA["WITCH_TRANSFORM_W"]=pl_witch_transform_w;
@ -349,73 +349,73 @@ void sig::Animation::InitializeAnimations(){
Animate2D::FrameSequence pl_witch_cat_walk_s(0.2f);
for(int i=0;i<2;i++){
pl_witch_cat_walk_s.AddFrame({&GFX["nico-witch.png"],{vi2d{0+i,4}*24,{24,24}}});
pl_witch_cat_walk_s.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0+i,4}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAT_WALK_S"]=pl_witch_cat_walk_s;
Animate2D::FrameSequence pl_witch_cat_walk_n(0.2f);
for(int i=0;i<2;i++){
pl_witch_cat_walk_n.AddFrame({&GFX["nico-witch.png"],{vi2d{0+i,5}*24,{24,24}}});
pl_witch_cat_walk_n.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0+i,5}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAT_WALK_N"]=pl_witch_cat_walk_n;
Animate2D::FrameSequence pl_witch_cat_walk_w(0.2f);
for(int i=0;i<2;i++){
pl_witch_cat_walk_w.AddFrame({&GFX["nico-witch.png"],{vi2d{0+i,6}*24,{24,24}}});
pl_witch_cat_walk_w.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0+i,6}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAT_WALK_W"]=pl_witch_cat_walk_w;
Animate2D::FrameSequence pl_witch_cat_walk_e(0.2f);
for(int i=0;i<2;i++){
pl_witch_cat_walk_e.AddFrame({&GFX["nico-witch.png"],{vi2d{0+i,7}*24,{24,24}}});
pl_witch_cat_walk_e.AddFrame({"assets/nico-witch.png",geom2d::rect<int32_t>{vi2d{0+i,7}*24,{24,24}}});
}
ANIMATION_DATA["WITCH_CAT_WALK_E"]=pl_witch_cat_walk_e;
CreateHorizontalAnimationSequence("ground-slam-attack-back.png",5,{64,64},{0.02f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("ground-slam-attack-front.png",5,{64,64},{0.02f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("battlecry_effect.png",5,{84,84},{0.02f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("sonicslash.png",4,{60,60},{0.04f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("assets/ground-slam-attack-back.png",5,{64,64},{0.02f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("assets/ground-slam-attack-front.png",5,{64,64},{0.02f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("assets/battlecry_effect.png",5,{84,84},{0.02f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("assets/sonicslash.png",4,{60,60},{0.04f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("swordslash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("assets/swordslash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
CreateStillAnimation("energy_bolt.png",{24,24});
CreateStillAnimation("assets/energy_bolt.png");
CreateHorizontalAnimationSequence("energy_particle.png",3,{3,3});
CreateHorizontalAnimationSequence("assets/energy_particle.png",3,{3,3});
CreateHorizontalAnimationSequence("splash_effect.png",5,{24,24},{0.05f});
CreateHorizontalAnimationSequence("assets/splash_effect.png",5,{24,24},{0.05f});
CreateStillAnimation("circle.png",{3,3});
CreateStillAnimation("assets/circle.png");
CreateHorizontalAnimationSequence("lightning_bolt.png",5,{24,24},{0.03f,Animate2D::Style::PingPong});
CreateHorizontalAnimationSequence("assets/lightning_bolt.png",5,{24,24},{0.03f,Animate2D::Style::PingPong});
CreateStillAnimation("lightning_bolt_part1.png",{5,5});
CreateStillAnimation("lightning_bolt_part2.png",{5,5});
CreateStillAnimation("lightning_bolt_part3.png",{5,5});
CreateStillAnimation("lightning_bolt_part4.png",{5,5});
CreateStillAnimation("assets/lightning_bolt_part1.png");
CreateStillAnimation("assets/lightning_bolt_part2.png");
CreateStillAnimation("assets/lightning_bolt_part3.png");
CreateStillAnimation("assets/lightning_bolt_part4.png");
CreateStillAnimation("chain_lightning.png",{1,9});
CreateStillAnimation("assets/chain_lightning.png");
CreateHorizontalAnimationSequence("monstersoul.png",3,{24,24},AnimationData{.frameDuration{0.25f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24});
CreateHorizontalAnimationSequence("dagger_stab.png",2,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("goblin_sword_slash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("goblin_bomb.png",4,{24,24},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("goblin_bomb_fuse.png",4,{24,24},AnimationData{.frameDuration{1.f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("bomb_boom.png",5,{36,36},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("tornado2.png",4,{24,48},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("large_tornado.png",4,{72,144},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("sand_suction.png",4,{72,72},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("bomb.png",4,{24,24},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("ghost_dagger.png",3,{24,24},{0.1f,Animate2D::Style::PingPong});
CreateHorizontalAnimationSequence("assets/monstersoul.png",3,{24,24},AnimationData{.frameDuration{0.25f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("assets/lightning_splash_effect.png",5,{24,24});
CreateHorizontalAnimationSequence("assets/dagger_stab.png",2,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("assets/goblin_sword_slash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence("assets/goblin_bomb.png",4,{24,24},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("assets/goblin_bomb_fuse.png",4,{24,24},AnimationData{.frameDuration{1.f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("assets/bomb_boom.png",5,{36,36},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("assets/tornado2.png",4,{24,48},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("assets/large_tornado.png",4,{72,144},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("assets/sand_suction.png",4,{72,72},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("assets/bomb.png",4,{24,24},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("assets/ghost_dagger.png",3,{24,24},{0.1f,Animate2D::Style::PingPong});
CreateStillAnimation("meteor.png",{192,192});
CreateStillAnimation("assets/meteor.png");
for(int i=0;i<5;i++){
Animate2D::FrameSequence firering;
firering.AddFrame({&GFX["fire_ring"+std::to_string(i)+".png"],{{0,0},{24,24}}});
ANIMATION_DATA["fire_ring"+std::to_string(i)+".png"]=firering;
firering.AddFrame({"assets/fire_ring"+std::to_string(i)+".png",geom2d::rect<int32_t>{{0,0},{24,24}}});
ANIMATION_DATA["assets/fire_ring"+std::to_string(i)+".png"]=firering;
}
CreateStillAnimation("arrow.png",{24,24});
CreateStillAnimation("charged_shot_arrow.png",{48,48});
CreateStillAnimation("laser.png",{5,1});
CreateStillAnimation("range_indicator.png",{24,24});
CreateStillAnimation("assets/arrow.png");
CreateStillAnimation("assets/charged_shot_arrow.png");
CreateStillAnimation("assets/laser.png");
CreateStillAnimation("assets/range_indicator.png");
Animate2D::FrameSequence goblin_bow_mount_n,goblin_bow_mount_e,goblin_bow_mount_s,goblin_bow_mount_w;
Animate2D::FrameSequence goblin_bow_attack_n,goblin_bow_attack_e,goblin_bow_attack_s,goblin_bow_attack_w;
@ -423,7 +423,7 @@ void sig::Animation::InitializeAnimations(){
for(int animationIndex=0;animationIndex<4;animationIndex++){
Animate2D::FrameSequence mountAnimation{0.6f};
for(int i=0;i<2;i++){
mountAnimation.AddFrame(Animate2D::Frame{&GFX["monsters/commercial_assets/Goblin (Bow)_foreground.png"],{{i*32,animationIndex*32},{32,32}}});
mountAnimation.AddFrame(Animate2D::Frame{"assets/monsters/commercial_assets/Goblin (Bow)_foreground.png",geom2d::rect<int32_t>{{i*32,animationIndex*32},{32,32}}});
}
ANIMATION_DATA[std::format("GOBLIN_BOW_MOUNTED_{}",animationIndex)]=mountAnimation;
}
@ -431,7 +431,7 @@ void sig::Animation::InitializeAnimations(){
for(int animationIndex=0;animationIndex<4;animationIndex++){
Animate2D::FrameSequence mountShootAnimation{0.06f,Animate2D::Style::OneShot};
for(int i=0;i<4;i++){
mountShootAnimation.AddFrame(Animate2D::Frame{&GFX["monsters/commercial_assets/Goblin (Bow)_foreground.png"],{{i*32,animationIndex*32+4*32},{32,32}}});
mountShootAnimation.AddFrame(Animate2D::Frame{"assets/monsters/commercial_assets/Goblin (Bow)_foreground.png",geom2d::rect<int32_t>{{i*32,animationIndex*32+4*32},{32,32}}});
}
ANIMATION_DATA[std::format("GOBLIN_BOW_ATTACK_{}",animationIndex)]=mountShootAnimation;
}
@ -440,44 +440,45 @@ void sig::Animation::InitializeAnimations(){
//Idle sequences for the sitting parrot.
for(int animationIndex=0;animationIndex<4;animationIndex++){
Animate2D::FrameSequence mountAnimation{0.6f};
mountAnimation.AddFrame(Animate2D::Frame{&GFX["monsters/commercial_assets/Parrot_foreground.png"],{{0,animationIndex*48},{48,48}}});
mountAnimation.AddFrame(Animate2D::Frame{"assets/monsters/commercial_assets/Parrot_foreground.png",geom2d::rect<int32_t>{{0,animationIndex*48},{48,48}}});
ANIMATION_DATA[std::format("PARROT_MOUNTED_{}",animationIndex)]=mountAnimation;
}
#pragma region Trapper Target Mark Debuff
AnimationData targetAnimData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}};
Animate2D::FrameSequence targetAnim(targetAnimData.frameDuration,targetAnimData.style);
targetAnim.AddFrame({&GFX["target.png"],{{int(0*24),0},{24,24}}});
targetAnim.AddFrame({&GFX["target.png"],{{int(0*24),0},{24,24}}});
targetAnim.AddFrame({&GFX["target.png"],{{int(1*24),0},{24,24}}});
ANIMATION_DATA["target.png"]=targetAnim;
targetAnim.AddFrame({"assets/target.png",geom2d::rect<int32_t>{{int(0*24),0},{24,24}}});
targetAnim.AddFrame({"assets/target.png",geom2d::rect<int32_t>{{int(0*24),0},{24,24}}});
targetAnim.AddFrame({"assets/target.png",geom2d::rect<int32_t>{{int(1*24),0},{24,24}}});
ANIMATION_DATA["assets/target.png"]=targetAnim;
AnimationData specialTargetAnimData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}};
Animate2D::FrameSequence specialTargetAnim(specialTargetAnimData.frameDuration,specialTargetAnimData.style);
specialTargetAnim.AddFrame({&GFX["special_target.png"],{{int(0*24),0},{24,24}}});
specialTargetAnim.AddFrame({&GFX["special_target.png"],{{int(0*24),0},{24,24}}});
specialTargetAnim.AddFrame({&GFX["special_target.png"],{{int(1*24),0},{24,24}}});
ANIMATION_DATA["special_target.png"]=specialTargetAnim;
specialTargetAnim.AddFrame({"assets/special_target.png",geom2d::rect<int32_t>{{int(0*24),0},{24,24}}});
specialTargetAnim.AddFrame({"assets/special_target.png",geom2d::rect<int32_t>{{int(0*24),0},{24,24}}});
specialTargetAnim.AddFrame({"assets/special_target.png",geom2d::rect<int32_t>{{int(1*24),0},{24,24}}});
ANIMATION_DATA["assets/special_target.png"]=specialTargetAnim;
#pragma endregion
CreateHorizontalAnimationSequence("bear_trap.png",3,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("explosive_trap.png",4,{48,48},AnimationData{.frameDuration{0.06f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("explosionframes.png",21,{24,24},AnimationData{.frameDuration{0.02f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("fire_ring.png",5,{60,60},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("assets/bear_trap.png",3,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("assets/explosive_trap.png",4,{48,48},AnimationData{.frameDuration{0.06f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("assets/explosionframes.png",21,{24,24},AnimationData{.frameDuration{0.02f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("assets/fire_ring.png",5,{60,60},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("portal.png",8,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("assets/portal.png",8,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
CreateHorizontalAnimationSequence("burstbullet.png",4,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("inkbubble_explode.png",4,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("assets/burstbullet.png",4,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::OneShot}});
CreateHorizontalAnimationSequence("assets/inkbubble_explode.png",4,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::OneShot}});
//!!!!!WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//DO NOT CREATE MORE ANIMATION SEQUENCES UNDERNEATH HERE AS THE NEXT BLOCK WILL CREATE DEFAULT ANIMATIONS
//FOR ALL NON-SPECIFIED ANIMATION SEQUENCES!
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
for(auto&dat:GFX){
std::string imgFile=dat.first;
for(auto&val:DATA["Images"].GetKeys()){
std::string key=val.first;
std::string imgFile="assets/"+DATA["Images"][key].GetString(0);
if(!ANIMATION_DATA.count(imgFile)){
LOG("WARNING! Animation data for "<<imgFile<<" not found! Auto-generating...");
CreateStillAnimation(imgFile,GFX[imgFile].Sprite()->Size());
CreateStillAnimation(imgFile);
}
}
}

View File

@ -41,14 +41,15 @@ All rights reserved.
#include "DEFINES.h"
#include "util.h"
#include "olcUTIL_Geometry2D.h"
#include"BitwiseEnum.h"
INCLUDE_game
INCLUDE_GFX
Arrow::Arrow(vf2d pos,vf2d targetPos,vf2d vel,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:finalDistance(geom2d::line(pos,targetPos).length()*1.2f),acc(PI/2*250),targetPos(targetPos),
Bullet(pos,vel,radius,damage,
"arrow.png",upperLevel,false,INFINITE,true,friendly,col){}
"assets/arrow.png",upperLevel,false,INFINITE,true,friendly,col){}
Arrow::Arrow(vf2d pos,vf2d targetPos,vf2d vel,const std::string_view gfx,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:finalDistance(geom2d::line(pos,targetPos).length()*1.2f),acc(PI/2*250),targetPos(targetPos),
@ -94,7 +95,7 @@ const vf2d Arrow::PointToBestTargetPath(const uint8_t perceptionLevel){
BulletDestroyState Arrow::PlayerHit(Player*player)
{
fadeOutTime=0.2f;
game->AddEffect(Effect{player->GetPos(),0,"splash_effect.png",upperLevel,player->GetSizeMult(),0.25});
game->AddEffect(Effect{player->GetPos(),0,"assets/splash_effect.png",upperLevel,player->GetSizeMult(),0.25});
if(poisonArrow)player->AddBuff(BuffRestorationType::OVER_TIME,BuffOverTimeType::HP_DAMAGE_OVER_TIME,"Poisonous Arrow"_ENC["POISON DURATION"],damage*("Poisonous Arrow"_ENC["POISON TICK DAMAGE"]/100.f),1.f);
return BulletDestroyState::KEEP_ALIVE;
}
@ -102,7 +103,7 @@ BulletDestroyState Arrow::PlayerHit(Player*player)
BulletDestroyState Arrow::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)
{
fadeOutTime=0.2f;
game->AddEffect(Effect{monster.GetPos(),0,"splash_effect.png",upperLevel,monster.GetSizeMult(),0.25});
game->AddEffect(Effect{monster.GetPos(),0,"assets/splash_effect.png",upperLevel,monster.GetSizeMult(),0.25});
if(poisonArrow)monster.AddBuff(BuffRestorationType::OVER_TIME,BuffOverTimeType::HP_DAMAGE_OVER_TIME,"Poisonous Arrow"_ENC["POISON DURATION"],damage*("Poisonous Arrow"_ENC["POISON TICK DAMAGE"]/100.f),1.f);
if(game->GetPlayer()->HasEnchant("Burning Arrow")&&markStacksBeforeHit>0&&monster.GetBuffs(BuffType::BURNING_ARROW_BURN).size()<"Burning Arrow"_ENC["MAX BURN STACK"])monster.AddBuff(BuffType::BURNING_ARROW_BURN,BuffRestorationType::OVER_TIME,BuffOverTimeType::HP_DAMAGE_OVER_TIME,"Burning Arrow"_ENC["BURN DURATION"],game->GetPlayer()->GetAttack()*"Burning Arrow"_ENC["BURN DAMAGE"]/100.f,2.f);
return BulletDestroyState::KEEP_ALIVE;
@ -115,7 +116,7 @@ void Arrow::ModifyOutgoingDamageData(HurtDamageInfo&data){
void Arrow::Draw(const Pixel blendCol)const{
if(poisonArrow){
game->SetDecalMode(DecalMode::ADDITIVE);
game->view.DrawRotatedDecal(pos,GFX["glow.png"].Decal(),image_angle,GFX["glow.png"].Sprite()->Size()/2,scale,{255,255,0,120});
game->view.DrawRotatedDecal(pos,GFX["assets/glow.png"].Decal(),image_angle,GFX["assets/glow.png"].Sprite()->Size()/2,scale,{255,255,0,120});
game->SetDecalMode(DecalMode::NORMAL);
Bullet::Draw({128,192,0,blendCol.a});
}else{

View File

@ -44,9 +44,10 @@ All rights reserved.
#include "RowItemDisplay.h"
#include "MenuDecal.h"
#include "SoundEffect.h"
#include"MenuFragmentItemButton.h"
INCLUDE_game
INCLUDE_GFX
void Menu::InitializeArtificerDisassembleWindow(){
Menu*artificerDisassembleWindow=CreateMenu(ARTIFICER_DISASSEMBLE,CENTERED,game->GetScreenSize()-vi2d{52,52});
@ -54,7 +55,7 @@ void Menu::InitializeArtificerDisassembleWindow(){
const auto ResetDisassemblyDisplay=[artificerDisassembleWindow](){
MenuType menuType{artificerDisassembleWindow->GetType()};
Component<MenuDecal>(menuType,"Down Arrow")->Disable();
Component<MenuIconButton>(menuType,"Disassembly Result")->Disable();
Component<MenuFragmentItemButton>(menuType,"Disassembly Result")->Disable();
Component<MenuLabel>(menuType,"Disassembly Result Title")->Disable();
Component<MenuLabel>(menuType,"Fragment Total Count")->Disable();
Component<MenuComponent>(menuType,"Disassemble Button")->Disable();
@ -62,7 +63,7 @@ void Menu::InitializeArtificerDisassembleWindow(){
const auto EnableDisassemblyDisplay=[artificerDisassembleWindow](){
MenuType menuType{artificerDisassembleWindow->GetType()};
Component<MenuDecal>(menuType,"Down Arrow")->Enable();
Component<MenuIconButton>(menuType,"Disassembly Result")->Enable();
Component<MenuFragmentItemButton>(menuType,"Disassembly Result")->Enable();
Component<MenuLabel>(menuType,"Disassembly Result Title")->Enable();
Component<MenuLabel>(menuType,"Fragment Total Count")->Enable();
Component<MenuComponent>(menuType,"Disassemble Button")->Enable();
@ -78,12 +79,12 @@ void Menu::InitializeArtificerDisassembleWindow(){
auto accessoryDescription{artificerDisassembleWindow->ADD("Item Description",MenuLabel)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+56.f,44.f},{artificerDisassembleWindow->size.x/2-56.f,72.f}},"",0.5f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END};
auto downArrow{artificerDisassembleWindow->ADD("Down Arrow",MenuDecal)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+4.f,92.f},{48,48}},GFX.at("downarrow.png"),DO_NOTHING,DO_NOTHING)END};
auto downArrow{artificerDisassembleWindow->ADD("Down Arrow",MenuDecal)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+4.f,92.f},{48,48}},"assets/downarrow.png",DO_NOTHING,DO_NOTHING)END};
auto disassemblyResult{artificerDisassembleWindow->ADD("Disassembly Result",MenuIconButton)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+4.f,141.f},{48,48}},nullptr,DO_NOTHING,IconButtonAttr::NOT_SELECTABLE)END};
auto disassemblyResult{artificerDisassembleWindow->ADD("Disassembly Result",MenuFragmentItemButton)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+4.f,141.f},{48,48}},std::optional<std::string>{},DO_NOTHING,IconButtonAttr::NOT_SELECTABLE)END};
auto disassemblyResultTitle{artificerDisassembleWindow->ADD("Disassembly Result Title",MenuLabel)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+56.f,141.f},{artificerDisassembleWindow->size.x/2-56.f,24.f}},"",2.f,ComponentAttr::BACKGROUND|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::FIT_TO_LABEL)END};
auto disassemblyTotalCount{artificerDisassembleWindow->ADD("Fragment Total Count",MenuLabel)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+56.f,127.f},{artificerDisassembleWindow->size.x/2-56.f,12.f}},"",0.85f,ComponentAttr::RIGHT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::FIT_TO_LABEL)END};
auto disassembleButton{artificerDisassembleWindow->ADD("Disassemble Button",MenuComponent)(geom2d::rect<float>{{artificerDisassembleWindow->size.x/2+72.f,171.f},{artificerDisassembleWindow->size.x/2-72.f,16.f}},"Disassemble",[ResetDisassemblyDisplay](MenuFuncData data){
@ -91,7 +92,7 @@ void Menu::InitializeArtificerDisassembleWindow(){
if(Inventory::Disassemble(it)==Inventory::DisassembleResult::SUCCESS){
SoundEffect::PlaySFX("Disassemble Item",SoundEffect::CENTERED);
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(Item::BLANK);
Component<MenuIconButton>(data.menu.type,"Disassembly Result")->SetIcon(nullptr);
Component<MenuFragmentItemButton>(data.menu.type,"Disassembly Result")->SetIcon({});
Component<MenuLabel>(data.menu.type,"Disassembly Result Title")->SetLabel("");
Component<MenuLabel>(data.menu.type,"Fragment Total Count")->SetLabel("");
ResetDisassemblyDisplay();
@ -110,7 +111,7 @@ void Menu::InitializeArtificerDisassembleWindow(){
EnableDisassemblyDisplay();
RowItemDisplay&item{*DYNAMIC_POINTER_CAST<RowItemDisplay>(data.component)};
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(item.GetItem().lock());
Component<MenuIconButton>(data.menu.type,"Disassembly Result")->SetIcon(GFX[item.GetItem().lock()->FragmentIcon().value_or("pixel.png")].Decal());
Component<MenuFragmentItemButton>(data.menu.type,"Disassembly Result")->SetItemFragment(item.GetItem().lock()->FragmentName());
Component<MenuLabel>(data.menu.type,"Disassembly Result Title")->SetLabel(item.GetItem().lock()->FragmentName());
Component<MenuLabel>(data.menu.type,"Fragment Total Count")->SetLabel(std::format("Currently Owned: {}",Inventory::GetItemCount(item.GetItem().lock()->FragmentName())));
return true;
@ -120,7 +121,7 @@ void Menu::InitializeArtificerDisassembleWindow(){
if(childComponent){
RowItemDisplay&item{childComponent.value().get()};
Component<MenuItemItemButton>(data.menu.type,"Item Icon")->SetItem(item.GetItem().lock());
Component<MenuIconButton>(data.menu.type,"Disassembly Result")->SetIcon(GFX[item.GetItem().lock()->FragmentIcon().value_or("pixel.png")].Decal());
Component<MenuFragmentItemButton>(data.menu.type,"Disassembly Result")->SetItemFragment(item.GetItem().lock()->FragmentName());
Component<MenuLabel>(data.menu.type,"Disassembly Result Title")->SetLabel(item.GetItem().lock()->FragmentName());
Component<MenuLabel>(data.menu.type,"Fragment Total Count")->SetLabel(std::format("Currently Owned: {}",Inventory::GetItemCount(item.GetItem().lock()->FragmentName())));
EnableDisassemblyDisplay();

View File

@ -60,8 +60,8 @@ void Menu::InitializeArtificerEnchantConfirmWindow(){
const float newLabelTextWidth{game->GetTextSize("NEW").x*2.f};
auto newLabel{artificerEnchantConfirmWindow->ADD("New Item Label",MenuLabel)(geom2d::rect<float>{{artificerEnchantConfirmWindow->size.x/2.f+artificerEnchantConfirmWindow->size.x/4.f-oldLabelTextWidth/2+2.f,14.f},vf2d{oldLabelTextWidth+8.f,24.f}},"NEW",2.f,ComponentAttr::SHADOW|ComponentAttr::BACKGROUND)END};
auto oldIcon{artificerEnchantConfirmWindow->ADD("Old Item Icon",MenuIconButton)(geom2d::rect<float>{{artificerEnchantConfirmWindow->size.x/4.f-16.f,42.f},{24,24}},nullptr,DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE)END};
auto newIcon{artificerEnchantConfirmWindow->ADD("New Item Icon",MenuIconButton)(geom2d::rect<float>{{artificerEnchantConfirmWindow->size.x/2.f+artificerEnchantConfirmWindow->size.x/4.f-16.f+4.f,42.f},{24,24}},nullptr,DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE)END};
auto oldIcon{artificerEnchantConfirmWindow->ADD("Old Item Icon",MenuIconButton)(geom2d::rect<float>{{artificerEnchantConfirmWindow->size.x/4.f-16.f,42.f},{24,24}},std::optional<ImgFilename>{},DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE)END};
auto newIcon{artificerEnchantConfirmWindow->ADD("New Item Icon",MenuIconButton)(geom2d::rect<float>{{artificerEnchantConfirmWindow->size.x/2.f+artificerEnchantConfirmWindow->size.x/4.f-16.f+4.f,42.f},{24,24}},std::optional<ImgFilename>{},DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE)END};
auto oldItemDescription{artificerEnchantConfirmWindow->ADD("Old Item Description",MenuItemLabel)(geom2d::rect<float>{{0.f,74.f},{artificerEnchantConfirmWindow->size.x/2.f-8.f,60.f}},Item::BLANK,ItemLabelDescriptionType::ITEM_DESCRIPTION,0.5f,ComponentAttr::SHADOW|ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::LEFT_ALIGN)END};
auto newItemDescription{artificerEnchantConfirmWindow->ADD("New Item Description",MenuItemLabel)(geom2d::rect<float>{{artificerEnchantConfirmWindow->size.x/2.f+8.f,74.f},{artificerEnchantConfirmWindow->size.x/2.f-8.f,60.f}},Item::BLANK,ItemLabelDescriptionType::ITEM_DESCRIPTION,0.5f,ComponentAttr::SHADOW|ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::LEFT_ALIGN)END};

View File

@ -86,7 +86,7 @@ void Menu::InitializeArtificerEnchantWindow(){
Component<MenuLabel>(menuType,"Enchant List Header")->Enable();
Component<MenuLabel>(menuType,"Enchant Cost Label")->Enable();
Component<MenuDecal>(menuType,"Fragment Cost Icon")->Enable();
Component<MenuDecal>(menuType,"Fragment Cost Icon")->SetImage(GFX.at(selectedItem.lock()->FragmentIcon().value()));
Component<MenuDecal>(menuType,"Fragment Cost Icon")->SetImage((*selectedItem.lock()).FragmentName());
Component<MenuLabel>(menuType,"Fragment Label")->Enable();
Component<MenuLabel>(menuType,"Fragment Money Cost Label")->Enable();
Component<MenuComponent>(menuType,"Fragment Enchant Button")->Enable();
@ -141,12 +141,12 @@ void Menu::InitializeArtificerEnchantWindow(){
std::optional<ItemEnchant>previousEnchant{item.lock()->GetEnchant()};
data.menu.ANY(A::ENCHANT)={};
if(previousEnchant.has_value())data.menu.ANY(A::ENCHANT)=previousEnchant.value();
Component<MenuIconButton>(ARTIFICER_ENCHANT_CONFIRM,"Old Item Icon")->SetIcon(item.lock()->Icon().Decal());
Component<MenuIconButton>(ARTIFICER_ENCHANT_CONFIRM,"Old Item Icon")->SetIcon("assets/items/"+item.lock()->ActualName()+".png");
Component<MenuItemLabel>(ARTIFICER_ENCHANT_CONFIRM,"Old Item Description")->SetItem(*item.lock());
item.lock()->ApplyRandomEnchant();
const ItemEnchant&newEnchant{item.lock()->GetEnchant().value()};
Component<MenuIconButton>(ARTIFICER_ENCHANT_CONFIRM,"New Item Icon")->SetIcon(item.lock()->Icon().Decal());
Component<MenuIconButton>(ARTIFICER_ENCHANT_CONFIRM,"New Item Icon")->SetIcon("assets/items/"+item.lock()->ActualName()+".png");
Component<MenuItemLabel>(ARTIFICER_ENCHANT_CONFIRM,"New Item Description")->SetItem(item.lock());
Menu::OpenMenu(ARTIFICER_ENCHANT_CONFIRM,true);
@ -155,7 +155,7 @@ void Menu::InitializeArtificerEnchantWindow(){
#pragma region Money Display
vf2d moneyIconPos{artificerEnchantWindow->size.x/2-28.f,artificerEnchantWindow->size.y-12.f};
auto moneyIcon=artificerEnchantWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
auto moneyIcon=artificerEnchantWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},"assets/money.png",DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
auto moneyDisplay=artificerEnchantWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos+vf2d{26.f,4.f},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
@ -186,10 +186,10 @@ void Menu::InitializeArtificerEnchantWindow(){
{{game->KEY_SHOULDER2,Pressed},{"Scroll Up/Down",[](MenuType type){}}},
{{game->KEY_SHOULDER,Pressed},{"Scroll Up/Down",[](MenuType type){}}},
{{game->KEY_FASTSCROLLUP,PressedDAS},{"Scroll",[](MenuType type){
Menu::menus[type]->GetSelection().lock()->parentComponent.lock()->DecreaseSelectionIndex(3.f);
Component<ScrollableWindowComponent>(type,"Enchant Container")->Scroll(-3.f);
}}},
{{game->KEY_FASTSCROLLDOWN,PressedDAS},{"Scroll",[](MenuType type){
Menu::menus[type]->GetSelection().lock()->parentComponent.lock()->IncreaseSelectionIndex(3.f);
Component<ScrollableWindowComponent>(type,"Enchant Container")->Scroll(3.f);
}}},
{{game->KEY_SCROLLVERT_R,Analog,InputEngageGroup::NOT_VISIBLE},{"Scroll Enchants",[](MenuType type){
Component<ScrollableWindowComponent>(type,"Enchant Container")->Scroll(game->KEY_SCROLLVERT.Analog());

View File

@ -78,7 +78,7 @@ void Menu::InitializeArtificerRefineWindow(){
Component<MenuRefineLabel>(menuType,"Stats Block")->Enable();
Component<MenuLabel>(menuType,"Refine Cost Label")->Enable();
Component<MenuDecal>(menuType,"Fragment Cost Icon")->Enable();
Component<MenuDecal>(menuType,"Fragment Cost Icon")->SetImage(GFX.at(selectedItem.lock()->FragmentIcon().value()));
Component<MenuDecal>(menuType,"Fragment Cost Icon")->SetImage((*selectedItem.lock()).FragmentName());
Component<MenuLabel>(menuType,"Fragment Label")->Enable();
Component<MenuLabel>(menuType,"Fragment Money Cost Label")->Enable();
Component<MenuComponent>(menuType,"Fragment Refine Button")->Enable();
@ -140,7 +140,7 @@ void Menu::InitializeArtificerRefineWindow(){
#pragma region Money Display
vf2d moneyIconPos{artificerRefineWindow->size.x/2-28.f,artificerRefineWindow->size.y-12.f};
auto moneyIcon=artificerRefineWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
auto moneyIcon=artificerRefineWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},"assets/money.png",DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
auto moneyDisplay=artificerRefineWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos+vf2d{26.f,4.f},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;

View File

@ -45,7 +45,7 @@ All rights reserved.
INCLUDE_game
INCLUDE_BULLET_LIST
INCLUDE_GFX
INCLUDE_MONSTER_LIST
INCLUDE_MONSTER_DATA
@ -63,13 +63,13 @@ DEFINE_STRATEGY(BEAR)
m.V(A::LOCKON_POS)=vf2d{distToPlayer,util::angleTo(m.GetPos(),game->GetPlayer()->GetPos())};
m.SetStrategyDrawFunction([](AiL*game,Monster&m,const std::string&strategy){
if(m.IsAlive()){
game->view.DrawRotatedDecal(m.GetPos()+m.V(A::LOCKON_POS).cart(),GFX["range_indicator.png"].Decal(),0.f,{12.f,12.f},vf2d{ConfigFloat("Smash Attack Diameter"),ConfigFloat("Smash Attack Diameter")}/100.f,{255,255,0,160});
game->view.DrawRotatedDecal(m.GetPos()+m.V(A::LOCKON_POS).cart(),GFX["assets/range_indicator.png"].Decal(),0.f,{12.f,12.f},vf2d{ConfigFloat("Smash Attack Diameter"),ConfigFloat("Smash Attack Diameter")}/100.f,{255,255,0,160});
}
});
m.RotateTowardsPos(m.GetPos()+m.V(A::LOCKON_POS).cart());
}else{
m.target=game->GetPlayer()->GetPos();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}
}break;
case 1:{

View File

@ -38,14 +38,15 @@ All rights reserved.
#include "BulletTypes.h"
#include "AdventuresInLestoria.h"
#include"BitwiseEnum.h"
INCLUDE_ANIMATION_DATA
INCLUDE_game
BearTrap::BearTrap(vf2d pos,float radius,int damage,float fadeinTime,float fadeoutTime,bool upperLevel,bool hitsMultiple,float lifetime,FriendlyType friendly,Pixel col,vf2d scale)
:Bullet(pos,{},radius,damage,"Ability Icons/bear_trap.png",upperLevel,hitsMultiple,lifetime,false,friendly,col,scale,0.f,"Trap Hit"){
:Bullet(pos,{},radius,damage,"assets/Ability Icons/bear_trap.png",upperLevel,hitsMultiple,lifetime,false,friendly,col,scale,0.f,"Trap Hit"){
fadeInTime=fadeinTime;
animation.AddState("bear_trap.png",ANIMATION_DATA["bear_trap.png"]);
animation.AddState("assets/bear_trap.png",ANIMATION_DATA["assets/bear_trap.png"]);
if(!friendly)ERR("WARNING! Trying to use unimplemented enemy version of the Bear Trap Bullet!");
}
void BearTrap::ModifyOutgoingDamageData(HurtDamageInfo&data){
@ -54,15 +55,15 @@ void BearTrap::ModifyOutgoingDamageData(HurtDamageInfo&data){
BulletDestroyState BearTrap::PlayerHit(Player*player){
fadeOutTime=0.5f;
animation.ChangeState(internal_animState,"bear_trap.png");
animation.ChangeState(internal_animState,"assets/bear_trap.png");
return BulletDestroyState::KEEP_ALIVE;
}
BulletDestroyState BearTrap::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
fadeOutTime=0.5f;
animation.ChangeState(internal_animState,"bear_trap.png");
animation.ChangeState(internal_animState,"assets/bear_trap.png");
const float bleedDamage{"Trapper.Ability 2.Marked Target Bleed"_f[0]/100.f*game->GetPlayer()->GetAttack()};
const float bleedDamage{"Trapper.Ability 2.Marked Target Bleed"_f[0]*game->GetPlayer()->GetAttack()};
float bleedDuration{"Trapper.Ability 2.Marked Target Bleed"_f[1]};
const float timeBetweenTicks{"Trapper.Ability 2.Marked Target Bleed"_f[2]};

View File

@ -48,7 +48,7 @@ All rights reserved.
INCLUDE_game
INCLUDE_ITEM_CATEGORIES
INCLUDE_DATA
INCLUDE_GFX
void Menu::InitializeBlacksmithCraftingWindow(){
Menu*blacksmithWindow=CreateMenu(BLACKSMITH,CENTERED,game->GetScreenSize()-vi2d{52,52});
@ -209,7 +209,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
#pragma region Money Display
vf2d moneyIconPos={224+inventoryDescriptionWidth-24,28+blacksmithWindow->size.y-44+6};
auto moneyIcon=blacksmithWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
auto moneyIcon=blacksmithWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},"assets/money.png",DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
auto moneyDisplay=blacksmithWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;

View File

@ -44,8 +44,8 @@ All rights reserved.
INCLUDE_game
Blizzard::Blizzard(const vf2d pos,const float radius, const float lifetime,const int damage,const float tickRate,const std::pair<MinScale,MaxScale>snowSizeRange,const float emitterFreq,const bool upperLevel,const FriendlyType friendly)
:damage(damage),tickRate(tickRate),tickTimer(tickRate),radius(radius),friendly(friendly),blizzardSFX("Blizzard",pos),Effect(pos,lifetime,"aiming_target.png",upperLevel,(radius*2)*vf2d{1.f,1.f}/24.f,0.5f,{},{199,247,239,128},0.f,0.f,true)
,snow(std::make_unique<BlizzardSnowEmitter>(pos,"circle.png",radius*1.25f,snowSizeRange,emitterFreq,lifetime,upperLevel)){
:damage(damage),tickRate(tickRate),tickTimer(tickRate),radius(radius),friendly(friendly),blizzardSFX("Blizzard",pos),Effect(pos,lifetime,"assets/aiming_target.png",upperLevel,(radius*2)*vf2d{1.f,1.f}/24.f,0.5f,{},{199,247,239,128},0.f,0.f,true)
,snow(std::make_unique<BlizzardSnowEmitter>(pos,"assets/circle.png",radius*1.25f,snowSizeRange,emitterFreq,lifetime,upperLevel)){
for(int i:std::ranges::iota_view(0,200))snow->Emit();
}
Blizzard&Blizzard::operator=(const Blizzard&newEff){

View File

@ -61,14 +61,14 @@ DEFINE_STRATEGY(BOAR)
float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos());
if(m.canMove&&distToPlayer>=ConfigInt("Closein Range")/100.f*24){
m.RemoveBuff(BuffType::SELF_INFLICTED_SLOWDOWN);
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else
if(m.HasLineOfSight(game->GetPlayer()->GetPos())&&m.canMove&&distToPlayer<=ConfigInt("Backpedal Range")/100.f*24){
m.RemoveBuff(BuffType::SELF_INFLICTED_SLOWDOWN);
m.AddBuff(BuffType::SELF_INFLICTED_SLOWDOWN,INFINITE,(100-ConfigInt("Backpedal Movespeed"))/100.f);
m.target=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).rpoint(-100);
if(m.attackedByPlayer)goto ScratchPhaseTransition;
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
m.UpdateFacingDirection(game->GetPlayer()->GetPos());
}else{
ScratchPhaseTransition:
@ -109,7 +109,7 @@ DEFINE_STRATEGY(BOAR)
if(m.F(A::TARGET_TIMER)<=0||m.bumpedIntoTerrain||distToTarget<12.f){
TransitionToRecoveryPhase();
}else{
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
//m.PerformShootAnimation();
if(!m.canMove)TransitionToRecoveryPhase();
}

View File

@ -48,10 +48,10 @@ INCLUDE_MONSTER_LIST
INCLUDE_game
Bomb::Bomb(const vf2d pos,const float z,const float gravity,const float detonationTime,const float bombFadeoutTime,const float bombKnockbackFactor,const vf2d targetPos,const float explosionRadius,const int damage,const bool upperLevel,const FriendlyType friendly,const Pixel col,const vf2d scale)
:Bullet(pos,{},0.f,damage,"goblin_bomb.png",upperLevel,true,INFINITY,false,friendly,col,scale)
:Bullet(pos,{},0.f,damage,"assets/goblin_bomb.png",upperLevel,true,INFINITY,false,friendly,col,scale)
,explosionRadius(explosionRadius),gravity(gravity),detonationTime(detonationTime),bombFadeoutTime(bombFadeoutTime),bombKnockbackFactor(bombKnockbackFactor),targetPos(targetPos){
this->z=z;
bomb_animation.AddState("Fuse",ANIMATION_DATA.at("goblin_bomb_fuse.png"));
bomb_animation.AddState("Fuse",ANIMATION_DATA.at("assets/goblin_bomb_fuse.png"));
bomb_animation.ChangeState(animation,"Fuse");
}
void Bomb::Update(float fElapsedTime){
@ -103,7 +103,7 @@ BulletDestroyState Bomb::MonsterHit(Monster&monster,const uint8_t markStacksBefo
void Bomb::Draw(const Pixel blendCol)const{
Bullet::Draw(blendCol);
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},bomb_animation.GetFrame(animation).GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,bomb_animation.GetFrame(animation).GetSourceRect().size/2,bomb_animation.GetFrame(animation).GetSourceRect().pos,bomb_animation.GetFrame(animation).GetSourceRect().size,scale,fadeOutTime==0?col:Pixel{col.r,col.g,col.b,uint8_t(util::lerp(col.a,uint8_t(0),1-((fadeOutTime-GetFadeoutTimer())/fadeOutTime)))});
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},bomb_animation.GetFrame(animation).GetSourceImage().Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,bomb_animation.GetFrame(animation).GetSourceRect().size/2,bomb_animation.GetFrame(animation).GetSourceRect().pos,bomb_animation.GetFrame(animation).GetSourceRect().size,scale,fadeOutTime==0?col:Pixel{col.r,col.g,col.b,uint8_t(util::lerp(col.a,uint8_t(0),1-((fadeOutTime-GetFadeoutTimer())/fadeOutTime)))});
}
void Bomb::ModifyOutgoingDamageData(HurtDamageInfo&data){}

View File

@ -39,12 +39,12 @@ All rights reserved.
#include "DEFINES.h"
#include "safemap.h"
INCLUDE_GFX
class BombBoom:public Effect{
public:
inline BombBoom(vf2d pos,float lifetime,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false)
:Effect(pos,lifetime,"bomb_boom.png",upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){}
:Effect(pos,lifetime,"assets/bomb_boom.png",upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){}
inline bool Update(float fElapsedTime)override{
return Effect::Update(fElapsedTime);

View File

@ -48,7 +48,7 @@ INCLUDE_MONSTER_LIST
INCLUDE_ANIMATION_DATA
BurstBullet::BurstBullet(vf2d pos,vf2d vel,const Entity target,const float explodeDist,const int extraBulletCount,const float extraBulletHeadingAngleChange,const float extraBulletRadius,const vf2d extraBulletScale,const float extraBulletStartSpeed,const float extraBulletAcc,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col,vf2d scale)
:Bullet(pos,vel,radius,damage,"burstrotatebullet.png",upperLevel,false,INFINITE,true,friendly,col,scale),extraBulletStartSpeed(extraBulletStartSpeed),extraBulletAcc(extraBulletAcc),extraBulletRadius(extraBulletRadius),extraBulletScale(extraBulletScale),extraBulletHeadingAngleChange(extraBulletHeadingAngleChange),extraBulletCount(extraBulletCount),target(target),explodeDist(explodeDist),scaleOscillator({0.85f,0.85f},{1.f,1.f},0.3f){
:Bullet(pos,vel,radius,damage,"assets/burstrotatebullet.png",upperLevel,false,INFINITE,true,friendly,col,scale),extraBulletStartSpeed(extraBulletStartSpeed),extraBulletAcc(extraBulletAcc),extraBulletRadius(extraBulletRadius),extraBulletScale(extraBulletScale),extraBulletHeadingAngleChange(extraBulletHeadingAngleChange),extraBulletCount(extraBulletCount),target(target),explodeDist(explodeDist),scaleOscillator({0.85f,0.85f},{1.f,1.f},0.3f){
animation.mult=0.f; //Prevent animating.
}

View File

@ -43,7 +43,7 @@ All rights reserved.
#include "Ability.h"
INCLUDE_game
INCLUDE_GFX
class CharacterAbilityPreviewComponent:public MenuLabel{
Ability*ability;
@ -66,10 +66,14 @@ protected:
window.DrawRectDecal(rect.pos+vi2d{2,2},vi2d{int(rect.size.y)-4,int(rect.size.y)-4});
window.DrawDecal(iconPos,GFX[ability->icon].Decal(),{1.33f,1.33f});
vi2d descriptionPos=iconPos+vi2d{int(rect.size.y)-2,9};
vi2d descriptionPos=iconPos+vi2d{int(rect.size.y)-2,8};
const std::string description{ability->GetDescriptionWithPlayerModifiers()};
const float descriptionTextLabelBoxWidth{rect.size.x-int(rect.size.y)-8};
const float descriptionTextLabelBoxHeight{std::floor(rect.size.y-14.f)};
const float descriptionHeightRatio{std::min(1.f,descriptionTextLabelBoxHeight/game->GetWrappedTextSizeProp(description,descriptionTextLabelBoxWidth).y)};
window.DrawShadowStringPropDecal(descriptionPos-vf2d{0,10},ability->name,{0xFF,0xAF,0x56},BLACK,{0.8f,1.f},{0.8f,1.f},int(rect.size.x-(descriptionPos.x-rect.pos.x))-4);
window.DrawShadowStringPropDecal(descriptionPos,ability->description,WHITE,BLACK,{0.8f,1.f},{0.8f,1.f},int(rect.size.x-(descriptionPos.x-rect.pos.x))-4);
window.DrawShadowStringPropDecal(descriptionPos-vf2d{0,8},ability->GetNameWithPlayerModifiers(),{0xFF,0xAF,0x56},BLACK,{0.8f,1.f},{0.8f,1.f},descriptionTextLabelBoxWidth);
window.DrawShadowStringPropDecal(descriptionPos,description,WHITE,BLACK,{0.8f,descriptionHeightRatio},{0.8f,descriptionHeightRatio},descriptionTextLabelBoxWidth);
InputType controlType=KEY;
if(Input::UsingGamepad())controlType=CONTROLLER;

View File

@ -59,7 +59,7 @@ All rights reserved.
#include <bit>
INCLUDE_game
INCLUDE_GFX
#pragma region CharacterMenuWindow
namespace CharacterMenuWindow{
@ -131,7 +131,7 @@ void Menu::InitializeCharacterMenuWindow(){
characterMenuWindow->ADD("Character Label",MenuLabel)(geom2d::rect<float>{{0,-4},{float(windowSize.x*0.5f)-1,24}},"Character",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
characterMenuWindow->ADD("Equip Slot Outline",MenuComponent)(geom2d::rect<float>{{0,28},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END;
//Don't load this graphical element if testing mode is enabled.
characterMenuWindow->ADD("Character Rotating Display",CharacterRotatingDisplay)(geom2d::rect<float>{{118,18},{130,windowSize.y-28}},GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal())END;
characterMenuWindow->ADD("Character Rotating Display",CharacterRotatingDisplay)(geom2d::rect<float>{{118,18},{130,windowSize.y-28}},classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName)END;
characterMenuWindow->ADD("Level Class Outline",MenuComponent)(geom2d::rect<float>{{windowSize.x*0.5f+4.f,-4},{float(windowSize.x*0.5f)-4,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END;
characterMenuWindow->ADD("Level Class Display",MenuLabel)(geom2d::rect<float>{vf2d{windowSize.x*0.5f+10.f,0.f},{118.f,8.f}},std::format("Lv{} {}",game->GetPlayer()->Level(),game->GetPlayer()->GetClassName()),1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
@ -364,7 +364,7 @@ void Menu::InitializeCharacterMenuWindow(){
float y=14+i*28;
float labelX=24;
float labelY=24+i*26+28;
auto skillBox{characterMenuWindow->ADD(std::format("Skill Icon Label {}",i),MenuIconButton)(geom2d::rect<float>{{x,y+28},{24,24}},GFX[ability.get().icon].Decal(),DO_NOTHING)END};
auto skillBox{characterMenuWindow->ADD(std::format("Skill Icon Label {}",i),MenuIconButton)(geom2d::rect<float>{{x,y+28},{24,24}},ability.get().icon,DO_NOTHING)END};
auto skillNameLabel{characterMenuWindow->ADD(std::format("Skill Name Label {}",i),MenuLabel)(geom2d::rect<float>{{labelX+4,labelY-6},{96,24}},ability.get().GetNameWithPlayerModifiers())END};
skillBox->SetHoverFunc([slot](MenuFuncData data){
const auto&ability{game->GetPlayer()->GetAbility(slot)};
@ -415,7 +415,7 @@ void Menu::InitializeCharacterMenuWindow(){
auto&[ability,slot]{abilityBoxes[i]};
auto abilityIcon{Component<MenuIconButton>(data.menu.GetType(),std::format("Skill Icon Label {}",i))};
auto abilityText{Component<MenuLabel>(data.menu.GetType(),std::format("Skill Name Label {}",i))};
abilityIcon->SetIcon(GFX[ability.get().icon].Decal());
abilityIcon->SetIcon(ability.get().icon);
abilityText->SetLabel(ability.get().GetNameWithPlayerModifiers());
if(tabClicked==SKILLS){
if(abilityText->GetLabel()!="???"){ //Unknown abilities should remain hidden for the player's surprise.

View File

@ -44,14 +44,14 @@ INCLUDE_game
class CharacterRotatingDisplay:public MenuComponent{
protected:
Decal*icon;
std::string icon;
float timer=0;
float rotatingFactor=7;
float perspectiveFactor=6;
public:
inline CharacterRotatingDisplay(geom2d::rect<float>rect,Decal*icon)
inline CharacterRotatingDisplay(geom2d::rect<float>rect,const std::string&icon)
:MenuComponent(rect,"",DO_NOTHING,ButtonAttr::UNSELECTABLE),icon(icon){}
inline void SetIcon(Decal*icon){
inline void SetIcon(const std::string&icon){
this->icon=icon;
}
protected:
@ -63,7 +63,7 @@ protected:
}
}
virtual inline void DrawDecal(ViewPort&window,bool focused)override{
window.DrawWarpedDecal(icon,std::array<vf2d,4>{
window.DrawWarpedDecal(GFX[icon].Decal(),std::array<vf2d,4>{
rect.pos+vf2d{abs(sin(timer)),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor},
rect.pos+vf2d{0,rect.size.y}+vf2d{abs(sin(timer)),sin(timer)}*vf2d{rotatingFactor,perspectiveFactor},
rect.pos+rect.size+vf2d{-abs(sin(float(timer+PI))),sin(float(timer+PI))}*vf2d{rotatingFactor,perspectiveFactor},

View File

@ -41,12 +41,13 @@ All rights reserved.
#include "DEFINES.h"
#include "util.h"
#include "olcUTIL_Geometry2D.h"
#include"BitwiseEnum.h"
INCLUDE_game
ChargedArrow::ChargedArrow(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:lastLaserPos(pos),laserGraphic("laser.png"),
Bullet(pos,vel,radius,damage,"charged_shot_arrow.png",upperLevel,true,INFINITE,true,friendly,col){}
:lastLaserPos(pos),laserGraphic("assets/laser.png"),
Bullet(pos,vel,radius,damage,"assets/charged_shot_arrow.png",upperLevel,true,INFINITE,true,friendly,col){}
ChargedArrow::ChargedArrow(const std::string&shotArrowGraphic,const std::string&laserGraphic,vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:lastLaserPos(pos),laserGraphic(laserGraphic),

View File

@ -42,7 +42,7 @@ All rights reserved.
#include "SoundEffect.h"
INCLUDE_game
INCLUDE_GFX
class Checkbox:public MenuComponent{
protected:
@ -80,8 +80,8 @@ public:
MenuComponent::DrawDecal(window,focused);
if(checked){
const vf2d scale{GetSize()/GFX["checkmark.png"].Sprite()->Size()};
window.DrawDecal(rect.pos,GFX["checkmark.png"].Decal(),scale);
const vf2d scale{GetSize()/GFX["assets/checkmark.png"].Sprite()->Size()};
window.DrawDecal(rect.pos,GFX["assets/checkmark.png"].Decal(),scale);
}
}
};

View File

@ -69,10 +69,11 @@ namespace classutils{//Classes have bit-wise operator capabilities.
}
};
#define CONFIG_F(var)e.IsFriendly() ? var##_F : Monster::STRATEGY::_GetFloat(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName())
#define CONFIG_I(var)e.IsFriendly() ? var##_I : Monster::STRATEGY::_GetInt(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName())
#define CONFIG_S(var)e.IsFriendly() ? var##_S : Monster::STRATEGY::_GetString(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName())
#define CONFIG_F(var)(e.IsFriendly() ? var##_F : Monster::STRATEGY::_GetFloat(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName()))
#define CONFIG_f(var,index)(e.IsFriendly() ? var##_f[index] : Monster::STRATEGY::_GetFloat(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName(),index))
#define CONFIG_I(var)(e.IsFriendly() ? var##_I : Monster::STRATEGY::_GetInt(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName()))
#define CONFIG_S(var)(e.IsFriendly() ? var##_S : Monster::STRATEGY::_GetString(*e.ToMonster(),var,(*e.ToMonster()).GetStrategyName()))
#define IFPLAYER e.ForPlayer([](Player&p){
#define IFMONSTER e.ForMonster([](Monster&m){
#define IFPLAYER e.ForPlayer([&](Player&p){
#define IFMONSTER e.ForMonster([&](Monster&m){
#define ENDIF });

View File

@ -58,7 +58,7 @@ namespace classutils{
static inline ClassInfo GetClassInfo(std::string className){
ClassInfo data{
DATA.GetProperty(className+".ClassName").GetString(),
DATA.GetProperty(className+".FullRender").GetString(),
"assets/"+DATA.GetProperty(className+".FullRender").GetString(),
DATA.GetProperty(className+".BaseHealth").GetInt(),
DATA.GetProperty(className+".BaseAtk").GetInt(),
float(DATA.GetProperty(className+".HealthGrowthRate").GetReal()),

View File

@ -43,19 +43,22 @@ All rights reserved.
#include "CharacterAbilityPreviewComponent.h"
INCLUDE_game
INCLUDE_GFX
INCLUDE_DATA
using A=Attribute;
void Menu::InitializeClassInfoWindow(){
Menu*classInfoWindow=CreateMenu(CLASS_INFO,CENTERED,game->GetScreenSize()-vi2d{24,0});
Menu*classSelectionWindow=Menu::menus[CLASS_SELECTION];
ClassInfo data=classutils::GetClassInfo(classSelectionWindow->S(A::CLASS_SELECTION));
game->GetPlayer()->SetBaseStat("Attack",data.baseAtk);
auto label=classInfoWindow->ADD("Class Name",MenuLabel)(geom2d::rect<float>{{0,0},{classInfoWindow->size.x-1,24}},data.className,2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
classInfoWindow->ADD("Rotating Character Display",CharacterRotatingDisplay)(geom2d::rect<float>{{-20,30},{144,180}},GFX[data.classFullImgName].Decal())END;
classInfoWindow->ADD("Rotating Character Display",CharacterRotatingDisplay)(geom2d::rect<float>{{-20,30},{144,180}},data.classFullImgName)END;
vf2d healthDisplayLabelPos={classInfoWindow->size.x/3,label->GetPos().y+24};
vf2d labelSize={2*classInfoWindow->size.x/3-1,16};

View File

@ -49,7 +49,7 @@ All rights reserved.
INCLUDE_game
INCLUDE_ITEM_CATEGORIES
INCLUDE_DATA
INCLUDE_GFX
void Menu::InitializeConsumableCraftingWindow(){
Menu*consumableCraftingWindow=CreateMenu(CRAFT_CONSUMABLE,CENTERED,game->GetScreenSize()-vi2d{52,52});
@ -130,7 +130,7 @@ void Menu::InitializeConsumableCraftingWindow(){
#pragma region Money Display
vf2d moneyIconPos={224+inventoryDescriptionWidth-24,28+consumableCraftingWindow->size.y-44+6};
auto moneyIcon=consumableCraftingWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
auto moneyIcon=consumableCraftingWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},"assets/money.png",DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
auto moneyDisplay=consumableCraftingWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;

View File

@ -78,11 +78,11 @@ DEFINE_STRATEGY(CRAB)
}else
if(outsideMaxShootingRange){
m.target=game->GetPlayer()->GetPos();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else
if(distToPlayer<ConfigPixels("Run Away Range")){
m.target=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).upoint(-1);
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else
if(distToPlayer>=ConfigPixelsArr("Random Direction Range",0)&&distToPlayer<ConfigPixelsArr("Random Direction Range",1)){
#define CW true
@ -91,7 +91,7 @@ DEFINE_STRATEGY(CRAB)
float dirFromPlayer=util::angleTo(game->GetPlayer()->GetPos(),m.GetPos());
float targetDir=m.B(A::RANDOM_DIRECTION)==CW?dirFromPlayer+PI/4:dirFromPlayer-PI/4;
m.target=game->GetPlayer()->GetPos()+vf2d{m.F(A::RANDOM_RANGE),targetDir}.cart();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
m.F(A::CHASE_TIMER)=1.f;
}
}break;
@ -105,7 +105,7 @@ DEFINE_STRATEGY(CRAB)
}break;
case CHARGE:{
m.F(A::CHASE_TIMER)-=fElapsedTime;
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
if(m.F(A::CHASE_TIMER)<=0.f||m.ReachedTargetPos()){
SETPHASE(MOVE);
m.B(A::RANDOM_DIRECTION)=util::random()%2;

View File

@ -57,7 +57,6 @@ using MonsterSpawnerID=int;
#define INCLUDE_EMITTER_LIST extern std::vector<std::unique_ptr<IEmitter>>EMITTER_LIST;
#define INCLUDE_DATA extern utils::datafile DATA;
#define INCLUDE_TILE_ANIMATION_DATA extern std::map<int,std::vector<std::pair<int,float>>>TILE_ANIMATION_DATA;
#define INCLUDE_GFX extern safemap<std::string,Renderable>GFX;
#define INCLUDE_ITEM_DATA extern safemap<std::string,ItemInfo>ITEM_DATA;
#define INCLUDE_ITEM_CATEGORIES extern safemap<std::string,std::set<std::string>>ITEM_CATEGORIES;
#define DO_NOTHING [](MenuFuncData data){return true;}
@ -69,9 +68,6 @@ using MonsterSpawnerID=int;
#define INCLUDE_PACK_KEY extern std::string PACK_KEY;
#define INCLUDE_BACKDROP_DATA extern std::map<BackdropName,Renderable>BACKDROP_DATA;
#define INCLUDE_FOREDROP_DATA extern std::map<BackdropName,Renderable>FOREDROP_DATA;
#define INCLUDE_CENTERED extern const vf2d Menu::CENTERED;

View File

@ -49,7 +49,7 @@ DaggerSlash::DaggerSlash(Monster&sourceMonster,const std::string&image,float rad
:Bullet(sourceMonster.GetPos(),{},radius,damage,image,upperLevel,false,daggerFrameDuration*ANIMATION_DATA["goblin_sword_slash.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerSlashDistance(daggerSlashDistance),facingDir(facingDir),knockbackAmt(knockbackAmt){}
void DaggerSlash::Update(float fElapsedTime){
ANIMATION_DATA["goblin_sword_slash.png"].ChangeFrameDuration(frameDuration);
ANIMATION_DATA["assets/goblin_sword_slash.png"].ChangeFrameDuration(frameDuration);
pos=sourceMonster.GetPos();
#pragma region Dagger slash offset
switch(facingDir){
@ -87,13 +87,13 @@ void DaggerSlash::Update(float fElapsedTime){
#pragma endregion
}
BulletDestroyState DaggerSlash::PlayerHit(Player*player){
game->AddEffect(Effect{pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}});
game->AddEffect(Effect{pos,0,"assets/lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}});
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
Deactivate();
return BulletDestroyState::KEEP_ALIVE;
}
BulletDestroyState DaggerSlash::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
game->AddEffect(Effect{pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}});
game->AddEffect(Effect{pos,0,"assets/lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}});
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
Deactivate();
return BulletDestroyState::KEEP_ALIVE;

View File

@ -46,17 +46,17 @@ INCLUDE_game
INCLUDE_ANIMATION_DATA
DaggerStab::DaggerStab(Monster&sourceMonster,const std::string&image,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,FriendlyType friendly,Pixel col)
:Bullet(sourceMonster.GetPos(),{},radius,damage,image,upperLevel,false,daggerFrameDuration*ANIMATION_DATA["dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
:Bullet(sourceMonster.GetPos(),{},radius,damage,image,upperLevel,false,daggerFrameDuration*ANIMATION_DATA["assets/dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerStabDistance(daggerStabDistance),facingDir(facingDir),daggerPositionOffsets(offsets),knockbackAmt(knockbackAmt){}
void DaggerStab::Update(float fElapsedTime){
ANIMATION_DATA["dagger_stab.png"].ChangeFrameDuration(frameDuration);
ANIMATION_DATA["assets/dagger_stab.png"].ChangeFrameDuration(frameDuration);
#pragma region Dagger Position Offset
vf2d daggerOffset=daggerPositionOffsets.offsets[facingDir];
pos=sourceMonster.GetPos()+daggerOffset;
#pragma endregion
#pragma region Dagger stabbing
if(lifetime<=ANIMATION_DATA["dagger_stab.png"].GetTotalAnimationDuration()*0.6667f&&
lifetime>=ANIMATION_DATA["dagger_stab.png"].GetTotalAnimationDuration()*0.3333f){
if(lifetime<=ANIMATION_DATA["assets/dagger_stab.png"].GetTotalAnimationDuration()*0.6667f&&
lifetime>=ANIMATION_DATA["assets/dagger_stab.png"].GetTotalAnimationDuration()*0.3333f){
switch(facingDir){
case Direction::NORTH:{
pos+=vf2d{0,-daggerStabDistance};
@ -93,13 +93,13 @@ void DaggerStab::Update(float fElapsedTime){
#pragma endregion
}
BulletDestroyState DaggerStab::PlayerHit(Player*player){
game->AddEffect(Effect{pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}});
game->AddEffect(Effect{pos,0,"assets/lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}});
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
Deactivate();
return BulletDestroyState::KEEP_ALIVE;
}
BulletDestroyState DaggerStab::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
game->AddEffect(Effect{pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}});
game->AddEffect(Effect{pos,0,"assets/lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}});
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
Deactivate();
return BulletDestroyState::KEEP_ALIVE;

View File

@ -40,12 +40,13 @@ All rights reserved.
#include <ranges>
#include "util.h"
#include "AdventuresInLestoria.h"
#include"BitwiseEnum.h"
INCLUDE_ANIMATION_DATA
INCLUDE_game
DeadlyDash::DeadlyDash(vf2d startPos,vf2d endPos,float radius,float afterImagesLingeringTime,int damage,float knockbackAmt,bool upperLevel,FriendlyType friendly,float afterImagesSpreadDist,const std::string&animation,Pixel col)
:animation(animation),startPos(startPos),endPos(endPos),checkRadius(radius),afterImagesSpreadDist(afterImagesSpreadDist),afterImagesLingeringTime(afterImagesLingeringTime),knockbackAmt(knockbackAmt),Bullet({},{},0.f,damage,"circle.png",upperLevel,true,INFINITE,false,friendly,col,{1.f,1.f},0.f){
:animation(animation),startPos(startPos),endPos(endPos),checkRadius(radius),afterImagesSpreadDist(afterImagesSpreadDist),afterImagesLingeringTime(afterImagesLingeringTime),knockbackAmt(knockbackAmt),Bullet({},{},0.f,damage,"assets/circle.png",upperLevel,true,INFINITE,false,friendly,col,{1.f,1.f},0.f){
const geom2d::line<float>afterImageLine{startPos,endPos};
const int afterImageCount{int(afterImageLine.length()/afterImagesSpreadDist)+1};
lifetime=afterImageCount*afterImagesLingeringTime;
@ -87,7 +88,7 @@ void DeadlyDash::Draw(const Pixel blendCol)const{
const vf2d drawPos{geom2d::line<float>{startPos,endPos}.rpoint(offsetDist)};
const Animate2D::Frame&frame{animation.GetFrame(animationFrameTimer)};
game->SetDecalMode(DecalMode::ADDITIVE);
game->view.DrawPartialRotatedDecal(drawPos,frame.GetSourceImage()->Decal(),0.f,frame.GetSourceRect().size/2,frame.GetSourceRect().pos,frame.GetSourceRect().size,{game->GetPlayer()->GetSizeMult(),game->GetPlayer()->GetSizeMult()},{col.r,col.g,col.b,alpha});
game->view.DrawPartialRotatedDecal(drawPos,frame.GetSourceImage().Decal(),0.f,frame.GetSourceRect().size/2,frame.GetSourceRect().pos,frame.GetSourceRect().size,{game->GetPlayer()->GetSizeMult(),game->GetPlayer()->GetSizeMult()},{col.r,col.g,col.b,alpha});
game->SetDecalMode(DecalMode::NORMAL);
}
}

View File

@ -43,7 +43,7 @@ All rights reserved.
#include "Unlock.h"
INCLUDE_game
INCLUDE_GFX
void Menu::InitializeDeathWindow(){
Menu*deathWindow=CreateMenu(MenuType::DEATH,CENTERED,vi2d{96,52});

View File

@ -40,11 +40,11 @@ All rights reserved.
#include "AdventuresInLestoria.h"
#include "util.h"
INCLUDE_GFX
INCLUDE_game
Debris::Debris(const vf2d pos,const vf2d vel,const int damage,const float radius,const float knockbackAmt,const float rotSpd,const float lifetime,bool upperLevel,FriendlyType friendly,Pixel col,const vf2d scale)
:Bullet(pos,vel,radius,damage,"commercial_assets/wind_solid_objects.png",upperLevel,false,lifetime,false,friendly,col,scale),knockbackAmt(knockbackAmt),rotatingSpd(rotSpd),randomFrame(util::random(GFX["commercial_assets/wind_solid_objects.png"].Sprite()->Size().x/24)){}
:Bullet(pos,vel,radius,damage,"assets/commercial_assets/wind_solid_objects.png",upperLevel,false,lifetime,false,friendly,col,scale),knockbackAmt(knockbackAmt),rotatingSpd(rotSpd),randomFrame(util::random(GFX["assets/commercial_assets/wind_solid_objects.png"].Sprite()->Size().x/24)){}
void Debris::Update(float fElapsedTime){
image_angle+=rotatingSpd*fElapsedTime;
}
@ -59,7 +59,7 @@ BulletDestroyState Debris::MonsterHit(Monster&monster,const uint8_t markStacksBe
return BulletDestroyState::KEEP_ALIVE;
}
void Debris::Draw(const Pixel blendCol)const{
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GetFrame().GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2+image_angle:image_angle,{12,12},vf2d{randomFrame*24.f,0.f},{24,24},scale,blendCol);
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GetFrame().GetSourceImage().Decal(),rotates?atan2(vel.y,vel.x)-PI/2+image_angle:image_angle,{12,12},vf2d{randomFrame*24.f,0.f},{24,24},scale,blendCol);
}
void Debris::ModifyOutgoingDamageData(HurtDamageInfo&data){}

View File

@ -42,7 +42,7 @@ All rights reserved.
INCLUDE_ANIMATION_DATA
INCLUDE_game
INCLUDE_GFX
//Note: The fadeout time activates when the original lifetime of the bullet expires! It doesn't begin immediately.
Effect::Effect(vf2d pos,float lifetime,const std::string&imgFile,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
@ -90,7 +90,7 @@ void Effect::_Draw()const{
if(GetZ()>0){
vf2d shadowScale=vf2d{8*size.x/3.f,1}/std::max(1.f,GetZ()/8);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,12*size.y},GFX["circle.png"].Decal(),shadowScale,BLACK);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,12*size.y},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
Pixel blendCol{col};
@ -108,10 +108,10 @@ void Effect::_Draw()const{
void Effect::Draw(const Pixel blendCol)const{
if(GetZ()>0){
vf2d shadowScale=vf2d{8*size.x/3.f,1}/std::max(1.f,GetZ()/24);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,6*size.x},GFX["circle.png"].Decal(),shadowScale,BLACK);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,6*size.x},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
//game->view.DrawDecal(pos,GetFrame().GetSourceImage()->Decal());
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,blendCol);
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()},GetFrame().GetSourceImage().Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,blendCol);
//game->view.DrawRectDecal(pos,GetFrame().GetSourceRect().size);
}

View File

@ -24,7 +24,8 @@ using EffectT=std::variant<
BlackHole,
ExpandingRing,
FallEffect,
FallWShadowEffect
FallWShadowEffect,
GroundSlamEffect
>;
struct EffectOverloads{

View File

@ -169,7 +169,7 @@ struct ForegroundEffect:Effect{
struct SpellCircle:Effect{
SpellCircle(vf2d pos,float lifetime,std::string imgFile,std::string spellInsigniaFile,bool upperLevel,float size=1.0f,float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false,float insigniaSize=1.0f,float insigniaFadeout=0.0f,vf2d insigniaSpd={},Pixel insigniaCol=WHITE,float insigniaRotation=0,float insigniaRotationSpd=0,bool insigniaAdditiveBlending=false);
SpellCircle(vf2d pos,float lifetime,std::string imgFile,std::string spellInsigniaFile,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false,vf2d insigniaSize={1,1},float insigniaFadeout=0.0f,vf2d insigniaSpd={},Pixel insigniaCol=WHITE,float insigniaRotation=0,float insigniaRotationSpd=0,bool insigniaAdditiveBlending=false);
Effect spellInsignia{vf2d{},0.f,"spell_insignia.png",false,{}};
Effect spellInsignia{vf2d{},0.f,"assets/spell_insignia.png",false,{}};
virtual bool Update(float fElapsedTime)override final; //NOTE: In most cases, call Effect::Update() in your overwritten function!
virtual void Draw(const Pixel blendCol)const override final; //NOTE: In most cases, call Effect::Update() in your overwritten function!
};
@ -350,4 +350,25 @@ public:
bool Update(float fElapsedTime)override;
private:
mutableconst float gravity;
};
class GroundSlamEffect:public Effect{
public:
struct GroundSlamSettings{
float range;
float knockbackAmt;
float knockbackReduction;
float knockbackWeightFactor;
int damage;
FriendlyType friendly;
float visualRadius;
bool hasSlamShockEnchant;
std::string soundEffectName;
};
GroundSlamEffect(vf2d pos,const float z,const float lifetime,GroundSlamSettings settings,bool upperLevel,float fadeout=0.0f,Pixel col=WHITE,bool additiveBlending=false);
bool Update(float fElapsedTime)override;
private:
mutableconst GroundSlamSettings settings;
};

View File

@ -40,18 +40,19 @@ All rights reserved.
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"
#include"BitwiseEnum.h"
INCLUDE_game
EnergyBolt::EnergyBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:Bullet(pos,vel,radius,damage,
"energy_bolt.png",upperLevel,game->GetPlayer()->HasEnchant("Piercing Bolt")?true:false,INFINITE,true,friendly,col){}
"assets/energy_bolt.png",upperLevel,game->GetPlayer()->HasEnchant("Piercing Bolt")?true:false,INFINITE,true,friendly,col){}
void EnergyBolt::Update(float fElapsedTime){
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
if(lastParticleSpawn==0){
lastParticleSpawn="Wizard.Auto Attack.ParticleFrequency"_F;
game->AddEffect(Effect{pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,"energy_particle.png",upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParticleSpeedRange"_FRange,"Wizard.Auto Attack.ParticleSpeedRange"_FRange}});
game->AddEffect(Effect{pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,"assets/energy_particle.png",upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParticleSpeedRange"_FRange,"Wizard.Auto Attack.ParticleSpeedRange"_FRange}});
}
if(distanceTraveled>"Wizard.Auto Attack.Range"_F&&IsActivated()){
fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F;
@ -61,14 +62,14 @@ void EnergyBolt::Update(float fElapsedTime){
BulletDestroyState EnergyBolt::PlayerHit(Player*player)
{
fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F;
game->AddEffect(Effect{player->GetPos(),0,"splash_effect.png",upperLevel,player->GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F});
game->AddEffect(Effect{player->GetPos(),0,"assets/splash_effect.png",upperLevel,player->GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F});
return BulletDestroyState::KEEP_ALIVE;
}
BulletDestroyState EnergyBolt::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit)
{
if(!game->GetPlayer()->HasEnchant("Piercing Bolt"))fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F;
game->AddEffect(Effect{monster.GetPos(),0,"splash_effect.png",upperLevel,monster.GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F});
game->AddEffect(Effect{monster.GetPos(),0,"assets/splash_effect.png",upperLevel,monster.GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F});
if(hitList.size()==1)damage=ceil(damage*"Piercing Bolt"_ENC["MULTI TARGET DAMAGE"]/100.f);
return BulletDestroyState::KEEP_ALIVE;
}

View File

@ -144,9 +144,25 @@ Buff&Entity::AddBuff(BuffType type,float duration,float intensity){
CallClassFunc(AddBuff(type,duration,intensity));
}
Buff&Entity::AddBuff(BuffType type,float duration,float intensity,std::set<std::string>attr){
CallClassFunc(AddBuff(type,duration,intensity,attr));
}
void Entity::ForPlayer(std::function<void(Player&p)>func){
if(is(Player*))func(*get(Player*));
}
void Entity::ForMonster(std::function<void(Monster&p)>func){
if(is(Monster*))func(*get(Monster*));
}
const float Entity::GetZ()const{
CallClassFunc(GetZ());
}
void Entity::Spin(float duration,float spinSpd){
CallClassFunc(Spin(duration,spinSpd));
}
void Entity::Knockback(vf2d vel){
CallClassFunc(Knockback(vel));
}

View File

@ -75,12 +75,16 @@ public:
const float GetMoveSpdMult()const;
const float GetSizeMult()const;
const int GetAttack()const;
const float GetZ()const;
const FriendlyType IsFriendly()const;
const State::State GetState()const;
const bool CanMove()const;
const bool HasEnchant(const std::string&enchant)const;
float&GetBlockTimer()const;
Buff&AddBuff(BuffType type,float duration,float intensity);
Buff&AddBuff(BuffType type,float duration,float intensity,std::set<std::string>attr);
void Spin(float duration,float spinSpd);
void Knockback(vf2d vel);
private:
mutableconst std::variant<Monster*,Player*>entity;
inline bool operator==(const Entity&rhs){return entity==rhs.entity;}

View File

@ -52,10 +52,10 @@ public:
inline void OnEquipStatsUpdate()override{
const std::weak_ptr<Item>equip=Inventory::GetEquip(slot);
if(!ISBLANK(equip)){
icon=const_cast<Decal*>(equip.lock()->Icon().Decal());
icon="assets/items/"+equip.lock()->ActualName()+".png";
itemRef=equip;
}else{
icon=nullptr;
icon={};
itemRef=Item::BLANK;
}
}
@ -64,7 +64,7 @@ public:
valid=!ISBLANK(itemRef);
if(!valid){
icon=nullptr;
icon={};
}
if(hovered){

View File

@ -5,6 +5,9 @@ INCLUDE_game
#ifndef __EMSCRIPTEN__
void Error::debug(std::stringstream&str,std::source_location loc){
#ifdef UNIT_TESTING
return;
#endif
std::stringstream finalOutput;
finalOutput<<loc.file_name()<<"("<<loc.line()<<":"<<loc.column()<<") "<<loc.function_name()<<": "<<str.str();
debugLogger<<finalOutput.str()<<std::endl;

View File

@ -42,14 +42,15 @@ All rights reserved.
#include "config.h"
#include "util.h"
#include "SoundEffect.h"
#include"BitwiseEnum.h"
INCLUDE_ANIMATION_DATA
INCLUDE_game
ExplosiveTrap::ExplosiveTrap(vf2d pos,float radius,float explosionRadius,float automaticDetonationTime,int damage,float fadeinTime,float fadeoutTime,float activationWaitTime,bool upperLevel,bool hitsMultiple,float lifetime,FriendlyType friendly,Pixel col,vf2d scale)
:activationWaitTime(activationWaitTime),automaticDetonationTime(automaticDetonationTime),activationRadius(radius),explosionRadius(explosionRadius),explosionCount(game->GetPlayer()->HasEnchant("Concussive Trap")?"Concussive Trap"_ENC["TRAP EXPLODE COUNT"]:1),Bullet(pos,{},0.f,damage,"Ability Icons/explosive_trap.png",upperLevel,hitsMultiple,INFINITE,false,friendly,col,scale,0.f,"Trap Hit"){
:activationWaitTime(activationWaitTime),automaticDetonationTime(automaticDetonationTime),activationRadius(radius),explosionRadius(explosionRadius),explosionCount(game->GetPlayer()->HasEnchant("Concussive Trap")?"Concussive Trap"_ENC["TRAP EXPLODE COUNT"]:1),Bullet(pos,{},0.f,damage,"assets/Ability Icons/explosive_trap.png",upperLevel,hitsMultiple,INFINITE,false,friendly,col,scale,0.f,"Trap Hit"){
fadeInTime=fadeinTime;
animation.AddState("explosive_trap.png",ANIMATION_DATA["explosive_trap.png"]);
animation.AddState("assets/explosive_trap.png",ANIMATION_DATA["assets/explosive_trap.png"]);
if(!friendly)ERR("WARNING! Trying to use unimplemented enemy version of the Explosive Trap Bullet!");
}
@ -65,7 +66,7 @@ void ExplosiveTrap::Update(float fElapsedTime){
activationWaitTime-=fElapsedTime;
if(activationWaitTime<=0.f){
radius=activationRadius;
animation.ChangeState(internal_animState,"explosive_trap.png");
animation.ChangeState(internal_animState,"assets/explosive_trap.png");
beepCount=std::min(4U,beepCount+1U);
SoundEffect::PlaySFX(std::format("Beep {}",beepCount),pos);
lastBeepTime=1.f;
@ -103,7 +104,7 @@ void ExplosiveTrap::Detonate(){
}
}
auto explodeEffect{game->AddEffect(Effect{pos,ANIMATION_DATA["explosionframes.png"].GetTotalAnimationDuration()-0.2f,"explosionframes.png",OnUpperLevel(),scale*2.f,0.2f,vf2d{0,-6.f},WHITE,util::random(2*PI),0.f})};
auto explodeEffect{game->AddEffect(Effect{pos,ANIMATION_DATA["assets/explosionframes.png"].GetTotalAnimationDuration()-0.2f,"assets/explosionframes.png",OnUpperLevel(),scale*2.f,0.2f,vf2d{0,-6.f},WHITE,util::random(2*PI),0.f})};
explodeEffect.get().scaleSpd={0.125f,0.125f};
SoundEffect::PlaySFX("Explosion",pos);
explosionCount--;

View File

@ -42,12 +42,13 @@ All rights reserved.
#include "util.h"
#include <ranges>
#include "SoundEffect.h"
#include"BitwiseEnum.h"
INCLUDE_game
FallingBullet::FallingBullet(const std::string&imgName,vf2d targetPos,vf2d vel,float zVel,float indicatorDisplayTime,float radius,int damage,bool upperLevel,bool hitsMultiple,float knockbackAmt,float lifetime,FriendlyType friendly,Pixel spellCircleCol,vf2d scale,float image_angle,float spellCircleRotation,float spellCircleRotationSpd,Pixel insigniaCol,float insigniaRotation,float insigniaRotationSpd)
:Bullet(targetPos,vel,0.f,damage,imgName,upperLevel,false,lifetime+0.1f,false,friendly,WHITE,scale,image_angle),targetPos(targetPos),zVel(zVel),indicatorDisplayTime(indicatorDisplayTime),knockbackAmt(knockbackAmt),collisionRadius(radius),
indicator(targetPos,lifetime+0.1f,"range_indicator.png","spell_insignia.png",upperLevel,radius/12.f,0.5f,{},spellCircleCol,spellCircleRotation,spellCircleRotationSpd,false,radius/12.f,0.f,{},insigniaCol,insigniaRotation,insigniaRotationSpd,false){
indicator(targetPos,lifetime+0.1f,"assets/range_indicator.png","assets/spell_insignia.png",upperLevel,radius/12.f,0.5f,{},spellCircleCol,spellCircleRotation,spellCircleRotationSpd,false,radius/12.f,0.f,{},insigniaCol,insigniaRotation,insigniaRotationSpd,false){
pos+=-vel*lifetime;
z=-zVel*lifetime;
}
@ -71,12 +72,12 @@ void FallingBullet::Update(float fElapsedTime){
}
}
game->ProximityKnockback(pos,collisionRadius,knockbackAmt,HurtType::PLAYER|HurtType::MONSTER);
for(int i:std::ranges::iota_view(0,30))game->AddEffect(Effect{pos-vf2d{0.f,GetZ()},util::random_range(0.05f,0.2f),"circle_outline.png",OnUpperLevel(),util::random_range(0.5f,1.f),0.2f,vf2d{util::random_range(-10.f,10.f),util::random_range(-3.f,0.f)},PixelLerp(BLACK,col,util::random(1.f)),0.f,0.f,true});
for(int i:std::ranges::iota_view(0,30))game->AddEffect(Effect{pos-vf2d{0.f,GetZ()},util::random_range(0.05f,0.2f),"assets/circle_outline.png",OnUpperLevel(),util::random_range(0.5f,1.f),0.2f,vf2d{util::random_range(-10.f,10.f),util::random_range(-3.f,0.f)},PixelLerp(BLACK,col,util::random(1.f)),0.f,0.f,true});
Deactivate();
}
}else{
if(lastTrailEffect<=0.f){
game->AddEffect(Effect{pos-vf2d{0.f,GetZ()},util::random_range(0.05f,0.2f),"circle_outline.png",OnUpperLevel(),util::random_range(0.5f,1.f),0.2f,vf2d{util::random_range(-3.f,3.f),util::random_range(-3.f,3.f)},PixelLerp(BLACK,col,util::random(1.f)),0.f,0.f,true});
game->AddEffect(Effect{pos-vf2d{0.f,GetZ()},util::random_range(0.05f,0.2f),"assets/circle_outline.png",OnUpperLevel(),util::random_range(0.5f,1.f),0.2f,vf2d{util::random_range(-3.f,3.f),util::random_range(-3.f,3.f)},PixelLerp(BLACK,col,util::random(1.f)),0.f,0.f,true});
}
}
indicator.Update(fElapsedTime);

View File

@ -40,7 +40,7 @@ All rights reserved.
#include "Player.h"
Feather::Feather(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool hitsMultiple,float lifetime,FriendlyType friendly,Pixel col,vf2d scale,float image_angle)
:Bullet(pos,vel,radius,damage,"feather.png",upperLevel,hitsMultiple,lifetime,true,friendly,col){
:Bullet(pos,vel,radius,damage,"assets/feather.png",upperLevel,hitsMultiple,lifetime,true,friendly,col){
SetBulletType(BulletType::FEATHER);
}

View File

@ -41,6 +41,7 @@ All rights reserved.
#include "DEFINES.h"
#include "util.h"
#include "SoundEffect.h"
#include"BitwiseEnum.h"
INCLUDE_game
@ -48,8 +49,8 @@ INCLUDE_MONSTER_LIST
FireBolt::FireBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:Bullet(pos,vel,radius,damage,
"energy_bolt.png",upperLevel,false,INFINITE,true,friendly,col){
if(game->GetPlayer()->HasEnchant("Trail of Fire")&&friendly)flameTrail=game->AddEffect(TrailEffect{pos,"Trail of Fire"_ENC["TRAIL DURATION"],"FlamesTexture.png",int("Trail of Fire"_ENC["TRAIL DAMAGE"]/100.f*game->GetPlayer()->GetAttack()),"Trail of Fire"_ENC["TRAIL TICK FREQUENCY"],upperLevel,1.f,vf2d{1.f,2.f},30000.f,Oscillator<Pixel>{{255,0,0,128},Pixel(0xE74F30),2.f},EffectType::TRAIL_OF_FIRE,true},true);
"assets/energy_bolt.png",upperLevel,false,INFINITE,true,friendly,col){
if(game->GetPlayer()->HasEnchant("Trail of Fire")&&friendly)flameTrail=game->AddEffect(TrailEffect{pos,"Trail of Fire"_ENC["TRAIL DURATION"],"assets/FlamesTexture.png",int("Trail of Fire"_ENC["TRAIL DAMAGE"]/100.f*game->GetPlayer()->GetAttack()),"Trail of Fire"_ENC["TRAIL TICK FREQUENCY"],upperLevel,1.f,vf2d{1.f,2.f},30000.f,Oscillator<Pixel>{{255,0,0,128},Pixel(0xE74F30),2.f},EffectType::TRAIL_OF_FIRE,true},true);
SoundEffect::PlaySFX("Wizard Fire Bolt Shoot",SoundEffect::CENTERED);
}
@ -57,18 +58,18 @@ void FireBolt::Update(float fElapsedTime){
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
if(lastParticleSpawn==0){
lastParticleSpawn="Wizard.Ability 1.ParticleFrequency"_F;
game->AddEffect(Effect{pos,"Wizard.Ability 1.ParticleLifetimeRange"_FRange,"energy_particle.png",upperLevel,"Wizard.Ability 1.ParticleSizeRange"_FRange,"Wizard.Ability 1.ParticleFadeoutTime"_F,vf2d{"Wizard.Ability 1.ParticleXSpeedRange"_FRange,"Wizard.Ability 1.ParticleYSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.ParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.ParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.ParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.ParticleAlphaRange"_FRange)}});
game->AddEffect(Effect{pos,"Wizard.Ability 1.ParticleLifetimeRange"_FRange,"assets/energy_particle.png",upperLevel,"Wizard.Ability 1.ParticleSizeRange"_FRange,"Wizard.Ability 1.ParticleFadeoutTime"_F,vf2d{"Wizard.Ability 1.ParticleXSpeedRange"_FRange,"Wizard.Ability 1.ParticleYSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.ParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.ParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.ParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.ParticleAlphaRange"_FRange)}});
}
if(distanceTraveled>"Wizard.Ability 1.Max Range"_F&&IsActivated()){
fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F;
for(int i=0;i<"Wizard.Ability 1.BulletHitExplosionParticleCount"_I;i++){
game->AddEffect(Effect{pos,"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}});
game->AddEffect(Effect{pos,"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"assets/circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}});
}
game->SetupWorldShake("Wizard.Ability 1.WorldShakeTime"_F);
if(friendly)game->Hurt(pos,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,int("Wizard.Ability 1.BulletHitExplosionDamageMult"_F*game->GetPlayer()->GetAttack()),OnUpperLevel(),0,HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
else game->Hurt(pos,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,damage,OnUpperLevel(),0,HurtType::PLAYER);
game->AddEffect(Effect{pos,0,"splash_effect.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel});
game->AddEffect(Effect{pos,0,"assets/splash_effect.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel});
SoundEffect::PlaySFX("Wizard Fire Bolt Hit",pos);
}
@ -80,10 +81,10 @@ BulletDestroyState FireBolt::PlayerHit(Player*player)
{
fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F;
for(int i=0;i<"Wizard.Ability 1.BulletHitExplosionParticleCount"_I;i++){
game->AddEffect(Effect{player->GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}});
game->AddEffect(Effect{player->GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"assets/circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}});
game->SetupWorldShake("Wizard.Ability 1.WorldShakeTime"_F);}
game->AddEffect(Effect{player->GetPos(),0,"splash_effect.png",upperLevel,5,0.25,vf2d{},Pixel{240,120,60}});
game->AddEffect(Effect{player->GetPos(),0,"assets/splash_effect.png",upperLevel,5,0.25,vf2d{},Pixel{240,120,60}});
SoundEffect::PlaySFX("Wizard Fire Bolt Hit",pos);
return BulletDestroyState::KEEP_ALIVE;
@ -93,11 +94,11 @@ BulletDestroyState FireBolt::MonsterHit(Monster&monster,const uint8_t markStacks
{
fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F;
for(int i=0;i<"Wizard.Ability 1.BulletHitExplosionParticleCount"_I;i++){
game->AddEffect(Effect{monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}});
game->AddEffect(Effect{monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"assets/circle.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}});
}
game->SetupWorldShake("Wizard.Ability 1.WorldShakeTime"_F);
game->Hurt(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,int("Wizard.Ability 1.BulletHitExplosionDamageMult"_F*game->GetPlayer()->GetAttack()),OnUpperLevel(),0,HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
game->AddEffect(Effect{monster.GetPos(),0,"splash_effect.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel});
game->AddEffect(Effect{monster.GetPos(),0,"assets/splash_effect.png",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel});
SoundEffect::PlaySFX("Wizard Fire Bolt Hit",pos);
return BulletDestroyState::KEEP_ALIVE;

View File

@ -48,5 +48,5 @@ ForegroundEffect::ForegroundEffect(vf2d pos,float lifetime,std::string imgFile,b
ForegroundEffect::ForegroundEffect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:Effect(pos,lifetime,imgFile,upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){}
void ForegroundEffect::Draw(const Pixel blendCol)const{
game->DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,blendCol);
game->DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage().Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,blendCol);
}

View File

@ -2,12 +2,12 @@
#include"AdventuresInLestoria.h"
#include"SoundEffect.h"
INCLUDE_GFX
INCLUDE_game
FreezeGround::FreezeGround(const vf2d pos,const float lifetime,const int damage,const FreezeGroundSettings settings,const bool upperLevel,const FriendlyType friendly)
:damage(damage),friendly(friendly),settings(settings),Effect(pos,lifetime,"freezeground.png",upperLevel,settings.radius/100.f/(GFX["freezeground.png"].Sprite()->Size().x/24.f)*2.35f,0.5f,{},{199,247,239,32},0.f,0.f,true)
:damage(damage),friendly(friendly),settings(settings),Effect(pos,lifetime,"assets/freezeground.png",upperLevel,settings.radius/100.f/(GFX_FORCE["assets/freezeground.png"].Sprite()->Size().x/24.f)*2.35f,0.5f,{},{199,247,239,32},0.f,0.f,true)
{
SoundEffect::PlaySFX("Freezing Ice",pos);

View File

@ -60,7 +60,7 @@ DEFINE_STRATEGY(FROG)
goto phase;
}
m.RotateTowardsPos(m.target);
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
m.PerformJumpAnimation();
}break;
case 1:{

View File

@ -39,10 +39,11 @@ All rights reserved.
#include "BulletTypes.h"
#include "AdventuresInLestoria.h"
#include "util.h"
#include"BitwiseEnum.h"
INCLUDE_game
INCLUDE_MONSTER_LIST
INCLUDE_GFX
FrogTongue::FrogTongue(Monster&sourceMonster,vf2d targetPos,float lifetime,int damage,bool upperLevel,float knockbackStrength,FriendlyType friendly,Pixel col)
:Bullet(sourceMonster.GetPos(),{},0,damage,upperLevel,friendly,col),targetPos(targetPos),tongueLength(0.f),knockbackStrength(knockbackStrength),sourceMonster(sourceMonster){
@ -97,8 +98,8 @@ void FrogTongue::Draw(const Pixel blendCol)const{
vf2d tongueEndPos=geom2d::line<float>(pos+drawVec,targetPos).upoint(pow(sin((lifetime*PI)/duration),20.f));
game->view.DrawRotatedDecal(pos+drawVec,GFX["tongue.png"].Decal(),drawVec.polar().y,{0.f,1.f},{tongueLength,1.0f},col);
game->view.DrawRotatedDecal(tongueEndPos,GFX["tongue_end.png"].Decal(),drawVec.polar().y,{2.f,2.f},{1.f,1.f},col);
game->view.DrawRotatedDecal(pos+drawVec,GFX["assets/tongue.png"].Decal(),drawVec.polar().y,{0.f,1.f},{tongueLength,1.0f},col);
game->view.DrawRotatedDecal(tongueEndPos,GFX["assets/tongue_end.png"].Decal(),drawVec.polar().y,{2.f,2.f},{1.f,1.f},col);
}
void FrogTongue::ModifyOutgoingDamageData(HurtDamageInfo&data){

View File

@ -96,7 +96,7 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
const float range{util::random_range(0,ConfigPixels("Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
m.F(A::SHRAPNEL_SHOT_FALL_TIMER)+=ConfigFloat("Shrapnel Shot Bullet Separation");
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Shrapnel Shot Bullet Radius"),ConfigInt("Shrapnel Shot Damage"),m.OnUpperLevel(),false,ConfigFloat("Shrapnel Knockback Amt"),ConfigFloat("Shrapnel Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Shrapnel Shot Bullet Radius")/100.f*1.75f,ConfigFloat("Shrapnel Shot Bullet Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Shrapnel Shot Bullet Radius"),ConfigInt("Shrapnel Shot Damage"),m.OnUpperLevel(),false,ConfigFloat("Shrapnel Knockback Amt"),ConfigFloat("Shrapnel Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Shrapnel Shot Bullet Radius")/100.f*1.75f,ConfigFloat("Shrapnel Shot Bullet Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
m.I(A::SHRAPNEL_SHOT_COUNT)--;
}
}
@ -137,28 +137,28 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
const float randomAng{util::random_range(0,2*PI)};
const float range{util::random_range(0,ConfigPixels("Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case PRECISE_BOMBARDMENT:{
const float randomAng{util::random_range(0,2*PI)};
const float range{util::random_range(0,ConfigPixels("Precise Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case LINE:{
//Draw a line from one side of the screen to the other, drawing through the middle.
if(m.I(A::CANNON_SHOT_COUNT)==0)m.F(A::LINE_SHOT_ANG)=util::random_range(0,2*PI);
const vf2d targetPos{geom2d::line{game->GetPlayer()->GetPos()+vf2d{float(game->ScreenHeight()),m.F(A::LINE_SHOT_ANG)}.cart(),game->GetPlayer()->GetPos()+vf2d{float(game->ScreenHeight()),m.F(A::LINE_SHOT_ANG)+PI}.cart()}.upoint(float(m.I(A::CANNON_SHOT_COUNT))/TOTAL_CANNON_SHOTS)};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case SHARPSHOOTER:{
if(m.I(A::CANNON_SHOT_COUNT)%2==0)CreateBullet(FallingBullet)("cannonball.png",game->GetPlayer()->GetPos(),ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
if(m.I(A::CANNON_SHOT_COUNT)%2==0)CreateBullet(FallingBullet)("assets/cannonball.png",game->GetPlayer()->GetPos(),ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case PREDICTION:{
const float angle{util::angleTo(game->GetPlayer()->GetPreviousPos(),game->GetPlayer()->GetPos())};
const float range{util::random_range(0,100.f*game->GetPlayer()->GetMoveSpdMult())*ConfigFloat("Cannon Shot Impact Time")};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,angle}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
}
AdvanceCannonPhase();
@ -183,7 +183,7 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
m.F(A::TOSS_COIN_WAIT_TIMER)=ConfigFloat("Coin Toss Pause Time");
m.V(A::TOSS_COIN_TARGET)=game->GetPlayer()->GetPos();
const bool OnLastCursePhase{Config("Curse Thresholds").GetValueCount()==m.I(A::CURSE_THRESHOLD_ARRAY_IND)};
if(!OnLastCursePhase)game->AddEffect(FlipCoinEffect{Oscillator<vf2d>{m.GetPos(),m.V(A::TOSS_COIN_TARGET),1.f/m.F(A::TOSS_COIN_WAIT_TIMER)/2.f},ConfigFloat("Coin Toss Rise Amount"),m.F(A::TOSS_COIN_WAIT_TIMER),"coin.png",m.OnUpperLevel(),3.f});
if(!OnLastCursePhase)game->AddEffect(FlipCoinEffect{Oscillator<vf2d>{m.GetPos(),m.V(A::TOSS_COIN_TARGET),1.f/m.F(A::TOSS_COIN_WAIT_TIMER)/2.f},ConfigFloat("Coin Toss Rise Amount"),m.F(A::TOSS_COIN_WAIT_TIMER),"assets/coin.png",m.OnUpperLevel(),3.f});
#pragma region Determine a hiding spot
const auto&hidingSpots{game->GetActiveZonesForCurrentMap().at("Hiding Spot")};
@ -276,28 +276,28 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
const float randomAng{util::random_range(0,2*PI)};
const float range{util::random_range(0,ConfigPixels("Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case PRECISE_BOMBARDMENT:{
const float randomAng{util::random_range(0,2*PI)};
const float range{util::random_range(0,ConfigPixels("Precise Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case LINE:{
//Draw a line from one side of the screen to the other, drawing through the middle.
if(m.I(A::CANNON_SHOT_COUNT)==0)m.F(A::LINE_SHOT_ANG)=util::random_range(0,2*PI);
const vf2d targetPos{geom2d::line{game->GetPlayer()->GetPos()+vf2d{float(game->ScreenHeight()),m.F(A::LINE_SHOT_ANG)}.cart(),game->GetPlayer()->GetPos()+vf2d{float(game->ScreenHeight()),m.F(A::LINE_SHOT_ANG)+PI}.cart()}.upoint(float(m.I(A::CANNON_SHOT_COUNT))/TOTAL_CANNON_SHOTS)};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case SHARPSHOOTER:{
if(m.I(A::CANNON_SHOT_COUNT)%2==0)CreateBullet(FallingBullet)("cannonball.png",game->GetPlayer()->GetPos(),ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
if(m.I(A::CANNON_SHOT_COUNT)%2==0)CreateBullet(FallingBullet)("assets/cannonball.png",game->GetPlayer()->GetPos(),ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case PREDICTION:{
const float angle{util::angleTo(game->GetPlayer()->GetPreviousPos(),game->GetPlayer()->GetPos())};
const float range{util::random_range(0,100.f*game->GetPlayer()->GetMoveSpdMult())*ConfigFloat("Cannon Shot Impact Time")};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,angle}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
}
AdvanceCannonPhase();
@ -310,7 +310,7 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
}
}break;
case FINAL:{
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
m.target=ConfigVec("Final Standing Spot");
m.PerformAnimation("SLASH",Direction::SOUTH);
m.SetStrategyOnHitFunction({});
@ -321,7 +321,7 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
|std::views::filter([&PIRATES_TREASURE](std::shared_ptr<Monster>&m){return m->GetStrategyName()==PIRATES_TREASURE;})){
m.target=treasure->GetPos();
}
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
m.PerformAnimation("DEATH");
game->GetPlayer()->RemoveAllBuffs(BuffType::PIRATE_GHOST_CAPTAIN_CURSE_DOT);
return true;
@ -334,19 +334,19 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
const float randomAng{util::random_range(0,2*PI)};
const float range{util::random_range(0,ConfigPixels("Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case PRECISE_BOMBARDMENT:{
const float randomAng{util::random_range(0,2*PI)};
const float range{util::random_range(0,ConfigPixels("Precise Bombardment Max Distance"))};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,randomAng}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case LINE:{
//Draw a line from one side of the screen to the other, drawing through the middle.
if(m.I(A::CANNON_SHOT_COUNT)==0)m.F(A::LINE_SHOT_ANG)=util::random_range(0,2*PI);
const vf2d targetPos{geom2d::line{game->GetPlayer()->GetPos()+vf2d{float(game->ScreenHeight()),m.F(A::LINE_SHOT_ANG)}.cart(),game->GetPlayer()->GetPos()+vf2d{float(game->ScreenHeight()),m.F(A::LINE_SHOT_ANG)+PI}.cart()}.upoint(float(m.I(A::CANNON_SHOT_COUNT))/TOTAL_CANNON_SHOTS)};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
case SHARPSHOOTER:{
if(m.I(A::CANNON_SHOT_COUNT)%2==0)CreateBullet(FallingBullet)("cannonball.png",game->GetPlayer()->GetPos(),ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
@ -355,7 +355,7 @@ DEFINE_STRATEGY(GHOST_OF_PIRATE_CAPTAIN)
const float angle{util::angleTo(game->GetPlayer()->GetPreviousPos(),game->GetPlayer()->GetPos())};
const float range{util::random_range(0,100.f*game->GetPlayer()->GetMoveSpdMult())*ConfigFloat("Cannon Shot Impact Time")};
const vf2d targetPos{game->GetPlayer()->GetPos()+vf2d{range,angle}.cart()};
CreateBullet(FallingBullet)("cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
CreateBullet(FallingBullet)("assets/cannonball.png",targetPos,ConfigVec("Cannon Vel"),ConfigFloatArr("Cannon Vel",2),ConfigFloat("Indicator Time"),ConfigPixels("Cannon Radius"),ConfigInt("Cannon Damage"),m.OnUpperLevel(),false,ConfigFloat("Cannon Knockback Amt"),ConfigFloat("Cannon Shot Impact Time"),NON_FRIENDLY,ConfigPixel("Cannon Spell Circle Color"),vf2d{ConfigFloat("Cannon Radius")/100.f*1.75f,ConfigFloat("Cannon Radius")/100.f*1.75f},util::random(2*PI),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Circle Rotation Spd")),ConfigPixel("Cannon Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Cannon Spell Insignia Rotation Spd")))EndBullet;
}break;
}
AdvanceCannonPhase();

View File

@ -43,7 +43,7 @@ All rights reserved.
INCLUDE_game
GhostSaber::GhostSaber(const vf2d pos,const std::weak_ptr<Monster>target,const float lifetime,const float distFromTarget,const float knockbackAmt,const float initialRot,const float radius,const float expandSpd,const int damage,const bool upperLevel,const float rotSpd,const FriendlyType friendly,const Pixel col,const vf2d scale,const float image_angle)
:Bullet(target.lock()->GetPos()+vf2d{distFromTarget,initialRot}.cart(),{},radius,damage,"ghost_dagger.png",upperLevel,true,INFINITE,false,friendly,col,scale,image_angle),attachedMonster(target),rotSpd(rotSpd),distFromTarget(distFromTarget),rot(initialRot),aliveTime(lifetime),knockbackAmt(knockbackAmt),expandSpd(expandSpd){}
:Bullet(target.lock()->GetPos()+vf2d{distFromTarget,initialRot}.cart(),{},radius,damage,"assets/ghost_dagger.png",upperLevel,true,INFINITE,false,friendly,col,scale,image_angle),attachedMonster(target),rotSpd(rotSpd),distFromTarget(distFromTarget),rot(initialRot),aliveTime(lifetime),knockbackAmt(knockbackAmt),expandSpd(expandSpd){}
void GhostSaber::Update(float fElapsedTime){
alphaOscillator.Update(fElapsedTime);
particleTimer-=fElapsedTime;
@ -51,7 +51,7 @@ void GhostSaber::Update(float fElapsedTime){
distFromTarget+=expandSpd*fElapsedTime;
if(particleTimer<=0.f){
particleTimer+=0.05f;
game->AddEffect(ShineEffect{pos,0.1f,0.1f,"pixel.png",2.f,vf2d{},Pixel{239,215,98,192},util::random(2*PI),0.f,true});
game->AddEffect(ShineEffect{pos,0.1f,0.1f,"assets/pixel.png",2.f,vf2d{},Pixel{239,215,98,192},util::random(2*PI),0.f,true});
}
rot+=rotSpd*fElapsedTime;
if(!attachedMonster.expired()){

View File

@ -78,7 +78,7 @@ DEFINE_STRATEGY(GIANT_CRAB)
}
}
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}break;
}
END_STRATEGY

View File

@ -46,7 +46,7 @@ using A=Attribute;
INCLUDE_game
INCLUDE_MONSTER_LIST
INCLUDE_GFX
DEFINE_STRATEGY(GIANT_OCTOPUS)
enum PhaseName{
@ -73,9 +73,9 @@ DEFINE_STRATEGY(GIANT_OCTOPUS)
m.F(A::BREAK_TIME)=0.5f;
m.AddBuff(BuffType::DAMAGE_REDUCTION,INFINITE,ConfigFloat("Permanent Resistance Buff")/100.f);
m.SetStrategyDeathFunction([](GameEvent&event,Monster&m,const StrategyName strategy){
std::string takoyakiImgDir{"item_img_directory"_S+"Takoyaki.png"};
if(!GFX.count(takoyakiImgDir))ERR(std::format("WARNING! Could not find item image {}",takoyakiImgDir));
game->AddEffect(Effect{m.GetPos(),INFINITE,"item_img_directory"_S+"Takoyaki.png",m.OnUpperLevel(),1.f,0.f,vf2d{4.f,4.f},vf2d{},WHITE});
std::string takoyakiImgDir{"assets/"+"item_img_directory"_S+"Takoyaki.png"};
if(!(GFX|takoyakiImgDir))ERR(std::format("WARNING! Could not find item image {}",takoyakiImgDir));
game->AddEffect(Effect{m.GetPos(),INFINITE,"assets/"+"item_img_directory"_S+"Takoyaki.png",m.OnUpperLevel(),1.f,0.f,vf2d{4.f,4.f},vf2d{},WHITE});
m.SetLifetime(4.f);
SETPHASE(DEAD);
return false;

View File

@ -64,7 +64,7 @@ DEFINE_STRATEGY(GOBLIN_BOAR_RIDER)
m.deathData.emplace_back(ConfigString("Spawned Monster"),1U);
}
m.RunStrategy(BOAR);
m.RunStrategy(MonsterStrategy::BOAR);
m.F(A::ATTACK_COOLDOWN)+=fElapsedTime;
if(m.F(A::SHOOT_TIMER)>0.f){
@ -72,7 +72,7 @@ DEFINE_STRATEGY(GOBLIN_BOAR_RIDER)
if(m.F(A::SHOOT_TIMER)<=0.f){
geom2d::line pointTowardsPlayer(m.GetPos(),game->GetPlayer()->GetPos());
vf2d extendedLine=pointTowardsPlayer.upoint(1.1f);
CreateBullet(Arrow)(m.GetPos(),extendedLine,pointTowardsPlayer.vector().norm()*ConfigFloat("Arrow Spd"),"goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet;
CreateBullet(Arrow)(m.GetPos(),extendedLine,pointTowardsPlayer.vector().norm()*ConfigFloat("Arrow Spd"),"assets/goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet;
Arrow&arrow=static_cast<Arrow&>(*BULLET_LIST.back());
arrow.PointToBestTargetPath(m.F(A::PERCEPTION_LEVEL));

View File

@ -79,7 +79,7 @@ DEFINE_STRATEGY(GOBLIN_BOMB)
m.F(A::SHOOT_TIMER)=0.f;
}
if(m.F(A::SHOOT_ANIMATION_TIME)<0.f)m.B(A::IGNORE_DEFAULT_ANIMATIONS)=false;
m.RunStrategy(RUN_AWAY);
m.RunStrategy(MonsterStrategy::RUN_AWAY);
}break;
}
END_STRATEGY

View File

@ -86,14 +86,14 @@ DEFINE_STRATEGY(GOBLIN_BOW)
if(outsideMaxShootingRange){
m.target=game->GetPlayer()->GetPos();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else
if(m.F(A::ATTACK_COOLDOWN)>=ConfigFloat("Attack Reload Time")){
PrepareToShoot();
}else
if(distToPlayer<ConfigPixels("Run Away Range")){
m.target=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).upoint(-1);
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else
if(distToPlayer>=ConfigPixelsArr("Random Direction Range",0)&&distToPlayer<ConfigPixelsArr("Random Direction Range",1)){
#define CW true
@ -102,7 +102,7 @@ DEFINE_STRATEGY(GOBLIN_BOW)
float dirFromPlayer=util::angleTo(game->GetPlayer()->GetPos(),m.GetPos());
float targetDir=m.B(A::RANDOM_DIRECTION)==CW?dirFromPlayer+PI/4:dirFromPlayer-PI/4;
m.target=game->GetPlayer()->GetPos()+vf2d{m.F(A::RANDOM_RANGE),targetDir}.cart();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else
if(m.F(A::ATTACK_COOLDOWN)>=ConfigFloat("Attack Reload Time")/2.f){ //Only the stand still and shoot range remains, which is twice as fast...
PrepareToShoot();
@ -115,7 +115,7 @@ DEFINE_STRATEGY(GOBLIN_BOW)
geom2d::line pointTowardsPlayer(m.GetPos(),game->GetPlayer()->GetPos());
vf2d extendedLine=pointTowardsPlayer.upoint(1.1f);
m.V(A::EXTENDED_LINE)=extendedLine;
Arrow tempArrow{m.GetPos(),extendedLine,pointTowardsPlayer.vector().norm()*ConfigFloat("Arrow Spd"),"goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel()};
Arrow tempArrow{m.GetPos(),extendedLine,pointTowardsPlayer.vector().norm()*ConfigFloat("Arrow Spd"),"assets/goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel()};
m.V(A::FIRE_VELOCITY)=tempArrow.PointToBestTargetPath(m.F(A::PERCEPTION_LEVEL));
SETPHASE(WINDUP);
}
@ -124,7 +124,7 @@ DEFINE_STRATEGY(GOBLIN_BOW)
m.F(A::SHOOT_TIMER)-=fElapsedTime;
if(m.F(A::SHOOT_TIMER)<=0){
m.F(A::ATTACK_COOLDOWN)=0.f;
CreateBullet(Arrow)(m.GetPos(),m.V(A::EXTENDED_LINE),m.V(A::FIRE_VELOCITY),"goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet;
CreateBullet(Arrow)(m.GetPos(),m.V(A::EXTENDED_LINE),m.V(A::FIRE_VELOCITY),"assets/goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet;
m.F(A::PERCEPTION_LEVEL)=std::min(ConfigFloat("Maximum Perception Level"),m.F(A::PERCEPTION_LEVEL)+ConfigFloat("Perception Level Increase"));
m.PerformAnimation("IDLE",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
SETPHASE(MOVE);

View File

@ -69,7 +69,7 @@ DEFINE_STRATEGY(GOBLIN_DAGGER)
case MOVE:{
float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos());
if(distToPlayer>ConfigFloat("Attack Spacing")/100.f*24){
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}else{
SETPHASE(WINDUP);
m.I(A::ATTACK_TYPE)=util::random()%2; //Choose randomly between stab or slash.

View File

@ -0,0 +1,112 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2026 Amy Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include"AdventuresInLestoria.h"
#include"DEFINES.h"
#include"GraphicsManager.h"
INCLUDE_game
INCLUDE_PACK_KEY
GraphicsManager GraphicsManager::self;
GraphicsManager::ForcedGraphicsManager GraphicsManager::ForcedGraphicsManager::self{};
ImgData::ImgData():lastAccessTime(game->GetRunTime()){}
void GraphicsManager::Initialize(){}
const Renderable&GraphicsManager::operator[](const ImgFilename&filename,const std::source_location&loc){
if(!gfx.contains(filename)){
gfx[filename].renderable.Load(blankImgFilename,&game->gamepack);
imgLoadQueue.emplace(filename,loc);
}
gfx[filename].lastAccessTime=game->GetRunTime();
return gfx[filename].renderable;
}
const Renderable&GraphicsManager::ForcedGraphicsManager::operator[](const ImgFilename&filename){
if(!GFX.gfx.contains(filename)){
if(GFX.LoadResource(GFX.gfx[filename].renderable,filename)!=rcode::OK)ERR("WARNING! Failed to instant load requested resource "<<filename<<"! THIS SHOULD NOT BE HAPPENING!!!")
GFX.currentImgLoadedSize+=GFX.gfx[filename].renderable.Sprite()->Size().area()*4;
LOG("Instant Requested and loaded image "<<filename<<". Total: "<<GFX.currentImgLoadedSize<<"/"<<GFX.imgLoadCapacity<<" bytes");
}
GFX.gfx[filename].lastAccessTime=game->GetRunTime();
return GFX.gfx[filename].renderable;
}
void GraphicsManager::LoadImageInQueue(){
while(imgLoadQueue.size()>0){
const auto&[imgToLoad,sourceLoc]{imgLoadQueue.front()};
LOG("Image load request "<<imgToLoad<<".");
try{
if(const rcode result{LoadResource(gfx[imgToLoad].renderable,imgToLoad)};result!=rcode::OK)throw std::runtime_error{std::format("Failed to load resource with result {}",int(result))};
}catch(std::exception&exception)ERR("WARNING! Failed to load requested resource "<<imgToLoad<<"! Error message:"<<exception.what()<<" THIS SHOULD NOT BE HAPPENING!!! "<<sourceLoc.file_name()<<" ("<<sourceLoc.line()<<":"<<sourceLoc.column()<<"):"<<sourceLoc.function_name());
currentImgLoadedSize+=(gfx[imgToLoad].renderable).Sprite()->Size().area()*4;
LOG("Requested and loaded image "<<imgToLoad<<". Total: "<<currentImgLoadedSize<<"/"<<imgLoadCapacity<<" bytes");
imgLoadQueue.pop();
}
}
void GraphicsManager::FreeUpMemory(){
//Two strategies are performed here. Cleanup until capacity < imgLoadCapacity with priority of clearing out images unused over the longest period of time first.
using LastAccessedTime=double;
static std::vector<std::pair<ImgFilename,LastAccessedTime>>gfxByAccessTime;
for(auto&val:gfx)gfxByAccessTime.emplace_back(val.first,val.second.lastAccessTime);
std::ranges::sort(gfxByAccessTime,[](std::pair<ImgFilename,LastAccessedTime>&val1,std::pair<ImgFilename,LastAccessedTime>&val2){return val1.second<val2.second;});
for(auto&[filename,lastAccessTime]:gfxByAccessTime){
if(currentImgLoadedSize>imgLoadCapacity){
currentImgLoadedSize-=(gfx[filename].renderable).Sprite()->Size().area();
gfx.erase(filename);
LOG("Deleted image "<<filename<<". Total: "<<currentImgLoadedSize<<"/"<<imgLoadCapacity<<" bytes");
}else break;
}
}
void GraphicsManager::Reset(){
currentImgLoadedSize=0;
gfx.clear();
GraphicsManager::Initialize();
}
rcode GraphicsManager::LoadResource(Renderable&renderable,std::string_view imgPath,bool filter,bool clamp){
rcode returnCode;
if(game->gamepack.Loaded()&&game->gamepack.FileExists(std::string{imgPath})){
returnCode=renderable.Load(std::string{imgPath},&game->gamepack,filter,clamp);
}else{
returnCode=renderable.Load(std::string{imgPath},nullptr,filter,clamp);
if("GENERATE_GAMEPACK"_B){
game->gamepack.AddFile(std::string{imgPath});
}
}
return returnCode;
}

View File

@ -0,0 +1,86 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2026 Amy Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#pragma once
#include"olcPixelGameEngine.h"
#include<queue>
#ifndef __EMSCRIPTEN__
#include <stacktrace>
#endif
using ImgFilename=std::string;
#define GFX GraphicsManager::self
#define GFX_FORCE GraphicsManager::ForcedGraphicsManager::self
class GraphicsManager{
public:
void Initialize();
const Renderable&operator[](const ImgFilename&filename,const std::source_location&loc=std::source_location::current());
void LoadImageInQueue();
void FreeUpMemory(); //Performs garbage collection to fit the required size.
void Reset();
struct ForcedGraphicsManager{
static ForcedGraphicsManager self;
const Renderable&operator[](const ImgFilename&filename);
};
struct ImgData{
public:
ImgData();
Renderable renderable;
double lastAccessTime;
};
static GraphicsManager self;
inline const bool operator|(const ImgFilename&filename)const
{
return gfx.contains(filename);
}
#ifdef UNIT_TESTING
public:
#else
private:
#endif
const std::string blankImgFilename{"assets/blank.png"};
const uint32_t imgLoadCapacity{128'000'000U}; //in bytes
std::unordered_map<ImgFilename,ImgData>gfx{};
std::queue<std::pair<ImgFilename,std::source_location>>imgLoadQueue{};
int currentImgLoadedSize{}; //in bytes
rcode LoadResource(Renderable&renderable,std::string_view imgPath,bool filter=false,bool clamp=true);
};
using ImgData=GraphicsManager::ImgData;

View File

@ -0,0 +1,73 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2026 Amy Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Effect.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"
#include"SoundEffect.h"
INCLUDE_game
GroundSlamEffect::GroundSlamEffect(vf2d pos,const float z,const float lifetime,GroundSlamSettings settings,bool upperLevel,float fadeout,Pixel col,bool additiveBlending)
:settings(settings),Effect(pos,lifetime,"assets/ground-slam-attack-front.png",upperLevel,settings.visualRadius,fadeout,{},col,0.f,0.f,additiveBlending){
game->AddEffect(Effect{pos,lifetime,"assets/ground-slam-attack-back.png",upperLevel,settings.visualRadius,fadeout,{},col,0.f,0.f,additiveBlending},true);
#pragma region Knockback effect
for(auto&[targetPtr,wasHurt]:game->Hurt(pos,settings.range,settings.damage,OnUpperLevel(),0,settings.friendly?HurtType::MONSTER:HurtType::PLAYER,settings.friendly?HurtFlag::PLAYER_ABILITY:HurtFlag::NONE)){
Entity entity{targetPtr};
float knockbackDir=0;
float knockbackAmt=0;
if(settings.hasSlamShockEnchant)if(std::holds_alternative<Monster*>(targetPtr))std::get<Monster*>(targetPtr)->Stun("Slam Shock"_ENC["STUN DURATION"]);
if(geom2d::line<float>(pos,entity.GetPos()).length()<=0.001f){
knockbackDir=util::random(2*PI);
knockbackAmt=settings.knockbackAmt;
}else{
knockbackDir=geom2d::line<float>(pos,entity.GetPos()).vector().norm().polar().y;
knockbackAmt=std::clamp(settings.knockbackAmt-geom2d::line<float>(pos,entity.GetPos()).length()*settings.knockbackReduction,1.f,settings.knockbackAmt);
}
knockbackAmt=std::max(1.f,knockbackAmt-settings.knockbackWeightFactor*(entity.GetSizeMult()-1.f));
entity.Knockback(vf2d{knockbackAmt,knockbackDir}.cart());
if(entity.IsFriendly())entity.SetIframeTime(1.f);
}
#pragma endregion
SoundEffect::PlaySFX(settings.soundEffectName,pos);
}
bool GroundSlamEffect::Update(float fElapsedTime){
return Effect::Update(fElapsedTime);
}

View File

@ -81,7 +81,7 @@ DEFINE_STRATEGY(HAWK)
float dirToPlayer{util::pointTo(game->GetPlayer()->GetPos(),m.GetPos()).polar().y};
dirToPlayer+=m.B(A::RANDOM_DIRECTION)?0.25*PI:-0.25*PI;
m.target=game->GetPlayer()->GetPos()+vf2d{ConfigFloat("Flight Distance"),dirToPlayer}.cart();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}
}break;
case PREPARE_CHARGE:{
@ -99,7 +99,7 @@ DEFINE_STRATEGY(HAWK)
m.B(A::IGNORE_DEFAULT_ANIMATIONS)=true;
if(m.F(A::FLYING_HEIGHT)>-ConfigFloat("Flight Oscillation Amount"))m.F(A::FLYING_HEIGHT)=std::max(-ConfigFloat("Flight Oscillation Amount"),m.F(A::FLYING_HEIGHT)-ConfigFloat("Attack Z Speed")*fElapsedTime);
m.targetAcquireTimer=1.f;
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
float distToTarget=geom2d::line<float>(m.GetPos(),m.target).length();
if(distToTarget<12.f){
m.F(A::TARGET_FLYING_HEIGHT)=ConfigFloat("Flight Height")-ConfigFloat("Flight Height Variance")+util::random_range(0,ConfigFloat("Flight Height Variance")*2);

View File

@ -47,7 +47,7 @@ All rights reserved.
#include "MenuIconButton.h"
INCLUDE_game
INCLUDE_GFX
void Menu::InitializeHubPauseWindow(){
Menu*hubPauseWindow=CreateMenu(MenuType::HUB_PAUSE,CENTERED,vi2d{96,168});
@ -58,7 +58,7 @@ void Menu::InitializeHubPauseWindow(){
return true;
},ButtonAttr::FIT_TO_LABEL)END;
hubPauseWindow->ADD("Character Button",MenuComponent)(geom2d::rect<float>{{6.f,28.f},{84.f,24.f}},"Character",[](MenuFuncData data){
Component<CharacterRotatingDisplay>(CHARACTER_MENU,"Character Rotating Display")->SetIcon(GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal());
Component<CharacterRotatingDisplay>(CHARACTER_MENU,"Character Rotating Display")->SetIcon(classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName);
Component<MenuComponent>(CHARACTER_MENU,"Equip Selection Select Button")->Click();
std::array abilityBoxes{
std::pair<std::reference_wrapper<Ability>,EnchantAbilitySlot>{game->GetPlayer()->GetAbility1(),EnchantAbilitySlot::ABILITY1},
@ -72,7 +72,7 @@ void Menu::InitializeHubPauseWindow(){
//Attempt to update labels in case they have changed.
auto skillBox{Component<MenuIconButton>(CHARACTER_MENU,std::format("Skill Icon Label {}",i))};
auto skillNameLabel{Component<MenuLabel>(CHARACTER_MENU,std::format("Skill Name Label {}",i))};
skillBox->SetIcon(GFX[ability.get().icon].Decal());
skillBox->SetIcon(ability.get().icon);
skillNameLabel->SetLabel(ability.get().GetNameWithPlayerModifiers());
i++;
}

View File

@ -44,7 +44,7 @@ All rights reserved.
INCLUDE_ANIMATION_DATA
INCLUDE_game
INCLUDE_GFX
INCLUDE_MONSTER_LIST
INCLUDE_WINDOW_SIZE
@ -178,7 +178,7 @@ void IBullet::_Draw()const{
if(GetZ()>0){
vf2d shadowScale=vf2d{8*scale.x/3.f,1}/std::max(1.f,GetZ()/8);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,12*scale.y},GFX["circle.png"].Decal(),shadowScale,BLACK);
game->view.DrawDecal(pos-vf2d{3,3}*shadowScale/2+vf2d{0,12*scale.y},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
const bool NotOnTitleScreen=GameState::STATE!=GameState::states[States::MAIN_MENU];
@ -193,10 +193,10 @@ void IBullet::_Draw()const{
void IBullet::Draw(const Pixel blendCol)const{
if(animated){
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GetFrame().GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2+image_angle:image_angle,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,scale,blendCol);
game->view.DrawPartialRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GetFrame().GetSourceImage().Decal(),rotates?atan2(vel.y,vel.x)-PI/2+image_angle:image_angle,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,scale,blendCol);
}else{
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GFX["circle.png"].Decal(),image_angle,GFX["circle.png"].Sprite()->Size()/2.f,scale,blendCol);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GFX["circle_outline.png"].Decal(),image_angle,GFX["circle.png"].Sprite()->Size()/2.f,scale,Pixel{WHITE.r,WHITE.g,WHITE.b,blendCol.a});
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GFX["assets/circle.png"].Decal(),image_angle,GFX["assets/circle.png"].Sprite()->Size()/2.f,scale,blendCol);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GFX["assets/circle_outline.png"].Decal(),image_angle,GFX["assets/circle.png"].Sprite()->Size()/2.f,scale,Pixel{WHITE.r,WHITE.g,WHITE.b,blendCol.a});
}
}

View File

@ -41,7 +41,7 @@ All rights reserved.
INCLUDE_game
Ink::Ink(vf2d pos,float radius,float lifetime,float inkSlowdownDuration,float inkSlowdownPct,float fadeinTime,float fadeoutTime,vf2d size,Pixel col,bool onUpperLevel,float rotation)
:Effect(pos,lifetime,"ink.png",onUpperLevel,fadeinTime,fadeoutTime,size,{},EffectType::NONE,col,rotation,0.f,false),radius(radius),inkSlowdownDuration(inkSlowdownDuration),inkSlowdownAmount(inkSlowdownPct){}
:Effect(pos,lifetime,"assets/ink.png",onUpperLevel,fadeinTime,fadeoutTime,size,{},EffectType::NONE,col,rotation,0.f,false),radius(radius),inkSlowdownDuration(inkSlowdownDuration),inkSlowdownAmount(inkSlowdownPct){}
bool Ink::Update(float fElapsedTime){
const float distToPlayer{util::distance(game->GetPlayer()->GetPos(),pos)};
if(distToPlayer<=radius){

View File

@ -43,7 +43,7 @@ INCLUDE_ANIMATION_DATA
INCLUDE_game
InkBullet::InkBullet(const vf2d pos,const vf2d targetPos,const vf2d vel,const float inkExplosionRadius,const float inkPuddleLifetime,const float inkSlowdownDuration,const float inkSlowdownPct,const float inkPuddleRadius,const bool upperLevel,const FriendlyType friendly)
:Bullet(pos,vel,inkExplosionRadius,0,"inkbullet.png",upperLevel,friendly),targetPos(targetPos),inkExplosionRadius(inkExplosionRadius),inkSlowdownPct(inkSlowdownPct),inkSlowdownDuration(inkSlowdownDuration),inkPuddleLifetime(inkPuddleLifetime),inkPuddleRadius(inkPuddleRadius){
:Bullet(pos,vel,inkExplosionRadius,0,"assets/inkbullet.png",upperLevel,friendly),targetPos(targetPos),inkExplosionRadius(inkExplosionRadius),inkSlowdownPct(inkSlowdownPct),inkSlowdownDuration(inkSlowdownDuration),inkPuddleLifetime(inkPuddleLifetime),inkPuddleRadius(inkPuddleRadius){
additiveBlending=true;
}
void InkBullet::Update(float fElapsedTime){
@ -53,7 +53,7 @@ void InkBullet::Update(float fElapsedTime){
else if(GetAliveTime()>=30.f)ERR(std::format("WARNING! An Ink Bullet did not resolve to target position {} in time! Last reported pos: {}! THE DISTANCE THRESHOLD FOR INK EXPLOSIONS IS LIKELY TOO HIGH! THIS SHOULD NOT BE HAPPENING!",targetPos.str(),pos.str())); //NOTE: THIS SHOULD NOT BE HAPPENING! If this does, then we probably just set the distance threshold WAY TOO LOW! Let's crash for now.
}
void InkBullet::Splat(){
game->AddEffect(Effect{pos,ANIMATION_DATA["inkbubble_explode.png"].GetTotalAnimationDuration(),"inkbubble_explode.png",OnUpperLevel(),vf2d{1.f,1.f},0.f,vf2d{},WHITE,0.f,0.f,additiveBlending});
game->AddEffect(Effect{pos,ANIMATION_DATA["assets/inkbubble_explode.png"].GetTotalAnimationDuration(),"inkbubble_explode.png",OnUpperLevel(),vf2d{1.f,1.f},0.f,vf2d{},WHITE,0.f,0.f,additiveBlending});
game->AddEffect(Ink{pos,inkPuddleRadius,inkPuddleLifetime,inkSlowdownDuration,inkSlowdownPct,0.4f,0.4f,vf2d{1.f,1.f},WHITE,OnUpperLevel(),int(util::random_range(0,4.f))*PI/2},true);
lifetime=0.f;
}

View File

@ -42,7 +42,7 @@ All rights reserved.
#include "GameSettings.h"
INCLUDE_game
INCLUDE_GFX
INCLUDE_WINDOW_SIZE
using IconScale=float;

View File

@ -51,7 +51,7 @@ All rights reserved.
INCLUDE_game
INCLUDE_ITEM_CATEGORIES
INCLUDE_DATA
INCLUDE_GFX
using A=Attribute;
using enum ComponentAttr;
using ButtonAttr::UNSELECTABLE;
@ -113,7 +113,7 @@ void Menu::InitializeInventoryWindow(){
return true;
},
[](MenuFuncData data){
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(Item::BLANK);
Component<MenuItemItemButton>(data.menu.GetType(),"Item Icon")->SetItem(Item ::BLANK);
return true;
},
InventoryCreator::RowPlayer_InventoryUpdate,
@ -147,7 +147,7 @@ void Menu::InitializeInventoryWindow(){
#pragma region Money Display
vf2d moneyIconPos={224+inventoryDescriptionWidth-24,28+inventoryWindow->size.y-44+6};
auto moneyIcon=inventoryWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
auto moneyIcon=inventoryWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},"assets/money.png",DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
auto moneyDisplay=inventoryWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,SHADOW|LEFT_ALIGN|FIT_TO_LABEL)END;

View File

@ -58,7 +58,7 @@ All rights reserved.
INCLUDE_game
INCLUDE_DATA
INCLUDE_GFX
const std::string Item::BLANK_ITEM_NAME="";
safemap<std::string,ItemInfo>ITEM_DATA;
@ -139,9 +139,6 @@ void ItemInfo::InitializeItems(){
for(auto&[key,value]:data.GetKeys()){
if(key=="")ERR("Failed to read an item block ,no name specified!");
std::string imgPath="assets/"+"item_img_directory"_S+key+".png";
Renderable&img=GFX["item_img_directory"_S+key+".png"];
game->LoadResource(img,imgPath);
std::string scriptName="",description="",category="";
std::string setName="";
float castTime=0;
@ -333,7 +330,7 @@ void ItemInfo::InitializeItems(){
ERR("WARNING! Tried to add item "<<it.name<<" to category "<<it.category<<" which does not exist!")
}
ITEM_CATEGORIES.at(it.category).insert(it.name);
it.img=img;
it.img=imgPath;
ItemProps&props=it.customProps;
if(scriptName!=""){
props.scriptProps=&DATA["ItemScript"][scriptName];
@ -343,7 +340,6 @@ void ItemInfo::InitializeItems(){
it.minStats=minStats;
it.maxStats=maxStats;
it.fragmentName=fragmentName;
it.fragmentIcon=fragmentIcon;
#pragma region Equipment Category Verification Tests
int equipmentCategories=0;
@ -384,29 +380,29 @@ void ItemInfo::InitializeItems(){
for(const auto&itemName:ITEM_CATEGORIES.at("Accessories")){
const std::string fragmentName{ITEM_DATA.at(itemName).fragmentName.value()};
ItemInfo&it{ITEM_DATA[fragmentName]};
GFX["item_img_directory"_S+fragmentName].Create(24,24);
it.img=GFX.at("item_img_directory"_S+fragmentName);
it.fragmentIcon.Create(24,24);
it.isFragmentOf=ITEM_DATA.at(itemName);
if(!game->TestingModeEnabled()){
if(it.FragmentIcon()){
game->SetDrawTarget(GFX.at("item_img_directory"_S+fragmentName).Sprite());
if(GFX|"assets/"+"item_img_directory"_S+fragmentName+".png"){
game->SetDrawTarget(it.fragmentIcon.Sprite());
game->Clear(BLANK);
game->SetPixelMode(Pixel::ALPHA);
game->DrawSprite({},GFX.at(it.FragmentIcon().value()).Sprite());
game->DrawSprite({},GFX["assets/"+"item_img_directory"_S+fragmentName+".png"].Sprite());
game->SetDrawTarget(nullptr);
GFX.at("item_img_directory"_S+fragmentName).Decal()->Update();
it.fragmentIcon.Decal()->Update();
}else{
#pragma region Collect colors from source ring image
std::set<Pixel>colors;
for(int y=0;y<24;y++){
for(int x=0;x<24;x++){
colors.insert(ITEM_DATA.at(itemName).Icon().Sprite()->GetPixel(x,y));
colors.insert(GFX_FORCE["assets/"+"item_img_directory"_S+ITEM_DATA.at(itemName).Name()+".png"].Sprite()->GetPixel(x,y));
}
}
colors.erase(BLANK);
#pragma endregion
#pragma region Generate fragment with randomly sampled pixels from the source ring image
game->SetDrawTarget(GFX.at("item_img_directory"_S+fragmentName).Sprite());
game->DrawSprite({},GFX.at("items/Fragment.png").Sprite(),1U,0U,[colors](const Pixel&in){
game->SetDrawTarget(it.fragmentIcon.Sprite());
game->DrawSprite({},GFX_FORCE["assets/items/Fragment.png"].Sprite(),1U,0U,[colors](const Pixel&in){
if(in==BLANK)return in;
for(const Pixel&p:colors){
if(util::random()%colors.size()==0)return PixelLerp(in,{p.r,p.g,p.b},0.5f);
@ -414,12 +410,11 @@ void ItemInfo::InitializeItems(){
return in;
});
game->SetDrawTarget(nullptr);
GFX.at("item_img_directory"_S+fragmentName).Decal()->Update();
it.fragmentIcon.Decal()->Update();
#pragma endregion
}
}
it.name=fragmentName;
it.fragmentIcon="item_img_directory"_S+fragmentName;
it.description="Fragment Description"_S;
it.category="Materials";
LOG(std::format("Item Fragment {} generated...",fragmentName));
@ -777,7 +772,7 @@ const ITCategory ItemInfo::Category()const{
return category;
}
const::Renderable&ItemInfo::Icon()const{
return img.value().get();
return isFragmentOf?FragmentIcon():GFX[*img];
}
const ItemScript&ItemInfo::OnUseAction()const{
return ITEM_SCRIPTS.at(useFunc);
@ -803,8 +798,8 @@ void Inventory::Clear(ITCategory itemCategory){
}
}
ItemOverlay::ItemOverlay(ItemInfo item)
:it(item),width("ItemDrop.Item Drop Scale"_F*24+4+game->GetTextSizeProp(item.Name()).x*0.5f){
ItemOverlay::ItemOverlay(const ItemInfo&item)
:it(&item),width("ItemDrop.Item Drop Scale"_F*24+4+game->GetTextSizeProp(item.Name()).x*0.5f){
xOffset=-width;
}
@ -824,8 +819,8 @@ void ItemOverlay::Draw(){
Pixel lightCol=Menu::GetCurrentTheme().GetButtonCol()*1.2f;
game->GradientFillRectDecal(pos,{item.width,8},darkCol,darkCol,darkCol,lightCol);
game->DrawRectDecal(pos,{item.width,8},Menu::GetCurrentTheme().GetHighlightCol());
game->DrawDecal(pos,const_cast<Decal*>(item.it.Icon().Decal()),{itemScale,itemScale});
game->DrawShadowStringPropDecal(pos+vf2d{itemScale*24+2,2},item.it.Name(),WHITE,BLACK,{0.5f,0.7f});
game->DrawDecal(pos,const_cast<Decal*>(item.it->Icon().Decal()),{itemScale,itemScale});
game->DrawShadowStringPropDecal(pos+vf2d{itemScale*24+2,2},item.it->Name(),WHITE,BLACK,{0.5f,0.7f});
counter++;
}
}
@ -1485,7 +1480,7 @@ const bool Item::SelectedEquipIsDifferent(const std::weak_ptr<Item>equipAttempti
}
}
}
const std::optional<std::string>&ItemInfo::FragmentIcon()const{
const Renderable&ItemInfo::FragmentIcon()const{
return fragmentIcon;
}
@ -1493,7 +1488,7 @@ const Pixel Stats::GetShimmeringColor(){
return PixelLerp({255,196,60},{254,217,133},sin((70*game->GetRunTime())/2.f+0.5f));
}
const std::optional<std::string>&Item::FragmentIcon()const{
const Renderable&Item::FragmentIcon()const{
return ITEM_DATA.at(FragmentName()).FragmentIcon();
}
@ -1531,4 +1526,9 @@ std::vector<std::string> Item::GetItemCategories(){
static std::vector<std::string>categories{};
if(categories.empty())std::transform(ITEM_CATEGORIES.begin(),ITEM_CATEGORIES.end(),std::back_inserter(categories),[](const auto&pair){return pair.first;});
return categories;
}
const std::optional<std::reference_wrapper<ItemInfo>>ItemInfo::IsFragmentOf()const{
return isFragmentOf;
}

View File

@ -36,20 +36,21 @@ All rights reserved.
*/
#pragma endregion
#pragma once
#include <string>
#include <functional>
#include <map>
#include "olcUTIL_DataFile.h"
#include "AttributableStat.h"
#include "BitwiseEnum.h"
#include <optional>
#include "Merchant.h"
#include "CraftingRequirement.h"
#include "FunctionPriming.h"
#include "IT.h"
#include <unordered_set>
#include "Buff.h"
#include "ItemEnchant.h"
#include<string>
#include<functional>
#include<map>
#include"olcUTIL_DataFile.h"
#include"AttributableStat.h"
#include<optional>
#include"Merchant.h"
#include"FunctionPriming.h"
#include"IT.h"
#include<unordered_set>
#include"Buff.h"
#include"ItemEnchant.h"
#include"olcPixelGameEngine.h"
#include"GraphicsManager.h"
#include"CraftingRequirement.h"
class AiL;
class ItemInfo;
@ -253,7 +254,7 @@ public:
const Pixel GetDisplayNameColor()const;
static const bool SelectedEquipIsDifferent(const std::weak_ptr<Item>equipAttemptingToEquip,const EquipSlot slotToEquipTo);
static std::vector<std::string>GetItemCategories();
const std::optional<std::string>&FragmentIcon()const;
const Renderable&FragmentIcon()const;
#ifndef UNIT_TESTING
private:
#else
@ -361,7 +362,7 @@ class ItemInfo{
float cooldownTime=0;
EquipSlot slot=EquipSlot::NONE;
EnhancementInfo enhancement;
std::optional<std::reference_wrapper<Renderable>>img;
std::optional<ImgFilename>img;
EventName useSound="";
std::string set="";
//Returns true if the item can be used, false otherwise
@ -378,13 +379,14 @@ class ItemInfo{
Stats minStats;
Stats maxStats;
std::optional<std::string>fragmentName;
std::optional<std::string>fragmentIcon;
Renderable fragmentIcon;
private:
static void InitializeScripts();
static void InitializeSets();
static std::map<std::string,EquipSlot>nameToEquipSlot;
static std::vector<std::shared_ptr<Item>>craftableConsumables;
const static std::unordered_map<std::string,BuffOverTimeType::BuffOverTimeType>NameToBuffType;
std::optional<std::reference_wrapper<ItemInfo>>isFragmentOf{};//Contains data about what this item is a fragment of if it's a fragment. Then we can retrieve the image proper via another item info's fragmentIcon value.
public:
static void InitializeItems();
ItemInfo();
@ -423,17 +425,18 @@ public:
const std::unordered_set<std::string>&GetClass()const;
Stats RandomizeStats();
const std::string&FragmentName()const;
const std::optional<std::string>&FragmentIcon()const;
const Renderable&FragmentIcon()const;
const std::optional<std::reference_wrapper<ItemInfo>>IsFragmentOf()const;
};
class ItemOverlay{
friend class ItemInfo;
ItemInfo it;
const ItemInfo*it;
float timer=0;
float xOffset=0;
float width=0; //How wide the entire label is.
static std::vector<ItemOverlay>items;
ItemOverlay(ItemInfo item);
ItemOverlay(const ItemInfo&item);
public:
static void AddToItemOverlay(const ItemInfo&it);
static void Update();

View File

@ -41,7 +41,7 @@ All rights reserved.
#include "SoundEffect.h"
INCLUDE_game
INCLUDE_GFX
float ItemDrop::gravity;
std::vector<ItemDrop>ItemDrop::drops;
@ -77,7 +77,7 @@ void ItemDrop::Draw()const{
#pragma region Item Drop Shadow Rendering
if(GetZ()>0){
vf2d shadowScale=vf2d{8*"ItemDrop.Item Drop Scale"_F/3.f,1}/std::max(1.f,GetZ()/24);
game->view.DrawDecal(GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*"ItemDrop.Item Drop Scale"_F},GFX["circle.png"].Decal(),shadowScale,BLACK);
game->view.DrawDecal(GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*"ItemDrop.Item Drop Scale"_F},GFX["assets/circle.png"].Decal(),shadowScale,BLACK);
}
#pragma endregion
@ -85,7 +85,7 @@ void ItemDrop::Draw()const{
if(GetZ()==0){
yOffset=sin((game->levelTime+randomSpinOffset)*3)*0.5f;
}
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()+yOffset},GFX["skill_overlay_icon_overlay.png"].Decal(),0,GFX["skill_overlay_icon_overlay.png"].Decal()->sprite->Size()/2,{"ItemDrop.Item Drop Scale"_F,"ItemDrop.Item Drop Scale"_F},YELLOW);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()+yOffset},GFX["assets/skill_overlay_icon_overlay.png"].Decal(),0,GFX["assets/skill_overlay_icon_overlay.png"].Decal()->sprite->Size()/2,{"ItemDrop.Item Drop Scale"_F,"ItemDrop.Item Drop Scale"_F},YELLOW);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()+yOffset},const_cast<Decal*>(item->Icon().Decal()),0,item->Icon().Sprite()->Size()/2,{"ItemDrop.Item Drop Scale"_F,"ItemDrop.Item Drop Scale"_F},{255,255,255,128});
game->SetDecalMode(DecalMode::ADDITIVE);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()+yOffset},const_cast<Decal*>(item->Icon().Decal()),0,item->Icon().Sprite()->Size()/2,{"ItemDrop.Item Drop Scale"_F,"ItemDrop.Item Drop Scale"_F},{uint8_t(abs(sin(game->levelTime*1.5)*255.f)),uint8_t(abs(sin(game->levelTime*1.5)*255.f)),uint8_t(abs(sin(game->levelTime*1.5)*255.f)),128});

View File

@ -389,5 +389,5 @@ datafile&ItemEnchantInfo::GetData(){
}break;
}
ERR(std::format("An undefined return path was reached for some reason while trying to retrieve data! Category: {}",int(Category())));
return DATA;
std::unreachable();
}

View File

@ -89,11 +89,11 @@ void ItemInfo::InitializeScripts(){
const int damage{props.GetInt("Tick Base Damage")+int(props.GetFloat("Tick Player Damage Mult")*game->GetPlayer()->GetAttack())};
lingeringEffect.emplace(vf2d{},props.GetString("Lingering Effect"),props.GetString("Lingering Sound"),props.GetFloat("Linger Radius")/100.f*24,damage,props.GetFloat("Tick Rate"),HurtType::MONSTER,props.GetFloat("Linger Time"),5.f,game->GetPlayer()->OnUpperLevel(),1.f,vf2d{},DARK_RED,util::random(2*PI),0.f,false,0.2f,
[](const Effect&self){
return Effect{self.pos,0.5f,"fire_ring.png",self.OnUpperLevel(),util::random_range(0.7f,1.f),0.1f,{},PixelLerp(Pixel(0xF7B752),Pixel(0xE74F30),util::random(1.f)),util::random(2*PI),0.f,true};
return Effect{self.pos,0.5f,"assets/fire_ring.png",self.OnUpperLevel(),util::random_range(0.7f,1.f),0.1f,{},PixelLerp(Pixel(0xF7B752),Pixel(0xE74F30),util::random(1.f)),util::random(2*PI),0.f,true};
});
}
CreateBullet(ThrownProjectile)(game->GetPlayer()->GetPos(),targetingPos.value(),props.GetString("Image"),props.GetFloat("Cast Size")/100.f*24,game->GetPlayer()->GetZ(),0.3f,8.f,projectileDamage,game->GetPlayer()->OnUpperLevel(),false,INFINITE,FRIENDLY,WHITE,props.GetFloat("Cast Size")/100.f*vf2d{1.f,1.f},0.f,
Effect{vf2d{},ANIMATION_DATA.at("explosionframes.png").GetTotalAnimationDuration(),"explosionframes.png",game->GetPlayer()->OnUpperLevel(),props.GetFloat("Cast Size")/100.f*vf2d{1.f,1.f}},props.GetString("Explode Sound Effect"),lingeringEffect)EndBullet;
Effect{vf2d{},ANIMATION_DATA.at("assets/explosionframes.png").GetTotalAnimationDuration(),"explosionframes.png",game->GetPlayer()->OnUpperLevel(),props.GetFloat("Cast Size")/100.f*vf2d{1.f,1.f}},props.GetString("Explode Sound Effect"),lingeringEffect)EndBullet;
return true;
};

View File

@ -43,7 +43,7 @@ All rights reserved.
#include "GameSettings.h"
INCLUDE_game
INCLUDE_GFX
bool Input::usingGamepad;
uint64_t Input::ingameControlsHandle{0};
@ -64,83 +64,83 @@ std::array<std::unordered_map<Steam::SteamInput,std::pair<std::string,HWButton>>
std::unordered_map<EInputActionOrigin,std::string>Input::steamIconToGameIcon{
#ifndef __EMSCRIPTEN__
#ifndef UNIT_TESTING
{k_EInputActionOrigin_SteamController_A,"themes/button_d_xb.png"},
{k_EInputActionOrigin_XBoxOne_A,"themes/button_d_xb.png"},
{k_EInputActionOrigin_XBox360_A,"themes/button_d_xb.png"},
{k_EInputActionOrigin_Switch_A,"themes/button_d_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_S,"themes/button_d_xb.png"},
{k_EInputActionOrigin_SteamDeck_A,"themes/button_d_xb.png"},
{k_EInputActionOrigin_SteamController_B,"themes/button_r_xb.png"},
{k_EInputActionOrigin_XBoxOne_B,"themes/button_r_xb.png"},
{k_EInputActionOrigin_XBox360_B,"themes/button_r_xb.png"},
{k_EInputActionOrigin_Switch_B,"themes/button_r_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_W,"themes/button_r_xb.png"},
{k_EInputActionOrigin_SteamDeck_B,"themes/button_r_xb.png"},
{k_EInputActionOrigin_SteamController_X,"themes/button_l_xb.png"},
{k_EInputActionOrigin_XBoxOne_X,"themes/button_l_xb.png"},
{k_EInputActionOrigin_XBox360_X,"themes/button_l_xb.png"},
{k_EInputActionOrigin_Switch_X,"themes/button_l_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_E,"themes/button_l_xb.png"},
{k_EInputActionOrigin_SteamDeck_X,"themes/button_l_xb.png"},
{k_EInputActionOrigin_SteamController_Y,"themes/button_u_xb.png"},
{k_EInputActionOrigin_XBoxOne_Y,"themes/button_u_xb.png"},
{k_EInputActionOrigin_XBox360_Y,"themes/button_u_xb.png"},
{k_EInputActionOrigin_Switch_Y,"themes/button_u_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_N,"themes/button_u_xb.png"},
{k_EInputActionOrigin_SteamDeck_Y,"themes/button_u_xb.png"},
{k_EInputActionOrigin_SteamController_LeftBumper,"themes/button_l1.png"},
{k_EInputActionOrigin_PS4_LeftBumper,"themes/button_l1.png"},
{k_EInputActionOrigin_XBoxOne_LeftBumper,"themes/button_l1.png"},
{k_EInputActionOrigin_XBox360_LeftBumper,"themes/button_l1.png"},
{k_EInputActionOrigin_Switch_LeftBumper,"themes/button_l1.png"},
{k_EInputActionOrigin_SteamDeck_L1,"themes/button_l1.png"},
{k_EInputActionOrigin_SteamController_RightBumper,"themes/button_r1.png"},
{k_EInputActionOrigin_PS4_RightBumper,"themes/button_r1.png"},
{k_EInputActionOrigin_XBoxOne_RightBumper,"themes/button_r1.png"},
{k_EInputActionOrigin_XBox360_RightBumper,"themes/button_r1.png"},
{k_EInputActionOrigin_Switch_RightBumper,"themes/button_r1.png"},
{k_EInputActionOrigin_SteamDeck_R1,"themes/button_r1.png"},
{k_EInputActionOrigin_SteamController_RightTrigger_Pull,"themes/button_r2.png"},
{k_EInputActionOrigin_PS4_RightTrigger_Pull,"themes/button_r2.png"},
{k_EInputActionOrigin_XBoxOne_RightTrigger_Pull,"themes/button_r2.png"},
{k_EInputActionOrigin_XBox360_RightTrigger_Pull,"themes/button_r2.png"},
{k_EInputActionOrigin_Switch_RightTrigger_Pull,"themes/button_r2.png"},
{k_EInputActionOrigin_SteamDeck_R2_SoftPull,"themes/button_r2.png"},
{k_EInputActionOrigin_SteamController_RightTrigger_Click,"themes/button_r2.png"},
{k_EInputActionOrigin_PS4_RightTrigger_Click,"themes/button_r2.png"},
{k_EInputActionOrigin_XBoxOne_RightTrigger_Click,"themes/button_r2.png"},
{k_EInputActionOrigin_XBox360_RightTrigger_Click,"themes/button_r2.png"},
{k_EInputActionOrigin_Switch_RightTrigger_Click,"themes/button_r2.png"},
{k_EInputActionOrigin_SteamDeck_R2,"themes/button_r2.png"},
{k_EInputActionOrigin_SteamController_LeftTrigger_Pull,"themes/button_l2.png"},
{k_EInputActionOrigin_PS4_LeftTrigger_Pull,"themes/button_l2.png"},
{k_EInputActionOrigin_XBoxOne_LeftTrigger_Pull,"themes/button_l2.png"},
{k_EInputActionOrigin_XBox360_LeftTrigger_Pull,"themes/button_l2.png"},
{k_EInputActionOrigin_Switch_LeftTrigger_Pull,"themes/button_l2.png"},
{k_EInputActionOrigin_SteamDeck_L2_SoftPull,"themes/button_l2.png"},
{k_EInputActionOrigin_SteamController_LeftTrigger_Click,"themes/button_l2.png"},
{k_EInputActionOrigin_PS4_LeftTrigger_Click,"themes/button_l2.png"},
{k_EInputActionOrigin_XBoxOne_LeftTrigger_Click,"themes/button_l2.png"},
{k_EInputActionOrigin_XBox360_LeftTrigger_Click,"themes/button_l2.png"},
{k_EInputActionOrigin_Switch_LeftTrigger_Click,"themes/button_l2.png"},
{k_EInputActionOrigin_SteamDeck_L2,"themes/button_l2.png"},
{k_EInputActionOrigin_PS4_X,"themes/button_d_ps.png"},
{k_EInputActionOrigin_PS4_Circle,"themes/button_r_ps.png"},
{k_EInputActionOrigin_PS4_Triangle,"themes/button_u_ps.png"},
{k_EInputActionOrigin_PS4_Square,"themes/button_l_ps.png"},
{k_EInputActionOrigin_SteamController_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_PS4_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_PS4_RightStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_XBoxOne_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_XBoxOne_RightStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_XBox360_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_XBox360_RightStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_Switch_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_Switch_RightStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_PS5_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_PS5_RightStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_SteamDeck_LeftStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_SteamDeck_RightStick_Move,"themes/button_analogstick.png"},
{k_EInputActionOrigin_SteamController_A,"assets/themes/button_d_xb.png"},
{k_EInputActionOrigin_XBoxOne_A,"assets/themes/button_d_xb.png"},
{k_EInputActionOrigin_XBox360_A,"assets/themes/button_d_xb.png"},
{k_EInputActionOrigin_Switch_A,"assets/themes/button_d_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_S,"assets/themes/button_d_xb.png"},
{k_EInputActionOrigin_SteamDeck_A,"assets/themes/button_d_xb.png"},
{k_EInputActionOrigin_SteamController_B,"assets/themes/button_r_xb.png"},
{k_EInputActionOrigin_XBoxOne_B,"assets/themes/button_r_xb.png"},
{k_EInputActionOrigin_XBox360_B,"assets/themes/button_r_xb.png"},
{k_EInputActionOrigin_Switch_B,"assets/themes/button_r_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_W,"assets/themes/button_r_xb.png"},
{k_EInputActionOrigin_SteamDeck_B,"assets/themes/button_r_xb.png"},
{k_EInputActionOrigin_SteamController_X,"assets/themes/button_l_xb.png"},
{k_EInputActionOrigin_XBoxOne_X,"assets/themes/button_l_xb.png"},
{k_EInputActionOrigin_XBox360_X,"assets/themes/button_l_xb.png"},
{k_EInputActionOrigin_Switch_X,"assets/themes/button_l_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_E,"assets/themes/button_l_xb.png"},
{k_EInputActionOrigin_SteamDeck_X,"assets/themes/button_l_xb.png"},
{k_EInputActionOrigin_SteamController_Y,"assets/themes/button_u_xb.png"},
{k_EInputActionOrigin_XBoxOne_Y,"assets/themes/button_u_xb.png"},
{k_EInputActionOrigin_XBox360_Y,"assets/themes/button_u_xb.png"},
{k_EInputActionOrigin_Switch_Y,"assets/themes/button_u_xb.png"},
{k_EInputActionOrigin_Switch_JoyConButton_N,"assets/themes/button_u_xb.png"},
{k_EInputActionOrigin_SteamDeck_Y,"assets/themes/button_u_xb.png"},
{k_EInputActionOrigin_SteamController_LeftBumper,"assets/themes/button_l1.png"},
{k_EInputActionOrigin_PS4_LeftBumper,"assets/themes/button_l1.png"},
{k_EInputActionOrigin_XBoxOne_LeftBumper,"assets/themes/button_l1.png"},
{k_EInputActionOrigin_XBox360_LeftBumper,"assets/themes/button_l1.png"},
{k_EInputActionOrigin_Switch_LeftBumper,"assets/themes/button_l1.png"},
{k_EInputActionOrigin_SteamDeck_L1,"assets/themes/button_l1.png"},
{k_EInputActionOrigin_SteamController_RightBumper,"assets/themes/button_r1.png"},
{k_EInputActionOrigin_PS4_RightBumper,"assets/themes/button_r1.png"},
{k_EInputActionOrigin_XBoxOne_RightBumper,"assets/themes/button_r1.png"},
{k_EInputActionOrigin_XBox360_RightBumper,"assets/themes/button_r1.png"},
{k_EInputActionOrigin_Switch_RightBumper,"assets/themes/button_r1.png"},
{k_EInputActionOrigin_SteamDeck_R1,"assets/themes/button_r1.png"},
{k_EInputActionOrigin_SteamController_RightTrigger_Pull,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_PS4_RightTrigger_Pull,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_XBoxOne_RightTrigger_Pull,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_XBox360_RightTrigger_Pull,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_Switch_RightTrigger_Pull,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_SteamDeck_R2_SoftPull,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_SteamController_RightTrigger_Click,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_PS4_RightTrigger_Click,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_XBoxOne_RightTrigger_Click,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_XBox360_RightTrigger_Click,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_Switch_RightTrigger_Click,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_SteamDeck_R2,"assets/themes/button_r2.png"},
{k_EInputActionOrigin_SteamController_LeftTrigger_Pull,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_PS4_LeftTrigger_Pull,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_XBoxOne_LeftTrigger_Pull,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_XBox360_LeftTrigger_Pull,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_Switch_LeftTrigger_Pull,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_SteamDeck_L2_SoftPull,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_SteamController_LeftTrigger_Click,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_PS4_LeftTrigger_Click,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_XBoxOne_LeftTrigger_Click,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_XBox360_LeftTrigger_Click,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_Switch_LeftTrigger_Click,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_SteamDeck_L2,"assets/themes/button_l2.png"},
{k_EInputActionOrigin_PS4_X,"assets/themes/button_d_ps.png"},
{k_EInputActionOrigin_PS4_Circle,"assets/themes/button_r_ps.png"},
{k_EInputActionOrigin_PS4_Triangle,"assets/themes/button_u_ps.png"},
{k_EInputActionOrigin_PS4_Square,"assets/themes/button_l_ps.png"},
{k_EInputActionOrigin_SteamController_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_PS4_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_PS4_RightStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_XBoxOne_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_XBoxOne_RightStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_XBox360_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_XBox360_RightStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_Switch_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_Switch_RightStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_PS5_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_PS5_RightStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_SteamDeck_LeftStick_Move,"assets/themes/button_analogstick.png"},
{k_EInputActionOrigin_SteamDeck_RightStick_Move,"assets/themes/button_analogstick.png"},
#endif
#endif
};
@ -177,28 +177,6 @@ void Input::Initialize(){
}
}
void Input::LoadSteamButtonIcons(){
GFX.Unlock();
#ifndef __EMSCRIPTEN__
#ifndef UNIT_TESTING
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)||GFX.at(loadImage).Decal()==nullptr)){
LOG(std::format("Loading steam image {}",loadImage));
if(!GFX.count(loadImage))GFX[loadImage];
if(GFX.at(loadImage).Load(loadImage)!=rcode::OK){
LOG(std::format("WARNING! Failed to load steam image {}!",loadImage));
}
}
}
}
#endif
#endif
GFX.SetInitialized();
}
void Input::UpdateSteamInput(){
STEAMINPUT(
uint8_t prevControllerCount=controllerCount;
@ -923,38 +901,38 @@ const Renderable&Input::GetIcon()const{
if(Input::steamGameInputToOrigin.count(Steam::SteamInput(key))&&
Input::steamGameInputToOrigin.at(Steam::SteamInput(key)).first>0){
if(steamIconToGameIcon.count(action)){
return GFX.at(GetProperIconName(steamIconToGameIcon[action]));
return GFX[GetProperIconName(steamIconToGameIcon[action])];
}else{
return GFX.at(SteamInput()->GetGlyphPNGForActionOrigin(action,k_ESteamInputGlyphSize_Small,0));
return GFX[SteamInput()->GetGlyphPNGForActionOrigin(action,k_ESteamInputGlyphSize_Small,0)];
}
}else
if(Input::steamGameInputToAnalogOrigin.count(Steam::SteamInput(key))&&
Input::steamGameInputToAnalogOrigin.at(Steam::SteamInput(key)).first>0){
if(steamIconToGameIcon.count(analogAction)){
return GFX.at(GetProperIconName(steamIconToGameIcon[analogAction]));
return GFX[GetProperIconName(steamIconToGameIcon[analogAction])];
}else{
return GFX.at(SteamInput()->GetGlyphPNGForActionOrigin(analogAction,k_ESteamInputGlyphSize_Small,0));
return GFX[SteamInput()->GetGlyphPNGForActionOrigin(analogAction,k_ESteamInputGlyphSize_Small,0)];
}
}
#endif
#endif
}
return GFX.at(GenericKey::keyLiteral.at({type,key}).iconName);
return GFX[GenericKey::keyLiteral.at({type,key}).iconName];
}
const Renderable&Input::GetIcon(IconType type)const{
switch(type){
case IconType::XB:{
return GFX.at(GenericKey::keyLiteral.at({this->type,key}).iconName);
return GFX[GenericKey::keyLiteral.at({this->type,key}).iconName];
}break;
case IconType::PS:{
return GFX.at(GenericKey::keyLiteral.at({this->type,key}).iconName2);
return GFX[GenericKey::keyLiteral.at({this->type,key}).iconName2];
}break;
case IconType::XB_REVERSED:{
return GFX.at(GenericKey::keyLiteral.at({this->type,key}).iconName3);
return GFX[GenericKey::keyLiteral.at({this->type,key}).iconName3];
}break;
}
ERR("WARNING! Did not handle a valid controller icon type. THIS SHOULD NOT BE HAPPENING!");
return GFX.at("themes/button_d_xb.png");
return GFX["assets/themes/button_d_xb.png"];
}
#undef END
@ -1058,20 +1036,20 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
{{KEY, olc::Key::OEM_8},{"\\"}},
{{KEY, olc::Key::CAPS_LOCK},{"CAP LK"}},
{{KEY, olc::ENUM_END},{""}},
{{KEY, SHOULDER},{"Q-E","themes/button_qe.png"}},
{{KEY, ARROWS},{"Arrow Keys","themes/button_arrows.png"}},
{{MOUSE, Mouse::LEFT},{"L.MOUSE","themes/lmb.png"}},
{{MOUSE, Mouse::RIGHT},{"R.MOUSE","themes/rmb.png"}},
{{MOUSE, Mouse::MIDDLE},{"M.MOUSE","themes/mmb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_D)},{"A/X","themes/button_d_xb.png","themes/button_d_ps.png","themes/button_r_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_L)},{"X/Square","themes/button_l_xb.png","themes/button_l_ps.png","themes/button_u_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_R)},{"B/Circle","themes/button_r_xb.png","themes/button_r_ps.png","themes/button_d_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_U)},{"Y/Triangle","themes/button_u_xb.png","themes/button_u_ps.png","themes/button_l_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::L1)},{"L1","themes/button_l1.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::L2)},{"L2","themes/button_l2.png"}},
{{KEY, SHOULDER},{"Q-E","assets/themes/button_qe.png"}},
{{KEY, ARROWS},{"Arrow Keys","assets/themes/button_arrows.png"}},
{{MOUSE, Mouse::LEFT},{"L.MOUSE","assets/themes/lmb.png"}},
{{MOUSE, Mouse::RIGHT},{"R.MOUSE","assets/themes/rmb.png"}},
{{MOUSE, Mouse::MIDDLE},{"M.MOUSE","assets/themes/mmb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_D)},{"A/X","assets/themes/button_d_xb.png","assets/themes/button_d_ps.png","assets/themes/button_r_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_L)},{"X/Square","assets/themes/button_l_xb.png","assets/themes/button_l_ps.png","assets/themes/button_u_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_R)},{"B/Circle","assets/themes/button_r_xb.png","assets/themes/button_r_ps.png","assets/themes/button_d_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::FACE_U)},{"Y/Triangle","assets/themes/button_u_xb.png","assets/themes/button_u_ps.png","assets/themes/button_l_xb.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::L1)},{"L1","assets/themes/button_l1.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::L2)},{"L2","assets/themes/button_l2.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::L3)},{"L3"}},
{{CONTROLLER, static_cast<int>(GPButtons::R1)},{"R1","themes/button_r1.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::R2)},{"R2","themes/button_r2.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::R1)},{"R1","assets/themes/button_r1.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::R2)},{"R2","assets/themes/button_r2.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::R3)},{"R3"}},
{{CONTROLLER, static_cast<int>(GPButtons::SELECT)},{"SELECT"}},
{{CONTROLLER, static_cast<int>(GPButtons::START)},{"START"}},
@ -1079,16 +1057,16 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
{{CONTROLLER, static_cast<int>(GPButtons::DPAD_R)},{"RIGHT"}},
{{CONTROLLER, static_cast<int>(GPButtons::DPAD_U)},{"UP"}},
{{CONTROLLER, static_cast<int>(GPButtons::DPAD_D)},{"DOWN"}},
{{CONTROLLER, static_cast<int>(GPButtons::SHOULDER)},{"L1-R1","themes/button_r1l1.png"}},
{{ANALOG, static_cast<int>(GPAxes::LY)},{"Up/Down","themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::RY)},{"Up/Down","themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::LX)},{"Right/Left","themes/button_analogstick_horz.png"}},
{{ANALOG, static_cast<int>(GPAxes::RX)},{"Right/Left","themes/button_analogstick_horz.png"}},
{{ANALOG, static_cast<int>(GPAxes::TL)},{"Left Trigger","themes/button_l2.png"}},
{{ANALOG, static_cast<int>(GPAxes::TR)},{"Right Trigger","themes/button_r2.png"}},
{{ANALOG, static_cast<int>(GPAxes::DX)},{"Right/Left","themes/button_analogstick_horz.png"}},
{{ANALOG, static_cast<int>(GPAxes::DY)},{"Up/Down","themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::ALL)},{"Analog Stick","themes/button_analogstick.png"}},
{{CONTROLLER, static_cast<int>(GPButtons::SHOULDER)},{"L1-R1","assets/themes/button_r1l1.png"}},
{{ANALOG, static_cast<int>(GPAxes::LY)},{"Up/Down","assets/themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::RY)},{"Up/Down","assets/themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::LX)},{"Right/Left","assets/themes/button_analogstick_horz.png"}},
{{ANALOG, static_cast<int>(GPAxes::RX)},{"Right/Left","assets/themes/button_analogstick_horz.png"}},
{{ANALOG, static_cast<int>(GPAxes::TL)},{"Left Trigger","assets/themes/button_l2.png"}},
{{ANALOG, static_cast<int>(GPAxes::TR)},{"Right Trigger","assets/themes/button_r2.png"}},
{{ANALOG, static_cast<int>(GPAxes::DX)},{"Right/Left","assets/themes/button_analogstick_horz.png"}},
{{ANALOG, static_cast<int>(GPAxes::DY)},{"Up/Down","assets/themes/button_analogstick_vert.png"}},
{{ANALOG, static_cast<int>(GPAxes::ALL)},{"Analog Stick","assets/themes/button_analogstick.png"}},
};
void Input::SetUsingGamepad(const bool usingGamepad){

View File

@ -122,7 +122,6 @@ class Input{
static uint8_t controllerCount;
static std::vector<Steam::SteamInput>leftStickActionSets;
static std::vector<Steam::SteamInput>rightStickActionSets;
static void LoadSteamButtonIcons();
public:
Input(InputType type,int key);
bool Pressed();

View File

@ -45,7 +45,7 @@ INCLUDE_game
INCLUDE_MONSTER_LIST
LargeStone::LargeStone(vf2d pos,const float stoneThrowTime,const vf2d landingPos,float moveVelWaitTimer,float radius,float z,float gravity,int damage,const float knockbackAmt,bool upperLevel,bool hitsMultiple,float lifetime,FriendlyType friendly,Pixel col,vf2d scale,float image_angle)
:knockbackAmt(knockbackAmt),stoneThrowTime(stoneThrowTime),startingPos(pos),landingPos(landingPos),gravity(gravity),initialMoveWaitTime(moveVelWaitTimer),moveTimer(moveVelWaitTimer),Bullet(pos,{},radius,damage,"large_rock.png",upperLevel,false,INFINITE,false,friendly,col,scale,image_angle){
:knockbackAmt(knockbackAmt),stoneThrowTime(stoneThrowTime),startingPos(pos),landingPos(landingPos),gravity(gravity),initialMoveWaitTime(moveVelWaitTimer),moveTimer(moveVelWaitTimer),Bullet(pos,{},radius,damage,"assets/large_rock.png",upperLevel,false,INFINITE,false,friendly,col,scale,image_angle){
this->z=z;
Deactivate();
}
@ -62,7 +62,7 @@ void LargeStone::Update(float fElapsedTime){
for(int i=0;i<100;i++){
const float randomDir{util::random(2*PI)};
game->AddEffect(FallEffect{pos+vf2d{radius,randomDir}.cart(),0.f,"circle.png",OnUpperLevel(),vf2d{1.5f,1.5f}*util::random(2.f),util::random(1.f),vf2d{vf2d{radius,randomDir}.cart().x,-util::random(30.f)-20.f},BLACK});
game->AddEffect(FallEffect{pos+vf2d{radius,randomDir}.cart(),0.f,"assets/circle.png",OnUpperLevel(),vf2d{1.5f,1.5f}*util::random(2.f),util::random(1.f),vf2d{vf2d{radius,randomDir}.cart().x,-util::random(30.f)-20.f},BLACK});
}
const HurtList pillarList{game->HurtMonsterType(pos,radius,3,OnUpperLevel(),GetZ(),"Stone Golem Pillar")};

View File

@ -45,7 +45,7 @@ All rights reserved.
INCLUDE_game
LargeTornado::LargeTornado(vf2d pos,const float suctionAmt,const float knockupAmt,const float knockbackAmt,const int damage,const float radius,const float lifetime,bool upperLevel,FriendlyType friendly,Pixel col,const vf2d scale)
:suctionAmt(suctionAmt),knockupDuration(knockupAmt),knockbackAmt(knockbackAmt),Bullet(pos,vf2d{},radius,damage,"large_tornado.png",upperLevel,true,lifetime+0.5f,false,friendly,col,scale){
:suctionAmt(suctionAmt),knockupDuration(knockupAmt),knockbackAmt(knockbackAmt),Bullet(pos,vf2d{},radius,damage,"assets/large_tornado.png",upperLevel,true,lifetime+0.5f,false,friendly,col,scale){
SetBulletType(BulletType::LARGE_TORNADO);
}

View File

@ -41,11 +41,11 @@ All rights reserved.
#include "util.h"
INCLUDE_game
INCLUDE_GFX
LevitatingRock::LevitatingRock(const Monster&attachedTarget,const vf2d&attackingTarget,const float fadeInTime,const float facingRotOffset,const float distance,const float lockOnTime,const float waitTime,const float targetSpd,const float radius,const int damage,const bool upperLevel,const FriendlyType friendly,const Pixel col,const vf2d scale)
:attachedTarget(attachedTarget),attackingTarget(attackingTarget),fadeInTime(fadeInTime),fadeInOriginalTime(fadeInTime),facingRotOffset(facingRotOffset),dist(distance),lockOnTime(lockOnTime),initialWaitTime(waitTime),flyingSpd(targetSpd),collisionRadius(radius),
Bullet(attachedTarget.GetPos(),{},0.f,damage,"rock.png",upperLevel,false,INFINITE,false,friendly,col){}
Bullet(attachedTarget.GetPos(),{},0.f,damage,"assets/rock.png",upperLevel,false,INFINITE,false,friendly,col){}
void LevitatingRock::Update(float fElapsedTime){
if(attachedTarget.IsDead()){
if(fadeOutTime==0.f){
@ -103,7 +103,7 @@ BulletDestroyState LevitatingRock::MonsterHit(Monster&monster,const uint8_t mark
void LevitatingRock::Draw(const Pixel blendCol)const{
Bullet::Draw(blendCol);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GFX["rock_outline.png"].Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,GFX["rock_outline.png"].Sprite()->Size()/2,scale,col);
game->view.DrawRotatedDecal(pos-vf2d{0,GetZ()}+drawOffsetY,GFX["assets/rock_outline.png"].Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,GFX["assets/rock_outline.png"].Sprite()->Size()/2,scale,col);
}
void LevitatingRock::AssignMaster(LevitatingRock*masterRock){

View File

@ -42,13 +42,14 @@ All rights reserved.
#include "Emitter.h"
#include "util.h"
#include "SoundEffect.h"
#include"BitwiseEnum.h"
INCLUDE_game
INCLUDE_MONSTER_LIST
INCLUDE_EMITTER_LIST
LightningBolt::LightningBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,FriendlyType friendly,Pixel col)
:Bullet(pos,vel,radius,damage,"lightning_bolt.png",upperLevel,false,INFINITE,true,friendly,col){
:Bullet(pos,vel,radius,damage,"assets/lightning_bolt.png",upperLevel,false,INFINITE,true,friendly,col){
SoundEffect::PlaySFX("Wizard Lightning Bolt Shoot",SoundEffect::CENTERED);
}
@ -60,16 +61,16 @@ void LightningBolt::Update(float fElapsedTime){
uint8_t brightness=uint8_t("Wizard.Ability 2.ParticleColorRange"_FRange);
switch(util::random()%4){
case 0:{
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"lightning_bolt_part1.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"assets/lightning_bolt_part1.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
}break;
case 1:{
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"lightning_bolt_part2.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"assets/lightning_bolt_part2.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
}break;
case 2:{
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"lightning_bolt_part3.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"assets/lightning_bolt_part3.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
}break;
case 3:{
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"lightning_bolt_part4.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
game->AddEffect(Effect{pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"assets/lightning_bolt_part4.png",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}});
}break;
}
}
@ -80,7 +81,7 @@ void LightningBolt::Update(float fElapsedTime){
BulletDestroyState LightningBolt::PlayerHit(Player*player){
fadeOutTime="Wizard.Ability 2.BulletFadeoutTime"_F;
game->AddEffect(Effect{player->GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"lightning_splash_effect.png",upperLevel,player->GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange});
game->AddEffect(Effect{player->GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"assets/lightning_splash_effect.png",upperLevel,player->GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange});
SoundEffect::PlaySFX("Wizard Lightning Bolt Hit",pos);
return BulletDestroyState::KEEP_ALIVE;
@ -88,7 +89,7 @@ BulletDestroyState LightningBolt::PlayerHit(Player*player){
BulletDestroyState LightningBolt::MonsterHit(Monster&monster,const uint8_t markStacksBeforeHit){
fadeOutTime="Wizard.Ability 2.BulletFadeoutTime"_F;
game->AddEffect(Effect{monster.GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange});
game->AddEffect(Effect{monster.GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"assets/lightning_splash_effect.png",upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange});
LightningBolt::ApplyLightningShock(monster,monster.OnUpperLevel());
@ -111,7 +112,7 @@ void LightningBolt::ApplyLightningShock(const Monster&monster,const bool onUpper
if(chainLightningRepeatCount>0)lightningChainDamage=int(game->GetPlayer()->GetAttack()*"Chain Lightning"_ENC["SHOCK DAMAGE"]/100.f);
if(m->Hurt(lightningChainDamage,onUpperLevel,0,HurtFlag::PLAYER_ABILITY)){
EMITTER_LIST.emplace_back(std::make_unique<LightningBoltEmitter>(LightningBoltEmitter(monster.GetPos(),m->GetPos(),"Wizard.Ability 2.LightningChainFrequency"_F,"Wizard.Ability 2.LightningChainLifetime"_F,onUpperLevel,1)));
game->AddEffect(Effect{m->GetPos(),"Wizard.Ability 2.LightningChainSplashLifetime"_F,"lightning_splash_effect.png",onUpperLevel,monster.GetSizeMult(),"Wizard.Ability 2.LightningChainSplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.LightningChainSplashRotationRange"_FRange});
game->AddEffect(Effect{m->GetPos(),"Wizard.Ability 2.LightningChainSplashLifetime"_F,"assets/lightning_splash_effect.png",onUpperLevel,monster.GetSizeMult(),"Wizard.Ability 2.LightningChainSplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.LightningChainSplashRotationRange"_FRange});
int chainLightningRepeat{};
if(chainLightningRepeatCount>0)chainLightningRepeat=chainLightningRepeatCount-1;
else if(game->GetPlayer()->HasEnchant("Chain Lightning")&&chainLightningRepeatCount==ORIGINAL_BOLT)chainLightningRepeat=int("Chain Lightning"_ENC["REPEAT COUNT"]);

View File

@ -65,7 +65,7 @@ void LightningBoltEmitter::DrawLightningBolt(const vf2d targetPos){
float targetDist=lineToTarget.length()*util::random(0.5f);
targetAngle+=util::random((PI/2))-PI/4;
geom2d::line<float>lightningLine=geom2d::line<float>(currentPos,currentPos+vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist});
game->AddEffect(Effect{lightningLine.upoint(0),0,"chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2f},lightningFadeOutSpd,vf2d{},WHITE,targetAngle,0,true},drawLightningBoltsInBack);
game->AddEffect(Effect{lightningLine.upoint(0),0,"assets/chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2f},lightningFadeOutSpd,vf2d{},WHITE,targetAngle,0,true},drawLightningBoltsInBack);
int iterations=1;
currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist};
while(iterations<MAX_ITERATIONS&&geom2d::line<float>(currentPos,targetPos).length()>1){
@ -74,7 +74,7 @@ void LightningBoltEmitter::DrawLightningBolt(const vf2d targetPos){
float targetDist=lineToTarget.length()*util::random(0.5f);
targetAngle+=util::random((PI/2))-PI/4;
geom2d::line<float>lightningLine=geom2d::line<float>(currentPos,currentPos+vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist});
game->AddEffect(Effect{lightningLine.upoint(0),0,"chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2f},lightningFadeOutSpd,vf2d{},WHITE,targetAngle,0,true},drawLightningBoltsInBack);
game->AddEffect(Effect{lightningLine.upoint(0),0,"assets/chain_lightning.png",upperLevel,vf2d{lightningLine.length(),0.2f},lightningFadeOutSpd,vf2d{},WHITE,targetAngle,0,true},drawLightningBoltsInBack);
currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist};
iterations++;
}

View File

@ -96,7 +96,7 @@ public:
const Animate2D::Frame&frame=ANIMATION_DATA[classAnimations.at(className)].GetFrame(animationTime);
geom2d::rect<int>sprRect=frame.GetSourceRect();
window.DrawPartialDecal(rect.pos+vf2d{rect.size.x-26,rect.size.y-36},sprRect.size,frame.GetSourceImage()->Decal(),sprRect.pos,sprRect.size);
window.DrawPartialDecal(rect.pos+vf2d{rect.size.x-26,rect.size.y-36},sprRect.size,frame.GetSourceImage().Decal(),sprRect.pos,sprRect.size);
std::string levelClassText=std::format("Lv{} {}",level,className);
vf2d levelClassTextSize=game->GetTextSize(levelClassText);
window.DrawShadowStringDecal(rect.pos+vf2d{rect.size.x-levelClassTextSize.x-2,rect.size.y-10},levelClassText);

View File

@ -98,7 +98,7 @@ void Menu::InitializeLoadGameWindow(){
#endif
#pragma region Keyboard Navigation Rules
loadGameWindow->SetupKeyboardNavigation(
loadGameWindow->SetupKeyboardNavigation(
[](MenuType type,Data&returnData){ //On Open
if(SaveFile::GetSaveFileCount()>0||SaveFile::GetOnlineSaveFileCount()>0){
if(SaveFile::IsOnline()){

View File

@ -98,7 +98,7 @@ void LoadingScreen::Draw(){
}
game->GetPlayer()->GetWalkEAnimation();
Animate2D::FrameSequence&playerWalkE=ANIMATION_DATA[game->GetPlayer()->GetWalkEAnimation()];
game->DrawPartialRotatedDecal({(float(currentProgress)/totalProgress)*(WINDOW_SIZE.x-48.f),WINDOW_SIZE.y-36.f},playerWalkE.GetFrame(game->GetRunTime()).GetSourceImage()->Decal(),game->GetPlayer()->GetSpinAngle(),{12,12},playerWalkE.GetFrame(game->GetRunTime()).GetSourceRect().pos,playerWalkE.GetFrame(game->GetRunTime()).GetSourceRect().size,playerScale*scale,blendCol);
game->DrawPartialRotatedDecal({(float(currentProgress)/totalProgress)*(WINDOW_SIZE.x-48.f),WINDOW_SIZE.y-36.f},playerWalkE.GetFrame(game->GetRunTime()).GetSourceImage().Decal(),game->GetPlayer()->GetSpinAngle(),{12,12},playerWalkE.GetFrame(game->GetRunTime()).GetSourceRect().pos,playerWalkE.GetFrame(game->GetRunTime()).GetSourceRect().size,playerScale*scale,blendCol);
}
}

View File

@ -79,7 +79,7 @@ DEFINE_STRATEGY(MAJOR_HAWK)
float dirToPlayer{util::pointTo(game->GetPlayer()->GetPos(),m.GetPos()).polar().y};
dirToPlayer+=m.B(A::RANDOM_DIRECTION)?0.25*PI:-0.25*PI;
m.target=game->GetPlayer()->GetPos()+vf2d{ConfigFloat("Aggressive Flight Distance"),dirToPlayer}.cart();
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
}
}break;
case PREPARE_CHARGE:{
@ -97,7 +97,7 @@ DEFINE_STRATEGY(MAJOR_HAWK)
m.B(A::IGNORE_DEFAULT_ANIMATIONS)=true;
if(m.F(A::FLYING_HEIGHT)>-ConfigFloat("Aggressive Flight Oscillation Amount"))m.F(A::FLYING_HEIGHT)=std::max(-ConfigFloat("Aggressive Flight Oscillation Amount"),m.F(A::FLYING_HEIGHT)-ConfigFloat("Aggressive Attack Z Speed")*fElapsedTime);
m.targetAcquireTimer=1.f;
m.RunStrategy(RUN_TOWARDS);
m.RunStrategy(MonsterStrategy::RUN_TOWARDS);
float distToTarget=geom2d::line<float>(m.GetPos(),m.target).length();
if(distToTarget<12.f){
m.F(A::TARGET_FLYING_HEIGHT)=ConfigFloat("Aggressive Flight Height")-ConfigFloat("Aggressive Flight Height Variance")+util::random_range(0,ConfigFloat("Aggressive Flight Height Variance")*2);
@ -108,5 +108,5 @@ DEFINE_STRATEGY(MAJOR_HAWK)
m.B(A::IGNORE_DEFAULT_ANIMATIONS)=false;
}break;
}
}else m.RunStrategy(HAWK); //Use normal hawk behaviors when there are too many Major Hawks.
}else m.RunStrategy(MonsterStrategy::HAWK); //Use normal hawk behaviors when there are too many Major Hawks.
END_STRATEGY

View File

@ -55,7 +55,7 @@ struct TileCollisionData{
};
struct TilesetData{
Renderable*tileset=nullptr;
ImgFilename tileset{};
int tilewidth=0,tileheight=0;
bool isTerrain=false;
std::unordered_map<int,ForegroundTileTag>foregroundTiles;

View File

@ -70,7 +70,6 @@ bool Menu::scrolling=false;
std::weak_ptr<MenuComponent>Menu::lastHover;
INCLUDE_game
INCLUDE_GFX
INCLUDE_WINDOW_SIZE
using A=Attribute;
@ -572,7 +571,7 @@ void Menu::DrawTiledWindowBackground(AiL*game,vf2d menuPos,vf2d size,Pixel rende
}
Renderable&Menu::GetPatchPart(int x,int y){
return GFX[themeSelection+"_"+std::to_string(x)+std::to_string(y)+".png"];
return game->THEME_DATA[themeSelection+"_"+std::to_string(x)+std::to_string(y)+".png"];
}
Theme&Menu::GetCurrentTheme(){

View File

@ -49,7 +49,7 @@ private:
float animationTime=0;
public:
inline MenuAnimatedIconButton(geom2d::rect<float>rect,std::string animation,MenuFunc onClick,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuIconButton(rect,nullptr,onClick,attributes),animation(animation){}
:MenuIconButton(rect,{},onClick,attributes),animation(animation){}
protected:
virtual inline void Update(AiL*game)override{
MenuIconButton::Update(game);
@ -57,7 +57,7 @@ protected:
}
virtual inline void DrawDecal(ViewPort&window,bool focused)override{
MenuComponent::DrawDecal(window,focused); //Skipping to MenuComponent's DrawDecal is INTENTIONAL! The way we draw animations is different from static images, we skip over MenuIconButton's draw!
Decal*spr=ANIMATION_DATA[animation].GetFrame(animationTime).GetSourceImage()->Decal();
Decal*spr=ANIMATION_DATA[animation].GetFrame(animationTime).GetSourceImage().Decal();
geom2d::rect<int>sprRect=ANIMATION_DATA[animation].GetFrame(animationTime).GetSourceRect();
window.DrawPartialDecal(rect.middle()-sprRect.size/2,spr,sprRect.pos,sprRect.size);
}

View File

@ -41,17 +41,20 @@ All rights reserved.
class MenuDecal:public MenuComponent{
public:
inline MenuDecal(geom2d::rect<float>rect,std::optional<std::reference_wrapper<Renderable>>image={},MenuFunc onClick=DO_NOTHING,MenuFunc onHover=DO_NOTHING)
:image(image),MenuComponent(rect,"",onClick,ButtonAttr::NONE){
inline MenuDecal(geom2d::rect<float>rect,std::optional<ImgFilename>imageFilename={},MenuFunc onClick=DO_NOTHING,MenuFunc onHover=DO_NOTHING)
:imageFilename(imageFilename),MenuComponent(rect,"",onClick,ButtonAttr::NONE){
SetHoverFunc(onHover);
}
inline void DrawDecal(ViewPort&window,bool focused)override{
if(image)window.DrawDecal(rect.pos,image.value().get().Decal(),rect.size/image.value().get().Sprite()->Size());
if(imageFilename){
if(ITEM_DATA.contains(*imageFilename))window.DrawDecal(rect.pos,ITEM_DATA[*imageFilename].Icon().Decal(),rect.size/ITEM_DATA[*imageFilename].Icon().Sprite()->Size());
else window.DrawDecal(rect.pos,GFX[*imageFilename].Decal(),rect.size/GFX[*imageFilename].Sprite()->Size());
}
}
inline void SetImage(Renderable&renderable){
image=renderable;
inline void SetImage(const ImgFilename&newImageFilename){
imageFilename=newImageFilename;
}
private:
std::optional<std::reference_wrapper<Renderable>>image;
std::optional<ImgFilename>imageFilename;
};

View File

@ -0,0 +1,111 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2026 Amy Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#pragma once
#include "Menu.h"
#include "MenuLabel.h"
#include "MenuItemButton.h"
#include "DEFINES.h"
#include "AdventuresInLestoria.h"
#include "Item.h"
#include "safemap.h"
INCLUDE_game
INCLUDE_ITEM_DATA
class MenuFragmentItemButton:public MenuItemItemButton{
protected:
ItemInfo*fragment;
public:
inline MenuFragmentItemButton(geom2d::rect<float>rect,const std::optional<std::string>fragmentName,MenuFunc onClick,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuItemItemButton(rect,{},onClick,DO_NOTHING,DO_NOTHING,"","",attributes),fragment(fragmentName?&ITEM_DATA[*fragmentName]:nullptr){
draggable=false;
if(fragment&&!fragment->IsFragmentOf())ERR("WARNING! Item is not a proper fragment! Only item fragments should be using MenuFragmentItemButtons!");
}
inline const ItemInfo&GetItemInfo()const{
return *fragment;
}
inline const ItemInfo&SetItemFragment(const std::string newFragmentName,bool labelUpdate=true){
fragment=&ITEM_DATA[newFragmentName];
if(labelUpdate){
UpdateLabel();
}
return GetItemInfo();
}
protected:
inline void UpdateLabel(){
std::string labelNameText;
std::string labelDescriptionText;
labelNameText=GetItemInfo().Name();
labelDescriptionText=GetItemInfo().Description();
if(hideDetails){
std::for_each(labelNameText.begin(),labelNameText.end(),[](char&c){c='?';});
std::for_each(labelDescriptionText.begin(),labelDescriptionText.end(),[](char&c){c='?';});
}
if(itemNameLabelName!=""){
Component<MenuLabel>(parentMenu,itemNameLabelName)->SetLabel(labelNameText);
Component<MenuLabel>(parentMenu,itemNameLabelName)->SetBorderCol(borderCol);
Component<MenuLabel>(parentMenu,itemNameLabelName)->Enable();
}
if(itemDescriptionLabelName!=""){
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->SetLabel(labelDescriptionText);
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->SetBorderCol(borderCol);
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->Enable();
}
}
virtual inline void Update(AiL*game)override{
MenuIconButton::Update(game);
UpdateLabel();
}
virtual inline void DrawDecal(ViewPort&window,bool focused)override{
MenuComponent::DrawDecal(window,focused);
if(valid&&!hideQty){
if(!ISBLANK(itemRef)&&!itemRef.lock()->IsEquippable()){
std::string quantityText="x"+std::to_string(itemRef.lock()->Amt());
vf2d quantityTextScale=rect.size/48.f;
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*quantityTextScale;
vf2d drawPos=rect.pos+rect.size-textSize;
if(itemRef.lock()->Amt()!=INFINITE){
window.DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,quantityTextScale,quantityTextScale);
}
}
}
if(fragment)window.DrawRotatedDecal(rect.middle(),fragment->Icon().Decal(),0.f,fragment->Icon().Sprite()->Size()/2,iconScale,tint);
}
};

View File

@ -52,16 +52,16 @@ enum class IconButtonAttr{
class MenuIconButton:public MenuComponent{
protected:
Decal*icon{nullptr};
std::optional<std::string>icon{};
vf2d iconScale{1,1};
Pixel tint=WHITE;
public:
inline MenuIconButton(geom2d::rect<float>rect,Decal*icon,MenuFunc onClick,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
inline MenuIconButton(geom2d::rect<float>rect,std::optional<ImgFilename>icon,MenuFunc onClick,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuComponent(rect,"",onClick,ButtonAttr(attributes)),icon(icon){
border=!(attributes&IconButtonAttr::NO_OUTLINE);
background=!(attributes&IconButtonAttr::NO_BACKGROUND);
}
virtual inline void SetIcon(Decal*newIcon){
virtual inline void SetIcon(const std::string&newIcon){
icon=newIcon;
}
virtual inline void SetIconScale(vf2d iconScale){
@ -73,8 +73,9 @@ protected:
}
virtual inline void DrawDecal(ViewPort&window,bool focused)override{
MenuComponent::DrawDecal(window,focused);
if(icon!=nullptr){
window.DrawRotatedDecal(rect.middle(),icon,0.f,icon->sprite->Size()/2,iconScale,tint);
if(icon){
if(ITEM_DATA.contains(*icon))window.DrawRotatedDecal(rect.middle(),ITEM_DATA[*icon].Icon().Decal(),0.f,ITEM_DATA[*icon].Icon().Sprite()->Size()/2,iconScale,tint);
else window.DrawRotatedDecal(rect.middle(),GFX[*icon].Decal(),0.f,GFX[*icon].Sprite()->Size()/2,iconScale,tint);
}
}
};

View File

@ -59,13 +59,13 @@ private:
public:
int selected=-1; //0-2 representing which loadout slot this item consumes. -1 means not selected.
inline MenuItemButton(geom2d::rect<float>rect,const std::vector<std::shared_ptr<Item>>&invRef,int invIndex,MenuFunc onClick,MenuType itemDescriptionMenu,std::string itemNameLabelName,std::string itemDescriptionLabelName,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuIconButton(rect,invRef.size()>invIndex?const_cast<Decal*>(invRef[invIndex]->Icon().Decal()):nullptr,onClick,attributes),invRef(invRef),itemDescriptionMenu(itemDescriptionMenu),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
:MenuIconButton(rect,invRef.size()>invIndex?"assets/items/"+invRef[invIndex]->ActualName()+".png":std::optional<std::string>{},onClick,attributes),invRef(invRef),itemDescriptionMenu(itemDescriptionMenu),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
draggable=false;
inventoryIndex=invIndex;
valid=invRef.size()>invIndex;
}
inline MenuItemButton(geom2d::rect<float>rect,const std::vector<std::shared_ptr<Item>>&invRef,int invIndex,MenuFunc onClick,MenuFunc onHover,MenuFunc onMouseOut,MenuType itemDescriptionMenu,std::string itemNameLabelName,std::string itemDescriptionLabelName,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuIconButton(rect,invRef.size()>invIndex?const_cast<Decal*>(invRef[invIndex]->Icon().Decal()):nullptr,onClick,attributes),invRef(invRef),itemDescriptionMenu(itemDescriptionMenu),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
:MenuIconButton(rect,invRef.size()>invIndex?"assets/items/"+invRef[invIndex]->ActualName()+".png":std::optional<std::string>{},onClick,attributes),invRef(invRef),itemDescriptionMenu(itemDescriptionMenu),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
draggable=false;
inventoryIndex=invIndex;
runHoverFunctions=true;
@ -88,7 +88,7 @@ public:
MenuIconButton::Update(game);
valid=invRef.size()>inventoryIndex&&ITEM_DATA.count(invRef[inventoryIndex]->ActualName())&&invRef[inventoryIndex]->Amt()>0;
if(!valid){
icon=nullptr;
icon={};
}
if(hovered){
UpdateLabel();
@ -108,11 +108,11 @@ protected:
std::string labelNameText;
std::string labelDescriptionText;
if(valid){
icon=const_cast<Decal*>(invRef[inventoryIndex]->Icon().Decal());
icon="assets/items/"+invRef[inventoryIndex]->ActualName()+".png";
labelNameText=invRef[inventoryIndex]->DisplayName();
labelDescriptionText=invRef[inventoryIndex]->Description(compact);
}else{
icon=nullptr;
icon={};
labelNameText="";
labelDescriptionText="";
}

View File

@ -48,22 +48,21 @@ INCLUDE_game
INCLUDE_ITEM_DATA
class MenuItemItemButton:public MenuIconButton{
private:
protected:
std::string itemNameLabelName;
std::string itemDescriptionLabelName;
bool hideQty=false;
CompactText compact=COMPACT;
bool hideDetails=false;
protected:
std::weak_ptr<Item>itemRef;
CompactText compact=COMPACT;
bool hideQty=false;
public:
inline MenuItemItemButton(geom2d::rect<float>rect,const std::weak_ptr<Item>itemRef,MenuFunc onClick,std::string itemNameLabelName,std::string itemDescriptionLabelName,IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuIconButton(rect,!ISBLANK(itemRef)?const_cast<Decal*>(itemRef.lock()->Icon().Decal()):nullptr,onClick,attributes),itemRef(itemRef),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
:MenuIconButton(rect,!ISBLANK(itemRef)?"assets/items/"+itemRef.lock()->ActualName()+".png":std::optional<std::string>{},onClick,attributes),itemRef(itemRef),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
draggable=false;
valid=!ISBLANK(itemRef);
}
inline MenuItemItemButton(geom2d::rect<float>rect,const std::weak_ptr<Item>itemRef,MenuFunc onClick,MenuFunc onHover,MenuFunc onMouseOut,std::string itemNameLabelName="",std::string itemDescriptionLabelName="",IconButtonAttr attributes=IconButtonAttr::SELECTABLE)
:MenuIconButton(rect,!ISBLANK(itemRef)?const_cast<Decal*>(itemRef.lock()->Icon().Decal()):nullptr,onClick,attributes),itemRef(itemRef),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
:MenuIconButton(rect,!ISBLANK(itemRef)?"assets/items/"+itemRef.lock()->ActualName()+".png":std::optional<std::string>{},onClick,attributes),itemRef(itemRef),itemNameLabelName(itemNameLabelName),itemDescriptionLabelName(itemDescriptionLabelName){
runHoverFunctions=true;
draggable=false;
valid=!ISBLANK(itemRef);
@ -91,27 +90,20 @@ public:
}
inline void UpdateIcon(){
if(ISBLANK(itemRef)){
icon=nullptr;
icon={};
return;
}
icon=const_cast<Decal*>(itemRef.lock()->Icon().Decal());
icon="assets/items/"+itemRef.lock()->ActualName()+".png";
}
inline void SetHideDetails(bool hideDetails){
this->hideDetails=hideDetails;
if(hideDetails){
tint=BLACK;
}else{
tint=WHITE;
}
if(hideDetails)tint=BLACK;
else tint=WHITE;
}
protected:
virtual inline void OnMouseOut()override{
if(itemNameLabelName!=""){
Component<MenuLabel>(parentMenu,itemNameLabelName)->Disable();
}
if(itemDescriptionLabelName!=""){
Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->Disable();
}
if(itemNameLabelName!="")Component<MenuLabel>(parentMenu,itemNameLabelName)->Disable();
if(itemDescriptionLabelName!="")Component<MenuLabel>(parentMenu,itemDescriptionLabelName)->Disable();
}
virtual inline void OnHover()override{
UpdateLabel();
@ -121,11 +113,11 @@ protected:
std::string labelDescriptionText;
if(ISBLANK(itemRef)){
icon=nullptr;
icon={};
labelNameText="";
labelDescriptionText="";
}else{
icon=const_cast<Decal*>(itemRef.lock()->Icon().Decal());
icon="assets/items/"+itemRef.lock()->ActualName()+".png";
labelNameText=itemRef.lock()->DisplayName();
labelDescriptionText=itemRef.lock()->Description(compact);
}
@ -149,13 +141,11 @@ protected:
MenuIconButton::Update(game);
valid=!ISBLANK(itemRef);
if(!valid){
icon=nullptr;
}
if(!valid)icon={};
UpdateLabel();
}
virtual inline void DrawDecal(ViewPort&window,bool focused)override{
MenuIconButton::DrawDecal(window,focused);
MenuComponent::DrawDecal(window,focused);
if(valid&&!hideQty){
if(!ISBLANK(itemRef)&&!itemRef.lock()->IsEquippable()){
std::string quantityText="x"+std::to_string(itemRef.lock()->Amt());
@ -167,5 +157,9 @@ protected:
}
}
}
if(icon){
if(!itemRef.expired()&&ITEM_DATA[itemRef.lock()->ActualName()].IsFragmentOf())window.DrawRotatedDecal(rect.middle(),itemRef.lock()->Icon().Decal(),0.f,itemRef.lock()->Icon().Sprite()->Size()/2,iconScale,tint);
else window.DrawRotatedDecal(rect.middle(),GFX[*icon].Decal(),0.f,GFX[*icon].Sprite()->Size()/2,iconScale,tint);
}
}
};

View File

@ -49,7 +49,7 @@ All rights reserved.
INCLUDE_game
INCLUDE_ITEM_CATEGORIES
INCLUDE_DATA
INCLUDE_GFX
void Menu::InitializeMerchantWindow(){
Menu*merchantWindow=CreateMenu(MERCHANT,CENTERED,game->GetScreenSize()-vi2d{52,52});
@ -266,7 +266,7 @@ void Menu::InitializeMerchantWindow(){
#pragma region Money Display
vf2d moneyIconPos={224+inventoryDescriptionWidth-24,28+merchantWindow->size.y-44+6};
auto moneyIcon=merchantWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
auto moneyIcon=merchantWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},"assets/money.png",DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
auto moneyDisplay=merchantWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;

View File

@ -44,10 +44,10 @@ All rights reserved.
INCLUDE_game
INCLUDE_MONSTER_LIST
INCLUDE_GFX
Meteor::Meteor(const vf2d pos,const float lifetime,const bool upperLevel,const MeteorSetting setting,const std::pair<MeteorDamage,PulsatingFireDamage>damage,const float fadeout,const vf2d spd,const Pixel col,const float rotation,const float rotationSpd,const bool additiveBlending)
:setting(setting),damage(damage),Effect(pos,lifetime,setting==COMET?"comet.png":setting==COMET_FLARE?"comet_flare.png":"meteor.png",upperLevel,{},fadeout,spd,col,rotation,rotationSpd,additiveBlending),startLifetime(lifetime){
:setting(setting),damage(damage),Effect(pos,lifetime,setting==COMET?"assets/comet.png":setting==COMET_FLARE?"assets/comet_flare.png":"assets/meteor.png",upperLevel,{},fadeout,spd,col,rotation,rotationSpd,additiveBlending),startLifetime(lifetime){
switch(setting){
case METEOR:{
meteorImpactParticles="Wizard.Ability 3.MeteorImpactParticles"_I;
@ -127,17 +127,17 @@ bool Meteor::Update(float fElapsedTime){
float randomAngle="Wizard.Ability 3.MeteorImpactParticleAngleRange"_FRange;
float randomRange=100*size.x*(1-util::random("Wizard.Ability 3.MeteorImpactParticleRandomVariance"_F))*(1-util::random("Wizard.Ability 3.MeteorImpactParticleRandomVariance"_F));
vf2d effectPos=vf2d{cos(randomAngle),sin(randomAngle)}*randomRange+meteorOffset;
game->AddEffect(Effect{effectPos,0,"circle.png",OnUpperLevel(),vf2d{util::random(2)+1,util::random(3)+1},util::random(3)+1,vf2d{util::random(10)-5,-util::random(20)-5},Pixel{uint8_t(randomColorTintR),uint8_t(randomColorTintG),uint8_t(randomColorTintB),uint8_t("Wizard.Ability 3.MeteorImpactParticleAlphaRange"_FRange)},0,0,true},effectPos.y<meteorOffset.y);
game->AddEffect(Effect{effectPos,0,"assets/circle.png",OnUpperLevel(),vf2d{util::random(2)+1,util::random(3)+1},util::random(3)+1,vf2d{util::random(10)-5,-util::random(20)-5},Pixel{uint8_t(randomColorTintR),uint8_t(randomColorTintG),uint8_t(randomColorTintB),uint8_t("Wizard.Ability 3.MeteorImpactParticleAlphaRange"_FRange)},0,0,true},effectPos.y<meteorOffset.y);
}
#define PLAYER_CASES default
switch(setting){
case SKELETON_MAGE:{
game->Hurt(pos,meteorRadius/1.25f,damage.first*damageMult,OnUpperLevel(),0,HurtType::PLAYER);
game->AddEffect(PulsatingFire{pos,fireRingLifetime,meteorRadius/1.25f,"fire_ring1.png",OnUpperLevel(),damage.second,PulsatingFire::SKELETON_MAGE,vf2d{meteorRadius/16,meteorRadius/16},"Wizard.Ability 3.FireRingFadeoutTime"_F},true);
game->AddEffect(PulsatingFire{pos,fireRingLifetime,meteorRadius/1.25f,"assets/fire_ring1.png",OnUpperLevel(),damage.second,PulsatingFire::SKELETON_MAGE,vf2d{meteorRadius/16,meteorRadius/16},"Wizard.Ability 3.FireRingFadeoutTime"_F},true);
}break;
PLAYER_CASES:{ //Default cases are player cases. Handle all other enemy cases in their own statements.
game->Hurt(pos,meteorRadius,damage.first*damageMult,OnUpperLevel(),0,HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
game->AddEffect(PulsatingFire{pos,fireRingLifetime,meteorRadius,"fire_ring1.png",OnUpperLevel(),damage.second,PulsatingFire::PLAYER,vf2d{meteorRadius/12,meteorRadius/12},"Wizard.Ability 3.FireRingFadeoutTime"_F},true);
game->AddEffect(PulsatingFire{pos,fireRingLifetime,meteorRadius,"assets/fire_ring1.png",OnUpperLevel(),damage.second,PulsatingFire::PLAYER,vf2d{meteorRadius/12,meteorRadius/12},"Wizard.Ability 3.FireRingFadeoutTime"_F},true);
}break;
}
#undef PLAYER_CASES
@ -150,12 +150,12 @@ void Meteor::Draw(const Pixel blendCol)const{
if(lifetime>0){
vf2d scale=vf2d{192,64}/3.f*(startLifetime+1-lifetime)*0.25*size;
vf2d meteorOffset=vf2d{lifetime*"Wizard.Ability 3.MeteorXMovementMult"_I,0}*"Wizard.Ability 3.MeteorShadowStartingDist"_F/fallSpdMult;
vf2d centerPoint=pos-vf2d{GFX["circle.png"].Sprite()->width*scale.x/2,GFX["circle.png"].Sprite()->height*scale.y/2};
game->view.DrawDecal(centerPoint+meteorOffset,GFX["circle.png"].Decal(),scale,{0,0,0,192});
vf2d centerPoint=pos-vf2d{GFX["assets/circle.png"].Sprite()->width*scale.x/2,GFX["assets/circle.png"].Sprite()->height*scale.y/2};
game->view.DrawDecal(centerPoint+meteorOffset,GFX["assets/circle.png"].Decal(),scale,{0,0,0,192});
}
vf2d meteorOffset=pos+vf2d{lifetime*"Wizard.Ability 3.MeteorXMovementMult"_I,lifetime*"Wizard.Ability 3.MeteorYMovementMult"_I}*"Wizard.Ability 3.MeteorStartingDist"_F/fallSpdMult-vf2d{0,GetFrame().GetSourceRect().size.y/4.f}*size;
if(lifetime<=0){
meteorOffset=pos-vf2d{0,GetFrame().GetSourceRect().size.y/4.f}*size;
}
game->view.DrawPartialRotatedDecal(meteorOffset,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadeout/original_fadeOutTime*255)});
game->view.DrawPartialRotatedDecal(meteorOffset,GetFrame().GetSourceImage().Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadeout/original_fadeOutTime*255)});
}

View File

@ -42,7 +42,7 @@ All rights reserved.
#include "util.h"
INCLUDE_game
INCLUDE_GFX
void Minimap::Initialize(){
Minimap::minimapChunkSize="Minimap.Chunk Size"_I;
@ -243,7 +243,7 @@ void Minimap::Draw(){
switch(displayMode){
case MinimapMode::SMALL:{
mapCircleHud.DrawRotatedDecal(minimapPos,cover.Decal(),0.f,game->camera.GetPosition()/game->GetCurrentMapData().tilewidth,vf2d{0.5f,0.5f});
game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,GFX["skill_overlay_icon.png"].Decal(),0.f,GFX["skill_overlay_icon.png"].Sprite()->Size()/2,vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/24.f*1.05f);
game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,GFX["assets/skill_overlay_icon.png"].Decal(),0.f,GFX["assets/skill_overlay_icon.png"].Sprite()->Size()/2,vf2d{float("Minimap.Minimap HUD Size"_I),float("Minimap.Minimap HUD Size"_I)}/24.f*1.05f);
game->DrawRotatedDecal(mapCircleHud.GetOffset()+minimapPos,game->GetPlayer()->GetMinimapImage().Decal(),0.f,vi2d{"Player.Minimap Image Size"_i[0],"Player.Minimap Image Size"_i[1]}/2,{0.5f,0.5f});
}break;
case MinimapMode::LARGE:{

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