more merging

This commit is contained in:
Bill Currie 2001-05-18 21:06:45 +00:00
parent f0c6dfcb1a
commit 1c87b2ef94
5 changed files with 190 additions and 10 deletions

View file

@ -121,7 +121,7 @@ nq_x11_DEPENDENCIES=../../libs/models/libQFmodels_sw.la ../../libs/video/targets
# OpenGL-using targets
# ... Common stuff
ogl_SOURCES= noisetextures.c gl_textures.c gl_draw.c gl_dyn_fires.c \
gl_dyn_part.c gl_dyn_textures.c \
gl_dyn_part.c gl_dyn_textures.c gl_ngraph.c \
gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c \
gl_screen.c gl_skin.c gl_sky.c gl_sky_clip.c gl_view.c gl_warp.c

186
nq/source/gl_ngraph.c Normal file
View file

@ -0,0 +1,186 @@
/*
gl_ngraph.c
(description)
Copyright (C) 1996-1997 Id Software, Inc.
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdio.h>
#include "QF/compat.h"
#include "QF/cvar.h"
#include "QF/draw.h"
#include "QF/vid.h"
#include "client.h"
#include "glquake.h"
#include "sbar.h"
extern byte *draw_chars; // 8*8 graphic characters
extern qboolean lighthalf;
extern cvar_t *r_netgraph;
extern cvar_t *r_netgraph_alpha;
extern cvar_t *r_netgraph_box;
int netgraphtexture; // netgraph texture
#define NET_GRAPHHEIGHT 32
//XXXstatic byte ngraph_texels[NET_GRAPHHEIGHT][NET_TIMINGS];
static void
R_LineGraph (int x, int h)
{
#if 0
int i;
int s;
int color;
s = NET_GRAPHHEIGHT;
if (h == 10000)
color = 0x6f; // yellow
else if (h == 9999)
color = 0x4f; // red
else if (h == 9998)
color = 0xd0; // blue
else
color = 0xfe; // white
if (h > s)
h = s;
for (i = 0; i < h; i++)
if (i & 1)
ngraph_texels[NET_GRAPHHEIGHT - i - 1][x] = 0xff;
else
ngraph_texels[NET_GRAPHHEIGHT - i - 1][x] = (byte) color;
for (; i < s; i++)
ngraph_texels[NET_GRAPHHEIGHT - i - 1][x] = (byte) 0xff;
#endif
}
void
Draw_CharToNetGraph (int x, int y, int num)
{
#if 0
int row, col;
byte *source;
int drawline;
int nx;
row = num >> 4;
col = num & 15;
source = draw_chars + (row << 10) + (col << 3);
for (drawline = 8; drawline; drawline--, y++) {
for (nx = 0; nx < 8; nx++)
if (source[nx] != 255)
ngraph_texels[y][nx + x] = 0x60 + source[nx];
source += 128;
}
#endif
}
void
R_NetGraph (void)
{
#if 0
int a, x, i, y;
int lost;
char st[80];
unsigned int ngraph_pixels[NET_GRAPHHEIGHT][NET_TIMINGS];
x = 0;
lost = CL_CalcNet ();
for (a = 0; a < NET_TIMINGS; a++) {
i = (cls.netchan.outgoing_sequence - a) & NET_TIMINGSMASK;
R_LineGraph (NET_TIMINGS - 1 - a, packet_latency[i]);
}
// now load the netgraph texture into gl and draw it
for (y = 0; y < NET_GRAPHHEIGHT; y++)
for (x = 0; x < NET_TIMINGS; x++)
ngraph_pixels[y][x] = d_8to24table[ngraph_texels[y][x]];
x = cl_hudswap->int_val ? vid.width - (NET_TIMINGS + 16): 0 ;
y = vid.height - sb_lines - 24 - NET_GRAPHHEIGHT - 1;
if (r_netgraph_alpha->value < 0.995) // roundoff
glColor4f (1, 1, 1, r_netgraph_alpha->value);
if (r_netgraph_box->int_val)
Draw_TextBox (x, y, NET_TIMINGS / 8, NET_GRAPHHEIGHT / 8 + 1);
y += 8;
snprintf (st, sizeof (st), "%3i%% packet loss", lost);
if (cl_hudswap->int_val) {
Draw_String8 (vid.width - ((strlen (st) * 8) + 8), y, st);
} else {
Draw_String8 (8, y, st);
}
x = cl_hudswap->int_val ? vid.width - (NET_TIMINGS + 8) : 8;
y += 8;
glBindTexture (GL_TEXTURE_2D, netgraphtexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format,
NET_TIMINGS, NET_GRAPHHEIGHT, 0, GL_RGBA,
GL_UNSIGNED_BYTE, ngraph_pixels);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x, y);
glTexCoord2f (1, 0);
glVertex2f (x + NET_TIMINGS, y);
glTexCoord2f (1, 1);
glVertex2f (x + NET_TIMINGS, y + NET_GRAPHHEIGHT);
glTexCoord2f (0, 1);
glVertex2f (x, y + NET_GRAPHHEIGHT);
glEnd ();
glColor3ubv (lighthalf_v);
#endif
}

View file

@ -62,8 +62,6 @@ extern cvar_t *r_netgraph;
extern void GDT_Init ();
extern entity_t r_worldentity;
/*
R_Envmap_f

View file

@ -782,7 +782,7 @@ SCR_RSShot_f (void)
st[sizeof (st) - 1] = 0;
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, h - 11, w);
strncpy (st, name->string, sizeof (st));
strncpy (st, cl_name->string, sizeof (st));
st[sizeof (st) - 1] = 0;
SCR_DrawStringToSnap (st, newbuf, w - strlen (st) * 8, h - 21, w);
@ -938,10 +938,9 @@ SCR_UpdateScreen (void)
// draw any areas not covered by the refresh
SCR_TileClear ();
#if 0 // R_NetGraph qw-only?
if (r_netgraph->int_val)
R_NetGraph ();
#endif
if (cl.intermission == 1 && key_dest == key_game) {
Sbar_IntermissionOverlay ();
} else if (cl.intermission == 2 && key_dest == key_game) {

View file

@ -76,10 +76,7 @@ V_CalcBlend (void)
int i;
for (i = 0; i < NUM_CSHIFTS; i++) {
if (!gl_cshiftpercent->value)
continue;
a2 = ((cl.cshifts[i].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
a2 = cl.cshifts[i].percent / 255.0;
if (!a2)
continue;