From e45de4c68a1cf0e2e02c4997420991196d512a2d Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 29 May 2017 04:17:49 +0000 Subject: [PATCH] Add QUAKESPASM_VER_SUFFIX macro for marking betas/dev builds. Refactor printing of QUAKESPASM_VERSION/QUAKESPASM_VER_PATCH to use a new QUAKESPASM_VER_STRING macro. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1408 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/console.c | 2 +- Quake/gl_vidsdl.c | 2 +- Quake/host.c | 2 +- Quake/main_sdl.c | 3 +-- Quake/menu.c | 2 +- Quake/quakedef.h | 9 +++++++++ 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/Quake/console.c b/Quake/console.c index 95d714c5..af71f04c 100644 --- a/Quake/console.c +++ b/Quake/console.c @@ -1238,7 +1238,7 @@ void Con_DrawConsole (int lines, qboolean drawinput) //draw version number in bottom right y += 8; - sprintf (ver, "QuakeSpasm %1.2f.%d", (float)QUAKESPASM_VERSION, QUAKESPASM_VER_PATCH); + sprintf (ver, "QuakeSpasm " QUAKESPASM_VER_STRING); for (x = 0; x < (int)strlen(ver); x++) Draw_Character ((con_linewidth - strlen(ver) + x + 2)<<3, y, ver[x] /*+ 128*/); } diff --git a/Quake/gl_vidsdl.c b/Quake/gl_vidsdl.c index 37cb2dee..43396fb4 100644 --- a/Quake/gl_vidsdl.c +++ b/Quake/gl_vidsdl.c @@ -569,7 +569,7 @@ static qboolean VID_SetMode (int width, int height, int bpp, qboolean fullscreen SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, fsaa > 0 ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); - q_snprintf(caption, sizeof(caption), "QuakeSpasm %1.2f.%d", (float)QUAKESPASM_VERSION, QUAKESPASM_VER_PATCH); + q_snprintf(caption, sizeof(caption), "QuakeSpasm " QUAKESPASM_VER_STRING); #if defined(USE_SDL2) /* Create the window if needed, hidden */ diff --git a/Quake/host.c b/Quake/host.c index 602e39f6..8fda3faf 100644 --- a/Quake/host.c +++ b/Quake/host.c @@ -220,7 +220,7 @@ void Host_FindMaxClients (void) void Host_Version_f (void) { Con_Printf ("Quake Version %1.2f\n", VERSION); - Con_Printf ("QuakeSpasm Version %1.2f.%d\n", QUAKESPASM_VERSION, QUAKESPASM_VER_PATCH); + Con_Printf ("QuakeSpasm Version " QUAKESPASM_VER_STRING "\n"); Con_Printf ("Exe: " __TIME__ " " __DATE__ "\n"); } diff --git a/Quake/main_sdl.c b/Quake/main_sdl.c index 1aefdc5b..a3dc3e3f 100644 --- a/Quake/main_sdl.c +++ b/Quake/main_sdl.c @@ -133,8 +133,7 @@ int main(int argc, char *argv[]) Sys_Printf("GLQuake %1.2f (c) id Software\n", GLQUAKE_VERSION); Sys_Printf("FitzQuake %1.2f (c) John Fitzgibbons\n", FITZQUAKE_VERSION); Sys_Printf("FitzQuake SDL port (c) SleepwalkR, Baker\n"); - Sys_Printf("QuakeSpasm %1.2f.%d (c) Ozkan Sezer, Eric Wasylishen & others\n", - QUAKESPASM_VERSION, QUAKESPASM_VER_PATCH); + Sys_Printf("QuakeSpasm " QUAKESPASM_VER_STRING " (c) Ozkan Sezer, Eric Wasylishen & others\n"); Sys_Printf("Host_Init\n"); Host_Init(); diff --git a/Quake/menu.c b/Quake/menu.c index 5a8ea155..3503d80f 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -1667,7 +1667,7 @@ void M_Quit_Draw (void) //johnfitz -- modified for new quit message m_state = m_quit; } - sprintf(msg1, "QuakeSpasm %1.2f.%d", (float)QUAKESPASM_VERSION, QUAKESPASM_VER_PATCH); + sprintf(msg1, "QuakeSpasm " QUAKESPASM_VER_STRING); //okay, this is kind of fucked up. M_DrawTextBox will always act as if //width is even. Also, the width and lines values are for the interior of the box, diff --git a/Quake/quakedef.h b/Quake/quakedef.h index 5a38ff59..22912fe7 100644 --- a/Quake/quakedef.h +++ b/Quake/quakedef.h @@ -38,6 +38,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define FITZQUAKE_VERSION 0.85 //johnfitz #define QUAKESPASM_VERSION 0.92 #define QUAKESPASM_VER_PATCH 2 // helper to print a string like 0.92.1 +#ifndef QUAKESPASM_VER_SUFFIX +#define QUAKESPASM_VER_SUFFIX // optional version suffix like -beta1 +#endif + +#define QS_STRINGIFY2(x) QS_STRINGIFY(x) +#define QS_STRINGIFY(x) #x + +// combined version string like "0.92.1-beta1" +#define QUAKESPASM_VER_STRING QS_STRINGIFY2(QUAKESPASM_VERSION) "." QS_STRINGIFY2(QUAKESPASM_VER_PATCH) QS_STRINGIFY2(QUAKESPASM_VER_SUFFIX) //define PARANOID // speed sapping error checking