1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-09-27 12:38:57 +00:00

Fix fade in/out for widescreen

This commit is contained in:
dawnDus 2022-02-27 23:15:35 -05:00
parent 74a5cddeaf
commit efd1729ce5
No known key found for this signature in database
GPG key ID: 972AABDE81848F21
4 changed files with 6 additions and 8 deletions

View file

@ -15,12 +15,12 @@ impl Fade {
impl GameEntity<()> for Fade { impl GameEntity<()> for Fade {
fn tick(&mut self, state: &mut SharedGameState, _custom: ()) -> GameResult { fn tick(&mut self, state: &mut SharedGameState, _custom: ()) -> GameResult {
let fade_ticks = state.constants.textscript.fade_ticks; let fade_ticks = (state.canvas_size.0 / 20.0) as i8;
match state.fade_state { match state.fade_state {
FadeState::FadeOut(tick, direction) if tick < fade_ticks => { FadeState::FadeOut(tick, direction) if tick < 15 => {
state.fade_state = FadeState::FadeOut(tick + 1, direction); state.fade_state = FadeState::FadeOut(tick + 1, direction);
} }
FadeState::FadeOut(tick, _) if tick == fade_ticks => { FadeState::FadeOut(tick, _) if tick == 15 => {
state.fade_state = FadeState::Hidden; state.fade_state = FadeState::Hidden;
} }
FadeState::FadeIn(tick, direction) if tick > -fade_ticks => { FadeState::FadeIn(tick, direction) if tick > -fade_ticks => {

View file

@ -145,7 +145,7 @@ impl GameEntity<(&[&Player], &NPCList)> for WaterRenderer {
.clamp(0, surf.columns.len() as i32) as usize; .clamp(0, surf.columns.len() as i32) as usize;
for col in &mut surf.columns[col_idx_left..=col_idx_right] { for col in &mut surf.columns[col_idx_left..=col_idx_right] {
col.speed = (obj.vel_y() as f32 / 512.0) * (obj.hit_rect_size() as f32 * 0.25).clamp(0.1, 1.0); col.speed = (obj.vel_y() as f32 / 1024.0) * (obj.hit_rect_size() as f32 * 0.25).clamp(0.1, 1.0);
} }
} }
}; };

View file

@ -232,7 +232,6 @@ pub struct TextScriptConsts {
pub text_shadow: bool, pub text_shadow: bool,
pub text_speed_normal: u8, pub text_speed_normal: u8,
pub text_speed_fast: u8, pub text_speed_fast: u8,
pub fade_ticks: i8,
} }
#[derive(Debug)] #[derive(Debug)]
@ -1501,7 +1500,6 @@ impl EngineConstants {
text_shadow: false, text_shadow: false,
text_speed_normal: 4, text_speed_normal: 4,
text_speed_fast: 1, text_speed_fast: 1,
fade_ticks: 15,
}, },
title: TitleConsts { title: TitleConsts {
intro_text: "Studio Pixel presents".to_owned(), intro_text: "Studio Pixel presents".to_owned(),
@ -1684,7 +1682,6 @@ impl EngineConstants {
self.textscript.text_shadow = true; self.textscript.text_shadow = true;
self.textscript.text_speed_normal = 1; self.textscript.text_speed_normal = 1;
self.textscript.text_speed_fast = 0; self.textscript.text_speed_fast = 0;
self.textscript.fade_ticks = 21;
self.soundtracks.insert("Famitracks".to_owned(), "/base/ogg17/".to_owned()); self.soundtracks.insert("Famitracks".to_owned(), "/base/ogg17/".to_owned());
self.soundtracks.insert("Ridiculon".to_owned(), "/base/ogg_ridic/".to_owned()); self.soundtracks.insert("Ridiculon".to_owned(), "/base/ogg_ridic/".to_owned());
self.game.tile_offset_x = 3; self.game.tile_offset_x = 3;

View file

@ -1223,7 +1223,8 @@ impl TextScriptVM {
let fade_type = read_cur_varint(&mut cursor)? as usize; let fade_type = read_cur_varint(&mut cursor)? as usize;
if let Some(direction) = FadeDirection::from_int(fade_type) { if let Some(direction) = FadeDirection::from_int(fade_type) {
state.fade_state = FadeState::FadeOut(-15, direction.opposite()); let fade_ticks = (state.canvas_size.0 / 20.0) as i8;
state.fade_state = FadeState::FadeOut(-fade_ticks, direction.opposite());
} }
exec_state = TextScriptExecutionState::WaitFade(event, cursor.position() as u32); exec_state = TextScriptExecutionState::WaitFade(event, cursor.position() as u32);