mirror of
https://github.com/doukutsu-rs/doukutsu-rs
synced 2024-11-15 18:32:48 +00:00
Allow TSC to keep running when no proper end is reached
This commit is contained in:
parent
1e7da276ab
commit
9dba30d360
|
@ -123,6 +123,11 @@ impl TextScript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some nicalis challenges are very broken
|
||||||
|
if !strict {
|
||||||
|
put_varint(TSCOpCode::_END as i32, &mut bytecode);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(bytecode)
|
Ok(bytecode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -267,7 +267,7 @@ impl TextScriptVM {
|
||||||
|
|
||||||
pub fn run(state: &mut SharedGameState, game_scene: &mut GameScene, ctx: &mut Context) -> GameResult {
|
pub fn run(state: &mut SharedGameState, game_scene: &mut GameScene, ctx: &mut Context) -> GameResult {
|
||||||
let scripts_ref = state.textscript_vm.scripts.clone();
|
let scripts_ref = state.textscript_vm.scripts.clone();
|
||||||
let scripts = scripts_ref.borrow_mut();
|
let scripts = scripts_ref.borrow();
|
||||||
let mut cached_event: Option<(u16, &Vec<u8>)> = None;
|
let mut cached_event: Option<(u16, &Vec<u8>)> = None;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
@ -638,8 +638,16 @@ impl TextScriptVM {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TSCOpCode::_END => {
|
TSCOpCode::_END => {
|
||||||
state.textscript_vm.flags.set_cutscene_skip(false);
|
// Vanilla keeps execution going into the next event if no proper end condition is met
|
||||||
exec_state = TextScriptExecutionState::Ended;
|
let scripts_ref = state.textscript_vm.scripts.clone();
|
||||||
|
let scripts = scripts_ref.borrow();
|
||||||
|
let script_list = scripts.scene_script.get_event_ids();
|
||||||
|
if let Some(next_event) = script_list.iter().find(|&&next_event| next_event > event) {
|
||||||
|
exec_state = TextScriptExecutionState::Running(*next_event, 0 as u32);
|
||||||
|
} else {
|
||||||
|
state.textscript_vm.flags.set_cutscene_skip(false);
|
||||||
|
exec_state = TextScriptExecutionState::Ended;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
TSCOpCode::END => {
|
TSCOpCode::END => {
|
||||||
state.textscript_vm.flags.set_cutscene_skip(false);
|
state.textscript_vm.flags.set_cutscene_skip(false);
|
||||||
|
|
Loading…
Reference in a new issue