1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2025-01-07 19:46:53 +00:00

fix cs+switch scrolling

This commit is contained in:
Alula 2021-10-16 15:26:10 +02:00
parent f3a87259a1
commit 23f0feaae0
No known key found for this signature in database
GPG key ID: 3E00485503A1D8BA
2 changed files with 4 additions and 3 deletions

View file

@ -36,7 +36,7 @@ impl Frame {
pub fn immediate_update(&mut self, state: &mut SharedGameState, stage: &Stage) {
let mut screen_width = state.canvas_size.0;
if state.constants.is_switch {
if state.constants.is_switch && stage.map.width <= 54 {
screen_width += 10.0; // hack for scrolling
}
@ -78,9 +78,10 @@ impl Frame {
pub fn update(&mut self, state: &mut SharedGameState, stage: &Stage) {
let mut screen_width = state.canvas_size.0;
if state.constants.is_switch {
if state.constants.is_switch && stage.map.width <= 54 {
screen_width += 10.0;
}
let tile_size = state.tile_size.as_int();
if (stage.map.width as usize).saturating_sub(1) * (tile_size as usize) < screen_width as usize {

View file

@ -398,7 +398,7 @@ impl GameScene {
for y in 0..(state.canvas_size.1 as i32 / 16 + 1) {
if direction == FadeDirection::Left {
batch.add_rect(state.canvas_size.0 - x as f32 * 16.0, y as f32 * 16.0, &rect);
batch.add_rect(state.canvas_size.0 - x as f32 * 16.0 - 16.0, y as f32 * 16.0, &rect);
} else {
batch.add_rect(x as f32 * 16.0, y as f32 * 16.0, &rect);
}