mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
win32 compile fixes
This commit is contained in:
parent
9181ddaa4c
commit
6767d6bfa0
9 changed files with 39 additions and 11 deletions
|
@ -59,10 +59,12 @@
|
|||
#if defined(HAVE__SNPRINTF)
|
||||
# undef snprintf
|
||||
# define snprintf Q_snprintfz
|
||||
# define need_qstring_h
|
||||
#endif
|
||||
#if defined(HAVE__VSNPRINTF)
|
||||
# undef vsnprintf
|
||||
# define vsnprintf Q_vsnprintfz
|
||||
# define need_qstring_h
|
||||
#endif
|
||||
#if defined(_WIN32) && !defined(__BORLANDC__)
|
||||
# define kbhit _kbhit
|
||||
|
|
|
@ -29,7 +29,12 @@
|
|||
#ifndef string_h
|
||||
#define string_h
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
const char * Q_strcasestr (const char *haystack, const char *needle);
|
||||
size_t Q_strnlen (const char *s, size_t maxlen);
|
||||
size_t Q_snprintfz (char *dest, size_t size, const char *fmt, ...) __attribute__((format(printf,3,4)));
|
||||
size_t Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr);
|
||||
|
||||
#endif // string_h
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef struct menu_item_s {
|
|||
int x, y;
|
||||
func_t func;
|
||||
func_t cursor;
|
||||
func_t keyevent;
|
||||
const char *text;
|
||||
menu_pic_t *pics;
|
||||
} menu_item_t;
|
||||
|
@ -209,6 +210,14 @@ bi_Menu_Cursor (progs_t *pr)
|
|||
menu->cursor = func;
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_KeyEvent (progs_t *pr)
|
||||
{
|
||||
func_t func = G_FUNCTION (pr, OFS_PARM0);
|
||||
|
||||
menu->keyevent = func;
|
||||
}
|
||||
|
||||
static void
|
||||
bi_Menu_End (progs_t *pr)
|
||||
{
|
||||
|
@ -236,6 +245,7 @@ Menu_Init (void)
|
|||
PR_AddBuiltin (&menu_pr_state, "Menu_CenterPic", bi_Menu_CenterPic, -1);
|
||||
PR_AddBuiltin (&menu_pr_state, "Menu_Item", bi_Menu_Item, -1);
|
||||
PR_AddBuiltin (&menu_pr_state, "Menu_Cursor", bi_Menu_Cursor, -1);
|
||||
PR_AddBuiltin (&menu_pr_state, "Menu_KeyEvent", bi_Menu_KeyEvent, -1);
|
||||
PR_AddBuiltin (&menu_pr_state, "Menu_End", bi_Menu_End, -1);
|
||||
|
||||
R_Progs_Init (&menu_pr_state);
|
||||
|
@ -333,6 +343,14 @@ Menu_KeyEvent (knum_t key, short unicode, qboolean down)
|
|||
{
|
||||
if (!menu)
|
||||
return;
|
||||
if (menu->keyevent) {
|
||||
G_INT (&menu_pr_state, OFS_PARM0) = key;
|
||||
G_INT (&menu_pr_state, OFS_PARM1) = unicode;
|
||||
G_INT (&menu_pr_state, OFS_PARM2) = down;
|
||||
PR_ExecuteProgram (&menu_pr_state, menu->keyevent);
|
||||
if (G_INT (&menu_pr_state, OFS_RETURN))
|
||||
return;
|
||||
}
|
||||
switch (key) {
|
||||
case QFK_DOWN:
|
||||
case QFM_WHEEL_DOWN:
|
||||
|
|
|
@ -32,6 +32,7 @@ static const char rcsid[] =
|
|||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
|
@ -67,8 +68,8 @@ Q_strnlen (const char *s, size_t maxlen)
|
|||
}
|
||||
|
||||
#ifdef HAVE__VSNPRINTF
|
||||
void
|
||||
Q_snprintfz (char *dest, size_t size, char *fmt, ...)
|
||||
size_t
|
||||
Q_snprintfz (char *dest, size_t size, const char *fmt, ...)
|
||||
{
|
||||
int len;
|
||||
va_list argptr;
|
||||
|
@ -78,10 +79,11 @@ Q_snprintfz (char *dest, size_t size, char *fmt, ...)
|
|||
va_end (argptr);
|
||||
if (len < 0) // the string didn't fit into the buffer
|
||||
dest[size - 1] = 0;
|
||||
return len;
|
||||
}
|
||||
|
||||
void
|
||||
Q_vsnprintfz (char *dest, size_t size, va_list argptr)
|
||||
size_t
|
||||
Q_vsnprintfz (char *dest, size_t size, const char *fmt, va_list argptr)
|
||||
{
|
||||
int len;
|
||||
|
||||
|
@ -89,5 +91,6 @@ Q_vsnprintfz (char *dest, size_t size, va_list argptr)
|
|||
|
||||
if (len < 0) // the string didn't fit into the buffer
|
||||
dest[size - 1] = 0;
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -60,6 +60,7 @@ static const char rcsid[] =
|
|||
#include "QF/GL/qf_vid.h"
|
||||
#include "QF/GL/types.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "r_cvar.h"
|
||||
#include "r_shared.h"
|
||||
#include "sbar.h"
|
||||
|
|
|
@ -58,7 +58,6 @@ cvar_t *joy_sensitivity; // Joystick sensitivity
|
|||
#define JOY_ABSOLUTE_AXIS 0x00000000 // control like a joystick
|
||||
#define JOY_RELATIVE_AXIS 0x00000010 // control like a mouse, spinner,
|
||||
// trackball
|
||||
#define JOY_MAX_AXES 6 // X, Y, Z, R, U, V
|
||||
#define JOY_AXIS_X 0
|
||||
#define JOY_AXIS_Y 1
|
||||
#define JOY_AXIS_Z 2
|
||||
|
|
|
@ -752,7 +752,7 @@ VID_InitFullDIB (HINSTANCE hInstance)
|
|||
modelist[nummodes].fullscreen = 1;
|
||||
modelist[nummodes].bpp = devmode.dmBitsPerPel;
|
||||
snprintf (modelist[nummodes].modedesc,
|
||||
sizeof (modelist[nummodes].modedesc), "%dx%dx%d",
|
||||
sizeof (modelist[nummodes].modedesc), "%ldx%ldx%ld",
|
||||
devmode.dmPelsWidth, devmode.dmPelsHeight,
|
||||
devmode.dmBitsPerPel);
|
||||
|
||||
|
@ -813,7 +813,7 @@ VID_InitFullDIB (HINSTANCE hInstance)
|
|||
modelist[nummodes].fullscreen = 1;
|
||||
modelist[nummodes].bpp = devmode.dmBitsPerPel;
|
||||
snprintf (modelist[nummodes].modedesc,
|
||||
sizeof (modelist[nummodes].modedesc), "%dx%dx%d",
|
||||
sizeof (modelist[nummodes].modedesc), "%ldx%ldx%ld",
|
||||
devmode.dmPelsWidth, devmode.dmPelsHeight,
|
||||
devmode.dmBitsPerPel);
|
||||
|
||||
|
@ -953,7 +953,8 @@ VID_Init (unsigned char *palette)
|
|||
modelist[nummodes].fullscreen = 1;
|
||||
modelist[nummodes].bpp = bpp;
|
||||
snprintf (modelist[nummodes].modedesc,
|
||||
sizeof (modelist[nummodes].modedesc), "%dx%dx%d",
|
||||
sizeof (modelist[nummodes].modedesc),
|
||||
"%ldx%ldx%ld",
|
||||
devmode.dmPelsWidth, devmode.dmPelsHeight,
|
||||
devmode.dmBitsPerPel);
|
||||
|
||||
|
|
|
@ -179,8 +179,7 @@ nq_x11_DEPENDENCIES= $(nq_x11_libs)
|
|||
|
||||
opengl_QFLIBS= \
|
||||
$(top_builddir)/libs/video/renderer/libQFrenderer_gl.la \
|
||||
$(top_builddir)/libs/models/libQFmodels_gl.la \
|
||||
$(top_builddir)/libs/video/targets/libQFglx.la
|
||||
$(top_builddir)/libs/models/libQFmodels_gl.la
|
||||
|
||||
# ... Linux 3DFX
|
||||
nq_3dfx_libs= \
|
||||
|
|
|
@ -136,7 +136,7 @@ WINS_GetLocalAddress ()
|
|||
myAddr = *(int *) local->h_addr_list[0];
|
||||
|
||||
addr = ntohl (myAddr);
|
||||
snprintf (my_tcpip_address, sizeof (my_tcpip_address), "%d.%d.%d.%d",
|
||||
snprintf (my_tcpip_address, sizeof (my_tcpip_address), "%ld.%ld.%ld.%ld",
|
||||
(addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff,
|
||||
addr & 0xff);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue