diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index f395d9e9..9a6e4a14 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -683,6 +683,10 @@ + + + + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 668656cc..85ef9e8d 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -157,7 +157,6 @@ InputGroup AiL::KEY_TOGGLE_MAP; float AiL::SIZE_CHANGE_SPEED=1; AiL::AiL(){ - debugLogger.open("debug.log"); utils::datafile::Read(DATA,"assets/config/configuration.txt"); std::filesystem::create_directories("save_file_path"_S); @@ -1436,7 +1435,7 @@ void AiL::RenderWorld(float fElapsedTime){ ItemDrop::drops[dropInd].Draw(); } for(const Bullet*const b:bulletsLower){ - b->Draw(); + b->_Draw(); } for(const Effect*const e:foregroundEffectsLower){ e->Draw(); @@ -1739,7 +1738,7 @@ void AiL::RenderWorld(float fElapsedTime){ ++dropsAfterUpperIt; } for(const Bullet*const b:bulletsUpper){ - b->Draw(); + b->_Draw(); } for(const Effect*const e:foregroundEffectsUpper){ e->Draw(); diff --git a/Adventures in Lestoria/Bomb.cpp b/Adventures in Lestoria/Bomb.cpp index 7ad86d64..ed687291 100644 --- a/Adventures in Lestoria/Bomb.cpp +++ b/Adventures in Lestoria/Bomb.cpp @@ -102,7 +102,7 @@ bool Bomb::MonsterHit(Monster&monster){ return false; } -void Bomb::Draw()const{ - Bullet::Draw(); +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,0,1-((fadeOutTime-GetFadeoutTimer())/fadeOutTime)))}); } \ No newline at end of file diff --git a/Adventures in Lestoria/Bullet.cpp b/Adventures in Lestoria/Bullet.cpp index 4639ddf9..9098b9fa 100644 --- a/Adventures in Lestoria/Bullet.cpp +++ b/Adventures in Lestoria/Bullet.cpp @@ -151,7 +151,7 @@ void Bullet::_Update(const float fElapsedTime){ } } -void Bullet::Draw()const{ +void Bullet::_Draw()const{ Pixel blendCol=col; if(fadeInTime==0&&fadeOutTime==0)blendCol.a=col.a; @@ -169,7 +169,10 @@ void Bullet::Draw()const{ &&(game->GetPlayer()->HasIframes()||game->GetPlayer()->GetZ()>1)){ blendCol.a/=1.59f; //Comes from 255 divided by 160 which is roughly what we want the alpha to be when the bullet has full transparency. } + Draw(blendCol); +} +void Bullet::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); }else{ diff --git a/Adventures in Lestoria/Bullet.h b/Adventures in Lestoria/Bullet.h index 95c5579f..c88339e2 100644 --- a/Adventures in Lestoria/Bullet.h +++ b/Adventures in Lestoria/Bullet.h @@ -42,6 +42,7 @@ All rights reserved. #include "DEFINES.h" struct Bullet{ + friend class AiL; vf2d vel; vf2d pos; float radius; @@ -61,16 +62,17 @@ struct Bullet{ protected: float distanceTraveled=0.f; vf2d scale={1,1}; -private: float fadeOutTimer=0; float fadeInTime=0; //Setting the fade in time causes the bullet to be disabled and the bullet's alpha will fade in from zero to the actual alpha of the bullet. When the fade in timer reaches the fade in time automatically, the bullet will be enabled. float fadeInTimer=0; void UpdateFadeTime(float fElapsedTime); virtual void Update(float fElapsedTime); +private: bool dead=false; //When marked as dead it wil be removed by the next frame. bool simulated=false; //A simulated bullet cannot interact / damage things in the world. It's simply used for simulating the trajectory and potential path of the bullet float iframeTimerOnHit{0.f}; bool playerAutoAttackProjectile=false; //Set to true for bullets that are auto attack projectiles to identify them. + void _Draw()const; protected: float drawOffsetY{}; bool _PlayerHit(Player*player); @@ -95,7 +97,7 @@ public: //DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! virtual bool MonsterHit(Monster&monster); Animate2D::Frame GetFrame()const; - virtual void Draw()const; + virtual void Draw(const Pixel blendCol)const; bool OnUpperLevel(); const bool IsDead()const; const float GetZ()const; diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h index 608523d6..cc4f2ba4 100644 --- a/Adventures in Lestoria/BulletTypes.h +++ b/Adventures in Lestoria/BulletTypes.h @@ -96,7 +96,7 @@ struct FrogTongue:public Bullet{ void Update(float fElapsedTime)override; bool PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! bool MonsterHit(Monster&monster)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! - void Draw()const override; + void Draw(const Pixel blendCol)const override; }; struct Wisp:public Bullet{ @@ -159,7 +159,7 @@ struct Bomb:public Bullet{ void Update(float fElapsedTime)override; bool PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! bool MonsterHit(Monster&monster)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! - void Draw()const override; + void Draw(const Pixel blendCol)const override; }; struct LevitatingRock:public Bullet{ @@ -180,7 +180,7 @@ struct LevitatingRock:public Bullet{ void Update(float fElapsedTime)override; bool PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! bool MonsterHit(Monster&monster)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! - void Draw()const override; + void Draw(const Pixel blendCol)const override; void AssignMaster(LevitatingRock*masterRock); const bool IsMaster()const; }; @@ -197,4 +197,15 @@ struct Tornado:public Bullet{ void Update(float fElapsedTime)override; bool PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! bool MonsterHit(Monster&monster)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! +}; + +struct Debris:public Bullet{ + const int randomFrame{}; + const float rotatingSpd{}; + float knockbackAmt{}; + Debris(const vf2d pos,const vf2d vel,const int damage,const float radius,const float knockbackAmt,const float rotSpd,const float lifetime,bool upperLevel,bool friendly=false,Pixel col=WHITE,const vf2d scale={1,1}); + void Update(float fElapsedTime)override; + bool PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! + bool MonsterHit(Monster&monster)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! + void Draw(const Pixel blendCol)const override; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Debris.cpp b/Adventures in Lestoria/Debris.cpp new file mode 100644 index 00000000..f7683e69 --- /dev/null +++ b/Adventures in Lestoria/Debris.cpp @@ -0,0 +1,61 @@ +#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 "BulletTypes.h" +#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,bool 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)){} +void Debris::Update(float fElapsedTime){ + image_angle+=rotatingSpd; +} +bool Debris::PlayerHit(Player*player){ + player->Knockback(vel.norm()*knockbackAmt); + return true; +} +bool Debris::MonsterHit(Monster&monster){ + monster.Knockback(vel.norm()*knockbackAmt); + return true; +} +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); +} \ No newline at end of file diff --git a/Adventures in Lestoria/FrogTongue.cpp b/Adventures in Lestoria/FrogTongue.cpp index b19efc8d..3773777b 100644 --- a/Adventures in Lestoria/FrogTongue.cpp +++ b/Adventures in Lestoria/FrogTongue.cpp @@ -91,7 +91,7 @@ bool FrogTongue::MonsterHit(Monster&monster){ monster.Knockback(geom2d::line(pos+drawVec,targetPos).vector()*knockbackStrength); return false; } -void FrogTongue::Draw()const{ +void FrogTongue::Draw(const Pixel blendCol)const{ geom2d::linelineToTarget(pos,targetPos); vf2d drawVec=lineToTarget.vector().norm()*3; diff --git a/Adventures in Lestoria/LevitatingRock.cpp b/Adventures in Lestoria/LevitatingRock.cpp index 84a83b32..2cfe4d74 100644 --- a/Adventures in Lestoria/LevitatingRock.cpp +++ b/Adventures in Lestoria/LevitatingRock.cpp @@ -103,8 +103,8 @@ bool LevitatingRock::MonsterHit(Monster&monster){ return true; } -void LevitatingRock::Draw()const{ - Bullet::Draw(); +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); } diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index a057fb0e..d49fa3b3 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -23,5 +23,4 @@ New Monster Sound Effects DEMO ==== -Health % max health healing bug Go back and apply new rendering code. \ No newline at end of file diff --git a/Adventures in Lestoria/Tornado.cpp b/Adventures in Lestoria/Tornado.cpp index 70838493..821b9876 100644 --- a/Adventures in Lestoria/Tornado.cpp +++ b/Adventures in Lestoria/Tornado.cpp @@ -61,7 +61,7 @@ bool Tornado::PlayerHit(Player*player){ player->Knockback(util::pointTo(centerPoint,player->GetPos())*knockbackAmt); player->Knockup(knockupDuration); - player->ApplyIframes(knockupDuration); + player->ApplyIframes(knockupDuration*2); return false; } @@ -72,7 +72,7 @@ bool Tornado::MonsterHit(Monster&monster){ monster.Knockback(util::pointTo(centerPoint,monster.GetPos())*knockbackAmt); monster.Knockup(knockupDuration); - monster.ApplyIframes(knockupDuration); + monster.ApplyIframes(knockupDuration*2); return false; } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 86841082..805190a4 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 9510 +#define VERSION_BUILD 9515 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Zephy.cpp b/Adventures in Lestoria/Zephy.cpp index 1c7ac236..5be4e10f 100644 --- a/Adventures in Lestoria/Zephy.cpp +++ b/Adventures in Lestoria/Zephy.cpp @@ -89,9 +89,15 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) m.phase=IDLE; game->SetOverlay(ConfigString("Wind Attack.Wind Overlay Sprite"),ConfigPixel("Wind Attack.Wind Overlay Color")); game->GetOverlay().Disable(); + + m.SetStrategyDeathFunction([](GameEvent&ev,Monster&m,const std::string&strategy){ + game->SetWindSpeed({}); + game->GetOverlay().Disable(); + return true; + }); }break; case IDLE:{ - const int randomAttackChoice=2; + const int randomAttackChoice=1; switch(randomAttackChoice){ case 0:{ @@ -204,11 +210,13 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration"); m.F(A::WIND_STRENGTH)=ConfigFloat("Wind Attack.Wind Starting Strength")/100.f; m.F(A::WIND_PHASE_TIMER)=ConfigFloat("Wind Attack.Wind Increase Phase Wait Time"); + m.F(A::SHOOT_TIMER)=ConfigFloat("Wind Attack.Wind Projectile Spawn Rate"); } }break; case WIND_ATTACK:{ m.F(A::CASTING_TIMER)-=fElapsedTime; m.F(A::WIND_PHASE_TIMER)-=fElapsedTime; + m.F(A::SHOOT_TIMER)-=fElapsedTime; const bool OnLeftLandingSite=m.I(A::ATTACK_CHOICE); @@ -257,12 +265,15 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) vf2d windSpd={m.F(A::WIND_STRENGTH)*"Player.MoveSpd"_F,0.f}; //Assume we landed left and causing a wind attack to the right. if(!LeftLandingSite)windSpd*=-1; game->SetWindSpeed(windSpd); - m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration"); #pragma endregion if(m.F(A::CASTING_TIMER)<=0.f){ m.phase=IDLE; game->GetOverlay().Disable(); + game->SetWindSpeed({}); + } + if(m.F(A::SHOOT_TIMER)<=0.f){ + } }break; case HALFHEALTH_PHASE:{ diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index 2513818e..0daecbb5 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -102,6 +102,7 @@ Images GFX_WindOverlay = wind_vignette.png GFX_Wind1 = wind1.png GFX_Wind2 = wind2.png + GFX_WindObjects = commercial_assets/wind_solid_objects.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 0afc6759..c77146c8 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 4165358a..fcacae20 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