diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index bf9d06c0..5a5f0458 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -689,10 +689,10 @@ bool handle_action(sf::Event event) if (overall_mode == MODE_COMBAT) { char_stand_ready(); add_string_to_buf("Stand ready. "); - if (univ.party[current_pc].status[6] > 0) { + if(univ.party[current_pc].status[eStatus::WEBS] > 0) { add_string_to_buf("You clean webs. "); - univ.party[current_pc].status[6] = move_to_zero(univ.party[current_pc].status[6]); - univ.party[current_pc].status[6] = move_to_zero(univ.party[current_pc].status[6]); + move_to_zero(univ.party[current_pc].status[eStatus::WEBS]); + move_to_zero(univ.party[current_pc].status[eStatus::WEBS]); put_pc_screen(); } check_fields(pc_pos[current_pc],2,current_pc); @@ -700,11 +700,11 @@ bool handle_action(sf::Event event) else { add_string_to_buf("Pause."); for (k = 0; k < 6; k++) - if(univ.party[k].main_status == eMainStatus::ALIVE && univ.party[k].status[6] > 0) { + if(univ.party[k].main_status == eMainStatus::ALIVE && univ.party[k].status[eStatus::WEBS] > 0) { sprintf((char *) str,"%s cleans webs.",univ.party[k].name.c_str()); add_string_to_buf((char *) str); - univ.party[k].status[6] = move_to_zero(univ.party[k].status[6]); - univ.party[k].status[6] = move_to_zero(univ.party[k].status[6]); + move_to_zero(univ.party[k].status[eStatus::WEBS]); + move_to_zero(univ.party[k].status[eStatus::WEBS]); } if (univ.party.in_horse >= 0) { if (overall_mode == MODE_OUTDOORS) { @@ -1250,7 +1250,7 @@ bool handle_action(sf::Event event) pause(10); for (i = 0; i < 6; i++) { store_sp[i] = univ.party[i].cur_health; - univ.party[i].status[6] = 0; + univ.party[i].status[eStatus::WEBS] = 0; } } i = 0; @@ -1439,7 +1439,8 @@ bool someone_awake() short i; for (i = 0; i < 6; i++) - if(univ.party[i].main_status == eMainStatus::ALIVE && univ.party[i].status[11] <= 0 && univ.party[i].status[12] <= 0) + if(univ.party[i].main_status == eMainStatus::ALIVE && + univ.party[i].status[eStatus::ASLEEP] <= 0 && univ.party[i].status[eStatus::PARALYZED] <= 0) return true; return false; } @@ -1757,17 +1758,17 @@ bool handle_keystroke(sf::Event& event){ case 'C': if(!in_scen_debug) break; for (i = 0; i < 6; i++) { - univ.party[i].status[STATUS_POISON] = 0; - if(univ.party[i].status[STATUS_BLESS_CURSE] < 0) - univ.party[i].status[STATUS_BLESS_CURSE] = 0; - if (univ.party[i].status[STATUS_HASTE_SLOW] < 0) - univ.party[i].status[STATUS_HASTE_SLOW] = 0; - univ.party[i].status[STATUS_WEBS] = 0; - univ.party[i].status[STATUS_DISEASE] = 0; - univ.party[i].status[STATUS_DUMB] = 0; - univ.party[i].status[STATUS_ASLEEP] = 0; - univ.party[i].status[STATUS_PARALYZED] = 0; - univ.party[i].status[STATUS_ACID] = 0; + univ.party[i].status[eStatus::POISON] = 0; + if(univ.party[i].status[eStatus::BLESS_CURSE] < 0) + univ.party[i].status[eStatus::BLESS_CURSE] = 0; + if (univ.party[i].status[eStatus::HASTE_SLOW] < 0) + univ.party[i].status[eStatus::HASTE_SLOW] = 0; + univ.party[i].status[eStatus::WEBS] = 0; + univ.party[i].status[eStatus::DISEASE] = 0; + univ.party[i].status[eStatus::DUMB] = 0; + univ.party[i].status[eStatus::ASLEEP] = 0; + univ.party[i].status[eStatus::PARALYZED] = 0; + univ.party[i].status[eStatus::ACID] = 0; } add_string_to_buf("Debug: You get cleaned up!"); print_buf(); @@ -2184,24 +2185,24 @@ void increase_age()//// update_stat = true; } - univ.party.light_level = move_to_zero(univ.party.light_level); + move_to_zero(univ.party.light_level); // if (PSD[128][9] == 1) // clear_map(); // decrease monster present counter - PSD[SDF_HOSTILES_PRESENT] = move_to_zero(PSD[SDF_HOSTILES_PRESENT]); + move_to_zero(PSD[SDF_HOSTILES_PRESENT]); // Party spell effects if (PSD[SDF_PARTY_STEALTHY] == 1) {reset_text_bar(); add_string_to_buf("Your footsteps grow louder. "); } - PSD[SDF_PARTY_STEALTHY] = move_to_zero(PSD[SDF_PARTY_STEALTHY]); + move_to_zero(PSD[SDF_PARTY_STEALTHY]); if (PSD[SDF_PARTY_DETECT_LIFE] == 1) {reset_text_bar(); add_string_to_buf("You stop detecting monsters. ");} - PSD[SDF_PARTY_DETECT_LIFE] = move_to_zero(PSD[SDF_PARTY_DETECT_LIFE]); + move_to_zero(PSD[SDF_PARTY_DETECT_LIFE]); if (PSD[SDF_PARTY_FIREWALK] == 1) {reset_text_bar(); add_string_to_buf("Your feet stop glowing. ");} - PSD[SDF_PARTY_FIREWALK] = move_to_zero(PSD[SDF_PARTY_FIREWALK]); + move_to_zero(PSD[SDF_PARTY_FIREWALK]); if (PSD[SDF_PARTY_FLIGHT] == 2) add_string_to_buf("You are starting to descend."); @@ -2216,7 +2217,7 @@ void increase_age()//// reset_text_bar(); } - PSD[SDF_PARTY_FLIGHT] = move_to_zero(PSD[SDF_PARTY_FLIGHT]); + move_to_zero(PSD[SDF_PARTY_FLIGHT]); if ((overall_mode > MODE_OUTDOORS) && (univ.town->lighting_type == 2)) { univ.party.light_level = max (0,univ.party.light_level - 9); @@ -2256,18 +2257,19 @@ void increase_age()//// // Protection, etc. for (i = 0; i < 6; i++) { // Process some status things, and check if stats updated - if ((univ.party[i].status[4] == 1) || (univ.party[i].status[5] == 1) || (univ.party[i].status[8] == 1) - || (univ.party[i].status[11] == 1)|| (univ.party[i].status[12] == 1)) + if(univ.party[i].status[eStatus::INVULNERABLE] == 1 || univ.party[i].status[eStatus::MAGIC_RESISTANCE] == 1 + || univ.party[i].status[eStatus::INVISIBLE] == 1 || univ.party[i].status[eStatus::MARTYRS_SHIELD] == 1 + || univ.party[i].status[eStatus::ASLEEP] == 1 || univ.party[i].status[eStatus::PARALYZED] == 1) update_stat = true; - univ.party[i].status[4] = move_to_zero(univ.party[i].status[4]); - univ.party[i].status[5] = move_to_zero(univ.party[i].status[5]); - univ.party[i].status[8] = move_to_zero(univ.party[i].status[8]); - univ.party[i].status[10] = move_to_zero(univ.party[i].status[10]); - univ.party[i].status[11] = move_to_zero(univ.party[i].status[11]); - univ.party[i].status[12] = move_to_zero(univ.party[i].status[12]); - if ((univ.party.age % 40 == 0) && (univ.party[i].status[0] > 0)) { + move_to_zero(univ.party[i].status[eStatus::INVULNERABLE]); + move_to_zero(univ.party[i].status[eStatus::MAGIC_RESISTANCE]); + move_to_zero(univ.party[i].status[eStatus::INVISIBLE]); + move_to_zero(univ.party[i].status[eStatus::MARTYRS_SHIELD]); + move_to_zero(univ.party[i].status[eStatus::ASLEEP]); + move_to_zero(univ.party[i].status[eStatus::PARALYZED]); + if(univ.party.age % 40 == 0 && univ.party[i].status[eStatus::POISONED_WEAPON] > 0) { update_stat = true; - univ.party[i].status[0] = move_to_zero(univ.party[i].status[0]); + move_to_zero(univ.party[i].status[eStatus::POISONED_WEAPON]); } } @@ -2296,7 +2298,7 @@ void increase_age()//// // Poison, acid, disease damage for (i = 0; i < 6; i++) // Poison - if (univ.party[i].status[2] > 0) { + if(univ.party[i].status[eStatus::POISON] > 0) { i = 6; if (((overall_mode == MODE_OUTDOORS) && (univ.party.age % 50 == 0)) || ((overall_mode == MODE_TOWN) && (univ.party.age % 20 == 0))) { update_stat = true; @@ -2304,7 +2306,7 @@ void increase_age()//// } } for (i = 0; i < 6; i++) // Disease - if (univ.party[i].status[7] > 0) { + if(univ.party[i].status[eStatus::DISEASE] > 0) { i = 6; if (((overall_mode == MODE_OUTDOORS) && (univ.party.age % 100 == 0)) || ((overall_mode == MODE_TOWN) && (univ.party.age % 25 == 0))) { update_stat = true; @@ -2312,7 +2314,7 @@ void increase_age()//// } } for (i = 0; i < 6; i++) // Acid - if (univ.party[i].status[13] > 0) { + if(univ.party[i].status[eStatus::ACID] > 0) { i = 6; update_stat = true; handle_acid(); @@ -2370,10 +2372,10 @@ void increase_age()//// // Blessing, slowed,etc. if (univ.party.age % 4 == 0) for (i = 0; i < 6; i++) { - if ((univ.party[i].status[1] != 0) || (univ.party[i].status[3] != 0)) + if(univ.party[i].status[eStatus::BLESS_CURSE] != 0 || univ.party[i].status[eStatus::HASTE_SLOW] != 0) update_stat = true; - univ.party[i].status[1] = move_to_zero(univ.party[i].status[1]); - univ.party[i].status[3] = move_to_zero(univ.party[i].status[3]); + move_to_zero(univ.party[i].status[eStatus::BLESS_CURSE]); + move_to_zero(univ.party[i].status[eStatus::HASTE_SLOW]); if (((item = pc_has_abil_equip(i,50)) < 24) && (univ.party[i].cur_health < univ.party[i].max_health) && ((overall_mode > MODE_OUTDOORS) || (get_ran(1,0,10) == 5))){ @@ -3026,7 +3028,7 @@ bool someone_poisoned() short i; for (i = 0; i < 6; i++) - if(univ.party[i].main_status == eMainStatus::ALIVE && (univ.party[i].status[2] > 0)) + if(univ.party[i].main_status == eMainStatus::ALIVE && (univ.party[i].status[eStatus::POISON] > 0)) return true; return false; } diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index bff2b251..1d1696a6 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -375,9 +375,11 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,ter_num_t in_which_terr combat_terrain[pc_pos[i].x][pc_pos[i].y] = combat_terrain[0][0]; update_explored(pc_pos[i]); - for (j = 0; j < 6; j++) - if (j != 2) - univ.party[i].status[j] = 0; + univ.party[i].status[eStatus::POISONED_WEAPON] = 0; + univ.party[i].status[eStatus::BLESS_CURSE] = 0; + univ.party[i].status[eStatus::HASTE_SLOW] = 0; + univ.party[i].status[eStatus::INVULNERABLE] = 0; + univ.party[i].status[eStatus::MAGIC_RESISTANCE] = 0; } // place monsters, w. friendly monsts landing near PCs @@ -522,8 +524,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[i].attitude % 2 == 1) && - (univ.town.monst[i].status[11] <= 0) && - (univ.town.monst[i].status[12] <= 0)) { + univ.town.monst[i].status[eStatus::ASLEEP] <= 0 && + univ.town.monst[i].status[eStatus::PARALYZED] <= 0) { combat_posing_monster = current_working_monster = 100 + i; monster_attack_pc(i,current_pc); combat_posing_monster = current_working_monster = -1; @@ -578,7 +580,7 @@ void pc_attack(short who_att,short target)//// // slice out bad attacks if(univ.party[who_att].main_status != eMainStatus::ALIVE) return; - if ((univ.party[who_att].status[11] > 0) || (univ.party[who_att].status[12] > 0)) + if(univ.party[who_att].status[eStatus::ASLEEP] > 0 || univ.party[who_att].status[eStatus::PARALYZED] > 0) return; last_attacked[who_att] = target; @@ -591,13 +593,13 @@ void pc_attack(short who_att,short target)//// weap1 = i; else weap2 = i; - hit_adj = (-5 * minmax(-8,8,univ.party[who_att].status[1])) + 5 * minmax(-8,8,which_m->status[1]) + hit_adj = (-5 * minmax(-8,8,univ.party[who_att].status[eStatus::BLESS_CURSE])) + 5 * minmax(-8,8,which_m->status[eStatus::BLESS_CURSE]) - stat_adj(who_att,1) * 5 + (get_encumberance(who_att)) * 5; - dam_adj = minmax(-8,8,univ.party[who_att].status[1]) - minmax(-8,8,which_m->status[1]) + dam_adj = minmax(-8,8,univ.party[who_att].status[eStatus::BLESS_CURSE]) - minmax(-8,8,which_m->status[eStatus::BLESS_CURSE]) + stat_adj(who_att,0); - if ((which_m->status[11] > 0) || (which_m->status[12] > 0)) { + if(which_m->status[eStatus::ASLEEP] > 0 || which_m->status[eStatus::PARALYZED] > 0) { hit_adj -= 80; dam_adj += 10; } @@ -624,7 +626,7 @@ void pc_attack(short who_att,short target)//// add_string_to_buf((char *) create_line); r1 = get_ran(1,1,100) + hit_adj - 20; - r1 += 5 * (univ.party[current_pc].status[6] / 3); + r1 += 5 * (univ.party[current_pc].status[eStatus::WEBS] / 3); r2 = get_ran(1,1,4) + dam_adj; if (r1 <= hit_chance[univ.party[who_att].skills[what_skill1]]) { @@ -652,7 +654,7 @@ void pc_attack(short who_att,short target)//// r1 = get_ran(1,1,100) - 5 + hit_adj - 5 * univ.party[who_att].items[weap1].bonus; - r1 += 5 * (univ.party[current_pc].status[6] / 3); + r1 += 5 * (univ.party[current_pc].status[eStatus::WEBS] / 3); if ((weap2 < 24) && (univ.party[who_att].traits[2] == false)) r1 += 25; @@ -693,12 +695,12 @@ void pc_attack(short who_att,short target)//// break; } // poison - if ((univ.party[who_att].status[0] > 0) && (univ.party[who_att].weap_poisoned == weap1)) { - poison_amt = univ.party[who_att].status[0]; + if(univ.party[who_att].status[eStatus::POISONED_WEAPON] > 0 && univ.party[who_att].weap_poisoned == weap1) { + poison_amt = univ.party[who_att].status[eStatus::POISONED_WEAPON]; if (pc_has_abil_equip(who_att,51) < 24) poison_amt += 2; poison_monst(which_m,poison_amt); - univ.party[who_att].status[0] = move_to_zero(univ.party[who_att].status[0]); + move_to_zero(univ.party[who_att].status[eStatus::POISONED_WEAPON]); } if ((univ.party[who_att].items[weap1].ability == 14) && (get_ran(1,0,1) == 1)) { add_string_to_buf(" Blade drips venom. "); @@ -739,7 +741,7 @@ void pc_attack(short who_att,short target)//// if (univ.party[who_att].traits[2] == false) r1 += 25; - r1 += 5 * (univ.party[current_pc].status[6] / 3); + r1 += 5 * (univ.party[current_pc].status[eStatus::WEBS] / 3); r2 = get_ran(1,1,univ.party[who_att].items[weap2].item_level) + dam_adj - 1 + univ.party[who_att].items[weap2].bonus; if (univ.party[who_att].items[weap2].ability == 12) r2 = (r2 * (10 - univ.party[who_att].items[weap2].ability_strength)) / 10; @@ -784,10 +786,10 @@ void pc_attack(short who_att,short target)//// else play_sound(2); } } - univ.party[who_att].status[0] = move_to_zero(univ.party[who_att].status[0]); + move_to_zero(univ.party[who_att].status[eStatus::POISONED_WEAPON]); take_ap(4); - if (((univ.town.monst[target].status[10] > 0) || (univ.town.monst[target].spec_skill == 22)) + if((univ.town.monst[target].status[eStatus::MARTYRS_SHIELD] > 0 || univ.town.monst[target].spec_skill == 22) && (store_hp - univ.town.monst[target].health > 0)) { add_string_to_buf(" Shares damage! "); damage_pc(who_att, store_hp - univ.town.monst[target].health, DAMAGE_MAGIC,eRace::UNKNOWN,0); @@ -1219,7 +1221,7 @@ void do_combat_cast(location target)//// break; case 69: // paralyze store_m_type = 9; - charm_monst(cur_monst,0,12,500); + charm_monst(cur_monst,0,eStatus::PARALYZED,500); break; case 7: // monster info @@ -1251,7 +1253,7 @@ void do_combat_cast(location target)//// case 117: // charm store_m_type = 14; - charm_monst(cur_monst,-1 * (bonus + univ.party[current_pc].level / 8),0,0); + charm_monst(cur_monst,-1 * (bonus + univ.party[current_pc].level / 8),eStatus::CHARM,0); break; case 118: // disease @@ -1297,7 +1299,7 @@ void do_combat_cast(location target)//// break; case 49: // Paralysis store_m_type = 9; - charm_monst(cur_monst,-10,12,1000); + charm_monst(cur_monst,-10,eStatus::PARALYZED,1000); break; case 30: store_m_type = 11; @@ -1492,10 +1494,10 @@ void fire_missile(location target) { skill = (overall_mode == MODE_FIRING) ? univ.party[missile_firer].skills[7] : univ.party[missile_firer].skills[6]; range = (overall_mode == MODE_FIRING) ? 12 : 8; dam = univ.party[missile_firer].items[ammo_inv_slot].item_level; - dam_bonus = univ.party[missile_firer].items[ammo_inv_slot].bonus + minmax(-8,8,univ.party[missile_firer].status[1]); + dam_bonus = univ.party[missile_firer].items[ammo_inv_slot].bonus + minmax(-8,8,univ.party[missile_firer].status[eStatus::BLESS_CURSE]); hit_bonus = (overall_mode == MODE_FIRING) ? univ.party[missile_firer].items[missile_inv_slot].bonus : 0; hit_bonus += stat_adj(missile_firer,1) - can_see_light(pc_pos[missile_firer],target,sight_obscurity) - + minmax(-8,8,univ.party[missile_firer].status[1]); + + minmax(-8,8,univ.party[missile_firer].status[eStatus::BLESS_CURSE]); if ((skill_item = pc_has_abil_equip(missile_firer,41)) < 24) { hit_bonus += univ.party[missile_firer].items[skill_item].ability_strength / 2; dam_bonus += univ.party[missile_firer].items[skill_item].ability_strength / 2; @@ -1536,7 +1538,7 @@ void fire_missile(location target) { take_ap((overall_mode == MODE_FIRING) ? 3 : 2); missile_firer = missile_firer; r1 = get_ran(1,1,100) - 5 * hit_bonus - 10; - r1 += 5 * (univ.party[missile_firer].status[6] / 3); + r1 += 5 * (univ.party[missile_firer].status[eStatus::WEBS] / 3); r2 = get_ran(1,1,dam) + dam_bonus; sprintf ((char *) create_line, "%s fires.",(char *) univ.party[missile_firer].name.c_str()); // debug add_string_to_buf((char *) create_line); @@ -1580,8 +1582,8 @@ void fire_missile(location target) { // hit_space(cur_monst->m_loc,get_ran(3,1,6),1,1,1); // poison - if ((univ.party[missile_firer].status[0] > 0) && (univ.party[missile_firer].weap_poisoned == ammo_inv_slot)) { - poison_amt = univ.party[missile_firer].status[0]; + if(univ.party[missile_firer].status[eStatus::POISONED_WEAPON] > 0 && univ.party[missile_firer].weap_poisoned == ammo_inv_slot) { + poison_amt = univ.party[missile_firer].status[eStatus::POISONED_WEAPON]; if (pc_has_abil_equip(missile_firer,51) < 24) poison_amt++; poison_monst(cur_monst,poison_amt); @@ -1608,7 +1610,7 @@ void fire_missile(location target) { if(!exploding){ combat_posing_monster = current_working_monster = -1; - univ.party[missile_firer].status[0] = move_to_zero(univ.party[missile_firer].status[0]); + move_to_zero(univ.party[missile_firer].status[eStatus::POISONED_WEAPON]); } print_buf(); } @@ -1708,28 +1710,28 @@ void combat_run_monst() monsters_going = false; process_fields(); - univ.party.light_level = move_to_zero(univ.party.light_level); + move_to_zero(univ.party.light_level); if ((which_combat_type == 1) && (univ.town->lighting_type == 2)) univ.party.light_level = max (0,univ.party.light_level - 9); if (univ.town->lighting_type == 3) univ.party.light_level = 0; - PSD[SDF_PARTY_DETECT_LIFE] = move_to_zero(PSD[SDF_PARTY_DETECT_LIFE]); - PSD[SDF_PARTY_FIREWALK] = move_to_zero(PSD[SDF_PARTY_FIREWALK]); + move_to_zero(PSD[SDF_PARTY_DETECT_LIFE]); + move_to_zero(PSD[SDF_PARTY_FIREWALK]); // decrease monster present counter - PSD[SDF_HOSTILES_PRESENT] = move_to_zero(PSD[SDF_HOSTILES_PRESENT]); + move_to_zero(PSD[SDF_HOSTILES_PRESENT]); dump_gold(1); univ.party.age++; if (univ.party.age % 4 == 0) for (i = 0; i < 6; i++) { - if ((univ.party[i].status[1] != 0) || (univ.party[i].status[3] != 0)) + if(univ.party[i].status[eStatus::BLESS_CURSE] != 0 || univ.party[i].status[eStatus::HASTE_SLOW] != 0) update_stat = true; - univ.party[i].status[1] = move_to_zero(univ.party[i].status[1]); - univ.party[i].status[3] = move_to_zero(univ.party[i].status[3]); - PSD[SDF_PARTY_STEALTHY] = move_to_zero(PSD[SDF_PARTY_STEALTHY]); + move_to_zero(univ.party[i].status[eStatus::BLESS_CURSE]); + move_to_zero(univ.party[i].status[eStatus::HASTE_SLOW]); + move_to_zero(PSD[SDF_PARTY_STEALTHY]); if ((item = pc_has_abil_equip(i,50)) < 24) { update_stat = true; heal_pc(i,get_ran(1,0,univ.party[i].items[item].item_level + 1)); @@ -1737,29 +1739,29 @@ void combat_run_monst() } for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) { - if ((univ.party[i].status[4] != 0) || (univ.party[i].status[5] != 0) - || (univ.party[i].status[8] != 0)|| (univ.party[i].status[10] != 0) - || (univ.party[i].status[11] != 0)|| (univ.party[i].status[12] != 0)) + if(univ.party[i].status[eStatus::INVULNERABLE] != 0 || univ.party[i].status[eStatus::MAGIC_RESISTANCE] != 0 + || univ.party[i].status[eStatus::INVISIBLE] != 0 || univ.party[i].status[eStatus::MARTYRS_SHIELD] != 0 + || univ.party[i].status[eStatus::ASLEEP] != 0 || univ.party[i].status[eStatus::PARALYZED] != 0) update_stat = true; - univ.party[i].status[4] = move_to_zero(univ.party[i].status[4]); - univ.party[i].status[5] = move_to_zero(univ.party[i].status[5]); - univ.party[i].status[8] = move_to_zero(univ.party[i].status[8]); - univ.party[i].status[10] = move_to_zero(univ.party[i].status[10]); - univ.party[i].status[11] = move_to_zero(univ.party[i].status[11]); - univ.party[i].status[12] = move_to_zero(univ.party[i].status[12]); + move_to_zero(univ.party[i].status[eStatus::INVULNERABLE]); + move_to_zero(univ.party[i].status[eStatus::MAGIC_RESISTANCE]); + move_to_zero(univ.party[i].status[eStatus::INVISIBLE]); + move_to_zero(univ.party[i].status[eStatus::MARTYRS_SHIELD]); + move_to_zero(univ.party[i].status[eStatus::ASLEEP]); + move_to_zero(univ.party[i].status[eStatus::PARALYZED]); // Do special items if (((item_level = get_prot_level(i,47)) > 0) && (get_ran(1,0,10) == 5)) { update_stat = true; - univ.party[i].status[3] += item_level / 2; + univ.party[i].status[eStatus::HASTE_SLOW] += item_level / 2; add_string_to_buf("An item hastes you!"); } if ((item_level = get_prot_level(i,46)) > 0) { if (get_ran(1,0,10) == 5) { update_stat = true; - univ.party[i].status[1] += item_level / 2; + univ.party[i].status[eStatus::BLESS_CURSE] += item_level / 2; add_string_to_buf("An item blesses you!"); } } @@ -1854,17 +1856,17 @@ void do_monster_turn() if (is_town()) cur_monst->ap = max(1,cur_monst->ap / 3); if (univ.party.age % 2 == 0) - if (cur_monst->status[3] < 0) + if(cur_monst->status[eStatus::HASTE_SLOW] < 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); + cur_monst->ap = max(0,cur_monst->ap - cur_monst->status[eStatus::WEBS] / 2); if (cur_monst->ap == 0) - cur_monst->status[6] = max(0,cur_monst->status[6] - 2); + cur_monst->status[eStatus::WEBS] = max(0,cur_monst->status[eStatus::WEBS] - 2); } - if (cur_monst->status[3] > 0) + if(cur_monst->status[eStatus::HASTE_SLOW] > 0) cur_monst->ap *= 2; } - if ((cur_monst->status[11] > 0) || (cur_monst->status[12] > 0)) + if(cur_monst->status[eStatus::ASLEEP] > 0 || cur_monst->status[eStatus::PARALYZED] > 0) cur_monst->ap = 0; if (in_scen_debug == true) cur_monst->ap = 0; @@ -1877,7 +1879,7 @@ void do_monster_turn() cur_monst->ap = 0; monst_spell_note(cur_monst->number,17); } - cur_monst->summoned = move_to_zero(cur_monst->summoned); + move_to_zero(cur_monst->summoned); } } @@ -2039,7 +2041,7 @@ void do_monster_turn() // missile range && (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->skill*/,cur_monst->status[1], + monst_fire_missile(i/*,cur_monst->skill*/,cur_monst->status[eStatus::BLESS_CURSE], cur_monst->spec_skill,cur_monst->cur_loc,target); // Vapors don't count as action @@ -2131,7 +2133,7 @@ void do_monster_turn() for (k = 0; k < 6; k++) if(univ.party[k].main_status == eMainStatus::ALIVE && !monst_adjacent(pc_pos[k],i) && (pc_adj[k] == true) && (cur_monst->attitude % 2 == 1) && (cur_monst->active > 0) && - (univ.party[k].status[8] == 0)) { + univ.party[k].status[eStatus::INVISIBLE] == 0) { combat_posing_monster = current_working_monster = k; pc_attack(k,i); combat_posing_monster = current_working_monster = 100 + i; @@ -2201,36 +2203,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->status[13] > 0) { // Acid + if(cur_monst->status[eStatus::ACID] > 0) { // Acid if (printed_acid == false) { add_string_to_buf("Acid: "); printed_acid = true; } - r1 = get_ran(cur_monst->status[13],1,6); + r1 = get_ran(cur_monst->status[eStatus::ACID],1,6); damage_monst(i, 6,r1, 0, DAMAGE_MAGIC,0); - cur_monst->status[13]--; + cur_monst->status[eStatus::ACID]--; } - if (cur_monst->status[11] == 1) + if (cur_monst->status[eStatus::ASLEEP] == 1) monst_spell_note(cur_monst->number,29); - cur_monst->status[11] = move_to_zero(cur_monst->status[11]); - cur_monst->status[12] = move_to_zero(cur_monst->status[12]); + move_to_zero(cur_monst->status[eStatus::ASLEEP]); + move_to_zero(cur_monst->status[eStatus::PARALYZED]); if (univ.party.age % 2 == 0) { - 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]); + move_to_zero(cur_monst->status[eStatus::BLESS_CURSE]); + move_to_zero(cur_monst->status[eStatus::HASTE_SLOW]); + move_to_zero(cur_monst->status[eStatus::WEBS]); - if (cur_monst->status[2] > 0) { // Poison + if(cur_monst->status[eStatus::POISON] > 0) { // Poison if (printed_poison == false) { add_string_to_buf("Poisoned monsters: "); printed_poison = true; } - r1 = get_ran(cur_monst->status[2],1,6); + r1 = get_ran(cur_monst->status[eStatus::POISON],1,6); damage_monst(i, 6, r1, 0, DAMAGE_POISON,0); - cur_monst->status[2]--; + cur_monst->status[eStatus::POISON]--; } - if (cur_monst->status[7] > 0) { // Disease + if(cur_monst->status[eStatus::DISEASE] > 0) { // Disease if (printed_disease == false) { add_string_to_buf("Diseased monsters: "); printed_disease = true; @@ -2243,7 +2245,7 @@ void do_monster_turn() case 5: scare_monst(cur_monst,10); break; } if (get_ran(1,1,6) < 4) - cur_monst->status[7]--; + cur_monst->status[eStatus::DISEASE]--; } } @@ -2251,7 +2253,7 @@ void do_monster_turn() if (univ.party.age % 4 == 0) { if (cur_monst->mp < cur_monst->max_mp) cur_monst->mp += 2; - cur_monst->status[9] = move_to_zero(cur_monst->status[9]); + move_to_zero(cur_monst->status[eStatus::DUMB]); } } // end take care of monsters } @@ -2294,7 +2296,7 @@ void monster_attack_pc(short who_att,short target) print_monst_attacks(attacker->number,target); // Check sanctuary - if (univ.party[target].status[8] > 0) { + if(univ.party[target].status[eStatus::INVISIBLE] > 0) { r1 = get_ran(1,1,100); if (r1 > hit_chance[attacker->level / 2]) { add_string_to_buf(" Can't find target! "); @@ -2308,21 +2310,21 @@ void monster_attack_pc(short who_att,short target) // add_string_to_buf((char *) create_line); // Attack roll - r1 = get_ran(1,1,100) - 5 * min(8,attacker->status[1]) + 5 * univ.party[target].status[1] + r1 = get_ran(1,1,100) - 5 * min(8,attacker->status[eStatus::BLESS_CURSE]) + 5 * univ.party[target].status[eStatus::BLESS_CURSE] + 5 * stat_adj(target,1) - 15; - r1 += 5 * (attacker->status[6] / 3); + r1 += 5 * (attacker->status[eStatus::WEBS] / 3); if (pc_parry[target] < 100) r1 += 5 * pc_parry[target]; // Damage roll r2 = get_ran(attacker->a[i] / 100 + 1,1,attacker->a[i] % 100) - + min(8,attacker->status[1]) - univ.party[target].status[1] + 1; + + min(8,attacker->status[eStatus::BLESS_CURSE]) - univ.party[target].status[eStatus::BLESS_CURSE] + 1; if (univ.difficulty_adjust() > 2) r2 = r2 * 2; if (univ.difficulty_adjust() == 2) r2 = (r2 * 3) / 2; - if ((univ.party[target].status[11] > 0) || (univ.party[target].status[12] > 0)) { + if ((univ.party[target].status[eStatus::ASLEEP] > 0) || (univ.party[target].status[eStatus::PARALYZED] > 0)) { r1 -= 80; r2 = r2 * 2; } @@ -2344,7 +2346,7 @@ void monster_attack_pc(short who_att,short target) damaged_message(store_hp - univ.party[target].cur_health, attacker->a[i].type); - if (univ.party[target].status[10] > 0) { + if(univ.party[target].status[eStatus::MARTYRS_SHIELD] > 0) { add_string_to_buf(" Shares damage! "); damage_monst(who_att, 6, store_hp - univ.party[target].cur_health, 0, DAMAGE_MAGIC,0); } @@ -2373,7 +2375,7 @@ void monster_attack_pc(short who_att,short target) // Petrification touch if ((attacker->spec_skill == 30) && (pc_has_abil_equip(target,49) == 24) - && (get_ran(1,0,20) + univ.party[target].level / 4 + univ.party[target].status[1]) <= 14) + && (get_ran(1,0,20) + univ.party[target].level / 4 + univ.party[target].status[eStatus::BLESS_CURSE]) <= 14) { add_string_to_buf(" Petrifying touch!"); print_buf(); @@ -2410,13 +2412,13 @@ void monster_attack_pc(short who_att,short target) // Sleep target if (attacker->spec_skill == 28) { add_string_to_buf(" Sleeps! "); - sleep_pc(target,6,STATUS_ASLEEP,-15); + sleep_pc(target,6,eStatus::ASLEEP,-15); put_pc_screen(); } // Paralyze target if (attacker->spec_skill == 29) { add_string_to_buf(" Paralysis touch! "); - sleep_pc(target,500,STATUS_PARALYZED,-5); + sleep_pc(target,500,eStatus::PARALYZED,-5); put_pc_screen(); } // Acid touch @@ -2488,15 +2490,15 @@ void monster_attack_monster(short who_att,short attackee) target->attitude = 2; // Attack roll - r1 = get_ran(1,1,100) - 5 * min(10,attacker->status[1]) - + 5 * target->status[1] - 15; - r1 += 5 * (attacker->status[6] / 3); + r1 = get_ran(1,1,100) - 5 * min(10,attacker->status[eStatus::BLESS_CURSE]) + + 5 * target->status[eStatus::BLESS_CURSE] - 15; + r1 += 5 * (attacker->status[eStatus::WEBS] / 3); // Damage roll r2 = get_ran(attacker->a[i] / 100 + 1,1,attacker->a[i] % 100) - + min(10,attacker->status[1]) - target->status[1] + 2; + + min(10,attacker->status[eStatus::BLESS_CURSE]) - target->status[eStatus::BLESS_CURSE] + 2; - if ((target->status[11] > 0) || (target->status[12] > 0)) { + if(target->status[eStatus::ASLEEP] > 0 || target->status[eStatus::PARALYZED] > 0) { r1 -= 80; r2 = r2 * 2; } @@ -2534,7 +2536,7 @@ void monster_attack_monster(short who_att,short attackee) // Sleep target if (attacker->spec_skill == 28) { add_string_to_buf(" Sleeps! "); - charm_monst(target,-15,11,6); + charm_monst(target,-15,eStatus::ASLEEP,6); } // Dumbfound target if (attacker->spec_skill == 24) { @@ -2544,7 +2546,7 @@ void monster_attack_monster(short who_att,short attackee) // Paralyze target if (attacker->spec_skill == 29) { add_string_to_buf(" Paralysis touch! "); - charm_monst(target,-5,12,500); + charm_monst(target,-5,eStatus::PARALYZED,500); } // Acid touch if (attacker->spec_skill == 31) { @@ -2654,11 +2656,11 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if (target < 100) { // on PC sprintf ((char *) create_line, " Fires ray at %s. ",(char *) univ.party[target].name.c_str()); add_string_to_buf((char *) create_line); - sleep_pc(target,100,STATUS_PARALYZED,0); + sleep_pc(target,100,eStatus::PARALYZED,0); } else { // on monst add_string_to_buf(" Shoots a ray."); - charm_monst(m_target,0,12,100); + charm_monst(m_target,0,eStatus::PARALYZED,100); } //run_a_missile(source,targ_space,8,0,14, // 0,0,100); @@ -2670,7 +2672,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor if (target < 100) { // on PC sprintf ((char *) create_line, " Gazes at %s. ",(char *) univ.party[target].name.c_str()); add_string_to_buf((char *) create_line); - r1 = get_ran(1,0,20) + univ.party[target].level / 4 + univ.party[target].status[1]; + r1 = get_ran(1,0,20) + univ.party[target].level / 4 + univ.party[target].status[eStatus::BLESS_CURSE]; if (pc_has_abil_equip(target,49) < 24) r1 = 20; if (r1 > 14) { @@ -2685,7 +2687,7 @@ 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->level / 4 + m_target->status[1]; + r1 = get_ran(1,0,20) + m_target->level / 4 + m_target->status[eStatus::BLESS_CURSE]; if ((r1 > 14) || (m_target->immunities & 2)) monst_spell_note(m_target->number,10); else { @@ -2782,7 +2784,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor add_string_to_buf((char *) create_line); // Check sanctuary - if (univ.party[target].status[8] > 0) { + if(univ.party[target].status[eStatus::INVISIBLE] > 0) { r1 = get_ran(1,1,100); if (r1 > hit_chance[level]) { add_string_to_buf(" Can't find target! "); @@ -2790,7 +2792,7 @@ void monst_fire_missile(short m_num,short bless,short level,location source,shor return; } - r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * univ.party[target].status[1] + r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * univ.party[target].status[eStatus::BLESS_CURSE] - 5 * (can_see_light(source, pc_pos[target],sight_obscurity)); if (pc_parry[target] < 100) r1 += 5 * pc_parry[target]; @@ -2833,7 +2835,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->status[1] + r1 = get_ran(1,1,100) - 5 * min(10,bless) + 5 * m_target->status[eStatus::BLESS_CURSE] - 5 * (can_see_light(source, m_target->cur_loc,sight_obscurity)); r2 = get_ran(dam[level],1,7) + min(10,bless); @@ -2920,15 +2922,15 @@ bool monst_cast_mage(cCreature *caster,short targ)//// if ((targ >= 100) && (univ.town.monst[targ - 100].active == 0)) return false; - level = max(1,caster->mu - caster->status[9]) - 1; + level = max(1,caster->mu - caster->status[eStatus::DUMB]) - 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->health * 4 < caster->m_health) && (get_ran(1,0,10) < 9)) spell = emer_spells[level][3]; - 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)) + else if(((caster->status[eStatus::HASTE_SLOW] < 0 && get_ran(1,0,10) < 7) || + (caster->status[eStatus::HASTE_SLOW] == 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]; @@ -2940,7 +2942,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// } // Hastes happen often now, but don't cast them redundantly - if ((caster->status[3] > 0) && ((spell == 2) || (spell == 18))) + if(caster->status[eStatus::HASTE_SLOW] > 0 && (spell == 2 || spell == 18)) spell = emer_spells[level][3]; @@ -3005,11 +3007,11 @@ bool monst_cast_mage(cCreature *caster,short targ)//// break; case 2: // minor haste play_sound(25); - caster->status[3] += 2; + caster->status[eStatus::HASTE_SLOW] += 2; break; case 3: // strength play_sound(25); - caster->status[1] += 3; + caster->status[eStatus::BLESS_CURSE] += 3; break; case 4: // flame cloud run_a_missile(l,vict_loc,2,1,11,0,0,80); @@ -3134,7 +3136,7 @@ bool monst_cast_mage(cCreature *caster,short targ)//// if ((monst_near(i,caster->cur_loc,8,0)) && (caster->attitude == univ.town.monst[i].attitude)) { affected = &univ.town.monst[i]; - affected->status[3] += 3; + affected->status[eStatus::HASTE_SLOW] += 3; } play_sound(4); break; @@ -3184,10 +3186,10 @@ bool monst_cast_mage(cCreature *caster,short targ)//// affected = &univ.town.monst[i]; affected->health += get_ran(2,1,10); r1 = get_ran(3,1,4); - affected->status[1] = min(8,affected->status[1] + r1); - affected->status[6] = 0; - if (affected->status[3] < 0) - affected->status[3] = 0; + affected->status[eStatus::BLESS_CURSE] = min(8,affected->status[eStatus::BLESS_CURSE] + r1); + affected->status[eStatus::WEBS] = 0; + if (affected->status[eStatus::HASTE_SLOW] < 0) + affected->status[eStatus::HASTE_SLOW] = 0; affected->morale += get_ran(3,1,10); } play_sound(4); @@ -3240,14 +3242,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->cl - caster->status[9]) - 1; + level = max(1,caster->cl - caster->status[eStatus::DUMB]) - 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->health * 4 < caster->m_health) && (get_ran(1,0,10) < 9)) spell = emer_spells[level][3]; - else if ((caster->status[3] < 0) && (get_ran(1,0,10) < 7) && (emer_spells[level][0] != 0)) + else if(caster->status[eStatus::HASTE_SLOW] < 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]; @@ -3313,7 +3315,7 @@ bool monst_cast_priest(cCreature *caster,short targ) break; case 1: case 5: // Blesses play_sound(24); - caster->status[1] = min(8,caster->status[1] + (spell == 1) ? 3 : 5); + caster->status[eStatus::BLESS_CURSE] = min(8,caster->status[eStatus::BLESS_CURSE] + (spell == 1) ? 3 : 5); play_sound(4); break; case 6: // curse @@ -3378,7 +3380,7 @@ bool monst_cast_priest(cCreature *caster,short targ) break; case 15: // martyr's shield play_sound(24); - caster->status[10] = min(10,caster->status[10] + 5); + caster->status[eStatus::MARTYRS_SHIELD] = min(10,caster->status[eStatus::MARTYRS_SHIELD] + 5); break; case 19: // summon host play_sound(24); @@ -3438,7 +3440,7 @@ bool monst_cast_priest(cCreature *caster,short targ) (caster->attitude == univ.town.monst[i].attitude)) { affected = &univ.town.monst[i]; if (spell == 16) - affected->status[1] = min(8,affected->status[1] + r1); + affected->status[eStatus::BLESS_CURSE] = min(8,affected->status[eStatus::BLESS_CURSE] + r1); if (spell == 24) affected->health += r1; } @@ -3471,13 +3473,13 @@ bool monst_cast_priest(cCreature *caster,short targ) play_sound(24); monst_spell_note(caster->number,26); 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; + caster->status[eStatus::MARTYRS_SHIELD] = 8; + caster->status[eStatus::POISON] = 0; + caster->status[eStatus::HASTE_SLOW] = 8; + caster->status[eStatus::WEBS] = 0; + caster->status[eStatus::DISEASE] = 0; + caster->status[eStatus::DUMB] = 0; + caster->status[eStatus::MARTYRS_SHIELD] = 8; break; case 26: // divine thud run_a_missile(l,target,9,0,11,0,0,80); @@ -3767,7 +3769,7 @@ void place_spell_pattern(effect_pat_type pat,location center,short type,bool pre break; case 12: which_m = &univ.town.monst[k]; - charm_monst(which_m,0,11,3); + charm_monst(which_m,0,eStatus::ASLEEP,3); break; default: if ((effect >= 50) && (effect < 80)) { @@ -3937,20 +3939,21 @@ void do_poison() for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) - if (univ.party[i].status[2] > 0) + if(univ.party[i].status[eStatus::POISON] > 0) some_poison = true; if (some_poison == true) { add_string_to_buf("Poison: "); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) - if (univ.party[i].status[2] > 0) { - r1 = get_ran(univ.party[i].status[2],1,6); + if(univ.party[i].status[eStatus::POISON] > 0) { + r1 = get_ran(univ.party[i].status[eStatus::POISON],1,6); damage_pc(i,r1,DAMAGE_POISON,eRace::UNKNOWN,0); if (get_ran(1,0,8) < 6) - univ.party[i].status[2] = move_to_zero(univ.party[i].status[2]); + move_to_zero(univ.party[i].status[eStatus::POISON]); if (get_ran(1,0,8) < 6) if (univ.party[i].traits[6] == true) - univ.party[i].status[2] = move_to_zero(univ.party[i].status[2]); + move_to_zero(univ.party[i].status[eStatus::POISON]); + // TODO: Shouldn't the above two conditionals be swapped? } put_pc_screen(); //if (overall_mode < 10) @@ -3966,14 +3969,14 @@ void handle_disease() for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) - if (univ.party[i].status[7] > 0) + if(univ.party[i].status[eStatus::DISEASE] > 0) disease = true; if (disease == true) { add_string_to_buf("Disease: "); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) - if (univ.party[i].status[7] > 0) { + if(univ.party[i].status[eStatus::DISEASE] > 0) { r1 = get_ran(1,1,10); switch (r1) { case 1: case 2: @@ -4001,7 +4004,7 @@ void handle_disease() if (univ.party[i].traits[6] == true) r1 -= 2; if ((get_ran(1,0,7) <= 0) || (pc_has_abil_equip(i,ITEM_PROTECT_FROM_DISEASE) < 24)) - univ.party[i].status[7] = move_to_zero(univ.party[i].status[7]); + move_to_zero(univ.party[i].status[eStatus::DISEASE]); } put_pc_screen(); } @@ -4014,17 +4017,17 @@ void handle_acid() for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) - if (univ.party[i].status[13] > 0) + if(univ.party[i].status[eStatus::ACID] > 0) some_acid = true; if (some_acid == true) { add_string_to_buf("Acid: "); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) - if (univ.party[i].status[13] > 0) { - r1 = get_ran(univ.party[i].status[13],1,6); + if(univ.party[i].status[eStatus::ACID] > 0) { + r1 = get_ran(univ.party[i].status[eStatus::ACID],1,6); damage_pc(i,r1,DAMAGE_MAGIC,eRace::UNKNOWN,0); - univ.party[i].status[13] = move_to_zero(univ.party[i].status[13]); + move_to_zero(univ.party[i].status[eStatus::ACID]); } if (overall_mode < MODE_COMBAT) boom_space(univ.party.p_loc,overall_mode,3,r1,8); @@ -4079,9 +4082,9 @@ void end_combat() for (i = 0; i < 6; i++) { if(univ.party[i].main_status == eMainStatus::FLED) univ.party[i].main_status = eMainStatus::ALIVE; - univ.party[i].status[0] = 0; - univ.party[i].status[1] = 0; - univ.party[i].status[3] = 0; + univ.party[i].status[eStatus::POISONED_WEAPON] = 0; + univ.party[i].status[eStatus::BLESS_CURSE] = 0; + univ.party[i].status[eStatus::HASTE_SLOW] = 0; } if (which_combat_type == 0) { overall_mode = MODE_OUTDOORS; @@ -4186,20 +4189,19 @@ bool combat_cast_mage_spell() case 3: sprintf ((char *) c_line, " %s stronger. ", (char *) univ.party[target].name.c_str()); - univ.party[target].status[1] = univ.party[target].status[1] + 3; + univ.party[target].status[eStatus::BLESS_CURSE] = univ.party[target].status[eStatus::BLESS_CURSE] + 3; store_m_type = 8; break; case 29: sprintf ((char *) c_line, " %s resistant. ", (char *) univ.party[target].name.c_str()); - univ.party[target].status[5] = univ.party[target].status[5] + 5 + bonus; + univ.party[target].status[eStatus::MAGIC_RESISTANCE] = univ.party[target].status[eStatus::MAGIC_RESISTANCE] + 5 + bonus; store_m_type = 15; break; default: i = (spell_num == 2) ? 2 : max(2,univ.party[current_pc].level / 2 + bonus); - univ.party[target].status[3] = min(8, - univ.party[target].status[3] + i); + univ.party[target].status[eStatus::HASTE_SLOW] = min(8, univ.party[target].status[eStatus::HASTE_SLOW] + i); sprintf ((char *) c_line, " %s hasted. ", (char *) univ.party[target].name.c_str()); store_m_type = 8; @@ -4217,11 +4219,10 @@ bool combat_cast_mage_spell() for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) { - univ.party[i].status[3] = min(8, - univ.party[i].status[3] + ((spell_num == 39) ? 1 + univ.party[current_pc].level / 8 + bonus : 3 + bonus)); + univ.party[i].status[eStatus::HASTE_SLOW] = min(8, univ.party[i].status[eStatus::HASTE_SLOW] + ((spell_num == 39) ? 1 + univ.party[current_pc].level / 8 + bonus : 3 + bonus)); if (spell_num == 55) { poison_weapon(i,2,1); - univ.party[i].status[1] += 4; + univ.party[i].status[eStatus::BLESS_CURSE] += 4; add_missile(pc_pos[i],14,0,0,0); } else add_missile(pc_pos[i],8,0,0,0); @@ -4267,7 +4268,7 @@ bool combat_cast_mage_spell() store_m_type = 8; break; case 56: - charm_monst(which_m,15,12,1000); + charm_monst(which_m,15,eStatus::PARALYZED,1000); store_m_type = 15; break; } @@ -4360,7 +4361,7 @@ bool combat_cast_priest_spell() if (target < 6) { store_sound = 4; univ.party[current_pc].cur_sp -= s_cost[1][spell_num]; - univ.party[target].status[1] += (spell_num == 0) ? 2 : + univ.party[target].status[eStatus::BLESS_CURSE] += (spell_num == 0) ? 2 : max(2,(univ.party[current_pc].level * 3) / 4 + 1 + bonus); sprintf ((char *) c_line, " %s blessed. ", (char *) univ.party[target].name.c_str()); @@ -4373,7 +4374,7 @@ bool combat_cast_priest_spell() univ.party[current_pc].cur_sp -= s_cost[1][spell_num]; for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) { - univ.party[i].status[1] += univ.party[current_pc].level / 3; + univ.party[i].status[eStatus::BLESS_CURSE] += univ.party[current_pc].level / 3; add_missile(pc_pos[i],8,0,0,0); } sprintf ((char *) c_line, " Party blessed. "); @@ -4388,14 +4389,14 @@ bool combat_cast_priest_spell() add_string_to_buf((char *) c_line); heal_pc(current_pc,200); cure_pc(current_pc,8); - univ.party[current_pc].status[1] = 8; - univ.party[current_pc].status[3] = 8; - univ.party[current_pc].status[4] = 3; - univ.party[current_pc].status[5] = 8; - univ.party[current_pc].status[6] = 0; - univ.party[current_pc].status[7] = 0; - univ.party[current_pc].status[9] = 0; - univ.party[current_pc].status[10] = 8; + univ.party[current_pc].status[eStatus::BLESS_CURSE] = 8; + univ.party[current_pc].status[eStatus::HASTE_SLOW] = 8; + univ.party[current_pc].status[eStatus::INVULNERABLE] = 3; + univ.party[current_pc].status[eStatus::MAGIC_RESISTANCE] = 8; + univ.party[current_pc].status[eStatus::WEBS] = 0; + univ.party[current_pc].status[eStatus::DISEASE] = 0; + univ.party[current_pc].status[eStatus::DUMB] = 0; + univ.party[current_pc].status[eStatus::MARTYRS_SHIELD] = 8; break; case 31: case 51: case 53: @@ -4411,7 +4412,7 @@ bool combat_cast_priest_spell() store_m_type = 8; break; case 51: - charm_monst(which_m,28 - bonus,0,0); + charm_monst(which_m,28 - bonus,eStatus::CHARM,0); store_m_type = 14; break; case 53: @@ -4779,12 +4780,12 @@ void sleep_cloud_space(short m,short n) for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) if (pc_pos[i] == target) { - sleep_pc(i,3,STATUS_ASLEEP,0); + sleep_pc(i,3,eStatus::ASLEEP,0); } if (overall_mode < MODE_COMBAT) if (target == univ.town.p_loc) { for (i = 0; i < 6; i++) - sleep_pc(i,3,STATUS_ASLEEP,0); + sleep_pc(i,3,eStatus::ASLEEP,0); } } diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index c26344a0..7ad880d9 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -281,12 +281,14 @@ void handle_sale(short what_chosen,short cost) univ.party[current_pc].cur_health = univ.party[current_pc].max_health; break; case 1: - univ.party[current_pc].status[2] = 0; + univ.party[current_pc].status[eStatus::POISON] = 0; break; case 2: - univ.party[current_pc].status[7] = 0; break; + univ.party[current_pc].status[eStatus::DISEASE] = 0; + break; case 3: - univ.party[current_pc].status[12] = 0; break; + univ.party[current_pc].status[eStatus::PARALYZED] = 0; + break; case 4: for (i = 0; i < 24; i++) if ((univ.party[current_pc].equip[i] == true) && @@ -294,9 +296,11 @@ void handle_sale(short what_chosen,short cost) univ.party[current_pc].items[i].cursed = univ.party[current_pc].items[i].unsellable = false; break; case 5: case 6: case 7: - univ.party[current_pc].main_status = eMainStatus::ALIVE; break; + univ.party[current_pc].main_status = eMainStatus::ALIVE; + break; case 8: - univ.party[current_pc].status[9] = 0; break; + univ.party[current_pc].status[eStatus::DUMB] = 0; + break; } } break; @@ -416,22 +420,22 @@ void set_up_shop_array() store_shop_costs[shop_pos] = heal_costs[0]; shop_pos++; } - if (univ.party[current_pc].status[2] > 0) { + if (univ.party[current_pc].status[eStatus::POISON] > 0) { store_shop_items[shop_pos] = 701; store_shop_costs[shop_pos] = heal_costs[1]; shop_pos++; } - if (univ.party[current_pc].status[7] > 0) { + if (univ.party[current_pc].status[eStatus::DISEASE] > 0) { store_shop_items[shop_pos] = 702; store_shop_costs[shop_pos] = heal_costs[2]; shop_pos++; } - if (univ.party[current_pc].status[12] > 0) { + if (univ.party[current_pc].status[eStatus::PARALYZED] > 0) { store_shop_items[shop_pos] = 703; store_shop_costs[shop_pos] = heal_costs[3]; shop_pos++; } - if (univ.party[current_pc].status[9] > 0) { + if (univ.party[current_pc].status[eStatus::DUMB] > 0) { store_shop_items[shop_pos] = 708; store_shop_costs[shop_pos] = heal_costs[8]; shop_pos++; diff --git a/osx/boe.infodlg.cpp b/osx/boe.infodlg.cpp index 3093112c..6f8528a4 100644 --- a/osx/boe.infodlg.cpp +++ b/osx/boe.infodlg.cpp @@ -632,11 +632,11 @@ static void display_pc_info(cDialog& me) } hit_adj = stat_adj(pc,1) * 5 - (total_encumberance(pc)) * 5 - + 5 * minmax(-8,8,univ.party[pc].status[1]); + + 5 * minmax(-8,8,univ.party[pc].status[eStatus::BLESS_CURSE]); if ((univ.party[pc].traits[2] == false) && (weap2 < 24)) hit_adj -= 25; - dam_adj = stat_adj(pc,0) + minmax(-8,8,univ.party[pc].status[1]); + dam_adj = stat_adj(pc,0) + minmax(-8,8,univ.party[pc].status[eStatus::BLESS_CURSE]); if ((skill_item = text_pc_has_abil_equip(pc,37)) < 24) { hit_adj += 5 * (univ.party[pc].items[skill_item].item_level / 2 + 1); dam_adj += univ.party[pc].items[skill_item].item_level / 2; diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index e49b6fbe..a062d8d1 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -416,11 +416,11 @@ void take_item(short pc_num,short which_item) which_item -= 30; } - if ((univ.party[pc_num].weap_poisoned == which_item) && (univ.party[pc_num].status[0] > 0)) { + if(univ.party[pc_num].weap_poisoned == which_item && univ.party[pc_num].status[eStatus::POISONED_WEAPON] > 0) { add_string_to_buf(" Poison lost. "); - univ.party[pc_num].status[0] = 0; + univ.party[pc_num].status[eStatus::POISONED_WEAPON] = 0; } - if ((univ.party[pc_num].weap_poisoned > which_item) && (univ.party[pc_num].status[0] > 0)) + if(univ.party[pc_num].weap_poisoned > which_item && univ.party[pc_num].status[eStatus::POISONED_WEAPON] > 0) univ.party[pc_num].weap_poisoned--; for (i = which_item; i < 23; i++) { @@ -528,9 +528,9 @@ void equip_item(short pc_num,short item_num) else { univ.party[pc_num].equip[item_num] = false; add_string_to_buf("Equip: Unequipped"); - if ((univ.party[pc_num].weap_poisoned == item_num) && (univ.party[pc_num].status[0] > 0)) { + if(univ.party[pc_num].weap_poisoned == item_num && univ.party[pc_num].status[eStatus::POISONED_WEAPON] > 0) { add_string_to_buf(" Poison lost. "); - univ.party[pc_num].status[0] = 0; + univ.party[pc_num].status[eStatus::POISONED_WEAPON] = 0; } } } @@ -854,13 +854,14 @@ void make_town_hostile() // If a town, give pwoer boost univ.town.monst[i].health *= 3; - univ.town.monst[i].status[3] = 8; - univ.town.monst[i].status[1] = 8; + univ.town.monst[i].status[eStatus::HASTE_SLOW] = 8; + univ.town.monst[i].status[eStatus::BLESS_CURSE] = 8; } } // In some towns, doin' this'll getcha' killed. //// wedge in special + // TODO: Resupport this! if (fry_party == true) { for (i = 0; i < 6; i++) diff --git a/osx/boe.monster.cpp b/osx/boe.monster.cpp index 273d3897..486c4916 100644 --- a/osx/boe.monster.cpp +++ b/osx/boe.monster.cpp @@ -247,8 +247,8 @@ void do_monsters() if (overall_mode == MODE_TOWN) for (i = 0; i < univ.town->max_monst(); i++) - if ((univ.town.monst[i].active != 0) && (univ.town.monst[i].status[11] <= 0) - && (univ.town.monst[i].status[12] <= 0)) { + if(univ.town.monst[i].active != 0 && univ.town.monst[i].status[eStatus::ASLEEP] <= 0 + && univ.town.monst[i].status[eStatus::PARALYZED] <= 0) { // have to pick targets if (univ.town.monst[i].active == 1) target = 6; @@ -883,7 +883,7 @@ void monst_inflict_fields(short which_monst) break; } if (univ.town.is_sleep_cloud(where_check.x,where_check.y)) { - charm_monst(which_m,0,11,3); + charm_monst(which_m,0,eStatus::ASLEEP,3); break; } if (univ.town.is_ice_wall(where_check.x,where_check.y)) { @@ -1152,14 +1152,14 @@ void poison_monst(cCreature *which_m,short how_much) monst_spell_note(which_m->number,10); return; } - which_m->status[2] = min(8, which_m->status[2] + how_much); + which_m->status[eStatus::POISON] = min(8, which_m->status[eStatus::POISON] + 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->status[13] = minmax(-8,8, which_m->status[13] + how_much); + which_m->status[eStatus::ACID] = minmax(-8,8, which_m->status[eStatus::ACID] + how_much); monst_spell_note(which_m->number,31); } @@ -1167,21 +1167,21 @@ 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->status[3] = minmax(-8,8, which_m->status[3] - how_much); + which_m->status[eStatus::HASTE_SLOW] = minmax(-8,8, which_m->status[eStatus::HASTE_SLOW] - 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->status[1] = minmax(-8,8, which_m->status[1] - how_much); + which_m->status[eStatus::BLESS_CURSE] = minmax(-8,8, which_m->status[eStatus::BLESS_CURSE] - 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->status[6] = minmax(-8,8, which_m->status[6] + how_much); + which_m->status[eStatus::WEBS] = minmax(-8,8, which_m->status[eStatus::WEBS] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 19); } @@ -1195,7 +1195,7 @@ void scare_monst(cCreature *which_m,short how_much) void disease_monst(cCreature *which_m,short how_much) { magic_adjust(which_m,&how_much); - which_m->status[7] = minmax(-8,8, which_m->status[7] + how_much); + which_m->status[eStatus::DISEASE] = minmax(-8,8, which_m->status[eStatus::DISEASE] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 25); } @@ -1203,18 +1203,18 @@ 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->status[9] = minmax(-8,8, which_m->status[9] + how_much); + which_m->status[eStatus::DUMB] = minmax(-8,8, which_m->status[eStatus::DUMB] + how_much); monst_spell_note(which_m->number,(how_much == 0) ? 10 : 22); } -void charm_monst(cCreature *which_m,short penalty,short which_status,short amount) +void charm_monst(cCreature *which_m,short penalty,eStatus which_status,short amount) // Also used for sleep and paralyze, which_statys is 0 means charm { short r1; - if ((which_status == 11) && + if ((which_status == eStatus::ASLEEP) && (which_m->m_type == eRace::UNDEAD || which_m->m_type == eRace::SLIME || which_m->m_type == eRace::STONE || which_m->m_type == eRace::PLANT)) return; @@ -1224,11 +1224,11 @@ void charm_monst(cCreature *which_m,short penalty,short which_status,short amoun if (which_m->immunities & 2) r1 = 200; r1 += penalty; - if (which_status == 11) + if (which_status == eStatus::ASLEEP) r1 -= 25; - if (which_status == 12) + if (which_status == eStatus::PARALYZED) r1 -= 15; - if ((which_status == 11) && (which_m->spec_skill == 32)) + if ((which_status == eStatus::ASLEEP) && (which_m->spec_skill == 32)) return; if (r1 > charm_odds[which_m->level / 2]) { @@ -1236,15 +1236,15 @@ void charm_monst(cCreature *which_m,short penalty,short which_status,short amoun monst_spell_note(which_m->number,10); } else { - if (which_status == 0) { + if (which_status == eStatus::CHARM) { which_m->attitude = 2; monst_spell_note(which_m->number,23); } else { which_m->status[which_status] = amount; - if (which_status == 11) + if (which_status == eStatus::ASLEEP) monst_spell_note(which_m->number,28); - if (which_status == 12) + if (which_status == eStatus::PARALYZED) monst_spell_note(which_m->number,30); } //one_sound(53); diff --git a/osx/boe.monster.h b/osx/boe.monster.h index d99e09bd..66976896 100644 --- a/osx/boe.monster.h +++ b/osx/boe.monster.h @@ -43,7 +43,7 @@ void web_monst(cCreature *which_m,short how_much); void scare_monst(cCreature *which_m,short how_much); void disease_monst(cCreature *which_m,short how_much); void dumbfound_monst(cCreature *which_m,short how_much); -void charm_monst(cCreature *which_m,short penalty,short which_status,short amount); +void charm_monst(cCreature *which_m,short penalty,eStatus which_status,short amount); void record_monst(cCreature *which_m); short place_monster(m_num_t which,location where); bool summon_monster(m_num_t which,location where,short duration,short given_attitude); diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 455c91c8..eb6bcbc7 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -437,10 +437,8 @@ void put_party_in_scen(std::string scen_name) std::array buttons = {-1,-1,-1}; bool item_took = false; - for (j = 0; j < 6; j++) - for (i = 0; i < 15; i++) - univ.party[j].status[i] = 0; for (j = 0; j < 6; j++) { + univ.party[i].status.clear(); if(isSplit(univ.party[j].main_status)) univ.party[j].main_status -= eMainStatus::SPLIT; univ.party[j].cur_health = univ.party[j].max_health; @@ -624,9 +622,9 @@ void cure_pc(short pc_num,short amt) { if(univ.party[pc_num].main_status != eMainStatus::ALIVE) return; - if (univ.party[pc_num].status[2] <= amt) - univ.party[pc_num].status[2] = 0; - else univ.party[pc_num].status[2] -= amt; + if(univ.party[pc_num].status[eStatus::POISON] <= amt) + univ.party[pc_num].status[eStatus::POISON] = 0; + else univ.party[pc_num].status[eStatus::POISON] -= amt; one_sound(51); } @@ -646,7 +644,7 @@ void curse_pc(short which_pc,short how_much) if(univ.party[which_pc].main_status != eMainStatus::ALIVE) return; if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { - univ.party[which_pc].status[1] = minmax(-8,8,univ.party[which_pc].status[1] - how_much); + univ.party[which_pc].status[eStatus::BLESS_CURSE] = minmax(-8,8,univ.party[which_pc].status[eStatus::BLESS_CURSE] - how_much); if(how_much < 0) sprintf ((char *) c_line, " %s blessed.",(char *) univ.party[which_pc].name.c_str()); else sprintf ((char *) c_line, " %s cursed.",(char *) univ.party[which_pc].name.c_str()); @@ -676,7 +674,7 @@ void dumbfound_pc(short which_pc,short how_much) return; } if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { - univ.party[which_pc].status[9] = min(univ.party[which_pc].status[9] + how_much,8); + univ.party[which_pc].status[eStatus::DUMB] = min(univ.party[which_pc].status[eStatus::DUMB] + how_much,8); sprintf ((char *) c_line, " %s dumbfounded.",(char *) univ.party[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } @@ -708,7 +706,7 @@ void disease_pc(short which_pc,short how_much) (how_much == 1) && (get_ran(1,0,1) == 0)) how_much++; if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { - univ.party[which_pc].status[7] = min(univ.party[which_pc].status[7] + how_much,8); + univ.party[which_pc].status[eStatus::DISEASE] = min(univ.party[which_pc].status[eStatus::DISEASE] + how_much,8); sprintf ((char *) c_line, " %s diseased.",(char *) univ.party[which_pc].name.c_str()); add_string_to_buf((char *) c_line); } @@ -725,18 +723,20 @@ void sleep_pc(short which_pc,short how_much,eStatus what_type,short adjust) return; if (how_much == 0) return; - if ((what_type == 11) || (what_type == 12)) { //// + // TODO: Uh, what if an invalid status is passed in? + // --> Currently, you'd get that status effect, but with a "paralyzed" message, sound, and quick-help + if(what_type == eStatus::ASLEEP || what_type == eStatus::PARALYZED) { //// if ((level = get_prot_level(which_pc,53)) > 0) how_much -= level / 2; if ((level = get_prot_level(which_pc,54)) > 0) - how_much -= (what_type == 11) ? level : level * 300; + how_much -= (what_type == eStatus::ASLEEP) ? level : level * 300; } r1 = get_ran(1,1,100) + adjust; if (r1 < 30 + univ.party[which_pc].level * 2) how_much = -1; - if ((what_type == 11) && ((univ.party[which_pc].traits[7] > 0) || (univ.party[which_pc].status[11] < 0))) + if(what_type == eStatus::ASLEEP && (univ.party[which_pc].traits[7] > 0 || univ.party[which_pc].status[eStatus::ASLEEP] < 0)) how_much = -1; if (how_much <= 0) { sprintf ((char *) c_line, " %s resisted.",(char *) univ.party[which_pc].name.c_str()); @@ -745,17 +745,17 @@ void sleep_pc(short which_pc,short how_much,eStatus what_type,short adjust) } if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { univ.party[which_pc].status[what_type] = how_much; - if (what_type == 11) + if(what_type == eStatus::ASLEEP) sprintf ((char *) c_line, " %s falls asleep.",(char *) univ.party[which_pc].name.c_str()); else sprintf ((char *) c_line, " %s paralyzed.",(char *) univ.party[which_pc].name.c_str()); - if (what_type == 11) + if(what_type == eStatus::ASLEEP) play_sound(96); else play_sound(90); add_string_to_buf((char *) c_line); univ.party[which_pc].ap = 0; } put_pc_screen(); - if (what_type == 11) + if(what_type == eStatus::ASLEEP) give_help(30,0); else give_help(32,0); @@ -768,7 +768,7 @@ void slow_pc(short which_pc,short how_much)//// return; if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { - univ.party[which_pc].status[3] = minmax(-8,8,univ.party[which_pc].status[3] - how_much); + univ.party[which_pc].status[eStatus::HASTE_SLOW] = minmax(-8,8,univ.party[which_pc].status[eStatus::HASTE_SLOW] - how_much); if (how_much < 0) sprintf ((char *) c_line, " %s hasted.",(char *) univ.party[which_pc].name.c_str()); else sprintf ((char *) c_line, " %s slowed.",(char *) univ.party[which_pc].name.c_str()); @@ -784,7 +784,7 @@ void web_pc(short which_pc,short how_much) if(univ.party[which_pc].main_status != eMainStatus::ALIVE) return; if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { - univ.party[which_pc].status[6] = min(univ.party[which_pc].status[6] + how_much,8); + univ.party[which_pc].status[eStatus::WEBS] = min(univ.party[which_pc].status[eStatus::WEBS] + how_much,8); sprintf ((char *) c_line, " %s webbed.",(char *) univ.party[which_pc].name.c_str()); add_string_to_buf((char *) c_line); one_sound(17); @@ -803,7 +803,7 @@ void acid_pc(short which_pc,short how_much) return; } if(univ.party[which_pc].main_status == eMainStatus::ALIVE) { - univ.party[which_pc].status[13] += how_much; + univ.party[which_pc].status[eStatus::ACID] += how_much; sprintf ((char *) c_line, " %s covered with acid!",(char *) univ.party[which_pc].name.c_str()); add_string_to_buf((char *) c_line); one_sound(42); @@ -986,14 +986,13 @@ bool poison_weapon( short pc_num, short how_much,short safe) r1 = get_ran(1,1,100); if (r1 > p_chance[univ.party[pc_num].skills[17]] + 10) { add_string_to_buf(" You nick yourself. "); - univ.party[pc_num].status[2] += p_level; + univ.party[pc_num].status[eStatus::POISON] += p_level; } } if (safe != 1) play_sound(55); univ.party[pc_num].weap_poisoned = weap; - univ.party[pc_num].status[0] = max (univ.party[pc_num].status[0], - p_level); + max (univ.party[pc_num].status[eStatus::POISON], p_level); return true; } @@ -1271,15 +1270,15 @@ void do_mage_spell(short pc_num,short spell_num) if (target < 6) univ.party[pc_num].cur_sp -= spell_cost[0][spell_num]; if ((spell_num == 57) && (target < 6)) { - univ.party[target].status[4] += 2 + stat_adj(pc_num,2) + get_ran(2,1,2); + univ.party[target].status[eStatus::INVULNERABLE] += 2 + stat_adj(pc_num,2) + get_ran(2,1,2); for (i = 0; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) { - univ.party[i].status[5] += 4 + univ.party[pc_num].level / 3 + stat_adj(pc_num,2); + univ.party[i].status[eStatus::MAGIC_RESISTANCE] += 4 + univ.party[pc_num].level / 3 + stat_adj(pc_num,2); } sprintf ((char *) c_line, " Party protected. "); } if ((spell_num == 29) && (target < 6)) { - univ.party[target].status[5] += 2 + stat_adj(pc_num,2) + get_ran(2,1,2); + univ.party[target].status[eStatus::MAGIC_RESISTANCE] += 2 + stat_adj(pc_num,2) + get_ran(2,1,2); sprintf ((char *) c_line, " %s protected.",univ.party[target].name.c_str()); } add_string_to_buf((char *) c_line); @@ -1461,45 +1460,45 @@ void do_priest_spell(short pc_num,short spell_num) //// break; case 19: // awaken - if (univ.party[target].status[11] <= 0) { + if(univ.party[target].status[eStatus::ASLEEP] <= 0) { sprintf ((char *) c_line, " %s is already awake! " ,(char *) univ.party[target].name.c_str()); break; } sprintf ((char *) c_line, " %s wakes up. " ,(char *) univ.party[target].name.c_str()); - univ.party[target].status[11] = 0; + univ.party[target].status[eStatus::ASLEEP] = 0; break; case 24: // cure paralysis - if (univ.party[target].status[12] <= 0) { + if(univ.party[target].status[eStatus::PARALYZED] <= 0) { sprintf ((char *) c_line, " %s isn't paralyzed! " ,(char *) univ.party[target].name.c_str()); break; } sprintf ((char *) c_line, " %s can move now. " ,(char *) univ.party[target].name.c_str()); - univ.party[target].status[12] = 0; + univ.party[target].status[eStatus::PARALYZED] = 0; break; case 27: sprintf ((char *) c_line, " %s recovers. " ,(char *) univ.party[target].name.c_str()); r1 = 2 + get_ran(1,0,2) + stat_adj(pc_num,2) / 2; - univ.party[target].status[7] = max(0,univ.party[target].status[7] - r1); + univ.party[target].status[eStatus::DISEASE] = max(0,univ.party[target].status[eStatus::DISEASE] - r1); break; case 28: sprintf ((char *) c_line, " %s restored. " ,(char *) univ.party[target].name.c_str()); r1 = 1 + get_ran(1,0,2) + stat_adj(pc_num,2) / 2; - univ.party[target].status[9] = max(0,univ.party[target].status[9] - r1); + univ.party[target].status[eStatus::DUMB] = max(0,univ.party[target].status[eStatus::DUMB] - r1); break; case 36: sprintf ((char *) c_line, " %s cleansed. " ,(char *) univ.party[target].name.c_str()); - univ.party[target].status[7] = 0; - univ.party[target].status[6] = 0; + univ.party[target].status[eStatus::DISEASE] = 0; + univ.party[target].status[eStatus::WEBS] = 0; break; } } @@ -1521,13 +1520,13 @@ void do_priest_spell(short pc_num,short spell_num) //// sprintf ((char *) c_line, " %s shielded. ", (char *) univ.party[target].name.c_str()); r1 = max(1,get_ran((univ.party[pc_num].level + 5) / 5,1,3) + adj); - univ.party[target].status[10] += r1; + univ.party[target].status[eStatus::MARTYRS_SHIELD] += r1; } if (spell_num == 5) { // sanctuary sprintf ((char *) c_line, " %s hidden. ", (char *) univ.party[target].name.c_str()); r1 = max(0,get_ran(0,1,3) + univ.party[pc_num].level / 4 + adj); - univ.party[target].status[8] += r1; + univ.party[target].status[eStatus::INVISIBLE] += r1; } if (spell_num == 6) { // symbiosis store_victim_health = univ.party[target].cur_health; @@ -1539,7 +1538,7 @@ void do_priest_spell(short pc_num,short spell_num) //// if (r1 < 100) univ.party[pc_num].cur_health--; if (r1 < 50) - univ.party[pc_num].cur_health = move_to_zero(univ.party[pc_num].cur_health); + move_to_zero(univ.party[pc_num].cur_health); targ_damaged = univ.party[target].max_health - univ.party[target].cur_health; } add_string_to_buf(" You absorb damage."); @@ -1553,7 +1552,7 @@ void do_priest_spell(short pc_num,short spell_num) //// sprintf ((char *) c_line, " %s healed. ", (char *) univ.party[target].name.c_str()); heal_pc(target,250); - univ.party[target].status[2] = 0; + univ.party[target].status[eStatus::POISON] = 0; one_sound(-53); one_sound(52); } if (spell_num == 49) { @@ -1662,15 +1661,15 @@ void do_priest_spell(short pc_num,short spell_num) //// if (spell_num == 42) { store = get_ran(0,1,3) + univ.party[pc_num].level / 6 + stat_adj(pc_num,2); r1 = max(0,store); - univ.party[i].status[8] += r1; + univ.party[i].status[eStatus::INVISIBLE] += r1; } if (spell_num == 61) { - univ.party[i].status[6] = 0; - univ.party[i].status[7] = 0; + univ.party[i].status[eStatus::WEBS] = 0; + univ.party[i].status[eStatus::DISEASE] = 0; } if (spell_num == 48) { // Hyperactivity - univ.party[i].status[11] -= 6 + 2 * stat_adj(pc_num,2); - univ.party[i].status[3] = max(0,univ.party[i].status[3]); + univ.party[i].status[eStatus::ASLEEP] -= 6 + 2 * stat_adj(pc_num,2); + univ.party[i].status[eStatus::HASTE_SLOW] = max(0,univ.party[i].status[eStatus::HASTE_SLOW]); } } break; @@ -1853,7 +1852,7 @@ void do_mindduel(short pc_num,cCreature *monst) while(univ.party[pc_num].main_status == eMainStatus::ALIVE && monst->active > 0 && i < 10) { play_sound(1); r1 = get_ran(1,1,100) + adjust; - r1 += 5 * (monst->status[9] - univ.party[pc_num].status[9]); + r1 += 5 * (monst->status[eStatus::DUMB] - univ.party[pc_num].status[eStatus::DUMB]); r1 += 5 * balance; r2 = get_ran(1,1,6); if (r1 < 30) { @@ -1862,10 +1861,10 @@ void do_mindduel(short pc_num,cCreature *monst) monst->mp += r2; balance++; if (univ.party[pc_num].cur_sp == 0) { - univ.party[pc_num].status[9] += 2; + univ.party[pc_num].status[eStatus::DUMB] += 2; sprintf((char *) c_line," %s is dumbfounded.",univ.party[pc_num].name.c_str()); add_string_to_buf((char *) c_line); - if (univ.party[pc_num].status[9] > 7) { + if (univ.party[pc_num].status[eStatus::DUMB] > 7) { sprintf((char *) c_line," %s is killed!",univ.party[pc_num].name.c_str()); add_string_to_buf((char *) c_line); kill_pc(pc_num,eMainStatus::DEAD); @@ -1882,9 +1881,9 @@ void do_mindduel(short pc_num,cCreature *monst) univ.party[pc_num].cur_sp += r2; balance--; if (monst->mp == 0) { - monst->status[9] += 2; + monst->status[eStatus::DUMB] += 2; monst_spell_note(monst->number,22); - if (monst->status[9] > 7) { + if (monst->status[eStatus::DUMB] > 7) { kill_monst(monst,pc_num); } @@ -1953,13 +1952,14 @@ bool pc_can_cast_spell(short pc_num,short type,short spell_num) return false; if ((type == 1) && (univ.party[pc_num].priest_spells[spell_num] == false)) return false; - if (univ.party[pc_num].status[9] >= 8 - level) + if(univ.party[pc_num].status[eStatus::DUMB] >= 8 - level) return false; - if (univ.party[pc_num].status[12] != 0) + if(univ.party[pc_num].status[eStatus::PARALYZED] != 0) return false; - if (univ.party[pc_num].status[11] > 0) + if(univ.party[pc_num].status[eStatus::ASLEEP] > 0) return false; + // TODO: Make an enum for this // 0 - everywhere 1 - combat only 2 - town only 3 - town & outdoor only 4 - town & combat only 5 - outdoor only store_w_cast = spell_w_cast[type][spell_num]; if (is_out()) { @@ -2781,7 +2781,7 @@ void poison_pc(short which_pc,short how_much) how_much++; if (how_much > 0) { - univ.party[which_pc].status[2] = min(univ.party[which_pc].status[2] + how_much,8); + univ.party[which_pc].status[eStatus::POISON] = min(univ.party[which_pc].status[eStatus::POISON] + how_much,8); sprintf ((char *) c_line, " %s poisoned.", (char *) univ.party[which_pc].name.c_str()); add_string_to_buf((char *) c_line); @@ -2806,7 +2806,9 @@ void affect_pc(short which_pc,eStatus type,short how_much)//// if(univ.party[which_pc].main_status != eMainStatus::ALIVE) return; univ.party[which_pc].status[type] = minmax (-8,8,univ.party[which_pc].status[type] + how_much); - if (((type >= 4) && (type <= 10)) || (type == 12) || (type == 13)) + // TODO: Original code also allowed poisoned weapon, poison, and sleep to be negative; should this be restored? + // TODO: For certain other status effects it could make sense to allow negatives, eg magic resistance or dumbfounded + if(type != eStatus::BLESS_CURSE && type != eStatus::HASTE_SLOW) univ.party[which_pc].status[type] = max(univ.party[which_pc].status[type],0); put_pc_screen(); } @@ -2823,9 +2825,9 @@ void affect_party(eStatus type,short how_much) void void_sanctuary(short pc_num) { - if (univ.party[pc_num].status[8] > 0) { + if(univ.party[pc_num].status[eStatus::INVISIBLE] > 0) { add_string_to_buf("You become visible!"); - univ.party[pc_num].status[8] = 0; + univ.party[pc_num].status[eStatus::INVISIBLE] = 0; } } @@ -2886,7 +2888,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ // armor if ((damage_type == 0) || (damage_type == 6) ||(damage_type == 7)) { - how_much -= minmax(-5,5,univ.party[which_pc].status[1]); + how_much -= minmax(-5,5,univ.party[which_pc].status[eStatus::BLESS_CURSE]); for (i = 0; i < 24; i++) if ((univ.party[which_pc].items[i].variety != eItemType::NO_ITEM) && (univ.party[which_pc].equip[i] == true)) { if(isArmourType(univ.party[which_pc].items[i].variety)) { @@ -2948,7 +2950,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ // invuln - if (univ.party[which_pc].status[4] > 0) + if(univ.party[which_pc].status[eStatus::INVULNERABLE] > 0) how_much = 0; // magic resistance @@ -2957,7 +2959,7 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ // Mag. res helps w. fire and cold if (((damage_type == 1) || (damage_type == 5)) && - (univ.party[which_pc].status[5] > 0)) + univ.party[which_pc].status[eStatus::MAGIC_RESISTANCE] > 0) how_much = how_much / 2; // fire res. @@ -2996,8 +2998,8 @@ bool damage_pc(short which_pc,short how_much,eDamageType damage_type,eRace type_ } else { // if asleep, get bonus - if (univ.party[which_pc].status[11] > 0) - univ.party[which_pc].status[11]--; + if(univ.party[which_pc].status[eStatus::ASLEEP] > 0) + univ.party[which_pc].status[eStatus::ASLEEP]--; sprintf ((char *) c_line, " %s takes %d. ",(char *) univ.party[which_pc].name.c_str(), how_much); if (do_print == true) @@ -3108,21 +3110,21 @@ void set_pc_moves() if ((i_level = get_prot_level(i,56)) > 0) univ.party[i].ap -= i_level / 5; - if ((univ.party[i].status[3] < 0) && (univ.party.age % 2 == 1)) // slowed? + if(univ.party[i].status[eStatus::HASTE_SLOW] < 0 && univ.party.age % 2 == 1) // slowed? univ.party[i].ap = 0; else { // do webs - univ.party[i].ap = max(0,univ.party[i].ap - univ.party[i].status[6] / 2); + univ.party[i].ap = max(0,univ.party[i].ap - univ.party[i].status[eStatus::WEBS] / 2); if (univ.party[i].ap == 0) { sprintf((char *) c_line,"%s must clean webs.",univ.party[i].name.c_str()); add_string_to_buf((char *) c_line); - univ.party[i].status[6] = max(0,univ.party[i].status[6] - 3); + univ.party[i].status[eStatus::WEBS] = max(0,univ.party[i].status[eStatus::WEBS] - 3); } } - if (univ.party[i].status[3] > 7) + if(univ.party[i].status[eStatus::HASTE_SLOW] > 7) univ.party[i].ap = univ.party[i].ap * 3; - else if (univ.party[i].status[3] > 0) + else if(univ.party[i].status[eStatus::HASTE_SLOW] > 0) univ.party[i].ap = univ.party[i].ap * 2; - if ((univ.party[i].status[11] > 0) || (univ.party[i].status[12] > 0)) + if(univ.party[i].status[eStatus::ASLEEP] > 0 || univ.party[i].status[eStatus::PARALYZED] > 0) univ.party[i].ap = 0; } diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index b23dd85f..88202b56 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -358,49 +358,49 @@ bool check_special_terrain(location where_check,short mode,short which_pc,short for ( ; i < 6; i++) if(univ.party[i].main_status == eMainStatus::ALIVE) { if (get_ran(1,1,100) <= ter_flag2.u) { - switch(ter_flag3.u){ - case STATUS_POISONED_WEAPON: // TODO: Do something here + switch((eStatus)ter_flag3.u){ + case eStatus::POISONED_WEAPON: // TODO: Do something here if(get_ran(1,1,100) > 60) add_string_to_buf("It's eerie here..."); break; - case STATUS_BLESS_CURSE: // Should say "You feel awkward." / "You feel blessed."? + case eStatus::BLESS_CURSE: // Should say "You feel awkward." / "You feel blessed."? curse_pc(i,ter_flag1.s); break; - case STATUS_POISON: + case eStatus::POISON: poison_pc(i,ter_flag1.u); break; - case STATUS_HASTE_SLOW: // Should say "You feel sluggish." / "You feel speedy."? + case eStatus::HASTE_SLOW: // Should say "You feel sluggish." / "You feel speedy."? slow_pc(i,ter_flag1.s); break; - case STATUS_INVULNERABLE: // Should say "You feel odd." / "You feel protected."? - affect_pc(i,STATUS_INVULNERABLE,ter_flag1.u); + case eStatus::INVULNERABLE: // Should say "You feel odd." / "You feel protected."? + affect_pc(i,eStatus::INVULNERABLE,ter_flag1.u); break; - case STATUS_MAGIC_RESISTANCE: // Should say "You feel odd." / "You feel protected."? - affect_pc(i,STATUS_MAGIC_RESISTANCE,ter_flag1.u); + case eStatus::MAGIC_RESISTANCE: // Should say "You feel odd." / "You feel protected."? + affect_pc(i,eStatus::MAGIC_RESISTANCE,ter_flag1.u); break; - case STATUS_WEBS: // Should say "You feel sticky." / "Your skin tingles."? + case eStatus::WEBS: // Should say "You feel sticky." / "Your skin tingles."? web_pc(i,ter_flag1.u); break; - case STATUS_DISEASE: // Should say "You feel healthy." / "You feel sick."? + case eStatus::DISEASE: // Should say "You feel healthy." / "You feel sick."? disease_pc(i,ter_flag1.u); break; - case STATUS_INVISIBLE: + case eStatus::INVISIBLE: if(ter_flag1.s < 0) add_string_to_buf("You feel obscure."); else add_string_to_buf("You feel exposed."); - affect_pc(i,STATUS_INVISIBLE,ter_flag1.s); + affect_pc(i,eStatus::INVISIBLE,ter_flag1.s); break; - case STATUS_DUMB: // Should say "You feel clearheaded." / "You feel confused."? + case eStatus::DUMB: // Should say "You feel clearheaded." / "You feel confused."? dumbfound_pc(i,ter_flag1.u); break; - case STATUS_MARTYRS_SHIELD: // Should say "You feel dull." / "You start to glow slightly."? - affect_pc(i,STATUS_MARTYRS_SHIELD,ter_flag1.u); + case eStatus::MARTYRS_SHIELD: // Should say "You feel dull." / "You start to glow slightly."? + affect_pc(i,eStatus::MARTYRS_SHIELD,ter_flag1.u); break; - case STATUS_ASLEEP: // Should say "You feel alert." / "You feel very tired."? - sleep_pc(i,ter_flag1.u,STATUS_ASLEEP,ter_flag1.u / 2); + case eStatus::ASLEEP: // Should say "You feel alert." / "You feel very tired."? + sleep_pc(i,ter_flag1.u,eStatus::ASLEEP,ter_flag1.u / 2); break; - case STATUS_PARALYZED: // Should say "You find it easier to move." / "You feel very stiff."? - sleep_pc(i,ter_flag1.u,STATUS_PARALYZED,ter_flag1.u / 2); + case eStatus::PARALYZED: // Should say "You find it easier to move." / "You feel very stiff."? + sleep_pc(i,ter_flag1.u,eStatus::PARALYZED,ter_flag1.u / 2); break; - case STATUS_ACID: // Should say "Your skin tingles pleasantly." / "Your skin burns!"? + case eStatus::ACID: // Should say "Your skin tingles pleasantly." / "Your skin burns!"? acid_pc(i,ter_flag1.u); break; } @@ -546,12 +546,12 @@ void check_fields(location where_check,short mode,short which_pc) if (mode < 2) { suppress_stat_screen = true; for (i = 0; i < 6; i++) { - sleep_pc(i,3,STATUS_ASLEEP,0); + sleep_pc(i,3,eStatus::ASLEEP,0); } suppress_stat_screen = false; put_pc_screen(); } - else sleep_pc(current_pc,3,STATUS_ASLEEP,0); + else sleep_pc(current_pc,3,eStatus::ASLEEP,0); } if (univ.town.is_fire_barr(where_check.x,where_check.y)) { add_string_to_buf(" Magic barrier! "); @@ -659,7 +659,7 @@ void use_item(short pc,short item) break; case ITEM_BLESS_CURSE: play_sound(4); - which_stat = STATUS_BLESS_CURSE; + which_stat = eStatus::BLESS_CURSE; if (type % 2 == 1) { ASB(" You feel awkward."); str = str * -1; @@ -670,7 +670,7 @@ void use_item(short pc,short item) break; case ITEM_HASTE_SLOW: play_sound(75); - which_stat = STATUS_HASTE_SLOW; + which_stat = eStatus::HASTE_SLOW; if (type % 2 == 1) { ASB(" You feel sluggish."); str = str * -1; @@ -681,7 +681,7 @@ void use_item(short pc,short item) break; case ITEM_AFFECT_INVULN: play_sound(68); - which_stat = STATUS_INVULNERABLE; + which_stat = eStatus::INVULNERABLE; if (type % 2 == 1) { ASB(" You feel odd."); str = str * -1; @@ -692,7 +692,7 @@ void use_item(short pc,short item) break; case ITEM_AFFECT_MAGIC_RES: play_sound(51); - which_stat = STATUS_MAGIC_RESISTANCE; + which_stat = eStatus::MAGIC_RESISTANCE; if (type % 2 == 1) { ASB(" You feel odd."); str = str * -1; @@ -702,7 +702,7 @@ void use_item(short pc,short item) else affect_pc(pc,which_stat,str); break; case ITEM_AFFECT_WEB: - which_stat = STATUS_WEBS; + which_stat = eStatus::WEBS; if (type % 2 == 1) ASB(" You feel sticky."); else { @@ -715,7 +715,7 @@ void use_item(short pc,short item) break; case ITEM_AFFECT_SANCTUARY: play_sound(43); - which_stat = STATUS_INVISIBLE; + which_stat = eStatus::INVISIBLE; if (type % 2 == 1) { ASB(" You feel exposed."); str = str * -1; @@ -726,7 +726,7 @@ void use_item(short pc,short item) break; case ITEM_AFFECT_MARTYRS_SHIELD: play_sound(43); - which_stat = STATUS_MARTYRS_SHIELD; + which_stat = eStatus::MARTYRS_SHIELD; if (type % 2 == 1) { ASB(" You feel dull."); str = str * -1; @@ -759,7 +759,7 @@ void use_item(short pc,short item) switch (type) { case 0: ASB(" You feel healthy."); - affect_pc(pc,STATUS_DISEASE,-1 * str); + affect_pc(pc,eStatus::DISEASE,-1 * str); break; case 1: ASB(" You feel sick."); @@ -767,7 +767,7 @@ void use_item(short pc,short item) break; case 2: ASB(" You all feel healthy."); - affect_party(STATUS_DISEASE,-1 * str); + affect_party(eStatus::DISEASE,-1 * str); break; case 3: ASB(" You all feel sick."); @@ -780,7 +780,7 @@ void use_item(short pc,short item) switch (type) { case 0: ASB(" You feel clear headed."); - affect_pc(pc,STATUS_DUMB,-1 * str); + affect_pc(pc,eStatus::DUMB,-1 * str); break; case 1: ASB(" You feel confused."); @@ -788,7 +788,7 @@ void use_item(short pc,short item) break; case 2: ASB(" You all feel clear headed."); - affect_party(STATUS_DUMB,-1 * str); + affect_party(eStatus::DUMB,-1 * str); break; case 3: ASB(" You all feel confused."); @@ -801,20 +801,20 @@ void use_item(short pc,short item) switch (type) { case 0: ASB(" You feel alert."); - affect_pc(pc,STATUS_ASLEEP,-1 * str); + affect_pc(pc,eStatus::ASLEEP,-1 * str); break; case 1: ASB(" You feel very tired."); - sleep_pc(pc,str + 1,STATUS_ASLEEP,200); + sleep_pc(pc,str + 1,eStatus::ASLEEP,200); break; case 2: ASB(" You all feel alert."); - affect_party(STATUS_ASLEEP,-1 * str); + affect_party(eStatus::ASLEEP,-1 * str); break; case 3: ASB(" You all feel very tired."); for (i = 0; i < 6; i++) - sleep_pc(i,str + 1,STATUS_ASLEEP,200); + sleep_pc(i,str + 1,eStatus::ASLEEP,200); break; } break; @@ -822,20 +822,20 @@ void use_item(short pc,short item) switch (type) { case 0: ASB(" You find it easier to move."); - affect_pc(pc,STATUS_PARALYZED,-1 * str * 100); + affect_pc(pc,eStatus::PARALYZED,-1 * str * 100); break; case 1: ASB(" You feel very stiff."); - sleep_pc(pc,str * 20 + 10,STATUS_PARALYZED,200); + sleep_pc(pc,str * 20 + 10,eStatus::PARALYZED,200); break; case 2: ASB(" You all find it easier to move."); - affect_party(STATUS_PARALYZED,-1 * str * 100); + affect_party(eStatus::PARALYZED,-1 * str * 100); break; case 3: ASB(" You all feel very stiff."); for (i = 0; i < 6; i++) - sleep_pc(i,str * 20 + 10,STATUS_PARALYZED,200); + sleep_pc(i,str * 20 + 10,eStatus::PARALYZED,200); break; } break; @@ -843,7 +843,7 @@ void use_item(short pc,short item) switch (type) { case 0: ASB(" Your skin tingles pleasantly."); - affect_pc(pc,STATUS_ACID,-1 * str); + affect_pc(pc,eStatus::ACID,-1 * str); break; case 1: ASB(" Your skin burns!"); @@ -851,7 +851,7 @@ void use_item(short pc,short item) break; case 2: ASB(" You all tingle pleasantly."); - affect_party(STATUS_ACID,-1 * str); + affect_party(eStatus::ACID,-1 * str); break; case 3: ASB(" Everyone's skin burns!"); @@ -865,13 +865,13 @@ void use_item(short pc,short item) case 0: case 1: ASB(" You feel wonderful!"); heal_pc(pc,str * 20); - affect_pc(pc,STATUS_BLESS_CURSE,str); + affect_pc(pc,eStatus::BLESS_CURSE,str); break; case 2: case 3: ASB(" Everyone feels wonderful!"); for (i = 0; i < 6; i++) { heal_pc(i,str * 20); - affect_pc(i,STATUS_BLESS_CURSE,str); + affect_pc(i,eStatus::BLESS_CURSE,str); } break; } @@ -1112,7 +1112,7 @@ void use_item(short pc,short item) && (dist(pc_pos[current_pc],univ.town.monst[i].cur_loc) <= 8) && (can_see_light(pc_pos[current_pc],univ.town.monst[i].cur_loc,sight_obscurity) < 5)) { which_m = &univ.town.monst[i]; - charm_monst(which_m,0,0,8); + charm_monst(which_m,0,eStatus::CHARM,8); } } break; @@ -2476,54 +2476,54 @@ void affect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, case SPEC_AFFECT_INVULN: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_INVULNERABLE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); + affect_pc(i,eStatus::INVULNERABLE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); break; case SPEC_AFFECT_MAGIC_RES: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_MAGIC_RESISTANCE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); + affect_pc(i,eStatus::MAGIC_RESISTANCE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); break; case SPEC_AFFECT_WEBS: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_WEBS,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); + affect_pc(i,eStatus::WEBS,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); break; case SPEC_AFFECT_DISEASE: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_DISEASE,spec.ex1a * ((spec.ex1b != 0) ? 1: -1)); + affect_pc(i,eStatus::DISEASE,spec.ex1a * ((spec.ex1b != 0) ? 1: -1)); break; case SPEC_AFFECT_SANCTUARY: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_INVISIBLE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); + affect_pc(i,eStatus::INVISIBLE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); break; case SPEC_AFFECT_CURSE_BLESS: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_BLESS_CURSE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); + affect_pc(i,eStatus::BLESS_CURSE,spec.ex1a * ((spec.ex1b != 0) ? -1: 1)); break; case SPEC_AFFECT_DUMBFOUND: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) - affect_pc(i,STATUS_DUMB,spec.ex1a * ((spec.ex1b == 0) ? -1: 1)); + affect_pc(i,eStatus::DUMB,spec.ex1a * ((spec.ex1b == 0) ? -1: 1)); break; case SPEC_AFFECT_SLEEP: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) { if (spec.ex1b == 0) { - affect_pc(i,STATUS_ASLEEP,-1 * spec.ex1a); + affect_pc(i,eStatus::ASLEEP,-1 * spec.ex1a); } - else sleep_pc(i,spec.ex1a,STATUS_ASLEEP,10); + else sleep_pc(i,spec.ex1a,eStatus::ASLEEP,10); } break; case SPEC_AFFECT_PARALYSIS: for (i = 0; i < 6; i++) if ((pc < 0) || (pc == i)) { if (spec.ex1b == 0) { - affect_pc(i,STATUS_PARALYZED,-1 * spec.ex1a); + affect_pc(i,eStatus::PARALYZED,-1 * spec.ex1a); } - else sleep_pc(i,spec.ex1a,STATUS_PARALYZED,10); + else sleep_pc(i,spec.ex1a,eStatus::PARALYZED,10); } break; case SPEC_AFFECT_STAT: diff --git a/osx/boe.text.cpp b/osx/boe.text.cpp index 92e66cd0..2bc43090 100644 --- a/osx/boe.text.cpp +++ b/osx/boe.text.cpp @@ -687,37 +687,37 @@ void draw_pc_effects(short pc) if(exceptSplit(univ.party[pc].main_status) != eMainStatus::ALIVE) return; // TODO: This used to draw the status icons in the spell dialog, but it no longer does. Fix that. - if ((univ.party[pc].status[STATUS_POISONED_WEAPON] > 0) && (dest_rect.right < right_limit)) { + if ((univ.party[pc].status[eStatus::POISONED_WEAPON] > 0) && (dest_rect.right < right_limit)) { rect_draw_some_item(status_gworld,source_rects[4],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if (univ.party[pc].status[STATUS_BLESS_CURSE] > 0) { + if (univ.party[pc].status[eStatus::BLESS_CURSE] > 0) { rect_draw_some_item(status_gworld,source_rects[2],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - else if (univ.party[pc].status[STATUS_BLESS_CURSE] < 0) { + else if (univ.party[pc].status[eStatus::BLESS_CURSE] < 0) { rect_draw_some_item(status_gworld,source_rects[3],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if (univ.party[pc].status[STATUS_POISON] > 0) { - rect_draw_some_item(status_gworld,source_rects[(univ.party[pc].status[STATUS_POISON] > 4) ? 1 : 0],pc_stats_gworld,dest_rect,sf::BlendAlpha); + if (univ.party[pc].status[eStatus::POISON] > 0) { + rect_draw_some_item(status_gworld,source_rects[(univ.party[pc].status[eStatus::POISON] > 4) ? 1 : 0],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if (univ.party[pc].status[STATUS_INVULNERABLE] > 0) { + if (univ.party[pc].status[eStatus::INVULNERABLE] > 0) { rect_draw_some_item(status_gworld,source_rects[5],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if (univ.party[pc].status[STATUS_HASTE_SLOW] > 0) { + if (univ.party[pc].status[eStatus::HASTE_SLOW] > 0) { rect_draw_some_item(status_gworld,source_rects[6],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - else if (univ.party[pc].status[STATUS_HASTE_SLOW] < 0) { + else if (univ.party[pc].status[eStatus::HASTE_SLOW] < 0) { rect_draw_some_item(status_gworld,source_rects[8],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; @@ -726,47 +726,47 @@ void draw_pc_effects(short pc) dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_MAGIC_RESISTANCE] > 0) && (dest_rect.right < right_limit)) { + if ((univ.party[pc].status[eStatus::MAGIC_RESISTANCE] > 0) && (dest_rect.right < right_limit)) { rect_draw_some_item(status_gworld,source_rects[9],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_WEBS] > 0) && (dest_rect.right < right_limit)) { + if ((univ.party[pc].status[eStatus::WEBS] > 0) && (dest_rect.right < right_limit)) { rect_draw_some_item(status_gworld,source_rects[10],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_DISEASE] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::DISEASE] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[11],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_INVISIBLE] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::INVISIBLE] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[12],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_DUMB] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::DUMB] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[13],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_MARTYRS_SHIELD] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::MARTYRS_SHIELD] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[14],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_ASLEEP] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::ASLEEP] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[15],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_PARALYZED] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::PARALYZED] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[16],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; } - if ((univ.party[pc].status[STATUS_ACID] > 0) && (dest_rect.right < right_limit)){ + if ((univ.party[pc].status[eStatus::ACID] > 0) && (dest_rect.right < right_limit)){ rect_draw_some_item(status_gworld,source_rects[17],pc_stats_gworld,dest_rect,sf::BlendAlpha); dest_rect.left += 13; dest_rect.right += 13; diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index aaea261c..ee300256 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -228,8 +228,7 @@ void start_town_mode(short which_town, short entry_dir) univ.town.monst[j].health = univ.town.monst[j].m_health; univ.town.monst[j].mp = univ.town.monst[j].max_mp; univ.town.monst[j].morale = univ.town.monst[j].m_morale; - for (k = 0; k < 15; k++) - univ.town.monst[j].status[k] = 0; + univ.town.monst[j].status.clear(); if (univ.town.monst[j].summoned > 0) univ.town.monst[j].active = 0; univ.town.monst[j].target = 6; @@ -692,11 +691,15 @@ location end_town_mode(short switching_level,location destination) // returns n erase_out_specials(); PSD[SDF_PARTY_STEALTHY] = 0; - //PSD[SDF_PARTY_DETECT_LIFE] = 0; //Yes? No? Maybe? + //PSD[SDF_PARTY_DETECT_LIFE] = 0; // TODO: Yes? No? Maybe? for (i = 0; i < 6; i++) - for (j = 0; j < 15; j++) - if ((j != 2) && (j != 7) && (j != 9)) - univ.party[i].status[j] = 0; + erase_if(univ.party[i].status, [](std::pair kv) -> bool { + // TODO: These were the only statuses kept in the original code, but what about acid? Should it be kept too? + if(kv.first == eStatus::POISON) return false; + if(kv.first == eStatus::DISEASE) return false; + if(kv.first == eStatus::DUMB) return false; + return true; + }); update_explored(to_return); diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index 30454f25..c12aba6a 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -157,7 +157,7 @@ bool run_trap(short pc_num,eTrapType trap_type,short trap_level,short diff) add_string_to_buf(" A purple ray flies out. "); r1 = 200 + univ.town.difficulty * 100; r1 = r1 + trap_level * 400; - sleep_pc(pc_num,r1,STATUS_PARALYZED,50); + sleep_pc(pc_num,r1,eStatus::PARALYZED,50); break; case TRAP_DRAIN_XP: add_string_to_buf(" You feel weak. "); diff --git a/osx/classes/monster.cpp b/osx/classes/monster.cpp index d6204753..67b5ac84 100644 --- a/osx/classes/monster.cpp +++ b/osx/classes/monster.cpp @@ -124,7 +124,8 @@ cCreature& cCreature::operator = (legacy::creature_data_type old){ ap = old.m_d.ap; morale = old.m_d.morale; m_morale = old.m_d.m_morale; - for(int i = 0; i < 15; i++) status[i] = old.m_d.status[i]; + for(int i = 0; i < 15; i++) + status[(eStatus) i] = old.m_d.status[i]; direction = old.m_d.direction; return *this; } @@ -148,12 +149,13 @@ std::ostream& operator << (std::ostream& out, eStatus& e){ return out << (int) e; } +// TODO: This should probably understand symbolic names as well as the numbers? std::istream& operator >> (std::istream& in, eStatus& e){ int i; in >> i; - if(i > 0 && i < 14) + if(i >= 0 && i < 14) e = (eStatus) i; - else e = STATUS_POISONED_WEAPON; + else e = eStatus::MAIN; return in; } @@ -203,7 +205,7 @@ cCreature& cCreature::operator = (const cCreature& other){ // replaces return_mo if(level >= 20) m_morale += 10 * (level - 20); morale = m_morale; direction = 0; - for(int i = 0; i < 15; i++) status[i] = 0; + status.clear(); attitude = start_attitude; // TODO: Is this right? cur_loc = start_loc; target = 6; // No target @@ -276,35 +278,35 @@ cMonster::cAbility::operator std::string(){ break; case MONST_STATUS_RAY: case MONST_STATUS_TOUCH: - switch(extra1){ - case STATUS_BLESS_CURSE: + switch((eStatus)extra1){ + case eStatus::BLESS_CURSE: sout << "Curse"; break; - case STATUS_POISON: + case eStatus::POISON: sout << "Poison"; i = 1; break; - case STATUS_HASTE_SLOW: + case eStatus::HASTE_SLOW: sout << "Slowing"; break; - case STATUS_WEBS: + case eStatus::WEBS: sout << "Glue"; i = 1; break; - case STATUS_DISEASE: + case eStatus::DISEASE: sout << "Infectious"; i = 1; break; - case STATUS_DUMB: + case eStatus::DUMB: sout << "Dumbfounding"; break; - case STATUS_ASLEEP: + case eStatus::ASLEEP: sout << "Sleep"; break; - case STATUS_PARALYZED: + case eStatus::PARALYZED: sout << "Paralysis"; break; - case STATUS_ACID: + case eStatus::ACID: sout << "Acid"; i = 1; break; @@ -522,9 +524,11 @@ void cCreature::writeTo(std::ostream& file) { file << "FACE " << facial_pic << '\n'; file << "TARGET " << target << '\n'; file << "TARGLOC " << targ_loc.x << ' ' << targ_loc.y << '\n'; - for(int i = 0; i < 15; i++) - if(status[i] != 0) - file << "STATUS " << i << ' ' << status[i] << '\n'; + for(int i = 0; i < 15; i++) { + eStatus stat = (eStatus) i; + if(status[stat] != 0) + file << "STATUS " << i << ' ' << status[stat] << '\n'; + } file << "CURHP " << health << '\n'; file << "CURSP " << mp << '\n'; file << "MORALE " << morale << '\n'; @@ -597,10 +601,8 @@ void cCreature::readFrom(std::istream& file) { else if(cur == "DIRECTION") line >> direction; else if(cur == "STATUS") { - int i; - line >> i; - if(i >= 0 && i < 15) - line >> status[i]; + eStatus i; + line >> i >> status[i]; } } } diff --git a/osx/classes/monster.h b/osx/classes/monster.h index 2638f2d9..93e1c163 100644 --- a/osx/classes/monster.h +++ b/osx/classes/monster.h @@ -10,6 +10,7 @@ #define BOE_DATA_MONSTER_H #include +#include #include #include "soundtool.h" @@ -168,7 +169,7 @@ public: short max_mp; unsigned char ap; short morale,m_morale; // these are calculated in-game based on the level - short status[15]; + std::map status; unsigned char direction; cCreature(); diff --git a/osx/classes/pc.cpp b/osx/classes/pc.cpp index 06e9df7d..23e58666 100644 --- a/osx/classes/pc.cpp +++ b/osx/classes/pc.cpp @@ -27,8 +27,9 @@ cPlayer& cPlayer::operator = (legacy::pc_record_type old){ experience = old.experience; skill_pts = old.skill_pts; level = old.level; + // TODO: Why are advan and exp_adj commented out? for(i = 0; i < 15; i++){ - status[i] = old.status[i]; + status[(eStatus) i] = old.status[i]; //advan[i] = old.advan[i]; traits[i] = old.traits[i]; } @@ -79,8 +80,6 @@ cPlayer::cPlayer(){ experience = 0; skill_pts = 60; level = 1; - for (i = 0; i < 15; i++) - status[i] = 0; for (i = 0; i < 24; i++) items[i] = cItemRec(); for (i = 0; i < 24; i++) @@ -135,8 +134,6 @@ cPlayer::cPlayer(long key,short slot){ experience = 0; skill_pts = 60; level = 1; - for (i = 0; i < 15; i++) - status[i] = 0; for (i = 0; i < 24; i++) items[i] = cItemRec(); for (i = 0; i < 24; i++) @@ -211,8 +208,6 @@ cPlayer::cPlayer(long key,short slot){ skill_pts = 0; level = 1; - for (i = 0; i < 15; i++) - status[i] = 0; for (i = 0; i < 24; i++) items[i] = cItemRec(); for (i = 0; i < 24; i++) @@ -263,9 +258,11 @@ void cPlayer::writeTo(std::ostream& file){ file << "EXPERIENCE " << experience << '\n'; file << "SKILLPTS " << skill_pts << '\n'; file << "LEVEL " << level << '\n'; - for(int i = 0; i < 15; i++) - if(status[i] != 0) - file << "STATUS " << i << ' ' << status[i] << '\n'; + for(int i = 0; i < 15; i++) { + eStatus stat = (eStatus) i; + if(status[stat] != 0) + file << "STATUS " << i << ' ' << status[stat] << '\n'; + } for(int i = 0; i < 24; i++) if(equip[i]) file << "EQUIP " << i << '\n'; @@ -302,9 +299,9 @@ void cPlayer::readFrom(std::istream& file){ sin.str(cur); sin >> cur; if(cur == "STATUS"){ - int i; + eStatus i; sin >> i; - if(i < 0) sin >> main_status; + if(i == eStatus::MAIN) sin >> main_status; else sin >> status[i]; }else if(cur == "NAME") sin >> name; @@ -332,7 +329,7 @@ void cPlayer::readFrom(std::istream& file){ else if(cur == "LEVEL") sin >> level; else if(cur == "STATUS"){ - int i; + eStatus i; sin >> i; sin >> status[i]; }else if(cur == "EQUIP"){ diff --git a/osx/classes/pc.h b/osx/classes/pc.h index aaf7c708..00bb71ea 100644 --- a/osx/classes/pc.h +++ b/osx/classes/pc.h @@ -10,6 +10,7 @@ #define BOE_DATA_PC_H #include +#include #include #include "simpletypes.h" @@ -31,7 +32,7 @@ public: unsigned short experience; short skill_pts; short level; - short status[15]; + std::map status; cItemRec items[24]; bool equip[24]; bool priest_spells[62]; diff --git a/osx/classes/simpletypes.h b/osx/classes/simpletypes.h index 36d05597..48f07279 100644 --- a/osx/classes/simpletypes.h +++ b/osx/classes/simpletypes.h @@ -87,21 +87,26 @@ inline bool isHumanoid(eRace race) { } /* adven[i].status*/ //complete - assign a positive value for a help pc effect, a negative for harm pc -enum eStatus { - STATUS_POISONED_WEAPON = 0, - STATUS_BLESS_CURSE = 1, - STATUS_POISON = 2, - STATUS_HASTE_SLOW = 3, - STATUS_INVULNERABLE = 4, - STATUS_MAGIC_RESISTANCE = 5, - STATUS_WEBS = 6, - STATUS_DISEASE = 7, - STATUS_INVISIBLE = 8, //sanctuary - STATUS_DUMB = 9, - STATUS_MARTYRS_SHIELD = 10, - STATUS_ASLEEP = 11, - STATUS_PARALYZED = 12, - STATUS_ACID = 13, +enum class eStatus { + MAIN = -1, // For saved games only + POISONED_WEAPON = 0, + BLESS_CURSE = 1, + POISON = 2, + HASTE_SLOW = 3, + INVULNERABLE = 4, + MAGIC_RESISTANCE = 5, + WEBS = 6, + DISEASE = 7, + INVISIBLE = 8, //sanctuary + DUMB = 9, + MARTYRS_SHIELD = 10, + ASLEEP = 11, + PARALYZED = 12, + ACID = 13, + // This one is new + // It's not quite a real status effect since it doesn't expire + // We use 15 because 14 was technically a "reserved/unused" status, though I don't think it was ever used for anything + CHARM = 15, }; /* Special Ability a.k.a spec_skill */ diff --git a/osx/classes/terrain.cpp b/osx/classes/terrain.cpp index 179ac21d..c5947e02 100644 --- a/osx/classes/terrain.cpp +++ b/osx/classes/terrain.cpp @@ -163,11 +163,11 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ break; case 5: special = TER_SPEC_DANGEROUS; - flag3.u = STATUS_POISON; + flag3.u = (int)eStatus::POISON; break; case 6: special = TER_SPEC_DANGEROUS; - flag3.u = STATUS_DISEASE; + flag3.u = (int)eStatus::DISEASE; break; case 7: special = TER_SPEC_CRUMBLING; diff --git a/osx/pcedit/pc.action.cpp b/osx/pcedit/pc.action.cpp index b2152ebb..5287550d 100644 --- a/osx/pcedit/pc.action.cpp +++ b/osx/pcedit/pc.action.cpp @@ -268,11 +268,11 @@ void take_item(short pc_num,short which_item) { short i; - if ((univ.party[pc_num].weap_poisoned == which_item) && (univ.party[pc_num].status[0] > 0)) { + if(univ.party[pc_num].weap_poisoned == which_item && univ.party[pc_num].status[eStatus::POISONED_WEAPON] > 0) { // add_string_to_buf(" Poison lost. "); - univ.party[pc_num].status[0] = 0; + univ.party[pc_num].status[eStatus::POISONED_WEAPON] = 0; } - if ((univ.party[pc_num].weap_poisoned > which_item) && (univ.party[pc_num].status[0] > 0)) + if(univ.party[pc_num].weap_poisoned > which_item && univ.party[pc_num].status[eStatus::POISONED_WEAPON] > 0) univ.party[pc_num].weap_poisoned--; for (i = which_item; i < 23; i++) { diff --git a/osx/pcedit/pc.graphics.cpp b/osx/pcedit/pc.graphics.cpp index 4fc5e9dc..dcd95fd0 100644 --- a/osx/pcedit/pc.graphics.cpp +++ b/osx/pcedit/pc.graphics.cpp @@ -518,82 +518,82 @@ void display_party() //for(k = 0 ; k < 10; k++) //frame_dlog_rect(GetWindowPort(mainPtr),pc_status_rect[k],0); - if (univ.party[i].status[0] > 0) + if(univ.party[i].status[eStatus::POISONED_WEAPON] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned Weap.",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[1] > 0) + if(univ.party[i].status[eStatus::BLESS_CURSE] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Blessed",eTextMode::WRAP,style); cur_rect++; } - else if(univ.party[i].status[1] < 0) + else if(univ.party[i].status[eStatus::BLESS_CURSE] < 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Cursed",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[2] > 0) + if(univ.party[i].status[eStatus::POISON] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Poisoned",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[3] > 0) + if(univ.party[i].status[eStatus::HASTE_SLOW] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Hasted",eTextMode::WRAP,style); cur_rect++; } - else if(univ.party[i].status[3] < 0) + else if(univ.party[i].status[eStatus::HASTE_SLOW] < 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Slowed",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[4] > 0) + if(univ.party[i].status[eStatus::INVULNERABLE] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Invulnerable",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[5] > 0) + if(univ.party[i].status[eStatus::MAGIC_RESISTANCE] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Magic Resistant",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[6] > 0) + if(univ.party[i].status[eStatus::WEBS] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Webbed",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[7] > 0) + if(univ.party[i].status[eStatus::DISEASE] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Diseased",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[8] > 0) + if(univ.party[i].status[eStatus::INVISIBLE] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Sanctury",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[9] > 0) + if(univ.party[i].status[eStatus::DUMB] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Dumbfounded",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[10] > 0) + if(univ.party[i].status[eStatus::MARTYRS_SHIELD] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Martyr's Shield",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[11] > 0) + if(univ.party[i].status[eStatus::ASLEEP] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Asleep",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[12] > 0) + if(univ.party[i].status[eStatus::PARALYZED] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Paralyzed",eTextMode::WRAP,style); cur_rect++; } - if (univ.party[i].status[13] > 0) + if(univ.party[i].status[eStatus::ACID] > 0) if(cur_rect <= 9) { win_draw_string(mainPtr,pc_status_rect[cur_rect],"Acid",eTextMode::WRAP,style); cur_rect++; diff --git a/osx/pcedit/pc.main.cpp b/osx/pcedit/pc.main.cpp index 6c2d304d..88828556 100644 --- a/osx/pcedit/pc.main.cpp +++ b/osx/pcedit/pc.main.cpp @@ -307,15 +307,15 @@ void handle_extra_menu(int item_hit) case 11: // conditions display_strings(4,15); for (i = 0; i < 6; i++) { - univ.party[i].status[2] = 0; - if (univ.party[i].status[3] < 0) - univ.party[i].status[3] = 0; - univ.party[i].status[6] = 0; - univ.party[i].status[7] = 0; - univ.party[i].status[9] = 0; - univ.party[i].status[11] = 0; - univ.party[i].status[12] = 0; - univ.party[i].status[13] = 0; + univ.party[i].status[eStatus::POISON] = 0; + if(univ.party[i].status[eStatus::HASTE_SLOW] < 0) + univ.party[i].status[eStatus::HASTE_SLOW] = 0; + univ.party[i].status[eStatus::WEBS] = 0; + univ.party[i].status[eStatus::DISEASE] = 0; + univ.party[i].status[eStatus::DUMB] = 0; + univ.party[i].status[eStatus::ASLEEP] = 0; + univ.party[i].status[eStatus::PARALYZED] = 0; + univ.party[i].status[eStatus::ACID] = 0; } break; diff --git a/osx/scenedit/scen.graphics.cpp b/osx/scenedit/scen.graphics.cpp index 49f282ed..4bfeadeb 100644 --- a/osx/scenedit/scen.graphics.cpp +++ b/osx/scenedit/scen.graphics.cpp @@ -181,37 +181,37 @@ short get_small_icon(ter_num_t ter){ icon = -1; break; case TER_SPEC_DANGEROUS: - switch(scenario.ter_types[ter].flag3.u){ - case STATUS_POISONED_WEAPON: // TODO: Do something here + switch((eStatus)scenario.ter_types[ter].flag3.u){ + case eStatus::POISONED_WEAPON: // TODO: Do something here break; - case STATUS_BLESS_CURSE: // TODO: Do something here (check flag1 to determine whether bless or curse) + case eStatus::BLESS_CURSE: // TODO: Do something here (check flag1 to determine whether bless or curse) break; - case STATUS_POISON: + case eStatus::POISON: icon = 35; break; - case STATUS_HASTE_SLOW: // TODO: Do something here (check flag1 to determine whether haste or slow) + case eStatus::HASTE_SLOW: // TODO: Do something here (check flag1 to determine whether haste or slow) break; - case STATUS_INVULNERABLE: // TODO: Do something here + case eStatus::INVULNERABLE: // TODO: Do something here break; - case STATUS_MAGIC_RESISTANCE: // TODO: Do something here + case eStatus::MAGIC_RESISTANCE: // TODO: Do something here break; - case STATUS_WEBS: // TODO: Do something here + case eStatus::WEBS: // TODO: Do something here break; - case STATUS_DISEASE: + case eStatus::DISEASE: icon = 33; break; - case STATUS_INVISIBLE: // TODO: Do something here + case eStatus::INVISIBLE: // TODO: Do something here break; - case STATUS_DUMB: // TODO: Do something here + case eStatus::DUMB: // TODO: Do something here break; - case STATUS_MARTYRS_SHIELD: // TODO: Do something here + case eStatus::MARTYRS_SHIELD: // TODO: Do something here break; - case STATUS_ASLEEP: + case eStatus::ASLEEP: icon = 44; break; - case STATUS_PARALYZED: // TODO: Do something here + case eStatus::PARALYZED: // TODO: Do something here break; - case STATUS_ACID: + case eStatus::ACID: icon = 41; break; } diff --git a/osx/tools/mathutil.cpp b/osx/tools/mathutil.cpp index 45c5fd07..12a3cb9a 100644 --- a/osx/tools/mathutil.cpp +++ b/osx/tools/mathutil.cpp @@ -51,14 +51,6 @@ short minmax(short min,short max,short k){ return k; } -short move_to_zero(short val){ - if (val < 0) - return val + 1; - if (val > 0) - return val - 1; - return val; -} - short gcd(short a, short b){ // Grabbed from Wikipedia and translated to C code short t; while(b != 0){ diff --git a/osx/tools/mathutil.h b/osx/tools/mathutil.h index 7b9508e5..c8e2f6a8 100644 --- a/osx/tools/mathutil.h +++ b/osx/tools/mathutil.h @@ -16,6 +16,23 @@ short s_sqrt(short val); short max(short a,short b); short min(short a,short b); short minmax(short min,short max,short k); -short move_to_zero(short val); short gcd(short a, short b); sf::Time time_in_ticks(int ticks); + +template +inline void move_to_zero(T& val){ + if (val < 0) + val++; + if (val > 0) + val--; +} + +// Not quite mathutil... perhaps I need a more general util file. +// This is from . +template +void erase_if(ContainerT& items, const PredicateT& predicate) { + for(auto it = items.begin(); it != items.end();) { + if(predicate(*it)) it = items.erase(it); + else ++it; + } +};