Fix edge cases when we click too close to the character or too far, still allow max possible distance teleports even when clicked outside of range.
This commit is contained in:
parent
46e3c7f7e7
commit
88666b1d61
@ -304,6 +304,7 @@ bool Wizard::RightClickAbility(){
|
||||
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,6.5f*24);
|
||||
if(dist<12)return false;
|
||||
vf2d teleportPoint=p.GetPos()+pointTowardsMouse*dist;
|
||||
while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p.CanPathfindTo(p.GetPos(),teleportPoint)){
|
||||
dist-=24;
|
||||
@ -317,7 +318,7 @@ bool Wizard::RightClickAbility(){
|
||||
p.iframe_time=0.35;
|
||||
return true;
|
||||
} else {
|
||||
p.notificationDisplay={"Cannot Teleport to that location!",1};
|
||||
p.notificationDisplay={"Cannot Teleport to that location!",0.5};
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -837,8 +837,8 @@ void Crawler::RenderHud(){
|
||||
DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)}-GetTextSizeProp(displayText)/2,displayText,DARK_RED,VERY_DARK_RED);
|
||||
}
|
||||
if(player.notificationDisplay.second>0){
|
||||
std::string displayText=player.notEnoughManaDisplay.first;
|
||||
DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)}-GetTextSizeProp(displayText)/2,displayText,DARK_BLUE,VERY_DARK_BLUE);
|
||||
std::string displayText=player.notificationDisplay.first;
|
||||
DrawShadowStringPropDecal(vf2d{float(ScreenWidth()/2),float(ScreenHeight()/4)-24}-GetTextSizeProp(displayText)/2,displayText,BLUE,VERY_DARK_BLUE);
|
||||
}
|
||||
std::string versionStr("v" + std::to_string(VERSION_MAJOR) + "." + std::to_string(VERSION_MINOR) + "." + std::to_string(VERSION_PATCH) + "." + std::to_string(VERSION_BUILD));
|
||||
DrawShadowStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4,versionStr,WHITE,BLACK,{0.4,0.4},0.4);
|
||||
|
@ -28,6 +28,14 @@ void Pathfinding::Initialize(){
|
||||
nodes[y*game->WORLD_SIZE.x + x].vecNeighbours.push_back(&nodes[(y + 0) * game->WORLD_SIZE.x + (x - 1)]);
|
||||
if(x<game->WORLD_SIZE.x-1)
|
||||
nodes[y*game->WORLD_SIZE.x + x].vecNeighbours.push_back(&nodes[(y + 0) * game->WORLD_SIZE.x + (x + 1)]);
|
||||
if (y>0 && x>0)
|
||||
nodes[y*game->WORLD_SIZE.x + x].vecNeighbours.push_back(&nodes[(y - 1) * game->WORLD_SIZE.x + (x - 1)]);
|
||||
if (y<game->WORLD_SIZE.y-1 && x>0)
|
||||
nodes[y*game->WORLD_SIZE.x + x].vecNeighbours.push_back(&nodes[(y + 1) * game->WORLD_SIZE.x + (x - 1)]);
|
||||
if (y>0 && x<game->WORLD_SIZE.x-1)
|
||||
nodes[y*game->WORLD_SIZE.x + x].vecNeighbours.push_back(&nodes[(y - 1) * game->WORLD_SIZE.x + (x + 1)]);
|
||||
if (y<game->WORLD_SIZE.y - 1 && x<game->WORLD_SIZE.x-1)
|
||||
nodes[y*game->WORLD_SIZE.x + x].vecNeighbours.push_back(&nodes[(y + 1) * game->WORLD_SIZE.x + (x + 1)]);
|
||||
}
|
||||
|
||||
// Manually positio the start and end markers so they are not nullptr
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 440
|
||||
#define VERSION_BUILD 448
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Loading…
x
Reference in New Issue
Block a user