07 Dec 2008
This commit is contained in:
parent
b4a5fd9f16
commit
5802157c26
|
@ -242,7 +242,8 @@ bspbrush_t *AllocBrush (int numsides)
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
c = (int)&(((bspbrush_t *)0)->sides[numsides]);
|
c = (int)&(((bspbrush_t *)0)->sides[numsides]);
|
||||||
bb = Malloc(c);
|
bb = malloc(c);
|
||||||
|
memset (bb, 0, c);
|
||||||
if (GetNumThreads() == 1) c_active_brushes++;
|
if (GetNumThreads() == 1) c_active_brushes++;
|
||||||
return bb;
|
return bb;
|
||||||
}
|
}
|
||||||
|
@ -259,7 +260,7 @@ void FreeBrush (bspbrush_t *brushes)
|
||||||
for (i=0 ; i<brushes->numsides ; i++)
|
for (i=0 ; i<brushes->numsides ; i++)
|
||||||
if (brushes->sides[i].winding)
|
if (brushes->sides[i].winding)
|
||||||
FreeWinding(brushes->sides[i].winding);
|
FreeWinding(brushes->sides[i].winding);
|
||||||
Mem_Free (brushes);
|
free(brushes);
|
||||||
if (GetNumThreads() == 1)
|
if (GetNumThreads() == 1)
|
||||||
c_active_brushes--;
|
c_active_brushes--;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ bool PrepareBSPModel( const char *dir, const char *name )
|
||||||
int numshaders;
|
int numshaders;
|
||||||
|
|
||||||
bsp_parms = 0;
|
bsp_parms = 0;
|
||||||
|
maxdist = 0.0;
|
||||||
bsplog = NULL;
|
bsplog = NULL;
|
||||||
|
|
||||||
// get global parms
|
// get global parms
|
||||||
|
@ -80,6 +81,7 @@ bool PrepareBSPModel( const char *dir, const char *name )
|
||||||
if( FS_CheckParm( "-full" )) bsp_parms |= BSPLIB_FULLCOMPILE;
|
if( FS_CheckParm( "-full" )) bsp_parms |= BSPLIB_FULLCOMPILE;
|
||||||
if( FS_CheckParm( "-onlyents" )) bsp_parms |= BSPLIB_ONLYENTS;
|
if( FS_CheckParm( "-onlyents" )) bsp_parms |= BSPLIB_ONLYENTS;
|
||||||
if( FS_CheckParm( "-info" )) bsp_parms |= BSPLIB_SHOWINFO;
|
if( FS_CheckParm( "-info" )) bsp_parms |= BSPLIB_SHOWINFO;
|
||||||
|
if( FS_CheckParm( "-cullerror" )) bsp_parms |= BSPLIB_CULLERROR;
|
||||||
|
|
||||||
// famous q1 "notexture" image: purple-black checkerboard
|
// famous q1 "notexture" image: purple-black checkerboard
|
||||||
checkermate_dds = FS_LoadInternal( "checkerboard.dds", &checkermate_dds_size );
|
checkermate_dds = FS_LoadInternal( "checkerboard.dds", &checkermate_dds_size );
|
||||||
|
|
|
@ -50,11 +50,13 @@ typedef enum
|
||||||
BSPLIB_RAD_NOCOLOR = BIT(8),
|
BSPLIB_RAD_NOCOLOR = BIT(8),
|
||||||
BSPLIB_DELETE_TEMP = BIT(9), // delete itermediate files
|
BSPLIB_DELETE_TEMP = BIT(9), // delete itermediate files
|
||||||
BSPLIB_SHOWINFO = BIT(10),
|
BSPLIB_SHOWINFO = BIT(10),
|
||||||
|
BSPLIB_CULLERROR = BIT(11),
|
||||||
} bsplibFlags_t;
|
} bsplibFlags_t;
|
||||||
|
|
||||||
extern uint bsp_parms;
|
extern uint bsp_parms;
|
||||||
extern char path[MAX_SYSPATH];
|
extern char path[MAX_SYSPATH];
|
||||||
extern cvar_t *bsplib_compress_bsp;
|
extern cvar_t *bsplib_compress_bsp;
|
||||||
|
extern float maxdist;
|
||||||
|
|
||||||
// bsplib export functions
|
// bsplib export functions
|
||||||
void WradMain( void );
|
void WradMain( void );
|
||||||
|
@ -258,19 +260,20 @@ typedef struct
|
||||||
typedef enum {stat_none, stat_working, stat_done} vstatus_t;
|
typedef enum {stat_none, stat_working, stat_done} vstatus_t;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
visplane_t plane; // normal pointing into neighbor
|
visplane_t plane; // normal pointing into neighbor
|
||||||
int leaf; // neighbor
|
int leaf; // neighbor
|
||||||
|
int owner_leaf; // neighbor
|
||||||
vec3_t origin; // for fast clip testing
|
|
||||||
|
vec3_t origin; // for fast clip testing
|
||||||
float radius;
|
float radius;
|
||||||
|
|
||||||
viswinding_t *winding;
|
viswinding_t *winding;
|
||||||
vstatus_t status;
|
vstatus_t status;
|
||||||
byte *portalfront; // [portals], preliminary
|
byte *portalfront; // [portals], preliminary
|
||||||
byte *portalflood; // [portals], intermediate
|
byte *portalflood; // [portals], intermediate
|
||||||
byte *portalvis; // [portals], final
|
byte *portalvis; // [portals], final
|
||||||
|
|
||||||
int nummightsee; // bit count on portalflood for sort
|
int nummightsee; // bit count on portalflood for sort
|
||||||
} visportal_t;
|
} visportal_t;
|
||||||
|
|
||||||
typedef struct seperating_plane_s
|
typedef struct seperating_plane_s
|
||||||
|
|
|
@ -462,11 +462,13 @@ float d;
|
||||||
|
|
||||||
d = DotProduct (thread->base->origin, p->plane.normal);
|
d = DotProduct (thread->base->origin, p->plane.normal);
|
||||||
d -= p->plane.dist;
|
d -= p->plane.dist;
|
||||||
if (d > p->radius)
|
if (d > thread->base->radius)
|
||||||
|
// if (d > p->radius)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (d < -p->radius)
|
// else if (d < -p->radius)
|
||||||
|
else if (d < -thread->base->radius)
|
||||||
{
|
{
|
||||||
stack.source = prevstack->source;
|
stack.source = prevstack->source;
|
||||||
}
|
}
|
||||||
|
@ -589,6 +591,7 @@ all seperating planes, and both portals must be behind the mew portal
|
||||||
|
|
||||||
int c_flood, c_vis;
|
int c_flood, c_vis;
|
||||||
|
|
||||||
|
char test_leaf[MAX_MAP_LEAFS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
|
@ -603,6 +606,11 @@ void SimpleFlood (visportal_t *srcportal, int leafnum)
|
||||||
visportal_t *p;
|
visportal_t *p;
|
||||||
int pnum;
|
int pnum;
|
||||||
|
|
||||||
|
if( bsp_parms & BSPLIB_CULLERROR && !test_leaf[leafnum])
|
||||||
|
return;
|
||||||
|
|
||||||
|
test_leaf[leafnum] = 0;
|
||||||
|
|
||||||
leaf = &leafs[leafnum];
|
leaf = &leafs[leafnum];
|
||||||
|
|
||||||
for (i=0 ; i<leaf->numportals ; i++)
|
for (i=0 ; i<leaf->numportals ; i++)
|
||||||
|
@ -632,18 +640,27 @@ void BasePortalVis (int portalnum)
|
||||||
visportal_t *tp, *p;
|
visportal_t *tp, *p;
|
||||||
float d;
|
float d;
|
||||||
viswinding_t *w;
|
viswinding_t *w;
|
||||||
|
vec3_t prenormal, normal;
|
||||||
|
float p_dot, tp_dot, p_rad, tp_rad;
|
||||||
|
|
||||||
p = portals+portalnum;
|
p = portals+portalnum;
|
||||||
|
|
||||||
p->portalfront = Malloc (portalbytes);
|
p->portalfront = Malloc (portalbytes);
|
||||||
p->portalflood = Malloc (portalbytes);
|
p->portalflood = Malloc (portalbytes);
|
||||||
p->portalvis = Malloc (portalbytes);
|
p->portalvis = Malloc (portalbytes);
|
||||||
|
|
||||||
|
Mem_Set( test_leaf, 0, MAX_MAP_LEAFS );
|
||||||
|
|
||||||
for (j=0, tp = portals ; j<numportals*2 ; j++, tp++)
|
for (j=0, tp = portals ; j<numportals*2 ; j++, tp++)
|
||||||
{
|
{
|
||||||
if (j == portalnum)
|
if (j == portalnum)
|
||||||
continue;
|
continue;
|
||||||
|
else if( bsp_parms & BSPLIB_CULLERROR && tp->leaf == p->owner_leaf)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
test_leaf[tp->leaf] = 1;
|
||||||
w = tp->winding;
|
w = tp->winding;
|
||||||
|
|
||||||
for (k=0 ; k<w->numpoints ; k++)
|
for (k=0 ; k<w->numpoints ; k++)
|
||||||
{
|
{
|
||||||
d = DotProduct (w->points[k], p->plane.normal)
|
d = DotProduct (w->points[k], p->plane.normal)
|
||||||
|
@ -665,6 +682,36 @@ void BasePortalVis (int portalnum)
|
||||||
if (k == w->numpoints)
|
if (k == w->numpoints)
|
||||||
continue; // no points on front
|
continue; // no points on front
|
||||||
|
|
||||||
|
if( maxdist > 0.0 )
|
||||||
|
{
|
||||||
|
// This approximation will consider 2 circles in 3d space with the centeer
|
||||||
|
// and radius of the polygons on the planes of the polygons.
|
||||||
|
|
||||||
|
prenormal[0] = p->origin[0] - tp->origin[0];
|
||||||
|
prenormal[1] = p->origin[1] - tp->origin[1];
|
||||||
|
prenormal[2] = p->origin[2] - tp->origin[2];
|
||||||
|
|
||||||
|
VectorCopy( prenormal, normal );
|
||||||
|
d = VectorNormalizeLength( normal );
|
||||||
|
|
||||||
|
p_dot = DotProduct(p->plane.normal, normal);
|
||||||
|
|
||||||
|
if(p_dot < 0.0)
|
||||||
|
p_rad = -p_dot * p->radius;
|
||||||
|
else
|
||||||
|
p_rad = p_dot * p->radius;
|
||||||
|
|
||||||
|
tp_dot = DotProduct(tp->plane.normal, normal);
|
||||||
|
|
||||||
|
if(tp_dot < 0.0)
|
||||||
|
tp_rad = -tp_dot * tp->radius;
|
||||||
|
else
|
||||||
|
tp_rad = tp_dot * tp->radius;
|
||||||
|
|
||||||
|
if(d > (maxdist + tp_rad + p_rad))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
p->portalfront[j>>3] |= (1<<(j&7));
|
p->portalfront[j>>3] |= (1<<(j&7));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,6 +230,33 @@ int PlaneFromPoints( vec_t *p0, vec_t *p1, vec_t *p2 )
|
||||||
return FindFloatPlane( normal, dist );
|
return FindFloatPlane( normal, dist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintContents( int cnt )
|
||||||
|
{
|
||||||
|
Msg("Contents:" );
|
||||||
|
|
||||||
|
if( cnt & CONTENTS_SOLID ) Msg( "solid " );
|
||||||
|
if( cnt & CONTENTS_WINDOW) Msg( "window " );
|
||||||
|
if( cnt & CONTENTS_AUX ) Msg( "aux " );
|
||||||
|
if( cnt & CONTENTS_LAVA) Msg( "lava " );
|
||||||
|
if( cnt & CONTENTS_SLIME) Msg( "slime " );
|
||||||
|
if( cnt & CONTENTS_WATER) Msg( "water " );
|
||||||
|
if( cnt & CONTENTS_SKY) Msg( "sky " );
|
||||||
|
|
||||||
|
if( cnt & CONTENTS_MIST) Msg( "mist " );
|
||||||
|
if( cnt & CONTENTS_FOG) Msg( "fog " );
|
||||||
|
if( cnt & CONTENTS_AREAPORTAL) Msg( "areaportal " );
|
||||||
|
if( cnt & CONTENTS_PLAYERCLIP) Msg( "playerclip " );
|
||||||
|
if( cnt & CONTENTS_MONSTERCLIP) Msg(" monsterclip " );
|
||||||
|
if( cnt & CONTENTS_CLIP) Msg( "clip " );
|
||||||
|
if( cnt & CONTENTS_ORIGIN) Msg(" origin" );
|
||||||
|
if( cnt & CONTENTS_BODY) Sys_Error("\nCONTENTS_BODY detected\n" );
|
||||||
|
if( cnt & CONTENTS_CORPSE) Sys_Error("\nCONTENTS_CORPSE detected\n" );
|
||||||
|
if( cnt & CONTENTS_DETAIL) Msg(" detail " );
|
||||||
|
if( cnt & CONTENTS_TRANSLUCENT) Msg( "translucent " );
|
||||||
|
if( cnt & CONTENTS_LADDER) Msg( "ladder " );
|
||||||
|
if( cnt & CONTENTS_TRIGGER) Msg( "trigger " );
|
||||||
|
Msg( "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
/*
|
/*
|
||||||
|
@ -252,8 +279,9 @@ int BrushContents( mapbrush_t *b )
|
||||||
{
|
{
|
||||||
s = &b->original_sides[i];
|
s = &b->original_sides[i];
|
||||||
trans |= dshaders[texinfo[s->texinfo].shadernum].surfaceFlags;
|
trans |= dshaders[texinfo[s->texinfo].shadernum].surfaceFlags;
|
||||||
if( s->contents != contents )
|
if( s->contents != contents && !( trans & SURF_NODRAW ))
|
||||||
{
|
{
|
||||||
|
// nodraw textures are ignored
|
||||||
MsgDev( D_WARN, "Entity %i, Brush %i: mixed face contents\n", b->entitynum, b->brushnum );
|
MsgDev( D_WARN, "Entity %i, Brush %i: mixed face contents\n", b->entitynum, b->brushnum );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include "bsplib.h"
|
#include "bsplib.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
|
#define BLOCK_SIZE 8192 // test
|
||||||
|
|
||||||
int block_xl = -8, block_xh = 7, block_yl = -8, block_yh = 7;
|
int block_xl = -8, block_xh = 7, block_yl = -8, block_yh = 7;
|
||||||
int entity_num;
|
int entity_num;
|
||||||
node_t *block_nodes[10][10];
|
node_t *block_nodes[10][10];
|
||||||
|
@ -45,7 +47,7 @@ node_t *BlockTree (int xl, int yl, int xh, int yh)
|
||||||
normal[0] = 1;
|
normal[0] = 1;
|
||||||
normal[1] = 0;
|
normal[1] = 0;
|
||||||
normal[2] = 0;
|
normal[2] = 0;
|
||||||
dist = mid*32768;
|
dist = mid*BLOCK_SIZE;
|
||||||
node->planenum = FindFloatPlane (normal, dist);
|
node->planenum = FindFloatPlane (normal, dist);
|
||||||
node->children[0] = BlockTree ( mid, yl, xh, yh);
|
node->children[0] = BlockTree ( mid, yl, xh, yh);
|
||||||
node->children[1] = BlockTree ( xl, yl, mid-1, yh);
|
node->children[1] = BlockTree ( xl, yl, mid-1, yh);
|
||||||
|
@ -56,7 +58,7 @@ node_t *BlockTree (int xl, int yl, int xh, int yh)
|
||||||
normal[0] = 0;
|
normal[0] = 0;
|
||||||
normal[1] = 1;
|
normal[1] = 1;
|
||||||
normal[2] = 0;
|
normal[2] = 0;
|
||||||
dist = mid*32768;
|
dist = mid*BLOCK_SIZE;
|
||||||
node->planenum = FindFloatPlane (normal, dist);
|
node->planenum = FindFloatPlane (normal, dist);
|
||||||
node->children[0] = BlockTree ( xl, mid, xh, yh);
|
node->children[0] = BlockTree ( xl, mid, xh, yh);
|
||||||
node->children[1] = BlockTree ( xl, yl, xh, mid-1);
|
node->children[1] = BlockTree ( xl, yl, xh, mid-1);
|
||||||
|
@ -84,12 +86,12 @@ void ProcessBlock_Thread (int blocknum)
|
||||||
yblock = block_yl + blocknum / (block_xh-block_xl+1);
|
yblock = block_yl + blocknum / (block_xh-block_xl+1);
|
||||||
xblock = block_xl + blocknum % (block_xh-block_xl+1);
|
xblock = block_xl + blocknum % (block_xh-block_xl+1);
|
||||||
|
|
||||||
mins[0] = xblock*32768;
|
mins[0] = xblock*BLOCK_SIZE;
|
||||||
mins[1] = yblock*32768;
|
mins[1] = yblock*BLOCK_SIZE;
|
||||||
mins[2] = -131072;
|
mins[2] = MIN_WORLD_COORD;
|
||||||
maxs[0] = (xblock+1)*32768;
|
maxs[0] = (xblock+1)*BLOCK_SIZE;
|
||||||
maxs[1] = (yblock+1)*32768;
|
maxs[1] = (yblock+1)*BLOCK_SIZE;
|
||||||
maxs[2] = 131072;
|
maxs[2] = MAX_WORLD_COORD;
|
||||||
|
|
||||||
// the makelist and chopbrushes could be cached between the passes...
|
// the makelist and chopbrushes could be cached between the passes...
|
||||||
brushes = MakeBspBrushList (brush_start, brush_end, mins, maxs);
|
brushes = MakeBspBrushList (brush_start, brush_end, mins, maxs);
|
||||||
|
@ -102,10 +104,12 @@ void ProcessBlock_Thread (int blocknum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
brushes = ChopBrushes (brushes);
|
// brushes = ChopBrushes (brushes);
|
||||||
tree = BrushBSP (brushes, mins, maxs);
|
tree = BrushBSP (brushes, mins, maxs);
|
||||||
|
|
||||||
block_nodes[xblock+5][yblock+5] = tree->headnode;
|
block_nodes[xblock+5][yblock+5] = tree->headnode;
|
||||||
|
|
||||||
|
Mem_Free( tree );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -130,14 +134,14 @@ void ProcessWorldModel( void )
|
||||||
//
|
//
|
||||||
// perform per-block operations
|
// perform per-block operations
|
||||||
//
|
//
|
||||||
if (block_xh * 32768 > map_maxs[0])
|
if (block_xh * BLOCK_SIZE > map_maxs[0])
|
||||||
block_xh = floor(map_maxs[0]/32768.0);
|
block_xh = floor(map_maxs[0]/BLOCK_SIZE);
|
||||||
if ( (block_xl+1) * 32768 < map_mins[0])
|
if ( (block_xl+1) * BLOCK_SIZE < map_mins[0])
|
||||||
block_xl = floor(map_mins[0]/32768.0);
|
block_xl = floor(map_mins[0]/BLOCK_SIZE);
|
||||||
if (block_yh * 32768 > map_maxs[1])
|
if (block_yh * BLOCK_SIZE > map_maxs[1])
|
||||||
block_yh = floor(map_maxs[1]/32768.0);
|
block_yh = floor(map_maxs[1]/BLOCK_SIZE);
|
||||||
if ( (block_yl+1) * 32768 < map_mins[1])
|
if ( (block_yl+1) * BLOCK_SIZE < map_mins[1])
|
||||||
block_yl = floor(map_mins[1]/32768.0);
|
block_yl = floor(map_mins[1]/BLOCK_SIZE);
|
||||||
|
|
||||||
if (block_xl <-4) block_xl = -4;
|
if (block_xl <-4) block_xl = -4;
|
||||||
if (block_yl <-4) block_yl = -4;
|
if (block_yl <-4) block_yl = -4;
|
||||||
|
@ -155,12 +159,12 @@ void ProcessWorldModel( void )
|
||||||
tree = AllocTree ();
|
tree = AllocTree ();
|
||||||
tree->headnode = BlockTree (block_xl-1, block_yl-1, block_xh+1, block_yh+1);
|
tree->headnode = BlockTree (block_xl-1, block_yl-1, block_xh+1, block_yh+1);
|
||||||
|
|
||||||
tree->mins[0] = (block_xl)*32768;
|
tree->mins[0] = (block_xl)*BLOCK_SIZE;
|
||||||
tree->mins[1] = (block_yl)*32768;
|
tree->mins[1] = (block_yl)*BLOCK_SIZE;
|
||||||
tree->mins[2] = map_mins[2] - 8;
|
tree->mins[2] = map_mins[2] - 8;
|
||||||
|
|
||||||
tree->maxs[0] = (block_xh+1)*32768;
|
tree->maxs[0] = (block_xh+1)*BLOCK_SIZE;
|
||||||
tree->maxs[1] = (block_yh+1)*32768;
|
tree->maxs[1] = (block_yh+1)*BLOCK_SIZE;
|
||||||
tree->maxs[2] = map_maxs[2] + 8;
|
tree->maxs[2] = map_maxs[2] + 8;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -218,8 +222,8 @@ void ProcessSubModel (void)
|
||||||
start = e->firstbrush;
|
start = e->firstbrush;
|
||||||
end = start + e->numbrushes;
|
end = start + e->numbrushes;
|
||||||
|
|
||||||
mins[0] = mins[1] = mins[2] = -131072;
|
mins[0] = mins[1] = mins[2] = MIN_WORLD_COORD;
|
||||||
maxs[0] = maxs[1] = maxs[2] = 131072;
|
maxs[0] = maxs[1] = maxs[2] = MAX_WORLD_COORD;
|
||||||
list = MakeBspBrushList (start, end, mins, maxs);
|
list = MakeBspBrushList (start, end, mins, maxs);
|
||||||
list = ChopBrushes (list);
|
list = ChopBrushes (list);
|
||||||
tree = BrushBSP (list, mins, maxs);
|
tree = BrushBSP (list, mins, maxs);
|
||||||
|
|
|
@ -19,6 +19,7 @@ int portalbytes, portallongs;
|
||||||
int totalvis;
|
int totalvis;
|
||||||
int totalphs;
|
int totalphs;
|
||||||
visportal_t *sorted_portals[MAX_MAP_PORTALS*2];
|
visportal_t *sorted_portals[MAX_MAP_PORTALS*2];
|
||||||
|
float maxdist;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
|
@ -152,23 +153,23 @@ void PlaneFromWinding( viswinding_t *w, visplane_t *plane )
|
||||||
plane->dist = DotProduct (w->points[0], plane->normal);
|
plane->dist = DotProduct (w->points[0], plane->normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
NewVisWinding
|
NewVisWinding
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
viswinding_t *NewVisWinding (int points)
|
viswinding_t *NewVisWinding( int points )
|
||||||
{
|
{
|
||||||
viswinding_t *w;
|
viswinding_t *w;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
if (points > MAX_POINTS_ON_WINDING)
|
if( points > MAX_POINTS_ON_WINDING )
|
||||||
Sys_Error ("NewVisWinding: %i points", points);
|
Sys_Error ("NewVisWinding: %i points", points);
|
||||||
|
|
||||||
size = (int)((viswinding_t *)0)->points[points];
|
size = (int)((viswinding_t *)0)->points[points];
|
||||||
w = Malloc (size);
|
w = malloc( size );
|
||||||
|
memset( w, 0, size );
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,6 +519,7 @@ void LoadPortals( void )
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Com_CloseScript( prtfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClusterPHS( int clusternum )
|
void ClusterPHS( int clusternum )
|
||||||
|
|
|
@ -186,10 +186,12 @@ void Conv_RunSearch( void )
|
||||||
AddMask( "*.flt" ); // Doom1 textures
|
AddMask( "*.flt" ); // Doom1 textures
|
||||||
AddMask( "*.mus" ); // Doom1 music
|
AddMask( "*.mus" ); // Doom1 music
|
||||||
}
|
}
|
||||||
if( !FS_CheckParm( "-force32" ))
|
if( !FS_CheckParm( "-force32" ))
|
||||||
|
{
|
||||||
imageflags |= IL_KEEP_8BIT;
|
imageflags |= IL_KEEP_8BIT;
|
||||||
|
write_qscsript = true;
|
||||||
|
}
|
||||||
Image_Init( "Doom1", imageflags );
|
Image_Init( "Doom1", imageflags );
|
||||||
write_qscsript = true;
|
|
||||||
break;
|
break;
|
||||||
case GAME_HEXEN2:
|
case GAME_HEXEN2:
|
||||||
case GAME_QUAKE1:
|
case GAME_QUAKE1:
|
||||||
|
@ -211,8 +213,10 @@ void Conv_RunSearch( void )
|
||||||
AddMask( "*.sp32");
|
AddMask( "*.sp32");
|
||||||
AddMask( "*.spr" );
|
AddMask( "*.spr" );
|
||||||
if( !FS_CheckParm( "-force32" ))
|
if( !FS_CheckParm( "-force32" ))
|
||||||
|
{
|
||||||
imageflags |= IL_KEEP_8BIT;
|
imageflags |= IL_KEEP_8BIT;
|
||||||
write_qscsript = true;
|
write_qscsript = true;
|
||||||
|
}
|
||||||
Image_Init( "Quake1", imageflags );
|
Image_Init( "Quake1", imageflags );
|
||||||
break;
|
break;
|
||||||
case GAME_QUAKE2:
|
case GAME_QUAKE2:
|
||||||
|
@ -235,8 +239,10 @@ void Conv_RunSearch( void )
|
||||||
AddMask( "pics/*.pcx"); // Quake2 pics
|
AddMask( "pics/*.pcx"); // Quake2 pics
|
||||||
AddMask( "env/*.pcx" ); // Quake2 skyboxes
|
AddMask( "env/*.pcx" ); // Quake2 skyboxes
|
||||||
if( !FS_CheckParm( "-force32" ))
|
if( !FS_CheckParm( "-force32" ))
|
||||||
|
{
|
||||||
imageflags |= IL_KEEP_8BIT;
|
imageflags |= IL_KEEP_8BIT;
|
||||||
write_qscsript = true;
|
write_qscsript = true;
|
||||||
|
}
|
||||||
Image_Init( "Quake2", imageflags );
|
Image_Init( "Quake2", imageflags );
|
||||||
break;
|
break;
|
||||||
case GAME_RTCW:
|
case GAME_RTCW:
|
||||||
|
@ -331,8 +337,10 @@ void Conv_RunSearch( void )
|
||||||
AddMask( "maps/*.bsp" ); // textures from bsp
|
AddMask( "maps/*.bsp" ); // textures from bsp
|
||||||
AddMask( "sprites/*.spr" ); // Half-Life sprites
|
AddMask( "sprites/*.spr" ); // Half-Life sprites
|
||||||
if( !FS_CheckParm( "-force32" ))
|
if( !FS_CheckParm( "-force32" ))
|
||||||
|
{
|
||||||
imageflags |= IL_KEEP_8BIT;
|
imageflags |= IL_KEEP_8BIT;
|
||||||
write_qscsript = true;
|
write_qscsript = true;
|
||||||
|
}
|
||||||
Image_Init( "Half-Life", imageflags );
|
Image_Init( "Half-Life", imageflags );
|
||||||
break;
|
break;
|
||||||
case GAME_XASH3D:
|
case GAME_XASH3D:
|
||||||
|
|
|
@ -192,7 +192,7 @@ void CL_LevelShot_f( void )
|
||||||
string checkname;
|
string checkname;
|
||||||
|
|
||||||
// check for exist
|
// check for exist
|
||||||
com.sprintf( checkname, "gfx/background/%s.png", cl.configstrings[CS_NAME] );
|
com.sprintf( checkname, "media/background/%s.png", cl.configstrings[CS_NAME] );
|
||||||
if(!FS_FileExists( checkname )) re->ScrShot( checkname, true );
|
if(!FS_FileExists( checkname )) re->ScrShot( checkname, true );
|
||||||
else Msg("levelshot for this map already created\nFirst remove old image if you wants do it again\n" );
|
else Msg("levelshot for this map already created\nFirst remove old image if you wants do it again\n" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1029,7 +1029,7 @@ void CL_RequestNextDownload( void )
|
||||||
while( precache_tex < pe->NumTextures())
|
while( precache_tex < pe->NumTextures())
|
||||||
{
|
{
|
||||||
com.sprintf( fn, "textures/%s.tga", pe->GetTextureName( precache_tex++ ));
|
com.sprintf( fn, "textures/%s.tga", pe->GetTextureName( precache_tex++ ));
|
||||||
if(!CL_CheckOrDownloadFile(fn)) return; // started a download
|
if(!CL_CheckOrDownloadFile( fn )) return; // started a download
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
precache_check = TEXTURE_CNT + 999;
|
precache_check = TEXTURE_CNT + 999;
|
||||||
|
|
|
@ -210,11 +210,11 @@ void CL_ParseServerData( sizebuf_t *msg )
|
||||||
str = MSG_ReadString( msg );
|
str = MSG_ReadString( msg );
|
||||||
|
|
||||||
// get splash name
|
// get splash name
|
||||||
Cvar_Set( "cl_levelshot_name", va( "background/%s.png", str ));
|
Cvar_Set( "cl_levelshot_name", va( "media/background/%s.png", str ));
|
||||||
Cvar_SetValue("scr_loading", 0.0f ); // reset progress bar
|
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
|
||||||
if(!FS_FileExists( va("gfx/%s", Cvar_VariableString( "cl_levelshot_name" ))))
|
if(!FS_FileExists( Cvar_VariableString( "cl_levelshot_name" )))
|
||||||
{
|
{
|
||||||
Cvar_Set("cl_levelshot_name", "common/black");
|
Cvar_Set( "cl_levelshot_name", "" );
|
||||||
cl.make_levelshot = true; // make levelshot
|
cl.make_levelshot = true; // make levelshot
|
||||||
}
|
}
|
||||||
// seperate the printfs so the server message can have a color
|
// seperate the printfs so the server message can have a color
|
||||||
|
|
|
@ -6,25 +6,6 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
#define STAT_MINUS 10 // num frame for '-' stats digit
|
|
||||||
|
|
||||||
const char *field_nums[11] =
|
|
||||||
{
|
|
||||||
"hud/num_0",
|
|
||||||
"hud/num_1",
|
|
||||||
"hud/num_2",
|
|
||||||
"hud/num_3",
|
|
||||||
"hud/num_4",
|
|
||||||
"hud/num_5",
|
|
||||||
"hud/num_6",
|
|
||||||
"hud/num_7",
|
|
||||||
"hud/num_8",
|
|
||||||
"hud/num_9",
|
|
||||||
"hud/num_-",
|
|
||||||
};
|
|
||||||
|
|
||||||
static shader_t field_shaders[11];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
CL_FadeColor
|
CL_FadeColor
|
||||||
|
@ -241,45 +222,6 @@ static void PF_ReadCoord (void){ PRVM_G_FLOAT(OFS_RETURN) = MSG_ReadBits( cls.mu
|
||||||
static void PF_ReadString (void){ PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString( MSG_ReadString( cls.multicast) ); }
|
static void PF_ReadString (void){ PRVM_G_INT(OFS_RETURN) = PRVM_SetEngineString( MSG_ReadString( cls.multicast) ); }
|
||||||
static void PF_ReadEntity (void){ VM_RETURN_EDICT( PRVM_PROG_TO_EDICT( MSG_ReadShort( cls.multicast ))); } // entindex
|
static void PF_ReadEntity (void){ VM_RETURN_EDICT( PRVM_PROG_TO_EDICT( MSG_ReadShort( cls.multicast ))); } // entindex
|
||||||
|
|
||||||
/*
|
|
||||||
=========
|
|
||||||
PF_drawfield
|
|
||||||
|
|
||||||
void DrawField( float value, vector pos, vector size )
|
|
||||||
=========
|
|
||||||
*/
|
|
||||||
static void PF_drawfield( void )
|
|
||||||
{
|
|
||||||
char num[16], *ptr;
|
|
||||||
int l, frame;
|
|
||||||
float value, *pos, *size;
|
|
||||||
|
|
||||||
if(!VM_ValidateArgs( "drawpic", 3 ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = PRVM_G_FLOAT(OFS_PARM0);
|
|
||||||
pos = PRVM_G_VECTOR(OFS_PARM1);
|
|
||||||
size = PRVM_G_VECTOR(OFS_PARM2);
|
|
||||||
|
|
||||||
com.snprintf( num, 16, "%i", (int)value );
|
|
||||||
l = com.strlen( num );
|
|
||||||
ptr = num;
|
|
||||||
|
|
||||||
if( size[0] == 0.0f ) size[0] = GIANTCHAR_WIDTH;
|
|
||||||
if( size[1] == 0.0f ) size[1] = GIANTCHAR_HEIGHT;
|
|
||||||
|
|
||||||
while( *ptr && l )
|
|
||||||
{
|
|
||||||
if( *ptr == '-' ) frame = STAT_MINUS;
|
|
||||||
else frame = *ptr -'0';
|
|
||||||
SCR_DrawPic( pos[0], pos[1], size[0], size[1], field_shaders[frame] );
|
|
||||||
pos[0] += size[0];
|
|
||||||
ptr++;
|
|
||||||
l--;
|
|
||||||
}
|
|
||||||
re->SetColor( NULL );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========
|
=========
|
||||||
PF_drawnet
|
PF_drawnet
|
||||||
|
@ -292,14 +234,14 @@ static void PF_drawnet( void )
|
||||||
float *pos;
|
float *pos;
|
||||||
shader_t shader;
|
shader_t shader;
|
||||||
|
|
||||||
if(!VM_ValidateArgs( "drawnet", 2 ))
|
if(!VM_ValidateArgs( "DrawNet", 2 ))
|
||||||
return;
|
return;
|
||||||
if(cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP-1)
|
if(cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP-1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VM_ValidateString(PRVM_G_STRING(OFS_PARM1));
|
VM_ValidateString(PRVM_G_STRING(OFS_PARM1));
|
||||||
pos = PRVM_G_VECTOR(OFS_PARM0);
|
pos = PRVM_G_VECTOR(OFS_PARM0);
|
||||||
shader = re->RegisterShader( va( "gfx/%s", PRVM_G_STRING(OFS_PARM1)), SHADER_NOMIP );
|
shader = re->RegisterShader( PRVM_G_STRING(OFS_PARM1), SHADER_NOMIP );
|
||||||
|
|
||||||
SCR_DrawPic( pos[0], pos[1], -1, -1, shader );
|
SCR_DrawPic( pos[0], pos[1], -1, -1, shader );
|
||||||
}
|
}
|
||||||
|
@ -712,7 +654,7 @@ VM_drawstring, // #114 float DrawString( vector pos, string text, vector scale
|
||||||
VM_drawpic, // #115 float DrawPic( vector pos, string pic, vector size, vector rgb, float alpha )
|
VM_drawpic, // #115 float DrawPic( vector pos, string pic, vector size, vector rgb, float alpha )
|
||||||
VM_drawfill, // #116 void DrawFill( vector pos, vector size, vector rgb, float alpha )
|
VM_drawfill, // #116 void DrawFill( vector pos, vector size, vector rgb, float alpha )
|
||||||
VM_drawmodel, // #117 void DrawModel( vector pos, vector size, string mod, vector org, vector ang, float seq )
|
VM_drawmodel, // #117 void DrawModel( vector pos, vector size, string mod, vector org, vector ang, float seq )
|
||||||
PF_drawfield, // #118 void DrawField( float value, vector pos, vector size )
|
NULL, // #118 -- reserved --
|
||||||
VM_getimagesize, // #119 vector getimagesize( string pic )
|
VM_getimagesize, // #119 vector getimagesize( string pic )
|
||||||
PF_drawnet, // #120 void DrawNet( vector pos, string image )
|
PF_drawnet, // #120 void DrawNet( vector pos, string image )
|
||||||
PF_drawfps, // #121 void DrawFPS( vector pos )
|
PF_drawfps, // #121 void DrawFPS( vector pos )
|
||||||
|
@ -739,8 +681,6 @@ const int vm_cl_numbuiltins = sizeof(vm_cl_builtins) / sizeof(prvm_builtin_t); /
|
||||||
|
|
||||||
void CL_InitClientProgs( void )
|
void CL_InitClientProgs( void )
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
Msg("\n");
|
Msg("\n");
|
||||||
PRVM_Begin;
|
PRVM_Begin;
|
||||||
|
|
||||||
|
@ -775,9 +715,6 @@ void CL_InitClientProgs( void )
|
||||||
prog->globals.cl->mapname = PRVM_SetEngineString( cls.servername );
|
prog->globals.cl->mapname = PRVM_SetEngineString( cls.servername );
|
||||||
prog->globals.cl->playernum = cl.playernum;
|
prog->globals.cl->playernum = cl.playernum;
|
||||||
|
|
||||||
for( i = 0; i < sizeof( field_nums ) / sizeof( field_nums[0] ); i++ )
|
|
||||||
field_shaders[i] = re->RegisterShader( va("gfx/%s", field_nums[i] ), SHADER_NOMIP );
|
|
||||||
|
|
||||||
// call the prog init
|
// call the prog init
|
||||||
PRVM_ExecuteProgram( prog->globals.cl->HUD_Init, "HUD_Init" );
|
PRVM_ExecuteProgram( prog->globals.cl->HUD_Init, "HUD_Init" );
|
||||||
PRVM_End;
|
PRVM_End;
|
||||||
|
|
|
@ -321,7 +321,7 @@ void SCR_UpdateScreen( void )
|
||||||
SCR_DrawCinematic();
|
SCR_DrawCinematic();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error("SCR_UpdateScreen: bad cls.state" );
|
Host_Error( "SCR_UpdateScreen: bad cls.state\n" );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ void SCR_RegisterShaders( void )
|
||||||
// register console images
|
// register console images
|
||||||
cls.consoleFont = re->RegisterShader( va( "gfx/fonts/%s", con_font->string ), SHADER_FONT );
|
cls.consoleFont = re->RegisterShader( va( "gfx/fonts/%s", con_font->string ), SHADER_FONT );
|
||||||
cls.clientFont = re->RegisterShader( va( "gfx/fonts/%s", cl_font->string ), SHADER_FONT );
|
cls.clientFont = re->RegisterShader( va( "gfx/fonts/%s", cl_font->string ), SHADER_FONT );
|
||||||
cls.consoleBack = re->RegisterShader( "gfx/background/conback", SHADER_NOMIP );
|
cls.consoleBack = re->RegisterShader( "gfx/shell/conback", SHADER_NOMIP ); // hardcoded ...
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -348,7 +348,7 @@ void SCR_Init( void )
|
||||||
scr_showpause = Cvar_Get("scr_showpause", "1", 0, "show pause picture" );
|
scr_showpause = Cvar_Get("scr_showpause", "1", 0, "show pause picture" );
|
||||||
scr_centertime = Cvar_Get("scr_centertime", "2.5", 0, "centerprint hold time" );
|
scr_centertime = Cvar_Get("scr_centertime", "2.5", 0, "centerprint hold time" );
|
||||||
scr_printspeed = Cvar_Get("scr_printspeed", "8", 0, "centerprint speed of print" );
|
scr_printspeed = Cvar_Get("scr_printspeed", "8", 0, "centerprint speed of print" );
|
||||||
cl_levelshot_name = Cvar_Get("cl_levelshot_name", "common/black", 0, "contains path to current levelshot" );
|
cl_levelshot_name = Cvar_Get( "cl_levelshot_name", "", 0, "contains path to current levelshot" );
|
||||||
scr_loading = Cvar_Get("scr_loading", "0", 0, "loading bar progress" );
|
scr_loading = Cvar_Get("scr_loading", "0", 0, "loading bar progress" );
|
||||||
scr_download = Cvar_Get("scr_download", "0", 0, "downloading bar progress" );
|
scr_download = Cvar_Get("scr_download", "0", 0, "downloading bar progress" );
|
||||||
cl_testentities = Cvar_Get ("cl_testentities", "0", 0, "test client entities" );
|
cl_testentities = Cvar_Get ("cl_testentities", "0", 0, "test client entities" );
|
||||||
|
|
|
@ -458,10 +458,10 @@ bool Cmd_GetGamesList( const char *s, char *completedname, int length )
|
||||||
|
|
||||||
bool Cmd_CheckMapsList( void )
|
bool Cmd_CheckMapsList( void )
|
||||||
{
|
{
|
||||||
byte *buffer;
|
|
||||||
wfile_t *wad;
|
wfile_t *wad;
|
||||||
search_t *t;
|
search_t *t;
|
||||||
int i;
|
int i, bufsize;
|
||||||
|
byte *buffer = NULL;
|
||||||
|
|
||||||
if( FS_FileExists( "scripts/maps.lst" ))
|
if( FS_FileExists( "scripts/maps.lst" ))
|
||||||
return true; // exist
|
return true; // exist
|
||||||
|
@ -469,7 +469,8 @@ bool Cmd_CheckMapsList( void )
|
||||||
t = FS_Search( "maps/*.bsp", false );
|
t = FS_Search( "maps/*.bsp", false );
|
||||||
if( !t ) return false;
|
if( !t ) return false;
|
||||||
|
|
||||||
buffer = Z_Malloc( t->numfilenames * 2 * sizeof( MAX_STRING )); // should be enough...
|
bufsize = t->numfilenames * MAX_VALUE; // should be enough...
|
||||||
|
buffer = Z_Malloc( bufsize );
|
||||||
for( i = 0; i < t->numfilenames; i++ )
|
for( i = 0; i < t->numfilenames; i++ )
|
||||||
{
|
{
|
||||||
string mapname, message;
|
string mapname, message;
|
||||||
|
@ -485,6 +486,7 @@ bool Cmd_CheckMapsList( void )
|
||||||
int num_spawnpoints = 0;
|
int num_spawnpoints = 0;
|
||||||
int lumplen = 0;
|
int lumplen = 0;
|
||||||
dheader_t *header;
|
dheader_t *header;
|
||||||
|
byte *lump;
|
||||||
|
|
||||||
com.strncpy( message, "No Title", MAX_STRING );
|
com.strncpy( message, "No Title", MAX_STRING );
|
||||||
header = (dheader_t *)WAD_Read( wad, LUMP_MAPINFO, NULL, TYPE_BINDATA );
|
header = (dheader_t *)WAD_Read( wad, LUMP_MAPINFO, NULL, TYPE_BINDATA );
|
||||||
|
@ -500,8 +502,8 @@ bool Cmd_CheckMapsList( void )
|
||||||
}
|
}
|
||||||
else goto skip_map;
|
else goto skip_map;
|
||||||
|
|
||||||
buffer = (byte *)WAD_Read( wad, LUMP_ENTITIES, &lumplen, TYPE_SCRIPT );
|
lump = (byte *)WAD_Read( wad, LUMP_ENTITIES, &lumplen, TYPE_SCRIPT );
|
||||||
ents = Com_OpenScript( LUMP_ENTITIES, buffer, lumplen + 1 );
|
ents = Com_OpenScript( LUMP_ENTITIES, lump, lumplen + 1 );
|
||||||
|
|
||||||
if( ents )
|
if( ents )
|
||||||
{
|
{
|
||||||
|
@ -511,11 +513,10 @@ bool Cmd_CheckMapsList( void )
|
||||||
|
|
||||||
while( Com_ReadToken( ents, SC_ALLOW_NEWLINES|SC_PARSE_GENERIC, &token ))
|
while( Com_ReadToken( ents, SC_ALLOW_NEWLINES|SC_PARSE_GENERIC, &token ))
|
||||||
{
|
{
|
||||||
if( !com.strcmp( token.string, "{" )) continue;
|
if( !com.strcmp( token.string, "classname" ))
|
||||||
else if( !com.strcmp( token.string, "}" )) break;
|
|
||||||
else if( !com.strcmp( token.string, "classname" ))
|
|
||||||
{
|
{
|
||||||
Com_ReadToken( ents, 0, &token );
|
Com_ReadToken( ents, 0, &token );
|
||||||
|
Msg("read token: %s\n", token.string );
|
||||||
if(!com.strcmp( token.string, "info_player_deatchmatch" ))
|
if(!com.strcmp( token.string, "info_player_deatchmatch" ))
|
||||||
num_spawnpoints++;
|
num_spawnpoints++;
|
||||||
else if(!com.strcmp( token.string, "info_player_start" ))
|
else if(!com.strcmp( token.string, "info_player_start" ))
|
||||||
|
@ -529,7 +530,7 @@ bool Cmd_CheckMapsList( void )
|
||||||
else goto skip_map;
|
else goto skip_map;
|
||||||
|
|
||||||
// format: mapname "maptitle"\n
|
// format: mapname "maptitle"\n
|
||||||
com.strcat( buffer, va( "%s \"%s\"\n", mapname, message )); // add new string
|
com.strncat( buffer, va( "%s \"%s\"\n", mapname, message ), bufsize ); // add new string
|
||||||
skip_map:
|
skip_map:
|
||||||
if( wad ) WAD_Close( wad );
|
if( wad ) WAD_Close( wad );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1128,7 +1128,7 @@ void VM_precache_pic( void )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VM_ValidateString(PRVM_G_STRING(OFS_PARM0));
|
VM_ValidateString(PRVM_G_STRING(OFS_PARM0));
|
||||||
if( re->RegisterShader( va( "gfx/%s", PRVM_G_STRING(OFS_PARM0)), SHADER_NOMIP ))
|
if( re->RegisterShader( PRVM_G_STRING(OFS_PARM0), SHADER_NOMIP ))
|
||||||
PRVM_G_FLOAT(OFS_RETURN) = true;
|
PRVM_G_FLOAT(OFS_RETURN) = true;
|
||||||
else PRVM_G_FLOAT(OFS_RETURN) = false;
|
else PRVM_G_FLOAT(OFS_RETURN) = false;
|
||||||
}
|
}
|
||||||
|
@ -1216,7 +1216,7 @@ void VM_drawpic( void )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VM_ValidateString(PRVM_G_STRING(OFS_PARM1));
|
VM_ValidateString(PRVM_G_STRING(OFS_PARM1));
|
||||||
shader = re->RegisterShader( va("gfx/%s", PRVM_G_STRING( OFS_PARM1 )), SHADER_NOMIP );
|
shader = re->RegisterShader( PRVM_G_STRING( OFS_PARM1 ), SHADER_NOMIP );
|
||||||
if( !shader )
|
if( !shader )
|
||||||
{
|
{
|
||||||
VM_Warning( "PF_drawpic: %s passed null picture name!\n", PRVM_NAME );
|
VM_Warning( "PF_drawpic: %s passed null picture name!\n", PRVM_NAME );
|
||||||
|
@ -1332,7 +1332,7 @@ void VM_getimagesize( void )
|
||||||
VM_ValidateString(PRVM_G_STRING(OFS_PARM0));
|
VM_ValidateString(PRVM_G_STRING(OFS_PARM0));
|
||||||
p = PRVM_G_STRING(OFS_PARM0);
|
p = PRVM_G_STRING(OFS_PARM0);
|
||||||
|
|
||||||
shader = re->RegisterShader( va( "gfx/%s", p ), SHADER_NOMIP );
|
shader = re->RegisterShader( p, SHADER_NOMIP );
|
||||||
re->DrawGetPicSize( &w, &h, shader );
|
re->DrawGetPicSize( &w, &h, shader );
|
||||||
VectorSet(PRVM_G_VECTOR(OFS_RETURN), w, h, 0 );
|
VectorSet(PRVM_G_VECTOR(OFS_RETURN), w, h, 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,9 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
|
||||||
{
|
{
|
||||||
// too many leafs for individual check, go by headnode
|
// too many leafs for individual check, go by headnode
|
||||||
if( !pe->HeadnodeVisible( svent->headnode, bitvector ))
|
if( !pe->HeadnodeVisible( svent->headnode, bitvector ))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "render_api.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "matrix_lib.h"
|
#include "matrix_lib.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
@ -1054,7 +1055,16 @@ bool SV_CheckWater( edict_t *ent )
|
||||||
ent->progs.sv->waterlevel = 2;
|
ent->progs.sv->waterlevel = 2;
|
||||||
point[2] = ent->progs.sv->origin[2] + ent->progs.sv->view_ofs[2];
|
point[2] = ent->progs.sv->origin[2] + ent->progs.sv->view_ofs[2];
|
||||||
if(SV_PointContents(point) & (MASK_WATER))
|
if(SV_PointContents(point) & (MASK_WATER))
|
||||||
|
{
|
||||||
ent->progs.sv->waterlevel = 3;
|
ent->progs.sv->waterlevel = 3;
|
||||||
|
if( ent->priv.sv->s.ed_type == ED_CLIENT )
|
||||||
|
ent->progs.sv->renderfx = (int)ent->progs.sv->renderfx | RDF_UNDERWATER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ent->priv.sv->s.ed_type == ED_CLIENT )
|
||||||
|
ent->progs.sv->renderfx = (int)ent->progs.sv->renderfx & ~RDF_UNDERWATER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ent->progs.sv->waterlevel > 1;
|
return ent->progs.sv->waterlevel > 1;
|
||||||
|
|
|
@ -449,11 +449,18 @@ void Image_GetPaletteD1( void )
|
||||||
{
|
{
|
||||||
image.d_rendermode = LUMP_NORMAL;
|
image.d_rendermode = LUMP_NORMAL;
|
||||||
|
|
||||||
if(!d1palette_init)
|
if( !d1palette_init )
|
||||||
{
|
{
|
||||||
|
byte temp[4];
|
||||||
|
|
||||||
Image_SetPalette( palette_d1, d_8toD1table );
|
Image_SetPalette( palette_d1, d_8toD1table );
|
||||||
d_8toD1table[247] = 0; // Image_LoadFLT will be convert transparency from 247 into 255 color
|
d_8toD1table[247] = 0; // Image_LoadFLT will be convert transparency from 247 into 255 color
|
||||||
d1palette_init = true;
|
d1palette_init = true;
|
||||||
|
|
||||||
|
// also swap palette colors: from 247 to 255
|
||||||
|
Mem_Copy( temp, &d_8toD1table[255], 4 );
|
||||||
|
Mem_Copy( &d_8toD1table[255], &d_8toD1table[247], 4 );
|
||||||
|
Mem_Copy( &d_8toD1table[247], temp, 4 );
|
||||||
}
|
}
|
||||||
image.d_currentpal = d_8toD1table;
|
image.d_currentpal = d_8toD1table;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,16 +278,6 @@ bool Image_LoadFLT( const char *name, const byte *buffer, size_t filesize )
|
||||||
image.type = PF_INDEXED_32; // 32-bit palete
|
image.type = PF_INDEXED_32; // 32-bit palete
|
||||||
Image_GetPaletteD1();
|
Image_GetPaletteD1();
|
||||||
|
|
||||||
// also swap palette colors: from 247 to 255
|
|
||||||
if( image.d_currentpal )
|
|
||||||
{
|
|
||||||
byte temp[4];
|
|
||||||
|
|
||||||
Mem_Copy( temp, &image.d_currentpal[247], 4 );
|
|
||||||
Mem_Copy( &image.d_currentpal[247], &image.d_currentpal[255], 4 );
|
|
||||||
Mem_Copy( &image.d_currentpal[247], temp, 4 );
|
|
||||||
}
|
|
||||||
|
|
||||||
result = FS_AddMipmapToPack( Data, image.width, image.height );
|
result = FS_AddMipmapToPack( Data, image.width, image.height );
|
||||||
if( Data ) Mem_Free( Data );
|
if( Data ) Mem_Free( Data );
|
||||||
return result;
|
return result;
|
||||||
|
@ -413,9 +403,9 @@ bool Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
|
||||||
|
|
||||||
// qlumpy used this color for transparent textures, otherwise it's decals
|
// qlumpy used this color for transparent textures, otherwise it's decals
|
||||||
if( pal[255*3+0] == 0 && pal[255*3+1] == 0 && pal[255*3+2] == 255 );
|
if( pal[255*3+0] == 0 && pal[255*3+1] == 0 && pal[255*3+2] == 255 );
|
||||||
else if( Sys.app_name == HOST_NORMAL )
|
else if(!( image.cmd_flags & IL_KEEP_8BIT ))
|
||||||
{
|
{
|
||||||
// render requires setup special palette
|
// apply decal palette immediately
|
||||||
image.flags |= IMAGE_COLORINDEX;
|
image.flags |= IMAGE_COLORINDEX;
|
||||||
rendermode = LUMP_DECAL;
|
rendermode = LUMP_DECAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,9 +242,9 @@ typedef struct leaflist_s
|
||||||
int maxcount;
|
int maxcount;
|
||||||
bool overflowed;
|
bool overflowed;
|
||||||
int *list;
|
int *list;
|
||||||
vec3_t bounds[2];
|
vec3_t mins;
|
||||||
int lastleaf; // for overflows where each leaf can't be stored individually
|
vec3_t maxs;
|
||||||
void (*storeleafs)( struct leaflist_s *ll, cnode_t *node );
|
int topnode; // for overflows where each leaf can't be stored individually
|
||||||
} leaflist_t;
|
} leaflist_t;
|
||||||
|
|
||||||
extern clipmap_t cm;
|
extern clipmap_t cm;
|
||||||
|
|
|
@ -64,24 +64,6 @@ LEAF LISTING
|
||||||
|
|
||||||
======================================================================
|
======================================================================
|
||||||
*/
|
*/
|
||||||
void CM_StoreLeafs( leaflist_t *ll, cnode_t *node )
|
|
||||||
{
|
|
||||||
cleaf_t *leaf = (cleaf_t *)node;
|
|
||||||
|
|
||||||
// store the lastLeaf even if the list is overflowed
|
|
||||||
if( leaf->cluster != -1 )
|
|
||||||
{
|
|
||||||
ll->lastleaf = leaf - cm.leafs;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ll->count >= ll->maxcount )
|
|
||||||
{
|
|
||||||
ll->overflowed = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ll->list[ll->count++] = leaf - cm.leafs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
CM_BoxLeafnums
|
CM_BoxLeafnums
|
||||||
|
@ -98,13 +80,20 @@ void CM_BoxLeafnums_r( leaflist_t *ll, cnode_t *node )
|
||||||
{
|
{
|
||||||
if( node->plane == NULL )
|
if( node->plane == NULL )
|
||||||
{
|
{
|
||||||
|
cleaf_t *leaf = (cleaf_t *)node;
|
||||||
|
|
||||||
// it's a leaf!
|
// it's a leaf!
|
||||||
ll->storeleafs( ll, node );
|
if( ll->count >= ll->maxcount)
|
||||||
|
{
|
||||||
|
ll->overflowed = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ll->list[ll->count++] = leaf - cm.leafs;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plane = node->plane;
|
plane = node->plane;
|
||||||
s = BoxOnPlaneSide( ll->bounds[0], ll->bounds[1], plane );
|
s = BoxOnPlaneSide( ll->mins, ll->maxs, plane );
|
||||||
if( s == 1 )
|
if( s == 1 )
|
||||||
{
|
{
|
||||||
node = node->children[0];
|
node = node->children[0];
|
||||||
|
@ -116,6 +105,8 @@ void CM_BoxLeafnums_r( leaflist_t *ll, cnode_t *node )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// go down both
|
// go down both
|
||||||
|
if( ll->topnode == -1 )
|
||||||
|
ll->topnode = node - cm.nodes;
|
||||||
CM_BoxLeafnums_r( ll, node->children[0] );
|
CM_BoxLeafnums_r( ll, node->children[0] );
|
||||||
node = node->children[1];
|
node = node->children[1];
|
||||||
}
|
}
|
||||||
|
@ -127,23 +118,22 @@ void CM_BoxLeafnums_r( leaflist_t *ll, cnode_t *node )
|
||||||
CM_BoxLeafnums
|
CM_BoxLeafnums
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
int CM_BoxLeafnums( const vec3_t mins, const vec3_t maxs, int *list, int listsize, int *lastleaf )
|
int CM_BoxLeafnums( const vec3_t mins, const vec3_t maxs, int *list, int listsize, int *topnode )
|
||||||
{
|
{
|
||||||
leaflist_t ll;
|
leaflist_t ll;
|
||||||
|
|
||||||
cms.checkcount++;
|
cms.checkcount++;
|
||||||
VectorCopy( mins, ll.bounds[0] );
|
VectorCopy( mins, ll.mins );
|
||||||
VectorCopy( maxs, ll.bounds[1] );
|
VectorCopy( maxs, ll.maxs );
|
||||||
ll.count = 0;
|
ll.count = 0;
|
||||||
ll.maxcount = listsize;
|
ll.maxcount = listsize;
|
||||||
ll.list = list;
|
ll.list = list;
|
||||||
ll.storeleafs = CM_StoreLeafs;
|
ll.topnode = -1;
|
||||||
ll.lastleaf = -1;
|
|
||||||
ll.overflowed = false;
|
ll.overflowed = false;
|
||||||
|
|
||||||
CM_BoxLeafnums_r( &ll, cm.nodes );
|
CM_BoxLeafnums_r( &ll, cm.nodes );
|
||||||
|
|
||||||
if( lastleaf ) *lastleaf = ll.lastleaf;
|
if( topnode ) *topnode = ll.topnode;
|
||||||
return ll.count;
|
return ll.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,5 @@ if exist vsound\vsound.plg del /f /q vsound\vsound.plg
|
||||||
echo Build succeeded!
|
echo Build succeeded!
|
||||||
echo Please wait. Xash is now loading
|
echo Please wait. Xash is now loading
|
||||||
cd D:\Xash3D\
|
cd D:\Xash3D\
|
||||||
quake.exe -game tmpQuArK -dev 3 -log +map qctest
|
quake.exe -game tmpQuArK -dev 3 -log +map dm7
|
||||||
:done
|
:done
|
|
@ -187,6 +187,7 @@ typedef struct
|
||||||
// builtin shaders
|
// builtin shaders
|
||||||
ref_shader_t *defaultShader;
|
ref_shader_t *defaultShader;
|
||||||
ref_shader_t *nodrawShader;
|
ref_shader_t *nodrawShader;
|
||||||
|
ref_shader_t *blackShader;
|
||||||
ref_shader_t *lightmapShader;
|
ref_shader_t *lightmapShader;
|
||||||
ref_shader_t *skyboxShader;
|
ref_shader_t *skyboxShader;
|
||||||
ref_shader_t *particleShader;
|
ref_shader_t *particleShader;
|
||||||
|
|
|
@ -1354,20 +1354,6 @@ shader_t Mod_RegisterShader( const char *name, int shaderType )
|
||||||
return shader;
|
return shader;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
R_PrecachePic
|
|
||||||
|
|
||||||
prefetching 2d graphics
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
bool R_PrecachePic( const char *name )
|
|
||||||
{
|
|
||||||
if( R_FindTexture(va( "gfx/%s", name ), NULL, 0, TF_STATIC|TF_NOPICMIP, TF_LINEAR, TW_REPEAT ))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
R_Init
|
R_Init
|
||||||
|
|
|
@ -4876,7 +4876,7 @@ ref_shader_t *R_FindShader( const char *name, int shaderType, uint surfaceParm )
|
||||||
}
|
}
|
||||||
|
|
||||||
// create the shader
|
// create the shader
|
||||||
shader = R_CreateShader( name, shaderType, surfaceParm, shaderScript );
|
shader = R_CreateShader( name, shaderType, surfaceParm, shaderScript );
|
||||||
|
|
||||||
// load it in
|
// load it in
|
||||||
return R_LoadShader( shader );
|
return R_LoadShader( shader );
|
||||||
|
@ -5091,6 +5091,20 @@ static void R_CreateBuiltInShaders( void )
|
||||||
|
|
||||||
tr.nodrawShader = R_LoadShader( shader );
|
tr.nodrawShader = R_LoadShader( shader );
|
||||||
|
|
||||||
|
// black shader
|
||||||
|
shader = R_NewShader();
|
||||||
|
|
||||||
|
// gfx black image
|
||||||
|
com.strncpy( shader->name, "<black>", sizeof( shader->name ));
|
||||||
|
shader->type = SHADER_NOMIP;
|
||||||
|
shader->flags = SHADER_STATIC;
|
||||||
|
shader->stages[0]->bundles[0]->textures[0] = r_blackTexture;
|
||||||
|
shader->stages[0]->bundles[0]->numTextures++;
|
||||||
|
shader->stages[0]->numBundles++;
|
||||||
|
shader->numStages++;
|
||||||
|
|
||||||
|
tr.blackShader = R_LoadShader( shader );
|
||||||
|
|
||||||
// lightmap shader
|
// lightmap shader
|
||||||
shader = R_NewShader();
|
shader = R_NewShader();
|
||||||
|
|
||||||
|
|
Reference in New Issue