Fixed set but unused variables

This commit is contained in:
zicodxx 2011-09-27 01:31:17 +02:00
parent bcdbff0665
commit fb775b35c3
31 changed files with 84 additions and 230 deletions

View file

@ -68,6 +68,7 @@ void gr_use_palette_table( char * filename )
fsize = PHYSFS_fileLength( fp );
Assert( fsize == 9472 );
(void)fsize;
PHYSFS_read( fp, gr_palette, 256*3, 1 );
PHYSFS_read( fp, gr_fade_table, 256*34, 1 );
PHYSFS_close(fp);

View file

@ -1,5 +1,9 @@
D1X-Rebirth Changelog
20110927
--------
2d/palette.c, RELEASE-NOTES.txt, editor/eobject.c, editor/group.c, editor/meddraw.c, editor/medrobot.c, editor/mine.c, editor/segment.c, editor/seguvs.c, iff/iff.c, main/aipath.c, main/bmread.c, main/dumpmine.c, main/fvi.c, main/gamemine.c, main/gamesave.c, main/gauges.c, main/newdemo.c, main/newmenu.c, main/piggy.c, main/render.c, main/titles.c, texmap/ntmap.c, texmap/scanline.c, ui/button.c, ui/inputbox.c, ui/keypad.c, ui/keytrap.c, ui/popup.c, ui/scroll.c: Fixed set but unused variables
20110926
--------
main/fireball.c, main/lighting.c: Code consistency checks by _Tyr_; Fixed set but unused variables

View file

@ -40,9 +40,6 @@ Special notes for this release
* Compiling the source via SCons will now automatically check for Endianess
* Available SConstruct options have changed! See 'scons -h' for more information.
* On *NIX (Linux, BSD, etc.) the game binary will be called 'd1/2x-rebirth' and on Windows the executable is called 'd1/2x-rebirth.exe'. No -gl or -sdl suffixes anymore. If needed, correct your Desktop shortcuts, start scripts, etc.
* If you use GCC 4.6 you might encounter many warnings looking like this:
'warning: variable VARIABLE_NAME set but not used [-Wunused-but-set-variable]'
Note that these warnings are totally harmless and we will fix them as soon as possible.
* The Tracker server is brand new and might still have a bug or two. If you encounter a bug, let us know so we can properly fix it. Most can be fixed without a modification on the game itself.

View file

@ -845,7 +845,6 @@ void move_object_to_position(int objnum, vms_vector *newpos)
fvi_query fq;
fvi_info hit_info;
vms_vector last_outside_pos;
vms_vector last_inside_pos;
temp_viewer_obj = *Viewer;
viewer_segnum = find_object_seg(&temp_viewer_obj);
@ -877,8 +876,6 @@ void move_object_to_position(int objnum, vms_vector *newpos)
vms_vector temp_vec;
last_inside_pos = temp_viewer_obj.pos;
vm_vec_avg(&temp_vec, &temp_viewer_obj.pos, &last_outside_pos);
temp_viewer_obj.pos = temp_vec;
update_object_seg(&temp_viewer_obj);

View file

@ -444,15 +444,11 @@ void duplicate_group(sbyte *vertex_ids, short *segment_ids, int num_segments)
int v,s,ss,new_vertex_id,new_segment_id,sidenum;
short new_segment_ids[MAX_SEGMENTS];
int new_vertex_ids[MAX_VERTICES]; // If new_vertex_ids[v] != -1, then vertex v has been remapped to new_vertex_ids[v]
short new_object_ids[MAX_OBJECTS];
// duplicate vertices
for (v=0; v<MXV; v++)
new_vertex_ids[v] = -1;
for (v=0; v<MAX_OBJECTS; v++)
new_object_ids[v] = -1;
// duplicate vertices
for (v=0; v<=Highest_vertex_index; v++) {
if (vertex_ids[v]) {
@ -473,6 +469,7 @@ void duplicate_group(sbyte *vertex_ids, short *segment_ids, int num_segments)
if (Objects[objnum].type != OBJ_PLAYER) {
int new_obj_id;
new_obj_id = obj_create_copy(objnum, &Objects[objnum].pos, new_segment_id);
(void)new_obj_id; // FIXME!
}
objnum = Objects[objnum].next;
}

View file

@ -495,14 +495,9 @@ void draw_special_wall( segment *seg, int side )
draw_wall_side(seg,side);
if (Walls[seg->sides[side].wall_num].trigger != -1) {
int trigger_num;
trigger_num = Walls[seg->sides[side].wall_num].trigger;
gr_setcolor(TRIGGER_COLOR);
draw_trigger_side(seg,side);
}
}
gr_setcolor(PLAINSEG_COLOR);
}

View file

