version 1.50 | | version 1.51 |
---|
| | |
%{ | | %{ |
/* | | /* |
* static char *rcsid_object_c = | | * static char *rcsid_object_c = |
* "$Id: loader.l,v 1.50 2003/09/03 13:42:19 tchize Exp $"; | | * "$Id: loader.l,v 1.51 2003/09/13 05:01:29 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
static char msgbuf[HUGE_BUF]; | | static char msgbuf[HUGE_BUF]; |
static char lorebuf[HUGE_BUF]; | | static char lorebuf[HUGE_BUF]; |
| | |
| | /* This table is only necessary to convert objects that existed before the |
| | * spell object conversion to the new object. It was not practical |
| | * to go through every mapping looking for every potion, rod, wand, etc |
| | * that had a sp set and update to the new value. So this maps the |
| | * old spell numbers to the name of the new archs. |
| | * If you are adding a new spell, you should not modify this - you |
| | * new spell won't have been used, and thus won't have any legacy object. |
| | * NULL entries in this table are valid - to denote objects that should |
| | * not be updated for whatever reason. |
| | */ |
| | char *spell_mapping[] = { |
| | "spell_magic_bullet", /* 0 */ |
| | "spell_small_fireball", /* 1 */ |
| | "spell_medium_fireball", /* 2 */ |
| | "spell_large_fireball", /* 3 */ |
| | "spell_burning_hands", /* 4 */ |
| | "spell_sm_lightning", /* 5 */ |
| | "spell_large_lightning", /* 6 */ |
| | "spell_magic_missile", /* 7 */ |
| | "spell_create_bomb", /* 8 */ |
| | "spell_summon_golem", /* 9 */ |
| | "spell_summon_fire_elemental", /* 10 */ |
| | "spell_summon_earth_elemental", /* 11 */ |
| | "spell_summon_water_elemental", /* 12 */ |
| | "spell_summon_air_elemental", /* 13 */ |
| | "spell_dimension_door", /* 14 */ |
| | "spell_create_earth_wall", /* 15 */ |
| | "spell_paralyze", /* 16 */ |
| | "spell_icestorm", /* 17 */ |
| | "spell_magic_mapping", /* 18 */ |
| | "spell_turn_undead", /* 19 */ |
| | "spell_fear", /* 20 */ |
| | "spell_poison_cloud", /* 21 */ |
| | "spell_wonder", /* 22 */ |
| | "spell_destruction", /* 23 */ |
| | "spell_perceive_self", /* 24 */ |
| | "spell_word_of_recall", /* 25 */ |
| | "spell_invisible", /* 26 */ |
| | "spell_invisible_to_undead", /* 27 */ |
| | "spell_probe", /* 28 */ |
| | "spell_lg_magic_bullet", /* 29 */ |
| | "spell_improved_invisibility", /* 30 */ |
| | "spell_holy_word", /* 31 */ |
| | "spell_minor_healing", /* 32 */ |
| | "spell_medium_healing", /* 33 */ |
| | "spell_major_healing", /* 34 */ |
| | "spell_heal", /* 35 */ |
| | "spell_create_food", /* 36 */ |
| | "spell_earth_to_dust", /* 37 */ |
| | "spell_armour", /* 38 */ |
| | "spell_strength", /* 39 */ |
| | "spell_dexterity", /* 40 */ |
| | "spell_constitution", /* 41 */ |
| | "spell_charisma", /* 42 */ |
| | "spell_create_fire_wall", /* 43 */ |
| | "spell_create_frost_wall", /* 44 */ |
| | "spell_protection_from_cold", /* 45 */ |
| | "spell_protection_from_electricity", /* 46 */ |
| | "spell_protection_from_fire", /* 47 */ |
| | "spell_protection_from_poison", /* 48 */ |
| | "spell_protection_from_slow", /* 49 */ |
| | "spell_protection_from_paralysis", /* 50 */ |
| | "spell_protection_from_draining", /* 51 */ |
| | "spell_protection_from_magic", /* 52 */ |
| | "spell_protection_from_attack", /* 53 */ |
| | "spell_levitate", /* 54 */ |
| | "spell_small_speedball", /* 55 */ |
| | "spell_large_speedball", /* 56 */ |
| | "spell_hellfire", /* 57 */ |
| | "spell_dragonbreath", /* 58 */ |
| | "spell_large_icestorm", /* 59 */ |
| | "spell_charging", /* 60 */ |
| | "spell_polymorph", /* 61 */ |
| | "spell_cancellation", /* 62 */ |
| | "spell_confusion", /* 63 */ |
| | "spell_mass_confusion", /* 64 */ |
| | "spell_summon_pet_monster", /* 65 */ |
| | "spell_slow", /* 66 */ |
| | "spell_regenerate_spellpoints", /* 67 */ |
| | "spell_cure_poison", /* 68 */ |
| | "spell_protection_from_confusion", /* 69 */ |
| | "spell_protection_from_cancellation", /* 70 */ |
| | "spell_protection_from_depletion", /* 71 */ |
| | "spell_alchemy", /* 72 */ |
| | "spell_remove_curse", /* 73 */ |
| | "spell_remove_damnation", /* 74 */ |
| | "spell_identify", /* 75*/ |
| | "spell_detect_magic", /* 76 */ |
| | "spell_detect_monster", /* 77 */ |
| | "spell_detect_evil", /* 78 */ |
| | "spell_detect_curse", /* 79 */ |
| | "spell_heroism", /* 80 */ |
| | "spell_aggravation", /* 81 */ |
| | "spell_firebolt", /* 82 */ |
| | "spell_frostbolt", /* 83 */ |
| | "spell_shockwave", /* 84 */ |
| | "spell_color_spray", /* 85 */ |
| | "spell_haste", /* 86 */ |
| | "spell_face_of_death", /* 87 */ |
| | "spell_ball_lightning", /* 88 */ |
| | "spell_meteor_swarm", /* 89 */ |
| | "spell_comet", /* 90 */ |
| | "spell_mystic_fist", /* 91 */ |
| | "spell_raise_dead", /* 92 */ |
| | "spell_resurrection", /* 93 */ |
| | "spell_reincarnation", /* 94 */ |
| | "spell_immunity_to_cold", /* 95 */ |
| | "spell_immunity_to_electricity",/* 96 */ |
| | "spell_immunity_to_fire", /* 97 */ |
| | "spell_immunity_to_poison", /* 98 */ |
| | "spell_immunity_to_slow", /* 99 */ |
| | "spell_immunity_to_paralysis", /* 100 */ |
| | "spell_immunity_to_draining", /* 101 */ |
| | "spell_immunity_to_magic", /* 102 */ |
| | "spell_immunity_to_attack", /* 103 */ |
| | "spell_invulnerability", /* 104 */ |
| | "spell_defense", /* 105 */ |
| | "spell_rune_of_fire", /* 106 */ |
| | "spell_rune_of_frost", /* 107 */ |
| | "spell_rune_of_shocking", /* 108 */ |
| | "spell_rune_of_blasting", /* 109 */ |
| | "spell_rune_of_death", /* 110 */ |
| | "spell_marking_rune", /* 111 */ |
| | "spell_build_director", /* 112 */ |
| | "spell_create_pool_of_chaos", /* 113 */ |
| | "spell_build_bullet_wall", /* 114 */ |
| | "spell_build_lightning_wall", /* 115 */ |
| | "spell_build_fireball_wall", /* 116 */ |
| | "spell_magic_rune", /* 117 */ |
| | "spell_rune_of_magic_drain", /* 118 */ |
| | "spell_antimagic_rune", /* 119 */ |
| | "spell_rune_of_transference", /* 120 */ |
| | "spell_transference", /* 121 */ |
| | "spell_magic_drain", /* 122 */ |
| | "spell_counterspell", /* 123 */ |
| | "spell_disarm", /* 124 */ |
| | "spell_cure_confusion", /* 125 */ |
| | "spell_restoration", /* 126 */ |
| | "was summon evil monster", /* 127 */ /* Not implenented as nothing used it */ |
| | "spell_counterwall", /* 128 */ |
| | "spell_cause_light_wounds", /* 129 */ |
| | "spell_cause_medium_wounds", /* 130 */ |
| | "spell_cause_heavy_wounds", /* 131 */ |
| | "spell_charm_monsters", /* 132 */ |
| | "spell_banishment", /* 133 */ |
| | "spell_create_missile", /* 134 */ |
| | "spell_show_invisible", /* 135 */ |
| | "spell_xray", /* 136 */ |
| | "spell_pacify", /* 137 */ |
| | "spell_summon_fog", /* 138 */ |
| | "spell_steambolt", /* 139 */ |
| | "spell_command_undead", /* 140 */ |
| | "spell_holy_orb", /* 141 */ |
| | "spell_summon_avatar", /* 142 */ |
| | "spell_holy_possession", /* 143 */ |
| | "spell_bless", /* 144 */ |
| | "spell_curse", /* 145 */ |
| | "spell_regeneration", /* 146 */ |
| | "spell_consecrate", /* 147 */ |
| | "spell_summon_cult_monsters", /* 148 */ |
| | "spell_cause_critical_wounds", /* 149 */ |
| | "spell_holy_wrath", /* 150 */ |
| | "spell_retributive_strike", /* 151 */ |
| | "spell_finger_of_death", /* 152 */ |
| | "spell_insect_plague", /* 153 */ |
| | "spell_call_holy_servant", /* 154 */ |
| | "spell_wall_of_thorns", /* 155 */ |
| | "spell_staff_to_snake", /* 156 */ |
| | "spell_light", /* 157 */ |
| | "spell_darkness", /* 158 */ |
| | "spell_nightfall", /* 159 */ |
| | "spell_daylight", /* 160 */ |
| | "spell_sunspear", /* 161 */ |
| | "spell_faery_fire", /* 162 */ |
| | "spell_cure_blindness", /* 163 */ |
| | "spell_dark_vision", /* 164 */ |
| | "spell_bullet_swarm", /* 165 */ |
| | "spell_bullet_storm", /* 166 */ |
| | "spell_cause_many_wounds", /* 167 */ |
| | "spell_small_snowstorm", /* 168 */ |
| | "spell_medium_snowstorm", /* 169 */ |
| | "spell_large_snowstorm", /* 170 */ |
| | "spell_cure_disease", /* 171 */ |
| | "spell_cause_red_death", /* 172 */ |
| | "spell_cause_flu", /* 173 */ |
| | "spell_cause_black_death", /* 174 */ |
| | "spell_cause_leprosy", /* 175 */ |
| | "spell_cause_smallpox", /* 176 */ |
| | "spell_cause_white_death", /* 177 */ |
| | "spell_cause_anthrax", /* 178 */ |
| | "spell_cause_typhoid", /* 179 */ |
| | "spell_mana_blast", /* 180 */ |
| | "spell_small_manaball", /* 181 */ |
| | "spell_medium_manaball", /* 182 */ |
| | "spell_large_manaball", /* 183 */ |
| | "spell_manabolt", /* 184 */ |
| | "spell_dancing_sword", /* 185 */ |
| | "spell_animate_weapon", /* 186 */ |
| | "spell_cause_cold", /* 187 */ |
| | "spell_divine_shock", /* 188 */ |
| | "spell_windstorm", /* 189 */ |
| | "spell_sanctuary", /* 190 */ |
| | "spell_peace", /* 191 */ |
| | "spell_spiderweb", /* 192 */ |
| | "spell_conflict", /* 193 */ |
| | "spell_rage", /* 194 */ |
| | "spell_forked_lightning", /* 195 */ |
| | "spell_poison_fog", /* 196 */ |
| | "spell_flaming_aura", /* 197 */ |
| | "spell_vitriol", /* 198 */ |
| | "spell_vitriol_splash", /* 199 */ |
| | "spell_iron_skin", /* 200 */ |
| | "spell_wrathful_eye", /* 201 */ |
| | "spell_town_portal", /* 202 */ |
| | "spell_missile_swarm", /* 203 */ |
| | "spell_cause_rabies", /* 204 */ |
| | "spell_glyph", /* 205 */ |
| | NULL |
| | }; |
| | |
#define SET_OR_CLEAR_FLAG(op, flag, val) \ | | #define SET_OR_CLEAR_FLAG(op, flag, val) \ |
{ if (val) SET_FLAG(op, flag); else CLEAR_FLAG(op, flag); } | | { if (val) SET_FLAG(op, flag); else CLEAR_FLAG(op, flag); } |
| | |
| | |
op->name_pl = add_string(p); | | op->name_pl = add_string(p); |
} | | } |
} | | } |
| | /* only do these when program is first run - a bit |
| | * excessive to do this at every run - most of this is |
| | * really just to catch any errors - program will still run, but |
| | * not in the ideal fashion. |
| | */ |
| | if ((op->type == WEAPON || op->type==BOW) && arch_init) { |
| | if (!op->skill) { |
| | LOG(llevError,"Weapon %s lacks a skill.\n", op->name); |
| | } else if ((!strcmp(op->skill,"one handed weapons") && op->body_info[1] != -1) || |
| | (!strcmp(op->skill,"two handed weapons") && op->body_info[1] != -2)) { |
| | LOG(llevError,"weapon %s arm usage does not match skill: %d, %s\n", |
| | op->name, op->body_info[1], op->skill); |
| | } |
| | } |
| | |
/* We changed last_heal to gen_sp_armour, which is what it | | /* We changed last_heal to gen_sp_armour, which is what it |
* really does for many objects. Need to catch any in maps | | * really does for many objects. Need to catch any in maps |
| | |
} | | } |
| | |
} | | } |
| | /* Old spellcasting object - need to load in the appropiate object */ |
| | if ((op->type == ROD || op->type == WAND || op->type == SCROLL || op->type == HORN |
| | || op->type == FIREWALL || |
| | /* POTIONS and ALTARS don't always cast spells, but if they do, update them */ |
| | ((op->type == POTION || op->type == ALTAR) && op->stats.sp)) && !op->inv) { |
| | object *tmp; |
| | |
| | tmp = get_archetype(spell_mapping[op->stats.sp]); |
| | insert_ob_in_ob(tmp, op); |
| | op->randomitems = NULL; /* So another spell isn't created for this object */ |
| | } |
| | /* spellbooks & runes use slaying. But not to arch name, but to spell name */ |
| | |
| | if ((op->type == SPELLBOOK || op->type == RUNE) && op->slaying && !op->inv) { |
| | object *tmp; |
| | |
| | tmp = get_archetype_by_object_name(op->slaying); |
| | insert_ob_in_ob(tmp, op); |
| | op->randomitems = NULL; /* So another spell isn't created for this object */ |
| | /* without this, value is all screwed up */ |
| | op->value = op->arch->clone.value * op->inv->value; |
| | } |
| | |
if (QUERY_FLAG(op, FLAG_MONSTER)) { | | if (QUERY_FLAG(op, FLAG_MONSTER)) { |
if (op->stats.hp > op->stats.maxhp) | | if (op->stats.hp > op->stats.maxhp) |
LOG(llevDebug,"Monster %s has hp set higher than maxhp (%d>%d)\n", | | LOG(llevDebug,"Monster %s has hp set higher than maxhp (%d>%d)\n", |
| | |
if (*yv=='\0') LOG(llevError,"Name without val\n"); | | if (*yv=='\0') LOG(llevError,"Name without val\n"); |
else FREE_AND_COPY(op->name_pl, yv); | | else FREE_AND_COPY(op->name_pl, yv); |
} | | } |
| | ^skill{S} FREE_AND_COPY(op->skill,yval()); |
^custom_name{S} { char *yv=yval(); | | ^custom_name{S} { char *yv=yval(); |
| | |
if (*yv=='\0') LOG(llevError,"Custom name without val\n"); | | if (*yv=='\0') LOG(llevError,"Custom name without val\n"); |
| | |
^grace{S} op->stats.grace = IVAL; | | ^grace{S} op->stats.grace = IVAL; |
^maxgrace{S} op->stats.maxgrace = IVAL; | | ^maxgrace{S} op->stats.maxgrace = IVAL; |
^exp{S} op->stats.exp = atoll(yval()); | | ^exp{S} op->stats.exp = atoll(yval()); |
| | ^perm_exp{S} op->perm_exp = atoll(yval()); |
^food{S} op->stats.food = IVAL; | | ^food{S} op->stats.food = IVAL; |
^dam{S} op->stats.dam = IVAL; | | ^dam{S} op->stats.dam = IVAL; |
^wc{S} op->stats.wc = IVAL; | | ^wc{S} op->stats.wc = IVAL; |
| | |
^resist_holyword{S} SET_RESIST(op, ATNR_HOLYWORD, IVAL); | | ^resist_holyword{S} SET_RESIST(op, ATNR_HOLYWORD, IVAL); |
^resist_blind{S} SET_RESIST(op, ATNR_BLIND, IVAL); | | ^resist_blind{S} SET_RESIST(op, ATNR_BLIND, IVAL); |
^resist_internal{S} SET_RESIST(op, ATNR_INTERNAL, IVAL); | | ^resist_internal{S} SET_RESIST(op, ATNR_INTERNAL, IVAL); |
| | ^resist_life_stealing{S} SET_RESIST(op, ATNR_LIFE_STEALING, IVAL); |
| | ^resist_disease{S} SET_RESIST(op, ATNR_DISEASE, IVAL); |
| | |
/* Old style resistances */ | | /* Old style resistances */ |
^immune{S} set_protection(op, IVAL, RESIST_IMMUNE); | | ^immune{S} set_protection(op, IVAL, RESIST_IMMUNE); |
| | |
^can_see_in_dark{S} SET_OR_CLEAR_FLAG(op, FLAG_SEE_IN_DARK, IVAL); | | ^can_see_in_dark{S} SET_OR_CLEAR_FLAG(op, FLAG_SEE_IN_DARK, IVAL); |
^is_cauldron{S} SET_OR_CLEAR_FLAG(op, FLAG_IS_CAULDRON, IVAL); | | ^is_cauldron{S} SET_OR_CLEAR_FLAG(op, FLAG_IS_CAULDRON, IVAL); |
^randomitems{S} op->randomitems = find_treasurelist(yval()); | | ^randomitems{S} op->randomitems = find_treasurelist(yval()); |
^is_dust{S} SET_OR_CLEAR_FLAG(op, FLAG_DUST, IVAL); | | |
^no_steal{S} SET_OR_CLEAR_FLAG(op, FLAG_NO_STEAL, IVAL); | | ^no_steal{S} SET_OR_CLEAR_FLAG(op, FLAG_NO_STEAL, IVAL); |
^one_hit{S} SET_OR_CLEAR_FLAG(op, FLAG_ONE_HIT, IVAL); | | ^one_hit{S} SET_OR_CLEAR_FLAG(op, FLAG_ONE_HIT, IVAL); |
^berserk{S} SET_OR_CLEAR_FLAG(op, FLAG_BERSERK, IVAL); | | ^berserk{S} SET_OR_CLEAR_FLAG(op, FLAG_BERSERK, IVAL); |
| | |
^can_dam_armour{S} { } | | ^can_dam_armour{S} { } |
^weapontype{S} op->weapontype = IVAL; | | ^weapontype{S} op->weapontype = IVAL; |
^tooltype{S} op->tooltype = IVAL; | | ^tooltype{S} op->tooltype = IVAL; |
^casting_speed{S} op->casting_speed = FVAL; | | ^casting_time{S} op->casting_time = FVAL; |
^elevation{S} op->elevation = IVAL; | | ^elevation{S} op->elevation = IVAL; |
^smoothlevel{S} op->smoothlevel = IVAL; | | ^smoothlevel{S} op->smoothlevel = IVAL; |
^client_type{S} op->client_type = IVAL; | | ^client_type{S} op->client_type = IVAL; |
^body_{A} set_body_info(op, yytext); | | ^body_{A} set_body_info(op, yytext); |
| | ^duration{S} op->duration = IVAL; |
| | ^range{S} op->range = IVAL; |
| | ^range_modifier{S} op->range_modifier = IVAL; |
| | ^dam_modifier{S} op->dam_modifier = IVAL; |
| | ^duration_modifier{S} op->duration_modifier = IVAL; |
| | |
^event_apply{S} { | | ^event_apply{S} { |
char *yv=yval(); | | char *yv=yval(); |
| | |
if(op->slaying && op->slaying!=op2->slaying) { | | if(op->slaying && op->slaying!=op2->slaying) { |
ADD_STRINGLINE_ENTRY(fastbuf,"slaying ",op->slaying,8); | | ADD_STRINGLINE_ENTRY(fastbuf,"slaying ",op->slaying,8); |
} | | } |
| | if(op->skill && op->skill!=op2->skill) { |
| | sprintf(buf2,"skill %s\n",op->skill); |
| | strcat(buf,buf2); |
| | } |
if(op->msg && op->msg!=op2->msg) { | | if(op->msg && op->msg!=op2->msg) { |
FAST_STRNCAT(fastbuf,"msg\n",3+eol_size); | | FAST_STRNCAT(fastbuf,"msg\n",3+eol_size); |
FAST_STRCAT(fastbuf,op->msg); | | FAST_STRCAT(fastbuf,op->msg); |
| | |
FAST_SAVE_LONG(fastbuf,"maxgrace ",op->stats.maxgrace,9); | | FAST_SAVE_LONG(fastbuf,"maxgrace ",op->stats.maxgrace,9); |
if(op->stats.exp!=op2->stats.exp) | | if(op->stats.exp!=op2->stats.exp) |
FAST_SAVE_LONG(fastbuf,"exp ",op->stats.exp,4); | | FAST_SAVE_LONG(fastbuf,"exp ",op->stats.exp,4); |
| | if(op->perm_exp!=op2->perm_exp) |
| | FAST_SAVE_LONG(fastbuf,"perm_exp ",op->perm_exp,4); |
if(op->expmul!=op2->expmul) | | if(op->expmul!=op2->expmul) |
FAST_SAVE_DOUBLE(fastbuf,"expmul ",op->expmul,7); | | FAST_SAVE_DOUBLE(fastbuf,"expmul ",op->expmul,7); |
if(op->stats.food!=op2->stats.food) | | if(op->stats.food!=op2->stats.food) |
| | |
FAST_SAVE_LONG(fastbuf,"item_power ",op->item_power,11); | | FAST_SAVE_LONG(fastbuf,"item_power ",op->item_power,11); |
} | | } |
| | |
| | if (op->duration != op2->duration) { |
| | sprintf(buf2,"duration %d\n", op->duration); |
| | strcat(buf,buf2); |
| | } |
| | |
| | if (op->range != op2->range) { |
| | sprintf(buf2,"range %d\n", op->range); |
| | strcat(buf,buf2); |
| | } |
| | |
| | if (op->range_modifier != op2->range_modifier) { |
| | sprintf(buf2,"range_modifier %d\n", op->range_modifier); |
| | strcat(buf,buf2); |
| | } |
| | |
| | if (op->duration_modifier != op2->duration_modifier) { |
| | sprintf(buf2,"range_modifier %d\n", op->duration_modifier); |
| | strcat(buf,buf2); |
| | } |
| | |
| | if (op->dam_modifier != op2->dam_modifier) { |
| | sprintf(buf2,"dam_modifier %d\n", op->dam_modifier); |
| | strcat(buf,buf2); |
| | } |
| | |
if (op->gen_sp_armour != op2->gen_sp_armour) { | | if (op->gen_sp_armour != op2->gen_sp_armour) { |
FAST_SAVE_LONG(fastbuf,"gen_sp_armour ",op->gen_sp_armour,14); | | FAST_SAVE_LONG(fastbuf,"gen_sp_armour ",op->gen_sp_armour,14); |
} | | } |