diff --git a/SConstruct b/SConstruct index 1a3ba78..69d48c0 100644 --- a/SConstruct +++ b/SConstruct @@ -173,21 +173,15 @@ def get_compiler_version(): ccversion = get_compiler_version() -# git revision -# TODO: consider tags -def get_git_revision(): - cmd_status, rawrevision = run_command("git rev-parse --short HEAD") - git_revision = None if cmd_status else rawrevision +# git tag +def get_git_tag(): + cmd_status, rawtag = run_command("git describe --tag") + git_tag = None if cmd_status else rawtag - if git_revision: - cmd_status, _ = run_command("git diff-index --quiet HEAD") - if cmd_status: - git_revision += "*" + return git_tag - return git_revision - -revision = get_git_revision() +git_tag = get_git_tag() # set job/thread count @@ -215,7 +209,7 @@ env.SetOption("num_jobs", GetNumCores()) # notify the user of the build configuration if not env.GetOption("clean"): # build tools - msg = "Building " + ((revision + " ") if revision else "") + msg = "Building " + ((git_tag + " ") if git_tag else "") msg += ( "using " + str(env.GetOption("num_jobs")) @@ -642,8 +636,8 @@ if debug: "_DEBUG", ] -if revision: - env["CPPDEFINES"] += ['REVISION=\\"' + revision + '\\"'] +if git_tag: + env["CPPDEFINES"] += ['GIT_TAG=\\"' + git_tag + '\\"'] # override options if target_plat != "Linux": diff --git a/cgame/cg_jappScoreboard.cpp b/cgame/cg_jappScoreboard.cpp index 5dafe8b..3afadfe 100644 --- a/cgame/cg_jappScoreboard.cpp +++ b/cgame/cg_jappScoreboard.cpp @@ -1131,10 +1131,10 @@ static void DrawClientInfo(float fade) { y -= font.Height(buf); font.Paint(SCREEN_WIDTH - font.Width(buf), y, buf, &colour, uiTextStyle_e::ShadowedMore); -#ifdef REVISION - y -= font.Height(REVISION); +#ifdef GIT_TAG + y -= font.Height(GIT_TAG); // JA++ version - font.Paint(SCREEN_WIDTH - font.Width(REVISION), y, REVISION, &colour, uiTextStyle_e::ShadowedMore); + font.Paint(SCREEN_WIDTH - font.Width(GIT_TAG), y, GIT_TAG, &colour, uiTextStyle_e::ShadowedMore); #endif } diff --git a/cgame/cg_q3pScoreboard.cpp b/cgame/cg_q3pScoreboard.cpp index 3be9b13..be0ce2f 100644 --- a/cgame/cg_q3pScoreboard.cpp +++ b/cgame/cg_q3pScoreboard.cpp @@ -800,10 +800,10 @@ static void DrawClientInfo(float fade) { VectorCopy4(&g_color_table[ColorIndex(COLOR_ORANGE)], &colour); colour.a = fade; -#ifdef REVISION - y -= font.Height(REVISION); +#ifdef GIT_TAG + y -= font.Height(GIT_TAG); // JA++ version - font.Paint(SCREEN_WIDTH - font.Width(REVISION), y, REVISION, &colour, uiTextStyle_e::ShadowedMore); + font.Paint(SCREEN_WIDTH - font.Width(GIT_TAG), y, GIT_TAG, &colour, uiTextStyle_e::ShadowedMore); #endif // date diff --git a/qcommon/q_shared.h b/qcommon/q_shared.h index a500db4..79fffc1 100644 --- a/qcommon/q_shared.h +++ b/qcommon/q_shared.h @@ -155,8 +155,8 @@ typedef int32_t qhandle_t, fxHandle_t, sfxHandle_t, fileHandle_t, clipHandle_t; // ja++ version #define JAPP_VERSION_SMALL "JA++, " XSTRING(ARCH_WIDTH) " bits, " __DATE__ -#ifdef REVISION -#define JAPP_VERSION JAPP_VERSION_SMALL ", " REVISION +#ifdef GIT_TAG +#define JAPP_VERSION JAPP_VERSION_SMALL ", " GIT_TAG #else #define JAPP_VERSION JAPP_VERSION_SMALL #endif @@ -765,7 +765,7 @@ extern vector3 axisDefault[3]; float Q_fabs(float f); float Q_rsqrt(float f); // reciprocal square root -#define SQRTFAST(x) ((x) * Q_rsqrt(x)) +#define SQRTFAST(x) ((x)*Q_rsqrt(x)) signed char ClampChar(int i); signed short ClampShort(int i); @@ -782,8 +782,8 @@ void ByteToDir(int b, vector3 *dir); #define Square(x) ((x) * (x)) -#define DEG2RAD(a) (((a) * M_PI) / 180.0F) -#define RAD2DEG(a) (((a) * 180.0f) / M_PI) +#define DEG2RAD(a) (((a)*M_PI) / 180.0F) +#define RAD2DEG(a) (((a)*180.0f) / M_PI) void VectorAdd(const vector3 *vec1, const vector3 *vec2, vector3 *vecOut); void VectorSubtract(const vector3 *vec1, const vector3 *vec2, vector3 *vecOut); @@ -1154,7 +1154,7 @@ typedef enum soundChannel_e { CHAN_MUSIC, // ## %s !!"W:\game\base\!!sound\*.wav;*.mp3" #music played as a looping sound - added by BTO (VV) } soundChannel_t; -#define ANGLE2SHORT(x) ((int)((x) * 65536 / 360) & 65535) +#define ANGLE2SHORT(x) ((int)((x)*65536 / 360) & 65535) #define SHORT2ANGLE(x) ((x) * (360.0f / 65536)) #define SNAPFLAG_RATE_DELAYED 1