almost there getting the sw32 client to link

This commit is contained in:
Bill Currie 2001-08-25 03:24:44 +00:00
parent 20544c6c67
commit 8fa46e9fc0
6 changed files with 129 additions and 141 deletions

View file

@ -148,7 +148,6 @@ qboolean scr_skipupdate;
qboolean block_drawing;
void SCR_ScreenShot_f (void);
void SCR_RSShot_f (void);
/*
CENTER PRINTING
@ -488,8 +487,6 @@ SCR_Init (void)
// register our commands
Cmd_AddCommand ("screenshot", SCR_ScreenShot_f, "Take a screenshot and "
"write it as qfxxx.tga in the current directory");
Cmd_AddCommand ("snap", SCR_RSShot_f, "Take a screenshot and upload it "
"to the server");
Cmd_AddCommand ("sizeup", SCR_SizeUp_f, "Increase the size of the screen");
Cmd_AddCommand ("sizedown", SCR_SizeDown_f, "Decrease the size of the "
"screen");
@ -675,6 +672,12 @@ SCR_DrawConsole (int swap)
SCREEN SHOTS
*/
tex_t *
SCR_ScreenShot (int width, int height)
{
return 0;
}
void
SCR_ScreenShot_f (void)
{
@ -795,134 +798,6 @@ SCR_DrawStringToSnap (const char *s, tex_t *tex, int x, int y)
}
}
/*
void
SCR_RSShot_f (void)
{
int x, y;
unsigned char *dest;
char pcxname[80];
unsigned char *newbuf;
int w, h;
int dx, dy, dex, dey, nx;
int r, b, g;
int count;
float fracw, frach;
char st[80];
time_t now;
if (CL_IsUploading ())
return; // already one pending
if (cls.state < ca_onserver)
return; // gotta be connected
Con_Printf ("Remote screen shot requested.\n");
snprintf (pcxname, sizeof (pcxname), "rss.pcx");
// save the pcx file
D_EnableBackBufferAccess (); // enable direct drawing of console
// to back buffer
w = (vid.width < RSSHOT_WIDTH) ? vid.width : RSSHOT_WIDTH;
h = (vid.height < RSSHOT_HEIGHT) ? vid.height : RSSHOT_HEIGHT;
fracw = (float) vid.width / (float) w;
frach = (float) vid.height / (float) h;
newbuf = calloc (1, w * h);
for (y = 0; y < h; y++) {
dest = newbuf + (w * y);
for (x = 0; x < w; x++) {
r = g = b = 0;
dx = x * fracw;
dex = (x + 1) * fracw;
if (dex == dx)
dex++; // at least one
dy = y * frach;
dey = (y + 1) * frach;
if (dey == dy)
dey++; // at least one
count = 0;
switch(r_pixbytes)
{
case 1:
for (; dy < dey; dy++) {
byte *src = (byte *) vid.buffer + (vid.rowbytes * dy) + dx;
for (nx = dx; nx < dex; nx++) {
r += vid_basepal[*src * 3];
g += vid_basepal[*src * 3 + 1];
b += vid_basepal[*src * 3 + 2];
src++;
count++;
}
}
break;
case 2:
for (;dy < dey;dy++) {
unsigned short *src = (unsigned short *) vid.buffer +
(vid.rowbytes * dy) + dx;
for (nx = dx; nx < dex; nx++) {
r += ((*src & 0xF800) >> 11) << (8 - 5);
g += ((*src & 0x07E0) >> 5) << (8 - 6);
b += ((*src & 0x001F) >> 0) << (8 - 5);
src++;
count++;
}
}
break;
case 4:
for (;dy < dey;dy++) {
unsigned int *src = (unsigned int *) vid.buffer +
(vid.rowbytes * dy) + dx;
for (nx = dx; nx < dex; nx++) {
r += ((byte *)src)[0];
g += ((byte *)src)[1];
b += ((byte *)src)[2];
src++;
count++;
}
}
break;
default:
Sys_Error("SCR_RSShot_f: unsupported r_pixbytes %i\n",
r_pixbytes);
}
r /= count;
g /= count;
b /= count;
*dest++ = MipColor (r, g, b);
}
}
time (&now);
strcpy (st, ctime (&now));
st[strlen (st) - 1] = 0;
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, 0, w);
strncpy (st, cls.servername, sizeof (st));
st[sizeof (st) - 1] = 0;
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, 10, w);
strncpy (st, name->string, sizeof (st));
st[sizeof (st) - 1] = 0;
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, 20, w);
WritePCXfile (pcxname, newbuf, w, h, w, vid_basepal, true, false);
free (newbuf);
D_DisableBackBufferAccess (); // for adapters that can't stay mapped
// in for linear writes all the time
Con_Printf ("Wrote %s\n", pcxname);
Con_Printf ("Sending shot to server...\n");
}
*/
//=============================================================================
char *scr_notifystring;

View file

