Jason Nelson's patch for fixing Win32 targets

This commit is contained in:
Dan Olson 2000-02-20 21:19:50 +00:00
parent 2afdb1db5f
commit 8ac1385c9f
38 changed files with 687 additions and 55 deletions

View file

@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef WIN32
#pragma warning(disable:4305)
#endif
{-0.525731, 0.000000, 0.850651},
{-0.442863, 0.238856, 0.864188},
{-0.295242, 0.000000, 0.955423},

View file

@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//char *date = "Dec 21 1999";
//char *time = "00:00:00";
char *date = __DATE__ ;
char *time = __TIME__ ;
char *ddate = __DATE__ ;
char *dtime = __TIME__ ;
char *mon[12] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };

View file

@ -27,6 +27,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef HAVE_MMSYSTEM_H
# include <mmsystem.h>
#endif
#include <cdaudio.h>
#include "qtypes.h"
#include "quakedef.h"
#include "keys.h"
#include "client.h"
#include "sys.h"
#include "console.h"
#include "cvar.h"
#include <cmd.h>
extern HWND mainwindow;
extern cvar_t bgmvolume;
@ -110,6 +120,125 @@ static int CDAudio_GetAudioDiskInfo(void)
return 0;
}
#define CD_f_DEFINED
void CD_f (void)
{
char *command;
int ret;
int n;
int startAddress;
if (Cmd_Argc() < 2)
return;
command = Cmd_Argv (1);
if (Q_strcasecmp(command, "on") == 0)
{
enabled = true;
return;
}
if (Q_strcasecmp(command, "off") == 0)
{
if (playing)
CDAudio_Stop();
enabled = false;
return;
}
if (Q_strcasecmp(command, "reset") == 0)
{
enabled = true;
if (playing)
CDAudio_Stop();
for (n = 0; n < 100; n++)
remap[n] = n;
CDAudio_GetAudioDiskInfo();
return;
}
if (Q_strcasecmp(command, "remap") == 0)
{
ret = Cmd_Argc() - 2;
if (ret <= 0)
{
for (n = 1; n < 100; n++)
if (remap[n] != n)
Con_Printf(" %u -> %u\n", n, remap[n]);
return;
}
for (n = 1; n <= ret; n++)
remap[n] = Q_atoi(Cmd_Argv (n+1));
return;
}
if (Q_strcasecmp(command, "close") == 0)
{
CDAudio_CloseDoor();
return;
}
if (!cdValid)
{
CDAudio_GetAudioDiskInfo();
if (!cdValid)
{
Con_Printf("No CD in player.\n");
return;
}
}
if (Q_strcasecmp(command, "play") == 0)
{
CDAudio_Play((byte)Q_atoi(Cmd_Argv (2)), false);
return;
}
if (Q_strcasecmp(command, "loop") == 0)
{
CDAudio_Play((byte)Q_atoi(Cmd_Argv (2)), true);
return;
}
if (Q_strcasecmp(command, "stop") == 0)
{
CDAudio_Stop();
return;
}
if (Q_strcasecmp(command, "pause") == 0)
{
CDAudio_Pause();
return;
}
if (Q_strcasecmp(command, "resume") == 0)
{
CDAudio_Resume();
return;
}
if (Q_strcasecmp(command, "eject") == 0)
{
if (playing)
CDAudio_Stop();
CDAudio_Eject();
cdValid = false;
return;
}
if (Q_strcasecmp(command, "info") == 0)
{
Con_Printf("%u tracks\n", maxTrack);
if (playing)
Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack);
else if (wasPlaying)
Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack);
Con_Printf("Volume is %f\n", cdvolume);
return;
}
}
void CDAudio_Play(byte track, qboolean looping)
{

View file

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <quakedef.h>
#ifdef HAVE_STRING_H
#include <string.h>

View file

@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <strings.h>
#endif
#if defined(_WIN32) && !defined(WINDED)
#if defined(_WIN32) && !defined(WINDED) && !defined(GLQUAKE)
void VID_LockBuffer (void);
void VID_UnlockBuffer (void);
#else

View file

@ -38,6 +38,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#include <string.h>
#if !defined(HAVE_SNPRINTF) && defined(HAVE__SNPRINTF)
# define snprintf _snprintf
#endif
cvar_t *cvar_vars;
char *cvar_null_string = "";

View file

@ -297,27 +297,59 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
trivertx_t *verts;
char cache[MAX_QPATH], fullpath[MAX_OSPATH];
QFile *f;
long modelcrc = 0;
qboolean fCacheSynced = false;
aliasmodel = m;
paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m);
modelcrc = m->numclipnodes +
m->numedges +
m->numframes +
m->numleafs +
m->nummarksurfaces +
m->nummodelsurfaces +
m->numnodes +
m->numplanes +
m->numsubmodels +
m->numsurfaces +
m->numsurfedges +
m->numtexinfo +
m->numtextures +
m->numvertexes;
//
// look for a cached version
//
strcpy (cache, "glquake/");
COM_StripExtension (m->name+strlen("progs/"), cache+strlen("glquake/"));
strcat (cache, ".ms2");
strcat (cache, ".ms3");
COM_FOpenFile (cache, &f);
if (f)
{
Qread (f, &numcommands, 4);
Qread (f, &numorder, 4);
Qread (f, commands, numcommands * sizeof(commands[0]));
Qread (f, vertexorder, numorder * sizeof(vertexorder[0]));
Qclose (f);
byte sig[2];
long cachecrc;
Qread (f, sig, sizeof(sig));
Qread (f, &cachecrc, sizeof(cachecrc));
if ((memcmp(sig, "QF", sizeof("QF")) != 0) ||
cachecrc != modelcrc)
{
Con_Printf ("Mismatched mesh on model %s\n",m->name);
}
else
{
Qread (f, &numcommands, 4);
Qread (f, &numorder, 4);
Qread (f, commands, numcommands * sizeof(commands[0]));
Qread (f, vertexorder, numorder * sizeof(vertexorder[0]));
Qclose (f);
fCacheSynced = 1;
}
}
else
if (!fCacheSynced)
{
//
// build it from scratch
@ -343,6 +375,10 @@ void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr)
if (f)
{
byte sig[2];
memcpy(sig, "QF", sizeof("QF"));
Qwrite(f, sig, sizeof(sig));
Qwrite(f, &modelcrc, sizeof(modelcrc));
Qwrite(f, &numcommands, 4);
Qwrite(f, &numorder, 4);
Qwrite(f, commands, numcommands * sizeof(commands[0]));

View file

@ -26,6 +26,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h"
#include "resource.h"
#include <commctrl.h>
#include "sys.h"
#include "vid.h"
#include "glquake.h"
#include "keys.h"
#include "screen.h"
#include "plugin.h"
#define MAX_MODE_LIST 30
#define VID_ROW_SIZE 3
@ -1575,6 +1581,10 @@ void VID_Init (unsigned char *palette)
HDC hdc;
DEVMODE devmode;
plugin_load("input");
IN->Init();
S_Init();
memset(&devmode, 0, sizeof(devmode));

View file

@ -47,11 +47,11 @@
#include <sound.h>
#include <cdaudio.h>
#include <keys.h>
#include <menu.h>
#include <draw.h>
#include <screen.h>
#include <sbar.h>
#include <mathlib.h>
#include <menu.h>
extern int host_hunklevel;

View file

@ -29,6 +29,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#include <dinput.h>
//#include "dosisms.h"
#include "client.h"
#include <cmd.h>
#include <console.h>
#include <qargs.h>
#include <lib_replace.h>
#include <keys.h>
#define DINPUT_BUFFERSIZE 16
#define iDirectInputCreate(a,b,c,d) pDirectInputCreate(a,b,c,d)

View file

@ -23,9 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <math.h>
#include "qtypes.h"
#include "quakedef.h"
#include "mathlib.h"
#include <qtypes.h>
#include <quakedef.h>
#include <mathlib.h>
#include "model.h"
void Sys_Error (char *error, ...);

View file

@ -29,12 +29,17 @@
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
*/
#include <string.h>
#include <stdio.h>
#ifndef WIN32
#include <dlfcn.h>
#include <stdlib.h>
#include <sys/param.h>
#else
#define LIBDIR ""
#include "input.h"
#endif
#include <stdlib.h>
#include <config.h>
#include <net.h>
@ -43,6 +48,10 @@
cvar_t drv_path = {"drv_path", ".:" LIBDIR "/quakeforge"};
input_pi *IN;
#ifndef WIN32
void *_plugin_load(const char *filename)
{
void *h;
@ -105,3 +114,30 @@ void plugin_unload(void *handle)
dlclose(handle);
}
#else
input_pi Winput;
int IN_Init();
void IN_Move(usercmd_t *);
void IN_Commands();
void Sys_SendKeyEvents();
void IN_Shutdown (void);
int plugin_load(char *filename)
{
IN = &Winput;
Winput.description = "Windows Input";
Winput.Init = IN_Init;
Winput.Move = IN_Move;
Winput.Commands = IN_Frame;
Winput.SendKeyEvents = IN_SendKeyEvents;
Winput.Shutdown = IN_Shutdown;
return 1;
}
void plugin_unload(void *handle)
{
}
#endif

View file

@ -26,6 +26,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <net.h>
// Input plugin interface.
typedef struct
{
void *handle;
char *filename;
char *description;
int (*Init)();
void (*Shutdown)();
void (*Commands)();
void (*SendKeyEvents)();
void (*Move)(usercmd_t *);
} input_pi;
#ifdef WIN32
#ifdef IN
#undef IN
#endif
#endif
extern input_pi *IN;
int plugin_load(char *filename);
void plugin_unload(void *handle);

View file

@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <cmd.h>
#include <console.h>
#include <client.h>
#include "lib_replace.h"
usercmd_t nullcmd; // guarenteed to be zero
@ -89,7 +90,7 @@ void COM_InitArgv (int argc, char **argv)
for (com_argc=0, len=0 ; com_argc < argc ; com_argc++)
{
largv[com_argc] = argv[com_argc];
if (!Q_strcmp ("-safe", argv[com_argc]))
if ((argv[com_argc]) && !Q_strcmp ("-safe", argv[com_argc]))
safe = true;
len += strlen (argv[com_argc]) + 1;
}

View file

@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <qtypes.h>
#include <quakefs.h>
@ -33,6 +35,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <zone.h>
#include <common.h>
#include <draw.h>
#ifdef WIN32
#include <io.h>
#endif
/*
All of Quake's data access is through a hierchal file system, but the contents of the file system can be transparently merged from several sources.

View file

@ -2,6 +2,10 @@
#include <stdarg.h>
#include <stdlib.h>
#include "quakeio.h"
#ifdef WIN32
#include <io.h>
#include <fcntl.h>
#endif
QFile *Qopen(const char *path, const char *mode)
{
@ -53,6 +57,7 @@ QFile *Qdopen(int fd, const char *mode)
}
*p++=*mode;
}
*p=0;
file=calloc(sizeof(*file),1);
@ -74,6 +79,9 @@ QFile *Qdopen(int fd, const char *mode)
return 0;
}
}
#ifdef WIN32
_setmode(_fileno(file->file),_O_BINARY);
#endif
return file;
}
@ -129,7 +137,7 @@ int Qprintf(QFile *file, const char *fmt, ...)
#else
(void)vsprintf(buf, fmt, args);
#endif
va_end(va);
va_end(args);
ret = strlen(buf); /* some *sprintf don't return the nb of bytes written */
if (ret>0)
ret=gzwrite(file, buf, (unsigned)ret);

View file

@ -6,6 +6,8 @@
#include "config.h"
#ifdef HAS_ZLIB
#include <zlib.h>
#else
#include <nozip.h>
#endif
typedef struct {

View file

@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "cvar.h"
#include "client.h"
#include "console.h"
#include "client.h"
cvar_t baseskin = {"baseskin", "base"};
cvar_t noskins = {"noskins", "0"};
@ -242,8 +243,10 @@ void Skin_NextDownload (void)
Skin_Find (sc);
if (noskins.value)
continue;
#ifndef UQUAKE
if (!CL_CheckOrDownloadFile(va("skins/%s.pcx", sc->skin->name)))
return; // started a download
#endif
}
cls.downloadtype = dl_none;

View file

@ -25,6 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# include <mmsystem.h>
#endif
#include "config.h"
#include "qtypes.h"
#include "sound.h"
#include "qargs.h"
#include "console.h"
#include <sound.h>
#ifdef HAVE_DSOUND
#define iDirectSoundCreate(a,b,c) pDirectSoundCreate(a,b,c)

View file

@ -27,6 +27,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_local.h"
#include "resource.h"
#include <mgraph.h>
#include <screen.h>
#include <view.h>
#include <cmd.h>
#include <keys.h>
#include <cdaudio.h>
#include <lib_replace.h>
#include <sound.h>
#include <keys.h>
#include <cvar.h>
#include <menu.h>
#include <sys.h>
#include <lib_replace.h>
#include <draw.h>
#include <console.h>
#include <client.h>
#include <screen.h>
#include "plugin.h"
#ifndef CDS_FULLSCREEN
# define CDS_FULLSCREEN 0x00000004
@ -2108,6 +2126,10 @@ void VID_Init (unsigned char *palette)
int basenummodes;
byte *ptmp;
plugin_load("input");
IN->Init();
Cvar_RegisterVariable (&vid_mode);
Cvar_RegisterVariable (&vid_wait);
Cvar_RegisterVariable (&vid_nopageflip);

View file

@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakefs.h"
#include "qendian.h"
#include "sys.h"
#include "console.h"
int wad_numlumps;
lumpinfo_t *wad_lumps;
@ -65,7 +66,59 @@ void W_CleanupName (char *in, char *out)
out[i] = 0;
}
#ifndef QUAKEWORLD
/*
====================
W_OpenWadFile
====================
*/
wadfile_t * W_OpenWadFile (char *filename)
{
lumpinfo_t *lump_p;
wadinfo_t header;
unsigned i;
int infotableofs;
int wadhandle;
wadfile_t *wadfile = NULL;
wadfile = Hunk_Alloc (sizeof(wadfile_t));
if (!wadfile)
Sys_Error ("W_LoadWadFile: couldn't allocate wadfile.n");
if (Sys_FileOpenRead (filename, &wadhandle) == -1)
{
return NULL;
}
Sys_FileRead(wadhandle, (void *)&header, sizeof(header));
if (header.identification[0] != 'W'
|| header.identification[1] != 'A'
|| header.identification[2] != 'D'
|| header.identification[3] != '2')
Sys_Error ("Wad file %s doesn't have WAD2 id\n",filename);
wadfile->wad_numlumps = LittleLong(header.numlumps);
infotableofs = LittleLong(header.infotableofs);
wadfile->wad_lumps = (lumpinfo_t *)Hunk_Alloc(sizeof(lumpinfo_t) * wadfile->wad_numlumps);
Sys_FileSeek (wadhandle, infotableofs);
Sys_FileRead (wadhandle, wadfile->wad_lumps, (sizeof(lumpinfo_t) * wadfile->wad_numlumps));
for (i=0, lump_p = wadfile->wad_lumps ; i<wadfile->wad_numlumps ; i++,lump_p++)
{
lump_p->filepos = LittleLong(lump_p->filepos);
lump_p->size = LittleLong(lump_p->size);
W_CleanupName (lump_p->name, lump_p->name);
if (lump_p->type == TYP_QPIC)
SwapPic ( (qpic_t *)(wadfile->wad_base + lump_p->filepos));
}
Con_Printf("Added WAD file %s.\n", filename);
wadfile->wad_handle = wadhandle;
return (wadfile);
}
#endif
/*
====================
@ -79,6 +132,8 @@ void W_LoadWadFile (char *filename)
unsigned i;
int infotableofs;
FILE *f = fopen("debug.log", "w");
wad_base = COM_LoadHunkFile (filename);
if (!wad_base)
Sys_Error ("W_LoadWadFile: couldn't load %s", filename);
@ -95,14 +150,19 @@ void W_LoadWadFile (char *filename)
infotableofs = LittleLong(header->infotableofs);
wad_lumps = (lumpinfo_t *)(wad_base + infotableofs);
for (i=0, lump_p = wad_lumps ; i<wad_numlumps ; i++,lump_p++)
{
lump_p->filepos = LittleLong(lump_p->filepos);
lump_p->size = LittleLong(lump_p->size);
W_CleanupName (lump_p->name, lump_p->name);
fprintf(f, "%i: %s\n", i, lump_p->name);
if (lump_p->type == TYP_QPIC)
SwapPic ( (qpic_t *)(wad_base + lump_p->filepos));
}
fclose(f);
}
@ -116,9 +176,9 @@ lumpinfo_t *W_GetLumpinfo (char *name)
int i;
lumpinfo_t *lump_p;
char clean[16];
W_CleanupName (name, clean);
for (lump_p=wad_lumps, i=0 ; i<wad_numlumps ; i++,lump_p++)
{
if (!strcmp(clean, lump_p->name))
@ -126,6 +186,7 @@ lumpinfo_t *W_GetLumpinfo (char *name)
}
Sys_Error ("W_GetLumpinfo: %s not found", name);
return NULL;
}

View file

@ -67,6 +67,16 @@ typedef struct
char name[16]; // must be null terminated
} lumpinfo_t;
typedef struct
{
int wad_numlumps;
lumpinfo_t *wad_lumps;
byte *wad_base;
int wad_handle;
}wadfile_t;
wadfile_t * W_OpenWadFile (char *filename);
extern int wad_numlumps;
extern lumpinfo_t *wad_lumps;
extern byte *wad_base;

View file

@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sbar.h"
#include "menu.h"
#include "draw.h"
#include <client.h>
extern byte *draw_chars; // 8*8 graphic characters

View file

@ -34,10 +34,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "screen.h"
#include "sbar.h"
#include "menu.h"
#include "sound.h"
#include "sound.h"
#include <plugin.h>
#include "mathlib.h"
#include <input.h>
#include <time.h>
#include <client.h>
/*

View file

@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <input.h>
#include <time.h>
#include <mathlib.h>
/*

View file

@ -24,9 +24,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "winquake.h"
#include "resource.h"
#include "sys.h"
#include "screen.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <io.h>
#define MINIMUM_WIN_MEMORY 0x0c00000
#define MAXIMUM_WIN_MEMORY 0x1000000
@ -78,6 +82,140 @@ FILE IO
===============================================================================
*/
/*
===============================================================================
FILE IO
===============================================================================
*/
#define MAX_HANDLES 10
FILE *sys_handles[MAX_HANDLES];
int findhandle (void)
{
int i;
for (i=1 ; i<MAX_HANDLES ; i++)
if (!sys_handles[i])
return i;
Sys_Error ("out of handles");
return -1;
}
/*
================
filelength
================
*/
int wfilelength (FILE *f)
{
int pos;
int end;
int t;
t = VID_ForceUnlockedAndReturnState ();
pos = ftell (f);
fseek (f, 0, SEEK_END);
end = ftell (f);
fseek (f, pos, SEEK_SET);
VID_ForceLockState (t);
return end;
}
int Sys_FileOpenRead (char *path, int *hndl)
{
FILE *f;
int i, retval;
int t;
t = VID_ForceUnlockedAndReturnState ();
i = findhandle ();
f = fopen(path, "rb");
if (!f)
{
*hndl = -1;
retval = -1;
}
else
{
sys_handles[i] = f;
*hndl = i;
retval = wfilelength(f);
}
VID_ForceLockState (t);
return retval;
}
int Sys_FileOpenWrite (char *path)
{
FILE *f;
int i;
int t;
t = VID_ForceUnlockedAndReturnState ();
i = findhandle ();
f = fopen(path, "wb");
if (!f)
Sys_Error ("Error opening %s: %s", path,strerror(errno));
sys_handles[i] = f;
VID_ForceLockState (t);
return i;
}
void Sys_FileClose (int handle)
{
int t;
t = VID_ForceUnlockedAndReturnState ();
fclose (sys_handles[handle]);
sys_handles[handle] = NULL;
VID_ForceLockState (t);
}
void Sys_FileSeek (int handle, int position)
{
int t;
t = VID_ForceUnlockedAndReturnState ();
fseek (sys_handles[handle], position, SEEK_SET);
VID_ForceLockState (t);
}
int Sys_FileRead (int handle, void *dest, int count)
{
int t, x;
t = VID_ForceUnlockedAndReturnState ();
x = fread (dest, 1, count, sys_handles[handle]);
VID_ForceLockState (t);
return x;
}
int Sys_FileWrite (int handle, void *data, int count)
{
int t, x;
t = VID_ForceUnlockedAndReturnState ();
x = fwrite (data, 1, count, sys_handles[handle]);
VID_ForceLockState (t);
return x;
}
#if 0
/*
================
@ -106,6 +244,13 @@ SYSTEM IO
===============================================================================
*/
/*void MaskExceptions (void)
{
}
void Sys_SetFPCW (void)
{
}*/
/*
================
@ -438,7 +583,7 @@ void Sys_Sleep (void)
}
void Sys_SendKeyEvents (void)
void IN_SendKeyEvents (void)
{
MSG msg;
@ -616,12 +761,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
while (1)
{
// yield the CPU for a little while when paused, minimized, or not the focus
if ((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing)
/* if ((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing)
{
SleepUntilInput (PAUSE_SLEEP);
scr_skipupdate = 1; // no point in bothering to draw
}
else if (!ActiveApp && !DDActive)
else*/ if (!ActiveApp && !DDActive)
{
SleepUntilInput (NOT_FOCUS_SLEEP);
}
@ -636,3 +781,33 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
return TRUE;
}
/*
================
SV_Error
Sends a datagram to all the clients informing them of the server crash,
then exits
================
*/
void SV_Error (char *error, ...)
{
va_list argptr;
static char string[1024];
static qboolean inerror = false;
if (inerror)
Sys_Error ("SV_Error: recursively entered (%s)", string);
inerror = true;
va_start (argptr, error);
vsnprintf (string, sizeof(string), error, argptr);
va_end (argptr);
Con_Printf ("SV_Error: %s\n",string);
//SV_FinalMessage (va("server crashed: %s\n", string));
Sys_Error ("SV_Error: %s\n",string);
}

