2 Copyright (C) 1996-1997 Id Software, Inc.
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 // d_modech.c: called when mode has just changed
25 int d_vrectx
, d_vrecty
, d_vrectright_particle
, d_vrectbottom_particle
;
27 int d_y_aspect_shift
, d_pix_min
, d_pix_max
, d_pix_shift
;
29 int d_scantable
[MAXHEIGHT
];
30 short *zspantable
[MAXHEIGHT
];
41 static qboolean protectset8
= false;
45 Sys_MakeCodeWriteable ((int)D_PolysetAff8Start
,
46 (int)D_PolysetAff8End
- (int)D_PolysetAff8Start
);
59 void D_ViewChanged (void)
64 rowbytes
= WARP_WIDTH
;
66 rowbytes
= vid
.rowbytes
;
68 scale_for_mip
= xscale
;
70 scale_for_mip
= yscale
;
72 d_zrowbytes
= vid
.width
* 2;
75 d_pix_min
= r_refdef
.vrect
.width
/ 320;
79 d_pix_max
= (int)((float)r_refdef
.vrect
.width
/ (320.0 / 4.0) + 0.5);
80 d_pix_shift
= 8 - (int)((float)r_refdef
.vrect
.width
/ 320.0 + 0.5);
84 if (pixelAspect
> 1.4)
89 d_vrectx
= r_refdef
.vrect
.x
;
90 d_vrecty
= r_refdef
.vrect
.y
;
91 d_vrectright_particle
= r_refdef
.vrectright
- d_pix_max
;
92 d_vrectbottom_particle
=
93 r_refdef
.vrectbottom
- (d_pix_max
<< d_y_aspect_shift
);
98 for (i
=0 ; i
<vid
.height
; i
++)
100 d_scantable
[i
] = i
*rowbytes
;
101 zspantable
[i
] = d_pzbuffer
+ i
*d_zwidth
;