cover half of the viewport during credits

This commit is contained in:
Alula 2021-10-16 15:25:55 +02:00
parent bdc4e7d209
commit f3a87259a1
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
2 changed files with 8 additions and 5 deletions

View File

@ -39,6 +39,9 @@ impl GameEntity<()> for Credits {
}
fn draw(&self, state: &mut SharedGameState, ctx: &mut Context, _frame: &Frame) -> GameResult {
let rect = Rect::new(0, 0, (state.screen_size.0 / 2.0) as _, state.screen_size.1 as _);
graphics::draw_rect(ctx, rect, Color::from_rgb(0, 0, 32))?;
if state.textscript_vm.illustration_state != IllustrationState::Hidden {
let x = match state.textscript_vm.illustration_state {
IllustrationState::FadeIn(x) | IllustrationState::FadeOut(x) => x,
@ -49,9 +52,6 @@ impl GameEntity<()> for Credits {
let batch = state.texture_set.get_or_load_batch(ctx, &state.constants, tex)?;
batch.add(x, 0.0);
batch.draw(ctx)?;
} else {
let rect = Rect::new_size((x * state.scale) as isize, 0, (160.0 * state.scale) as _, state.screen_size.1 as _);
graphics::draw_rect(ctx, rect, Color::from_rgb(0, 0, 32))?;
}
}

View File

@ -1536,6 +1536,10 @@ impl TextScriptVM {
}
TSCOpCode::SIL => {
let number = read_cur_varint(&mut cursor)? as u16;
log::warn!("<SIL{:04}", number);
state.textscript_vm.current_illustration = None;
state.textscript_vm.illustration_state = IllustrationState::FadeIn(-160.0);
for path in state.constants.credit_illustration_paths.iter() {
let path = format!("{}Credit{:02}", path, number);
@ -1545,11 +1549,10 @@ impl TextScriptVM {
}
}
state.textscript_vm.illustration_state = IllustrationState::FadeIn(-160.0);
exec_state = TextScriptExecutionState::Running(event, cursor.position() as u32);
}
TSCOpCode::CIL => {
log::warn!("<CIL");
state.textscript_vm.illustration_state = if let Some(_) = state.textscript_vm.current_illustration {
IllustrationState::FadeOut(0.0)
} else {