@@ -42,6 +42,8 @@ static const float PEEK_ARRIVE_RATIO = 0.03f;
42
42
*/
43
43
static const float HORIZONTAL_MARGIN = 196 .f; // 6 tiles
44
44
static const float VERTICAL_MARGIN = 196 .f; // 6 tiles
45
+ static const float PEEK_ADD_HORIZONTAL_MARGIN = 320 .f; // 10 tiles
46
+ static const float PEEK_ADD_VERTICAL_MARGIN = 320 .f; // 10 tiles
45
47
46
48
/* 0 = no movement, 1 = no smooth adaptation */
47
49
static const float MULTIPLAYER_CAM_WEIGHT = 0 .1f ;
@@ -725,10 +727,25 @@ Camera::update_scroll_normal_multiplayer(float dt_sec)
725
727
if (p->is_dead () || p->is_dying ())
726
728
continue ;
727
729
728
- x1 = std::min (x1, p->get_bbox ().get_left () - HORIZONTAL_MARGIN);
729
- x2 = std::max (x2, p->get_bbox ().get_right () + HORIZONTAL_MARGIN);
730
- y1 = std::min (y1, p->get_bbox ().get_top () - VERTICAL_MARGIN);
731
- y2 = std::max (y2, p->get_bbox ().get_bottom () + VERTICAL_MARGIN);
730
+ float lft = p->get_bbox ().get_left () - HORIZONTAL_MARGIN;
731
+ float rgt = p->get_bbox ().get_right () + HORIZONTAL_MARGIN;
732
+ float top = p->get_bbox ().get_top () - VERTICAL_MARGIN;
733
+ float btm = p->get_bbox ().get_bottom () + VERTICAL_MARGIN;
734
+
735
+ if (p->peeking_direction_x () == Direction::LEFT)
736
+ lft -= PEEK_ADD_HORIZONTAL_MARGIN;
737
+ else if (p->peeking_direction_x () == Direction::RIGHT)
738
+ rgt += PEEK_ADD_HORIZONTAL_MARGIN;
739
+
740
+ if (p->peeking_direction_y () == Direction::UP)
741
+ top -= PEEK_ADD_VERTICAL_MARGIN;
742
+ else if (p->peeking_direction_y () == Direction::DOWN)
743
+ btm += PEEK_ADD_VERTICAL_MARGIN;
744
+
745
+ x1 = std::min (x1, lft);
746
+ x2 = std::max (x2, rgt);
747
+ y1 = std::min (y1, top);
748
+ y2 = std::max (y2, btm);
732
749
}
733
750
734
751
// Might happens if all players are dead
0 commit comments