diff --git a/include/winquake.h b/include/winquake.h index 02cc1952b..795eca2de 100644 --- a/include/winquake.h +++ b/include/winquake.h @@ -77,10 +77,6 @@ extern LPDIRECTDRAWSURFACE lpBackBuffer; extern LPDIRECTDRAWPALETTE lpDDPal; #endif -#ifdef HAVE_DSOUND_H -extern LPDIRECTSOUND pDS; -extern LPDIRECTSOUNDBUFFER pDSBuf; -#endif void VID_LockBuffer (void); void VID_UnlockBuffer (void); void VID_UpdateWindowStatus (int window_x, int window_y); @@ -100,8 +96,6 @@ extern qboolean winsock_lib_initialized; extern int window_center_x, window_center_y; extern RECT window_rect; -extern qboolean mouseinitialized; - #ifdef SPLASH_SCREEN extern HWND hwnd_dialog; #endif diff --git a/libs/audio/targets/snd_dx.c b/libs/audio/targets/snd_dx.c index 2d42fb2fe..5b41357c5 100644 --- a/libs/audio/targets/snd_dx.c +++ b/libs/audio/targets/snd_dx.c @@ -334,10 +334,10 @@ SNDDMA_InitDirect (void) &dwWrite); IDirectSoundBuffer_Play (pDSBuf, 0, 0, DSBPLAY_LOOPING); - sn.samples = gSndBufSize / (sn.samplebits / 8); - sn.samplepos = 0; + sn.frames = gSndBufSize / (sn.samplebits / 8) / sn.channels; + sn.framepos = 0; sn.submission_chunk = 1; - sn.buffer = lpData; + sn.buffer = (byte *) lpData; sample16 = (sn.samplebits / 8) - 1; dsound_init = true; @@ -403,8 +403,9 @@ SNDDMA_GetDMAPos (void) s = mmtime.u.sample - mmstarttime.u.sample; s >>= sample16; + s /= sn.channels; - s &= (sn.samples - 1); + s %= sn.frames; return s; } @@ -483,7 +484,7 @@ DSOUND_ClearBuffer (int clear) // FIXME: this should be called with 2nd pbuf2 = NULL, dwsize =0 pData = DSOUND_LockBuffer (true); - memset (pData, clear, sn.samples * sn.samplebits / 8); + memset (pData, clear, sn.frames * sn.channels * sn.samplebits / 8); DSOUND_LockBuffer (false); } diff --git a/libs/audio/targets/snd_win.c b/libs/audio/targets/snd_win.c index ec2a414e5..11b56f77f 100644 --- a/libs/audio/targets/snd_win.c +++ b/libs/audio/targets/snd_win.c @@ -250,8 +250,8 @@ SNDDMA_InitWav (void) } } - sn.samples = gSndBufSize / (sn.samplebits / 8); - sn.samplepos = 0; + sn.frames = gSndBufSize / (sn.samplebits / 8) / sn.channels; + sn.framepos = 0; sn.submission_chunk = 1; sn.buffer = (unsigned char *) lpData; sample16 = (sn.samplebits / 8) - 1; @@ -295,8 +295,9 @@ SNDDMA_GetDMAPos (void) s = snd_sent * WAV_BUFFER_SIZE; s >>= sample16; + s /= sn.channels; - s &= (sn.samples - 1); + s %= sn.frames; return s; } diff --git a/libs/audio/testsound.c b/libs/audio/testsound.c index 007b204e2..0dd7333dc 100644 --- a/libs/audio/testsound.c +++ b/libs/audio/testsound.c @@ -50,6 +50,11 @@ static __attribute__ ((used)) const char rcsid[] = #include "QF/sound.h" +#ifdef _WIN32 +# include "winquake.h" +HWND mainwindow; +#endif + #define MEMSIZE (32 * 1024 * 1024) cbuf_t *testsound_cbuf; diff --git a/libs/console/server.c b/libs/console/server.c index ae06690e7..b0c102735 100644 --- a/libs/console/server.c +++ b/libs/console/server.c @@ -336,17 +336,18 @@ setgeometry_status (view_t *view) sb->text = realloc (sb->text, sb->width); memset (sb->text, 0, sb->width); // force an update } - +#ifdef SIGWINCH static void sigwinch (int sig) { interrupted = 1; signal (SIGWINCH, sigwinch); } - +#endif static void get_size (int *xlen, int *ylen) { +#if 0 struct winsize size; *xlen = *ylen = 0; @@ -354,6 +355,8 @@ get_size (int *xlen, int *ylen) return; *xlen = size.ws_col; *ylen = size.ws_row; +#endif + getmaxyx (stdscr, *ylen, *xlen); } static void @@ -363,12 +366,14 @@ process_input (void) int escape = 0; if (interrupted) { +#ifdef SIGWINCH interrupted = 0; get_size (&screen_x, &screen_y); resizeterm (screen_y, screen_x); con_linewidth = screen_x; view_resize (sv_con_data.view, screen_x, screen_y); sv_con_data.view->draw (sv_con_data.view); +#endif } for (ch = 1; ch; ) { @@ -557,7 +562,9 @@ create_input_line (int width) static void init (void) { +#ifdef SIGWINCH signal (SIGWINCH, sigwinch); +#endif initscr (); start_color (); diff --git a/libs/net/nc/net_udp.c b/libs/net/nc/net_udp.c index 964b1db3b..709dea9a5 100644 --- a/libs/net/nc/net_udp.c +++ b/libs/net/nc/net_udp.c @@ -88,10 +88,14 @@ static __attribute__ ((used)) const char rcsid[] = #endif #ifndef HAVE_SOCKLEN_T -# ifdef HAVE_SIZE - typedef size_t socklen_t; +# ifdef _WIN32 + typedef int socklen_t; # else +# ifdef HAVE_SIZE + typedef size_t socklen_t; +# else typedef unsigned int socklen_t; +# endif # endif #endif diff --git a/libs/net/nm/net_dgrm.c b/libs/net/nm/net_dgrm.c index f272e1b70..da9bf2a6a 100644 --- a/libs/net/nm/net_dgrm.c +++ b/libs/net/nm/net_dgrm.c @@ -59,7 +59,8 @@ static __attribute__ ((used)) const char rcsid[] = #ifdef BAN_TEST #if defined(_WIN32) -#include +#include "winquake.h" + typedef uint32_t in_addr_t; #else # include # include diff --git a/libs/net/nm/net_wins.c b/libs/net/nm/net_wins.c index 1a139a36e..673cf9c38 100644 --- a/libs/net/nm/net_wins.c +++ b/libs/net/nm/net_wins.c @@ -413,12 +413,13 @@ WINS_CheckNewConnections (void) //============================================================================= int -WINS_Read (int socket, byte * buf, int len, struct qsockaddr *addr) +WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr) { int addrlen = sizeof (struct qsockaddr); int ret; - ret = precvfrom (socket, buf, len, 0, (struct sockaddr *) addr, &addrlen); + ret = precvfrom (socket, (char *) buf, len, 0, (struct sockaddr *) addr, + &addrlen); if (ret == -1) { int err = pWSAGetLastError (); @@ -469,13 +470,13 @@ WINS_Broadcast (int socket, byte * buf, int len) //============================================================================= int -WINS_Write (int socket, byte * buf, int len, struct qsockaddr *addr) +WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr) { int ret; ret = - psendto (socket, buf, len, 0, (struct sockaddr *) addr, + psendto (socket, (char *) buf, len, 0, (struct sockaddr *) addr, sizeof (struct qsockaddr)); if (ret == -1) if (pWSAGetLastError () == WSAEWOULDBLOCK) diff --git a/libs/util/bspfile.c b/libs/util/bspfile.c index 1d7845dd9..0c429eaaa 100644 --- a/libs/util/bspfile.c +++ b/libs/util/bspfile.c @@ -193,14 +193,15 @@ LoadBSPMem (void *mem, size_t mem_size, void (*cb) (const bsp_t *, void *), void *cbdata) { bsp_t *bsp; + int version; bsp = calloc (sizeof (bsp_t), 1); bsp->header = mem; - if (LittleLong (bsp->header->version) != BSPVERSION) - Sys_Error ("version %i, not %i", LittleLong (bsp->header->version), - BSPVERSION); + version = LittleLong (bsp->header->version); + if (version != BSPVERSION) + Sys_Error ("version %i, not %i", version, BSPVERSION); #undef SET_LUMP #define SET_LUMP(l,n) \ diff --git a/libs/util/sys.c b/libs/util/sys.c index 5074223f7..636de0528 100644 --- a/libs/util/sys.c +++ b/libs/util/sys.c @@ -604,7 +604,7 @@ Sys_ConsoleInput (void) } text[len] = c; len++; - if (len < sizeof (text)) + if (len < (int) sizeof (text)) text[len] = 0; else { // buffer is full diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index 7fc304343..39080ca40 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -157,7 +157,7 @@ VID_SetWindowedMode ( void ) height = rect.bottom - rect.top; // Create the window - mainwindow = CreateWindow ("QuakeForge", PROGRAM, + mainwindow = CreateWindow ("QuakeForge", PACKAGE_NAME, WindowStyle, rect.left, rect.top, width, height, NULL, NULL, global_hInstance, NULL); @@ -382,7 +382,8 @@ VID_Shutdown (void) { HGLRC hRC; HDC hDC; - int i, temp[8192]; + int i; + GLuint temp[8192]; #ifdef SPLASH_SCREEN if(hwnd_dialog) diff --git a/nq/source/sys_sdl.c b/nq/source/sys_sdl.c index 4bdf67993..e6543b3ee 100644 --- a/nq/source/sys_sdl.c +++ b/nq/source/sys_sdl.c @@ -93,7 +93,7 @@ startup (void) if ((vinfo.dwMajorVersion < 4) || (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) { - Sys_Error ("This version of " PROGRAM + Sys_Error ("This version of " PACKAGE_NAME " requires at least Win95 or NT 4.0"); } #endif diff --git a/nq/source/sys_wind.c b/nq/source/sys_wind.c index 785b9f681..ea8c53780 100644 --- a/nq/source/sys_wind.c +++ b/nq/source/sys_wind.c @@ -70,7 +70,7 @@ main (int argc, const char **argv) if (!strcmp (argv[i], "-dedicated")) break; if (i == argc) { - char **newargv; + const char **newargv; newargv = malloc ((argc + 2) * sizeof (*newargv)); memcpy (newargv, argv, argc * 4); diff --git a/qtv/source/qtv.c b/qtv/source/qtv.c index d1bf77549..077155c87 100644 --- a/qtv/source/qtv.c +++ b/qtv/source/qtv.c @@ -113,7 +113,11 @@ qtv_print (const char *fmt, va_list args) } else { mytime = time (NULL); local = localtime (&mytime); +#ifdef _WIN32 + strftime (stamp, sizeof (stamp), "[%b %d %X] ", local); +#else strftime (stamp, sizeof (stamp), "[%b %e %X] ", local); +#endif Con_Printf ("%s%s", stamp, msg->str); } if (msg->str[0] && msg->str[strlen (msg->str) - 1] != '\n') { diff --git a/qw/include/server.h b/qw/include/server.h index 585b54451..f0d03d2f4 100644 --- a/qw/include/server.h +++ b/qw/include/server.h @@ -421,7 +421,7 @@ extern struct cvar_s *sv_highchars; extern struct cvar_s *sv_mintic, *sv_maxtic; extern struct cvar_s *sv_maxspeed; -extern struct cvar_s *timeout; +extern struct cvar_s *sv_timeout; extern netadr_t master_adr[MAX_MASTERS]; // address of the master server diff --git a/qw/source/cl_sys_sdl.c b/qw/source/cl_sys_sdl.c index 6ee663cf0..4e7cf833d 100644 --- a/qw/source/cl_sys_sdl.c +++ b/qw/source/cl_sys_sdl.c @@ -94,7 +94,7 @@ startup (void) if ((vinfo.dwMajorVersion < 4) || (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) { - Sys_Error ("This version of " PROGRAM + Sys_Error ("This version of " PACKAGE_NAME " requires at least Win95 or NT 4.0"); } #endif diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index 69e9bd7b2..af6e5ed7e 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -104,7 +104,7 @@ startup (void) if ((vinfo.dwMajorVersion < 4) || (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) { - Sys_Error ("This version of " PROGRAM + Sys_Error ("This version of " PACKAGE_NAME " requires a full Win32 implementation."); } diff --git a/qw/source/master.c b/qw/source/master.c index d9081df72..be8823d1a 100644 --- a/qw/source/master.c +++ b/qw/source/master.c @@ -505,7 +505,11 @@ ma_log (const char *fmt, ...) mytime = time (NULL); local = localtime (&mytime); +#ifdef _WIN32 + strftime (stamp, sizeof (stamp), "[%b %d %X] ", local); +#else strftime (stamp, sizeof (stamp), "[%b %e %X] ", local); +#endif fprintf (stdout, "%s", stamp); va_start (args, fmt); vfprintf (stdout, fmt, args); diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 5bf45e03d..9de1804ed 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -141,7 +141,7 @@ cvar_t *sv_maxtic; // physics time tic cvar_t *sv_netdosprotect; // tone down DoS from quake servers -cvar_t *timeout; // seconds without any message +cvar_t *sv_timeout; // seconds without any message cvar_t *zombietime; // seconds to sink messages after // disconnect @@ -1839,7 +1839,7 @@ SV_CheckTimeouts (void) float droptime; int nclients, i; - droptime = realtime - timeout->value; + droptime = realtime - sv_timeout->value; nclients = 0; for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) { @@ -2104,8 +2104,8 @@ SV_InitLocal (void) "Spawn the player entity"); watervis = Cvar_Get ("watervis", "0", CVAR_SERVERINFO, Cvar_Info, "Set nonzero to enable r_wateralpha on clients"); - timeout = Cvar_Get ("timeout", "65", CVAR_NONE, NULL, "Sets the amount of " - "time in seconds before a client is considered " + sv_timeout = Cvar_Get ("timeout", "65", CVAR_NONE, NULL, "Sets the amount " + "of time in seconds before a client is considered " "disconnected if the server does not receive a " "packet"); zombietime = Cvar_Get ("zombietime", "2", CVAR_NONE, NULL, "The number of " diff --git a/qw/source/sv_qtv.c b/qw/source/sv_qtv.c index 281b905c9..eabedae14 100644 --- a/qw/source/sv_qtv.c +++ b/qw/source/sv_qtv.c @@ -457,7 +457,7 @@ SV_qtvCheckTimeouts (void) float droptime; sv_qtv_t *proxy; - droptime = realtime - timeout->value; + droptime = realtime - sv_timeout->value; for (i = 0; i < MAX_PROXIES; i++) { proxy = proxies + i; diff --git a/qw/source/sv_sys_win.c b/qw/source/sv_sys_win.c index 21ec01b58..98099c045 100644 --- a/qw/source/sv_sys_win.c +++ b/qw/source/sv_sys_win.c @@ -64,7 +64,7 @@ startup (void) if ((vinfo.dwMajorVersion < 4) || (vinfo.dwPlatformId == VER_PLATFORM_WIN32s)) { - Sys_Error (PROGRAM " requires at least Win95 or NT 4.0"); + Sys_Error (PACKAGE_NAME " requires at least Win95 or NT 4.0"); } if (vinfo.dwPlatformId == VER_PLATFORM_WIN32_NT) diff --git a/tools/qflight/source/qflight.c b/tools/qflight/source/qflight.c index c5123411f..14fa08a78 100644 --- a/tools/qflight/source/qflight.c +++ b/tools/qflight/source/qflight.c @@ -169,7 +169,7 @@ LightWorld (void) BSP_AddLighting (bsp, (byte *) lightdata->str, lightdata->size); if (options.verbosity >= 0) - printf ("lightdatasize: %zi\n", bsp->lightdatasize); + printf ("lightdatasize: %ld\n", (long) bsp->lightdatasize); } int diff --git a/tools/qfvis/source/qfvis.c b/tools/qfvis/source/qfvis.c index 0a2947a85..76a9c712b 100644 --- a/tools/qfvis/source/qfvis.c +++ b/tools/qfvis/source/qfvis.c @@ -317,7 +317,7 @@ WatchThread (void *_thread) int ind = 0; while (1) { - sleep (1); + usleep (1000000); for (i = 0; i < thread; i ++) local_work[i] = working[i]; @@ -884,8 +884,8 @@ main (int argc, char **argv) BSP_AddVisibility (bsp, (byte *) visdata->str, visdata->size); if (options.verbosity >= 0) - printf ("visdatasize:%zi compressed from %zi\n", bsp->visdatasize, - originalvismapsize); + printf ("visdatasize:%ld compressed from %ld\n", + (long) bsp->visdatasize, (long) originalvismapsize); CalcAmbientSounds ();