diff --git a/src/deh_tables.c b/src/deh_tables.c index 618b8161a..078c223c6 100644 --- a/src/deh_tables.c +++ b/src/deh_tables.c @@ -1825,6 +1825,7 @@ struct int_const_s const INT_CONST[] = { // item timer stuff {"TIMER_COUNTER", TIMER_COUNTER}, {"TIMER_NONUMBER",TIMER_NONUMBER}, + {"TIMER_END", TIMER_END}, {"TIMER_PURPLE", TIMER_PURPLE}, {"TIMER_YELLOW", TIMER_YELLOW}, {"TIMER_GREEN", TIMER_GREEN}, diff --git a/src/h_timers.cpp b/src/h_timers.cpp index 21f0c9e6f..deed799a8 100644 --- a/src/h_timers.cpp +++ b/src/h_timers.cpp @@ -51,6 +51,14 @@ typedef struct itimer_s static bool sorttimers(itimer_t a, itimer_t b) { + const bool enda = (a.flags & TIMER_END); + const bool endb = (b.flags & TIMER_END); + + // Check if timer should always be at the end? + if (enda != endb) + return !enda; + + // Just sort by time please. return a.timer < b.timer; } diff --git a/src/h_timers.h b/src/h_timers.h index 9643c1965..f2f7f7945 100644 --- a/src/h_timers.h +++ b/src/h_timers.h @@ -26,21 +26,22 @@ typedef enum timerflags_e { TIMER_COUNTER = 1, TIMER_NONUMBER = 1<<1, - TIMER_PURPLE = 1<<2, - TIMER_YELLOW = 1<<3, - TIMER_GREEN = 1<<4, - TIMER_BLUE = 1<<5, - TIMER_RED = 1<<6, - TIMER_GRAY = 1<<7, - TIMER_ORANGE = 1<<8, - TIMER_SKY = 1<<9, - TIMER_LAVENDER = 1<<10, - TIMER_GOLD = 1<<11, - TIMER_AQUA = 1<<12, - TIMER_MAGENTA = 1<<13, - TIMER_PINK = 1<<14, - TIMER_BROWN = 1<<15, - TIMER_TAN = 1<<16, + TIMER_END = 1<<2, + TIMER_PURPLE = 1<<3, + TIMER_YELLOW = 1<<4, + TIMER_GREEN = 1<<5, + TIMER_BLUE = 1<<6, + TIMER_RED = 1<<7, + TIMER_GRAY = 1<<8, + TIMER_ORANGE = 1<<9, + TIMER_SKY = 1<<10, + TIMER_LAVENDER = 1<<11, + TIMER_GOLD = 1<<12, + TIMER_AQUA = 1<<13, + TIMER_MAGENTA = 1<<14, + TIMER_PINK = 1<<15, + TIMER_BROWN = 1<<16, + TIMER_TAN = 1<<17, } timerflags_t; extern consvar_t cv_itemtimers;