Auto-aim implemented for controller/keyboard gameplay.
This commit is contained in:
parent
a206cb10eb
commit
64422e4a24
@ -1275,6 +1275,7 @@ const vf2d Player::GetWorldAimingLocation(){
|
|||||||
const vf2d Player::GetAimingLocation(){
|
const vf2d Player::GetAimingLocation(){
|
||||||
if(Input::UsingGamepad()){
|
if(Input::UsingGamepad()){
|
||||||
float xAxis=0.f,yAxis=0.f;
|
float xAxis=0.f,yAxis=0.f;
|
||||||
|
#pragma region Manual Aiming
|
||||||
for(GamePad*gamepad:GamePad::getGamepads()){
|
for(GamePad*gamepad:GamePad::getGamepads()){
|
||||||
if(gamepad->stillConnected){
|
if(gamepad->stillConnected){
|
||||||
if(fabs(gamepad->getAxis(GPAxes::RX))>0.f){
|
if(fabs(gamepad->getAxis(GPAxes::RX))>0.f){
|
||||||
@ -1294,10 +1295,27 @@ const vf2d Player::GetAimingLocation(){
|
|||||||
if(xAxis!=0.f||yAxis!=0.f)break; //Found a controller, so we're good to break.
|
if(xAxis!=0.f||yAxis!=0.f)break; //Found a controller, so we're good to break.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#pragma endregion
|
||||||
if(xAxis!=0.f||yAxis!=0.f){
|
if(xAxis!=0.f||yAxis!=0.f){
|
||||||
return {(game->ScreenWidth()*xAxis)/2+game->ScreenWidth()/2,(game->ScreenHeight()*yAxis)/2+game->ScreenHeight()/2};
|
return {(game->ScreenWidth()*xAxis)/2+game->ScreenWidth()/2,(game->ScreenHeight()*yAxis)/2+game->ScreenHeight()/2};
|
||||||
}else{
|
}else{
|
||||||
return game->GetScreenSize()/2+vf2d{"Player.Aiming Cursor Max Distance"_F/100*24.f,aimingAngle.y}.cart();
|
//Find the closest monster target.
|
||||||
|
vf2d closestPoint={std::numeric_limits<float>::max(),std::numeric_limits<float>::max()};
|
||||||
|
for(Monster&m:MONSTER_LIST){
|
||||||
|
if(m.IsAlive()){
|
||||||
|
float distToMonster=geom2d::line<float>(GetPos(),m.GetPos()).length();
|
||||||
|
geom2d::line<float>aimingLine=geom2d::line<float>(GetPos(),m.GetPos());
|
||||||
|
vf2d aimingPoint=aimingLine.rpoint(operator""_Pixels("Player.Aiming Cursor Max Distance"_F));
|
||||||
|
float distToClosestPoint=geom2d::line<float>(GetPos(),closestPoint).length();
|
||||||
|
if(distToClosestPoint>distToMonster&&distToMonster<=operator""_Pixels("Player.Auto Aim Detection Distance"_F)){
|
||||||
|
closestPoint=aimingPoint;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(closestPoint!=vf2d{std::numeric_limits<float>::max(),std::numeric_limits<float>::max()}){
|
||||||
|
return game->GetScreenSize()/2+closestPoint-GetPos();
|
||||||
|
}else
|
||||||
|
return game->GetScreenSize()/2+vf2d{float(operator""_Pixels("Player.Aiming Cursor Max Distance"_F)),aimingAngle.y}.cart();
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
return game->GetMousePos();
|
return game->GetMousePos();
|
||||||
|
@ -12,6 +12,8 @@ Settings Menu
|
|||||||
|
|
||||||
- Fix Stage Completed screen, item displays can hit the scrollbar.
|
- Fix Stage Completed screen, item displays can hit the scrollbar.
|
||||||
|
|
||||||
|
- Stage Loot Config
|
||||||
|
|
||||||
January 31st
|
January 31st
|
||||||
============
|
============
|
||||||
Make new unlocked nodes more obvious, made neighboring nodes more obvious
|
Make new unlocked nodes more obvious, made neighboring nodes more obvious
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 6190
|
#define VERSION_BUILD 6200
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -32,6 +32,9 @@ Player
|
|||||||
# Distance the aiming cursor may be aimed at in controller aiming mode.
|
# Distance the aiming cursor may be aimed at in controller aiming mode.
|
||||||
Aiming Cursor Max Distance = 600
|
Aiming Cursor Max Distance = 600
|
||||||
|
|
||||||
|
# Distance the auto aim will try and find a target in.
|
||||||
|
Auto Aim Detection Distance = 1000
|
||||||
|
|
||||||
# How long the rumble lasts when getting hit by a monster.
|
# How long the rumble lasts when getting hit by a monster.
|
||||||
Hurt Rumble Time = 0.1s
|
Hurt Rumble Time = 0.1s
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user