1 #ifndef _VIEW_CONTROL_
2 #define _VIEW_CONTROL_
3 /*
4 
5 	Copyright (C) 1991-2001 and beyond by Bungie Studios, Inc.
6 	and the "Aleph One" developers.
7 
8 	This program is free software; you can redistribute it and/or modify
9 	it under the terms of the GNU General Public License as published by
10 	the Free Software Foundation; either version 3 of the License, or
11 	(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.  See the
16 	GNU General Public License for more details.
17 
18 	This license is contained in the file "COPYING",
19 	which is included with this source code; it is available online at
20 	http://www.gnu.org/licenses/gpl.html
21 
22 	May 22, 2000 (Loren Petrich)
23 
24 	View controller. This controls various parameters of the viewing.
25 
26 	The parameters are, in turn, controllable with XML.
27 
28 	May 23, 2000 (Loren Petrich):
29 
30 	Added field-of-view control
31 
32 	May 24, 2000 (Loren Petrich):
33 
34 	Added landscape control
35 
36 Nov 29, 2000 (Loren Petrich):
37 	Added making view-folding effect optional
38 	Added making teleport static/fold effect optional
39 
40 Dec 17, 2000 (Loren Petrich:
41 	Added teleport-sound control for Marathon 1 compatibility
42 */
43 
44 #include "world.h"
45 #include "FontHandler.h"
46 #include "shape_descriptors.h"
47 
48 // Returns whether or not the overhead map can possibly be active
49 bool View_MapActive();
50 
51 // Accessors for field-of-view values (normal, extravision, tunnel vision):
52 float View_FOV_Normal();
53 float View_FOV_ExtraVision();
54 float View_FOV_TunnelVision();
55 
56 // Move field-of-view value closer to some target value;
57 // returns whether or not the FOV had been changed.
58 bool View_AdjustFOV(float& FOV, float FOV_Target);
59 
60 // Indicates whether to fix the horizontal or the vertical field-of-view angle
61 // (default: fix vertical FOV angle)
62 bool View_FOV_FixHorizontalNotVertical();
63 
64 // Indicates whether to do fold-in/fold-out effect when one is teleporting
65 bool View_DoFoldEffect();
66 
67 // Indicates whether to do the "static" effect when one is teleporting
68 bool View_DoStaticEffect();
69 
70 // Indicates whether to skip all teleport effects teleporting into a level
71 bool View_DoInterlevelTeleportInEffects();
72 
73 // Indicates whether to skip all teleport effects teleporting out of a level
74 bool View_DoInterlevelTeleportOutEffects();
75 
76 // Gets the on-screen-display font
77 FontSpecifier& GetOnScreenFont();
78 
79 // Landscape stuff
80 
81 struct LandscapeOptions
82 {
83 	// 2^(HorizExp) is the number of texture repeats when going in a circle;
84 	// it is a horizontal scaling factor
85 	short HorizExp;
86 	// 2^(VertExp) is a vertical scaling factor, which creates an amount of scaling
87 	// equal to the corresponding horizontal scaling factor.
88 	short VertExp;
89 	// Aspect-ratio exponent to use in OpenGL rendering;
90 	// (height) = 2^(-OGL_AspRatExp)*(width).
91 	// Necessary because OpenGL prefers powers of 2, and Bungie's landscapes have heights
92 	// that are not powers of 2.
93 	short OGL_AspRatExp;
94 	// Whether the texture repeats in the vertical direction (true: like Marathon 1)
95 	// or gets clamped in the vertical direction (false: like Marathon 2/oo)
96 	bool VertRepeat;
97 	// This is the azimuth or yaw (full circle = 512);
98 	// the texture is shifted leftward, relative to view direction, by this amount.
99 	angle Azimuth;
100 
101 	// Constructor: sets everything to defaults appropriate for standard textures
102 	// Same scale for horizontal and vertical, 2^1 = 2 repeats,
103 	// OpenGL hight is half width, and the azimuth is zero
LandscapeOptionsLandscapeOptions104 	LandscapeOptions(): HorizExp(1), VertExp(1), OGL_AspRatExp(0), VertRepeat(false), Azimuth(0) {}
105 };
106 
107 LandscapeOptions *View_GetLandscapeOptions(shape_descriptor Desc);
108 
109 
110 class InfoTree;
111 void parse_mml_view(const InfoTree& root);
112 void reset_mml_view();
113 void parse_mml_landscapes(const InfoTree& root);
114 void reset_mml_landscapes();
115 
116 #endif
117