debug: improve conds
parent
f74b66e7b4
commit
a1c6255b7d
Binary file not shown.
Binary file not shown.
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue