diff --git a/code/ai/aicode.cpp b/code/ai/aicode.cpp index dc1e007ce9e..0f569ca6f00 100644 --- a/code/ai/aicode.cpp +++ b/code/ai/aicode.cpp @@ -14551,7 +14551,6 @@ int aas_1(object *objp, ai_info *aip, vec3d *safe_pos) weapon *weaponp = &Weapons[weapon_objp->instance]; weapon_info *wip = &Weapon_info[weaponp->weapon_info_index]; - object *target_ship_obj = NULL; if (wip->shockwave.speed == 0.0f) { aip->ai_flags.remove(AI::AI_Flags::Avoid_shockwave_weapon); @@ -14570,16 +14569,12 @@ int aas_1(object *objp, ai_info *aip, vec3d *safe_pos) // time in the future, this time based on max lifetime and life left. if (wip->is_locked_homing()) { expected_pos = weaponp->homing_pos; - if (weaponp->homing_object && weaponp->homing_object->type == OBJ_SHIP) { - target_ship_obj = weaponp->homing_object; - } pos_set = 1; if (IS_VEC_NULL(&weaponp->homing_pos)) { pos_set = 0; if (weaponp->target_num != -1) { if (Objects[weaponp->target_num].type == OBJ_SHIP) { - target_ship_obj = &Objects[weaponp->target_num]; - expected_pos = target_ship_obj->pos; + expected_pos = Objects[weaponp->target_num].pos; pos_set = 1; } } diff --git a/code/bmpman/bmpman.cpp b/code/bmpman/bmpman.cpp index 3d8480e437a..d691a3a23c7 100644 --- a/code/bmpman/bmpman.cpp +++ b/code/bmpman/bmpman.cpp @@ -2159,7 +2159,8 @@ void bm_lock_ani(int /*handle*/, bitmap_slot *bs, bitmap* /*bmp*/, int bpp, usho // Skip a frame if ((i < nframes - 1) && can_drop_frames) { - frame_data = anim_get_next_raw_buffer(the_anim_instance, 0, flags & BMP_AABITMAP ? 1 : 0, bm->bpp); + // we can just ignore the return since we're skipping the frame. + anim_get_next_raw_buffer(the_anim_instance, 0, flags & BMP_AABITMAP ? 1 : 0, bm->bpp); } } diff --git a/code/graphics/opengl/gropenglstate.cpp b/code/graphics/opengl/gropenglstate.cpp index 70cc6430526..b3fcd75f65e 100644 --- a/code/graphics/opengl/gropenglstate.cpp +++ b/code/graphics/opengl/gropenglstate.cpp @@ -182,7 +182,7 @@ void opengl_state::init() glBlendFunc(GL_ONE, GL_ZERO); blendfunc_Value.first = GL_ONE; - blendfunc_Value.first = GL_ZERO; + blendfunc_Value.second = GL_ZERO; buffer_blendfunc_Value.fill(blendfunc_Value); glDepthFunc(GL_LESS); diff --git a/code/hud/hudlock.cpp b/code/hud/hudlock.cpp index d4e47b647f2..a8c3def557c 100644 --- a/code/hud/hudlock.cpp +++ b/code/hud/hudlock.cpp @@ -719,7 +719,7 @@ void hud_do_lock_indicator(float frametime) } } -void hud_lock_acquire_current_target(object *target_objp, ship_subsys *target_subsys) +void hud_lock_acquire_current_target(object *target_objp, ship_subsys **target_subsys) { ship *target_shipp=nullptr; int lock_in_range=0; @@ -735,7 +735,7 @@ void hud_lock_acquire_current_target(object *target_objp, ship_subsys *target_su weapon_info* wip = &Weapon_info[swp->secondary_bank_weapons[swp->current_secondary_bank]]; // Reset target subsys in case it isn't needed - if (target_subsys != nullptr) target_subsys = nullptr; + if (*target_subsys != nullptr) *target_subsys = nullptr; // if a large ship, lock to pos closest to center and within range if ( (target_shipp) && (Ship_info[target_shipp->ship_info_index].is_big_or_huge()) ) { @@ -764,7 +764,7 @@ void hud_lock_acquire_current_target(object *target_objp, ship_subsys *target_su lock_dot=vm_vec_dot(&Player_obj->orient.vec.fvec, &vec_to_lock); if ( lock_dot > best_lock_dot ) { best_lock_dot=lock_dot; - target_subsys = ss; + *target_subsys = ss; } } ss = GET_NEXT( ss ); @@ -1073,7 +1073,7 @@ void hud_lock_determine_lock_target(lock_info *lock_slot, weapon_info *wip) } } } else { - hud_lock_acquire_current_target(lock_slot->obj, lock_slot->subsys); + hud_lock_acquire_current_target(lock_slot->obj, &lock_slot->subsys); } } } else { @@ -1124,7 +1124,7 @@ void hud_lock_determine_lock_target(lock_info *lock_slot, weapon_info *wip) } } } else { - hud_lock_acquire_current_target(lock_slot->obj, lock_slot->subsys); + hud_lock_acquire_current_target(lock_slot->obj, &lock_slot->subsys); } } } diff --git a/code/missionui/missionshipchoice.cpp b/code/missionui/missionshipchoice.cpp index 8136e6473bf..d508b6c8855 100644 --- a/code/missionui/missionshipchoice.cpp +++ b/code/missionui/missionshipchoice.cpp @@ -2432,7 +2432,7 @@ commit_pressed_status create_wings(bool API_Access) ss_slot_info *ws; wing *wp; - int shipnum, objnum, slot_index; + int shipnum, slot_index; int cleanup_ship_index[MAX_WING_SLOTS]; int i,j,k; @@ -2465,8 +2465,6 @@ commit_pressed_status create_wings(bool API_Access) return commit_pressed_status::PLAYER_NO_WEAPONS; } - objnum = OBJ_INDEX(Player_obj); - shipnum = Objects[objnum].instance; } else { // We should always update the parse object information, even if the ship is present at start, // because the wing might have more than one wave or scripting functions might need accurate data diff --git a/code/parse/sexp.cpp b/code/parse/sexp.cpp index 48b7e06af10..7807d0894c7 100644 --- a/code/parse/sexp.cpp +++ b/code/parse/sexp.cpp @@ -34313,7 +34313,6 @@ void add_block_variable(const char *text, const char *var_name, int type, int in strcpy_s(Block_variables[index].text, text); strcpy_s(Block_variables[index].variable_name, var_name); - Block_variables[index].type &= ~SEXP_VARIABLE_NOT_USED; Block_variables[index].type = (type | SEXP_VARIABLE_SET); } @@ -34340,7 +34339,6 @@ int sexp_add_variable(const char *text, const char *var_name, int type, int inde if (index >= 0) { strcpy_s(Sexp_variables[index].text, text); strcpy_s(Sexp_variables[index].variable_name, var_name); - Sexp_variables[index].type &= ~SEXP_VARIABLE_NOT_USED; Sexp_variables[index].type = (type | SEXP_VARIABLE_SET); } diff --git a/code/pilotfile/csg.cpp b/code/pilotfile/csg.cpp index f8172897e0f..1eaae38ce61 100644 --- a/code/pilotfile/csg.cpp +++ b/code/pilotfile/csg.cpp @@ -130,7 +130,8 @@ void pilotfile::csg_read_info() Assertion ((idx < (int)ship_list.size()), "Campaign file contains an incorrect value for the last flown ship class. No data in ship_list for ship number %d.", idx); if (idx >= (int)ship_list.size()) idx = -1; - else if (idx != -1) + + if (idx != -1) p->last_ship_flown_si_index = ship_list[idx].index; else p->last_ship_flown_si_index = -1; diff --git a/code/ship/ship.cpp b/code/ship/ship.cpp index d95a20e375f..79d89abab79 100644 --- a/code/ship/ship.cpp +++ b/code/ship/ship.cpp @@ -19893,7 +19893,6 @@ float ArmorType::GetDamage(float damage_applied, int in_damage_type_idx, float d // Nuke: idiotproof this, no segfault 4 u if ( (storage_idx < 0) || (storage_idx >= AT_NUM_STORAGE_LOCATIONS) ) { Warning(LOCATION, "+Value: for +Store: calculation out of range. Should be between 0 and %i. Read: %i, Skipping calculation.", AT_NUM_STORAGE_LOCATIONS, storage_idx); - storage_idx = 0; } else { storage[storage_idx] = damage_applied; } @@ -19907,7 +19906,6 @@ float ArmorType::GetDamage(float damage_applied, int in_damage_type_idx, float d // Nuke: idiotproof this, no segfault 4 u if ( (storage_idx < 0) || (storage_idx >= AT_NUM_STORAGE_LOCATIONS) ) { Warning(LOCATION, "+Value: for +Load: calculation out of range. Should be between 0 and %i. Read: %i, Skipping calculation.", AT_NUM_STORAGE_LOCATIONS, storage_idx); - storage_idx = 0; } else { damage_applied = storage[storage_idx]; } diff --git a/code/starfield/starfield.cpp b/code/starfield/starfield.cpp index 181107ea9fb..cfade5f8656 100644 --- a/code/starfield/starfield.cpp +++ b/code/starfield/starfield.cpp @@ -1742,7 +1742,6 @@ void stars_draw_stars() int i; star *sp; - float dist = 0.0f; float ratio; vDist vDst; vertex p1, p2; @@ -1793,7 +1792,7 @@ void stars_draw_stars() } if ( can_draw && (Star_flags & (STAR_FLAG_TAIL|STAR_FLAG_DIM)) ) { - dist = vm_vec_dist_quick( &sp->last_star_pos, &p2.world ); + float dist = vm_vec_dist_quick( &sp->last_star_pos, &p2.world ); if ( dist > Star_max_length ) { ratio = Star_max_length / dist;