Redundant collision tile error handling. And allow a flag for abilities to cancel casts (Wizard Teleport)

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
pull/28/head
parent ac0fbbb174
commit dbc68b8c4b
  1. 1
      Crawler/Ability.h
  2. 2
      Crawler/Crawler.cpp
  3. 10
      Crawler/Player.h
  4. 4
      Crawler/TSXParser.h
  5. 2
      Crawler/Warrior.cpp
  6. 1
      Crawler/Wizard.cpp
  7. 11
      Crawler/assets/config/classes/Ranger.txt
  8. 8
      Crawler/assets/config/classes/Thief.txt
  9. 8
      Crawler/assets/config/classes/Trapper.txt
  10. 8
      Crawler/assets/config/classes/Warrior.txt
  11. 8
      Crawler/assets/config/classes/Witch.txt
  12. 10
      Crawler/assets/config/classes/Wizard.txt
  13. 1
      Crawler/assets/maps/Decorations_c1_No_Shadow24x24.tsx
  14. 1
      Crawler/assets/maps/Tilesheet_No_Shadow24x24.tsx

@ -22,6 +22,7 @@ struct Ability{
float COOLDOWN_TIME=0;
int manaCost=0;
Pixel barColor1,barColor2;
bool canCancelCast=false;
PrecastData precastInfo;
std::function<bool(Player*,vf2d)>action=[](Player*,vf2d){return false;};
Ability();

@ -578,7 +578,7 @@ void Crawler::RenderWorld(float fElapsedTime){
playerScale.x=120*abs(pow(player->teleportAnimationTimer-0.175,3));
pos=player->teleportStartPosition.lerp(player->teleportTarget,(0.35-player->teleportAnimationTimer)/0.35);
}
view.DrawPartialRotatedDecal(pos+vf2d{0,-player->GetZ()*(signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,player->GetBuffs(BuffType::ATTACK_UP).size()>0?Pixel{255,uint8_t(255*abs(sin(1.4*player->GetBuffs(BuffType::ATTACK_UP)[0].duration))),uint8_t(255*abs(sin(1.4*player->GetBuffs(BuffType::ATTACK_UP)[0].duration)))}:WHITE);
view.DrawPartialRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,player->GetBuffs(BuffType::ATTACK_UP).size()>0?Pixel{255,uint8_t(255*abs(sin(1.4*player->GetBuffs(BuffType::ATTACK_UP)[0].duration))),uint8_t(255*abs(sin(1.4*player->GetBuffs(BuffType::ATTACK_UP)[0].duration)))}:WHITE);
};
enum class RenderMode{

@ -352,7 +352,8 @@ struct Witch:Player{
#class".Right Click Ability.Mana Cost"_I, \
{uint8_t(#class".Right Click Ability.Cooldown Bar Color 1"_f[0]),uint8_t(#class".Right Click Ability.Cooldown Bar Color 1"_f[1]),uint8_t(#class".Right Click Ability.Cooldown Bar Color 1"_f[2]),uint8_t(#class".Right Click Ability.Cooldown Bar Color 1"_f[3]==0?255:#class".Right Click Ability.Cooldown Bar Color 1"_f[3])}, \
{uint8_t(#class".Right Click Ability.Cooldown Bar Color 2"_f[0]),uint8_t(#class".Right Click Ability.Cooldown Bar Color 2"_f[1]),uint8_t(#class".Right Click Ability.Cooldown Bar Color 2"_f[2]),uint8_t(#class".Right Click Ability.Cooldown Bar Color 2"_f[3]==0?255:#class".Right Click Ability.Cooldown Bar Color 2"_f[3])}, \
{#class".Right Click Ability.Precast Time"_F,#class".Right Click Ability.Casting Range"_I/100.f*24,#class".Right Click Ability.Casting Size"_I/100.f*24} \
{#class".Right Click Ability.Precast Time"_F,#class".Right Click Ability.Casting Range"_I/100.f*24,#class".Right Click Ability.Casting Size"_I/100.f*24}, \
bool(#class".Right Click Ability.CancelCast"_I) \
}; \
class::ability1={ \
#class".Ability 1.Name"_S, \
@ -360,7 +361,8 @@ struct Witch:Player{
#class".Ability 1.Mana Cost"_I, \
{uint8_t(#class".Ability 1.Cooldown Bar Color 1"_f[0]),uint8_t(#class".Ability 1.Cooldown Bar Color 1"_f[1]),uint8_t(#class".Ability 1.Cooldown Bar Color 1"_f[2]),uint8_t(#class".Ability 1.Cooldown Bar Color 1"_f[3]==0?255:#class".Ability 1.Cooldown Bar Color 1"_f[3])}, \
{uint8_t(#class".Ability 1.Cooldown Bar Color 2"_f[0]),uint8_t(#class".Ability 1.Cooldown Bar Color 2"_f[1]),uint8_t(#class".Ability 1.Cooldown Bar Color 2"_f[2]),uint8_t(#class".Ability 1.Cooldown Bar Color 2"_f[3]==0?255:#class".Ability 1.Cooldown Bar Color 2"_f[3])}, \
{#class".Ability 1.Precast Time"_F,#class".Ability 1.Casting Range"_I/100.f*24,#class".Ability 1.Casting Size"_I/100.f*24} \
{#class".Ability 1.Precast Time"_F,#class".Ability 1.Casting Range"_I/100.f*24,#class".Ability 1.Casting Size"_I/100.f*24}, \
bool(#class".Ability 1.CancelCast"_I) \
}; \
class::ability2={ \
#class".Ability 2.Name"_S, \
@ -369,6 +371,7 @@ struct Witch:Player{
{uint8_t(#class".Ability 2.Cooldown Bar Color 1"_f[0]),uint8_t(#class".Ability 2.Cooldown Bar Color 1"_f[1]),uint8_t(#class".Ability 2.Cooldown Bar Color 1"_f[2]),uint8_t(#class".Ability 2.Cooldown Bar Color 1"_f[3]==0?255:#class".Ability 2.Cooldown Bar Color 1"_f[3])}, \
{uint8_t(#class".Ability 2.Cooldown Bar Color 2"_f[0]),uint8_t(#class".Ability 2.Cooldown Bar Color 2"_f[1]),uint8_t(#class".Ability 2.Cooldown Bar Color 2"_f[2]),uint8_t(#class".Ability 2.Cooldown Bar Color 2"_f[3]==0?255:#class".Ability 2.Cooldown Bar Color 2"_f[3])}, \
{#class".Ability 2.Precast Time"_F,#class".Ability 2.Casting Range"_I/100.f*24,#class".Ability 2.Casting Size"_I/100.f*24} \
bool(#class".Ability 2.CancelCast"_I) \
}; \
class::ability3={ \
#class".Ability 3.Name"_S, \
@ -376,6 +379,7 @@ struct Witch:Player{
#class".Ability 3.Mana Cost"_I, \
{uint8_t(#class".Ability 3.Cooldown Bar Color 1"_f[0]),uint8_t(#class".Ability 3.Cooldown Bar Color 1"_f[1]),uint8_t(#class".Ability 3.Cooldown Bar Color 1"_f[2]),uint8_t(#class".Ability 3.Cooldown Bar Color 1"_f[3]==0?255:#class".Ability 3.Cooldown Bar Color 1"_f[3])}, \
{uint8_t(#class".Ability 3.Cooldown Bar Color 2"_f[0]),uint8_t(#class".Ability 3.Cooldown Bar Color 2"_f[1]),uint8_t(#class".Ability 3.Cooldown Bar Color 2"_f[2]),uint8_t(#class".Ability 3.Cooldown Bar Color 2"_f[3]==0?255:#class".Ability 3.Cooldown Bar Color 2"_f[3])}, \
{#class".Ability 3.Precast Time"_F,#class".Ability 3.Casting Range"_I/100.f*24,#class".Ability 3.Casting Size"_I/100.f*24} \
{#class".Ability 3.Precast Time"_F,#class".Ability 3.Casting Range"_I/100.f*24,#class".Ability 3.Casting Size"_I/100.f*24}, \
bool(#class".Ability 3.CancelCast"_I) \
}; \
class::ability4={"???",0,0};

@ -128,6 +128,10 @@ class TSXParser{
if (newTag.tag=="object"&&previousTag=="tile"){
TileCollisionData data;
data.collision=geom2d::rect<int>{{newTag.GetInteger("x"),newTag.GetInteger("y")},{newTag.GetInteger("width"),newTag.GetInteger("height")}};
if(parsedTilesetInfo.CollisionData.count(previousTagID)){
std::cout<<"WARNING! There was already collision data defined for tile "<<previousTagID<<"!"<<std::endl;
throw;
}
parsedTilesetInfo.CollisionData[previousTagID]=data;
}
std::cout<<"\n"<<"=============\n";

@ -11,7 +11,7 @@ INCLUDE_BULLET_LIST
INCLUDE_game
void Warrior::Initialize(){
READFROMCONFIG(Warrior,WARRIOR);
Warrior::name="Warrior"".ClassName"_S; Warrior::cl=WARRIOR; Warrior::rightClickAbility=Ability{ "Warrior"".Right Click Ability.Name"_S, "Warrior"".Right Click Ability.Cooldown"_F, "Warrior"".Right Click Ability.Mana Cost"_I, {uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 1"_f[0]),uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 1"_f[1]),uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 1"_f[2]),uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 1"_f[3]==0?255:"Warrior"".Right Click Ability.Cooldown Bar Color 1"_f[3])}, {uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 2"_f[0]),uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 2"_f[1]),uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 2"_f[2]),uint8_t("Warrior"".Right Click Ability.Cooldown Bar Color 2"_f[3]==0?255:"Warrior"".Right Click Ability.Cooldown Bar Color 2"_f[3])}, {"Warrior"".Right Click Ability.Precast Time"_F,"Warrior"".Right Click Ability.Casting Range"_I/100.f*24,"Warrior"".Right Click Ability.Casting Size"_I/100.f*24}, bool("Warrior"".Right Click Ability.CancelCast"_I) }; Warrior::ability1={ "Warrior"".Ability 1.Name"_S, "Warrior"".Ability 1.Cooldown"_F, "Warrior"".Ability 1.Mana Cost"_I, {uint8_t("Warrior"".Ability 1.Cooldown Bar Color 1"_f[0]),uint8_t("Warrior"".Ability 1.Cooldown Bar Color 1"_f[1]),uint8_t("Warrior"".Ability 1.Cooldown Bar Color 1"_f[2]),uint8_t("Warrior"".Ability 1.Cooldown Bar Color 1"_f[3]==0?255:"Warrior"".Ability 1.Cooldown Bar Color 1"_f[3])}, {uint8_t("Warrior"".Ability 1.Cooldown Bar Color 2"_f[0]),uint8_t("Warrior"".Ability 1.Cooldown Bar Color 2"_f[1]),uint8_t("Warrior"".Ability 1.Cooldown Bar Color 2"_f[2]),uint8_t("Warrior"".Ability 1.Cooldown Bar Color 2"_f[3]==0?255:"Warrior"".Ability 1.Cooldown Bar Color 2"_f[3])}, {"Warrior"".Ability 1.Precast Time"_F,"Warrior"".Ability 1.Casting Range"_I/100.f*24,"Warrior"".Ability 1.Casting Size"_I/100.f*24}, bool("Warrior"".Ability 1.CancelCast"_I) }; Warrior::ability2={ "Warrior"".Ability 2.Name"_S, "Warrior"".Ability 2.Cooldown"_F, "Warrior"".Ability 2.Mana Cost"_I, {uint8_t("Warrior"".Ability 2.Cooldown Bar Color 1"_f[0]),uint8_t("Warrior"".Ability 2.Cooldown Bar Color 1"_f[1]),uint8_t("Warrior"".Ability 2.Cooldown Bar Color 1"_f[2]),uint8_t("Warrior"".Ability 2.Cooldown Bar Color 1"_f[3]==0?255:"Warrior"".Ability 2.Cooldown Bar Color 1"_f[3])}, {uint8_t("Warrior"".Ability 2.Cooldown Bar Color 2"_f[0]),uint8_t("Warrior"".Ability 2.Cooldown Bar Color 2"_f[1]),uint8_t("Warrior"".Ability 2.Cooldown Bar Color 2"_f[2]),uint8_t("Warrior"".Ability 2.Cooldown Bar Color 2"_f[3]==0?255:"Warrior"".Ability 2.Cooldown Bar Color 2"_f[3])}, {"Warrior"".Ability 2.Precast Time"_F,"Warrior"".Ability 2.Casting Range"_I/100.f*24,"Warrior"".Ability 2.Casting Size"_I/100.f*24} bool("Warrior"".Ability 2.CancelCast"_I) }; Warrior::ability3={ "Warrior"".Ability 3.Name"_S, "Warrior"".Ability 3.Cooldown"_F, "Warrior"".Ability 3.Mana Cost"_I, {uint8_t("Warrior"".Ability 3.Cooldown Bar Color 1"_f[0]),uint8_t("Warrior"".Ability 3.Cooldown Bar Color 1"_f[1]),uint8_t("Warrior"".Ability 3.Cooldown Bar Color 1"_f[2]),uint8_t("Warrior"".Ability 3.Cooldown Bar Color 1"_f[3]==0?255:"Warrior"".Ability 3.Cooldown Bar Color 1"_f[3])}, {uint8_t("Warrior"".Ability 3.Cooldown Bar Color 2"_f[0]),uint8_t("Warrior"".Ability 3.Cooldown Bar Color 2"_f[1]),uint8_t("Warrior"".Ability 3.Cooldown Bar Color 2"_f[2]),uint8_t("Warrior"".Ability 3.Cooldown Bar Color 2"_f[3]==0?255:"Warrior"".Ability 3.Cooldown Bar Color 2"_f[3])}, {"Warrior"".Ability 3.Precast Time"_F,"Warrior"".Ability 3.Casting Range"_I/100.f*24,"Warrior"".Ability 3.Casting Size"_I/100.f*24}, bool("Warrior"".Ability 3.CancelCast"_I) }; Warrior::ability4={"???",0,0};
Warrior::idle_n="WARRIOR_IDLE_N";
Warrior::idle_e="WARRIOR_IDLE_E";
Warrior::idle_s="WARRIOR_IDLE_S";

@ -74,7 +74,6 @@ void Wizard::InitializeClassAbilities(){
#pragma region Wizard Right-click Ability (Teleport)
Wizard::rightClickAbility.action=
[](Player*p,vf2d pos={}){
if(p->GetState()==State::CASTING)return false;
float pointMouseDirection=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x);
vf2d pointTowardsMouse={cos(pointMouseDirection),sin(pointMouseDirection)};
float dist=std::clamp(geom2d::line<float>{p->GetPos(),game->GetWorldMousePos()}.length(),0.f,"Wizard.Right Click Ability.TeleportRange"_F/100*24);

@ -7,14 +7,19 @@ Ranger
DamageMult = 1
Radius = 100
Cooldown = 0.6
# Whether or not this ability cancels casts.
CancelCast = 0
ArrowSpd = 250
}
Right Click Ability
{
Name = Retreat
Cooldown = 7
Mana Cost = 0
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64, 255
@ -34,6 +39,8 @@ Ranger
Name = Rapid Fire
Cooldown = 12
Mana Cost = 35
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -62,6 +69,8 @@ Ranger
Name = Charged Shot
Cooldown = 15
Mana Cost = 40
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -88,6 +97,8 @@ Ranger
Name = Multishot
Cooldown = 25
Mana Cost = 50
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255

@ -7,6 +7,8 @@ Thief
Name = ???
Cooldown = 8
Mana Cost = 5
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64, 255
@ -21,6 +23,8 @@ Thief
Name = ???
Cooldown = 6
Mana Cost = 30
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -35,6 +39,8 @@ Thief
Name = ???
Cooldown = 6
Mana Cost = 25
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -49,6 +55,8 @@ Thief
Name = ???
Cooldown = 40
Mana Cost = 75
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255

@ -7,6 +7,8 @@ Trapper
Name = ???
Cooldown = 8
Mana Cost = 5
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64, 255
@ -21,6 +23,8 @@ Trapper
Name = ???
Cooldown = 6
Mana Cost = 30
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -35,6 +39,8 @@ Trapper
Name = ???
Cooldown = 6
Mana Cost = 25
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -49,6 +55,8 @@ Trapper
Name = ???
Cooldown = 40
Mana Cost = 75
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255

@ -7,6 +7,8 @@ Warrior
DamageMult = 1
Range = 150
Cooldown = 0.35
# Whether or not this ability cancels casts.
CancelCast = 0
SwordSwingTime = 0.2
}
@ -15,6 +17,8 @@ Warrior
Name = Block
Cooldown = 15
Mana Cost = 0
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64, 255
@ -37,6 +41,8 @@ Warrior
Name = Battlecry
Cooldown = 12
Mana Cost = 40
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -79,6 +85,8 @@ Warrior
Name = Ground Slam
Cooldown = 15
Mana Cost = 50
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255

@ -7,6 +7,8 @@ Witch
Name = ???
Cooldown = 8
Mana Cost = 5
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64, 255
@ -21,6 +23,8 @@ Witch
Name = ???
Cooldown = 6
Mana Cost = 30
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -35,6 +39,8 @@ Witch
Name = ???
Cooldown = 6
Mana Cost = 25
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -49,6 +55,8 @@ Witch
Name = ???
Cooldown = 40
Mana Cost = 75
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255

@ -8,6 +8,8 @@ Wizard
Radius = 100
Speed = 200
Cooldown = 0.85
# Whether or not this ability cancels casts.
CancelCast = 0
# When bullet makes contact, how fast the bullet will fade out.
BulletHitFadeoutTime = 0.2
@ -28,6 +30,8 @@ Wizard
Name = Teleport
Cooldown = 8
Mana Cost = 5
# Whether or not this ability cancels casts.
CancelCast = 1
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 0, 0, 64, 255
@ -64,6 +68,8 @@ Wizard
Name = Firebolt
Cooldown = 6
Mana Cost = 30
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -126,6 +132,8 @@ Wizard
Name = Lightning Bolt
Cooldown = 6
Mana Cost = 25
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255
@ -178,6 +186,8 @@ Wizard
Name = Meteor
Cooldown = 40
Mana Cost = 75
# Whether or not this ability cancels casts.
CancelCast = 0
#RGB Values. Color 1 is the left side of the bar, Color 2 is the right side.
Cooldown Bar Color 1 = 64, 0, 0, 255

@ -446,7 +446,6 @@
<tile id="517" type="ForegroundTile">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="24" height="21"/>
<object id="2" x="0" y="0" width="24" height="21"/>
</objectgroup>
</tile>
<tile id="518" type="ForegroundTile">

@ -1986,7 +1986,6 @@
<tile id="1649">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="24" height="24"/>
<object id="2" x="0" y="0" width="24" height="24"/>
</objectgroup>
</tile>
<tile id="1650">

Loading…
Cancel
Save