Compare commits

..
Author SHA1 Message Date
Goober5000 1009fbd144 apply taylor's XT branch diff 2008-10-11 20:57:42 +00:00
Goober5000 7158aca5a0 made a copy 2008-10-11 20:52:41 +00:00
237 changed files with 12649 additions and 14657 deletions

No files matched your search

+12 -6
View File
@@ -306,10 +306,16 @@ FS2_SOURCES = \
graphics/gropengl.h \
graphics/gropenglbmpman.cpp \
graphics/gropenglbmpman.h \
graphics/gropengldraw.cpp \
graphics/gropengldraw.h \
graphics/gropenglextension.cpp \
graphics/gropenglextension.h \
graphics/gropengllight.cpp \
graphics/gropengllight.h \
graphics/gropenglshader.cpp \
graphics/gropenglshader.h \
graphics/gropenglstate.cpp \
graphics/gropenglstate.h \
graphics/gropengltexture.cpp \
graphics/gropengltexture.h \
graphics/gropengltnl.cpp \
@@ -318,6 +324,7 @@ FS2_SOURCES = \
graphics/grstub.h \
graphics/line.h \
graphics/tmapper.h \
graphics/textureset.cpp \
hud/hud.cpp \
hud/hud.h \
hud/hudartillery.cpp \
@@ -362,6 +369,9 @@ FS2_SOURCES = \
inetfile/chttpget.h \
inetfile/inetgetfile.cpp \
inetfile/inetgetfile.h \
io/joy.cpp \
io/joy.h \
io/joy_ff.h \
io/key.cpp \
io/key.h \
io/keycontrol.cpp \
@@ -675,10 +685,8 @@ FS2_SOURCES = \
## joystic support sources
if FS2_OS_WIN32
JOY_SOURCES = \
io/joy.cpp \
io/joy.h \
io/joy-win.cpp \
io/joy_ff.cpp \
io/joy_ff.h \
io/sw_error.hpp \
io/sw_force.h \
io/sw_guid.hpp \
@@ -687,9 +695,7 @@ endif
if FS2_OS_UNIX
JOY_SOURCES = \
io/joy.h \
io/joy_ff.h \
io/joy-unix.cpp
io/joy-sdl.cpp
endif
## sound support sources
-6
View File
@@ -310,12 +310,6 @@ void parse_ai_profiles_tbl(char *filename)
if (optional_string("$Player Weapon Recharge Scale:"))
parse_float_list(profile->weapon_energy_scale, NUM_SKILL_LEVELS);
if (optional_string("$Max Turret Target Ownage:"))
parse_int_list(profile->max_turret_ownage_target, NUM_SKILL_LEVELS);
if (optional_string("$Max Turret Player Ownage:"))
parse_int_list(profile->max_turret_ownage_player, NUM_SKILL_LEVELS);
set_flag(profile, "$big ships can attack beam turrets on untargeted ships:", AIPF_BIG_SHIPS_CAN_ATTACK_BEAM_TURRETS_ON_UNTARGETED_SHIPS);
set_flag(profile, "$smart primary weapon selection:", AIPF_SMART_PRIMARY_WEAPON_SELECTION);
-4
View File
@@ -115,10 +115,6 @@ typedef struct ai_profile_t {
float ship_fire_delay_scale_hostile[NUM_SKILL_LEVELS];
float ship_fire_delay_scale_friendly[NUM_SKILL_LEVELS];
// Maximum turrets of one ship allowed to shoot the same target
int max_turret_ownage_target[NUM_SKILL_LEVELS];
int max_turret_ownage_player[NUM_SKILL_LEVELS];
} ai_profile_t;
+484 -431
View File
File diff suppressed because it is too large. Load diff
+18 -39
View File
@@ -65,7 +65,7 @@
* --Goober5000
*
* Revision 1.31 2006/01/13 03:30:59 Goober5000
* übercommit of custom IFF stuff :)
* �bercommit of custom IFF stuff :)
*
* Revision 1.30 2006/01/11 21:15:15 wmcoolmon
* Somewhat better turret comments
@@ -632,11 +632,7 @@ void evaluate_obj_as_target(object *objp, eval_enemy_obj_struct *eeo)
dist *= (1.0f + 0.1f*num_att_turrets);
// return if we're over the cap
// int max_turrets = 3 + Game_skill_level * Game_skill_level;
int max_turrets = The_mission.ai_profile->max_turret_ownage_target[Game_skill_level];
if (objp->flags & OF_PLAYER_SHIP) {
max_turrets = The_mission.ai_profile->max_turret_ownage_player[Game_skill_level];
}
int max_turrets = 3 + Game_skill_level * Game_skill_level;
if (num_att_turrets > max_turrets) {
return;
}
@@ -1133,7 +1129,7 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en
return best_subsysp;
// Make sure big or huge ship *actually* has subsystems (ie, knossos)
if (esip->n_subsystems == 0) {
if ( esip->subsystems.empty() ) {
return best_subsysp;
}
@@ -1370,14 +1366,12 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
}
// now do anything else
else {
for (int i=0; i < wip->shots; i++)
{
for (int i = 0; i < wip->shots; i++) {
weapon_objnum = weapon_create( turret_pos, &turret_orient, turret_weapon_class, parent_objnum, -1, 1);
weapon_set_tracking_info(weapon_objnum, parent_objnum, turret->turret_enemy_objnum, 1, turret->targeted_subsys);
objp=&Objects[weapon_objnum];
wp=&Weapons[objp->instance];
objp = &Objects[weapon_objnum];
wp = &Weapons[objp->instance];
//nprintf(("AI", "Turret_time_enemy_in_range = %7.3f\n", ss->turret_time_enemy_in_range));
if (weapon_objnum != -1) {
@@ -1386,7 +1380,7 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
wp->turret_subsys = turret;
// if the gun is a flak gun
if(wip->wi_flags & WIF_FLAK){
if (wip->wi_flags & WIF_FLAK) {
// show a muzzle flash
flak_muzzle_flash(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, turret_weapon_class);
@@ -1405,6 +1399,10 @@ bool turret_fire_weapon(int weapon_num, ship_subsys *turret, int parent_objnum,
} else if(wip->muzzle_flash > -1) {
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, Weapon_info[turret_weapon_class].muzzle_flash);
}
// otherwise just do mflash if the weapon has it
else if (wip->muzzle_flash >= 0) {
mflash_create(turret_pos, turret_fvec, &Objects[parent_ship->objnum].phys_info, wip->muzzle_flash);
}
// in multiplayer (and the master), then send a turret fired packet.
if ( MULTIPLAYER_MASTER && (weapon_objnum != -1) ) {
@@ -1489,6 +1487,11 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
Weapons[Objects[weapon_objnum].instance].turret_subsys = tsi->turret;
Weapons[Objects[weapon_objnum].instance].target_num = tsi->turret->turret_enemy_objnum;
// muzzle flash?
if (Weapon_info[tsi->weapon_class].muzzle_flash >= 0) {
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
}
// maybe sound
if ( Weapon_info[tsi->weapon_class].launch_snd != -1 ) {
// Don't play turret firing sound if turret sits on player ship... it gets annoying.
@@ -1496,8 +1499,7 @@ void turret_swarm_fire_from_turret(turret_swarm_info *tsi)
snd_play_3d( &Snds[Weapon_info[tsi->weapon_class].launch_snd], &turret_pos, &View_position );
}
}
if(Weapon_info[tsi->weapon_class].muzzle_flash > -1)
mflash_create(&turret_pos, &turret_fvec, &Objects[tsi->parent_objnum].phys_info, Weapon_info[tsi->weapon_class].muzzle_flash);
// in multiplayer (and the master), then send a turret fired packet.
if ( MULTIPLAYER_MASTER && (weapon_objnum != -1) ) {
int subsys_index;
@@ -1584,7 +1586,7 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
// (NOTE: this will probably get changed by other parts of the code (swarming, beams, etc) to be
// a more accurate time, but we need to give it a long enough time for the other parts of the code
// to change the timestamp before it gets acted upon - taylor)
ss->turret_animation_done_time = timestamp(1000);
ss->turret_animation_done_time = timestamp(200);
} else {
return;
}
@@ -1640,10 +1642,6 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
int secnum = 0;
for(i = 0; i < (MAX_SHIP_WEAPONS); i++)
{
//WMC - Only fire more than once if we have multiple guns flag set.
if(num_valid > 0 && !(tp->flags & MSS_FLAG_USE_MULTIPLE_GUNS))
break;
if(i < MAX_SHIP_PRIMARY_BANKS)
{
if(i >= swp->num_primary_banks)
@@ -1911,25 +1909,6 @@ void ai_fire_from_turret(ship *shipp, ship_subsys *ss, int parent_objnum)
}
}
if ( ok_to_fire && (tp->flags & MSS_FLAG_TURRET_HULL_CHECK) ) {
int model_num = Ship_info[shipp->ship_info_index].model_num;
mc_info hull_check;
vec3d end;
vm_vec_scale_add(&end, &gpos, &gvec, model_get_radius(model_num));
hull_check.model_num = model_num;
hull_check.orient = &objp->orient;
hull_check.pos = &objp->pos;
hull_check.p0 = &gpos;
hull_check.p1 = &end;
hull_check.flags = MC_CHECK_MODEL | MC_CHECK_RAY;
if ( model_collide(&hull_check) ) {
ok_to_fire = false;
}
}
if ( ok_to_fire )
{
something_was_ok_to_fire = true;
+1 -1
View File
@@ -106,7 +106,7 @@
* Cleaned up some more texture stuff enabled console debug for D3D.
*
* Revision 2.1.2.2 2002/09/28 22:13:42 randomtiger
* Sorted out some bits and pieces. The background nebula blends now which is nice. – RT
* Sorted out some bits and pieces. The background nebula blends now which is nice. � RT
*
* Revision 2.1.2.1 2002/09/24 18:56:40 randomtiger
* DX8 branch commit
+1 -1
View File
@@ -942,7 +942,7 @@ int unpack_pixel_count(anim_instance *ai, ubyte *data, ubyte pix, int count = 0,
anim *a = ai->parent;
int pixel_size = (bpp / 8);
ubyte r, g, b;
Assert(a);
Assert(a);
// if this is an aabitmap, don't run through the palette
if(aabitmap){
+10 -11
View File
@@ -65,7 +65,7 @@
* --Goober5000
*
* Revision 2.33 2006/01/13 03:30:59 Goober5000
* übercommit of custom IFF stuff :)
* übercommit of custom IFF stuff :)
*
* Revision 2.32 2005/11/21 02:43:30 Goober5000
* change from "setting" to "profile"; this way makes more sense
@@ -1244,32 +1244,31 @@ void asteroid_maybe_reposition(object *objp, asteroid_field *asfieldp)
// only wrap if player won't see asteroid disappear/reverse direction
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
if ((dot < 0.7f) || (dist > 3000.0f)) {
if ( (dot < 0.7f) || (dist > asfieldp->bound_rad) ) {
if (Num_asteroids > MAX_ASTEROIDS-10) {
objp->flags |= OF_SHOULD_BE_DEAD;
} else {
// check to ensure player won't see asteroid appear either
asteroid_wrap_pos(objp, asfieldp);
Asteroids[objp->instance].target_objnum = -1;
vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
dist = vm_vec_normalized_dir(&vec_to_asteroid, &objp->pos, &Eye_position);
dot = vm_vec_dot(&Eye_matrix.vec.fvec, &vec_to_asteroid);
dist = vm_vec_dist_quick(&objp->pos, &Eye_position);
if (( dot > 0.7f) && (dist < 3000.0f)) {
if ( (dot > 0.7f) && (dist < (asfieldp->bound_rad * 1.3f)) ) {
// player would see asteroid pop out other side, so reverse velocity instead of wrapping
objp->pos = old_asteroid_pos;
vm_vec_copy_scale(&objp->phys_info.vel, &old_vel, -1.0f);
objp->phys_info.desired_vel = objp->phys_info.vel;
Asteroids[objp->instance].target_objnum = -1;
}
// update last pos (after vel is known)
vm_vec_scale_add(&objp->last_pos, &objp->pos, &objp->phys_info.vel, -flFrametime);
asteroid_update_collide(objp);
if ( MULTIPLAYER_MASTER )
send_asteroid_throw( objp );
}
@@ -2454,7 +2453,7 @@ void asteroid_page_in()
// Page in textures
for (j=0; j<asip->modelp[k]->n_textures; j++ ) {
int bitmap_num = asip->modelp[k]->maps[j].base_map.original_texture;
int bitmap_num = asip->modelp[k]->maps[j].base_map.texture;
if ( bitmap_num > -1 ) {
bm_page_in_texture( bitmap_num );
+1
View File
@@ -264,6 +264,7 @@ typedef enum {
typedef struct asteroid_field {
vec3d min_bound; // Minimum range of field.
vec3d max_bound; // Maximum range of field.
float bound_rad;
int has_inner_bound;
vec3d inner_min_bound;
vec3d inner_max_bound;
+2 -2
View File
@@ -99,8 +99,8 @@
#define BM_TYPE_CUBEMAP_DXT3 13 // 32-bit cubemap (compressed cubemap surface)
#define BM_TYPE_CUBEMAP_DXT5 14 // 32-bit cubemap (compressed cubemap surface)
// special types ( used in: bm_bitmaps[i].type )
#define BM_TYPE_RENDER_TARGET_STATIC 16 // 24/32 bit setup internally as a static render target
#define BM_TYPE_RENDER_TARGET_DYNAMIC 17 // 24/32 bit setup internally as a dynamic render target
#define BM_TYPE_RENDER_TARGET_STATIC 15 // 24/32 bit setup internally as a static render target
#define BM_TYPE_RENDER_TARGET_DYNAMIC 16 // 24/32 bit setup internally as a dynamic render target
/// Moved from cpp file ///////////////////
+55 -53
View File
@@ -957,7 +957,8 @@ extern int Cmdline_cache_bitmaps;
int GLOWMAP = -1;
int SPECMAP = -1;
int ENVMAP = -1;
int BUMPMAP = -1;
int NORMMAP = -1;
int HEIGHTMAP = -1;
bitmap_entry bm_bitmaps[MAX_BITMAPS];
@@ -1950,7 +1951,7 @@ uint bm_get_signature( int handle )
}
extern int palman_is_nondarkening(int r,int g, int b);
static void bm_convert_format( int bitmapnum, bitmap *bmp, ubyte bpp, ubyte flags )
static void bm_convert_format( bitmap *bmp, ubyte flags )
{
int idx;
@@ -1981,35 +1982,6 @@ static void bm_convert_format( int bitmapnum, bitmap *bmp, ubyte bpp, ubyte flag
}
}
// basically, map the bitmap into the current palette. used to be done for all pcx's, now just for
// Fred, since its the only thing that uses the software tmapper
void bm_swizzle_8bit_for_fred(bitmap_entry *be, bitmap *bmp, ubyte *data, ubyte *palette)
{
/* 2004/10/17 - taylor - no longer needed since FRED is OGL now
int pcx_xparent_index = -1;
int i;
int r, g, b;
ubyte palxlat[256];
for (i=0; i<256; i++ ) {
r = palette[i*3];
g = palette[i*3+1];
b = palette[i*3+2];
if ( g == 255 && r == 0 && b == 0 ) {
palxlat[i] = 255;
pcx_xparent_index = i;
} else {
palxlat[i] = (ubyte)(palette_find( r, g, b ));
}
}
for (i=0; i<bmp->w * bmp->h; i++ ) {
ubyte c = palxlat[data[i]];
data[i] = c;
}
be->palette_checksum = gr_palette_checksum;
*/
}
void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
{
ubyte *data;
@@ -2051,7 +2023,7 @@ void bm_lock_pcx( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
bmp->flags = 0;
bm_convert_format( bitmapnum, bmp, bpp, flags );
bm_convert_format( bmp, flags );
}
void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
@@ -2167,7 +2139,7 @@ void bm_lock_ani( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
memcpy(dptr, sptr, size);
}
bm_convert_format( first_frame+i, bm, bpp, flags );
bm_convert_format( bm, flags );
// Skip a frame
if ( (i < nframes-1) && can_drop_frames ) {
@@ -2241,7 +2213,7 @@ void bm_lock_user( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, uby
// Error( LOCATION, "Unhandled user bitmap conversion from %d to %d bpp", be->info.user.bpp, bmp->bpp );
}
bm_convert_format( bitmapnum, bmp, bpp, flags );
bm_convert_format( bmp, flags );
}
void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
@@ -2303,7 +2275,7 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
bmp->flags = 0;
bm_convert_format( bitmapnum, bmp, bpp, flags );
bm_convert_format( bmp, flags );
}
//lock a dds file
@@ -2451,7 +2423,7 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
if (flags & BMP_AABITMAP) {
Assert( bpp == 8 );
} else if ((flags & BMP_TEX_NONCOMP) && (!(flags & BMP_TEX_COMP))) {
Assert( bpp >= 16 ); // cheating but bpp passed isn't what we normally end up with
// Assert( bpp >= 16 ); // cheating but bpp passed isn't what we normally end up with
} else if ((flags & BMP_TEX_DXT1) || (flags & BMP_TEX_DXT3) || (flags & BMP_TEX_DXT5)){
Assert( bpp >= 16 ); // cheating but bpp passed isn't what we normally end up with
} else if (flags & BMP_TEX_CUBEMAP) {
@@ -2606,7 +2578,7 @@ int bm_release(int handle, int clear_render_targets)
Assert( be->handle == handle ); // INVALID BITMAP HANDLE
if ( !clear_render_targets && (be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC) ) {
if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
nprintf(("BmpMan", "Tried to release a render target!\n"));
return 0;
}
@@ -2771,10 +2743,6 @@ int bm_unload_fast( int handle, int clear_render_targets )
be = &bm_bitmaps[n];
bmp = &be->bm;
if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
return -1;
}
if ( be->type == BM_TYPE_NONE ) {
return -1; // Already been released
}
@@ -2783,6 +2751,10 @@ int bm_unload_fast( int handle, int clear_render_targets )
return -1;
}
if ( !clear_render_targets && ((be->type == BM_TYPE_RENDER_TARGET_STATIC) || (be->type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
return -1;
}
// If it is locked, cannot free it.
if (be->ref_count != 0) {
nprintf(("BmpMan", "Tried to unload_fast %s that has a lock count of %d.. not unloading\n", be->filename, be->ref_count));
@@ -3033,9 +3005,6 @@ void bm_page_in_stop()
if ( !gr_preload(bm_bitmaps[i].handle, (bm_bitmaps[i].preloaded==2)) ) {
mprintf(( "Out of VRAM. Done preloading.\n" ));
bm_preloading = 0;
} else {
// it's loaded into API memory now so dump the system version of the data
bm_free_data_fast(i);
}
} else {
bm_lock( bm_bitmaps[i].handle, (bm_bitmaps[i].used_flags == BMP_AABITMAP) ? 8 : 16, bm_bitmaps[i].used_flags );
@@ -3123,6 +3092,7 @@ int bm_get_cache_slot( int bitmap_id, int separate_ani_frames )
{
int n = bitmap_id % MAX_BITMAPS;
Assert( n >= 0 );
Assert( bm_bitmaps[n].handle == bitmap_id ); // INVALID BITMAP HANDLE
bitmap_entry *be = &bm_bitmaps[n];
@@ -3276,6 +3246,8 @@ void bm_get_filename(int bitmapnum, char *filename)
{
int n = bitmapnum % MAX_BITMAPS;
Assert( n >= 0 );
// return filename
strcpy(filename, bm_bitmaps[n].filename);
}
@@ -3286,16 +3258,19 @@ int bm_is_compressed(int num)
int n = num % MAX_BITMAPS;
ubyte type = BM_TYPE_NONE;
//duh
if (!Use_compressed_textures)
// duh
if ( !Use_compressed_textures ) {
return 0;
}
Assert(num == bm_bitmaps[n].handle);
Assert( n >= 0 );
Assert( num == bm_bitmaps[n].handle );
type = bm_bitmaps[n].comp_type;
switch (type) {
case BM_TYPE_NONE:
case BM_TYPE_DDS:
return 0;
case BM_TYPE_DXT1:
@@ -3324,7 +3299,7 @@ int bm_has_alpha_channel(int handle)
{
int n = handle % MAX_BITMAPS;
Assert( (n >= 0) && (n < MAX_BITMAPS) );
Assert( n >= 0 );
Assert( handle == bm_bitmaps[n].handle );
// assume that PCX never has a real alpha channel (it may be 32-bit, but without any alpha)
@@ -3339,11 +3314,24 @@ int bm_has_alpha_channel(int handle)
// for is TCACHE_TYPE_SECTIONED - taylor
int bm_get_tcache_type(int num)
{
if ( bm_is_compressed(num) )
if ( bm_is_compressed(num) ) {
return TCACHE_TYPE_COMPRESSED;
}
// if ( bm_is_render_target(num) )
// if ( bm_is_render_target(num) ) {
// return TCACHE_TYPE_RENDER_TARGET;
// }
int n = num % MAX_BITMAPS;
Assert( n >= 0 );
Assert( num == bm_bitmaps[n].handle );
/* switch ( bm_bitmaps[n].comp_type ) {
default:
break;
}*/
return TCACHE_TYPE_NORMAL;
}
@@ -3352,6 +3340,7 @@ int bm_get_size(int num)
{
int n = num % MAX_BITMAPS;
Assert( n >= 0 );
Assert(num == bm_bitmaps[n].handle);
return bm_bitmaps[n].mem_taken;
@@ -3361,10 +3350,12 @@ int bm_get_num_mipmaps(int num)
{
int n = num % MAX_BITMAPS;
Assert( n >= 0 );
Assert( num == bm_bitmaps[n].handle );
if (bm_bitmaps[n].num_mipmaps == 0)
if (bm_bitmaps[n].num_mipmaps == 0) {
return 1;
}
return bm_bitmaps[n].num_mipmaps;
}
@@ -3382,6 +3373,7 @@ int bm_convert_color_index_to_BGR(int num, ubyte **out_data)
Assert( out_data != NULL );
Assert( n >= 0 );
Assert( num == bm_bitmaps[n].handle );
if ( num != bm_bitmaps[n].handle )
@@ -3560,9 +3552,14 @@ int bm_is_render_target(int bitmap_id)
{
int n = bitmap_id % MAX_BITMAPS;
Assert(bitmap_id == bm_bitmaps[n].handle);
Assert( n >= 0 );
Assert( bitmap_id == bm_bitmaps[n].handle );
return ( (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC) );
if ( !((bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC) || (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_DYNAMIC)) ) {
return 0;
}
return bm_bitmaps[n].type;
}
int bm_set_render_target(int handle, int face)
@@ -3599,6 +3596,11 @@ int bm_set_render_target(int handle, int face)
gr_reset_clip();
if (gr_screen.mode == GR_OPENGL) {
extern void opengl_setup_viewport();
opengl_setup_viewport();
}
return 1;
}
+5 -4
View File
@@ -691,10 +691,11 @@ void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *r, ubyte *g, ubyte *
// get the rgba components of a pixel, any of the parameters can be NULL
void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of its index -Bobboau
extern int SPECMAP; //this holds a reference to a map that is for specular mapping -Bobboau
extern int ENVMAP; //this holds a reference to a map that is for environment mapping -Bobboau
extern int BUMPMAP; //blah blah bumpmapping
extern int GLOWMAP; // this holds a reference to a map that is a fully lit version of its index -Bobboau
extern int SPECMAP; // this holds a reference to a map that is for specular mapping -Bobboau
extern int ENVMAP; // this holds a reference to a map that is for environment mapping -Bobboau
extern int NORMMAP; // normal mapping
extern int HEIGHTMAP; // height map for normal mapping
int bm_is_compressed(int num);
int bm_get_tcache_type(int num);
+20 -24
View File
@@ -402,11 +402,19 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_t
th = h;
}
// gr_resize_screen_pos(&tw, &th);
//Center it?
if(center_x)
image_pos[0] = (gr_screen.max_w - tw)/2;
{
image_pos[0] = (gr_screen.max_w_unscaled - tw)/2;
gr_resize_screen_pos(&image_pos[0], NULL);
}
if(center_y)
image_pos[1] = (gr_screen.max_h - th)/2;
{
image_pos[1] = (gr_screen.max_h_unscaled - th)/2;
gr_resize_screen_pos(NULL, &image_pos[1]);
}
}
if(in_x_pos < 0 && !center_x)
image_pos[0] += gr_screen.max_w + in_x_pos;
@@ -418,30 +426,18 @@ subtitle::subtitle(int in_x_pos, int in_y_pos, char* in_text, float in_display_t
else if(!center_y)
image_pos[1] += in_y_pos;
text_pos[0] = image_pos[0];
if(image_id != -1)
{
text_pos[0] = image_pos[0] + w; //Still set from bm_get_info call
if (!center_x)
{
deltax = text_pos[0] / 1024.0f; //MikeStar;
text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
}
}
else
{
text_pos[0] = image_pos[0];
if (!center_x)
{
deltax = text_pos[0] / 1024.0f; //MikeStar;
text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
}
}
text_pos[0] += w; //Still set from bm_get_info call
// deltax = text_pos[0] / i2fl(gr_screen.max_w_unscaled); //MikeStar;
// text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
text_pos[1] = image_pos[1];
if (!center_y)
{
deltay = text_pos[1] / 768.0f; //MikeStar;
text_pos[1] = gr_screen.max_h * deltay; //MikeStar;
}
// deltay = text_pos[1] / i2fl(gr_screen.max_h_unscaled); //MikeStar;
// text_pos[1] = gr_screen.max_h * deltay; //MikeStar;
time_displayed = 0.0f;
time_displayed_end = 2.0f*fade_time + display_time;
+3 -2
View File
@@ -419,14 +419,14 @@ cf_pathtype Pathtypes[CF_MAX_PATH_TYPES] = {
{ CF_TYPE_MOVIES, "data" DIR_SEPARATOR_STR "movies", ".mve .msb .ogg", CF_TYPE_DATA },
{ CF_TYPE_INTERFACE, "data" DIR_SEPARATOR_STR "interface", ".pcx .ani .dds .tga .eff", CF_TYPE_DATA },
{ CF_TYPE_FONT, "data" DIR_SEPARATOR_STR "fonts", ".vf .ttf", CF_TYPE_DATA },
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds", CF_TYPE_DATA },
{ CF_TYPE_EFFECTS, "data" DIR_SEPARATOR_STR "effects", ".ani .eff .pcx .neb .tga .jpg .dds .sdr", CF_TYPE_DATA },
{ CF_TYPE_HUD, "data" DIR_SEPARATOR_STR "hud", ".ani .pcx .tga .dds", CF_TYPE_DATA },
{ CF_TYPE_PLAYERS, "data" DIR_SEPARATOR_STR "players", ".hcf", CF_TYPE_DATA },
{ CF_TYPE_PLAYER_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "images", ".pcx .dds", CF_TYPE_PLAYERS },
{ CF_TYPE_SQUAD_IMAGES, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "squads", ".pcx .dds", CF_TYPE_PLAYERS },
{ CF_TYPE_SINGLE_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "single", ".pl2 .cs2 .plr .csg .css", CF_TYPE_PLAYERS },
{ CF_TYPE_MULTI_PLAYERS, "data" DIR_SEPARATOR_STR "players" DIR_SEPARATOR_STR "multi", ".plr", CF_TYPE_PLAYERS },
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_CACHE, "data" DIR_SEPARATOR_STR "cache", ".clr .tmp .ibx .tsb", CF_TYPE_DATA }, //clr=cached color
{ CF_TYPE_MULTI_CACHE, "data" DIR_SEPARATOR_STR "multidata", ".pcx .dds .fs2 .txt", CF_TYPE_DATA },
{ CF_TYPE_MISSIONS, "data" DIR_SEPARATOR_STR "missions", ".fs2 .fc2 .ntl .ssv", CF_TYPE_DATA },
{ CF_TYPE_CONFIG, "data" DIR_SEPARATOR_STR "config", ".cfg", CF_TYPE_DATA },
@@ -2022,6 +2022,7 @@ int cf_chksum_pack(char *filename, uint *chk_long, bool full)
return 1;
}
// get the 2 byte checksum of the passed filename - return 0 if operation failed, 1 if succeeded
int cf_chksum_short(char *filename, ushort *chksum, int max_size, int cf_type)
{
+1 -1
View File
@@ -321,7 +321,7 @@ int cfread_lua_number(double *buf, CFILE *cfile)
Assert( !cb->data );
Assert(cb->fp != NULL);
long orig_pos = ftell(cb->fp);
int orig_pos = ftell(cb->fp);
int items_read = fscanf(cb->fp, LUA_NUMBER_SCAN, buf);
cb->raw_position += ftell(cb->fp)-orig_pos;
+1 -7
View File
@@ -1660,10 +1660,8 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
if (find_handle != -1) {
do {
if (num_files >= max)
break;
if ( strlen(find.name) >= MAX_FILENAME_LEN )
continue;
break;
if (!(find.attrib & _A_SUBDIR)) {
if ( !Get_file_list_filter || (*Get_file_list_filter)(find.name) ) {
@@ -1701,10 +1699,6 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
if (num_files >= max)
break;
if ( strlen(dir->d_name) >= MAX_FILENAME_LEN ) {
continue;
}
if (fnmatch(filter, dir->d_name, 0) != 0)
continue;
+4 -8
View File
@@ -162,8 +162,8 @@ void pack_file( char *filespec, char *filename, int filesize, _fs_time_t time_wr
}
if ( strlen(filename) > 31 ) {
printf( "Filename '%s' too long! Skipping...\n", filename );
return;
printf( "Filename '%s' too long\n", filename );
exit(1);
}
memset( path, 0, sizeof(path) );
@@ -255,7 +255,7 @@ void pack_directory( char * filespec)
find_handle = _findfirst( tmp1, &find );
if( find_handle != -1 ) {
if ( find.attrib & _A_SUBDIR ) {
if (strcmp( "..", find.name) && strcmp( ".", find.name) && strcmp( ".svn", find.name)) {
if (strcmp( "..", find.name) && strcmp( ".", find.name)) {
strcpy( tmp, filespec );
strcat( tmp, "\\" );
strcat( tmp, find.name );
@@ -267,7 +267,7 @@ void pack_directory( char * filespec)
while( !_findnext( find_handle, &find ) ) {
if ( find.attrib & _A_SUBDIR ) {
if (strcmp( "..", find.name) && strcmp( ".", find.name) && strcmp( ".svn", find.name)) {
if (strcmp( "..", find.name) && strcmp( ".", find.name)) {
strcpy( tmp, filespec );
strcat( tmp, "\\" );
strcat( tmp, find.name );
@@ -300,10 +300,6 @@ void pack_directory( char * filespec)
continue;
}
if ( (strcmp(dir->d_name, ".svn") == 0) ) {
continue;
}
if (S_ISDIR(buf.st_mode)) {
strcpy( tmp, filespec );
strcat( tmp, "/" );
+78 -88
View File
@@ -990,9 +990,9 @@ Flag exe_params[] =
{ "-env", "Enable environment maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-env", },
{ "-mipmap", "Enable mipmapping", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-mipmap", },
{ "-nomotiondebris", "Disable motion debris", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nomotiondebris",},
{ "-2d_poof", "Stops fog intersect hull", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-2d_poof", },
{ "-noscalevid", "Disable scale-to-window for movies", true, 0, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noscalevid", },
{ "-missile_lighting", "Apply Lighting to Missiles" , true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
{ "-missile_lighting", "Apply Lighting to Missiles", true, EASY_ALL_ON, EASY_DEFAULT, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-missile_lighting", },
{ "-normal", "Enable normal maps", true, EASY_MEM_ALL_ON, EASY_DEFAULT_MEM, "Graphics", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-normal" },
{ "-img2dds", "Compress non-compressed images", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-img2dds", },
{ "-no_vsync", "Disable vertical sync", true, 0, EASY_DEFAULT, "Game Speed", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-no_vsync", },
@@ -1035,8 +1035,8 @@ Flag exe_params[] =
{ "-noibx", "Don't use cached index buffers (IBX)", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-noibx", },
{ "-loadallweps", "Load all weapons, even those not used", true, 0, EASY_DEFAULT, "Troubleshoot", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-loadallweps", },
{ "-disable_fbo", "Disable OpenGL RenderTargets", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-no_glsl", "Disable GLSL (shader) support", true, 0, EASY_DEFAULT, "Troubleshoot", "", },
{ "-alpha_env", "Use specular alpha for env mapping", true, 0, EASY_DEFAULT_MEM, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-alpha_env", },
{ "-ingame_join", "Allows ingame joining", true, 0, EASY_DEFAULT, "Experimental", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-ingame_join", },
{ "-voicer", "Voice recognition", true, 0, EASY_DEFAULT, "Experimental", "", },
@@ -1057,6 +1057,7 @@ Flag exe_params[] =
{ "-output_scripting", "Outputs scripting to scripting.html", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-output_scripting", },
{ "-save_render_target", "Save render targets to file", true, 0, EASY_DEFAULT, "Dev Tool", "", },
{ "-debug_window", "Display debug window", true, 0, EASY_DEFAULT, "Dev Tool", "", },
{ "-verify_vps", "Spew VP crcs to vp_crcs.txt", true, 0, EASY_DEFAULT, "Dev Tool", "", },
#ifdef SCP_UNIX
{ "-nograb", "Don't grab mouse/keyboard in a window", true, 0, EASY_DEFAULT, "Dev Tool", "http://www.hard-light.net/wiki/index.php/Command-Line_Reference#-nograb", },
#endif
@@ -1118,36 +1119,36 @@ cmdline_parm ogl_spec_arg("-ogl_spec", NULL); // Cmdline_ogl_spec
cmdline_parm spec_static_arg("-spec_static", NULL);
cmdline_parm spec_point_arg("-spec_point", NULL);
cmdline_parm spec_tube_arg("-spec_tube", NULL);
cmdline_parm poof_2d_arg("-2d_poof", NULL); // Cmdline_2d_poof
cmdline_parm alpha_env("-alpha_env", NULL); // Cmdline_alpha_env
cmdline_parm ambient_factor_arg("-ambient_factor", NULL); // Cmdline_ambient_factor
cmdline_parm cell_arg("-cell", NULL); // Cmdline_cell
cmdline_parm decals("-decals", NULL); // Cmdline_decals
cmdline_parm env("-env", NULL); // Cmdline_env
cmdline_parm mipmap_arg("-mipmap", NULL); // Cmdline_mipmap
cmdline_parm missile_lighting_arg("-missile_lighting", NULL); // Cmdline_missile_lighting
cmdline_parm glow_arg("-glow", NULL); // Cmdline_noglow -- use Bobs glow code
cmdline_parm glow_arg("-glow", NULL); // Cmdline_glow -- use Bobs glow code
cmdline_parm nomotiondebris_arg("-nomotiondebris", NULL); // Cmdline_nomotiondebris -- Removes those ugly floating rocks -C
cmdline_parm noscalevid_arg("-noscalevid", NULL); // Cmdline_noscalevid -- disable video scaling that fits to window
cmdline_parm spec_arg("-spec", NULL); // Cmdline_nospec -- use specular highlighting -Sticks
cmdline_parm spec_arg("-spec", NULL); // Cmdline_spec -- use specular highlighting -Sticks
cmdline_parm noemissive_arg("-no_emissive_light", NULL); // Cmdline_no_emissive -- don't use emissive light in OGL
cmdline_parm normal_arg("-normal", NULL); // Cmdline_normal -- enable normal mapping
cmdline_parm height_arg("-height", NULL); // Cmdline_height -- enable support for parallax mapping
float Cmdline_clip_dist = Default_min_draw_distance;
float Cmdline_fov = 0.75f;
float Cmdline_ogl_spec = 80.0f;
int Cmdline_2d_poof = 0;
int Cmdline_alpha_env = 0;
int Cmdline_ambient_factor = 128;
int Cmdline_cell = 0;
int Cmdline_decals = 0;
int Cmdline_env = 0;
int Cmdline_mipmap = 0;
int Cmdline_missile_lighting = 0;
int Cmdline_noglow = 1;
int Cmdline_glow = 0;
int Cmdline_nomotiondebris = 0;
int Cmdline_noscalevid = 0;
int Cmdline_nospec = 1;
int Cmdline_spec = 0;
int Cmdline_no_emissive = 0;
int Cmdline_normal = 0;
int Cmdline_height = 0;
// Game Speed related
cmdline_parm cache_bitmaps_arg("-cache_bitmaps", NULL); // Cmdline_cache_bitmaps
@@ -1219,7 +1220,6 @@ int Cmdline_objupd = 3; // client object updates on LAN by default
// Troubleshooting
cmdline_parm d3d_lesstmem_arg("-d3d_bad_tsys", NULL); // Cmdline_d3d_lesstmem
//cmdline_parm fred2_htl_arg("-fredhtl", NULL); // Cmdline_FRED2_htl
cmdline_parm loadallweapons_arg("-loadallweps", NULL); // Cmdline_load_all_weapons
cmdline_parm htl_arg("-nohtl", NULL); // Cmdline_nohtl -- don't use HT&L
cmdline_parm noibx_arg("-noibx", NULL); // Cmdline_noibx
@@ -1228,10 +1228,9 @@ cmdline_parm no_set_gamma_arg("-no_set_gamma", NULL); // Cmdline_no_set_gamma
cmdline_parm no_vbo_arg("-novbo", NULL); // Cmdline_novbo
cmdline_parm safeloading_arg("-safeloading", NULL); // Cmdline_safeloading -- Uses old loading method -C
cmdline_parm no_fbo_arg("-disable_fbo", NULL); // Cmdline_no_fbo
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps
cmdline_parm noglsl_arg("-no_glsl", NULL); // Cmdline_noglsl -- disable GLSL support in OpenGL
int Cmdline_d3d_lesstmem = 0;
//int Cmdline_FRED2_htl = 0; // turn HTL on in fred - Kazan
int Cmdline_load_all_weapons = 0;
int Cmdline_nohtl = 0;
int Cmdline_noibx = 0;
@@ -1240,7 +1239,7 @@ int Cmdline_no_set_gamma = 0;
int Cmdline_novbo = 0; // turn off OGL VBO support, troubleshooting
int Cmdline_safeloading = 0;
int Cmdline_no_fbo = 0;
int Cmdline_verify_vps = 0;
int Cmdline_noglsl = 0;
// Developer/Testing related
cmdline_parm start_mission_arg("-start_mission", NULL); // Cmdline_start_mission
@@ -1257,15 +1256,17 @@ cmdline_parm save_render_targets_arg("-save_render_target", NULL); // Cmdline_sa
cmdline_parm debug_window_arg("-debug_window", NULL); // Cmdline_debug_window
cmdline_parm window_arg("-window", NULL); // Cmdline_window
cmdline_parm res_arg("-res", NULL); // Cmdline_lores
cmdline_parm verify_vps_arg("-verify_vps", NULL); // Cmdline_verify_vps -- spew VP crcs to vp_crcs.txt
#ifdef SCP_UNIX
cmdline_parm no_grab("-nograb", NULL); // Cmdline_no_grab
#endif
cmdline_parm dev_nofail("-dev_nofail", NULL); // Cmdline_dev_nofail
char *Cmdline_start_mission = NULL;
int Cmdline_dis_collisions = 0;
int Cmdline_dis_weapons = 0;
int Cmdline_noparseerrors = 0;
int Cmdline_nowarn = 0; // turn warnings off in FRED
int Cmdline_nowarn = 1; // turn warnings off in FRED
int Cmdline_show_mem_usage = 0;
int Cmdline_show_pos = 0;
int Cmdline_show_stats = 0;
@@ -1273,10 +1274,12 @@ int Cmdline_timerbar = 0;
int Cmdline_save_render_targets = 0;
int Cmdline_debug_window = 0;
int Cmdline_window = 0;
char *Cmdline_res = 0;
int Cmdline_verify_vps = 0;
char *Cmdline_res = NULL;
#ifdef SCP_UNIX
int Cmdline_no_grab = 0;
#endif
int Cmdline_dev_nofail = 0;
// Other
cmdline_parm get_flags_arg("-get_flags", NULL);
@@ -1284,7 +1287,6 @@ cmdline_parm output_sexp_arg("-output_sexps", NULL); //WMC - outputs all SEXPs t
cmdline_parm output_scripting_arg("-output_scripting", NULL); //WMC
#ifndef NDEBUG
// NOTE: this assumes that os_init() has already been called but isn't a fatal error if it hasn't
void cmdline_debug_print_cmdline()
@@ -1553,7 +1555,7 @@ void os_init_cmdline(char *cmdline)
// if the file exists, get a single line, and deal with it
if ( fp ) {
char buf[1024], *p;
char buf[1024], *p = NULL;
fgets(buf, 1024, fp);
@@ -1747,34 +1749,30 @@ char *cmdline_parm::str()
// external entry point into this modules
bool SetCmdlineParams()
// Sets externed variables used for communication cmdline information
{
if ( dev_nofail.found() ) {
Cmdline_dev_nofail = 1;
}
//getcwd(FreeSpace_Directory, 256); // set the directory to our fs2 root
if (no_fpscap.found())
{
if ( no_fpscap.found() ) {
Cmdline_NoFPSCap = 1;
}
if(loadallweapons_arg.found())
{
if ( loadallweapons_arg.found() ) {
Cmdline_load_all_weapons = 1;
}
if(poof_2d_arg.found())
{
Cmdline_2d_poof = 1;
}
if(voice_recognition_arg.found())
{
if ( voice_recognition_arg.found() ) {
Cmdline_voice_recognition = 1;
}
if (nowarn_arg.found())
{
if ( nowarn_arg.found() ) {
Cmdline_nowarn = 1;
}
/* karajorma - let's just use -nohtl instead
if (fred2_htl_arg.found())
{
@@ -1804,26 +1802,22 @@ bool SetCmdlineParams()
}
// is this a standalone server??
if (standalone_arg.found()) {
if ( standalone_arg.found() )
Is_standalone = 1;
}
// object update control
if(objupd_arg.found()){
if ( objupd_arg.found() ) {
Cmdline_objupd = objupd_arg.get_int();
if (Cmdline_objupd < 0)
{
Cmdline_objupd = 0;
}
if (Cmdline_objupd > 3)
{
Cmdline_objupd = 3;
}
}
if(mpnoreturn_arg.found()) {
if ( mpnoreturn_arg.found() )
Cmdline_mpnoreturn = 1;
}
// run with no sound
if ( nosound_arg.found() ) {
@@ -1991,13 +1985,11 @@ bool SetCmdlineParams()
}
if (fps_arg.found())
{
if ( fps_arg.found() ) {
Show_framerate = 1;
}
if(pos_arg.found())
{
if ( pos_arg.found() ) {
Cmdline_show_pos = 1;
}
@@ -2009,11 +2001,11 @@ bool SetCmdlineParams()
Cmdline_nomotiondebris = 1;
}
if( mipmap_arg.found() ) {
if ( mipmap_arg.found() ) {
Cmdline_mipmap = 1;
}
if( stats_arg.found() ) {
if ( stats_arg.found() ) {
Cmdline_show_stats = 1;
}
@@ -2021,7 +2013,7 @@ bool SetCmdlineParams()
Viewer_zoom = VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
}
if( clip_dist_arg.found() ) {
if ( clip_dist_arg.found() ) {
Min_draw_distance = Cmdline_clip_dist = clip_dist_arg.get_float();
}
@@ -2069,49 +2061,59 @@ bool SetCmdlineParams()
}
if ( spec_arg.found() )
{
Cmdline_nospec = 0;
}
Cmdline_spec = 1;
if ( htl_arg.found() )
{
Cmdline_nohtl = 1;
}
if( no_set_gamma_arg.found() )
{
if ( no_set_gamma_arg.found() )
Cmdline_no_set_gamma = 1;
}
if(no_vsync_arg.found() )
{
if ( no_vsync_arg.found() )
Cmdline_no_vsync = 1;
}
#ifdef SCP_UNIX
// no key/mouse grab
if(no_grab.found()){
if ( no_grab.found() )
Cmdline_no_grab = 1;
}
#endif
if ( img2dds_arg.found() )
if ( img2dds_arg.found() ) {
Cmdline_img2dds = 1;
}
if ( glow_arg.found() )
Cmdline_noglow = 0;
if ( glow_arg.found() ) {
Cmdline_glow = 1;
}
if ( query_speech_arg.found() )
if ( query_speech_arg.found() ) {
Cmdline_query_speech = 1;
}
if ( ship_choice_3d_arg.found() )
if ( ship_choice_3d_arg.found() ) {
Cmdline_ship_choice_3d = 1;
}
if ( show_mem_usage_arg.found() )
if ( show_mem_usage_arg.found() ) {
Cmdline_show_mem_usage = 1;
}
if (ingamejoin_arg.found() )
if (ingamejoin_arg.found() ) {
Cmdline_ingamejoin = 1;
}
if ( normal_arg.found() ) {
Cmdline_normal = 1;
// height maps are only used if normal maps are
if ( height_arg.found() ) {
Cmdline_height = 1;
}
}
if ( noglsl_arg.found() ) {
Cmdline_noglsl = 1;
}
if ( start_mission_arg.found() ) {
Cmdline_start_mission = start_mission_arg.str();
@@ -2256,28 +2258,19 @@ bool SetCmdlineParams()
return false;
}
Cmdline_d3d_lesstmem = !d3d_lesstmem_arg.found();
if ( d3d_lesstmem_arg.found() )
Cmdline_d3d_lesstmem = 1;
if ( no_vbo_arg.found() )
{
Cmdline_novbo = 1;
}
if ( snd_preload_arg.found() )
{
Cmdline_snd_preload = 1;
}
if ( alpha_env.found() ) {
Cmdline_alpha_env = 1;
}
if ( env.found() ) {
if ( env.found() )
Cmdline_env = 1;
}
if ( decals.found() ) {
#ifdef WIN32
MessageBox(NULL, "Decals have been disabled in builds after May 4, 2006. Please remove the \"-decals\" command line from the launcher to prevent this message from appearing the the future.", "", MB_OK | MB_ICONINFORMATION);
#endif
@@ -2299,20 +2292,17 @@ bool SetCmdlineParams()
if(dis_collisions.found())
Cmdline_dis_collisions = 1;
if(dis_weapons.found())
if ( dis_weapons.found() )
Cmdline_dis_weapons = 1;
if ( noibx_arg.found() ) {
if ( noibx_arg.found() )
Cmdline_noibx = 1;
}
if ( no_fbo_arg.found() ) {
if ( no_fbo_arg.found() )
Cmdline_no_fbo = 1;
}
if ( noemissive_arg.found() ) {
if ( noemissive_arg.found() )
Cmdline_no_emissive = 1;
}
if ( ogl_spec_arg.found() ) {
Cmdline_ogl_spec = ogl_spec_arg.get_float();
+7 -6
View File
@@ -650,18 +650,19 @@ extern float Cmdline_ogl_spec;
extern float static_light_factor;
extern float static_point_factor;
extern float static_tube_factor;
extern int Cmdline_2d_poof;
extern int Cmdline_alpha_env;
extern int Cmdline_ambient_factor;
extern int Cmdline_cell;
extern int Cmdline_decals;
extern int Cmdline_env;
extern int Cmdline_mipmap;
extern int Cmdline_missile_lighting;
extern int Cmdline_noglow;
extern int Cmdline_glow;
extern int Cmdline_nomotiondebris;
extern int Cmdline_noscalevid; // disables fit-to-window for movies - taylor
extern int Cmdline_nospec;
extern int Cmdline_spec;
extern int Cmdline_normal;
extern int Cmdline_glsl;
extern int Cmdline_height;
// Game Speed related
extern int Cmdline_cache_bitmaps;
@@ -702,7 +703,6 @@ extern int Cmdline_objupd;
// Troubleshooting
extern int Cmdline_d3d_lesstmem;
extern int Cmdline_FRED2_htl;
extern int Cmdline_load_all_weapons;
extern int Cmdline_nohtl;
extern int Cmdline_noibx;
@@ -711,7 +711,7 @@ extern int Cmdline_no_set_gamma;
extern int Cmdline_novbo;
extern int Cmdline_safeloading;
extern int Cmdline_no_fbo;
extern int Cmdline_verify_vps;
extern int Cmdline_noglsl;
// Developer/Testing related
extern char *Cmdline_start_mission;
@@ -725,6 +725,7 @@ extern int Cmdline_show_stats;
extern int Cmdline_timerbar;
extern int Cmdline_save_render_targets;
extern int Cmdline_debug_window;
extern int Cmdline_verify_vps;
#ifdef SCP_UNIX
extern int Cmdline_no_grab;
#endif
+2
View File
@@ -354,6 +354,8 @@ typedef struct config_item {
short key_id; // actual key bound to action
short joy_id; // joystick button bound to action
int used; // has control been used yet in mission? If so, this is the timestamp
// config_item() : key_default(-1), joy_default(-1), tab(-1), hasXSTR(false), text(""), type(CC_TYPE_TRIGGER), key_id(-1), joy_id(-1), used(-1) {}
} config_item;
// --------------------------------------------------
+1 -1
View File
@@ -703,7 +703,7 @@ char *Joy_button_text_french[] = {
"Bouton 13", "Bouton 14", "Bouton 15", "Bouton 16", "Bouton 17", "Bouton 18",
"Bouton 19", "Bouton 20", "Bouton 21", "Bouton 22", "Bouton 23", "Bouton 24",
"Bouton 25", "Bouton 26", "Bouton 27", "Bouton 28", "Bouton 29", "Bouton 30",
"Bouton 31", "Bouton 32", "Chapeau Arrière", "Chapeau Avant", "Chapeau Gauche", "Chapeau Droite"
"Bouton 31", "Bouton 32", "Chapeau Arri�re", "Chapeau Avant", "Chapeau Gauche", "Chapeau Droite"
};
// This is the text that is displayed on the screen for the keys a player selects
-1
View File
@@ -560,7 +560,6 @@ void cutscenes_screen_play()
// full_name = cf_add_ext(name, NOX(".mve"));
main_hall_stop_music();
main_hall_stop_ambient();
int rval = movie_play(name);
main_hall_start_music();
+6 -1
View File
@@ -117,6 +117,7 @@
#include "cutscene/cutscenes.h" // cutscene_mark_viewable()
#include "cutscene/mvelib.h"
#include "cutscene/oggplayer.h"
#include "menuui/mainhallmenu.h"
extern int Game_mode;
@@ -195,6 +196,9 @@ bool movie_play(char *name)
return false;
}
// kill all background sounds
main_hall_pause();
// clear the screen and hide the mouse cursor
Mouse_hidden++;
gr_reset_clip();
@@ -247,8 +251,9 @@ bool movie_play(char *name)
}
}
// show the mouse cursor again
// show the mouse cursor again, and unpause the mainhall music
Mouse_hidden--;
main_hall_unpause();
return true;
}
+18 -24
View File
@@ -42,6 +42,7 @@
#include "graphics/gropengl.h"
#include "graphics/gropengltexture.h"
#include "graphics/gropenglextension.h"
#include "graphics/gropenglstate.h"
#include "globalincs/pstypes.h"
#include "cutscene/mvelib.h"
@@ -529,7 +530,7 @@ int mve_video_createbuf(ubyte minor, ubyte *data)
gl_screenYH = g_screenY + g_height;
gl_screenXW = g_screenX + g_width;
if (GL_texture_target == GL_TEXTURE_RECTANGLE_ARB) {
if (GL_state.Texture.GetTarget() == GL_TEXTURE_RECTANGLE_ARB) {
gl_screenU = (GLfloat)g_width;
gl_screenV = (GLfloat)g_height;
} else {
@@ -620,9 +621,7 @@ void mve_video_display()
}
if (gr_screen.mode == GR_OPENGL) {
glBindTexture(GL_texture_target, GLtex);
glTexSubImage2D(GL_texture_target, 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_width, g_height, GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV, pixelbuf);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
@@ -709,25 +708,22 @@ int mve_video_init(ubyte *data)
return 0;
}
// disable everything but what we need
opengl_switch_arb(-1, 0);
opengl_switch_arb(0, 1);
gr_set_lighting(false, false);
glBindTexture(GL_texture_target, GLtex);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_ALWAYS);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GL_state.Texture.DisableAll();
GL_state.Texture.SetActiveUnit(0);
GL_state.Texture.SetTarget(GL_texture_target);
GL_state.Texture.Enable(GLtex);
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_texture_target, 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB5_A1, wp2, hp2, 0, GL_BGRA_EXT, GL_UNSIGNED_SHORT_1_5_5_5_REV, NULL);
// set our color so that we can make sure that it's correct
glColor3f(1.0f, 1.0f, 1.0f);
@@ -836,12 +832,10 @@ void mve_shutdown()
glPopMatrix();
}
glBindTexture(GL_texture_target, 0);
GL_state.Texture.Disable();
GL_state.Texture.Delete(GLtex);
glDeleteTextures(1, &GLtex);
GLtex = 0;
opengl_switch_arb(-1, 0);
opengl_set_texture_target();
}
if (pixelbuf != NULL) {
+38 -45
View File
@@ -41,6 +41,8 @@
#include "graphics/gropengl.h"
#include "graphics/gropengltexture.h"
#include "graphics/gropenglextension.h"
#include "graphics/gropenglshader.h"
#include "graphics/gropenglstate.h"
#include "graphics/2d.h"
#include "io/key.h"
#include "osapi/osapi.h"
@@ -360,16 +362,6 @@ static void OGG_video_init(theora_info *tinfo)
g_screenHeight = tinfo->frame_height;
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
if (pixelbuf == NULL) {
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
video_inited = 1;
return;
}
memset( pixelbuf, 0, g_screenWidth * g_screenHeight * 3 );
if (gr_screen.mode == GR_OPENGL) {
// set the appropriate texture target
if ( Is_Extension_Enabled(OGL_ARB_TEXTURE_RECTANGLE) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_NON_POWER_OF_TWO) )
@@ -387,22 +379,22 @@ static void OGG_video_init(theora_info *tinfo)
return;
}
// disable everything but what we need
opengl_switch_arb(-1, 0);
opengl_switch_arb(0, 1);
gr_set_lighting(false, false);
glBindTexture(GL_texture_target, GLtex);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_ALWAYS);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
glTexParameteri(GL_texture_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GL_state.Texture.DisableAll();
GL_state.Texture.SetActiveUnit(0);
GL_state.Texture.SetTarget(GL_texture_target);
GL_state.Texture.Enable(GLtex);
GL_state.SetTextureSource(TEXTURE_SOURCE_DECAL);
GL_state.SetAlphaBlendMode(ALPHA_BLEND_NONE);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
GL_state.Texture.SetWrapS(GL_CLAMP_TO_EDGE);
GL_state.Texture.SetWrapT(GL_CLAMP_TO_EDGE);
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_state.Texture.GetTarget(), 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
float screen_ratio = (float)gr_screen.max_w / (float)gr_screen.max_h;
float movie_ratio = (float)g_screenWidth / (float)g_screenHeight;
@@ -422,17 +414,19 @@ static void OGG_video_init(theora_info *tinfo)
scale_video = 1;
}
// NOTE: using NULL instead of pixelbuf crashes some drivers, but then so does pixelbuf
glTexImage2D(GL_texture_target, 0, GL_RGB8, wp2, hp2, 0, GL_BGR, GL_UNSIGNED_BYTE, NULL);
// set our color so that we can make sure that it's correct
glColor3f(1.0f, 1.0f, 1.0f);
}
#ifndef NO_DIRECT3D
else if (gr_screen.mode == GR_DIRECT3D) {
// TODO: is there a fast way to do frames in D3D too?
pixelbuf = (ubyte *) vm_malloc_q(g_screenWidth * g_screenHeight * 3);
if (pixelbuf == NULL) {
nprintf(("MOVIE", "ERROR: Can't allocate memory for pixelbuf"));
video_inited = 1;
return;
}
#endif
memset( pixelbuf, 0, g_screenWidth * g_screenHeight * 3 );
if (scale_video) {
g_screenX = ((fl2i(gr_screen.max_w / scale_by + 0.5f) - g_screenWidth) / 2);
@@ -448,7 +442,7 @@ static void OGG_video_init(theora_info *tinfo)
gl_screenYH = g_screenY + g_screenHeight;
gl_screenXW = g_screenX + g_screenWidth;
if (GL_texture_target == GL_TEXTURE_RECTANGLE_ARB) {
if (GL_state.Texture.GetTarget() == GL_TEXTURE_RECTANGLE_ARB) {
gl_screenU = (GLfloat)wp2;
gl_screenV = (GLfloat)hp2;
} else {
@@ -462,8 +456,9 @@ static void OGG_video_init(theora_info *tinfo)
static void OGG_video_close()
{
if (!video_inited)
if ( !video_inited ) {
return;
}
if (gr_screen.mode == GR_OPENGL) {
if (scale_video) {
@@ -471,15 +466,13 @@ static void OGG_video_close()
glPopMatrix();
}
opengl_switch_arb(-1, 0);
glBindTexture(GL_texture_target, 0);
GL_state.Texture.Disable();
GL_state.Texture.Delete(GLtex);
glDeleteTextures(1, &GLtex);
GLtex = 0;
opengl_set_texture_target();
glEnable(GL_DEPTH_TEST);
GLtex = 0;
}
if (pixelbuf != NULL) {
@@ -578,9 +571,7 @@ static void OGG_video_draw(theora_state *tstate)
convert_YUV_to_RGB(&yuv);
if (gr_screen.mode == GR_OPENGL) {
glBindTexture(GL_texture_target, GLtex);
glTexSubImage2D(GL_texture_target, 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
glTexSubImage2D(GL_state.Texture.GetTarget(), 0, 0, 0, g_screenWidth, g_screenHeight, GL_BGR, GL_UNSIGNED_BYTE, pixelbuf);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
@@ -595,8 +586,6 @@ static void OGG_video_draw(theora_state *tstate)
glTexCoord2f(gl_screenU, 0);
glVertex2i(gl_screenXW, g_screenY);
glEnd();
} else {
// TODO: FIXME!!!
}
gr_flip();
@@ -801,7 +790,7 @@ THEORAFILE *theora_open(char *filename)
if ( ogg_sync_pageout(&movie->osyncstate, &movie->opage) > 0 ) {
OGG_queue_page(movie); // demux into the appropriate stream
} else {
int ret = OGG_buffer_data(movie); // someone needs more data
ret = OGG_buffer_data(movie); // someone needs more data
if ( ret == 0 ) {
mprintf(("Theora ERROR: End of file while searching for codec headers in '%s'!\n", lower_name));
@@ -851,6 +840,10 @@ void theora_play(THEORAFILE *movie)
if ( (movie == NULL) || !movie->theora_p )
return;
// only OGL is supported
if (gr_screen.mode != GR_OPENGL)
return;
// open audio
if (movie->vorbis_p)
OGG_audio_init(&movie->vinfo);
+27 -14
View File
@@ -47,7 +47,7 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
// make sure there is an extension
strcpy(real_name, filename);
char *p = strchr(real_name, '.');
if (p) { *p=0; }
if (p) { *p = 0; }
strcat(real_name, ".dds");
// try to open the file
@@ -79,8 +79,9 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
dds_header.dwMipMapCount = cfread_uint(ddsfile);
// skip over the crap we don't care about
for (i = 0; i < 11; i++)
for (i = 0; i < 11; i++) {
trash = cfread_uint(ddsfile);
}
dds_header.ddpfPixelFormat.dwSize = cfread_uint(ddsfile);
dds_header.ddpfPixelFormat.dwFlags = cfread_uint(ddsfile);
@@ -95,11 +96,13 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
dds_header.ddsCaps.dwCaps2 = cfread_uint(ddsfile);
// sanity
if (dds_header.dwDepth == 0)
if (dds_header.dwDepth == 0) {
dds_header.dwDepth = 1;
}
if (dds_header.dwMipMapCount < 1)
if (dds_header.dwMipMapCount < 1) {
dds_header.dwMipMapCount = 1;
}
d_width = dds_header.dwWidth;
d_height = dds_header.dwHeight;
@@ -122,11 +125,13 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
d_width /= 2;
d_height /= 2;
if (d_width <= 0)
if (d_width <= 0) {
d_width = 1;
}
if (d_height <= 0)
if (d_height <= 0) {
d_height = 1;
}
// size of data block (4x4)
d_size += ((d_width + 3) / 4) * ((d_height + 3) / 4) * ((dds_header.ddpfPixelFormat.dwFourCC == FOURCC_DXT1) ? 8 : 16);
@@ -189,14 +194,17 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
d_height /= 2;
d_depth /= 2;
if (d_width < 1)
if (d_width < 1) {
d_width = 1;
}
if (d_height < 1)
if (d_height < 1) {
d_height = 1;
}
if (d_depth < 1)
if (d_depth < 1) {
d_depth = 1;
}
d_size += d_width * d_height * d_depth * (dds_header.ddpfPixelFormat.dwRGBBitCount / 8);
}
@@ -240,20 +248,25 @@ int dds_read_header(char *filename, CFILE *img_cfp, int *width, int *height, int
}
// stuff important info
if (bpp)
if (bpp) {
*bpp = bits;
}
if (compression_type)
if (compression_type) {
*compression_type = ct;
}
if (width)
if (width) {
*width = dds_header.dwWidth;
}
if (height)
if (height) {
*height = dds_header.dwHeight;
}
if (levels)
if (levels) {
*levels = dds_header.dwMipMapCount;
}
if (palette && (bits == 8)) {
cfseek(ddsfile, DDS_OFFSET, CF_SEEK_SET);
+7 -5
View File
@@ -46,17 +46,19 @@
// DDS format stuff ...
#define DDSD_LINEARSIZE 0x00080000
#define DDSD_PITCH 0x00000008
#define DDSD_PIXELFORMAT 0x00001000
#define DDSD_WIDTH 0x00000004
#define DDSD_HEIGHT 0x00000002
#define DDSD_CAPS 0x00000001
#define DDSD_MIPMAPCOUNT 0x00020000
#define DDPF_ALPHAPIXELS 0x00000001
#define DDPF_FOURCC 0x00000004
#define DDPF_PALETTEINDEXED4 0x00000008
#define DDPF_PALETTEINDEXEDTO8 0x00000010
#define DDPF_PALETTEINDEXED8 0x00000020
#define DDPF_RGB 0x00000040
#define DDSD_PIXELFORMAT 0x00001000
#define DDSD_WIDTH 0x00000004
#define DDSD_HEIGHT 0x00000002
#define DDSD_CAPS 0x00000001
#define DDSD_MIPMAPCOUNT 0x00020000
#define DDPF_LUMINANCE 0x00020000
#define DDSCAPS_COMPLEX 0x00000008
#define DDSCAPS_PRIMARYSURFACE 0x00000200
+24 -21
View File
@@ -440,6 +440,7 @@ void debris_init()
void debris_page_in()
{
uint i;
char loader_name[64];
Debris_model = model_load( NOX("debris01.pof"), 0, NULL );
if (Debris_model >= 0) {
@@ -450,21 +451,22 @@ void debris_page_in()
Debris_vaporize_model = model_load( NOX("debris02.pof"), 0, NULL );
for (i=0; i<Species_info.size(); i++ )
{
for (i = 0; i < Species_info.size(); i++) {
species_info *species = &Species_info[i];
nprintf(( "Paging", "Paging in debris texture '%s'\n", species->debris_texture.filename));
if ( strlen(species->species_name) && (species->debris_texture.base_map.texture < 0) ) {
memset(loader_name, 0, sizeof(loader_name));
snprintf(loader_name, sizeof(loader_name) - 1, "Species: %s\n", species->species_name);
species->debris_texture.bitmap_id = bm_load(species->debris_texture.filename);
if (species->debris_texture.bitmap_id < 0)
{
Warning( LOCATION, "Couldn't load species %s debris\ntexture, '%s'\n", species->species_name, species->debris_texture.filename);
model_load_texture(&species->debris_texture, species->debris_texture_name, loader_name);
bm_page_in_texture(species->debris_texture.base_map.texture);
bm_page_in_texture(species->debris_texture.glow_map.texture);
bm_page_in_texture(species->debris_texture.spec_map.texture);
bm_page_in_texture(species->debris_texture.norm_map.texture);
bm_page_in_texture(species->debris_texture.height_map.texture);
}
bm_page_in_texture(species->debris_texture.bitmap_id);
}
}
MONITOR(NumSmallDebrisRend)
@@ -476,12 +478,12 @@ MONITOR(NumHullDebrisRend)
//
void debris_render(object * obj)
{
int i, num, swapped;
int i, num;
polymodel *pm;
debris *db;
texture_map swapped_tex;
bool swapped = false;
swapped = -1;
pm = NULL;
num = obj->instance;
@@ -491,13 +493,13 @@ void debris_render(object * obj)
Assert(db->flags & DEBRIS_USED);
// Swap in a different texture depending on the species
if (db->species >= 0)
{
if (db->species >= 0) {
pm = model_get( db->model_num );
if ( pm && (pm->n_textures == 1) ) {
swapped = pm->maps[0].base_map.texture;
pm->maps[0].base_map.texture = Species_info[db->species].debris_texture.bitmap_id;
memcpy(&swapped_tex, &pm->maps[0], sizeof(texture_map));
memcpy(&pm->maps[0], &Species_info[db->species].debris_texture, sizeof(texture_map));
swapped = true;
}
}
@@ -520,8 +522,8 @@ void debris_render(object * obj)
submodel_render( db->model_num, db->submodel_num, &obj->orient, &obj->pos, MR_NO_LIGHTING );
}
if ((swapped!=-1) && pm) {
pm->maps[0].base_map.texture = swapped;
if (swapped) {
memcpy(&pm->maps[0], &swapped_tex, sizeof(texture_map));
}
}
@@ -835,11 +837,11 @@ object *debris_create(object *source_obj, int model_num, int submodel_num, vec3d
// Create Debris piece n!
if ( hull_flag ) {
if (rand() < RAND_MAX/6) // Make some pieces blow up shortly after explosion.
db->lifeleft = 2.0f * ((float) myrand()/(float) RAND_MAX) + 0.5f;
db->lifeleft = 2.0f * (myrand() * RAND_MAX_1f) + 0.5f;
else
db->lifeleft = -1.0f; // large hull pieces stay around forever
} else {
db->lifeleft = (i2fl(myrand())/i2fl(RAND_MAX))*2.0f+0.1f;
db->lifeleft = (myrand() * RAND_MAX_1f)*2.0f+0.1f;
}
// increase lifetime for vaporized debris
@@ -1396,6 +1398,7 @@ void calc_debris_physics_properties( physics_info *pi, vec3d *mins, vec3d *maxs
// John, with new bspgen, just set pi->mass = mass
mass = 0.12f * dx * dy * dz;
pi->mass = (float) pow(mass, 0.6666667f) * 4.65f;
pi->I_body_inv.vec.rvec.xyz.x = 12.0f / (pi->mass * (dy*dy + dz*dz));
+1 -1
View File
@@ -647,7 +647,7 @@ void dc_printf(char *format, ...)
va_list args;
va_start(args, format);
vsprintf(tmp, format, args);
vsnprintf(tmp, sizeof(tmp)-1, format, args);
va_end(args);
char *p = tmp;
+14
View File
@@ -1497,3 +1497,17 @@ void fireball_get_color(int idx, float *red, float *green, float *blue)
*green = fbi->exp_color[1];
*blue = fbi->exp_color[2];
}
int fireball_get_type(object *obj)
{
int num, objnum;
fireball *fb;
num = obj->instance;
objnum = OBJ_INDEX(obj);
Assert( Fireballs[num].objnum == objnum );
fb = &Fireballs[num];
return fb->fireball_info_index;
}
+3 -2
View File
@@ -297,14 +297,15 @@ float fireball_lifeleft( object *obj );
// Returns life left of a fireball in percent
float fireball_lifeleft_percent( object *obj );
// returns the type of fileball (the FIREBALL_* types)
int fireball_get_type(object *obj);
// returns the lighting color (in [0...1] range) to use for explosion
void fireball_get_color(int idx, float *red, float *green, float *blue);
// internal function to draw warp grid.
extern void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius, int warp_3d = 0 );
extern int Warp_model;
// Goober5000
extern int Knossos_warp_ani_used;
+1 -1
View File
@@ -392,7 +392,7 @@ void warpin_render(object *obj, matrix *orient, vec3d *pos, int texture_bitmap_n
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
// vm_vec_scale_add( &vecs[4], &center, &orient->vec.fvec, -Grid_depth );
vecs[4] = center;
verts[0].u = 0.01f; verts[0].v = 0.01f;
+7 -10
View File
@@ -374,7 +374,7 @@ void bg_bitmap_dlg::create()
box->AddString(Nebula_colors[i]);
}
m_slider.SetRange(0, MAX_STARS);
m_slider.SetRange(100, MAX_STARS);
m_slider.SetPos(Num_stars);
sprintf(buf, "%d", Num_stars);
GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
@@ -1384,18 +1384,15 @@ void bg_bitmap_dlg::OnImportBackground()
Mp = saved_mp;
// pick one (if count is 0, it's retail with just one background)
if (count > 0)
if (count > 1)
{
int i, which = 0;
int i, which;
if (count > 1)
{
BackgroundChooser dlg(count);
if (dlg.DoModal() == IDCANCEL)
return;
BackgroundChooser dlg(count);
if (dlg.DoModal() == IDCANCEL)
return;
which = dlg.GetChosenBackground();
}
which = dlg.GetChosenBackground();
for (i = 0; i < which + 1; i++)
skip_to_string("$Bitmap List:");
+128 -140
View File
@@ -90,26 +90,21 @@ IDB_CHAINED_DIRECTIVE BITMAP MOVEABLE PURE "res\\chained_directive.bmp"
IDB_GREEN_DOT BITMAP MOVEABLE PURE "res\\green_do.bmp"
IDB_BLACK_DOT BITMAP MOVEABLE PURE "res\\black_do.bmp"
IDB_VARIABLE BITMAP MOVEABLE PURE "res\\variable.bmp"
IDB_DATA_12 BITMAP MOVEABLE PURE "res\\data12.bmp"
IDB_DATA_02 BITMAP MOVEABLE PURE "res\\data02.bmp"
IDB_DATA_03 BITMAP MOVEABLE PURE "res\\data03.bmp"
IDB_DATA_04 BITMAP MOVEABLE PURE "res\\data04.bmp"
IDB_DATA_05 BITMAP MOVEABLE PURE "res\\data05.bmp"
IDB_DATA_00 BITMAP MOVEABLE PURE "res\\data00.bmp"
IDB_DATA_06 BITMAP MOVEABLE PURE "res\\data06.bmp"
IDB_DATA_07 BITMAP MOVEABLE PURE "res\\data07.bmp"
IDB_DATA_08 BITMAP MOVEABLE PURE "res\\data08.bmp"
IDB_DATA_09 BITMAP MOVEABLE PURE "res\\data09.bmp"
IDB_DATA_10 BITMAP MOVEABLE PURE "res\\data10.bmp"
IDB_DATA_11 BITMAP MOVEABLE PURE "res\\data11.bmp"
IDB_DATA_01 BITMAP MOVEABLE PURE "res\\data01.bmp"
IDB_DATA_15 BITMAP MOVEABLE PURE "res\\data15.bmp"
IDB_DATA_20 BITMAP MOVEABLE PURE "res\\data20.bmp"
IDB_DATA_25 BITMAP MOVEABLE PURE "res\\data25.bmp"
IDB_DATA_30 BITMAP MOVEABLE PURE "res\\data30.bmp"
IDB_DATA_35 BITMAP MOVEABLE PURE "res\\data35.bmp"
IDB_DATA_40 BITMAP MOVEABLE PURE "res\\data40.bmp"
IDB_DATA_45 BITMAP MOVEABLE PURE "res\\data45.bmp"
IDB_DATA_50 BITMAP MOVEABLE PURE "res\\data50.bmp"
IDB_DATA_55 BITMAP MOVEABLE PURE "res\\data55.bmp"
IDB_DATA_60 BITMAP MOVEABLE PURE "res\\data60.bmp"
IDB_DATA_65 BITMAP MOVEABLE PURE "res\\data65.bmp"
IDB_DATA_70 BITMAP MOVEABLE PURE "res\\data70.bmp"
IDB_DATA_75 BITMAP MOVEABLE PURE "res\\data75.bmp"
IDB_DATA_80 BITMAP MOVEABLE PURE "res\\data80.bmp"
IDB_DATA_85 BITMAP MOVEABLE PURE "res\\data85.bmp"
IDB_DATA_90 BITMAP MOVEABLE PURE "res\\data90.bmp"
IDB_DATA_95 BITMAP MOVEABLE PURE "res\\data95.bmp"
IDB_DATA_14 BITMAP MOVEABLE PURE "res\\data14.bmp"
IDB_DATA_13 BITMAP MOVEABLE PURE "res\\data13.bmp"
/////////////////////////////////////////////////////////////////////////////
//
@@ -878,19 +873,13 @@ BEGIN
PUSHBUTTON "Cancel",IDCANCEL,355,184,50,14
END
IDD_MISSION_NOTES DIALOG DISCARDABLE 0, 0, 479, 327
IDD_MISSION_NOTES DIALOGEX 0, 0, 464, 324
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Mission Specs"
FONT 8, "MS Sans Serif"
BEGIN
RTEXT "Title",IDC_STATIC,7,10,29,8
EDITTEXT IDC_MISSION_TITLE,41,7,109,14,ES_AUTOHSCROLL
RTEXT "Designer",IDC_STATIC,7,25,29,8
EDITTEXT IDC_DESIGNER_NAME,41,23,109,14,ES_AUTOHSCROLL
RTEXT "Created:",IDC_STATIC,23,42,28,8
LTEXT "xx/xx/xx",IDC_CREATED,57,42,91,8
RTEXT "Last Modified:",IDC_STATIC,7,51,45,8
LTEXT "xx/xx/xx",IDC_MODIFIED,57,51,92,8
CONTROL "Single Player",IDC_SINGLE,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,7,63,57,10
CONTROL "Multi Player",IDC_MULTI,"Button",BS_AUTORADIOBUTTON,7,
@@ -903,100 +892,100 @@ BEGIN
BS_AUTORADIOBUTTON,76,72,66,10
CONTROL "Dogfight",IDC_DOGFIGHT,"Button",BS_AUTORADIOBUTTON,76,
81,43,10
LTEXT "Max Respawns",IDC_STATIC,8,97,52,8
EDITTEXT IDC_RESPAWNS,86,94,50,14,ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_RESPAWNS,92,94,50,14,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Spin1",IDC_RESPAWN_SPIN,"msctls_updown32",
UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY |
UDS_ARROWKEYS,136,94,11,14
PUSHBUTTON "Custom Wing Names",IDC_CUSTOM_WING_NAMES,10,115,128,14
GROUPBOX "Squadron Reassign",IDC_STATIC,2,136,148,44
LTEXT "Name",IDC_STATIC,14,147,28,8
EDITTEXT IDC_SQUAD_NAME,48,147,98,14,ES_AUTOHSCROLL
PUSHBUTTON "Logo",IDC_SQUAD_LOGO_BUTTON,8,161,31,14
EDITTEXT IDC_SQUAD_LOGO,48,161,98,14,ES_AUTOHSCROLL | ES_READONLY
GROUPBOX "Loading Screen",IDC_STATIC,2,185,148,46
PUSHBUTTON "640x480",IDC_LOADING_SCREEN_BUTTON640,7,197,40,14
EDITTEXT IDC_LOADING_SCREEN640,47,197,97,14,ES_AUTOHSCROLL
PUSHBUTTON "1024x768",IDC_LOADING_SCREEN_BUTTON1024,7,213,40,16
EDITTEXT IDC_LOADING_SCREEN1024,47,213,97,16,ES_AUTOHSCROLL
GROUPBOX "Support Ships",IDC_STATIC,160,6,152,71
CONTROL "Disallow Support Ships",IDC_SUPPORT_ALLOWED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,164,16,95,10
CONTROL "Support Ships Repair Hull",IDC_SUPPORT_REPAIRS_HULL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,164,27,123,10
LTEXT "Hull Repair Ceiling",IDC_STATIC,164,43,60,8
EDITTEXT IDC_MAX_HULL_REPAIR_VAL,244,41,49,14,ES_AUTOHSCROLL
LTEXT "%",IDC_STATIC,298,46,8,8
LTEXT "Subsytem Repair Ceiling",IDC_STATIC,164,64,75,8
EDITTEXT IDC_MAX_SUBSYS_REPAIR_VAL,244,59,49,14,ES_AUTOHSCROLL
LTEXT "%",IDC_STATIC,298,60,8,8
GROUPBOX "Ship Trails",IDC_STATIC,160,81,154,41
CONTROL "Toggle (off in nebula; on elsewhere)",
IDC_SPECS_TOGGLE_TRAILS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,162,92,141,10
CONTROL "Minimium speed to display",IDC_CONTRAIL_THRESHOLD_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,103,93,10
EDITTEXT IDC_CONTRAIL_THRESHOLD,262,102,48,14,ES_READONLY
GROUPBOX "Built-in Command Messages",IDC_STATIC,158,131,154,46
LTEXT "Sender",IDC_STATIC,165,145,40,8
COMBOBOX IDC_COMMAND_SENDER,209,143,99,140,CBS_DROPDOWN |
WS_VSCROLL | WS_TABSTOP
LTEXT "Persona",IDC_STATIC,165,161,40,8
COMBOBOX IDC_COMMAND_PERSONA,209,160,99,140,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Mission Music",IDC_STATIC,157,188,154,47
LTEXT "Default",IDC_STATIC,161,200,40,8
COMBOBOX IDC_EVENT_MUSIC,207,199,99,140,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "If music pack is present",IDC_STATIC,161,213,43,16
COMBOBOX IDC_SUBSTITUTE_EVENT_MUSIC,207,215,99,140,CBS_DROPDOWN |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "Flags",IDC_STATIC,321,20,154,198
UDS_ARROWKEYS,142,94,11,14
PUSHBUTTON "Custom Wing Names",IDC_CUSTOM_WING_NAMES,13,115,136,14
EDITTEXT IDC_SQUAD_NAME,356,124,98,14,ES_AUTOHSCROLL
PUSHBUTTON "Logo",IDC_SQUAD_LOGO_BUTTON,316,139,31,14
EDITTEXT IDC_SQUAD_LOGO,356,139,98,14,ES_AUTOHSCROLL |
ES_READONLY
PUSHBUTTON "640x480",IDC_LOADING_SCREEN_BUTTON640,317,284,40,14
EDITTEXT IDC_LOADING_SCREEN640,357,284,97,14,ES_AUTOHSCROLL
PUSHBUTTON "1024x768",IDC_LOADING_SCREEN_BUTTON1024,317,300,40,16
EDITTEXT IDC_LOADING_SCREEN1024,357,300,97,16,ES_AUTOHSCROLL
CONTROL "All Teams at War",IDC_FULL_WAR,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,31,72,10
WS_TABSTOP,165,22,72,10
CONTROL "Red Alert Mission",IDC_RED_ALERT,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,326,41,78,10
BS_AUTOCHECKBOX | WS_TABSTOP,165,33,78,10
CONTROL "Scramble Mission",IDC_SCRAMBLE,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,51,72,10
WS_TABSTOP,165,42,72,10
CONTROL "No Briefing",IDC_NO_BRIEFING,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,165,52,72,10
CONTROL "No Debriefing",IDC_NO_DEBRIEFING,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,165,62,72,10
CONTROL "Disallow Promotions/Badges",IDC_NO_PROMOTION,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,326,61,106,10
BS_AUTOCHECKBOX | WS_TABSTOP,165,73,106,10
CONTROL "Disable Built-in Messages",IDC_DISABLE_BUILTIN_MSGS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,71,123,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,82,123,10
CONTROL "Disable Built-in Command Messages",
IDC_DISABLE_BUILTIN_COMMAND_MSGS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,326,81,129,10
BS_AUTOCHECKBOX | WS_TABSTOP,165,92,129,10
CONTROL "No Traitor",IDC_NO_TRAITOR,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,91,123,10
WS_TABSTOP,165,102,123,10
CONTROL "All Ships Beam-Freed By Default",
IDC_BEAM_FREE_ALL_BY_DEFAULT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,101,123,10
WS_TABSTOP,304,38,123,10
CONTROL "Allow Daisy-Chained Docking",IDC_ALLOW_DOCK_TREES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,111,123,10
CONTROL "No Briefing",IDC_NO_BRIEFING,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,121,72,10
CONTROL "No Debriefing",IDC_NO_DEBRIEFING,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,326,131,72,10
CONTROL "Use Autopilot Cinematics",IDC_USE_AUTOPILOT_CINEMATICS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,326,141,123,10
CONTROL "Deactivate Hardcoded Autopilot",
IDC_DEACTIVATE_AUTOPILOT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,151,123,10
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,304,47,123,10
CONTROL "Disallow Support Ships",IDC_SUPPORT_ALLOWED,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,309,168,95,10
CONTROL "Support Ships Repair Hull",IDC_SUPPORT_REPAIRS_HULL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,179,123,10
EDITTEXT IDC_MAX_HULL_REPAIR_VAL,389,193,59,14,ES_AUTOHSCROLL
EDITTEXT IDC_MAX_SUBSYS_REPAIR_VAL,389,211,59,14,ES_AUTOHSCROLL
CONTROL "Toggle (off in nebula; on elsewhere)",
IDC_SPECS_TOGGLE_TRAILS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,309,242,141,10
CONTROL "Minimium speed to display",IDC_CONTRAIL_THRESHOLD_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,309,253,93,10
EDITTEXT IDC_CONTRAIL_THRESHOLD,411,252,48,14,ES_READONLY
COMBOBOX IDC_AI_PROFILE,59,134,93,140,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_EVENT_MUSIC,211,134,93,140,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SUBSTITUTE_EVENT_MUSIC,211,150,93,140,CBS_DROPDOWN |
WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_MISSION_DESC,0,182,299,57,ES_MULTILINE |
ES_AUTOVSCROLL | ES_WANTRETURN
EDITTEXT IDC_MISSION_NOTES,1,254,297,57,ES_MULTILINE |
ES_AUTOVSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,347,7,50,14
PUSHBUTTON "Cancel",IDCANCEL,403,7,50,14
LTEXT "Max Respawns",IDC_STATIC,8,97,52,8
RTEXT "Title",IDC_STATIC,7,10,29,8
RTEXT "Designer Notes",IDC_STATIC,1,243,50,8
LTEXT "xx/xx/xx",IDC_MODIFIED,57,51,101,8
RTEXT "Designer",IDC_STATIC,7,25,29,8
RTEXT "Created:",IDC_STATIC,23,42,28,8
LTEXT "xx/xx/xx",IDC_CREATED,57,42,103,8
RTEXT "Last Modified:",IDC_STATIC,7,51,45,8
LTEXT "Mission Description",IDC_STATIC,0,170,62,8
LTEXT "Music",IDC_STATIC,153,137,32,8
GROUPBOX "Squadron Reassign",IDC_STATIC,310,114,150,44
LTEXT "Name",IDC_STATIC,322,125,28,8
GROUPBOX "Loading Screen",IDC_STATIC,309,274,151,46
GROUPBOX "Support Ships",IDC_STATIC,305,158,154,71
LTEXT "Hull Repair Ceiling",IDC_STATIC,309,195,60,8
LTEXT "Subsytem Repair Ceiling",IDC_STATIC,309,216,75,8
LTEXT "%",IDC_STATIC,452,196,8,8
LTEXT "%",IDC_STATIC,452,210,8,8
GROUPBOX "Ship Trails",IDC_STATIC,306,231,154,41
LTEXT "Substitute Music",IDC_STATIC,153,153,52,8
LTEXT "AI Profile",IDC_STATIC,1,137,32,8
CONTROL "Player Starts under AI Control (NO MULTI)",
IDC_PLAYER_START_AI,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,161,146,10
WS_TABSTOP,3,153,149,10
CONTROL "Use Autopilot Cinematics",IDC_USE_AUTOPILOT_CINEMATICS,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,304,58,123,10
CONTROL "2D Mission",IDC_2D_MISSION,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,326,171,123,10
LTEXT "AI Profile",IDC_STATIC,320,229,32,8
COMBOBOX IDC_AI_PROFILE,378,226,93,140,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Mission Description",IDC_STATIC,4,238,62,8
EDITTEXT IDC_MISSION_DESC,4,250,471,29,ES_MULTILINE |
ES_AUTOVSCROLL | ES_WANTRETURN
RTEXT "Designer Notes",IDC_STATIC,2,284,50,8
EDITTEXT IDC_MISSION_NOTES,3,294,472,29,ES_MULTILINE |
ES_AUTOVSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,368,0,50,14
PUSHBUTTON "Cancel",IDCANCEL,424,0,50,14
WS_TABSTOP,304,70,123,10
CONTROL "Deactivate Hardcoded Autopilot",
IDC_DEACTIVATE_AUTOPILOT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,304,81,123,10
LTEXT "Retail Flags:",IDC_STATIC,167,7,40,8
LTEXT "FS2 Open Flags",IDC_STATIC,304,25,52,8
END
IDD_PREFERENCES DIALOG DISCARDABLE 0, 0, 333, 81
@@ -1928,11 +1917,11 @@ BEGIN
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL | WS_HSCROLL
END
IDD_BRIEFING_EDITOR DIALOGEX 0, 0, 258, 417
IDD_BRIEFING_EDITOR DIALOGEX 0, 0, 258, 407
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Briefing Editor"
MENU IDR_PLAYER_EDIT_MENU
FONT 8, "MS Sans Serif"
FONT 8, "MS Sans Serif", 0, 0, 0x1
BEGIN
PUSHBUTTON "Prev",IDC_PREV,147,7,23,14,0,WS_EX_STATICEDGE
PUSHBUTTON "Next",IDC_NEXT,173,7,23,14,0,WS_EX_STATICEDGE
@@ -1954,58 +1943,57 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,7,38,69,10
CONTROL "Cut to previous stage",IDC_CUT_PREV,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,47,83,10
EDITTEXT IDC_TEXT,7,72,244,40,ES_MULTILINE | ES_AUTOVSCROLL |
EDITTEXT IDC_TEXT,7,75,244,40,ES_MULTILINE | ES_AUTOVSCROLL |
ES_WANTRETURN
EDITTEXT IDC_VOICE,63,115,83,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE,150,115,42,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,194,115,13,14,BS_BITMAP,
EDITTEXT IDC_VOICE,63,118,83,13,ES_AUTOHSCROLL
PUSHBUTTON "Browse",IDC_BROWSE,150,118,42,14,0,WS_EX_STATICEDGE
PUSHBUTTON "IDB_PLAY",IDC_PLAY,194,118,13,14,BS_BITMAP,
WS_EX_TRANSPARENT | WS_EX_STATICEDGE
COMBOBOX IDC_BRIEFING_MUSIC,70,142,83,135,CBS_DROPDOWNLIST |
COMBOBOX IDC_BRIEFING_MUSIC,63,134,83,135,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SUBSTITUTE_BRIEFING_MUSIC,70,159,83,135,CBS_DROPDOWN |
COMBOBOX IDC_SUBSTITUTE_BRIEFING_MUSIC,63,151,83,135,CBS_DROPDOWN |
WS_VSCROLL | WS_TABSTOP
CONTROL "Tree1",IDC_TREE,"SysTreeView32",TVS_HASBUTTONS |
TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS |
WS_BORDER | WS_TABSTOP,7,190,244,71,WS_EX_CLIENTEDGE
WS_BORDER | WS_TABSTOP,7,181,244,71,WS_EX_CLIENTEDGE
CONTROL "Draw lines between marked icons",IDC_LINES,"Button",
BS_3STATE | WS_TABSTOP,129,264,122,10
EDITTEXT IDC_ICON_LABEL,51,288,75,14,ES_AUTOHSCROLL
COMBOBOX IDC_ICON_IMAGE,52,304,75,135,CBS_DROPDOWNLIST |
BS_3STATE | WS_TABSTOP,129,255,122,10
EDITTEXT IDC_ICON_LABEL,51,277,75,14,ES_AUTOHSCROLL
COMBOBOX IDC_ICON_IMAGE,52,293,75,135,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_SHIP_TYPE,52,320,75,145,CBS_DROPDOWNLIST |
COMBOBOX IDC_SHIP_TYPE,52,309,75,145,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_TEAM,52,336,75,84,CBS_DROPDOWNLIST | WS_VSCROLL |
COMBOBOX IDC_TEAM,52,325,75,84,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
EDITTEXT IDC_ID,151,284,30,12,ES_AUTOHSCROLL | ES_NUMBER
EDITTEXT IDC_ID,151,273,30,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "Highlight",IDC_HILIGHT,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,135,302,43,10
WS_TABSTOP,135,291,43,10
CONTROL "Change locally",IDC_LOCAL,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,135,319,62,10
WS_TABSTOP,135,308,62,10
CONTROL "Flip Icon",IDC_FLIP_ICON,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,136,335,43,10
PUSHBUTTON "Make Icon",IDC_MAKE_ICON,197,283,50,14,0,
WS_TABSTOP,136,324,43,10
PUSHBUTTON "Make Icon",IDC_MAKE_ICON,197,272,50,14,0,
WS_EX_STATICEDGE
PUSHBUTTON "Delete Icon",IDC_DELETE_ICON,197,300,50,14,0,
PUSHBUTTON "Delete Icon",IDC_DELETE_ICON,197,289,50,14,0,
WS_EX_STATICEDGE
PUSHBUTTON "Propagate",IDC_PROPAGATE_ICONS,197,317,50,14,0,
PUSHBUTTON "Propagate",IDC_PROPAGATE_ICONS,197,306,50,14,0,
WS_EX_STATICEDGE
EDITTEXT IDC_ICON_TEXT,14,363,230,40,ES_MULTILINE |
EDITTEXT IDC_ICON_TEXT,14,352,230,40,ES_MULTILINE |
ES_AUTOVSCROLL | ES_WANTRETURN
LTEXT "Stage 1 of 9",IDC_STAGE_TITLE,7,7,53,8
GROUPBOX "Current Icon Info",IDC_STATIC,7,274,244,136
LTEXT "Label",IDC_STATIC,13,291,18,8
LTEXT "Icon image",IDC_STATIC,13,307,36,8
LTEXT "Text",IDC_STATIC,7,62,15,8
GROUPBOX "Current Icon Info",IDC_STATIC,7,264,244,136
LTEXT "Label",IDC_STATIC,13,280,18,8
LTEXT "Icon image",IDC_STATIC,13,296,36,8
LTEXT "Text",IDC_STATIC,7,65,15,8
LTEXT "Camera Transition Time (ms)",IDC_STATIC,7,25,90,8
LTEXT "Voice Wave File",IDC_STATIC,7,117,53,8
LTEXT "Text",IDC_STATIC,14,352,15,8
LTEXT "Team",IDC_STATIC,13,339,19,8
LTEXT "Ship Type",IDC_STATIC,13,323,33,8
LTEXT "ID",IDC_STATIC,137,286,8,8
LTEXT "Default",IDC_STATIC,14,144,24,8
LTEXT "Usage Formula",IDC_STATIC,7,180,48,8
LTEXT "If music pack is present",IDC_STATIC,14,157,44,17
GROUPBOX "Briefing Music",IDC_STATIC,7,132,150,44
LTEXT "Voice Wave File",IDC_STATIC,7,120,53,8
LTEXT "Text",IDC_STATIC,14,341,15,8
LTEXT "Team",IDC_STATIC,13,328,19,8
LTEXT "Ship Type",IDC_STATIC,13,312,33,8
LTEXT "ID",IDC_STATIC,137,275,8,8
LTEXT "Briefing Music",IDC_STATIC,7,137,45,8
LTEXT "Usage Formula",IDC_STATIC,7,171,48,8
LTEXT "Substitute Music",IDC_STATIC,7,154,53,8
END
IDD_IGNORE_ORDERS DIALOG DISCARDABLE 0, 0, 120, 217
@@ -2568,8 +2556,8 @@ BEGIN
IDD_MISSION_NOTES, DIALOG
BEGIN
RIGHTMARGIN, 475
BOTTOMMARGIN, 323
RIGHTMARGIN, 460
BOTTOMMARGIN, 320
END
IDD_PREFERENCES, DIALOG
@@ -2743,7 +2731,7 @@ BEGIN
RIGHTMARGIN, 251
VERTGUIDE, 136
TOPMARGIN, 7
BOTTOMMARGIN, 410
BOTTOMMARGIN, 400
END
IDD_IGNORE_ORDERS, DIALOG
+11 -4
View File
@@ -2342,16 +2342,23 @@ void inc_mission_time()
fix thistime;
thistime = timer_get_fixed_seconds();
if (!lasttime)
if ( !lasttime ) {
Frametime = F1_0 / 30;
else
} else {
Frametime = thistime - lasttime;
}
if (Frametime > MAX_FRAMETIME)
if (Frametime > MAX_FRAMETIME) {
Frametime = MAX_FRAMETIME;
} else if (Frametime < MIN_FRAMETIME) {
if ( !Cmdline_NoFPSCap ) {
thistime = MIN_FRAMETIME - Frametime;
Sleep( DWORD(f2fl(thistime) * 1000.0f) );
thistime = timer_get_fixed_seconds();
}
if (Frametime < MIN_FRAMETIME)
Frametime = MIN_FRAMETIME;
}
Missiontime += Frametime;
lasttime = thistime;
+1 -1
View File
@@ -505,7 +505,7 @@ char **Builtin_mission_names;
char *Game_current_mission_filename;
CFILE *Working_demo;
struct beam_info;
bool cube_map_drawen=false;
bool Env_cubemap_drawn = false;
int Multi_ping_timestamp = -1;
int Sun_drew = 0;
int Networking_disabled = 0;
+2 -11
View File
@@ -1828,17 +1828,8 @@ void CFREDView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
if(cy > 0)
{
gr_init_res(GR_640,GR_OPENGL, cx,cy);
glViewport(0, 0, cx, cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, gr_screen.max_w, gr_screen.max_h,0, 0.0, 1.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
if (cy > 0) {
gr_screen_resize(cx, cy);
RedrawWindow();
}
}
+3 -7
View File
@@ -902,12 +902,12 @@ bool fred_init()
snd_init(0, 0, 44100, 16);
// Not ready for this yet
// Cmdline_nospec = 1;
// Cmdline_noglow = 1;
// Cmdline_spec = 0;
// Cmdline_glow = 0;
Cmdline_window = 1;
DBUGFILE_OUTPUT_0("About to gr_init");
gr_init(GR_640, GR_OPENGL, 32, 640, 480);
gr_init(GR_OPENGL, 640, 480, 32);
Mouse_hidden = 1;
@@ -1572,10 +1572,6 @@ void clear_mission()
The_mission.contrail_threshold = CONTRAIL_THRESHOLD_DEFAULT;
// Goober5000
The_mission.command_persona = Default_command_persona;
strcpy(The_mission.command_sender, DEFAULT_COMMAND);
// Goober5000: reset ALL mission flags, not just nebula!
The_mission.flags = 0;
The_mission.support_ships.max_support_ships = -1; // negative means infinite
+2 -36
View File
@@ -266,7 +266,6 @@
#include "gamesnd/eventmusic.h"
#include "cfile/cfile.h"
#include "mission/missionparse.h"
#include "mission/missionmessage.h"
#ifdef _DEBUG
#define new DEBUG_NEW
@@ -298,8 +297,6 @@ CMissionNotesDlg::CMissionNotesDlg(CWnd* pParent /*=NULL*/) : CDialog(CMissionNo
m_ai_profile = -1;
m_event_music = -1;
m_substitute_event_music = _T("");
m_command_persona = -1;
m_command_sender = _T("");
m_full_war = FALSE;
m_red_alert = FALSE;
m_scramble = FALSE;
@@ -344,8 +341,6 @@ void CMissionNotesDlg::DoDataExchange(CDataExchange* pDX)
DDX_CBIndex(pDX, IDC_AI_PROFILE, m_ai_profile);
DDX_CBIndex(pDX, IDC_EVENT_MUSIC, m_event_music);
DDX_Text(pDX, IDC_SUBSTITUTE_EVENT_MUSIC, m_substitute_event_music);
DDX_CBIndex(pDX, IDC_COMMAND_PERSONA, m_command_persona);
DDX_Text(pDX, IDC_COMMAND_SENDER, m_command_sender);
DDX_Check(pDX, IDC_FULL_WAR, m_full_war);
DDX_Check(pDX, IDC_RED_ALERT, m_red_alert);
DDX_Check(pDX, IDC_SCRAMBLE, m_scramble);
@@ -614,12 +609,6 @@ void CMissionNotesDlg::OnOK()
MODIFY(Current_soundtrack_num, m_event_music - 1);
strcpy(The_mission.substitute_event_music_name, m_substitute_event_music);
MODIFY(The_mission.command_persona, ((CComboBox *) GetDlgItem(IDC_COMMAND_PERSONA))->GetItemData(m_command_persona));
if (m_command_sender.GetAt(0) == '#')
strcpy(The_mission.command_sender, m_command_sender.Mid(1));
else
strcpy(The_mission.command_sender, m_command_sender);
MODIFY(Mission_all_attack, m_full_war);
if (query_modified()){
set_modified();
@@ -644,7 +633,7 @@ void CMissionNotesDlg::OnCancel()
BOOL CMissionNotesDlg::OnInitDialog()
{
int i, box_index = 0, mission_command_persona_box_index = -1;
int i;
CComboBox *box;
CEdit *edit;
@@ -661,7 +650,6 @@ BOOL CMissionNotesDlg::OnInitDialog()
m_mission_desc_orig = m_mission_desc = convert_multiline_string(The_mission.mission_desc);
m_red_alert = (The_mission.flags & MISSION_FLAG_RED_ALERT) ? 1 : 0;
m_scramble = (The_mission.flags & MISSION_FLAG_SCRAMBLE) ? 1 : 0;
m_full_war = Mission_all_attack;
m_daisy_chained_docking = (The_mission.flags & MISSION_FLAG_ALLOW_DOCK_TREES) ? 1 : 0;
m_disallow_support = (The_mission.support_ships.max_support_ships == 0) ? 1 : 0;
m_no_promotion = (The_mission.flags & MISSION_FLAG_NO_PROMOTION) ? 1 : 0;
@@ -700,25 +688,6 @@ BOOL CMissionNotesDlg::OnInitDialog()
box->AddString(Soundtracks[i].name);
}
box = (CComboBox *) GetDlgItem(IDC_COMMAND_PERSONA);
for (i=0; i<Num_personas; i++){
if (Personas[i].flags & PERSONA_FLAG_COMMAND){
box->AddString(Personas[i].name);
box->SetItemData(box_index, i);
if (i == The_mission.command_persona)
mission_command_persona_box_index = box_index;
box_index++;
}
}
box = (CComboBox *) GetDlgItem(IDC_COMMAND_SENDER);
box->AddString(DEFAULT_COMMAND);
for (i=0; i<MAX_SHIPS; i++){
if (Ships[i].objnum >= 0)
if (Ship_info[Ships[i].ship_info_index].flags & SIF_HUGE_SHIP)
box->AddString(Ships[i].ship_name);
}
// squad info
if(strlen(The_mission.squad_name) > 0){
m_squad_name = _T(The_mission.squad_name);
@@ -730,12 +699,9 @@ BOOL CMissionNotesDlg::OnInitDialog()
m_type = The_mission.game_type;
m_ai_profile = (The_mission.ai_profile - Ai_profiles);
m_event_music = Current_soundtrack_num + 1;
m_substitute_event_music = The_mission.substitute_event_music_name;
m_command_persona = mission_command_persona_box_index;
m_command_sender = The_mission.command_sender;
m_full_war = Mission_all_attack;
// set up the game type checkboxes accoring to m_type
if ( m_type & MISSION_TYPE_SINGLE ){
-2
View File
@@ -211,8 +211,6 @@ public:
int m_ai_profile;
int m_event_music;
CString m_substitute_event_music;
int m_command_persona;
CString m_command_sender;
BOOL m_full_war;
BOOL m_red_alert;
BOOL m_scramble;
+335 -658
View File
File diff suppressed because it is too large. Load diff
+2 -9
View File
@@ -141,15 +141,11 @@
#include "ship/ship.h"
#include "object/waypoint.h"
#include <string>
#include <vector>
#define BACKUP_DEPTH 9
class CFred_mission_save {
private:
char *raw_ptr;
std::vector<std::string> fso_ver_comment;
int err;
CFILE *fp;
@@ -187,18 +183,15 @@ public:
int save_reinforcements();
void save_ai_goals(ai_goal *goalp, int ship);
int fout(char *format, ...);
int fout_version(char *format, ...);
int fout_ext(char *pre_str, char *format, ...);
int fout_ext(char *format, ...);
void parse_comments(int = 1);
CFred_mission_save() : err(0), raw_ptr(Mission_text_raw) { }
int save_mission_file(char *pathname);
int autosave_mission_file(char *pathname);
int save_campaign_file(char *pathname);
void fso_comment_push(char *ver);
void fso_comment_pop(bool pop_all = false);
// Goober5000
int fout_and_bypass(char *format, ...);
void bypass_comment(char *comment);
};
Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 B

+16 -23
View File
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by FRED.rc
// Microsoft Visual C++ generated include file.
// Used by fred.rc
//
#define IDC_SAVE_DEFAULT_PREFS 3
#define ID_DELETE_VARIABLE 3
@@ -101,26 +101,21 @@
#define IDD_CUSTOM_WING_NAMES 267
#define IDD_RESTRICT_PATHS 270
#define IDD_BACKGROUND_CHOOSER 272
#define IDB_DATA_02 274
#define IDB_DATA_03 275
#define IDB_DATA_04 276
#define IDB_DATA_05 277
#define IDB_DATA_06 278
#define IDB_DATA_07 279
#define IDB_DATA_08 280
#define IDB_DATA_09 281
#define IDB_DATA_01 285
#define IDB_DATA_10 286
#define IDB_DATA_15 296
#define IDB_DATA_00 297
#define IDB_DATA_20 300
#define IDB_DATA_25 301
#define IDB_DATA_30 302
#define IDB_DATA_35 303
#define IDB_DATA_40 304
#define IDB_DATA_45 305
#define IDB_DATA_50 306
#define IDB_DATA_55 307
#define IDB_DATA_60 308
#define IDB_DATA_65 309
#define IDB_DATA_70 310
#define IDB_DATA_75 311
#define IDB_DATA_80 312
#define IDB_DATA_85 313
#define IDB_DATA_90 314
#define IDB_DATA_95 315
#define IDB_DATA_11 287
#define IDB_DATA_12 288
#define IDB_DATA_15 289
#define IDB_DATA_14 290
#define IDB_DATA_13 291
#define IDC_SHIP_CLASS 1003
#define IDC_SHIP_WING 1004
#define IDC_SOUND_CLIP_NAME 1007
@@ -578,8 +573,6 @@
#define IDC_LIST3 1208
#define IDC_FILELIST 1208
#define IDC_YES_MESSAGE_LIST 1208
#define IDC_COMMAND_SENDER 1209
#define IDC_COMMAND_PERSONA 1210
#define IDC_FILTER_WAYPOINTS 1211
#define IDC_FILTER_STARTS 1212
#define IDC_FILTER_SHIPS 1213
@@ -1369,7 +1362,7 @@
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 316
#define _APS_NEXT_RESOURCE_VALUE 292
#define _APS_NEXT_COMMAND_VALUE 33091
#define _APS_NEXT_CONTROL_VALUE 1595
#define _APS_NEXT_SYMED_VALUE 105
+16 -77
View File
@@ -820,7 +820,6 @@
#include "weapon/weapon.h"
#include "hud/hudartillery.h"
#include "iff_defs/iff_defs.h"
#include "mission/missionmessage.h"
#define TREE_NODE_INCREMENT 100
@@ -3140,7 +3139,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
case OPF_SUBSYSTEM:
case OPF_AWACS_SUBSYSTEM:
case OPF_ROTATING_SUBSYSTEM:
case OPF_SUBSYS_OR_GENERIC:
str = "<name of subsystem>";
break;
@@ -3193,10 +3191,6 @@ int sexp_tree::get_default_value(sexp_list_item *item, int op, int i)
str = "<any data>";
break;
case OPF_PERSONA:
str = "<persona name>";
break;
default:
str = "<new default required!>";
break;
@@ -3265,7 +3259,6 @@ int sexp_tree::query_default_argument_available(int op, int i)
case OPF_SKYBOX_MODEL_NAME:
case OPF_SHIP_OR_NONE:
case OPF_SUBSYSTEM_OR_NONE:
case OPF_SUBSYS_OR_GENERIC:
case OPF_BACKGROUND_BITMAP:
case OPF_SUN_BITMAP:
case OPF_NEBULA_STORM_TYPE:
@@ -3295,12 +3288,6 @@ int sexp_tree::query_default_argument_available(int op, int i)
return 0;
case OPF_PERSONA:
if (Num_personas)
return 1;
return 0;
case OPF_POINT:
case OPF_WAYPOINT_PATH:
if (Num_waypoint_lists)
@@ -4254,26 +4241,21 @@ void sexp_tree::OnLButtonUp(UINT nFlags, CPoint point)
}
const static UINT Numbered_data_bitmaps[] = {
IDB_DATA_00,
IDB_DATA_01,
IDB_DATA_02,
IDB_DATA_03,
IDB_DATA_04,
IDB_DATA_05,
IDB_DATA_06,
IDB_DATA_07,
IDB_DATA_08,
IDB_DATA_09,
IDB_DATA_10,
IDB_DATA_11,
IDB_DATA_12,
IDB_DATA_13,
IDB_DATA_14,
IDB_DATA_15,
IDB_DATA_20,
IDB_DATA_25,
IDB_DATA_30,
IDB_DATA_35,
IDB_DATA_40,
IDB_DATA_45,
IDB_DATA_50,
IDB_DATA_55,
IDB_DATA_60,
IDB_DATA_65,
IDB_DATA_70,
IDB_DATA_75,
IDB_DATA_80,
IDB_DATA_85,
IDB_DATA_90,
IDB_DATA_95
};
void sexp_tree::setup(CEdit *ptr)
@@ -4834,10 +4816,6 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
list = get_listing_opf_subsystem_or_none(parent_node, arg_index);
break;
case OPF_SUBSYS_OR_GENERIC:
list = get_listing_opf_subsys_or_generic(parent_node, arg_index);
break;
case OPF_JUMP_NODE_NAME:
list = get_listing_opf_jump_nodes();
break;
@@ -4878,10 +4856,6 @@ sexp_list_item *sexp_tree::get_listing_opf(int opf, int parent_node, int arg_ind
list = get_listing_opf_turret_target_order();
break;
case OPF_PERSONA:
list = get_listing_opf_persona();
break;
default:
Int3(); // unknown OPF code
list = NULL;
@@ -4972,25 +4946,15 @@ int sexp_tree::find_ancestral_argument_number(int parent_op, int child_node)
*/
int sexp_tree::get_data_image(int node)
{
int count = get_sibling_place(node) + 1;
int count = get_sibling_place(node);
if (count <= 0) {
if(count < 0)
return BITMAP_DATA;
}
if (count % 5) {
if(count > NUM_BITMAP_NUMBERED_DATA)
return BITMAP_DATA;
}
int idx = (count % 100) / 5;
int num = sizeof(Numbered_data_bitmaps)/sizeof(UINT);
if (idx > num) {
return BITMAP_DATA;
}
return BITMAP_NUMBERED_DATA + idx;
return BITMAP_NUMBERED_DATA + count;
}
int sexp_tree::get_sibling_place(int node)
@@ -5587,20 +5551,6 @@ sexp_list_item *sexp_tree::get_listing_opf_message()
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_persona()
{
int i;
sexp_list_item head;
for (i = 0; i < Num_personas; i++) {
if (Personas[i].flags & PERSONA_FLAG_WINGMAN) {
head.add_data (Personas[i].name);
}
}
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_who_from()
{
object *ptr;
@@ -5939,17 +5889,6 @@ sexp_list_item *sexp_tree::get_listing_opf_subsystem_or_none(int parent_node, in
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_subsys_or_generic(int parent_node, int arg_index)
{
sexp_list_item head;
head.add_data(SEXP_ALL_ENGINES_STRING);
head.add_data(SEXP_ALL_TURRETS_STRING);
head.add_list(get_listing_opf_subsystem(parent_node, arg_index));
return head.next;
}
sexp_list_item *sexp_tree::get_listing_opf_jump_nodes()
{
sexp_list_item head;
+1 -2
View File
@@ -55,6 +55,7 @@
#define BITMAP_BLUE_DOT BITMAP_ROOT
#define BITMAP_RED_DOT BITMAP_ROOT_DIRECTIVE
#define BITMAP_NUMBERED_DATA 9
#define NUM_BITMAP_NUMBERED_DATA 15
//Therefore NEXT DEFINE should be 9+12 or 21
@@ -246,9 +247,7 @@ public:
sexp_list_item *get_listing_opf_flexible_argument();
sexp_list_item *get_listing_opf_ship_or_none();
sexp_list_item *get_listing_opf_subsystem_or_none(int parent_node, int arg_index);
sexp_list_item *get_listing_opf_subsys_or_generic(int parent_node, int arg_index);
sexp_list_item *get_listing_opf_turret_target_order();
sexp_list_item *get_listing_opf_persona();
// ---------------------------------------------------------
int m_mode;
+9 -28
View File
@@ -132,7 +132,6 @@ BOOL ShipSpecialDamage::OnInitDialog()
m_special_exp_enabled = TRUE;
}
CDialog::OnInitDialog();
// maybe gray out lots of stuff
@@ -164,25 +163,6 @@ void ShipSpecialDamage::OnOK()
{
UpdateData(TRUE);
object *objp;
objp = GET_FIRST(&obj_used_list);
while (objp != END_OF_LIST(&obj_used_list)) {
if ((objp->type == OBJ_START) || (objp->type == OBJ_SHIP)) {
if (objp->flags & OF_MARKED)
update_ship(objp->instance);
}
objp = GET_NEXT(objp);
}
CDialog::OnOK();
}
void ShipSpecialDamage::update_ship(int shipnum)
{
ship *shipp = &Ships[shipnum];
// TODO: Add extra validation here
if (m_special_exp_enabled) {
@@ -193,17 +173,17 @@ void ShipSpecialDamage::update_ship(int shipnum)
return;
}
if (shipp->special_exp_index == -1) {
if (Ships[m_ship_num].special_exp_index == -1) {
// get free sexp_variables
start = sexp_variable_allocate_block(shipp->ship_name, SEXP_VARIABLE_BLOCK | SEXP_VARIABLE_BLOCK_EXP);
start = sexp_variable_allocate_block(Ships[m_ship_num].ship_name, SEXP_VARIABLE_BLOCK | SEXP_VARIABLE_BLOCK_EXP);
if (start == -1) {
MessageBox("Unable to allocate storage, try deleting Sexp variables");
return;
} else {
shipp->special_exp_index = start;
Ships[m_ship_num].special_exp_index = start;
}
} else {
start = shipp->special_exp_index;
start = Ships[m_ship_num].special_exp_index;
}
// set to update
set_modified();
@@ -217,16 +197,17 @@ void ShipSpecialDamage::update_ship(int shipnum)
sprintf(Sexp_variables[start+SHOCK_SPEED].text, "%d", m_shock_speed);
} else {
if (shipp->special_exp_index != -1) {
if (Ships[m_ship_num].special_exp_index != -1) {
// set to update
set_modified();
// free block
sexp_variable_block_free(shipp->ship_name, Ships[m_ship_num].special_exp_index, SEXP_VARIABLE_BLOCK |SEXP_VARIABLE_BLOCK_EXP);
sexp_variable_block_free(Ships[m_ship_num].ship_name, Ships[m_ship_num].special_exp_index, SEXP_VARIABLE_BLOCK |SEXP_VARIABLE_BLOCK_EXP);
// set index to no exp block
shipp->special_exp_index = -1;
Ships[m_ship_num].special_exp_index = -1;
}
}
}
CDialog::OnOK();
}
-1
View File
@@ -24,7 +24,6 @@ class ShipSpecialDamage : public CDialog
// Construction
public:
ShipSpecialDamage(CWnd* pParent = NULL); // standard constructor
void update_ship(int ship);
// Dialog Data
//{{AFX_DATA(ShipSpecialDamage)
+1 -2
View File
@@ -181,7 +181,7 @@ BOOL CShipTexturesDlg::OnInitDialog()
for (i=0; i<pm->n_textures; i++)
{
// get texture file name
bm_get_filename(pm->maps[i].base_map.original_texture, texture_file);
strcpy(texture_file, pm->original_maps[i].filename);
// skip blank textures
if (!strlen(texture_file))
@@ -379,7 +379,6 @@ void CShipTexturesDlg::swap_strings(char *str1, char *str2)
texture_replace *CShipTexturesDlg::texture_set(texture_replace *dest, const texture_replace *src)
{
dest->new_texture_id = src->new_texture_id;
strcpy(dest->ship_name, src->ship_name);
strcpy(dest->old_texture, src->old_texture);
strcpy(dest->new_texture, src->new_texture);
+1 -1
View File
@@ -124,7 +124,7 @@ BOOL starfield_editor::OnInitDialog()
CDialog::OnInitDialog();
theApp.init_window(&Starfield_wnd_data, this);
m_slider.SetRange(0, MAX_STARS);
m_slider.SetRange(100, MAX_STARS);
m_slider.SetPos(Num_stars);
sprintf(buf, "%d", Num_stars);
GetDlgItem(IDC_TOTAL)->SetWindowText(buf);
+142 -164
View File
@@ -1792,7 +1792,6 @@
#include "mission/missioncampaign.h"
#include "mission/missiongoals.h"
#include "mission/missionhotkey.h"
//#include "mission/missionlist.h"
#include "mission/missionload.h"
#include "mission/missionlog.h"
#include "mission/missionmessage.h"
@@ -1833,7 +1832,6 @@
#include "osapi/osregistry.h"
#include "parse/encrypt.h"
#include "parse/lua.h"
#include "parse/parselo.h"
#include "parse/scripting.h"
#include "parse/sexp.h"
#include "particle/particle.h"
@@ -1900,11 +1898,11 @@ extern int Om_tracker_flag; // needed for FS2OpenPXO config
// This function is defined in code\network\multiutil.cpp so will be linked from multiutil.obj
// it's required fro the -missioncrcs command line option - Kazan
void multi_spew_pxo_checksums(int max_files, char *outfile);
void fs2netd_spew_table_checksums(char *outfile);
void multi_spew_table_checksums(int max_files, char *outfile);
extern bool frame_rate_display;
bool cube_map_drawen = false;
bool Env_cubemap_drawn = false;
void game_reset_view_clip();
void game_reset_shade_frame();
@@ -2695,7 +2693,6 @@ void game_level_close()
mission_event_shutdown();
asteroid_level_close();
jumpnode_level_close();
// model_cache_reset(); // Reset/free all the model caching stuff
flak_level_close(); // unload flak stuff
neb2_level_close(); // shutdown gaseous nebula stuff
ct_level_close();
@@ -2705,9 +2702,22 @@ void game_level_close()
cameras_close();
subtitles_close();
trail_level_close();
mission_parse_level_close();
batch_reset();
audiostream_unpause_all();
Game_paused = 0;
if (gr_screen.envmap_render_target >= 0) {
if ( bm_release(gr_screen.envmap_render_target, 1) ) {
gr_screen.envmap_render_target = -1;
}
}
gr_set_ambient_light(120, 120, 120);
ENVMAP = Default_env_map;
}
uint load_gl_init;
@@ -2846,7 +2856,7 @@ void game_level_init(int seed)
// campaign wasn't ended
Campaign_ended_in_mission = 0;
cube_map_drawen = false;
Env_cubemap_drawn = false;
load_gl_init = time(NULL) - load_gl_init;
@@ -3217,6 +3227,9 @@ void game_post_level_init()
// Stuff which gets called after mission is loaded. Because player isn't created until
// after mission loads, some things must get initted after the level loads
extern void game_environment_map_gen();
game_environment_map_gen();
model_level_post_init();
HUD_init();
@@ -3259,6 +3272,8 @@ int game_start_mission()
{
mprintf(( "=================== STARTING LEVEL LOAD ==================\n" ));
int s1 = timer_get_milliseconds();
get_mission_info(Game_current_mission_filename, &The_mission, false);
if ( !(Game_mode & GM_STANDALONE_SERVER) )
@@ -3336,6 +3351,10 @@ int game_start_mission()
bm_print_bitmaps();
int e1 = timer_get_milliseconds();
printf("Level load took %f seconds.\n", (e1 - s1) / 1000.0f );
return 1;
}
@@ -3634,12 +3653,18 @@ void game_init()
#ifndef NDEBUG
#ifdef FS_VERSION_IDENT
mprintf(("FreeSpace version: %i.%i.%i (%s)\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD, FS_VERSION_IDENT));
#else
mprintf(("FreeSpace version: %i.%i.%i\n", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD));
#endif
extern void cmdline_debug_print_cmdline();
cmdline_debug_print_cmdline();
#endif
memset(whee, 0, sizeof(whee));
#ifdef APPLE_APP
// some OSX hackery to drop us out of the APP the binary is run from
char *c = NULL;
@@ -3672,10 +3697,11 @@ void game_init()
if (Is_standalone) {
// force off some cmdlines if they are on
Cmdline_nospec = 1;
Cmdline_noglow = 1;
Cmdline_spec = 0;
Cmdline_glow = 0;
Cmdline_env = 0;
Cmdline_3dwarp = 0;
Cmdline_normal = 0;
// now init the standalone server code
std_init_standalone();
@@ -3776,92 +3802,27 @@ void game_init()
// SOUND INIT END
/////////////////////////////
// check for hi res pack file
int has_sparky_hi = cf_exists_full("2_ChoosePilot-m.pcx", CF_TYPE_ANY);
if (!Is_standalone) {
int width = 640, height = 480, cdepth = 16, res = GR_640, mode = GR_OPENGL;
char Device_init_error[512];
bool is_640x480 = true; // default to 640x480 res
// We cannot continue without this, quit, but try to help the user out first
ptr = os_config_read_string(NULL, NOX("VideocardFs2open"), NULL);
// if we don't have a config string then construct one, using OpenGL 640x480 16-bit as the default
if (ptr == NULL) {
char Default_video_settings[] = "OGL -(640x480)x16 bit";
ptr = &Default_video_settings[0];
}
if(Cmdline_res != NULL) {
char Cmdline_video_settings[128];
sprintf(Cmdline_video_settings, "OGL -(%s)x16 bit", Cmdline_res);
ptr = &Cmdline_video_settings[0];
}
Assert( ptr != NULL );
// OpenGL should be default
mode = GR_OPENGL;
#ifndef NO_DIRECT3D
if ( !strncmp(ptr, NOX("D3D8"), 4) )
mode = GR_DIRECT3D;
#endif
// NOTE: The "ptr+5" is to skip over the initial "????-" in the video string.
// If the format of that string changes you'll have to change this too!!!
if ( sscanf(ptr+5, "(%dx%d)x%d ", &width, &height, &cdepth) != 3 ) {
strcpy(Device_init_error, "Can't understand 'VideocardFs2open' registry entry!");
goto VidInitError;
}
// if we are less than 1024x768 res then stay at low-res, otherwise bump it
is_640x480 = ( (width < 1024) && (height < 768) );
res = (!is_640x480 && has_sparky_hi) ? GR_1024 : GR_640;
#ifdef WIN32
// for Windows, we need to do this just before the gr_init() call
extern void win32_create_window(int width, int height);
win32_create_window( width, height );
#endif
gr_init(res, mode, cdepth, width, height);
VidInitError:
extern int Gr_inited;
if (!Gr_inited) {
if ( gr_init() == false ) {
#ifdef _WIN32
ClipCursor(NULL);
ShowCursor(TRUE);
ShowWindow((HWND)os_get_window(),SW_MINIMIZE);
MessageBox( NULL, Device_init_error, "Error intializing graphics", MB_OK|MB_TASKMODAL|MB_SETFOREGROUND );
run_launcher();
ClipCursor(NULL);
ShowCursor(TRUE);
ShowWindow((HWND)os_get_window(),SW_MINIMIZE);
MessageBox( NULL, "Error intializing graphics!", "Error", MB_OK|MB_TASKMODAL|MB_SETFOREGROUND );
run_launcher();
#elif defined(SCP_UNIX)
fprintf(stderr, "Error initializing graphics: %s\n\n", Device_init_error);
// the default entry should have been created already if it didn't exist, so if we're here then
// the current value is invalid and we need to replace it
os_config_write_string(NULL, NOX("VideocardFs2open"), NOX("OGL -(640x480)x16 bit"));
// courtesy
fprintf(stderr, "The default video entry is now in place. Please try running the game again...\n");
fprintf(stderr, "(edit ~/.fs2_open/fs2_open.ini to change from default resolution)\n");
#endif
exit(1);
return;
}
}
// we are standalone (ie, server mode)
else {
gr_init(GR_640, GR_STUB, 16, 640, 480);
}
fprintf(stderr, "Error initializing graphics!");
// this has to be set after gr_init() is done on *nix
os_set_title(Osreg_title);
// the default entry should have been created already if it didn't exist, so if we're here then
// the current value is invalid and we need to replace it
os_config_write_string(NULL, NOX("VideocardFs2open"), NOX("OGL -(1024x768)x16 bit"));
// courtesy
fprintf(stderr, "The default video entry is now in place. Please try running the game again...\n");
fprintf(stderr, "(edit ~/.fs2_open/fs2_open.ini to change from default resolution)\n");
#endif
exit(1);
return;
}
// Karajorma - Moved here from the sound init code cause otherwise windows complains
#ifdef FS2_VOICER
@@ -4169,18 +4130,20 @@ void game_show_framerate()
#endif
if (Show_framerate && HUD_draw) {
if (Show_framerate) {
gr_set_color_fast(&HUD_color_debug);
if (frametotal != 0.0f)
if (frametotal != 0.0f) {
gr_printf( 20, 100, "FPS: %0.1f", Framerate );
else
} else {
gr_string( 20, 100, "FPS: ?" );
}
}
#ifndef NDEBUG
if ( Debug_dump_frames )
if (Debug_dump_frames) {
return;
}
#endif
// possibly show control checking info
@@ -4191,7 +4154,7 @@ void game_show_framerate()
// MONITOR_INC(BmpNew, bitmaps_new_this_frame);
#ifdef _WIN32
if (Cmdline_show_stats && HUD_draw) {
if (Cmdline_show_stats) {
char mem_buffer[50];
#ifndef NO_DIRECT3D
@@ -4205,10 +4168,11 @@ void game_show_framerate()
GlobalMemoryStatus(&mem_stats);
// on win2k+, it should be == -1 if >4gig (indicates wrap around)
if ( ((int)Mem_starttime_phys == -1) || ((int)mem_stats.dwAvailPhys == -1) )
if ( ((int)Mem_starttime_phys == -1) || ((int)mem_stats.dwAvailPhys == -1) ) {
sprintf(mem_buffer, "Using Physical: *** (>4G)");
else
} else {
sprintf(mem_buffer,"Using Physical: %d Meg",(Mem_starttime_phys - mem_stats.dwAvailPhys)/1024/1024);
}
gr_string( 20, 120, mem_buffer);
sprintf(mem_buffer,"Using Pagefile: %d Meg",(Mem_starttime_pagefile - mem_stats.dwAvailPageFile)/1024/1024);
@@ -4216,10 +4180,11 @@ void game_show_framerate()
sprintf(mem_buffer,"Using Virtual: %d Meg",(Mem_starttime_virtual - mem_stats.dwAvailVirtual)/1024/1024);
gr_string( 20, 140, mem_buffer);
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) )
if ( ((int)mem_stats.dwAvailPhys == -1) || ((int)mem_stats.dwTotalPhys == -1) ) {
sprintf(mem_buffer, "Physical Free: *** / *** (>4G)");
else
} else {
sprintf(mem_buffer,"Physical Free: %d / %d Meg",mem_stats.dwAvailPhys/1024/1024, mem_stats.dwTotalPhys/1024/1024);
}
gr_string( 20, 160, mem_buffer);
sprintf(mem_buffer,"Pagefile Free: %d / %d Meg",mem_stats.dwAvailPageFile/1024/1024, mem_stats.dwTotalPageFile/1024/1024);
@@ -4230,8 +4195,7 @@ void game_show_framerate()
#endif
#ifndef NDEBUG
if ( Show_cpu == 1 ) {
if (Show_cpu == 1) {
int sx,sy,dy;
sx = 530;
sy = 15;
@@ -4262,7 +4226,6 @@ void game_show_framerate()
sy += dy;
{
extern int Num_pairs; // Number of object pairs that were checked.
gr_printf( sx, sy, NOX("PAIRS: %d"), Num_pairs );
sy += dy;
@@ -4271,13 +4234,12 @@ void game_show_framerate()
gr_printf( sx, sy, NOX("FVI: %d"), Num_pairs_checked );
sy += dy;
Num_pairs_checked = 0;
}
gr_printf( sx, sy, NOX("Snds: %d"), snd_num_playing() );
sy += dy;
if ( Timing_total > 0.01f ) {
if (Timing_total > 0.01f) {
gr_printf( sx, sy, NOX("CLEAR: %.0f%%"), Timing_clear*100.0f/Timing_total );
sy += dy;
gr_printf( sx, sy, NOX("REND2D: %.0f%%"), Timing_render2*100.0f/Timing_total );
@@ -4291,8 +4253,7 @@ void game_show_framerate()
}
}
if ( Show_mem ) {
if (Show_mem) {
int sx,sy,dy;
sx = (gr_screen.res == GR_1024) ? 870 : 530;
sy = 15;
@@ -4323,7 +4284,7 @@ void game_show_framerate()
#endif
#ifndef NO_DIRECT3D
if ( gr_screen.mode == GR_DIRECT3D ) {
if (gr_screen.mode == GR_DIRECT3D) {
extern int D3D_textures_in;
gr_printf( sx, sy, NOX("VRAM: %d KB\n"), (D3D_textures_in)/1024 );
sy += dy;
@@ -4338,7 +4299,7 @@ void game_show_framerate()
}
if ( Show_player_pos ) {
if (Show_player_pos) {
int sx, sy;
sx = 320;
sy = 100;
@@ -4395,7 +4356,7 @@ void game_show_framerate()
void game_show_eye_pos(vec3d *eye_pos, matrix* eye_orient)
{
if ( !Cmdline_show_pos && HUD_draw )
if(!Cmdline_show_pos)
return;
//Do stuff
@@ -4977,17 +4938,19 @@ void say_view_target()
if (!(Game_mode & GM_DEAD_DIED) && ((Game_mode & (GM_DEAD_BLEW_UP)) || ((Last_view_target != NULL) && (Last_view_target != view_target)))) {
if (view_target != Player_obj){
char view_target_name[128] = "";
char *view_target_name = NULL;
switch(Objects[Player_ai->target_objnum].type) {
case OBJ_SHIP:
strcpy(view_target_name, Ships[Objects[Player_ai->target_objnum].instance].ship_name);
view_target_name = Ships[Objects[Player_ai->target_objnum].instance].ship_name;
break;
case OBJ_WEAPON:
strcpy(view_target_name, Weapon_info[Weapons[Objects[Player_ai->target_objnum].instance].weapon_info_index].name);
view_target_name = Weapon_info[Weapons[Objects[Player_ai->target_objnum].instance].weapon_info_index].name;
Viewer_mode &= ~VM_OTHER_SHIP;
break;
case OBJ_JUMP_NODE: {
strcpy(view_target_name, XSTR( "jump node", 184));
char jump_node_name[128];
strcpy(jump_node_name, XSTR( "jump node", 184));
view_target_name = jump_node_name;
Viewer_mode &= ~VM_OTHER_SHIP;
break;
}
@@ -4997,7 +4960,6 @@ void say_view_target()
break;
}
end_string_at_first_hash_symbol(view_target_name);
if ( view_target_name ) {
HUD_fixed_printf(0.0f, XSTR( "Viewing %s%s\n", 185), (Viewer_mode & VM_OTHER_SHIP) ? XSTR( "from ", 186) : "", view_target_name);
Show_viewing_from_self = 1;
@@ -5052,7 +5014,7 @@ float get_shake(float intensity, int decay_time, int max_decay_time)
{
int r = myrand();
float shake = intensity * (float) (r-RAND_MAX_2)/RAND_MAX;
float shake = intensity * (float)(r-RAND_MAX_2) * RAND_MAX_1f;
if (decay_time >= 0) {
Assert(max_decay_time > 0);
@@ -5136,7 +5098,7 @@ vec3d Dead_player_last_vel = { { { 1.0f, 1.0f, 1.0f } } };
extern float View_zoom;
inline void render_environment(int i, vec3d *eye_pos, matrix *new_orient, float new_zoom)
{
bm_set_render_target( (Game_subspace_effect) ? gr_screen.dynamic_environment_map : gr_screen.static_environment_map, i);
bm_set_render_target(gr_screen.envmap_render_target, i);
gr_clear();
@@ -5167,14 +5129,14 @@ void setup_environment_mapping(vec3d *eye_pos, matrix *eye_orient)
// prefer the mission specified envmap over the static-generated envmap, but
// the dynamic envmap should always get preference if in a subspace mission
if ( !Game_subspace_effect && strlen(The_mission.envmap_name) ) {
if ( !Dynamic_environment && strlen(The_mission.envmap_name) ) {
ENVMAP = bm_load(The_mission.envmap_name);
if (ENVMAP >= 0)
return;
}
if ( (Game_subspace_effect && (gr_screen.dynamic_environment_map < 0)) || (!Game_subspace_effect && (gr_screen.static_environment_map < 0)) ) {
if (gr_screen.envmap_render_target < 0) {
if (ENVMAP >= 0)
return;
@@ -5190,7 +5152,7 @@ void setup_environment_mapping(vec3d *eye_pos, matrix *eye_orient)
return;
}
ENVMAP = (Game_subspace_effect) ? gr_screen.dynamic_environment_map : gr_screen.static_environment_map;
ENVMAP = gr_screen.envmap_render_target;
/*
Envmap matrix setup -- left-handed
@@ -5259,6 +5221,37 @@ void setup_environment_mapping(vec3d *eye_pos, matrix *eye_orient)
g3_set_view_matrix( eye_pos, eye_orient, old_zoom );
}
// setup the render target ready for this mission's environment map
void game_environment_map_gen()
{
const int size = 512;
int gen_flags = (BMP_FLAG_RENDER_TARGET_STATIC | BMP_FLAG_CUBEMAP);
if ( !Cmdline_env ) {
return;
}
if (gr_screen.envmap_render_target >= 0) {
if ( !bm_release(gr_screen.envmap_render_target, 1) ) {
Int3();
}
gr_screen.envmap_render_target = -1;
}
if ( Dynamic_environment || (The_mission.flags & MISSION_FLAG_SUBSPACE) ) {
Dynamic_environment = true;
gen_flags &= ~BMP_FLAG_RENDER_TARGET_STATIC;
gen_flags |= BMP_FLAG_RENDER_TARGET_DYNAMIC;
}
// bail if we are going to be static, and have an envmap specified already
else if ( strlen(The_mission.envmap_name) ) {
return;
}
gr_screen.envmap_render_target = bm_make_render_target(size, size, gen_flags);
}
int Scripting_didnt_draw_hud = 1;
// Set eye_pos and eye_orient based on view mode.
@@ -5584,9 +5577,12 @@ void game_render_frame( vec3d *eye_pos, matrix *eye_orient )
}
// this needs to happen after g3_start_frame() and before the primary projection and view matrix is setup
if ( Cmdline_env && (!cube_map_drawen || Game_subspace_effect) ) {
if ( Cmdline_env && !Env_cubemap_drawn ) {
setup_environment_mapping(eye_pos, eye_orient);
cube_map_drawen = true;
if ( !Dynamic_environment ) {
Env_cubemap_drawn = true;
}
}
#ifndef DYN_CLIP_DIST
@@ -6423,7 +6419,7 @@ void game_frame(int paused)
popupdead_start();
}
}
}
}
DEBUG_GET_TIME( render3_time2 )
DEBUG_GET_TIME( render2_time1 )
@@ -7940,7 +7936,7 @@ void game_leave_state( int old_state, int new_state )
}
break;
case GS_STATE_MULTI_MISSION_SYNC:
case GS_STATE_MULTI_MISSION_SYNC:
common_select_close();
// if we're moving into the options menu we don't need to do anything else
@@ -7992,7 +7988,7 @@ void game_leave_state( int old_state, int new_state )
multi_ingame_select_close();
break;
case GS_STATE_INITIAL_PLAYER_SELECT:
case GS_STATE_INITIAL_PLAYER_SELECT:
player_select_close();
break;
@@ -8055,6 +8051,7 @@ void game_enter_state( int old_state, int new_state )
#if defined(PRESS_TOUR_BUILD) || defined(PD_BUILD)
mht_init();
#else
Assert( Player != NULL );
main_hall_init(Player->main_hall);
#endif
break;
@@ -9019,6 +9016,7 @@ DCF(pofspew, "")
game_spew_pof_info();
}
// returns:
// 0 on an error
// 1 on a clean exit
@@ -9104,7 +9102,7 @@ int game_main(char *cmdline)
multi_spew_pxo_checksums(1024, "mission_crcs.txt");
if (Cmdline_spew_table_crcs) {
fs2netd_spew_table_checksums("table_crcs.txt");
multi_spew_table_checksums(50, "table_crcs.txt");
}
game_shutdown();
@@ -9113,7 +9111,7 @@ int game_main(char *cmdline)
if (Cmdline_spew_table_crcs) {
fs2netd_spew_table_checksums("table_crcs.txt");
multi_spew_table_checksums(50, "table_crcs.txt");
game_shutdown();
return 0;
}
@@ -9263,7 +9261,8 @@ int main(int argc, char *argv[])
DBUGFILE_INIT();
// create user's directory
// create user's directory
memset(userdir, 0, sizeof(userdir));
snprintf(userdir, MAX_PATH - 1, "%s/%s/", detect_home(), Osreg_user_dir);
_mkdir(userdir);
@@ -9567,12 +9566,15 @@ void game_render_mouse(float frametime)
am = &Animating_mouse;
if ( am->first_frame != -1 ) {
mouse_get_pos(&mx, &my);
am->elapsed_time += frametime;
am->current_frame = fl2i( ( am->elapsed_time / am->time ) * (am->num_frames-1) );
if ( am->current_frame >= am->num_frames ) {
am->current_frame = 0;
am->elapsed_time = 0.0f;
}
gr_set_cursor_bitmap(am->first_frame + am->current_frame);
}
}
@@ -9857,13 +9859,11 @@ void Time_model( int modelnum )
int i;
for (i=0; i<pm->n_textures; i++ ) {
char filename[1024];
ubyte pal[768];
int bmp_num = pm->maps[i].base_map.original_texture;
int bmp_num = pm->maps[i].base_map.texture;
if ( bmp_num > -1 ) {
bm_get_palette(pm->maps[i].base_map.original_texture, pal, filename );
int w,h;
bm_get_info( pm->maps[i].base_map.original_texture,&w, &h );
int w, h;
bm_get_info( pm->maps[i].base_map.texture, &w, &h );
if ( (w > 512) || (h > 512) ) {
@@ -10064,27 +10064,16 @@ void get_version_string(char *str, int max_size)
Assert( max_size > 6 );
if ( FS_VERSION_BUILD == 0 ) {
sprintf(str,"FreeSpace 2 Open v%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR);
sprintf(str, "FreeSpace 2 Open v%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR);
} else {
sprintf(str,"FreeSpace 2 Open v%d.%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
sprintf(str, "FreeSpace 2 Open v%d.%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
}
/*
// Goober5000 - although this is cool, it's a bit redundant
// append the CVS "release" version in the $Name variable, but
// only do this if it's been tagged
int rcs_name_len = strlen(RCS_Name);
if (rcs_name_len > 11)
{
char buffer[100];
strcpy(buffer, RCS_Name + 7);
buffer[rcs_name_len-9] = 0;
SAFE_STRCAT( str, " ", max_size );
SAFE_STRCAT( str, buffer, max_size );
}
*/
#ifdef FS_VERSION_IDENT
SAFE_STRCAT( str, " (", max_size );
SAFE_STRCAT( str, FS_VERSION_IDENT, max_size );
SAFE_STRCAT( str, ")", max_size );
#endif
#ifdef INF_BUILD
SAFE_STRCAT( str, " Inferno", max_size );
@@ -10098,6 +10087,7 @@ void get_version_string(char *str, int max_size)
SAFE_STRCAT( str, " Debug", max_size );
#endif
/* This is obsolete now, so don't bother - taylor
// Lets get some more info in here
switch(gr_screen.mode)
{
@@ -10108,7 +10098,7 @@ void get_version_string(char *str, int max_size)
case GR_OPENGL:
SAFE_STRCAT( str, " OpenGL", max_size );
break;
}
}*/
if (Cmdline_nohtl)
SAFE_STRCAT( str, " non-HT&L", max_size );
@@ -10374,16 +10364,6 @@ void demo_upsell_next_screen()
} else {
Demo_upsell_show_next_bitmap_time = timer_get_milliseconds() + DEMO_UPSELL_SCREEN_DELAY;
}
/*
if ( Demo_upsell_screen_number < NUM_DEMO_UPSELL_SCREENS ) {
if ( Demo_upsell_bitmap_filenames[gr_screen.res][Demo_upsell_screen_number] >= 0 ) {
#ifndef HARDWARE_ONLY
palette_use_bm_palette(Demo_upsell_bitmaps[gr_screen.res][Demo_upsell_screen_number]);
#endif
}
}
*/
}
void demo_upsell_load_bitmaps()
@@ -11221,7 +11201,6 @@ int game_hacked_data()
return 1;
}
if ( Om_tracker_flag && !(Hacked_data_check_ready) ) {
// this may fail the first time or two
if ( (rc = fs2netd_update_valid_tables()) != -1 ) {
@@ -11236,7 +11215,6 @@ int game_hacked_data()
Hacked_data = true;
}
return (int)Hacked_data;
}
+124 -147
View File
@@ -46,8 +46,7 @@
#include "graphics/font.h"
#include "globalincs/alphacolors.h"
#include "network/multi_options.h"
#include "cmdline/cmdline.h"
#include "cfile/cfilesystem.h"
#include "gamesequence/gamesequence.h"
#ifdef WIN32
//#include <windows.h>
@@ -105,25 +104,25 @@ char Multi_fs_tracker_filter[MAX_PATH] = "";
void fs2netd_options_config_init()
{
if ( !strlen(Multi_options_g.game_tracker_ip) ) {
// if ( !strlen(Multi_options_g.game_tracker_ip) ) {
ml_printf("FS2NetD MSG: Address for game tracker not specified, using default instead (%s).", FS2NETD_DEFAULT_SERVER);
strncpy( Multi_options_g.game_tracker_ip, FS2NETD_DEFAULT_SERVER, MULTI_OPTIONS_STRING_LEN );
}
// }
if ( !strlen(Multi_options_g.user_tracker_ip) ) {
// if ( !strlen(Multi_options_g.user_tracker_ip) ) {
ml_printf("FS2NetD MSG: Address for user tracker not specified, using default instead (%s).", FS2NETD_DEFAULT_SERVER);
strncpy( Multi_options_g.user_tracker_ip, FS2NETD_DEFAULT_SERVER, MULTI_OPTIONS_STRING_LEN );
}
// }
if ( !strlen(Multi_options_g.tracker_port) ) {
// if ( !strlen(Multi_options_g.tracker_port) ) {
ml_printf("FS2NetD MSG: Port for game/user trackers not specified, using default instead (%u).", FS2NETD_DEFAULT_PORT);
strncpy( Multi_options_g.tracker_port, FS2NETD_DEFAULT_PORT, STD_NAME_LEN );
}
// }
if ( !strlen(Multi_options_g.pxo_ip) ) {
// if ( !strlen(Multi_options_g.pxo_ip) ) {
ml_printf("FS2NetD MSG: Address for chat server not specified, using default instead (%s).", FS2NETD_DEFAULT_CHAT_SERVER);
strncpy( Multi_options_g.pxo_ip, FS2NETD_DEFAULT_CHAT_SERVER, MULTI_OPTIONS_STRING_LEN );
}
// }
if ( !strlen(Multi_options_g.pxo_banner_url) ) {
ml_printf("FS2NetD MSG: URL for banners not specified, using default instead (%s).", FS2NETD_DEFAULT_BANNER_URL);
@@ -394,6 +393,7 @@ void fs2netd_do_frame()
ubyte pid = 0;
int itemp;
static fix NextPing = -1;
static fix NextHolePunch = -1;
static fix GotPong = -1;
bool reset = false;
@@ -427,6 +427,7 @@ void fs2netd_do_frame()
PXO_SID = -1;
NextHeartBeat = -1;
NextHolePunch = -1;
NextPing = -1;
GotPong = -1;
@@ -472,6 +473,7 @@ void fs2netd_do_frame()
PXO_SID = -1;
NextHeartBeat = -1;
NextHolePunch = -1;
NextPing = -1;
GotPong = -1;
@@ -496,6 +498,49 @@ void fs2netd_do_frame()
// handle server heart beats
fs2netd_server_send_heartbeat();
/*
// send out UDP hole punch updates
// we only do this sparingly however, with the updates being sent:
// - every 15 seconds when at the lobby or game start screens
// - and a simple refresh every 5 minutes otherwise
if ( (NextHolePunch == -1) || (timer_get_fixed_seconds() >= NextHolePunch) ) {
int hp_timeout = 300;
switch ( gameseq_get_state() ) {
case GS_STATE_MULTI_JOIN_GAME:
case GS_STATE_MULTI_START_GAME:
case GS_STATE_PXO:
case GS_STATE_PXO_HELP:
hp_timeout = 15;
break;
}
NextHolePunch = timer_get_fixed_seconds() + (hp_timeout * F1_0);
UDP_hole_punch_data *cur = Net_player->hole_punch_data;
while (cur != NULL) {
if (cur->state == UDP_HOLE_PUNCH_STATE_DONE) {
UDP_hole_punch_data *prev = Net_player->hole_punch_data;
while (prev->next != cur) {
prev = prev->next;
}
cur = prev->next = cur->next;
continue;
}
send_udp_hole_punch(cur->ip, cur->port, cur->state);
ml_printf("FS2NetD Info: Sent UDP hole punch to '%s'", cur->ip);
cur = cur->next;
}
}
*/
// Check for GWall messages - ping replies, etc
if ( (rc = FS2NetD_GetData(buffer, sizeof(buffer))) != -1 ) {
@@ -605,8 +650,6 @@ void fs2netd_do_frame()
Logged_in = false;
PXO_SID = -1;
}
break;
}
default: {
@@ -769,99 +812,6 @@ int fs2netd_load_servers()
return 0;
}
static char Chk_mission_name[NAME_LENGTH+1];
static uint Chk_mission_crc = 0;
int fs2netd_check_mission_do()
{
if (timeout == -1) {
timeout = timer_get_fixed_seconds() + (15 * F1_0);
}
// if timeout passes then bail on stats failure
if ( timer_get_fixed_seconds() > timeout ) {
timeout = -1;
return 4;
}
int rescode = FS2NetD_CheckSingleMission(Chk_mission_name, Chk_mission_crc, do_full_packet);
do_full_packet = 0;
if (rescode) {
timeout = -1;
return rescode;
}
return 0;
}
bool fs2netd_check_mission(char *mission_name)
{
int rc = 0;
// don't bother with this if we aren't on FS2NetD
if ( !Om_tracker_flag ) {
return 0;
}
if ( !(Game_mode & GM_MULTIPLAYER) ) {
return 0;
}
if ( !Is_connected ) {
return 0;
}
strcpy(Chk_mission_name, mission_name);
cf_chksum_long(Chk_mission_name, &Chk_mission_crc);
do_full_packet = 1;
In_process = true;
if (Is_standalone) {
do { rc = fs2netd_check_mission_do(); } while (!rc);
} else {
rc = popup_till_condition(fs2netd_check_mission_do, XSTR("&Cancel", 779), XSTR("Sending stats...", -1));
}
In_process = false;
switch (rc) {
// operation canceled, or invalid
case 0:
return false;
// successful, but invalid
case 1:
return false;
// successful and valid
case 2:
return true;
// failed to send request packet
case 3:
if ( !Is_standalone ) {
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Server request failed!", -1));
}
return false;
// it timed out
case 4:
if ( !Is_standalone ) {
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Server request timed out!", -1));
}
return false;
}
return false;
}
void fs2netd_debrief_init()
{
if ( !(Game_mode & GM_MULTIPLAYER) ) {
@@ -877,7 +827,12 @@ void fs2netd_debrief_init()
}
bool mValidStatus = fs2netd_check_mission(Netgame.mission_name);
uint CurrentMissionChsum;
bool mValidStatus = false;
cf_chksum_long(Netgame.mission_name, &CurrentMissionChsum);
mValidStatus = FS2NetD_CheckSingleMission(Netgame.mission_name, CurrentMissionChsum);
if ( ((multi_num_players() > 1) || (Multi_num_players_at_start > 1)) && !game_hacked_data() && mValidStatus ) {
// verify that we are logged in before doing anything else
@@ -1418,15 +1373,12 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
strncpy( new_plr.callsign, callsign, CALLSIGN_LEN );
memset( out_plr, 0, sizeof(player) );
timeout = timer_get_fixed_seconds() + (30 * F1_0);
}
int rc = FS2NetD_GetPlayerData(-2, callsign, &new_plr, false, (int)first_call );
// some sort of failure
if (rc > 0) {
timeout = -1;
return -2;
}
@@ -1434,12 +1386,6 @@ int fs2netd_get_pilot_info(const char *callsign, player *out_plr, bool first_cal
memcpy( out_plr, &new_plr, sizeof(player) );
}
// if timeout passes then bail on failure
if ( timer_get_fixed_seconds() > timeout ) {
timeout = -1;
return -2;
}
// we should only be returning -1 (processing) or 0 (got data successfully)
return rc;
}
@@ -1493,50 +1439,81 @@ void fs2netd_update_game_count(char *chan_name)
FS2NetD_GameCountUpdate(chan_name);
}
void fs2netd_spew_table_checksums(char *outfile)
void fs2netd_udp_hole_punch()
{
char full_name[MAX_PATH_LEN];
int count, idx;
FILE *out = NULL;
char modname[128];
time_t my_time = 0;
if ( Table_valid_status.empty() ) {
/* // don't bother with this if we aren't on FS2NetD
if ( !Om_tracker_flag ) {
return;
}
cf_create_default_path_string(full_name, sizeof(full_name) - 1, CF_TYPE_ROOT, outfile);
// open the outfile
out = fopen(full_name, "wt");
if (out == NULL) {
if ( !Is_connected ) {
return;
}
memset( modname, 0, sizeof(modname) );
strcpy( modname, Cmdline_spew_table_crcs );
server_item *cur = Game_server_head;
char ip[16];
int i = 0;
my_time = time(NULL);
fprintf(out, "-- Table CRCs generated on %s \n", ctime(&my_time));
// give them a second to respond normally.
fix end_time = timer_get_fixed_seconds() + F1_0;
fprintf(out, "LOCK TABLES `fstables` WRITE;\n");
fprintf(out, "INSERT INTO `fstables` VALUES ");
while ( timer_get_fixed_seconds() <= end_time ) {
multi_do_frame();
}
count = (int)Table_valid_status.size();
// do all the checksums
for (idx = 0; idx < count; idx++) {
if (idx == 0) {
fprintf(out, "('%s',%u,'%s')", Table_valid_status[idx].name, Table_valid_status[idx].crc32, modname);
} else {
fprintf(out, ",('%s',%u,'%s')", Table_valid_status[idx].name, Table_valid_status[idx].crc32, modname);
do {
i++;
cur = cur->next;
} while (cur != Game_server_head);
// if everyone is counted then just bail
if (i == Active_game_count) {
ml_printf("FS2NetD Info: (UDP hole-punch) All servers responding.");
return;
}
// check every server.
do {
bool has_responded = false;
// this is only for TCP connections (which should always be the case for us anyway)
if (cur->server_addr.type != NET_TCP) {
continue;
}
}
fprintf(out, ";\n");
fprintf(out, "UNLOCK TABLES;\n");
// see if this server has responded normally.
if ( Active_game_count > 0 ) {
active_game *agcur = Active_game_head;
fclose(out);
do {
// Check if they're equal.
if ( (agcur->server_addr.port == cur->server_addr.port) &&
memcmp(agcur->server_addr.addr, cur->server_addr.addr, 4) )
{
has_responded = true;
break;
}
agcur = agcur->next;
} while (agcur != Active_game_head);
}
if (has_responded) {
cur = cur->next;
continue;
}
memset(ip, 0, sizeof(ip));
psnet_addr_to_string(ip, &cur->server_addr);
ml_printf("FS2NetD Info: (UDP hole-punch) Requesting response from %s", ip);
FS2NetD_UDPHolePunch(ip);
cur = cur->next;
} while (cur != Game_server_head);*/
}
+2
View File
@@ -65,4 +65,6 @@ void fs2netd_add_table_validation(char *tblname);
void fs2netd_update_chat_channel();
void fs2netd_update_game_count(char *chan_name);
void fs2netd_udp_hole_punch();
#endif // _FS2NETD_CLIENT_H
+1
View File
@@ -101,6 +101,7 @@
#define PCKT_CHAT_CHAN_COUNT_REPLY 0x19
#define PCKT_SLIST_HB_2 0x1a
#define PCKT_SLIST_DISCONNECT 0x1b
#define PCKT_UDP_HOLE_PUNCH_RQST 0x1c
//***********************************************************************************************************************
+25 -7
View File
@@ -175,7 +175,7 @@
extern std::vector<crc_valid_status> Table_valid_status;
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout)
bool FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout)
{
int rc, buffer_size, buffer_offset;
bool my_packet = false;
@@ -197,7 +197,7 @@ int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout)
DONE_PACKET();
if ( FS2NetD_SendData(buffer, buffer_size) == -1 )
return 3;
return false;
Recieve_Only:
@@ -207,12 +207,12 @@ Recieve_Only:
if ( (rc = FS2NetD_GetData(buffer, sizeof(buffer))) != -1 ) {
if (rc < BASE_PACKET_SIZE)
return 0;
return false;
VRFY_PACKET2( PCKT_MCHECK_REPLY );
if (!my_packet)
return 0;
return false;
PXO_GET_DATA( status );
Assert( (status == 0) || (status == 1) );
@@ -220,11 +220,9 @@ Recieve_Only:
// anything beyond 'true' is considered a failure of some kind
if (status > 1)
status = 0;
return status+1;
}
return 0;
return (status == 1);
}
int FS2NetD_SendPlayerData(int SID, const char *player_name, const char *user, player *pl, int timeout)
@@ -1027,3 +1025,23 @@ void FS2NetD_GameCountUpdate(char *chan_name)
FS2NetD_SendData(buffer, buffer_size);
}
void FS2NetD_UDPHolePunch(char *ip_string)
{
int buffer_size;
char buffer[BASE_PACKET_SIZE+40];
Assert( ip_string );
// Clear any old dead crap data
FS2NetD_IgnorePackets();
// (fs2open_ping)
INIT_PACKET( PCKT_UDP_HOLE_PUNCH_RQST );
PXO_ADD_STRING( ip_string );
DONE_PACKET();
FS2NetD_SendData(buffer, buffer_size);
}
+2 -1
View File
@@ -96,7 +96,7 @@ struct netgame_info;
int FS2NetD_SendPlayerData(int SID, const char* player_name, const char* user, player *pl, int timeout = 15);
int FS2NetD_GetPlayerData(int SID, const char* player_name, player *pl, bool CanCreate = false, int timeout = 15);
int FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout = 15);
bool FS2NetD_CheckSingleMission(const char *m_name, uint crc32, int timeout = 15);
int FS2NetD_CheckValidSID(int SID);
int FS2NetD_GetServerList(int timeout = 15);
void FS2NetD_Ping();
@@ -107,6 +107,7 @@ void FS2NetD_Pong(int tstamp);
int FS2NetD_ValidateTableList(int timeout = 30);
void FS2NetD_ChatChannelUpdate(char *chan_name);
void FS2NetD_GameCountUpdate(char *chan_name);
void FS2NetD_UDPHolePunch(char *ip_string);
fs2open_banmask *FS2NetD_GetBanList(int *numBanMasks, int timeout = 15);
// longer timeouts - mySQL operations
-8
View File
@@ -771,14 +771,6 @@ $Player Shield Recharge Scale: 4, 2, 1.5, 1.25, 1 \n\
;; factor applied to the speed at which the player's weapons recharge \n\
$Player Weapon Recharge Scale: 10, 4, 2.5, 2, 1.5 \n\
\n\
;; maximum number of turrets on one ship allowed to be attacking a \n\
;; target at a given time \n\
$Max Turret Target Ownage: 3, 4, 7, 12, 19 \n\
\n\
;; maximum number of turrets on one ship allowed to be attacking the \n\
;; player at a given time \n\
$Max Turret Player Ownage: 3, 4, 7, 12, 19 \n\
\n\
\n\
;; General AI-related flags. These were previously all lumped together \n\
;; under the New AI mission flag. \n\
+25 -38
View File
@@ -511,8 +511,6 @@ typedef unsigned int uint;
typedef unsigned long ulong;
#define HARDWARE_ONLY
//Stucture to store clipping codes in a word
typedef struct ccodes {
ubyte cc_or, cc_and; //or is low byte, and is high byte
@@ -525,29 +523,14 @@ typedef struct vec3d {
struct {
float x,y,z;
} xyz;
float a1d[3];
};
inline void operator= (vertex&vert);
inline void set_screen_vert(vertex&vert);
inline void operator= (vertex &vert);
inline void set_screen_vert(vertex &vert);
} vec3d;
/*
// A vector referenced as an array
typedef struct vectora {
float xyz[3];
} vectora;
typedef struct vec2d {
float i,j;
} vec2d;
// Used for some 2d primitives, like gr_poly
typedef struct vert2df {
float x, y;
} vert2df;
*/
typedef struct angles {
float p, b, h;
} angles_t;
@@ -557,38 +540,41 @@ typedef struct matrix {
struct {
vec3d rvec, uvec, fvec;
} vec;
float a2d[3][3];
float a1d[9];
};
} matrix;
typedef struct uv_pair {
float u,v;
float u, v;
} uv_pair;
// Used to store rotated points for mines.
// Has flag to indicate if projected.
typedef struct vertex {
float x, y, z; // world space position
float sx, sy, sw; // screen space position (sw == 1/z)
float u, v, u2, v2, u3, v3, u4, v4; // texture position
vec3d real_pos; // _real_ world position
ubyte spec_a, spec_r, spec_b, spec_g; //specular highlights -Bobboau
ubyte r, g, b, a; // color. Use b for darkening;
ubyte codes; // what sides of view pyramid this point is on/off. 0 = Inside view pyramid.
ubyte flags; // Projection flags. Indicates whether it is projected or not or if projection overflowed.
ubyte pad[2]; // pad structure to be 4 byte aligned.
void operator=(vec3d&vec){
memcpy(&x,&vec, sizeof(vec3d));
}
float x, y, z; // world space position
float sx, sy, sw; // screen space position (sw == 1/z)
float u, v; //, u2, v2, u3, v3, u4, v4; // texture position
vec3d real_pos; // _real_ world position
ubyte spec_a, spec_r, spec_b, spec_g; //specular highlights -Bobboau
ubyte r, g, b, a; // color. Use b for darkening;
ubyte codes; // what sides of view pyramid this point is on/off. 0 = Inside view pyramid.
ubyte flags; // Projection flags. Indicates whether it is projected or not or if projection overflowed.
ubyte pad[2]; // pad structure to be 4 byte aligned.
void operator= (vec3d &vec) { memcpy(&x, &vec, sizeof(vec3d)); }
} vertex;
inline void vec3d::operator= (vertex&vert){
memcpy(this,&vert.x,sizeof(vec3d));
inline void vec3d::operator= (vertex &vert)
{
memcpy(this, &vert.x, sizeof(vec3d));
}
//set the vector to the vertex screen position
inline void vec3d::set_screen_vert(vertex&vert){
memcpy(this,&vert.sx,sizeof(vec3d));
inline void vec3d::set_screen_vert(vertex &vert)
{
memcpy(this, &vert.sx, sizeof(vec3d));
}
//def_list
@@ -684,6 +670,7 @@ const float PI2 = (PI*2.0f);
// half values
const float PI_2 = (PI/2.0f);
const int RAND_MAX_2 = (RAND_MAX/2);
const float RAND_MAX_1f = (1.0f / RAND_MAX);
#define ANG_TO_RAD(x) ((x)*PI/180)
+9 -5
View File
@@ -290,11 +290,15 @@ int Interface_last_tick = -1; // last timer tick on flip
char Processing_filename[MAX_PATH_LEN];
#endif
// If true, then we are using Direct3D hardware. This is used for game type stuff
// that changes when you're using hardware.
int D3D_enabled = 0;
// for OGL
int OGL_enabled = 0;
// override states to skip rendering of certain elements, but without disabling them completely
bool Basemap_override = false;
bool Envmap_override = false;
bool Specmap_override = false;
bool Normalmap_override = false;
bool Heightmap_override = false;
bool Glowpoint_override = false;
bool GLSL_override = false;
// Values used for noise for thruster animations
float Noise[NOISE_NUM_FRAMES] = {
+8 -5
View File
@@ -366,12 +366,15 @@ extern int Interface_last_tick; // last timer tick on flip
// Noise numbers go from 0 to 1.0
extern float Noise[NOISE_NUM_FRAMES];
// override states to skip rendering of certain elements, but without disabling them completely
extern bool Basemap_override;
extern bool Envmap_override;
extern bool Specmap_override;
extern bool Normalmap_override;
extern bool Heightmap_override;
extern bool Glowpoint_override;
extern bool GLSL_override;
// If true, then we are using Direct3D hardware. This is used for game type stuff
// that changes when you're using hardware.
extern int D3D_enabled;
// for OGL
extern int OGL_enabled;
// game skill levels
#define NUM_SKILL_LEVELS 5
+4 -3
View File
@@ -169,9 +169,10 @@
// the first version is 3.0 :-)
// Major.Minor.Bugfix
#define FS_VERSION_MAJOR 3 // major version
#define FS_VERSION_MINOR 6 // increase by 1 for minor revs
#define FS_VERSION_BUILD 10 // bugfix release
#define FS_VERSION_MAJOR 3 // major version
#define FS_VERSION_MINOR 6 // increase by 1 for minor revs
#define FS_VERSION_BUILD 10 // bugfix release
#define FS_VERSION_IDENT NOX("Xt-0314") // special build release identifier, must be a string (don't define unless it's supposed to be used!!)
#define VERSION_LOC_FNAME "version.nfo"
#define MOTD_LOC_FNAME "motd.txt"
+1 -1
View File
@@ -1231,7 +1231,7 @@ void _cdecl Warning( char *filename, int line, const char *format, ... )
memset( AssertText2, 0, sizeof(AssertText2) );
va_start(args, format);
vsprintf(AssertText1, format, args);
vsnprintf(AssertText1, sizeof(AssertText1) - 1, format, args);
va_end(args);
slen = strlen(AssertText1);
+417 -405
View File
File diff suppressed because it is too large. Load diff
+66 -89
View File
@@ -797,19 +797,26 @@ typedef struct color {
} color;
typedef struct tsb_t {
vec3d tangent;
float scaler;
} tsb_t;
// this should be basicly just like it is in the VB
// a list of triangles and their associated normals
struct poly_list {
poly_list(): n_prim(0), n_verts(0), vert(NULL), norm(NULL), currently_allocated(0) {}
poly_list(): n_prim(0), n_verts(0), vert(NULL), norm(NULL), tsb(NULL), currently_allocated(0) {}
~poly_list();
poly_list& operator = (poly_list&);
void allocate(int size);
void make_index_buffer();
void calculate_tangent();
int n_prim;
int n_verts;
vertex *vert;
vec3d *norm;
tsb_t *tsb;
private:
int currently_allocated;
@@ -874,8 +881,6 @@ typedef struct screen {
int clip_left, clip_right, clip_top, clip_bottom;
// same as above except in 1024x768 or 640x480 dimensions
int clip_left_unscaled, clip_right_unscaled, clip_top_unscaled, clip_bottom_unscaled;
// center of clip area
float clip_center_x, clip_center_y;
int current_alphablend_mode; // See GR_ALPHABLEND defines above
int current_bitblt_mode; // See GR_BITBLT_MODE defines above
@@ -889,12 +894,11 @@ typedef struct screen {
// void *offscreen_buffer; // NEVER ACCESS! This+rowsize*y = screen offset
// void *offscreen_buffer_base; // Pointer to lowest address of offscreen buffer
int custom_size;
bool custom_size;
int rendering_to_texture; //wich texture we are rendering to, -1 if the back buffer
int rendering_to_face; //wich face of the texture we are rendering to, -1 if the back buffer
int static_environment_map;
int dynamic_environment_map;
int envmap_render_target;
bool recording_state_block;
int current_state_block;
@@ -905,7 +909,6 @@ typedef struct screen {
//switch onscreen, offscreen
void (*gf_flip)();
void (*gf_flip_window)(uint _hdc, int x, int y, int w, int h );
// Sets the current palette
void (*gf_set_palette)(ubyte * new_pal, int restrict_alphacolor);
@@ -933,9 +936,6 @@ typedef struct screen {
//void (*gf_set_font)(int fontnum);
// Sets the current bitmap
void (*gf_set_bitmap)( int bitmap_num, int alphablend, int bitbltmode, float alpha);
// Call this to create a shader.
// This function takes a while, so don't call it once a frame!
// r,g,b, and c should be between -1.0 and 1.0f
@@ -1045,20 +1045,14 @@ typedef struct screen {
// set fog attributes
void (*gf_fog_set)(int fog_mode, int r, int g, int b, float fog_near, float fog_far);
// get the current pixel color in the framebuffer
void (*gf_get_pixel)(int x, int y, int *r, int *g, int *b);
// poly culling
int (*gf_set_cull)(int cull);
// cross fade
void (*gf_cross_fade)(int bmap1, int bmap2, int x1, int y1, int x2, int y2, float pct);
// filtering
void (*gf_filter_set)(int filter);
// set a texture into cache. for sectioned bitmaps, pass in sx and sy to set that particular section of the bitmap
int (*gf_tcache_set)(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int fail_on_full, int force, int stage);
int (*gf_tcache_set)(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int stage);
// preload a bitmap into texture memory
int (*gf_preload)(int bitmap_num, int is_aabitmap);
@@ -1126,8 +1120,8 @@ typedef struct screen {
void (*gf_draw_line_list)(colored_vector*lines, int num);
void (*gf_draw_htl_line)(vec3d *start, vec3d* end);
void (*gf_draw_htl_sphere)(float rad);
void (*gf_line_htl)(vec3d *start, vec3d* end);
void (*gf_sphere_htl)(float rad);
// void (*gf_set_environment_mapping)(int i);
@@ -1138,12 +1132,6 @@ typedef struct screen {
*/
} screen;
// cpu types
//extern int Gr_amd3d;
//extern int Gr_katmai;
//extern int Gr_cpu;
//extern int Gr_mmx;
// handy macro
#define GR_MAYBE_CLEAR_RES(bmap) do { int bmw = -1; int bmh = -1; if(bmap != -1){ bm_get_info( bmap, &bmw, &bmh, NULL, NULL, NULL); if((bmw != gr_screen.max_w) || (bmh != gr_screen.max_h)){gr_clear();} } else {gr_clear();} } while(0);
@@ -1152,6 +1140,7 @@ typedef struct screen {
// Call this at application startup
// # Software Re-added by Kazan --- THIS HAS TO STAY -- It is used by standalone!
#define GR_DEFAULT (-1) // set to use default settings
#define GR_STUB (100)
#define GR_DIRECT3D (102) // Use Direct3d hardware renderer
#define GR_OPENGL (104) // Use OpenGl hardware renderer
@@ -1161,7 +1150,8 @@ typedef struct screen {
#define GR_640 0 // 640 x 480
#define GR_1024 1 // 1024 x 768
extern bool gr_init(int res, int mode, int depth = 16, int fred_x = -1, int fred_y = -1 );
extern bool gr_init(int d_mode = GR_DEFAULT, int d_width = GR_DEFAULT, int d_height = GR_DEFAULT, int d_depth = GR_DEFAULT);
extern void gr_screen_resize(int width, int height);
// Call this when your app ends.
extern void gr_close();
@@ -1219,9 +1209,6 @@ extern int Web_cursor_bitmap;
// Called by OS when application gets/looses focus
extern void gr_activate(int active);
// Sets up resolution
void gr_init_res(int res, int mode, int fredx = -1, int fredy = -1);
#define GR_CALL(x) (*x)
// These macros make the function indirection look like the
@@ -1231,7 +1218,6 @@ void gr_init_res(int res, int mode, int fredx = -1, int fredy = -1);
//#define gr_flip GR_CALL(gr_screen.gf_flip)
void gr_flip();
#define gr_flip_window GR_CALL(gr_screen.gf_flip_window)
//#define gr_set_clip GR_CALL(gr_screen.gf_set_clip)
__inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
@@ -1253,10 +1239,7 @@ __inline void gr_set_clip(int x, int y, int w, int h, bool resize=true)
//#define gr_set_color_fast GR_CALL(gr_screen.gf_set_color_fast)
//#define gr_set_bitmap GR_CALL(gr_screen.gf_set_bitmap)
__inline void gr_set_bitmap( int bitmap_num, int alphablend=GR_ALPHABLEND_NONE, int bitbltmode=GR_BITBLT_MODE_NORMAL, float alpha=1.0f )
{
(*gr_screen.gf_set_bitmap)(bitmap_num, alphablend, bitbltmode, alpha);
}
void gr_set_bitmap(int bitmap_num, int alphablend = GR_ALPHABLEND_NONE, int bitbltmode = GR_BITBLT_MODE_NORMAL, float alpha = 1.0f);
//#define gr_create_shader GR_CALL(gr_screen.gf_create_shader)
//#define gr_set_shader GR_CALL(gr_screen.gf_set_shader)
@@ -1337,9 +1320,6 @@ __inline void gr_gradient(int x1, int y1, int x2, int y2, bool resize = true)
#define gr_set_gamma GR_CALL(gr_screen.gf_set_gamma)
#define gr_lock GR_CALL(gr_screen.gf_lock)
#define gr_unlock GR_CALL(gr_screen.gf_unlock)
#define gr_get_region GR_CALL(gr_screen.gf_get_region)
//#define gr_fog_set GR_CALL(gr_screen.gf_fog_set)
@@ -1352,12 +1332,10 @@ __inline void gr_fog_set(int fog_mode, int r, int g, int b, float fog_near = -1.
#define gr_cross_fade GR_CALL(gr_screen.gf_cross_fade)
#define gr_filter_set GR_CALL(gr_screen.gf_filter_set)
//#define gr_tcache_set GR_CALL(gr_screen.gf_tcache_set)
__inline int gr_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int fail_on_full = 0, int force = 0, int stage = 0)
__inline int gr_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int stage = 0)
{
return (*gr_screen.gf_tcache_set)(bitmap_id, bitmap_type, u_scale, v_scale, fail_on_full, force, stage);
return (*gr_screen.gf_tcache_set)(bitmap_id, bitmap_type, u_scale, v_scale, stage);
}
#define gr_preload GR_CALL(gr_screen.gf_preload)
@@ -1389,63 +1367,63 @@ __inline int gr_bm_set_render_target(int n, int face = -1)
#define gr_set_texture_addressing GR_CALL(*gr_screen.gf_set_texture_addressing)
#define gr_make_buffer GR_CALL(*gr_screen.gf_make_buffer)
#define gr_make_buffer GR_CALL(*gr_screen.gf_make_buffer)
#define gr_destroy_buffer GR_CALL(*gr_screen.gf_destroy_buffer)
__inline void gr_render_buffer(int start, int n_prim, ushort *sbuffer, uint *ibuffer = NULL, int flags = TMAP_FLAG_TEXTURED)
{
(*gr_screen.gf_render_buffer)(start, n_prim, sbuffer, ibuffer, flags);
}
#define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)
#define gr_set_buffer GR_CALL(*gr_screen.gf_set_buffer)
#define gr_make_flat_buffer GR_CALL(*gr_screen.gf_make_flat_buffer)
#define gr_make_line_buffer GR_CALL(*gr_screen.gf_make_line_buffer)
#define gr_make_flat_buffer GR_CALL(*gr_screen.gf_make_flat_buffer)
#define gr_make_line_buffer GR_CALL(*gr_screen.gf_make_line_buffer)
#define gr_set_proj_matrix GR_CALL(*gr_screen.gf_set_proj_matrix)
#define gr_end_proj_matrix GR_CALL(*gr_screen.gf_end_proj_matrix)
#define gr_set_view_matrix GR_CALL(*gr_screen.gf_set_view_matrix)
#define gr_end_view_matrix GR_CALL(*gr_screen.gf_end_view_matrix)
#define gr_push_scale_matrix GR_CALL(*gr_screen.gf_push_scale_matrix)
#define gr_pop_scale_matrix GR_CALL(*gr_screen.gf_pop_scale_matrix)
#define gr_start_instance_matrix GR_CALL(*gr_screen.gf_start_instance_matrix)
#define gr_start_angles_instance_matrix GR_CALL(*gr_screen.gf_start_angles_instance_matrix)
#define gr_end_instance_matrix GR_CALL(*gr_screen.gf_end_instance_matrix)
#define gr_set_proj_matrix GR_CALL(*gr_screen.gf_set_proj_matrix)
#define gr_end_proj_matrix GR_CALL(*gr_screen.gf_end_proj_matrix)
#define gr_set_view_matrix GR_CALL(*gr_screen.gf_set_view_matrix)
#define gr_end_view_matrix GR_CALL(*gr_screen.gf_end_view_matrix)
#define gr_push_scale_matrix GR_CALL(*gr_screen.gf_push_scale_matrix)
#define gr_pop_scale_matrix GR_CALL(*gr_screen.gf_pop_scale_matrix)
#define gr_start_instance_matrix GR_CALL(*gr_screen.gf_start_instance_matrix)
#define gr_start_angles_instance_matrix GR_CALL(*gr_screen.gf_start_angles_instance_matrix)
#define gr_end_instance_matrix GR_CALL(*gr_screen.gf_end_instance_matrix)
#define gr_make_light GR_CALL (*gr_screen.gf_make_light)
#define gr_modify_light GR_CALL (*gr_screen.gf_modify_light)
#define gr_destroy_light GR_CALL (*gr_screen.gf_destroy_light)
#define gr_set_light GR_CALL (*gr_screen.gf_set_light)
#define gr_reset_lighting GR_CALL (*gr_screen.gf_reset_lighting)
#define gr_make_light GR_CALL(*gr_screen.gf_make_light)
#define gr_modify_light GR_CALL(*gr_screen.gf_modify_light)
#define gr_destroy_light GR_CALL(*gr_screen.gf_destroy_light)
#define gr_set_light GR_CALL(*gr_screen.gf_set_light)
#define gr_reset_lighting GR_CALL(*gr_screen.gf_reset_lighting)
#define gr_set_ambient_light GR_CALL(*gr_screen.gf_set_ambient_light)
#define gr_set_lighting GR_CALL (*gr_screen.gf_lighting)
#define gr_center_alpha GR_CALL (*gr_screen.gf_center_alpha)
#define gr_set_lighting GR_CALL(*gr_screen.gf_lighting)
#define gr_center_alpha GR_CALL(*gr_screen.gf_center_alpha)
#define gr_start_clip GR_CALL (*gr_screen.gf_start_clip_plane)
#define gr_end_clip GR_CALL (*gr_screen.gf_end_clip_plane)
#define gr_start_clip GR_CALL(*gr_screen.gf_start_clip_plane)
#define gr_end_clip GR_CALL(*gr_screen.gf_end_clip_plane)
#define gr_zbias GR_CALL (*gr_screen.gf_zbias)
#define gr_set_fill_mode GR_CALL (*gr_screen.gf_set_fill_mode)
#define gr_set_texture_panning GR_CALL (*gr_screen.gf_set_texture_panning)
#define gr_zbias GR_CALL(*gr_screen.gf_zbias)
#define gr_set_fill_mode GR_CALL(*gr_screen.gf_set_fill_mode)
#define gr_set_texture_panning GR_CALL(*gr_screen.gf_set_texture_panning)
#define gr_start_state_block GR_CALL (*gr_screen.gf_start_state_block)
#define gr_end_state_block GR_CALL (*gr_screen.gf_end_state_block)
#define gr_set_state_block GR_CALL (*gr_screen.gf_set_state_block)
#define gr_start_state_block GR_CAL(*gr_screen.gf_start_state_block)
#define gr_end_state_block GR_CALL(*gr_screen.gf_end_state_block)
#define gr_set_state_block GR_CALL(*gr_screen.gf_set_state_block)
//#define gr_set_environment_mapping GR_CALL (*gr_screen.gf_set_environment_mapping)
//#define gr_set_environment_mapping GR_CALL(*gr_screen.gf_set_environment_mapping)
#define gr_setup_background_fog GR_CALL (*gr_screen.gf_setup_background_fog)
#define gr_setup_background_fog GR_CALL(*gr_screen.gf_setup_background_fog)
#define gr_draw_line_list GR_CALL (*gr_screen.gf_draw_line_list)
#define gr_draw_line_list GR_CALL(*gr_screen.gf_draw_line_list)
#define gr_draw_htl_line GR_CALL(*gr_screen.gf_draw_htl_line)
#define gr_draw_htl_sphere GR_CALL(*gr_screen.gf_draw_htl_sphere)
#define gr_line_htl GR_CALL(*gr_screen.gf_line_htl)
#define gr_sphere_htl GR_CALL(*gr_screen.gf_sphere_htl)
/*
#define gr_begin_sprites GR_CALL (*gr_screen.gf_begin_sprites)
#define gr_draw_sprites GR_CALL (*gr_screen.gf_draw_sprites)
#define gr_end sprites GR_CALL (*gr_screen.gf_end_sprites)
#define gr_display_sprites GR_CALL (*gr_screen.gf_display_sprites)
#define gr_begin_sprites GR_CALL(*gr_screen.gf_begin_sprites)
#define gr_draw_sprites GR_CALL(*gr_screen.gf_draw_sprites)
#define gr_end sprites GR_CALL(*gr_screen.gf_end_sprites)
#define gr_display_sprites GR_CALL(*gr_screen.gf_display_sprites)
*/
// color functions
@@ -1469,16 +1447,15 @@ void gr_bitmap_list(bitmap_rect_list* list, int n_bm, bool allow_scaling);
// Moreover, it is _really_ intended for use with 45 degree angles.
void gr_pline_special(vec3d **pts, int num_pts, int thickness,bool resize=true);
#define VERTEX_FLAG_POSITION (1<<0)
#define VERTEX_FLAG_RHW (1<<1) //incompatable with the next normal
#define VERTEX_FLAG_NORMAL (1<<2)
#define VERTEX_FLAG_DIFUSE (1<<3)
#define VERTEX_FLAG_SPECULAR (1<<4)
#define VERTEX_FLAG_UV1 (1<<5) //how many UV coords, only use one of these
#define VERTEX_FLAG_UV2 (1<<6)
#define VERTEX_FLAG_UV3 (1<<7)
#define VERTEX_FLAG_UV4 (1<<8)
void poly_tsb_calc(vertex *v0, vertex *v1, vertex *v2, vec3d *o_norm, vec3d *o_stan, vec3d *o_ttan);
#define VERTEX_FLAG_POSITION (1<<0)
#define VERTEX_FLAG_RHW (1<<1) //incompatable with the next normal
#define VERTEX_FLAG_NORMAL (1<<2)
#define VERTEX_FLAG_DIFUSE (1<<3)
#define VERTEX_FLAG_SPECULAR (1<<4)
#define VERTEX_FLAG_UV1 (1<<5) //how many UV coords, only use one of these
#define VERTEX_FLAG_UV2 (1<<6)
#define VERTEX_FLAG_UV3 (1<<7)
#define VERTEX_FLAG_UV4 (1<<8)
#define VERTEX_FLAG_TANGENT (1<<9)
#endif
+2 -201
View File
@@ -513,205 +513,6 @@ void gr_get_string_size(int *w1, int *h1, char *text, int len)
MONITOR( FontChars )
/*
void gr8_char(int x,int y,int letter)
{
font_char *ch;
ch = &Current_font->char_data[letter];
gr_aabitmap_ex( x, y, ch->byte_width, Current_font->h, Current_font->u[letter], Current_font->v[letter] );
// mprintf(( "String = %s\n", text ));
}
void gr8_string( int sx, int sy, char *s )
{
int width, spacing, letter;
int x, y;
if ( !Current_font ) return;
if ( !s ) return;
gr_set_bitmap(Current_font->bitmap);
x = sx;
y = sy;
if (sx==0x8000) { //centered
x = get_centered_x(s);
} else {
x = sx;
}
while (*s) {
while (*s== '\n' ) {
s++;
y += Current_font->h;
if (sx==0x8000) { //centered
x = get_centered_x(s);
} else {
x = sx;
}
}
if (*s == 0 ) break;
letter = get_char_width(s[0],s[1],&width,&spacing);
if (letter<0) { //not in font, draw as space
x += spacing;
s++;
continue;
}
gr8_char( x, y, letter );
x += spacing;
s++;
}
}
*/
/*
void gr8_string(int sx, int sy, char *s )
{
int row,width, spacing, letter;
int x, y;
if ( !Current_font ) return;
if ( !s ) return;
x = sx;
y = sy;
if (sx==0x8000) { //centered
x = get_centered_x(s);
} else {
x = sx;
}
spacing = 0;
gr_lock();
while (*s) {
MONITOR_INC( FontChars, 1 );
x += spacing;
while (*s== '\n' ) {
s++;
y += Current_font->h;
if (sx==0x8000) { //centered
x = get_centered_x(s);
} else {
x = sx;
}
}
if (*s == 0 ) break;
letter = get_char_width(s[0],s[1],&width,&spacing);
s++;
//If not in font, draw as space
if (letter<0) continue;
int xd, yd, xc, yc;
int wc, hc;
// Check if this character is totally clipped
if ( x + width < gr_screen.clip_left ) continue;
if ( y + Current_font->h < gr_screen.clip_top ) continue;
if ( x > gr_screen.clip_right ) continue;
if ( y > gr_screen.clip_bottom ) continue;
xd = yd = 0;
if ( x < gr_screen.clip_left ) xd = gr_screen.clip_left - x;
if ( y < gr_screen.clip_top ) yd = gr_screen.clip_top - y;
xc = x+xd;
yc = y+yd;
wc = width - xd; hc = Current_font->h - yd;
if ( xc + wc > gr_screen.clip_right ) wc = gr_screen.clip_right - xc;
if ( yc + hc > gr_screen.clip_bottom ) hc = gr_screen.clip_bottom - yc;
if ( wc < 1 ) continue;
if ( hc < 1 ) continue;
ubyte *fp = Current_font->pixel_data + Current_font->char_data[letter].offset + xd + yd*width;
ubyte *dptr = GR_SCREEN_PTR(ubyte, xc, yc);
#ifndef HARDWARE_ONLY
if ( Current_alphacolor ) {
for (row=0; row<hc; row++) {
#ifdef USE_INLINE_ASM
ubyte *lookup = &Current_alphacolor->table.lookup[0][0];
_asm mov edx, lookup
_asm xor eax, eax
_asm mov ecx, wc
_asm xor ebx, ebx
_asm mov edi, dptr
_asm mov esi, fp
_asm shr ecx, 1
_asm jz OnlyOne
_asm pushf
InnerFontLoop:
_asm mov al, [edi]
_asm mov bl, [edi+1]
_asm add edi,2
_asm mov ah, [esi]
_asm mov bh, [esi+1]
_asm add esi,2
_asm mov al, [edx+eax]
_asm mov ah, [edx+ebx]
_asm mov [edi-2], ax
_asm dec ecx
_asm jnz InnerFontLoop
_asm popf
_asm jnc NotOdd
OnlyOne:
_asm mov al, [edi]
_asm mov ah, [esi]
_asm mov al, [edx+eax]
_asm mov [edi], al
NotOdd:
dptr += gr_screen.rowsize;
fp += width;
#else
int i;
for (i=0; i< wc; i++ ) {
*dptr++ = Current_alphacolor->table.lookup[*fp++][*dptr];
}
fp += width - wc;
dptr += gr_screen.rowsize - wc;
#endif
}
} else { // No alpha color
#endif
for (row=0; row<hc; row++) {
int i;
for (i=0; i< wc; i++ ) {
if (*fp > 5 )
*dptr = gr_screen.current_color.raw8;
dptr++;
fp++;
}
fp += width - wc;
dptr += gr_screen.rowsize - wc;
}
// }
}
gr_unlock();
}
*/
#ifdef _WIN32
HFONT MyhFont = NULL;
HDC hDibDC = NULL;
@@ -765,7 +566,7 @@ void _cdecl gr_printf( int x, int y, char * format, ... )
if ( !Current_font ) return;
va_start(args, format);
vsprintf(grx_printf_text,format,args);
vsnprintf(grx_printf_text, sizeof(grx_printf_text)-1, format, args);
va_end(args);
gr_string(x,y,grx_printf_text);
@@ -778,7 +579,7 @@ void _cdecl gr_printf_no_resize( int x, int y, char * format, ... )
if ( !Current_font ) return;
va_start(args, format);
vsprintf(grx_printf_text,format,args);
vsnprintf(grx_printf_text, sizeof(grx_printf_text)-1, format, args);
va_end(args);
gr_string(x,y,grx_printf_text,false);
+195 -277
View File
@@ -17,6 +17,11 @@
geometry_batcher::~geometry_batcher()
{
deallocate();
}
void geometry_batcher::deallocate()
{
if (vert != NULL) {
vm_free(vert);
@@ -27,6 +32,8 @@ geometry_batcher::~geometry_batcher()
vm_free(vert_list);
vert_list = NULL;
}
n_allocated = 0;
}
void geometry_batcher::allocate_internal(int n_verts)
@@ -60,36 +67,30 @@ void geometry_batcher::allocate_internal(int n_verts)
n_to_render = 0;
}
void geometry_batcher::allocate(int quad, int n_tri)
void geometry_batcher::allocate(int quad)
{
int to_alloc = 0;
// quads have two triangles, therefore six verts
if (quad > 0 ) {
to_alloc += (quad * 6);
}
if (quad <= 0)
return;
// a single triangle has a mere 3 verts
if ( n_tri > 0 ) {
to_alloc += (n_tri * 3);
}
to_alloc += (quad * 4);
allocate_internal(to_alloc);
}
void geometry_batcher::add_allocate(int quad, int n_tri)
#define MAGIC_BUMP 20
void geometry_batcher::add_allocate(int quad)
{
int to_alloc = (n_to_render * 3);
int to_alloc = (n_to_render * 4);
int magic_bump = MAGIC_BUMP;
// quads have two triangles, therefore six verts
if ( quad > 0 ) {
to_alloc += (quad * 6);
}
if (quad <= 0)
return;
// a single triangle has a mere 3 verts
if (n_tri > 0) {
to_alloc += (n_tri * 3);
}
// quads have 4 verts
to_alloc += (quad * 4);
magic_bump *= 4;
vertex *old_vert = vert;
@@ -99,22 +100,22 @@ void geometry_batcher::add_allocate(int quad, int n_tri)
vert_list = NULL;
}
vert = (vertex *) vm_malloc( sizeof(vertex) * to_alloc );
vert_list = (vertex **) vm_malloc( sizeof(vertex*) * to_alloc );
vert = (vertex *) vm_malloc( sizeof(vertex) * (to_alloc + magic_bump) );
vert_list = (vertex **) vm_malloc( sizeof(vertex*) * (to_alloc + magic_bump) );
Verify( (vert != NULL) && (vert_list != NULL) );
for (int i = 0; i < to_alloc; i++)
for (int i = 0; i < (to_alloc + magic_bump); i++)
vert_list[i] = &vert[i];
memset( vert, 0, sizeof(vertex) * to_alloc );
memset( vert, 0, sizeof(vertex) * (to_alloc + magic_bump) );
if (old_vert != NULL) {
memcpy( vert, old_vert, sizeof(vertex) * n_to_render * 3 );
memcpy( vert, old_vert, sizeof(vertex) * (n_to_render * 4) );
vm_free(old_vert);
}
n_allocated = to_alloc;
n_allocated = to_alloc + magic_bump;
}
}
@@ -129,9 +130,8 @@ void geometry_batcher::clone(const geometry_batcher &geo)
memcpy( vert, geo.vert, sizeof(vertex) * n_allocated );
for (int i = 0; i < n_allocated; i++) {
for (int i = 0; i < n_allocated; i++)
vert_list[i] = &vert[i];
}
} else {
vert = NULL;
vert_list = NULL;
@@ -140,17 +140,16 @@ void geometry_batcher::clone(const geometry_batcher &geo)
const geometry_batcher &geometry_batcher::operator=(const geometry_batcher &geo)
{
if (this != &geo) {
if (this != &geo)
clone(geo);
}
return *this;
}
/*
0----1
|\ |
| \ |
| |
| |
3----2
*/
void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float depth)
@@ -159,7 +158,7 @@ void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float dep
vec3d PNT, p[4];
vec3d fvec, rvec, uvec;
vertex *P = &vert[n_to_render * 3];
vertex *P = &vert[n_to_render * 4];
vm_vert2vec(pnt, &PNT);
@@ -195,66 +194,52 @@ void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float dep
vm_vec_scale_add(&p[2], &p[2], &uvec, -rad);
//move all the data from the vecs into the verts
//tri 1
g3_transfer_vertex(&P[5], &p[3]);
g3_transfer_vertex(&P[4], &p[2]);
g3_transfer_vertex(&P[3], &p[1]);
//tri 2
g3_transfer_vertex(&P[2], &p[3]);
g3_transfer_vertex(&P[1], &p[1]);
g3_transfer_vertex(&P[0], &p[0]);
// move all the data from the vecs into the verts
if (Cmdline_nohtl) {
g3_rotate_vertex(&P[0], &p[0]);
g3_rotate_vertex(&P[1], &p[1]);
g3_rotate_vertex(&P[2], &p[2]);
g3_rotate_vertex(&P[3], &p[3]);
} else {
g3_transfer_vertex(&P[0], &p[0]);
g3_transfer_vertex(&P[1], &p[1]);
g3_transfer_vertex(&P[2], &p[2]);
g3_transfer_vertex(&P[3], &p[3]);
}
// set up the UV coords
if ( orient & 1 ) {
// tri 1
P[5].u = 1.0f;
P[4].u = 0.0f;
P[3].u = 0.0f;
// tri 2
P[2].u = 1.0f;
P[1].u = 0.0f;
P[0].u = 1.0f;
} else {
// tri 1
P[5].u = 0.0f;
P[4].u = 1.0f;
P[3].u = 1.0f;
// tri 2
P[1].u = 0.0f;
P[2].u = 0.0f;
P[1].u = 1.0f;
P[3].u = 1.0f;
} else {
P[0].u = 0.0f;
P[1].u = 1.0f;
P[2].u = 1.0f;
P[3].u = 0.0f;
}
if ( orient & 2 ) {
// tri 1
P[5].v = 1.0f;
P[4].v = 1.0f;
P[3].v = 0.0f;
// tri 2
P[2].v = 1.0f;
P[1].v = 0.0f;
P[0].v = 0.0f;
} else {
// tri 1
P[5].v = 0.0f;
P[4].v = 0.0f;
P[3].v = 1.0f;
// tri 2
P[2].v = 0.0f;
P[1].v = 1.0f;
P[0].v = 1.0f;
P[1].v = 1.0f;
P[2].v = 0.0f;
P[3].v = 0.0f;
} else {
P[0].v = 0.0f;
P[1].v = 0.0f;
P[2].v = 1.0f;
P[3].v = 1.0f;
}
for (int i = 0; i < 6 ; i++) {
for (int i = 0; i < 4; i++) {
P[i].r = pnt->r;
P[i].g = pnt->g;
P[i].b = pnt->b;
P[i].a = pnt->a;
}
n_to_render += 2;
n_to_render++;
}
void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float angle, float depth)
@@ -264,14 +249,15 @@ void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float ang
extern float Physics_viewer_bank;
angle += Physics_viewer_bank;
if ( angle < 0.0f )
if (angle < 0.0f) {
angle += PI2;
else if ( angle > PI2 )
} else if (angle > PI2) {
angle -= PI2;
}
vec3d PNT, p[4];
vec3d fvec, rvec, uvec;
vertex *P = &vert[n_to_render * 3];
vertex *P = &vert[n_to_render * 4];
vm_vert2vec(pnt, &PNT);
@@ -279,7 +265,6 @@ void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float ang
vm_vec_normalize_safe(&fvec);
vm_rot_point_around_line(&uvec, &View_matrix.vec.uvec, angle, &vmd_zero_vector, &fvec);
// uvec = View_matrix.vec.uvec;
vm_vec_crossprod(&rvec, &fvec, &uvec);
vm_vec_normalize_safe(&rvec);
@@ -294,109 +279,67 @@ void geometry_batcher::draw_bitmap(vertex *pnt, int orient, float rad, float ang
vm_vec_scale_add(&p[0], &p[0], &uvec, rad);
vm_vec_scale_add(&p[2], &p[2], &uvec, -rad);
//move all the data from the vecs into the verts
//tri 1
g3_transfer_vertex(&P[5], &p[3]);
g3_transfer_vertex(&P[4], &p[2]);
g3_transfer_vertex(&P[3], &p[1]);
//tri 2
g3_transfer_vertex(&P[2], &p[3]);
g3_transfer_vertex(&P[1], &p[1]);
g3_transfer_vertex(&P[0], &p[0]);
// move all the data from the vecs into the verts
if (Cmdline_nohtl) {
g3_rotate_vertex(&P[0], &p[0]);
g3_rotate_vertex(&P[1], &p[1]);
g3_rotate_vertex(&P[2], &p[2]);
g3_rotate_vertex(&P[3], &p[3]);
} else {
g3_transfer_vertex(&P[0], &p[0]);
g3_transfer_vertex(&P[1], &p[1]);
g3_transfer_vertex(&P[2], &p[2]);
g3_transfer_vertex(&P[3], &p[3]);
}
// set up the UV coords
if ( orient & 1 ) {
// tri 1
P[5].u = 1.0f;
P[4].u = 0.0f;
P[3].u = 0.0f;
// tri 2
P[2].u = 1.0f;
P[1].u = 0.0f;
P[0].u = 1.0f;
} else {
// tri 1
P[5].u = 0.0f;
P[4].u = 1.0f;
P[3].u = 1.0f;
// tri 2
P[1].u = 0.0f;
P[2].u = 0.0f;
P[1].u = 1.0f;
P[3].u = 1.0f;
} else {
P[0].u = 0.0f;
P[1].u = 1.0f;
P[2].u = 1.0f;
P[3].u = 0.0f;
}
if ( orient & 2 ) {
// tri 1
P[5].v = 1.0f;
P[4].v = 1.0f;
P[3].v = 0.0f;
// tri 2
P[2].v = 1.0f;
P[1].v = 0.0f;
P[0].v = 0.0f;
} else {
// tri 1
P[5].v = 0.0f;
P[4].v = 0.0f;
P[3].v = 1.0f;
// tri 2
P[2].v = 0.0f;
P[1].v = 1.0f;
P[0].v = 1.0f;
P[1].v = 1.0f;
P[2].v = 0.0f;
P[3].v = 0.0f;
} else {
P[0].v = 0.0f;
P[1].v = 0.0f;
P[2].v = 1.0f;
P[3].v = 1.0f;
}
/* //tri 1
P[5].u = 0.0f; P[5].v = 0.0f;
P[4].u = 1.0f; P[4].v = 0.0f;
P[3].u = 1.0f; P[3].v = 1.0f;
//tri 2
P[2].u = 0.0f; P[2].v = 0.0f;
P[1].u = 1.0f; P[1].v = 1.0f;
P[0].u = 0.0f; P[0].v = 1.0f;*/
for (int i = 0; i < 6 ; i++) {
for (int i = 0; i < 4; i++) {
P[i].r = pnt->r;
P[i].g = pnt->g;
P[i].b = pnt->b;
P[i].a = pnt->a;
}
n_to_render += 2;
n_to_render++;
}
void geometry_batcher::draw_tri(vertex* verts)
void geometry_batcher::draw_tri(vertex *verts)
{
vertex *P = &vert[n_to_render *3 ];
for (int i = 0; i < 3; i++)
P[i] = verts[i];
n_to_render += 1;
}
void geometry_batcher::draw_quad(vertex* verts)
void geometry_batcher::draw_quad(vertex *verts)
{
vertex *P = &vert[n_to_render * 3];
P[0] = verts[0];
P[1] = verts[1];
P[2] = verts[2];
P[0] = verts[0];
P[2] = verts[2];
P[3] = verts[3];
n_to_render += 2;
}
void geometry_batcher::draw_beam(vec3d *start, vec3d *end, float width, float intensity)
{
vec3d p[4];
vertex *P = &vert[n_to_render * 3];
vertex *P = &vert[n_to_render * 4];
vec3d fvec, uvecs, uvece, evec;
@@ -421,36 +364,37 @@ void geometry_batcher::draw_beam(vec3d *start, vec3d *end, float width, float in
vm_vec_scale_add(&p[2], end, &uvece, -width);
vm_vec_scale_add(&p[3], start, &uvecs, -width);
// move all the data from the vecs into the verts
if (Cmdline_nohtl) {
g3_rotate_vertex(&P[0], &p[0]);
g3_rotate_vertex(&P[1], &p[1]);
g3_rotate_vertex(&P[2], &p[2]);
g3_rotate_vertex(&P[3], &p[3]);
} else {
g3_transfer_vertex(&P[0], &p[0]);
g3_transfer_vertex(&P[1], &p[1]);
g3_transfer_vertex(&P[2], &p[2]);
g3_transfer_vertex(&P[3], &p[3]);
}
//move all the data from the vecs into the verts
//tri 1
g3_transfer_vertex(&P[0], &p[3]);
g3_transfer_vertex(&P[1], &p[2]);
g3_transfer_vertex(&P[2], &p[1]);
// set up the UV coords
P[0].u = 0.0f;
P[1].u = 1.0f;
P[2].u = 1.0f;
P[3].u = 0.0f;
//tri 2
g3_transfer_vertex(&P[3], &p[3]);
g3_transfer_vertex(&P[4], &p[1]);
g3_transfer_vertex(&P[5], &p[0]);
//set up the UV coords
//tri 1
P[0].u = 0.0f; P[0].v = 0.0f;
P[1].u = 1.0f; P[1].v = 0.0f;
P[2].u = 1.0f; P[2].v = 1.0f;
//tri 2
P[3].u = 0.0f; P[3].v = 0.0f;
P[4].u = 1.0f; P[4].v = 1.0f;
P[5].u = 0.0f; P[5].v = 1.0f;
P[0].v = 0.0f;
P[1].v = 0.0f;
P[2].v = 1.0f;
P[3].v = 1.0f;
ubyte _color = (ubyte)(255.0f * intensity);
for(int i = 0; i < 6; i++){
for (int i = 0; i < 4; i++) {
P[i].r = P[i].g = P[i].b = P[i].a = _color;
}
n_to_render += 2;
n_to_render++;
}
float geometry_batcher::draw_laser(vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b)
@@ -486,62 +430,43 @@ float geometry_batcher::draw_laser(vec3d *p0, float width1, vec3d *p1, float wid
vec3d vecs[4];
vertex *pts = &vert[n_to_render * 3];
vertex *pts = &vert[n_to_render * 4];
vm_vec_scale_add( &vecs[0], &end, &uvec, width2 );
vm_vec_scale_add( &vecs[1], &start, &uvec, width1 );
vm_vec_scale_add( &vecs[2], &start, &uvec, -width1 );
vm_vec_scale_add( &vecs[3], &end, &uvec, -width2 );
g3_transfer_vertex( &pts[0], &vecs[0] );
g3_transfer_vertex( &pts[1], &vecs[1] );
g3_transfer_vertex( &pts[2], &vecs[2] );
g3_transfer_vertex( &pts[3], &vecs[0] );
g3_transfer_vertex( &pts[4], &vecs[2] );
g3_transfer_vertex( &pts[5], &vecs[3] );
if (Cmdline_nohtl) {
g3_rotate_vertex(&pts[0], &vecs[0]);
g3_rotate_vertex(&pts[1], &vecs[1]);
g3_rotate_vertex(&pts[2], &vecs[2]);
g3_rotate_vertex(&pts[3], &vecs[3]);
} else {
g3_transfer_vertex(&pts[0], &vecs[0]);
g3_transfer_vertex(&pts[1], &vecs[1]);
g3_transfer_vertex(&pts[2], &vecs[2]);
g3_transfer_vertex(&pts[3], &vecs[3]);
}
pts[0].u = 1.0f;
pts[0].v = 0.0f;
pts[1].u = 0.0f;
pts[1].v = 0.0f;
pts[2].u = 0.0f;
pts[2].v = 1.0f;
pts[3].u = 1.0f;
pts[0].v = 1.0f;
pts[1].v = 1.0f;
pts[2].v = 0.0f;
pts[3].v = 0.0f;
pts[4].u = 0.0f;
pts[4].v = 1.0f;
pts[5].u = 1.0f;
pts[5].v = 1.0f;
pts[0].r = (ubyte)r;
pts[0].g = (ubyte)g;
pts[0].b = (ubyte)b;
pts[0].a = 255;
pts[1].r = (ubyte)r;
pts[1].g = (ubyte)g;
pts[1].b = (ubyte)b;
pts[1].a = 255;
pts[2].r = (ubyte)r;
pts[2].g = (ubyte)g;
pts[2].b = (ubyte)b;
pts[2].a = 255;
pts[3].r = (ubyte)r;
pts[3].g = (ubyte)g;
pts[3].b = (ubyte)b;
pts[3].a = 255;
pts[4].r = (ubyte)r;
pts[4].g = (ubyte)g;
pts[4].b = (ubyte)b;
pts[4].a = 255;
pts[5].r = (ubyte)r;
pts[5].g = (ubyte)g;
pts[5].b = (ubyte)b;
pts[5].a = 255;
for (int i = 0; i < 4; i++) {
pts[i].r = (ubyte)r;
pts[i].g = (ubyte)g;
pts[i].b = (ubyte)b;
pts[i].a = 255;
}
n_to_render += 2;
n_to_render++;
return center.xyz.z;
}
@@ -549,7 +474,7 @@ float geometry_batcher::draw_laser(vec3d *p0, float width1, vec3d *p1, float wid
void geometry_batcher::render(int flags)
{
if (n_to_render) {
g3_draw_poly( n_to_render * 3, vert_list, flags | TMAP_FLAG_TRILIST);
g3_draw_poly( n_to_render * 4, vert_list, flags | TMAP_FLAG_QUADLIST);
n_to_render = 0;
}
}
@@ -559,36 +484,28 @@ void geometry_batcher::render(int flags)
// laser batcher
struct batch_item {
batch_item(): texture(-1), tmap_flags(0), alpha(1.0f), laser(false) {};
batch_item(): texture(-1), tmap_flags(0), alpha(1.0f) {};
geometry_batcher batch;
int texture;
int tmap_flags;
float alpha;
bool laser;
};
static std::vector<batch_item> geometry_map;
static batch_item geometry_map[MAX_BITMAPS];
static int find_good_batch_item(int texture)
static int Gr_batch_min_index = MAX_BITMAPS;
static int Gr_batch_max_index = 0;
static inline void add_batch_index(int index)
{
uint max_size = geometry_map.size();
for (uint i = 0; i < max_size; i++) {
if (geometry_map[i].texture == texture)
return (int)i;
if (index < Gr_batch_min_index) {
Gr_batch_min_index = index;
} else if (index > Gr_batch_max_index) {
Gr_batch_max_index = index;
}
// don't have an existing match so add a new entry
batch_item new_item;
new_item.texture = texture;
geometry_map.push_back(new_item);
return (int)(geometry_map.size() - 1);
}
float batch_add_laser(int texture, vec3d *p0, float width1, vec3d *p1, float width2, int r, int g, int b)
@@ -599,10 +516,17 @@ float batch_add_laser(int texture, vec3d *p0, float width1, vec3d *p1, float wid
}
geometry_batcher *item = NULL;
int index = find_good_batch_item(texture);
int index = (texture % MAX_BITMAPS);
Assert( index >= 0 );
geometry_map[index].laser = true;
add_batch_index(index);
geometry_map[index].texture = texture;
geometry_map[index].tmap_flags = (TMAP_FLAG_TEXTURED | TMAP_FLAG_XPARENT | TMAP_HTL_3D_UNLIT |
TMAP_FLAG_RGB | TMAP_FLAG_GOURAUD | TMAP_FLAG_CORRECT);
geometry_map[index].alpha = 0.99999f;
item = &geometry_map[index].batch;
item->add_allocate(1);
@@ -618,11 +542,13 @@ int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float
}
geometry_batcher *item = NULL;
int index = find_good_batch_item(texture);
int index = (texture % MAX_BITMAPS);
Assert( index >= 0 );
Assert( geometry_map[index].laser == false );
add_batch_index(index);
geometry_map[index].texture = texture;
geometry_map[index].tmap_flags = tmap_flags;
geometry_map[index].alpha = alpha;
@@ -635,53 +561,45 @@ int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float
return 0;
}
void batch_render_lasers()
void batch_render()
{
uint map_size = geometry_map.size();
batch_item *bi;
batch_item *bi, *end;
for (uint i = 0; i < map_size; i++) {
bi = &geometry_map[i];
bi = &geometry_map[Gr_batch_min_index];
end = &geometry_map[Gr_batch_max_index];
if ( !bi->laser )
continue;
while (bi < end) {
if ( bi->batch.need_to_render() ) {
gr_set_bitmap(bi->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, bi->alpha);
bi->batch.render(bi->tmap_flags);
}
if ( !bi->batch.need_to_render() )
continue;
Assert( bi->texture >= 0 );
gr_set_bitmap(bi->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.99999f);
bi->batch.render(TMAP_FLAG_TEXTURED | TMAP_FLAG_XPARENT | TMAP_HTL_3D_UNLIT | TMAP_FLAG_RGB | TMAP_FLAG_GOURAUD | TMAP_FLAG_CORRECT);
++bi;
}
}
void batch_render_bitmaps()
{
uint map_size = geometry_map.size();
batch_item *bi;
for (uint i = 0; i < map_size; i++) {
bi = &geometry_map[i];
if ( bi->laser )
continue;
if ( !bi->batch.need_to_render() )
continue;
Assert( bi->texture >= 0 );
gr_set_bitmap(bi->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, bi->alpha);
bi->batch.render( bi->tmap_flags );
// since one should be left over (99.9% of the time)...
if (bi == end) {
if ( bi->batch.need_to_render() ) {
gr_set_bitmap(bi->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, bi->alpha);
bi->batch.render(bi->tmap_flags);
}
}
}
void batch_render_all()
{
batch_render_lasers();
batch_render_bitmaps();
}
void batch_reset()
{
geometry_map.clear();
batch_item *bi;
for (int i = 0; i < MAX_BITMAPS; i++) {
bi = &geometry_map[i];
bi->texture = -1;
bi->tmap_flags = 0;
bi->alpha = 1.0f;
bi->batch.deallocate();
}
Gr_batch_min_index = MAX_BITMAPS;
Gr_batch_max_index = 0;
}
+7 -6
View File
@@ -33,10 +33,13 @@ public:
// initial memory space needed
// NOTE: This MUST be called BEFORE calling any of the draw_*() functions!!
void allocate(int quad, int n_tri = 0);
void allocate(int quad);
// deallocate any vert memory
void deallocate();
// allocate an additional block of memory to what we already have (this is a resize function)
void add_allocate(int quad, int n_tri = 0);
void add_allocate(int quad);
// draw a bitmap into the geometry batcher
void draw_bitmap(vertex *position, int orient, float rad, float depth = 0);
@@ -61,7 +64,7 @@ public:
void render(int flags);
// determine if we even need to try and render this (helpful for particle system)
int need_to_render() { return n_to_render; };
bool need_to_render() { return (n_to_render > 0); };
void operator =(int){};
};
@@ -69,9 +72,7 @@ public:
float batch_add_laser(int texture, vec3d *p0, float width1, vec3d *p1, float width2, int r = 255, int g = 255, int b = 255);
int batch_add_bitmap(int texture, int tmap_flags, vertex *pnt, int orient, float rad, float alpha = 1.0f, float depth = 0.0f);
void batch_render_all();
void batch_render_bitmaps();
void batch_render_lasers();
void batch_render();
void batch_reset();
#endif
+2 -2
View File
@@ -2588,7 +2588,7 @@ void gr_d3d_render_buffer(int start, int n_prim, ushort* index_buffer, uint *ibu
// bool single_pass_spec = false;
if(GLOWMAP > -1 && !Cmdline_noglow){
if(GLOWMAP > -1 && Cmdline_glow){
//glowmapped
gr_screen.gf_set_bitmap(GLOWMAP, gr_screen.current_alphablend_mode, gr_screen.current_bitblt_mode, 0.0);
d3d_tcache_set_internal(gr_screen.current_bitmap, TCACHE_TYPE_NORMAL, &u_scale, &v_scale, 0, 0, 1);
@@ -2675,7 +2675,7 @@ void gr_d3d_render_buffer(int start, int n_prim, ushort* index_buffer, uint *ibu
else GlobalD3DVars::lpD3DDevice->DrawPrimitive(D3DPT_TRIANGLELIST , start, n_prim);
}
gr_d3d_set_state( TEXTURE_SOURCE_DECAL, ALPHA_BLEND_NONE, ZBUFFER_TYPE_FULL );
if(Cmdline_env){
if ( !Cmdline_env ) {
gr_zbias(2);
extern int Game_subspace_effect;
+2 -2
View File
@@ -542,8 +542,8 @@ BOOL d3d_lost_device(bool force)
if(old_render_target){old_render_target->Release();old_render_target=NULL;}
if(global_index_buffer){global_index_buffer->Release();global_index_buffer=NULL;}
extern bool cube_map_drawen;
cube_map_drawen = false;
extern bool Env_cubemap_drawn;
Env_cubemap_drawn = false;
void bm_pre_lost();
Loaded 100 of 237 files, more files were not shown because too many files have changed in this diff. Show more