View file

@ -71,16 +71,16 @@ BEGIN
167,28
END
IDD_PROGRESS DIALOGEX 0, 0, 333, 75
IDD_PROGRESS DIALOGEX 0, 0, 335, 75
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP |
WS_VISIBLE
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
FONT 8, "MS Sans Serif", 0, 0, 0x1
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Creating 15 bit inverse palette. This is only done once, so just be patient for the next 30-60 seconds.",
IDC_STATIC,7,51,319,10
CONTROL 112,IDC_STATIC,"Static",SS_BITMAP | SS_REALSIZEIMAGE,0,0,
333,49
335,49
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,61,
319,11
END
@ -91,7 +91,7 @@ END
// Bitmap
//
IDB_QWBITMAP BITMAP DISCARDABLE "quakeworld.bmp"
IDB_QWBITMAP BITMAP DISCARDABLE "qwcl.bmp"
/////////////////////////////////////////////////////////////////////////////
//
@ -117,7 +117,7 @@ END
STRINGTABLE DISCARDABLE
BEGIN
IDS_STRING1 "WinQuake"
IDS_STRING1 "QuakeForge"
END
#endif // English (U.S.) resources

View file

@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_IOCTL_H

View file

@ -33,6 +33,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <protocol.h>
#include <server.h>
#include <mathlib.h>
#include <quakedef.h>
#include <quakedef.h>
model_t *loadmodel;
char loadname[32]; // for hunk tags

