From 495c58e53f38015754aca178d1b9ad5aff6970d9 Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 29 Sep 2022 14:03:29 -0700 Subject: [PATCH 1/2] Add V_STRINGDANCE -- dancing letters They do a wiggle~ --- src/v_video.c | 39 ++++++++++++++++++++++++++++++++++++--- src/v_video.h | 5 +++++ 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index 8ed5ed53f..0e85bf2fa 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -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; } diff --git a/src/v_video.h b/src/v_video.h index 9564bca15..35be68b2f 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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 From 62b2718261b23075f276367697b7a2bbdba790ae Mon Sep 17 00:00:00 2001 From: James R Date: Thu, 29 Sep 2022 15:18:41 -0700 Subject: [PATCH 2/2] Print on the title screen and in console if there are uncommitted changes --- src/Makefile | 8 ++++++++ src/comptime.c | 7 +++++++ src/d_netcmd.c | 3 +++ src/doomdef.h | 1 + src/f_finale.c | 2 ++ 5 files changed, 21 insertions(+) diff --git a/src/Makefile b/src/Makefile index 2367553ed..3c621001d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -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 diff --git a/src/comptime.c b/src/comptime.c index 398eda074..81b5ec7d6 100644 --- a/src/comptime.c +++ b/src/comptime.c @@ -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"; diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 58a17204b..8ecad7285 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -4756,6 +4756,9 @@ static void Command_Version_f(void) CONS_Printf("\x87" "DEVELOP " "\x80"); #endif + if (compuncommitted) + CONS_Printf("\x85" "! UNCOMMITTED CHANGES ! " "\x80"); + CONS_Printf("\n"); } diff --git a/src/doomdef.h b/src/doomdef.h index 6997d7951..30c53c5c8 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -613,6 +613,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 diff --git a/src/f_finale.c b/src/f_finale.c index 005a4c6a1..7b5651535 100644 --- a/src/f_finale.c +++ b/src/f_finale.c @@ -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 }