Merged render.h, to fix compile warnings..

No more compile warnings! A completely clean build on my system!
Wrapped all the unistd.h includes with #ifdef HAVE_UNISTD_H.
Seems like there is more, but that looks like it..
This commit is contained in:
Zephaniah E. Hull 2000-01-19 11:01:04 +00:00
parent 9f7c061fb0
commit 34391442c7
27 changed files with 58 additions and 300 deletions

View file

@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/file.h>

View file

@ -52,10 +52,6 @@ int cnttextures[2] = {-1, -1}; // cached
int particletexture; // little dot for particles
int playertextures; // up to 16 color translated skins
int mirrortexturenum; // quake texturenum, not gltexturenum
qboolean mirror;
mplane_t *mirror_plane;
//
// view origin
//
@ -88,7 +84,6 @@ cvar_t r_speeds = {"r_speeds","0"};
cvar_t r_fullbright = {"r_fullbright","0"};
cvar_t r_lightmap = {"r_lightmap","0"};
cvar_t r_shadows = {"r_shadows","0"};
cvar_t r_mirroralpha = {"r_mirroralpha","1"};
cvar_t r_wateralpha = {"r_wateralpha","1"};
cvar_t r_dynamic = {"r_dynamic","1"};
cvar_t r_novis = {"r_novis","0"};
@ -877,15 +872,7 @@ R_SetupGL ( void ) {
// MYgluPerspective (yfov, screenaspect, 4, 4096);
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
if (mirror) {
if (mirror_plane->normal[2])
glScalef (1, -1, 1);
else
glScalef (-1, 1, 1);
glCullFace(GL_BACK);
} else {
glCullFace(GL_FRONT);
}
glCullFace(GL_FRONT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
@ -947,16 +934,7 @@ R_RenderScene ( void ) {
*/
void
R_Clear ( void ) {
if (r_mirroralpha.value != 1.0) {
if (gl_clear.value) {
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
} else {
glClear (GL_DEPTH_BUFFER_BIT);
}
gldepthmin = 0;
gldepthmax = 0.5;
glDepthFunc (GL_LEQUAL);
} else if (gl_ztrick.value) {
if (gl_ztrick.value) {
static int trickframe;
if (gl_clear.value)
@ -986,74 +964,6 @@ R_Clear ( void ) {
glDepthRange (gldepthmin, gldepthmax);
}
/*
R_Mirror
*/
void
R_Mirror ( void ) {
#ifndef QUAKEWORLD
float d;
msurface_t *s;
entity_t *ent;
if (!mirror)
return;
memcpy (r_base_world_matrix, r_world_matrix, sizeof(r_base_world_matrix));
d = DotProduct (r_refdef.vieworg, mirror_plane->normal) - mirror_plane->dist;
VectorMA (r_refdef.vieworg, -2*d, mirror_plane->normal, r_refdef.vieworg);
d = DotProduct (vpn, mirror_plane->normal);
VectorMA (vpn, -2*d, mirror_plane->normal, vpn);
r_refdef.viewangles[0] = -asin (vpn[2])/M_PI*180;
r_refdef.viewangles[1] = atan2 (vpn[1], vpn[0])/M_PI*180;
r_refdef.viewangles[2] = -r_refdef.viewangles[2];
ent = &cl_entities[cl.viewentity];
if (cl_numvisedicts < MAX_VISEDICTS)
{
cl_visedicts[cl_numvisedicts] = ent;
cl_numvisedicts++;
}
gldepthmin = 0.5;
gldepthmax = 1;
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
R_RenderScene ();
R_DrawWaterSurfaces ();
gldepthmin = 0;
gldepthmax = 0.5;
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
// blend on top
glEnable (GL_BLEND);
glMatrixMode(GL_PROJECTION);
if (mirror_plane->normal[2])
glScalef (1,-1,1);
else
glScalef (-1,1,1);
glCullFace(GL_FRONT);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixf (r_base_world_matrix);
glColor4f (1,1,1,r_mirroralpha.value);
s = cl.worldmodel->textures[mirrortexturenum]->texturechain;
for ( ; s ; s=s->texturechain)
R_RenderBrushPoly (s);
cl.worldmodel->textures[mirrortexturenum]->texturechain = NULL;
glDisable (GL_BLEND);
glColor4f (1,1,1,1);
#endif
}
/*
R_RenderView
@ -1080,8 +990,6 @@ R_RenderView ( void ) {
c_alias_polys = 0;
}
mirror = false;
if (gl_finish.value)
glFinish ();
@ -1133,8 +1041,6 @@ R_RenderView ( void ) {
}
glDisable(GL_FOG); // More fog right here :)
// render mirror view
R_Mirror ();
R_PolyBlend ();
if (r_speeds.value) {

View file

@ -172,7 +172,6 @@ R_Init
void R_Init (void)
{
#ifndef QUAKEWORLD
extern byte *hunk_base;
extern cvar_t gl_finish;
#endif /* QUAKEWORLD */
@ -186,7 +185,6 @@ void R_Init (void)
Cvar_RegisterVariable (&r_drawentities);
Cvar_RegisterVariable (&r_drawviewmodel);
Cvar_RegisterVariable (&r_shadows);
Cvar_RegisterVariable (&r_mirroralpha);
Cvar_RegisterVariable (&r_wateralpha);
Cvar_RegisterVariable (&r_dynamic);
Cvar_RegisterVariable (&r_novis);
@ -584,15 +582,12 @@ void R_NewMap (void)
// identify sky texture
skytexturenum = -1;
mirrortexturenum = -1;
for (i=0 ; i<cl.worldmodel->numtextures ; i++)
{
if (!cl.worldmodel->textures[i])
continue;
if (!Q_strncmp(cl.worldmodel->textures[i]->name,"sky",3) )
skytexturenum = i;
if (!Q_strncmp(cl.worldmodel->textures[i]->name,"window02_1",10) )
mirrortexturenum = i;
cl.worldmodel->textures[i]->texturechain = NULL;
}
#ifdef QUAKE2

View file

@ -894,20 +894,6 @@ dynamic:
}
}
/*
================
R_MirrorChain
================
*/
void R_MirrorChain (msurface_t *s)
{
if (mirror)
return;
mirror = true;
mirror_plane = s->plane;
}
#if 0
/*
================
@ -1062,15 +1048,8 @@ void DrawTextureChains (void)
continue;
if (i == skytexturenum)
R_DrawSkyChain (s);
else if (i == mirrortexturenum && r_mirroralpha.value != 1.0)
{
R_MirrorChain (s);
continue;
}
else
{
if ((s->flags & SURF_DRAWTURB) && r_wateralpha.value != 1.0)
continue; // draw translucent water later
for ( ; s ; s=s->texturechain)
R_RenderBrushPoly (s);
}
@ -1293,12 +1272,8 @@ void R_RecursiveWorldNode (mnode_t *node)
// if sorting by texture, just store it out
if (gl_texsort.value)
{
if (!mirror
|| surf->texinfo->texture != cl.worldmodel->textures[mirrortexturenum])
{
surf->texturechain = surf->texinfo->texture->texturechain;
surf->texinfo->texture->texturechain = surf;
}
surf->texturechain = surf->texinfo->texture->texturechain;
surf->texinfo->texture->texturechain = surf;
} else if (surf->flags & SURF_DRAWSKY) {
surf->texturechain = skychain;
skychain = surf;
@ -1369,9 +1344,6 @@ void R_MarkLeaves (void)
if (r_oldviewleaf == r_viewleaf && !r_novis.value)
return;
if (mirror)
return;
r_visframecount++;
r_oldviewleaf = r_viewleaf;

View file

@ -207,7 +207,6 @@ extern cvar_t r_waterwarp;
extern cvar_t r_fullbright;
extern cvar_t r_lightmap;
extern cvar_t r_shadows;
extern cvar_t r_mirroralpha;
extern cvar_t r_wateralpha;
extern cvar_t r_dynamic;
extern cvar_t r_novis;
@ -241,10 +240,6 @@ extern int gl_alpha_format;
extern cvar_t gl_max_size;
extern cvar_t gl_playermip;
extern int mirrortexturenum; // quake texturenum, not gltexturenum
extern qboolean mirror;
extern mplane_t *mirror_plane;
extern float r_world_matrix[16];
extern const char *gl_vendor;

View file

@ -23,7 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h>
#include <stdlib.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <vga.h>
#include <vgakeyboard.h>

View file

@ -1,5 +1,7 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@ -38,6 +40,7 @@ typedef struct efrag_s
typedef struct entity_s
{
#ifndef QUAKEWORLD
qboolean forcelink; // model changed
int update_type;
@ -46,16 +49,21 @@ typedef struct entity_s
double msgtime; // time of last update
vec3_t msg_origins[2]; // last two updates (0 is newest)
vec3_t origin;
vec3_t msg_angles[2]; // last two updates (0 is newest)
int effects; // light, particals, etc
#endif
vec3_t origin;
vec3_t angles;
struct model_s *model; // NULL = no model
struct efrag_s *efrag; // linked list of efrags
int frame;
float syncbase; // for client-side animations
byte *colormap;
int effects; // light, particals, etc
int skinnum; // for Alias models
#ifdef QUAKEWORLD
int keynum;
struct player_info_s *scoreboard; // identify player
#endif
int visframe; // last frame this entity was
// found in an active leaf
@ -112,6 +120,7 @@ extern vec3_t r_origin, vpn, vright, vup;
extern struct texture_s *r_notexture_mip;
extern entity_t r_worldentity;
void R_Init (void);
void R_InitTextures (void);
@ -156,3 +165,7 @@ void D_DeleteSurfaceCache (void);
void D_InitCaches (void *buffer, int size);
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);
void R_InitParticles (void);
void R_ClearParticles (void);
void R_DrawParticles (void);
void R_DrawWaterSurfaces (void);

View file

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

View file

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

View file

@ -19,7 +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 HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>

View file

@ -33,7 +33,9 @@
#include <ctype.h>
#include <errno.h>
#include <signal.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/time.h>
#include <sys/types.h>

View file

@ -24,7 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// vid_dos.c: DOS-specific video routines
//
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

View file

@ -226,7 +226,7 @@ void ResetFrameBuffer(void)
void VID_Init(unsigned char *pal)
{
int pnum, i;
int pnum;
/* Initalize sound */
S_Init();
@ -788,10 +788,6 @@ static int XLateKey(ggi_key_event *ev)
return key;
}
static int config_notify=0;
static int config_notify_width;
static int config_notify_height;
static void GetEvent(void)
{
ggi_event ev;

View file

@ -27,7 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -29,7 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <sys/types.h>
#include <errno.h>
#include <thread.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -27,7 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_local.h"
#include <stdio.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#if defined(HAVE_SYS_IO_H)
# include <sys/io.h>
#elif defined(HAVE_ASM_IO_H)

View file

@ -27,7 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <ctype.h>
#include <sys/time.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>

View file

@ -19,7 +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 HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "quakedef.h"

View file

@ -31,7 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
#define model_t quakeforgemodel_t
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_IOCTL_H

View file

@ -29,7 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
#define model_t quakeforgemodel_t
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_IOCTL_H

View file

@ -1,155 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// refresh.h -- public interface to refresh functions
#define TOP_RANGE 16 // soldier uniform colors
#define BOTTOM_RANGE 96
//=============================================================================
typedef struct efrag_s
{
struct mleaf_s *leaf;
struct efrag_s *leafnext;
struct entity_s *entity;
struct efrag_s *entnext;
} efrag_t;
typedef struct entity_s
{
int keynum; // for matching entities in different frames
vec3_t origin;
vec3_t angles;
struct model_s *model; // NULL = no model
int frame;
byte *colormap;
int skinnum; // for Alias models
struct player_info_s *scoreboard; // identify player
float syncbase;
struct efrag_s *efrag; // linked list of efrags (FIXME)
int visframe; // last frame this entity was
// found in an active leaf
// only used for static objects
int dlightframe; // dynamic lighting
int dlightbits;
// FIXME: could turn these into a union
int trivial_accept;
struct mnode_s *topnode; // for bmodels, first world node
// that splits bmodel, or NULL if
// not split
} entity_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
vrect_t vrect; // subwindow in video for refresh
// FIXME: not need vrect next field here?
vrect_t aliasvrect; // scaled Alias version
int vrectright, vrectbottom; // right & bottom screen coords
int aliasvrectright, aliasvrectbottom; // scaled Alias versions
float vrectrightedge; // rightmost right edge we care about,
// for use in edge list
float fvrectx, fvrecty; // for floating-point compares
float fvrectx_adj, fvrecty_adj; // left and top edges, for clamping
int vrect_x_adj_shift20; // (vrect.x + 0.5 - epsilon) << 20
int vrectright_adj_shift20; // (vrectright + 0.5 - epsilon) << 20
float fvrectright_adj, fvrectbottom_adj;
// right and bottom edges, for clamping
float fvrectright; // rightmost edge, for Alias clamping
float fvrectbottom; // bottommost edge, for Alias clamping
float horizontalFieldOfView; // at Z = 1.0, this many X is visible
// 2.0 = 90 degrees
float xOrigin; // should probably allways be 0.5
float yOrigin; // between be around 0.3 to 0.5
vec3_t vieworg;
vec3_t viewangles;
float fov_x, fov_y;
int ambientlight;
} refdef_t;
//
// refresh
//
extern int reinit_surfcache;
extern refdef_t r_refdef;
extern vec3_t r_origin, vpn, vright, vup;
extern struct texture_s *r_notexture_mip;
extern entity_t r_worldentity;
void R_Init (void);
void R_InitTextures (void);
void R_InitEfrags (void);
void R_RenderView (void); // must set r_refdef first
void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
// called whenever r_refdef or vid change
void R_InitSky (struct texture_s *mt); // called at level load
void R_AddEfrags (entity_t *ent);
void R_RemoveEfrags (entity_t *ent);
void R_NewMap (void);
void R_ParseParticleEffect (void);
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
void R_RocketTrail (vec3_t start, vec3_t end, int type);
void R_EntityParticles (entity_t *ent);
void R_BlobExplosion (vec3_t org);
void R_ParticleExplosion (vec3_t org);
void R_LavaSplash (vec3_t org);
void R_TeleportSplash (vec3_t org);
void R_PushDlights (void);
void R_InitParticles (void);
void R_ClearParticles (void);
void R_DrawParticles (void);
void R_DrawWaterSurfaces (void);
//
// surface cache related
//
extern int reinit_surfcache; // if 1, surface cache is currently empty and
extern qboolean r_cache_thrash; // set if thrashing the surface cache
int D_SurfaceCacheForRes (int width, int height);
void D_FlushCaches (void);
void D_DeleteSurfaceCache (void);
void D_InitCaches (void *buffer, int size);
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);

View file

@ -367,6 +367,7 @@ void V_UpdatePalette (void);
void V_Register (void);
void V_ParseDamage (void);
void V_SetContentsColor (int contents);
void V_CalcBlend (void);
//

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef NeXT
#include <libc.h>
#endif
#ifndef _MSC_VER
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>

View file

@ -19,7 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/segments.h>
#include <go32.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/nearptr.h>
#include <dos.h>
#include <string.h>

View file

@ -29,7 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */
#define model_t quakeforgemodel_t
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef HAVE_SYS_IOCTL_H

View file

@ -19,14 +19,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <limits.h>
#include <sys/time.h>
#include <sys/types.h>
#include <dir.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>