Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix issue #4

  • Loading branch information...
commit a542770c16b252e84df31657f69efd034d690a8f 1 parent 9da259c
@Spl3en authored
Showing with 26 additions and 1 deletion.
  1. +26 −1 LoLCamera/LoLCamera.c
View
27 LoLCamera/LoLCamera.c
@@ -15,7 +15,8 @@ typedef enum {
FollowEntity,
ShareEntity,
Free,
- Drag
+ Drag,
+ FocusSelf
} CameraTrackingMode;
@@ -168,6 +169,12 @@ static CameraTrackingMode camera_is_enabled ()
}
}
+ if (!camera_is_near(this->champions[0]))
+ {
+ // The champion has been teleported far
+ return FocusSelf;
+ }
+
// If our champion is dead, set free mode
if (champ_is_dead)
return Free;
@@ -417,6 +424,9 @@ static void camera_compute_lerp_rate (float *lerp_rate, CameraTrackingMode camer
case Normal:
break;
+ case FocusSelf:
+ break;
+
case NoMove:
case NoUpdate:
break;
@@ -431,6 +441,16 @@ static void camera_compute_lerp_rate (float *lerp_rate, CameraTrackingMode camer
*lerp_rate = local_lerp_rate;
}
+BOOL camera_is_near (Entity *e)
+{
+ if (e == NULL)
+ return FALSE;
+
+ float distance_cam_champ = vector2D_distance(&e->p.v, &this->cam->v);
+
+ return (distance_cam_champ < 2000.0);
+}
+
BOOL camera_entity_is_near (Entity *e)
{
if (e == NULL)
@@ -462,6 +482,11 @@ void camera_compute_target (Vector2D *target, CameraTrackingMode camera_mode)
);
break;
+ case FocusSelf:
+ vector2D_set_pos(target, this->champ->v.x, this->champ->v.y);
+ mempos_set(this->cam, this->champ->v.x, this->champ->v.y);
+ break;
+
case FollowEntity:
{
Entity *ally = this->focused_entity;
Please sign in to comment.
Something went wrong with that request. Please try again.