diff --git a/Adventures in Lestoria/Bullet.cpp b/Adventures in Lestoria/Bullet.cpp index b60f5147..eccf4ab4 100644 --- a/Adventures in Lestoria/Bullet.cpp +++ b/Adventures in Lestoria/Bullet.cpp @@ -61,6 +61,12 @@ Animate2D::Frame Bullet::GetFrame()const{ } void Bullet::UpdateFadeTime(float fElapsedTime) { + if(fadeInTime>0){ + if(fadeInTimer0){ if(fadeOutTimer==0){ lifetime=fadeOutTime; @@ -144,7 +150,11 @@ void Bullet::_Update(const float fElapsedTime){ void Bullet::Draw()const{ Pixel blendCol=col; - blendCol.a=fadeOutTime==0?col.a:uint8_t(util::lerp(col.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime))); + if(fadeInTime==0&&fadeOutTime==0){ + blendCol.a=col.a; + }else + if(fadeOutTime>0)blendCol.a=uint8_t(util::lerp(col.a,0,1-((fadeOutTime-fadeOutTimer)/fadeOutTime))); + if(fadeInTime>0)blendCol.a=uint8_t(util::lerp(col.a,0,((fadeInTime-fadeInTimer)/fadeInTime))); if(GetZ()>0){ vf2d shadowScale=vf2d{8*scale.x/3.f,1}/std::max(1.f,GetZ()/8); @@ -191,4 +201,11 @@ const float Bullet::GetZ()const{ Bullet&Bullet::SetIframeTimeOnHit(float iframeTimer){ iframeTimerOnHit=iframeTimer; return *this; +} +Bullet&Bullet::SetFadeinTime(float fadeInTime){ + const float durationDiff=fadeInTime-fadeInTimer; + this->fadeInTime=fadeInTime; + lifetime+=durationDiff; + deactivated=true; + return *this; } \ No newline at end of file diff --git a/Adventures in Lestoria/Bullet.h b/Adventures in Lestoria/Bullet.h index 0b789671..2663fabe 100644 --- a/Adventures in Lestoria/Bullet.h +++ b/Adventures in Lestoria/Bullet.h @@ -63,6 +63,8 @@ protected: float distanceTraveled=0.f; vf2d scale={1,1}; private: + 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); bool dead=false; //When marked as dead it wil be removed by the next frame. @@ -96,4 +98,5 @@ public: const bool IsDead()const; const float GetZ()const; Bullet&SetIframeTimeOnHit(float iframeTimer); + Bullet&SetFadeinTime(float fadeInTime); }; \ No newline at end of file diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h index abf606c7..55c74120 100644 --- a/Adventures in Lestoria/BulletTypes.h +++ b/Adventures in Lestoria/BulletTypes.h @@ -191,7 +191,8 @@ struct Tornado:public Bullet{ vf2d centerPoint{}; float knockupDuration{}; float knockbackAmt{}; - Tornado(vf2d centerPoint,float distance,float initialRot,float rotSpd,float spd,int damage,const float knockupAmt,const float knockbackAmt,const float lifetime,bool upperLevel,bool friendly=false,Pixel col=WHITE,const vf2d scale={1,1}); + float fadeInDuration{}; + Tornado(vf2d centerPoint,float distance,float initialRot,float rotSpd,int damage,const float knockupAmt,const float knockbackAmt,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()!! diff --git a/Adventures in Lestoria/Tornado.cpp b/Adventures in Lestoria/Tornado.cpp index c3516245..58e73b82 100644 --- a/Adventures in Lestoria/Tornado.cpp +++ b/Adventures in Lestoria/Tornado.cpp @@ -40,8 +40,8 @@ All rights reserved. #include "Player.h" #include "util.h" -Tornado::Tornado(vf2d centerPoint,float distance,float initialRot,float rotSpd,float spd,int damage,const float knockupDuration,const float knockbackAmt,const float lifetime,bool upperLevel,bool friendly,Pixel col,const vf2d scale) - :polarAngle({distance,initialRot}),rotatingSpd(rotSpd),knockupDuration(knockupDuration),knockbackAmt(knockbackAmt),Bullet(centerPoint+polarAngle.cart(),{},6.f,damage,"tornado2.png",upperLevel,true,lifetime,false,friendly,col,scale){} +Tornado::Tornado(vf2d centerPoint,float distance,float initialRot,float rotSpd,int damage,const float knockupDuration,const float knockbackAmt,const float lifetime,bool upperLevel,bool friendly,Pixel col,const vf2d scale) + :polarAngle({distance,initialRot}),rotatingSpd(rotSpd),knockupDuration(knockupDuration),knockbackAmt(knockbackAmt),Bullet(centerPoint+polarAngle.cart(),vf2d{},6.f,damage,"tornado2.png",upperLevel,true,lifetime,false,friendly,col,scale){} void Tornado::Update(float fElapsedTime){ rot+=rotatingSpd; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5ce0ac14..33b2724f 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 9451 +#define VERSION_BUILD 9455 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Zephy.cpp b/Adventures in Lestoria/Zephy.cpp index 177a0679..9c6455b0 100644 --- a/Adventures in Lestoria/Zephy.cpp +++ b/Adventures in Lestoria/Zephy.cpp @@ -147,6 +147,22 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) m.phase=TORNADO_ATTACK; m.PerformAnimation("ATTACK",Direction::SOUTH); m.targetAcquireTimer=0.f; + m.F(A::CASTING_TIMER)=ConfigFloat("Tornado Attack.Attack Duration"); + + const int tornadoRingCount=Config("Tornado Attack.Tornados").GetKeys().size(); + for(int tornadoRingId=1;tornadoRingId<=tornadoRingCount;tornadoRingId++){ + + //From strategy documentation: + //# For each Ring: Distance from Boss in Units, # of tornados, Rotation Speed (degrees/sec). + const float tornadoDistance=ConfigPixelsArr(std::format("Tornado Attack.Tornados.Ring{}",tornadoRingId),0); + const int tornadoCount=ConfigIntArr(std::format("Tornado Attack.Tornados.Ring{}",tornadoRingId),1); + const float tornadoRotSpd=util::degToRad(ConfigFloatArr(std::format("Tornado Attack.Tornados.Ring{}",tornadoRingId),2)); //It's in degrees, let's convert it to radians now. + + const float randomRotDir=util::random(2*PI); + + CreateBullet(Tornado)(m.GetPos(),tornadoDistance,randomRotDir,tornadoRotSpd,m.GetAttack(),ConfigFloat("Tornado Attack.Knockup Duration"),ConfigFloat("Tornado Attack.Knockback Amount"),ConfigFloat("Tornado Attack.Attack Duration"),m.OnUpperLevel(),false,WHITE)EndBullet; + BULLET_LIST.back()->SetFadeinTime(ConfigFloat("Tornado Fade-In Time")); + } } }break; case TORNADO_ATTACK:{ diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index fca93b47..03d43f8b 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -805,6 +805,8 @@ MonsterStrategy Knockup Duration = 0.7s Knockback Amount = 2.0 + Tornado Fade-In Time = 0.5s + Tornados { # For each Ring: Distance from Boss in Units, # of tornados, Rotation Speed (degrees/sec). diff --git a/Adventures in Lestoria/assets/config/credits.txt b/Adventures in Lestoria/assets/config/credits.txt index 758d8ab3..784e8384 100644 --- a/Adventures in Lestoria/assets/config/credits.txt +++ b/Adventures in Lestoria/assets/config/credits.txt @@ -28,7 +28,7 @@ Credits LINE[25]=" " LINE[26]="olcPGEX_MiniAudio Copyright` 2024 by Moros Smith under the OLC-3 License" LINE[27]=" " - LINE[28]="olcPGEX_ViewPort by Gorbit99" + LINE[28]="olcPGEX_Gamepad & olcPGEX_ViewPort by Gorbit99" LINE[29]=" " LINE[30]="miniaudio library Copyright` 2024 by David Reid under the MIT No Attribution License" LINE[31]="Ogg Vorbis audio decoder - v1.22 - public domain http://nothings.org/stb_vorbis/" @@ -58,21 +58,24 @@ Credits LINE[55]="Nb Pixel Font Bundle" LINE[56]="Nb Pixel Font Bundle 2" LINE[57]=" " - LINE[58]=" " - LINE[59]="Game License" - LINE[60]="~~~~~~~~~~~~~~~~" - LINE[61]="License (OLC-3)" - LINE[62]="~~~~~~~~~~~~~~~" - LINE[63]=" " - LINE[64]="Copyright ` 2024 Sig Productions " - LINE[65]=" " - LINE[66]="Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:" - LINE[67]=" " - LINE[68]="1. Redistributions or derivations of source code must retain the above copyright notice, this list of conditions and the following disclaimer." - LINE[69]=" " - LINE[70]="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." - LINE[71]=" " - LINE[72]="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." - LINE[73]=" " - LINE[74]="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." + LINE[58]="Spells and Company by LittleFieryOne" + LINE[59]=" " + LINE[60]=" " + LINE[61]=" " + LINE[62]="Game License" + LINE[63]="~~~~~~~~~~~~~~~~" + LINE[64]="License (OLC-3)" + LINE[65]="~~~~~~~~~~~~~~~" + LINE[66]=" " + LINE[67]="Copyright ` 2024 Sig Productions " + LINE[68]=" " + LINE[69]="Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:" + LINE[70]=" " + LINE[71]="1. Redistributions or derivations of source code must retain the above copyright notice, this list of conditions and the following disclaimer." + LINE[72]=" " + LINE[73]="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." + LINE[74]=" " + LINE[75]="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." + LINE[76]=" " + LINE[77]="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." } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/spr_spell_tornado_strip4.png b/Adventures in Lestoria/assets/spr_spell_tornado_strip4.png deleted file mode 100644 index ee180022..00000000 Binary files a/Adventures in Lestoria/assets/spr_spell_tornado_strip4.png and /dev/null differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 32469ba4..eb735ad0 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