Changed reflection code to slightly account for rotations.

pull/35/head
sigonasr2 1 year ago
parent 37fb379df9
commit 553baa5945
  1. 24
      Adventures in Lestoria/Monster.cpp
  2. 2
      Adventures in Lestoria/TODO.txt
  3. 2
      Adventures in Lestoria/Version.h
  4. 2
      Adventures in Lestoria/assets/Campaigns/1_5.tmx
  5. BIN
      Adventures in Lestoria/assets/monsters/Frog.png
  6. BIN
      x64/Release/Adventures in Lestoria.exe

@ -328,7 +328,29 @@ void Monster::Draw(){
}
void Monster::DrawReflection(float drawRatioX,float multiplierX){
game->SetDecalMode(DecalMode::ADDITIVE);
game->view.DrawPartialRotatedDecal(GetPos()+vf2d{drawRatioX*GetFrame().GetSourceRect().size.x,GetZ()+(GetFrame().GetSourceRect().size.y-16)*GetSizeMult()},GetFrame().GetSourceImage()->Decal(),0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(GetFacingDirection()==RIGHT?-1:1)*multiplierX,GetSizeMult()*-1),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
vf2d defaultPos=GetPos()+vf2d{drawRatioX*GetFrame().GetSourceRect().size.x,GetZ()+(GetFrame().GetSourceRect().size.y-16)*GetSizeMult()};
vf2d spriteSize=GetFrame().GetSourceRect().size/1.5f*GetSizeMult();
float bottomExpansionAmount=abs(util::radToDeg(spriteRot))/10;
//BL is in TR, BR is in TL, TR is in BL and TL is in BR.
std::array<vf2d,4>points={
vf2d{defaultPos+vf2d{-spriteSize.x/2,spriteSize.y}-vf2d{bottomExpansionAmount,0}}, //BL
vf2d{defaultPos-spriteSize.x/2}, //TL
vf2d{defaultPos+vf2d{spriteSize.x/2,-spriteSize.y/2}}, //TR
vf2d{defaultPos+spriteSize/2+vf2d{bottomExpansionAmount,0}}, //BR
};
if(GetFacingDirection()==RIGHT){
points={
vf2d{defaultPos+spriteSize/2+vf2d{bottomExpansionAmount,0}}, //BR
vf2d{defaultPos+vf2d{spriteSize.x/2,-spriteSize.y/2}}, //TR
vf2d{defaultPos-spriteSize.x/2}, //TL
vf2d{defaultPos+vf2d{-spriteSize.x/2,spriteSize.y}-vf2d{bottomExpansionAmount,0}}, //BL
};
}
game->view.DrawPartialWarpedDecal(GetFrame().GetSourceImage()->Decal(),points,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size);
game->SetDecalMode(DecalMode::NORMAL);
}
void Monster::Collision(Player*p){

@ -14,8 +14,6 @@ Settings Menu
- XP Bar
- Fix reflections for rotated monsters.
January 31st
============
Make new unlocked nodes more obvious, made neighboring nodes more obvious

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 6238
#define VERSION_BUILD 6261
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="200" height="250" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="96">
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="200" height="250" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="97">
<properties>
<property name="Backdrop" propertytype="Backdrop" value="forest"/>
<property name="Background Music" propertytype="BGM" value="foresty1_1"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

Loading…
Cancel
Save