Several more little tweaks/fixes

- Fix PCs sometimes taking damage when they shouldn't due to the marked damage field not being initialized
- Fix targeting not hitting the correct space when the screen is shifted
- Fix target space special node node being called in combat
- Move monster marked damage into cCreature
This commit is contained in:
2015-01-15 19:51:45 -05:00
parent 0b9593f3d1
commit 96f14d3a38
7 changed files with 13 additions and 11 deletions

View File

@@ -1157,6 +1157,7 @@ bool handle_action(sf::Event event) {
// Targeting a space
else if(overall_mode == MODE_SPELL_TARGET || overall_mode == MODE_FIRING || overall_mode == MODE_THROWING ||
overall_mode == MODE_FANCY_TARGET || overall_mode == MODE_TOWN_TARGET) {
destination = center;
destination.x += i - 4;
destination.y += j - 4;
handle_target_space(destination, did_something, need_redraw, need_reprint);

View File

@@ -66,8 +66,6 @@ extern short boom_gr[8];
const char *d_string[] = {"North", "NorthEast", "East", "SouthEast", "South", "SouthWest", "West", "NorthWest"};
short monst_marked_damage[60];
location hor_vert_place[14] = {
loc(0,0),loc(-1,1),loc(1,1),loc(-2,2),loc(0,2),
loc(2,2),loc(0,1),loc(-1,2),loc(1,2),loc(-1,3),
@@ -893,6 +891,11 @@ void do_combat_cast(location target) {
}
force_wall_position = 10;
// TODO: Should we do this here? Or in the handling of targeting modes?
// (It really depends whether we want to be able to trigger it for targeting something other than a spell.)
if(adjust <= 4 && !cast_spell_on_space(target, spell_being_cast))
return; // The special node intercepted and cancelled regular spell behaviour.
void_sanctuary(current_pc);
if(overall_mode == MODE_SPELL_TARGET) {
spell_targets[0] = target;
@@ -1377,10 +1380,10 @@ void handle_marked_damage() {
univ.party[i].marked_damage = 0;
}
for(i = 0; i < univ.town->max_monst(); i++)
if(monst_marked_damage[i] > 0) {
damage_monst(i, current_pc, monst_marked_damage[i], 0, eDamageType::MARKED,0); // was 9 rather than 10; probably a mistake
if(univ.town.monst[i].marked_damage > 0) {
damage_monst(i, current_pc, univ.town.monst[i].marked_damage, 0, eDamageType::MARKED,0);
monst_marked_damage[i] = 0;
univ.town.monst[i].marked_damage = 0;
}
}

View File

@@ -57,7 +57,6 @@ extern sf::Texture bg_gworld;
extern rectangle sbar_rect,item_sbar_rect,shop_sbar_rect;
extern std::shared_ptr<cScrollbar> text_sbar,item_sbar,shop_sbar;
extern location center;
extern short monst_marked_damage[60];
extern location store_anim_ul;
extern char light_area[13][13];
extern short terrain_there[9][9];
@@ -249,7 +248,7 @@ void start_missile_anim() {
for(i = 0; i < 6; i++)
univ.party[i].marked_damage = 0;
for(i = 0; i < univ.town->max_monst(); i++)
monst_marked_damage[i] = 0;
univ.town.monst[i].marked_damage = 0;
have_missile = false;
have_boom = false;
}

View File

@@ -67,7 +67,6 @@ extern short current_spell_range;
extern short hit_chance[21],combat_active_pc;
extern std::map<eDamageType,int> boom_gr;
extern short current_ground;
extern short monst_marked_damage[60];
extern location golem_m_locs[16];
extern cUniverse univ;
extern sf::Texture pc_gworld;

View File

@@ -38,7 +38,6 @@ extern location center;
extern bool in_scen_debug,belt_present,processing_fields,monsters_going,suppress_stat_screen,boom_anim_active;
extern effect_pat_type current_pat;
extern cOutdoors::cWandering store_wandering_special;
extern short monst_marked_damage[60];
extern eSpell spell_being_cast, town_spell;
extern sf::RenderWindow mini_map;
extern short fast_bang;
@@ -1495,7 +1494,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s
short boom_type = 2;
if(dam_type == eDamageType::FIRE)
boom_type = 0;
monst_marked_damage[which_m] += how_much;
univ.town.monst[which_m].marked_damage += how_much;
add_explosion(victim->cur_loc,how_much,0,boom_type,14 * (victim->x_width - 1),18 * (victim->y_width - 1));
// Note: Windows version printed an "undamaged" message here if applicable, but I don't think that's right.
if(how_much == 0)

View File

@@ -178,6 +178,7 @@ public:
short morale,m_morale; // these are calculated in-game based on the level
std::map<eStatus,short> status;
eDirection direction;
short marked_damage = 0; // for use during animations
cCreature();
cCreature(int num);

View File

@@ -46,7 +46,7 @@ public:
// transient stuff
std::map<eSkill,eSpell> last_cast;
location combat_pos;
short marked_damage, dir, parry, last_attacked;
short marked_damage = 0, dir, parry, last_attacked;
void finish_create();
void apply_status(eStatus which, int how_much);