massive windows.h and WIN32 cleanup.

This commit is contained in:
Bill Currie 2001-10-16 21:40:45 +00:00
parent 8557d50235
commit 2d068c0745
19 changed files with 20 additions and 320 deletions

View file

@ -30,9 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif

View file

@ -39,9 +39,7 @@ static const char rcsid[] =
#include <stdlib.h>
#ifdef _WIN32
# include "winquake.h"
#endif
#include "winquake.h"
#include "QF/cmd.h"
#include "QF/cvar.h"
@ -171,9 +169,7 @@ SND_Startup (void)
rc = S_O_Init ();
if (!rc) {
#ifndef _WIN32
Sys_Printf ("S_Startup: S_O_Init failed.\n");
#endif
sound_started = 0;
return;
}

View file

@ -43,11 +43,7 @@ static const char rcsid[] =
#include "compat.h"
#ifdef _WIN32
# include "winquake.h"
#else
# define DWORD unsigned long
#endif
#include "winquake.h"
#define PAINTBUFFER_SIZE 512
portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE * 2];
@ -89,7 +85,7 @@ void
SND_TransferStereo16 (int endtime)
{
int lpaintedtime, lpos;
DWORD *pbuf;
unsigned long *pbuf;
snd_vol = volume->value * 256;
@ -109,7 +105,7 @@ SND_TransferStereo16 (int endtime)
#endif
#endif
{
pbuf = (DWORD *) shm->buffer;
pbuf = (unsigned long *) shm->buffer;
}
while (lpaintedtime < endtime) {
@ -144,7 +140,7 @@ SND_TransferPaintBuffer (int endtime)
{
int count, out_idx, out_mask, snd_vol, step, val;
int *p;
DWORD *pbuf;
unsigned long *pbuf;
if (shm->samplebits == 16 && shm->channels == 2) {
SND_TransferStereo16 (endtime);
@ -170,7 +166,7 @@ SND_TransferPaintBuffer (int endtime)
#endif
#endif
{
pbuf = (DWORD *) shm->buffer;
pbuf = (unsigned long *) shm->buffer;
}
if (shm->samplebits == 16) {

View file

@ -56,7 +56,7 @@ static const char rcsid[] =
# endif
#endif
#ifdef WIN32
#ifdef HAVE_IO_H
# include <io.h>
#endif

View file

@ -395,18 +395,10 @@ Hunk_AllocName (int size, const char *name)
size = sizeof (hunk_t) + ((size + 15) & ~15);
if (hunk_size - hunk_low_used - hunk_high_used < size)
// Sys_Error ("Hunk_Alloc: failed on %i bytes",size);
#ifdef _WIN32
Sys_Error
("Not enough RAM allocated. Try starting using "
"\"-heapsize 16000\" on the %s command line.",
PROGRAM);
#else
Sys_Error
("Not enough RAM allocated. Try starting using \"-mem 16\" on "
"the %s command line.",
PROGRAM);
#endif
h = (hunk_t *) (hunk_base + hunk_low_used);
hunk_low_used += size;

View file

@ -825,15 +825,6 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
if (scr_disabled_for_loading)
return;
#ifdef _WIN32
{ // don't suck up any cpu if minimized
extern qboolean Minimized;
if (Minimized)
return;
}
#endif
r_realtime = realtime;
scr_copytop = 0;

View file

@ -354,24 +354,6 @@ D_PolysetCalcGradients (int skinwidth)
// a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16);
}
#if 0
byte gelmap[256];
void
InitGel (byte * palette)
{
int i;
int r;
for (i = 0; i < 256; i++) {
// r = (palette[i*3]>>4);
r =
(palette[i * 3] + palette[i * 3 + 1] +
palette[i * 3 + 2]) / (16 * 3);
gelmap[i] = /* 64 */ 0 + r;
}
}
#endif
void
D_PolysetDrawSpans (spanpackage_t * pspanpackage)
@ -627,89 +609,6 @@ done32: ;
}
/*
D_PolysetFillSpans
*/
#if 0
void
D_PolysetFillSpans (spanpackage_t * pspanpackage)
{
int color, lcount;
switch(r_pixbytes)
{
case 1:
// FIXME: do z buffering
color = (d_aflatcolor++) & 0xFF;
while (1) {
int lcount;
byte *lpdest;
lcount = pspanpackage->count;
if (lcount == -1)
return;
if (lcount) {
lpdest = (byte *) d_viewbuffer + pspanpackage->pdest;
do {
*lpdest++ = color;
} while (--lcount);
}
pspanpackage++;
}
break;
case 2:
color = d_8to16table[(d_aflatcolor++) & 0xFF];
while (1) {
short *lpdest;
lcount = pspanpackage->count;
if (lcount == -1)
return;
if (lcount) {
lpdest = (short *) d_viewbuffer + pspanpackage->pdest;
do {
*lpdest++ = color;
} while (--lcount);
}
pspanpackage++;
}
break;
case 4:
color = d_8to24table[(d_aflatcolor++) & 0xFF];
while (1) {
int lcount;
int *lpdest;
lcount = pspanpackage->count;
if (lcount == -1)
return;
if (lcount) {
lpdest = (int *) d_viewbuffer + pspanpackage->pdest;
do {
*lpdest++ = color;
} while (--lcount);
}
pspanpackage++;
}
break;
default:
Sys_Error("D_PolysetFillSpans: unsupported r_pixbytes %i\n", r_pixbytes);
}
}
#endif
void
D_RasterizeAliasPolySmooth (void)
{
@ -926,79 +825,3 @@ D_PolysetSetEdgeTable (void)
pedgetable = &edgetables[edgetableindex];
}
#if 0
void
D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
{
int d;
int new[6];
int ofs;
d = lp2[0] - lp1[0];
if (d < -1 || d > 1)
goto split;
d = lp2[1] - lp1[1];
if (d < -1 || d > 1)
goto split;
return; // line is completed
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[4] = (lp1[4] + lp2[4]) >> 1;
// draw the point
ofs = d_scantable[new[1]] + new[0];
if (new[5] > d_pzbuffer[ofs]) {
int pix;
d_pzbuffer[ofs] = new[5];
pix = skintable[new[3] >> 16][new[2] >> 16];
// pix = ((byte *)acolormap)[pix + (new[4] & 0xFF00)];
d_viewbuffer[ofs] = pix;
}
// recursively continue
D_PolysetRecursiveDrawLine (lp1, new);
D_PolysetRecursiveDrawLine (new, lp2);
}
void
D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
{
int d;
int new[4];
d = lp2[0] - lp1[0];
if (d < -1 || d > 1)
goto split;
d = lp2[1] - lp1[1];
if (d < -1 || d > 1)
goto split;
return;
split:
// split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1;
new[4] = (lp1[4] + lp2[4]) >> 1;
D_PolysetRecursiveDrawLine (new, lp3);
// recursively continue
D_PolysetRecursiveTriangle (lp1, new, lp3);
D_PolysetRecursiveTriangle (new, lp2, lp3);
}
#endif

View file

@ -845,15 +845,6 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
if (scr_disabled_for_loading)
return;
#ifdef _WIN32
{ // don't suck up any cpu if minimized
extern qboolean Minimized;
if (Minimized)
return;
}
#endif
r_realtime = realtime;
scr_copytop = 0;

View file

@ -189,55 +189,6 @@ R_MakeSky (void)
default:
Sys_Error("R_MakeSky: unsupported r_pixbytes %i\n", r_pixbytes);
}
/*
int x, y;
int ofs, baseofs;
int xshift, yshift;
unsigned int *pnewsky;
static int xlast = -1, ylast = -1;
xshift = skytime * skyspeed;
yshift = skytime * skyspeed;
if ((xshift == xlast) && (yshift == ylast))
return;
xlast = xshift;
ylast = yshift;
pnewsky = (unsigned int *) &newsky[0];
for (y = 0; y < SKYSIZE; y++) {
baseofs = ((y + yshift) & SKYMASK) * 131;
// FIXME: clean this up
#if UNALIGNED_OK
for (x = 0; x < SKYSIZE; x += 4) {
ofs = baseofs + ((x + xshift) & SKYMASK);
// PORT: unaligned dword access to bottommask and bottomsky
*pnewsky = (*(pnewsky + (128 / sizeof (unsigned int))) &
*(unsigned int *) &bottommask[ofs]) |
*(unsigned int *) &bottomsky[ofs];
pnewsky++;
}
#else
for (x = 0; x < SKYSIZE; x++) {
ofs = baseofs + ((x + xshift) & SKYMASK);
*(byte *) pnewsky = (*((byte *) pnewsky + 128) &
*(byte *) & bottommask[ofs]) |
*(byte *) & bottomsky[ofs];
pnewsky = (unsigned int *) ((byte *) pnewsky + 1);
}
#endif
pnewsky += 128 / sizeof (unsigned int);
}
*/
r_skymade = 1;
}

View file

@ -46,12 +46,6 @@ static const char rcsid[] =
#include "compat.h"
#ifdef WIN32
// FIXME: this is evil...
# include <windows.h>
HWND mainwindow;
#endif
cvar_t *m_filter;
cvar_t *in_grab;

View file

@ -30,9 +30,6 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef _WIN32
# include <windows.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif

View file

@ -41,11 +41,6 @@ static const char rcsid[] =
# include <strings.h>
#endif
#ifdef _WIN32
// must be BEFORE include gl/gl.h
# include "winquake.h"
#endif
#include "QF/console.h"
#include "QF/cvar.h"
#include "QF/input.h"

View file

@ -76,8 +76,6 @@ int noconinput;
#ifdef _WIN32
# include "winquake.h"
// FIXME: minimized is not currently supported under SDL
qboolean Minimized = false;
void MaskExceptions (void);
#endif

View file

@ -379,11 +379,11 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (parms.memsize > MAXIMUM_WIN_MEMORY)
parms.memsize = MAXIMUM_WIN_MEMORY;
if (COM_CheckParm ("-heapsize")) {
t = COM_CheckParm ("-heapsize") + 1;
if (COM_CheckParm ("-mem")) {
t = COM_CheckParm ("-mem") + 1;
if (t < com_argc)
parms.memsize = atoi (com_argv[t]) * 1024;
parms.memsize = atoi (com_argv[t]) * 1024 * 1024;
}
parms.membase = malloc (parms.memsize);

View file

@ -77,9 +77,6 @@ int noconinput;
#ifdef _WIN32
# include "winquake.h"
// FIXME: minimized is not currently supported under SDL
qboolean Minimized = false;
void MaskExceptions (void);
#endif
void
@ -89,9 +86,6 @@ Sys_Init (void)
OSVERSIONINFO vinfo;
#endif
#ifdef USE_INTEL_ASM
#ifdef _WIN32
MaskExceptions ();
#endif
Sys_SetFPCW ();
#endif

View file

@ -366,11 +366,11 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (host_parms.memsize > MAXIMUM_WIN_MEMORY)
host_parms.memsize = MAXIMUM_WIN_MEMORY;
if (COM_CheckParm ("-heapsize")) {
t = COM_CheckParm ("-heapsize") + 1;
if (COM_CheckParm ("-mem")) {
t = COM_CheckParm ("-mem") + 1;
if (t < com_argc)
host_parms.memsize = atoi (com_argv[t]) * 1024;
host_parms.memsize = atoi (com_argv[t]) * 1024 * 1024;
}
host_parms.membase = malloc (host_parms.memsize);

View file

@ -30,12 +30,8 @@ static const char rcsid[] =
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifndef _WIN32
# ifdef HAVE_UNISTD_H
#ifdef HAVE_UNISTD_H
# include <unistd.h>
# endif
#else
# include <windows.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
@ -116,11 +112,7 @@ Netchan_Init (void)
int port;
// pick a port value that should be nice and random
#ifdef _WIN32
port = ((int) (timeGetTime () * 1000) * time (NULL)) & 0xffff;
#else
port = ((int) (getpid () + getuid () * 1000) * time (NULL)) & 0xffff;
#endif
port = rand () * (65536.0 / RAND_MAX);
Cvar_SetValue (qport, port);
}
@ -132,11 +124,11 @@ Netchan_Init_Cvars (void)
"Show all network packets");
showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, NULL, "Toggle the "
"display of how many packets you are dropping");
qport = Cvar_Get ("qport", "0", CVAR_NONE, NULL, "The internal port "
"number for the game networking code. Useful for "
"clients who use multiple connections through one "
"IP address (NAT/IP-MASQ) because default port is "
"random.");
qport = Cvar_Get ("qport", "0", CVAR_NONE, NULL, "The internal port "
"number for the game networking code. Useful for "
"clients who use multiple connections through one "
"IP address (NAT/IP-MASQ) because default port is "
"random.");
}
/*

View file

@ -136,9 +136,6 @@ main (int argc, const char **argv)
host_parms.memsize = 8 * 1024 * 1024;
if ((t = COM_CheckParm ("-heapsize")) != 0 && t + 1 < com_argc)
host_parms.memsize = atoi (com_argv[t + 1]) * 1024;
if ((t = COM_CheckParm ("-mem")) != 0 && t + 1 < com_argc)
host_parms.memsize = atoi (com_argv[t + 1]) * 1024 * 1024;

View file

@ -39,10 +39,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#ifdef WIN32
#include <direct.h>
#endif
#ifdef NeXT
#include <libc.h>
#endif