diff --git a/src/boe.combat.cpp b/src/boe.combat.cpp index 6ba7667b2..7655efd72 100644 --- a/src/boe.combat.cpp +++ b/src/boe.combat.cpp @@ -1871,13 +1871,13 @@ void fire_missile(location target) { } } else if(cPlayer* pc = dynamic_cast(victim)) { if(cInvenSlot spec_item = pc->has_abil_equip(eItemAbil::HIT_CALL_SPECIAL)) { - short s1,s2,s3; - univ.party.force_ptr(21, pc->combat_pos.x); - univ.party.force_ptr(22, pc->combat_pos.y); - univ.party.force_ptr(20, univ.get_target_i(*pc)); - run_special(eSpecCtx::ATTACKED_RANGE, 0, spec_item->abil_data[0], missile_firer.combat_pos, &s1, &s2, &s3); - if(s1 > 0) - missile_firer.ap += (overall_mode == MODE_FIRING) ? 3 : 2; + short s1,s2,s3; + univ.party.force_ptr(21, pc->combat_pos.x); + univ.party.force_ptr(22, pc->combat_pos.y); + univ.party.force_ptr(20, univ.get_target_i(*pc)); + run_special(eSpecCtx::ATTACKED_RANGE, 0, spec_item->abil_data[0], missile_firer.combat_pos, &s1, &s2, &s3); + if(s1 > 0) + missile_firer.ap += (overall_mode == MODE_FIRING) ? 3 : 2; } } } @@ -2943,13 +2943,13 @@ void monster_attack(short who_att,iLiving* target) { if(pc_target != nullptr) { if(cInvenSlot spec_item = pc_target->has_abil_equip(eItemAbil::HIT_CALL_SPECIAL)) { - short s1,s2,s3; - univ.party.force_ptr(21, target->get_loc().x); - univ.party.force_ptr(22, target->get_loc().y); - univ.party.force_ptr(20, i_monst); - run_special(eSpecCtx::ATTACKED_MELEE, 0, spec_item->abil_data[0], attacker->cur_loc, &s1, &s2, &s3); - if(s1 > 0) - attacker->ap += 4; + short s1,s2,s3; + univ.party.force_ptr(21, target->get_loc().x); + univ.party.force_ptr(22, target->get_loc().y); + univ.party.force_ptr(20, i_monst); + run_special(eSpecCtx::ATTACKED_MELEE, 0, spec_item->abil_data[0], attacker->cur_loc, &s1, &s2, &s3); + if(s1 > 0) + attacker->ap += 4; } } else if(m_target != nullptr && m_target->abil[eMonstAbil::HIT_TRIGGER].active) { short s1,s2,s3; diff --git a/src/boe.graphutil.cpp b/src/boe.graphutil.cpp index 8fce1c9a6..7c1dd0504 100644 --- a/src/boe.graphutil.cpp +++ b/src/boe.graphutil.cpp @@ -225,56 +225,56 @@ void play_see_monster_str(unsigned short m, location monst_loc) { void draw_combat_pc(cPlayer& who, location center, bool attacking) { rectangle active_pc_rect; if(who.main_status == eMainStatus::ALIVE) - if(point_onscreen(center, who.combat_pos) && (cartoon_happening || party_can_see(who.combat_pos) < 6)) { - location where_draw(who.combat_pos.x - center.x + 4, who.combat_pos.y - center.y + 4); - rectangle source_rect; - sf::Texture* from_gw; - pic_num_t pic = who.which_graphic; - if(pic >= 1000) { - bool isParty = pic >= 10000; - pic_num_t need_pic = pic % 1000; - if(who.direction >= 4) - need_pic++; - if(attacking) - need_pic += 2; - graf_pos_ref(from_gw, source_rect) = spec_scen_g.find_graphic(need_pic, isParty); - } else if(pic >= 100) { - // Note that we assume it's a 1x1 graphic. - // PCs can't be larger than that, but we leave it to the scenario designer to avoid assigning larger graphics. - pic_num_t need_pic = pic - 100; - int mode = 0; - if(who.direction >= 4) - mode++; - if(attacking) - mode += 10; - source_rect = get_monster_template_rect(need_pic, mode, 0); - int which_sheet = m_pic_index[need_pic].i / 20; - from_gw = ResMgr::get("monst" + std::to_string(1 + which_sheet)).get(); - } else { - source_rect = calc_rect(2 * (pic / 8), pic % 8); - if(who.direction >= 4) - source_rect.offset(28,0); - if(attacking) - source_rect.offset(0,288); - from_gw = ResMgr::get("pcs").get(); - } - - Draw_Some_Item(*from_gw, source_rect, terrain_screen_gworld, where_draw, 1, 0); - + if(point_onscreen(center, who.combat_pos) && (cartoon_happening || party_can_see(who.combat_pos) < 6)) { + location where_draw(who.combat_pos.x - center.x + 4, who.combat_pos.y - center.y + 4); + rectangle source_rect; + sf::Texture* from_gw; + pic_num_t pic = who.which_graphic; + if(pic >= 1000) { + bool isParty = pic >= 10000; + pic_num_t need_pic = pic % 1000; + if(who.direction >= 4) + need_pic++; + if(attacking) + need_pic += 2; + graf_pos_ref(from_gw, source_rect) = spec_scen_g.find_graphic(need_pic, isParty); + } else if(pic >= 100) { + // Note that we assume it's a 1x1 graphic. + // PCs can't be larger than that, but we leave it to the scenario designer to avoid assigning larger graphics. + pic_num_t need_pic = pic - 100; + int mode = 0; + if(who.direction >= 4) + mode++; + if(attacking) + mode += 10; + source_rect = get_monster_template_rect(need_pic, mode, 0); + int which_sheet = m_pic_index[need_pic].i / 20; + from_gw = ResMgr::get("monst" + std::to_string(1 + which_sheet)).get(); + } else { + source_rect = calc_rect(2 * (pic / 8), pic % 8); + if(who.direction >= 4) + source_rect.offset(28,0); + if(attacking) + source_rect.offset(0,288); + from_gw = ResMgr::get("pcs").get(); } + + Draw_Some_Item(*from_gw, source_rect, terrain_screen_gworld, where_draw, 1, 0); + + } } void frame_active_pc(location center) { if(monsters_going) return; location where_draw(univ.current_pc().combat_pos.x - center.x + 4, univ.current_pc().combat_pos.y - center.y + 4); rectangle active_pc_rect; - active_pc_rect.top = 18 + where_draw.y * 36; - active_pc_rect.left = 18 + where_draw.x * 28; - active_pc_rect.bottom = 54 + where_draw.y * 36; - active_pc_rect.right = 46 + where_draw.x * 28; - active_pc_rect.offset(ul); - - frame_roundrect(mainPtr, active_pc_rect, 8, sf::Color::Magenta); + active_pc_rect.top = 18 + where_draw.y * 36; + active_pc_rect.left = 18 + where_draw.x * 28; + active_pc_rect.bottom = 54 + where_draw.y * 36; + active_pc_rect.right = 46 + where_draw.x * 28; + active_pc_rect.offset(ul); + + frame_roundrect(mainPtr, active_pc_rect, 8, sf::Color::Magenta); } void draw_pcs(location center) { diff --git a/src/boe.specials.cpp b/src/boe.specials.cpp index 7053588c1..df5582696 100644 --- a/src/boe.specials.cpp +++ b/src/boe.specials.cpp @@ -3409,14 +3409,14 @@ void ifthen_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type, for(cPlayer& pc : univ.party) if(pc.main_status == eMainStatus::ALIVE) if(cInvenSlot item = pc.has_class_equip(spec.ex1a)) { - *next_spec = spec.ex1b; - if(spec.ex2a > 0) { - *redraw = 1; - pc.take_item(item.slot); - if(&pc == &univ.party[stat_window]) - put_item_screen(stat_window); - } + *next_spec = spec.ex1b; + if(spec.ex2a > 0) { + *redraw = 1; + pc.take_item(item.slot); + if(&pc == &univ.party[stat_window]) + put_item_screen(stat_window); } + } break; case eSpecType::IF_DAY_REACHED: if(univ.party.calc_day() >= spec.ex1a) diff --git a/src/classes/party.cpp b/src/classes/party.cpp index 8bb68cf64..0238d7057 100644 --- a/src/classes/party.cpp +++ b/src/classes/party.cpp @@ -506,13 +506,13 @@ bool cParty::check_class(unsigned int item_class,bool take) { for(auto& pc : *this) if(pc.main_status == eMainStatus::ALIVE) if(cInvenSlot item = pc.has_class(item_class)) { - if(take) { - if(item->charges > 1) - item->charges--; - else pc.take_item(item.slot); - } - return true; + if(take) { + if(item->charges > 1) + item->charges--; + else pc.take_item(item.slot); } + return true; + } return false; }