diff --git a/art/lava_death.dem b/art/lava_death.dem new file mode 100644 index 0000000..c83f224 Binary files /dev/null and b/art/lava_death.dem differ diff --git a/art/timing_test.dem b/art/timing_test.dem new file mode 100644 index 0000000..4c29d33 Binary files /dev/null and b/art/timing_test.dem differ diff --git a/code/game/src/debug_replay.c b/code/game/src/debug_replay.c index ba233a7..553c17f 100644 --- a/code/game/src/debug_replay.c +++ b/code/game/src/debug_replay.c @@ -104,8 +104,27 @@ void debug_replay_clear(void) { record_pos = 0; } +void debug_replay_cleanup_ents(void) { + if (!mime) return; + + entity_despawn(mime); + mime = 0; + + is_playing = false; + camera_set_follow(plr); + + for (int i = 0; i < zpl_array_count(temp_actors); i++) { + entity_despawn(temp_actors[i]); + } + + zpl_array_free(temp_actors); +} + void debug_replay_stop(void) { is_recording = false; + is_playing = false; + record_pos = 0; + debug_replay_cleanup_ents(); } void debug_replay_run(void) { @@ -160,17 +179,7 @@ void debug_replay_update(void) { // NOTE(zaklaus): remove our dummy art exhibist if (mime && record_pos == zpl_array_count(records)) { - entity_despawn(mime); - mime = 0; - - is_playing = false; - camera_set_follow(plr); - - for (int i = 0; i < zpl_array_count(temp_actors); i++) { - entity_despawn(temp_actors[i]); - } - - zpl_array_free(temp_actors); + debug_replay_cleanup_ents(); } } diff --git a/code/game/src/debug_ui.c b/code/game/src/debug_ui.c index 1e6f771..2082e75 100644 --- a/code/game/src/debug_ui.c +++ b/code/game/src/debug_ui.c @@ -45,6 +45,8 @@ typedef struct debug_item { debug_kind kind; char const *name; float name_width; + uint8_t skip; + union { union { char const *text; @@ -133,12 +135,9 @@ static debug_item items[] = { .items = (debug_item[]) { { .kind = DITEM_TEXT, .name = "macro", .proc = DrawReplayFileName }, { .kind = DITEM_TEXT, .name = "samples", .proc = DrawReplaySamples }, - { .kind = DITEM_BUTTON, .name = "new", .on_click = ActReplayNew }, - { .kind = DITEM_BUTTON, .name = "load", .on_click = ActReplayLoad }, - { .kind = DITEM_BUTTON, .name = "save", .on_click = ActReplaySave }, - { .kind = DITEM_BUTTON, .name = "save as...", .on_click = ActReplaySaveAs }, - { .kind = DITEM_GAP }, + { .kind = DITEM_COND, .on_success = CondReplayDataPresentAndNotPlaying }, + { .kind = DITEM_BUTTON, .name = "replay", .on_click = ActReplayRun }, { .kind = DITEM_COND, .on_success = CondReplayStatusOff }, { .kind = DITEM_BUTTON, .name = "record", .on_click = ActReplayBegin }, @@ -146,10 +145,20 @@ static debug_item items[] = { { .kind = DITEM_COND, .on_success = CondReplayStatusOn }, { .kind = DITEM_BUTTON, .name = "stop", .on_click = ActReplayEnd }, - { .kind = DITEM_COND, .on_success = CondReplayDataPresent }, - { .kind = DITEM_BUTTON, .name = "replay", .on_click = ActReplayRun }, + { .kind = DITEM_COND, .on_success = CondReplayIsPlaying }, + { .kind = DITEM_BUTTON, .name = "stop", .on_click = ActReplayEnd }, + { .kind = DITEM_COND, .on_success = CondReplayIsNotPlayingOrRecordsNotClear }, { .kind = DITEM_BUTTON, .name = "clear", .on_click = ActReplayClear }, + + { .kind = DITEM_GAP }, + + { .kind = DITEM_COND, .on_success = CondReplayIsNotPlaying, .skip = 4 }, + { .kind = DITEM_BUTTON, .name = "new", .on_click = ActReplayNew }, + { .kind = DITEM_BUTTON, .name = "load", .on_click = ActReplayLoad }, + { .kind = DITEM_BUTTON, .name = "save", .on_click = ActReplaySave }, + { .kind = DITEM_BUTTON, .name = "save as...", .on_click = ActReplaySaveAs }, + { .kind = DITEM_END }, } } @@ -191,7 +200,7 @@ debug_draw_result debug_draw_list(debug_item *list, float xpos, float ypos, bool assert(it->on_success); if (!it->on_success()) { - it += 1; + it += it->skip ? it->skip : 1; } }break; case DITEM_LIST: { diff --git a/code/game/src/debug_ui_actions.c b/code/game/src/debug_ui_actions.c index 010c96f..130abc4 100644 --- a/code/game/src/debug_ui_actions.c +++ b/code/game/src/debug_ui_actions.c @@ -21,17 +21,32 @@ ActSpawnCar(void) { static inline uint8_t CondReplayStatusOn(void) { - return is_recording; + return is_recording && !is_playing; } static inline uint8_t CondReplayStatusOff(void) { - return !is_recording; + return !is_recording && !is_playing; } static inline uint8_t -CondReplayDataPresent(void) { - return records != NULL && !is_recording; +CondReplayDataPresentAndNotPlaying(void) { + return records != NULL && !is_recording && !is_playing; +} + +static inline uint8_t +CondReplayIsPlaying(void) { + return records != NULL && !is_recording && is_playing; +} + +static inline uint8_t +CondReplayIsNotPlaying(void) { + return !is_recording && !is_playing; +} + +static inline uint8_t +CondReplayIsNotPlayingOrRecordsNotClear(void) { + return records != NULL && !is_recording && !is_playing; } static inline void diff --git a/code/modules/source/system_vehicle.c b/code/modules/source/system_vehicle.c index d7d4e77..92dce10 100644 --- a/code/modules/source/system_vehicle.c +++ b/code/modules/source/system_vehicle.c @@ -52,7 +52,7 @@ void EnterOrLeaveVehicle(ecs_iter_t *it) { } } -#define VEHICLE_FORCE 19.8f +#define VEHICLE_FORCE 34.8f #define VEHICLE_ACCEL 0.27f #define VEHICLE_DECEL 0.28f #define VEHICLE_STEER 0.11f