@ -111,18 +111,6 @@ void call_init_ai_object(object *objp, int behavior)
init_ai_object(objp-Objects, behavior, hide_segment);
if (behavior == AIB_STATION) {
int cseg, mseg;
cseg = 0;
mseg = 0;
if (Cursegp != NULL)
cseg = Cursegp-Segments;
if (Markedsegp != NULL) {
mseg = Markedsegp-Segments;
}
objp->ctype.ai_info.follow_path_start_seg = Cursegp-Segments;
objp->ctype.ai_info.follow_path_end_seg = Markedsegp-Segments;
}

View file

@ -90,7 +90,7 @@ int med_save_mine(char * filename)
// saves to an already-open file
int save_mine_data(PHYSFS_file * SaveFile)
{
int header_offset, editor_offset, vertex_offset, segment_offset, doors_offset, texture_offset, walls_offset, triggers_offset; //, links_offset;
int header_offset, editor_offset, vertex_offset, segment_offset, texture_offset, walls_offset, triggers_offset; //, links_offset;
int newseg_verts_offset;
int newsegment_offset;
int i;
@ -112,7 +112,7 @@ int save_mine_data(PHYSFS_file * SaveFile)
newseg_verts_offset = newsegment_offset + sizeof(segment);
walls_offset = newseg_verts_offset + (sizeof(vms_vector)*8);
triggers_offset = walls_offset + (sizeof(wall)*Num_walls);
doors_offset = triggers_offset + (sizeof(trigger)*Num_triggers);
// doors_offset = triggers_offset + (sizeof(trigger)*Num_triggers);
//===================== SAVE FILE INFO ========================
@ -368,6 +368,7 @@ int save_mine_data_compiled(PHYSFS_file *SaveFile)
bit_mask |= (1 << sidenum);
wallnum = seg->sides[sidenum].wall_num;
Assert( wallnum < 255 ); // Get John or Mike.. can only store up to 255 walls!!!
(void)wallnum;
}
}
if (New_file_format_save)

View file