@ -61,6 +61,58 @@ R_AnimateLight (void)
DYNAMIC LIGHTS
*/
void
R_RecursiveMarkLights (vec3_t lightorigin, dlight_t *light, int bit,
mnode_t *node)
{
mplane_t *splitplane;
float ndist, maxdist;
msurface_t *surf;
int i;
maxdist = light->radius * light->radius;
loc0:
if (node->contents < 0)
return;
splitplane = node->plane;
ndist = DotProduct (lightorigin, splitplane->normal) - splitplane->dist;
if (ndist > light->radius) {
if (node->children[0]->contents >= 0) {
node = node->children[0];
goto loc0;
}
return;
}
if (ndist < -light->radius) {
if (node->children[1]->contents >= 0) {
node = node->children[1];
goto loc0;
}
return;
}
// mark the polygons
surf = r_worldentity.model->surfaces + node->firstsurface;
for (i = 0; i < node->numsurfaces; i++, surf++) {
if (surf->dlightframe != r_framecount) {
surf->dlightbits = 0;
surf->dlightframe = r_framecount;
}
surf->dlightbits |= bit;
}
if (node->children[0]->contents >= 0) {
if (node->children[1]->contents >= 0)
R_RecursiveMarkLights (lightorigin, light, bit, node->children[1]);
node = node->children[0];
goto loc0;
} else if (node->children[1]->contents >= 0) {
node = node->children[1];
goto loc0;
}
}
static void
mark_surfaces (msurface_t *surf, vec3_t lightorigin, dlight_t *light,
int bit)

View file

@ -142,9 +142,6 @@ void R_MarkLeaves (void);
void CreatePassages (void);
void SetVisibilityByPassages (void);
void R_NetGraph (void);
void R_ZGraph (void);
cvar_t *r_draworder;
extern cvar_t *scr_fov;
@ -900,8 +897,7 @@ R_RenderView_ (void)
if (!r_dspeeds->int_val) {
VID_UnlockBuffer ();
S_ExtraUpdate (); // don't let sound get messed up if
// going slow
S_ExtraUpdate (); // don't let sound get messed up if going slow
VID_LockBuffer ();
}
@ -937,9 +933,6 @@ R_RenderView_ (void)
if (r_timegraph->int_val)
R_TimeGraph ();
if (r_netgraph->int_val)
R_NetGraph ();
if (r_zgraph->int_val)
R_ZGraph ();

View file

@ -58,9 +58,43 @@ particle_t *particles;
int r_numparticles;
vec3_t r_pright, r_pup, r_ppn;
cvar_t *r_particles;
/*
R_MaxParticlesCheck
Misty-chan: EXTREME heavy lifting and bugfixing thanks goes out to taniwha
- I built this, and he got it working :)
*/
void
R_MaxParticlesCheck (cvar_t *var)
{
// Do not use 0 in this! sw doesn't grok 0 and it'll segfault if we do!
r_numparticles = max(var->int_val, 1);
/*
Debugging code. will print what the above was set to, and is also useful
for checking if this is accidentally being run all the time.
Con_Printf ("%d", r_numparticles);
*/
if (particles)
free (particles);
particles = (particle_t *) calloc (r_numparticles, sizeof (particle_t));
R_ClearParticles ();
}
void
R_Particles_Init_Cvars (void)
{
// Does a callback to R_MaxParticleCheck when the cvar changes. Neat trick.
Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
"Maximum amount of particles to display. No maximum, minimum is 1.");
}
void
R_InitParticles (void)
{
@ -216,6 +250,35 @@ R_ParticleExplosion (vec3_t org)
}
}
void
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
{
int i, j;
particle_t *p;
int colorMod = 0;
for (i=0; i<512; i++)
{
if (!free_particles)
return;
p = free_particles;
free_particles = p->next;
p->next = active_particles;
active_particles = p;
p->die = r_realtime + 0.3;
p->color = colorStart + (colorMod % colorLength);
colorMod++;
p->type = pt_blob;
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j] + ((rand()%32)-16);
p->vel[j] = (rand()%512)-256;
}
}
}
void
R_BlobExplosion (vec3_t org)
{

View file

@ -914,3 +914,8 @@ R_DrawSurfaceBlock32 (void)
}
}
*/
void
R_SurfacePatch (void)
{
}

View file

@ -64,7 +64,7 @@ libQFsdl.la: $(libQFsdl_la_OBJECTS) $(libQFsdl_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libQFsdl_la_LDFLAGS) $(libQFsdl_la_OBJECTS) $(libQFsdl_la_LIBADD) $(LIBS)
libQFsdl32_la_LDFLAGS= -version-info 1:0:0
libQFsdl32_la_SOURCES= in_common.c in_sdl.c vid.c vid_common_sw.c vid_sdl32.c
libQFsdl32_la_SOURCES= $(in_common_SOURCE) in_sdl.c vid.c vid_common_sw.c vid_sdl32.c
libQFsdl32.la: $(libQFsdl32_la_OBJECTS) $(libQFsdl32_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libQFsdl32_la_LDFLAGS) $(libQFsdl32_la_OBJECTS) $(libQFsdl32_la_LIBADD) $(LIBS)