diff --git a/src/ops/delay.c b/src/ops/delay.c index f4c5b2af..84595fff 100644 --- a/src/ops/delay.c +++ b/src/ops/delay.c @@ -56,6 +56,8 @@ static bool delay_common_add(scene_state_t *ss, exec_state_t *es, ss->delay.time[i] = delay_time; ss->delay.origin_script[i] = es_variables(es)->script_number; ss->delay.origin_i[i] = es_variables(es)->i; + ss->delay.origin_fparam1[i] = es_variables(es)->fparam1; + ss->delay.origin_fparam2[i] = es_variables(es)->fparam2; copy_command(&ss->delay.commands[i], post_command); return true; diff --git a/src/scene_serialization.c b/src/scene_serialization.c index 25ea0664..265e08a9 100644 --- a/src/scene_serialization.c +++ b/src/scene_serialization.c @@ -202,7 +202,7 @@ void deserialize_scene(tt_deserializer_t* stream, scene_state_t* scene, } else if (c == 'P') { s2 = STATE_PATTERNS; } else if (c == 'G') { - grid_state = grid_num = grid_count = 0; + grid_state = grid_count = 0; s2 = STATE_GRID; } else { @@ -210,7 +210,7 @@ void deserialize_scene(tt_deserializer_t* stream, scene_state_t* scene, if (script < 0 || script >= EDITABLE_SCRIPT_COUNT) { script = NO_SCRIPT; } - else { s2 = STATE_SCRIPT; } + s2 = STATE_SCRIPT; } l = 0; @@ -225,7 +225,9 @@ void deserialize_scene(tt_deserializer_t* stream, scene_state_t* scene, } if (s == STATE_SCRIPT) { - if (script < 0 || script >= EDITABLE_SCRIPT_COUNT) continue; + if (script == NO_SCRIPT || script < 0 || + script >= EDITABLE_SCRIPT_COUNT) + continue; if (c != '\n') { if (p < 32) { @@ -328,6 +330,12 @@ void deserialize_scene(tt_deserializer_t* stream, scene_state_t* scene, } } else if (grid_state == 1) { + if (c >= '0' && c <= '9') { + grid_num = c - '0'; + grid_state = 2; + } + } + else if (grid_state == 2) { if (c >= '0' && c <= '9') { grid_num = grid_num * 10 + c - '0'; } diff --git a/src/state.h b/src/state.h index 64bde6f6..c1f9acfe 100644 --- a/src/state.h +++ b/src/state.h @@ -133,6 +133,8 @@ typedef struct { int16_t time[DELAY_SIZE]; uint8_t origin_script[DELAY_SIZE]; int16_t origin_i[DELAY_SIZE]; + int16_t origin_fparam1[DELAY_SIZE]; + int16_t origin_fparam2[DELAY_SIZE]; uint8_t count; } scene_delay_t; diff --git a/src/teletype.c b/src/teletype.c index c16affc9..dbb94005 100644 --- a/src/teletype.c +++ b/src/teletype.c @@ -375,6 +375,8 @@ void tele_tick(scene_state_t *ss, uint8_t time) { es_variables(&es)->delayed = true; es_variables(&es)->script_number = ss->delay.origin_script[i]; es_variables(&es)->i = ss->delay.origin_i[i]; + es_variables(&es)->fparam1 = ss->delay.origin_fparam1[i]; + es_variables(&es)->fparam2 = ss->delay.origin_fparam2[i]; run_script_with_exec_state(ss, &es, DELAY_SCRIPT);