Merge branch 'you-have-uncommitted-changes' into 'master'

The programmer took a nap. Hold out, programmer!

See merge request KartKrew/Kart!722
This commit is contained in:
Sal 2022-10-01 02:14:15 +00:00
commit e9d2785cc3
7 changed files with 62 additions and 3 deletions

View file

@ -195,6 +195,14 @@ passthru_opts:=
# separate suffix with an underscore
exesuffix:=$(call _,$(EXESUFFIX))
# If there are uncommitted changes
# -uno: disregard untracked files
# Warning: this can only be accurate for comptime.c since
# that file is always recompiled!
ifneq ($(shell git status --porcelain -uno),)
opts+=-DCOMPVERSION_UNCOMMITTED
endif
include Makefile.d/platform.mk
include Makefile.d/features.mk
include Makefile.d/versions.mk

View file

@ -15,6 +15,13 @@ const char *comprevision = SRB2_COMP_REVISION;
#elif (defined(COMPVERSION))
#include "comptime.h"
const int compuncommitted =
#if (defined(COMPVERSION_UNCOMMITTED))
1;
#else
0;
#endif
#else
const char *compbranch = "Unknown";
const char *comprevision = "illegal";

View file

@ -4817,6 +4817,9 @@ static void Command_Version_f(void)
CONS_Printf("\x87" "DEVELOP " "\x80");
#endif
if (compuncommitted)
CONS_Printf("\x85" "! UNCOMMITTED CHANGES ! " "\x80");
CONS_Printf("\n");
}

View file

@ -625,6 +625,7 @@ UINT32 quickncasehash (const char *p, size_t n)
// Compile date and time and revision.
extern const char *compdate, *comptime, *comprevision, *compbranch;
extern int compuncommitted;
// Disabled code and code under testing
// None of these that are disabled in the normal build are guaranteed to work perfectly

View file

@ -2006,6 +2006,8 @@ void F_TitleScreenDrawer(void)
#else // Regular build
addtext(V_ALLOWLOWERCASE|V_TRANSLUCENT, va("%s", VERSIONSTRING));
#endif
if (compuncommitted)
addtext(V_REDMAP|V_STRINGDANCE, "! UNCOMMITTED CHANGES !");
}
#undef addtext
}

View file

@ -36,6 +36,7 @@
// SRB2Kart
#include "k_hud.h"
#include "i_time.h"
// Each screen is [vid.width*vid.height];
UINT8 *screens[5];
@ -1636,6 +1637,14 @@ UINT8 *V_GetStringColormap(INT32 colorflags)
#endif
}
INT32 V_DanceYOffset(INT32 counter)
{
const INT32 duration = 16;
const INT32 step = (I_GetTime() + counter) % duration;
return abs(step - (duration / 2)) - (duration / 4);
}
// Writes a single character (draw WHITE if bit 7 set)
//
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed)
@ -2044,9 +2053,13 @@ void V_DrawStringScaled(
boolean uppercase;
boolean notcolored;
boolean dance;
boolean nodanceoverride;
INT32 dancecounter;
fixed_t cx, cy;
fixed_t cxoff;
fixed_t cxoff, cyoff;
fixed_t cw;
INT32 spacing;
@ -2057,6 +2070,14 @@ void V_DrawStringScaled(
uppercase = !( flags & V_ALLOWLOWERCASE );
flags &= ~(V_FLIP);/* These two (V_ALLOWLOWERCASE) share a bit. */
dance = (flags & V_STRINGDANCE) != 0;
nodanceoverride = !dance;
dancecounter = 0;
/* Some of these flags get overloaded in this function so
don't pass them on. */
flags &= ~(V_PARAMMASK);
if (colormap == NULL)
{
colormap = V_GetStringColormap(( flags & V_CHARCOLORMASK ));
@ -2247,8 +2268,9 @@ void V_DrawStringScaled(
cx = x;
cy = y;
cyoff = 0;
for (; ( c = *s ); ++s)
for (; ( c = *s ); ++s, ++dancecounter)
{
switch (c)
{
@ -2267,18 +2289,29 @@ void V_DrawStringScaled(
( ( c & 0x7f )<< V_CHARCOLORSHIFT )&
V_CHARCOLORMASK);
}
if (nodanceoverride)
{
dance = false;
}
}
else if (c == V_STRINGDANCE)
{
dance = true;
}
else if (cx < right)
{
if (uppercase)
c = toupper(c);
if (dance)
cyoff = V_DanceYOffset(dancecounter) * FRACUNIT;
c -= font->start;
if (c >= 0 && c < font->size && font->font[c])
{
cw = SHORT (font->font[c]->width) * dupx;
cxoff = (*dim_fn)(scale, chw, hchw, dupx, &cw);
V_DrawFixedPatch(cx + cxoff, cy, scale,
V_DrawFixedPatch(cx + cxoff, cy + cyoff, scale,
flags, font->font[c], colormap);
cx += cw;
}

View file

@ -84,6 +84,9 @@ void V_CubeApply(RGBA_t *input);
// Bottom 8 bits are used for parameter (screen or character)
#define V_PARAMMASK 0x000000FF
// strings/characters only
#define V_STRINGDANCE 0x00000002
// flags hacked in scrn (not supported by all functions (see src))
// patch scaling uses bits 9 and 10
#define V_SCALEPATCHSHIFT 8
@ -220,6 +223,8 @@ void V_DrawPromptBack(INT32 boxheight, INT32 color);
#define V__IntegerStringWidth( scale,option,font,string ) \
(V_StringScaledWidth(scale,FRACUNIT,FRACUNIT,option,font,string) / FRACUNIT)
INT32 V_DanceYOffset(INT32 counter);
// draw a single character
void V_DrawCharacter(INT32 x, INT32 y, INT32 c, boolean lowercaseallowed);
// draw a single character, but for the chat