1 //
2 // Copyright(C) 1993-1996 Id Software, Inc.
3 // Copyright(C) 2005-2014 Simon Howard
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // DESCRIPTION:
16 //  Sky rendering. The DOOM sky is a texture map like any
17 //  wall, wrapping around. A 1024 columns equal 360 degrees.
18 //  The default sky map is 256 columns and repeats 4 times
19 //  on a 320 screen?
20 //
21 //
22 
23 
24 
25 // Needed for FRACUNIT.
26 #include "m_fixed.h"
27 
28 // Needed for Flat retrieval.
29 #include "r_data.h"
30 
31 
32 #include "r_sky.h"
33 
34 //
35 // sky mapping
36 //
37 int			skyflatnum;
38 int			skytexture = -1; // [crispy] initialize
39 int			skytexturemid;
40 
41 
42 
43 //
44 // R_InitSkyMap
45 // Called whenever the view size changes.
46 //
R_InitSkyMap(void)47 void R_InitSkyMap (void)
48 {
49   // skyflatnum = R_FlatNumForName ( SKYFLATNAME );
50     // [crispy] stretch sky
51     if (skytexture == -1)
52     {
53         return;
54     }
55     if ((crispy->stretchsky = crispy->freelook || crispy->mouselook || crispy->pitch))
56     {
57         skytexturemid = -28*FRACUNIT * (textureheight[skytexture] >> FRACBITS) / SKYSTRETCH_HEIGHT;
58     }
59     else
60     skytexturemid = ORIGHEIGHT/2*FRACUNIT;
61 }
62 
63