- if(ymode != 0 && config.clamp_y > 0) {
- translation.y = clamp(translation.y,
- player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y),
- player_pos.y - SCREEN_HEIGHT * config.clamp_y);
+ if(ymode != 0) {
+ float top_edge, bottom_edge;
+ if(config.clamp_y <= 0) {
+ top_edge = 0;
+ bottom_edge = SCREEN_HEIGHT;
+ } else {
+ top_edge = SCREEN_HEIGHT*config.clamp_y;
+ bottom_edge = SCREEN_HEIGHT*(1-config.clamp_y);
+ }
+
+ float peek_to = 0;
+ float translation_compensation = player_pos.y - translation.y;
+
+ if(player->peeking_direction() == ::UP) {
+ peek_to = bottom_edge - translation_compensation;
+ } else if(player->peeking_direction() == ::DOWN) {
+ peek_to = top_edge - translation_compensation;
+ }
+
+ float peek_move = (peek_to - peek_pos.y) * PEEK_ARRIVE_RATIO;
+ if(fabs(peek_move) < 1.0) {
+ peek_move = 0.0;
+ }
+
+ peek_pos.y += peek_move;
+
+ translation.y -= peek_pos.y;
+
+ if(config.clamp_y > 0) {
+ translation.y = clamp(translation.y,
+ player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y),
+ player_pos.y - SCREEN_HEIGHT * config.clamp_y);
+ if(ymode == 2) {
+ yoshi_translation.y = clamp(yoshi_translation.y,
+ player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y),
+ player_pos.y - SCREEN_HEIGHT * config.clamp_y);
+ }
+ }