// position where he last touched the ground. (this probably needs
// exceptions for trampolines and similar things in the future)
float target_y;
+#if 0
if(player->fall_mode == Player::JUMPING)
target_y = player->last_ground_y + player->get_bbox().get_height();
else
target_y = player->get_bbox().p2.y;
+#endif
+ target_y = player->last_ground_y;
+
target_y -= SCREEN_HEIGHT * config.target_y;
// delta_y is the distance we'd have to travel to directly reach target_y
if(ymode == 3) {
float halfsize = config.kirby_rectsize_y * 0.5f;
translation.y = clamp(translation.y,
- player_pos.y - SCREEN_HEIGHT * (0.5f - halfsize),
- player_pos.y - SCREEN_HEIGHT * (0.5f + halfsize));
+ player_pos.y - SCREEN_HEIGHT * (0.5f + halfsize),
+ player_pos.y - SCREEN_HEIGHT * (0.5f - halfsize));
}
if(ymode == 4) {
// TODO...
if(ymode != 0 && config.clamp_y > 0) {
translation.y = clamp(translation.y,
- player_pos.y - SCREEN_HEIGHT * config.clamp_y,
- player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y));
+ player_pos.y - SCREEN_HEIGHT * (1-config.clamp_y),
+ player_pos.y - SCREEN_HEIGHT * config.clamp_y);
}
/****** Horizontal scrolling part *******/
player_pos.x < translation.x + LEFTEND) {
lookahead_mode = LOOKAHEAD_LEFT;
} else {
- printf("abortscroll\n");
lookahead_mode = LOOKAHEAD_NONE;
}
}
}
LEFTEND = SCREEN_WIDTH * config.edge_x;
- RIGHTEND = SCREEN_HEIGHT * (1-config.edge_x);
+ RIGHTEND = SCREEN_WIDTH * (1-config.edge_x);
// calculate our scroll target depending on scroll mode
float target_x;
if(lookahead_mode == LOOKAHEAD_LEFT)
- target_x = player->get_bbox().get_middle().x - RIGHTEND;
+ target_x = player_pos.x - RIGHTEND;
else if(lookahead_mode == LOOKAHEAD_RIGHT)
- target_x = player->get_bbox().get_middle().x - LEFTEND;
+ target_x = player_pos.x - LEFTEND;
else
target_x = translation.x;
if(config.xmode == 3) {
float halfsize = config.kirby_rectsize_x * 0.5f;
translation.x = clamp(translation.x,
- player_pos.x - SCREEN_WIDTH * (0.5f - halfsize),
- player_pos.x - SCREEN_WIDTH * (0.5f + halfsize));
+ player_pos.x - SCREEN_WIDTH * (0.5f + halfsize),
+ player_pos.x - SCREEN_WIDTH * (0.5f - halfsize));
}
if(config.xmode == 4) {
// TODO...
if(config.xmode != 0 && config.clamp_x > 0) {
translation.x = clamp(translation.x,
- player_pos.x - SCREEN_WIDTH * config.clamp_x,
- player_pos.x - SCREEN_WIDTH * (1-config.clamp_x));
+ player_pos.x - SCREEN_WIDTH * (1-config.clamp_x),
+ player_pos.x - SCREEN_WIDTH * config.clamp_x);
}
keep_in_bounds(translation);