diff --git a/2d/palette.c b/2d/palette.c index 103dd58d9..5f0abf6c0 100644 --- a/2d/palette.c +++ b/2d/palette.c @@ -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); diff --git a/CHANGELOG.txt b/CHANGELOG.txt index e2c860db7..7423566ab 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 90acb3db6..7e07e635d 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -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. diff --git a/editor/eobject.c b/editor/eobject.c index 569fc5943..07624614c 100644 --- a/editor/eobject.c +++ b/editor/eobject.c @@ -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); diff --git a/editor/group.c b/editor/group.c index af0a62eeb..5d3f3aecf 100644 --- a/editor/group.c +++ b/editor/group.c @@ -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; vsides[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); } diff --git a/editor/medrobot.c b/editor/medrobot.c index 72d70671a..186b99aa7 100644 --- a/editor/medrobot.c +++ b/editor/medrobot.c @@ -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; } diff --git a/editor/mine.c b/editor/mine.c index a201f8880..6ba7ea8f9 100644 --- a/editor/mine.c +++ b/editor/mine.c @@ -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) diff --git a/editor/segment.c b/editor/segment.c index daafadd8b..4965b51d1 100644 --- a/editor/segment.c +++ b/editor/segment.c @@ -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; schildren[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++) { diff --git a/iff/iff.c b/iff/iff.c index 3ea1b37d9..6c9cd699b 100644 --- a/iff/iff.c +++ b/iff/iff.c @@ -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<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); diff --git a/main/aipath.c b/main/aipath.c index 92fe91c59..00572223d 100644 --- a/main/aipath.c +++ b/main/aipath.c @@ -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) diff --git a/main/bmread.c b/main/bmread.c index b81c76927..ca8038349 100644 --- a/main/bmread.c +++ b/main/bmread.c @@ -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 )) { diff --git a/main/dumpmine.c b/main/dumpmine.c index 96ca6bb99..39e55074a 100644 --- a/main/dumpmine.c +++ b/main/dumpmine.c @@ -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; ip0,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; diff --git a/main/gamemine.c b/main/gamemine.c index cde4b3630..92e62b843 100644 --- a/main/gamemine.c +++ b/main/gamemine.c @@ -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); diff --git a/main/gamesave.c b/main/gamesave.c index ba3615d32..42b5c0234 100644 --- a/main/gamesave.c +++ b/main/gamesave.c @@ -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=1)); #endif + (void)hostagetext_offset; //======================== CLOSE FILE ============================= diff --git a/main/gauges.c b/main/gauges.c index 1f85ae79a..04e425ac6 100644 --- a/main/gauges.c +++ b/main/gauges.c @@ -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; diff --git a/main/newdemo.c b/main/newdemo.c index 954e7eb5f..030961f6b 100644 --- a/main/newdemo.c +++ b/main/newdemo.c @@ -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" ); diff --git a/main/newmenu.c b/main/newmenu.c index 59dcb0e39..2bfee2183 100644 --- a/main/newmenu.c +++ b/main/newmenu.c @@ -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; } diff --git a/main/piggy.c b/main/piggy.c index 4e062acf1..2ab7dbec5 100644 --- a/main/piggy.c +++ b/main/piggy.c @@ -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; ibm_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; diff --git a/main/render.c b/main/render.c index a0ca7b47e..b0ab9823f 100644 --- a/main/render.c +++ b/main/render.c @@ -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 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)); diff --git a/main/titles.c b/main/titles.c index 9c00177f6..3eff0adfd 100644 --- a/main/titles.c +++ b/main/titles.c @@ -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); diff --git a/texmap/ntmap.c b/texmap/ntmap.c index 4f5576b56..d753ff828 100644 --- a/texmap/ntmap.c +++ b/texmap/ntmap.c @@ -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 diff --git a/texmap/scanline.c b/texmap/scanline.c index e1c1f1d91..0d889a210 100644 --- a/texmap/scanline.c +++ b/texmap/scanline.c @@ -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); diff --git a/ui/button.c b/ui/button.c index cb75dd8c7..e2c7cd063 100644 --- a/ui/button.c +++ b/ui/button.c @@ -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(); } } - - - - - diff --git a/ui/inputbox.c b/ui/inputbox.c index 8bf705637..46882ef79 100644 --- a/ui/inputbox.c +++ b/ui/inputbox.c @@ -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); diff --git a/ui/keypad.c b/ui/keypad.c index 169a05566..f28e86d9e 100644 --- a/ui/keypad.c +++ b/ui/keypad.c @@ -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 ) { diff --git a/ui/keytrap.c b/ui/keytrap.c index 43f394c53..d96d55c86 100644 --- a/ui/keytrap.c +++ b/ui/keytrap.c @@ -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(); } } diff --git a/ui/popup.c b/ui/popup.c index dd733ba48..5b3d39015 100644 --- a/ui/popup.c +++ b/ui/popup.c @@ -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 ); diff --git a/ui/scroll.c b/ui/scroll.c index eab39960f..63a9b6e53 100644 --- a/ui/scroll.c +++ b/ui/scroll.c @@ -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 );