Raycaster now keeps track of the square we are aimed but _does not_ know what is there, that's the job of other things like MainUI. Closes #50.
This commit is contained in:
parent
0d79ce35b3
commit
8bbafc4d10
4 changed files with 15 additions and 12 deletions
|
@ -204,7 +204,7 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) {
|
|||
apply_sprite_effect(effect, sprite_width, sprite_height);
|
||||
} else {
|
||||
effect = $brightness;
|
||||
level += (aiming_at == rec.second) * 0.1;
|
||||
level += (aiming_at == sprite_pos.location) * AIMED_AT_BRIGHTNESS;
|
||||
effect->setUniform("darkness", level);
|
||||
}
|
||||
|
||||
|
@ -475,6 +475,8 @@ bool Raycaster::play_rotate() {
|
|||
$plane_x = std::lerp($plane_x, $camera.target_plane_x, $camera.t);
|
||||
$plane_y = std::lerp($plane_y, $camera.target_plane_y, $camera.t);
|
||||
|
||||
aiming_at = { size_t($pos_x + $dir_x), size_t($pos_y + $dir_y) };
|
||||
|
||||
return $camera.t >= 1.0;
|
||||
}
|
||||
|
||||
|
@ -482,19 +484,21 @@ bool Raycaster::play_move() {
|
|||
$camera.t += $camera.move_speed;
|
||||
$pos_x = std::lerp($pos_x, $camera.target_x, $camera.t);
|
||||
$pos_y = std::lerp($pos_y, $camera.target_y, $camera.t);
|
||||
|
||||
aiming_at = { size_t($pos_x + $dir_x), size_t($pos_y + $dir_y) };
|
||||
|
||||
return $camera.t >= 1.0;
|
||||
}
|
||||
|
||||
void Raycaster::abort_plan() {
|
||||
$camera.target_x = $pos_x;
|
||||
$camera.target_y = $pos_y;
|
||||
aiming_at = { size_t($pos_x + $dir_x), size_t($pos_y + $dir_y) };
|
||||
}
|
||||
|
||||
Point Raycaster::aimed_at() {
|
||||
return {
|
||||
size_t($pos_x + $dir_x),
|
||||
size_t($pos_y + $dir_y)
|
||||
};
|
||||
bool Raycaster::is_target(DinkyECS::Entity entity) {
|
||||
(void)entity;
|
||||
return false;
|
||||
}
|
||||
|
||||
Point Raycaster::camera_target() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue