mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 22:56:30 -10:00
Compare commits
2
Commits
multiplayer
...
xt_branch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1009fbd144 | ||
|
|
7158aca5a0 |
No files matched your search
+12
-6
@@ -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
|
||||
|
||||
+484
-431
File diff suppressed because it is too large.
Load diff
+17
-11
@@ -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
|
||||
@@ -1129,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;
|
||||
}
|
||||
|
||||
@@ -1366,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) {
|
||||
@@ -1382,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);
|
||||
|
||||
@@ -1401,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) ) {
|
||||
@@ -1485,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.
|
||||
@@ -1492,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;
|
||||
@@ -1580,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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+23
-17
@@ -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,21 +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
|
||||
deltax = text_pos[0] / 1024.0f; //MikeStar;
|
||||
text_pos[0] = gr_screen.max_w * deltax; //MikeStar;
|
||||
}
|
||||
else
|
||||
{
|
||||
text_pos[0] = image_pos[0];
|
||||
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];
|
||||
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;
|
||||
@@ -462,11 +467,12 @@ void subtitle::do_frame(float frametime)
|
||||
gr_set_color_fast(&text_color);
|
||||
|
||||
int font_height = gr_get_font_height();
|
||||
int y = text_pos[1];
|
||||
int x = fl2i(text_pos[0]);
|
||||
int y = fl2i(text_pos[1]);
|
||||
|
||||
for(unsigned int i = 0; i < text_lines.size(); i++)
|
||||
{
|
||||
gr_string(text_pos[0], y, (char*)text_lines[i].c_str(), false);
|
||||
gr_string(x, y, (char*)text_lines[i].c_str(), false);
|
||||
y += font_height;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
+78
-88
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
// --------------------------------------------------
|
||||
|
||||
@@ -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
|
||||
|
||||
+18
-24
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
@@ -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
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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], ¢er, &orient->vec.fvec, -Grid_depth );
|
||||
vecs[4] = center;
|
||||
|
||||
verts[0].u = 0.01f; verts[0].v = 0.01f;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
+129
-151
@@ -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"
|
||||
@@ -1903,7 +1902,7 @@ 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();
|
||||
@@ -2694,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();
|
||||
@@ -2704,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;
|
||||
@@ -2845,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;
|
||||
|
||||
@@ -3216,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();
|
||||
@@ -3258,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) )
|
||||
@@ -3335,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;
|
||||
}
|
||||
|
||||
@@ -3633,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;
|
||||
@@ -3671,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();
|
||||
@@ -3775,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
|
||||
@@ -4171,15 +4133,17 @@ void game_show_framerate()
|
||||
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
|
||||
@@ -4204,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);
|
||||
@@ -4215,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);
|
||||
@@ -4229,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;
|
||||
@@ -4261,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;
|
||||
@@ -4270,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 );
|
||||
@@ -4290,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;
|
||||
@@ -4322,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;
|
||||
@@ -4337,7 +4299,7 @@ void game_show_framerate()
|
||||
}
|
||||
|
||||
|
||||
if ( Show_player_pos ) {
|
||||
if (Show_player_pos) {
|
||||
int sx, sy;
|
||||
sx = 320;
|
||||
sy = 100;
|
||||
@@ -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.
|
||||
@@ -5575,7 +5568,7 @@ void game_render_frame( vec3d *eye_pos, matrix *eye_orient )
|
||||
// maybe offset the HUD (jitter stuff) and measure the 2D displacement between the player's view and ship vector
|
||||
dont_offset = ((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_OBSERVER));
|
||||
HUD_set_offsets(Viewer_obj, !dont_offset, &eye_no_jitter);
|
||||
|
||||
|
||||
// for multiplayer clients, call code in Shield.cpp to set up the Shield_hit array. Have to
|
||||
// do this becaues of the disjointed nature of this system (in terms of setup and execution).
|
||||
// must be done before ships are rendered
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "graphics/font.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "network/multi_options.h"
|
||||
#include "gamesequence/gamesequence.h"
|
||||
|
||||
#ifdef WIN32
|
||||
//#include <windows.h>
|
||||
@@ -103,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);
|
||||
@@ -392,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;
|
||||
|
||||
@@ -425,6 +427,7 @@ void fs2netd_do_frame()
|
||||
PXO_SID = -1;
|
||||
|
||||
NextHeartBeat = -1;
|
||||
NextHolePunch = -1;
|
||||
NextPing = -1;
|
||||
GotPong = -1;
|
||||
|
||||
@@ -470,6 +473,7 @@ void fs2netd_do_frame()
|
||||
PXO_SID = -1;
|
||||
|
||||
NextHeartBeat = -1;
|
||||
NextHolePunch = -1;
|
||||
NextPing = -1;
|
||||
GotPong = -1;
|
||||
|
||||
@@ -494,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 ) {
|
||||
@@ -1392,3 +1439,81 @@ void fs2netd_update_game_count(char *chan_name)
|
||||
FS2NetD_GameCountUpdate(chan_name);
|
||||
}
|
||||
|
||||
|
||||
void fs2netd_udp_hole_punch()
|
||||
{
|
||||
/* // don't bother with this if we aren't on FS2NetD
|
||||
if ( !Om_tracker_flag ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !Is_connected ) {
|
||||
return;
|
||||
}
|
||||
|
||||
server_item *cur = Game_server_head;
|
||||
char ip[16];
|
||||
int i = 0;
|
||||
|
||||
// give them a second to respond normally.
|
||||
fix end_time = timer_get_fixed_seconds() + F1_0;
|
||||
|
||||
while ( timer_get_fixed_seconds() <= end_time ) {
|
||||
multi_do_frame();
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// see if this server has responded normally.
|
||||
if ( Active_game_count > 0 ) {
|
||||
active_game *agcur = Active_game_head;
|
||||
|
||||
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);*/
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
//***********************************************************************************************************************
|
||||
|
||||
@@ -1025,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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
+25
-38
@@ -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)
|
||||
|
||||
|
||||
@@ -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] = {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
-403
File diff suppressed because it is too large.
Load diff
+66
-87
@@ -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;
|
||||
@@ -887,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;
|
||||
@@ -903,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);
|
||||
@@ -931,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
|
||||
@@ -1043,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);
|
||||
@@ -1124,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);
|
||||
|
||||
@@ -1136,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);
|
||||
|
||||
@@ -1150,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
|
||||
@@ -1159,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();
|
||||
@@ -1217,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
|
||||
@@ -1229,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)
|
||||
@@ -1251,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)
|
||||
@@ -1335,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)
|
||||
@@ -1350,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)
|
||||
@@ -1387,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
|
||||
@@ -1467,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
@@ -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
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -2044,7 +2044,7 @@ void gr_d3d_tmapper_internal( int nverts, vertex **verts, uint flags, int is_sca
|
||||
//BEGIN FINAL SETTINGS
|
||||
if(Cmdline_cell && cell_enabled){
|
||||
|
||||
if(GLOWMAP < 0 || Cmdline_noglow){
|
||||
if(GLOWMAP < 0 || !Cmdline_glow){
|
||||
d3d_SetTexture(2, NULL);
|
||||
d3d_SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
|
||||
@@ -2099,7 +2099,7 @@ void gr_d3d_tmapper_internal( int nverts, vertex **verts, uint flags, int is_sca
|
||||
}
|
||||
}
|
||||
|
||||
if(GLOWMAP < 0 || Cmdline_noglow){
|
||||
if(GLOWMAP < 0 || !Cmdline_glow){
|
||||
// d3d_SetTexture(1, NULL);
|
||||
// d3d_SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
}else{
|
||||
|
||||
@@ -1560,7 +1560,6 @@ bool gr_d3d_init()
|
||||
d3d_setup_color();
|
||||
|
||||
// Tell FreeSpace code that we're using Direct3D.
|
||||
D3D_enabled = 1;
|
||||
GlobalD3DVars::D3D_inited = true;
|
||||
|
||||
d3d_generate_state_blocks();
|
||||
|
||||
@@ -251,6 +251,7 @@
|
||||
#include "globalincs/globals.h" // just in case pstypes.h messed up
|
||||
|
||||
extern int Gr_cursor;
|
||||
extern int Gr_cursor_size;
|
||||
|
||||
//#define GR_SCREEN_PTR(type,x,y) ((type *)(ptr_u(gr_screen.offscreen_buffer) + ptr_u(((x)+gr_screen.offset_x)*sizeof(type)) + ptr_u(((y)+gr_screen.offset_y)*gr_screen.rowsize)))
|
||||
//#define GR_SCREEN_PTR_SIZE(bpp,x,y) ((ptr_u)(ptr_u(gr_screen.offscreen_buffer) + ptr_u(((x)+gr_screen.offset_x)*(bpp)) + ptr_u(((y)+gr_screen.offset_y)*gr_screen.rowsize)))
|
||||
|
||||
+463
-2086
File diff suppressed because it is too large.
Load diff
+457
-16
@@ -184,8 +184,10 @@
|
||||
#define STUB_FUNCTION 0
|
||||
#elif defined(SCP_UNIX)
|
||||
#ifdef __APPLE__
|
||||
#define GL_GLEXT_LEGACY // I'd like to punch the idiot that made this needed
|
||||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glu.h>
|
||||
#define GL_GLEXT_FUNCTION_POINTERS // we need the ptr versions of the functions
|
||||
#include <OpenGL/glext.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
@@ -198,6 +200,14 @@
|
||||
#include "graphics/grinternal.h"
|
||||
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
// in case it's missing from the GL headers
|
||||
#ifndef GL_ARB_pixel_buffer_object
|
||||
#define GL_ARB_pixel_buffer_object 1
|
||||
@@ -273,6 +283,49 @@
|
||||
#define GL_COORD_REPLACE_ARB 0x8862
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_vertex_buffer_object
|
||||
#define GL_ARB_vertex_buffer_object 1
|
||||
#ifdef __APPLE__
|
||||
typedef long GLintptrARB;
|
||||
typedef long GLsizeiptrARB;
|
||||
|
||||
typedef void (* glBindBufferARBProcPtr) (GLenum target, GLuint buffer);
|
||||
typedef void (* glDeleteBuffersARBProcPtr) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (* glGenBuffersARBProcPtr) (GLsizei n, GLuint *buffers);
|
||||
typedef GLboolean (* glIsBufferARBProcPtr) (GLuint buffer);
|
||||
typedef void (* glBufferDataARBProcPtr) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
|
||||
typedef void (* glBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
|
||||
typedef void (* glGetBufferSubDataARBProcPtr) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
|
||||
typedef GLvoid *(* glMapBufferARBProcPtr) (GLenum target, GLenum access);
|
||||
typedef GLboolean (* glUnmapBufferARBProcPtr) (GLenum target);
|
||||
typedef void (* glGetBufferParameterivARBProcPtr) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (* glGetBufferPointervARBProcPtr) (GLenum target, GLenum pname, GLvoid **params);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
|
||||
typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
|
||||
typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
|
||||
typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
|
||||
typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
|
||||
typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);
|
||||
#endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_compiled_vertex_array
|
||||
#define GL_EXT_compiled_vertex_array 1
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glLockArraysEXTProcPtr) (GLint, GLsizei);
|
||||
typedef void (* glUnlockArraysEXTProcPtr) (void);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
|
||||
typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
|
||||
#endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_framebuffer_object
|
||||
#define GL_EXT_framebuffer_object 1
|
||||
#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
|
||||
@@ -328,10 +381,25 @@
|
||||
#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
|
||||
#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
|
||||
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef GLboolean (* glIsRenderbufferEXTProcPtr) (GLuint renderbuffer);
|
||||
typedef void (* glBindRenderbufferEXTProcPtr) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (* glDeleteRenderbuffersEXTProcPtr) (GLsizei n, const GLuint *renderbuffers);
|
||||
typedef void (* glGenRenderbuffersEXTProcPtr) (GLsizei n, GLuint *renderbuffers);
|
||||
typedef void (* glRenderbufferStorageEXTProcPtr) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
typedef void (* glGetRenderbufferParameterivEXTProcPtr) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef GLboolean (* glIsFramebufferEXTProcPtr) (GLuint framebuffer);
|
||||
typedef void (* glBindFramebufferEXTProcPtr) (GLenum target, GLuint framebuffer);
|
||||
typedef void (* glDeleteFramebuffersEXTProcPtr) (GLsizei n, const GLuint *framebuffers);
|
||||
typedef void (* glGenFramebuffersEXTProcPtr) (GLsizei n, GLuint *framebuffers);
|
||||
typedef GLenum (* glCheckFramebufferStatusEXTProcPtr) (GLenum target);
|
||||
typedef void (* glFramebufferTexture1DEXTProcPtr) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (* glFramebufferTexture2DEXTProcPtr) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
|
||||
typedef void (* glFramebufferTexture3DEXTProcPtr) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
|
||||
typedef void (* glFramebufferRenderbufferEXTProcPtr) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (* glGetFramebufferAttachmentParameterivEXTProcPtr) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (* glGenerateMipmapEXTProcPtr) (GLenum target);
|
||||
#else
|
||||
typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
|
||||
@@ -349,24 +417,397 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum
|
||||
typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
|
||||
typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_EXT_framebuffer_object
|
||||
|
||||
#ifndef GL_ARB_shader_objects
|
||||
#define GL_ARB_shader_objects 1
|
||||
#define GL_PROGRAM_OBJECT_ARB 0x8B40
|
||||
#define GL_SHADER_OBJECT_ARB 0x8B48
|
||||
#define GL_OBJECT_TYPE_ARB 0x8B4E
|
||||
#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
|
||||
#define GL_FLOAT_VEC2_ARB 0x8B50
|
||||
#define GL_FLOAT_VEC3_ARB 0x8B51
|
||||
#define GL_FLOAT_VEC4_ARB 0x8B52
|
||||
#define GL_INT_VEC2_ARB 0x8B53
|
||||
#define GL_INT_VEC3_ARB 0x8B54
|
||||
#define GL_INT_VEC4_ARB 0x8B55
|
||||
#define GL_BOOL_ARB 0x8B56
|
||||
#define GL_BOOL_VEC2_ARB 0x8B57
|
||||
#define GL_BOOL_VEC3_ARB 0x8B58
|
||||
#define GL_BOOL_VEC4_ARB 0x8B59
|
||||
#define GL_FLOAT_MAT2_ARB 0x8B5A
|
||||
#define GL_FLOAT_MAT3_ARB 0x8B5B
|
||||
#define GL_FLOAT_MAT4_ARB 0x8B5C
|
||||
#define GL_SAMPLER_1D_ARB 0x8B5D
|
||||
#define GL_SAMPLER_2D_ARB 0x8B5E
|
||||
#define GL_SAMPLER_3D_ARB 0x8B5F
|
||||
#define GL_SAMPLER_CUBE_ARB 0x8B60
|
||||
#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
|
||||
#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
|
||||
#define GL_SAMPLER_2D_RECT_ARB 0x8B63
|
||||
#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
|
||||
#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
|
||||
#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
|
||||
#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
|
||||
#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
|
||||
#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
|
||||
#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
|
||||
#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
|
||||
#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
|
||||
#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
|
||||
|
||||
typedef char GLcharARB; /* native character */
|
||||
typedef unsigned int GLhandleARB; /* shader object handle */
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glDeleteObjectARBProcPtr) (GLhandleARB obj);
|
||||
typedef GLhandleARB (* glGetHandleARBProcPtr) (GLenum pname);
|
||||
typedef void (* glDetachObjectARBProcPtr) (GLhandleARB containerObj, GLhandleARB attachedObj);
|
||||
typedef GLhandleARB (* glCreateShaderObjectARBProcPtr) (GLenum shaderType);
|
||||
typedef void (* glShaderSourceARBProcPtr) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
|
||||
typedef void (* glCompileShaderARBProcPtr) (GLhandleARB shaderObj);
|
||||
typedef GLhandleARB (* glCreateProgramObjectARBProcPtr) (void);
|
||||
typedef void (* glAttachObjectARBProcPtr) (GLhandleARB containerObj, GLhandleARB obj);
|
||||
typedef void (* glLinkProgramARBProcPtr) (GLhandleARB programObj);
|
||||
typedef void (* glUseProgramObjectARBProcPtr) (GLhandleARB programObj);
|
||||
typedef void (* glValidateProgramARBProcPtr) (GLhandleARB programObj);
|
||||
typedef void (* glUniform1fARBProcPtr) (GLint location, GLfloat v0);
|
||||
typedef void (* glUniform2fARBProcPtr) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (* glUniform3fARBProcPtr) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (* glUniform4fARBProcPtr) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (* glUniform1iARBProcPtr) (GLint location, GLint v0);
|
||||
typedef void (* glUniform2iARBProcPtr) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (* glUniform3iARBProcPtr) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (* glUniform4iARBProcPtr) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (* glUniform1fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform2fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform3fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform4fvARBProcPtr) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (* glUniform1ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniform2ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniform3ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniform4ivARBProcPtr) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (* glUniformMatrix2fvARBProcPtr) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (* glUniformMatrix3fvARBProcPtr) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (* glUniformMatrix4fvARBProcPtr) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (* glGetObjectParameterfvARBProcPtr) (GLhandleARB obj, GLenum pname, GLfloat *params);
|
||||
typedef void (* glGetObjectParameterivARBProcPtr) (GLhandleARB obj, GLenum pname, GLint *params);
|
||||
typedef void (* glGetInfoLogARBProcPtr) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
|
||||
typedef void (* glGetAttachedObjectsARBProcPtr) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
|
||||
typedef GLint (* glGetUniformLocationARBProcPtr) (GLhandleARB programObj, const GLcharARB *name);
|
||||
typedef void (* glGetActiveUniformARBProcPtr) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef void (* glGetUniformfvARBProcPtr) (GLhandleARB programObj, GLint location, GLfloat *params);
|
||||
typedef void (* glGetUniformivARBProcPtr) (GLhandleARB programObj, GLint location, GLint *params);
|
||||
typedef void (* glGetShaderSourceARBProcPtr) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
|
||||
typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
|
||||
typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
|
||||
typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
|
||||
typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
|
||||
typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
|
||||
typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
|
||||
typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
|
||||
typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
|
||||
typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
|
||||
typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
|
||||
typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
|
||||
typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
|
||||
typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
||||
typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_ARB_shader_objects
|
||||
|
||||
#ifndef GL_ARB_vertex_shader
|
||||
#define GL_ARB_vertex_shader 1
|
||||
#define GL_VERTEX_SHADER_ARB 0x8B31
|
||||
#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
|
||||
#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
|
||||
#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
|
||||
#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
|
||||
#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glBindAttribLocationARBProcPtr) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
typedef void (* glGetActiveAttribARBProcPtr) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef GLint (* glGetAttribLocationARBProcPtr) (GLhandleARB programObj, const GLcharARB *name);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
|
||||
typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
|
||||
typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_ARB_vertex_shader
|
||||
|
||||
#ifndef GL_ARB_fragment_shader
|
||||
#define GL_ARB_fragment_shader 1
|
||||
#define GL_FRAGMENT_SHADER_ARB 0x8B30
|
||||
#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
|
||||
#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
|
||||
#endif // GL_ARB_fragment_shader
|
||||
|
||||
#ifndef GL_ARB_shading_language_100
|
||||
#define GL_ARB_shading_language_100 1
|
||||
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
|
||||
#endif // GL_ARB_shading_language_100
|
||||
|
||||
// as usual, OS X headers completely suck
|
||||
#ifndef GL_SHADING_LANGUAGE_VERSION_ARB
|
||||
#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
|
||||
#endif
|
||||
|
||||
// most of following is probably useless, but some of it is required by GL_ARB_*_shader
|
||||
#ifndef GL_ARB_vertex_program
|
||||
#define GL_ARB_vertex_program 1
|
||||
#define GL_COLOR_SUM_ARB 0x8458
|
||||
#define GL_VERTEX_PROGRAM_ARB 0x8620
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
|
||||
#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
|
||||
#define GL_PROGRAM_LENGTH_ARB 0x8627
|
||||
#define GL_PROGRAM_STRING_ARB 0x8628
|
||||
#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
|
||||
#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
|
||||
#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
|
||||
#define GL_CURRENT_MATRIX_ARB 0x8641
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
|
||||
#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
|
||||
#define GL_PROGRAM_BINDING_ARB 0x8677
|
||||
#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
|
||||
#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
|
||||
#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
|
||||
#define GL_PROGRAM_FORMAT_ARB 0x8876
|
||||
#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
|
||||
#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
|
||||
#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
|
||||
#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
|
||||
#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
|
||||
#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
|
||||
#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
|
||||
#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
|
||||
#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
|
||||
#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
|
||||
#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
|
||||
#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
|
||||
#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
|
||||
#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
|
||||
#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
|
||||
#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
|
||||
#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
|
||||
#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
|
||||
#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
|
||||
#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
|
||||
#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
|
||||
#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
|
||||
#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
|
||||
#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
|
||||
#define GL_MATRIX0_ARB 0x88C0
|
||||
#define GL_MATRIX1_ARB 0x88C1
|
||||
#define GL_MATRIX2_ARB 0x88C2
|
||||
#define GL_MATRIX3_ARB 0x88C3
|
||||
#define GL_MATRIX4_ARB 0x88C4
|
||||
#define GL_MATRIX5_ARB 0x88C5
|
||||
#define GL_MATRIX6_ARB 0x88C6
|
||||
#define GL_MATRIX7_ARB 0x88C7
|
||||
#define GL_MATRIX8_ARB 0x88C8
|
||||
#define GL_MATRIX9_ARB 0x88C9
|
||||
#define GL_MATRIX10_ARB 0x88CA
|
||||
#define GL_MATRIX11_ARB 0x88CB
|
||||
#define GL_MATRIX12_ARB 0x88CC
|
||||
#define GL_MATRIX13_ARB 0x88CD
|
||||
#define GL_MATRIX14_ARB 0x88CE
|
||||
#define GL_MATRIX15_ARB 0x88CF
|
||||
#define GL_MATRIX16_ARB 0x88D0
|
||||
#define GL_MATRIX17_ARB 0x88D1
|
||||
#define GL_MATRIX18_ARB 0x88D2
|
||||
#define GL_MATRIX19_ARB 0x88D3
|
||||
#define GL_MATRIX20_ARB 0x88D4
|
||||
#define GL_MATRIX21_ARB 0x88D5
|
||||
#define GL_MATRIX22_ARB 0x88D6
|
||||
#define GL_MATRIX23_ARB 0x88D7
|
||||
#define GL_MATRIX24_ARB 0x88D8
|
||||
#define GL_MATRIX25_ARB 0x88D9
|
||||
#define GL_MATRIX26_ARB 0x88DA
|
||||
#define GL_MATRIX27_ARB 0x88DB
|
||||
#define GL_MATRIX28_ARB 0x88DC
|
||||
#define GL_MATRIX29_ARB 0x88DD
|
||||
#define GL_MATRIX30_ARB 0x88DE
|
||||
#define GL_MATRIX31_ARB 0x88DF
|
||||
|
||||
#ifdef __APPLE__
|
||||
typedef void (* glVertexAttrib1dARBProcPtr) (GLuint index, GLdouble x);
|
||||
typedef void (* glVertexAttrib1dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib1fARBProcPtr) (GLuint index, GLfloat x);
|
||||
typedef void (* glVertexAttrib1fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib1sARBProcPtr) (GLuint index, GLshort x);
|
||||
typedef void (* glVertexAttrib1svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib2dARBProcPtr) (GLuint index, GLdouble x, GLdouble y);
|
||||
typedef void (* glVertexAttrib2dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib2fARBProcPtr) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (* glVertexAttrib2fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib2sARBProcPtr) (GLuint index, GLshort x, GLshort y);
|
||||
typedef void (* glVertexAttrib2svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib3dARBProcPtr) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
typedef void (* glVertexAttrib3dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib3fARBProcPtr) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (* glVertexAttrib3fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib3sARBProcPtr) (GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
typedef void (* glVertexAttrib3svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib4NbvARBProcPtr) (GLuint index, const GLbyte *v);
|
||||
typedef void (* glVertexAttrib4NivARBProcPtr) (GLuint index, const GLint *v);
|
||||
typedef void (* glVertexAttrib4NsvARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib4NubARBProcPtr) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
typedef void (* glVertexAttrib4NubvARBProcPtr) (GLuint index, const GLubyte *v);
|
||||
typedef void (* glVertexAttrib4NuivARBProcPtr) (GLuint index, const GLuint *v);
|
||||
typedef void (* glVertexAttrib4NusvARBProcPtr) (GLuint index, const GLushort *v);
|
||||
typedef void (* glVertexAttrib4bvARBProcPtr) (GLuint index, const GLbyte *v);
|
||||
typedef void (* glVertexAttrib4dARBProcPtr) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (* glVertexAttrib4dvARBProcPtr) (GLuint index, const GLdouble *v);
|
||||
typedef void (* glVertexAttrib4fARBProcPtr) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (* glVertexAttrib4fvARBProcPtr) (GLuint index, const GLfloat *v);
|
||||
typedef void (* glVertexAttrib4ivARBProcPtr) (GLuint index, const GLint *v);
|
||||
typedef void (* glVertexAttrib4sARBProcPtr) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
typedef void (* glVertexAttrib4svARBProcPtr) (GLuint index, const GLshort *v);
|
||||
typedef void (* glVertexAttrib4ubvARBProcPtr) (GLuint index, const GLubyte *v);
|
||||
typedef void (* glVertexAttrib4uivARBProcPtr) (GLuint index, const GLuint *v);
|
||||
typedef void (* glVertexAttrib4usvARBProcPtr) (GLuint index, const GLushort *v);
|
||||
typedef void (* glVertexAttribPointerARBProcPtr) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (* glDisableVertexAttribArrayARBProcPtr) (GLuint index);
|
||||
typedef void (* glEnableVertexAttribArrayARBProcPtr) (GLuint index);
|
||||
typedef void (* glGetVertexAttribPointervARBProcPtr) (GLuint index, GLenum pname, GLvoid **pointer);
|
||||
typedef void (* glGetVertexAttribdvARBProcPtr) (GLuint index, GLenum pname, GLdouble *params);
|
||||
typedef void (* glGetVertexAttribfvARBProcPtr) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (* glGetVertexAttribivARBProcPtr) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (* glBindProgramARBProcPtr) (GLenum target, GLuint program);
|
||||
typedef void (* glDeleteProgramsARBProcPtr) (GLsizei n, const GLuint *programs);
|
||||
typedef void (* glGenProgramsARBProcPtr) (GLsizei n, GLuint *programs);
|
||||
typedef GLboolean (* glIsProgramARBProcPtr) (GLuint program);
|
||||
typedef void (* glProgramEnvParameter4dARBProcPtr) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (* glProgramEnvParameter4dvARBProcPtr) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (* glProgramEnvParameter4fARBProcPtr) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (* glProgramEnvParameter4fvARBProcPtr) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (* glProgramLocalParameter4dARBProcPtr) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (* glProgramLocalParameter4dvARBProcPtr) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (* glProgramLocalParameter4fARBProcPtr) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (* glProgramLocalParameter4fvARBProcPtr) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (* glGetProgramEnvParameterdvARBProcPtr) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (* glGetProgramEnvParameterfvARBProcPtr) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (* glGetProgramLocalParameterdvARBProcPtr) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (* glGetProgramLocalParameterfvARBProcPtr) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (* glProgramStringARBProcPtr) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
|
||||
typedef void (* glGetProgramStringARBProcPtr) (GLenum target, GLenum pname, GLvoid *string);
|
||||
typedef void (* glGetProgramivARBProcPtr) (GLenum target, GLenum pname, GLint *params);
|
||||
#else
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
|
||||
typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
|
||||
typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
|
||||
typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
|
||||
typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
|
||||
typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
|
||||
#endif // __APPLE__
|
||||
#endif // GL_ARB_vertex_program
|
||||
|
||||
|
||||
const ubyte GL_zero_3ub[3] = { 0, 0, 0 };
|
||||
|
||||
void gr_opengl_init(int reinit=0);
|
||||
bool gr_opengl_init();
|
||||
void gr_opengl_cleanup(int minimize=1);
|
||||
void opengl_setup_render_states(int &r,int &g,int &b,int &alpha, int &tmap_type, int flags, int is_scaler = 0);
|
||||
void opengl_set_state(gr_texture_source ts, gr_alpha_blend ab, gr_zbuffer_type zt);
|
||||
//void gr_opengl_bitmap(int x, int y);
|
||||
void gr_opengl_bitmap_ex(int x, int y, int w, int h, int sx, int sy, bool resize);
|
||||
void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage = 0 );
|
||||
void opengl_reset_spec_mapping();
|
||||
int opengl_check_for_errors();
|
||||
int opengl_check_for_errors(char *err_at = NULL);
|
||||
|
||||
extern int VBO_ENABLED;
|
||||
#ifndef NDEBUG
|
||||
#define GL_CHECK_FOR_ERRORS(s) opengl_check_for_errors((s))
|
||||
#else
|
||||
#define GL_CHECK_FOR_ERRORS(s)
|
||||
#endif
|
||||
|
||||
extern gr_texture_source GL_current_tex_src;
|
||||
extern gr_alpha_blend GL_current_alpha_blend;
|
||||
extern gr_zbuffer_type GL_current_ztype;
|
||||
extern int Use_VBOs;
|
||||
extern int Use_PBOs;
|
||||
extern int Use_GLSL;
|
||||
|
||||
#endif
|
||||
@@ -218,6 +218,7 @@ int gr_opengl_bm_load(ubyte type, int n, char *filename, CFILE *img_cfp, int *w,
|
||||
|
||||
if (type == BM_TYPE_DDS) {
|
||||
int dds_error = dds_read_header( filename, img_cfp, w, h, bpp, &dds_ct, mm_lvl, size );
|
||||
|
||||
if (dds_error != DDS_ERROR_NONE) {
|
||||
mprintf(("DDS ERROR: Couldn't open '%s' -- %s\n", filename, dds_error_string(dds_error)));
|
||||
return -1;
|
||||
@@ -302,7 +303,7 @@ void gr_opengl_bm_init(int n)
|
||||
// specific instructions for setting up the start of a page-in session
|
||||
void gr_opengl_bm_page_in_start()
|
||||
{
|
||||
gr_opengl_preload_init();
|
||||
opengl_preload_init();
|
||||
}
|
||||
|
||||
extern void bm_clean_slot(int n);
|
||||
@@ -645,8 +646,9 @@ void gr_opengl_bm_save_render_target(int n)
|
||||
{
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo )
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo ) {
|
||||
return;
|
||||
}
|
||||
|
||||
bitmap_entry *be = &bm_bitmaps[n];
|
||||
bitmap *bmp = &be->bm;
|
||||
@@ -667,11 +669,13 @@ int gr_opengl_bm_make_render_target(int n, int *width, int *height, ubyte *bpp,
|
||||
{
|
||||
Assert( (n >= 0) && (n < MAX_BITMAPS) );
|
||||
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo )
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (flags & BMP_FLAG_CUBEMAP) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) )
|
||||
if ( (flags & BMP_FLAG_CUBEMAP) && !Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( (flags & BMP_FLAG_CUBEMAP) && (*width != *height) ) {
|
||||
MIN(*width, *height) = MAX(*width, *height);
|
||||
@@ -679,16 +683,18 @@ int gr_opengl_bm_make_render_target(int n, int *width, int *height, ubyte *bpp,
|
||||
|
||||
Assert( is_power_of_two(*width, *height) );
|
||||
|
||||
if ( opengl_make_render_target(bm_bitmaps[n].handle, n, width, height, bpp, mm_lvl, flags) )
|
||||
if ( opengl_make_render_target(bm_bitmaps[n].handle, n, width, height, bpp, mm_lvl, flags) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int gr_opengl_bm_set_render_target(int n, int face)
|
||||
{
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo )
|
||||
if ( !Is_Extension_Enabled(OGL_EXT_FRAMEBUFFER_OBJECT) || Cmdline_no_fbo ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (n == -1) {
|
||||
opengl_set_render_target(-1);
|
||||
@@ -699,8 +705,9 @@ int gr_opengl_bm_set_render_target(int n, int face)
|
||||
|
||||
int is_static = (bm_bitmaps[n].type == BM_TYPE_RENDER_TARGET_STATIC);
|
||||
|
||||
if ( opengl_set_render_target(n, face, is_static) )
|
||||
if ( opengl_set_render_target(n, face, is_static) ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -119,6 +119,9 @@
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropengltexture.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "ddsutils/ddsutils.h"
|
||||
|
||||
#include "osapi/outwnd.h"
|
||||
|
||||
@@ -132,7 +135,7 @@ char *OGL_extension_string = NULL;
|
||||
// - number of extensions to check for
|
||||
// - extension name(s) (max is 3 variants)
|
||||
// - number of functions that extension needs/wants
|
||||
// - function names that extension needs (max is 15)
|
||||
// - function names that extension needs (max is 20)
|
||||
|
||||
// OpenGL extensions that we will want to use
|
||||
ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
|
||||
@@ -193,9 +196,9 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
|
||||
"glMapBufferARB", "glUnmapBufferARB" } },
|
||||
|
||||
// allows pixel data to use buffer objects
|
||||
{ false, false, 2, { "GL_ARB_pixel_buffer_object", "GL_EXT_pixel_buffer_object" }, 6, {
|
||||
{ false, false, 2, { "GL_ARB_pixel_buffer_object", "GL_EXT_pixel_buffer_object" }, 7, {
|
||||
"glBindBufferARB", "glDeleteBuffersARB", "glGenBuffersARB", "glBufferDataARB",
|
||||
"glMapBufferARB", "glUnmapBufferARB" } },
|
||||
"glBufferSubDataARB", "glMapBufferARB", "glUnmapBufferARB" } },
|
||||
|
||||
// Mac-only extension that allows use of system copy of texture to avoid an additional API copy
|
||||
// { false, 0, 1, { "GL_APPLE_client_storage" }, 0, { NULL } },
|
||||
@@ -225,7 +228,28 @@ ogl_extension GL_Extensions[NUM_OGL_EXTENSIONS] =
|
||||
{ false, false, 1, { "GL_EXT_texture_lod_bias" }, 0, { NULL } },
|
||||
|
||||
// point sprites (for particles)
|
||||
{ false, false, 2, { "GL_ARB_point_sprite", "NV_point_sprite" }, 0, { NULL } }
|
||||
{ false, false, 2, { "GL_ARB_point_sprite", "NV_point_sprite" }, 0, { NULL } },
|
||||
|
||||
// OpenGL Shading Language support. If this is present, then GL_ARB_shader_objects, GL_ARB_fragment_shader
|
||||
// and GL_ARB_vertex_shader should also be available.
|
||||
{ false, false, 1, { "GL_ARB_shading_language_100" }, 0, { NULL } },
|
||||
|
||||
// shader objects and program object management
|
||||
{ false, false, 1, { "GL_ARB_shader_objects" }, 17, { "glDeleteObjectARB", "glCreateShaderObjectARB", "glShaderSourceARB",
|
||||
"glCompileShaderARB", "glGetObjectParameterivARB", "glGetInfoLogARB", "glCreateProgramObjectARB",
|
||||
"glAttachObjectARB", "glLinkProgramARB", "glUseProgramObjectARB", "glValidateProgramARB", "glGetUniformLocationARB",
|
||||
"glGetUniformivARB", "glUniform1fARB", "glUniform3fARB", "glUniform1iARB", "glUniformMatrix4fvARB" } },
|
||||
|
||||
// programmable vertex level processing
|
||||
// some of functions are provided by GL_ARB_vertex_program
|
||||
{ false, false, 1, { "GL_ARB_vertex_shader" }, 4, { "glEnableVertexAttribArrayARB", "glDisableVertexAttribArrayARB",
|
||||
"glGetAttribLocationARB", "glVertexAttribPointerARB" } },
|
||||
|
||||
// programmable fragment level processing
|
||||
{ false, false, 1, { "GL_ARB_fragment_shader" }, 0, { NULL } },
|
||||
|
||||
// shader version 3.0 detection extensions (if either of these extensions exist then we should have a SM3.0 compatible card)
|
||||
{ false, false, 2, { "GL_NV_vertex_program3", "GL_ATI_shader_texture_lod" }, 0, { NULL } }
|
||||
};
|
||||
|
||||
// ogl_funcion is:
|
||||
@@ -254,6 +278,7 @@ ogl_function GL_Functions[NUM_OGL_FUNCTIONS] =
|
||||
{ "glDeleteBuffersARB", 0 },
|
||||
{ "glGenBuffersARB", 0 },
|
||||
{ "glBufferDataARB", 0 },
|
||||
{ "glBufferSubDataARB", 0 },
|
||||
{ "glMapBufferARB", 0 },
|
||||
{ "glUnmapBufferARB", 0 },
|
||||
{ "glIsRenderbufferEXT", 0 },
|
||||
@@ -270,7 +295,30 @@ ogl_function GL_Functions[NUM_OGL_FUNCTIONS] =
|
||||
{ "glFramebufferTexture2DEXT", 0 },
|
||||
{ "glFramebufferRenderbufferEXT", 0 },
|
||||
{ "glGetFramebufferAttachmentParameterivEXT", 0 },
|
||||
{ "glGenerateMipmapEXT", 0 }
|
||||
{ "glGenerateMipmapEXT", 0 },
|
||||
{ "glDeleteObjectARB", 0 },
|
||||
{ "glCreateShaderObjectARB", 0 },
|
||||
{ "glShaderSourceARB", 0 },
|
||||
{ "glCompileShaderARB", 0 },
|
||||
{ "glGetObjectParameterivARB", 0 },
|
||||
{ "glGetInfoLogARB", 0 },
|
||||
{ "glCreateProgramObjectARB", 0 },
|
||||
{ "glAttachObjectARB", 0 },
|
||||
{ "glLinkProgramARB", 0 },
|
||||
{ "glUseProgramObjectARB", 0 },
|
||||
{ "glValidateProgramARB", 0 },
|
||||
{ "glEnableVertexAttribArrayARB", 0 },
|
||||
{ "glDisableVertexAttribArrayARB", 0 },
|
||||
{ "glGetAttribLocationARB", 0 },
|
||||
{ "glVertexAttribPointerARB", 0 },
|
||||
{ "glGetUniformLocationARB", 0 },
|
||||
{ "glGetUniformivARB", 0 },
|
||||
{ "glUniform1fARB", 0 },
|
||||
{ "glUniform3fARB", 0 },
|
||||
{ "glUniform3fvARB", 0 },
|
||||
{ "glUniform4fvARB", 0 },
|
||||
{ "glUniform1iARB", 0 },
|
||||
{ "glUniformMatrix4fvARB", 0 }
|
||||
};
|
||||
|
||||
// special extensions (only special functions are supported at the moment)
|
||||
@@ -402,3 +450,71 @@ Next:
|
||||
|
||||
return num_found;
|
||||
}
|
||||
|
||||
|
||||
extern int OGL_fogmode;
|
||||
|
||||
void opengl_extensions_init()
|
||||
{
|
||||
opengl_get_extensions();
|
||||
|
||||
// if S3TC compression is found, then "GL_ARB_texture_compression" must be an extension
|
||||
Use_compressed_textures = Is_Extension_Enabled(OGL_EXT_TEXTURE_COMPRESSION_S3TC);
|
||||
Texture_compression_available = Is_Extension_Enabled(OGL_ARB_TEXTURE_COMPRESSION);
|
||||
|
||||
//allow VBOs to be used
|
||||
if ( !Cmdline_nohtl && !Cmdline_novbo && Is_Extension_Enabled(OGL_ARB_VERTEX_BUFFER_OBJECT) ) {
|
||||
Use_VBOs = 1;
|
||||
}
|
||||
|
||||
// if ( Is_Extension_Enabled(OGL_ARB_PIXEL_BUFFER_OBJECT) ) {
|
||||
// Use_PBOs = 1;
|
||||
// }
|
||||
|
||||
if ( !Cmdline_noglsl && Is_Extension_Enabled(OGL_ARB_SHADER_OBJECTS) && Is_Extension_Enabled(OGL_ARB_FRAGMENT_SHADER)
|
||||
&& Is_Extension_Enabled(OGL_ARB_VERTEX_SHADER) && Is_Extension_Enabled(OGL_SM30) )
|
||||
{
|
||||
Use_GLSL = 1;
|
||||
}
|
||||
|
||||
// setup the best fog function found
|
||||
if ( !Fred_running ) {
|
||||
if ( Is_Extension_Enabled(OGL_EXT_FOG_COORD) ) {
|
||||
OGL_fogmode = 2;
|
||||
} else {
|
||||
OGL_fogmode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// if we can't do cubemaps then turn off Cmdline_env
|
||||
if ( !(Is_Extension_Enabled(OGL_ARB_TEXTURE_CUBE_MAP) && Is_Extension_Enabled(OGL_ARB_TEXTURE_ENV_COMBINE)) ) {
|
||||
Cmdline_env = 0;
|
||||
}
|
||||
|
||||
// can't have this stuff without GLSL support
|
||||
if ( !Use_GLSL ) {
|
||||
Cmdline_normal = 0;
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
|
||||
if (Use_GLSL) {
|
||||
GLint max_texture_units;
|
||||
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &max_texture_units);
|
||||
|
||||
// we need enough texture slots for this stuff to work
|
||||
|
||||
if (max_texture_units < 4) {
|
||||
Int3();
|
||||
Use_GLSL = 0;
|
||||
}
|
||||
|
||||
if (max_texture_units < 5) {
|
||||
Cmdline_normal = 0;
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
|
||||
if (max_texture_units < 6) {
|
||||
Cmdline_height = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -127,6 +127,7 @@
|
||||
#define _GROPENGLEXT_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "graphics/gropengl.h"
|
||||
|
||||
//EXTENSIONS!!!!
|
||||
//be sure to check for this at startup and handle not finding it gracefully
|
||||
@@ -144,7 +145,7 @@ typedef struct ogl_extension {
|
||||
int num_extensions;
|
||||
const char *extension_name[3];
|
||||
int num_functions;
|
||||
const char *function_names[15];
|
||||
const char *function_names[20];
|
||||
} ogl_extension;
|
||||
|
||||
typedef struct ogl_function {
|
||||
@@ -182,8 +183,13 @@ extern ogl_function GL_EXT_Special[];
|
||||
#define OGL_ARB_TEXTURE_CUBE_MAP 17
|
||||
#define OGL_EXT_TEXTURE_LOD_BIAS 18
|
||||
#define OGL_ARB_POINT_SPRITE 19
|
||||
#define OGL_ARB_SHADING_LANGUAGE_100 20
|
||||
#define OGL_ARB_SHADER_OBJECTS 21
|
||||
#define OGL_ARB_VERTEX_SHADER 22
|
||||
#define OGL_ARB_FRAGMENT_SHADER 23
|
||||
#define OGL_SM30 24
|
||||
|
||||
#define NUM_OGL_EXTENSIONS 20
|
||||
#define NUM_OGL_EXTENSIONS 25
|
||||
|
||||
|
||||
// Functions
|
||||
@@ -206,25 +212,49 @@ extern ogl_function GL_EXT_Special[];
|
||||
#define OGL_DELETE_BUFFERS 12
|
||||
#define OGL_GEN_BUFFERS 13
|
||||
#define OGL_BUFFER_DATA 14
|
||||
#define OGL_MAP_BUFFER 15
|
||||
#define OGL_UNMAP_BUFFER 16
|
||||
#define OGL_IS_RENDERBUFFER 17
|
||||
#define OGL_BIND_RENDERBUFFER 18
|
||||
#define OGL_DELETE_RENDERBUFFERS 19
|
||||
#define OGL_GEN_RENDERBUFFERS 20
|
||||
#define OGL_RENDERBUFFER_STORAGE 21
|
||||
#define OGL_GET_RENDERBUFFER_PARAMETER_IV 22
|
||||
#define OGL_IS_FRAMEBUFFER 23
|
||||
#define OGL_BIND_FRAMEBUFFER 24
|
||||
#define OGL_DELETE_FRAMEBUFFERS 25
|
||||
#define OGL_GEN_FRAMEBUFFERS 26
|
||||
#define OGL_CHECK_FRAMEBUFFER_STATUS 27
|
||||
#define OGL_FRAMEBUFFER_TEXTURE_2D 28
|
||||
#define OGL_FRAMEBUFFER_RENDERBUFFER 29
|
||||
#define OGL_GET_FRAMEBUFFER_ATTACHMENT_PARAMETER_IV 30
|
||||
#define OGL_GENERATE_MIPMAP 31
|
||||
#define OGL_BUFFER_SUB_DATA 15
|
||||
#define OGL_MAP_BUFFER 16
|
||||
#define OGL_UNMAP_BUFFER 17
|
||||
#define OGL_IS_RENDERBUFFER 18
|
||||
#define OGL_BIND_RENDERBUFFER 19
|
||||
#define OGL_DELETE_RENDERBUFFERS 20
|
||||
#define OGL_GEN_RENDERBUFFERS 21
|
||||
#define OGL_RENDERBUFFER_STORAGE 22
|
||||
#define OGL_GET_RENDERBUFFER_PARAMETER_IV 23
|
||||
#define OGL_IS_FRAMEBUFFER 24
|
||||
#define OGL_BIND_FRAMEBUFFER 25
|
||||
#define OGL_DELETE_FRAMEBUFFERS 26
|
||||
#define OGL_GEN_FRAMEBUFFERS 27
|
||||
#define OGL_CHECK_FRAMEBUFFER_STATUS 28
|
||||
#define OGL_FRAMEBUFFER_TEXTURE_2D 29
|
||||
#define OGL_FRAMEBUFFER_RENDERBUFFER 30
|
||||
#define OGL_GET_FRAMEBUFFER_ATTACHMENT_PARAMETER_IV 31
|
||||
#define OGL_GENERATE_MIPMAP 32
|
||||
#define OGL_DELETE_OBJECT 33
|
||||
#define OGL_CREATE_SHADER_OBJECT 34
|
||||
#define OGL_SHADER_SOURCE 35
|
||||
#define OGL_COMPILE_SHADER 36
|
||||
#define OGL_GET_OBJECT_PARAMETERIV 37
|
||||
#define OGL_GET_INFO_LOG 38
|
||||
#define OGL_CREATE_PROGRAM_OBJECT 39
|
||||
#define OGL_ATTACH_OBJECT 40
|
||||
#define OGL_LINK_PROGRAM 41
|
||||
#define OGL_USE_PROGRAM_OBJECT 42
|
||||
#define OGL_VALIDATE_PROGRAM 43
|
||||
#define OGL_ENABLE_VERTEX_ATTRIB_ARRAY 44
|
||||
#define OGL_DISABLE_VERTEX_ATTRIB_ARRAY 45
|
||||
#define OGL_GET_ATTRIB_LOCATION 46
|
||||
#define OGL_VERTEX_ATTRIB_POINTER 47
|
||||
#define OGL_GET_UNIFORM_LOCATION 48
|
||||
#define OGL_GET_UNIFORMIV 49
|
||||
#define OGL_UNIFORM1F 50
|
||||
#define OGL_UNIFORM3F 51
|
||||
#define OGL_UNIFORM3FV 52
|
||||
#define OGL_UNIFORM4FV 53
|
||||
#define OGL_UNIFORM1I 54
|
||||
#define OGL_UNIFORM_MATRIX4FV 55
|
||||
|
||||
#define NUM_OGL_FUNCTIONS 32
|
||||
#define NUM_OGL_FUNCTIONS 56
|
||||
|
||||
|
||||
// special extensions/functions (OS specific, non-GL stuff)
|
||||
@@ -236,62 +266,86 @@ extern ogl_function GL_EXT_Special[];
|
||||
|
||||
#define Is_Extension_Enabled(x) GL_Extensions[x].enabled
|
||||
|
||||
int opengl_get_extensions();
|
||||
void opengl_print_extensions();
|
||||
void opengl_extensions_init();
|
||||
|
||||
|
||||
#define GLEXT_CALL(i,x) if (GL_Functions[i].function_ptr)\
|
||||
#define GLEXT_CALL(i, x) if (GL_Functions[i].function_ptr) \
|
||||
((x)GL_Functions[i].function_ptr)
|
||||
|
||||
// the same as GLEXT_CALL() except that it can be used with a cast or in an if statement
|
||||
// this doesn't do NULL ptr checking so you have to be careful with it!
|
||||
#define GLEXT_CALL2(i,x) ((x)GL_Functions[i].function_ptr)
|
||||
#define GLEXT_CALL2(i, x) ((x)GL_Functions[i].function_ptr)
|
||||
|
||||
#define GLEXT_SPC_CALL(i,x) if (GL_EXT_Special[i].function_ptr) \
|
||||
#define GLEXT_SPC_CALL(i, x) if (GL_EXT_Special[i].function_ptr) \
|
||||
((x)GL_EXT_Special[i].function_ptr)
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
// OS X doesn't have the PFN* names so we have to use the real OSX functions, so until
|
||||
// we move to true runtime loading this will have to suffice...
|
||||
#define vglFogCoordfEXT glFogCoordfEXT
|
||||
#define vglFogCoordPointerEXT glFogCoordPointerEXT
|
||||
#define vglMultiTexCoord2fARB glMultiTexCoord2fARB
|
||||
#define vglActiveTextureARB glActiveTextureARB
|
||||
#define vglClientActiveTextureARB glClientActiveTextureARB
|
||||
#define vglCompressedTexImage2D glCompressedTexImage2D
|
||||
#define vglCompressedTexSubImage2D glCompressedTexSubImage2D
|
||||
#define vglGetCompressedTexImageARB glGetCompressedTexImageARB
|
||||
//#define vglSecondaryColor3fvEXT glSecondaryColor3fvEXT
|
||||
//#define vglSecondaryColor3ubvEXT glSecondaryColor3ubvEXT
|
||||
#define vglLockArraysEXT glLockArraysEXT
|
||||
#define vglUnlockArraysEXT glUnlockArraysEXT
|
||||
//#define vglLoadTransposeMatrixfARB glLoadTransposeMatrixfARB
|
||||
//#define vglMultTransposeMatrixfARB glMultTransposeMatrixfARB
|
||||
#define vglDrawRangeElements glDrawRangeElements
|
||||
#define vglBindBufferARB glBindBufferARB
|
||||
#define vglDeleteBuffersARB glDeleteBuffersARB
|
||||
#define vglGenBuffersARB glGenBuffersARB
|
||||
#define vglBufferDataARB glBufferDataARB
|
||||
#define vglMapBufferARB glMapBufferARB
|
||||
#define vglUnmapBufferARB glUnmapBufferARB
|
||||
#define vglIsRenderbufferEXT glIsRenderbufferEXT
|
||||
#define vglBindRenderbufferEXT glBindRenderbufferEXT
|
||||
#define vglDeleteRenderbuffersEXT glDeleteRenderbuffersEXT
|
||||
#define vglGenRenderbuffersEXT glGenRenderbuffersEXT
|
||||
#define vglRenderbufferStorageEXT glRenderbufferStorageEXT
|
||||
#define vglGetRenderbufferParameterivEXT glGetRenderbufferParameterivEXT
|
||||
#define vglIsFramebufferEXT glIsFramebufferEXT
|
||||
#define vglBindFramebufferEXT glBindFramebufferEXT
|
||||
#define vglDeleteFramebuffersEXT glDeleteFramebuffersEXT
|
||||
#define vglGenFramebuffersEXT glGenFramebuffersEXT
|
||||
#define vglCheckFramebufferStatusEXT glCheckFramebufferStatusEXT
|
||||
#define vglFramebufferTexture2DEXT glFramebufferTexture2DEXT
|
||||
#define vglFramebufferRenderbufferEXT glFramebufferRenderbufferEXT
|
||||
#define vglGetFramebufferAttachmentParameterivEXT glGetFramebufferAttachmentParameterivEXT
|
||||
#define vglGenerateMipmapEXT glGenerateMipmapEXT
|
||||
// special one, since it's a core feature
|
||||
typedef void (* glDrawRangeElementsProcPtr) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
|
||||
#else
|
||||
// OS X doesn't have the PFN* names so we have to use the real OSX function ptrs
|
||||
#define PFNGLFOGCOORDFEXTPROC glFogCoordfEXTProcPtr
|
||||
#define PFNGLFOGCOORDPOINTEREXTPROC glFogCoordPointerEXTProcPtr
|
||||
#define PFNGLMULTITEXCOORD2FARBPROC glMultiTexCoord2fARBProcPtr
|
||||
#define PFNGLACTIVETEXTUREARBPROC glActiveTextureARBProcPtr
|
||||
#define PFNGLCLIENTACTIVETEXTUREARBPROC glClientActiveTextureARBProcPtr
|
||||
#define PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2DARBProcPtr
|
||||
#define PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2DARBProcPtr
|
||||
#define PFNGLGETCOMPRESSEDTEXIMAGEARBPROC glGetCompressedTexImageARBProcPtr
|
||||
//#define PFNGLSECONDARYCOLOR3FVEXTPROC glSecondaryColor3fvEXTProcPtr
|
||||
//#define PFNGLSECONDARYCOLOR3UBVEXTPROC glSecondaryColor3ubvEXTProcPtr
|
||||
#define PFNGLLOCKARRAYSEXTPROC glLockArraysEXTProcPtr
|
||||
#define PFNGLUNLOCKARRAYSEXTPROC glUnlockArraysEXTProcPtr
|
||||
//#define PFNGLLOADTRANSPOSEMATRIXFARBPROC glLoadTransposeMatrixfARBProcPtr
|
||||
//#define PFNGLMULTTRANSPOSEMATRIXFARBPROC glMultTransposeMatrixfARBProcPtr
|
||||
#define PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElementsProcPtr
|
||||
#define PFNGLBINDBUFFERARBPROC glBindBufferARBProcPtr
|
||||
#define PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARBProcPtr
|
||||
#define PFNGLGENBUFFERSARBPROC glGenBuffersARBProcPtr
|
||||
#define PFNGLBUFFERDATAARBPROC glBufferDataARBProcPtr
|
||||
#define PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARBProcPtr
|
||||
#define PFNGLMAPBUFFERARBPROC glMapBufferARBProcPtr
|
||||
#define PFNGLUNMAPBUFFERARBPROC glUnmapBufferARBProcPtr
|
||||
#define PFNGLISRENDERBUFFEREXTPROC glIsRenderbufferEXTProcPtr
|
||||
#define PFNGLBINDRENDERBUFFEREXTPROC glBindRenderbufferEXTProcPtr
|
||||
#define PFNGLDELETERENDERBUFFERSEXTPROC glDeleteRenderbuffersEXTProcPtr
|
||||
#define PFNGLGENRENDERBUFFERSEXTPROC glGenRenderbuffersEXTProcPtr
|
||||
#define PFNGLRENDERBUFFERSTORAGEEXTPROC glRenderbufferStorageEXTProcPtr
|
||||
#define PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC glGetRenderbufferParameterivEXTProcPtr
|
||||
#define PFNGLISFRAMEBUFFEREXTPROC glIsFramebufferEXTProcPtr
|
||||
#define PFNGLBINDFRAMEBUFFEREXTPROC glBindFramebufferEXTProcPtr
|
||||
#define PFNGLDELETEFRAMEBUFFERSEXTPROC glDeleteFramebuffersEXTProcPtr
|
||||
#define PFNGLGENFRAMEBUFFERSEXTPROC glGenFramebuffersEXTProcPtr
|
||||
#define PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC glCheckFramebufferStatusEXTProcPtr
|
||||
#define PFNGLFRAMEBUFFERTEXTURE2DEXTPROC glFramebufferTexture2DEXTProcPtr
|
||||
#define PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC glFramebufferRenderbufferEXTProcPtr
|
||||
#define PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC glGetFramebufferAttachmentParameterivEXTProcPtr
|
||||
#define PFNGLGENERATEMIPMAPEXTPROC glGenerateMipmapEXTProcPtr
|
||||
#define PFNGLDELETEOBJECTARBPROC glDeleteObjectARBProcPtr
|
||||
#define PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARBProcPtr
|
||||
#define PFNGLSHADERSOURCEARBPROC glShaderSourceARBProcPtr
|
||||
#define PFNGLCOMPILESHADERARBPROC glCompileShaderARBProcPtr
|
||||
#define PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARBProcPtr
|
||||
#define PFNGLGETINFOLOGARBPROC glGetInfoLogARBProcPtr
|
||||
#define PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARBProcPtr
|
||||
#define PFNGLATTACHOBJECTARBPROC glAttachObjectARBProcPtr
|
||||
#define PFNGLLINKPROGRAMARBPROC glLinkProgramARBProcPtr
|
||||
#define PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARBProcPtr
|
||||
#define PFNGLVALIDATEPROGRAMARBPROC glValidateProgramARBProcPtr
|
||||
#define PFNGLENABLEVERTEXATTRIBARRAYARBPROC glEnableVertexAttribArrayARBProcPtr
|
||||
#define PFNGLDISABLEVERTEXATTRIBARRAYARBPROC glDisableVertexAttribArrayARBProcPtr
|
||||
#define PFNGLGETATTRIBLOCATIONARBPROC glGetAttribLocationARBProcPtr
|
||||
#define PFNGLVERTEXATTRIBPOINTERARBPROC glVertexAttribPointerARBProcPtr
|
||||
#define PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARBProcPtr
|
||||
#define PFNGLGETUNIFORMIVARBPROC glGetUniformivARBProcPtr
|
||||
#define PFNGLUNIFORM1FARBPROC glUniform1fARBProcPtr
|
||||
#define PFNGLUNIFORM3FARBPROC glUniform3fARBProcPtr
|
||||
#define PFNGLUNIFORM3FVARBPROC glUniform3fvARBProcPtr
|
||||
#define PFNGLUNIFORM4FVARBPROC glUnifrom4fvARBProcPtr
|
||||
#define PFNGLUNIFORM1IARBPROC glUniform1iARBProcPtr
|
||||
#define PFNGLUNIFORMMATRIX4FVARBPROC glUniformMatrix4fvARBProcPtr
|
||||
#endif // __APPLE__
|
||||
|
||||
#define vglFogCoordfEXT GLEXT_CALL( OGL_FOG_COORDF, PFNGLFOGCOORDFEXTPROC )
|
||||
#define vglFogCoordPointerEXT GLEXT_CALL( OGL_FOG_COORD_POINTER, PFNGLFOGCOORDPOINTEREXTPROC )
|
||||
@@ -312,6 +366,7 @@ void opengl_print_extensions();
|
||||
#define vglDeleteBuffersARB GLEXT_CALL( OGL_DELETE_BUFFERS, PFNGLDELETEBUFFERSARBPROC )
|
||||
#define vglGenBuffersARB GLEXT_CALL( OGL_GEN_BUFFERS, PFNGLGENBUFFERSARBPROC )
|
||||
#define vglBufferDataARB GLEXT_CALL( OGL_BUFFER_DATA, PFNGLBUFFERDATAARBPROC )
|
||||
#define vglBufferSubDataARB GLEXT_CALL( OGL_BUFFER_SUB_DATA, PFNGLBUFFERSUBDATAARBPROC )
|
||||
#define vglMapBufferARB GLEXT_CALL2( OGL_MAP_BUFFER, PFNGLMAPBUFFERARBPROC )
|
||||
#define vglUnmapBufferARB GLEXT_CALL( OGL_UNMAP_BUFFER, PFNGLUNMAPBUFFERARBPROC )
|
||||
#define vglIsRenderbufferEXT GLEXT_CALL2( OGL_IS_RENDERBUFFER, PFNGLISRENDERBUFFEREXTPROC )
|
||||
@@ -329,8 +384,30 @@ void opengl_print_extensions();
|
||||
#define vglFramebufferRenderbufferEXT GLEXT_CALL( OGL_FRAMEBUFFER_RENDERBUFFER, PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC )
|
||||
#define vglGetFramebufferAttachmentParameterivEXT GLEXT_CALL( OGL_GET_FRAMEBUFFER_ATTACHMENT_PARAMETER_IV, PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC )
|
||||
#define vglGenerateMipmapEXT GLEXT_CALL( OGL_GENERATE_MIPMAP, PFNGLGENERATEMIPMAPEXTPROC )
|
||||
#define vglDeleteObjectARB GLEXT_CALL( OGL_DELETE_OBJECT, PFNGLDELETEOBJECTARBPROC )
|
||||
#define vglCreateShaderObjectARB GLEXT_CALL2( OGL_CREATE_SHADER_OBJECT, PFNGLCREATESHADEROBJECTARBPROC )
|
||||
#define vglShaderSourceARB GLEXT_CALL( OGL_SHADER_SOURCE, PFNGLSHADERSOURCEARBPROC )
|
||||
#define vglCompileShaderARB GLEXT_CALL( OGL_COMPILE_SHADER, PFNGLCOMPILESHADERARBPROC )
|
||||
#define vglGetObjectParameterivARB GLEXT_CALL( OGL_GET_OBJECT_PARAMETERIV, PFNGLGETOBJECTPARAMETERIVARBPROC )
|
||||
#define vglGetInfoLogARB GLEXT_CALL( OGL_GET_INFO_LOG, PFNGLGETINFOLOGARBPROC )
|
||||
#define vglCreateProgramObjectARB GLEXT_CALL2( OGL_CREATE_PROGRAM_OBJECT, PFNGLCREATEPROGRAMOBJECTARBPROC )
|
||||
#define vglAttachObjectARB GLEXT_CALL( OGL_ATTACH_OBJECT, PFNGLATTACHOBJECTARBPROC )
|
||||
#define vglLinkProgramARB GLEXT_CALL( OGL_LINK_PROGRAM, PFNGLLINKPROGRAMARBPROC )
|
||||
#define vglUseProgramObjectARB GLEXT_CALL( OGL_USE_PROGRAM_OBJECT, PFNGLUSEPROGRAMOBJECTARBPROC )
|
||||
#define vglValidateProgramARB GLEXT_CALL( OGL_VALIDATE_PROGRAM, PFNGLVALIDATEPROGRAMARBPROC )
|
||||
#define vglEnableVertexAttribArrayARB GLEXT_CALL( OGL_ENABLE_VERTEX_ATTRIB_ARRAY, PFNGLENABLEVERTEXATTRIBARRAYARBPROC )
|
||||
#define vglDisableVertexAttribArrayARB GLEXT_CALL( OGL_DISABLE_VERTEX_ATTRIB_ARRAY, PFNGLDISABLEVERTEXATTRIBARRAYARBPROC )
|
||||
#define vglGetAttribLocationARB GLEXT_CALL2( OGL_GET_ATTRIB_LOCATION, PFNGLGETATTRIBLOCATIONARBPROC )
|
||||
#define vglVertexAttribPointerARB GLEXT_CALL( OGL_VERTEX_ATTRIB_POINTER, PFNGLVERTEXATTRIBPOINTERARBPROC )
|
||||
#define vglGetUniformLocationARB GLEXT_CALL2( OGL_GET_UNIFORM_LOCATION, PFNGLGETUNIFORMLOCATIONARBPROC )
|
||||
#define vglGetUniformivARB GLEXT_CALL( OGL_GET_UNIFORMIV, PFNGLGETUNIFORMIVARBPROC )
|
||||
#define vglUniform1fARB GLEXT_CALL( OGL_UNIFORM1F, PFNGLUNIFORM1FARBPROC )
|
||||
#define vglUniform3fARB GLEXT_CALL( OGL_UNIFORM3F, PFNGLUNIFORM3FARBPROC )
|
||||
#define vglUniform3fvARB GLEXT_CALL( OGL_UNIFORM3FV, PFNGLUNIFORM3FVARBPROC )
|
||||
#define vglUniform4fvARB GLEXT_CALL( OGL_UNIFORM3FV, PFNGLUNIFORM4FVARBPROC )
|
||||
#define vglUniform1iARB GLEXT_CALL( OGL_UNIFORM1I, PFNGLUNIFORM1IARBPROC )
|
||||
#define vglUniformMatrix4fvARB GLEXT_CALL( OGL_UNIFORM_MATRIX4FV, PFNGLUNIFORMMATRIX4FVARBPROC )
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
// special extensions
|
||||
#define vwglSwapIntervalEXT GLEXT_SPC_CALL( OGL_SPC_WGL_SWAP_INTERVAL, PFNWGLSWAPINTERVALEXTPROC )
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
#include "graphics/gropengl.h"
|
||||
#include "graphics/gropenglextension.h"
|
||||
#include "graphics/gropengllight.h"
|
||||
#include "graphics/gropenglstate.h"
|
||||
#include "graphics/2d.h"
|
||||
#include "render/3d.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
@@ -208,7 +209,6 @@
|
||||
|
||||
// Variables
|
||||
opengl_light *opengl_lights = NULL;
|
||||
bool *currently_enabled_lights = NULL;
|
||||
bool lighting_is_enabled = true;
|
||||
int Num_active_gl_lights = 0;
|
||||
int GL_center_alpha = 0;
|
||||
@@ -255,58 +255,62 @@ void FSLight2GLLight(light *FSLight, opengl_light *GLLight)
|
||||
GLLight->SpotDir.y = 0.0f;
|
||||
GLLight->SpotDir.z = -1.0f;
|
||||
// spot exponent
|
||||
GLLight->SpotExp = Cmdline_ogl_spec / 2.0f;
|
||||
GLLight->SpotExp = Cmdline_ogl_spec * 0.5f;
|
||||
// spot cutoff
|
||||
GLLight->SpotCutOff = 180.0f; // special value, light in all directions
|
||||
// defaults to disable attenuation
|
||||
GLLight->ConstantAtten = 1.0f;
|
||||
GLLight->LinearAtten = 0.0f;
|
||||
GLLight->QuadraticAtten = 0.0f;
|
||||
// position
|
||||
GLLight->Position.x = FSLight->vec.xyz.x;
|
||||
GLLight->Position.y = FSLight->vec.xyz.y;
|
||||
GLLight->Position.z = FSLight->vec.xyz.z; // flipped axis for FS2
|
||||
GLLight->Position.w = 1.0f;
|
||||
|
||||
|
||||
//If the light is a directional light
|
||||
if (FSLight->type == LT_DIRECTIONAL) {
|
||||
GLLight->Position.x = -FSLight->vec.xyz.x;
|
||||
GLLight->Position.y = -FSLight->vec.xyz.y;
|
||||
GLLight->Position.z = -FSLight->vec.xyz.z;
|
||||
GLLight->Position.w = 0.0f; // Directional lights in OpenGL have w set to 0 and the direction vector in the position field
|
||||
switch (FSLight->type) {
|
||||
case LT_POINT: {
|
||||
// this crap still needs work...
|
||||
GLLight->ConstantAtten = 0.0f;
|
||||
GLLight->LinearAtten = (1.0f / MAX(FSLight->rada, FSLight->radb)) * 1.25f;
|
||||
|
||||
GLLight->Specular.r *= static_light_factor;
|
||||
GLLight->Specular.g *= static_light_factor;
|
||||
GLLight->Specular.b *= static_light_factor;
|
||||
}
|
||||
|
||||
//If the light is a point or tube type
|
||||
if ( (FSLight->type == LT_POINT) || (FSLight->type == LT_TUBE) ) {
|
||||
// this crap still needs work...
|
||||
GLLight->ConstantAtten = 0.0f;
|
||||
GLLight->LinearAtten = (1.0f / MAX(FSLight->rada, FSLight->radb));
|
||||
|
||||
if (FSLight->type == LT_POINT) {
|
||||
GLLight->Specular.r *= static_point_factor;
|
||||
GLLight->Specular.g *= static_point_factor;
|
||||
GLLight->Specular.b *= static_point_factor;
|
||||
GLLight->Ambient.r = (GLLight->Diffuse.r / 2.0f);
|
||||
GLLight->Ambient.g = (GLLight->Diffuse.r / 2.0f);
|
||||
GLLight->Ambient.b = (GLLight->Diffuse.r / 2.0f);
|
||||
GLLight->LinearAtten *= 1.25f;
|
||||
} else {
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LT_TUBE: {
|
||||
GLLight->Specular.r *= static_tube_factor;
|
||||
GLLight->Specular.g *= static_tube_factor;
|
||||
GLLight->Specular.b *= static_tube_factor;
|
||||
}
|
||||
GLLight->Specular.b *= static_tube_factor;
|
||||
|
||||
GLLight->Position.x = FSLight->vec.xyz.x;
|
||||
GLLight->Position.y = FSLight->vec.xyz.y;
|
||||
GLLight->Position.z = FSLight->vec.xyz.z; // flipped axis for FS2
|
||||
GLLight->Position.w = 1.0f;
|
||||
|
||||
if (FSLight->type == LT_TUBE) {
|
||||
GLLight->SpotDir.x = FSLight->vec2.xyz.x;
|
||||
GLLight->SpotDir.y = FSLight->vec2.xyz.y;
|
||||
GLLight->SpotDir.z = FSLight->vec2.xyz.z;
|
||||
GLLight->SpotDir.x = FSLight->vec2.xyz.x * 1.5f;
|
||||
GLLight->SpotDir.y = FSLight->vec2.xyz.y * 1.5f;
|
||||
GLLight->SpotDir.z = FSLight->vec2.xyz.z * 1.5f;
|
||||
GLLight->SpotCutOff = 90.0f;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LT_DIRECTIONAL: {
|
||||
GLLight->Position.x = -FSLight->vec.xyz.x;
|
||||
GLLight->Position.y = -FSLight->vec.xyz.y;
|
||||
GLLight->Position.z = -FSLight->vec.xyz.z;
|
||||
GLLight->Position.w = 0.0f; // Directional lights in OpenGL have w set to 0
|
||||
|
||||
GLLight->Specular.r *= static_light_factor;
|
||||
GLLight->Specular.g *= static_light_factor;
|
||||
GLLight->Specular.b *= static_light_factor;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Int3();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,16 +380,8 @@ int opengl_sort_active_lights(const void *a, const void *b)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// finds the first unoccupied light
|
||||
void opengl_pre_render_init_lights()
|
||||
{
|
||||
for (int i = 0; i < GL_max_lights; i++) {
|
||||
if (currently_enabled_lights[i]) {
|
||||
glDisable(GL_LIGHT0+i);
|
||||
currently_enabled_lights[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
// sort the lights to try and get the most visible lights on the first pass
|
||||
qsort(opengl_lights, Num_active_gl_lights, sizeof(opengl_light), opengl_sort_active_lights);
|
||||
}
|
||||
@@ -398,13 +394,17 @@ static matrix last_view_orient;
|
||||
|
||||
static bool use_last_view = false;
|
||||
|
||||
void opengl_change_active_lights(int pos)
|
||||
void opengl_change_active_lights(int pos, int d_offset)
|
||||
{
|
||||
if ( !lighting_is_enabled )
|
||||
return;
|
||||
int i, offset;
|
||||
|
||||
int i;
|
||||
int offset = pos * GL_max_lights;
|
||||
if ( !lighting_is_enabled ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Assert( d_offset < GL_max_lights );
|
||||
|
||||
offset = (pos * GL_max_lights) + d_offset;
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
@@ -475,22 +475,22 @@ void opengl_change_active_lights(int pos)
|
||||
|
||||
|
||||
for (i = 0; i < GL_max_lights; i++) {
|
||||
if (currently_enabled_lights[i]) {
|
||||
glDisable(GL_LIGHT0+i);
|
||||
currently_enabled_lights[i] = false;
|
||||
if ( (offset + i) >= Num_active_gl_lights ) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (offset + i) >= Num_active_gl_lights )
|
||||
continue;
|
||||
|
||||
if (opengl_lights[offset+i].occupied) {
|
||||
opengl_set_light(i, &opengl_lights[offset+i]);
|
||||
|
||||
glEnable(GL_LIGHT0+i);
|
||||
currently_enabled_lights[i] = true;
|
||||
GL_state.Light(i, GL_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// make sure that we turn off any lights that we aren't using right now
|
||||
for ( ; i < GL_max_lights; i++) {
|
||||
GL_state.Light(i, GL_FALSE);
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -515,6 +515,9 @@ void gr_opengl_set_light(light *fs_light)
|
||||
if (Num_active_gl_lights >= MAX_LIGHTS)
|
||||
return;
|
||||
|
||||
//if (fs_light->type == LT_POINT)
|
||||
// return;
|
||||
|
||||
// init the light
|
||||
FSLight2GLLight(fs_light, &opengl_lights[Num_active_gl_lights]);
|
||||
opengl_lights[Num_active_gl_lights++].occupied = true;
|
||||
@@ -633,7 +636,15 @@ void opengl_calculate_ambient_factor()
|
||||
GL_light_ambient[3] = 1.0f;
|
||||
}
|
||||
|
||||
void opengl_init_light()
|
||||
void opengl_light_shutdown()
|
||||
{
|
||||
if (opengl_lights != NULL) {
|
||||
vm_free(opengl_lights);
|
||||
opengl_lights = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void opengl_light_init()
|
||||
{
|
||||
opengl_calculate_ambient_factor();
|
||||
|
||||
@@ -649,21 +660,17 @@ void opengl_init_light()
|
||||
// allocate memory for enabled lights
|
||||
Verify(GL_max_lights > 0);
|
||||
|
||||
if ( currently_enabled_lights == NULL )
|
||||
currently_enabled_lights = (bool *) vm_malloc_q(GL_max_lights * sizeof(bool));
|
||||
|
||||
if ( opengl_lights == NULL )
|
||||
opengl_lights = (opengl_light *) vm_malloc_q(MAX_LIGHTS * sizeof(opengl_light));
|
||||
|
||||
if ( (currently_enabled_lights == NULL) || (opengl_lights == NULL) )
|
||||
if (opengl_lights == NULL)
|
||||
Error( LOCATION, "Unable to allocate memory for lights!\n");
|
||||
|
||||
memset( currently_enabled_lights, 0, GL_max_lights * sizeof(bool) );
|
||||
memset( opengl_lights, 0, MAX_LIGHTS * sizeof(opengl_light) );
|
||||
}
|
||||
|
||||
extern int Cmdline_no_emissive;
|
||||
void opengl_default_light_settings(int ambient = 1, int emission = 1, int specular = 1)
|
||||
void opengl_default_light_settings(int ambient, int emission, int specular)
|
||||
{
|
||||
if (!lighting_is_enabled)
|
||||
return;
|
||||
@@ -695,8 +702,9 @@ void opengl_default_light_settings(int ambient = 1, int emission = 1, int specul
|
||||
|
||||
void gr_opengl_set_lighting(bool set, bool state)
|
||||
{
|
||||
if (Cmdline_nohtl)
|
||||
if (Cmdline_nohtl) {
|
||||
return;
|
||||
}
|
||||
|
||||
lighting_is_enabled = set;
|
||||
|
||||
@@ -710,17 +718,10 @@ void gr_opengl_set_lighting(bool set, bool state)
|
||||
}
|
||||
|
||||
for (int i = 0; i < GL_max_lights; i++) {
|
||||
if (currently_enabled_lights[i])
|
||||
glDisable(GL_LIGHT0+i);
|
||||
GL_state.Light(i, GL_FALSE);
|
||||
}
|
||||
|
||||
memset( currently_enabled_lights, 0, GL_max_lights * sizeof(bool) );
|
||||
|
||||
if (state) {
|
||||
glEnable(GL_LIGHTING);
|
||||
} else {
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
GL_state.Lighting( (state) ? GL_TRUE : GL_FALSE );
|
||||
}
|
||||
|
||||
void gr_opengl_set_ambient_light(int red, int green, int blue)
|
||||
|
||||
@@ -113,26 +113,25 @@ struct opengl_light
|
||||
struct light_data;
|
||||
|
||||
//Variables
|
||||
extern opengl_light *opengl_lights;
|
||||
extern bool *currently_enabled_lights;
|
||||
extern bool lighting_is_enabled;
|
||||
extern GLint GL_max_lights;
|
||||
extern int Num_active_gl_lights;
|
||||
extern int GL_center_alpha;
|
||||
|
||||
//Functions
|
||||
void FSLight2GLLight(light *FSLight, opengl_light *GLLight);
|
||||
int gr_opengl_make_light(light *fs_light, int idx, int priority); //unused -- stub function
|
||||
void gr_opengl_modify_light(light *fs_light, int idx, int priority); //unused -- stub function
|
||||
void gr_opengl_destroy_light(int idx); //unused -- stub function
|
||||
void gr_opengl_set_light(light *fs_light);
|
||||
void gr_opengl_reset_lighting();
|
||||
void gr_opengl_set_lighting(bool set, bool state);
|
||||
void opengl_pre_render_init_lights();
|
||||
void opengl_change_active_lights(int);
|
||||
void opengl_init_light();
|
||||
void gr_opengl_center_alpha(int type);
|
||||
void gr_opengl_set_center_alpha(int type);
|
||||
void gr_opengl_set_ambient_light(int red, int green, int blue);
|
||||
|
||||
void opengl_change_active_lights(int pos, int d_offset = 0);
|
||||
void opengl_light_init();
|
||||
void opengl_light_shutdown();
|
||||
void opengl_default_light_settings(int amb = 1, int emi = 1, int spec = 1);
|
||||
|
||||
#endif //_GROPENGLLIGHT_H
|
||||
+385
-423
File diff suppressed because it is too large.
Load diff
@@ -151,65 +151,49 @@
|
||||
#include "graphics/gropengl.h"
|
||||
|
||||
|
||||
//turns on/off GL_TEXTUREx_ARB
|
||||
void opengl_switch_arb(int unit, int state);
|
||||
|
||||
typedef struct tcache_slot_opengl {
|
||||
GLuint texture_id;
|
||||
GLenum texture_target;
|
||||
float u_scale, v_scale;
|
||||
GLuint texture_id;
|
||||
GLenum texture_target;
|
||||
float u_scale, v_scale;
|
||||
int bitmap_handle;
|
||||
int size;
|
||||
int time_created;
|
||||
ushort w,h;
|
||||
ushort w, h;
|
||||
ubyte bpp;
|
||||
ubyte mipmap_levels;
|
||||
} tcache_slot_opengl;
|
||||
|
||||
extern int GL_texture_sections;
|
||||
extern int GL_texture_ram;
|
||||
extern int GL_frame_count;
|
||||
extern int GL_min_texture_width;
|
||||
extern GLint GL_max_texture_width;
|
||||
extern int GL_min_texture_height;
|
||||
extern GLint GL_max_texture_height;
|
||||
extern int GL_square_textures;
|
||||
extern int GL_textures_in;
|
||||
extern int GL_textures_in_frame;
|
||||
extern int GL_last_bitmap_id;
|
||||
extern int GL_last_detail;
|
||||
extern int GL_last_bitmap_type;
|
||||
extern int GL_last_section_x;
|
||||
extern int GL_last_section_y;
|
||||
extern GLint GL_supported_texture_units;
|
||||
extern int GL_should_preload;
|
||||
extern ubyte GL_xlat[256];
|
||||
extern int GL_mipmap_filter;
|
||||
extern GLenum GL_texture_target;
|
||||
extern GLenum GL_texture_face;
|
||||
extern GLfloat GL_anisotropy;
|
||||
extern bool GL_rendering_to_framebuffer;
|
||||
|
||||
void opengl_switch_arb(int unit, int state);
|
||||
void opengl_tcache_init();
|
||||
void opengl_free_texture_slot(int n);
|
||||
void opengl_tcache_flush();
|
||||
void opengl_tcache_cleanup();
|
||||
void opengl_tcache_shutdown();
|
||||
void opengl_tcache_frame();
|
||||
int gr_opengl_tcache_set(int bitmap_handle, int bitmap_type, float *u_scale, float *v_scale, int fail_on_full = 0, int force = 0, int stage = 0);
|
||||
void opengl_set_additive_tex_env();
|
||||
void opengl_set_modulate_tex_env();
|
||||
void gr_opengl_set_tex_env_scale(float scale);
|
||||
int gr_opengl_preload(int bitmap_num, int is_aabitmap);
|
||||
void gr_opengl_preload_init();
|
||||
void opengl_preload_init();
|
||||
GLfloat opengl_get_max_anisotropy();
|
||||
void opengl_set_anisotropy(GLfloat aniso_value = GL_anisotropy);
|
||||
void gr_opengl_set_texture_panning(float u, float v, bool enable);
|
||||
void gr_opengl_set_texture_addressing(int mode);
|
||||
//void opengl_set_anisotropy(GLfloat aniso_value = GL_anisotropy);
|
||||
void opengl_kill_render_target(int slot);
|
||||
int opengl_make_render_target(int handle, int slot, int *w, int *h, ubyte *bpp, int *mm_lvl, int flags);
|
||||
int opengl_set_render_target(int slot, int face = -1, int is_static = 0);
|
||||
int opengl_export_image(int slot, int width, int height, int alpha, int num_mipmaps, ubyte *image_data = NULL);
|
||||
|
||||
void opengl_set_texture_target(GLenum target = GL_TEXTURE_2D);
|
||||
void opengl_set_texture_face(GLenum face = GL_TEXTURE_2D);
|
||||
|
||||
int gr_opengl_tcache_set(int bitmap_handle, int bitmap_type, float *u_scale, float *v_scale, int stage = 0);
|
||||
int gr_opengl_preload(int bitmap_num, int is_aabitmap);
|
||||
void gr_opengl_set_texture_panning(float u, float v, bool enable);
|
||||
void gr_opengl_set_texture_addressing(int mode);
|
||||
|
||||
#endif //_GROPENGLTEXTURE_H
|
||||
+596
-341
File diff suppressed because it is too large.
Load diff
@@ -136,7 +136,6 @@ void gr_opengl_start_state_block();
|
||||
int gr_opengl_end_state_block();
|
||||
void gr_opengl_set_state_block(int);
|
||||
|
||||
void gr_opengl_draw_htl_line(vec3d *start, vec3d *end);
|
||||
void gr_opengl_draw_htl_sphere(float rad);
|
||||
void opengl_tnl_shutdown();
|
||||
|
||||
#endif //_GROPENGLTNL_H
|
||||
@@ -66,17 +66,7 @@ int gr_stub_save_screen()
|
||||
return 1;
|
||||
}
|
||||
|
||||
int gr_stub_supports_res_ingame(int res)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int gr_stub_supports_res_interface(int res)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int gr_stub_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int fail_on_full = 0, int force = 0, int tex_unit = 0)
|
||||
int gr_stub_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scale, int tex_unit = 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -187,10 +177,6 @@ void gr_stub_fade_out(int instantaneous)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_filter_set(int filter)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_flash_alpha(int r, int g, int b, int a)
|
||||
{
|
||||
}
|
||||
@@ -203,10 +189,6 @@ void gr_stub_flip()
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_flip_window(uint _hdc, int x, int y, int w, int h )
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_fog_set(int fog_mode, int r, int g, int b, float fog_near, float fog_far)
|
||||
{
|
||||
}
|
||||
@@ -215,10 +197,6 @@ void gr_stub_free_screen(int id)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_get_pixel(int x, int y, int *r, int *g, int *b)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_get_region(int front, int w, int h, ubyte *data)
|
||||
{
|
||||
data = NULL;
|
||||
@@ -296,10 +274,6 @@ void gr_stub_set_additive_tex_env()
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_set_bitmap( int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha )
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_set_buffer(int idx)
|
||||
{
|
||||
}
|
||||
@@ -381,10 +355,6 @@ void gr_stub_translate_texture_matrix(int unit, vec3d *shift)
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_unlock()
|
||||
{
|
||||
}
|
||||
|
||||
void gr_stub_zbias_stub(int bias)
|
||||
{
|
||||
}
|
||||
@@ -636,7 +606,7 @@ void gr_stub_bm_page_in_start()
|
||||
}
|
||||
|
||||
|
||||
void gr_stub_init()
|
||||
bool gr_stub_init()
|
||||
{
|
||||
if (gr_screen.res != GR_640) {
|
||||
gr_screen.res = GR_640;
|
||||
@@ -664,11 +634,9 @@ void gr_stub_init()
|
||||
|
||||
// function pointers...
|
||||
gr_screen.gf_flip = gr_stub_flip;
|
||||
gr_screen.gf_flip_window = gr_stub_flip_window;
|
||||
gr_screen.gf_set_clip = gr_stub_set_clip;
|
||||
gr_screen.gf_reset_clip = gr_stub_reset_clip;
|
||||
|
||||
gr_screen.gf_set_bitmap = gr_stub_set_bitmap;
|
||||
gr_screen.gf_clear = gr_stub_clear;
|
||||
// gr_screen.gf_bitmap = gr_stub_bitmap;
|
||||
gr_screen.gf_bitmap_ex = gr_stub_bitmap_ex;
|
||||
@@ -710,10 +678,7 @@ void gr_stub_init()
|
||||
gr_screen.gf_dump_frame = gr_stub_dump_frame;
|
||||
|
||||
gr_screen.gf_set_gamma = gr_stub_set_gamma;
|
||||
|
||||
gr_screen.gf_lock = gr_stub_lock;
|
||||
gr_screen.gf_unlock = gr_stub_unlock;
|
||||
|
||||
|
||||
gr_screen.gf_fog_set = gr_stub_fog_set;
|
||||
|
||||
// UnknownPlayer : Don't recognize this - MAY NEED DEBUGGING
|
||||
@@ -729,14 +694,10 @@ void gr_stub_init()
|
||||
gr_screen.gf_bm_make_render_target = gr_stub_bm_make_render_target;
|
||||
gr_screen.gf_bm_set_render_target = gr_stub_bm_set_render_target;
|
||||
|
||||
gr_screen.gf_get_pixel = gr_stub_get_pixel;
|
||||
|
||||
gr_screen.gf_set_cull = gr_stub_set_cull;
|
||||
|
||||
gr_screen.gf_cross_fade = gr_stub_cross_fade;
|
||||
|
||||
gr_screen.gf_filter_set = gr_stub_filter_set;
|
||||
|
||||
gr_screen.gf_tcache_set = gr_stub_tcache_set;
|
||||
|
||||
gr_screen.gf_set_clear_color = gr_stub_set_clear_color;
|
||||
@@ -791,6 +752,8 @@ void gr_stub_init()
|
||||
|
||||
gr_screen.gf_draw_line_list = gr_stub_draw_line_list;
|
||||
|
||||
gr_screen.gf_draw_htl_line = gr_stub_draw_htl_line;
|
||||
gr_screen.gf_draw_htl_sphere = gr_stub_draw_htl_sphere;
|
||||
gr_screen.gf_line_htl = gr_stub_draw_htl_line;
|
||||
gr_screen.gf_sphere_htl = gr_stub_draw_htl_sphere;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -9,4 +9,4 @@
|
||||
* $NoKeywords: $
|
||||
*/
|
||||
|
||||
void gr_stub_init();
|
||||
bool gr_stub_init();
|
||||
@@ -237,6 +237,8 @@ extern void grx_tmapper( int nv, vertex * verts[], uint flags );
|
||||
//tristrips, for trails mostly, might find other uses eventualy
|
||||
#define TMAP_FLAG_TRISTRIP (1<<14)
|
||||
#define TMAP_FLAG_TRILIST (1<<15)
|
||||
#define TMAP_FLAG_QUADLIST (1<<16)
|
||||
#define TMAP_FLAG_QUADSTRIP (1<<17)
|
||||
|
||||
#define TMAP_ADDRESS_WRAP 1
|
||||
#define TMAP_ADDRESS_MIRROR 2
|
||||
|
||||
+7
-11
@@ -762,14 +762,14 @@ int Subspace_text_val_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
};
|
||||
|
||||
// message text coords
|
||||
int Head_message_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
/*int Head_message_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
7, 37
|
||||
},
|
||||
{ // GR_1024
|
||||
11, 57
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
// ping text coords
|
||||
int Ping_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
@@ -853,14 +853,14 @@ char Kills_fname[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN] = {
|
||||
// used to draw border around a talking head
|
||||
static hud_frames Head_frame_gauge;
|
||||
static int Head_frame_gauge_loaded = 0;
|
||||
int Head_frame_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
/*int Head_frame_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
5, 35
|
||||
},
|
||||
{ // GR_1024
|
||||
5, 56
|
||||
}
|
||||
};
|
||||
};*/
|
||||
char Head_fname[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN] = {
|
||||
"head1",
|
||||
"head1"
|
||||
@@ -1722,10 +1722,10 @@ void hud_maybe_blit_head_border()
|
||||
// hud_set_default_color();
|
||||
hud_set_gauge_color(HUD_TALKING_HEAD);
|
||||
|
||||
GR_AABITMAP(Head_frame_gauge.first_frame, Head_frame_coords[gr_screen.res][0], Head_frame_coords[gr_screen.res][1]);
|
||||
GR_AABITMAP(Head_frame_gauge.first_frame, current_hud->Head_frame_coords[0], current_hud->Head_frame_coords[1]);
|
||||
|
||||
// draw title
|
||||
gr_string(Head_message_coords[gr_screen.res][0], Head_message_coords[gr_screen.res][1], XSTR("message", 217));
|
||||
gr_string(current_hud->Head_message_coords[0], current_hud->Head_message_coords[1], XSTR("message", 217));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1738,11 +1738,7 @@ void hud_maybe_clear_head_area()
|
||||
|
||||
if ( message_anim_is_playing() ) {
|
||||
// clear
|
||||
if (gr_screen.res == GR_640) {
|
||||
HUD_set_clip(7, 45, 160, 120); // these coords are set in MissionMessage.cpp
|
||||
} else {
|
||||
HUD_set_clip(7, 66, 160, 120);
|
||||
}
|
||||
HUD_set_clip(current_hud->Head_coords[0], current_hud->Head_coords[1], 160, 120);
|
||||
gr_clear();
|
||||
HUD_reset_clip();
|
||||
}
|
||||
|
||||
@@ -368,8 +368,7 @@ void draw_brackets_square(int x1, int y1, int x2, int y2, bool resize)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if(resize || gr_screen.rendering_to_texture != -1)
|
||||
{
|
||||
if ( resize && (gr_screen.custom_size || (gr_screen.rendering_to_texture != -1)) ) {
|
||||
gr_resize_screen_pos(&x1, &y1);
|
||||
gr_resize_screen_pos(&x2, &y2);
|
||||
}
|
||||
|
||||
+119
-55
@@ -261,7 +261,7 @@ int ETS_bar_h[GR_NUM_RESOLUTIONS] = {
|
||||
41
|
||||
};
|
||||
|
||||
typedef struct ets_gauge_info
|
||||
/*typedef struct ets_gauge_info
|
||||
{
|
||||
char letter;
|
||||
int letter_coords[2];
|
||||
@@ -309,6 +309,13 @@ ets_gauge_info Ets_gauge_info_english[GR_NUM_RESOLUTIONS][3] =
|
||||
}
|
||||
};
|
||||
ets_gauge_info *Ets_gauge_info = NULL;
|
||||
*/
|
||||
|
||||
const char Ets_gauge_letter_german[3] = { 'G', 'S', 'A' };
|
||||
const char Ets_gauge_letter_french[3] = { 'C', 'B', 'M' };
|
||||
const char Ets_gauge_letter_english[3] = { 'G', 'S', 'E' };
|
||||
|
||||
const char *Ets_gauge_letter = NULL;
|
||||
|
||||
char Ets_fname[GR_NUM_RESOLUTIONS][MAX_FILENAME_LEN] = {
|
||||
"energy1",
|
||||
@@ -330,11 +337,14 @@ void hud_init_ets()
|
||||
}
|
||||
|
||||
if(Lcl_gr){
|
||||
Ets_gauge_info = Ets_gauge_info_german[gr_screen.res];
|
||||
// Ets_gauge_info = Ets_gauge_info_german[gr_screen.res];
|
||||
Ets_gauge_letter = Ets_gauge_letter_german;
|
||||
} else if(Lcl_fr){
|
||||
Ets_gauge_info = Ets_gauge_info_french[gr_screen.res];
|
||||
// Ets_gauge_info = Ets_gauge_info_french[gr_screen.res];
|
||||
Ets_gauge_letter = Ets_gauge_letter_french;
|
||||
} else {
|
||||
Ets_gauge_info = Ets_gauge_info_english[gr_screen.res];
|
||||
// Ets_gauge_info = Ets_gauge_info_english[gr_screen.res];
|
||||
Ets_gauge_letter = Ets_gauge_letter_english;
|
||||
}
|
||||
|
||||
Hud_ets_inited = 1;
|
||||
@@ -573,6 +583,7 @@ void ai_manage_ets(object* obj)
|
||||
void hud_show_ets()
|
||||
{
|
||||
int i, j, index, y_start, y_end, clip_h, w, h, x, y;
|
||||
int top_coords[2], bottom_coords[2];
|
||||
|
||||
ship* ship_p = &Ships[Player_obj->instance];
|
||||
|
||||
@@ -582,60 +593,117 @@ void hud_show_ets()
|
||||
|
||||
// if at least two gauges are not shown, don't show any
|
||||
i = 0;
|
||||
if (!ship_has_energy_weapons(ship_p)) i++;
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) i++;
|
||||
if (!ship_has_engine_power(ship_p)) i++;
|
||||
if (i >= 2) return;
|
||||
if ( !ship_has_energy_weapons(ship_p)) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( !ship_has_engine_power(ship_p) ) {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i >= 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
hud_set_gauge_color(HUD_ETS_GAUGE);
|
||||
|
||||
Assert( Ets_gauge_letter != NULL );
|
||||
|
||||
// draw the letters for the gauges first, before any clipping occurs
|
||||
i = 0;
|
||||
for ( j = 0; j < 3; j++ )
|
||||
{
|
||||
if (j == 0 && !ship_has_energy_weapons(ship_p))
|
||||
{
|
||||
continue;
|
||||
for (j = 0; j < 3; j++) {
|
||||
switch (j) {
|
||||
case 0: {
|
||||
if ( !ship_has_energy_weapons(ship_p) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
x = current_hud->ETS_gun_text_coords[0];
|
||||
y = current_hud->ETS_gun_text_coords[1];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
x = current_hud->ETS_shield_text_coords[0];
|
||||
y = current_hud->ETS_shield_text_coords[1];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2: {
|
||||
if ( !ship_has_engine_power(ship_p) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
x = current_hud->ETS_engine_text_coords[0];
|
||||
y = current_hud->ETS_engine_text_coords[1];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (j == 1 && Player_obj->flags & OF_NO_SHIELDS)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (j == 2 && !ship_has_engine_power(ship_p))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Assert(Ets_gauge_info != NULL);
|
||||
gr_printf(Ets_gauge_info[i].letter_coords[0], Ets_gauge_info[i].letter_coords[1], NOX("%c"), Ets_gauge_info[j].letter);
|
||||
|
||||
gr_printf(x, y, NOX("%c"), Ets_gauge_letter[j]);
|
||||
i++;
|
||||
}
|
||||
|
||||
// draw the three energy gauges
|
||||
i = 0;
|
||||
index = 0;
|
||||
for ( j = 0; j < 3; j++ ) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
switch (j) {
|
||||
case 0:
|
||||
index = ship_p->weapon_recharge_index;
|
||||
if ( !ship_has_energy_weapons(ship_p) )
|
||||
{
|
||||
continue;
|
||||
case 0: {
|
||||
index = ship_p->weapon_recharge_index;
|
||||
|
||||
if ( !ship_has_energy_weapons(ship_p) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
top_coords[0] = current_hud->ETS_gun_top_coords[0];
|
||||
top_coords[1] = current_hud->ETS_gun_top_coords[1];
|
||||
bottom_coords[0] = current_hud->ETS_gun_bottom_coords[0];
|
||||
bottom_coords[1] = current_hud->ETS_gun_bottom_coords[1];
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
index = ship_p->shield_recharge_index;
|
||||
if ( Player_obj->flags & OF_NO_SHIELDS )
|
||||
{
|
||||
continue;
|
||||
|
||||
case 1: {
|
||||
index = ship_p->shield_recharge_index;
|
||||
|
||||
if (Player_obj->flags & OF_NO_SHIELDS) {
|
||||
continue;
|
||||
}
|
||||
|
||||
top_coords[0] = current_hud->ETS_shield_top_coords[0];
|
||||
top_coords[1] = current_hud->ETS_shield_top_coords[1];
|
||||
bottom_coords[0] = current_hud->ETS_shield_bottom_coords[0];
|
||||
bottom_coords[1] = current_hud->ETS_shield_bottom_coords[1];
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
index = ship_p->engine_recharge_index;
|
||||
if ( !ship_has_engine_power(ship_p) )
|
||||
{
|
||||
continue;
|
||||
|
||||
case 2: {
|
||||
index = ship_p->engine_recharge_index;
|
||||
|
||||
if ( !ship_has_engine_power(ship_p) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
top_coords[0] = current_hud->ETS_engine_top_coords[0];
|
||||
top_coords[1] = current_hud->ETS_engine_top_coords[1];
|
||||
bottom_coords[0] = current_hud->ETS_engine_bottom_coords[0];
|
||||
bottom_coords[1] = current_hud->ETS_engine_bottom_coords[1];
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
clip_h = fl2i( (1 - Energy_levels[index]) * ETS_bar_h[gr_screen.res] );
|
||||
@@ -649,16 +717,14 @@ void hud_show_ets()
|
||||
|
||||
// draw the top portion
|
||||
|
||||
Assert(Ets_gauge_info != NULL);
|
||||
x = Ets_gauge_info[i].top_coords[0];
|
||||
y = Ets_gauge_info[i].top_coords[1];
|
||||
x = top_coords[0];
|
||||
y = top_coords[1];
|
||||
|
||||
GR_AABITMAP_EX(Ets_gauge.first_frame,x,y,w,clip_h,0,0);
|
||||
GR_AABITMAP_EX(Ets_gauge.first_frame, x, y, w, clip_h, 0, 0);
|
||||
|
||||
// draw the bottom portion
|
||||
Assert(Ets_gauge_info != NULL);
|
||||
x = Ets_gauge_info[i].bottom_coords[0];
|
||||
y = Ets_gauge_info[i].bottom_coords[1];
|
||||
x = bottom_coords[0];
|
||||
y = bottom_coords[1];
|
||||
|
||||
y_start = y + (ETS_bar_h[gr_screen.res] - clip_h);
|
||||
y_end = y + ETS_bar_h[gr_screen.res];
|
||||
@@ -677,9 +743,8 @@ void hud_show_ets()
|
||||
// some portion of recharge needs to be drawn
|
||||
|
||||
// draw the top portion
|
||||
Assert(Ets_gauge_info != NULL);
|
||||
x = Ets_gauge_info[i].top_coords[0];
|
||||
y = Ets_gauge_info[i].top_coords[1];
|
||||
x = top_coords[0];
|
||||
y = top_coords[1];
|
||||
|
||||
y_start = y + clip_h;
|
||||
y_end = y + ETS_bar_h[gr_screen.res];
|
||||
@@ -687,9 +752,8 @@ void hud_show_ets()
|
||||
GR_AABITMAP_EX(Ets_gauge.first_frame+1, x, y_start, w, y_end-y_start, 0, clip_h);
|
||||
|
||||
// draw the bottom portion
|
||||
Assert(Ets_gauge_info != NULL);
|
||||
x = Ets_gauge_info[i].bottom_coords[0];
|
||||
y = Ets_gauge_info[i].bottom_coords[1];
|
||||
x = bottom_coords[0];
|
||||
y = bottom_coords[1];
|
||||
|
||||
GR_AABITMAP_EX(Ets_gauge.first_frame+2, x,y,w,ETS_bar_h[gr_screen.res]-clip_h,0,0);
|
||||
}
|
||||
|
||||
@@ -896,7 +896,7 @@ void HUD_fixed_printf(float duration, char * format, ...)
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(tmp, format, args);
|
||||
vsnprintf(tmp, sizeof(tmp)-1, format, args);
|
||||
va_end(args);
|
||||
|
||||
msg_length = strlen(tmp);
|
||||
@@ -987,7 +987,7 @@ void HUD_printf(char *format, ...)
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(tmp, format, args);
|
||||
vsnprintf(tmp, sizeof(tmp)-1, format, args);
|
||||
va_end(args);
|
||||
|
||||
len = strlen(tmp);
|
||||
@@ -1006,7 +1006,7 @@ void HUD_ship_sent_printf(int sh, char *format, ...)
|
||||
Assert(len < HUD_MSG_LENGTH_MAX);
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(tmp + len, format, args);
|
||||
vsnprintf(tmp + len, sizeof(tmp)-1-len, format, args);
|
||||
va_end(args);
|
||||
|
||||
len = strlen(tmp);
|
||||
@@ -1033,7 +1033,7 @@ void HUD_sourced_printf(int source, char *format, ...)
|
||||
}
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(tmp, format, args);
|
||||
vsnprintf(tmp, sizeof(tmp)-1, format, args);
|
||||
va_end(args);
|
||||
Assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
|
||||
hud_sourced_print(source, tmp);
|
||||
|
||||
+13
-1
@@ -244,6 +244,18 @@ gauge_info gauges[MAX_HUD_GAUGE_TYPES] = {
|
||||
{ NULL, HUD_VAR(Wenergy_coords), "$Weapons Energy:", 416, 265, 666, 424, HUD_VAR(Wenergy_size), HUD_VAR(Wenergy_fname), 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(Wenergy_text_coords), "$Weapons Energy Text:", 439, 318, 708, 509, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(Escort_coords), "$Escort List:", 486, 206, 865, 330, 0, HUD_VAR(Escort_filename[0]), 0, HUD_VAR(Escort_htext), 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(Head_coords), "$Talking Head:", 7, 45, 7, 66, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(Head_frame_coords), "$Talking Head Frame:", 5, 35, 5, 56, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(Head_message_coords), "$Talking Head Text:", 7, 37, 11, 57, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_gun_text_coords), "$ETS Gun Text:", 525, 422, 882, 690, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_gun_top_coords), "$ETS Gun Top:", 523, 380, 880, 648, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_gun_bottom_coords), "$ETS Gun Bottom:", 523, 430, 880, 698, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_shield_text_coords), "$ETS Shield Text:", 542, 422, 900, 690, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_shield_top_coords), "$ETS Shield Top:", 540, 380, 898, 648, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_shield_bottom_coords), "$ETS Shield Bottom:", 540, 430, 898, 698, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_engine_text_coords), "$ETS Engine Text:", 559, 422, 917, 690, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_engine_top_coords), "$ETS Engine Top:", 557, 380, 916, 648, 0, 0, 0, 0, 0, -1, -1 },
|
||||
{ NULL, HUD_VAR(ETS_engine_bottom_coords), "$ETS Engine Bottom:", 557, 430, 916, 698, 0, 0, 0, 0, 0, -1, -1 },
|
||||
|
||||
//Mini-gauges
|
||||
{ &gauges[2], HUD_VAR(Hud_mini_3digit), "$Text Base:", 310, 298, 502, 477, 0, 0, 0, 0, 0, -1, -1 },
|
||||
@@ -260,7 +272,7 @@ gauge_info gauges[MAX_HUD_GAUGE_TYPES] = {
|
||||
};
|
||||
|
||||
//Number of gauges
|
||||
int Num_gauge_types = 17;
|
||||
int Num_gauge_types = 29;
|
||||
int Num_custom_gauges = 0;
|
||||
#endif
|
||||
#ifdef NEW_HUD
|
||||
|
||||
@@ -275,6 +275,20 @@ typedef struct hud_info
|
||||
//Hudescort
|
||||
int Escort_coords[2];
|
||||
|
||||
int Head_frame_coords[2];
|
||||
int Head_message_coords[2];
|
||||
int Head_coords[2];
|
||||
|
||||
int ETS_gun_text_coords[2];
|
||||
int ETS_gun_top_coords[2];
|
||||
int ETS_gun_bottom_coords[2];
|
||||
int ETS_shield_text_coords[2];
|
||||
int ETS_shield_top_coords[2];
|
||||
int ETS_shield_bottom_coords[2];
|
||||
int ETS_engine_text_coords[2];
|
||||
int ETS_engine_top_coords[2];
|
||||
int ETS_engine_bottom_coords[2];
|
||||
|
||||
//*Gauges*
|
||||
//Shield mini text
|
||||
int Hud_mini_3digit[2];
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
* get object vars correct
|
||||
*
|
||||
* Revision 2.79 2006/01/13 03:30:59 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* �bercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 2.78 2006/01/10 01:23:09 phreak
|
||||
* Fixed a logic error when dealing with non-targetable subsystems
|
||||
@@ -1094,7 +1094,7 @@ typedef struct homing_beep_info
|
||||
float precalced_interp; // a precalculated value used in a linear interpretation
|
||||
} homing_beep_info;
|
||||
|
||||
homing_beep_info Homing_beep = { -1, 0, 150, 1000, 30.0f, 1500.0f };
|
||||
homing_beep_info Homing_beep = { -1, 0, 150, 1000, 30.0f, 1500.0f, 1.729412f };
|
||||
|
||||
// Set at the start of a mission, used to decide how to draw the separation for the warning missile indicators
|
||||
float Min_warning_missile_dist;
|
||||
@@ -1601,8 +1601,8 @@ void hud_make_shader(shader *sh, int r, int g, int b, float dimmer = 1000.0f)
|
||||
float tmp = 0.025f * i2fl(HUD_color_alpha+1.0f);
|
||||
|
||||
R = fl2i(r * tmp);
|
||||
G = fl2i(r * tmp); // fl2i(g * tmp); WTF??
|
||||
B = fl2i(r * tmp); // fl2i(b * tmp); WTF??
|
||||
G = R; // fl2i(g * tmp); WTF??
|
||||
B = R; // fl2i(b * tmp); WTF??
|
||||
A = fl2i((i2fl(r) / dimmer)*(i2fl(HUD_color_alpha) / 15.0f) * 255.0f);
|
||||
|
||||
gr_create_shader( sh, R, G, B, A );
|
||||
@@ -2085,19 +2085,19 @@ void hud_target_missile(object *source_obj, int next_flag)
|
||||
|
||||
if ( !target_found ) {
|
||||
// if no bomb is found, search for bombers
|
||||
ship_obj *start, *so;
|
||||
ship_obj *s_start, *so;
|
||||
|
||||
if ( (aip->target_objnum != -1)
|
||||
&& (Objects[aip->target_objnum].type == OBJ_SHIP)
|
||||
&& ((Ship_info[Ships[Objects[aip->target_objnum].instance].ship_info_index].flags & SIF_BOMBER)
|
||||
|| (Objects[aip->target_objnum].flags & OF_TARGETABLE_AS_BOMB))) {
|
||||
int index = Ships[Objects[aip->target_objnum].instance].ship_list_index;
|
||||
start = get_ship_obj_ptr_from_index(index);
|
||||
s_start = get_ship_obj_ptr_from_index(index);
|
||||
} else {
|
||||
start = GET_FIRST(&Ship_obj_list);
|
||||
s_start = GET_FIRST(&Ship_obj_list);
|
||||
}
|
||||
|
||||
for (so=advance_ship(start, next_flag); so!=start; so=advance_ship(so, next_flag)) {
|
||||
for (so=advance_ship(s_start, next_flag); so!=s_start; so=advance_ship(so, next_flag)) {
|
||||
A = &Objects[so->objnum];
|
||||
|
||||
// don't look at header
|
||||
@@ -4778,7 +4778,6 @@ void hud_show_lead_indicator_quick(vec3d *target_world_pos, object *targetp)
|
||||
polymodel *pm;
|
||||
ship_weapon *swp;
|
||||
weapon_info *wip;
|
||||
weapon_info *tmp=NULL;
|
||||
float dist_to_target, time_to_target, target_moved_dist, prange;
|
||||
int bank_to_fire, indicator_frame, frame_offset;
|
||||
float sx, sy;
|
||||
|
||||
@@ -893,7 +893,6 @@ void hud_render_target_setup(vec3d *camera_eye, matrix *camera_orient, float zoo
|
||||
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
|
||||
gr_set_view_matrix(&Eye_position, &Eye_matrix);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------
|
||||
@@ -1604,6 +1603,12 @@ void hud_render_target_ship(object *target_objp)
|
||||
model_set_detail_level(target_sip->hud_target_lod);
|
||||
}
|
||||
|
||||
// render transparent, if we are supposed to
|
||||
if (target_sip->flags2 & SIF2_TRANSPARENT) {
|
||||
model_set_alpha(target_sip->alpha_max);
|
||||
flags |= MR_ALL_XPARENT;
|
||||
}
|
||||
|
||||
// maybe render a special hud-target-only model
|
||||
if(target_sip->model_num_hud >= 0){
|
||||
model_render( target_sip->model_num_hud, &target_objp->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING);
|
||||
@@ -1730,7 +1735,7 @@ void hud_render_target_weapon(object *target_objp)
|
||||
weapon_info *target_wip = NULL;
|
||||
weapon *wp = NULL;
|
||||
object *viewer_obj, *viewed_obj;
|
||||
int *replacement_textures = NULL;
|
||||
texture_map *replacement_textures = NULL;
|
||||
int target_team, is_homing, is_player_missile, missile_view, viewed_model_num, hud_target_lod, w, h;
|
||||
float factor;
|
||||
char outstr[100]; // temp buffer
|
||||
@@ -1751,12 +1756,12 @@ void hud_render_target_weapon(object *target_objp)
|
||||
}
|
||||
|
||||
if ( Detail.targetview_model ) {
|
||||
|
||||
viewer_obj = Player_obj;
|
||||
viewed_obj = target_objp;
|
||||
missile_view = FALSE;
|
||||
viewed_model_num = target_wip->model_num;
|
||||
hud_target_lod = target_wip->hud_target_lod;
|
||||
|
||||
if ( is_homing && is_player_missile ) {
|
||||
ship *homing_shipp = &Ships[wp->homing_object->instance];
|
||||
ship_info *homing_sip = &Ship_info[homing_shipp->ship_info_index];
|
||||
@@ -1769,15 +1774,14 @@ void hud_render_target_weapon(object *target_objp)
|
||||
hud_target_lod = homing_sip->hud_target_lod;
|
||||
}
|
||||
|
||||
if (Targetbox_wire!=0)
|
||||
{
|
||||
if ( Targetbox_wire != 0 ) {
|
||||
int is_bright = 0;
|
||||
|
||||
model_set_outline_color_fast(iff_get_color_by_team(target_team, Player_ship->team, is_bright));
|
||||
model_set_outline_color_fast( iff_get_color_by_team(target_team, Player_ship->team, is_bright) );
|
||||
|
||||
flags = (Cmdline_nohtl) ? MR_SHOW_OUTLINE : MR_SHOW_OUTLINE_HTL;
|
||||
|
||||
if (Targetbox_wire==1)
|
||||
if (Targetbox_wire == 1)
|
||||
flags |=MR_NO_POLYS;
|
||||
}
|
||||
|
||||
|
||||
+108
-869
File diff suppressed because it is too large.
Load diff
@@ -114,6 +114,18 @@ typedef struct Joy_info {
|
||||
int axis_max[JOY_NUM_AXES];
|
||||
} Joy_info;
|
||||
|
||||
typedef struct joy_button_info {
|
||||
int actual_state; // Set if the button is physically down
|
||||
int state; // Set when the button goes from up to down, cleared on down to up. Different than actual_state after a flush.
|
||||
int down_count;
|
||||
int up_count;
|
||||
int down_time;
|
||||
uint last_down_check; // timestamp in milliseconds of last
|
||||
} joy_button_info;
|
||||
|
||||
const int joy_pollrate = 1000 / 18; // poll at 18Hz
|
||||
|
||||
|
||||
extern int Joy_sensitivity;
|
||||
extern int Dead_zone_size; // percentage of range that is dead zone
|
||||
|
||||
|
||||
+2
-5
@@ -643,7 +643,7 @@ uint key_get_shift_status()
|
||||
#else
|
||||
if (keyd_pressed[KEY_DEBUG_KEY]) {
|
||||
mprintf(("Cheats_enabled = %i, Key_normal_game = %i\n", Cheats_enabled, Key_normal_game));
|
||||
if ((Cheats_enabled) && Key_normal_game) {
|
||||
if (/*(Cheats_enabled) &&*/ Key_normal_game) {
|
||||
mprintf(("Debug key\n"));
|
||||
shift_status |= KEY_DEBUGGED1;
|
||||
}
|
||||
@@ -916,7 +916,7 @@ void key_mark( uint code, int state, uint latency )
|
||||
#else
|
||||
if ( keyd_pressed[KEY_DEBUG_KEY] ) {
|
||||
mprintf(("Cheats_enabled = %i, Key_normal_game = %i\n", Cheats_enabled, Key_normal_game));
|
||||
if (Cheats_enabled && Key_normal_game) {
|
||||
if (/*Cheats_enabled &&*/ Key_normal_game) {
|
||||
keycode |= KEY_DEBUGGED1;
|
||||
}
|
||||
}
|
||||
@@ -1364,6 +1364,3 @@ void di_cleanup()
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.68 2006/01/13 03:31:09 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* �bercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 2.67 2005/12/29 08:08:36 wmcoolmon
|
||||
* Codebase commit, most notably including objecttypes.tbl
|
||||
@@ -2102,7 +2102,7 @@ void game_process_cheats(int k)
|
||||
extern void prevent_spawning_collision(object *new_obj);
|
||||
ship_subsys *ptr;
|
||||
char name[NAME_LENGTH];
|
||||
int i, ship_idx, ship_class, num_ships = 1;
|
||||
int ship_idx, ship_class, num_ships = 1;
|
||||
|
||||
// if not found, then don't create it :(
|
||||
ship_class = ship_info_lookup("Volition Bravos");
|
||||
|
||||
+3
-1
@@ -250,9 +250,11 @@ void mouse_eval_deltas_di();
|
||||
#endif
|
||||
|
||||
extern int Cmdline_window;
|
||||
extern int Cmdline_no_grab;
|
||||
|
||||
void mouse_force_pos(int x, int y);
|
||||
|
||||
|
||||
int mouse_is_visible()
|
||||
{
|
||||
return !Mouse_hidden;
|
||||
@@ -300,7 +302,7 @@ void mouse_init()
|
||||
// (should be on by default already, just here as a reminder)
|
||||
SDL_EventState( SDL_MOUSEBUTTONDOWN, SDL_ENABLE );
|
||||
SDL_EventState( SDL_MOUSEBUTTONUP, SDL_ENABLE );
|
||||
#endif
|
||||
#endif // SCP_UNIX
|
||||
|
||||
LEAVE_CRITICAL_SECTION( mouse_lock );
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ public:
|
||||
//Setting
|
||||
void set_alphacolor(int r, int g, int b, int alpha);
|
||||
void set_model(char *model_name, bool show_polys=false);
|
||||
void show(bool show){if(show){m_flags&=~JN_HIDE;}else{m_flags|=JN_HIDE;}}
|
||||
void show(bool enabled){if(enabled){m_flags&=~JN_HIDE;}else{m_flags|=JN_HIDE;}}
|
||||
|
||||
//Rendering
|
||||
void render(vec3d *pos, vec3d *view_pos = NULL);
|
||||
|
||||
+2087
-960
File diff suppressed because it is too large.
Load diff
+143
-56
@@ -695,7 +695,7 @@ int GUIScreen::OnFrame(float frametime, bool doevents)
|
||||
int status = OwnerSystem->GetStatus();
|
||||
|
||||
//Pass the status on
|
||||
GUIObject* cgp = (GUIObject*)GET_LAST(&Guiobjects);
|
||||
cgp = (GUIObject*)GET_LAST(&Guiobjects);
|
||||
cgp->Status |= (status & GST_KEYBOARD_STATUS);
|
||||
for(; cgp != END_OF_LIST(&Guiobjects); cgp = cgp_prev)
|
||||
{
|
||||
@@ -735,11 +735,15 @@ int GUIScreen::OnFrame(float frametime, bool doevents)
|
||||
gr_zbuffer_set(GR_ZBUFF_NONE);
|
||||
|
||||
//Draw now. This prevents problems from an object deleting itself or moving around in the list
|
||||
for(cgp = (GUIObject*)GET_LAST(&Guiobjects); cgp != END_OF_LIST(&Guiobjects); cgp = (GUIObject*)GET_PREV(cgp))
|
||||
{
|
||||
if(!doevents)
|
||||
cgp = (GUIObject*)GET_FIRST(&Guiobjects);
|
||||
|
||||
while (cgp != END_OF_LIST(&Guiobjects)) {
|
||||
if ( !doevents )
|
||||
cgp->Status = 0;
|
||||
|
||||
cgp->OnDraw(frametime);
|
||||
|
||||
cgp = (GUIObject*)GET_NEXT(cgp);
|
||||
}
|
||||
|
||||
// reset zbuffer to saved value
|
||||
@@ -757,6 +761,8 @@ GUISystem::GUISystem()
|
||||
GraspedGuiobject=ActiveObject=NULL;
|
||||
Status=LastStatus=0;
|
||||
|
||||
MouseX = MouseY = 0;
|
||||
|
||||
//Fill out Guiobjects with some handy info
|
||||
//On 2nd thought, don't. This is hackish.
|
||||
/*
|
||||
@@ -778,6 +784,7 @@ GUISystem::GUISystem()
|
||||
}*/
|
||||
ClassInfoParsed = false;
|
||||
}
|
||||
|
||||
GUISystem::~GUISystem()
|
||||
{
|
||||
GUIScreen* csp = (GUIScreen*)GET_FIRST(&Screens);
|
||||
@@ -956,13 +963,15 @@ void GUISystem::DestroyClassInfo()
|
||||
GUIObject::GUIObject(std::string in_Name, int x_coord, int y_coord, int x_width, int y_height, int in_style)
|
||||
{
|
||||
//General stuff
|
||||
next = prev = this;
|
||||
LastStatus = Status = 0;
|
||||
OwnerSystem = NULL;
|
||||
OwnerScreen = NULL;
|
||||
Parent = NULL;
|
||||
CloseFunction = NULL;
|
||||
|
||||
list_init(this);
|
||||
list_init(&Children);
|
||||
|
||||
//These would make no sense
|
||||
//x_coord and y_coord of < 0 mean to let the parent handle placement.
|
||||
if(x_width == 0 || y_height == 0)
|
||||
@@ -991,23 +1000,33 @@ GUIObject::GUIObject(std::string in_Name, int x_coord, int y_coord, int x_width,
|
||||
|
||||
GUIObject::~GUIObject()
|
||||
{
|
||||
if(CloseFunction != NULL)
|
||||
if (CloseFunction != NULL)
|
||||
CloseFunction(this);
|
||||
//Set these properly
|
||||
|
||||
DeleteChildren();
|
||||
|
||||
// Set these properly
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
DeleteChildren();
|
||||
}
|
||||
|
||||
void GUIObject::DeleteChildren(GUIObject* exception)
|
||||
{
|
||||
if ( EMPTY(&Children) )
|
||||
return;
|
||||
|
||||
GUIObject* cgp = (GUIObject*)GET_FIRST(&Children);
|
||||
GUIObject* cgp_next;
|
||||
for(; cgp != END_OF_LIST(&Children); cgp = cgp_next)
|
||||
GUIObject* cgp_temp;
|
||||
|
||||
while (cgp != END_OF_LIST(&Children))
|
||||
{
|
||||
cgp_next = (GUIObject*)GET_NEXT(cgp);
|
||||
delete cgp;
|
||||
cgp_temp = cgp;
|
||||
cgp = (GUIObject*)GET_NEXT(cgp);
|
||||
|
||||
delete cgp_temp;
|
||||
}
|
||||
|
||||
list_init(&Children);
|
||||
}
|
||||
|
||||
GUIObject* GUIObject::AddChildInternal(GUIObject *cgp)
|
||||
@@ -1056,7 +1075,7 @@ GUIObject* GUIObject::AddChild(GUIObject* cgp)
|
||||
cgp->OwnerSystem = OwnerSystem;
|
||||
cgp->OwnerScreen = OwnerScreen;
|
||||
|
||||
//Update coordinates (Should be relative x/y and width/height) to absolute coordinates
|
||||
// Update coordinates (Should be relative x/y and width/height) to absolute coordinates
|
||||
cgp->Coords[0] += ChildCoords[0];
|
||||
cgp->Coords[1] += ChildCoords[1];
|
||||
cgp->Coords[2] += ChildCoords[0];
|
||||
@@ -1099,7 +1118,9 @@ int GUIObject::OnFrame(float frametime, int *unused_queue)
|
||||
int rval = OF_TRUE;
|
||||
|
||||
GUIObject *cgp_prev; //Elements will move themselves to the end of the list if they become active
|
||||
for(GUIObject *cgp = (GUIObject*)GET_LAST(&Children); cgp != END_OF_LIST(&Children); cgp = cgp_prev)
|
||||
GUIObject *cgp = (GUIObject*)GET_LAST(&Children);
|
||||
|
||||
for ( ; (cgp != NULL) && (cgp != END_OF_LIST(&Children)); cgp = cgp_prev)
|
||||
{
|
||||
cgp_prev = (GUIObject*)GET_PREV(cgp);
|
||||
cgp->LastStatus = cgp->Status;
|
||||
@@ -1438,23 +1459,26 @@ int Window::DoRefreshSize()
|
||||
//Find caption coordinates
|
||||
if(!(Style & WS_NOTITLEBAR))
|
||||
{
|
||||
int close_w,close_h,hide_w,hide_h;
|
||||
int close_w = 0,close_h = 0;
|
||||
int hide_w = 0, hide_h = 0;
|
||||
|
||||
if(IMG_HANDLE_IS_VALID(GetCIEImageHandle(WCI_CLOSE)))
|
||||
if(IMG_HANDLE_IS_VALID(GetCIEImageHandle(WCI_CLOSE))) {
|
||||
IMG_INFO(GetCIEImageHandle(WCI_CLOSE), &close_w, &close_h);
|
||||
else
|
||||
} else {
|
||||
gr_get_string_size(&close_w, &close_h, "X");
|
||||
}
|
||||
|
||||
if(IMG_HANDLE_IS_VALID(GetCIEImageHandle(WCI_HIDE)))
|
||||
if(IMG_HANDLE_IS_VALID(GetCIEImageHandle(WCI_HIDE))) {
|
||||
IMG_INFO(GetCIEImageHandle(WCI_HIDE), &hide_w, &hide_h);
|
||||
else
|
||||
} else {
|
||||
gr_get_string_size(&hide_w, &hide_h, "-");
|
||||
}
|
||||
|
||||
int caption_min_size;
|
||||
if(Caption.size() > 0)
|
||||
{
|
||||
gr_get_string_size(&w, &h, (char *)Caption.c_str());
|
||||
caption_min_size = w + close_w + hide_w;
|
||||
caption_min_size = w + close_w + hide_w + 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1482,7 +1506,7 @@ int Window::DoRefreshSize()
|
||||
else
|
||||
{
|
||||
h += 5;
|
||||
CaptionCoords[0] = Coords[0] +(((Coords[2]-Coords[0]) - w) / 2);
|
||||
CaptionCoords[0] = Coords[0] + (((Coords[2]-Coords[0]) - w - (close_w + hide_w)) / 2);
|
||||
CaptionCoords[1] = Coords[1] + BorderSizes[1];
|
||||
}
|
||||
CaptionCoords[2] = CaptionCoords[0] + w;
|
||||
@@ -1603,7 +1627,7 @@ int Window::DoMouseUp(float frametime)
|
||||
else
|
||||
{
|
||||
UnhiddenHeight = Coords[3];
|
||||
Coords[3] = Coords[1] + BorderSizes[1] + BorderSizes[3];
|
||||
Coords[3] = Coords[1] + (CaptionCoords[3] - CaptionCoords[1]) + BorderSizes[1] + BorderSizes[3];
|
||||
Style |= GS_HIDDEN;
|
||||
}
|
||||
|
||||
@@ -1641,6 +1665,12 @@ void Window::DoMove(int dx, int dy)
|
||||
CaptionCoords[2] += dx;
|
||||
CaptionCoords[3] += dy;
|
||||
|
||||
// change the hidden height too if needed
|
||||
if (Style & GS_HIDDEN)
|
||||
{
|
||||
UnhiddenHeight += dy;
|
||||
}
|
||||
|
||||
//Handle moving the border around
|
||||
uint i;
|
||||
for(i = 0; i < 8; i++)
|
||||
@@ -1662,11 +1692,24 @@ void draw_open_rect(int x1, int y1, int x2, int y2, bool resize = false)
|
||||
gr_line(x1, y2, x1, y1, resize);
|
||||
}
|
||||
|
||||
extern void gr_opengl_shade(int x, int y, int w, int h, bool resize);
|
||||
|
||||
void Window::DoDraw(float frametime)
|
||||
{
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
int w, h;
|
||||
|
||||
|
||||
// if the window has no title bar, and no content, then don't draw any of it
|
||||
if ( (Style & WS_NOTITLEBAR) && !HasChildren() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// shade the background of the window so that it's just slightly transparent
|
||||
gr_set_shader(&WindowShade);
|
||||
gr_opengl_shade(Coords[0], Coords[1], Coords[2], Coords[3], false);
|
||||
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
|
||||
if(IMG_HANDLE_IS_VALID(GetCIEImageHandle(WCI_BORDER, CIE_HANDLE_TL)))
|
||||
{
|
||||
IMG_SET(GetCIEImageHandle(WCI_BORDER, CIE_HANDLE_TL));
|
||||
@@ -1798,6 +1841,21 @@ void Window::DoDraw(float frametime)
|
||||
}
|
||||
}
|
||||
|
||||
void Window::ClearContent()
|
||||
{
|
||||
if ( !HasChildren() )
|
||||
return;
|
||||
|
||||
LinkedList *cgp = GET_FIRST(&Children);
|
||||
LinkedList *cgp_next;
|
||||
|
||||
while ( cgp && (cgp != END_OF_LIST(&Children)) ) {
|
||||
cgp_next = GET_NEXT(cgp);
|
||||
delete cgp;
|
||||
cgp = cgp_next;
|
||||
}
|
||||
}
|
||||
|
||||
Window::Window(std::string in_caption, int x_coord, int y_coord, int x_width, int y_width, int in_style)
|
||||
:GUIObject(in_caption, x_coord,y_coord,x_width,y_width,in_style)
|
||||
{
|
||||
@@ -1808,6 +1866,9 @@ Window::Window(std::string in_caption, int x_coord, int y_coord, int x_width, in
|
||||
|
||||
//Set the type
|
||||
Type = GT_WINDOW;
|
||||
|
||||
// create a shader for the window
|
||||
gr_create_shader(&WindowShade, 0, 0, 0, 200);
|
||||
}
|
||||
|
||||
//*****************************Button*******************************
|
||||
@@ -1925,12 +1986,14 @@ TreeItem::TreeItem()
|
||||
:LinkedList()
|
||||
{
|
||||
Function = NULL;
|
||||
Data=0;
|
||||
ShowThis=true;
|
||||
ShowChildren=false;
|
||||
DeleteData=true;
|
||||
Data = 0;
|
||||
ShowThis = true;
|
||||
ShowChildren = false;
|
||||
DeleteData = true;
|
||||
Parent = NULL;
|
||||
memset(Coords, 0, sizeof(Coords));
|
||||
}
|
||||
|
||||
void TreeItem::ClearAllItems()
|
||||
{
|
||||
LinkedList* cgp = GET_FIRST(&Children);
|
||||
@@ -1941,6 +2004,7 @@ void TreeItem::ClearAllItems()
|
||||
delete cgp;
|
||||
}
|
||||
}
|
||||
|
||||
TreeItem::~TreeItem()
|
||||
{
|
||||
ClearAllItems();
|
||||
@@ -2036,12 +2100,12 @@ int Tree::DoRefreshSize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(!(Style & GS_NOAUTORESIZEX))
|
||||
{
|
||||
Coords[2] = Coords[0] + DrawData[1];
|
||||
}
|
||||
|
||||
*/
|
||||
return OF_TRUE;
|
||||
}
|
||||
|
||||
@@ -2051,6 +2115,9 @@ Tree::Tree(std::string in_name, int x_coord, int y_coord, void* in_associatedite
|
||||
|
||||
AssociatedItem = in_associateditem;
|
||||
|
||||
SelectedItem = NULL;
|
||||
HighlightedItem = NULL;
|
||||
|
||||
//Set the type
|
||||
Type = GT_MENU;
|
||||
}
|
||||
@@ -2181,18 +2248,28 @@ TreeItem* Tree::AddItem(TreeItem *parent, std::string in_name, int in_data, bool
|
||||
ni->Data = in_data;
|
||||
ni->DeleteData = in_delete_data;
|
||||
ni->Function = in_function;
|
||||
if(parent != NULL)
|
||||
|
||||
if (parent != NULL)
|
||||
list_append(&parent->Children, ni);
|
||||
else
|
||||
list_append(&Items, ni);
|
||||
|
||||
OnRefreshSize();
|
||||
|
||||
return ni;
|
||||
}
|
||||
|
||||
void Tree::ClearItems()
|
||||
{
|
||||
Items.ClearAllItems();
|
||||
|
||||
LinkedList* cgp = GET_FIRST(&Items);
|
||||
LinkedList* cgp_next;
|
||||
for(; cgp != END_OF_LIST(&Items); cgp = cgp_next)
|
||||
{
|
||||
cgp_next = GET_NEXT(cgp);
|
||||
delete cgp;
|
||||
}
|
||||
}
|
||||
|
||||
//*****************************Text*******************************
|
||||
@@ -2643,6 +2720,7 @@ Checkbox::Checkbox(std::string in_label, int x_coord, int y_coord, void (*in_fun
|
||||
IsChecked = false;
|
||||
HighlightStatus = 0;
|
||||
FlagPtr = NULL;
|
||||
BoolFlagPtr = NULL;
|
||||
|
||||
//Set the type
|
||||
Type = GT_CHECKBOX;
|
||||
@@ -2694,8 +2772,13 @@ void Checkbox::DoDraw(float frametime)
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
|
||||
draw_open_rect(CheckCoords[0], CheckCoords[1], CheckCoords[2], CheckCoords[3], false);
|
||||
if((IsChecked && FlagPtr == NULL) || (FlagPtr!= NULL && ((*FlagPtr) & Flag)))
|
||||
|
||||
if ( (IsChecked && ((FlagPtr == NULL) && (BoolFlagPtr == NULL)))
|
||||
|| ((FlagPtr != NULL) && ((*FlagPtr) & Flag))
|
||||
|| ((BoolFlagPtr != NULL) && (*BoolFlagPtr)) )
|
||||
{
|
||||
gr_string(CheckCoords[0], CheckCoords[1], "X", false);
|
||||
}
|
||||
|
||||
gr_set_color_fast(&Color_text_normal);
|
||||
gr_string(CheckCoords[2] + CB_TEXTCHECKDIST, CheckCoords[1], (char *)Label.c_str(), false);
|
||||
@@ -2703,11 +2786,14 @@ void Checkbox::DoDraw(float frametime)
|
||||
|
||||
int Checkbox::DoMouseOver(float frametime)
|
||||
{
|
||||
if(OwnerSystem->GetMouseX() >= CheckCoords[0]
|
||||
&& OwnerSystem->GetMouseX() <= CheckCoords[2]
|
||||
&& OwnerSystem->GetMouseY() >= CheckCoords[1]
|
||||
&& OwnerSystem->GetMouseY() <= CheckCoords[3])
|
||||
if ( (OwnerSystem->GetMouseX() >= CheckCoords[0])
|
||||
&& (OwnerSystem->GetMouseX() <= CheckCoords[2])
|
||||
&& (OwnerSystem->GetMouseY() >= CheckCoords[1])
|
||||
&& (OwnerSystem->GetMouseY() <= CheckCoords[3]) )
|
||||
{
|
||||
HighlightStatus = 1;
|
||||
}
|
||||
|
||||
return OF_TRUE;
|
||||
}
|
||||
|
||||
@@ -2715,41 +2801,42 @@ int Checkbox::DoMouseDown(float frametime)
|
||||
{
|
||||
OwnerSystem->SetActiveObject(this);
|
||||
|
||||
if(OwnerSystem->GetMouseX() >= CheckCoords[0]
|
||||
&& OwnerSystem->GetMouseX() <= CheckCoords[2]
|
||||
&& OwnerSystem->GetMouseY() >= CheckCoords[1]
|
||||
&& OwnerSystem->GetMouseY() <= CheckCoords[3])
|
||||
if ( (OwnerSystem->GetMouseX() >= CheckCoords[0])
|
||||
&& (OwnerSystem->GetMouseX() <= CheckCoords[2])
|
||||
&& (OwnerSystem->GetMouseY() >= CheckCoords[1])
|
||||
&& (OwnerSystem->GetMouseY() <= CheckCoords[3]) )
|
||||
{
|
||||
HighlightStatus = 2;
|
||||
}
|
||||
|
||||
return OF_TRUE;
|
||||
}
|
||||
|
||||
int Checkbox::DoMouseUp(float frametime)
|
||||
{
|
||||
if(OwnerSystem->GetMouseX() >= CheckCoords[0]
|
||||
&& OwnerSystem->GetMouseX() <= CheckCoords[2]
|
||||
&& OwnerSystem->GetMouseY() >= CheckCoords[1]
|
||||
&& OwnerSystem->GetMouseY() <= CheckCoords[3])
|
||||
if ( (OwnerSystem->GetMouseX() >= CheckCoords[0])
|
||||
&& (OwnerSystem->GetMouseX() <= CheckCoords[2])
|
||||
&& (OwnerSystem->GetMouseY() >= CheckCoords[1])
|
||||
&& (OwnerSystem->GetMouseY() <= CheckCoords[3]) )
|
||||
{
|
||||
HighlightStatus = 1;
|
||||
if(function != NULL)
|
||||
{
|
||||
|
||||
if (function != NULL) {
|
||||
function(this);
|
||||
}
|
||||
if(FlagPtr != NULL)
|
||||
{
|
||||
if(!(*FlagPtr & Flag))
|
||||
{
|
||||
|
||||
if (FlagPtr != NULL) {
|
||||
if ( !(*FlagPtr & Flag) ) {
|
||||
*FlagPtr |= Flag;
|
||||
IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
*FlagPtr &= ~Flag;
|
||||
IsChecked = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else if (BoolFlagPtr != NULL) {
|
||||
*BoolFlagPtr = !(*BoolFlagPtr);
|
||||
IsChecked = *BoolFlagPtr;
|
||||
} else {
|
||||
IsChecked = !IsChecked;
|
||||
}
|
||||
}
|
||||
|
||||
+39
-10
@@ -83,8 +83,8 @@ struct LinkedList
|
||||
public:
|
||||
struct LinkedList *next, *prev;
|
||||
|
||||
LinkedList(){next=this;prev=this;}
|
||||
virtual ~LinkedList(){prev->next=next;next->prev=prev;}
|
||||
LinkedList(){ next = this; prev = this; }
|
||||
virtual ~LinkedList(){ prev->next = next; next->prev = prev; }
|
||||
};
|
||||
|
||||
//*****************************ClassInfoEntry*******************************
|
||||
@@ -280,7 +280,6 @@ private:
|
||||
LinkedList Children;
|
||||
|
||||
int GetOIECoords(int *x1, int *y1, int *x2, int *y2);
|
||||
void DeleteChildren(GUIObject* exception = NULL);
|
||||
GUIObject *AddChildInternal(GUIObject* cgp);
|
||||
protected:
|
||||
//ON FUNCTIONS
|
||||
@@ -323,6 +322,7 @@ public:
|
||||
//CHILD FUNCTIONS
|
||||
//Used for managing children. :)
|
||||
GUIObject *AddChild(GUIObject* cgp);
|
||||
void DeleteChildren(GUIObject* exception = NULL);
|
||||
|
||||
//SET FUNCTIONS
|
||||
void SetPosition(int x, int y);
|
||||
@@ -420,8 +420,8 @@ public:
|
||||
#define W_BORDERWIDTH 1
|
||||
#define W_BORDERHEIGHT 1
|
||||
|
||||
#define WS_NOTITLEBAR (1<<31)
|
||||
#define WS_NONMOVEABLE (1<<30)
|
||||
#define WS_NOTITLEBAR (1<<31) // doesn't have a title bar (ie, no title or min/close buttons)
|
||||
#define WS_NONMOVEABLE (1<<30) // can't be moved around
|
||||
|
||||
#define WCI_CAPTION 0
|
||||
#define WCI_CAPTION_TEXT 1
|
||||
@@ -456,6 +456,8 @@ class Window : public GUIObject
|
||||
bitmap_rect_list BorderRectLists[8];
|
||||
bitmap_rect_list CaptionRectList;
|
||||
|
||||
shader WindowShade;
|
||||
|
||||
protected:
|
||||
void DoDraw(float frametime);
|
||||
void DoMove(int dx, int dy);
|
||||
@@ -464,9 +466,12 @@ protected:
|
||||
int DoMouseDown(float frametime);
|
||||
int DoMouseUp(float frametime);
|
||||
int DoMouseOut(float frametime);
|
||||
bool HasChildren(){return NOT_EMPTY(&Children);}
|
||||
|
||||
public:
|
||||
Window(std::string in_caption, int x_coord, int y_coord, int x_width = -1, int y_height = -1, int in_style = 0);
|
||||
void SetCaption(std::string in_caption){Caption = in_caption;}
|
||||
void ClearContent();
|
||||
};
|
||||
|
||||
//*****************************Button*******************************
|
||||
@@ -654,6 +659,8 @@ class Checkbox : public GUIObject
|
||||
int* FlagPtr;
|
||||
int Flag;
|
||||
|
||||
bool *BoolFlagPtr;
|
||||
|
||||
int CheckCoords[4];
|
||||
bool IsChecked; //Is it checked?
|
||||
int HighlightStatus;
|
||||
@@ -666,15 +673,37 @@ protected:
|
||||
int DoMouseDown(float frametime);
|
||||
int DoMouseUp(float frametime);
|
||||
int DoMouseOut(float frametime);
|
||||
|
||||
public:
|
||||
Checkbox(std::string in_label, int x_coord, int y_coord, void (*in_function)(Checkbox *caller) = NULL, int x_width = -1, int y_height = DEFAULT_BUTTON_HEIGHT, int in_style = 0);
|
||||
|
||||
bool GetChecked(){return IsChecked;}
|
||||
bool GetChecked() {
|
||||
return IsChecked;
|
||||
}
|
||||
|
||||
void SetLabel(std::string in_label){Label = in_label;}
|
||||
void SetChecked(bool in_ischecked){IsChecked = in_ischecked;}
|
||||
void SetFlag(int* in_flag_ptr, int in_flag){FlagPtr = in_flag_ptr;Flag = in_flag;if(FlagPtr != NULL && (*FlagPtr & Flag))IsChecked=true;}
|
||||
void SetFlag(uint* in_flag_ptr, int in_flag){SetFlag((int*)in_flag_ptr, in_flag);}
|
||||
void SetLabel(std::string in_label) {
|
||||
Label = in_label;
|
||||
}
|
||||
|
||||
void SetChecked(bool in_ischecked) {
|
||||
IsChecked = in_ischecked;
|
||||
}
|
||||
|
||||
void SetFlag(int* in_flag_ptr, int in_flag) {
|
||||
FlagPtr = in_flag_ptr;
|
||||
Flag = in_flag;
|
||||
|
||||
if ( (FlagPtr != NULL) && (*FlagPtr & Flag) )
|
||||
IsChecked = true;
|
||||
}
|
||||
|
||||
void SetFlag(uint* in_flag_ptr, int in_flag) {
|
||||
SetFlag((int*)in_flag_ptr, in_flag);
|
||||
}
|
||||
|
||||
void SetBool(bool *in_bool_ptr) {
|
||||
BoolFlagPtr = in_bool_ptr;
|
||||
}
|
||||
};
|
||||
|
||||
//*****************************ImageAnim*******************************
|
||||
|
||||
+53
-24
@@ -563,20 +563,13 @@ void light_add_directional( vec3d *dir, float intensity, float r, float g, float
|
||||
|
||||
void light_add_point( vec3d * pos, float r1, float r2, float intensity, float r, float g, float b, int light_ignore_objnum, float spec_r, float spec_g, float spec_b, bool specular )
|
||||
{
|
||||
Assert( r1 > 0.0f );
|
||||
Assert( r2 > 0.0f );
|
||||
|
||||
if(!specular){
|
||||
spec_r = r;
|
||||
spec_g = g;
|
||||
spec_b = b;
|
||||
}
|
||||
|
||||
light * l;
|
||||
|
||||
if ( Lighting_off ) return;
|
||||
if (Lighting_off)
|
||||
return;
|
||||
|
||||
if (!Lighting_flag) return;
|
||||
if ( !Lighting_flag )
|
||||
return;
|
||||
|
||||
// if ( keyd_pressed[KEY_LSHIFT] ) return;
|
||||
|
||||
@@ -585,6 +578,36 @@ void light_add_point( vec3d * pos, float r1, float r2, float intensity, float r,
|
||||
return;
|
||||
}
|
||||
|
||||
Assert( r1 > 0.0f );
|
||||
Assert( r2 > 0.0f );
|
||||
|
||||
if ( !specular ) {
|
||||
spec_r = r;
|
||||
spec_g = g;
|
||||
spec_b = b;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Num_lights; i++) {
|
||||
l = &Lights[i];
|
||||
|
||||
if (l->type != LT_POINT)
|
||||
continue;
|
||||
|
||||
if ( vm_vec_dist_quick(&l->vec, pos) < l->rada ) {
|
||||
if (l->r == r && l->g == g && l->b == b) {
|
||||
if (l->light_ignore_objnum == light_ignore_objnum) {
|
||||
// printf("resuing light %i\n", i);
|
||||
|
||||
l->intensity += (intensity * 0.1f);
|
||||
l->rada += (r1 * 0.225f);
|
||||
l->radb += (r2 * 0.175f);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
l = &Lights[Num_lights++];
|
||||
|
||||
l->type = LT_POINT;
|
||||
@@ -925,17 +948,18 @@ int light_get_global_count()
|
||||
|
||||
int light_get_global_dir(vec3d *pos, int n)
|
||||
{
|
||||
if ( (n < 0) || (n >= (int)Static_light.size()) ) {
|
||||
if ( (n < 0) || (n >= (int)Static_light.size()) )
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pos) {
|
||||
*pos = Static_light[n]->vec;
|
||||
if (pos == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
*pos = Static_light[n]->vec;
|
||||
|
||||
if (Lighting_mode != LM_DARKEN)
|
||||
vm_vec_scale( pos, -1.0f );
|
||||
|
||||
if ( Lighting_mode != LM_DARKEN ) {
|
||||
vm_vec_scale( pos, -1.0f );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -952,15 +976,22 @@ void light_set_all_relevent()
|
||||
|
||||
gr_reset_lighting();
|
||||
|
||||
for (idx = 0; idx < (int)Static_light.size(); idx++)
|
||||
for (idx = 0; idx < (int)Static_light.size(); idx++) {
|
||||
gr_set_light( Static_light[idx] );
|
||||
}
|
||||
|
||||
// for simplicity sake were going to forget about dynamic lights for the moment
|
||||
|
||||
int n = Num_light_levels-1;
|
||||
|
||||
for (idx = 0; idx < Num_relevent_lights[n]; idx++ )
|
||||
for (idx = 0; idx < Num_relevent_lights[n]; idx++) {
|
||||
gr_set_light( Relevent_lights[idx][n] );
|
||||
}
|
||||
|
||||
if (gr_screen.mode == GR_OPENGL) {
|
||||
extern void opengl_pre_render_init_lights();
|
||||
opengl_pre_render_init_lights();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1059,7 +1090,7 @@ void light_apply_specular(ubyte *param_r, ubyte *param_g, ubyte *param_b, vec3d
|
||||
float rval = 0, gval = 0, bval = 0;
|
||||
int idx;
|
||||
|
||||
if ( Cmdline_nospec ) {
|
||||
if ( !Cmdline_spec ) {
|
||||
*param_r = 0;
|
||||
*param_g = 0;
|
||||
*param_b = 0;
|
||||
@@ -1408,5 +1439,3 @@ float light_apply( vec3d *pos, vec3d * norm )
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ float frand()
|
||||
do {
|
||||
i_rval = myrand();
|
||||
} while (i_rval == RAND_MAX);
|
||||
float rval = ((float) i_rval) / RAND_MAX;
|
||||
float rval = i2fl(i_rval) * RAND_MAX_1f;
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
+76
-72
@@ -481,7 +481,6 @@ int fvi_ray_sphere(vec3d *intp,vec3d *p0,vec3d *p1,vec3d *sphere_pos,float spher
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//==============================================================
|
||||
// Finds intersection of a ray and an axis-aligned bounding box
|
||||
// Given a ray with origin at p0, and direction pdir, this function
|
||||
@@ -491,8 +490,7 @@ int fvi_ray_sphere(vec3d *intp,vec3d *p0,vec3d *p1,vec3d *sphere_pos,float spher
|
||||
// Fast ray-box intersection taken from Graphics Gems I, pages 395,736.
|
||||
int fvi_ray_boundingbox( vec3d *min, vec3d *max, vec3d * p0, vec3d *pdir, vec3d *hitpt )
|
||||
{
|
||||
bool inside = true;
|
||||
bool middle[3] = { true, true, true };
|
||||
int middle = ((1<<0) | (1<<1) | (1<<2));
|
||||
int i;
|
||||
int which_plane;
|
||||
float maxt[3];
|
||||
@@ -501,48 +499,50 @@ int fvi_ray_boundingbox( vec3d *min, vec3d *max, vec3d * p0, vec3d *pdir, vec3d
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (p0->a1d[i] < min->a1d[i]) {
|
||||
candidate_plane[i] = min->a1d[i];
|
||||
middle[i] = false;
|
||||
inside = false;
|
||||
middle &= ~(1<<i);
|
||||
} else if (p0->a1d[i] > max->a1d[i]) {
|
||||
candidate_plane[i] = max->a1d[i];
|
||||
middle[i] = false;
|
||||
inside = false;
|
||||
middle &= ~(1<<i);
|
||||
}
|
||||
}
|
||||
|
||||
// ray origin inside bounding box
|
||||
if ( inside ) {
|
||||
if (middle) {
|
||||
*hitpt = *p0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// calculate T distances to canditate plane
|
||||
for (i = 0; i < 3; i++) {
|
||||
if ( !middle[i] && (pdir->a1d[i] != 0.0f) )
|
||||
maxt[i] = (candidate_plane[i] - p0->a1d[i]) / pdir->a1d[i];
|
||||
else
|
||||
if ( (middle & (1<<i)) || (pdir->a1d[i] == 0.0f) ) {
|
||||
maxt[i] = -1.0f;
|
||||
} else {
|
||||
maxt[i] = (candidate_plane[i] - p0->a1d[i]) / pdir->a1d[i];
|
||||
}
|
||||
}
|
||||
|
||||
// Get largest of the maxt's for final choice of intersection
|
||||
which_plane = 0;
|
||||
for (i = 1; i < 3; i++) {
|
||||
if (maxt[which_plane] < maxt[i])
|
||||
if (maxt[which_plane] < maxt[i]) {
|
||||
which_plane = i;
|
||||
}
|
||||
}
|
||||
|
||||
// check final candidate actually inside box
|
||||
if (maxt[which_plane] < 0.0f)
|
||||
if (maxt[which_plane] < 0.0f) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (which_plane != i) {
|
||||
hitpt->a1d[i] = p0->a1d[i] + maxt[which_plane] * pdir->a1d[i];
|
||||
|
||||
if ( (hitpt->a1d[i] < min->a1d[i]) || (hitpt->a1d[i] > max->a1d[i]) )
|
||||
return 0;
|
||||
} else {
|
||||
if (which_plane == i) {
|
||||
hitpt->a1d[i] = candidate_plane[i];
|
||||
} else {
|
||||
hitpt->a1d[i] = (maxt[which_plane] * pdir->a1d[i]) + p0->a1d[i];
|
||||
|
||||
if ( (hitpt->a1d[i] < min->a1d[i]) || (hitpt->a1d[i] > max->a1d[i]) ) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1139,12 +1139,19 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
|
||||
vec3d ve; // edge velocity
|
||||
float best_sphere_time; // earliest time sphere hits edge
|
||||
vec3d delta_x;
|
||||
float delta_x_dot_ve, delta_x_dot_vs, ve_dot_vs, ve_sqr, vs_sqr, delta_x_sqr;
|
||||
float delta_x_dot_ve, delta_x_dot_vs, ve_dot_vs, ve_sqr, vs_sqr, delta_x_sqr;
|
||||
vec3d temp_edge_hit, temp_sphere_hit;
|
||||
float t_sphere_hit = 0.0f;
|
||||
float A, B, C, temp, discriminant, A2;
|
||||
float root, root1, root2;
|
||||
float Rs2 = (Rs * Rs);
|
||||
float Rs_point2 = (0.2f * Rs);
|
||||
|
||||
best_sphere_time = FLT_MAX;
|
||||
|
||||
for (i=0; i<nv; i++) {
|
||||
vs_sqr = vm_vec_mag_squared(vs);
|
||||
|
||||
for (i = 0; i < nv; i++) {
|
||||
// Get vertices of edge to check
|
||||
v0 = *verts[i];
|
||||
if (i+1 != nv) {
|
||||
@@ -1165,22 +1172,18 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
|
||||
delta_x_sqr = vm_vec_mag_squared(&delta_x);
|
||||
ve_dot_vs = vm_vec_dotprod(&ve, vs);
|
||||
ve_sqr = vm_vec_mag_squared(&ve);
|
||||
vs_sqr = vm_vec_mag_squared(vs);
|
||||
|
||||
float t_sphere_hit, temp;
|
||||
|
||||
// solve for sphere time
|
||||
float A, B, C, root, discriminant; //WMC - changed to float 4/15/2005
|
||||
float root1, root2;
|
||||
A = ve_dot_vs*ve_dot_vs - ve_sqr*vs_sqr;
|
||||
B = 2 * (delta_x_dot_ve*ve_dot_vs - delta_x_dot_vs*ve_sqr);
|
||||
C = delta_x_dot_ve*delta_x_dot_ve + Rs*Rs*ve_sqr - delta_x_sqr*ve_sqr;
|
||||
B = 2.0f * (delta_x_dot_ve*ve_dot_vs - delta_x_dot_vs*ve_sqr);
|
||||
C = delta_x_dot_ve*delta_x_dot_ve + Rs2*ve_sqr - delta_x_sqr*ve_sqr;
|
||||
|
||||
discriminant = B*B - 4*A*C;
|
||||
if (discriminant > 0) {
|
||||
root = fl_sqrt(discriminant);
|
||||
root1 = (float) ((-B + root)/(2*A));
|
||||
root2 = (float) ((-B - root)/(2*A));
|
||||
discriminant = B*B - 4.0f*A*C;
|
||||
if (discriminant > 0.0f) {
|
||||
A2 = (2.0f * A);
|
||||
root = sqrt(discriminant);
|
||||
root1 = (-B + root) / A2;
|
||||
root2 = (-B - root) / A2;
|
||||
|
||||
|
||||
// sort root1 and root2
|
||||
@@ -1190,12 +1193,11 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
|
||||
root2 = temp;
|
||||
}
|
||||
|
||||
if (root1 >= -0.05f && root1 < 0.0f) {
|
||||
if ( (root1 < 0.0f) && (root1 >= -0.05f) )
|
||||
root1 = 0.000001f;
|
||||
}
|
||||
|
||||
// look only at first hit
|
||||
if ( (root1 >= 0) && (root1 <= 1) ) {
|
||||
if ( (root1 <= 1.0f) && (root1 >= 0.0f) ) {
|
||||
t_sphere_hit = root1;
|
||||
} else {
|
||||
goto TryVertex;
|
||||
@@ -1210,39 +1212,40 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
|
||||
continue;
|
||||
|
||||
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, t_sphere_hit );
|
||||
float q;
|
||||
|
||||
// solve for edge time
|
||||
A = ve_sqr * (ve_dot_vs*ve_dot_vs - ve_sqr*vs_sqr);
|
||||
B = 2*ve_sqr * (delta_x_dot_ve*vs_sqr - delta_x_dot_vs*ve_dot_vs);
|
||||
C = 2*delta_x_dot_ve*delta_x_dot_vs*ve_dot_vs + Rs*Rs*ve_dot_vs*ve_dot_vs
|
||||
A *= ve_sqr;
|
||||
B = 2.0f*ve_sqr * (delta_x_dot_ve*vs_sqr - delta_x_dot_vs*ve_dot_vs);
|
||||
C = 2.0f*delta_x_dot_ve*delta_x_dot_vs*ve_dot_vs + Rs2*ve_dot_vs*ve_dot_vs
|
||||
- delta_x_sqr*ve_dot_vs*ve_dot_vs - delta_x_dot_ve*delta_x_dot_ve*vs_sqr;
|
||||
|
||||
discriminant = B*B - 4*A*C;
|
||||
discriminant = B*B - 4.0f*A*C;
|
||||
A2 = (2.0f * A);
|
||||
|
||||
// guard against nearly perpendicular sphere edge velocities
|
||||
if ( (discriminant < 0) ) {
|
||||
discriminant = 0;
|
||||
}
|
||||
if (discriminant < 0.0f)
|
||||
root = 0.0f;
|
||||
else
|
||||
root = fl_sqrt(discriminant);
|
||||
|
||||
root = fl_sqrt(discriminant);
|
||||
root1 = (float) ((-B + root)/(2*A));
|
||||
root2 = (float) ((-B - root)/(2*A));
|
||||
root1 = (-B + root) / A2;
|
||||
root2 = (-B - root) / A2;
|
||||
|
||||
// given sphere position, find which edge time (position) allows a valid solution
|
||||
if ( (root1 >= 0) && (root1 <= 1) ) {
|
||||
if ( (root1 <= 1.0f) && (root1 >= 0.0f) ) {
|
||||
// try edge root1
|
||||
vm_vec_scale_add( &temp_edge_hit, &v0, &ve, root1 );
|
||||
q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
|
||||
if ( fl_abs(q - Rs*Rs) < 0.2*Rs ) { // error less than 0.1m absolute (2*delta*Radius)
|
||||
float q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
|
||||
if ( fl_abs(q - Rs2) < Rs_point2 ) { // error less than 0.1m absolute (2*delta*Radius)
|
||||
goto Hit;
|
||||
}
|
||||
}
|
||||
|
||||
if ( (root2 >= 0) && (root2 <= 1) ) {
|
||||
if ( (root2 <= 1.0f) && (root2 >= 0.0f) ) {
|
||||
// try edge root2
|
||||
vm_vec_scale_add( &temp_edge_hit, &v0, &ve, root2 );
|
||||
q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
|
||||
if ( fl_abs(q - Rs*Rs) < 0.2*Rs ) { // error less than 0.1m absolute
|
||||
float q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
|
||||
if ( fl_abs(q - Rs2) < Rs_point2 ) { // error less than 0.1m absolute
|
||||
goto Hit;
|
||||
}
|
||||
} else {
|
||||
@@ -1261,20 +1264,21 @@ int fvi_polyedge_sphereline(vec3d *hit_point, vec3d *xs0, vec3d *vs, float Rs, i
|
||||
TryVertex:
|
||||
// try V0
|
||||
A = vs_sqr;
|
||||
B = 2*delta_x_dot_vs;
|
||||
C = delta_x_sqr - Rs*Rs;
|
||||
B = 2.0f*delta_x_dot_vs;
|
||||
C = delta_x_sqr - Rs2;
|
||||
int v0_hit;
|
||||
float sphere_v0, sphere_v1;
|
||||
|
||||
v0_hit = 0;
|
||||
sphere_v0 = UNINITIALIZED_VALUE;
|
||||
sphere_v1 = UNINITIALIZED_VALUE;
|
||||
|
||||
v0_hit = 0;
|
||||
discriminant = B*B - 4*A*C;
|
||||
if (discriminant > 0) {
|
||||
A2 = (2.0f * A);
|
||||
discriminant = B*B - 4.0f*A*C;
|
||||
if (discriminant > 0.0f) {
|
||||
root = fl_sqrt(discriminant);
|
||||
root1 = (float) ((-B + root)/(2*A));
|
||||
root2 = (float) ((-B - root)/(2*A));
|
||||
root1 = (-B + root) / A2;
|
||||
root2 = (-B - root) / A2;
|
||||
|
||||
if (root1 > root2) {
|
||||
temp = root1;
|
||||
@@ -1283,10 +1287,10 @@ TryVertex:
|
||||
}
|
||||
|
||||
// look only at the fist hit (ignore negative first hit)
|
||||
if ( (root1 > 0) && (root1 < 1) ) {
|
||||
if ( (root1 < 1.0f) && (root1 > 0.0f) ) {
|
||||
v0_hit = 1;
|
||||
sphere_v0 = root1;
|
||||
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, root1 );
|
||||
// vm_vec_scale_add( &temp_sphere_hit, xs0, vs, sphere_v0 );
|
||||
// q = vm_vec_dist_squared( &v0, &temp_sphere_hit ); // debug
|
||||
// if ( fl_abs(q - Rs*Rs) > 2*WARN_DIST*Rs )
|
||||
// mprintf(("Estimated radius error: Estimate %f, actual %f Get Dave A.\n", fl_sqrt(q), Rs));
|
||||
@@ -1299,15 +1303,15 @@ TryVertex:
|
||||
delta_x_dot_vs = vm_vec_dotprod( &delta_x, vs );
|
||||
int v1_hit;
|
||||
|
||||
B = 2*delta_x_dot_vs;
|
||||
C = delta_x_sqr - Rs*Rs;
|
||||
B = 2.0f*delta_x_dot_vs;
|
||||
C = delta_x_sqr - Rs2;
|
||||
|
||||
v1_hit = 0;
|
||||
discriminant = B*B - 4*A*C;
|
||||
if (discriminant > 0) {
|
||||
discriminant = B*B - 4.0f*A*C;
|
||||
if (discriminant > 0.0f) {
|
||||
root = fl_sqrt(discriminant);
|
||||
root1 = (float) ((-B + root)/(2*A));
|
||||
root2 = (float) ((-B - root)/(2*A));
|
||||
root1 = (-B + root) / A2;
|
||||
root2 = (-B - root) / A2;
|
||||
|
||||
if (root1 > root2) {
|
||||
temp = root1;
|
||||
@@ -1316,10 +1320,10 @@ TryVertex:
|
||||
}
|
||||
|
||||
// look only at the first hit (ignore negative first hit)
|
||||
if ( (root1 > 0) && (root1 < 1) ) {
|
||||
if ( (root1 < 1.0f) && (root1 > 0.0f) ) {
|
||||
v1_hit = 1;
|
||||
sphere_v1 = root1;
|
||||
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, root1 );
|
||||
// vm_vec_scale_add( &temp_sphere_hit, xs0, vs, sphere_v1 );
|
||||
// q = vm_vec_dist_squared( &v1, &temp_sphere_hit );
|
||||
// if ( fl_abs(q - Rs*Rs) > 2*WARN_DIST*Rs )
|
||||
// mprintf(("Estimated radius error: Estimate %f, actual %f Get Dave A.\n", fl_sqrt(q), Rs));
|
||||
@@ -1347,8 +1351,8 @@ TryVertex:
|
||||
continue;
|
||||
}
|
||||
|
||||
vm_vec_scale_add( &temp_sphere_hit, xs0, vs, t_sphere_hit );
|
||||
q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
|
||||
//vm_vec_scale_add( &temp_sphere_hit, xs0, vs, t_sphere_hit );
|
||||
//q = vm_vec_dist_squared(&temp_edge_hit, &temp_sphere_hit);
|
||||
// if ( fl_abs(q - Rs*Rs) > 2*WARN_DIST*Rs ) {
|
||||
// mprintf(("Estimated radius error: Estimate %f, actual %f Get Dave A.\n", fl_sqrt(q), Rs));
|
||||
// }
|
||||
|
||||
+25
-20
@@ -630,6 +630,15 @@ void vm_vec_scale_add(vec3d *dest,vec3d *src1,vec3d *src2,float k)
|
||||
}
|
||||
#endif
|
||||
|
||||
//scales a vector, subtracts it to another, and stores in a 3rd vector
|
||||
//dest = src1 - k * src2
|
||||
void vm_vec_scale_sub(vec3d *dest, vec3d *src1, vec3d *src2, float k)
|
||||
{
|
||||
dest->xyz.x = src1->xyz.x - src2->xyz.x*k;
|
||||
dest->xyz.y = src1->xyz.y - src2->xyz.y*k;
|
||||
dest->xyz.z = src1->xyz.z - src2->xyz.z*k;
|
||||
}
|
||||
|
||||
//scales a vector and adds it to another
|
||||
//dest += k * src
|
||||
#ifndef _INLINE_VECMAT
|
||||
@@ -685,31 +694,21 @@ float vm_vec_dot3(float x,float y,float z,vec3d *v)
|
||||
//returns magnitude of a vector
|
||||
float vm_vec_mag(vec3d *v)
|
||||
{
|
||||
float x,y,z,mag1, mag2;
|
||||
x = v->xyz.x*v->xyz.x;
|
||||
y = v->xyz.y*v->xyz.y;
|
||||
z = v->xyz.z*v->xyz.z;
|
||||
float mag1;
|
||||
|
||||
mag1 = x+y+z;
|
||||
mag1 = (v->xyz.x * v->xyz.x) + (v->xyz.y * v->xyz.y) + (v->xyz.z * v->xyz.z);
|
||||
|
||||
if ( mag1 < 0.0 )
|
||||
return 0;
|
||||
if (mag1 <= 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
mag2 = fl_sqrt(mag1);
|
||||
if ( mag2 < 0.0 )
|
||||
Int3();
|
||||
return mag2;
|
||||
return fl_sqrt(mag1);
|
||||
}
|
||||
|
||||
//returns squared magnitude of a vector, useful if you want to compare distances
|
||||
float vm_vec_mag_squared(vec3d *v)
|
||||
{
|
||||
float x,y,z,mag1;
|
||||
x = v->xyz.x*v->xyz.x;
|
||||
y = v->xyz.y*v->xyz.y;
|
||||
z = v->xyz.z*v->xyz.z;
|
||||
mag1 = x+y+z;
|
||||
return mag1;
|
||||
return ((v->xyz.x * v->xyz.x) + (v->xyz.y * v->xyz.y) + (v->xyz.z * v->xyz.z));
|
||||
}
|
||||
|
||||
float vm_vec_dist_squared(vec3d *v0, vec3d *v1)
|
||||
@@ -759,14 +758,20 @@ float vm_vec_mag_quick(vec3d *v)
|
||||
c = v->xyz.z;
|
||||
|
||||
if (a < b) {
|
||||
float t=a; a=b; b=t;
|
||||
t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
}
|
||||
|
||||
if (b < c) {
|
||||
float t=b; b=c; c=t;
|
||||
t = b;
|
||||
b = c;
|
||||
c = t;
|
||||
|
||||
if (a < b) {
|
||||
float t=a; a=b; b=t;
|
||||
t = a;
|
||||
a = b;
|
||||
b = t;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -401,6 +401,7 @@ void vm_vec_copy_scale(vec3d *dest,vec3d *src,float s);
|
||||
void vm_vec_scale_add(vec3d *dest,vec3d *src1,vec3d *src2,float k);
|
||||
#endif
|
||||
|
||||
void vm_vec_scale_sub(vec3d *dest,vec3d *src1,vec3d *src2,float k);
|
||||
|
||||
//scales a vector and adds it to another
|
||||
//dest += k * src
|
||||
@@ -724,4 +725,3 @@ void vm_vec2vert(vec3d *vec, vertex *vert);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -983,7 +983,10 @@ void credits_do_frame(float frametime)
|
||||
sy = fl2i(Credit_position-0.5f);
|
||||
}
|
||||
|
||||
gr_string(0x8000, sy, Credit_text);
|
||||
extern void gr_opengl_string( float sx, float sy, char *s, bool resize = true );
|
||||
|
||||
gr_opengl_string((float)0x8000, Credit_position, Credit_text);
|
||||
// gr_string(0x8000, sy, Credit_text);
|
||||
|
||||
int temp_time;
|
||||
temp_time = timer_get_milliseconds();
|
||||
|
||||
@@ -1097,11 +1097,6 @@ void main_hall_init(int main_hall_num)
|
||||
// remove any multiplayer flags from the game mode
|
||||
Game_mode &= ~(GM_MULTIPLAYER);
|
||||
|
||||
// set the interface palette
|
||||
#ifndef HARDWARE_ONLY
|
||||
palette_use_bm_palette(Main_hall_bitmap);
|
||||
#endif
|
||||
|
||||
Main_hall_mask_w = -1;
|
||||
Main_hall_mask_h = -1;
|
||||
|
||||
@@ -1307,6 +1302,7 @@ void main_hall_do(float frametime)
|
||||
gamesnd_play_iface(SND_IFACE_MOUSE_CLICK);
|
||||
gameseq_post_event(GS_EVENT_LAB);
|
||||
break;
|
||||
|
||||
#ifndef NDEBUG
|
||||
case KEY_1:
|
||||
// no soup for you!
|
||||
@@ -2105,7 +2101,7 @@ void main_hall_handle_random_intercom_sounds()
|
||||
{
|
||||
// if we have no timestamp for the next random sound, then set on
|
||||
if((Main_hall_next_intercom_sound_stamp == -1) && (Main_hall_intercom_sound_handle == -1)){
|
||||
Main_hall_next_intercom_sound_stamp = timestamp((int)(((float)rand()/(float)RAND_MAX) *
|
||||
Main_hall_next_intercom_sound_stamp = timestamp((int)((rand() * RAND_MAX_1f) *
|
||||
(float)(Main_hall->intercom_delay[Main_hall_next_intercom_sound][1]
|
||||
- Main_hall->intercom_delay[Main_hall_intercom_sound_handle][0])) );
|
||||
}
|
||||
@@ -2137,7 +2133,7 @@ void main_hall_handle_random_intercom_sounds()
|
||||
}
|
||||
|
||||
// set the timestamp
|
||||
Main_hall_next_intercom_sound_stamp = timestamp((int)(((float)rand()/(float)RAND_MAX) *
|
||||
Main_hall_next_intercom_sound_stamp = timestamp((int)((rand() * RAND_MAX_1f) *
|
||||
(float)(Main_hall->intercom_delay[Main_hall_next_intercom_sound][1]
|
||||
- Main_hall->intercom_delay[Main_hall_next_intercom_sound][0])) );
|
||||
|
||||
@@ -2214,7 +2210,7 @@ void main_hall_reset_ambient_vol()
|
||||
// blit the freespace version #
|
||||
void main_hall_blit_version()
|
||||
{
|
||||
char version_string[100];
|
||||
char version_string[256];
|
||||
int w;
|
||||
|
||||
// format the version string
|
||||
|
||||
@@ -510,14 +510,14 @@ static struct {
|
||||
} Backgrounds[GR_NUM_RESOLUTIONS][NUM_TABS] = {
|
||||
//XSTR:OFF
|
||||
{ // GR_640
|
||||
{ "OptionsMain", "OptionsMain-M"},
|
||||
{ "OptionsMulti", "OptionsMulti-M"},
|
||||
{ "OptionsDetail", "OptionsDetail-M"},
|
||||
{ "OptionsMain", "OptionsMain-M", -1, -1 },
|
||||
{ "OptionsMulti", "OptionsMulti-M", -1, -1 },
|
||||
{ "OptionsDetail", "OptionsDetail-M", -1, -1 },
|
||||
},
|
||||
{ // GR_1024
|
||||
{ "2_OptionsMain", "2_OptionsMain-M"},
|
||||
{ "2_OptionsMulti", "2_OptionsMulti-M"},
|
||||
{ "2_OptionsDetail", "2_OptionsDetail-M"},
|
||||
{ "2_OptionsMain", "2_OptionsMain-M", -1, -1 },
|
||||
{ "2_OptionsMulti", "2_OptionsMulti-M", -1, -1 },
|
||||
{ "2_OptionsDetail", "2_OptionsDetail-M", -1, -1 },
|
||||
}
|
||||
//XSTR:ON
|
||||
};
|
||||
|
||||
@@ -543,9 +543,6 @@ void player_select_init()
|
||||
/*
|
||||
Demo_title_bitmap = bm_load(Demo_title_bitmap_filename);
|
||||
if ( Demo_title_bitmap >= 0 ) {
|
||||
#ifndef HARDWARE_ONLY
|
||||
palette_use_bm_palette(Demo_title_bitmap);
|
||||
#endif
|
||||
Demo_title_active = 1;
|
||||
Demo_title_expire_timestamp = timestamp(5000);
|
||||
} else {
|
||||
@@ -715,9 +712,6 @@ void player_select_do()
|
||||
|
||||
//if ( !Player_select_palette_set ) {
|
||||
// Assert(Player_select_palette >= 0);
|
||||
//#ifndef HARDWARE_ONLY
|
||||
// palette_use_bm_palette(Player_select_palette);
|
||||
//#endif
|
||||
// Player_select_palette_set = 1;
|
||||
// }
|
||||
|
||||
|
||||
+27
-10
@@ -694,6 +694,7 @@ void techroom_init_desc(char *src, int w)
|
||||
void techroom_select_new_entry()
|
||||
{
|
||||
Assert(Current_list != NULL);
|
||||
|
||||
if (Current_list == NULL || Current_list_size <= 0) {
|
||||
Cur_entry_index = Cur_entry = -1;
|
||||
techroom_init_desc(NULL,0);
|
||||
@@ -715,15 +716,27 @@ void techroom_select_new_entry()
|
||||
if ( (i < Cur_entry + 5) && (i > Cur_entry - 5) )
|
||||
continue;
|
||||
|
||||
mprintf(("TECH ROOM: Dumping excess ship textures...\n"));
|
||||
mprintf(("TECH ROOM: Dumping excess ships...\n"));
|
||||
|
||||
model_page_out_textures(Current_list[i].model_num);
|
||||
model_page_out_textures(Current_list[i].model_num, true);
|
||||
model_unload(Current_list[i].model_num);
|
||||
|
||||
ship_page_out_texture_set(Current_list[i].index, true);
|
||||
|
||||
Current_list[i].textures_loaded = 0;
|
||||
Current_list[i].model_num = -1;
|
||||
}
|
||||
}
|
||||
|
||||
Techroom_ship_modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
// don't model_load() again if we don't need to, it messes up the load count
|
||||
if (Current_list[Cur_entry].model_num >= 0) {
|
||||
Techroom_ship_modelnum = Current_list[Cur_entry].model_num;
|
||||
} else {
|
||||
Techroom_ship_modelnum = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
}
|
||||
|
||||
// if we have a special texture set for this ship then be sure to load it now
|
||||
ship_init_texture_set(Cur_entry_index, model_get(Techroom_ship_modelnum));
|
||||
|
||||
Current_list[Cur_entry].model_num = Techroom_ship_modelnum;
|
||||
|
||||
@@ -925,7 +938,7 @@ void techroom_ships_render(float frametime)
|
||||
g3_start_frame(1);
|
||||
g3_set_view_matrix(&sip->closeup_pos, &vmd_identity_matrix, sip->closeup_zoom * 1.3f);
|
||||
|
||||
if (!Cmdline_nohtl) {
|
||||
if ( !Cmdline_nohtl ) {
|
||||
gr_set_proj_matrix(Proj_fov, gr_screen.clip_aspect, Min_draw_distance, Max_draw_distance);
|
||||
gr_set_view_matrix(&Eye_position, &Eye_matrix);
|
||||
}
|
||||
@@ -936,14 +949,12 @@ void techroom_ships_render(float frametime)
|
||||
light_dir.xyz.y = 1.0f;
|
||||
light_add_directional(&light_dir, 0.85f, 1.0f, 1.0f, 1.0f);
|
||||
light_rotate_all();
|
||||
// lighting for techroom
|
||||
|
||||
model_clear_instance(Techroom_ship_modelnum);
|
||||
model_set_detail_level(0);
|
||||
model_render(Techroom_ship_modelnum, &Techroom_ship_orient, &vmd_zero_vector, MR_LOCK_DETAIL | MR_AUTOCENTER);
|
||||
model_render(Techroom_ship_modelnum, &Techroom_ship_orient, &vmd_zero_vector, MR_LOCK_DETAIL | MR_AUTOCENTER, -1, -1, sip->texture_set);
|
||||
|
||||
if (!Cmdline_nohtl)
|
||||
{
|
||||
if ( !Cmdline_nohtl ) {
|
||||
gr_end_view_matrix();
|
||||
gr_end_proj_matrix();
|
||||
}
|
||||
@@ -1703,9 +1714,15 @@ void techroom_lists_reset()
|
||||
Current_list = NULL;
|
||||
Current_list_size = 0;
|
||||
|
||||
model_free_all();
|
||||
|
||||
if (Ship_list != NULL) {
|
||||
for (i = 0; i < Ship_list_size; i++) {
|
||||
if (Ship_list[i].model_num >= 0) {
|
||||
model_page_out_textures(Ship_list[i].model_num, true);
|
||||
model_unload(Ship_list[i].model_num);
|
||||
ship_page_out_texture_set(Ship_list[i].index, true);
|
||||
}
|
||||
}
|
||||
|
||||
delete[] Ship_list;
|
||||
Ship_list = NULL;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
* spelling
|
||||
*
|
||||
* Revision 2.47 2006/01/13 03:31:09 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* �bercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 2.46 2005/10/10 17:21:05 taylor
|
||||
* remove NO_NETWORK
|
||||
@@ -816,14 +816,14 @@ static float Distort_patterns[MAX_DISTORT_PATTERNS][MAX_DISTORT_LEVELS] =
|
||||
static int Distort_num; // which distort pattern is being used
|
||||
static int Distort_next; // which section of distort pattern is next
|
||||
|
||||
int Head_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
/*int Head_coords[GR_NUM_RESOLUTIONS][2] = {
|
||||
{ // GR_640
|
||||
7, 45
|
||||
},
|
||||
{ // GR_1024
|
||||
7, 66
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
// forward declaration
|
||||
void message_maybe_distort_text(char *text);
|
||||
@@ -1686,7 +1686,7 @@ void message_play_anim( message_q *q )
|
||||
|
||||
// figure out anim start frame
|
||||
anim_start_frame = message_calc_anim_start_frame(Message_wave_duration, anim_info->anim_data, is_death_scream);
|
||||
anim_play_init(&aps, anim_info->anim_data, Head_coords[gr_screen.res][0], Head_coords[gr_screen.res][1]);
|
||||
anim_play_init(&aps, anim_info->anim_data, current_hud->Head_coords[0], current_hud->Head_coords[1]);
|
||||
aps.start_at = anim_start_frame;
|
||||
|
||||
// aps.color = &HUD_color_defaults[HUD_color_alpha];
|
||||
|
||||
+218
-108
@@ -340,7 +340,7 @@
|
||||
* --Goober5000
|
||||
*
|
||||
* Revision 2.135 2006/01/13 03:31:09 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* �bercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 2.134 2006/01/04 08:19:21 taylor
|
||||
* fixes for regular texture replacement
|
||||
@@ -1561,6 +1561,10 @@ void restore_default_weapons(char *ships_tbl);
|
||||
void restore_one_primary_bank(int *ship_primary_weapons, int *default_primary_weapons);
|
||||
void restore_one_secondary_bank(int *ship_secondary_weapons, int *default_secondary_weapons);
|
||||
|
||||
// texture replacement handling (the parse_object specific bits anyway)
|
||||
void parse_object_page_out_texture_set(p_object *p_objp, bool release);
|
||||
void parse_object_init_texture_set(p_object *p_objp, ship_info *sip, polymodel *pm);
|
||||
|
||||
|
||||
MONITOR(NumShipArrivals)
|
||||
MONITOR(NumShipDepartures)
|
||||
@@ -2805,11 +2809,6 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
subsys_status *sssp;
|
||||
ship_weapon *wp;
|
||||
|
||||
// texture replacements
|
||||
char texture_file[MAX_FILENAME_LEN];
|
||||
char *p;
|
||||
polymodel *pm;
|
||||
|
||||
MONITOR_INC(NumShipArrivals, 1);
|
||||
|
||||
// base level creation - need ship name in case of duplicate textures
|
||||
@@ -2924,43 +2923,11 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
shipp->base_texture_anim_frametime = game_get_overall_frametime();
|
||||
|
||||
// handle the replacement textures
|
||||
if (p_objp->num_texture_replacements > 0)
|
||||
{
|
||||
shipp->replacement_textures = (int *) vm_malloc(MAX_MODEL_TEXTURES * sizeof(int));
|
||||
|
||||
for (i = 0; i < MAX_MODEL_TEXTURES; i++)
|
||||
shipp->replacement_textures[i] = -1;
|
||||
}
|
||||
|
||||
// now fill them in
|
||||
for (i = 0; i < p_objp->num_texture_replacements; i++)
|
||||
{
|
||||
pm = model_get(sip->model_num);
|
||||
|
||||
// look for textures
|
||||
for (j = 0; j < pm->n_textures; j++)
|
||||
{
|
||||
// get texture file name
|
||||
bm_get_filename(pm->maps[j].base_map.texture, texture_file);
|
||||
|
||||
// get rid of file extension
|
||||
p = strchr(texture_file, '.');
|
||||
if (p)
|
||||
{
|
||||
mprintf(("ignoring extension on file '%s'\n", texture_file));
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// now compare the extension-less texture file names
|
||||
if (!stricmp(texture_file, p_objp->replacement_textures[i].old_texture))
|
||||
{
|
||||
// replace it
|
||||
shipp->replacement_textures[j] = p_objp->replacement_textures[i].new_texture_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
parse_object_init_texture_set(p_objp, sip, model_get(sip->model_num));
|
||||
|
||||
// mark the active ship replacement texture set
|
||||
if (p_objp->texture_set != NULL)
|
||||
shipp->replacement_textures = p_objp->texture_set;
|
||||
|
||||
// check the parse object's flags for possible things to set on this newly created ship
|
||||
resolve_parse_flags(&Objects[objnum], p_objp->flags, p_objp->flags2);
|
||||
@@ -3228,7 +3195,7 @@ int parse_create_object_sub(p_object *p_objp)
|
||||
}
|
||||
else
|
||||
{
|
||||
int max_allowed_sparks, num_sparks, i;
|
||||
int max_allowed_sparks, num_sparks;
|
||||
polymodel *pm;
|
||||
|
||||
// shipp->hull_hit_points_taken = (float) p_objp->initial_hull * sip->max_hull_hit_points / 100.0f;
|
||||
@@ -3821,38 +3788,32 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
if (optional_string("+Persona Index:"))
|
||||
stuff_int(&p_objp->persona_index);
|
||||
|
||||
// texture replacement - Goober5000
|
||||
p_objp->num_texture_replacements = 0;
|
||||
if (optional_string("$Texture Replace:") || optional_string("$Duplicate Model Texture Replace:"))
|
||||
// texture replacement
|
||||
p_objp->replacement_textures.clear();
|
||||
p_objp->texture_set = NULL;
|
||||
if ( optional_string("$Texture Replace:") || optional_string("$Duplicate Model Texture Replace:") )
|
||||
{
|
||||
texture_replace trp;
|
||||
char *p;
|
||||
|
||||
while ((p_objp->num_texture_replacements < MAX_MODEL_TEXTURES) && (optional_string("+old:")))
|
||||
{
|
||||
stuff_string(p_objp->replacement_textures[p_objp->num_texture_replacements].old_texture, F_NAME, MAX_FILENAME_LEN);
|
||||
while ( optional_string("+old:") ) {
|
||||
stuff_string(trp.old_texture, F_NAME, MAX_FILENAME_LEN);
|
||||
required_string("+new:");
|
||||
stuff_string(p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture, F_NAME, MAX_FILENAME_LEN);
|
||||
stuff_string(trp.new_texture, F_NAME, MAX_FILENAME_LEN);
|
||||
|
||||
// get rid of extensions
|
||||
p = strchr(p_objp->replacement_textures[p_objp->num_texture_replacements].old_texture, '.');
|
||||
p = strchr(trp.old_texture, '.');
|
||||
if (p)
|
||||
{
|
||||
mprintf(("Extraneous extension found on replacement texture %s!\n", p_objp->replacement_textures[p_objp->num_texture_replacements].old_texture));
|
||||
*p = 0;
|
||||
}
|
||||
p = strchr(p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture, '.');
|
||||
if (p)
|
||||
{
|
||||
mprintf(("Extraneous extension found on replacement texture %s!\n", p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture));
|
||||
mprintf(("Extraneous extension found on replacement texture %s!\n", trp.old_texture));
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// load the texture
|
||||
p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture_id = bm_load(p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture);
|
||||
|
||||
if (p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture_id < 0)
|
||||
p = strchr(trp.new_texture, '.');
|
||||
if (p)
|
||||
{
|
||||
Warning(LOCATION, "Could not load replacement texture %s for ship %s\n", p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture, p_objp->name);
|
||||
mprintf(("Extraneous extension found on replacement texture %s!\n", trp.new_texture));
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// *** account for FRED
|
||||
@@ -3860,14 +3821,23 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
{
|
||||
Assert( Fred_texture_replacements != NULL );
|
||||
strcpy(Fred_texture_replacements[Fred_num_texture_replacements].ship_name, p_objp->name);
|
||||
strcpy(Fred_texture_replacements[Fred_num_texture_replacements].old_texture, p_objp->replacement_textures[p_objp->num_texture_replacements].old_texture);
|
||||
strcpy(Fred_texture_replacements[Fred_num_texture_replacements].new_texture, p_objp->replacement_textures[p_objp->num_texture_replacements].new_texture);
|
||||
Fred_texture_replacements[Fred_num_texture_replacements].new_texture_id = -1;
|
||||
strcpy(Fred_texture_replacements[Fred_num_texture_replacements].old_texture, trp.old_texture);
|
||||
strcpy(Fred_texture_replacements[Fred_num_texture_replacements].new_texture, trp.new_texture);
|
||||
Fred_num_texture_replacements++;
|
||||
}
|
||||
|
||||
// increment
|
||||
p_objp->num_texture_replacements++;
|
||||
// check if we already have an existing replacement texture, and if so delete it to add the new specification
|
||||
for (i = 0; i < (int)p_objp->replacement_textures.size(); i++)
|
||||
{
|
||||
if ( !stricmp(p_objp->replacement_textures[i].old_texture, trp.old_texture) )
|
||||
p_objp->replacement_textures.erase( p_objp->replacement_textures.begin() + i );
|
||||
}
|
||||
|
||||
// add the texture set only if we aren't over the limit
|
||||
if ( p_objp->replacement_textures.size() < MAX_MODEL_TEXTURES )
|
||||
p_objp->replacement_textures.push_back( trp );
|
||||
else
|
||||
mprintf(("Too many replacement textures specified for ship '%s'!\n", p_objp->name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3892,7 +3862,7 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
Player_start_pobject = *p_objp;
|
||||
Player_start_pobject.flags |= P_SF_PLAYER_START_VALID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Goober5000 - preload stuff for certain object flags
|
||||
// (done after parsing object, but before creating it)
|
||||
@@ -3903,6 +3873,36 @@ int parse_object(mission *pm, int flag, p_object *p_objp)
|
||||
return 1;
|
||||
}
|
||||
|
||||
void mission_parse_handle_late_arrivals(p_object *p_objp)
|
||||
{
|
||||
ship_info *sip = NULL;
|
||||
polymodel *pm = NULL;
|
||||
model_subsystem *subsystems = NULL;
|
||||
|
||||
// only for objects which show up after the start of a mission
|
||||
if (p_objp->created_object != NULL)
|
||||
return;
|
||||
|
||||
Assert( p_objp->ship_class >= 0 );
|
||||
|
||||
sip = &Ship_info[p_objp->ship_class];
|
||||
|
||||
if ( !sip->subsystems.empty() ) {
|
||||
subsystems = &sip->subsystems[0];
|
||||
}
|
||||
|
||||
// we need the model to process the texture set, so go ahead and load it now
|
||||
sip->model_num = model_load(sip->pof_file, sip->subsystems.size(), subsystems);
|
||||
|
||||
pm = model_get(sip->model_num);
|
||||
|
||||
// make sure that we have valid ship-level textures loaded, if they exist
|
||||
ship_init_texture_set(p_objp->ship_class, pm);
|
||||
|
||||
// now handle any object specific replacement textures
|
||||
parse_object_init_texture_set(p_objp, sip, pm);
|
||||
}
|
||||
|
||||
// Goober5000 - I split this because 1) it's clearer; and 2) initially multiple docked ships would have been
|
||||
// insanely difficult otherwise
|
||||
//
|
||||
@@ -3937,6 +3937,9 @@ void mission_parse_maybe_create_parse_object(p_object *pobjp)
|
||||
|
||||
// add to arrival list
|
||||
list_append(&Ship_arrival_list, pobjp);
|
||||
|
||||
// we need to deal with replacement textures now, so that texture page-in will work properly
|
||||
mission_parse_handle_late_arrivals(pobjp);
|
||||
}
|
||||
// ingame joiners bail here.
|
||||
else if((Game_mode & GM_MULTIPLAYER) && (Net_player->flags & NETINFO_FLAG_INGAME_JOIN))
|
||||
@@ -4182,12 +4185,14 @@ void swap_parse_object(p_object *p_obj, int new_ship_class)
|
||||
|
||||
p_object *mission_parse_get_parse_object(ushort net_signature)
|
||||
{
|
||||
int i;
|
||||
uint i;
|
||||
|
||||
// look for original ships
|
||||
for (i = 0; i < (int)Parse_objects.size(); i++)
|
||||
if(Parse_objects[i].net_signature == net_signature)
|
||||
for (i = 0; i < Parse_objects.size(); i++) {
|
||||
if (Parse_objects[i].net_signature == net_signature) {
|
||||
return &Parse_objects[i];
|
||||
}
|
||||
}
|
||||
|
||||
// boo
|
||||
return NULL;
|
||||
@@ -4196,12 +4201,14 @@ p_object *mission_parse_get_parse_object(ushort net_signature)
|
||||
// Goober5000 - also get it by name
|
||||
p_object *mission_parse_get_parse_object(char *name)
|
||||
{
|
||||
int i;
|
||||
uint i;
|
||||
|
||||
// look for original ships
|
||||
for (i = 0; i < (int)Parse_objects.size(); i++)
|
||||
if(!stricmp(Parse_objects[i].name, name))
|
||||
for (i = 0; i < Parse_objects.size(); i++) {
|
||||
if ( !stricmp(Parse_objects[i].name, name) ) {
|
||||
return &Parse_objects[i];
|
||||
}
|
||||
}
|
||||
|
||||
// boo
|
||||
return NULL;
|
||||
@@ -5641,6 +5648,13 @@ void parse_asteroid_fields(mission *pm)
|
||||
required_string("$Maximum:");
|
||||
stuff_vector(&Asteroid_field.max_bound);
|
||||
|
||||
vec3d a_rad;
|
||||
vm_vec_sub(&a_rad, &Asteroid_field.max_bound, &Asteroid_field.min_bound);
|
||||
vm_vec_scale(&a_rad, 0.5f);
|
||||
float b_rad = vm_vec_mag(&a_rad);
|
||||
|
||||
Asteroid_field.bound_rad = MAX(3000.0f, b_rad);
|
||||
|
||||
if (optional_string("+Inner Bound:")) {
|
||||
Asteroid_field.has_inner_bound = 1;
|
||||
|
||||
@@ -6062,7 +6076,7 @@ int get_mission_info(char *filename, mission *mission_p, bool basic)
|
||||
{
|
||||
char real_fname[MAX_FILENAME_LEN];
|
||||
strcpy(real_fname, filename);
|
||||
char *p = strchr(real_fname, '.');
|
||||
char *p = strrchr(real_fname, '.');
|
||||
if (p) *p = 0; // remove any extension
|
||||
strcat(real_fname, FS_MISSION_FILE_EXT); // append mission extension
|
||||
|
||||
@@ -6193,20 +6207,25 @@ int parse_main(char *mission_name, int flags)
|
||||
return rval;
|
||||
}
|
||||
|
||||
void mission_parse_level_close()
|
||||
{
|
||||
uint i;
|
||||
|
||||
// free parse object dock lists
|
||||
for (i = 0; i < Parse_objects.size(); i++) {
|
||||
dock_free_instances(&Parse_objects[i]);
|
||||
|
||||
parse_object_page_out_texture_set(&Parse_objects[i], true);
|
||||
}
|
||||
}
|
||||
|
||||
void mission_parse_close()
|
||||
{
|
||||
// free subsystems
|
||||
if (Subsys_status != NULL)
|
||||
{
|
||||
if (Subsys_status != NULL) {
|
||||
vm_free(Subsys_status);
|
||||
Subsys_status = NULL;
|
||||
}
|
||||
|
||||
// free parse object dock lists
|
||||
for (int i = 0; i < (int)Parse_objects.size(); i++)
|
||||
{
|
||||
dock_free_instances(&Parse_objects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// sets the arrival location of the ships in wingp. pass num_to_set since the threshold value
|
||||
@@ -6379,7 +6398,7 @@ void parse_object_clear_handled_flag_helper(p_object *pobjp, p_dock_function_inf
|
||||
void parse_object_clear_all_handled_flags()
|
||||
{
|
||||
// clear flag for all ships
|
||||
for (int i = 0; i < (int)Parse_objects.size(); i++)
|
||||
for (uint i = 0; i < Parse_objects.size(); i++)
|
||||
{
|
||||
p_object *pobjp = &Parse_objects[i];
|
||||
p_dock_function_info dfi;
|
||||
@@ -7778,7 +7797,9 @@ void mission_bring_in_support_ship( object *requester_objp )
|
||||
pobj->wing_status_wing_pos = -1;
|
||||
pobj->respawn_count = 0;
|
||||
pobj->alt_type_index = -1;
|
||||
pobj->num_texture_replacements = 0;
|
||||
|
||||
pobj->replacement_textures.clear();
|
||||
pobj->texture_set = NULL;
|
||||
}
|
||||
|
||||
// returns true if a support ship is currently in the process of warping in.
|
||||
@@ -7968,24 +7989,23 @@ void restore_default_weapons(char *ships_tbl)
|
||||
ship_info *sip;
|
||||
|
||||
// guesstimate that this actually is a ships.tbl
|
||||
if (!strstr(ships_tbl, "#Ship Classes"))
|
||||
{
|
||||
if ( !strstr(ships_tbl, "#Ship Classes") ) {
|
||||
MessageBox(NULL, "This is not a ships.tbl file. Aborting conversion...", "Error", MB_OK);
|
||||
return;
|
||||
}
|
||||
|
||||
// for every ship
|
||||
for (i = 0; i < MAX_SHIPS; i++)
|
||||
{
|
||||
for (i = 0; i < MAX_SHIPS; i++) {
|
||||
// ensure the ship slot is used in this mission
|
||||
if (Ships[i].objnum >= 0)
|
||||
{
|
||||
if (Ships[i].objnum >= 0) {
|
||||
// get ship_info
|
||||
sip = &Ship_info[Ships[i].ship_info_index];
|
||||
|
||||
// find the ship class
|
||||
ch = strstr(ships_tbl, ship_class);
|
||||
if (!ch) continue;
|
||||
if (!ch) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check pbanks (capital ships have these specified but empty)
|
||||
Mp = strstr(ch, "$Default PBanks");
|
||||
@@ -7999,40 +8019,45 @@ void restore_default_weapons(char *ships_tbl)
|
||||
|
||||
// see if we have any turrets
|
||||
ch = strstr(ch, "$Subsystem");
|
||||
for (ss = GET_FIRST(&Ships[i].subsys_list); ss != END_OF_LIST(&Ships[i].subsys_list); ss = GET_NEXT(ss))
|
||||
{
|
||||
for ( ss = GET_FIRST(&Ships[i].subsys_list); ss != END_OF_LIST(&Ships[i].subsys_list); ss = GET_NEXT(ss) ) {
|
||||
// we do
|
||||
if (ss->system_info->type == SUBSYSTEM_TURRET)
|
||||
{
|
||||
if (ss->system_info->type == SUBSYSTEM_TURRET) {
|
||||
// find it in the ship_info subsys list
|
||||
si_subsys = -1;
|
||||
for (j = 0; j < sip->n_subsystems; j++)
|
||||
{
|
||||
if (!subsystem_stricmp(ss->system_info->subobj_name, sip->subsystems[j].subobj_name))
|
||||
{
|
||||
|
||||
for (j = 0; j < (int)sip->subsystems.size(); j++) {
|
||||
if ( !subsystem_stricmp(ss->system_info->subobj_name, sip->subsystems[j].subobj_name) ) {
|
||||
si_subsys = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (si_subsys < 0) continue;
|
||||
|
||||
if (si_subsys < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// find it in the file - make sure it belongs to *this* ship
|
||||
subsys = stristr(ch, ss->system_info->subobj_name);
|
||||
if (!subsys) continue;
|
||||
if (subsys > strstr(ch, "$Name")) continue;
|
||||
if ( !subsys ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( subsys > strstr(ch, "$Name") ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// check pbanks - make sure they are *this* subsystem's banks
|
||||
Mp = strstr(subsys, "$Default PBanks");
|
||||
if (Mp < strstr(subsys + 1, "$Subsystem"))
|
||||
{
|
||||
|
||||
if ( Mp < strstr(subsys + 1, "$Subsystem") ) {
|
||||
Mp = strchr(Mp, '(');
|
||||
restore_one_primary_bank(ss->weapons.primary_bank_weapons, sip->subsystems[si_subsys].primary_banks);
|
||||
}
|
||||
|
||||
// check sbanks - make sure they are *this* subsystem's banks
|
||||
Mp = strstr(subsys, "$Default SBanks");
|
||||
if (Mp < strstr(subsys + 1, "$Subsystem"))
|
||||
{
|
||||
|
||||
if ( Mp < strstr(subsys + 1, "$Subsystem") ) {
|
||||
Mp = strchr(Mp, '(');
|
||||
restore_one_secondary_bank(ss->weapons.secondary_bank_weapons, sip->subsystems[si_subsys].secondary_banks);
|
||||
}
|
||||
@@ -8081,3 +8106,88 @@ void restore_one_secondary_bank(int *ship_secondary_weapons, int *default_second
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this init and page_out stuff is basically a copy of the ship_* versions, but specific to p_object handling
|
||||
extern void model_page_out_texture_info(texture_info *tinfo, bool release);
|
||||
|
||||
void parse_object_page_out_texture_set(p_object *p_objp, bool release)
|
||||
{
|
||||
texture_map *tmap;
|
||||
int i;
|
||||
|
||||
if (p_objp == NULL) {
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_objp->texture_set == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_MODEL_TEXTURES; i++) {
|
||||
tmap = &p_objp->texture_set[i];
|
||||
|
||||
if (tmap->set_flag != TMR_SET_POBJECT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
model_page_out_texture_info(&tmap->base_map, release);
|
||||
model_page_out_texture_info(&tmap->glow_map, release);
|
||||
model_page_out_texture_info(&tmap->spec_map, release);
|
||||
model_page_out_texture_info(&tmap->norm_map, release);
|
||||
model_page_out_texture_info(&tmap->height_map, release);
|
||||
}
|
||||
|
||||
vm_free(p_objp->texture_set);
|
||||
p_objp->texture_set = NULL;
|
||||
}
|
||||
|
||||
void parse_object_init_texture_set(p_object *p_objp, ship_info *sip, polymodel *pm)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
Assert( pm != NULL );
|
||||
Assert( sip != NULL );
|
||||
|
||||
if (p_objp == NULL) {
|
||||
Int3();
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_objp->texture_set != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_objp->replacement_textures.size() < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// allocate memory and set original textures by default
|
||||
p_objp->texture_set = (texture_map*) vm_malloc( sizeof(texture_map) * MAX_MODEL_TEXTURES );
|
||||
|
||||
if (sip->texture_set != NULL) {
|
||||
memcpy( p_objp->texture_set, sip->texture_set, sizeof(texture_map) * MAX_MODEL_TEXTURES );
|
||||
} else {
|
||||
memcpy( p_objp->texture_set, pm->original_maps, sizeof(texture_map) * MAX_MODEL_TEXTURES );
|
||||
}
|
||||
|
||||
// now fill in the replacements
|
||||
for (i = 0; i < (int)p_objp->replacement_textures.size(); i++) {
|
||||
// look for textures
|
||||
for (j = 0; j < pm->n_textures; j++) {
|
||||
if ( !strlen(p_objp->texture_set[j].filename) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// now compare the extension-less texture file names
|
||||
if ( !stricmp(p_objp->texture_set[j].filename, p_objp->replacement_textures[i].old_texture) ) {
|
||||
// replace it
|
||||
model_load_texture(&p_objp->texture_set[j], p_objp->replacement_textures[i].new_texture, p_objp->name);
|
||||
p_objp->texture_set[j].set_flag = TMR_SET_POBJECT;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
* Special shockwave and moving capship bugfix, (even more) scripting stuff, slight rearrangement of level management functions to facilitate scripting access.
|
||||
*
|
||||
* Revision 2.75 2006/01/13 03:31:09 Goober5000
|
||||
* übercommit of custom IFF stuff :)
|
||||
* �bercommit of custom IFF stuff :)
|
||||
*
|
||||
* Revision 2.74 2005/12/29 08:08:36 wmcoolmon
|
||||
* Codebase commit, most notably including objecttypes.tbl
|
||||
@@ -809,7 +809,6 @@ typedef struct texture_replace {
|
||||
char ship_name[NAME_LENGTH];
|
||||
char old_texture[MAX_FILENAME_LEN];
|
||||
char new_texture[MAX_FILENAME_LEN];
|
||||
int new_texture_id;
|
||||
} texture_replace;
|
||||
|
||||
extern texture_replace *Fred_texture_replacements;
|
||||
@@ -892,9 +891,8 @@ typedef struct p_object {
|
||||
float ship_max_hull_strength;
|
||||
float ship_max_shield_strength;
|
||||
|
||||
// Goober5000
|
||||
int num_texture_replacements;
|
||||
texture_replace replacement_textures[MAX_MODEL_TEXTURES]; // replacement textures - Goober5000
|
||||
std::vector<texture_replace> replacement_textures;
|
||||
texture_map *texture_set;
|
||||
} p_object;
|
||||
|
||||
// defines for flags used for p_objects when they are created. Used to help create special
|
||||
@@ -1022,6 +1020,9 @@ p_object *mission_parse_get_parse_object(char *name);
|
||||
int parse_create_object(p_object *objp);
|
||||
void resolve_parse_flags(object *objp, int parse_flags, int parse_flags2);
|
||||
|
||||
// game_level_close() close out
|
||||
void mission_parse_level_close();
|
||||
// game_shutdown() close out
|
||||
void mission_parse_close();
|
||||
|
||||
// used in squadmate messaging stuff to create wings from reinforcements.
|
||||
|
||||
@@ -1702,64 +1702,77 @@ int brief_setup_closeup(brief_icon *bi)
|
||||
Closeup_one_revolution_time = ONE_REV_TIME;
|
||||
|
||||
switch(Closeup_icon->type) {
|
||||
case ICON_PLANET:
|
||||
Closeup_icon = NULL;
|
||||
return -1;
|
||||
/*
|
||||
strcpy(pof_filename, NOX("planet.pof"));
|
||||
strcpy(Closeup_icon->closeup_label, XSTR("planet",-1));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -8300.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
Closeup_one_revolution_time = ONE_REV_TIME * 3;
|
||||
*/
|
||||
break;
|
||||
case ICON_ASTEROID_FIELD:
|
||||
#ifndef FS2_DEMO
|
||||
strcpy(pof_filename, Asteroid_info[ASTEROID_TYPE_LARGE].pof_files[0]);
|
||||
strcpy(Closeup_icon->closeup_label, XSTR( "asteroid", 431));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -334.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
#endif
|
||||
break;
|
||||
case ICON_JUMP_NODE:
|
||||
strcpy(pof_filename, NOX("subspacenode.pof"));
|
||||
strcpy(Closeup_icon->closeup_label, XSTR( "jump node", 432));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -2700.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
Closeup_one_revolution_time = ONE_REV_TIME * 3;
|
||||
break;
|
||||
case ICON_UNKNOWN:
|
||||
case ICON_UNKNOWN_WING:
|
||||
strcpy(pof_filename, NOX("unknownship.pof"));
|
||||
strcpy(Closeup_icon->closeup_label, XSTR( "unknown", 433));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -22.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
break;
|
||||
default:
|
||||
brief_get_closeup_ship_modelnum(Closeup_icon);
|
||||
Assert( Closeup_icon->ship_class != -1 );
|
||||
sip = &Ship_info[Closeup_icon->ship_class];
|
||||
|
||||
strcpy(Closeup_icon->closeup_label,sip->name);
|
||||
|
||||
// cut any text off after (and including) '#' char
|
||||
end_string_at_first_hash_symbol(Closeup_icon->closeup_label);
|
||||
|
||||
// Goober5000 - wcsaga doesn't want this
|
||||
if (!Cmdline_wcsaga && sip->flags & (SIF_SMALL_SHIP|SIF_BIG_SHIP|SIF_HUGE_SHIP|SIF_SENTRYGUN))
|
||||
{
|
||||
strcat(Closeup_icon->closeup_label, XSTR( " class", 434));
|
||||
case ICON_PLANET: {
|
||||
Closeup_icon = NULL;
|
||||
return -1;
|
||||
/*
|
||||
strcpy(pof_filename, NOX("planet.pof"));
|
||||
strcpy(Closeup_icon->closeup_label, XSTR("planet",-1));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -8300.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
Closeup_one_revolution_time = ONE_REV_TIME * 3;
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case ICON_ASTEROID_FIELD: {
|
||||
#ifndef FS2_DEMO
|
||||
strcpy(pof_filename, Asteroid_info[ASTEROID_TYPE_LARGE].pof_files[0]);
|
||||
strcpy(Closeup_icon->closeup_label, XSTR( "asteroid", 431));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -334.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ICON_JUMP_NODE: {
|
||||
strcpy(pof_filename, NOX("subspacenode.pof"));
|
||||
strcpy(Closeup_icon->closeup_label, XSTR( "jump node", 432));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -2700.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
Closeup_one_revolution_time = ONE_REV_TIME * 3;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ICON_UNKNOWN:
|
||||
case ICON_UNKNOWN_WING: {
|
||||
strcpy(pof_filename, NOX("unknownship.pof"));
|
||||
strcpy(Closeup_icon->closeup_label, XSTR( "unknown", 433));
|
||||
vm_vec_make(&Closeup_cam_pos, 0.0f, 0.0f, -22.0f);
|
||||
Closeup_zoom = 0.5f;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
brief_get_closeup_ship_modelnum(Closeup_icon);
|
||||
Assert( Closeup_icon->ship_class != -1 );
|
||||
sip = &Ship_info[Closeup_icon->ship_class];
|
||||
|
||||
strcpy(Closeup_icon->closeup_label,sip->name);
|
||||
|
||||
// cut any text off after (and including) '#' char
|
||||
end_string_at_first_hash_symbol(Closeup_icon->closeup_label);
|
||||
|
||||
// Goober5000 - wcsaga doesn't want this
|
||||
if ( !Cmdline_wcsaga && sip->flags & (SIF_SMALL_SHIP|SIF_BIG_SHIP|SIF_HUGE_SHIP|SIF_SENTRYGUN) ) {
|
||||
strcat(Closeup_icon->closeup_label, XSTR( " class", 434));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Closeup_icon->modelnum == -1 ) {
|
||||
if ( sip == NULL ) {
|
||||
Closeup_icon->modelnum = model_load(pof_filename, 0, NULL);
|
||||
} else {
|
||||
Closeup_icon->modelnum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
Closeup_icon->modelnum = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
}
|
||||
|
||||
Closeup_icon->radius = model_get_radius(Closeup_icon->modelnum);
|
||||
}
|
||||
|
||||
|
||||
@@ -760,10 +760,6 @@ void common_set_interface_palette(char *filename)
|
||||
Error(LOCATION, "Could not load in \"%s\"!", filename);
|
||||
}
|
||||
*/
|
||||
|
||||
#ifndef HARDWARE_ONLY
|
||||
palette_use_bm_palette(InterfacePaletteBitmap);
|
||||
#endif
|
||||
}
|
||||
|
||||
// release the interface palette .pcx file, and restore the game palette
|
||||
|
||||
@@ -1813,41 +1813,36 @@ void ship_select_blit_ship_info()
|
||||
}
|
||||
gr_string(Ship_info_coords[gr_screen.res][SHIP_SELECT_X_COORD]+4, y_start, str);
|
||||
}
|
||||
|
||||
y_start += 10;
|
||||
|
||||
if(ShipSelectModelNum >= 0)
|
||||
{
|
||||
if (ShipSelectModelNum >= 0) {
|
||||
int num_turrets = 0;
|
||||
int x;
|
||||
for(x = 0; x < sip->n_subsystems; x++)
|
||||
{
|
||||
if(sip->subsystems[x].type == SUBSYSTEM_TURRET)
|
||||
|
||||
for (uint x = 0; x < sip->subsystems.size(); x++) {
|
||||
if (sip->subsystems[x].type == SUBSYSTEM_TURRET) {
|
||||
num_turrets++;
|
||||
/*
|
||||
for(y = 0; y < MAX_SHIP_PRIMARY_BANKS || y < MAX_SHIP_SECONDARY_BANKS; y++)
|
||||
}
|
||||
|
||||
/*for (int y = 0; (y < MAX_SHIP_PRIMARY_BANKS) || (y < MAX_SHIP_SECONDARY_BANKS); y++)
|
||||
{
|
||||
if(y < MAX_SHIP_PRIMARY_BANKS)
|
||||
{
|
||||
if(sip->subsystems[x].primary_banks[y] != -1)
|
||||
{
|
||||
if (y < MAX_SHIP_PRIMARY_BANKS) {
|
||||
if (sip->subsystems[x].primary_banks[y] != -1) {
|
||||
num_turrets++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(y < MAX_SHIP_SECONDARY_BANKS)
|
||||
{
|
||||
if(sip->subsystems[x].secondary_banks[y] != -1)
|
||||
{
|
||||
if (y < MAX_SHIP_SECONDARY_BANKS) {
|
||||
if (sip->subsystems[x].secondary_banks[y] != -1) {
|
||||
num_turrets++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}*/
|
||||
}
|
||||
if(num_turrets)
|
||||
{
|
||||
|
||||
if (num_turrets) {
|
||||
gr_set_color_fast(header);
|
||||
gr_string(Ship_info_coords[gr_screen.res][SHIP_SELECT_X_COORD], y_start, XSTR("Turrets",-1));
|
||||
y_start += 10;
|
||||
@@ -2106,31 +2101,34 @@ void ship_select_do(float frametime)
|
||||
|
||||
if ( ss_icon_being_carried() ) {
|
||||
int mouse_x, mouse_y, sx, sy;
|
||||
|
||||
mouse_get_pos_unscaled( &mouse_x, &mouse_y );
|
||||
|
||||
sx = mouse_x + Ss_delta_x;
|
||||
sy = mouse_y + Ss_delta_y;
|
||||
if(Ss_icons[Carried_ss_icon.ship_class].icon_bmaps[ICON_FRAME_SELECTED] != -1)
|
||||
{
|
||||
|
||||
if (Ss_icons[Carried_ss_icon.ship_class].icon_bmaps[ICON_FRAME_SELECTED] != -1) {
|
||||
gr_set_bitmap(Ss_icons[Carried_ss_icon.ship_class].icon_bmaps[ICON_FRAME_SELECTED]);
|
||||
gr_bitmap(sx, sy);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ship_info *sip = &Ship_info[Carried_ss_icon.ship_class];
|
||||
if(Ss_icons[Carried_ss_icon.ship_class].model_index == -1) {
|
||||
Ss_icons[Carried_ss_icon.ship_class].model_index = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
|
||||
if (Ss_icons[Carried_ss_icon.ship_class].model_index == -1) {
|
||||
Ss_icons[Carried_ss_icon.ship_class].model_index = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
|
||||
mprintf(("SL WARNING: Had to attempt to page in model for %s paged in manually! Result: %d\n", sip->name, Ss_icons[Carried_ss_icon.ship_class].model_index));
|
||||
}
|
||||
|
||||
gr_set_color_fast(&Icon_colors[ICON_FRAME_SELECTED]);
|
||||
//gr_set_shader(&Icon_shaders[ICON_FRAME_SELECTED]);
|
||||
|
||||
int w = 32;
|
||||
int h = 28;
|
||||
|
||||
if(Ss_icons[Carried_ss_icon.ship_class].model_index != -1)
|
||||
{
|
||||
if (Ss_icons[Carried_ss_icon.ship_class].model_index != -1) {
|
||||
draw_model_icon(Ss_icons[Carried_ss_icon.ship_class].model_index, MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING | MR_NO_LIGHTING, sip->closeup_zoom / 1.25f, sx, sy, w, h, sip);
|
||||
}
|
||||
|
||||
draw_brackets_square(sx, sy, sx + w, sy + h);
|
||||
//gr_shade(mouse_x + Ss_delta_x, mouse_y + Ss_delta_y, 32, 28);
|
||||
}
|
||||
@@ -2338,24 +2336,25 @@ void draw_ship_icon_with_number(int screen_offset, int ship_class)
|
||||
}
|
||||
|
||||
// blit the icon
|
||||
if(ss_icon->current_icon_bitmap != -1)
|
||||
{
|
||||
if (ss_icon->current_icon_bitmap != -1) {
|
||||
gr_set_bitmap(ss_icon->current_icon_bitmap);
|
||||
gr_bitmap(Ship_list_coords[gr_screen.res][screen_offset][0], Ship_list_coords[gr_screen.res][screen_offset][1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ship_info *sip = &Ship_info[ship_class];
|
||||
if(ss_icon->model_index == -1) {
|
||||
ss_icon->model_index = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
|
||||
if (ss_icon->model_index == -1) {
|
||||
ss_icon->model_index = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
|
||||
mprintf(("SL WARNING: Had to attempt to page in model for %s paged in manually! Result: %d\n", sip->name, ss_icon->model_index));
|
||||
}
|
||||
|
||||
gr_set_color_fast(color_to_draw);
|
||||
//gr_set_shader(shader_to_use);
|
||||
if(ss_icon->model_index != -1)
|
||||
{
|
||||
|
||||
if (ss_icon->model_index != -1) {
|
||||
draw_model_icon(ss_icon->model_index, MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING | MR_NO_LIGHTING, sip->closeup_zoom / 1.25f, Ship_list_coords[gr_screen.res][screen_offset][0],Ship_list_coords[gr_screen.res][screen_offset][1], 32, 28, sip);
|
||||
}
|
||||
|
||||
draw_brackets_square(Ship_list_coords[gr_screen.res][screen_offset][0], Ship_list_coords[gr_screen.res][screen_offset][1], Ship_list_coords[gr_screen.res][screen_offset][0] + 32, Ship_list_coords[gr_screen.res][screen_offset][1] + 28);
|
||||
//gr_shade(Ship_list_coords[gr_screen.res][screen_offset][0],Ship_list_coords[gr_screen.res][screen_offset][1], 32, 28);
|
||||
}
|
||||
@@ -2447,7 +2446,7 @@ void start_ship_animation(int ship_class, int play_sound)
|
||||
}
|
||||
|
||||
// Load the necessary model file
|
||||
ShipSelectModelNum = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
ShipSelectModelNum = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
|
||||
// page in ship textures properly (takes care of nondimming pixels)
|
||||
model_page_in_textures(ShipSelectModelNum, ship_class);
|
||||
@@ -2928,31 +2927,28 @@ void ss_make_slot_full(int slot_index)
|
||||
void ss_blit_ship_icon(int x,int y,int ship_class,int bmap_num)
|
||||
{
|
||||
// blit the bitmap in the correct location
|
||||
if(ship_class == -1)
|
||||
{
|
||||
if (ship_class == -1) {
|
||||
gr_set_bitmap(Wing_slot_empty_bitmap);
|
||||
gr_bitmap(x,y);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Assert( Ss_icons != NULL );
|
||||
|
||||
ss_icon_info *icon = &Ss_icons[ship_class];
|
||||
if(icon->icon_bmaps[bmap_num] != -1)
|
||||
{
|
||||
|
||||
if (icon->icon_bmaps[bmap_num] != -1) {
|
||||
Assert(icon->icon_bmaps[bmap_num] != -1);
|
||||
|
||||
gr_set_bitmap(icon->icon_bmaps[bmap_num]);
|
||||
gr_bitmap(x,y);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ship_info *sip = &Ship_info[ship_class];
|
||||
if(icon->model_index == -1) {
|
||||
icon->model_index = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
|
||||
if (icon->model_index == -1) {
|
||||
icon->model_index = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
mprintf(("SL WARNING: Had to attempt to page in model for %s paged in manually! Result: %d\n", sip->name, icon->model_index));
|
||||
}
|
||||
if(icon->model_index != -1)
|
||||
{
|
||||
|
||||
if (icon->model_index != -1) {
|
||||
gr_set_color_fast(&Icon_colors[bmap_num]);
|
||||
//gr_set_shader(&Icon_shaders[bmap_num]);
|
||||
draw_model_icon(icon->model_index, MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING | MR_NO_LIGHTING, sip->closeup_zoom / 1.25f, x, y, 32, 28, sip);
|
||||
@@ -3476,25 +3472,24 @@ void ss_load_icons(int ship_class)
|
||||
icon = &Ss_icons[ship_class];
|
||||
ship_info *sip = &Ship_info[ship_class];
|
||||
|
||||
if(!Cmdline_ship_choice_3d && strlen(sip->icon_filename))
|
||||
{
|
||||
int first_frame, num_frames, i;
|
||||
first_frame = bm_load_animation(sip->icon_filename, &num_frames);
|
||||
if ( first_frame == -1 ) {
|
||||
if ( !Cmdline_ship_choice_3d && strlen(sip->icon_filename) ) {
|
||||
int first_frame, num_frames, i;
|
||||
|
||||
first_frame = bm_load_animation(sip->icon_filename, &num_frames, NULL, 0, CF_TYPE_INTERFACE);
|
||||
|
||||
if (first_frame == -1) {
|
||||
Int3(); // Could not load in icon frames.. get Alan
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i = 0; i < num_frames; i++ ) {
|
||||
for (i = 0; i < num_frames; i++) {
|
||||
icon->icon_bmaps[i] = first_frame+i;
|
||||
}
|
||||
|
||||
// set the current bitmap for the ship icon
|
||||
icon->current_icon_bitmap = icon->icon_bmaps[ICON_FRAME_NORMAL];
|
||||
}
|
||||
else
|
||||
{
|
||||
icon->model_index = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
} else {
|
||||
icon->model_index = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
model_page_in_textures(icon->model_index, ship_class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1520,7 +1520,7 @@ void wl_render_overhead_view(float frametime)
|
||||
{
|
||||
if (wl_ship->model_num < 0)
|
||||
{
|
||||
wl_ship->model_num = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
wl_ship->model_num = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
model_page_in_textures(wl_ship->model_num, ship_class);
|
||||
}
|
||||
|
||||
@@ -1545,12 +1545,12 @@ void wl_render_overhead_view(float frametime)
|
||||
if (gr_screen.res == GR_640)
|
||||
{
|
||||
// lo-res
|
||||
wl_ship->overhead_bitmap = bm_load_animation(sip->overhead_filename);
|
||||
wl_ship->overhead_bitmap = bm_load_animation(sip->overhead_filename, NULL, NULL, 0, CF_TYPE_INTERFACE);
|
||||
} else {
|
||||
// high-res
|
||||
char filename[NAME_LENGTH+2] = "2_";
|
||||
strcat(filename, sip->overhead_filename);
|
||||
wl_ship->overhead_bitmap = bm_load_animation(sip->overhead_filename);
|
||||
wl_ship->overhead_bitmap = bm_load_animation(sip->overhead_filename, NULL, NULL, 0, CF_TYPE_INTERFACE);
|
||||
}
|
||||
|
||||
// load the bitmap
|
||||
@@ -1589,7 +1589,7 @@ void wl_render_overhead_view(float frametime)
|
||||
// Load the necessary model file, if necessary
|
||||
if (wl_ship->model_num < 0)
|
||||
{
|
||||
wl_ship->model_num = model_load(sip->pof_file, sip->n_subsystems, &sip->subsystems[0]);
|
||||
wl_ship->model_num = model_load(sip->pof_file, sip->subsystems.size(), &sip->subsystems[0]);
|
||||
model_page_in_textures(wl_ship->model_num, ship_class);
|
||||
}
|
||||
|
||||
@@ -1967,7 +1967,7 @@ void wl_load_icons(int weapon_class)
|
||||
|
||||
if(!Cmdline_ship_choice_3d || (wip->render_type == WRT_LASER && !strlen(wip->tech_model)))
|
||||
{
|
||||
first_frame = bm_load_animation(Weapon_info[weapon_class].icon_filename, &num_frames);
|
||||
first_frame = bm_load_animation(Weapon_info[weapon_class].icon_filename, &num_frames, NULL, 0, CF_TYPE_INTERFACE);
|
||||
|
||||
for ( i = 0; (i < num_frames) && (i < NUM_ICON_FRAMES); i++ ) {
|
||||
icon->icon_bmaps[i] = first_frame+i;
|
||||
@@ -4911,7 +4911,7 @@ void wl_apply_current_loadout_to_all_ships_in_current_wing()
|
||||
int source_wss_slot, cur_wss_slot;
|
||||
int cur_wing_block, cur_wing_slot, cur_bank;
|
||||
int weapon_type_to_add, result;
|
||||
int i;
|
||||
int i, j;
|
||||
|
||||
ship_info *sip, *source_sip;
|
||||
weapon_info *wip;
|
||||
@@ -5041,7 +5041,6 @@ void wl_apply_current_loadout_to_all_ships_in_current_wing()
|
||||
// display error messages
|
||||
if (error_flag)
|
||||
{
|
||||
int i, j;
|
||||
bool is_duplicate;
|
||||
char error_msg[MAX_WING_SLOTS * MAX_SHIP_WEAPONS * (50 + NAME_LENGTH * 2) + 40];
|
||||
strcpy(error_msg, "The following errors were encountered:\n\n");
|
||||
|
||||
Loaded 100 of 170 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user