2001-08-25 02:47:11 +00:00
|
|
|
/*
|
|
|
|
sw32_graph.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
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-02-22 07:32:34 +00:00
|
|
|
#define NH_DEFINE
|
|
|
|
#include "namehack.h"
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-08-25 02:47:11 +00:00
|
|
|
#include "QF/cvar.h"
|
|
|
|
#include "QF/draw.h"
|
|
|
|
#include "QF/render.h"
|
|
|
|
#include "QF/sys.h"
|
|
|
|
|
2012-02-14 08:28:09 +00:00
|
|
|
#include "r_internal.h"
|
2012-02-17 07:13:56 +00:00
|
|
|
#include "vid_internal.h"
|
2021-07-10 15:09:41 +00:00
|
|
|
#include "vid_sw.h"
|
2001-08-25 02:47:11 +00:00
|
|
|
|
|
|
|
/*
|
2001-08-28 22:46:02 +00:00
|
|
|
R_LineGraph
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2010-01-13 06:42:26 +00:00
|
|
|
Called by only R_DisplayTime
|
2001-08-25 02:47:11 +00:00
|
|
|
*/
|
2012-02-18 13:28:42 +00:00
|
|
|
void
|
2021-07-11 01:59:27 +00:00
|
|
|
sw32_R_LineGraph (int x, int y, int *h_vals, int count, int height)
|
2001-08-25 02:47:11 +00:00
|
|
|
{
|
2001-08-28 22:46:02 +00:00
|
|
|
int h, i, s, color;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2001-08-28 22:46:02 +00:00
|
|
|
// FIXME: disable on no-buffer adapters, or put in the driver
|
2021-07-11 01:59:27 +00:00
|
|
|
s = height;
|
2001-08-25 02:47:11 +00:00
|
|
|
|
2001-08-28 22:46:02 +00:00
|
|
|
while (count--) {
|
|
|
|
h = *h_vals++;
|
|
|
|
|
|
|
|
if (h == 10000)
|
|
|
|
color = 0x6f; // yellow
|
|
|
|
else if (h == 9999)
|
|
|
|
color = 0x4f; // red
|
|
|
|
else if (h == 9998)
|
|
|
|
color = 0xd0; // blue
|
|
|
|
else
|
|
|
|
color = 0xff; // pink
|
2012-05-21 23:23:22 +00:00
|
|
|
|
2001-08-28 22:46:02 +00:00
|
|
|
if (h > s)
|
|
|
|
h = s;
|
|
|
|
|
2021-07-10 15:09:41 +00:00
|
|
|
switch(sw32_ctx->pixbytes) {
|
2001-08-28 22:46:02 +00:00
|
|
|
case 1:
|
|
|
|
{
|
|
|
|
byte *dest = (byte *) vid.buffer + vid.rowbytes * y + x;
|
2021-07-10 15:12:03 +00:00
|
|
|
for (i = 0; i < h; i++, dest -= vid.rowbytes)
|
2001-08-28 22:46:02 +00:00
|
|
|
*dest = color;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
{
|
|
|
|
short *dest = (short *) vid.buffer +
|
|
|
|
(vid.rowbytes >> 1) * y + x;
|
2012-02-22 07:32:34 +00:00
|
|
|
color = sw32_8to16table[color];
|
2021-07-10 15:12:03 +00:00
|
|
|
for (i = 0; i < h; i++, dest -= (vid.rowbytes >> 1))
|
2001-08-28 22:46:02 +00:00
|
|
|
*dest = color;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
{
|
|
|
|
int *dest = (int *) vid.buffer +
|
|
|
|
(vid.rowbytes >> 2) * y + x;
|
|
|
|
color = d_8to24table[color];
|
2021-07-10 15:12:03 +00:00
|
|
|
for (i = 0; i < h; i++, dest -= (vid.rowbytes >> 2))
|
2001-08-28 22:46:02 +00:00
|
|
|
*dest = color;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2002-05-14 06:12:29 +00:00
|
|
|
Sys_Error("R_LineGraph: unsupported r_pixbytes %i",
|
2021-07-10 15:09:41 +00:00
|
|
|
sw32_ctx->pixbytes);
|
2001-08-28 22:46:02 +00:00
|
|
|
}
|
2001-08-25 02:47:11 +00:00
|
|
|
}
|
|
|
|
}
|