From 3fa8514d1e1fb2e2a009aa3bb8ea3be92c6a84c4 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Fri, 17 Oct 2014 01:30:08 -0400 Subject: [PATCH] silence various GCC warnings --- src/inetfile/cftp.cpp | 4 +- src/inetfile/chttpget.cpp | 2 +- src/menuui/optionsmenumulti.cpp | 2 +- src/menuui/readyroom.cpp | 9 +-- src/mission/missiongoals.cpp | 4 +- src/missionui/missionshipchoice.cpp | 2 - src/network/multi_campaign.cpp | 4 +- src/network/multi_endgame.cpp | 4 +- src/network/multi_ingame.cpp | 3 - src/network/multi_obj.cpp | 6 -- src/network/multi_ping.cpp | 5 +- src/network/multi_voice.cpp | 5 +- src/network/multimsgs.cpp | 10 +-- src/network/multiutil.cpp | 16 ++-- src/network/psnet2.cpp | 32 ++++---- src/object/collideshipship.cpp | 12 +-- src/parse/sexp.cpp | 6 +- src/ship/afterburner.cpp | 4 +- src/ship/aibig.cpp | 11 +-- src/ship/aicode.cpp | 113 +++++++++------------------- src/ship/aigoals.cpp | 7 +- src/ship/ship.cpp | 26 ++----- src/ship/shipfx.cpp | 7 +- src/starfield/nebula.cpp | 4 +- src/tgautils/tgautils.cpp | 2 + src/ui/listbox.cpp | 4 +- src/ui/scroll.cpp | 3 +- src/ui/slider2.cpp | 7 +- src/weapon/beam.cpp | 53 ++----------- src/weapon/corkscrew.cpp | 2 - src/weapon/shockwave.cpp | 6 +- src/weapon/weapons.cpp | 14 ++-- 32 files changed, 117 insertions(+), 272 deletions(-) diff --git a/src/inetfile/cftp.cpp b/src/inetfile/cftp.cpp index 251c2d7..30b7442 100644 --- a/src/inetfile/cftp.cpp +++ b/src/inetfile/cftp.cpp @@ -233,9 +233,9 @@ CFtpGet::CFtpGet(char *URL,char *localfile,char *Username,char *Password) } else { - int len = min((filestart-dirstart)+1, sizeof(m_szDir)); + int len = min((filestart-dirstart)+1, (int)sizeof(m_szDir)); SDL_strlcpy(m_szDir, dirstart, len); - len = min((dirstart-pURL), sizeof(m_szHost)); + len = min((dirstart-pURL), (int)sizeof(m_szHost)); SDL_strlcpy(m_szHost, pURL, len); } //At this point we should have a nice host,dir and filename diff --git a/src/inetfile/chttpget.cpp b/src/inetfile/chttpget.cpp index 7e6f369..6ce2fcf 100644 --- a/src/inetfile/chttpget.cpp +++ b/src/inetfile/chttpget.cpp @@ -258,7 +258,7 @@ void ChttpGet::GetFile(char *URL,char *localfile) else { SDL_strlcpy(m_szDir, dirstart, sizeof(m_szDir));//,(filestart-dirstart)); - int len = min((dirstart-pURL), sizeof(m_szHost)); + int len = min((dirstart-pURL), (int)sizeof(m_szHost)); SDL_strlcpy(m_szHost, pURL, len); } diff --git a/src/menuui/optionsmenumulti.cpp b/src/menuui/optionsmenumulti.cpp index 1e680d9..bdba251 100644 --- a/src/menuui/optionsmenumulti.cpp +++ b/src/menuui/optionsmenumulti.cpp @@ -971,7 +971,7 @@ void options_multi_notify_process() y_start = OM_NOTIFY_Y; gr_set_color_fast(&Color_bright); for(idx=0;idxwingnum]; for ( j = 0; j < ss_wing->num_slots; j++ ) { // get the slot pointer ss_slot = &ss_wing->ss_slots[j]; diff --git a/src/network/multi_campaign.cpp b/src/network/multi_campaign.cpp index dcfeed8..edfb27e 100644 --- a/src/network/multi_campaign.cpp +++ b/src/network/multi_campaign.cpp @@ -217,7 +217,7 @@ int Multi_campaign_accept_flags[MAX_PLAYERS]; // load a new campaign file or notify the standalone if we're not the server void multi_campaign_start(char *filename) { - int max_players; +// int max_players; char str[255]; // set the netgame mode @@ -251,7 +251,7 @@ void multi_campaign_start(char *filename) } // maybe override the Netgame.respawn setting - max_players = mission_parse_get_multi_mission_info( Netgame.mission_name ); + // max_players = mission_parse_get_multi_mission_info( Netgame.mission_name ); Netgame.respawn = The_mission.num_respawns; nprintf(("Network","MULTI CAMPAIGN : overriding respawn setting with mission max %d\n",The_mission.num_respawns)); diff --git a/src/network/multi_endgame.cpp b/src/network/multi_endgame.cpp index 97592cc..b64d04a 100644 --- a/src/network/multi_endgame.cpp +++ b/src/network/multi_endgame.cpp @@ -698,7 +698,7 @@ void multi_endgame_popup(int notify_code,int error_code,int wsa_error) // called when server is waiting for clients to disconnect int multi_endgame_server_ok_to_leave() { - int idx,clients_gone; + int idx; // check to see if our client disconnect timestamp has elapsed if ( Multi_endgame_server_wait_stamp > 0.0f ) { @@ -709,10 +709,8 @@ int multi_endgame_server_ok_to_leave() } // check to see if all clients have disconnected - clients_gone = 1; for(idx=0;idxinstance].ship_info_index]; // blit the ship name itself gr_set_color_fast(&Color_normal); diff --git a/src/network/multi_obj.cpp b/src/network/multi_obj.cpp index 040235a..426a733 100644 --- a/src/network/multi_obj.cpp +++ b/src/network/multi_obj.cpp @@ -1082,7 +1082,6 @@ int multi_oo_maybe_update(net_player *pl, object *obj, ubyte *data) float eye_dot, dist; int in_cone; int range; - int ship_index; ship *shipp; ship_info *sip; ushort cur_pos_chksum = 0; @@ -1097,7 +1096,6 @@ int multi_oo_maybe_update(net_player *pl, object *obj, ubyte *data) // determine what the timestamp is for this object if(obj->type == OBJ_SHIP){ stamp = Ships[obj->instance].np_updates[NET_PLAYER_NUM(pl)].update_stamp; - ship_index = &Ships[obj->instance] - Ships; } else { return 0; } @@ -1235,16 +1233,12 @@ void multi_oo_process_all(net_player *pl) int idx; object *moveup; - object *pobj; // if the player has an invalid objnum.. if(pl->player->objnum < 0){ return; } - // get the player's object - pobj = &Objects[pl->player->objnum]; - object *targ_obj; // build the list of ships to check against diff --git a/src/network/multi_ping.cpp b/src/network/multi_ping.cpp index dcbf590..fce3936 100644 --- a/src/network/multi_ping.cpp +++ b/src/network/multi_ping.cpp @@ -172,7 +172,7 @@ void multi_ping_send_all() // get the lowest existing ping in the ping struct, returning -1 if no pings int multi_ping_get_lowest(ping_struct *ps) { - int idx, lowest_index; + int idx; float lowest; // if there are no recorded pings, return -1 @@ -184,9 +184,8 @@ int multi_ping_get_lowest(ping_struct *ps) lowest = -1.0f; for(idx=0;idxnum_pings;idx++){ // if we found a lower value - if((lowest == -1) || (ps->ping_times[idx] < lowest)){ + if((lowest == -1.0f) || (ps->ping_times[idx] < lowest)){ lowest = ps->ping_times[idx]; - lowest_index = idx; } } diff --git a/src/network/multi_voice.cpp b/src/network/multi_voice.cpp index f61112c..e03110a 100644 --- a/src/network/multi_voice.cpp +++ b/src/network/multi_voice.cpp @@ -1221,7 +1221,7 @@ void multi_voice_set_vars(int qos,int duration) // process a request for the token void multi_voice_process_token_request(int player_index) { - int stream_index,idx; + int idx; // if we're not doing voice on this server, return now if(Netgame.options.flags & MSO_FLAG_NO_VOICE){ @@ -1240,7 +1240,6 @@ void multi_voice_process_token_request(int player_index) } // attempt to find a free token token - stream_index = -1; for(idx=0;idx= (MULTI_VOICE_ACCUM_BUFFER_COUNT - 1)){ diff --git a/src/network/multimsgs.cpp b/src/network/multimsgs.cpp index ee8ead8..440616b 100644 --- a/src/network/multimsgs.cpp +++ b/src/network/multimsgs.cpp @@ -2193,7 +2193,7 @@ void send_netgame_update_packet(net_player *pl) // process information about the netgame sent from the server/host void process_netgame_update_packet( ubyte *data, header *hinfo ) { - int offset,old_flags; + int offset;//,old_flags; int ng_state; SDL_assert(!(Game_mode & GM_STANDALONE_SERVER)); @@ -2211,7 +2211,7 @@ void process_netgame_update_packet( ubyte *data, header *hinfo ) GET_UINT(Netgame.respawn); // be sure not to blast the quitting flag because of the "one frame extra" problem - old_flags = Netgame.flags; +// old_flags = Netgame.flags; GET_INT(Netgame.flags); GET_INT(Netgame.type_flags); GET_INT(Netgame.version_info); @@ -3847,7 +3847,7 @@ void process_ingame_nak(ubyte *data, header *hinfo) switch(state){ case ACK_FILE_ACCEPTED : - SDL_assert(Net_player->flags & NETINFO_FLAG_INGAME_JOIN); + SDL_assert(pl->flags & NETINFO_FLAG_INGAME_JOIN); nprintf(("Network","Mission file rejected by server, aborting...\n")); multi_quit_game(PROMPT_NONE, MULTI_END_NOTIFY_FILE_REJECTED); break; @@ -7449,7 +7449,7 @@ void process_NEW_primary_fired_packet(ubyte *data, header *hinfo) int offset; // linked; // ubyte banks_fired, current_bank; object* objp; - ship *shipp; +// ship *shipp; ushort shooter_sig; // read all packet info @@ -7471,7 +7471,7 @@ void process_NEW_primary_fired_packet(ubyte *data, header *hinfo) if(objp->instance < 0){ return; } - shipp = &Ships[objp->instance]; +// shipp = &Ships[objp->instance]; // get the link status of the primary banks // linked = 0; diff --git a/src/network/multiutil.cpp b/src/network/multiutil.cpp index 0489ee9..2d1f8a8 100644 --- a/src/network/multiutil.cpp +++ b/src/network/multiutil.cpp @@ -2464,8 +2464,6 @@ void multi_handle_state_special() void multi_file_xfer_notify(int handle) { char *filename; - int len,idx; - int force_dir; int cf_type; int is_mission = 0; @@ -2473,19 +2471,13 @@ void multi_file_xfer_notify(int handle) filename = NULL; filename = multi_xfer_get_filename(handle); - // get the directory the file is forced into - force_dir = multi_xfer_get_force_dir(handle); - // something is messed up if(filename == NULL){ return; } // convert the filename to all lowercase - len = strlen(filename); - for(idx=0;idxnet_id, 4); ipx_addr.sa_socket = htons(port); addr = (SOCKADDR *)&ipx_addr; - name_length = sizeof(ipx_addr); if( SOCKET_ERROR == SENDTO(Unreliable_socket, (char *)&conn_header,RELIABLE_PACKET_HEADER_ONLY_SIZE,0,addr,sizeof(SOCKADDR), PSNET_TYPE_RELIABLE) ){ ml_printf("Unable to send IPX packet in nw_ConnectToServer()! -- %d\n",WSAGetLastError()); return; @@ -2015,7 +2010,6 @@ void psnet_rel_connect_to_server(PSNET_SOCKET *socket, net_addr_t *server_addr) memcpy(&sockaddr.sin_addr.s_addr, iaddr, 4); sockaddr.sin_port = htons(port); addr = (SOCKADDR *)&sockaddr; - name_length = sizeof(sockaddr); if( SOCKET_ERROR == SENDTO(Unreliable_socket, (char *)&conn_header,RELIABLE_PACKET_HEADER_ONLY_SIZE,0,addr,sizeof(SOCKADDR), PSNET_TYPE_RELIABLE) ){ ml_printf("Unable to send UDP packet in nw_ConnectToServer()! -- %d\n",WSAGetLastError()); return; @@ -2034,7 +2028,7 @@ void psnet_rel_connect_to_server(PSNET_SOCKET *socket, net_addr_t *server_addr) first_sent_req = psnet_get_time(); - time_sent_req = psnet_get_time(); +// time_sent_req = psnet_get_time(); //Wait until we get a response from the server or we timeout @@ -2634,7 +2628,7 @@ void psnet_ras_status() // set some options on a socket void psnet_socket_options( SOCKET sock ) { - int broadcast, ret; + int broadcast;//, ret; #ifndef PLAT_UNIX int cursize, cursizesize, bufsize; #else @@ -2660,14 +2654,14 @@ void psnet_socket_options( SOCKET sock ) cursizesize = sizeof(int); getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&cursize, &cursizesize); // for ( trysize = bufsize; trysize >= cursize; trysize >>= 1 ) { - ret = setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize)); - if ( ret == SOCKET_ERROR ) { + /*ret =*/ setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize)); + /*if ( ret == SOCKET_ERROR ) { int wserr; wserr = WSAGetLastError(); // if ( (wserr == WSAENOPROTOOPT) || (wserr == WSAEINVAL) ) // break; - } + }*/ // } getsockopt(sock, SOL_SOCKET, SO_RCVBUF, (char *)&cursize, &cursizesize); ml_printf("Receive buffer set to %d\n", cursize); @@ -2676,15 +2670,15 @@ void psnet_socket_options( SOCKET sock ) cursizesize = sizeof(int); getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&cursize, &cursizesize); // for ( trysize = bufsize; trysize >= cursize; trysize >>= 1 ) { - ret = setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&bufsize, sizeof(bufsize)); - if ( ret == SOCKET_ERROR ) { + /*ret =*/ setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&bufsize, sizeof(bufsize)); + /*if ( ret == SOCKET_ERROR ) { int wserr; wserr = WSAGetLastError(); // if ( (wserr == WSAENOPROTOOPT) || (wserr == WSAEINVAL) ){ // break; // } - } + }*/ getsockopt(sock, SOL_SOCKET, SO_SNDBUF, (char *)&cursize, &cursizesize); ml_printf("Send buffer set to %d\n", cursize); } diff --git a/src/object/collideshipship.cpp b/src/object/collideshipship.cpp index 751de45..ecf8b80 100644 --- a/src/object/collideshipship.cpp +++ b/src/object/collideshipship.cpp @@ -1470,7 +1470,7 @@ void collide_ship_ship_do_sound(vector *world_hit_pos, object *A, object *B, int { vector rel_vel; float rel_speed; - int light_collision=0; +// int light_collision=0; vm_vec_sub(&rel_vel, &A->phys_info.desired_vel, &B->phys_info.desired_vel); rel_speed = vm_vec_mag_quick(&rel_vel); @@ -1478,7 +1478,7 @@ void collide_ship_ship_do_sound(vector *world_hit_pos, object *A, object *B, int if ( rel_speed > MIN_REL_SPEED_FOR_LOUD_COLLISION ) { snd_play_3d( &Snds[SND_SHIP_SHIP_HEAVY], world_hit_pos, &View_position ); } else { - light_collision=1; + // light_collision=1; if ( player_involved ) { if ( !snd_is_playing(Player_collide_sound) ) { Player_collide_sound = snd_play_3d( &Snds[SND_SHIP_SHIP_LIGHT], world_hit_pos, &View_position ); @@ -1492,10 +1492,10 @@ void collide_ship_ship_do_sound(vector *world_hit_pos, object *A, object *B, int // maybe play a "shield" collision sound overlay if appropriate if ( (get_shield_strength(A) > 5) || (get_shield_strength(B) > 5) ) { - float vol_scale=1.0f; - if ( light_collision ) { - vol_scale=0.7f; - } + // float vol_scale=1.0f; + // if ( light_collision ) { + // vol_scale=0.7f; + // } if ( player_involved ) { if ( !snd_is_playing(Player_collide_sound) ) { diff --git a/src/parse/sexp.cpp b/src/parse/sexp.cpp index 52332a6..405d80b 100644 --- a/src/parse/sexp.cpp +++ b/src/parse/sexp.cpp @@ -5040,11 +5040,11 @@ void sexp_cap_waypont_speed(int n) void sexp_jettison_cargo( int n ) { char *shipname; - int jettison_delay, ship_index; + int ship_index;//, jettison_delay; // get some data shipname = CTEXT(n); - jettison_delay = atoi(CTEXT(CDR(n))); +// jettison_delay = atoi(CTEXT(CDR(n))); // lookup the ship ship_index = ship_name_lookup(shipname); @@ -6641,7 +6641,6 @@ void sexp_add_remove_escort(int node) { int sindex; int flag; - char *whee; // get the firing ship sindex = ship_name_lookup(CTEXT(node)); @@ -6653,7 +6652,6 @@ void sexp_add_remove_escort(int node) } // determine whether to add or remove it - whee = CTEXT(CDR(node)); flag = atoi(CTEXT(CDR(node))); // add/remove diff --git a/src/ship/afterburner.cpp b/src/ship/afterburner.cpp index 7306e72..069ef6a 100644 --- a/src/ship/afterburner.cpp +++ b/src/ship/afterburner.cpp @@ -425,8 +425,8 @@ void afterburners_stop(object *objp, int key_released) } objp->phys_info.flags &= ~PF_AFTERBURNER_ON; - float percent_left; - percent_left = shipp->afterburner_fuel / sip->afterburner_fuel_capacity; +// float percent_left; +// percent_left = shipp->afterburner_fuel / sip->afterburner_fuel_capacity; if ( objp == Player_obj ) { diff --git a/src/ship/aibig.cpp b/src/ship/aibig.cpp index c7302ed..74ec968 100644 --- a/src/ship/aibig.cpp +++ b/src/ship/aibig.cpp @@ -1025,6 +1025,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector * if (dist_to_enemy < wip->max_speed * wip->lifetime) ai_fire_primary_weapon(Pl_objp); + /* int priority1, priority2; priority1 = -1; @@ -1035,6 +1036,7 @@ void ai_big_maybe_fire_weapons(float dist_to_enemy, float dot_to_enemy, vector * if (Ship_info[Ships[En_objp->instance].ship_info_index].flags & (SIF_BIG_SHIP | SIF_HUGE_SHIP)) if (En_objp->phys_info.speed * dist_to_enemy < 5000.0f) // Don't select a bomb if enemy moving fast relative to distance priority1 = WIF_BOMB; + */ if (!(En_objp->flags & OF_PROTECTED)) { //ai_select_secondary_weapon(Pl_objp, tswp, priority1, priority2); // Note, need to select to get weapon speed and lifetime @@ -1108,15 +1110,12 @@ void ai_big_chase() ship_info *sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index]; ship *shipp = &Ships[Pl_objp->instance]; ai_info *aip = &Ai_info[shipp->ai_index]; - int enemy_ship_type; vector predicted_enemy_pos; SDL_assert(aip->mode == AIM_CHASE); maybe_cheat_fire_synaptic(Pl_objp, aip); - enemy_ship_type = Ship_info[Ships[En_objp->instance].ship_info_index].flags; - ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos); player_pos = Pl_objp->pos; @@ -1495,10 +1494,9 @@ int ai_big_strafe_maybe_retreat(float dist, vector *target_pos) aip->submode = AIS_STRAFE_RETREAT1; aip->submode_start_time = Missiontime; - float box_dist; int is_inside; vector goal_point; - box_dist = get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST); + get_world_closest_box_point_with_delta(&goal_point, En_objp, &Pl_objp->pos, &is_inside, STRAFE_RETREAT_BOX_DIST); // set goal point aip->goal_point = goal_point; @@ -1522,7 +1520,6 @@ void ai_big_strafe_attack() vector target_pos; vector rand_vec; float target_dist, target_dot, accel, t; - object *target_objp; aip = &Ai_info[Ships[Pl_objp->instance].ai_index]; @@ -1534,8 +1531,6 @@ void ai_big_strafe_attack() if ( ai_big_strafe_maybe_retreat(target_dist, &target_pos) ) return; - target_objp = &Objects[aip->target_objnum]; - if (aip->ai_flags & AIF_KAMIKAZE) { if (target_dist < 1200.0f) { //nprintf(("AI", "Kamikaze: %7.3f %7.3f\n", target_dot, target_dist)); diff --git a/src/ship/aicode.cpp b/src/ship/aicode.cpp index 1de992c..5affdff 100644 --- a/src/ship/aicode.cpp +++ b/src/ship/aicode.cpp @@ -1303,7 +1303,7 @@ float compute_dots(object *objp, object *other_objp, float *to_dot, float *from_ // need to infer its position either by weapon fire pos or last know pos void update_ai_stealth_info_with_error(ai_info *aip/*, int no_error*/) { - object *ship; +// object *ship; object *stealth_objp; /* float error_time_mult, error_dist_mult, error_dot_mult, error_mult; @@ -1318,7 +1318,7 @@ void update_ai_stealth_info_with_error(ai_info *aip/*, int no_error*/) stealth_objp = &Objects[aip->target_objnum]; // my_ship - ship = &Objects[Ships[aip->shipnum].objnum]; +// ship = &Objects[Ships[aip->shipnum].objnum]; // if update is due to weapon fire, get exact stealth position // if (no_error) { @@ -2471,14 +2471,11 @@ int find_nearby_hostile(int objnum, int enemy_team_mask, float range, int *count int nearest_objnum; float nearest_dist; object *objp; - ai_info *aip; ship_obj *so; nearest_objnum = -1; nearest_dist = range; - aip = &Ai_info[Ships[Objects[objnum].instance].ai_index]; - *count = 0; for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { @@ -3031,8 +3028,8 @@ int find_turret_enemy(ship_subsys *turret_subsys, int objnum, vector *tpos, vect if ( (turret_subsys->weapons.flags & SW_FLAG_TAGGED_ONLY) && ship_is_tagged(&Objects[aip->target_objnum]) ) { // select new target if aip->target_objnum is out of field of view vector v2e; - float dot, dist; - dist = vm_vec_normalized_dir(&v2e, &Objects[aip->target_objnum].pos, tpos); + float dot;//, dist; + /*dist =*/ vm_vec_normalized_dir(&v2e, &Objects[aip->target_objnum].pos, tpos); dot = vm_vec_dot(&v2e, tvec); // MODIFY FOR ATTACKING BIG SHIP // dot += (0.5f * Objects[aip->target_objnum].radius / dist); @@ -3781,13 +3778,13 @@ void ai_dock_with_object(object *docker, object *dockee, int priority, int dock_ aip = &Ai_info[Ships[docker->instance].ai_index]; if ((aip->ai_flags & AIF_DOCKED) && (dock_type == AIDO_DOCK)) { - object *dockee2; - int docker_index2, dockee_index2; + // object *dockee2; + // int docker_index2, dockee_index2; SDL_assert(aip->dock_objnum > -1); - dockee2 = &Objects[aip->dock_objnum]; - docker_index2 = aip->dock_index; - dockee_index2 = aip->dockee_index; + // dockee2 = &Objects[aip->dock_objnum]; + // docker_index2 = aip->dock_index; + // dockee_index2 = aip->dockee_index; // MWA -- 2/9/98. use the goal code to undock the ships since goals might need to get removed // and that code will do it properly. I'd actually be surprised if we got into this code anymore // since the outer layer goal code should deal with this issue....but who knows... @@ -4141,11 +4138,9 @@ int find_nearest_waypoint(object *objp) int i; float dist, min_dist, dot; int min_ind; - ship *shipp; int wp_listnum; waypoint_list *wpl; - shipp = &Ships[objp->instance]; wp_listnum = Ai_info[Ships[objp->instance].ai_index].wp_list; SDL_assert(wp_listnum > 0); wpl = &Waypoint_lists[wp_listnum]; @@ -4392,12 +4387,12 @@ float ai_path() { polymodel *pm; int num_paths, num_points; - float dot, dist_to_goal, dist_to_next, speed, dot_to_next; + float dot, dist_to_goal, dist_to_next, dot_to_next; ship *shipp = &Ships[Pl_objp->instance]; ship_info *sip = &Ship_info[shipp->ship_info_index]; ai_info *aip; vector nvel_vec; - float mag, prev_dot_to_goal; + float mag;//, prev_dot_to_goal; vector temp_vec, *slop_vec; object *gobjp; ship *gshipp; @@ -4476,8 +4471,6 @@ float ai_path() gcvp = *cvp; gnvp = *nvp; - speed = Pl_objp->phys_info.speed; - dist_to_goal = vm_vec_dist_quick(&Pl_objp->pos, &gcvp); dist_to_next = vm_vec_dist_quick(&Pl_objp->pos, &gnvp); // Can't use fvec, need to use velocity vector because we aren't necessarily @@ -4509,7 +4502,7 @@ float ai_path() // Code to control speed is MUCH less forgiving in path following than in waypoint // following. Must be very close to path or might hit objects. - prev_dot_to_goal = aip->prev_dot_to_goal; +// prev_dot_to_goal = aip->prev_dot_to_goal; dot = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gcvp); dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, &gnvp); @@ -4694,7 +4687,7 @@ void ai_waypoints() { int wp_index; vector *wp_cur, *wp_next; - float dot, dist_to_goal, dist_to_next, speed, dot_to_next; + float dot, dist_to_goal;//, dot_to_next; ship *shipp = &Ships[Pl_objp->instance]; ship_info *sip = &Ship_info[shipp->ship_info_index]; waypoint_list *wpl; @@ -4721,10 +4714,8 @@ void ai_waypoints() wp_cur = &wpl->waypoints[wp_index]; wp_next = &wpl->waypoints[(wp_index+1) % wpl->count]; - speed = Pl_objp->phys_info.speed; dist_to_goal = vm_vec_dist_quick(&Pl_objp->pos, wp_cur); - dist_to_next = vm_vec_dist_quick(&Pl_objp->pos, wp_next); // Can't use fvec, need to use velocity vector because we aren't necessarily // moving in the direction we're facing. @@ -4768,13 +4759,13 @@ void ai_waypoints() prev_dot_to_goal = aip->prev_dot_to_goal; dot = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, wp_cur); - dot_to_next = vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, wp_next); + /*dot_to_next =*/ vm_vec_dot_to_point(&nvel_vec, &Pl_objp->pos, wp_next); aip->prev_dot_to_goal = dot; // If there is no next point on the path, don't care about dot to next. - if (wp_index + 1 >= wpl->count) { - dot_to_next = dot; - } +// if (wp_index + 1 >= wpl->count) { +// dot_to_next = dot; +// } // nprintf(("AI", "Wp #%i, dot = %6.3f, next dot = %6.3f, dist = %7.2f\n", wp_index, dot, dot_to_next, dist_to_goal)); @@ -5217,7 +5208,7 @@ void slide_face_ship() return; vector goal_pos; - float dot_from_enemy, dot_to_enemy; + float dot_from_enemy; vector vec_from_enemy, vec_to_goal; float dist; float up, right; @@ -5230,7 +5221,6 @@ void slide_face_ship() ai_turn_towards_vector(&En_objp->pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0); dot_from_enemy = vm_vec_dot(&vec_from_enemy, &En_objp->orient.v.fvec); - dot_to_enemy = -vm_vec_dot(&vec_from_enemy, &Pl_objp->orient.v.fvec); if (vm_vec_dot(&vec_from_enemy, &En_objp->orient.v.rvec) > 0.0f) right = 1.0f; @@ -5479,13 +5469,10 @@ int ai_select_primary_weapon(object *objp, object *other_objp, int flags) { ship *shipp = &Ships[objp->instance]; ship_weapon *swp = &shipp->weapons; - ship_info *sip; //SDL_assert( other_objp != NULL ); SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); - sip = &Ship_info[shipp->ship_info_index]; - if (flags & WIF_PUNCTURE) { if (swp->current_primary_bank >= 0) { int bank_index; @@ -5614,12 +5601,10 @@ void ai_fire_primary_weapon(object *objp) { ship *shipp = &Ships[objp->instance]; ship_weapon *swp = &shipp->weapons; - ship_info *sip; ai_info *aip; object *enemy_objp; SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); - sip = &Ship_info[shipp->ship_info_index]; aip = &Ai_info[shipp->ai_index]; @@ -5985,7 +5970,6 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2) { ship_weapon *swp; ship *shipp; - ship_info *sip; int current_bank; int rval = 0; @@ -5999,9 +5983,6 @@ int ai_fire_secondary_weapon(object *objp, int priority1, int priority2) shipp = &Ships[objp->instance]; swp = &shipp->weapons; - SDL_assert( shipp->ship_info_index >= 0 && shipp->ship_info_index < MAX_SHIP_TYPES); - sip = &Ship_info[shipp->ship_info_index]; - // Select secondary weapon. current_bank = swp->current_secondary_bank; //ai_select_secondary_weapon(objp, swp, priority1, priority2); @@ -6612,9 +6593,8 @@ void get_behind_ship(ai_info *aip, ship_info *sip, float dist_to_enemy) vector new_pos; float dot; vector vec_from_enemy; - float dist; - dist = vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos); + vm_vec_normalized_dir(&vec_from_enemy, &Pl_objp->pos, &En_objp->pos); vm_vec_scale_add(&new_pos, &En_objp->pos, &En_objp->orient.v.fvec, -100.0f); // Pick point 100 units behind. ai_turn_towards_vector(&new_pos, Pl_objp, flFrametime, sip->srotation_time, NULL, NULL, 0.0f, 0); @@ -6705,10 +6685,8 @@ int will_collide_with_big_ship_all(object *objp, object *ignore_objp, vector *go object *big_objp; int collision_obj_index = -1; float min_dist = 999999.9f; - float collision_time = -1.0f; for ( so = GET_FIRST(&Ship_obj_list); so != END_OF_LIST(&Ship_obj_list); so = GET_NEXT(so) ) { - float time = 0.0f; big_objp = &Objects[so->objnum]; if (big_objp == ignore_objp) @@ -6725,7 +6703,6 @@ int will_collide_with_big_ship_all(object *objp, object *ignore_objp, vector *go if (cur_dist < min_dist) { min_dist = cur_dist; *collision_point = cur_collision_point; - collision_time = time; collision_obj_index = OBJ_INDEX(big_objp); } } @@ -7641,7 +7618,7 @@ void ai_chase_big_circle_set_goal(vector *goal_pos, object *attack_objp, object // get the current and desired horizontal separations between target void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vector *horz_vec_to_target, float *desired_separation, float *cur_separation) { - float temp, r_target, r_attacker, h_attacker, h_target; + float temp, r_target, r_attacker; float perp_dist; vector vec_to_target; polymodel *pm; @@ -7652,14 +7629,12 @@ void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vect temp = max(pm->maxs.xyz.x, pm->maxs.xyz.y); r_attacker = max(-pm->mins.xyz.x, -pm->mins.xyz.y); r_attacker = max(temp, r_attacker); - h_attacker = max(-pm->mins.xyz.z, pm->maxs.xyz.z); // get radius of target (for rotations about forward) pm = model_get(Ships[attack_objp->instance].modelnum); temp = max(pm->maxs.xyz.x, pm->maxs.xyz.y); r_target = max(-pm->mins.xyz.x, -pm->mins.xyz.y); r_target = max(temp, r_target); - h_target = max(-pm->mins.xyz.z, pm->maxs.xyz.z); // find separation between cylinders [if parallel] vm_vec_sub(&vec_to_target, &attack_objp->pos, &target_objp->pos); @@ -7678,7 +7653,7 @@ void ai_chase_big_get_separations(object *attack_objp, object *target_objp, vect void ai_chase_big_parallel_set_goal(vector *goal_pos, object *attack_objp, object *target_objp, float *accel) { int opposing; - float temp, r_target, r_attacker, h_attacker, h_target; + float temp, r_target, r_attacker; float separation, optimal_separation; vector horz_vec_to_target; polymodel *pm; @@ -7689,14 +7664,12 @@ void ai_chase_big_parallel_set_goal(vector *goal_pos, object *attack_objp, objec temp = max(pm->maxs.xyz.x, pm->maxs.xyz.y); r_attacker = max(-pm->mins.xyz.x, -pm->mins.xyz.y); r_attacker = max(temp, r_attacker); - h_attacker = max(-pm->mins.xyz.z, pm->maxs.xyz.z); // get radius of target (for rotations about forward) pm = model_get(Ships[attack_objp->instance].modelnum); temp = max(pm->maxs.xyz.x, pm->maxs.xyz.y); r_target = max(-pm->mins.xyz.x, -pm->mins.xyz.y); r_target = max(temp, r_target); - h_target = max(-pm->mins.xyz.z, pm->maxs.xyz.z); // are we opposing (only when other ship is not moving) opposing = ( vm_vec_dotprod(&attack_objp->orient.v.fvec, &target_objp->orient.v.fvec) < 0 ); @@ -7967,7 +7940,7 @@ void ai_cruiser_chase() // Make object Pl_objp chase object En_objp void ai_chase() { - float dist_to_enemy, time_to_enemy; + float dist_to_enemy; float dot_to_enemy, dot_from_enemy, real_dot_to_enemy; vector player_pos, enemy_pos, predicted_enemy_pos, real_vec_to_enemy, predicted_vec_to_enemy; ship_info *sip = &Ship_info[Ships[Pl_objp->instance].ship_info_index]; @@ -8016,7 +7989,6 @@ void ai_chase() ai_set_positions(Pl_objp, En_objp, aip, &player_pos, &enemy_pos); dist_to_enemy = vm_vec_dist_quick(&player_pos, &enemy_pos); - time_to_enemy = compute_time_to_enemy(dist_to_enemy, Pl_objp, En_objp); vm_vec_sub(&real_vec_to_enemy, &enemy_pos, &player_pos); vm_vec_normalize(&real_vec_to_enemy); @@ -9458,8 +9430,7 @@ void ai_guard() ship *shipp = &Ships[Pl_objp->instance]; ai_info *aip = &Ai_info[shipp->ai_index]; object *guard_objp; - ship *gshipp; - float dist_to_guardobj, dot_to_guardobj; + float dist_to_guardobj; vector vec_to_guardobj; /* // Debug code, find an object to guard. @@ -9504,8 +9475,6 @@ void ai_guard() return; } - gshipp = &Ships[guard_objp->instance]; - float objval; vector goal_point; vector rel_vec; @@ -9520,7 +9489,6 @@ void ai_guard() case AIS_GUARD_PATROL: // Stay near ship dist_to_guardobj = vm_vec_normalized_dir(&vec_to_guardobj, &guard_objp->pos, &Pl_objp->pos); - dot_to_guardobj = vm_vec_dot(&Pl_objp->orient.v.fvec, &vec_to_guardobj); rel_vec = aip->guard_vec; vm_vec_add(&goal_point, &guard_objp->pos, &rel_vec); @@ -10059,7 +10027,7 @@ void ai_dock() // This mode means to follow the path until just before the end. case AIS_DOCK_1: { - float dist; + // float dist; int r; if ((r = maybe_dock_obstructed(Pl_objp, goal_objp, 1)) != -1) { @@ -10074,7 +10042,7 @@ void ai_dock() } */ } //else { { - dist = ai_path(); + /*dist =*/ ai_path(); //nprintf(("AI", "Time = %7.3f, submode = %i\n", f2fl(Missiontime), aip->submode)); //nprintf(("AI", "Dock 1: Frame: %i, goal point = %i, dist = %7.3f\n", Framecount, aip->path_cur-aip->path_start, dist)); @@ -10292,11 +10260,11 @@ void ai_dock() } case AIS_UNDOCK_2: { float dist; - ai_info *other_aip; + //ai_info *other_aip; // get pointer to docked object's aip to reset flags, etc SDL_assert( aip->dock_objnum != -1 ); - other_aip = &Ai_info[Ships[Objects[aip->dock_objnum].instance].ai_index]; + //other_aip = &Ai_info[Ships[Objects[aip->dock_objnum].instance].ai_index]; // Second stage of undocking. dist = dock_orient_and_approach(Pl_objp, &Objects[aip->goal_objnum], DOA_UNDOCK_2); @@ -10346,14 +10314,14 @@ void ai_dock() break; } case AIS_UNDOCK_4: { - ai_info *other_aip; + //ai_info *other_aip; // MWA 10/07/97 I'm slightly confused by the dual use of goal_objnum and dock_objnum. Seems to me // that goal_objnum and dock_objnum are the same through this whole docking/undocking process, although // I could be wrong. dock_objnum was reset in undock_2 submode so try to use goal_objnum here to // get other ships ai_info pointer - SDL_assert( aip->goal_objnum != -1 ); - other_aip = &Ai_info[Ships[Objects[aip->goal_objnum].instance].ai_index]; + //SDL_assert( aip->goal_objnum != -1 ); + //other_aip = &Ai_info[Ships[Objects[aip->goal_objnum].instance].ai_index]; aip->mode = AIM_NONE; aip->dock_path_index = -1; // invalidate the docking path index @@ -10477,9 +10445,7 @@ int aifft_rotate_turret(ship *shipp, int parent_objnum, ship_subsys *ss, object vector v2e; vm_vec_normalized_dir(&v2e, predicted_enemy_pos, &gun_pos); if (vm_vec_dot(&v2e, gvec) > tp->turret_fov) { - int rval; - - rval = model_rotate_gun(shipp->modelnum, ss->system_info, &Objects[parent_objnum].orient, + model_rotate_gun(shipp->modelnum, ss->system_info, &Objects[parent_objnum].orient, &ss->submodel_info_1.angs, &ss->submodel_info_2.angs, &Objects[parent_objnum].pos, predicted_enemy_pos); } @@ -10525,7 +10491,7 @@ DCF(mf, "") // Returns dot product from turret to subsystem in *dot_out ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *enemy_objp, float *dot_out) { - ship *eshipp, *shipp; + ship *eshipp; ship_info *esip; ship_subsys *best_subsysp = NULL; float dot; @@ -10535,8 +10501,6 @@ ship_subsys *aifft_find_turret_subsys(object *objp, ship_subsys *ssp, object *en eshipp = &Ships[enemy_objp->instance]; esip = &Ship_info[eshipp->ship_info_index]; - shipp = &Ships[objp->instance]; - float best_dot = 0.0f; *dot_out = best_dot; @@ -11796,9 +11760,8 @@ int ai_formation() } else { vector v2f2; float dot_to_f2; - float dist_to_f2; - dist_to_f2 = vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos); + vm_vec_normalized_dir(&v2f2, &future_goal_point_2, &Pl_objp->pos); dot_to_f2 = vm_vec_dot(&v2f2, &Pl_objp->orient.v.fvec); // Leader flying like a maniac. Don't try hard to form on wing. @@ -12053,12 +12016,8 @@ void ai_maybe_launch_cmeasure(object *objp, ai_info *aip) if ((aip->nearest_locked_object != -1) && (Objects[aip->nearest_locked_object].type == OBJ_WEAPON)) { object *weapon_objp; - weapon *weaponp; - weapon_info *wip; weapon_objp = &Objects[aip->nearest_locked_object]; - weaponp = &Weapons[weapon_objp->instance]; - wip = &Weapon_info[weaponp->weapon_info_index]; if ((dist = vm_vec_dist_quick(&objp->pos, &weapon_objp->pos)) < weapon_objp->phys_info.speed*2.0f) { @@ -12295,10 +12254,8 @@ void ai_manage_shield(object *objp, ai_info *aip) void ai_maybe_evade_locked_missile(object *objp, ai_info *aip) { ship *shipp; - ship_info *sip; shipp = &Ships[objp->instance]; - sip = &Ship_info[shipp->ship_info_index]; // Only small ships evade an incoming missile. Why would a capital ship try to swerve? if (!(Ship_info[Ships[objp->instance].ship_info_index].flags & SIF_SMALL_SHIP)) { @@ -14012,7 +13969,7 @@ int find_ship_name(char *name) void create_waypoints() { - int i, j, z; + int i, j; // Waypoints_created = 1; @@ -14021,7 +13978,7 @@ void create_waypoints() for (j=0; jinstance != -1 ); - ai_shipname = Ships[objp->instance].ship_name; + //ai_shipname = Ships[objp->instance].ship_name; aip = &Ai_info[Ships[objp->instance].ai_index]; return_val = AI_GOAL_SATISFIED; @@ -2133,9 +2133,6 @@ void ai_process_mission_orders( int objnum, ai_info *aip ) break; case AI_GOAL_WARP: { - int index; - - index = current_goal->wp_index; ai_set_mode_warp_out( objp, aip ); break; } diff --git a/src/ship/ship.cpp b/src/ship/ship.cpp index 588eab6..60e7f59 100644 --- a/src/ship/ship.cpp +++ b/src/ship/ship.cpp @@ -2847,10 +2847,8 @@ void ship_wing_cleanup( int shipnum, wing *wingp ) void ship_destroyed( int num ) { ship *shipp; - object *objp; shipp = &Ships[num]; - objp = &Objects[shipp->objnum]; // add the information to the exited ship list ship_add_exited_ship( shipp, SEF_DESTROYED ); @@ -2894,10 +2892,8 @@ void ship_destroyed( int num ) void ship_vanished(int num) { ship *sp; - object *objp; sp = &Ships[num]; - objp = &Objects[sp->objnum]; // demo recording if(Game_mode & GM_DEMO_RECORD){ @@ -5075,12 +5071,11 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) int n = obj->instance; ship *shipp; ship_weapon *swp; - ship_info *sip; ai_info *aip; int weapon, i, j, weapon_objnum; int bank_to_fire, num_fired = 0; - int banks_fired, have_timeout; // used for multiplayer to help determine whether or not to send packet - have_timeout = 0; // used to help tell us whether or not we need to send a packet + int banks_fired;//, have_timeout; // used for multiplayer to help determine whether or not to send packet +// have_timeout = 0; // used to help tell us whether or not we need to send a packet banks_fired = 0; // used in multiplayer -- bitfield of banks that were fired int sound_played; // used to track what sound is played. If the player is firing two banks @@ -5113,7 +5108,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) if((shipp->ai_index < 0) || (shipp->ai_index >= MAX_AI_INFO)){ return 0; } - sip = &Ship_info[shipp->ship_info_index]; + aip = &Ai_info[shipp->ai_index]; if ( swp->num_primary_banks <= 0 ) { @@ -5178,7 +5173,7 @@ int ship_fire_primary(object * obj, int stream_weapons, int force) swp->next_primary_fire_stamp[bank_to_fire] = timestamp(1000); } - have_timeout = 1; + // have_timeout = 1; continue; } @@ -5578,11 +5573,11 @@ extern void ai_maybe_announce_shockwave_weapon(object *firing_objp, int weapon_i // need to avoid firing when normally called int ship_fire_secondary( object *obj, int allow_swarm ) { - int n, weapon, j, bank, have_timeout, starting_bank_count = -1, num_fired; + int n, weapon, j, bank, starting_bank_count = -1, num_fired; +// int have_timeout; ushort starting_sig = 0; ship *shipp; ship_weapon *swp; - ship_info *sip; weapon_info *wip; ai_info *aip; polymodel *po; @@ -5616,7 +5611,6 @@ int ship_fire_secondary( object *obj, int allow_swarm ) shipp = &Ships[n]; swp = &shipp->weapons; - sip = &Ship_info[shipp->ship_info_index]; aip = &Ai_info[shipp->ai_index]; // if no secondary weapons are present on ship, return @@ -5643,7 +5637,7 @@ int ship_fire_secondary( object *obj, int allow_swarm ) } wip = &Weapon_info[swp->secondary_bank_weapons[bank]]; - have_timeout = 0; // used to help tell whether or not we have a timeout +// have_timeout = 0; // used to help tell whether or not we have a timeout if ( MULTIPLAYER_MASTER ) { starting_sig = multi_get_next_network_signature( MULTI_SIG_NON_PERMANENT ); starting_bank_count = swp->secondary_bank_ammo[bank]; @@ -5677,7 +5671,7 @@ int ship_fire_secondary( object *obj, int allow_swarm ) if (timestamp_until(swp->next_secondary_fire_stamp[bank]) > 60000){ swp->next_secondary_fire_stamp[bank] = timestamp(1000); } - have_timeout = 1; + // have_timeout = 1; goto done_secondary; } @@ -6246,10 +6240,8 @@ int get_subsystem_pos(vector *pos, object *objp, ship_subsys *subsysp) matrix m; model_subsystem *psub; vector pnt; - ship *shipp; SDL_assert(objp->type == OBJ_SHIP); - shipp = &Ships[objp->instance]; SDL_assert ( subsysp != NULL ); @@ -9345,7 +9337,6 @@ void ship_update_artillery_lock() return; #else ai_info *aip = NULL; - weapon_info *tlaser = NULL; mc_info *cinfo = NULL; int c_objnum; vector temp, local_hit; @@ -9389,7 +9380,6 @@ void ship_update_artillery_lock() if(!(Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].wi_flags & WIF_BEAM) || (Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]].b_info.beam_type != BEAM_TYPE_C)){ continue; } - tlaser = &Weapon_info[shipp->weapons.primary_bank_weapons[shipp->weapons.current_primary_bank]]; // get collision info if(!beam_get_collision(shipp->targeting_laser_objnum, 0, &c_objnum, &cinfo)){ diff --git a/src/ship/shipfx.cpp b/src/ship/shipfx.cpp index 3e1463a..e195187 100644 --- a/src/ship/shipfx.cpp +++ b/src/ship/shipfx.cpp @@ -1152,10 +1152,10 @@ void shipfx_warpout_frame( object *objp, float frametime ) // Find the closest point on line from center of wormhole vector pos; - float dist; +// float dist; fvi_ray_plane(&pos,&objp->pos,&shipp->warp_effect_fvec,&shipp->warp_effect_pos, &shipp->warp_effect_fvec, 0.0f ); - dist = vm_vec_dist( &pos, &objp->pos ); +// dist = vm_vec_dist( &pos, &objp->pos ); // mprintf(( "Warp pos = %.1f, rad=%.1f, center dist = %.1f\n", warp_pos, objp->radius, dist )); @@ -2692,7 +2692,7 @@ void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci) vector temp, dir, shockwave_pos; vector head = vmd_zero_vector; vector tail = vmd_zero_vector; - float len, step, cur; + float step, cur; int idx; // sanity checks @@ -2743,7 +2743,6 @@ void shipfx_do_shockwave_stuff(ship *shipp, shockwave_create_info *sci) // now create as many shockwaves as needed vm_vec_sub(&dir, &head, &tail); - len = vm_vec_mag(&dir); step = 1.0f / ((float)sip->shockwave_count + 1.0f); cur = step; for(idx=0; idxshockwave_count; idx++){ diff --git a/src/starfield/nebula.cpp b/src/starfield/nebula.cpp index a8212f7..8f6a6b2 100644 --- a/src/starfield/nebula.cpp +++ b/src/starfield/nebula.cpp @@ -221,7 +221,7 @@ int load_nebula(const char *filename) { CFILE *fp; char id[16]; - int version, major, minor; + int version, major;//, minor; fp = cfopen(filename, "rb"); @@ -238,7 +238,7 @@ int load_nebula(const char *filename) cfread( &version, sizeof(int), 1, fp ); version = INTEL_INT(version); major = version / 100; - minor = version % 100; + //minor = version % 100; if ( major != NEBULA_MAJOR_VERSION ) { mprintf(( "An out of date nebula file.\n" )); diff --git a/src/tgautils/tgautils.cpp b/src/tgautils/tgautils.cpp index 561a56f..59874f3 100644 --- a/src/tgautils/tgautils.cpp +++ b/src/tgautils/tgautils.cpp @@ -557,6 +557,7 @@ int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, in return TARGA_ERROR_READING; } + /* int xo, yo; if ( header.image_descriptor & 0x10 ) { xo = 1; @@ -569,6 +570,7 @@ int targa_read_bitmap(char *real_filename, ubyte *image_data, ubyte *palette, in } else { yo = 0; } + */ // only accept 16 bit, compressed if(header.pixel_depth!=16) { diff --git a/src/ui/listbox.cpp b/src/ui/listbox.cpp index 6bd75a3..0865aec 100644 --- a/src/ui/listbox.cpp +++ b/src/ui/listbox.cpp @@ -303,7 +303,7 @@ void UI_LISTBOX::draw() void UI_LISTBOX::process(int focus) { - int OnMe, mitem, oldbarpos, kf = 0; + int OnMe, mitem, kf = 0; int i, j; selected_item = -1; @@ -456,7 +456,6 @@ void UI_LISTBOX::process(int focus) } else { if (has_scrollbar) { - oldbarpos = scrollbar.position; scrollbar.position = first_item; scrollbar.bar_position = scrollbar.position - scrollbar.start; @@ -513,7 +512,6 @@ void UI_LISTBOX::process(int focus) first_item = 0; } else if (has_scrollbar) { - oldbarpos = scrollbar.position; scrollbar.position = first_item; scrollbar.bar_position = scrollbar.position - scrollbar.start; diff --git a/src/ui/scroll.cpp b/src/ui/scroll.cpp index ccb2798..af3a597 100644 --- a/src/ui/scroll.cpp +++ b/src/ui/scroll.cpp @@ -240,7 +240,7 @@ void UI_SCROLLBAR::draw() void UI_SCROLLBAR::process(int focus) { int OnMe, OnSlider; - int oldpos, op; + int op; moved = 0; if (disabled_flag) { @@ -260,7 +260,6 @@ void UI_SCROLLBAR::process(int focus) } op = position; - oldpos = bar_position; if (up_button.pressed()) { position--; diff --git a/src/ui/slider2.cpp b/src/ui/slider2.cpp index c03deb6..7164a8b 100644 --- a/src/ui/slider2.cpp +++ b/src/ui/slider2.cpp @@ -129,17 +129,12 @@ void UI_SLIDER2::draw() { void UI_SLIDER2::process(int focus) { - int OnMe, keyfocus, mouse_lock_move; + int OnMe, mouse_lock_move; if (disabled_flag) { return; } - keyfocus = 0; - if (my_wnd->selected_gadget == this){ - keyfocus = 1; - } - OnMe = is_mouse_on(); if ( OnMe ) { // are we on the button? diff --git a/src/weapon/beam.cpp b/src/weapon/beam.cpp index d43945c..29b0eaa 100644 --- a/src/weapon/beam.cpp +++ b/src/weapon/beam.cpp @@ -2257,8 +2257,6 @@ void beam_jitter_aim(beam *b, float aim) int beam_collide_ship(obj_pair *pair) { beam *b; - ship *shipp; - ship_info *sip; mc_info test_collide; int model_num; float widest; @@ -2313,8 +2311,6 @@ int beam_collide_ship(obj_pair *pair) if((pair->b->type != OBJ_SHIP) || (pair->b->instance < 0)){ return 1; } - shipp = &Ships[pair->b->instance]; - sip = &Ship_info[shipp->ship_info_index]; // get the widest portion of the beam widest = beam_get_widest(b); @@ -2688,7 +2684,6 @@ void beam_handle_collisions(beam *b) int idx, s_idx; beam_collision r_coll[MAX_FRAME_COLLISIONS]; int r_coll_count = 0; - beam_weapon_info *bwi; weapon_info *wi; float widest; @@ -2702,7 +2697,7 @@ void beam_handle_collisions(beam *b) Int3(); return; } - bwi = &Weapon_info[b->weapon_info_index].b_info; + wi = &Weapon_info[b->weapon_info_index]; // get the widest part of the beam @@ -3176,70 +3171,34 @@ void beam_test(int whee) void beam_test_new(int whee) { - int s1, s2, s3; - object *orion, *fenris, *herc2, *herc3, *herc6, *alpha; - ship_subsys *orion_turret, *fenris_turret, *fenris_radar, *orion_radar, *lookup; + int s2, s3; + object *fenris, *alpha; + ship_subsys *fenris_turret, *lookup; beam_fire_info f; nprintf(("General", "Running beam test\n")); // lookup some stuff - s1 = ship_name_lookup("GTD Orion 1"); - SDL_assert(s1 >= 0); - orion = &Objects[Ships[s1].objnum]; s2 = ship_name_lookup("GTC Fenris 2"); SDL_assert(s2 >= 0); fenris = &Objects[Ships[s2].objnum]; - s3 = ship_name_lookup("GTF Hercules 2"); - SDL_assert(s3 >= 0); - herc2 = &Objects[Ships[s3].objnum]; - s3 = ship_name_lookup("GTF Hercules 3"); - SDL_assert(s3 >= 0); - herc3 = &Objects[Ships[s3].objnum]; - s3 = ship_name_lookup("GTF Hercules 6"); - SDL_assert(s3 >= 0); - herc6 = &Objects[Ships[s3].objnum]; s3 = ship_name_lookup("Alpha 1"); SDL_assert(s3 >= 0); alpha = &Objects[Ships[s3].objnum]; // get beam weapons - lookup = GET_FIRST(&Ships[s1].subsys_list); - orion_turret = NULL; - orion_radar = NULL; - while(lookup != END_OF_LIST(&Ships[s1].subsys_list)){ - // turret - if((lookup->system_info->type == SUBSYSTEM_TURRET) && !SDL_strcasecmp(lookup->system_info->subobj_name, "turret07")){ - orion_turret = lookup; - } - - // radar - if(lookup->system_info->type == SUBSYSTEM_RADAR){ - orion_radar = lookup; - } - - lookup = GET_NEXT(lookup); - } - SDL_assert(orion_turret != NULL); - SDL_assert(orion_radar != NULL); lookup = GET_FIRST(&Ships[s2].subsys_list); fenris_turret = NULL; - fenris_radar = NULL; while(lookup != END_OF_LIST(&Ships[s2].subsys_list)){ // turret if((lookup->system_info->type == SUBSYSTEM_TURRET) && !SDL_strcasecmp(lookup->system_info->subobj_name, "turret03")){ - fenris_turret = lookup; - } - - // radar - if(lookup->system_info->type == SUBSYSTEM_RADAR){ - fenris_radar = lookup; + fenris_turret = lookup; + break; } lookup = GET_NEXT(lookup); } SDL_assert(fenris_turret != NULL); - SDL_assert(fenris_radar != NULL); memset(&f, 0, sizeof(beam_fire_info)); f.accuracy = beam_accuracy; diff --git a/src/weapon/corkscrew.cpp b/src/weapon/corkscrew.cpp index 42ad6c2..bd979d6 100644 --- a/src/weapon/corkscrew.cpp +++ b/src/weapon/corkscrew.cpp @@ -200,7 +200,6 @@ void cscrew_process_post(object *objp) vector cen, neg; vector new_pt; weapon *wp; - weapon_info *wip; cscrew_info *ci; float twist_val; @@ -211,7 +210,6 @@ void cscrew_process_post(object *objp) // get various useful pointers wp = &Weapons[objp->instance]; - wip = &Weapon_info[wp->weapon_info_index]; ci = &Corkscrew_missiles[wp->cscrew_index]; // move to the outside of the corkscrew diff --git a/src/weapon/shockwave.cpp b/src/weapon/shockwave.cpp index aacb8c7..d0f8605 100644 --- a/src/weapon/shockwave.cpp +++ b/src/weapon/shockwave.cpp @@ -286,7 +286,7 @@ int shockwave_create(int parent_objnum, vector *pos, shockwave_create_info *sci, { int i, objnum, real_parent; shockwave *sw; - shockwave_info *si; +// shockwave_info *si; matrix orient; for ( i = 0; i < MAX_SHOCKWAVES; i++ ) { @@ -324,7 +324,7 @@ int shockwave_create(int parent_objnum, vector *pos, shockwave_create_info *sci, sw->rot_angle = sci->rot_angle; - si = &Shockwave_info[sw->shockwave_info_index]; +// si = &Shockwave_info[sw->shockwave_info_index]; // sw->total_time = i2fl(si->num_frames) / si->fps; // in seconds sw->total_time = sw->outer_radius / sw->speed; @@ -520,14 +520,12 @@ void shockwave_move(object *shockwave_objp, float frametime) void shockwave_render(object *objp) { shockwave *sw; - shockwave_info *si; vertex p; SDL_assert(objp->type == OBJ_SHOCKWAVE); SDL_assert(objp->instance >= 0 && objp->instance < MAX_SHOCKWAVES); sw = &Shockwaves[objp->instance]; - si = &Shockwave_info[sw->shockwave_info_index]; if( (sw->delay_stamp != -1) && !timestamp_elapsed(sw->delay_stamp)){ return; diff --git a/src/weapon/weapons.cpp b/src/weapon/weapons.cpp index f49aed1..b07828a 100644 --- a/src/weapon/weapons.cpp +++ b/src/weapon/weapons.cpp @@ -2464,12 +2464,12 @@ void weapon_process_post(object * obj, float frame_time) float dot; vector tvec; ai_info *parent_aip; - float lead_scale = 0.0f; + // float lead_scale = 0.0f; parent_aip = NULL; if (obj->parent != Player_obj-Objects) { parent_aip = &Ai_info[Ships[Objects[obj->parent].instance].ai_index]; - lead_scale = parent_aip->lead_scale; + // lead_scale = parent_aip->lead_scale; } vm_vec_normalized_dir(&tvec, &v0, &Objects[wp->target_num].pos); @@ -3165,13 +3165,12 @@ void weapon_area_apply_blast(vector *force_apply_pos, object *ship_obj, vector * void weapon_do_area_effect(object *wobjp, vector *pos, object *other_obj) { weapon_info *wip; - weapon *wp; object *objp; float damage, blast; wip = &Weapon_info[Weapons[wobjp->instance].weapon_info_index]; - wp = &Weapons[wobjp->instance]; - SDL_assert(wip->inner_radius != 0); + + SDL_assert(wip->inner_radius != 0); // only blast ships and asteroids for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) ) { @@ -3236,7 +3235,6 @@ void weapon_hit( object * weapon_obj, object * other_obj, vector * hitpos ) int num = weapon_obj->instance; int weapon_type = Weapons[num].weapon_info_index; - object *weapon_parent_objp; weapon_info *wip; // int np_index; @@ -3245,7 +3243,6 @@ void weapon_hit( object * weapon_obj, object * other_obj, vector * hitpos ) return; } wip = &Weapon_info[weapon_type]; - weapon_parent_objp = &Objects[weapon_obj->parent]; // if this is the player ship, and is a laser hit, skip it. wait for player "pain" to take care of it // if( ((wip->subtype != WP_LASER) || !MULTIPLAYER_CLIENT) && (Player_obj != NULL) && (other_obj == Player_obj) ){ @@ -3691,7 +3688,6 @@ float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target) #ifndef MAKE_FS1 // don't do special damage scaling for capships in FS1 // if the hit object was a ship if(target->type == OBJ_SHIP){ - ship *shipp; ship_info *sip; // get some info on the ship @@ -3699,7 +3695,7 @@ float weapon_get_damage_scale(weapon_info *wip, object *wep, object *target) if((target->instance < 0) || (target->instance >= MAX_SHIPS)){ return total_scale; } - shipp = &Ships[target->instance]; + sip = &Ship_info[Ships[target->instance].ship_info_index]; // get hull pct of the ship currently -- 2.39.2