@ -647,7 +647,7 @@ void set_matrix_based_on_side(vms_matrix *rotmat,int destside)
case WBACK:
break;
}
(void)tmpvec;
}
// -------------------------------------------------------------------------------------
@ -1947,9 +1947,6 @@ void med_check_all_vertices()
{
int s,v;
segment *sp;
int count;
count = 0;
for (s=0; s<Num_segments; s++) {
sp = &Segments[s];

View file

@ -127,6 +127,7 @@ fix get_average_light_at_vertex(int vnum, short *segs)
*segs++ = segnum;
Assert(segs - original_segs < MAX_LIGHT_SEGS);
(void)original_segs;
for (sidenum=0; sidenum < MAX_SIDES_PER_SEGMENT; sidenum++) {
if (!IS_CHILD(segp->children[sidenum])) {
@ -1045,12 +1046,11 @@ found1: ;
// segment to get the wall in the connected segment which shares the edge, and get tmap_num from there.
void propagate_tmaps_to_segment_sides(segment *base_seg, int base_side, segment *con_seg, int con_side, int uv_only_flag)
{
sbyte *base_vp,*con_vp;
sbyte *base_vp;
int abs_id1,abs_id2;
int v;
base_vp = Side_to_verts[base_side];
con_vp = Side_to_verts[con_side];
// Do for each edge on connecting face.
for (v=0; v<4; v++) {

View file

@ -759,6 +759,7 @@ int write_body(PHYSFS_file *ofile,iff_bitmap_header *bitmap_header,int compressi
if (compression_on) { //write actual data length
Assert(PHYSFSX_fseek(ofile,save_pos,SEEK_SET)==0);
(void)save_pos;
PHYSFS_writeSBE32(ofile, total_len);
Assert(PHYSFSX_fseek(ofile,total_len,SEEK_CUR)==0);
if (total_len&1) PHYSFSX_writeU8(ofile, 0); //pad to even
@ -815,6 +816,7 @@ int write_tiny(PHYSFS_file *ofile,iff_bitmap_header *bitmap_header,int compressi
if (compression_on) {
Assert(PHYSFSX_fseek(ofile,save_pos,SEEK_SET)==0);
(void)save_pos;
PHYSFS_writeSBE32(ofile, 4+total_len);
Assert(PHYSFSX_fseek(ofile,4+total_len,SEEK_CUR)==0);
if (total_len&1) PHYSFSX_writeU8(ofile, 0); //pad to even
@ -853,6 +855,7 @@ int write_pbm(PHYSFS_file *ofile,iff_bitmap_header *bitmap_header,int compressio
pbm_size = 4 + BMHD_SIZE + body_size + tiny_size + sizeof(pal_entry)*(1<<bitmap_header->nplanes)+8;
Assert(PHYSFSX_fseek(ofile,save_pos,SEEK_SET)==0);
(void)save_pos;
PHYSFS_writeSBE32(ofile, pbm_size+8);
Assert(PHYSFSX_fseek(ofile,pbm_size+8,SEEK_CUR)==0);
@ -917,7 +920,6 @@ int iff_read_animbrush(char *ifilename,grs_bitmap **bm_list,int max_bitmaps,int
{
int ret = IFF_NO_ERROR; //return code
PHYSFS_file *ifile;
iff_bitmap_header bmheader;
int sig,form_len;
long form_type;
@ -927,8 +929,6 @@ int iff_read_animbrush(char *ifilename,grs_bitmap **bm_list,int max_bitmaps,int
if (ifile == NULL)
return IFF_NO_FILE;
bmheader.raw_data = NULL;
sig=get_sig(ifile);
PHYSFS_readSBE32(ifile, &form_len);

View file

@ -585,17 +585,6 @@ void move_object_to_goal(object *objp, vms_vector *goal_point, int goal_seg)
Assert(objp->segnum != -1);
#ifndef NDEBUG
if (objp->segnum != goal_seg)
if (find_connect_side(&Segments[objp->segnum], &Segments[goal_seg]) == -1) {
fix dist;
dist = find_connected_distance(&objp->pos, objp->segnum, goal_point, goal_seg, 30, WID_FLY_FLAG);
if (Connected_segment_distance > 2) { // This global is set in find_connected_distance
// Int3();
}
}
#endif
aip->cur_path_index += aip->PATH_DIR;
if (aip->cur_path_index <= 0) {
@ -636,8 +625,6 @@ void ai_follow_path(object *objp, int player_visibility)
fix dist_to_goal;
// robot_info *robptr = &Robot_info[objp->id];
int forced_break, original_dir, original_index;
fix dist_to_player;
int goal_seg;
ai_local *ailp = &Ai_local_info[objp-Objects];
fix threshold_distance;
@ -675,43 +662,8 @@ if ((aip->hide_index + aip->path_length > Point_segs_free_ptr - Point_segs) && (
return;
goal_point = Point_segs[aip->hide_index + aip->cur_path_index].point;
goal_seg = Point_segs[aip->hide_index + aip->cur_path_index].segnum;
dist_to_goal = vm_vec_dist_quick(&goal_point, &objp->pos);
if (Player_is_dead)
dist_to_player = vm_vec_dist_quick(&objp->pos, &Viewer->pos);
else
dist_to_player = vm_vec_dist_quick(&objp->pos, &ConsoleObject->pos);
#if 0
// Efficiency hack: If far away from player, move in big quantized jumps.
if ((dist_to_player > F1_0*200) && !(Game_mode & GM_MULTI)) {
if (dist_to_goal < F1_0*2)
move_object_to_goal(objp, &goal_point, goal_seg);
else {
robot_info *robptr = &Robot_info[objp->id];
fix cur_speed = robptr->max_speed[Difficulty_level]/2;
fix distance_travellable = fixmul(FrameTime, cur_speed);
if (distance_travellable >= dist_to_goal)
move_object_to_goal(objp, &goal_point, goal_seg);
else {
fix prob = fixdiv(distance_travellable, dist_to_goal);
int rand_num = d_rand();
if ( (rand_num >> 1) < prob)
move_object_to_goal(objp, &goal_point, goal_seg);
}
}
// If we are hiding, we stop when we get to the goal.
if (ailp->mode == AIM_HIDE)
ailp->mode = AIM_STILL;
return;
}
#endif
// If running from player, only run until can't be seen.
if (ailp->mode == AIM_RUN_FROM_OBJECT) {
if ((player_visibility == 0) && (ailp->player_awareness_type == 0)) {
@ -1044,33 +996,26 @@ void ai_reset_all_paths(void)
// Try to resume path.
void attempt_to_resume_path(object *objp)
{
//int objnum = objp-Objects;
ai_static *aip = &objp->ctype.ai_info;
// int goal_segnum, object_segnum,
int abs_index, new_path_index;
ai_static *aip = &objp->ctype.ai_info;
int new_path_index;
if (aip->behavior == AIB_STATION)
if (d_rand() > 8192) {
ai_local *ailp = &Ai_local_info[objp-Objects];
ai_local *ailp = &Ai_local_info[objp-Objects];
aip->hide_segment = objp->segnum;
ailp->mode = AIM_STILL;
}
// object_segnum = objp->segnum;
abs_index = aip->hide_index+aip->cur_path_index;
// goal_segnum = Point_segs[abs_index].segnum;
new_path_index = aip->cur_path_index - aip->PATH_DIR;
if ((new_path_index >= 0) && (new_path_index < aip->path_length)) {
aip->cur_path_index = new_path_index;
} else {
// At end of line and have nowhere to go.
// At end of line and have nowhere to go.
move_towards_segment_center(objp);
create_path_to_station(objp, 15);
}
}
// ----------------------------------------------------------------------------------------------------------
@ -1265,6 +1210,7 @@ void player_follow_path(object *objp)
goal_point = Point_segs[Player_hide_index + Player_cur_path_index].point;
goal_seg = Point_segs[Player_hide_index + Player_cur_path_index].segnum;
Assert((goal_seg >= 0) && (goal_seg <= Highest_segment_index));
(void)goal_seg;
dist_to_goal = vm_vec_dist_quick(&goal_point, &objp->pos);
if (Player_cur_path_index < 0)

View file

@ -1182,8 +1182,6 @@ void bm_read_object(int skip)
int first_bitmap_num, first_bitmap_num_dead=0, n_normal_bitmaps;
char *equal_ptr;
short model_num;
short explosion_vclip_num = -1;
short explosion_sound_num = SOUND_ROBOT_DESTROYED;
fix lighting = F1_0/2; // Default
int type=-1;
fix strength=0;
@ -1212,14 +1210,9 @@ void bm_read_object(int skip)
type = OL_CLUTTER;
else if (!stricmp(equal_ptr,"exit"))
type = OL_EXIT;
}
else if (!stricmp( arg, "exp_vclip" )) {
explosion_vclip_num = atoi(equal_ptr);
} else if (!stricmp( arg, "dead_pof" )) {
model_name_dead = equal_ptr;
first_bitmap_num_dead=N_ObjBitmapPtrs;
} else if (!stricmp( arg, "exp_sound" )) {
explosion_sound_num = atoi(equal_ptr);
} else if (!stricmp( arg, "lighting" )) {
lighting = fl2f(atof(equal_ptr));
if ( (lighting < 0) || (lighting > F1_0 )) {

View file

@ -865,22 +865,13 @@ void dump_used_textures_level(PHYSFS_file *my_file, int level_num)
{
int i;
int temp_tmap_buf[MAX_TEXTURES];
int perm_tmap_buf[MAX_TEXTURES];
sbyte level_tmap_buf[MAX_TEXTURES];
int temp_wall_buf[MAX_WALL_ANIMS];
int perm_wall_buf[MAX_WALL_ANIMS];
for (i=0; i<MAX_TEXTURES; i++) {
perm_tmap_buf[i] = 0;
for (i=0; i<MAX_TEXTURES; i++)
level_tmap_buf[i] = -1;
}
for (i=0; i<MAX_WALL_ANIMS; i++) {
perm_wall_buf[i] = 0;
}
determine_used_textures_level(0, 1, level_num, temp_tmap_buf, temp_wall_buf, level_tmap_buf, MAX_TEXTURES);
// -- determine_used_textures_robots(temp_tmap_buf);
PHYSFSX_printf(my_file, "\nTextures used in [%s]\n", Gamesave_current_filename);
say_used_tmaps(my_file, temp_tmap_buf);
}

View file

@ -697,6 +697,7 @@ int find_vector_intersection(fvi_query *fq,fvi_info *hit_data)
//problems, try using zero radius and see if we hit a wall
new_hit_type = fvi_sub(&new_hit_pnt,&new_hit_seg2,fq->p0,fq->startseg,fq->p1,0,fq->thisobjnum,fq->ignore_obj_list,fq->flags,hit_data->seglist,&hit_data->n_segs,-2);
(void)new_hit_type; // FIXME! This should become hit_type, right?
if (new_hit_seg2 != -1) {
hit_seg = new_hit_seg2;

View file

@ -513,7 +513,7 @@ int load_mine_data_compiled(PHYSFS_file *LoadFile)
//=============================== Reading part ==============================
compiled_version = PHYSFSX_readByte(LoadFile);
//Assert( compiled_version==COMPILED_MINE_VERSION );
(void)compiled_version;
if (New_file_format_load)
Num_vertices = PHYSFSX_readShort(LoadFile);

View file

@ -762,6 +762,7 @@ int load_game_data(PHYSFS_file *LoadFile)
trig_size = PHYSFSX_readInt(LoadFile);
Assert(trig_size == sizeof(ControlCenterTriggers));
(void)trig_size;
PHYSFSX_fseek(LoadFile, 4, SEEK_CUR);
Num_robot_centers = PHYSFSX_readInt(LoadFile);
@ -1013,14 +1014,9 @@ int load_game_data(PHYSFS_file *LoadFile)
for (t=0; t<Num_triggers; t++) {
int l;
for (l=0; l<Triggers[t].num_links; l++) {
int seg_num, side_num, wall_num;
int seg_num;
seg_num = Triggers[t].seg[l];
side_num = Triggers[t].side[l];
wall_num = Segments[seg_num].sides[side_num].wall_num;
// -- if (Walls[wall_num].controlling_trigger != -1)
// -- Int3();
//check to see that if a trigger requires a wall that it has one,
//and if it requires a matcen that it has one
@ -1148,6 +1144,7 @@ int load_level(char * filename_passed)
gamedata_offset = PHYSFSX_readInt(LoadFile);
Assert(sig == MAKE_SIG('P','L','V','L'));
(void)sig;
if (Gamesave_current_version < 5)
hostagetext_offset = PHYSFSX_readInt(LoadFile);
@ -1185,6 +1182,7 @@ int load_level(char * filename_passed)
PHYSFSX_fseek(LoadFile,hostagetext_offset,SEEK_SET);
load_hostage_data(LoadFile,(version>=1));
#endif
(void)hostagetext_offset;
//======================== CLOSE FILE =============================

View file

@ -981,7 +981,7 @@ void hud_show_energy(void)
void show_bomb_count(int x,int y,int bg_color,int always_show,int right_align)
{
int bomb,count,countx,w=0,h=0,aw=0;
int bomb,count,w=0,h=0,aw=0;
char txt[5],*t;
if (!PlayerCfg.BombGauge)
@ -990,11 +990,7 @@ void show_bomb_count(int x,int y,int bg_color,int always_show,int right_align)
bomb = PROXIMITY_INDEX;
count = Players[Player_num].secondary_ammo[bomb];
// #ifndef RELEASE
count = min(count,99); //only have room for 2 digits - cheating give 200
// #endif
countx = (bomb==PROXIMITY_INDEX)?count:-count;
if (always_show && count == 0) //no bombs, draw nothing on HUD
return;

View file

@ -3468,12 +3468,10 @@ void newdemo_strip_frames(char *outname, int bytes_to_strip)
{
PHYSFS_file *outfile;
char *buf;
int total_size, bytes_done, read_elems, bytes_back;
int read_elems, bytes_back;
int trailer_start, loc1, loc2, stop_loc, bytes_to_read;
short last_frame_length;
bytes_done = 0;
total_size = PHYSFS_fileLength(infile);
outfile = PHYSFSX_openWriteBuffered(outname);
if (outfile == NULL) {
nm_messagebox( NULL, 1, TXT_OK, "Can't open output file" );

View file

@ -123,6 +123,7 @@ void nm_draw_background1(char * filename)
gr_init_bitmap_data (&nm_background1);
pcx_error = pcx_read_bitmap( filename, &nm_background1, BM_LINEAR, gr_palette );
Assert(pcx_error == PCX_ERROR_NONE);
(void)pcx_error;
}
gr_palette_load( gr_palette );
show_fullscr(&nm_background1);
@ -147,6 +148,7 @@ void nm_draw_background(int x1, int y1, int x2, int y2 )
gr_init_bitmap_data (&nm_background);
pcx_error = pcx_read_bitmap(MENU_BACKGROUND_BITMAP,&nm_background,BM_LINEAR,background_palette);
Assert(pcx_error == PCX_ERROR_NONE);
(void)pcx_error;
gr_remap_bitmap_good( &nm_background, background_palette, -1, -1 );
BGScaleX=((float)SWIDTH/nm_background.bm_w);
BGScaleY=((float)SHEIGHT/nm_background.bm_h);
@ -1386,7 +1388,7 @@ void newmenu_create_structure( newmenu *menu )
int newmenu_draw(window *wind, newmenu *menu)
{
grs_canvas *menu_canvas = window_get_canvas(wind), *save_canvas = grd_curcanv;
int tw, th = 0, ty, sx, sy;
int th = 0, ty, sx, sy;
int i;
int string_width, string_height, average_width;
@ -1412,7 +1414,6 @@ int newmenu_draw(window *wind, newmenu *menu)
gr_set_curfont(HUGE_FONT);
gr_set_fontcolor( BM_XRGB(31,31,31), -1 );
gr_get_string_size(menu->title,&string_width,&string_height,&average_width );
tw = string_width;
th = string_height;
gr_printf( 0x8000, ty, menu->title );
}
@ -1421,7 +1422,6 @@ int newmenu_draw(window *wind, newmenu *menu)
gr_set_curfont(MEDIUM3_FONT);
gr_set_fontcolor( BM_XRGB(21,21,21), -1 );
gr_get_string_size(menu->subtitle,&string_width,&string_height,&average_width );
tw = string_width;
gr_printf( 0x8000, ty+th, menu->subtitle );
}
@ -1545,7 +1545,6 @@ newmenu *newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item *
{
window *wind = NULL;
newmenu *menu;
grs_canvas *menu_canvas;
MALLOC(menu, newmenu, 1);
@ -1596,7 +1595,6 @@ newmenu *newmenu_do4( char * title, char * subtitle, int nitems, newmenu_item *
return NULL;
}
menu->wind = wind;
menu_canvas = window_get_canvas(wind);
return menu;
}

View file

@ -279,8 +279,7 @@ int properties_init()
DiskBitmapHeader bmh;
DiskSoundHeader sndh;
int header_size, N_bitmaps, N_sounds;
int i,size, length;
int read_sounds = 1;
int i,size;
int Pigdata_start;
int pigsize;
int retval;
@ -288,10 +287,6 @@ int properties_init()
hashtable_init( &AllBitmapsNames, MAX_BITMAP_FILES );
hashtable_init( &AllDigiSndNames, MAX_SOUND_FILES );
if (GameArg.SndNoSound)
{
read_sounds = 0;
}
for (i=0; i<MAX_SOUND_FILES; i++ ) {
#ifdef ALLEGRO
@ -393,7 +388,6 @@ int properties_init()
PHYSFSX_fseek( Piggy_fp, Pigdata_start, SEEK_SET );
size = PHYSFS_fileLength(Piggy_fp) - Pigdata_start;
length = size;
N_bitmaps = PHYSFSX_readInt(Piggy_fp);
size -= sizeof(int);
@ -616,7 +610,7 @@ void piggy_critical_error()
void piggy_bitmap_page_in( bitmap_index bitmap )
{
grs_bitmap * bmp;
int i,org_i,temp;
int i,org_i;
org_i = 0;
@ -669,7 +663,7 @@ void piggy_bitmap_page_in( bitmap_index bitmap )
memcpy( &Piggy_bitmap_cache_data[Piggy_bitmap_cache_next], &zsize, sizeof(int) );
Piggy_bitmap_cache_next += sizeof(int);
descent_critical_error = 0;
temp = PHYSFS_read( Piggy_fp, &Piggy_bitmap_cache_data[Piggy_bitmap_cache_next], 1, zsize-4 );
PHYSFS_read( Piggy_fp, &Piggy_bitmap_cache_data[Piggy_bitmap_cache_next], 1, zsize-4 );
if ( descent_critical_error ) {
piggy_critical_error();
goto ReDoIt;
@ -688,7 +682,7 @@ void piggy_bitmap_page_in( bitmap_index bitmap )
goto ReDoIt;
}
descent_critical_error = 0;
temp = PHYSFS_read( Piggy_fp, &Piggy_bitmap_cache_data[Piggy_bitmap_cache_next], 1, bmp->bm_h*bmp->bm_w );
PHYSFS_read( Piggy_fp, &Piggy_bitmap_cache_data[Piggy_bitmap_cache_next], 1, bmp->bm_h*bmp->bm_w );
if ( descent_critical_error ) {
piggy_critical_error();
goto ReDoIt;

View file

@ -101,8 +101,6 @@ int Render_only_bottom=0;
int Bottom_bitmap_num = 9;
#endif
fix Face_reflectivity = (F1_0/2);
#ifdef EDITOR
int _search_mode = 0; //true if looking for curseg,side,face
short _search_x,_search_y; //pixel we're looking at
@ -185,12 +183,10 @@ extern int Current_level_num;
// tmap1, tmap2 are texture map ids. tmap2 is the pasty one.
void render_face(int segnum, int sidenum, int nv, int *vp, int tmap1, int tmap2, uvl *uvlp, vms_vector *norm)
{
// fix face_light;
grs_bitmap *bm;
#ifdef OGL
grs_bitmap *bm2=NULL;
#endif
fix reflect;
g3s_uvl uvl_copy[8];
g3s_lrgb dyn_light[8];
int i;
@ -205,8 +201,6 @@ void render_face(int segnum, int sidenum, int nv, int *vp, int tmap1, int tmap2,
pointlist[i] = &Segment_points[vp[i]];
}
// face_light = -vm_vec_dot(&Viewer->orient.fvec,norm);
if (tmap1 >= NumTextures) {
Int3();
Segments[segnum].sides[sidenum].tmap_num = 0;
@ -236,54 +230,45 @@ void render_face(int segnum, int sidenum, int nv, int *vp, int tmap1, int tmap2,
Assert( !(bm->bm_flags & BM_FLAG_PAGED_OUT) );
//reflect = fl2f((1.0-TmapInfo[p->tmap_num].reflect)/2.0 + 0.5);
//reflect = fl2f((1.0-TmapInfo[p->tmap_num].reflect));
reflect = Face_reflectivity; // f1_0; //until we figure this stuff out...
//set light values for each vertex & build pointlist
for (i=0;i<nv;i++)
{
int i;
//the uvl struct has static light already in it
for (i=0;i<nv;i++)
//scale static light for destruction effect
if (Control_center_destroyed) //make lights flash
uvl_copy[i].l = fixmul(flash_scale,uvl_copy[i].l);
//add in dynamic light (from explosions, etc.)
uvl_copy[i].l += (Dynamic_light[vp[i]].r+Dynamic_light[vp[i]].g+Dynamic_light[vp[i]].b)/3;
//saturate at max value
if (uvl_copy[i].l > MAX_LIGHT)
uvl_copy[i].l = MAX_LIGHT;
// And now the same for the ACTUAL (rgb) light we want to use
//scale static light for destruction effect
if (Control_center_destroyed) //make lights flash
{
//the uvl struct has static light already in it
//scale static light for destruction effect
if (Control_center_destroyed) //make lights flash
uvl_copy[i].l = fixmul(flash_scale,uvl_copy[i].l);
//add in dynamic light (from explosions, etc.)
uvl_copy[i].l += (Dynamic_light[vp[i]].r+Dynamic_light[vp[i]].g+Dynamic_light[vp[i]].b)/3;
//saturate at max value
if (uvl_copy[i].l > MAX_LIGHT)
uvl_copy[i].l = MAX_LIGHT;
// And now the same for the ACTUAL (rgb) light we want to use
//scale static light for destruction effect
if (Control_center_destroyed) //make lights flash
if (PlayerCfg.DynLightColor) // let the mine glow red a little
{
if (PlayerCfg.DynLightColor) // let the mine glow red a little
{
dyn_light[i].r = fixmul(flash_scale>=f0_5*1.5?flash_scale:f0_5*1.5,uvl_copy[i].l);
dyn_light[i].g = dyn_light[i].b = fixmul(flash_scale,uvl_copy[i].l);
}
else
dyn_light[i].r = dyn_light[i].g = dyn_light[i].b = fixmul(flash_scale,uvl_copy[i].l);
dyn_light[i].r = fixmul(flash_scale>=f0_5*1.5?flash_scale:f0_5*1.5,uvl_copy[i].l);
dyn_light[i].g = dyn_light[i].b = fixmul(flash_scale,uvl_copy[i].l);
}
// add light color
dyn_light[i].r += Dynamic_light[vp[i]].r;
dyn_light[i].g += Dynamic_light[vp[i]].g;
dyn_light[i].b += Dynamic_light[vp[i]].b;
// saturate at max value
if (dyn_light[i].r > MAX_LIGHT)
dyn_light[i].r = MAX_LIGHT;
if (dyn_light[i].g > MAX_LIGHT)
dyn_light[i].g = MAX_LIGHT;
if (dyn_light[i].b > MAX_LIGHT)
dyn_light[i].b = MAX_LIGHT;
else
dyn_light[i].r = dyn_light[i].g = dyn_light[i].b = fixmul(flash_scale,uvl_copy[i].l);
}
// add light color
dyn_light[i].r += Dynamic_light[vp[i]].r;
dyn_light[i].g += Dynamic_light[vp[i]].g;
dyn_light[i].b += Dynamic_light[vp[i]].b;
// saturate at max value
if (dyn_light[i].r > MAX_LIGHT)
dyn_light[i].r = MAX_LIGHT;
if (dyn_light[i].g > MAX_LIGHT)
dyn_light[i].g = MAX_LIGHT;
if (dyn_light[i].b > MAX_LIGHT)
dyn_light[i].b = MAX_LIGHT;
}
@ -329,7 +314,7 @@ void check_face(int segnum, int sidenum, int facenum, int nv, int *vp, int tmap1
int save_lighting;
grs_bitmap *bm;
g3s_uvl uvl_copy[8];
g3s_lrgb dyn_light[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
g3s_lrgb dyn_light[8];
g3s_point *pointlist[4];
if (tmap2 > 0 )
@ -754,11 +739,8 @@ void outline_seg_side(segment *seg,int _side,int edge,int vert)
cc=rotate_list(8,seg->verts);
if (! cc.and) { //all off screen?
side *s;
g3s_point *pnt;
s=&seg->sides[_side];
//render curedge of curside of curseg in green
gr_setcolor(BM_XRGB(0,63,0));

View file

@ -546,6 +546,7 @@ int briefing_process_char(briefing *br)
char bitmap_name[32];
ubyte temp_palette[768];
int iff_error;
(void)iff_error;
if (br->robot_canv != NULL)
{
@ -670,12 +671,14 @@ void show_animated_bitmap(briefing *br)
{
grs_canvas *curcanv_save, *bitmap_canv=0;
grs_bitmap *bitmap_ptr;
#ifdef OGL
float scale = 1.0;
if (((float)SWIDTH/320) < ((float)SHEIGHT/200))
scale = ((float)SWIDTH/320);
else
scale = ((float)SHEIGHT/200);
#endif
// Only plot every nth frame.
if (br->door_div_count) {
@ -779,17 +782,20 @@ void show_animated_bitmap(briefing *br)
void show_briefing_bitmap(grs_bitmap *bmp)
{
grs_canvas *curcanv_save, *bitmap_canv;
#ifdef OGL
float scale = 1.0;
#endif
bitmap_canv = gr_create_sub_canvas(grd_curcanv, rescale_x(220), rescale_y(55), (bmp->bm_w*(SWIDTH/(HIRESMODE ? 640 : 320))),(bmp->bm_h*(SHEIGHT/(HIRESMODE ? 480 : 200))));
curcanv_save = grd_curcanv;
gr_set_current_canvas(bitmap_canv);
#ifdef OGL
if (((float)SWIDTH/(HIRESMODE ? 640 : 320)) < ((float)SHEIGHT/(HIRESMODE ? 480 : 200)))
scale = ((float)SWIDTH/(HIRESMODE ? 640 : 320));
else
scale = ((float)SHEIGHT/(HIRESMODE ? 480 : 200));
#ifdef OGL
ogl_ubitmapm_cs(0,0,bmp->bm_w*scale,bmp->bm_h*scale,bmp,255,F1_0);
#else
gr_bitmapm(0, 0, bmp);

View file

@ -646,14 +646,7 @@ void ntexture_map_lighted(grs_bitmap *srcb, g3ds_tmap *t)
// -------------------------------------------------------------------------------------
void ntmap_scanline_lighted_linear(grs_bitmap *srcb, int y, fix xleft, fix xright, fix uleft, fix uright, fix vleft, fix vright, fix lleft, fix lright)
{
fix u,v,l;
fix dx,recip_dx;
fix du_dx,dv_dx,dl_dx;
u = uleft;
v = vleft;
l = lleft;
fix dx,recip_dx,du_dx,dv_dx,dl_dx;
dx = f2i(xright) - f2i(xleft);
if ((dx < 0) || (xright < 0) || (xleft > xright)) // the (xleft > xright) term is not redundant with (dx < 0) because dx is computed using integers

View file

@ -975,7 +975,7 @@ void c_tmap_scanline_quad()
fix u,v,l,dudx, dvdx, dldx;
// Quadratic setup stuff:
fix a0, a1, a2, b0, b1, b2, dudx1, dvdx1;
fix a1, a2, b1, b2, dudx1, dvdx1;
fix u0 = fx_u;
fix u2 = fx_u + fx_du_dx*(fx_xright-fx_xleft+1); // This just needs to be uright from outer loop
fix v0 = fx_v;
@ -989,8 +989,6 @@ void c_tmap_scanline_quad()
v0 = fixdiv( v0, w0 ); // Divide Z out. This should be in outer loop
u2 = fixdiv( u2, w2 ); // Divide Z out. This should be in outer loop
v2 = fixdiv( v2, w2 ); // Divide Z out. This should be in outer loop
a0 = u0;
b0 = v0;
a1 = (-3*u0+4*u1-u2)/dx;
b1 = (-3*v0+4*v1-v2)/dx;
a2 = (2*(u0-2*u1+u2))/(dx*dx);

View file

@ -129,7 +129,6 @@ UI_GADGET_BUTTON * ui_add_gadget_button( UI_DIALOG * dlg, short x, short y, shor
void ui_button_do( UI_GADGET_BUTTON * button, int keypress )
{
int result;
int OnMe, ButtonLastSelected;
OnMe = ui_mouse_on_gadget( (UI_GADGET *)button );
@ -162,7 +161,7 @@ void ui_button_do( UI_GADGET_BUTTON * button, int keypress )
if ((keypress == button->hotkey1) && button->user_function1 )
{
result = button->user_function1();
button->user_function1();
last_keypress = 0;
}
@ -190,11 +189,6 @@ void ui_button_do( UI_GADGET_BUTTON * button, int keypress )
if (button->pressed && button->user_function )
{
result = button->user_function();
button->user_function();
}
}

View file

@ -83,15 +83,13 @@ void ui_draw_inputbox( UI_GADGET_INPUTBOX * inputbox )
UI_GADGET_INPUTBOX * ui_add_gadget_inputbox( UI_DIALOG * dlg, short x, short y, short length, short slength, char * text )
{
int h, w, aw, f;
int h, w, aw;
UI_GADGET_INPUTBOX * inputbox;
gr_get_string_size( NULL, &w, &h, &aw );
inputbox = (UI_GADGET_INPUTBOX *)ui_gadget_add( dlg, 6, x, y, x+aw*slength-1, y+h-1+4 );
f = 0;
inputbox->text = d_malloc(length + 1);
strncpy( inputbox->text, text, length );
inputbox->position = strlen(inputbox->text);

View file

@ -273,14 +273,13 @@ void ui_pad_goto_next()
void ui_pad_goto_prev()
{
int i, si;
int i;
if (active_pad == -1 )
active_pad = MAX_NUM_PADS;
i = active_pad - 1;
if (i<0) i= MAX_NUM_PADS - 1;
si = i;
while( KeyPad[i]==NULL )
{

View file

@ -37,10 +37,8 @@ UI_GADGET_KEYTRAP * ui_add_gadget_keytrap( UI_DIALOG * dlg, int key_to_trap, int
void ui_keytrap_do( UI_GADGET_KEYTRAP * keytrap, int keypress )
{
int result;
if ( keypress == keytrap->trap_key )
{
result = keytrap->user_function();
keytrap->user_function();
}
}

View file

@ -34,7 +34,6 @@ int PopupMenu( int NumButtons, char * text[] )
UI_DIALOG * dlg;
UI_GADGET_BUTTON * ButtonG[10];
short SavedMouseX, SavedMouseY;
char * Button[10];
int button_width, button_height, width, height;
@ -60,8 +59,6 @@ int PopupMenu( int NumButtons, char * text[] )
return -1;
}
SavedMouseX = Mouse.x; SavedMouseY = Mouse.y;
button_width = button_height = 0;
gr_set_current_canvas( &grd_curscreen->sc_canvas );

View file

@ -27,13 +27,10 @@ static char rcsid[] = "$Id: scroll.c,v 1.1.1.1 2006/03/17 19:52:16 zicodxx Exp $
void ui_draw_scrollbar( UI_GADGET_SCROLLBAR * scrollbar )
{
int x, y;
if (scrollbar->status==0)
return;
scrollbar->status = 0;
x = y = 0;
ui_mouse_hide();
gr_set_current_canvas( scrollbar->canvas );