diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 39053591..3b84d35d 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -56,7 +56,7 @@ extern short store_current_pc; extern short refer_mage[62],refer_priest[62]; //extern location monster_targs[60]; extern short combat_posing_monster , current_working_monster ; // 0-5 PC 100 + x - monster x - +extern cScenario scenario; extern short spell_caster, missile_firer,current_monst_tactic; char create_line[60]; short spell_being_cast; @@ -360,7 +360,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr univ.town.monst.dudes[i].cur_loc.y = get_ran(1,14,18); if (univ.town.monst.dudes[i].attitude == 2) univ.town.monst.dudes[i].cur_loc.y += 9; - else if ((univ.town.monst.dudes[i].m_d.mu > 0) || (univ.town.monst.dudes[i].m_d.cl > 0)) + else if ((univ.town.monst.dudes[i].mu > 0) || (univ.town.monst.dudes[i].cl > 0)) univ.town.monst.dudes[i].cur_loc.y -= 4;//max(12,univ.town.monst.dudes[i].m_loc.y - 4); num_tries = 0; while (((monst_can_be_there(univ.town.monst.dudes[i].cur_loc,i) == false) || @@ -371,7 +371,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr univ.town.monst.dudes[i].cur_loc.y = get_ran(1,14,18); if (univ.town.monst.dudes[i].attitude == 2) univ.town.monst.dudes[i].cur_loc.y += 9; - else if ((univ.town.monst.dudes[i].m_d.mu > 0) || (univ.town.monst.dudes[i].m_d.cl > 0)) + else if ((univ.town.monst.dudes[i].mu > 0) || (univ.town.monst.dudes[i].cl > 0)) univ.town.monst.dudes[i].cur_loc.y -= 4;//max(12,univ.town.monst.dudes[i].m_loc.y - 4); } if (get_blockage(combat_terrain[univ.town.monst.dudes[i].cur_loc.x][univ.town.monst.dudes[i].cur_loc.y]) > 0) @@ -488,8 +488,8 @@ bool pc_combat_move(location destination) //// if ((monst_exist > 0) && (monst_adjacent(pc_pos[current_pc],i) == true) && (monst_adjacent(destination,i) == false) && (univ.town.monst.dudes[i].attitude % 2 == 1) && - (univ.town.monst.dudes[i].m_d.status[11] <= 0) && - (univ.town.monst.dudes[i].m_d.status[12] <= 0)) { + (univ.town.monst.dudes[i].status[11] <= 0) && + (univ.town.monst.dudes[i].status[12] <= 0)) { combat_posing_monster = current_working_monster = 100 + i; monster_attack_pc(i,current_pc); combat_posing_monster = current_working_monster = -1; @@ -557,13 +557,13 @@ void pc_attack(short who_att,short target)//// weap1 = i; else weap2 = i; - hit_adj = (-5 * minmax(-8,8,ADVEN[who_att].status[1])) + 5 * minmax(-8,8,which_m->m_d.status[1]) + hit_adj = (-5 * minmax(-8,8,ADVEN[who_att].status[1])) + 5 * minmax(-8,8,which_m->status[1]) - stat_adj(who_att,1) * 5 + (get_encumberance(who_att)) * 5; - dam_adj = minmax(-8,8,ADVEN[who_att].status[1]) - minmax(-8,8,which_m->m_d.status[1]) + dam_adj = minmax(-8,8,ADVEN[who_att].status[1]) - minmax(-8,8,which_m->status[1]) + stat_adj(who_att,0); - if ((which_m->m_d.status[11] > 0) || (which_m->m_d.status[12] > 0)) { + if ((which_m->status[11] > 0) || (which_m->status[12] > 0)) { hit_adj -= 80; dam_adj += 10; } @@ -580,7 +580,7 @@ void pc_attack(short who_att,short target)//// void_sanctuary(who_att); - store_hp = univ.town.monst.dudes[target].m_d.health; + store_hp = univ.town.monst.dudes[target].health; combat_posing_monster = current_working_monster = who_att; @@ -636,10 +636,10 @@ void pc_attack(short who_att,short target)//// // assassinate r1 = get_ran(1,1,100); - if ((ADVEN[who_att].level >= which_m->m_d.level - 1) - && (ADVEN[who_att].skills[16] >= which_m->m_d.level / 2) - && (which_m->m_d.spec_skill != 12)) // Can't assassinate splitters - if (r1 < hit_chance[max(ADVEN[who_att].skills[16] - which_m->m_d.level,0)]) { + if ((ADVEN[who_att].level >= which_m->level - 1) + && (ADVEN[who_att].skills[16] >= which_m->level / 2) + && (which_m->spec_skill != 12)) // Can't assassinate splitters + if (r1 < hit_chance[max(ADVEN[who_att].skills[16] - which_m->level,0)]) { add_string_to_buf(" You assassinate. "); spec_dam += r2; } @@ -751,10 +751,10 @@ void pc_attack(short who_att,short target)//// ADVEN[who_att].status[0] = move_to_zero(ADVEN[who_att].status[0]); take_ap(4); - if (((univ.town.monst.dudes[target].m_d.status[10] > 0) || (univ.town.monst.dudes[target].m_d.spec_skill == 22)) - && (store_hp - univ.town.monst.dudes[target].m_d.health > 0)) { + if (((univ.town.monst.dudes[target].status[10] > 0) || (univ.town.monst.dudes[target].spec_skill == 22)) + && (store_hp - univ.town.monst.dudes[target].health > 0)) { add_string_to_buf(" Shares damage! "); - damage_pc(who_att, store_hp - univ.town.monst.dudes[target].m_d.health, DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); + damage_pc(who_att, store_hp - univ.town.monst.dudes[target].health, DAMAGE_MAGIC,MONSTER_TYPE_UNKNOWN,0); } combat_posing_monster = current_working_monster = -1; @@ -770,39 +770,39 @@ short calc_spec_dam(short abil,short abil_str,cCreature *monst) //// store += get_ran(abil_str,1,6); break; case 2: - if (monst->m_d.m_type == 7) + if (monst->m_type == 7) store += 8 * abil_str; break; case 175: - if (monst->m_d.m_type == 7) + if (monst->m_type == 7) store += 25 + 8 * abil_str; break; case 174: - if (monst->m_d.m_type == 8) + if (monst->m_type == 8) store += 20 + 6 * abil_str; break; case 3: - if (monst->m_d.m_type == 8) + if (monst->m_type == 8) store += 6 * abil_str; break; case 4: - if (monst->m_d.m_type == 1) + if (monst->m_type == 1) store += 5 * abil_str; break; case 5: - if (monst->m_d.m_type == 9) + if (monst->m_type == 9) store += 8 * abil_str; break; case 6: - if (monst->m_d.m_type == 4) + if (monst->m_type == 4) store += 4 * abil_str; break; case 7: - if (monst->m_d.m_type == 5) + if (monst->m_type == 5) store += 4 * abil_str; break; case 8: - if (monst->m_d.m_type == 12) + if (monst->m_type == 12) store += 7 * abil_str; break; case 13: @@ -1200,7 +1200,7 @@ void do_combat_cast(location target)//// case 52: // Mindduel! store_m_type = -1; - if ((cur_monst->m_d.mu == 0) && (cur_monst->m_d.cl == 0)) + if ((cur_monst->mu == 0) && (cur_monst->cl == 0)) add_string_to_buf(" Can't duel: no magic."); else { item = pc_has_abil(current_pc,159); @@ -1226,7 +1226,7 @@ void do_combat_cast(location target)//// case 62: store_m_type = 14; - cur_monst->m_d.health += 20; + cur_monst->health += 20; store_sound = 55; break; @@ -1290,14 +1290,14 @@ void do_combat_cast(location target)//// break; case 103: case 132: - if (cur_monst->m_d.m_type != 8) { + if (cur_monst->m_type != 8) { add_string_to_buf(" Not undead. "); store_m_type = -1; break; } store_m_type = 8; r1 = get_ran(1,0,90); - if (r1 > hit_chance[minmax(0,19,bonus * 2 + level * 4 - (cur_monst->m_d.level / 2) + 3)]) + if (r1 > hit_chance[minmax(0,19,bonus * 2 + level * 4 - (cur_monst->level / 2) + 3)]) add_string_to_buf(" Monster resisted. "); else { r1 = get_ran((spell_being_cast == 103) ? 2 : 6, 1, 14); @@ -1307,13 +1307,13 @@ void do_combat_cast(location target)//// break; case 155: - if (cur_monst->m_d.m_type != 7) { + if (cur_monst->m_type != 7) { add_string_to_buf(" Not a demon. "); store_m_type = -1; break; } r1 = get_ran(1,1,100); - if (r1 > hit_chance[minmax(0,19,level * 4 - cur_monst->m_d.level + 10)]) + if (r1 > hit_chance[minmax(0,19,level * 4 - cur_monst->level + 10)]) add_string_to_buf(" Demon resisted. "); else { r1 = get_ran(8 + bonus * 2, 1, 11); @@ -1326,7 +1326,7 @@ void do_combat_cast(location target)//// } if (store_m_type >= 0) add_missile(target,store_m_type,1, - 14 * (cur_monst->m_d.x_width - 1),18 * (cur_monst->m_d.y_width - 1)); + 14 * (cur_monst->x_width - 1),18 * (cur_monst->y_width - 1)); } break; @@ -1532,7 +1532,7 @@ void fire_missile(location target) { ADVEN[missile_firer].items[ammo_inv_slot].ability_strength,cur_monst); if (ADVEN[missile_firer].items[ammo_inv_slot].ability == 176) { ASB(" There is a flash of light."); - cur_monst->m_d.health += r2; + cur_monst->health += r2; } else damage_monst(targ_monst, missile_firer, r2, spec_dam, DAMAGE_WEAPON,13); @@ -1801,38 +1801,38 @@ void do_monster_turn() } // End of seeing if monsters see others - cur_monst->m_d.ap = 0; + cur_monst->ap = 0; if (cur_monst->active == 2) { // Begin action loop for angry, active monsters // First note that hostile monsters are around. if (cur_monst->attitude % 2 == 1) PSD[SDF_HOSTILES_PRESENT] = 30; // Give monster its action points - cur_monst->m_d.ap = cur_monst->m_d.speed; + cur_monst->ap = cur_monst->speed; if (is_town()) - cur_monst->m_d.ap = max(1,cur_monst->m_d.ap / 3); + cur_monst->ap = max(1,cur_monst->ap / 3); if (univ.party.age % 2 == 0) - if (cur_monst->m_d.status[3] < 0) - cur_monst->m_d.ap = 0; - if (cur_monst->m_d.ap > 0) { // adjust for webs - cur_monst->m_d.ap = max(0,cur_monst->m_d.ap - cur_monst->m_d.status[6] / 2); - if (cur_monst->m_d.ap == 0) - cur_monst->m_d.status[6] = max(0,cur_monst->m_d.status[6] - 2); + if (cur_monst->status[3] < 0) + cur_monst->ap = 0; + if (cur_monst->ap > 0) { // adjust for webs + cur_monst->ap = max(0,cur_monst->ap - cur_monst->status[6] / 2); + if (cur_monst->ap == 0) + cur_monst->status[6] = max(0,cur_monst->status[6] - 2); } - if (cur_monst->m_d.status[3] > 0) - cur_monst->m_d.ap *= 2; + if (cur_monst->status[3] > 0) + cur_monst->ap *= 2; } - if ((cur_monst->m_d.status[11] > 0) || (cur_monst->m_d.status[12] > 0)) - cur_monst->m_d.ap = 0; + if ((cur_monst->status[11] > 0) || (cur_monst->status[12] > 0)) + cur_monst->ap = 0; if (in_scen_debug == true) - cur_monst->m_d.ap = 0; + cur_monst->ap = 0; center_on_monst = false; // Now take care of summoned monsters if (cur_monst->active > 0) { if ((cur_monst->summoned % 100) == 1) { cur_monst->active = 0; - cur_monst->m_d.ap = 0; + cur_monst->ap = 0; monst_spell_note(cur_monst->number,17); } cur_monst->summoned = move_to_zero(cur_monst->summoned); @@ -1857,7 +1857,7 @@ void do_monster_turn() - while ((cur_monst->m_d.ap > 0) && (cur_monst->active > 0)) { // Spend each action point + while ((cur_monst->ap > 0) && (cur_monst->active > 0)) { // Spend each action point if (is_combat()) { // Pick target. If in town, target already picked // in do_monsters @@ -1893,9 +1893,9 @@ void do_monster_turn() } // Draw w. monster in center, if can see - if ((cur_monst->m_d.ap > 0) && (is_combat() == true) + if ((cur_monst->ap > 0) && (is_combat() == true) // First make sure it has a target and is close, if not, don't bother - && (cur_monst->attitude > 0) && (cur_monst->m_d.picture_num > 0) + && (cur_monst->attitude > 0) && (cur_monst->picture_num > 0) && ((target != 6) || (cur_monst->attitude % 2 == 1)) && (party_can_see_monst(i) == true) ) { center_on_monst = true; @@ -1913,15 +1913,15 @@ void do_monster_turn() // This only happens when there is >1 a.p. left, and tends to involve // running to a nice position. current_monst_tactic = 0; - if ((target != 6) && (cur_monst->m_d.ap > 1) && (futzing == 0)) { + if ((target != 6) && (cur_monst->ap > 1) && (futzing == 0)) { l = closest_pc_loc(cur_monst->cur_loc); - if (((cur_monst->m_d.mu > 0) || (cur_monst->m_d.cl > 0)) && + if (((cur_monst->mu > 0) || (cur_monst->cl > 0)) && (dist(cur_monst->cur_loc,l) < 5) && (monst_adjacent(l,i) == false)) current_monst_tactic = 1; // this means flee - if ( (((cur_monst->m_d.spec_skill > 0) && (cur_monst->m_d.spec_skill < 4)) - || (cur_monst->m_d.spec_skill == 20)) && // Archer? + if ( (((cur_monst->spec_skill > 0) && (cur_monst->spec_skill < 4)) + || (cur_monst->spec_skill == 20)) && // Archer? (dist(cur_monst->cur_loc,targ_space) < 6) && (monst_adjacent(targ_space,i) == false)) current_monst_tactic = 1; // this means flee @@ -1929,16 +1929,16 @@ void do_monster_turn() // flee - if ((univ.town.monst.dudes[i].target != 6) && (((cur_monst->m_d.morale <= 0) - && (cur_monst->m_d.spec_skill != 13) && (cur_monst->m_d.m_type != 8)) + if ((univ.town.monst.dudes[i].target != 6) && (((cur_monst->morale <= 0) + && (cur_monst->spec_skill != 13) && (cur_monst->m_type != 8)) || (current_monst_tactic == 1))) { - if (cur_monst->m_d.morale < 0) - cur_monst->m_d.morale++; - if (cur_monst->m_d.health > 50) - cur_monst->m_d.morale++; + if (cur_monst->morale < 0) + cur_monst->morale++; + if (cur_monst->health > 50) + cur_monst->morale++; r1 = get_ran(1,1,6); if (r1 == 3) - cur_monst->m_d.morale++; + cur_monst->morale++; if ((ADVEN[univ.town.monst.dudes[i].target].main_status == 1) && (cur_monst->mobility == 1)) { acted_yet = flee_party (i,cur_monst->cur_loc,targ_space); if (acted_yet == true) take_m_ap(1,cur_monst); @@ -1948,26 +1948,26 @@ void do_monster_turn() && (monst_can_see(i,targ_space) == true) && (can_see_monst(targ_space,i) == true)) { // Begin spec. attacks -// sprintf((char *)create_line,"%d: %d %d %d",i,cur_monst->m_d.breath,cur_monst->m_d.mu,cur_monst->m_d.cl); +// sprintf((char *)create_line,"%d: %d %d %d",i,cur_monst->breath,cur_monst->mu,cur_monst->cl); // add_string_to_buf((char *)create_line); // Breathe (fire) - if ( (cur_monst->m_d.breath > 0) + if ( (cur_monst->breath > 0) && (get_ran(1,1,8) < 4) && (acted_yet == false)) { - //print_nums(cur_monst->m_d.breath,cur_monst->m_d.breath_type,dist(cur_monst->m_loc,targ_space) ); + //print_nums(cur_monst->breath,cur_monst->breath_type,dist(cur_monst->m_loc,targ_space) ); if ((target != 6) && (dist(cur_monst->cur_loc,targ_space) <= 8)) { - acted_yet = monst_breathe(cur_monst,targ_space,cur_monst->m_d.breath_type); + acted_yet = monst_breathe(cur_monst,targ_space,cur_monst->breath_type); had_monst = true; acted_yet = true; take_m_ap(4,cur_monst); } } // Mage spell - if ((cur_monst->m_d.mu > 0) && (get_ran(1,1,10) < ((cur_monst->m_d.cl > 0) ? 6 : 9) ) + if ((cur_monst->mu > 0) && (get_ran(1,1,10) < ((cur_monst->cl > 0) ? 6 : 9) ) && (acted_yet == false)) { if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->number >= 160) - || (cur_monst->m_d.level > 9)) + || (cur_monst->level > 9)) && (dist(cur_monst->cur_loc,targ_space) <= 10)) { acted_yet = monst_cast_mage(cur_monst,target); had_monst = true; @@ -1976,8 +1976,8 @@ void do_monster_turn() } } // Priest spell - if ((cur_monst->m_d.cl > 0) && (get_ran(1,1,8) < 7) && (acted_yet == false)) { - if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->m_d.level > 9)) + if ((cur_monst->cl > 0) && (get_ran(1,1,8) < 7) && (acted_yet == false)) { + if (((monst_adjacent(targ_space,i) == false) || (get_ran(1,0,2) < 2) || (cur_monst->level > 9)) && (dist(cur_monst->cur_loc,targ_space) <= 10)) { acted_yet = monst_cast_priest(cur_monst,target); had_monst = true; @@ -1987,23 +1987,23 @@ void do_monster_turn() } // Missile - if ((abil_range[cur_monst->m_d.spec_skill] > 0) // breathing gas short range - && (get_ran(1,1,8) < abil_odds[cur_monst->m_d.spec_skill]) && (acted_yet == false)) { + if ((abil_range[cur_monst->spec_skill] > 0) // breathing gas short range + && (get_ran(1,1,8) < abil_odds[cur_monst->spec_skill]) && (acted_yet == false)) { // Don't fire when adjacent, unless non-gaze magical attack if (((monst_adjacent(targ_space,i) == false) || - ((cur_monst->m_d.spec_skill > 7) && (cur_monst->m_d.spec_skill != 20) - && (cur_monst->m_d.spec_skill != 33))) + ((cur_monst->spec_skill > 7) && (cur_monst->spec_skill != 20) + && (cur_monst->spec_skill != 33))) // missile range - && (dist(cur_monst->cur_loc,targ_space) <= abil_range[cur_monst->m_d.spec_skill])) { + && (dist(cur_monst->cur_loc,targ_space) <= abil_range[cur_monst->spec_skill])) { print_monst_name(cur_monst->number); - monst_fire_missile(i/*,cur_monst->m_d.skill*/,cur_monst->m_d.status[1], - cur_monst->m_d.spec_skill,cur_monst->cur_loc,target); + monst_fire_missile(i/*,cur_monst->skill*/,cur_monst->status[1], + cur_monst->spec_skill,cur_monst->cur_loc,target); // Vapors don't count as action - if ((cur_monst->m_d.spec_skill == 11) || (cur_monst->m_d.spec_skill == 7) || - (cur_monst->m_d.spec_skill == 20)) + if ((cur_monst->spec_skill == 11) || (cur_monst->spec_skill == 7) || + (cur_monst->spec_skill == 20)) take_m_ap(2,cur_monst); - else if (cur_monst->m_d.spec_skill == 10) + else if (cur_monst->spec_skill == 10) take_m_ap(1,cur_monst); else take_m_ap(3,cur_monst); had_monst = true; @@ -2098,30 +2098,30 @@ void do_monster_turn() // Place fields for monsters that create them. Only done when monst sees foe if ((target != 6) && (can_see(cur_monst->cur_loc,targ_space,0) < 5)) { //// - if ((cur_monst->m_d.radiate_1 == 1) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->radiate_1 == 1) && (get_ran(1,1,100) < cur_monst->radiate_2)) place_spell_pattern(square,cur_monst->cur_loc,5,false,7); - if ((cur_monst->m_d.radiate_1 == 2) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->radiate_1 == 2) && (get_ran(1,1,100) < cur_monst->radiate_2)) place_spell_pattern(square,cur_monst->cur_loc,8,false,7); - if ((cur_monst->m_d.radiate_1 == 3) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->radiate_1 == 3) && (get_ran(1,1,100) < cur_monst->radiate_2)) place_spell_pattern(square,cur_monst->cur_loc,4,false,7); - if ((cur_monst->m_d.radiate_1 == 4) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->radiate_1 == 4) && (get_ran(1,1,100) < cur_monst->radiate_2)) place_spell_pattern(square,cur_monst->cur_loc,6,false,7); - if ((cur_monst->m_d.radiate_1 == 5) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->radiate_1 == 5) && (get_ran(1,1,100) < cur_monst->radiate_2)) place_spell_pattern(square,cur_monst->cur_loc,12,false,7); - if ((cur_monst->m_d.radiate_1 == 6) && (get_ran(1,1,100) < cur_monst->m_d.radiate_2)) + if ((cur_monst->radiate_1 == 6) && (get_ran(1,1,100) < cur_monst->radiate_2)) place_spell_pattern(square,cur_monst->cur_loc,7,false,7); - if ((cur_monst->m_d.radiate_1 == 10) && (get_ran(1,1,100) < 5)){ - if (summon_monster(cur_monst->m_d.radiate_2, + if ((cur_monst->radiate_1 == 10) && (get_ran(1,1,100) < 5)){ + if (summon_monster(cur_monst->radiate_2, cur_monst->cur_loc,130,cur_monst->attitude) == true) {monst_spell_note(cur_monst->number,33); play_sound(61);} } - if ((cur_monst->m_d.radiate_1 == 11) && (get_ran(1,1,100) < 20)){ - if (summon_monster(cur_monst->m_d.radiate_2, + if ((cur_monst->radiate_1 == 11) && (get_ran(1,1,100) < 20)){ + if (summon_monster(cur_monst->radiate_2, cur_monst->cur_loc,130,cur_monst->attitude) == true) {monst_spell_note(cur_monst->number,33); play_sound(61);} } - if ((cur_monst->m_d.radiate_1 == 12) && (get_ran(1,1,100) < 50)){ - if (summon_monster(cur_monst->m_d.radiate_2, + if ((cur_monst->radiate_1 == 12) && (get_ran(1,1,100) < 50)){ + if (summon_monster(cur_monst->radiate_2, cur_monst->cur_loc,130,cur_monst->attitude) == true) {monst_spell_note(cur_monst->number,33); play_sound(61);} } @@ -2129,8 +2129,8 @@ void do_monster_turn() combat_posing_monster = current_working_monster = -1; // Redraw monster after it goes - if ((cur_monst->attitude > 0) && (cur_monst->active > 0) && (cur_monst->m_d.ap == 0) - && (is_combat()) && (cur_monst->m_d.picture_num > 0) && (party_can_see_monst(i) == true)) { + if ((cur_monst->attitude > 0) && (cur_monst->active > 0) && (cur_monst->ap == 0) + && (is_combat()) && (cur_monst->picture_num > 0) && (party_can_see_monst(i) == true)) { center = cur_monst->cur_loc; draw_terrain(0); @@ -2138,12 +2138,12 @@ void do_monster_turn() // If monster dead, take away actions if (cur_monst->active == 0) - cur_monst->m_d.ap = 0; + cur_monst->ap = 0; //if ((futzing == 1) && (get_ran(1,0,1) == 0)) // If monster's just pissing around, give up - // cur_monst->m_d.ap = 0; + // cur_monst->ap = 0; if (futzing > 1) // If monster's just pissing around, give up - cur_monst->m_d.ap = 0; + cur_monst->ap = 0; } // End of monster action loop @@ -2159,36 +2159,36 @@ void do_monster_turn() if ((cur_monst->active < 0) || (cur_monst->active > 2)) cur_monst->active = 0; // clean up if (cur_monst->active != 0) { // Take care of monster effects - if (cur_monst->m_d.status[13] > 0) { // Acid + if (cur_monst->status[13] > 0) { // Acid if (printed_acid == false) { add_string_to_buf("Acid: "); printed_acid = true; } - r1 = get_ran(cur_monst->m_d.status[13],1,6); + r1 = get_ran(cur_monst->status[13],1,6); damage_monst(i, 6,r1, 0, DAMAGE_MAGIC,0); - cur_monst->m_d.status[13]--; + cur_monst->status[13]--; } - if (cur_monst->m_d.status[11] == 1) + if (cur_monst->status[11] == 1) monst_spell_note(cur_monst->number,29); - cur_monst->m_d.status[11] = move_to_zero(cur_monst->m_d.status[11]); - cur_monst->m_d.status[12] = move_to_zero(cur_monst->m_d.status[12]); + cur_monst->status[11] = move_to_zero(cur_monst->status[11]); + cur_monst->status[12] = move_to_zero(cur_monst->status[12]); if (univ.party.age % 2 == 0) { - cur_monst->m_d.status[1] = move_to_zero(cur_monst->m_d.status[1]); - cur_monst->m_d.status[3] = move_to_zero(cur_monst->m_d.status[3]); - cur_monst->m_d.status[6] = move_to_zero(cur_monst->m_d.status[6]); + cur_monst->status[1] = move_to_zero(cur_monst->status[1]); + cur_monst->status[3] = move_to_zero(cur_monst->status[3]); + cur_monst->status[6] = move_to_zero(cur_monst->status[6]); - if (cur_monst->m_d.status[2] > 0) { // Poison + if (cur_monst->status[2] > 0) { // Poison if (printed_poison == false) { add_string_to_buf("Poisoned monsters: "); printed_poison = true; } - r1 = get_ran(cur_monst->m_d.status[2],1,6); + r1 = get_ran(cur_monst->status[2],1,6); damage_monst(i, 6, r1, 0, DAMAGE_POISON,0); - cur_monst->m_d.status[2]--; + cur_monst->status[2]--; } - if (cur_monst->m_d.status[7] > 0) { // Disease + if (cur_monst->status[7] > 0) { // Disease if (printed_disease == false) { add_string_to_buf("Diseased monsters: "); printed_disease = true; @@ -2201,15 +2201,15 @@ void do_monster_turn() case 5: scare_monst(cur_monst,10); break; } if (get_ran(1,1,6) < 4) - cur_monst->m_d.status[7]--; + cur_monst->status[7]--; } } if (univ.party.age % 4 == 0) { - if (cur_monst->m_d.mp < cur_monst->m_d.max_mp) - cur_monst->m_d.mp += 2; - cur_monst->m_d.status[9] = move_to_zero(cur_monst->m_d.status[9]); + if (cur_monst->mp < cur_monst->max_mp) + cur_monst->mp += 2; + cur_monst->status[9] = move_to_zero(cur_monst->status[9]); } } // end take care of monsters } @@ -2241,43 +2241,43 @@ void monster_attack_pc(short who_att,short target) // Draw attacker frames if ((is_combat()) && ((center_on_monst == true) || (monsters_going == false))) { - if (attacker->m_d.spec_skill != 11) - frame_space(attacker->cur_loc,0,attacker->m_d.x_width,attacker->m_d.y_width); + if (attacker->spec_skill != 11) + frame_space(attacker->cur_loc,0,attacker->x_width,attacker->y_width); frame_space(pc_pos[target],1,1,1); } - if ((attacker->m_d.a[0] != 0) || (attacker->m_d.a[2] != 0)) + if ((attacker->a[0] != 0) || (attacker->a[2] != 0)) print_monst_attacks(attacker->number,target); // Check sanctuary if (ADVEN[target].status[8] > 0) { r1 = get_ran(1,1,100); - if (r1 > hit_chance[attacker->m_d.level / 2]) { + if (r1 > hit_chance[attacker->level / 2]) { add_string_to_buf(" Can't find target! "); } return; } for (i = 0; i < 3; i++) { - if ((attacker->m_d.a[i] > 0) && (ADVEN[target].main_status == 1)) { + if ((attacker->a[i] > 0) && (ADVEN[target].main_status == 1)) { // sprintf ((char *) create_line, " Attacks %s.",(char *) ADVEN[target].name); // add_string_to_buf((char *) create_line); // Attack roll - r1 = get_ran(1,1,100) - 5 * min(8,attacker->m_d.status[1]) + 5 * ADVEN[target].status[1] + r1 = get_ran(1,1,100) - 5 * min(8,attacker->status[1]) + 5 * ADVEN[target].status[1] + 5 * stat_adj(target,1) - 15; - r1 += 5 * (attacker->m_d.status[6] / 3); + r1 += 5 * (attacker->status[6] / 3); if (pc_parry[target] < 100) r1 += 5 * pc_parry[target]; // Damage roll - r2 = get_ran(attacker->m_d.a[i] / 100 + 1,1,attacker->m_d.a[i] % 100) - + min(8,attacker->m_d.status[1]) - ADVEN[target].status[1] + 1; - if (difficulty_adjust() > 2) + r2 = get_ran(attacker->a[i] / 100 + 1,1,attacker->a[i] % 100) + + min(8,attacker->status[1]) - ADVEN[target].status[1] + 1; + if (univ.difficulty_adjust() > 2) r2 = r2 * 2; - if (difficulty_adjust() == 2) + if (univ.difficulty_adjust() == 2) r2 = (r2 * 3) / 2; if ((ADVEN[target].status[11] > 0) || (ADVEN[target].status[12] > 0)) { @@ -2287,32 +2287,32 @@ void monster_attack_pc(short who_att,short target) draw_terrain(2); // Check if hit, and do effects - if (r1 <= hit_chance[(attacker->m_d.skill + 4) / 2]) { - if (attacker->m_d.m_type == MONSTER_TYPE_UNDEAD) + if (r1 <= hit_chance[(attacker->skill + 4) / 2]) { + if (attacker->m_type == MONSTER_TYPE_UNDEAD) dam_type = DAMAGE_UNDEAD; - if (attacker->m_d.m_type == MONSTER_TYPE_DEMON) + if (attacker->m_type == MONSTER_TYPE_DEMON) dam_type = DAMAGE_DEMON; store_hp = ADVEN[target].cur_health; sound_type = get_monst_sound(attacker,i); dam_type += DAMAGE_MARKED; if (damage_pc(target,r2,dam_type, - attacker->m_d.m_type,sound_type) && + attacker->m_type,sound_type) && (store_hp - ADVEN[target].cur_health > 0)) { damaged_message(store_hp - ADVEN[target].cur_health, - (i > 0) ? attacker->m_d.a23_type : attacker->m_d.a1_type); + (i > 0) ? attacker->a23_type : attacker->a1_type); if (ADVEN[target].status[10] > 0) { add_string_to_buf(" Shares damage! "); damage_monst(who_att, 6, store_hp - ADVEN[target].cur_health, 0, DAMAGE_MAGIC,0); } - if ((attacker->m_d.poison > 0) && (i == 0)) { - poison_pc(target,attacker->m_d.poison); + if ((attacker->poison > 0) && (i == 0)) { + poison_pc(target,attacker->poison); } // Gremlin - if ((attacker->m_d.spec_skill == 21) && (get_ran(1,0,2) < 2)) { + if ((attacker->spec_skill == 21) && (get_ran(1,0,2) < 2)) { add_string_to_buf(" Steals food! "); print_buf(); play_sound(26); @@ -2321,15 +2321,15 @@ void monster_attack_pc(short who_att,short target) } // Disease - if (((attacker->m_d.spec_skill == 25)) + if (((attacker->spec_skill == 25)) && (get_ran(1,0,2) < 2)) { add_string_to_buf(" Causes disease! "); print_buf(); - disease_pc(target,(attacker->m_d.spec_skill == 25) ? 6 : 2); + disease_pc(target,(attacker->spec_skill == 25) ? 6 : 2); } // Petrification touch - if ((attacker->m_d.spec_skill == 30) + if ((attacker->spec_skill == 30) && (pc_has_abil_equip(target,49) == 24) && (get_ran(1,0,20) + ADVEN[target].level / 4 + ADVEN[target].status[1]) <= 14) { @@ -2339,59 +2339,59 @@ void monster_attack_pc(short who_att,short target) } // Undead xp drain - if (((attacker->m_d.spec_skill == 16) || (attacker->m_d.spec_skill == 17)) + if (((attacker->spec_skill == 16) || (attacker->spec_skill == 17)) && (pc_has_abil_equip(target,48) == 24)) { add_string_to_buf(" Drains life! "); - drain_pc(target,(attacker->m_d.level * 3) / 2); + drain_pc(target,(attacker->level * 3) / 2); put_pc_screen(); } // Undead slow - if ((attacker->m_d.spec_skill == 18) && (get_ran(1,0,8) < 6) && (pc_has_abil_equip(target,48) == 24)) { + if ((attacker->spec_skill == 18) && (get_ran(1,0,8) < 6) && (pc_has_abil_equip(target,48) == 24)) { add_string_to_buf(" Stuns! "); slow_pc(target,2); put_pc_screen(); } // Dumbfound target - if (attacker->m_d.spec_skill == 24) { + if (attacker->spec_skill == 24) { add_string_to_buf(" Dumbfounds! "); dumbfound_pc(target,2); put_pc_screen(); } // Web target - if (attacker->m_d.spec_skill == 27) { + if (attacker->spec_skill == 27) { add_string_to_buf(" Webs! "); web_pc(target,5); put_pc_screen(); } // Sleep target - if (attacker->m_d.spec_skill == 28) { + if (attacker->spec_skill == 28) { add_string_to_buf(" Sleeps! "); sleep_pc(target,6,STATUS_ASLEEP,-15); put_pc_screen(); } // Paralyze target - if (attacker->m_d.spec_skill == 29) { + if (attacker->spec_skill == 29) { add_string_to_buf(" Paralysis touch! "); sleep_pc(target,500,STATUS_PARALYZED,-5); put_pc_screen(); } // Acid touch - if (attacker->m_d.spec_skill == 31) { + if (attacker->spec_skill == 31) { add_string_to_buf(" Acid touch! "); - acid_pc(target,(attacker->m_d.level > 20) ? 4 : 2); + acid_pc(target,(attacker->level > 20) ? 4 : 2); } // Freezing touch - if (((attacker->m_d.spec_skill == 15) || (attacker->m_d.spec_skill == 17)) + if (((attacker->spec_skill == 15) || (attacker->spec_skill == 17)) && (get_ran(1,0,8) < 6) && (pc_has_abil_equip(target,48) == 24)) { add_string_to_buf(" Freezing touch!"); r1 = get_ran(3,1,10); damage_pc(target,r1,DAMAGE_COLD,MONSTER_TYPE_UNKNOWN,0); } // Killing touch - if (attacker->m_d.spec_skill == 35) + if (attacker->spec_skill == 35) { add_string_to_buf(" Killing touch!"); r1 = get_ran(20,1,10); @@ -2428,16 +2428,16 @@ void monster_attack_monster(short who_att,short attackee) // Draw attacker frames if ((is_combat()) && ((center_on_monst == true) || (monsters_going == false))) { - if (attacker->m_d.spec_skill != 11) - frame_space(attacker->cur_loc,0,attacker->m_d.x_width,attacker->m_d.y_width); + if (attacker->spec_skill != 11) + frame_space(attacker->cur_loc,0,attacker->x_width,attacker->y_width); frame_space(target->cur_loc,1,1,1); } - if ((attacker->m_d.a[1] != 0) || (attacker->m_d.a[0] != 0)) + if ((attacker->a[1] != 0) || (attacker->a[0] != 0)) print_monst_attacks(attacker->number,100 + attackee); for (i = 0; i < 3; i++) { - if ((attacker->m_d.a[i] > 0) && (target->active != 0)) { + if ((attacker->a[i] > 0) && (target->active != 0)) { // sprintf ((char *) create_line, " Attacks %s.",(char *) ADVEN[target].name); // add_string_to_buf((char *) create_line); @@ -2446,72 +2446,72 @@ void monster_attack_monster(short who_att,short attackee) target->attitude = 2; // Attack roll - r1 = get_ran(1,1,100) - 5 * min(10,attacker->m_d.status[1]) - + 5 * target->m_d.status[1] - 15; - r1 += 5 * (attacker->m_d.status[6] / 3); + r1 = get_ran(1,1,100) - 5 * min(10,attacker->status[1]) + + 5 * target->status[1] - 15; + r1 += 5 * (attacker->status[6] / 3); // Damage roll - r2 = get_ran(attacker->m_d.a[i] / 100 + 1,1,attacker->m_d.a[i] % 100) - + min(10,attacker->m_d.status[1]) - target->m_d.status[1] + 2; + r2 = get_ran(attacker->a[i] / 100 + 1,1,attacker->a[i] % 100) + + min(10,attacker->status[1]) - target->status[1] + 2; - if ((target->m_d.status[11] > 0) || (target->m_d.status[12] > 0)) { + if ((target->status[11] > 0) || (target->status[12] > 0)) { r1 -= 80; r2 = r2 * 2; } draw_terrain(2); // Check if hit, and do effects - if (r1 <= hit_chance[(attacker->m_d.skill + 4) / 2]) { - if (attacker->m_d.m_type == MONSTER_TYPE_DEMON) + if (r1 <= hit_chance[(attacker->skill + 4) / 2]) { + if (attacker->m_type == MONSTER_TYPE_DEMON) dam_type = DAMAGE_DEMON; - if (attacker->m_d.m_type == MONSTER_TYPE_UNDEAD) + if (attacker->m_type == MONSTER_TYPE_UNDEAD) dam_type = DAMAGE_UNDEAD; - store_hp = target->m_d.health; + store_hp = target->health; sound_type = get_monst_sound(attacker,i); dam_type += DAMAGE_MARKED; if (damage_monst(attackee,7,r2,0,dam_type,sound_type) == true) { - damaged_message(store_hp - target->m_d.health, - (i > 0) ? attacker->m_d.a23_type : attacker->m_d.a1_type); + damaged_message(store_hp - target->health, + (i > 0) ? attacker->a23_type : attacker->a1_type); - if ((attacker->m_d.poison > 0) && (i == 0)) { - poison_monst(target,attacker->m_d.poison); + if ((attacker->poison > 0) && (i == 0)) { + poison_monst(target,attacker->poison); } // Undead slow - if ((attacker->m_d.spec_skill == 18) && (get_ran(1,0,8) < 6)) { + if ((attacker->spec_skill == 18) && (get_ran(1,0,8) < 6)) { add_string_to_buf(" Stuns! "); slow_monst(target,2); } // Web target - if (attacker->m_d.spec_skill == 27) { + if (attacker->spec_skill == 27) { add_string_to_buf(" Webs! "); web_monst(target,4); } // Sleep target - if (attacker->m_d.spec_skill == 28) { + if (attacker->spec_skill == 28) { add_string_to_buf(" Sleeps! "); charm_monst(target,-15,11,6); } // Dumbfound target - if (attacker->m_d.spec_skill == 24) { + if (attacker->spec_skill == 24) { add_string_to_buf(" Dumbfounds! "); dumbfound_monst(target,2); } // Paralyze target - if (attacker->m_d.spec_skill == 29) { + if (attacker->spec_skill == 29) { add_string_to_buf(" Paralysis touch! "); charm_monst(target,-5,12,500); } // Acid touch - if (attacker->m_d.spec_skill == 31) { + if (attacker->spec_skill == 31) { add_string_to_buf(" Acid touch! "); acid_monst(target,3); } // Freezing touch - if (((attacker->m_d.spec_skill == 15) || (attacker->m_d.spec_skill == 17)) + if (((attacker->spec_skill == 15) || (attacker->spec_skill == 17)) && (get_ran(1,0,8) < 6)) { add_string_to_buf(" Freezing touch!"); r1 = get_ran(3,1,10); @@ -2519,7 +2519,7 @@ void monster_attack_monster(short who_att,short attackee) } // Death touch - if ((attacker->m_d.spec_skill == 35) + if ((attacker->spec_skill == 35) && (get_ran(1,0,8) < 6)) { add_string_to_buf(" Killing touch!"); r1 = get_ran(20,1,10); @@ -2567,9 +2567,9 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if (target >= 100) m_target = &univ.town.monst.dudes[target - 100]; if (((overall_mode >= MODE_COMBAT) && (overall_mode <= MODE_TALKING)) && (center_on_monst == true)) { - frame_space(source,0,univ.town.monst.dudes[m_num].m_d.x_width,univ.town.monst.dudes[m_num].m_d.y_width); + frame_space(source,0,univ.town.monst.dudes[m_num].x_width,univ.town.monst.dudes[m_num].y_width); if (target >= 100) - frame_space(targ_space,1,m_target->m_d.x_width,m_target->m_d.y_width); + frame_space(targ_space,1,m_target->x_width,m_target->y_width); else frame_space(targ_space,1,1,1); } @@ -2642,8 +2642,8 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor } else { monst_spell_note(m_target->number,9); - r1 = get_ran(1,0,20) + m_target->m_d.level / 4 + m_target->m_d.status[1]; - if ((r1 > 14) || (m_target->m_d.immunities & 2)) + r1 = get_ran(1,0,20) + m_target->level / 4 + m_target->status[1]; + if ((r1 > 14) || (m_target->immunities & 2)) monst_spell_note(m_target->number,10); else { monst_spell_note(m_target->number,8); @@ -2674,9 +2674,9 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor else { // on monst run_a_missile(source,targ_space,8,0,43,0,0,100); monst_spell_note(m_target->number,11); - if (m_target->m_d.mp >= 4) - m_target->m_d.mp = m_target->m_d.mp / 2; - else m_target->m_d.skill = 1; + if (m_target->mp >= 4) + m_target->mp = m_target->mp / 2; + else m_target->skill = 1; } } else if (level == 10) { // heat ray @@ -2789,7 +2789,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor monst_spell_note(m_target->number,14); break; } - r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * m_target->m_d.status[1] + r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * m_target->status[1] - 5 * (can_see(source, m_target->cur_loc,0)); r2 = get_ran(dam[level],1,7) + min(10,bless); @@ -2814,24 +2814,24 @@ bool monst_breathe(cCreature *caster,location targ_space,short dam_type)//// draw_terrain(2); if ((is_combat()) && (center_on_monst == true)) { - frame_space(caster->cur_loc,0,caster->m_d.x_width,caster->m_d.y_width); + frame_space(caster->cur_loc,0,caster->x_width,caster->y_width); } //if (dam_type < 2) l = caster->cur_loc; - if ((caster->m_d.direction < 4) && - (caster->m_d.x_width > 1)) + if ((caster->direction < 4) && + (caster->x_width > 1)) l.x++; - dam_type = caster->m_d.breath_type; + dam_type = caster->breath_type; run_a_missile(l,targ_space,missile_t[dam_type],0,44,0,0,100); // play_sound(44); //else play_sound(64); - level = caster->m_d.breath; + level = caster->breath; //if (level > 10) // play_sound(5); monst_breathe_note(caster->number); - level = get_ran(caster->m_d.breath,1,8); + level = get_ran(caster->breath,1,8); if (overall_mode < MODE_COMBAT) level = level / 3; start_missile_anim(); @@ -2874,15 +2874,15 @@ bool monst_cast_mage(cCreature *caster,short targ)//// if ((targ >= 100) && (univ.town.monst.dudes[targ - 100].active == 0)) return false; - level = max(1,caster->m_d.mu - caster->m_d.status[9]) - 1; + level = max(1,caster->mu - caster->status[9]) - 1; target = find_fireball_loc(caster->cur_loc,1,(caster->attitude % 2 == 1) ? 0 : 1,&target_levels); friend_levels_near = (caster->attitude % 2 != 1) ? count_levels(caster->cur_loc,3) : -1 * count_levels(caster->cur_loc,3); - if ((caster->m_d.health * 4 < caster->m_d.m_health) && (get_ran(1,0,10) < 9)) + if ((caster->health * 4 < caster->m_health) && (get_ran(1,0,10) < 9)) spell = emer_spells[level][3]; - else if ((((caster->m_d.status[3] < 0) && (get_ran(1,0,10) < 7)) || - ((caster->m_d.status[3] == 0) && (get_ran(1,0,10) < 5))) && (emer_spells[level][0] != 0)) + else if ((((caster->status[3] < 0) && (get_ran(1,0,10) < 7)) || + ((caster->status[3] == 0) && (get_ran(1,0,10) < 5))) && (emer_spells[level][0] != 0)) spell = emer_spells[level][0]; else if ((friend_levels_near <= -10) && (get_ran(1,0,10) < 7) && (emer_spells[level][1] != 0)) spell = emer_spells[level][1]; @@ -2894,7 +2894,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// } // Hastes happen often now, but don't cast them redundantly - if ((caster->m_d.status[3] > 0) && ((spell == 2) || (spell == 18))) + if ((caster->status[3] > 0) && ((spell == 2) || (spell == 18))) spell = emer_spells[level][3]; @@ -2938,17 +2938,17 @@ bool monst_cast_mage(cCreature *caster,short targ)//// spell = 26; // sprintf((char *)create_line,"m att %d trg %d trg2 x%dy%d spl %d mp %d tl:%d ",caster->attitude,targ, -// (short)target.x,(short)target.y,spell,caster->m_d.mp,target_levels); +// (short)target.x,(short)target.y,spell,caster->mp,target_levels); // add_string_to_buf((char *) create_line); l = caster->cur_loc; - if ((caster->m_d.direction < 4) && (caster->m_d.x_width > 1)) + if ((caster->direction < 4) && (caster->x_width > 1)) l.x++; - if (caster->m_d.mp >= monst_mage_cost[spell - 1]) { + if (caster->mp >= monst_mage_cost[spell - 1]) { monst_cast_spell_note(caster->number,spell,0); acted = true; - caster->m_d.mp -= monst_mage_cost[spell - 1]; + caster->mp -= monst_mage_cost[spell - 1]; draw_terrain(2); switch (spell) { @@ -2959,11 +2959,11 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 2: // minor haste play_sound(25); - caster->m_d.status[3] += 2; + caster->status[3] += 2; break; case 3: // strength play_sound(25); - caster->m_d.status[1] += 3; + caster->status[1] += 3; break; case 4: // flame cloud run_a_missile(l,vict_loc,2,1,11,0,0,80); @@ -2972,7 +2972,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// case 5: // flame run_a_missile(l,vict_loc,2,1,11,0,0,80); start_missile_anim(); - r1 = get_ran(caster->m_d.level,1,4); + r1 = get_ran(caster->level,1,4); damage_target(targ,r1,DAMAGE_FIRE); break; case 6: // minor poison @@ -2984,8 +2984,8 @@ bool monst_cast_mage(cCreature *caster,short targ)//// case 7: // slow run_a_missile(l,vict_loc,15,0,25,0,0,80); if (targ < 6) - slow_pc(targ,2 + caster->m_d.level / 2); - else slow_monst(&univ.town.monst.dudes[targ - 100],2 + caster->m_d.level / 2); + slow_pc(targ,2 + caster->level / 2); + else slow_monst(&univ.town.monst.dudes[targ - 100],2 + caster->level / 2); break; case 8: // dumbfound run_a_missile(l,vict_loc,14,0,25,0,0,80); @@ -3013,7 +3013,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// place_spell_pattern(rad2,target,5,false,7); break; case 12: // fireball - r1 = 1 + (caster->m_d.level * 3) / 4; + r1 = 1 + (caster->level * 3) / 4; if (r1 > 29) r1 = 29; run_a_missile(l,target,2,1,11,0,0,80); start_missile_anim(); @@ -3062,7 +3062,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 16: // ice bolt run_a_missile(l,vict_loc,6,1,11,0,0,80); - r1 = get_ran(5 + (caster->m_d.level / 5),1,8); + r1 = get_ran(5 + (caster->level / 5),1,8); start_missile_anim(); damage_target(targ,r1,DAMAGE_COLD); break; @@ -3071,14 +3071,14 @@ bool monst_cast_mage(cCreature *caster,short targ)//// if (caster->attitude % 2 == 1) for (i = 0; i < 6; i++) if (pc_near(i,caster->cur_loc,8)) - slow_pc(i,2 + caster->m_d.level / 4); + slow_pc(i,2 + caster->level / 4); for (i = 0; i < univ.town->max_monst(); i++) { if ((univ.town.monst.dudes[i].active != 0) && (((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude % 2 != 1)) || ((univ.town.monst.dudes[i].attitude % 2 != 1) && (caster->attitude % 2 == 1)) || ((univ.town.monst.dudes[i].attitude % 2 == 1) && (caster->attitude != univ.town.monst.dudes[i].attitude))) && (dist(caster->cur_loc,univ.town.monst.dudes[i].cur_loc) <= 7)) - slow_monst(&univ.town.monst.dudes[i],2 + caster->m_d.level / 4); + slow_monst(&univ.town.monst.dudes[i],2 + caster->level / 4); } break; case 18: // major haste @@ -3087,13 +3087,13 @@ bool monst_cast_mage(cCreature *caster,short targ)//// if ((monst_near(i,caster->cur_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; - affected->m_d.status[3] += 3; + affected->status[3] += 3; } play_sound(4); break; case 19: // firestorm run_a_missile(l,target,2,1,11,0,0,80); - r1 = 1 + (caster->m_d.level * 3) / 4 + 3; + r1 = 1 + (caster->level * 3) / 4 + 3; if (r1 > 29) r1 = 29; start_missile_anim(); place_spell_pattern(rad2,target,50 + r1,true,7); @@ -3134,13 +3134,13 @@ bool monst_cast_mage(cCreature *caster,short targ)//// if ((monst_near(i,caster->cur_loc,8,0)) && (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; - affected->m_d.health += get_ran(2,1,10); + affected->health += get_ran(2,1,10); r1 = get_ran(3,1,4); - affected->m_d.status[1] = min(8,affected->m_d.status[1] + r1); - affected->m_d.status[6] = 0; - if (affected->m_d.status[3] < 0) - affected->m_d.status[3] = 0; - affected->m_d.morale += get_ran(3,1,10); + affected->status[1] = min(8,affected->status[1] + r1); + affected->status[6] = 0; + if (affected->status[3] < 0) + affected->status[3] = 0; + affected->morale += get_ran(3,1,10); } play_sound(4); break; @@ -3149,7 +3149,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; } } - else caster->m_d.mp++; + else caster->mp++; if (ashes_loc.x > 0) make_sfx(ashes_loc.x,ashes_loc.y,6); @@ -3190,14 +3190,14 @@ bool monst_cast_priest(cCreature *caster,short targ) if (univ.town.is_antimagic(caster->cur_loc.x,caster->cur_loc.y)) { return false; } - level = max(1,caster->m_d.cl - caster->m_d.status[9]) - 1; + level = max(1,caster->cl - caster->status[9]) - 1; target = find_fireball_loc(caster->cur_loc,1,(caster->attitude % 2 == 1) ? 0 : 1,&target_levels); friend_levels_near = (caster->attitude % 2 != 1) ? count_levels(caster->cur_loc,3) : -1 * count_levels(caster->cur_loc,3); - if ((caster->m_d.health * 4 < caster->m_d.m_health) && (get_ran(1,0,10) < 9)) + if ((caster->health * 4 < caster->m_health) && (get_ran(1,0,10) < 9)) spell = emer_spells[level][3]; - else if ((caster->m_d.status[3] < 0) && (get_ran(1,0,10) < 7) && (emer_spells[level][0] != 0)) + else if ((caster->status[3] < 0) && (get_ran(1,0,10) < 7) && (emer_spells[level][0] != 0)) spell = emer_spells[level][0]; else if ((friend_levels_near <= -10) && (get_ran(1,0,10) < 7) && (emer_spells[level][1] != 0)) spell = emer_spells[level][1]; @@ -3233,22 +3233,22 @@ bool monst_cast_priest(cCreature *caster,short targ) // sprintf((char *)create_line,"p att %d trg %d trg2 x%dy%d spl %d mp %d",caster->attitude,targ, -// (short)target.x,(short)target.y,spell,caster->m_d.mp); +// (short)target.x,(short)target.y,spell,caster->mp); // add_string_to_buf((char *) create_line); // snuff heals if unwounded - if ((caster->m_d.health == caster->m_d.m_health) && + if ((caster->health == caster->m_health) && ((spell == 17) || (spell == 20))) spell--; l = caster->cur_loc; - if ((caster->m_d.direction < 4) && (caster->m_d.x_width > 1)) + if ((caster->direction < 4) && (caster->x_width > 1)) l.x++; - if (caster->m_d.mp >= monst_priest_cost[spell - 1]) { + if (caster->mp >= monst_priest_cost[spell - 1]) { monst_cast_spell_note(caster->number,spell,1); acted = true; - caster->m_d.mp -= monst_priest_cost[spell - 1]; + caster->mp -= monst_priest_cost[spell - 1]; draw_terrain(2); switch (spell) { case 3: // wrack @@ -3263,7 +3263,7 @@ bool monst_cast_priest(cCreature *caster,short targ) break; case 1: case 5: // Blesses play_sound(24); - caster->m_d.status[1] = min(8,caster->m_d.status[1] + (spell == 1) ? 3 : 5); + caster->status[1] = min(8,caster->status[1] + (spell == 1) ? 3 : 5); play_sound(4); break; case 6: // curse @@ -3328,7 +3328,7 @@ bool monst_cast_priest(cCreature *caster,short targ) break; case 15: // martyr's shield play_sound(24); - caster->m_d.status[10] = min(10,caster->m_d.status[10] + 5); + caster->status[10] = min(10,caster->status[10] + 5); break; case 19: // summon host play_sound(24); @@ -3378,7 +3378,7 @@ bool monst_cast_priest(cCreature *caster,short targ) case 17: r1 = get_ran(5,1,6) + 3; break; case 20: r1 = 50; break; } - caster->m_d.health = min(caster->m_d.health + r1, caster->m_d.m_health); + caster->health = min(caster->health + r1, caster->m_health); break; case 16: case 24:// bless all,revive all play_sound(24); @@ -3388,15 +3388,15 @@ bool monst_cast_priest(cCreature *caster,short targ) (caster->attitude == univ.town.monst.dudes[i].attitude)) { affected = &univ.town.monst.dudes[i]; if (spell == 16) - affected->m_d.status[1] = min(8,affected->m_d.status[1] + r1); + affected->status[1] = min(8,affected->status[1] + r1); if (spell == 24) - affected->m_d.health += r1; + affected->health += r1; } play_sound(4); break; case 18: // Flamestrike run_a_missile(l,target,2,0,11,0,0,80); - r1 = 2 + caster->m_d.level / 2 + 2; + r1 = 2 + caster->level / 2 + 2; start_missile_anim(); place_spell_pattern(square,target,50 + r1,true,7); ashes_loc = target; @@ -3420,18 +3420,18 @@ bool monst_cast_priest(cCreature *caster,short targ) case 25: // avatar play_sound(24); monst_spell_note(caster->number,26); - caster->m_d.health = caster->m_d.m_health; - caster->m_d.status[1] = 8; - caster->m_d.status[2] = 0; - caster->m_d.status[3] = 8; - caster->m_d.status[6] = 0; - caster->m_d.status[7] = 0; - caster->m_d.status[9] = 0; - caster->m_d.status[10] = 8; + caster->health = caster->m_health; + caster->status[1] = 8; + caster->status[2] = 0; + caster->status[3] = 8; + caster->status[6] = 0; + caster->status[7] = 0; + caster->status[9] = 0; + caster->status[10] = 8; break; case 26: // divine thud run_a_missile(l,target,9,0,11,0,0,80); - r1 = (caster->m_d.level * 3) / 4 + 5; + r1 = (caster->level * 3) / 4 + 5; if (r1 > 29) r1 = 29; start_missile_anim(); place_spell_pattern(rad2,target,130 + r1,true,7 ); @@ -3441,7 +3441,7 @@ bool monst_cast_priest(cCreature *caster,short targ) } - else caster->m_d.mp++; + else caster->mp++; if (ashes_loc.x > 0) make_sfx(ashes_loc.x,ashes_loc.y,6); do_explosion_anim(5,0); @@ -3506,8 +3506,8 @@ short count_levels(location where,short radius) for (i = 0; i < univ.town->max_monst(); i++) if (monst_near(i,where,radius,0) == true) { if (univ.town.monst.dudes[i].attitude % 2 == 1) - store = store - univ.town.monst.dudes[i].m_d.level; - else store = store + univ.town.monst.dudes[i].m_d.level; + store = store - univ.town.monst.dudes[i].level; + else store = store + univ.town.monst.dudes[i].level; } if (is_combat()) { for (i = 0; i < 6; i++) @@ -3696,7 +3696,7 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre case 5: r1 = get_ran(2,1,6); which_m = &univ.town.monst.dudes[k]; - if (which_m->m_d.spec_skill == 22) + if (which_m->spec_skill == 22) break; damage_monst(k, who_hit, r1,0, DAMAGE_FIRE,0); break; @@ -3707,7 +3707,7 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre case 8: which_m = &univ.town.monst.dudes[k]; r1 = get_ran(3,1,6); - if (which_m->m_d.spec_skill == 23) + if (which_m->spec_skill == 23) break; damage_monst(k, who_hit, r1,0, DAMAGE_COLD,0); break; @@ -4083,7 +4083,7 @@ bool combat_cast_mage_spell() store_sum_monst = pick_trapped_monst(); if (store_sum_monst == 0) return false; - get_monst = return_monster_template(store_sum_monst); + get_monst = scenario.scen_monsters[store_sum_monst]; if (store_sp < get_monst.level) { add_string_to_buf("Cast: Not enough spell points. "); return false; @@ -4224,7 +4224,7 @@ bool combat_cast_mage_spell() } num_opp++; add_missile(univ.town.monst.dudes[i].cur_loc,store_m_type,0, - 14 * (which_m->m_d.x_width - 1),18 * (which_m->m_d.y_width - 1)); + 14 * (which_m->x_width - 1),18 * (which_m->y_width - 1)); } } @@ -4371,7 +4371,7 @@ bool combat_cast_priest_spell() } num_opp++; add_missile(univ.town.monst.dudes[i].cur_loc,store_m_type,0, - 14 * (which_m->m_d.x_width - 1),18 * (which_m->m_d.y_width - 1)); + 14 * (which_m->x_width - 1),18 * (which_m->y_width - 1)); } } @@ -4742,7 +4742,7 @@ void sleep_cloud_space(short m,short n) void take_m_ap(short num,cCreature *monst) { - monst->m_d.ap = max(0,monst->m_d.ap - num); + monst->ap = max(0,monst->ap - num); } void add_new_action(short pc_num) @@ -4754,8 +4754,8 @@ void add_new_action(short pc_num) short get_monst_sound(cCreature *attacker,short which_att) { short type,strength; - type = (which_att == 0) ? attacker->m_d.a1_type : attacker->m_d.a23_type; - strength = attacker->m_d.a[which_att]; + type = (which_att == 0) ? attacker->a1_type : attacker->a23_type; + strength = attacker->a[which_att]; switch (type) { case 3: @@ -4772,17 +4772,17 @@ short get_monst_sound(cCreature *attacker,short which_att) { break; default: - if (attacker->m_d.m_type == 0) { + if (attacker->m_type == 0) { if (strength > 9) return 3; else return 2; } - if ((attacker->m_d.m_type == 0) ||(attacker->m_d.m_type == 6) ||(attacker->m_d.m_type == 9) ){ + if ((attacker->m_type == 0) ||(attacker->m_type == 6) ||(attacker->m_type == 9) ){ return 2; } - if (attacker->m_d.m_type == 4) + if (attacker->m_type == 4) return 1; - if (attacker->m_d.m_type == 5) + if (attacker->m_type == 5) return 4; return 0; break; diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index 2c51d4f3..0936ca58 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -62,8 +62,7 @@ extern cUniverse univ; short terrain_pic[256]; -std::vector scen_headers; -std::vector scen_header_strs; +extern cScenarioList scen_headers; GWorldPtr pcs_gworld = NULL; @@ -1783,17 +1782,17 @@ void put_scen_info() char *difficulty[] = {"Low","Medium","High","Very High"}; for (i = 0; i < 3; i++) - if (scen_headers.size() > (store_scen_page_on * 3 + i) && scen_headers[store_scen_page_on * 3 + i].flag1 != 0) { - cd_set_pict(947, 6 + i * 3,scen_headers[store_scen_page_on * 3 + i].intro_pic,PICT_SCEN); + if (scen_headers.size() > (store_scen_page_on * 3 + i) && scen_headers.data(store_scen_page_on * 3 + i).flag1 != 0) { + cd_set_pict(947, 6 + i * 3,scen_headers.data(store_scen_page_on * 3 + i).intro_pic,PICT_SCEN); sout.str(""); - sout << scen_header_strs[store_scen_page_on * 3 + i].name; - sout << " v" << scen_headers[store_scen_page_on * 3 + i].ver[0]; - sout << '.' << scen_headers[store_scen_page_on * 3 + i].ver[1]; - sout << '.' << scen_headers[store_scen_page_on * 3 + i].ver[2]; - sout << " - | Difficulty: " << difficulty[scen_headers[store_scen_page_on * 3 + i].difficulty]; - sout << ", Rating: " << ratings[scen_headers[store_scen_page_on * 3 + i].default_ground]; - sout << " |" << scen_header_strs[store_scen_page_on * 3 + i].who1; - sout << " |" << scen_header_strs[store_scen_page_on * 3 + i].who2; + sout << scen_headers.strs(store_scen_page_on * 3 + i).name; + sout << " v" << scen_headers.data(store_scen_page_on * 3 + i).ver[0]; + sout << '.' << scen_headers.data(store_scen_page_on * 3 + i).ver[1]; + sout << '.' << scen_headers.data(store_scen_page_on * 3 + i).ver[2]; + sout << " - | Difficulty: " << difficulty[scen_headers.data(store_scen_page_on * 3 + i).difficulty]; + sout << ", Rating: " << ratings[scen_headers.data(store_scen_page_on * 3 + i).rating]; + sout << " |" << scen_headers.strs(store_scen_page_on * 3 + i).who1; + sout << " |" << scen_headers.strs(store_scen_page_on * 3 + i).who2; csit(947,7 + i * 3,(char *) sout.str().c_str()); cd_activate_item(947,8 + i * 3,1); } diff --git a/osx/boe.fileio.cpp b/osx/boe.fileio.cpp index acf74478..1c4da85d 100644 --- a/osx/boe.fileio.cpp +++ b/osx/boe.fileio.cpp @@ -60,12 +60,11 @@ extern short terrain_pic[256],cur_town_talk_loaded; extern cScenario scenario; extern cUniverse univ; //extern piles_of_stuff_dumping_type *data_store; -extern std::vector scen_header_strs; //std::vector scen_names; //stored_town_maps_type town_maps; //extern talking_record_type talking; //extern outdoor_strs_type outdoor_text[2][2]; -extern std::vector scen_headers; +cScenarioList scen_headers; extern ter_num_t combat_terrain[64][64]; extern bool belt_present; extern bool mac_is_intel; @@ -1217,7 +1216,7 @@ void build_scen_headers() } index++; }while (err == noErr); - if (scen_header_strs.size() == 0) { // no scens present + if (scen_headers.size() == 0) { // no scens present } FSCloseIterator(iter); } @@ -1300,8 +1299,7 @@ bool load_scenario_header(FSRef file/*,short header_entry*/){ scen_strs.file == "busywork.exs" */) return false; - scen_headers.push_back(curScen); - scen_header_strs.push_back(scen_strs); + scen_headers.push_back(curScen,scen_strs); // for (i = 0; i < 3; i++) { // store = (short) scenario.scen_str_len[i]; // len = (long) (store); diff --git a/osx/boe.global.h b/osx/boe.global.h index 10f9899f..a02a4206 100644 --- a/osx/boe.global.h +++ b/osx/boe.global.h @@ -45,285 +45,27 @@ #define CDST cd_set_text_edit_str #define CDSN cd_set_text_edit_num -//typedef struct { -// short personality,type; -// char link1[4],link2[4]; -// short extras[4]; -// } talking_node_type; -// -//typedef struct { -// unsigned char strlens[200]; -// talking_node_type talk_nodes[60]; -// } talking_record_type; -// -//typedef struct { -// unsigned char monst[4]; -// } wandering_type; -// -//typedef struct { -// unsigned char monst[7]; -// unsigned char friendly[3]; -// short spec_on_meet,spec_on_win,spec_on_flee,cant_flee; -// short end_spec1,end_spec2; -//} out_wandering_type; -// -//typedef struct { -// unsigned char terrain[48][48]; -// location special_locs[18]; -// unsigned char special_id[18]; -// location exit_locs[8]; -// char exit_dests[8]; -// location sign_locs[8]; -// out_wandering_type wandering[4],special_enc[4]; -// location wandering_locs[4]; -// Rect info_rect[8]; -// unsigned char strlens[180]; -// cSpecial specials[60]; -// } outdoor_record_type; -// -//typedef struct { -// unsigned char number; -// unsigned char start_attitude; -// location start_loc; -// unsigned char mobile; -// unsigned char time_flag; -// unsigned char extra1,extra2; -// short spec1, spec2; -// char spec_enc_code,time_code; -// short monster_time,personality; -// short special_on_kill,facial_pic; -// -// } creature_start_type; -// -//typedef struct { -// location item_loc; -// short item_code,ability; -// unsigned char charges,always_there,property,contained; -// } preset_item_type; -// -//typedef struct { -// location field_loc; -// short field_type; -// } preset_field_type; -// -//typedef struct { -// short town_chop_time,town_chop_key; -// wandering_type wandering[4]; -// location wandering_locs[4]; -// location special_locs[50]; -// unsigned char spec_id[50]; -// location sign_locs[15]; -// short lighting; -// location start_locs[4]; -// location exit_locs[4]; -// short exit_specs[4]; -// Rect in_town_rect; -// preset_item_type preset_items[64]; -// short max_num_monst; -// preset_field_type preset_fields[50]; -// short spec_on_entry,spec_on_entry_if_dead; -// short timer_spec_times[8]; -// short timer_specs[8]; -// unsigned char strlens[180]; -// cSpecial specials[100]; -// unsigned char specials1,specials2,res1,res2; -// short difficulty; -// } town_record_type; -// -// -// -//typedef struct { -// unsigned char terrain[64][64]; -// Rect room_rect[16]; -// creature_start_type creatures[60]; -// unsigned char lighting[8][64]; -// } big_tr_type; -// -//typedef struct { -// unsigned char terrain[48][48]; -// Rect room_rect[16]; -// creature_start_type creatures[40]; -// unsigned char lighting[6][48]; -// } ave_tr_type; -// -//typedef struct { -// unsigned char terrain[32][32]; -// Rect room_rect[16]; -// creature_start_type creatures[30]; -// unsigned char lighting[4][32]; -// } tiny_tr_type; -// -//typedef struct { -// short block_type; -// short block_destroy_time; -// char block_alignment; -// char block_key_time; -// location block_loc; -// } city_block_type; -// -//typedef struct { -// Rect what_rect; -// unsigned char ter_type; -// unsigned char hollow; -// } city_ter_rect_type; -// -//typedef struct { -// creature_start_type creatures[30]; -// city_block_type city_block[15]; -// city_ter_rect_type city_ter_rect[10]; -// } template_town_type; -// -//typedef struct { -// cItemRec scen_items[400]; -// char monst_names[256][20]; -// char ter_names[256][30]; -// } scen_item_data_type; - -//struct creature_data_type { -// short active,attitude; -// unsigned char number; -// location m_loc; -// cMonster m_d; -// bool mobile; -// short summoned; -// cTown::cCreature monst_start; -//}; - struct scen_header_type { unsigned char flag1, flag2, flag3, flag4; unsigned char ver[3],min_run_ver,prog_make_ver[3],num_towns; - unsigned char out_width,out_height,difficulty,intro_pic,default_ground; + unsigned char out_width,out_height,difficulty,intro_pic,rating; }; struct scen_header_str_type{ std::string name, who1, who2, file; - //scen_header_str_type(){} - scen_header_str_type& operator = (const scen_header_str_type& other) { - name = other.name; - who1 = other.who1; - who2 = other.who2; - file = other.file; - return *this; - } }; -// for game -//struct talk_save_type { -// short personality; -// short town_num; -// short str1,str2; -//}; -// -//struct creature_list_type { -// creature_data_type dudes[60]; -// short which_town; -// short friendly; -//}; -// -//struct current_town_type { -// short town_num, difficulty; -// cTown* town; -// char explored[64][64]; -// bool hostile; -// creature_list_type monst; -// bool in_boat; -// location p_loc; -// cSpeech* cur_talk; -// short cur_talk_loaded; -//}; -// -//struct outdoor_creature_type { -// bool exists; -// short direction; -// cOutdoors::cWandering what_monst; -// location which_sector,m_loc; -//}; -// -//struct party_record_type { -// long age; -// short gold,food; -// unsigned char stuff_done[310][10],item_taken[200][8]; -// short light_level; -// location outdoor_corner,i_w_c,p_loc,loc_in_sec; -// cVehicle boats[30]; -// cVehicle horses[30]; -// creature_list_type creature_save[4]; -// short in_boat,in_horse; -// outdoor_creature_type out_c[10]; -// cItemRec magic_store_items[5][10]; -// short imprisoned_monst[4]; -// char m_seen[256]; -// char journal_str[50]; -// short journal_day[50]; -// short special_notes_str[140][2]; -// talk_save_type talk_save[120]; -// short direction,at_which_save_slot; -// char alchemy[20]; -// bool can_find_town[200]; -// short key_times[100]; -// short party_event_timers[30]; -// short global_or_town[30]; -// short node_to_call[30]; -// char spec_items[50],help_received[120]; -// short m_killed[200]; -// long total_m_killed,total_dam_done,total_xp_gained,total_dam_taken; -// char scen_name[256]; -//}; -// -//struct stored_town_maps_type { -// char town_maps[200][8][64]; -//}; - -//typedef struct { -//// char town_strs[180][256]; -// //char out_strs[120][256]; -//// char scen_strs[270][256]; -//// char talk_strs[170][256]; -// std::vector scen_header_strs; -// std::vector scen_names; -//// scen_item_data_type scen_item_list; -// stored_town_maps_type town_maps; -// } piles_of_stuff_dumping_type; - -//typedef struct { -// char out_strs[9][256]; -// } outdoor_strs_type; -//struct pc_record_type { -// short main_status; -// char name[20]; -// short skills[30]; -// short max_health,cur_health,max_sp,cur_sp,experience,skill_pts,level; -// short status[15]; -// cItemRec items[24]; -// bool equip[24]; -// bool priest_spells[62],mage_spells[62]; -// short which_graphic,weap_poisoned; -// bool advan[15],traits[15]; -// short race,exp_adj,direction; -//}; -// -//struct setup_save_type { -// unsigned char setup[4][64][64]; -//}; -// -// -//struct town_item_list { -// cItemRec items[NUM_TOWN_ITEMS]; -//}; -// -//struct flag_type { -// short i; -//}; +class cScenarioList { + std::vector d; + std::vector s; +public: + void clear() {d.clear(); s.clear();} + size_t size() {return d.size();} + void push_back(scen_header_type& head, scen_header_str_type& strs) {d.push_back(head); s.push_back(strs);} + scen_header_type& data(size_t i) {return d.at(i);} + scen_header_str_type& strs(size_t i) {return s.at(i);} +}; struct effect_pat_type { unsigned char pattern[9][9]; }; - -//typedef struct stored_outdoor_maps_type { -// char outdoor_maps[100][6][48]; -//}; - -//typedef struct { -//long l[10]; -//} PrefRecord,*PrefPtr,**PrefHandle; -// diff --git a/osx/boe.graphics.cpp b/osx/boe.graphics.cpp index 7c599100..ad01782d 100644 --- a/osx/boe.graphics.cpp +++ b/osx/boe.graphics.cpp @@ -1188,8 +1188,8 @@ void draw_text_bar(short mode) if ((is_combat()) && (monsters_going == true)) // Print bar for 1st monster with >0 ap - // that is monster that is going for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].m_d.ap > 0)) { - combat_string = print_monster_going(univ.town.monst.dudes[i].number,univ.town.monst.dudes[i].m_d.ap); + if ((univ.town.monst.dudes[i].active > 0) && (univ.town.monst.dudes[i].ap > 0)) { + combat_string = print_monster_going(univ.town.monst.dudes[i].number,univ.town.monst.dudes[i].ap); put_text_bar((char *) combat_string.c_str()); remember_tiny_text = 500; i = 400; @@ -1814,8 +1814,8 @@ void draw_terrain(short mode) supressing_some_spaces = true; for (i = 0; i < 4; i++) ok_space[i].x = -1; if (current_working_monster >= 100) { - for (i = 0; i < univ.town.monst.dudes[current_working_monster - 100].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[current_working_monster - 100].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[current_working_monster - 100].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[current_working_monster - 100].y_width; j++) { ok_space[i + 2 * j].x = univ.town.monst.dudes[current_working_monster - 100].cur_loc.x + i; ok_space[i + 2 * j].y = univ.town.monst.dudes[current_working_monster - 100].cur_loc.y + j; ok_space[i + 2 * j].x = ok_space[i + 2 * j].x - center.x + 4; @@ -2552,8 +2552,8 @@ void boom_space(location where,short mode,short type,short damage,short sound) // adjust for possible big monster which_m = monst_there(where); if (which_m < 90) { - x_adj += 14 * (univ.town.monst.dudes[which_m].m_d.x_width - 1); - y_adj += 18 * (univ.town.monst.dudes[which_m].m_d.y_width - 1); + x_adj += 14 * (univ.town.monst.dudes[which_m].x_width - 1); + y_adj += 18 * (univ.town.monst.dudes[which_m].y_width - 1); } OffsetRect(&dest_rect,where_draw.x * 28,where_draw.y * 36); source_rect = store_rect = dest_rect; diff --git a/osx/boe.graphutil.cpp b/osx/boe.graphutil.cpp index 209091e5..7a07b994 100644 --- a/osx/boe.graphutil.cpp +++ b/osx/boe.graphutil.cpp @@ -292,7 +292,7 @@ void draw_monsters() //// } if (is_town()) for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 11)) + if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].spec_skill != 11)) if (party_can_see_monst(i)) { check_if_monst_seen(univ.town.monst.dudes[i].number); where_draw.x = univ.town.monst.dudes[i].cur_loc.x - center.x + 4; @@ -306,21 +306,21 @@ void draw_monsters() //// store_loc.x += k % width; store_loc.y += k / width; // customize? - if (univ.town.monst.dudes[i].m_d.picture_num >= 1000) { - source_rect = get_custom_rect((univ.town.monst.dudes[i].m_d.picture_num % 1000) + - k + ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : width * height) + if (univ.town.monst.dudes[i].picture_num >= 1000) { + source_rect = get_custom_rect((univ.town.monst.dudes[i].picture_num % 1000) + + k + ((univ.town.monst.dudes[i].direction < 4) ? 0 : width * height) + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); } - if (univ.town.monst.dudes[i].m_d.picture_num < 1000) { + if (univ.town.monst.dudes[i].picture_num < 1000) { source_rect = get_monster_template_rect(univ.town.monst.dudes[i].number, - ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); + ((univ.town.monst.dudes[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0),k); ter = univ.town->terrain(univ.town.monst.dudes[i].cur_loc.x,univ.town.monst.dudes[i].cur_loc.y); // in bed? if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && (scenario.ter_types[ter].special == TER_SPEC_BED) && - ((univ.town.monst.dudes[i].m_d.m_type < 7) - && (univ.town.monst.dudes[i].m_d.m_type != 1) && (univ.town.monst.dudes[i].m_d.m_type != 2)) + ((univ.town.monst.dudes[i].m_type < 7) + && (univ.town.monst.dudes[i].m_type != 1) && (univ.town.monst.dudes[i].m_type != 2)) && ((univ.town.monst.dudes[i].active == 1) || (univ.town.monst.dudes[i].target == 6)) && (width == 1) && (height == 1)) //// draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); @@ -330,7 +330,7 @@ void draw_monsters() //// } if (is_combat()) { for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 11)) + if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].spec_skill != 11)) if (((point_onscreen(center,univ.town.monst.dudes[i].cur_loc) == true) && (cartoon_happening == true)) || (party_can_see_monst(i) == true)) { check_if_monst_seen(univ.town.monst.dudes[i].number); @@ -343,21 +343,21 @@ void draw_monsters() //// store_loc.x += k % width; store_loc.y += k / width; // customize? - if (univ.town.monst.dudes[i].m_d.picture_num >= 1000) { - source_rect = get_custom_rect((univ.town.monst.dudes[i].m_d.picture_num % 1000) + - k + ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : width * height) + if (univ.town.monst.dudes[i].picture_num >= 1000) { + source_rect = get_custom_rect((univ.town.monst.dudes[i].picture_num % 1000) + + k + ((univ.town.monst.dudes[i].direction < 4) ? 0 : width * height) + ((combat_posing_monster == i + 100) ? (2 * width * height) : 0)); Draw_Some_Item(spec_scen_g, source_rect, terrain_screen_gworld, store_loc, 1, 0); } - if (univ.town.monst.dudes[i].m_d.picture_num < 1000) { + if (univ.town.monst.dudes[i].picture_num < 1000) { source_rect = get_monster_template_rect(univ.town.monst.dudes[i].number, - ((univ.town.monst.dudes[i].m_d.direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0) + ((univ.town.monst.dudes[i].direction < 4) ? 0 : 1) + ((combat_posing_monster == i + 100) ? 10 : 0) ,k); ter = univ.town->terrain(univ.town.monst.dudes[i].cur_loc.x,univ.town.monst.dudes[i].cur_loc.y); if ((store_loc.x >= 0) && (store_loc.x < 9) && (store_loc.y >= 0) && (store_loc.y < 9) && (scenario.ter_types[ter].special == TER_SPEC_BED) && - ((univ.town.monst.dudes[i].m_d.m_type < 7) - && (univ.town.monst.dudes[i].m_d.m_type != 1) && (univ.town.monst.dudes[i].m_d.m_type != 2)) + ((univ.town.monst.dudes[i].m_type < 7) + && (univ.town.monst.dudes[i].m_type != 1) && (univ.town.monst.dudes[i].m_type != 2)) && ((univ.town.monst.dudes[i].active == 1) || (univ.town.monst.dudes[i].target == 6)) && (width == 1) && (height == 1)) draw_one_terrain_spot((short) where_draw.x,(short) where_draw.y,10000 + scenario.ter_types[ter].flag1.u,0); //// diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 7ff6a920..59f14693 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -479,13 +479,13 @@ void put_monst_info()//// Str255 str; short abil,i; - if ( store_m->m_d.spec_skill == MONSTER_INVISIBLE) - cd_set_pict(999,4,400,PICT_MONST);// should probably be PICT_BLANK? - else if (store_m->m_d.picture_num < 1000) - cd_set_pict(999,4,store_m->m_d.picture_num,PICT_MONST); + if ( store_m->spec_skill == MONSTER_INVISIBLE) + cd_set_pict(999,4,400,PICT_MONST);// TODO: should probably be PICT_BLANK? + else if (store_m->picture_num < 1000) + cd_set_pict(999,4,store_m->picture_num,PICT_MONST); else { short type_g = PICT_CUSTOM + PICT_MONST; - short size_g = store_m->m_d.picture_num / 1000; + short size_g = store_m->picture_num / 1000; switch(size_g){ case 2: type_g += PICT_WIDE_MONSTER; @@ -497,7 +497,7 @@ void put_monst_info()//// type_g += PICT_WIDE_MONSTER + PICT_TALL_MONSTER; break; } - cd_set_pict(999,4,(store_m->m_d.picture_num % 1000), type_g); + cd_set_pict(999,4,(store_m->picture_num % 1000), type_g); } store_text = get_m_name(store_m->number); @@ -507,34 +507,34 @@ void put_monst_info()//// cd_set_item_text(999,i,""); } - abil = store_m->m_d.spec_skill; + abil = store_m->spec_skill; get_str(str,20,abil + 1); cd_set_item_text(999,19,(char *) str); - get_str(str,20,store_m->m_d.radiate_1 + 50); + get_str(str,20,store_m->radiate_1 + 50); cd_set_item_text(999,31,(char *) str); for (i = 0; i < 3; i++) - if (store_m->m_d.a[i] > 0) { + if (store_m->a[i] > 0) { std::ostringstream sout(store_text); - sout << store_m->m_d.a[i] / 100 + 1 << 'd' << store_m->m_d.a[i] % 100; + sout << store_m->a[i] / 100 + 1 << 'd' << store_m->a[i] % 100; store_text = sout.str(); cd_set_item_text(999,13 + i,store_text.c_str()); } - cd_set_item_num(999,6,store_m->m_d.level); - cd_set_item_num(999,7,store_m->m_d.health); - cd_set_item_num(999,8,store_m->m_d.mp); - cd_set_item_num(999,9,store_m->m_d.armor); - cd_set_item_num(999,10,store_m->m_d.skill); - cd_set_item_num(999,11,store_m->m_d.morale); - cd_set_item_num(999,12,store_m->m_d.speed); - cd_set_item_num(999,16,store_m->m_d.mu); - cd_set_item_num(999,17,store_m->m_d.cl); - cd_set_item_num(999,18,store_m->m_d.poison); + cd_set_item_num(999,6,store_m->level); + cd_set_item_num(999,7,store_m->health); + cd_set_item_num(999,8,store_m->mp); + cd_set_item_num(999,9,store_m->armor); + cd_set_item_num(999,10,store_m->skill); + cd_set_item_num(999,11,store_m->morale); + cd_set_item_num(999,12,store_m->speed); + cd_set_item_num(999,16,store_m->mu); + cd_set_item_num(999,17,store_m->cl); + cd_set_item_num(999,18,store_m->poison); // 2140 - lit 2141 - dark // immunities for (i = 0; i < 8; i++) - if (store_m->m_d.immunities & (char)(s_pow(2,i))) + if (store_m->immunities & (char)(s_pow(2,i))) cd_set_led(999,20 + i,1); else cd_set_led(999,20 + i,0); @@ -562,7 +562,7 @@ void display_monst_event_filter (short item_hit) if (on_monst_menu[position] < 0) position = 0; store_m->number = on_monst_menu[position]; - store_m->m_d = return_monster_template(on_monst_menu[position]); + *store_m = *store_m; // to fill in fields that wouldn't otherwise be filled in; replaces return_monster_template put_monst_info(); break; case 29: @@ -570,7 +570,7 @@ void display_monst_event_filter (short item_hit) if (on_monst_menu[position] < 0) position = 0; store_m->number = on_monst_menu[position]; - store_m->m_d = return_monster_template(on_monst_menu[position]); + *store_m = *store_m; // no, this is not redundant put_monst_info(); break; @@ -593,7 +593,7 @@ void display_monst(short array_pos,cCreature *which_m,short mode) full_roster = true; store_m = &hold_m; store_m->number = on_monst_menu[array_pos]; - store_m->m_d = return_monster_template(on_monst_menu[array_pos]); + *store_m = *store_m; // yes, this DOES do something } else { hold_m = *which_m; diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index 65dc2de1..d737c67a 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -841,9 +841,9 @@ void make_town_hostile() univ.town.monst.dudes[i].active = 2; // If a town, give pwoer boost - univ.town.monst.dudes[i].m_d.health *= 3; - univ.town.monst.dudes[i].m_d.status[3] = 8; - univ.town.monst.dudes[i].m_d.status[1] = 8; + univ.town.monst.dudes[i].health *= 3; + univ.town.monst.dudes[i].status[3] = 8; + univ.town.monst.dudes[i].status[1] = 8; } } @@ -1364,7 +1364,7 @@ void place_glands(location where,m_num_t m_type) cItemRec store_i; cMonster monst; - monst = return_monster_template(m_type); + monst = scenario.scen_monsters[m_type]; if ((monst.corpse_item >= 0) && (monst.corpse_item < 400) && (get_ran(1,1,100) < monst.corpse_item_chance)) { store_i = get_stored_item(monst.corpse_item); diff --git a/osx/boe.locutils.cpp b/osx/boe.locutils.cpp index 4e46f0c2..5c728e67 100644 --- a/osx/boe.locutils.cpp +++ b/osx/boe.locutils.cpp @@ -426,9 +426,9 @@ bool monst_on_space(location loc,short m_num) if (univ.town.monst.dudes[m_num].active == 0) return false; if ((loc.x - univ.town.monst.dudes[m_num].cur_loc.x >= 0) && - (loc.x - univ.town.monst.dudes[m_num].cur_loc.x <= univ.town.monst.dudes[m_num].m_d.x_width - 1) && + (loc.x - univ.town.monst.dudes[m_num].cur_loc.x <= univ.town.monst.dudes[m_num].x_width - 1) && (loc.y - univ.town.monst.dudes[m_num].cur_loc.y >= 0) && - (loc.y - univ.town.monst.dudes[m_num].cur_loc.y <= univ.town.monst.dudes[m_num].m_d.y_width - 1)) + (loc.y - univ.town.monst.dudes[m_num].cur_loc.y <= univ.town.monst.dudes[m_num].y_width - 1)) return true; return false; @@ -450,8 +450,8 @@ bool monst_can_be_there(location loc,short m_num) // First clear monst away so it doesn't block itself univ.town.monst.dudes[m_num].cur_loc.x += 100; - for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[m_num].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[m_num].y_width; j++) { destination.x = loc.x + i; destination.y = loc.y + j; if ((is_blocked(destination) == true) || (loc_off_act_area(destination) == true)) { @@ -468,8 +468,8 @@ bool monst_adjacent(location loc,short m_num) short i,j; location destination; - for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[m_num].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[m_num].y_width; j++) { destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (adjacent(destination,loc) == true) @@ -483,8 +483,8 @@ bool monst_can_see(short m_num,location l) short i,j; location destination; - for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[m_num].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[m_num].y_width; j++) { destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (can_see(destination,l,0) < 5) @@ -498,8 +498,8 @@ bool party_can_see_monst(short m_num) short i,j; location destination; - for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[m_num].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[m_num].y_width; j++) { destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (party_can_see(destination) < 6) @@ -513,8 +513,8 @@ bool can_see_monst(location l,short m_num) short i,j; location destination; - for (i = 0; i < univ.town.monst.dudes[m_num].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[m_num].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[m_num].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[m_num].y_width; j++) { destination.x = univ.town.monst.dudes[m_num].cur_loc.x + i; destination.y = univ.town.monst.dudes[m_num].cur_loc.y + j; if (can_see(l,destination,0) < 5) diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 6025b3bb..28ffd0e4 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -46,75 +46,54 @@ short charm_odds[20] = {90,90,85,80,78, 75,73,60,40,30, 20,10,4,1,0, 0,0,0,0,0}; //cCreature null_start_type; = {0,0,loc(80,80),1,0,0,0,0,0,0,0, 0,-1,-1,-1}; //// -cMonster return_monster_template(m_num_t store) -{ - cMonster monst; - short m_num,i; - - m_num = store; - monst = scenario.scen_monsters[store]; - if (monst.spec_skill == 11) - monst.picture_num = 0; - - monst.m_num = m_num; - monst.health = (PSD[SDF_EASY_MODE] == 0) ? monst.health : monst.health / 2; - - // now adjust for difficulty - monst.health = monst.health * difficulty_adjust(); - - monst.m_health = monst.health; // in scenario file, health is stored in health field - monst.max_mp = 0; - monst.mp = monst.max_mp; - - monst.ap = 0; - - if ((monst.mu > 0) || (monst.cl > 0)) - monst.max_mp = monst.mp = 12 * monst.level; - - monst.m_morale = 10 * monst.level; - if (monst.level >= 20) - monst.m_morale += 10 * (monst.level - 20); - - monst.morale = monst.m_morale; - monst.direction = 0; - for (i = 0; i < 15; i++) - monst.status[i] = 0; - - return monst; -} - -short difficulty_adjust() -{ - short i, j = 0; - short to_return = 1; - - for (i = 0; i < 6; i++) - if (ADVEN[i].main_status == 1) - j += ADVEN[i].level; - - if ((scenario.difficulty <= 0) && (j >= 60)) - to_return++; - if ((scenario.difficulty <= 1) && (j >= 130)) - to_return++; - if ((scenario.difficulty <= 2) && (j >= 210)) - to_return++; - return to_return; -} +//cMonster return_monster_template(m_num_t store) +//{ +// cMonster monst; +// short m_num,i; +// +// m_num = store; +// monst = scenario.scen_monsters[store]; +// if (monst.spec_skill == 11) +// monst.picture_num = 0; +// +// monst.m_num = m_num; +// monst.health = (PSD[SDF_EASY_MODE] == 0) ? monst.health : monst.health / 2; +// +// // now adjust for difficulty +// monst.health = monst.health * difficulty_adjust(); +// +// monst.m_health = monst.health; // in scenario file, health is stored in health field +// monst.max_mp = 0; +// monst.mp = monst.max_mp; +// +// monst.ap = 0; +// +// if ((monst.mu > 0) || (monst.cl > 0)) +// monst.max_mp = monst.mp = 12 * monst.level; +// +// monst.m_morale = 10 * monst.level; +// if (monst.level >= 20) +// monst.m_morale += 10 * (monst.level - 20); +// +// monst.morale = monst.m_morale; +// monst.direction = 0; +// for (i = 0; i < 15; i++) +// monst.status[i] = 0; +// +// return monst; +//} short out_enc_lev_tot(short which) { short count = 0,i; - cMonster store_m; short num[7] = {22,8,4,4,3,2,1}; if (univ.party.out_c[which].what_monst.cant_flee == true) return 10000; for (i = 0; i < 7; i++) - if (univ.party.out_c[which].what_monst.monst[i] != 0) { - store_m = return_monster_template(univ.party.out_c[which].what_monst.monst[i]); - count += store_m.level * num[i]; - } + if (univ.party.out_c[which].what_monst.monst[i] != 0) + count += scenario.scen_monsters[univ.party.out_c[which].what_monst.monst[i]].level * num[i]; return count; } @@ -241,8 +220,8 @@ location get_monst_head(short m_num) location l; l = univ.town.monst.dudes[m_num].cur_loc; - if ((univ.town.monst.dudes[m_num].m_d.direction < 4) && - (univ.town.monst.dudes[m_num].m_d.x_width > 1)) + if ((univ.town.monst.dudes[m_num].direction < 4) && + (univ.town.monst.dudes[m_num].x_width > 1)) l.x++; return l; @@ -292,16 +271,14 @@ void set_up_monst(short mode,m_num_t m_num) for (which = 0; which < univ.town->max_monst(); which++) if (univ.town.monst.dudes[which].active == 0) { + univ.town.monst.dudes[which].number = m_num; univ.town.monst.dudes[which] = cCreature(); univ.town.monst.dudes[which].active = 2; univ.town.monst.dudes[which].summoned = 0; univ.town.monst.dudes[which].attitude = mode + 1; - univ.town.monst.dudes[which].number = m_num; - univ.town.monst.dudes[which].m_d = return_monster_template(m_num); univ.town.monst.dudes[which].mobility = 1; - //univ.town.monst.dudes[which].monst_start = null_start_type; break; - } + } } void do_monsters() @@ -312,8 +289,8 @@ void do_monsters() if (overall_mode == MODE_TOWN) for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].m_d.status[11] <= 0) - && (univ.town.monst.dudes[i].m_d.status[12] <= 0)) { + if ((univ.town.monst.dudes[i].active != 0) && (univ.town.monst.dudes[i].status[11] <= 0) + && (univ.town.monst.dudes[i].status[12] <= 0)) { // have to pick targets if (univ.town.monst.dudes[i].active == 1) target = 6; @@ -349,15 +326,15 @@ void do_monsters() l1 = univ.town.monst.dudes[i].cur_loc; l2 = (univ.town.monst.dudes[i].target <= 6) ? univ.town.p_loc : univ.town.monst.dudes[target - 100].cur_loc; - if ((univ.town.monst.dudes[i].m_d.morale < 0) && (univ.town.monst.dudes[i].m_d.spec_skill != 13) - && (univ.town.monst.dudes[i].m_d.m_type != 8)) { + if ((univ.town.monst.dudes[i].morale < 0) && (univ.town.monst.dudes[i].spec_skill != 13) + && (univ.town.monst.dudes[i].m_type != 8)) { acted_yet = flee_party(i,l1,l2); if (get_ran(1,0,10) < 6) - univ.town.monst.dudes[i].m_d.morale++; + univ.town.monst.dudes[i].morale++; } else if (monst_hate_spot(i,&l2) == true) acted_yet = seek_party(i,l1,l2); - else if (((univ.town.monst.dudes[i].m_d.mu == 0) && (univ.town.monst.dudes[i].m_d.mu == 0)) + else if (((univ.town.monst.dudes[i].mu == 0) && (univ.town.monst.dudes[i].mu == 0)) || (can_see(l1,l2,0) > 3)) acted_yet = seek_party(i,l1,l2); } @@ -375,7 +352,7 @@ void do_monsters() univ.town.monst.dudes[i].active = 2; add_string_to_buf("Monster saw you!"); // play go active sound - switch (univ.town.monst.dudes[i].m_d.m_type) { + switch (univ.town.monst.dudes[i].m_type) { case 0: case 3: case 4: case 5: case 6: case 9: play_sound(18); break; default: play_sound(46); break; @@ -411,17 +388,17 @@ bool monst_hate_spot(short which_m,location *good_loc) loc = univ.town.monst.dudes[which_m].cur_loc; if (univ.town.is_fire_barr(loc.x,loc.y) || univ.town.is_force_barr(loc.x,loc.y) || univ.town.is_quickfire(loc.x,loc.y) || univ.town.is_blade_wall(loc.x,loc.y) // hate regular fields - || (univ.town.is_ice_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].m_d.radiate_1 != 2) - && (univ.town.monst.dudes[which_m].m_d.immunities & 32 == 0)) // hate ice wall? - || (univ.town.is_fire_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].m_d.radiate_1 != 1) - && (univ.town.monst.dudes[which_m].m_d.immunities & 8 == 0)) // hate fire wall? - || (univ.town.is_scloud(loc.x,loc.y) && (univ.town.monst.dudes[which_m].m_d.radiate_1 != 6) - && (univ.town.monst.dudes[which_m].m_d.immunities & 3 == 0)) // hate stink cloud? - || (univ.town.is_sleep_cloud(loc.x,loc.y) && (univ.town.monst.dudes[which_m].m_d.radiate_1 != 5) - && (univ.town.monst.dudes[which_m].m_d.immunities & 3 == 0)) // hate sleep cloud? - || (univ.town.is_force_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].m_d.radiate_1 != 3) - && (univ.town.monst.dudes[which_m].m_d.immunities & 3 == 0)) // hate shock cloud? - || (((univ.town.monst.dudes[which_m].m_d.mu > 0) || (univ.town.monst.dudes[which_m].m_d.cl > 0)) + || (univ.town.is_ice_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].radiate_1 != 2) + && (univ.town.monst.dudes[which_m].immunities & 32 == 0)) // hate ice wall? + || (univ.town.is_fire_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].radiate_1 != 1) + && (univ.town.monst.dudes[which_m].immunities & 8 == 0)) // hate fire wall? + || (univ.town.is_scloud(loc.x,loc.y) && (univ.town.monst.dudes[which_m].radiate_1 != 6) + && (univ.town.monst.dudes[which_m].immunities & 3 == 0)) // hate stink cloud? + || (univ.town.is_sleep_cloud(loc.x,loc.y) && (univ.town.monst.dudes[which_m].radiate_1 != 5) + && (univ.town.monst.dudes[which_m].immunities & 3 == 0)) // hate sleep cloud? + || (univ.town.is_force_wall(loc.x,loc.y) && (univ.town.monst.dudes[which_m].radiate_1 != 3) + && (univ.town.monst.dudes[which_m].immunities & 3 == 0)) // hate shock cloud? + || (((univ.town.monst.dudes[which_m].mu > 0) || (univ.town.monst.dudes[which_m].cl > 0)) && univ.town.is_antimagic(loc.x,loc.y))) // hate antimagic { prospect = find_clear_spot(loc,1); @@ -811,7 +788,7 @@ bool combat_move_monster(short which,location destination) else if (monst_check_special_terrain(destination,2,which) == false) return false; else { - univ.town.monst.dudes[which].m_d.direction = + univ.town.monst.dudes[which].direction = set_direction(univ.town.monst.dudes[which].cur_loc, destination); univ.town.monst.dudes[which].cur_loc = destination; monst_inflict_fields(which); @@ -819,9 +796,9 @@ bool combat_move_monster(short which,location destination) if (point_onscreen(destination,center) == true) { if (is_combat()) move_sound(combat_terrain[destination.x][destination.y], - (short) univ.town.monst.dudes[which].m_d.ap); + (short) univ.town.monst.dudes[which].ap); else move_sound(univ.town->terrain(destination.x,destination.y), - (short) univ.town.monst.dudes[which].m_d.ap); + (short) univ.town.monst.dudes[which].ap); } return true; @@ -900,7 +877,7 @@ bool town_move_monster(short num,location dest) return false; if (monst_can_be_there(dest,num) == true) { - univ.town.monst.dudes[num].m_d.direction = + univ.town.monst.dudes[num].direction = set_direction(univ.town.monst.dudes[num].cur_loc, dest); univ.town.monst.dudes[num].cur_loc = dest; monst_inflict_fields(num); @@ -929,8 +906,8 @@ void monst_inflict_fields(short which_monst) return; which_m = &univ.town.monst.dudes[which_monst]; - for (i = 0; i < univ.town.monst.dudes[which_monst].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[which_monst].m_d.y_width; j++) + for (i = 0; i < univ.town.monst.dudes[which_monst].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[which_monst].y_width; j++) if (univ.town.monst.dudes[which_monst].active > 0) { where_check.x = univ.town.monst.dudes[which_monst].cur_loc.x + i; where_check.y = univ.town.monst.dudes[which_monst].cur_loc.y + j; @@ -955,7 +932,7 @@ void monst_inflict_fields(short which_monst) } if (univ.town.is_ice_wall(where_check.x,where_check.y)) { r1 = get_ran(3,1,6); - if (univ.town.monst.dudes[which_monst].m_d.spec_skill != 23) + if (univ.town.monst.dudes[which_monst].spec_skill != 23) damage_monst(which_monst,7,r1,0,DAMAGE_COLD,0); break; } @@ -964,7 +941,7 @@ void monst_inflict_fields(short which_monst) curse_monst(which_m,r1); break; } - if ((univ.town.is_web(where_check.x,where_check.y)) && (which_m->m_d.m_type != 12)) { + if ((univ.town.is_web(where_check.x,where_check.y)) && (which_m->m_type != 12)) { monst_spell_note(which_m->number,19); r1 = get_ran(1,2,3); web_monst(which_m,r1); @@ -973,14 +950,14 @@ void monst_inflict_fields(short which_monst) } if (univ.town.is_fire_wall(where_check.x,where_check.y)) { r1 = get_ran(2,1,6); - if (univ.town.monst.dudes[which_monst].m_d.spec_skill != 22) + if (univ.town.monst.dudes[which_monst].spec_skill != 22) damage_monst(which_monst,7,r1,0,DAMAGE_FIRE,0); break; } } if (univ.town.monst.dudes[which_monst].active > 0) - for (i = 0; i < univ.town.monst.dudes[which_monst].m_d.x_width; i++) - for (j = 0; j < univ.town.monst.dudes[which_monst].m_d.y_width; j++) { + for (i = 0; i < univ.town.monst.dudes[which_monst].x_width; i++) + for (j = 0; j < univ.town.monst.dudes[which_monst].y_width; j++) { where_check.x = univ.town.monst.dudes[which_monst].cur_loc.x + i; where_check.y = univ.town.monst.dudes[which_monst].cur_loc.y + j; if ((univ.town.is_crate(where_check.x,where_check.y)) || @@ -1039,12 +1016,12 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon // begin determining guts, which determines how enthused the monst is about entering // nasty barriers - if ((which_m->m_d.mu > 0) || (which_m->m_d.cl > 0)) + if ((which_m->mu > 0) || (which_m->cl > 0)) mage = true; - if (which_m->m_d.spec_skill == 13) + if (which_m->spec_skill == 13) guts = 20; - else guts = get_ran(1,1,(which_m->m_d.level / 2)); - guts += which_m->m_d.health / 20; + else guts = get_ran(1,1,(which_m->level / 2)); + guts += which_m->health / 20; if (mage == true) guts = guts / 2; if (which_m->attitude == 0) @@ -1052,13 +1029,13 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon if ((univ.town.is_antimagic(where_check.x,where_check.y)) && (mage == true)) return false; - if ((univ.town.is_fire_wall(where_check.x,where_check.y)) && (which_m->m_d.spec_skill != 22)) { + if ((univ.town.is_fire_wall(where_check.x,where_check.y)) && (which_m->spec_skill != 22)) { if (guts < 3) return false; } if (univ.town.is_force_wall(where_check.x,where_check.y)) { if (guts < 4) return false; } - if ((univ.town.is_ice_wall(where_check.x,where_check.y)) && (which_m->m_d.spec_skill != 23)) { + if ((univ.town.is_ice_wall(where_check.x,where_check.y)) && (which_m->spec_skill != 23)) { if (guts < 5) return false; } if (univ.town.is_sleep_cloud(where_check.x,where_check.y)) { @@ -1073,11 +1050,11 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon if (univ.town.is_scloud(where_check.x,where_check.y)) { if (guts < 4) return false; } - if ((univ.town.is_web(where_check.x,where_check.y)) && (which_m->m_d.m_type != 12)) { + if ((univ.town.is_web(where_check.x,where_check.y)) && (which_m->m_type != 12)) { if (guts < 3) return false; } if (univ.town.is_fire_barr(where_check.x,where_check.y)) { - if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->m_d.mu * 10 + which_m->m_d.cl * 4))) { + if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->mu * 10 + which_m->cl * 4))) { play_sound(60); add_string_to_buf("Monster breaks barrier."); univ.town.set_fire_barr(where_check.x,where_check.y,false); @@ -1090,7 +1067,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon } } if (univ.town.is_force_barr(where_check.x,where_check.y)) { /// Not in big towns - if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->m_d.mu * 10 + which_m->m_d.cl * 4)) + if ((which_m->attitude % 2 == 1) && (get_ran(1,1,100) < (which_m->mu * 10 + which_m->cl * 4)) /*&& (univ.town.num >= 20)*/) { // Checking for a town num > 20 seems utterly pointless play_sound(60); add_string_to_buf("Monster breaks barrier."); @@ -1160,7 +1137,7 @@ bool monst_check_special_terrain(location where_check,short mode,short which_mon break; case TER_SPEC_DAMAGING: // TODO: Update this to check other cases - if (ter_flag == DAMAGE_FIRE && univ.town.monst.dudes[which_monst].m_d.immunities & 8) + if (ter_flag == DAMAGE_FIRE && univ.town.monst.dudes[which_monst].immunities & 8) return true; else return false; break; @@ -1199,32 +1176,32 @@ void forced_place_monster(m_num_t which,location where) void magic_adjust(cCreature *which_m,short *how_much) { - if (which_m->m_d.spec_skill == 26) { + if (which_m->spec_skill == 26) { *how_much = 0; - which_m->m_d.health += 3; + which_m->health += 3; } - if (which_m->m_d.immunities & 1) + if (which_m->immunities & 1) *how_much = *how_much / 2; - if (which_m->m_d.immunities & 2) + if (which_m->immunities & 2) *how_much = 0; } void poison_monst(cCreature *which_m,short how_much) { - if (which_m->m_d.immunities & 64) + if (which_m->immunities & 64) how_much = how_much / 2; - if (which_m->m_d.immunities & 128) { + if (which_m->immunities & 128) { monst_spell_note(which_m->number,10); return; } - which_m->m_d.status[2] = min(8, which_m->m_d.status[2] + how_much); + which_m->status[2] = min(8, which_m->status[2] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 4); } void acid_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.status[13] = minmax(-8,8, which_m->m_d.status[13] + how_much); + which_m->status[13] = minmax(-8,8, which_m->status[13] + how_much); monst_spell_note(which_m->number,31); } @@ -1232,35 +1209,35 @@ void acid_monst(cCreature *which_m,short how_much) void slow_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.status[3] = minmax(-8,8, which_m->m_d.status[3] - how_much); + which_m->status[3] = minmax(-8,8, which_m->status[3] - how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 2); } void curse_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.status[1] = minmax(-8,8, which_m->m_d.status[1] - how_much); + which_m->status[1] = minmax(-8,8, which_m->status[1] - how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 5); } void web_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.status[6] = minmax(-8,8, which_m->m_d.status[6] + how_much); + which_m->status[6] = minmax(-8,8, which_m->status[6] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 19); } void scare_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.morale = which_m->m_d.morale - how_much; + which_m->morale = which_m->morale - how_much; monst_spell_note(which_m->number,(how_much == 0) ? 10 : 1); } void disease_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.status[7] = minmax(-8,8, which_m->m_d.status[7] + how_much); + which_m->status[7] = minmax(-8,8, which_m->status[7] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 25); } @@ -1268,7 +1245,7 @@ void disease_monst(cCreature *which_m,short how_much) void dumbfound_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->m_d.status[9] = minmax(-8,8, which_m->m_d.status[9] + how_much); + which_m->status[9] = minmax(-8,8, which_m->status[9] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 22); } @@ -1280,22 +1257,22 @@ void charm_monst(cCreature *which_m,short penalty,short which_status,short amoun if ((which_status == 11) && - ((which_m->m_d.m_type == 8) || (which_m->m_d.m_type == 10) || (which_m->m_d.m_type == 11))) + ((which_m->m_type == 8) || (which_m->m_type == 10) || (which_m->m_type == 11))) return; r1 = get_ran(1,1,100); - if (which_m->m_d.immunities & 1) + if (which_m->immunities & 1) r1 = r1 * 2; - if (which_m->m_d.immunities & 2) + if (which_m->immunities & 2) r1 = 200; r1 += penalty; if (which_status == 11) r1 -= 25; if (which_status == 12) r1 -= 15; - if ((which_status == 11) && (which_m->m_d.spec_skill == 32)) + if ((which_status == 11) && (which_m->spec_skill == 32)) return; - if (r1 > charm_odds[which_m->m_d.level / 2]) { + if (r1 > charm_odds[which_m->level / 2]) { //one_sound(68); monst_spell_note(which_m->number,10); } @@ -1305,7 +1282,7 @@ void charm_monst(cCreature *which_m,short penalty,short which_status,short amoun monst_spell_note(which_m->number,23); } else { - which_m->m_d.status[which_status] = amount; + which_m->status[which_status] = amount; if (which_status == 11) monst_spell_note(which_m->number,28); if (which_status == 12) @@ -1322,11 +1299,11 @@ void record_monst(cCreature *which_m) r1 = get_ran(1,1,100); r1 = (r1 * 7) / 10; - if ((which_m->m_d.x_width > 1) || (which_m->m_d.y_width > 1)) { + if ((which_m->x_width > 1) || (which_m->y_width > 1)) { ASB("Capture Soul: Monster is too big."); } - else if ((r1 > charm_odds[which_m->m_d.level / 2]) || (which_m->m_d.spec_skill == 12) - || (which_m->m_d.m_type == 3)) { + else if ((r1 > charm_odds[which_m->level / 2]) || (which_m->spec_skill == 12) + || (which_m->m_type == 3)) { monst_spell_note(which_m->number,10); play_sound(68); } @@ -1357,20 +1334,18 @@ short place_monster(m_num_t which,location where) } if (i < univ.town->max_monst()) { + univ.town.monst.dudes[i].number = which; univ.town.monst.dudes[i] = cCreature(); - univ.town.monst.dudes[i].m_d = return_monster_template(which); univ.town.monst.dudes[i].attitude = scenario.scen_monsters[which].default_attitude; if (univ.town.monst.dudes[i].attitude % 2 == 0) univ.town.monst.dudes[i].attitude = 1; univ.town.monst.dudes[i].mobility = 1; univ.town.monst.dudes[i].active = 2; - univ.town.monst.dudes[i].number = which; univ.town.monst.dudes[i].cur_loc = where; - univ.town.monst.dudes[i].summoned = 0; - //univ.town.monst.dudes[i].monst_start = null_start_type; + univ.town.monst.dudes[i].summoned = 0; univ.town.monst.dudes[i].target = 6; - if (univ.town.monst.dudes[i].m_d.picture_num < 1000) { + if (univ.town.monst.dudes[i].picture_num < 1000) { add_monst_graphic(which,1); } @@ -1446,14 +1421,13 @@ void activate_monsters(short code,short attitude) for (i = 0; i < univ.town->max_monst(); i++) if (univ.town.monst.dudes[i].spec_enc_code == code) { + univ.town.monst.dudes[i] = univ.town->creatures(i); univ.town.monst.dudes[i].spec_enc_code = 0; - univ.town.monst.dudes[i].active = 2; - which = univ.town.monst.dudes[i].number = univ.town->creatures(i).number; - univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; + univ.town.monst.dudes[i].active = 2; // TODO: Can thes be commented out? \/ + //univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i].cur_loc = univ.town->creatures(i).start_loc; - univ.town.monst.dudes[i].m_d = return_monster_template(which); + //univ.town.monst.dudes[i].cur_loc = univ.town->creatures(i).start_loc; univ.town.monst.dudes[i].target = 6; add_monst_graphic(univ.town.monst.dudes[i].number,1); diff --git a/osx/boe.monster.h b/osx/boe.monster.h index b7a4afa1..eaff95b5 100644 --- a/osx/boe.monster.h +++ b/osx/boe.monster.h @@ -1,5 +1,5 @@ -cMonster return_monster_template(m_num_t store); -short difficulty_adjust(); +//cMonster return_monster_template(m_num_t store); +//short difficulty_adjust(); short out_enc_lev_tot(short which); short count_monst(); void create_wand_monst(); diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 6e2ddbd5..0c4b6e4c 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -2156,7 +2156,7 @@ void do_mindduel(short pc_num,cCreature *monst) { short i = 0,adjust,r1,r2,balance = 0; - adjust = (ADVEN[pc_num].level + ADVEN[pc_num].skills[2]) / 2 - monst->m_d.level * 2; + adjust = (ADVEN[pc_num].level + ADVEN[pc_num].skills[2]) / 2 - monst->level * 2; if ((i = get_prot_level(pc_num,53)) > 0) adjust += i * 5; if (monst->attitude % 2 != 1) @@ -2167,13 +2167,13 @@ void do_mindduel(short pc_num,cCreature *monst) while ((ADVEN[pc_num].main_status == 1) && (monst->active > 0) && (i < 10)) { play_sound(1); r1 = get_ran(1,1,100) + adjust; - r1 += 5 * (monst->m_d.status[9] - ADVEN[pc_num].status[9]); + r1 += 5 * (monst->status[9] - ADVEN[pc_num].status[9]); r1 += 5 * balance; r2 = get_ran(1,1,6); if (r1 < 30) { sprintf((char *)c_line, " %s is drained %d.",ADVEN[pc_num].name.c_str(),r2); add_string_to_buf((char *) c_line); - monst->m_d.mp += r2; + monst->mp += r2; balance++; if (ADVEN[pc_num].cur_sp == 0) { ADVEN[pc_num].status[9] += 2; @@ -2195,16 +2195,16 @@ void do_mindduel(short pc_num,cCreature *monst) add_string_to_buf((char *) c_line); ADVEN[pc_num].cur_sp += r2; balance--; - if (monst->m_d.mp == 0) { - monst->m_d.status[9] += 2; + if (monst->mp == 0) { + monst->status[9] += 2; monst_spell_note(monst->number,22); - if (monst->m_d.status[9] > 7) { + if (monst->status[9] > 7) { kill_monst(monst,pc_num); } } else { - monst->m_d.mp = max(0,monst->m_d.mp - r2); + monst->mp = max(0,monst->mp - r2); } @@ -3109,7 +3109,7 @@ m_num_t pick_trapped_monst() else { sp = get_m_name(univ.party.imprisoned_monst[i]); csit(988,3 + 3 * i, sp.c_str()); - get_monst = return_monster_template(univ.party.imprisoned_monst[i]); + get_monst = scenario.scen_monsters[univ.party.imprisoned_monst[i]]; cdsin(988,4 + 3 * i,get_monst.level); } diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index d34dd516..29bd6360 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -1277,7 +1277,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s victim = &univ.town.monst.dudes[which_m]; - resist = victim->m_d.immunities; + resist = victim->immunities; if (dam_type == 3) { if (resist & 1) @@ -1306,25 +1306,25 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s // Absorb damage? if (((dam_type == 1) || (dam_type == 3) || (dam_type == 5)) - && (victim->m_d.spec_skill == 26)) { - victim->m_d.health += how_much; + && (victim->spec_skill == 26)) { + victim->health += how_much; ASB(" Magic absorbed."); return false; } // Saving throw - if (((dam_type == 1) || (dam_type == 5)) && (get_ran(1,0,20) <= victim->m_d.level)) + if (((dam_type == 1) || (dam_type == 5)) && (get_ran(1,0,20) <= victim->level)) how_much = how_much / 2; - if ((dam_type == 3) && (get_ran(1,0,24) <= victim->m_d.level)) + if ((dam_type == 3) && (get_ran(1,0,24) <= victim->level)) how_much = how_much / 2; // Rentar-Ihrno? - if (victim->m_d.spec_skill == 36) + if (victim->spec_skill == 36) how_much = how_much / 10; - r1 = get_ran(1,0,(victim->m_d.armor * 5) / 4); - r1 += victim->m_d.level / 4; + r1 = get_ran(1,0,(victim->armor * 5) / 4); + r1 += victim->level / 4; if (dam_type == 0) how_much -= r1; @@ -1332,7 +1332,7 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s if (how_much < 0) how_much = 0; monst_marked_damage[which_m] += how_much; - add_explosion(victim->cur_loc,how_much,0,(dam_type > 2) ? 2 : 0,14 * (victim->m_d.x_width - 1),18 * (victim->m_d.y_width - 1)); + add_explosion(victim->cur_loc,how_much,0,(dam_type > 2) ? 2 : 0,14 * (victim->x_width - 1),18 * (victim->y_width - 1)); if (how_much == 0) return false; else return true; @@ -1352,17 +1352,17 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s if (do_print == true) monst_damaged_mes(which_m,how_much,how_much_spec); - victim->m_d.health = victim->m_d.health - how_much - how_much_spec; + victim->health = victim->health - how_much - how_much_spec; if (in_scen_debug == true) - victim->m_d.health = -1; + victim->health = -1; // splitting monsters - if ((victim->m_d.spec_skill == 12) && (victim->m_d.health > 0)){ + if ((victim->spec_skill == 12) && (victim->health > 0)){ where_put = find_clear_spot(victim->cur_loc,1); if (where_put.x > 0) if ((which_spot = place_monster(victim->number,where_put)) < 90) { - univ.town.monst.dudes[which_spot].m_d.health = victim->m_d.health; + univ.town.monst.dudes[which_spot].health = victim->health; univ.town.monst.dudes[which_spot].number = victim->number; univ.town.monst.dudes[which_spot].start_attitude = victim->start_attitude; univ.town.monst.dudes[which_spot].start_loc = victim->start_loc; @@ -1401,19 +1401,19 @@ bool damage_monst(short which_m, short who_hit, short how_much, short how_much_s } } - if (victim->m_d.health < 0) { + if (victim->health < 0) { monst_killed_mes(which_m); kill_monst(victim,who_hit); } else { if (how_much > 0) - victim->m_d.morale = victim->m_d.morale - 1; + victim->morale = victim->morale - 1; if (how_much > 5) - victim->m_d.morale = victim->m_d.morale - 1; + victim->morale = victim->morale - 1; if (how_much > 10) - victim->m_d.morale = victim->m_d.morale - 1; + victim->morale = victim->morale - 1; if (how_much > 20) - victim->m_d.morale = victim->m_d.morale - 2; + victim->morale = victim->morale - 2; } if ((victim->attitude % 2 != 1) && (who_hit < 7) && @@ -1437,7 +1437,7 @@ void kill_monst(cCreature *which_m,short who_killed) short xp,i,j,s1,s2,s3; location l; - switch (which_m->m_d.m_type) { + switch (which_m->m_type) { case 0: case 3: case 4: case 5: case 6: if (( which_m->number == 38) || ( which_m->number == 39)) @@ -1457,11 +1457,11 @@ void kill_monst(cCreature *which_m,short who_killed) PSD[which_m->spec1][which_m->spec2] = 1; run_special(12,2,which_m->special_on_kill,which_m->cur_loc,&s1,&s2,&s3); - if (which_m->m_d.radiate_1 == 15) - run_special(12,0,which_m->m_d.radiate_2,which_m->cur_loc,&s1,&s2,&s3); + if (which_m->radiate_1 == 15) + run_special(12,0,which_m->radiate_2,which_m->cur_loc,&s1,&s2,&s3); if ((in_scen_debug == false) && ((which_m->summoned >= 100) || (which_m->summoned == 0))) { // no xp for party-summoned monsters - xp = which_m->m_d.level * 2; + xp = which_m->level * 2; if (who_killed < 6) award_xp(who_killed,xp); else if (who_killed == 6) @@ -1476,11 +1476,11 @@ void kill_monst(cCreature *which_m,short who_killed) } if ((in_scen_debug == false) && (which_m->summoned == 0)) - place_treasure(which_m->cur_loc, which_m->m_d.level / 2, which_m->m_d.treasure, 0); + place_treasure(which_m->cur_loc, which_m->level / 2, which_m->treasure, 0); i = which_m->cur_loc.x; j = which_m->cur_loc.y; - switch (which_m->m_d.m_type) { + switch (which_m->m_type) { case 7: make_sfx(i,j,6); break; case 8: if (which_m->number <= 59) make_sfx(i,j,7); break; case 10: case 12: make_sfx(i,j,4); break; diff --git a/osx/boe.startup.cpp b/osx/boe.startup.cpp index e37eca84..e40e2f60 100644 --- a/osx/boe.startup.cpp +++ b/osx/boe.startup.cpp @@ -29,9 +29,8 @@ extern long register_flag; extern WindowPtr mainPtr; extern Point ul; //extern piles_of_stuff_dumping_type *data_store; -extern vector scen_headers; +extern cScenarioList scen_headers;; extern bool unreg_party_in_scen_not_check; -extern std::vector scen_header_strs; //extern std::vector scen_names;; extern cUniverse univ; @@ -100,11 +99,11 @@ bool handle_startup_press(Point the_point) scen = pick_a_scen(); if(scen < 0) break; - if (scen_headers[scen].prog_make_ver[0] >= 2) { + if (scen_headers.data(scen).prog_make_ver[0] >= 2) { FCD(912,0); break; } - scen_name = scen_header_strs[scen].file; + scen_name = scen_headers.strs(scen).file; put_party_in_scen(scen_name); break; diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index dcd8e824..a423b295 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -852,11 +852,11 @@ short do_look(location space) if ((univ.town.monst.dudes[i].active != 0) && (is_lit == true) && (monst_on_space(space,i) == true) && ((overall_mode == MODE_LOOK_TOWN) || (can_see(pc_pos[current_pc],space,0) < 5)) - && (univ.town.monst.dudes[i].m_d.picture_num != 0)) { + && (univ.town.monst.dudes[i].picture_num != 0)) { msg = get_m_name(univ.town.monst.dudes[i].number); - if (univ.town.monst.dudes[i].m_d.health < univ.town.monst.dudes[i].m_d.m_health) { + if (univ.town.monst.dudes[i].health < univ.town.monst.dudes[i].m_health) { if (univ.town.monst.dudes[i].attitude % 2 == 1) msg = " Wounded " + msg + " (H)"; else msg = " Wounded " + msg + " (F)"; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index 74c12888..4b4619d3 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -238,11 +238,11 @@ void start_town_mode(short which_town, short entry_dir) if (univ.town.monst.dudes[j].active == 2) univ.town.monst.dudes[j].active = 1; univ.town.monst.dudes[j].cur_loc = univ.town->creatures(j).start_loc; - univ.town.monst.dudes[j].m_d.health = univ.town.monst.dudes[j].m_d.m_health; - univ.town.monst.dudes[j].m_d.mp = univ.town.monst.dudes[j].m_d.max_mp; - univ.town.monst.dudes[j].m_d.morale = univ.town.monst.dudes[j].m_d.m_morale; + univ.town.monst.dudes[j].health = univ.town.monst.dudes[j].m_health; + univ.town.monst.dudes[j].mp = univ.town.monst.dudes[j].max_mp; + univ.town.monst.dudes[j].morale = univ.town.monst.dudes[j].m_morale; for (k = 0; k < 15; k++) - univ.town.monst.dudes[j].m_d.status[k] = 0; + univ.town.monst.dudes[j].status[k] = 0; if (univ.town.monst.dudes[j].summoned > 0) univ.town.monst.dudes[j].active = 0; univ.town.monst.dudes[j].target = 6; @@ -261,7 +261,7 @@ void start_town_mode(short which_town, short entry_dir) // Now remove time flag so it doesn't get reappearing univ.town.monst.dudes[j].time_flag = 0; univ.town.monst.dudes[j].cur_loc = univ.town->creatures(j).start_loc; - univ.town.monst.dudes[j].m_d.health = univ.town.monst.dudes[j].m_d.m_health; + univ.town.monst.dudes[j].health = univ.town.monst.dudes[j].m_health; } break ; @@ -317,15 +317,11 @@ void start_town_mode(short which_town, short entry_dir) // First set up the values. univ.town.monst.dudes[i] = univ.town->creatures(i); univ.town.monst.dudes[i].target = 6; - univ.town.monst.dudes[i].active = 1; - univ.town.monst.dudes[i].number = univ.town->creatures(i).number; - univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; - univ.town.monst.dudes[i].cur_loc = univ.town->creatures(i).start_loc; - univ.town.monst.dudes[i].mobility = univ.town->creatures(i).mobility; - univ.town.monst.dudes[i].m_d = return_monster_template(univ.town.monst.dudes[i].number); - + univ.town.monst.dudes[i].active = 1; // TODO: Can those two \/ be commented out? + //univ.town.monst.dudes[i].attitude = univ.town->creatures(i).start_attitude; + //univ.town.monst.dudes[i].cur_loc = univ.town->creatures(i).start_loc; + //univ.town.monst.dudes[i].mobility = univ.town->creatures(i).mobility; univ.town.monst.dudes[i].summoned = 0; - univ.town.monst.dudes[i] = univ.town->creatures(i); if (univ.town.monst.dudes[i].spec_enc_code > 0) univ.town.monst.dudes[i].active = 0; @@ -389,7 +385,7 @@ void start_town_mode(short which_town, short entry_dir) // where they cannot be for (i = 0; i < univ.town->max_monst(); i++) { if (univ.town.monst.dudes[i].active > 0) - if (((univ.town.monst.dudes[i].m_d.x_width > 1) || (univ.town.monst.dudes[i].m_d.y_width > 1)) && + if (((univ.town.monst.dudes[i].x_width > 1) || (univ.town.monst.dudes[i].y_width > 1)) && (monst_can_be_there(univ.town.monst.dudes[i].cur_loc,i) == false)) univ.town.monst.dudes[i].active = 0; } @@ -423,7 +419,7 @@ void start_town_mode(short which_town, short entry_dir) // Flush excess doomguards and viscous goos for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst.dudes[i].m_d.spec_skill == 12) && + if ((univ.town.monst.dudes[i].spec_skill == 12) && (univ.town.monst.dudes[i].number != univ.town->creatures(i).number)) univ.town.monst.dudes[i].active = 0; diff --git a/osx/classes/monster.cpp b/osx/classes/monster.cpp index 8e73e068..9adbf379 100644 --- a/osx/classes/monster.cpp +++ b/osx/classes/monster.cpp @@ -102,7 +102,7 @@ cCreature& cCreature::operator = (legacy::creature_data_type old){ number = old.number; cur_loc.x = old.m_loc.x; cur_loc.y = old.m_loc.y; - m_d = old.m_d; + *this = old.m_d; mobility = old.mobile; summoned = old.summoned; number = old.monst_start.number; @@ -158,3 +158,43 @@ std::istream& operator >> (std::istream& in, eRace& e){ else e = RACE_HUMAN; return in; } + +extern cUniverse univ; +extern cScenario scenario; +cCreature& cCreature::operator = (const cCreature& other){ // replaces return_monster_template() from boe.monsters.cpp + id = other.id; + number = other.number; + start_attitude = other.start_attitude; + start_loc = other.start_loc; + mobility = other.mobility; + time_flag = other.time_flag; + extra1 = other.extra1; + extra2 = other.extra2; + spec1 = other.spec1; + spec2 = other.spec2; + spec_enc_code = other.spec_enc_code; + time_code = other.time_code; + monster_time = other.monster_time; + personality = other.personality; + special_on_kill = other.special_on_kill; + facial_pic = other.facial_pic; + *this = scenario.scen_monsters[number]; + active = 1; // TODO: Is this right? + if(spec_skill == 11) picture_num = 0; + m_health /= (univ.party.stuff_done[306][7]) ? 2 : 1; + m_health *= univ.difficulty_adjust(); + health = m_health; + ap = 0; + if((mu > 0 || cl > 0)) + max_mp = mp = 12 * level; + else max_mp = mp = 0; + m_morale = 10 * level; + if(level >= 20) m_morale += 10 * (level - 20); + morale = m_morale; + direction = 0; + for(int i = 0; i < 15; i++) status[i] = 0; + attitude = start_attitude; // TODO: Is this right? + cur_loc = start_loc; + target = 6; // No target + return *this; +} diff --git a/osx/classes/monster.h b/osx/classes/monster.h index 819886f8..06fca71d 100644 --- a/osx/classes/monster.h +++ b/osx/classes/monster.h @@ -185,7 +185,6 @@ public: class cCreature : public cMonster { public: using cMonster::operator=; - cMonster m_d; // TODO: Delete this member in favour of the inherited fields unsigned long id; m_num_t number; // TODO: This appears to be a duplicate of cMonster::m_num (ie it's used for the same thing) short active, attitude; @@ -206,6 +205,8 @@ public: cCreature& operator = (legacy::creature_data_type old); cCreature& operator = (legacy::creature_start_type old); + cCreature& operator = (const cCreature& other); + //cCreature& operator = (const cMonster& other); }; std::ostream& operator << (std::ostream& out, eStatus& e); diff --git a/osx/classes/universe.cpp b/osx/classes/universe.cpp index 9a93fedd..758b3afe 100644 --- a/osx/classes/universe.cpp +++ b/osx/classes/universe.cpp @@ -798,3 +798,21 @@ cCurTown::cCurTown(){ for(int j = 0; j < 64; j++) fields[i][j] = 0L; } +extern cScenario scenario; +short cUniverse::difficulty_adjust() { + short party_level = 0; + short adj = 1; + + for (short i = 0; i < 6; i++) + if (party[i].main_status == 1) + party_level += party[i].level; + + if ((scenario.difficulty <= 0) && (party_level >= 60)) + adj++; + if ((scenario.difficulty <= 1) && (party_level >= 130)) + adj++; + if ((scenario.difficulty <= 2) && (party_level >= 210)) + adj++; + + return adj; +} diff --git a/osx/classes/universe.h b/osx/classes/universe.h index 5c3e8985..9c3a1445 100644 --- a/osx/classes/universe.h +++ b/osx/classes/universe.h @@ -139,6 +139,7 @@ public: void append(legacy::stored_town_maps_type& old); void append(legacy::stored_outdoor_maps_type& old); + short difficulty_adjust(); }; #endif \ No newline at end of file