diff --git a/osx/Blades of Exile Char Editor/pc.editors.cpp b/osx/Blades of Exile Char Editor/pc.editors.cpp index a2871cda..bd5fe0d8 100644 --- a/osx/Blades of Exile Char Editor/pc.editors.cpp +++ b/osx/Blades of Exile Char Editor/pc.editors.cpp @@ -151,7 +151,7 @@ void take_item(short pc_num,short which_item) ADVEN[pc_num].items[i] = ADVEN[pc_num].items[i + 1]; ADVEN[pc_num].equip[i] = ADVEN[pc_num].equip[i + 1]; } - ADVEN[pc_num].items[23].variety = 0; + ADVEN[pc_num].items[23].variety = ITEM_TYPE_NO_ITEM; ADVEN[pc_num].equip[23] = false; } diff --git a/osx/Scenario Editor/scen.core.cpp b/osx/Scenario Editor/scen.core.cpp index 11110a58..12802dfe 100644 --- a/osx/Scenario Editor/scen.core.cpp +++ b/osx/Scenario Editor/scen.core.cpp @@ -863,7 +863,7 @@ void init_scenario() { for (i = 0; i < 256; i++) { scenario.ter_types[i].picture = ter_pics[i]; scenario.ter_types[i].blockage = ter_block[i]; - scenario.ter_types[i].special = ter_traits[i]; + scenario.ter_types[i].special = (eTerSpec) ter_traits[i]; get_str(temp_str,1,i + 1); sprintf((char *)scenario.ter_names[i], "%s", temp_str); @@ -937,7 +937,7 @@ bool save_ter_info() { if (store_which_ter > 90) { store_ter.blockage = cd_get_led_range(813,19,24); - store_ter.special = cd_get_led_range(813,32,55); + store_ter.special = (eTerSpec) cd_get_led_range(813,32,55); i = CDGN(813,6); if ((store_ter.special < 2) || (store_ter.special > 6)) { if (cre(i,0,256,"First special flag must be from 0 to 255.","",813) == true) return false; @@ -1494,8 +1494,8 @@ bool save_item_info() { sprintf(store_item.name,"%s",str); store_item.graphic_num = CDGN(818,4); - store_item.variety = cd_get_led_range(818,18,45); - store_item.type = cd_get_led_range(818,46,48) + 1; + store_item.variety = (eItemType) cd_get_led_range(818,18,45); + store_item.type = (eWeapType) (cd_get_led_range(818,46,48) + 1); store_item.item_level = CDGN(818,5); if (cre(store_item.item_level,0,50,"Item Level must be from 0 to 50.","",818) > 0) return false; @@ -1588,9 +1588,10 @@ void edit_item_type_event_filter (short item_hit) { break; default: cd_hit_led_range(818,18,45,item_hit); - store_item.variety = cd_get_led_range(818,18,45); - if ((store_item.variety == 1) || (store_item.variety == 2)) - store_item.type = 1; + store_item.variety = (eItemType) cd_get_led_range(818,18,45); + if ((store_item.variety == ITEM_TYPE_ONE_HANDED) || (store_item.variety == ITEM_TYPE_TWO_HANDED)) + store_item.type = ITEM_EDGED; + else store_item.type = ITEM_NOT_MELEE; cd_hit_led_range(818,46,48,item_hit); break; @@ -1676,7 +1677,7 @@ void edit_item_abil_event_filter (short item_hit) { switch (item_hit) { case 4: - store_item2.ability = 0; + store_item2.ability = ITEM_NO_ABILITY; toast_dialog(); break; case 3: @@ -1690,8 +1691,8 @@ void edit_item_abil_event_filter (short item_hit) { break; } i = choose_text_res(23,1,15,store_item2.ability + 1,824,"Choose Weapon Ability (inherent)"); - if (i >= 0) store_item2.ability = i - 1; - else store_item2.ability = 0; + if (i >= 0) store_item2.ability = (eItemAbil) (i - 1); + else store_item2.ability = ITEM_NO_ABILITY; put_item_abils_in_dlog(); break; case 35: @@ -1703,8 +1704,8 @@ void edit_item_abil_event_filter (short item_hit) { break; } i = choose_text_res(23,31,63,store_item2.ability + 1,824,"Choose General Ability (inherent)"); - if (i >= 0) store_item2.ability = i - 1; - else store_item2.ability = 0; + if (i >= 0) store_item2.ability = (eItemAbil) (i - 1); + else store_item2.ability = ITEM_NO_ABILITY; put_item_abils_in_dlog(); break; case 36: @@ -1714,8 +1715,8 @@ void edit_item_abil_event_filter (short item_hit) { break; } i = choose_text_res(23,71,95,store_item2.ability + 1,824,"Choose Usable Ability (Not spell)"); - if (i >= 0) store_item2.ability = i - 1; - else store_item2.ability = 0; + if (i >= 0) store_item2.ability = (eItemAbil) (i - 1); + else store_item2.ability = ITEM_NO_ABILITY; put_item_abils_in_dlog(); break; case 39: @@ -1725,8 +1726,8 @@ void edit_item_abil_event_filter (short item_hit) { break; } i = choose_text_res(23,111,136,store_item2.ability + 1,824,"Choose Usable Ability (Spell)"); - if (i >= 0) store_item2.ability = i - 1; - else store_item2.ability = 0; + if (i >= 0) store_item2.ability = (eItemAbil) (i - 1); + else store_item2.ability = ITEM_NO_ABILITY; put_item_abils_in_dlog(); break; case 38: @@ -1736,8 +1737,8 @@ void edit_item_abil_event_filter (short item_hit) { break; } i = choose_text_res(23,151,162,store_item2.ability + 1,824,"Choose Reagent Ability"); - if (i >= 0) store_item2.ability = i - 1; - else store_item2.ability = 0; + if (i >= 0) store_item2.ability = (eItemAbil) (i - 1); + else store_item2.ability = ITEM_NO_ABILITY; put_item_abils_in_dlog(); break; case 37: @@ -1747,8 +1748,8 @@ void edit_item_abil_event_filter (short item_hit) { break; } i = choose_text_res(23,171,177,store_item2.ability + 1,824,"Choose Missile Ability"); - if (i >= 0) store_item2.ability = i - 1; - else store_item2.ability = 0; + if (i >= 0) store_item2.ability = (eItemAbil) (i - 1); + else store_item2.ability = ITEM_NO_ABILITY; put_item_abils_in_dlog(); break; default: diff --git a/osx/boe.actions.cpp b/osx/boe.actions.cpp index ad861462..2fade5c7 100644 --- a/osx/boe.actions.cpp +++ b/osx/boe.actions.cpp @@ -1544,7 +1544,7 @@ void initiate_outdoor_combat(short i) for (n = 0; n < 24; n++) if ((ADVEN[m].main_status != 1) && (ADVEN[m].items[n].variety != 0)) { place_item(ADVEN[m].items[n],to_place,true); - ADVEN[m].items[n].variety = 0; + ADVEN[m].items[n].variety = ITEM_TYPE_NO_ITEM; } overall_mode = MODE_COMBAT; diff --git a/osx/boe.combat.cpp b/osx/boe.combat.cpp index 7dc4ebf4..9755a98f 100644 --- a/osx/boe.combat.cpp +++ b/osx/boe.combat.cpp @@ -389,7 +389,7 @@ void start_outdoor_combat(cOutdoors::cCreature encounter,unsigned char in_which_ } for (i = 0; i < NUM_TOWN_ITEMS; i++) - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; store_current_pc = current_pc; current_pc = 0; set_pc_moves(); diff --git a/osx/boe.consts.h b/osx/boe.consts.h index 06d8cc41..05a45fd8 100644 --- a/osx/boe.consts.h +++ b/osx/boe.consts.h @@ -266,204 +266,6 @@ enum eTrapType { TRAP_DISEASE_ALL = 12, }; -/* items[i].type a.k.a type of weapon */ -#define ITEM_EDGED 1 -#define ITEM_BASHING 2 -#define ITEM_POLE 3 - -/* items[i].variety a.k.a item type (in editor) */ -#define ITEM_TYPE_NO_ITEM 0 -#define ITEM_TYPE_ONE_HANDED 1 -#define ITEM_TYPE_TWO_HANDED 2 -#define ITEM_TYPE_GOLD 3 -#define ITEM_TYPE_BOW 4 -#define ITEM_TYPE_ARROW 5 -#define ITEM_TYPE_THROWN_MISSILE 6 -#define ITEM_TYPE_POTION 7 // potion/magic item -#define ITEM_TYPE_SCROLL 8 // scroll/magic item -#define ITEM_TYPE_WAND 9 -#define ITEM_TYPE_TOOL 10 -#define ITEM_TYPE_FOOD 11 -#define ITEM_TYPE_SHIELD 12 -#define ITEM_TYPE_ARMOR 13 -#define ITEM_TYPE_HELM 14 -#define ITEM_TYPE_GLOVES 15 -#define ITEM_TYPE_SHIELD_2 16 -/* don't know why a second type of shield is used ; it is actually checked - * in the armor code (item >= 12 and <= 17) - * and you can't equip another (12) shield while wearing it ... I didn't - * find a single item with this property in the bladbase.exs ... */ -#define ITEM_TYPE_BOOTS 17 -#define ITEM_TYPE_RING 18 -#define ITEM_TYPE_NECKLACE 19 -#define ITEM_TYPE_WEAPON_POISON 20 -#define ITEM_TYPE_NON_USE_OBJECT 21 -#define ITEM_TYPE_PANTS 22 -#define ITEM_TYPE_CROSSBOW 23 -#define ITEM_TYPE_BOLTS 24 -#define ITEM_TYPE_MISSILE_NO_AMMO 25 //e.g slings - -/* items[i].ability */ - -/* Weapons Ability */ -#define ITEM_NO_ABILITY 0 -#define ITEM_FLAMING_WEAPON 1 -#define ITEM_DEMON_SLAYER 2 -#define ITEM_UNDEAD_SLAYER 3 -#define ITEM_LIZARD_SLAYER 4 -#define ITEM_GIANT_SLAYER 5 -#define ITEM_MAGE_SLAYER 6 -#define ITEM_PRIEST_SLAYER 7 -#define ITEM_BUG_SLAYER 8 -#define ITEM_ACIDIC_WEAPON 9 -#define ITEM_SOULSUCKER 10 -#define ITEM_DRAIN_MISSILES 11 -#define ITEM_WEAK_WEAPON 12 -#define ITEM_CAUSES_FEAR 13 -#define ITEM_POISONED_WEAPON 14 - -/* General Ability */ -#define ITEM_PROTECTION 30 -#define ITEM_FULL_PROTECTION 31 -#define ITEM_FIRE_PROTECTION 32 -#define ITEM_COLD_PROTECTION 33 -#define ITEM_POISON_PROTECTION 34 -#define ITEM_MAGIC_PROTECTION 35 -#define ITEM_ACID_PROTECTION 36 -#define ITEM_SKILL 37 -#define ITEM_STRENGTH 38 -#define ITEM_DEXTERITY 39 -#define ITEM_INTELLIGENCE 40 -#define ITEM_ACCURACY 41 -#define ITEM_THIEVING 42 -#define ITEM_GIANT_STRENGTH 43 -#define ITEM_LIGHTER_OBJECT 44 -#define ITEM_HEAVIER_OBJECT 45 -#define ITEM_OCCASIONAL_BLESS 46 -#define ITEM_OCCASIONAL_HASTE 47 -#define ITEM_LIFE_SAVING 48 -#define ITEM_PROTECT_FROM_PETRIFY 49 -#define ITEM_REGENERATE 50 -#define ITEM_POISON_AUGMENT 51 -#define ITEM_DISEASE_PARTY 52 -#define ITEM_WILL 53 -#define ITEM_FREE_ACTION 54 -#define ITEM_SPEED 55 -#define ITEM_SLOW_WEARER 56 -#define ITEM_PROTECT_FROM_UNDEAD 57 -#define ITEM_PROTECT_FROM_DEMONS 58 -#define ITEM_PROTECT_FROM_HUMANOIDS 59 -#define ITEM_PROTECT_FROM_REPTILES 60 -#define ITEM_PROTECT_FROM_GIANTS 61 -#define ITEM_PROTECT_FROM_DISEASE 62 - -/* NonSpell Use ; the constant refers to both the positive and negative effect (don't mind the name). */ -#define ITEM_POISON_WEAPON 70 //put poison on weapon -#define ITEM_BLESS_CURSE 71 -#define ITEM_AFFECT_POISON 72 -#define ITEM_HASTE_SLOW 73 -#define ITEM_AFFECT_INVULN 74 -#define ITEM_AFFECT_MAGIC_RES 75 -#define ITEM_AFFECT_WEB 76 -#define ITEM_AFFECT_DISEASE 77 -#define ITEM_AFFECT_SANCTUARY 78 -#define ITEM_AFFECT_DUMBFOUND 79 -#define ITEM_AFFECT_MARTYRS_SHIELD 80 -#define ITEM_AFFECT_SLEEP 81 -#define ITEM_AFFECT_PARALYSIS 82 -#define ITEM_AFFECT_ACID 83 -#define ITEM_BLISS 84 -#define ITEM_AFFECT_EXPERIENCE 85 -#define ITEM_AFFECT_SKILL_POINTS 86 -#define ITEM_AFFECT_HEALTH 87 -#define ITEM_AFFECT_SPELL_POINTS 88 -#define ITEM_DOOM 89 -#define ITEM_LIGHT 90 -#define ITEM_STEALTH 91 -#define ITEM_FIREWALK 92 -#define ITEM_FLYING 93 -#define ITEM_MAJOR_HEALING 94 - -/* Spell Usable */ - -#define ITEM_SPELL_FLAME 110 -#define ITEM_SPELL_FIREBALL 111 -#define ITEM_SPELL_FIRESTORM 112 -#define ITEM_SPELL_KILL 113 -#define ITEM_SPELL_ICE_BOLT 114 -#define ITEM_SPELL_SLOW 115 -#define ITEM_SPELL_SHOCKWAVE 116 -#define ITEM_SPELL_DISPEL_UNDEAD 117 -#define ITEM_SPELL_DISPEL_SPIRIT 118 -#define ITEM_SPELL_SUMMONING 119 -#define ITEM_SPELL_MASS_SUMMONING 120 -#define ITEM_SPELL_ACID_SPRAY 121 -#define ITEM_SPELL_STINKING_CLOUD 122 -#define ITEM_SPELL_SLEEP_FIELD 123 -#define ITEM_SPELL_VENOM 124 -#define ITEM_SPELL_SHOCKSTORM 125 -#define ITEM_SPELL_PARALYSIS 126 -#define ITEM_SPELL_WEB_SPELL 127 -#define ITEM_SPELL_STRENGTHEN_TARGET 128 //wand of carrunos effect -#define ITEM_SPELL_QUICKFIRE 129 -#define ITEM_SPELL_MASS_CHARM 130 -#define ITEM_SPELL_MAGIC_MAP 131 -#define ITEM_SPELL_DISPEL_BARRIER 132 -#define ITEM_SPELL_MAKE_ICE_WALL 133 -#define ITEM_SPELL_CHARM_SPELL 134 -#define ITEM_SPELL_ANTIMAGIC_CLOUD 135 - -/* Reagents */ -#define ITEM_HOLLY 150 // Holly/Toadstool -#define ITEM_COMFREY_ROOT 151 -#define ITEM_GLOWING_NETTLE 152 -#define ITEM_CRYPT_SHROOM 153 // Crypt Shroom/Wormgr. -#define ITEM_ASPTONGUE_MOLD 154 -#define ITEM_EMBER_FLOWERS 155 -#define ITEM_GRAYMOLD 156 -#define ITEM_MANDRAKE 157 -#define ITEM_SAPPHIRE 158 -#define ITEM_SMOKY_CRYSTAL 159 -#define ITEM_RESSURECTION_BALM 160 -#define ITEM_LOCKPICKS 161 - -/* Missiles */ - -#define ITEM_MISSILE_RETURNING 170 -#define ITEM_MISSILE_LIGHTNING 171 -#define ITEM_MISSILE_EXPLODING 172 -#define ITEM_MISSILE_ACID 173 -#define ITEM_MISSILE_SLAY_UNDEAD 174 -#define ITEM_MISSILE_SLAY_DEMON 175 -#define ITEM_MISSILE_HEAL_TARGET 176 - -/* Terrains Specials Properties : scenario.ter_types[i].special */ //complete - -#define TER_SPEC_NONE 0 -#define TER_SPEC_CHANGE_WHEN_STEP_ON 1 -#define TER_SPEC_DOES_FIRE_DAMAGE 2 -#define TER_SPEC_DOES_COLD_DAMAGE 3 -#define TER_SPEC_DOES_MAGIC_DAMAGE 4 -#define TER_SPEC_POISON_LAND 5 -#define TER_SPEC_DISEASED_LAND 6 -#define TER_SPEC_CRUMBLING_TERRAIN 7 -#define TER_SPEC_LOCKABLE_TERRAIN 8 -#define TER_SPEC_UNLOCKABLE_TERRAIN 9 -#define TER_SPEC_UNLOCKABLE_BASHABLE 10 -#define TER_SPEC_IS_A_SIGN 11 -#define TER_SPEC_CALL_LOCAL_SPECIAL 12 -#define TER_SPEC_CALL_SCENARIO_SPECIAL 13 -#define TER_SPEC_IS_A_CONTAINER 14 -#define TER_SPEC_WATERFALL 15 -#define TER_SPEC_CONVEYOR_NORTH 16 -#define TER_SPEC_CONVEYOR_EAST 17 -#define TER_SPEC_CONVEYOR_SOUTH 18 -#define TER_SPEC_CONVEYOR_WEST 19 -#define TER_SPEC_BLOCKED_TO_MONSTERS 20 -#define TER_SPEC_TOWN_ENTRANCE 21 -#define TER_SPEC_CAN_BE_USED 22 -#define TER_SPEC_CALL_SPECIAL_WHEN_USED 23 - //stuff used in blxactions.c //Startup button rects (also used in startup.c) diff --git a/osx/boe.dlgutil.cpp b/osx/boe.dlgutil.cpp index dd037ce3..a5c54892 100644 --- a/osx/boe.dlgutil.cpp +++ b/osx/boe.dlgutil.cpp @@ -345,7 +345,7 @@ void handle_sale(short what_chosen,short cost) base_item.item_properties = base_item.item_properties | 1; switch (pc_ok_to_buy(current_pc,cost,base_item)) { case 1: play_sound(-38); give_to_pc(current_pc,base_item,true); - univ.party.magic_store_items[what_magic_shop][what_magic_shop_item].variety = 0; + univ.party.magic_store_items[what_magic_shop][what_magic_shop_item].variety = ITEM_TYPE_NO_ITEM; break; case 2: ASB("Can't carry any more items."); break; case 3: ASB("Not enough cash."); break; diff --git a/osx/boe.itemdata.cpp b/osx/boe.itemdata.cpp index c5cba959..8e5f4bbc 100644 --- a/osx/boe.itemdata.cpp +++ b/osx/boe.itemdata.cpp @@ -52,7 +52,7 @@ cItemRec get_food() food.graphic_num = 114; // food doesn't always appear if (get_ran(1,0,2) != 1) - food.variety = 0; + food.variety = ITEM_TYPE_NO_ITEM; return food; } diff --git a/osx/boe.items.cpp b/osx/boe.items.cpp index 7bd68802..a537cb17 100644 --- a/osx/boe.items.cpp +++ b/osx/boe.items.cpp @@ -162,7 +162,7 @@ bool give_to_pc(short pc_num,cItemRec item,short print_result) return false; } -bool forced_give(short item_num,short abil) //// +bool forced_give(short item_num,eItemAbil abil) //// // if abil > 0, force abil, else ignore { short i,j; @@ -172,7 +172,7 @@ bool forced_give(short item_num,short abil) //// if ((item_num < 0) || (item_num > 399)) return true; item = get_stored_item(item_num); - if (abil > 0) + if (abil > ITEM_NO_ABILITY) item.ability = abil; for (i = 0; i < 6; i++) for (j = 0; j < 24; j++) @@ -445,7 +445,8 @@ void enchant_weapon(short pc_num,short item_hit,short enchant_type,short new_val if (ADVEN[pc_num].items[item_hit].is_magic() || (ADVEN[pc_num].items[item_hit].ability != 0)) return; - ADVEN[pc_num].items[item_hit].item_properties |= 4; + ADVEN[pc_num].items[item_hit].set_magic(true); + ADVEN[pc_num].items[item_hit].set_enchanted(true); switch (enchant_type) { case 0: sprintf((char *)store_name,"%s (+1)",ADVEN[pc_num].items[item_hit].full_name); @@ -464,14 +465,14 @@ void enchant_weapon(short pc_num,short item_hit,short enchant_type,short new_val break; case 3: sprintf((char *)store_name,"%s (F)",ADVEN[pc_num].items[item_hit].full_name); - ADVEN[pc_num].items[item_hit].ability = 110; + ADVEN[pc_num].items[item_hit].ability = ITEM_SPELL_FLAME; ADVEN[pc_num].items[item_hit].ability_strength = 5; ADVEN[pc_num].items[item_hit].charges = 8; break; case 4: sprintf((char *)store_name,"%s (F!)",ADVEN[pc_num].items[item_hit].full_name); ADVEN[pc_num].items[item_hit].value = new_val; - ADVEN[pc_num].items[item_hit].ability = 1; + ADVEN[pc_num].items[item_hit].ability = ITEM_FLAMING_WEAPON; ADVEN[pc_num].items[item_hit].ability_strength = 5; break; case 5: @@ -482,7 +483,7 @@ void enchant_weapon(short pc_num,short item_hit,short enchant_type,short new_val case 6: sprintf((char *)store_name,"%s (B)",ADVEN[pc_num].items[item_hit].full_name); ADVEN[pc_num].items[item_hit].bonus++; - ADVEN[pc_num].items[item_hit].ability = 71; + ADVEN[pc_num].items[item_hit].ability = ITEM_BLESS_CURSE; ADVEN[pc_num].items[item_hit].ability_strength = 5; ADVEN[pc_num].items[item_hit].magic_use_type = 0; ADVEN[pc_num].items[item_hit].charges = 8; @@ -650,26 +651,26 @@ void destroy_an_item() ASB("Too many items. Some item destroyed."); for (i = 0; i < NUM_TOWN_ITEMS; i++) if (univ.town.items[i].type_flag == 15) { - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; return; } for (i = 0; i < NUM_TOWN_ITEMS; i++) if (univ.town.items[i].value < 3) { - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; return; } for (i = 0; i < NUM_TOWN_ITEMS; i++) if (univ.town.items[i].value < 30) { - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; return; } for (i = 0; i < NUM_TOWN_ITEMS; i++) if (!univ.town.items[i].is_magic()) { - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; return; } i = get_ran(1,0,NUM_TOWN_ITEMS); - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; } @@ -1480,18 +1481,18 @@ void place_treasure(location where,short level,short loot,short mode) if ((item_val(new_item) < min) || (item_val(new_item) > max)) { new_item = return_treasure(treas_chart[loot][j],level,mode); if (item_val(new_item) > max) - new_item.variety = 0; + new_item.variety = ITEM_TYPE_NO_ITEM; } } // not many magic items if (mode == 0) { if (new_item.is_magic() && (level < 2) && (get_ran(1,0,5) < 3)) - new_item.variety = 0; + new_item.variety = ITEM_TYPE_NO_ITEM; if (new_item.is_magic() && (level == 2) && (get_ran(1,0,5) < 2)) - new_item.variety = 0; + new_item.variety = ITEM_TYPE_NO_ITEM; if (new_item.is_cursed() && (get_ran(1,0,5) < 3)) - new_item.variety = 0; + new_item.variety = ITEM_TYPE_NO_ITEM; } // if forced, keep dipping until a treasure comes uo @@ -1502,9 +1503,9 @@ void place_treasure(location where,short level,short loot,short mode) // Not many cursed items if (new_item.is_cursed() && (get_ran(1,0,2) == 1)) - new_item.variety = 0; + new_item.variety = ITEM_TYPE_NO_ITEM; - if (new_item.variety != 0) { + if (new_item.variety != ITEM_TYPE_NO_ITEM) { for (i = 0; i < 6; i++) if ((ADVEN[i].main_status == 1) && (get_ran(1,1,100) < id_odds[ADVEN[i].skills[13]])) @@ -1538,7 +1539,7 @@ cItemRec return_treasure(short loot,short level,short mode) }; short r1; - treas.variety = 0; + treas.variety = ITEM_TYPE_NO_ITEM; r1 = get_ran(1,0,41); if (loot >= 3) r1 += 3; diff --git a/osx/boe.items.h b/osx/boe.items.h index be6e8e8c..4d6143e8 100644 --- a/osx/boe.items.h +++ b/osx/boe.items.h @@ -1,6 +1,6 @@ void sort_pc_items(short pc_num); bool give_to_pc(short pc_num,cItemRec item,short print_result); -bool forced_give(short item_num,short abil); +bool forced_give(short item_num,eItemAbil abil); bool GTP(short item_num); bool silent_GTP(short item_num); void give_gold(short amount,bool print_result); diff --git a/osx/boe.party.cpp b/osx/boe.party.cpp index 20d2b99b..fd0b1708 100644 --- a/osx/boe.party.cpp +++ b/osx/boe.party.cpp @@ -227,7 +227,7 @@ void init_party(short mode) univ.party.out_c[i].exists = false; for (i = 0; i < 5; i++) for (j = 0; j < 10; j++) - univ.party.magic_store_items[i][j].variety = 0; + univ.party.magic_store_items[i][j].variety = ITEM_TYPE_NO_ITEM; for (i = 0; i < 4; i++) univ.party.imprisoned_monst[i] = 0; for (i = 0; i < 256; i++) @@ -370,7 +370,7 @@ void init_party_scen_data() univ.party.out_c[i].exists = false; for (i = 0; i < 5; i++) for (j = 0; j < 10; j++) - univ.party.magic_store_items[i][j].variety = 0; + univ.party.magic_store_items[i][j].variety = ITEM_TYPE_NO_ITEM; for (i = 0; i < 4; i++) univ.party.imprisoned_monst[i] = 0; for (i = 0; i < 256; i++) @@ -2905,7 +2905,7 @@ void do_alchemy() //// else { store_i.value = potion_val[which_p]; store_i.ability_strength = potion_strs[which_p]; - store_i.ability = potion_abils[which_p]; + store_i.ability = (eItemAbil) potion_abils[which_p]; if (which_p == 8) store_i.magic_use_type = 2; strcpy(store_i.full_name,alch_names_short[which_p]); @@ -3440,7 +3440,7 @@ void kill_pc(short which_pc,eMainStatus type) for (i = 0; i < 24; i++) if (ADVEN[which_pc].items[i].variety != 0) { dummy = place_item(ADVEN[which_pc].items[i],item_loc,true); - ADVEN[which_pc].items[i].variety = 0; + ADVEN[which_pc].items[i].variety = ITEM_TYPE_NO_ITEM; } if ((type == MAIN_STATUS_DEAD) || (type == MAIN_STATUS_DUST)) play_sound(21); diff --git a/osx/boe.specials.cpp b/osx/boe.specials.cpp index 1b82a956..d188d8bf 100644 --- a/osx/boe.specials.cpp +++ b/osx/boe.specials.cpp @@ -1802,7 +1802,7 @@ void general_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case 19: check_mess = true; - if ((forced_give(spec.ex1a,0) == false) && ( spec.ex1b >= 0)) + if ((forced_give(spec.ex1a,ITEM_NO_ABILITY) == false) && ( spec.ex1b >= 0)) *next_spec = spec.ex1b; break; case 20: @@ -1894,7 +1894,7 @@ void oneshot_spec(short which_mode,cSpecial cur_node,short cur_spec_type, } switch (cur_node.type) { case 50: - if (forced_give(spec.ex1a,0) == false) { + if (forced_give(spec.ex1a,ITEM_NO_ABILITY) == false) { set_sd = false; if ( spec.ex2b >= 0) *next_spec = spec.ex2b; @@ -2376,7 +2376,7 @@ void ifthen_spec(short which_mode,cSpecial cur_node,short cur_spec_type, && (l == univ.town.items[i].item_loc)) { *next_spec = spec.ex2b; *redraw = 1; - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; } break; case 145: @@ -2861,15 +2861,15 @@ void rect_spec(short which_mode,cSpecial cur_node,short cur_spec_type, break; case 212: for (k = 0; k < NUM_TOWN_ITEMS; k++) - if ((univ.town.items[k].variety > 0) && (univ.town.items[k].item_loc == l)) { + if ((univ.town.items[k].variety > ITEM_TYPE_NO_ITEM) && (univ.town.items[k].item_loc == l)) { univ.town.items[k].item_loc.x = spec.sd1; univ.town.items[k].item_loc.y = spec.sd2; } break; case 213: for (k = 0; k < NUM_TOWN_ITEMS; k++) - if ((univ.town.items[k].variety > 0) && (univ.town.items[k].item_loc == l)) { - univ.town.items[k].variety = 0; + if ((univ.town.items[k].variety > ITEM_TYPE_NO_ITEM) && (univ.town.items[k].item_loc == l)) { + univ.town.items[k].variety = ITEM_TYPE_NO_ITEM; } break; case 214: diff --git a/osx/boe.town.cpp b/osx/boe.town.cpp index ac71d7c7..1eefc160 100644 --- a/osx/boe.town.cpp +++ b/osx/boe.town.cpp @@ -500,7 +500,7 @@ void start_town_mode(short which_town, short entry_dir) univ.town.monst.dudes[i].active = 0; for (i = 0; i < NUM_TOWN_ITEMS; i++) if (loc_off_act_area(univ.town.items[i].item_loc) == true) - univ.town.items[i].variety = 0; + univ.town.items[i].variety = ITEM_TYPE_NO_ITEM; // Clean univ.out.out unwanted monsters for (i = 0; i < T_M; i++) @@ -551,7 +551,7 @@ void start_town_mode(short which_town, short entry_dir) for (n = 0; n < 24; n++) if ((ADVEN[m].main_status != 1) && (ADVEN[m].items[n].variety != 0)) { place_item(ADVEN[m].items[n],univ.town.p_loc,true); - ADVEN[m].items[n].variety = 0; + ADVEN[m].items[n].variety = ITEM_TYPE_NO_ITEM; } for (i = 0; i < T_M; i++) @@ -625,7 +625,7 @@ location end_town_mode(short switching_level,location destination) // returns n (univ.town.items[i].item_loc.y <= scenario.store_item_rects[j].bottom)) ) { univ.party.stored_items[j][i] = univ.town.items[i]; } - else univ.party.stored_items[j][i].variety = 0; + else univ.party.stored_items[j][i].variety = ITEM_TYPE_NO_ITEM; } diff --git a/osx/boe.townspec.cpp b/osx/boe.townspec.cpp index dbbde5db..3fc848b1 100644 --- a/osx/boe.townspec.cpp +++ b/osx/boe.townspec.cpp @@ -99,7 +99,7 @@ void DSG(short item_num,unsigned char *flip_bit,short dialog_num,short what_spec item = get_stored_item(item_num); if (item_num == 0) - item.variety = 0; + item.variety = ITEM_TYPE_NO_ITEM; if (*flip_bit == 0) { choice = fancy_choice_dialog(dialog_num,0); if (choice == 1) diff --git a/osx/item.cpp b/osx/item.cpp index 6120ca43..ce8d2b04 100644 --- a/osx/item.cpp +++ b/osx/item.cpp @@ -45,6 +45,10 @@ bool cItemRec::is_concealed() const { return item_properties & 32; } +bool cItemRec::is_enchanted() const { + return item_properties & 64; +} + // Set bit to 1: a |= b // Set bit to 0: a &= ~b // Toggle bit: a ^= b @@ -79,6 +83,11 @@ void cItemRec::set_concealed(bool b) { else item_properties &= ~32; } +void cItemRec::set_enchanted(bool b) { + if(b) item_properties |= 64; + else item_properties &= ~64; +} + short cItemRec::item_weight() const { short n = charges, w = weight; if (variety == 0) @@ -91,16 +100,16 @@ short cItemRec::item_weight() const { } cItemRec::cItemRec(){ - variety = 0; + variety = ITEM_TYPE_NO_ITEM; item_level = 0; awkward = 0; bonus = 0; protection = 0; charges = 0; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 0; - ability = 0; + ability = ITEM_NO_ABILITY; ability_strength = 0; type_flag = 0; is_special = 0; @@ -118,7 +127,7 @@ cItemRec::cItemRec(){ } cItemRec::cItemRec(long preset){ - ability = 0; + ability = ITEM_NO_ABILITY; ability_strength = 0; type_flag = 0; is_special = 0; @@ -152,7 +161,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 0; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 65; value = 2; @@ -168,7 +177,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 0; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 10; value = 15; @@ -184,7 +193,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 12; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 47; value = 1; @@ -216,7 +225,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 0; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 66; value = 6; @@ -232,7 +241,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 0; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 62; value = 0; @@ -248,7 +257,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 0; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 53; value = 0; @@ -264,7 +273,7 @@ cItemRec::cItemRec(long preset){ bonus = 0; protection = 0; charges = 1; - type = 0; + type = ITEM_NOT_MELEE; magic_use_type = 0; graphic_num = 50; value = 0; @@ -279,16 +288,16 @@ cItemRec::cItemRec(long preset){ __attribute__((deprecated)) cItemRec& cItemRec::operator = (legacy::item_record_type& old){ - variety = old.variety; + variety = (eItemType) old.variety; item_level = old.item_level; awkward = old.awkward; bonus = old.bonus; protection = old.protection; charges = old.charges; - type = old.type; + type = (eWeapType) old.type; magic_use_type = old.magic_use_type; graphic_num = old.graphic_num; - ability = old.ability; + ability = (eItemAbil) old.ability; ability_strength = old.ability_strength; type_flag = old.type_flag; is_special = old.is_special; diff --git a/osx/item.h b/osx/item.h index 041de4a7..dcb2897a 100644 --- a/osx/item.h +++ b/osx/item.h @@ -10,16 +10,201 @@ namespace legacy { struct item_record_type; }; +/* items[i].type a.k.a type of weapon */ +enum eWeapType { + ITEM_NOT_MELEE = 0, + ITEM_EDGED = 1, + ITEM_BASHING = 2, + ITEM_POLE = 3, +}; + +/* items[i].variety a.k.a item type (in editor) */ +enum eItemType { + ITEM_TYPE_NO_ITEM = 0, + ITEM_TYPE_ONE_HANDED = 1, + ITEM_TYPE_TWO_HANDED = 2, + ITEM_TYPE_GOLD = 3, + ITEM_TYPE_BOW = 4, + ITEM_TYPE_ARROW = 5, + ITEM_TYPE_THROWN_MISSILE = 6, + ITEM_TYPE_POTION = 7, // potion/magic item + ITEM_TYPE_SCROLL = 8, // scroll/magic item + ITEM_TYPE_WAND = 9, + ITEM_TYPE_TOOL = 10, + ITEM_TYPE_FOOD = 11, + ITEM_TYPE_SHIELD = 12, + ITEM_TYPE_ARMOR = 13, + ITEM_TYPE_HELM = 14, + ITEM_TYPE_GLOVES = 15, + ITEM_TYPE_SHIELD_2 = 16, + // don't know why a second type of shield is used ; it is actually checked + // in the armor code (item >= 12 and <= 17) + // and you can't equip another (12) shield while wearing it ... I didn't + // find a single item with this property in the bladbase.exs ... + ITEM_TYPE_BOOTS = 17, + ITEM_TYPE_RING = 18, + ITEM_TYPE_NECKLACE = 19, + ITEM_TYPE_WEAPON_POISON = 20, + ITEM_TYPE_NON_USE_OBJECT = 21, + ITEM_TYPE_PANTS = 22, + ITEM_TYPE_CROSSBOW = 23, + ITEM_TYPE_BOLTS = 24, + ITEM_TYPE_MISSILE_NO_AMMO = 25, //e.g slings + ITEM_TYPE_UNUSED1 = 26, // these are here solely because they are options in the editor + ITEM_TYPE_UNUSED2 = 27, +}; + +/* items[i].ability */ +enum eItemAbil { + // Weapon abilities + ITEM_NO_ABILITY = 0, + ITEM_FLAMING_WEAPON = 1, + ITEM_DEMON_SLAYER = 2, + ITEM_UNDEAD_SLAYER = 3, + ITEM_LIZARD_SLAYER = 4, + ITEM_GIANT_SLAYER = 5, + ITEM_MAGE_SLAYER = 6, + ITEM_PRIEST_SLAYER = 7, + ITEM_BUG_SLAYER = 8, + ITEM_ACIDIC_WEAPON = 9, + ITEM_SOULSUCKER = 10, + ITEM_DRAIN_MISSILES = 11, + ITEM_WEAK_WEAPON = 12, + ITEM_CAUSES_FEAR = 13, + ITEM_POISONED_WEAPON = 14, + // General abilities + ITEM_PROTECTION = 30, + ITEM_FULL_PROTECTION = 31, + ITEM_FIRE_PROTECTION = 32, + ITEM_COLD_PROTECTION = 33, + ITEM_POISON_PROTECTION = 34, + ITEM_MAGIC_PROTECTION = 35, + ITEM_ACID_PROTECTION = 36, + ITEM_SKILL = 37, + ITEM_STRENGTH = 38, + ITEM_DEXTERITY = 39, + ITEM_INTELLIGENCE = 40, + ITEM_ACCURACY = 41, + ITEM_THIEVING = 42, + ITEM_GIANT_STRENGTH = 43, + ITEM_LIGHTER_OBJECT = 44, + ITEM_HEAVIER_OBJECT = 45, + ITEM_OCCASIONAL_BLESS = 46, + ITEM_OCCASIONAL_HASTE = 47, + ITEM_LIFE_SAVING = 48, + ITEM_PROTECT_FROM_PETRIFY = 49, + ITEM_REGENERATE = 50, + ITEM_POISON_AUGMENT = 51, + ITEM_DISEASE_PARTY = 52, + ITEM_WILL = 53, + ITEM_FREE_ACTION = 54, + ITEM_SPEED = 55, + ITEM_SLOW_WEARER = 56, + ITEM_PROTECT_FROM_UNDEAD = 57, + ITEM_PROTECT_FROM_DEMONS = 58, + ITEM_PROTECT_FROM_HUMANOIDS = 59, + ITEM_PROTECT_FROM_REPTILES = 60, + ITEM_PROTECT_FROM_GIANTS = 61, + ITEM_PROTECT_FROM_DISEASE = 62, + // Nonspell Usable + ITEM_POISON_WEAPON = 70, //put poison on weapon + ITEM_BLESS_CURSE = 71, + ITEM_AFFECT_POISON = 72, + ITEM_HASTE_SLOW = 73, + ITEM_AFFECT_INVULN = 74, + ITEM_AFFECT_MAGIC_RES = 75, + ITEM_AFFECT_WEB = 76, + ITEM_AFFECT_DISEASE = 77, + ITEM_AFFECT_SANCTUARY = 78, + ITEM_AFFECT_DUMBFOUND = 79, + ITEM_AFFECT_MARTYRS_SHIELD = 80, + ITEM_AFFECT_SLEEP = 81, + ITEM_AFFECT_PARALYSIS = 82, + ITEM_AFFECT_ACID = 83, + ITEM_BLISS = 84, + ITEM_AFFECT_EXPERIENCE = 85, + ITEM_AFFECT_SKILL_POINTS = 86, + ITEM_AFFECT_HEALTH = 87, + ITEM_AFFECT_SPELL_POINTS = 88, + ITEM_DOOM = 89, + ITEM_LIGHT = 90, + ITEM_STEALTH = 91, + ITEM_FIREWALK = 92, + ITEM_FLYING = 93, + ITEM_MAJOR_HEALING = 94, + // Spell Usable + ITEM_SPELL_FLAME = 110, + ITEM_SPELL_FIREBALL = 111, + ITEM_SPELL_FIRESTORM = 112, + ITEM_SPELL_KILL = 113, + ITEM_SPELL_ICE_BOLT = 114, + ITEM_SPELL_SLOW = 115, + ITEM_SPELL_SHOCKWAVE = 116, + ITEM_SPELL_DISPEL_UNDEAD = 117, + ITEM_SPELL_DISPEL_SPIRIT = 118, + ITEM_SPELL_SUMMONING = 119, + ITEM_SPELL_MASS_SUMMONING = 120, + ITEM_SPELL_ACID_SPRAY = 121, + ITEM_SPELL_STINKING_CLOUD = 122, + ITEM_SPELL_SLEEP_FIELD = 123, + ITEM_SPELL_VENOM = 124, + ITEM_SPELL_SHOCKSTORM = 125, + ITEM_SPELL_PARALYSIS = 126, + ITEM_SPELL_WEB_SPELL = 127, + ITEM_SPELL_STRENGTHEN_TARGET = 128, //wand of carrunos effect + ITEM_SPELL_QUICKFIRE = 129, + ITEM_SPELL_MASS_CHARM = 130, + ITEM_SPELL_MAGIC_MAP = 131, + ITEM_SPELL_DISPEL_BARRIER = 132, + ITEM_SPELL_MAKE_ICE_WALL = 133, + ITEM_SPELL_CHARM_SPELL = 134, + ITEM_SPELL_ANTIMAGIC_CLOUD = 135, + // Reagents + ITEM_HOLLY = 150, // Holly/Toadstool + ITEM_COMFREY_ROOT = 151, + ITEM_GLOWING_NETTLE = 152, + ITEM_WORMGRASS = 153, // Crypt Shroom/Wormgr. + ITEM_ASPTONGUE_MOLD = 154, + ITEM_EMBER_FLOWERS = 155, + ITEM_GRAYMOLD = 156, + ITEM_MANDRAKE = 157, + ITEM_SAPPHIRE = 158, + ITEM_SMOKY_CRYSTAL = 159, + ITEM_RESSURECTION_BALM = 160, + ITEM_LOCKPICKS = 161, + // Missile Abilities + ITEM_MISSILE_RETURNING = 170, + ITEM_MISSILE_LIGHTNING = 171, + ITEM_MISSILE_EXPLODING = 172, + ITEM_MISSILE_ACID = 173, + ITEM_MISSILE_SLAY_UNDEAD = 174, + ITEM_MISSILE_SLAY_DEMON = 175, + ITEM_MISSILE_HEAL_TARGET = 176, +}; + class cItemRec { public: - short variety, item_level; - char awkward, bonus, protection, charges, type, magic_use_type; - unsigned char graphic_num,ability, ability_strength,type_flag, is_special; + eItemType variety; + short item_level; + char awkward; + char bonus; + char protection; + char charges; + eWeapType type; + char magic_use_type; + unsigned short graphic_num; + eItemAbil ability; + unsigned char ability_strength; + unsigned char type_flag; + unsigned char is_special; short value; - unsigned char weight, special_class; + unsigned char weight; + unsigned char special_class; location item_loc; - char full_name[25], name[15]; - unsigned char treas_class,item_properties; + char full_name[25]; + char name[15]; + unsigned char treas_class; + unsigned char item_properties; private: unsigned char reserved1; unsigned char reserved2; @@ -32,12 +217,14 @@ public: bool is_contained() const; bool is_cursed() const; bool is_concealed() const; + bool is_enchanted() const; void set_ident(bool b); void set_property(bool b); void set_magic(bool b); void set_contained(bool b); void set_cursed(bool b); void set_concealed(bool b); + void set_enchanted(bool b); short item_weight() const; cItemRec(); diff --git a/osx/terrain.cpp b/osx/terrain.cpp index 21d26697..3dffe942 100644 --- a/osx/terrain.cpp +++ b/osx/terrain.cpp @@ -15,7 +15,7 @@ cTerrain& cTerrain::operator = (legacy::terrain_type_type& old){ blockage = old.blockage; flag1 = old.flag1; flag2 = old.flag2; - special = old.special; + special = (eTerSpec) old.special; trans_to_what = old.trans_to_what; fly_over = old.fly_over; boat_over = old.boat_over; diff --git a/osx/terrain.h b/osx/terrain.h index 7e47fadc..9ddaaa13 100644 --- a/osx/terrain.h +++ b/osx/terrain.h @@ -8,13 +8,42 @@ namespace legacy { struct terrain_type_type; }; +/* Terrains Specials Properties : scenario.ter_types[i].special */ //complete + +enum eTerSpec { + TER_SPEC_NONE = 0, + TER_SPEC_CHANGE_WHEN_STEP_ON = 1, + TER_SPEC_DOES_FIRE_DAMAGE = 2, + TER_SPEC_DOES_COLD_DAMAGE = 3, + TER_SPEC_DOES_MAGIC_DAMAGE = 4, + TER_SPEC_POISON_LAND = 5, + TER_SPEC_DISEASED_LAND = 6, + TER_SPEC_CRUMBLING_TERRAIN = 7, + TER_SPEC_LOCKABLE_TERRAIN = 8, + TER_SPEC_UNLOCKABLE_TERRAIN = 9, + TER_SPEC_UNLOCKABLE_BASHABLE = 10, + TER_SPEC_IS_A_SIGN = 11, + TER_SPEC_CALL_LOCAL_SPECIAL = 12, + TER_SPEC_CALL_SCENARIO_SPECIAL = 13, + TER_SPEC_IS_A_CONTAINER = 14, + TER_SPEC_WATERFALL = 15, + TER_SPEC_CONVEYOR_NORTH = 16, + TER_SPEC_CONVEYOR_EAST = 17, + TER_SPEC_CONVEYOR_SOUTH = 18, + TER_SPEC_CONVEYOR_WEST = 19, + TER_SPEC_BLOCKED_TO_MONSTERS = 20, + TER_SPEC_TOWN_ENTRANCE = 21, + TER_SPEC_CHNAGE_WHEN_USED = 22, + TER_SPEC_CALL_SPECIAL_WHEN_USED = 23, +}; + class cTerrain { public: short picture; unsigned char blockage; unsigned char flag1; unsigned char flag2; - unsigned char special; + eTerSpec special; unsigned char trans_to_what; unsigned char fly_over; unsigned char boat_over;