1 /*
2 	d_zpoint.c
3 
4 	software driver module for drawing z-buffered points
5 
6 	Copyright (C) 1996-1997  Id Software, Inc.
7 
8 	This program is free software; you can redistribute it and/or
9 	modify it under the terms of the GNU General Public License
10 	as published by the Free Software Foundation; either version 2
11 	of the License, or (at your option) any later version.
12 
13 	This program is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 	See the GNU General Public License for more details.
18 
19 	You should have received a copy of the GNU General Public License
20 	along with this program; if not, write to:
21 
22 		Free Software Foundation, Inc.
23 		59 Temple Place - Suite 330
24 		Boston, MA  02111-1307, USA
25 
26 */
27 #ifdef HAVE_CONFIG_H
28 # include "config.h"
29 #endif
30 
31 #define NH_DEFINE
32 #include "namehack.h"
33 
34 #include "QF/sys.h"
35 
36 #include "d_local.h"
37 #include "r_internal.h"
38 #include "vid_internal.h"
39 
40 
41 void
sw32_D_DrawZPoint(void)42 sw32_D_DrawZPoint (void)
43 {
44 	short      *pz;
45 	int         izi;
46 
47 	pz = sw32_d_pzbuffer + (sw32_d_zwidth * sw32_r_zpointdesc.v) + sw32_r_zpointdesc.u;
48 	izi = (int) (sw32_r_zpointdesc.zi * 0x8000);
49 
50 	if (*pz <= izi) {
51 		*pz = izi;
52 		switch(sw32_r_pixbytes)
53 		{
54 		case 1:
55 			((byte *) sw32_d_viewbuffer) [sw32_d_scantable[sw32_r_zpointdesc.v] +
56 									 sw32_r_zpointdesc.u] = sw32_r_zpointdesc.color;
57 			break;
58 		case 2:
59 			((short *) sw32_d_viewbuffer) [sw32_d_scantable[sw32_r_zpointdesc.v] +
60 									  sw32_r_zpointdesc.u] =
61 				sw32_8to16table[sw32_r_zpointdesc.color];
62 			break;
63 		case 4:
64 			((int *) sw32_d_viewbuffer) [sw32_d_scantable[sw32_r_zpointdesc.v] +
65 									sw32_r_zpointdesc.u] =
66 				d_8to24table[sw32_r_zpointdesc.color];
67 			break;
68 		default:
69 			Sys_Error("D_DrawZPoint: unsupported r_pixbytes %i", sw32_r_pixbytes);
70 		}
71 	}
72 }
73