From 6909073d3dd8b6003e4b7370b120e00b1dd989b8 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Mon, 2 Dec 2019 10:01:47 -0500 Subject: [PATCH] make messages consistent --- source/cd_sdl.c | 3 +- source/cl_parse.c | 2 +- source/console.c | 10 +++---- source/gl_vidsdl.c | 57 ++++++++++++++++++++++++++++-------- source/host.c | 12 +++++--- source/host_cmd.c | 3 +- source/in_sdl.c | 2 +- source/lodepng.c | 2 +- source/main_sdl.c | 28 +++++++----------- source/menu.c | 6 ++-- source/quakedef.h | 11 +++---- source/snd_dma.c | 2 -- source/snd_sdl.c | 4 +-- source/sv_main.c | 2 +- source/unix/sys_sdl_unix.c | 2 +- source/windows/sys_sdl_win.c | 2 +- 16 files changed, 85 insertions(+), 63 deletions(-) diff --git a/source/cd_sdl.c b/source/cd_sdl.c index 103dc93..c889fda 100644 --- a/source/cd_sdl.c +++ b/source/cd_sdl.c @@ -502,8 +502,7 @@ int32_t CDAudio_Init(void) } sdl_num_drives = SDL_CDNumDrives(); - Con_Printf("SDL detected %" PRIi32 " CD-ROM drive%c\n", sdl_num_drives, - sdl_num_drives == 1 ? ' ' : 's'); + Con_Printf("SDL detected %" PRIi32 " CD-ROM drive(s)\n", sdl_num_drives); if(sdl_num_drives < 1) return -1; diff --git a/source/cl_parse.c b/source/cl_parse.c index 484ae0d..6cb6513 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -316,7 +316,7 @@ void CL_ParseServerInfo(void) // seperate the printfs so the server message can have a color Con_Printf("\n%s\n", Con_Quakebar(40)); //johnfitz - Con_Printf("%c%s\n", 2, str); + Con_Printf("\x02%s\n", str); //johnfitz -- tell user which protocol this is Con_Printf("Using protocol %" PRIi32 "\n", i); diff --git a/source/console.c b/source/console.c index 8dbf2d4..f15850c 100644 --- a/source/console.c +++ b/source/console.c @@ -325,7 +325,7 @@ void Con_Init(void) con_current = con_totallines - 1; //johnfitz - Con_Printf("Console initialized.\n"); + Con_Printf("Console initialized\n"); Cvar_RegisterVariable(&con_notifytime); Cvar_RegisterVariable(&con_logcenterprint); //johnfitz @@ -1186,9 +1186,10 @@ The typing input line at the bottom should only be drawn if typing is allowed */ void Con_DrawConsole(int32_t lines, bool drawinput) { + static char const ver[] = ENGINE_NAME " " VERSION; + int32_t i, x, y, j, sb, rows; const char *text; - char ver[32]; if(lines <= 0) return; @@ -1231,9 +1232,8 @@ void Con_DrawConsole(int32_t lines, bool drawinput) //draw version number in bottom right y += 8; - q_snprintf(ver, sizeof(ver), "QuakeSpasm " QUAKESPASM_VERSION); - for(x = 0; x < (int32_t)strlen(ver); x++) - Draw_Character((con_linewidth - strlen(ver) + x + 2) << 3, y, ver[x] /*+ 128*/); + for(x = 0; x < (int32_t)strsizeof(ver); x++) + Draw_Character((con_linewidth - strsizeof(ver) + x + 2) << 3, y, ver[x] /*+ 128*/); } diff --git a/source/gl_vidsdl.c b/source/gl_vidsdl.c index 5868228..594cb6c 100644 --- a/source/gl_vidsdl.c +++ b/source/gl_vidsdl.c @@ -25,7 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "cfgfile.h" #include "bgmusic.h" -#include "resource.h" #include //ericw -- for putting the driver into multithreaded mode @@ -279,8 +278,10 @@ static void VID_Gamma_Init(void) gammaworks = (SDL_SetWindowBrightness(draw_context, 1) == 0); # endif +#if defined(DEBUG) if(!gammaworks) Con_SafePrintf("gamma adjustment not available\n"); +#endif } /* @@ -476,9 +477,10 @@ VID_SetMode */ static bool VID_SetMode(int32_t width, int32_t height, int32_t refreshrate, int32_t bpp, bool fullscreen) { + static char const caption[] = ENGINE_NAME " " VERSION; + int32_t temp; Uint32 flags; - char caption[50]; int32_t depthbits, stencilbits; int32_t fsaa_obtained; int32_t previous_display; @@ -507,8 +509,6 @@ static bool VID_SetMode(int32_t width, int32_t height, int32_t refreshrate, int3 SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, fsaa > 0 ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, fsaa); - q_snprintf(caption, sizeof(caption), "QuakeSpasm " QUAKESPASM_VERSION); - /* Create the window if needed, hidden */ if(!draw_context) { @@ -818,6 +818,14 @@ static char *GL_MakeNiceExtensionsList(const char *in) return out; } +static void GL_ShowBriefInfo(void) +{ + Con_SafePrintf("GL Vendor : %s\n", gl_vendor); + Con_SafePrintf("GL Renderer: %s\n", gl_renderer); + Con_SafePrintf("GL Version : %s\n", gl_version); + Con_SafePrintf("GL TexUnits: %" PRIi32 "\n", (int32_t)gl_max_texture_units); +} + /* =============== GL_Info_f -- johnfitz @@ -825,9 +833,7 @@ GL_Info_f -- johnfitz */ static void GL_Info_f(void) { - Con_SafePrintf("GL_VENDOR: %s\n", gl_vendor); - Con_SafePrintf("GL_RENDERER: %s\n", gl_renderer); - Con_SafePrintf("GL_VERSION: %s\n", gl_version); + GL_ShowBriefInfo(); Con_Printf("GL_EXTENSIONS: %s\n", gl_extensions_nice); } @@ -880,13 +886,17 @@ static void GL_CheckExtensions(void) GL_GenBuffersFunc = (PFNGLGENBUFFERSARBPROC) SDL_GL_GetProcAddress("glGenBuffersARB"); if(GL_BindBufferFunc && GL_BufferDataFunc && GL_BufferSubDataFunc && GL_DeleteBuffersFunc && GL_GenBuffersFunc) { +#if defined(DEBUG) Con_Printf("FOUND: ARB_vertex_buffer_object\n"); +#endif gl_vbo_able = true; } +#if defined(DEBUG) else { Con_Warning("ARB_vertex_buffer_object not available\n"); } +#endif } // multitexture @@ -900,11 +910,12 @@ static void GL_CheckExtensions(void) GL_ClientActiveTextureFunc = (PFNGLCLIENTACTIVETEXTUREARBPROC) SDL_GL_GetProcAddress("glClientActiveTextureARB"); if(GL_MTexCoord2fFunc && GL_SelectTextureFunc && GL_ClientActiveTextureFunc) { +#if defined(DEBUG) Con_Printf("FOUND: ARB_multitexture\n"); +#endif gl_mtexable = true; glGetIntegerv(GL_MAX_TEXTURE_UNITS, &gl_max_texture_units); - Con_Printf("GL_MAX_TEXTURE_UNITS: %" PRIi32 "\n", (int32_t)gl_max_texture_units); } else { @@ -922,12 +933,16 @@ static void GL_CheckExtensions(void) Con_Warning("texture_env_combine disabled at command line\n"); else if(GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_env_combine")) { +#if defined(DEBUG) Con_Printf("FOUND: ARB_texture_env_combine\n"); +#endif gl_texture_env_combine = true; } else if(GL_ParseExtensionList(gl_extensions, "GL_EXT_texture_env_combine")) { +#if defined(DEBUG) Con_Printf("FOUND: EXT_texture_env_combine\n"); +#endif gl_texture_env_combine = true; } else @@ -941,12 +956,16 @@ static void GL_CheckExtensions(void) Con_Warning("texture_env_add disabled at command line\n"); else if(GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_env_add")) { +#if defined(DEBUG) Con_Printf("FOUND: ARB_texture_env_add\n"); +#endif gl_texture_env_add = true; } else if(GL_ParseExtensionList(gl_extensions, "GL_EXT_texture_env_add")) { +#if defined(DEBUG) Con_Printf("FOUND: EXT_texture_env_add\n"); +#endif gl_texture_env_add = true; } else @@ -972,7 +991,9 @@ static void GL_CheckExtensions(void) } else { +#if defined(DEBUG) Con_Printf("FOUND: SDL_GL_SetSwapInterval\n"); +#endif } // anisotropic filtering @@ -994,7 +1015,9 @@ static void GL_CheckExtensions(void) if(test1 == 1 && test2 == 2) { +#if defined(DEBUG) Con_Printf("FOUND: EXT_texture_filter_anisotropic\n"); +#endif gl_anisotropy_able = true; } else @@ -1023,7 +1046,9 @@ static void GL_CheckExtensions(void) Con_Warning("texture_non_power_of_two disabled at command line\n"); else if(GL_ParseExtensionList(gl_extensions, "GL_ARB_texture_non_power_of_two")) { +#if defined(DEBUG) Con_Printf("FOUND: ARB_texture_non_power_of_two\n"); +#endif gl_texture_NPOT = true; } else @@ -1085,18 +1110,24 @@ static void GL_CheckExtensions(void) GL_Uniform3fFunc && GL_Uniform4fFunc) { +#if defined(DEBUG) Con_Printf("FOUND: GLSL\n"); +#endif gl_glsl_able = true; } +#if defined(DEBUG) else { Con_Warning("GLSL not available\n"); } +#endif } +#if defined(DEBUG) else { Con_Warning("OpenGL version < 2, GLSL not available\n"); } +#endif // GLSL gamma // @@ -1106,10 +1137,12 @@ static void GL_CheckExtensions(void) { gl_glsl_gamma_able = true; } +#if defined(DEBUG) else { Con_Warning("GLSL gamma not available, using hardware gamma\n"); } +#endif // GLSL alias model rendering // @@ -1119,10 +1152,12 @@ static void GL_CheckExtensions(void) { gl_glsl_alias_able = true; } +#if defined(DEBUG) else { Con_Warning("GLSL alias model rendering not available, using Fitz renderer\n"); } +#endif } /* @@ -1165,10 +1200,6 @@ static void GL_Init(void) gl_version = (const char *) glGetString(GL_VERSION); gl_extensions = (const char *) glGetString(GL_EXTENSIONS); - Con_SafePrintf("GL_VENDOR: %s\n", gl_vendor); - Con_SafePrintf("GL_RENDERER: %s\n", gl_renderer); - Con_SafePrintf("GL_VERSION: %s\n", gl_version); - if(gl_version == NULL || sscanf(gl_version, "%" PRIi32 ".%" PRIi32 "", &gl_version_major, &gl_version_minor) < 2) { gl_version_major = 0; @@ -1181,6 +1212,8 @@ static void GL_Init(void) GL_CheckExtensions(); //johnfitz + GL_ShowBriefInfo(); + #if PLATFORM_IS(OSX) // ericw -- enable multi-threaded OpenGL, gives a decent FPS boost. // https://developer.apple.com/library/mac/technotes/tn2085/ diff --git a/source/host.c b/source/host.c index e4150c1..b7b353d 100644 --- a/source/host.c +++ b/source/host.c @@ -225,11 +225,15 @@ void Host_FindMaxClients(void) Cvar_SetQuick(&deathmatch, "0"); } +static void PrintExeTime(void) +{ + Con_Printf("Compiled on " __DATE__ " " __TIME__ "\n"); +} + void Host_Version_f(void) { - Con_Printf("Quake Version %s\n", VERSION); - Con_Printf("QuakeSpasm Version " QUAKESPASM_VERSION "\n"); - Con_Printf("Exe: " __TIME__ " " __DATE__ "\n"); + Con_Printf(ENGINE_NAME " Version " VERSION "\n"); + PrintExeTime(); } /* cvar callback functions : */ @@ -836,7 +840,7 @@ void Host_Init(void) NET_Init(); SV_Init(); - Con_Printf("Exe: " __TIME__ " " __DATE__ "\n"); + PrintExeTime(); Con_Printf("%4.1f megabyte heap\n", host_parms->memsize / (1024 * 1024.0)); if(cls.state != ca_dedicated) diff --git a/source/host_cmd.c b/source/host_cmd.c index 8917202..96ff4b6 100644 --- a/source/host_cmd.c +++ b/source/host_cmd.c @@ -428,8 +428,7 @@ Host_Status_f */ void Host_Status_f(void) { - void (*print_fn)(const char *fmt, ...) - FUNCP_PRINTF(1, 2); + void (*print_fn)(const char *fmt, ...) FUNCP_PRINTF(1, 2); client_t *client; int32_t seconds; int32_t minutes; diff --git a/source/in_sdl.c b/source/in_sdl.c index 1d4662e..10ac055 100644 --- a/source/in_sdl.c +++ b/source/in_sdl.c @@ -256,7 +256,7 @@ void IN_StartupJoystick(void) gamecontroller = SDL_GameControllerOpen(i); if(gamecontroller) { - Con_Printf("detected controller: %s\n", controllername != NULL ? controllername : "NULL"); + Con_Printf("Controller found: %s\n", controllername != NULL ? controllername : "NULL"); joy_active_instaceid = SDL_JoystickInstanceID(SDL_GameControllerGetJoystick(gamecontroller)); joy_active_controller = gamecontroller; diff --git a/source/lodepng.c b/source/lodepng.c index 3637ee4..e50e8fb 100644 --- a/source/lodepng.c +++ b/source/lodepng.c @@ -2332,7 +2332,7 @@ const LodePNGDecompressSettings lodepng_default_decompress_settings = {0, 0, 0, /* ////////////////////////////////////////////////////////////////////////// */ -#ifndef LODEPNG_NO_COMPILE_CRC +#if !defined(LODEPNG_NO_COMPILE_CRC) /* CRC polynomial: 0xedb88320 */ static unsigned lodepng_crc32_table[256] = { diff --git a/source/main_sdl.c b/source/main_sdl.c index 35e23c5..7b1f869 100644 --- a/source/main_sdl.c +++ b/source/main_sdl.c @@ -43,23 +43,17 @@ static void Sys_InitSDL(void) SDL_version *sdl_version = &v; SDL_GetVersion(&v); - Sys_Printf("Found SDL version %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n", sdl_version->major, sdl_version->minor, sdl_version->patch); + Sys_Printf("SDL version %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n", sdl_version->major, sdl_version->minor, sdl_version->patch); + if(SDL_VERSIONNUM(sdl_version->major, sdl_version->minor, sdl_version->patch) < SDL_REQUIREDVERSION) - { - /*reject running under older SDL versions */ - Sys_Error("You need at least v%" PRIi32 ".%" PRIi32 ".%" PRIi32 " of SDL to run this game.", SDL_MIN_X, SDL_MIN_Y, SDL_MIN_Z); - } + Sys_Error("Need at least v%" PRIi32 ".%" PRIi32 ".%" PRIi32 " of SDL to run. Exiting.", SDL_MIN_X, SDL_MIN_Y, SDL_MIN_Z); + if(SDL_VERSIONNUM(sdl_version->major, sdl_version->minor, sdl_version->patch) >= SDL_NEW_VERSION_REJECT) - { - /*reject running under newer (1.3.x) SDL */ - Sys_Error("Your version of SDL library is incompatible with me.\n" - "You need a library version in the line of %" PRIi32 ".%" PRIi32 ".%" PRIi32 "\n", SDL_MIN_X, SDL_MIN_Y, SDL_MIN_Z); - } + Sys_Error("Detected SDL is too new. Exiting."); if(SDL_Init(0) < 0) - { Sys_Error("Couldn't init SDL: %s", SDL_GetError()); - } + atexit(Sys_AtExit); } @@ -105,14 +99,12 @@ int32_t main(int32_t argc, char *argv[]) parms.membase = malloc(parms.memsize); if(!parms.membase) - Sys_Error("Not enough memory free; check disk space\n"); + Sys_Error("Not enough memory free for heap. You need 256MiB.\n"); - Sys_Printf("Quake " VERSION " (c) id Software\n"); - Sys_Printf("FitzQuake " FITZQUAKE_VERSION " (c) John Fitzgibbons\n"); - Sys_Printf("FitzQuake SDL port (c) SleepwalkR, Baker\n"); - Sys_Printf("QuakeSpasm " QUAKESPASM_VERSION " (c) Ozkan Sezer, Eric Wasylishen & others\n"); + Sys_Printf(ENGINE_NAME " " VERSION " (c) id Software, John Fitzgibbons, " + "SleepwalkR, Baker, Ozkan Sezer, Eric Wasylishen, " + "Alison Watson, et al.\n"); - Sys_Printf("Host_Init\n"); Host_Init(); oldtime = Sys_DoubleTime(); diff --git a/source/menu.c b/source/menu.c index 42e773b..54a71bd 100644 --- a/source/menu.c +++ b/source/menu.c @@ -1677,10 +1677,10 @@ bool M_Quit_TextEntry(void) } -void M_Quit_Draw(void) //johnfitz -- modified for new quit message +void M_Quit_Draw(void) { - static char const msg1[] = "QuakeSpasm " QUAKESPASM_VERSION; - static char const msg2[] = "by Ozkan, Ericw & Stevenaaus"; + static char const msg1[] = ENGINE_NAME " " VERSION; + static char const msg2[] = "FIXME: make this customizable"; static char const msg3[] = "Press y to quit"; int32_t boxlen; diff --git a/source/quakedef.h b/source/quakedef.h index 88e5853..351e95f 100644 --- a/source/quakedef.h +++ b/source/quakedef.h @@ -24,15 +24,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef spingle__quakedef_h #define spingle__quakedef_h -// quakedef.h -- primary header for client +#define ENGINE_NAME "spingle" +#define VERSION "6.90" -#define VERSION "1.09" -#define FITZQUAKE_VERSION "0.85" //johnfitz -#define QUAKESPASM_VERSION "0.93.1" +//#define PARANOID // speed sapping error checking -//define PARANOID // speed sapping error checking - -#define GAMENAME "id1" // directory to look in by default +#define GAMENAME "id1" // directory to look in by default #include "q_stdinc.h" diff --git a/source/snd_dma.c b/source/snd_dma.c index 2742ffd..b52b3b0 100644 --- a/source/snd_dma.c +++ b/source/snd_dma.c @@ -189,8 +189,6 @@ void S_Init(void) if(safemode || COM_CheckParm("-nosound")) return; - Con_Printf("\nSound Initialization\n"); - Cmd_AddCommand("play", S_Play); Cmd_AddCommand("playvol", S_PlayVol); Cmd_AddCommand("stopsound", S_StopAllSoundsC); diff --git a/source/snd_sdl.c b/source/snd_sdl.c index 2f12746..f3f6d36 100644 --- a/source/snd_sdl.c +++ b/source/snd_sdl.c @@ -150,7 +150,7 @@ bool SNDDMA_Init(dma_t *dma) shm->samplepos = 0; shm->submission_chunk = 1; - Con_Printf("SDL audio spec : %" PRIi32 " Hz, %" PRIi32 " samples, %" PRIi32 " channels\n", + Con_Printf("SDL Audio Spec : %" PRIi32 " Hz, %" PRIi32 " samples, %" PRIi32 " channels\n", obtained.freq, obtained.samples, obtained.channels); { const char *driver = SDL_GetCurrentAudioDriver(); @@ -160,7 +160,7 @@ bool SNDDMA_Init(dma_t *dma) device != NULL ? device : "(UNKNOWN)"); } buffersize = shm->samples * (shm->samplebits / 8); - Con_Printf("SDL audio driver: %s, %" PRIi32 " bytes buffer\n", drivername, buffersize); + Con_Printf("SDL Audio Driver: %s, %" PRIi32 " bytes buffer\n", drivername, buffersize); shm->buffer = (uint8_t *) calloc(1, buffersize); if(!shm->buffer) diff --git a/source/sv_main.c b/source/sv_main.c index 5fb13a7..5921cc1 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -289,7 +289,7 @@ void SV_SendServerinfo(client_t *client) int32_t i; //johnfitz MSG_WriteByte(&client->message, svc_print); - sprintf(message, "%c\nFITZQUAKE " FITZQUAKE_VERSION " SERVER (%" PRIi32 " CRC)\n", 2, pr_crc); //johnfitz -- include fitzquake version + sprintf(message, "\x02\nFITZQUAKE 0.85 SERVER (%" PRIi32 " CRC)\n", pr_crc); MSG_WriteString(&client->message, message); MSG_WriteByte(&client->message, svc_serverinfo); diff --git a/source/unix/sys_sdl_unix.c b/source/unix/sys_sdl_unix.c index b9a4660..d907a21 100644 --- a/source/unix/sys_sdl_unix.c +++ b/source/unix/sys_sdl_unix.c @@ -327,7 +327,7 @@ void Sys_Init(void) host_parms->userdir = host_parms->basedir; host_parms->numcpus = Sys_NumCPUs(); - Sys_Printf("Detected %" PRIi32 " CPUs.\n", host_parms->numcpus); + Sys_Printf("Detected %" PRIi32 " CPUs\n", host_parms->numcpus); } void Sys_mkdir(const char *path) diff --git a/source/windows/sys_sdl_win.c b/source/windows/sys_sdl_win.c index 3531f82..413e6d8 100644 --- a/source/windows/sys_sdl_win.c +++ b/source/windows/sys_sdl_win.c @@ -255,7 +255,7 @@ void Sys_Init(void) Win95old = true; } } - Sys_Printf("Detected %" PRIi32 " CPUs.\n", host_parms->numcpus); + Sys_Printf("Detected %" PRIi32 " CPUs\n", host_parms->numcpus); if(isDedicated) {