FS2_Open
Open source remastering of the Freespace 2 engine
neb.cpp
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 #include "bmpman/bmpman.h"
13 #include "cmdline/cmdline.h"
14 #include "ddsutils/ddsutils.h"
15 #include "debugconsole/console.h"
16 #include "freespace2/freespace.h"
17 #include "jpgutils/jpgutils.h"
18 #include "mission/missionparse.h"
19 #include "nebula/neb.h"
20 #include "object/object.h"
21 #include "parse/parselo.h"
22 #include "pcxutils/pcxutils.h"
23 #include "pngutils/pngutils.h"
24 #include "render/3d.h"
25 #include "ship/ship.h"
26 #include "starfield/starfield.h"
27 #include "tgautils/tgautils.h"
28 
29 
30 // --------------------------------------------------------------------------------------------------------
31 // NEBULA DEFINES/VARS
32 //
33 
34 bool Nebula_sexp_used = false;
35 
36 static ubyte Neb2_fog_color_r = 0;
37 static ubyte Neb2_fog_color_g = 0;
38 static ubyte Neb2_fog_color_b = 0;
39 
40 static ubyte *Neb2_htl_fog_data = NULL;
41 
42 // #define NEB2_THUMBNAIL
43 
44 /*
45 3D CARDS THAT FOG PROPERLY
46 Voodoo1
47 Voodoo2
48 G200
49 TNT
50 
51 3D CARDS THAT DON'T FOG PROPERLY
52 Permedia2
53 AccelStar II
54 */
55 
56 // if nebula rendering is active (DCF stuff - not mission specific)
58 
59 // array of neb2 poofs
61  "", "", "", "", "", ""
62 };
63 int Neb2_poofs[MAX_NEB2_POOFS] = { -1, -1, -1, -1, -1, -1 };
64 int Neb2_poof_flags = ( (1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<4) | (1<<5) );
66 
67 // array of neb2 bitmaps
69  "", "", "", "", "", ""
70 };
71 int Neb2_bitmap[MAX_NEB2_BITMAPS] = { -1, -1, -1, -1, -1, -1 };
73 
74 // texture to use for this level
76 
77 // nebula flags
78 #define NF_USED (1<<0) // if this nebula slot is used
79 
80 float max_rotation = 3.75f;
81 float neb2_flash_fade = 0.3f;
82 
83 // fog values for different ship types
84 //Why the heck is this still here? Commenting out. -WMC
85 /*
86 float Neb_ship_fog_vals_glide[MAX_SHIP_TYPE_COUNTS][2] = {
87  {0.0f, 0.0f}, // SHIP_TYPE_NONE
88  {10.0f, 500.0f}, // SHIP_TYPE_CARGO
89  {10.0f, 500.0f}, // SHIP_TYPE_FIGHTER_BOMBER
90  {10.0f, 600.0f}, // SHIP_TYPE_CRUISER
91  {10.0f, 600.0f}, // SHIP_TYPE_FREIGHTER
92  {10.0f, 750.0f}, // SHIP_TYPE_CAPITAL
93  {10.0f, 500.0f}, // SHIP_TYPE_TRANSPORT
94  {10.0f, 500.0f}, // SHIP_TYPE_REPAIR_REARM
95  {10.0f, 500.0f}, // SHIP_TYPE_NAVBUOY
96  {10.0f, 500.0f}, // SHIP_TYPE_SENTRYGUN
97  {10.0f, 600.0f}, // SHIP_TYPE_ESCAPEPOD
98  {10.0f, 1000.0f}, // SHIP_TYPE_SUPERCAP
99  {10.0f, 500.0f}, // SHIP_TYPE_STEALTH
100  {10.0f, 500.0f}, // SHIP_TYPE_FIGHTER
101  {10.0f, 500.0f}, // SHIP_TYPE_BOMBER
102  {10.0f, 750.0f}, // SHIP_TYPE_DRYDOCK
103  {10.0f, 600.0f}, // SHIP_TYPE_AWACS
104  {10.0f, 600.0f}, // SHIP_TYPE_GAS_MINER
105  {10.0f, 600.0f}, // SHIP_TYPE_CORVETTE
106  {10.0f, 1000.0f}, // SHIP_TYPE_KNOSSOS_DEVICE
107 };
108 */
109 /*
110 float Neb_ship_fog_vals_d3d[MAX_SHIP_TYPE_COUNTS][2] = {
111  {0.0f, 0.0f}, // SHIP_TYPE_NONE
112  {10.0f, 500.0f}, // SHIP_TYPE_CARGO
113  {10.0f, 500.0f}, // SHIP_TYPE_FIGHTER_BOMBER
114  {10.0f, 600.0f}, // SHIP_TYPE_CRUISER
115  {10.0f, 600.0f}, // SHIP_TYPE_FREIGHTER
116  {10.0f, 750.0f}, // SHIP_TYPE_CAPITAL
117  {10.0f, 500.0f}, // SHIP_TYPE_TRANSPORT
118  {10.0f, 500.0f}, // SHIP_TYPE_REPAIR_REARM
119  {10.0f, 500.0f}, // SHIP_TYPE_NAVBUOY
120  {10.0f, 500.0f}, // SHIP_TYPE_SENTRYGUN
121  {10.0f, 600.0f}, // SHIP_TYPE_ESCAPEPOD
122  {10.0f, 1000.0f}, // SHIP_TYPE_SUPERCAP
123  {10.0f, 500.0f}, // SHIP_TYPE_STEALTH
124  {10.0f, 500.0f}, // SHIP_TYPE_FIGHTER
125  {10.0f, 500.0f}, // SHIP_TYPE_BOMBER
126  {10.0f, 750.0f}, // SHIP_TYPE_DRYDOCK
127  {10.0f, 600.0f}, // SHIP_TYPE_AWACS
128  {10.0f, 600.0f}, // SHIP_TYPE_GAS_MINER
129  {10.0f, 600.0f}, // SHIP_TYPE_CORVETTE
130  {10.0f, 1000.0f}, // SHIP_TYPE_KNOSSOS_DEVICE
131 };
132 */
133 //WMC - these were originally indexed to SHIP_TYPE_FIGHTER_BOMBER
134 const static float Default_fog_near = 10.0f;
135 const static float Default_fog_far = 500.0f;
136 
137 // fog near and far values for rendering the background nebula
138 #define NEB_BACKG_FOG_NEAR_GLIDE 2.5f
139 #define NEB_BACKG_FOG_NEAR_D3D 4.5f
140 #define NEB_BACKG_FOG_FAR_GLIDE 10.0f
141 #define NEB_BACKG_FOG_FAR_D3D 10.0f
144 
145 // stats
146 int pneb_tried = 0; // total pnebs tried to render
147 int pneb_tossed_alpha = 0; // pnebs tossed because of alpha optimization
148 int pneb_tossed_dot = 0; // pnebs tossed because of dot product
149 int pneb_tossed_off = 0; // pnebs tossed because of being offscree
150 int neb_tried = 0; // total nebs tried
151 int neb_tossed_alpha = 0; // nebs tossed because of alpha
152 int neb_tossed_dot = 0; // nebs tossed because of dot product
153 int neb_tossed_count = 0; // nebs tossed because of max render count
154 
155 // the AWACS suppression level for the nebula
156 float Neb2_awacs = -1.0f;
157 
158 // The visual render distance multipliers for the nebula
159 float Neb2_fog_near_mult = 1.0f;
160 float Neb2_fog_far_mult = 1.0f;
161 
162 // how many "slices" are in the current player nebuls
163 int Neb2_slices = 5;
164 
166 
168  { // lowest detail level
169  0.575f, // max alpha for this detail level in Glide
170  0.71f, // max alpha for this detail level in D3d
171  0.13f, // break alpha (below which, poofs don't draw). this affects the speed and visual quality a lot
172  150.0f, 150.0f / 1.3333f, // x and y alpha fade/break values. adjust alpha on the polys as they move offscreen
173  510.0f, // total dimension of player poof cube
174  50.0f, // inner radius of the player poof cube
175  250.0f, // outer radius of the player pood cube
176  120.0f, // radius of the poofs
177  1.0f, 1.0f, 1.0f // width, height, depth jittering. best left at 1.0
178  },
179  { // 2nd lowest detail level
180  0.575f, // max alpha for this detail level in Glide
181  0.71f, // max alpha for this detail level in D3d
182  0.125f, // break alpha (below which, poofs don't draw). this affects the speed and visual quality a lot
183  300.0f, 300.0f / 1.3333f, // x and y alpha fade/break values. adjust alpha on the polys as they move offscreen
184  550.0f, // total dimension of player poof cube
185  100.0f, // inner radius of the player poof cube
186  250.0f, // outer radius of the player pood cube
187  125.0f, // radius of the poofs
188  1.0f, 1.0f, 1.0f // width, height, depth jittering. best left at 1.0
189  },
190  { // 2nd highest detail level
191  0.575f, // max alpha for this detail level in Glide
192  0.71f, // max alpha for this detail level in D3d
193  0.1f, // break alpha (below which, poofs don't draw). this affects the speed and visual quality a lot
194  300.0f, 300.0f / 1.3333f, // x and y alpha fade/break values. adjust alpha on the polys as they move offscreen
195  550.0f, // total dimension of player poof cube
196  150.0f, // inner radius of the player poof cube
197  250.0f, // outer radius of the player pood cube
198  125.0f, // radius of the poofs
199  1.0f, 1.0f, 1.0f // width, height, depth jittering. best left at 1.0
200  },
201  { // higest detail level
202  0.475f, // max alpha for this detail level in Glide
203  0.575f, // max alpha for this detail level in D3d
204  0.05f, // break alpha (below which, poofs don't draw). this affects the speed and visual quality a lot
205  200.0f, 200.0f / 1.3333f, // x and y alpha fade/break values. adjust alpha on the polys as they move offscreen
206  750.0f, // total dimension of player poof cube
207  200.0f, // inner radius of the player poof cube
208  360.0f, // outer radius of the player pood cube
209  150.0f, // radius of the poofs
210  1.0f, 1.0f, 1.0f // width, height, depth jittering. best left at 1.0
211  },
212 };
213 neb2_detail *Nd = &Neb2_detail[MAX_DETAIL_LEVEL - 2];
214 
215 int Neb2_background_color[3] = {0, 0, 255}; // rgb background color (used for lame rendering)
216 
217 int Neb2_regen = 0;
218 
219 // --------------------------------------------------------------------------------------------------------
220 // NEBULA FORWARD DECLARATIONS
221 //
222 
223 // return the alpha the passed poof should be rendered with, for a 2 shell nebula
224 float neb2_get_alpha_2shell(float inner_radius, float outer_radius, float magic_num, vec3d *v);
225 
226 // return an alpha value for a bitmap offscreen based upon "break" value
227 float neb2_get_alpha_offscreen(float sx, float sy, float incoming_alpha);
228 
229 // do a pre-render of the background nebula
230 void neb2_pre_render(camid cid);
231 
232 // fill in the position of the eye for this frame
233 void neb2_get_eye_pos(vec3d *eye_vector);
234 
235 // fill in the eye orient for this frame
236 void neb2_get_eye_orient(matrix *eye_matrix);
237 
238 // get a (semi) random bitmap to use for a poof
239 int neb2_get_bitmap();
240 
241 // regenerate the player nebula
242 void neb2_regen();
243 
244 
245 // --------------------------------------------------------------------------------------------------------
246 // NEBULA FUNCTIONS
247 //
248 
249 // initialize neb2 stuff at game startup
250 void neb2_init()
251 {
252  char name[MAX_FILENAME_LEN];
253 
254  try
255  {
256  // read in the nebula.tbl
257  read_file_text("nebula.tbl", CF_TYPE_TABLES);
258  reset_parse();
259 
260  // background bitmaps
261  Neb2_bitmap_count = 0;
262  while (!optional_string("#end")) {
263  // nebula
264  required_string("+Nebula:");
266 
267  if (Neb2_bitmap_count < MAX_NEB2_BITMAPS) {
268  strcpy_s(Neb2_bitmap_filenames[Neb2_bitmap_count++], name);
269  }
270  else {
271  WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebulas (%d)!\nSkipping %s.", MAX_NEB2_BITMAPS, name);
272  }
273  }
274 
275  // poofs
276  Neb2_poof_count = 0;
277  while (!optional_string("#end")) {
278  // nebula
279  required_string("+Poof:");
281 
282  if (Neb2_poof_count < MAX_NEB2_POOFS) {
283  strcpy_s(Neb2_poof_filenames[Neb2_poof_count++], name);
284  }
285  else {
286  WarningEx(LOCATION, "nebula.tbl\nExceeded maximum number of nebula poofs (%d)!\nSkipping %s.", MAX_NEB2_POOFS, name);
287  }
288  }
289 
290  // should always have 6 neb poofs
291  Assert(Neb2_poof_count == 6);
292  }
293  catch (const parse::ParseException& e)
294  {
295  mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "nebula.tbl", e.what()));
296  return;
297  }
298 }
299 
300 // set detail level
302 {
303  // sanity
304  if (level < 0) {
305  Nd = &Neb2_detail[0];
306  return;
307  }
308  if (level >= MAX_DETAIL_LEVEL) {
309  Nd = &Neb2_detail[MAX_DETAIL_LEVEL-1];
310  return;
311  }
312 
313  Nd = &Neb2_detail[level];
314 
315  // regen the player neb
317 }
318 
320 {
321  if (r) *r = Neb2_fog_color_r;
322  if (g) *g = Neb2_fog_color_g;
323  if (b) *b = Neb2_fog_color_b;
324 }
325 
327 {
328  Nebula_sexp_used = false;
329 }
330 
331 // initialize nebula stuff - call from game_post_level_init(), so the mission has been loaded
333 {
334  int idx;
335 
336  // standalone servers can bail here
338  return;
339  }
340 
341  // Skip actual rendering if we're in FRED.
342  if(Fred_running)
343  {
345  return;
346  }
347 
348  // if the mission is not a fullneb mission, skip
351  Neb2_awacs = -1.0f;
352  return;
353  }
354 
356  // by default we'll use pof rendering
360  } else {
361  // Set a default colour just in case something goes wrong
362  Neb2_fog_color_r = 30;
363  Neb2_fog_color_g = 52;
364  Neb2_fog_color_b = 157;
365 
366  // OK, lets try something a bit more interesting
367  if (strlen(Neb2_texture_name)) {
368  Neb2_htl_fog_data = new ubyte[768];
369 
370  if ((Neb2_htl_fog_data != NULL) && (pcx_read_header(Neb2_texture_name, NULL, NULL, NULL, NULL, Neb2_htl_fog_data) == PCX_ERROR_NONE)) {
371  // based on the palette, get an average color value (this doesn't really account for actual pixel usage though)
372  ushort r = 0, g = 0, b = 0, pcount = 0;
373  for (idx = 0; idx < 768; idx += 3) {
374  if (Neb2_htl_fog_data[idx] || Neb2_htl_fog_data[idx+1] || Neb2_htl_fog_data[idx+2]) {
375  r = r + Neb2_htl_fog_data[idx];
376  g = g + Neb2_htl_fog_data[idx+1];
377  b = b + Neb2_htl_fog_data[idx+2];
378  pcount++;
379  }
380  }
381 
382  if (pcount > 0) {
383  Neb2_fog_color_r = (ubyte)(r / pcount);
384  Neb2_fog_color_g = (ubyte)(g / pcount);
385  Neb2_fog_color_b = (ubyte)(b / pcount);
386  } else {
387  // it's just black
388  Neb2_fog_color_r = Neb2_fog_color_g = Neb2_fog_color_b = 0;
389  }
390 
391  // done, now free up the palette data
392  if ( Neb2_htl_fog_data != NULL ) {
393  delete[] Neb2_htl_fog_data;
394  Neb2_htl_fog_data = NULL;
395  }
396  }
397  }
398 
400  }
401 
402  // load in all nebula bitmaps
403  for (idx=0; idx<Neb2_poof_count; idx++) {
404  if (Neb2_poofs[idx] < 0) {
406  }
407  }
408 
409  pneb_tried = 0;
410  pneb_tossed_alpha = 0;
411  pneb_tossed_dot = 0;
412  neb_tried = 0;
413  neb_tossed_alpha = 0;
414  neb_tossed_dot = 0;
415  neb_tossed_count = 0;
416 
417  // setup proper fogging values
418  Neb_backg_fog_near = NEB_BACKG_FOG_NEAR_D3D;
419  Neb_backg_fog_far = NEB_BACKG_FOG_FAR_D3D;
420 
421  // regen the nebula
423 
424  // if we are going to use fullneb, but aren't fullneb yet, then be sure to reset our mode
427  Neb2_awacs = -1.0f;
428  }
429 }
430 
431 // shutdown nebula stuff
433 {
434  int idx;
435 
436  // standalone servers can bail here
438  return;
439  }
440 
441  // if the mission is not a fullneb mission, skip
443  return;
444  }
445 
446  // unload all nebula bitmaps
447  for (idx=0; idx<Neb2_poof_count; idx++) {
448  if (Neb2_poofs[idx] >= 0) {
449  bm_release(Neb2_poofs[idx]);
450  Neb2_poofs[idx] = -1;
451  }
452  }
453 
454  // unflag the mission as being fullneb so stuff doesn't fog in the techdata room :D
456 
457  if (Neb2_htl_fog_data) {
458  delete[] Neb2_htl_fog_data;
459  Neb2_htl_fog_data = NULL;
460  }
461 }
462 
463 // call before beginning all rendering
465 {
466  // standalone servers can bail here
468  return;
469  }
470 
471  // if the mission is not a fullneb mission, skip
473  return;
474  }
475 
477  // RT The background needs to be the same colour as the fog and this seems
478  // to be the ideal place to do it
482 
487 
488  gr_clear();
489 
493 
494  return;
495  }
496 
497  // pre-render the real background nebula
498  neb2_pre_render(cid);
499 }
500 
501 // level paging code
503 {
504  int idx;
505 
506  // load in all nebula bitmaps
508  for (idx = 0; idx < Neb2_poof_count; idx++) {
509  if ( (Neb2_poofs[idx] >= 0) && (Neb2_poof_flags & (1<<idx)) ) {
511  }
512  }
513  }
514 }
515 
516 // should we not render this object because its obscured by the nebula?
517 int neb_skip_opt = 0;
518 DCF(neb_skip, "Toggles culling of objects obscured by nebula")
519 {
520  neb_skip_opt = !neb_skip_opt;
521  if (neb_skip_opt) {
522  dc_printf("Using neb object skipping!\n");
523  } else {
524  dc_printf("Not using neb object skipping!\n");
525  }
526 }
527 int neb2_skip_render(object *objp, float z_depth)
528 {
529  float fog_near, fog_far;
530 
531  // if we're never skipping
532  if (!neb_skip_opt) {
533  return 0;
534  }
535 
536  // lame rendering
538  return 0;
539  }
540 
541  // get near and far fog values based upon object type and rendering mode
542  neb2_get_adjusted_fog_values(&fog_near, &fog_far, objp);
543 
544  // by object type
545  switch( objp->type ) {
546  // some objects we always render
547  case OBJ_SHOCKWAVE:
548  case OBJ_JUMP_NODE:
549  case OBJ_NONE:
550  case OBJ_GHOST:
551  case OBJ_BEAM:
552  case OBJ_WAYPOINT:
553  return 0;
554 
555  // any weapon over 500 meters away
556  // Use the "far" distance multiplier here
557  case OBJ_WEAPON:
558  if (z_depth >= 500.0f * Neb2_fog_far_mult) {
559  return 1;
560  }
561  break;
562 
563  // any small ship over the fog limit, or any cruiser 50% further than the fog limit
564  case OBJ_SHIP:
565  ship_info *sip;
566  if ( (objp->instance >= 0) && (Ships[objp->instance].ship_info_index >= 0) ) {
567  sip = &Ship_info[Ships[objp->instance].ship_info_index];
568  } else {
569  return 0;
570  }
571 
572  // small ships over the fog limit by a small factor
573  if ( (sip->flags & SIF_SMALL_SHIP) && (z_depth >= (fog_far * 1.5f)) ) {
574  return 1;
575  }
576 
577  // big ships
578  if ( (sip->flags & SIF_BIG_SHIP) && (z_depth >= (fog_far * 2.0f)) ) {
579  return 1;
580  }
581 
582  // huge ships
583  if ( (sip->flags & SIF_HUGE_SHIP) && (z_depth >= (fog_far * 3.0f)) ) {
584  return 1;
585  }
586  break;
587 
588  // any fireball over the fog limit for small ships
589  case OBJ_FIREBALL:
590  return 0;
591  break;
592 
593  // any debris over the fog limit for small ships
594  case OBJ_DEBRIS:
595  return 0;
596  break;
597 
598  // any asteroids 50% farther than the fog limit for small ships
599  case OBJ_ASTEROID:
600  if (z_depth >= (fog_far * 1.5f)) {
601  return 1;
602  }
603  break;
604 
605  // hmmm. unknown object type - should probably let it through
606  default:
607  Int3();
608  return 0;
609  }
610  return 0;
611 }
612 
613 // extend LOD
614 float neb2_get_lod_scale(int objnum)
615 {
616  ship *shipp;
617  ship_info *sip;
618 
619  // bogus
620  if ( (objnum < 0)
621  || (objnum >= MAX_OBJECTS)
622  || (Objects[objnum].type != OBJ_SHIP)
623  || (Objects[objnum].instance < 0)
624  || (Objects[objnum].instance >= MAX_SHIPS)) {
625  return 1.0f;
626  }
627  shipp = &Ships[Objects[objnum].instance];
628  sip = &Ship_info[shipp->ship_info_index];
629 
630  // small ship?
631  if (sip->flags & SIF_SMALL_SHIP) {
632  return 1.8f;
633  } else if (sip->flags & SIF_BIG_SHIP) {
634  return 1.4f;
635  }
636 
637  // hmm
638  return 1.0f;
639 }
640 
641 
642 // --------------------------------------------------------------------------------------------------------
643 // NEBULA FORWARD DEFINITIONS
644 //
645 
646 // return the alpha the passed poof should be rendered with, for a 2 shell nebula
647 float neb2_get_alpha_2shell(float inner_radius, float outer_radius, float magic_num, vec3d *v)
648 {
649  float dist;
650  float alpha;
651  vec3d eye_pos;
652 
653  // get the eye position
654  neb2_get_eye_pos(&eye_pos);
655 
656  // determine what alpha to draw this bitmap with
657  // higher alpha the closer the bitmap gets to the eye
658  dist = vm_vec_dist_quick(&eye_pos, v);
659 
660  // if the point is inside the inner radius, alpha is based on distance to the player's eye,
661  // becoming more transparent as it gets close
662  if (dist <= inner_radius) {
663  // alpha per meter between the magic # and the inner radius
664  alpha = Nd->max_alpha_glide / (inner_radius - magic_num);
665 
666  // above value times the # of meters away we are
667  alpha *= (dist - magic_num);
668  return alpha < 0.0f ? 0.0f : alpha;
669  }
670  // if the point is outside the inner radius, it starts out as completely transparent at max
671  // outer radius, and becomes more opaque as it moves towards inner radius
672  else if (dist <= outer_radius) {
673  // alpha per meter between the outer radius and the inner radius
674  alpha = Nd->max_alpha_glide / (outer_radius - inner_radius);
675 
676  // above value times the range between the outer radius and the poof
677  return alpha < 0.0f ? 0.0f : alpha * (outer_radius - dist);
678  }
679 
680  // otherwise transparent
681  return 0.0f;
682 }
683 
684 // return an alpha value for a bitmap offscreen based upon "break" value
685 float neb2_get_alpha_offscreen(float sx, float sy, float incoming_alpha)
686 {
687  float alpha = 0.0f;
688  float per_pixel_x = incoming_alpha / (float)Nd->break_x;
689  float per_pixel_y = incoming_alpha / (float)Nd->break_y;
690  int off_x = ((sx < 0.0f) || (sx > (float)gr_screen.max_w));
691  int off_y = ((sy < 0.0f) || (sy > (float)gr_screen.max_h));
692  float off_x_amount = 0.0f;
693  float off_y_amount = 0.0f;
694 
695  // determine how many pixels outside we are
696  if (off_x) {
697  if (sx < 0.0f) {
698  off_x_amount = fl_abs(sx);
699  } else {
700  off_x_amount = sx - (float)gr_screen.max_w;
701  }
702  }
703  if (off_y) {
704  if (sy < 0.0f) {
705  off_y_amount = fl_abs(sy);
706  } else {
707  off_y_amount = sy - (float)gr_screen.max_h;
708  }
709  }
710 
711  // if offscreen X
712  if (off_x) {
713  // offscreen X and Y - and Y is greater
714  if (off_y && (off_y_amount > off_x_amount)) {
715  alpha = incoming_alpha - (off_y_amount * per_pixel_y);
716  } else {
717  alpha = incoming_alpha - (off_x_amount * per_pixel_x);
718  }
719  }
720  // offscreen y
721  else if (off_y) {
722  alpha = incoming_alpha - (off_y_amount * per_pixel_y);
723  }
724  // should never get here
725  else {
726  Int3();
727  }
728 
729  return alpha < 0.0f ? 0.0f : alpha;
730 }
731 
732 // -------------------------------------------------------------------------------------------------
733 // WACKY LOCAL PLAYER NEBULA STUFF
734 //
735 
737 
739 {
740  vec3d eye_pos;
741  float ws = Nd->cube_dim / (float)Neb2_slices;
742  float hs = Nd->cube_dim / (float)Neb2_slices;
743  float ds = Nd->cube_dim / (float)Neb2_slices;
744 
745  // get the eye position
746  neb2_get_eye_pos(&eye_pos);
747 
748  // check left, right (0, and 1, x and -x)
749  if (cube_cen.xyz.x - eye_pos.xyz.x > ws) {
750  return 0;
751  } else if (eye_pos.xyz.x - cube_cen.xyz.x > ws) {
752  return 1;
753  }
754 
755  // check up, down (2, and 3, y and -y)
756  if (cube_cen.xyz.y - eye_pos.xyz.y > hs) {
757  return 2;
758  } else if (eye_pos.xyz.y - cube_cen.xyz.y > hs) {
759  return 3;
760  }
761 
762  // check front, back (4, and 5, z and -z)
763  if (cube_cen.xyz.z - eye_pos.xyz.z > ds) {
764  return 4;
765  } else if (eye_pos.xyz.z - cube_cen.xyz.z > ds) {
766  return 5;
767  }
768  // nothing
769  return -1;
770 }
771 
772 void neb2_copy(int xyz, int src, int dest)
773 {
774  int idx1, idx2;
775 
776  switch(xyz) {
777  case 0:
778  for (idx1=0; idx1<Neb2_slices; idx1++) {
779  for(idx2=0; idx2<Neb2_slices; idx2++) {
780  Neb2_cubes[dest][idx1][idx2] = Neb2_cubes[src][idx1][idx2];
781  }
782  }
783  break;
784  case 1:
785  for (idx1=0; idx1<Neb2_slices; idx1++) {
786  for (idx2=0; idx2<Neb2_slices; idx2++) {
787  Neb2_cubes[idx1][dest][idx2] = Neb2_cubes[idx1][src][idx2];
788  }
789  }
790  break;
791  case 2:
792  for (idx1=0; idx1<Neb2_slices; idx1++) {
793  for (idx2=0; idx2<Neb2_slices; idx2++) {
794  Neb2_cubes[idx1][idx2][dest] = Neb2_cubes[idx1][idx2][src];
795  }
796  }
797  break;
798  default:
799  Int3();
800  break;
801  }
802 }
803 
804 void neb2_gen_slice(int xyz, int src, vec3d *cube_center)
805 {
806  int idx1, idx2;
807  float h_incw, h_inch, h_incd;
808  float ws, hs, ds;
809  vec3d cube_corner;
810  vec3d *v;
811 
812  ws = Nd->cube_dim / (float)Neb2_slices;
813  h_incw = ws / 2.0f;
814  hs = Nd->cube_dim / (float)Neb2_slices;
815  h_inch = hs / 2.0f;
816  ds = Nd->cube_dim / (float)Neb2_slices;
817  h_incd = ds / 2.0f;
818  cube_corner = *cube_center;
819  cube_corner.xyz.x -= (Nd->cube_dim / 2.0f);
820  cube_corner.xyz.y -= (Nd->cube_dim / 2.0f);
821  cube_corner.xyz.z -= (Nd->cube_dim / 2.0f);
822  switch(xyz) {
823  case 0:
824  for (idx1=0; idx1<Neb2_slices; idx1++) {
825  for (idx2=0; idx2<Neb2_slices; idx2++) {
826  v = &Neb2_cubes[src][idx1][idx2].pt;
827 
828  v->xyz.x = h_incw + (ws * (float)src) + frand_range(-Nd->wj, Nd->wj);
829  v->xyz.y = h_inch + (hs * (float)idx1) + frand_range(-Nd->hj, Nd->hj);
830  v->xyz.z = h_incd + (ds * (float)idx2) + frand_range(-Nd->dj, Nd->dj);
831  vm_vec_add2(v, &cube_corner);
832 
833  // set the bitmap
834  Neb2_cubes[src][idx1][idx2].bmap = neb2_get_bitmap();
835 
836  // set the rotation speed
837  Neb2_cubes[src][idx1][idx2].rot = 0.0f;
838  Neb2_cubes[src][idx1][idx2].rot_speed = frand_range(-max_rotation, max_rotation);
839  Neb2_cubes[src][idx1][idx2].flash = 0.0f;
840  }
841  }
842  break;
843  case 1:
844  for (idx1=0; idx1<Neb2_slices; idx1++) {
845  for (idx2=0; idx2<Neb2_slices; idx2++) {
846  v = &Neb2_cubes[idx1][src][idx2].pt;
847 
848  v->xyz.x = h_incw + (ws * (float)idx1) + frand_range(-Nd->wj, Nd->wj);
849  v->xyz.y = h_inch + (hs * (float)src) + frand_range(-Nd->hj, Nd->hj);
850  v->xyz.z = h_incd + (ds * (float)idx2) + frand_range(-Nd->dj, Nd->dj);
851  vm_vec_add2(v, &cube_corner);
852 
853  // set the bitmap
854  Neb2_cubes[idx1][src][idx2].bmap = neb2_get_bitmap();
855 
856  // set the rotation speed
857  Neb2_cubes[idx1][src][idx2].rot = 0.0f;
858  Neb2_cubes[idx1][src][idx2].rot_speed = frand_range(-max_rotation, max_rotation);
859  Neb2_cubes[src][idx1][idx2].flash = 0.0f;
860  }
861  }
862  break;
863  case 2:
864  for (idx1=0; idx1<Neb2_slices; idx1++) {
865  for (idx2=0; idx2<Neb2_slices; idx2++) {
866  v = &Neb2_cubes[idx1][idx2][src].pt;
867 
868  v->xyz.x = h_incw + (ws * (float)idx1) + frand_range(-Nd->wj, Nd->wj);
869  v->xyz.y = h_inch + (hs * (float)idx2) + frand_range(-Nd->hj, Nd->hj);
870  v->xyz.z = h_incd + (ds * (float)src) + frand_range(-Nd->dj, Nd->dj);
871  vm_vec_add2(v, &cube_corner);
872 
873  // set the bitmap
874  Neb2_cubes[idx1][idx2][src].bmap = neb2_get_bitmap();
875 
876  // set the rotation speed
877  Neb2_cubes[idx1][idx2][src].rot = 0.0f;
878  Neb2_cubes[idx1][idx2][src].rot_speed = frand_range(-max_rotation, max_rotation);
879  Neb2_cubes[src][idx1][idx2].flash = 0.0f;
880  }
881  }
882  break;
883  default:
884  Int3();
885  break;
886  }
887 }
888 
889 // regenerate the player nebula
891 {
892  int idx;
893  vec3d eye_pos;
895 
896  mprintf(("Regenerating local nebula!\n"));
897 
898  // get eye position and orientation
899  neb2_get_eye_pos(&eye_pos);
900  neb2_get_eye_orient(&eye_orient);
901 
902  // determine the corner of the cube
903  cube_cen = eye_pos;
904 
905  // generate slices of the cube
906  for (idx=0; idx<Neb2_slices; idx++) {
907  neb2_gen_slice(0, idx, &cube_cen);
908  }
909 }
910 
911 /*
912  * TODO: remove this
913 float max_area = 100000000.0f;
914 DCF(max_area, "")
915 {
916  dc_stuff_float(&max_area);
917 }
918 */
919 
920 float g3_draw_rotated_bitmap_area(vertex *pnt, float angle, float rad, uint tmap_flags, float area);
921 int neb_mode = 1;
922 int frames_total = 0;
923 int frame_count = 0;
924 float frame_avg;
926 {
927  vertex p, ptemp;
928  int idx1, idx2, idx3;
929  float alpha;
930  int frame_rendered;
931  vec3d eye_pos;
933 
934  // standalone servers can bail here
936  return;
937  }
938 
939  // if the mission is not a fullneb mission, skip
941  return;
942  }
943 
944  if (Neb2_regen) {
945  neb2_regen();
946  Neb2_regen = 0;
947  }
948 
949  // don't render in lame mode
951  return;
952  }
953 
954  memset(&p, 0, sizeof(p));
955 
956  // get eye position and orientation
957  neb2_get_eye_pos(&eye_pos);
958  neb2_get_eye_orient(&eye_orient);
959 
960  // maybe swap stuff around if the player crossed a "border"
961  for (idx2=0; idx2<3; idx2++) {
962  switch(crossed_border()) {
963  case -1:
964  break;
965 
966  case 0 :
967  cube_cen.xyz.x -= Nd->cube_dim / (float)Neb2_slices;
968  for (idx1=Neb2_slices-1; idx1>0; idx1--) {
969  neb2_copy(0, idx1-1, idx1);
970  }
971  neb2_gen_slice(0, 0, &cube_cen);
972  break;
973 
974  case 1 :
975  cube_cen.xyz.x += Nd->cube_dim / (float)Neb2_slices;
976  for (idx1=0; idx1<Neb2_slices-1; idx1++) {
977  neb2_copy(0, idx1+1, idx1);
978  }
979  neb2_gen_slice(0, Neb2_slices - 1, &cube_cen);
980  break;
981 
982  case 2 :
983  cube_cen.xyz.y -= Nd->cube_dim / (float)Neb2_slices;
984  for (idx1=Neb2_slices-1; idx1>0; idx1--) {
985  neb2_copy(1, idx1-1, idx1);
986  }
987  neb2_gen_slice(1, 0, &cube_cen);
988  break;
989 
990  case 3 :
991  cube_cen.xyz.y += Nd->cube_dim / (float)Neb2_slices;
992  for (idx1=0; idx1<Neb2_slices-1; idx1++) {
993  neb2_copy(1, idx1+1, idx1);
994  }
995  neb2_gen_slice(1, Neb2_slices - 1, &cube_cen);
996  break;
997 
998  case 4 :
999  cube_cen.xyz.z -= Nd->cube_dim / (float)Neb2_slices;
1000  for (idx1=Neb2_slices-1; idx1>0; idx1--) {
1001  neb2_copy(2, idx1-1, idx1);
1002  }
1003  neb2_gen_slice(2, 0, &cube_cen);
1004  break;
1005 
1006  case 5 :
1007  cube_cen.xyz.z += Nd->cube_dim / (float)Neb2_slices;
1008  for (idx1=0; idx1<Neb2_slices-1; idx1++) {
1009  neb2_copy(2, idx1+1, idx1);
1010  }
1011  neb2_gen_slice(2, Neb2_slices - 1, &cube_cen);
1012  break;
1013  }
1014  }
1015 
1016  // if we've switched nebula rendering off
1018  return;
1019  }
1020 
1021  frame_rendered = 0;
1022  // render the nebula
1023  for (idx1=0; idx1<Neb2_slices; idx1++) {
1024  for (idx2=0; idx2<Neb2_slices; idx2++) {
1025  for (idx3=0; idx3<Neb2_slices; idx3++) {
1026 
1027  // Miss this one out if the id is -1
1028  if (Neb2_cubes[idx1][idx2][idx3].bmap == -1) {
1029  continue;
1030  }
1031 
1032  pneb_tried++;
1033 
1034  // rotate the poof
1035  Neb2_cubes[idx1][idx2][idx3].rot += (Neb2_cubes[idx1][idx2][idx3].rot_speed * flFrametime);
1036  if (Neb2_cubes[idx1][idx2][idx3].rot >= 360.0f) {
1037  Neb2_cubes[idx1][idx2][idx3].rot = 0.0f;
1038  }
1039 
1040  // optimization 1 - don't draw backfacing poly's
1041  // useless
1042  if (vm_vec_dot_to_point(&eye_orient.vec.fvec, &eye_pos, &Neb2_cubes[idx1][idx2][idx3].pt) <= 0.0f) {
1043  pneb_tossed_dot++;
1044  continue;
1045  }
1046 
1047  // rotate and project the vertex into viewspace
1048  g3_rotate_vertex(&p, &Neb2_cubes[idx1][idx2][idx3].pt);
1049 
1050  ptemp = p;
1051  g3_project_vertex(&ptemp);
1052 
1053  // get the proper alpha value
1054  alpha = neb2_get_alpha_2shell(Nd->cube_inner, Nd->cube_outer, Nd->prad/4.0f, &Neb2_cubes[idx1][idx2][idx3].pt);
1055 
1056  // optimization 2 - don't draw 0.0f or less poly's
1057  // this amounts to big savings
1058  if (alpha <= Nd->break_alpha) {
1059  pneb_tossed_alpha++;
1060  continue;
1061  }
1062 
1063  // drop poly's which are offscreen at all
1064  // if the poly's are offscreen
1065  if ( (ptemp.screen.xyw.x < 0.0f)
1066  || (ptemp.screen.xyw.x > (float)gr_screen.max_w)
1067  || (ptemp.screen.xyw.y < 0.0f)
1068  || (ptemp.screen.xyw.y > (float)gr_screen.max_h) )
1069  {
1070  alpha = neb2_get_alpha_offscreen(
1071  ptemp.screen.xyw.x,
1072  ptemp.screen.xyw.y,
1073  alpha);
1074  }
1075 
1076  // optimization 2 - don't draw 0.0f or less poly's
1077  // this amounts to big savings
1078  if (alpha <= Nd->break_alpha) {
1079  pneb_tossed_alpha++;
1080  continue;
1081  }
1082 
1083  // set the bitmap and render
1084  gr_set_bitmap(Neb2_cubes[idx1][idx2][idx3].bmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, (alpha + Neb2_cubes[idx1][idx2][idx3].flash));
1085 
1086  if (!Cmdline_nohtl) gr_set_lighting(false, false); {
1087  gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
1088  g3_draw_rotated_bitmap(&p, fl_radians(Neb2_cubes[idx1][idx2][idx3].rot), Nd->prad, TMAP_FLAG_TEXTURED);
1089  }
1090  }
1091  }
1092  }
1093 
1094  frames_total += frame_rendered;
1095  frame_count++;
1096  frame_avg = (float)frames_total / (float)frame_count;
1097 
1098  // gr_set_color_fast(&Color_bright_red);
1099  // gr_printf(30, 100, "Area %.3f", total_area);
1100 #ifdef NEB2_THUMBNAIL
1101  extern int tbmap;
1102  if (tbmap != -1) {
1103  gr_set_bitmap(tbmap);
1104  gr_bitmap(0, 0);
1105  }
1106 #endif
1107 }
1108 
1109 // call this when the player's viewpoint has changed, this will cause the code to properly reset
1110 // the eye's local poofs
1112 {
1113  Neb2_regen = 1;
1114 }
1115 
1116 /*
1117 //Object types
1118 #define OBJ_NONE 0 //unused object
1119 #define OBJ_SHIP 1 //a ship
1120 #define OBJ_WEAPON 2 //a laser, missile, etc
1121 #define OBJ_FIREBALL 3 //an explosion
1122 #define OBJ_START 4 //a starting point marker (player start, etc)
1123 #define OBJ_WAYPOINT 5 //a waypoint object, maybe only ever used by Fred
1124 #define OBJ_DEBRIS 6 //a flying piece of ship debris
1125 #define OBJ_CMEASURE 7 //a countermeasure, such as chaff
1126 #define OBJ_GHOST 8 //so far, just a placeholder for when a player dies.
1127 #define OBJ_POINT 9 //generic object type to display a point in Fred.
1128 #define OBJ_SHOCKWAVE 10 // a shockwave
1129 #define OBJ_WING 11 // not really a type used anywhere, but I need it for Fred.
1130 #define OBJ_OBSERVER 12 // used for multiplayer observers (possibly single player later)
1131 #define OBJ_ASTEROID 13 // An asteroid, you know, a big rock, like debris, sort of.
1132 #define OBJ_JUMP_NODE 14 // A jump node object, used only in Fred.
1133 #define OBJ_BEAM 15 // beam weapons. we have to roll them into the object system to get the benefits of the collision pairs
1134 */
1135 // get near and far fog values based upon object type and rendering mode
1136 void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
1137 {
1138  int type_index = -1;
1139 
1140  // default values in case something truly nasty happens
1141  *fnear = 10.0f;
1142  *ffar = 1000.0f;
1143 
1144  if (objp == NULL) {
1145  return;
1146  }
1147 
1148  //Otherwise, use defaults
1149  *fnear = Default_fog_near;
1150  *ffar = Default_fog_far;
1151 
1152  // determine what fog index to use
1153  if(objp->type == OBJ_SHIP) {
1154  Assert((objp->instance >= 0) && (objp->instance < MAX_SHIPS));
1155  if((objp->instance >= 0) && (objp->instance < MAX_SHIPS)) {
1156  type_index = ship_query_general_type(objp->instance);
1157  if(type_index > 0) {
1158  *fnear = Ship_types[type_index].fog_start_dist;
1159  *ffar = Ship_types[type_index].fog_complete_dist;
1160  }
1161  }
1162  } else if (objp->type == OBJ_FIREBALL) { //mostly here for the warp effect
1163  *fnear = objp->radius*2;
1164  *ffar = (objp->radius*objp->radius*200)+objp->radius*200;
1165  return;
1166  }
1167 }
1168 
1169 // This version of the function allows for global adjustment to fog values
1170 void neb2_get_adjusted_fog_values(float *fnear, float *ffar, object *objp)
1171 {
1172  neb2_get_fog_values(fnear, ffar, objp);
1173 
1174  // Multiply fog distances by mission multipliers
1175  *fnear *= Neb2_fog_near_mult;
1176  *ffar *= Neb2_fog_far_mult;
1177 
1178  // Avoide divide-by-zero
1179  if ((*fnear - *ffar) == 0)
1180  *ffar = *fnear + 1.0f;
1181 }
1182 
1184 // given a position in space, return a value from 0.0 to 1.0 representing the fog level
1186 {
1187  float pct;
1188 
1189  // get near and far fog values based upon object type and rendering mode
1190  neb2_get_adjusted_fog_values(&nNf_near, &nNf_far, obj);
1191 
1192  // get the fog pct
1193  pct = vm_vec_dist_quick(&Eye_position, &obj->pos) / (nNf_far - nNf_near);
1194 
1195  CLAMP(pct, 0.0f, 1.0f);
1196 
1197  return pct;
1198 }
1199 
1200 //this only gets called after the one above has been called as it assumes you have set the near and far planes properly
1201 //doun't use this outside of ship rendering
1203 {
1204  float pct;
1205 
1206  // get the fog pct
1207  pct = vm_vec_dist_quick(&Eye_position, pos) / ((nNf_far*2) - nNf_near);
1208 
1209  CLAMP(pct, 0.0f, 1.0f);
1210 
1211  return pct;
1212 }
1213 
1214 // fogging stuff --------------------------------------------------------------------
1215 
1216 // do a pre-render of the background nebula
1217 #define ESIZE 32
1218 ubyte tpixels[ESIZE * ESIZE * 4]; // for 32 bits
1219 int last_esize = -1;
1222 int tbmap = -1;
1223 // UnknownPlayer : Contained herein, the origins of the nebula rendering bug!
1224 // I am really not entirely sure what this code achieves, but the old
1225 // D3D calls were the cause of the nebula bug - they have been commented out.
1226 // If you want to save some rendering time, I would suggest maybe kill this off.
1227 // It doesn't use much, but it APPEARS to be fairly useless unless someone wants
1228 // to enlighten me.
1229 //
1231 {
1232  // if the mission is not a fullneb mission, skip
1234  return;
1235  }
1236 
1237  // bail early in lame and poly modes
1239  return;
1240  }
1241 
1242  // set the view clip
1245  g3_start_frame(1); // Turn on zbuffering
1246  g3_set_view(cid.getCamera());
1247  gr_set_clip(0, 0, this_esize, this_esize);
1248 
1249  // render the background properly
1250  // hack - turn off nebula stuff
1251  int neb_save = Neb2_render_mode;
1253 
1254  // draw background stuff nebula
1256 
1257  Neb2_render_mode = neb_save;
1258 
1259  // grab the region
1260  gr_get_region(0, this_esize, this_esize, (ubyte*)tpixels);
1261 
1262 #ifdef NEB2_THUMBNAIL
1263  if (tbmap == -1) {
1264  tbmap = bm_create(16, this_esize, this_esize, tpixels, 0);
1265  bm_lock(tbmap, 16, 0);
1266  bm_unlock(tbmap);
1267  }
1268 #endif
1269 
1270  // maybe do some swizzling
1271 
1272  // end the frame
1273  g3_end_frame();
1274 
1275  gr_clear();
1276 
1277  // if the size has changed between frames, make a new bitmap
1278  if (this_esize != last_esize) {
1279  last_esize = this_esize;
1280 
1281  // recalculate ex_scale and ey_scale values for looking up color values
1282  ex_scale = (float)this_esize / (float)gr_screen.max_w;
1283  ey_scale = (float)this_esize / (float)gr_screen.max_h;
1284  }
1285 }
1286 
1287 // wacky scheme for smoothing colors
1289 
1290 // get the color of the pixel in the small pre-rendered background nebula
1291 #define PIXEL_INDEX_SMALL(xv, yv) ( (this_esize * (yv) * gr_screen.bytes_per_pixel) + ((xv) * gr_screen.bytes_per_pixel) )
1292 void neb2_get_pixel(int x, int y, int *r, int *g, int *b)
1293 {
1294  // we shouldn't ever be here if in htl rendering mode
1296 
1297  int ra, ga, ba;
1298  ubyte rv, gv, bv;
1299  ubyte avg_count;
1300  int xs, ys;
1301 
1302  // if we're in lame rendering mode, return a constant value
1304  *r = Neb2_background_color[0];
1305  *g = Neb2_background_color[1];
1306  *b = Neb2_background_color[2];
1307 
1308  return;
1309  }
1310 
1311  // get the proper pixel index to be looking up
1312  rv = gv = bv = 0;
1313 
1314  // select screen format
1316 
1317  // pixel plus all immediate neighbors (on the small screen - should be more effective than 2 or 1)
1318  xs = (int)(ex_scale * x);
1319  ys = (int)(ey_scale * y);
1320 
1321  // sometimes goes over by 1 in direct3d
1322  if (ys >= (this_esize - 1)) {
1323  ys--;
1324  }
1325 
1326  avg_count = 0;
1327  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs, ys)], &rv, &gv, &bv, NULL);
1328  ra = rv;
1329  ga = gv;
1330  ba = bv;
1331  avg_count++;
1332  if (xs > 0) {
1333  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs - 1, ys)], &rv, &gv, &bv, NULL); // left
1334  ra += rv;
1335  ba += bv;
1336  ga += gv;
1337  avg_count++;
1338  }
1339  if (xs < this_esize - 1) {
1340  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs + 1, ys)], &rv, &gv, &bv, NULL); // right
1341  ra += rv;
1342  ba += bv;
1343  ga += gv;
1344  avg_count++;
1345  }
1346  if (ys > 0) {
1347  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs, ys - 1)], &rv, &gv, &bv, NULL); // top
1348  ra += rv;
1349  ba += bv;
1350  ga += gv;
1351  avg_count++;
1352  }
1353  if (ys < this_esize - 2) {
1354  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs, ys + 1)], &rv, &gv, &bv, NULL); // bottom
1355  ra += rv;
1356  ba += bv;
1357  ga += gv;
1358  avg_count++;
1359  }
1360  if ( (xs > 0) && (ys > 0) ) {
1361  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs - 1, ys - 1)], &rv, &gv, &bv, NULL); // upper left
1362  ra += rv;
1363  ba += bv;
1364  ga += gv;
1365  avg_count++;
1366  }
1367  if ( (xs < this_esize - 1) && (ys < this_esize - 1) ) {
1368  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs + 1, ys + 1)], &rv, &gv, &bv, NULL); // lower right
1369  ra += rv;
1370  ba += bv;
1371  ga += gv;
1372  avg_count++;
1373  }
1374  if ( (ys > 0) && (xs < this_esize - 1) ) {
1375  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs + 1, ys - 1)], &rv, &gv, &bv, NULL); // lower left
1376  ra += rv;
1377  ba += bv;
1378  ga += gv;
1379  avg_count++;
1380  }
1381  if ( (ys < this_esize - 1) && (xs > 0) ) {
1382  bm_get_components(&tpixels[PIXEL_INDEX_SMALL(xs - 1, ys + 1)], &rv, &gv, &bv, NULL); // upper right
1383  ra += rv;
1384  ba += bv;
1385  ga += gv;
1386  avg_count++;
1387  }
1388 
1389  rv = (ubyte)(ra / (int)avg_count);
1390  gv = (ubyte)(ga / (int)avg_count);
1391  bv = (ubyte)(ba / (int)avg_count);
1392 
1393  // return values
1394  *r = (int)rv;
1395  *g = (int)gv;
1396  *b = (int)bv;
1397 }
1398 
1399 // get the color to fog the background color to
1400 void neb2_get_backg_color(int *r, int *g, int *b)
1401 {
1402  *r = Neb2_background_color[0];
1403  *g = Neb2_background_color[1];
1404  *b = Neb2_background_color[2];
1405 }
1406 
1407 // set the background color
1408 void neb2_set_backg_color(int r, int g, int b)
1409 {
1410  Neb2_background_color[0] = r;
1411  Neb2_background_color[1] = g;
1412  Neb2_background_color[2] = b;
1413 }
1414 
1415 // fill in the position of the eye for this frame
1416 void neb2_get_eye_pos(vec3d *eye_vector)
1417 {
1418  *eye_vector = Eye_position;
1419 }
1420 
1421 // fill in the eye orient for this frame
1422 void neb2_get_eye_orient(matrix *eye_matrix)
1423 {
1424  *eye_matrix = Eye_matrix;
1425 }
1426 
1427 // get a (semi) random bitmap to use for a poof
1429 {
1430  int count = 0;
1431  int huh;
1432  static int neb2_choose = 0;
1433 
1434  // get a random count
1435  count = (int)frand_range(1.0f, 5.0f);
1436 
1437  // very ad-hoc
1438  while(count > 0) {
1439  // don't cycle too many times
1440  huh = 0;
1441  do {
1442  if(neb2_choose == MAX_NEB2_POOFS - 1){
1443  neb2_choose = 0;
1444  } else {
1445  neb2_choose++;
1446  }
1447 
1448  huh++;
1449  }
1450  while(!(Neb2_poof_flags & (1<<neb2_choose)) && (huh < 10));
1451  count--;
1452  }
1453 
1454  // bitmap 0
1455  if (Neb2_poofs[neb2_choose] < 0) {
1456  return Neb2_poofs[0];
1457  }
1458  return Neb2_poofs[neb2_choose];
1459 }
1460 
1461 // nebula DCF functions ------------------------------------------------------
1462 // TODO: With the new debug parser in place, most of these sub-commands can now be handled by neb2. This should clear up the DCF list a bit
1463 DCF(neb2, "list nebula console commands")
1464 {
1465 // dc_printf("neb2_fog <X> <float> <float> : set near and far fog planes for ship type X\n");
1466 // dc_printf("where X is an integer from 1 - 11\n");
1467 // dc_printf("1 = cargo containers, 2 = fighters/bombers, 3 = cruisers\n");
1468 // dc_printf("4 = freighters, 5 = capital ships, 6 = transports, 7 = support ships\n");
1469 // dc_printf("8 = navbuoys, 9 = sentryguns, 10 = escape pods, 11 = background nebula polygons\n\n");
1470 
1471  dc_printf("neb2_max_alpha : max alpha value (0.0 to 1.0) for cloud poofs. 0.0 is completely transparent\n");
1472  dc_printf("neb2_break_alpha : alpha value (0.0 to 1.0) at which faded polygons are not drawn. higher values generally equals higher framerate, with more visual cloud popping\n");
1473  dc_printf("neb2_break_off : how many pixels offscreen (left, right, top, bottom) when a cloud poof becomes fully transparent. Lower values cause quicker fading\n");
1474  dc_printf("neb2_smooth : magic fog smoothing modes (0 - 3)\n");
1475  dc_printf("neb2_select : <int> <int> where the first # is the bitmap to be adjusting (0 through 5), and the second int is a 0 or 1, to turn off and on\n");
1476  dc_printf("neb2_rot : set max rotation speed for poofs\n");
1477  dc_printf("neb2_prad : set cloud poof radius\n");
1478  dc_printf("neb2_cdim : poof cube dimension\n");
1479  dc_printf("neb2_cinner : poof cube inner dimension\n");
1480  dc_printf("neb2_couter : poof cube outer dimension\n");
1481  dc_printf("neb2_jitter : poof jitter\n");
1482  dc_printf("neb2_mode : switch between no nebula, polygon background, pof background, lame, or HTL rendering (0, 1, 2, 3 and 4 respectively)\n\n");
1483  dc_printf("neb2_ff : flash fade/sec\n");
1484  dc_printf("neb2_background : rgb background color\n");
1485  dc_printf("neb2_fog_color : rgb fog color\n");
1486 
1487 // dc_printf("neb2_fog_vals : display all the current settings for all above values\n");
1488 }
1489 
1490 DCF(neb2_prad, "set cloud poof radius")
1491 {
1492  dc_stuff_float(&Nd->prad);
1493 }
1494 DCF(neb2_cdim, "poof cube dimension")
1495 {
1496  dc_stuff_float(&Nd->cube_dim);
1497 }
1498 
1499 DCF(neb2_cinner, "poof cube inner dimension")
1500 {
1501  dc_stuff_float(&Nd->cube_inner);
1502 }
1503 
1504 DCF(neb2_couter, "poof cube outer dimension")
1505 {
1506  dc_stuff_float(&Nd->cube_outer);
1507 }
1508 
1509 DCF(neb2_jitter, "poof jitter")
1510 {
1511  float value;
1512  dc_stuff_float(&value);
1513  Nd->hj = Nd->dj = Nd->wj = value;
1514 }
1515 
1516 DCF(neb2_max_alpha, "max alpha value (0.0 to 1.0) for cloud poofs.")
1517 {
1519 }
1520 
1521 DCF(neb2_break_alpha, "alpha value (0.0 to 1.0) at which faded polygons are not drawn.")
1522 {
1524 }
1525 
1526 DCF(neb2_break_off, "how many pixels offscreen (left, right, top, bottom) when a cloud poof becomes fully transparent.")
1527 {
1528  int value;
1529  dc_stuff_int(&value);
1530  Nd->break_y = (float)value;
1532 }
1533 
1534 DCF(neb2_smooth, "magic fog smoothing modes (0 - 3)")
1535 {
1536  int index;
1537  dc_stuff_int(&index);
1538  if ( (index >= 0) && (index <= 3) ) {
1539  wacky_scheme = index;
1540  } else {
1541  dc_printf("Invalid smooth mode %i", index);
1542  }
1543 }
1544 
1545 DCF(neb2_select, "Enables/disables a poof bitmap")
1546 {
1547  int bmap;
1548  bool val_b;
1549 
1550  dc_stuff_int(&bmap);
1551 
1552  if ( (bmap >= 0) && (bmap < Neb2_poof_count) ) {
1553  dc_stuff_boolean(&val_b);
1554 
1555  val_b ? (Neb2_poof_flags |= (1<<bmap)) : (Neb2_poof_flags &= ~(1<<bmap));
1556  }
1557 }
1558 
1559 DCF(neb2_rot, "set max rotation speed for poofs")
1560 {
1561  dc_stuff_float(&max_rotation);
1562 }
1563 
1564 DCF(neb2_ff, "flash fade/sec")
1565 {
1566  dc_stuff_float(&neb2_flash_fade);
1567 }
1568 
1569 DCF(neb2_mode, "Switches nebula render modes")
1570 {
1571  int mode;
1572  dc_stuff_int(&mode);
1573 
1574  switch (mode) {
1575  case NEB2_RENDER_NONE:
1577  break;
1578 
1579  case NEB2_RENDER_POLY:
1581  break;
1582 
1583  case NEB2_RENDER_POF:
1587  break;
1588 
1589  case NEB2_RENDER_LAME:
1591  break;
1592 
1593  case NEB2_RENDER_HTL:
1594  if (!Cmdline_nohtl) {
1596  }
1597  break;
1598  }
1599 }
1600 
1601 DCF(neb2_slices, "Sets how many 'slices' are used in the nebula")
1602 {
1603  dc_stuff_int(&Neb2_slices);
1604  neb2_eye_changed();
1605 }
1606 
1607 DCF(neb2_background, "Sets the RGB background color (lame rendering)")
1608 {
1609  int r, g, b;
1610 
1614 
1615  Neb2_background_color[0] = r;
1616  Neb2_background_color[1] = g;
1617  Neb2_background_color[2] = b;
1618 }
1619 
1620 DCF(neb2_fog_color, "Sets the RGB fog color (HTL)")
1621 {
1622  ubyte r, g, b;
1623 
1624  dc_stuff_ubyte(&r);
1625  dc_stuff_ubyte(&g);
1626  dc_stuff_ubyte(&b);
1627 
1628  Neb2_fog_color_r = r;
1629  Neb2_fog_color_g = g;
1630  Neb2_fog_color_b = b;
1631 }
ubyte tpixels[ESIZE *ESIZE *4]
Definition: neb.cpp:1218
int Neb2_poof_flags
Definition: neb.cpp:64
void bm_unlock(int handle)
Unlocks a bitmap.
Definition: bmpman.cpp:3005
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
float vm_vec_dot_to_point(const vec3d *dir, const vec3d *p1, const vec3d *p2)
Definition: vecmat.cpp:1348
struct screen3d::@234::@236 xyw
int Neb2_regen
Definition: neb.cpp:217
#define NEB2_RENDER_HTL
Definition: neb.h:35
#define gr_clear
Definition: 2d.h:749
float break_alpha
Definition: neb.h:77
float neb2_get_alpha_2shell(float inner_radius, float outer_radius, float magic_num, vec3d *v)
Definition: neb.cpp:647
#define OBJ_FIREBALL
Definition: object.h:34
int Neb2_render_mode
Definition: neb.cpp:57
float rot
Definition: neb.h:66
int Game_mode
Definition: systemvars.cpp:24
#define MISSION_FLAG_FULLNEB
Definition: missionparse.h:70
float frand_range(float min, float max)
Return a floating point number in the range min..max.
Definition: floating.cpp:50
void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
Definition: neb.cpp:1136
float neb2_get_alpha_offscreen(float sx, float sy, float incoming_alpha)
Definition: neb.cpp:685
int wacky_scheme
Definition: neb.cpp:1288
float flFrametime
Definition: fredstubs.cpp:22
int neb_tried
Definition: neb.cpp:150
int Fred_running
Definition: fred.cpp:44
float frame_avg
Definition: neb.cpp:924
#define MAX_SHIPS
Definition: globals.h:37
neb2_detail Neb2_detail[MAX_DETAIL_LEVEL]
Definition: neb.cpp:167
void stars_set_background_orientation(matrix *orient)
Definition: starfield.cpp:2207
float max_rotation
Definition: neb.cpp:80
void g3_set_view(camera *cam)
Definition: 3dsetup.cpp:137
float g3_draw_rotated_bitmap_area(vertex *pnt, float angle, float rad, uint tmap_flags, float area)
Definition: 3ddraw.cpp:1069
float wj
Definition: neb.h:83
#define PIXEL_INDEX_SMALL(xv, yv)
Definition: neb.cpp:1291
Assert(pm!=NULL)
void _cdecl void void _cdecl void _cdecl void _cdecl WarningEx(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
Definition: pstypes.h:88
#define mprintf(args)
Definition: pstypes.h:238
int frame_count
Definition: neb.cpp:923
#define OBJ_ASTEROID
Definition: object.h:44
void neb2_set_backg_color(int r, int g, int b)
Definition: neb.cpp:1408
void neb2_render_player()
Definition: neb.cpp:925
matrix Eye_matrix
Definition: 3dsetup.cpp:26
struct vec3d::@225::@227 xyz
void neb2_get_fog_color(ubyte *r, ubyte *g, ubyte *b)
Definition: neb.cpp:319
GLclampf f
Definition: Glext.h:7097
void neb2_gen_slice(int xyz, int src, vec3d *cube_center)
Definition: neb.cpp:804
#define MAX_OBJECTS
Definition: globals.h:83
#define PCX_ERROR_NONE
Definition: pcxutils.h:25
int neb_tossed_alpha
Definition: neb.cpp:151
int Neb2_poof_count
Definition: neb.cpp:65
GLenum mode
Definition: Glext.h:5794
cube_poof Neb2_cubes[MAX_CPTS][MAX_CPTS][MAX_CPTS]
Definition: neb.cpp:165
int bmap
Definition: neb.h:65
#define NEB_BACKG_FOG_FAR_D3D
Definition: neb.cpp:141
char Neb2_texture_name[MAX_FILENAME_LEN]
Definition: neb.cpp:75
ubyte blue
Definition: 2d.h:102
object * objp
Definition: lua.cpp:3105
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
#define Int3()
Definition: pstypes.h:292
int pneb_tossed_alpha
Definition: neb.cpp:147
int pneb_tossed_off
Definition: neb.cpp:149
color current_clear_color
Definition: 2d.h:398
DCF(neb_skip,"Toggles culling of objects obscured by nebula")
Definition: neb.cpp:518
char Neb2_poof_filenames[MAX_NEB2_POOFS][MAX_FILENAME_LEN]
Definition: neb.cpp:60
ship * shipp
Definition: lua.cpp:9162
vec3d pos
Definition: object.h:152
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
int clip_height
Definition: 2d.h:378
GLenum type
Definition: Gl.h:1492
void stars_draw_background()
Definition: starfield.cpp:2153
int Neb2_bitmap[MAX_NEB2_BITMAPS]
Definition: neb.cpp:71
#define CLAMP(x, min, max)
Definition: pstypes.h:488
ubyte green
Definition: 2d.h:101
#define gr_set_lighting
Definition: 2d.h:924
float prad
Definition: neb.h:82
GLfloat angle
Definition: Glext.h:10324
float Neb2_awacs
Definition: neb.cpp:156
__inline void gr_set_clip(int x, int y, int w, int h, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:741
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
#define OBJ_WAYPOINT
Definition: object.h:36
int instance
Definition: object.h:150
void neb2_get_backg_color(int *r, int *g, int *b)
Definition: neb.cpp:1400
#define NEB2_RENDER_LAME
Definition: neb.h:34
void vm_vec_add2(vec3d *dest, const vec3d *src)
Definition: vecmat.cpp:178
int Cmdline_nohtl
Definition: cmdline.cpp:438
#define GR_ALPHABLEND_FILTER
Definition: 2d.h:349
#define NEB_BACKG_FOG_NEAR_GLIDE
Definition: neb.cpp:138
GLdouble GLdouble GLdouble r
Definition: Glext.h:5337
dc_stuff_int & b
Definition: neb.cpp:1613
#define SIF_BIG_SHIP
Definition: ship.h:944
int crossed_border()
Definition: neb.cpp:738
struct matrix::@228::@230 vec
float neb2_get_fog_intensity(object *obj)
Definition: neb.cpp:1185
char Neb2_bitmap_filenames[MAX_NEB2_BITMAPS][MAX_FILENAME_LEN]
Definition: neb.cpp:68
unsigned int uint
Definition: pstypes.h:64
#define MAX_CPTS
Definition: neb.h:70
screen3d screen
Definition: pstypes.h:173
void stars_set_background_model(char *model_name, char *texture_name, int flags)
Definition: starfield.cpp:2172
GLboolean GLboolean g
Definition: Glext.h:5781
float hj
Definition: neb.h:83
float rot_speed
Definition: neb.h:67
void neb2_level_init()
Definition: neb.cpp:326
void neb2_eye_changed()
Definition: neb.cpp:1111
int flags
Definition: ship.h:1227
#define SIF_SMALL_SHIP
Definition: ship.h:943
int tbmap
Definition: neb.cpp:1222
#define OBJ_WEAPON
Definition: object.h:33
void stuff_string(char *outstr, int type, int len, char *terminators)
Definition: parselo.cpp:1189
#define OBJ_DEBRIS
Definition: object.h:37
#define CF_TYPE_TABLES
Definition: cfile.h:50
ubyte red
Definition: 2d.h:100
int Neb2_poofs[MAX_NEB2_POOFS]
Definition: neb.cpp:63
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
Definition: 3dmath.cpp:97
int required_string(const char *pstr)
Definition: parselo.cpp:468
#define fl_abs(fl)
Definition: floating.h:31
float max_alpha_glide
Definition: neb.h:75
bitmap * bm_lock(int handle, ubyte bpp, ubyte flags, bool nodebug)
Locks down the bitmap indexed by bitmapnum.
Definition: bmpman.cpp:1754
int optional_string(const char *pstr)
Definition: parselo.cpp:539
float Neb_backg_fog_far
Definition: neb.cpp:143
matrix eye_orient
Definition: fredrender.cpp:112
float break_y
Definition: neb.h:78
int this_esize
Definition: neb.cpp:1220
int neb_tossed_count
Definition: neb.cpp:153
float cube_outer
Definition: neb.h:81
#define NEB2_RENDER_POF
Definition: neb.h:33
Definition: ship.h:534
int pcx_read_header(const char *real_filename, CFILE *img_cfp, int *w, int *h, int *bpp, ubyte *pal)
Definition: pcxutils.cpp:40
vec3d eye_pos
Definition: fredrender.cpp:103
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
Definition: parselo.cpp:1995
#define MAX_NEB2_BITMAPS
Definition: neb.h:51
Definition: neb.h:63
#define gr_get_region
Definition: 2d.h:831
int pneb_tried
Definition: neb.cpp:146
int Neb2_bitmap_count
Definition: neb.cpp:72
int g3_project_vertex(vertex *point)
Definition: 3dmath.cpp:202
int idx
Definition: multiui.cpp:761
void neb2_init()
Definition: neb.cpp:250
int Neb2_slices
Definition: neb.cpp:163
float dj
Definition: neb.h:83
float neb2_get_lod_scale(int objnum)
Definition: neb.cpp:614
void dc_stuff_ubyte(ubyte *i)
Stuffs an unsigned byte to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats.
int pneb_tossed_dot
Definition: neb.cpp:148
GLint GLint GLint GLint GLint x
Definition: Glext.h:5182
object Objects[MAX_OBJECTS]
Definition: object.cpp:62
unsigned char ubyte
Definition: pstypes.h:62
void neb2_page_in()
Definition: neb.cpp:502
int bm_create(int bpp, int w, int h, void *data, int flags)
Definition: bmpman.cpp:469
int frames_total
Definition: neb.cpp:922
int ship_query_general_type(int ship)
Definition: ship.cpp:14475
int max_w
Definition: 2d.h:360
dc_stuff_int & r
Definition: neb.cpp:1611
int g3_draw_rotated_bitmap(vertex *pnt, float angle, float radius, uint tmap_flags, float depth=0.0f)
Definition: 3ddraw.cpp:844
#define OBJ_SHIP
Definition: object.h:32
float cube_dim
Definition: neb.h:79
#define GM_STANDALONE_SERVER
Definition: systemvars.h:27
void dc_stuff_float(float *f)
Stuffs a float to the given variable.
dc_stuff_int & value
Definition: neb.cpp:1529
void neb2_render_setup(camid cid)
Definition: neb.cpp:464
#define SIF_HUGE_SHIP
Definition: ship.h:945
neb2_detail * Nd
Definition: neb.cpp:213
void reset_parse(char *text)
Definition: parselo.cpp:3305
void dc_stuff_int(int *i)
Stuffs an int to the given variable. Supports binary (0b), hexadecimal (0x), and octal (0o) formats...
GLuint const GLchar * name
Definition: Glext.h:5608
int Neb2_background_color[3]
Definition: neb.cpp:215
vec3d Eye_position
Definition: 3dsetup.cpp:27
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
ship Ships[MAX_SHIPS]
Definition: ship.cpp:122
void dc_stuff_boolean(bool *b)
stuffs a boolean evaluated integer or string into the given variable.
__inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near=-1.0f, float fog_far=-1.0f)
Definition: 2d.h:833
bool Nebula_sexp_used
Definition: neb.cpp:34
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
int neb_skip_opt
Definition: neb.cpp:517
float break_x
Definition: neb.h:78
void neb2_regen()
Definition: neb.cpp:890
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
Definition: vecmat.cpp:417
Definition: pstypes.h:606
void neb2_pre_render(camid cid)
Definition: neb.cpp:1230
void neb2_post_level_init()
Definition: neb.cpp:332
float rad
Definition: model.h:757
float ex_scale
Definition: neb.cpp:1221
float neb2_flash_fade
Definition: neb.cpp:81
vec3d pt
Definition: neb.h:64
float ey_scale
Definition: neb.cpp:1221
void bm_page_in_texture(int bitmapnum, int nframes)
Marks a texture as being used for this level.
Definition: bmpman.cpp:2462
int neb_tossed_dot
Definition: neb.cpp:152
float Neb_backg_fog_near
Definition: neb.cpp:142
#define g3_end_frame()
Definition: 3d.h:49
int clip_width
Definition: 2d.h:378
#define OBJ_SHOCKWAVE
Definition: object.h:41
class camera * getCamera()
Definition: camera.cpp:833
screen gr_screen
Definition: 2d.cpp:46
int neb2_skip_render(object *objp, float z_depth)
Definition: neb.cpp:527
unsigned short ushort
Definition: pstypes.h:63
dc_stuff_int & g
Definition: neb.cpp:1612
float flash
Definition: neb.h:68
int ship_info_index
Definition: ship.h:539
GLfloat GLfloat p
Definition: Glext.h:8373
#define MAX_NEB2_POOFS
Definition: neb.h:45
void neb2_get_adjusted_fog_values(float *fnear, float *ffar, object *objp)
Definition: neb.cpp:1170
#define F_NAME
Definition: parselo.h:34
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
GLenum src
Definition: Glext.h:5917
SCP_vector< ship_info > Ship_info
Definition: ship.cpp:164
#define LOCATION
Definition: pstypes.h:245
int max_h
Definition: 2d.h:360
#define TMAP_FLAG_TEXTURED
Definition: tmapper.h:36
void neb2_get_eye_pos(vec3d *eye_vector)
Definition: neb.cpp:1416
void neb2_get_pixel(int x, int y, int *r, int *g, int *b)
Definition: neb.cpp:1292
hull_check pos
Definition: lua.cpp:5050
float nNf_far
Definition: neb.cpp:1183
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a)
Gets the RGBA components of a pixel according to the selected mode.
Definition: bmpman.cpp:685
int neb2_get_bitmap()
Definition: neb.cpp:1428
GLsizei GLsizei GLuint * obj
Definition: Glext.h:5619
float cube_inner
Definition: neb.h:80
GLint GLsizei count
Definition: Gl.h:1491
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
#define GR_BITBLT_MODE_NORMAL
Definition: 2d.h:351
void dc_printf(const char *format,...)
Prints the given char string to the debug console.
Definition: console.cpp:358
void neb2_set_detail_level(int level)
Definition: neb.cpp:301
#define NEB2_RENDER_NONE
Definition: neb.h:31
#define OBJ_NONE
Definition: object.h:31
#define OBJ_BEAM
Definition: object.h:46
float radius
Definition: object.h:154
mission The_mission
vec3d cube_cen
Definition: neb.cpp:736
GLint level
Definition: Glext.h:5180
dc_stuff_int & index
Definition: neb.cpp:1537
void neb2_level_close()
Definition: neb.cpp:432
int last_esize
Definition: neb.cpp:1219
#define MAX_DETAIL_LEVEL
Definition: systemvars.h:159
GLclampf GLclampf GLclampf alpha
Definition: Glext.h:5177
float nNf_near
Definition: neb.cpp:1183
char type
Definition: object.h:146
float Neb2_fog_near_mult
Definition: neb.cpp:159
int neb_mode
Definition: neb.cpp:921
void neb2_copy(int xyz, int src, int dest)
Definition: neb.cpp:772
#define OBJ_JUMP_NODE
Definition: object.h:45
const GLdouble * v
Definition: Glext.h:5322
#define OBJ_GHOST
Definition: object.h:39
#define NEB_BACKG_FOG_FAR_GLIDE
Definition: neb.cpp:140
void neb2_get_eye_orient(matrix *eye_matrix)
Definition: neb.cpp:1422
#define ESIZE
Definition: neb.cpp:1217
float aspect
Definition: 2d.h:372
SCP_vector< ship_type_info > Ship_types
Definition: ship.cpp:168
GLint y
Definition: Gl.h:1505
float Neb2_fog_far_mult
Definition: neb.cpp:160
#define BACKGROUND_MODEL_FILENAME
Definition: starfield.h:26
#define g3_start_frame(zbuffer_flag)
Definition: 3d.h:39
#define fl_radians(fl)
Definition: floating.h:42
#define GR_FOGMODE_NONE
Definition: 2d.h:355
#define strcpy_s(...)
Definition: safe_strings.h:67
void BM_SELECT_SCREEN_FORMAT()
Sets bm_set_components and bm_get_components to reference screen format functions.
Definition: bmpman.cpp:2733
#define NEB_BACKG_FOG_NEAR_D3D
Definition: neb.cpp:139
#define NEB2_RENDER_POLY
Definition: neb.h:32