31 #define MAX_DEBRIS_VCLIPS                       4 
   32 #define DEBRIS_ROT_MIN                          10000 
   33 #define DEBRIS_ROT_RANGE                        8 
   34 #define DEBRIS_ROT_RANGE_SCALER         10000 
   35 #define RND_MAX_MASK                            0x3fff 
   36 #define HALF_RND_MAX                            0x2000 
   54 static int Subspace_model_inner = -1;
 
   55 static int Subspace_model_outer = -1;
 
   56 static int Rendering_to_env = 0;
 
   61 #define MAX_FLARE_COUNT 10 
   62 #define MAX_FLARE_BMP 6 
  157 debris_vclip Debris_vclips_normal[
MAX_DEBRIS_VCLIPS] = { { -1, -1, 
"debris01" }, { -1, -1, 
"debris02" }, { -1, -1, 
"debris03" }, { -1, -1, 
"debris04" } };
 
  158 debris_vclip Debris_vclips_nebula[
MAX_DEBRIS_VCLIPS] = { { -1, -1, 
"nebdeb01" }, { -1, -1, 
"nebdeb02" }, { -1, -1, 
"nebdeb03" }, { -1, -1, 
"nebdeb04" } };
 
  186                 if ( (vclips[i].bm >= 0) && 
bm_release(vclips[i].bm) ) {
 
  197         if (vclips == NULL) {
 
  205                 if ( vclips[i].bm < 0 ) {
 
  207                         vclips[
i].
bm = 
bm_load(Debris_vclips[i].name);
 
  210                         if (vclips[i].bm <= 0) {
 
  211                                 Error( 
LOCATION, 
"Couldn't load animation/bitmap '%s'\n", vclips[i].name );
 
  242 static void starfield_create_bitmap_buffer(
const int si_idx)
 
  258         int div_x = sbi->
div_x;
 
  259         int div_y = sbi->
div_y;
 
  266         if (sbi->
verts != NULL) {
 
  267                 delete [] sbi->
verts;
 
  270         sbi->
verts = 
new(std::nothrow) 
vertex[div_x * div_y * 6];
 
  272         if (sbi->
verts == NULL) {
 
  277         sbi->
n_verts = div_x * div_y * 6;
 
  280         ui = 1.0f / (
float)div_x;
 
  281         vi = 1.0f / (
float)div_y;       
 
  286         scale_x *= 1.883333f; 
 
  288         float s_phi = 0.5f + (((
p_phi * scale_x) / 360.0
f) / 2.0f);
 
  289         float s_theta = (((
p_theta * scale_y) / 360.0
f) / 2.0f);
 
  290         float d_phi = -(((
p_phi * scale_x) / 360.0
f) / (
float)(div_x));
 
  291         float d_theta = -(((
p_theta * scale_y) / 360.0
f) / (
float)(div_y));
 
  305         for(idx=0; idx<=div_x; idx++) {
 
  306                 for(s_idx=0; s_idx<=div_y; s_idx++) {
 
  311                         vm_vec_rotate(&t_points[idx][s_idx], &s_points[idx][s_idx], &m_bank);
 
  314                         vm_vec_rotate(&s_points[idx][s_idx], &t_points[idx][s_idx], &m);
 
  318         memset(v, 0, 
sizeof(
vertex) * 4);
 
  324         for (idx = 0; idx < div_x; idx++) {
 
  325                 for (s_idx = 0; s_idx < div_y; s_idx++) {
 
  359 static void starfield_generate_bitmap_buffers()
 
  363         int sb_instances = (
int)Starfield_bitmap_instances.size();
 
  365         for (idx = 0; idx < sb_instances; idx++) {
 
  366                 if (Starfield_bitmap_instances[idx].star_bitmap_index < 0) {
 
  370                 starfield_create_bitmap_buffer(idx);
 
  395 #define CHECK_END() {   \ 
  397                 required_string("#end");        \ 
  408         bool in_check = 
false;
 
  422                                 starfield_bitmap_entry_init(&sbm);
 
  428                                         if (sbm.
xparent == Starfield_bitmaps[idx].xparent) {
 
  433                                                 Warning(
LOCATION, 
"Starfield bitmap '%s' already listed as a %s bitmap!!  Only using the xparent version!",
 
  434                                                         sbm.
filename, (rc) ? 
"xparent" : 
"non-xparent");
 
  438                                         Starfield_bitmaps.push_back(sbm);
 
  447                                 starfield_bitmap_entry_init(&sbm);
 
  488                                                 sprintf(tempf, 
"$FlareTexture%d:", idx + 1);
 
  512                                                 sprintf(tempf, 
"$FlareGlow%d:", idx + 1);
 
  536                                                 Sun_bitmaps[
idx] = sbm;
 
  541                                         Sun_bitmaps.push_back(sbm);
 
  591                 mprintf((
"TABLES: Unable to parse '%s'!  Error message = %s.\n", filename, e.what()));
 
  600         static int Star_bitmaps_loaded = 0;
 
  602         if (Star_bitmaps_loaded)
 
  608         int mprintf_count = 0;
 
  609         for (idx = 0; idx < (
int)Starfield_bitmaps.size(); idx++) {
 
  610                 sb = &Starfield_bitmaps[
idx];
 
  626         if (mprintf_count > 0) {
 
  627                 Warning(
LOCATION, 
"Unable to load %d starfield bitmap(s)!\n", mprintf_count);
 
  630         for (idx = 0; idx < (
int)Sun_bitmaps.size(); idx++) {
 
  631                 sb = &Sun_bitmaps[
idx];
 
  678         Star_bitmaps_loaded = 1;
 
  683         for (
uint i = 0; i < Starfield_bitmap_instances.size(); i++) {
 
  684                 delete [] Starfield_bitmap_instances[
i].verts;
 
  685                 Starfield_bitmap_instances[
i].verts = NULL;
 
  688         Starfield_bitmap_instances.clear();
 
  719         if (clear_backgrounds)
 
  724                         Backgrounds[
i].
suns.clear();
 
  740                 for (idx = 0; idx < Starfield_bitmaps.size(); idx++) {
 
  741                         sb = &Starfield_bitmaps[
idx];
 
  752                 for (idx = 0; idx < Sun_bitmaps.size(); idx++) {
 
  753                         sb = &Sun_bitmaps[
idx];
 
  786         float dist, dist_max;
 
  801                 while (dist >= dist_max) {
 
  824         for (i=0; i<8; i++ ) {
 
  827                 gr_init_color(&star_colors[i], intensity, intensity, intensity );
 
  833         if ( !Suns.size() ) {
 
  834                 if ( !strlen(Sun_bitmaps[0].
filename) ) {
 
  835                         mprintf((
"Trying to add default sun but no default exists!!\n"));
 
  837                         mprintf((
"Adding default sun.\n"));
 
  844                         Suns.push_back(def_sun);
 
  853         starfield_generate_bitmap_buffers();
 
  859 #define STAR_AMOUNT_DEFAULT 0.75f 
  860 #define STAR_DIM_DEFAULT 7800.0f 
  861 #define STAR_CAP_DEFAULT 75.0f 
  862 #define STAR_MAX_LENGTH_DEFAULT 0.04f           // 312 
  869 #define STAR_FLAG_TAIL                  (1<<0)  // Draw a tail when moving 
  870 #define STAR_FLAG_DIM                   (1<<1)  // Dim as you move 
  871 #define STAR_FLAG_ANTIALIAS             (1<<2)  // Draw the star using antialiased lines 
  872 #define STAR_FLAG_DEFAULT               (STAR_FLAG_TAIL | STAR_FLAG_DIM) 
  877 DCF(stars,
"Set parameters for starfield")
 
  884                 dc_printf( 
"Usage: stars keyword\nWhere keyword can be in the following forms:\n" );
 
  885                 dc_printf( 
"stars default   Resets stars to all default values\n" );
 
  887                 dc_printf( 
"stars tail X    Where X is the percent of 'tail' between 0 and 1.0\n" );
 
  888                 dc_printf( 
"stars dim X     Where X is the amount stars dim between 0 and 255.0\n" );
 
  889                 dc_printf( 
"stars cap X     Where X is the cap of dimming between 0 and 255.\n" );
 
  890                 dc_printf( 
"stars len X     Where X is the cap of length.\n" );
 
  891                 dc_printf( 
"stars m0        Macro0. Old 'pixel type' crappy stars. flags=none\n" );
 
  892                 dc_printf( 
"stars m1        Macro1. (default) tail=.75, dim=20.0, cap=75.0, flags=dim,tail\n" );
 
  893                 dc_printf( 
"stars m2        Macro2. tail=.75, dim=20.0, cap=75.0, flags=dim,tail,aa\n" );
 
  894                 dc_printf( 
"stars flag X    Toggles flag X, where X is tail or dim or aa (aa=antialias)\n" );
 
  895                 dc_printf( 
"\nHINT: set cap to 0 to get dim rate and tail down, then use\n" );
 
  896                 dc_printf( 
"cap to keep the lines from going away when moving too fast.\n" );
 
  897                 dc_printf( 
"\nUse '? stars' to see current values.\n" );
 
  903                 dc_printf( 
"Tail: %.2f\n", Star_amount );
 
  906                 dc_printf( 
"Max length: %.2f\n", Star_max_length );
 
  911                 dc_printf( 
"\nTHESE AREN'T SAVED TO DISK, SO IF YOU TWEAK\n" );
 
  912                 dc_printf( 
"THESE AND LIKE THEM, WRITE THEM DOWN!!\n" );
 
  926         } 
else if (arg == 
"tail") {
 
  928                 CLAMP(val_f, 0.0, 1.0);
 
  931                 dc_printf(
"Star_amount set to %f\n", Star_amount);
 
  933         } 
else if (arg == 
"dim") {
 
  938                         dc_printf(
"Star_dim set to %f\n", Star_dim);
 
  941                         dc_printf(
"Error: Star_dim value must be non-negative\n");
 
  944         } 
else if (arg == 
"cap") {
 
  946                 CLAMP(val_f, 0.0, 255);
 
  949                 dc_printf(
"Star_cap set to %f\n", Star_cap);
 
  951         } 
else if (arg == 
"len") {
 
  954                 dc_printf(
"Star_max_length set to %f\n", Star_max_length);
 
  956         } 
else if (arg == 
"m0") {
 
  963                 dc_printf(
"Starfield set: Old 'pixel type' crappy stars. flags=none\n");
 
  965         } 
else if ((arg == 
"m1") || (arg == 
"default")) {
 
  972                 dc_printf(
"Starfield set: (default) tail=.75, dim=20.0, cap=75.0, flags=dim,tail\n");
 
  974         } 
else if (arg == 
"m2") {
 
  981                 dc_printf(
"Starfield set: tail=.75, dim=20.0, cap=75.0, flags=dim,tail,aa\n");
 
  983         } 
else if (arg == 
"flag") {
 
  987                 } 
else if (arg == 
"dim" ) {
 
  989                 } 
else if (arg == 
"aa" ) {
 
  992                         dc_printf(
"Error: unknown flag argument '%s'\n", arg.c_str());
 
  996                 dc_printf(
"Error: Unknown argument '%s'", arg.c_str());
 
 1008         reload_old_debris = 1;
 
 1022         Assert( sun_n < (
int)Suns.size() );
 
 1024         if ( (sun_n >= (
int)Suns.size()) || (sun_n < 0) ) {
 
 1055         int num_suns = (
int)Suns.size();
 
 1057         for (idx = 0; idx < num_suns; idx++) {
 
 1059                 if (Suns[idx].star_bitmap_index < 0)
 
 1062                 bm = &Sun_bitmaps[Suns[
idx].star_bitmap_index];
 
 1068                 memset( &sun_vex, 0, 
sizeof(
vertex) );
 
 1072                 sun_pos.
xyz.y = 1.0f;
 
 1080                 if ( !Rendering_to_env )
 
 1109         vertex flare_vex = *sun_vex; 
 
 1111         Assert( sun_n < (
int)Suns.size() );
 
 1113         if ( (sun_n >= (
int)Suns.size()) || (sun_n < 0) ) {
 
 1118         if (Suns[sun_n].star_bitmap_index < 0) {
 
 1121                 bm = &Sun_bitmaps[Suns[sun_n].star_bitmap_index];
 
 1141                 for (i = 0; i < bm->
n_flares; i++) {
 
 1157         vec3d sun_pos, sun_dir;
 
 1165         if ( (sun_n >= (
int)Suns.size()) || (sun_n < 0) ) {
 
 1170         if (Suns[sun_n].star_bitmap_index < 0)
 
 1173         bm = &Sun_bitmaps[Suns[sun_n].star_bitmap_index];
 
 1179         memset( &sun_vex, 0, 
sizeof(
vertex) );
 
 1183         sun_pos.
xyz.y = 1.0f;
 
 1209                 vec3d local_light_dir;
 
 1228         if ( !show_bitmaps )
 
 1250         int sb_instances = (
int)Starfield_bitmap_instances.size();
 
 1252         for (idx = 0; idx < sb_instances; idx++) {
 
 1254                 star_index = Starfield_bitmap_instances[
idx].star_bitmap_index;
 
 1256                 if (star_index < 0) {
 
 1261                 if (Starfield_bitmaps[star_index].bitmap_id < 0) {
 
 1267                 if (Starfield_bitmaps[star_index].xparent) {
 
 1268                         if (Starfield_bitmaps[star_index].fps) {
 
 1269                                 gr_set_bitmap(Starfield_bitmaps[star_index].bitmap_id + ((
timestamp() / (
int)(Starfield_bitmaps[star_index].fps)) % Starfield_bitmaps[star_index].n_frames));           
 
 1276                         if (Starfield_bitmaps[star_index].fps) {
 
 1283                 gr_render(Starfield_bitmap_instances[idx].n_verts, Starfield_bitmap_instances[idx].verts, tmap_flags);
 
 1315 DCF(subspace_set,
"Set parameters for subspace effect")
 
 1321                 dc_printf( 
"Usage: subspace [--status] <axis> <speed>\n");
 
 1322                 dc_printf(
"[--status] -- Displays the current speeds for both axes\n");
 
 1323                 dc_printf(
"<axis>  -- May be either 'u' or 'v', and corresponds to the texture axis\n");
 
 1324                 dc_printf(
"<speed> -- is the speed along the axis that the texture is moved\n");
 
 1329                 dc_printf( 
"u: %.2f\n", subspace_u_speed );
 
 1330                 dc_printf( 
"v: %.2f\n", subspace_v_speed );
 
 1338                 if ( value < 0.0
f ) {
 
 1339                         dc_printf(
"Error: speed must be non-negative");
 
 1342                 subspace_u_speed = 
value;
 
 1344         } 
else if (arg == 
"v") {
 
 1348                         dc_printf(
"Error: speed must be non-negative");
 
 1351                 subspace_v_speed = 
value;
 
 1354                 dc_printf(
"Error: Unknown axis '%s'", arg.c_str());
 
 1363         if ( Subspace_model_inner == -1 )       {
 
 1364                 Subspace_model_inner = 
model_load( 
"subspace_small.pof", 0, NULL );
 
 1365                 Assert(Subspace_model_inner >= 0);
 
 1368         if ( Subspace_model_outer == -1 )       {
 
 1369                 Subspace_model_outer = 
model_load( 
"subspace_big.pof", 0, NULL );
 
 1370                 Assert(Subspace_model_outer >= 0);
 
 1373         if ( Subspace_glow_bitmap == -1 )       {
 
 1374                 Subspace_glow_bitmap = 
bm_load( 
NOX(
"SunGlow01"));
 
 1375                 Assert(Subspace_glow_bitmap >= 0);
 
 1378         if ( !Rendering_to_env ) {
 
 1384                 if ( Subspace_glow_frame < 0.0
f )
 
 1385                         Subspace_glow_frame = 0.0f;
 
 1386                 if ( Subspace_glow_frame > 100.0
f )
 
 1387                         Subspace_glow_frame = 0.0f;
 
 1389                 while ( Subspace_glow_frame > total_time ) {
 
 1390                         Subspace_glow_frame -= total_time;
 
 1397                 if ( framenum >= NOISE_NUM_FRAMES )
 
 1398                         framenum = NOISE_NUM_FRAMES-1;
 
 1401                 if (subspace_offset_u > 1.0
f ) {
 
 1402                         subspace_offset_u -= 1.0f;
 
 1405                 subspace_offset_u_inner += 
flFrametime*subspace_u_speed*3.0f;
 
 1406                 if (subspace_offset_u > 1.0
f ) {
 
 1407                         subspace_offset_u -= 1.0f;
 
 1411                 if (subspace_offset_v > 1.0
f ) {
 
 1412                         subspace_offset_v -= 1.0f;
 
 1418         angles angs = { 0.0f, 0.0f, 0.0f };
 
 1420         angs.
b = subspace_offset_v * 
PI2;
 
 1430         Interp_subspace = 1;
 
 1432         Interp_subspace_offset_v = 0.0f;
 
 1446         Interp_subspace = 1;
 
 1448         Interp_subspace_offset_v = 0.0f;
 
 1450         angs.
b = -subspace_offset_v * 
PI2;
 
 1470         glow_pos.
xyz.x = 0.0f;
 
 1471         glow_pos.
xyz.y = 0.0f;
 
 1472         glow_pos.
xyz.z = 100.0f;
 
 1478         glow_pos.
xyz.z = -100.0f;
 
 1483         Interp_subspace = 0;
 
 1493                 memset(
p1.color,INT_MAX,4);
 
 1501                 p1.
vec.set_screen_vert(*P1);
 
 1502                 p2.
vec.set_screen_vert(*P2);
 
 1511 class star_point_list {
 
 1513         star_point *point_list;
 
 1515         star_point_list():n_points(0),point_list(NULL){};
 
 1516         ~star_point_list(){
if(point_list)
delete[]point_list;};
 
 1518         void allocate(
int size){
 
 1519                 if(size<=n_points)
return;
 
 1520                 if(point_list)
delete[]point_list;
 
 1521                 point_list = 
new star_point[
size];
 
 1524         star_point* operator[] (
int idx) {
 
 1525                 return &point_list[
idx];
 
 1530 star_point_list star_list;
 
 1532 void new_stars_draw_stars()
 
 1547                 for (sp=Stars,i=0; i<
Num_stars; i++, sp++ ) {
 
 1559         if (tmp_num_stars < 0 ) {
 
 1561         } 
else if ( tmp_num_stars > 
Num_stars ) {
 
 1565         int stars_to_draw = 0;
 
 1566         for (sp=Stars,i=0; i<tmp_num_stars; i++, sp++ ) {
 
 1568                 memset(&p1, 0, 
sizeof(
vertex));
 
 1569                 memset(&p2, 0, 
sizeof(
vertex));
 
 1591                         if ( dist > Star_max_length ) {
 
 1592                                 ratio = Star_max_length / dist;
 
 1621                 if ( !can_draw )        
continue;
 
 1625                         if ( colorf < Star_cap )
 
 1627                         color = (
fl2i(colorf)*(i&7))/256;
 
 1636                 star_list[stars_to_draw++]->set(&p2,&p1,&sp->
col);
 
 1663         int tmp_num_stars = 0;
 
 1669         for (i = 0; i < tmp_num_stars; i++) {
 
 1673                 memset(&p1, 0, 
sizeof(
vertex));
 
 1674                 memset(&p2, 0, 
sizeof(
vertex));
 
 1690                 if ( can_draw && (Star_flags & (
STAR_FLAG_TAIL|STAR_FLAG_DIM)) ) {
 
 1693                         if ( dist > Star_max_length ) {
 
 1694                                 ratio = Star_max_length / dist;
 
 1729                 if ( ((vDst.
x * vDst.
x) + (vDst.
y * vDst.
y)) <= 4 ) {
 
 1747         if (Motion_debris_override)
 
 1782                 if ( reload_old_debris ) {
 
 1810         reload_old_debris = 0;
 
 1813 void stars_draw(
int show_stars, 
int show_suns, 
int show_nebulas, 
int show_subspace, 
int env)
 
 1818         Rendering_to_env = 
env;
 
 1826 #ifdef TIME_STAR_CODE 
 1843         else if ( !show_subspace ) 
 
 1854 #ifdef TIME_STAR_CODE 
 1856         mprintf(( 
"Stars: %d\n", xt2-xt1 ));
 
 1870         Rendering_to_env = 0;
 
 1886         Sun_bitmaps[
idx].preload = 1;
 
 1902         Starfield_bitmaps[
idx].preload = 1;
 
 1914                 Subspace_model_inner = 
model_load( 
"subspace_small.pof", 0, NULL );
 
 1915                 Assert(Subspace_model_inner >= 0);
 
 1916                 Subspace_model_outer = 
model_load( 
"subspace_big.pof", 0, NULL );
 
 1917                 Assert(Subspace_model_outer >= 0);
 
 1923                 nprintf(( 
"Paging", 
"Paging in textures for subspace effect.\n" ));
 
 1931                 nprintf(( 
"Paging", 
"Paging in textures for subspace effect.\n" ));
 
 1937                 if (Subspace_glow_bitmap < 0) {
 
 1938                         Subspace_glow_bitmap = 
bm_load( 
NOX(
"SunGlow01"));
 
 1943                 Subspace_model_inner = -1;
 
 1944                 Subspace_model_outer = -1;
 
 1946                 if (Subspace_glow_bitmap > 0) {
 
 1948                         Subspace_glow_bitmap = -1;
 
 1953         for (idx = 0; idx < (
int)Starfield_bitmaps.size(); idx++) {
 
 1954                 sb = &Starfield_bitmaps[
idx];
 
 1984         for (idx = 0; idx < (
int)Sun_bitmaps.size(); idx++) {
 
 1985                 sb = &Sun_bitmaps[
idx];
 
 2045         for (idx = 0; idx < (
int)Starfield_bitmap_instances.size(); idx++) {
 
 2046                 sbi = &Starfield_bitmap_instances[
idx];
 
 2080         for (idx = 0; idx < (
int)Suns.size(); idx++) {
 
 2191         if ( (model_name == NULL) || (*model_name == 
'\0') )
 
 2209         if (orient == NULL) {
 
 2225         for (idx = 0; idx < (
int)Starfield_bitmaps.size(); idx++) {
 
 2244         for (idx = 0; idx < (
int)Sun_bitmaps.size(); idx++) {
 
 2282         if (Sun_bitmaps[idx].bitmap_id < 0) {
 
 2287                 if (Sun_bitmaps[idx].bitmap_id < 0) {
 
 2288                         Sun_bitmaps[
idx].bitmap_id = 
bm_load_animation(Sun_bitmaps[idx].filename, &Sun_bitmaps[idx].n_frames, &Sun_bitmaps[idx].fps, NULL, 1);
 
 2290                         if (Sun_bitmaps[idx].bitmap_id < 0) {
 
 2297                 if (Sun_bitmaps[idx].glow_bitmap < 0) {
 
 2298                         Sun_bitmaps[
idx].glow_bitmap = 
bm_load(Sun_bitmaps[idx].glow_filename);
 
 2301                         if (Sun_bitmaps[idx].glow_bitmap < 0) {
 
 2302                                 Sun_bitmaps[
idx].glow_bitmap = 
bm_load_animation(Sun_bitmaps[idx].glow_filename, &Sun_bitmaps[idx].glow_n_frames, &Sun_bitmaps[idx].glow_fps, NULL, 1);
 
 2304                                 if (Sun_bitmaps[idx].glow_bitmap < 0) {
 
 2305                                         Warning(
LOCATION, 
"Unable to load sun glow bitmap: '%s'!\n", Sun_bitmaps[idx].glow_filename);
 
 2310                 if (Sun_bitmaps[idx].flare) {
 
 2320                                                 Warning(
LOCATION, 
"Unable to load sun flare bitmap: '%s'!\n", Sun_bitmaps[idx].flare_bitmaps[i].filename);
 
 2331                 for (i = 0; i < (
int)Suns.size(); i++) {
 
 2332                         if ( Suns[i].star_bitmap_index < 0 ) {
 
 2340         Suns.push_back(sbi);
 
 2342         return Suns.size() - 1;
 
 2373         if (Starfield_bitmaps[idx].bitmap_id < 0) {
 
 2377                 if (Starfield_bitmaps[idx].bitmap_id < 0) {
 
 2378                         Starfield_bitmaps[
idx].bitmap_id = 
bm_load_animation(Starfield_bitmaps[idx].filename, &Starfield_bitmaps[idx].n_frames, &Starfield_bitmaps[idx].fps, NULL, 1);
 
 2380                         if (Starfield_bitmaps[idx].bitmap_id < 0) {
 
 2388         for (
int i = 0; i < (
int)Starfield_bitmap_instances.size(); i++) {
 
 2389                 if ( Starfield_bitmap_instances[i].star_bitmap_index < 0 ) {
 
 2391                         Starfield_bitmap_instances[
i] = sbi;
 
 2392                         starfield_create_bitmap_buffer(i);
 
 2398         Starfield_bitmap_instances.push_back(sbi);
 
 2399         starfield_create_bitmap_buffer(Starfield_bitmap_instances.size() - 1);
 
 2401         return Starfield_bitmap_instances.size() - 1;
 
 2410         if (!bitmap_count) {
 
 2412                         return (
int)Suns.size();
 
 2414                         return (
int)Starfield_bitmap_instances.size();
 
 2420                         return (
int)Sun_bitmaps.size();
 
 2422                         return (
int)Starfield_bitmaps.size();
 
 2431         int max_index = (is_a_sun) ? (
int)Suns.size() : (
int)Starfield_bitmap_instances.size();
 
 2436         if ( (index < 0) || (index >= max_index) )
 
 2439         if (is_a_sun && (Suns[index].star_bitmap_index >= 0)) {
 
 2440                 return &Sun_bitmaps[Suns[
index].star_bitmap_index];
 
 2441         } 
else if (!is_a_sun && (Starfield_bitmap_instances[index].star_bitmap_index >= 0)) {
 
 2442                 return &Starfield_bitmaps[Starfield_bitmap_instances[
index].star_bitmap_index];
 
 2451         return (sb && sb->
glare);
 
 2457         int max_index = (is_a_sun) ? (
int)Suns.size() : (
int)Starfield_bitmap_instances.size();
 
 2459         Assert( (index >= 0) && (index < max_index) );
 
 2461         if ( (index < 0) || (index >= max_index) )
 
 2465                 return &Suns[
index];
 
 2467                 return &Starfield_bitmap_instances[
index];
 
 2474         int max_index = (is_a_sun) ? (
int)Suns.size() : (
int)Starfield_bitmap_instances.size();
 
 2476         Assert( (index >= 0) && (index < max_index) );
 
 2478         if ( (index < 0) || (index >= max_index) )
 
 2482                 Suns[
index].star_bitmap_index =  -1;
 
 2484                 Starfield_bitmap_instances[
index].star_bitmap_index = -1;
 
 2488                 delete [] Starfield_bitmap_instances[
index].verts;
 
 2489                 Starfield_bitmap_instances[
index].verts = NULL;
 
 2497         int max_index = (is_a_sun) ? (
int)Suns.size() : (
int)Starfield_bitmap_instances.size();
 
 2499         Assert( (index >= 0) && (index < max_index) );
 
 2501         if ( (index < 0) || (index >= max_index) )
 
 2502                 return NOX(
"<none>");
 
 2504         if (is_a_sun && (Suns[index].star_bitmap_index >= 0)) {
 
 2505                 return Sun_bitmaps[Suns[
index].star_bitmap_index].filename;
 
 2506         } 
else if (!is_a_sun && (Starfield_bitmap_instances[index].star_bitmap_index >= 0)) {
 
 2507                 return Starfield_bitmaps[Starfield_bitmap_instances[
index].star_bitmap_index].filename;
 
 2510         return NOX(
"<none>");
 
 2548         int max_index = (is_a_sun) ? (
int)Sun_bitmaps.size() : (
int)Starfield_bitmaps.size();
 
 2550         Assert( (index >= 0) && (index < max_index) );
 
 2552         if ( (index < 0) || (index >= max_index) )
 
 2556                 return Sun_bitmaps[
index].filename;
 
 2558                 return Starfield_bitmaps[
index].filename;
 
 2570         int add_new = index > ((is_a_sun) ? (
int)Sun_bitmaps.size() : (
int)Starfield_bitmaps.size());
 
 2573         Assert( sbi_new != NULL );
 
 2598                         Suns.push_back( sbi );
 
 2600                         Starfield_bitmap_instances.push_back( sbi );
 
 2606                         Starfield_bitmap_instances[
index] = sbi;
 
 2611                 starfield_create_bitmap_buffer(index);
 
 2621         int max_index = (is_a_sun) ? (
int)Suns.size() : (
int)Starfield_bitmap_instances.size();
 
 2623         Assert( (index >= 0) && (index < max_index) );
 
 2625         if ( (index < 0) || (index >= max_index) )
 
 2629                 Suns.erase( Suns.begin() + 
index );
 
 2631                 Starfield_bitmap_instances.erase( Starfield_bitmap_instances.begin() + 
index );
 
 2656                 for (j = 0; j < background->
suns.size(); j++)
 
 2660                                 mprintf((
"Failed to load sun %s for background %d, falling back to background %d\n",
 
 2661                                         background->
suns[j].filename, i + 1, i + 2));
 
 2669                         for (j = 0; j < background->
bitmaps.size(); j++)
 
 2673                                         mprintf((
"Failed to load bitmap %s for background %d, falling back to background %d\n",
 
 2674                                                 background->
suns[j].filename, i + 1, i + 2));
 
 2701                 int failed_suns = 0;
 
 2702                 for (j = 0; j < background->
suns.size(); j++)
 
 2706                                 nprintf((
"General", 
"Failed to add sun '%s' to the mission!", background->
suns[j].filename));
 
 2710                 if (failed_suns > 0)
 
 2711                         Warning(
LOCATION, 
"Failed to add %d sun bitmaps to the mission!", failed_suns);
 
 2713                 int failed_stars = 0;
 
 2714                 for (j = 0; j < background->
bitmaps.size(); j++)
 
 2718                                 nprintf((
"General", 
"Failed to add starfield bitmap '%s' to the mission!", background->
bitmaps[j].filename));
 
 2722                 if (failed_stars > 0)
 
 2723                         Warning(
LOCATION, 
"Failed to add %d starfield bitmaps to the mission!", failed_stars);
 
 2746         return !(Backgrounds[
idx].
suns.size() > 0 || Backgrounds[
idx].
bitmaps.size() > 0);
 
void light_add_directional(const vec3d *dir, float intensity, float r, float g, float b, float spec_r, float spec_g, float spec_b, bool specular)
 
void advance_to_eoln(char *more_terminators)
 
int stars_get_num_entries(bool is_a_sun, bool bitmap_count)
 
float Subspace_glow_frame
 
matrix skybox_orientation
 
int timestamp(int delta_ms)
 
char Neb2_texture_name[MAX_FILENAME_LEN]
 
struct screen3d::@234::@236 xyw
 
int stars_add_bitmap_entry(starfield_list_entry *sle)
 
SCP_vector< starfield_list_entry > suns
 
#define TMAP_FLAG_XPARENT
 
float vm_vec_mag_quick(const vec3d *v)
 
#define DETAIL_FLAG_MOTION
 
float supernova_pct_complete()
 
float Interp_subspace_offset_u
 
void stars_release_debris_vclips(debris_vclip *vclips)
 
#define MISSION_FLAG_FULLNEB
 
polymodel * model_get(int model_num)
 
const char * stars_get_name_FRED(int index, bool is_a_sun)
 
background_t Backgrounds[MAX_BACKGROUNDS]
 
#define gr_set_texture_panning
 
GLsizei const GLfloat * value
 
bool Motion_debris_override
 
matrix * vm_angles_2_matrix(matrix *m, const angles *a)
 
#define gr_start_instance_matrix
 
#define STAR_FLAG_ANTIALIAS
 
void stars_set_nebula(bool activate)
 
void stars_set_background_orientation(matrix *orient)
 
void stars_mark_instance_unused(int index, bool is_a_sun)
 
#define DEFAULT_NMODEL_FLAGS
 
debris_vclip Debris_vclips_normal[]
 
#define TOGGLE_TEXT_NORMAL_ALPHA
 
#define DETAIL_FLAG_STARS
 
ubyte g3_transfer_vertex(vertex *dest, const vec3d *src)
 
starfield_bitmap_instance * stars_get_instance(int index, bool is_a_sun)
 
void _cdecl void void _cdecl void _cdecl Warning(char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
void gr_init_alphacolor(color *clr, int r, int g, int b, int alpha, int type)
 
struct flare_info flare_info
 
void stars_preload_sun_bitmap(char *fname)
 
void stars_pre_level_init(bool clear_backgrounds)
 
void set_flags(uint flags)
 
int light_get_global_dir(vec3d *pos, int n)
 
struct vec3d::@225::@227 xyz
 
bool stars_background_empty(int idx)
 
#define TMAP_HTL_3D_UNLIT
 
void model_render_immediate(model_render_params *render_info, int model_num, matrix *orient, vec3d *pos, int render, bool sort)
 
const float MIN_DIST_RANGE
 
old_debris odebris[MAX_DEBRIS]
 
#define STAR_MAX_LENGTH_DEFAULT
 
vec3d * vm_vec_rotate(vec3d *dest, const vec3d *src, const matrix *m)
 
starfield_bitmap_instance()
 
ubyte g3_code_vertex(vertex *point)
 
void stars_copy_background(background_t *dest, background_t *src)
 
void gr_set_color_fast(color *dst)
 
#define gr_end_instance_matrix
 
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
 
#define MAX_DEBRIS_VCLIPS
 
float subspace_offset_u_inner
 
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
 
debris_vclip * Debris_vclips
 
int stars_get_first_valid_background()
 
void stars_modify_entry_FRED(int index, const char *name, starfield_list_entry *sbi_new, bool is_a_sun)
 
float Noise[NOISE_NUM_FRAMES]
 
void bm_page_in_xparent_texture(int bitmapnum, int nframes)
Marks a textures as being used for level and is transparant. 
 
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot. 
 
#define TOGGLE_TEXT_NEBULA_ALPHA
 
void stars_draw_sun(int show_sun)
 
char filename[MAX_FILENAME_LEN]
 
void stars_draw_background()
 
void stuff_float(float *f)
 
int bm_load_animation(const char *real_filename, int *nframes, int *fps, int *keyframe, int can_drop_frames, int dir_type)
Loads a bitmap sequance so we can draw with it. 
 
#define CLAMP(x, min, max)
 
void gr_set_color(int r, int g, int b)
 
int Cmdline_nomotiondebris
 
void set_alpha(float alpha)
 
#define PM_FLAG_HAS_INTRINSIC_ROTATE
 
void stars_preload_background_bitmap(char *fname)
 
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
 
void vm_vec_add2(vec3d *dest, const vec3d *src)
 
#define GR_ALPHABLEND_FILTER
 
#define SUPERNOVA_SUN_SCALE
 
void model_delete_instance(int model_instance_num)
 
float Interp_subspace_offset_v
 
struct matrix::@228::@230 vec
 
void stars_set_background_model(char *model_name, char *texture_name, int flags)
 
void vm_vec_scale(vec3d *dest, float s)
 
void stars_load_background(int background_idx)
 
struct starfield_bitmap_instance starfield_bitmap_instance
 
void stars_post_level_init()
 
GLboolean GLboolean GLboolean GLboolean a
 
#define STAR_FLAG_DEFAULT
 
#define gr_draw_line_list
 
float g3_draw_laser(const vec3d *headp, float head_width, const vec3d *tailp, float tail_width, uint tmap_flags=TMAP_FLAG_TEXTURED, float max_len=0.0f)
 
texture_map maps[MAX_MODEL_TEXTURES]
 
flare_info flare_infos[MAX_FLARE_COUNT]
 
void stars_draw_sun_glow(int sun_n)
 
void stuff_string(char *outstr, int type, int len, char *terminators)
 
void stars_load_debris_vclips(debris_vclip *vclips)
 
int stars_find_bitmap(char *name)
 
#define STAR_AMOUNT_DEFAULT
 
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
 
void vm_set_identity(matrix *m)
 
int Stars_background_inited
 
int stars_find_sun(char *name)
 
ubyte g3_rotate_vertex(vertex *dest, const vec3d *src)
 
int required_string(const char *pstr)
 
debris_vclip Debris_vclips_nebula[]
 
void stars_project_2d_onto_sphere(vec3d *pnt, float rho, float phi, float theta)
 
int optional_string(const char *pstr)
 
char skybox_model[MAX_FILENAME_LEN]
 
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias. 
 
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, int ferror=1, int duplicate=0)
 
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
 
void model_page_in_textures(int modelnum, int ship_info_index=-1)
 
bool Parsing_modular_table
 
void set_color(color &clr)
 
int g3_project_vertex(vertex *point)
 
void set_forced_bitmap(int bitmap)
 
void stars_swap_backgrounds(int idx1, int idx2)
 
starfield_bitmap * stars_get_bitmap_entry(int index, bool is_a_sun)
 
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
 
#define TMAP_FLAG_CORRECT
 
void dc_stuff_float(float *f)
Stuffs a float to the given variable. 
 
void reset_parse(char *text)
 
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
 
void stars_load_first_valid_background()
 
void vm_vec_sub(vec3d *dest, const vec3d *src0, const vec3d *src1)
 
void stars_load_debris(int fullneb=0)
 
void dc_stuff_string_white(char *out_str, size_t maxlen)
Stuffs a whitespace delimited string to out_str from the command line, stopping at the end of the com...
 
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later. 
 
__inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near=-1.0f, float fog_far=-1.0f)
 
#define TMAP_FLAG_TRILIST
 
typedef float(SCP_EXT_CALLCONV *SCPTRACKIR_PFFLOATVOID)()
 
struct starfield_bitmap starfield_bitmap
 
flare_bitmap flare_bitmaps[MAX_FLARE_BMP]
 
void stars_get_sun_pos(int sun_n, vec3d *pos)
 
ubyte g3_rotate_faraway_vertex(vertex *dest, const vec3d *src)
 
float vm_vec_dist_quick(const vec3d *v0, const vec3d *v1)
 
const int MAX_PERSPECTIVE_DIVISIONS
 
int optional_string_either(char *str1, char *str2)
 
void bm_page_in_texture(int bitmapnum, int nframes)
Marks a texture as being used for this level. 
 
fix timer_get_fixed_seconds()
 
float vm_vec_copy_normalize(vec3d *dest, const vec3d *src)
 
DCF(stars,"Set parameters for starfield")
 
void stars_draw(int show_stars, int show_suns, int show_nebulas, int show_subspace, int env)
 
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
 
void parse_startbl(const char *filename)
 
#define TMAP_FLAG_TEXTURED
 
char filename[MAX_FILENAME_LEN]
 
struct debris_vclip debris_vclip
 
const char * stars_get_name_from_instance(int index, bool is_a_sun)
 
int g3_draw_bitmap(vertex *pos, int orient, float radius, uint tmap_flags, float depth=0.0f)
 
bool stars_sun_has_glare(int index)
 
struct flare_bitmap flare_bitmap
 
float vm_vec_dot(const vec3d *v0, const vec3d *v1)
 
int parse_modular_table(const char *name_check, void(*parse_callback)(const char *filename), int path_type, int sort_type)
 
#define GR_BITBLT_MODE_NORMAL
 
#define DETAIL_FLAG_NEBULAS
 
void dc_printf(const char *format,...)
Prints the given char string to the debug console. 
 
SCP_vector< starfield_list_entry > bitmaps
 
const float MAX_DIST_RANGE
 
cmdline_parm env("-noenv", NULL, AT_NONE)
 
int bm_unload(int handle, int clear_render_targets, bool nodebug)
Unloads a bitmap's data, but not the bitmap info. 
 
void stars_pack_backgrounds()
 
char filename[MAX_FILENAME_LEN]
 
char glow_filename[MAX_FILENAME_LEN]
 
int model_create_instance(bool is_ship, int model_num)
 
void stars_clear_instances()
 
GLclampf GLclampf GLclampf alpha
 
void stars_delete_entry_FRED(int index, bool is_a_sun)
 
void stars_draw_bitmaps(int show_bitmaps)
 
void vm_vec_add(vec3d *dest, const vec3d *src0, const vec3d *src1)
 
void gr_init_color(color *c, int r, int g, int b)
 
matrix vmd_identity_matrix
 
void stars_load_all_bitmaps()
 
int stars_add_sun_entry(starfield_list_entry *sun_ptr)
 
#define DEBRIS_ROT_RANGE_SCALER
 
void model_unload(int modelnum, int force=0)
 
#define BACKGROUND_MODEL_FILENAME
 
float vm_vec_normalize(vec3d *v)
 
void stars_draw_lens_flare(vertex *sun_vex, int sun_n)