diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index c405d679..f395d9e9 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -715,6 +715,10 @@ + + + + diff --git a/Adventures in Lestoria/Effect.h b/Adventures in Lestoria/Effect.h index d65be004..fb852372 100644 --- a/Adventures in Lestoria/Effect.h +++ b/Adventures in Lestoria/Effect.h @@ -93,4 +93,11 @@ struct SwordSlash:Effect{ bool Update(float fElapsedTime)override; private: HitList hitList; +}; + +//This draws effects using screen coordinates instead of world coordinates, useful for applying effects directly on the screen. +struct ForegroundEffect:Effect{ + ForegroundEffect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,float size=1.0f,float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false); + ForegroundEffect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false); + virtual void Draw()const override final; }; \ No newline at end of file diff --git a/Adventures in Lestoria/ForegroundEffect.cpp b/Adventures in Lestoria/ForegroundEffect.cpp new file mode 100644 index 00000000..6854df40 --- /dev/null +++ b/Adventures in Lestoria/ForegroundEffect.cpp @@ -0,0 +1,58 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +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 "olcPixelGameEngine.h" +#include "Effect.h" +#include "DEFINES.h" +#include "AdventuresInLestoria.h" + +INCLUDE_game + +ForegroundEffect::ForegroundEffect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,float 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){} +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{ + if(additiveBlending)game->SetDecalMode(DecalMode::ADDITIVE); + if(fadeout==0){ + game->DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,col); + } else { + game->DrawPartialRotatedDecal(pos,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->SetDecalMode(DecalMode::NORMAL); +} \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 7c0a4f20..a6c50b72 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 9486 +#define VERSION_BUILD 9491 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Zephy.cpp b/Adventures in Lestoria/Zephy.cpp index cec14458..22304603 100644 --- a/Adventures in Lestoria/Zephy.cpp +++ b/Adventures in Lestoria/Zephy.cpp @@ -45,6 +45,7 @@ All rights reserved. INCLUDE_game INCLUDE_MONSTER_DATA INCLUDE_WINDOW_SIZE +INCLUDE_GFX using A=Attribute; @@ -89,7 +90,7 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) game->GetOverlay().Disable(); }break; case IDLE:{ - const int randomAttackChoice=util::random()%3; + const int randomAttackChoice=2; switch(randomAttackChoice){ case 0:{ @@ -208,11 +209,15 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) else m.PerformAnimation("ATTACK",Direction::WEST); #pragma region Wind Streak Effect - m.F(A::ENVIRONMENT_TIMER)-=fElapsedTime; + m.F(A::ENVIRONMENT_TIMER)-=fElapsedTime; //Assuming facing right / on left landing site for initial values. if(m.F(A::ENVIRONMENT_TIMER)<=0.f){ - vf2d randomScreenOffset={util::random(WINDOW_SIZE.x/2.f),float(WINDOW_SIZE.y)}; - float randomSpeed=util::random_range(ConfigFloatArr("Wind Attack.Wind Streak Speed Range",0),ConfigFloatArr("Wind Attack.Wind Streak Speed Range",1)); + const bool spawnOnTopOfScreen=util::random()%2; + float windStreakYPos=util::random(WINDOW_SIZE.y/4.f); + if(!spawnOnTopOfScreen)windStreakYPos=WINDOW_SIZE.y-windStreakYPos; + vf2d randomScreenOffset={util::random(WINDOW_SIZE.x/2.f),windStreakYPos}; + + vf2d randomSpeed=vf2d{util::random_range(ConfigFloatArr("Wind Attack.Wind Streak X Speed Range",0),ConfigFloatArr("Wind Attack.Wind Streak X Speed Range",1)),util::random_range(ConfigFloatArr("Wind Attack.Wind Streak Y Speed Range",0),ConfigFloatArr("Wind Attack.Wind Streak Y Speed Range",1))}; float randomLifetime=util::random_range(ConfigFloatArr("Wind Attack.Wind Streak Lifetime Range",0),ConfigFloatArr("Wind Attack.Wind Streak Lifetime Range",1)); if(!OnLeftLandingSite){ @@ -220,6 +225,16 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) randomSpeed*=-1.f; } + const uint8_t randomColAmt=util::random()%256; + const uint8_t randomAlpha=util::random()%256; + const std::string windImageChoice=util::random()%2?"wind1.png":"wind2.png"; + + const bool positiveWindRotation=util::random()%2; + float windRotationSpd=util::random(util::degToRad(15.f)); + if(!positiveWindRotation)windRotationSpd*=-1; + + game->AddEffect(std::make_unique(randomScreenOffset,randomLifetime,windImageChoice,m.OnUpperLevel(),vf2d{1.f,1.f}*(util::random_range(0.25f,1.f)),1.f,randomSpeed,Pixel{randomColAmt,randomColAmt,randomColAmt,randomAlpha},util::random(2*PI),windRotationSpd,true)); + m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Wind Attack.Wind Streak Spawn Rate"); } #pragma endregion diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 1ef67d8b..2716288c 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -835,9 +835,10 @@ MonsterStrategy Wind Overlay Sprite = "wind_vignette.png" Wind Overlay Color = 64, 64, 64, 255 - Wind Streak Spawn Rate = 0.15s + Wind Streak Spawn Rate = 0.08s # In pixels/sec - Wind Streak Speed Range = 24px/s, 128px/s + Wind Streak X Speed Range = 240px/s, 768px/s + Wind Streak Y Speed Range = -16px/s, 16px/s Wind Streak Lifetime Range = 2s, 8s } } diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index 174d38c0..2513818e 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -100,6 +100,8 @@ Images GFX_BirdPoop = birdpoop.png GFX_Tornado = tornado2.png GFX_WindOverlay = wind_vignette.png + GFX_Wind1 = wind1.png + GFX_Wind2 = wind2.png # Ability Icons GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index e8983334..0afc6759 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 26154307..ec810a2d 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