fix some bogosities

This commit is contained in:
Bill Currie 2001-08-31 19:13:16 +00:00
parent ea614fc2c6
commit 99a4ea2093
4 changed files with 9 additions and 2 deletions

View file

@ -35,6 +35,7 @@
#include "QF/qargs.h" #include "QF/qargs.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "compat.h"
#include "d_local.h" #include "d_local.h"
#include "r_local.h" #include "r_local.h"
@ -153,7 +154,7 @@ D_SCAlloc (int width, int size)
Sys_Error ("D_SCAlloc: bad cache size %d\n", size); Sys_Error ("D_SCAlloc: bad cache size %d\n", size);
/* This adds the offset of data[0] in the surfcache_t struct. */ /* This adds the offset of data[0] in the surfcache_t struct. */
size += (int) ((surfcache_t *) 0)->data; size += field_offset (surfcache_t, data);
#define SIZE_ALIGN (sizeof(surfcache_t*)-1) #define SIZE_ALIGN (sizeof(surfcache_t*)-1)
size = (size + SIZE_ALIGN) & ~SIZE_ALIGN; size = (size + SIZE_ALIGN) & ~SIZE_ALIGN;

View file

@ -33,6 +33,7 @@
#include "QF/render.h" #include "QF/render.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "compat.h"
#include "d_local.h" #include "d_local.h"
static int sprite_height; static int sprite_height;
@ -645,6 +646,7 @@ D_SpriteCalculateGradients (void)
VectorInverse (p_taxis); VectorInverse (p_taxis);
distinv = 1.0 / (-DotProduct (modelorg, r_spritedesc.vpn)); distinv = 1.0 / (-DotProduct (modelorg, r_spritedesc.vpn));
distinv = min (distinv, 1.0);
d_sdivzstepu = p_saxis[0] * xscaleinv; d_sdivzstepu = p_saxis[0] * xscaleinv;
d_tdivzstepu = p_taxis[0] * xscaleinv; d_tdivzstepu = p_taxis[0] * xscaleinv;

View file

@ -35,6 +35,7 @@
#include "QF/qargs.h" #include "QF/qargs.h"
#include "QF/sys.h" #include "QF/sys.h"
#include "compat.h"
#include "d_local.h" #include "d_local.h"
#include "r_local.h" #include "r_local.h"
@ -154,7 +155,7 @@ D_SCAlloc (int width, int size)
Sys_Error ("D_SCAlloc: bad cache size %d\n", size); Sys_Error ("D_SCAlloc: bad cache size %d\n", size);
/* This adds the offset of data[0] in the surfcache_t struct. */ /* This adds the offset of data[0] in the surfcache_t struct. */
size += (int) ((surfcache_t *) 0)->data; size += field_offset (surfcache_t, data);
#define SIZE_ALIGN (sizeof(surfcache_t*)-1) #define SIZE_ALIGN (sizeof(surfcache_t*)-1)
size = (size + SIZE_ALIGN) & ~SIZE_ALIGN; size = (size + SIZE_ALIGN) & ~SIZE_ALIGN;

View file

@ -32,6 +32,7 @@
#include "QF/render.h" #include "QF/render.h"
#include "compat.h"
#include "r_local.h" #include "r_local.h"
#define MAXLEFTCLIPEDGES 100 #define MAXLEFTCLIPEDGES 100
@ -494,6 +495,7 @@ R_RenderFace (msurface_t *fa, int clipflags)
TransformVector (pplane->normal, p_normal); TransformVector (pplane->normal, p_normal);
// FIXME: cache this? // FIXME: cache this?
distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal)); distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal));
distinv = min (distinv, 1.0);
surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv; surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv;
surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv;
@ -594,6 +596,7 @@ R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf)
TransformVector (pplane->normal, p_normal); TransformVector (pplane->normal, p_normal);
// FIXME: cache this? // FIXME: cache this?
distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal)); distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal));
distinv = min (distinv, 1.0);
surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv; surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv;
surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv; surface_p->d_zistepv = -p_normal[1] * yscaleinv * distinv;