]> icculus.org git repositories - taylor/freespace2.git/blob - include/starfield.h
make numlock not overlap with pause
[taylor/freespace2.git] / include / starfield.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Starfield/StarField.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Code to handle and draw starfields, background space image bitmaps, floating
16  * debris, etc.
17  *
18  * $Log$
19  * Revision 1.2  2002/06/09 04:41:15  relnev
20  * added copyright header
21  *
22  * Revision 1.1.1.1  2002/05/03 03:28:12  root
23  * Initial import.
24  *
25  * 
26  * 11    7/21/99 8:10p Dave
27  * First run of supernova effect.
28  * 
29  * 10    6/03/99 6:37p Dave
30  * More TNT fun. Made perspective bitmaps more flexible.
31  * 
32  * 9     5/09/99 6:00p Dave
33  * Lots of cool new effects. E3 build tweaks.
34  * 
35  * 8     5/07/99 1:59p Johnson
36  * Tweaked background bitmaps a bit.
37  * 
38  * 7     4/23/99 5:53p Dave
39  * Started putting in new pof nebula support into Fred.
40  * 
41  * 6     4/07/99 6:22p Dave
42  * Fred and Freespace support for multiple background bitmaps and suns.
43  * Fixed link errors on all subprojects. Moved encrypt_init() to
44  * cfile_init() and lcl_init(), since its safe to call twice.
45  * 
46  * 5     3/31/99 8:24p Dave
47  * Beefed up all kinds of stuff, incluging beam weapons, nebula effects
48  * and background nebulae. Added per-ship non-dimming pixel colors.
49  * 
50  * 4     11/14/98 5:33p Dave
51  * Lots of nebula work. Put in ship contrails.
52  * 
53  * 3     11/05/98 5:55p Dave
54  * Big pass at reducing #includes
55  * 
56  * 2     10/07/98 10:54a Dave
57  * Initial checkin.
58  * 
59  * 1     10/07/98 10:51a Dave
60  * 
61  * 21    4/11/98 6:53p John
62  * Added first rev of subspace effect.
63  * 
64  * 20    4/07/98 4:17p John
65  * Made Fred be able to move suns.  Made suns actually affect the lighting
66  * in the game.
67  * 
68  * 19    3/21/98 7:36p Lawrance
69  * Move jump nodes to own lib.
70  * 
71  * 18    3/19/98 12:29p Lawrance
72  * Fix jumpnode targeting bug on the target monitor
73  * 
74  * 17    3/15/98 3:41p Allender
75  * new sexpression to gauge whether a ship warped out in proximity of jump
76  * node
77  * 
78  * 16    3/11/98 5:33p Lawrance
79  * Support rendering and targeting of jump nodes
80  * 
81  * 15    3/10/98 4:26p Hoffoss
82  * Changed jump node structure to include a name.  Position is now taken
83  * from the object (each jump node has an associated object now).
84  * 
85  * 14    3/06/98 5:30p Hoffoss
86  * Added jump node rendering code to FreeSpace.
87  * 
88  * 13    2/26/98 10:08p Hoffoss
89  * Rewrote state saving and restoring to fix bugs and simplify the code.
90  * 
91  * 12    2/06/98 3:08p Mike
92  * More asteroid stuff, including resolving conflicts between the two
93  * asteroid_field structs!
94  * 
95  * 11    1/18/98 4:24p John
96  * Detect when view camera "cuts" and tell the star code about it so it
97  * won't blur stars and debris between the last frame and this frame.
98  * 
99  * 10    8/25/97 5:56p Hoffoss
100  * Added multiple asteroid field support, loading and saving of asteroid
101  * fields, and ship score field to Fred.
102  * 
103  * 9     8/05/97 10:18a Lawrance
104  * my_rand() being used temporarily instead of rand()
105  * 
106  * 8     2/17/97 3:06p Hoffoss
107  * Changed header description.
108  * 
109  * 7     2/14/97 3:29p Hoffoss
110  * Added header for MSDEV to fill in.
111  *
112  * $NoKeywords: $
113  */
114
115 #ifndef _STARFIELD_H
116 #define _STARFIELD_H
117
118 #include "parselo.h"
119 #include "cfile.h"
120
121 #define MAX_STARFIELD_BITMAP_LISTS      1
122 #define MAX_STARFIELD_BITMAPS                   60
123 #define MAX_ASTEROID_FIELDS                     4
124
125 // nice low polygon background
126 #define BACKGROUND_MODEL_FILENAME                                       "spherec.pof"
127
128 // global info (not individual instances)
129 typedef struct starfield_bitmap {
130         char filename[MAX_FILENAME_LEN+1];                              // bitmap filename
131         char glow_filename[MAX_FILENAME_LEN+1];         // only for suns        
132         int bitmap;                                                                                             // bitmap handle
133         int glow_bitmap;                                                                                // only for suns
134         int xparent;    
135         float r, g, b, i;                                                                               // only for suns
136 } starfield_bitmap;
137
138 // starfield bitmap instance
139 typedef struct starfield_bitmap_instance {
140         char filename[MAX_FILENAME_LEN+1];                              // used to match up into the starfield_bitmap array     
141         float scale_x, scale_y;                                                         // x and y scale
142         int div_x, div_y;                                                                               // # of x and y divisions
143         angles ang;                                                                                             // angles from fred
144 } starfield_bitmap_instance;
145
146 // background bitmaps
147 extern starfield_bitmap Starfield_bitmaps[MAX_STARFIELD_BITMAPS];
148 extern starfield_bitmap_instance Starfield_bitmap_instance[MAX_STARFIELD_BITMAPS];
149 extern int Num_starfield_bitmaps;
150
151 // sun bitmaps and sun glow bitmaps
152 extern starfield_bitmap Sun_bitmaps[MAX_STARFIELD_BITMAPS];
153 extern starfield_bitmap_instance Suns[MAX_STARFIELD_BITMAPS];
154 extern int Num_suns;
155
156 extern const int MAX_STARS;
157 extern int Num_stars;
158
159 // call on game startup
160 void stars_init();
161
162 // call this in game_post_level_init() so we know whether we're running in full nebula mode or not
163 void stars_level_init();
164
165 // This *must* be called to initialize the lighting.
166 // You can turn off all the stars and suns and nebulas, though.
167 void stars_draw(int show_stars, int show_suns, int show_nebulas, int show_subspace);
168 // void calculate_bitmap_matrix(starfield_bitmaps *bm, vector *v);
169 // void calculate_bitmap_points(starfield_bitmaps *bm, float bank = 0.0f);
170
171 // draw the corresponding glow for sun_n
172 void stars_draw_sun_glow(int sun_n);
173
174 // Call when the viewer camera "cuts" so stars and debris
175 // don't draw incorrect blurs between last frame and this frame.
176 void stars_camera_cut();
177
178 // call this to set a specific model as the background model
179 void stars_set_background_model(char *model_name, char *texture_name);
180
181 // lookup a starfield bitmap, return index or -1 on fail
182 int stars_find_bitmap(char *name);
183
184 // lookup a sun by bitmap filename, return index or -1 on fail
185 int stars_find_sun(char *name);
186
187 // get the world coords of the sun pos on the unit sphere.
188 void stars_get_sun_pos(int sun_n, vector *pos);
189
190 #endif
191