View file

@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include "sys.h"
#include <quakedef.h>
#include <qtypes.h>
@ -722,7 +724,7 @@ void SVC_DirectConnect (void)
if (newcl->spectator)
Con_Printf ("Spectator %s connected\n", newcl->name);
else
Con_DPrintf ("Client %s connected\n", newcl->name);
Con_Printf ("Client %s connected\n", newcl->name);
newcl->sendinfo = true;
// QuakeForge stuff.

View file

@ -21,10 +21,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/types.h>
#include <sys/timeb.h>
#include "qwsvdef.h"
//#include "qwsvdef.h"
#include <winsock.h>
#include <conio.h>
#include "quakedef.h"
#include <qtypes.h>
#include <sys.h>
#include <common.h>
#include <lib_replace.h>
#include <client.h>
extern cvar_t sys_nostdout;

View file

@ -36,9 +36,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sound.h>
#include <screen.h>
#include <menu.h>
#include <mathlib.h>
#include <input.h>
#include <plugin.h>
#include <time.h>
/*

View file

@ -29,6 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys.h>
#include <mathlib.h>
#include <console.h>
#include <quakefs.h>
model_t *loadmodel;
char loadname[32]; // for hunk tags
@ -351,6 +352,48 @@ model_t *Mod_ForName (char *name, qboolean crash)
byte *mod_base;
int Mod_LoadExternalTexture(int number, char *texturename)
{
int j, pixels;
miptex_t *mt;
texture_t *tx;
char texturepathname[1024];
if (texturename[0] == '\0')
return (0);
sprintf(texturepathname, "/id1/gfx/%s", texturename);
mt = (miptex_t *)COM_LoadHunkFile(texturepathname);
if (!mt)
{
return (0);
}
mt->width = LittleLong (mt->width);
mt->height = LittleLong (mt->height);
for (j=0 ; j<MIPLEVELS ; j++)
mt->offsets[j] = LittleLong (mt->offsets[j]);
if ( (mt->width & 15) || (mt->height & 15) )
Sys_Error ("Texture %s is not 16 aligned", mt->name);
pixels = mt->width*mt->height/64*85;
tx = Hunk_AllocName (sizeof(texture_t) +pixels, loadname );
loadmodel->textures[number] = tx;
memcpy (tx->name, mt->name, sizeof(tx->name));
tx->width = mt->width;
tx->height = mt->height;
for (j=0 ; j<MIPLEVELS ; j++)
tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t);
// the pixels immediately follow the structures
memcpy ( tx+1, mt+1, pixels);
if (!Q_strncmp(mt->name,"sky",3))
R_InitSky (tx);
return (1);
}
/*
=================
@ -386,6 +429,12 @@ void Mod_LoadTextures (lump_t *l)
mt = (miptex_t *)((byte *)m + m->dataofs[i]);
mt->width = LittleLong (mt->width);
mt->height = LittleLong (mt->height);
if (mt->height == -1 && mt->width == -1)
{
if (Mod_LoadExternalTexture(i, mt->name));
continue;
}
for (j=0 ; j<MIPLEVELS ; j++)
mt->offsets[j] = LittleLong (mt->offsets[j]);

View file

@ -23,6 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "winquake.h"
#include "net_loop.h"
#include "net_dgrm.h"
#include "net_ser.h"
#include "lib_replace.h"
#include "console.h"
#include "sys.h"
extern cvar_t hostname;
#define MAXHOSTNAMELEN 256

View file

@ -24,6 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "winquake.h"
#include <wsipx.h>
#include "net_wipx.h"
#include "net.h"
#include "console.h"
#include "lib_replace.h"
#include "sys.h"
extern cvar_t hostname;

View file

@ -38,9 +38,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <lib_replace.h>
#include <menu.h>
#include <view.h>
#include <mathlib.h>
#include <input.h>
#include <plugin.h>
#include <time.h>
/*

View file

@ -23,6 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include "winquake.h"
#include "resource.h"
#include "sys.h"
#include "screen.h"
#include "qargs.h"
#include "console.h"
#include "lib_replace.h"
#include "conproc.h"
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@ -62,6 +69,20 @@ void Sys_PopFPCW (void);
volatile int sys_checksum;
void Sys_DebugLog(char *file, char *fmt, ...)
{
va_list argptr;
static char data[1024];
int fd;
va_start(argptr, fmt);
vsnprintf(data, sizeof(data), fmt, argptr);
va_end(argptr);
fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write(fd, data, strlen(data));
close(fd);
};
/*
================
Sys_PageIn
@ -110,13 +131,12 @@ int findhandle (void)
return -1;
}
#if 0
/*
================
filelength
================
*/
int filelength (QFile *f)
int wfilelength (QFile *f)
{
int pos;
int end;
@ -133,7 +153,6 @@ int filelength (QFile *f)
return end;
}
#endif
int Sys_FileOpenRead (char *path, int *hndl)
{
@ -156,7 +175,7 @@ int Sys_FileOpenRead (char *path, int *hndl)
{
sys_handles[i] = f;
*hndl = i;
retval = filelength(f);
retval = wfilelength(f);
}
VID_ForceLockState (t);
@ -246,11 +265,9 @@ void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
}
#ifndef _M_IX86
#if 0
void Sys_SetFPCW (void)
{
}
void Sys_PushFPCW_SetHigh (void)
{
@ -260,9 +277,6 @@ void Sys_PopFPCW (void)
{
}
void MaskExceptions (void)
{
}
#endif
@ -601,7 +615,7 @@ void Sys_Sleep (void)
}
void Sys_SendKeyEvents (void)
void IN_SendKeyEvents (void)
{
MSG msg;
@ -832,12 +846,12 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
else
{
// yield the CPU for a little while when paused, minimized, or not the focus
if ((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing)
/*if ((cl.paused && (!ActiveApp && !DDActive)) || Minimized || block_drawing)
{
SleepUntilInput (PAUSE_SLEEP);
scr_skipupdate = 1; // no point in bothering to draw
}
else if (!ActiveApp && !DDActive)
else */if (!ActiveApp && !DDActive)
{
SleepUntilInput (NOT_FOCUS_SLEEP);
}

View file

@ -61,12 +61,12 @@ IDI_ICON2 ICON DISCARDABLE "quake.ico"
// Dialog
//
IDD_DIALOG1 DIALOGEX 0, 0, 62, 21
IDD_DIALOG1 DIALOGEX 0, 0, 72, 21
STYLE DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_CENTER | WS_POPUP
EXSTYLE WS_EX_TOOLWINDOW | WS_EX_CLIENTEDGE
FONT 16, "Times New Roman", 0, 0, 0x1
FONT 16, "Times New Roman"
BEGIN
CTEXT "Starting Quake...",IDC_STATIC,4,6,54,8
CTEXT "Starting QuakeForge...",IDC_STATIC,4,6,64,8
END
IDD_PROGRESS DIALOGEX 0, 0, 333, 45
@ -79,7 +79,7 @@ BEGIN
IDC_STATIC,7,19,319,10
CONTROL "Progress1",IDC_PROGRESS,"msctls_progress32",0x0,7,29,
319,11
LTEXT "Starting Quake...",IDC_STATIC,7,4,54,8
LTEXT "Starting QuakeForge...",IDC_STATIC,7,4,72,8
END
@ -94,7 +94,7 @@ BEGIN
IDD_DIALOG1, DIALOG
BEGIN
LEFTMARGIN, 4
RIGHTMARGIN, 58
RIGHTMARGIN, 68
TOPMARGIN, 6
BOTTOMMARGIN, 16
HORZGUIDE, 6
@ -111,7 +111,7 @@ END
STRINGTABLE DISCARDABLE
BEGIN
IDS_STRING1 "WinQuake"
IDS_STRING1 "QuakeForge"
END
#endif // English (U.S.) resources