The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
490 lines
24 KiB
490 lines
24 KiB
#pragma region License
|
|
/*
|
|
License (OLC-3)
|
|
~~~~~~~~~~~~~~~
|
|
|
|
Copyright 2024 Joshua 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 "Animation.h"
|
|
#include "AdventuresInLestoria.h"
|
|
#include "DEFINES.h"
|
|
#include "safemap.h"
|
|
#include <ranges>
|
|
|
|
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={}){
|
|
Animate2D::FrameSequence anim(data.frameDuration,data.style);
|
|
anim.AddFrame({&GFX[imgName],{{0,0},size}});
|
|
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}});
|
|
}
|
|
ANIMATION_DATA[imgName]=anim;
|
|
};
|
|
|
|
auto SetupClassWalkIdleAnimations=[&](Renderable&sheet,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}}});
|
|
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}}});
|
|
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}}});
|
|
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}}});
|
|
ANIMATION_DATA[className+"_WALK_N"]=pl_walk_n;
|
|
Animate2D::FrameSequence pl_idle_s;
|
|
pl_idle_s.AddFrame({&sheet,{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}}});
|
|
ANIMATION_DATA[className+"_IDLE_E"]=pl_idle_e;
|
|
Animate2D::FrameSequence pl_idle_w;
|
|
pl_idle_w.AddFrame({&sheet,{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}}});
|
|
ANIMATION_DATA[className+"_IDLE_N"]=pl_idle_n;
|
|
};
|
|
|
|
//Warrior animations.
|
|
SetupClassWalkIdleAnimations(GFX["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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
ANIMATION_DATA["WARRIOR_SWINGSWORD_N"]=pl_warrior_swing_n;
|
|
ANIMATION_DATA["WARRIOR_SWINGSWORD_E"]=pl_warrior_swing_e;
|
|
ANIMATION_DATA["WARRIOR_SWINGSWORD_S"]=pl_warrior_swing_s;
|
|
ANIMATION_DATA["WARRIOR_SWINGSWORD_W"]=pl_warrior_swing_w;
|
|
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_N"]=pl_warrior_sonic_swing_n;
|
|
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_E"]=pl_warrior_sonic_swing_e;
|
|
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_S"]=pl_warrior_sonic_swing_s;
|
|
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_W"]=pl_warrior_sonic_swing_w;
|
|
|
|
//Ranger animations
|
|
SetupClassWalkIdleAnimations(GFX["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}}});
|
|
}
|
|
ANIMATION_DATA["RANGER_SHOOT_S"]=pl_ranger_shoot_s;
|
|
ANIMATION_DATA["RANGER_SHOOT_N"]=pl_ranger_shoot_n;
|
|
ANIMATION_DATA["RANGER_SHOOT_E"]=pl_ranger_shoot_e;
|
|
ANIMATION_DATA["RANGER_SHOOT_W"]=pl_ranger_shoot_w;
|
|
|
|
//Wizard animations
|
|
SetupClassWalkIdleAnimations(GFX["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}}});
|
|
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}}});
|
|
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}}});
|
|
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}}});
|
|
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}}});
|
|
if(i==1){
|
|
pl_wizard_attack_s.AddFrame({&GFX["nico-wizard.png"],{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}}});
|
|
if(i==1){
|
|
pl_wizard_attack_e.AddFrame({&GFX["nico-wizard.png"],{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}}});
|
|
if(i==1){
|
|
pl_wizard_attack_w.AddFrame({&GFX["nico-wizard.png"],{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}}});
|
|
if(i==1){
|
|
pl_wizard_attack_n.AddFrame({&GFX["nico-wizard.png"],{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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
ANIMATION_DATA["WIZARD_CAST_W"]=pl_wizard_cast_w;
|
|
|
|
//Thief animations.
|
|
SetupClassWalkIdleAnimations(GFX["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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
ANIMATION_DATA["THIEF_SWINGSWORD_N"]=pl_thief_swing_n;
|
|
ANIMATION_DATA["THIEF_SWINGSWORD_E"]=pl_thief_swing_e;
|
|
ANIMATION_DATA["THIEF_SWINGSWORD_S"]=pl_thief_swing_s;
|
|
ANIMATION_DATA["THIEF_SWINGSWORD_W"]=pl_thief_swing_w;
|
|
ANIMATION_DATA["THIEF_DEADLYDASH_N"]=pl_thief_deadlydash_n;
|
|
ANIMATION_DATA["THIEF_DEADLYDASH_E"]=pl_thief_deadlydash_e;
|
|
ANIMATION_DATA["THIEF_DEADLYDASH_S"]=pl_thief_deadlydash_s;
|
|
ANIMATION_DATA["THIEF_DEADLYDASH_W"]=pl_thief_deadlydash_w;
|
|
|
|
//Trapper animations
|
|
SetupClassWalkIdleAnimations(GFX["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}}});
|
|
}
|
|
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}}});
|
|
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}}});
|
|
}
|
|
ANIMATION_DATA["TRAPPER_SHOOT_S"]=pl_trapper_shoot_s;
|
|
ANIMATION_DATA["TRAPPER_SHOOT_N"]=pl_trapper_shoot_n;
|
|
ANIMATION_DATA["TRAPPER_SHOOT_E"]=pl_trapper_shoot_e;
|
|
ANIMATION_DATA["TRAPPER_SHOOT_W"]=pl_trapper_shoot_w;
|
|
ANIMATION_DATA["TRAPPER_SETTRAP_S"]=pl_trapper_setTrap_s;
|
|
ANIMATION_DATA["TRAPPER_SETTRAP_N"]=pl_trapper_setTrap_n;
|
|
ANIMATION_DATA["TRAPPER_SETTRAP_E"]=pl_trapper_setTrap_e;
|
|
ANIMATION_DATA["TRAPPER_SETTRAP_W"]=pl_trapper_setTrap_w;
|
|
|
|
//Witch animations
|
|
SetupClassWalkIdleAnimations(GFX["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}}});
|
|
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}}});
|
|
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}}});
|
|
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}}});
|
|
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}}});
|
|
if(i==1){
|
|
pl_witch_attack_s.AddFrame({&GFX["nico-witch.png"],{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}}});
|
|
if(i==1){
|
|
pl_witch_attack_e.AddFrame({&GFX["nico-witch.png"],{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}}});
|
|
if(i==1){
|
|
pl_witch_attack_w.AddFrame({&GFX["nico-witch.png"],{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}}});
|
|
if(i==1){
|
|
pl_witch_attack_n.AddFrame({&GFX["nico-witch.png"],{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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
Animate2D::FrameSequence pl_witch_transform_n(0.1f);
|
|
pl_witch_transform_n.AddFrame({&GFX["nico-witch.png"],{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}}});
|
|
Animate2D::FrameSequence pl_witch_transform_e(0.1f);
|
|
pl_witch_transform_e.AddFrame({&GFX["nico-witch.png"],{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;
|
|
ANIMATION_DATA["WITCH_TRANSFORM_E"]=pl_witch_transform_e;
|
|
|
|
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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}}});
|
|
}
|
|
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("swordslash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
|
|
|
|
CreateStillAnimation("energy_bolt.png",{24,24});
|
|
|
|
CreateHorizontalAnimationSequence("energy_particle.png",3,{3,3});
|
|
|
|
CreateHorizontalAnimationSequence("splash_effect.png",5,{24,24},{0.05f});
|
|
|
|
CreateStillAnimation("circle.png",{3,3});
|
|
|
|
CreateHorizontalAnimationSequence("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("chain_lightning.png",{1,9});
|
|
|
|
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}});
|
|
|
|
CreateStillAnimation("meteor.png",{192,192});
|
|
|
|
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;
|
|
}
|
|
CreateStillAnimation("arrow.png",{24,24});
|
|
CreateStillAnimation("charged_shot_arrow.png",{48,48});
|
|
CreateStillAnimation("laser.png",{5,1});
|
|
CreateStillAnimation("range_indicator.png",{24,24});
|
|
|
|
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;
|
|
//Idle sequences for the mounted boar bow goblin.
|
|
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}}});
|
|
}
|
|
ANIMATION_DATA[std::format("GOBLIN_BOW_MOUNTED_{}",animationIndex)]=mountAnimation;
|
|
}
|
|
//Shooting sequences for the mounted boar bow goblin.
|
|
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}}});
|
|
}
|
|
ANIMATION_DATA[std::format("GOBLIN_BOW_ATTACK_{}",animationIndex)]=mountShootAnimation;
|
|
}
|
|
|
|
Animate2D::FrameSequence parrot_sit_n,parrot_sit_e,parrot_sit_s,parrot_sit_w;
|
|
//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}}});
|
|
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;
|
|
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;
|
|
#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("portal.png",8,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}});
|
|
|
|
//!!!!!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;
|
|
if(!ANIMATION_DATA.count(imgFile)){
|
|
LOG("WARNING! Animation data for "<<imgFile<<" not found! Auto-generating...");
|
|
CreateStillAnimation(imgFile,GFX[imgFile].Sprite()->Size());
|
|
}
|
|
}
|
|
}
|
|
|
|
void sig::Animation::SetupPlayerAnimations(){
|
|
int counter=0;
|
|
while("Player"_A.HasProperty("PLAYER_ANIMATION["+std::to_string(counter)+"]")){
|
|
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_N");
|
|
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_E");
|
|
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_S");
|
|
game->GetPlayer()->AddAnimation(DATA["Player"]["PLAYER_ANIMATION["+std::to_string(counter)+"]"].GetString()+"_W");
|
|
counter++;
|
|
}
|
|
|
|
ANIMATION_DATA.SetInitialized();
|
|
} |