1 | /* |
1 | /* |
2 | * CrossFire, A Multiplayer game for X-windows |
2 | * CrossFire, A Multiplayer game |
3 | * |
3 | * |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
4 | * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (C) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (C) 1992 Frank Tore Johansen |
6 | * Copyright (C) 1992 Frank Tore Johansen |
7 | * |
7 | * |
… | |
… | |
678 | */ |
678 | */ |
679 | dummy->name = op->map->path; |
679 | dummy->name = op->map->path; |
680 | EXIT_X (dummy) = op->x; |
680 | EXIT_X (dummy) = op->x; |
681 | EXIT_Y (dummy) = op->y; |
681 | EXIT_Y (dummy) = op->y; |
682 | insert_ob_in_ob (dummy, op); |
682 | insert_ob_in_ob (dummy, op); |
683 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You fix this place in your mind.\nYou feel you are able to come here from anywhere."); |
683 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "You fix this place in your mind. You feel you are able to come here from anywhere."); |
684 | return 1; |
684 | return 1; |
685 | } |
685 | } |
686 | |
686 | |
687 | dummy->destroy (); |
687 | dummy->destroy (); |
688 | |
688 | |
… | |
… | |
760 | exitmap = maptile::find_sync (force->name); |
760 | exitmap = maptile::find_sync (force->name); |
761 | |
761 | |
762 | /* If we were unable to load (ex. random map deleted), warn player */ |
762 | /* If we were unable to load (ex. random map deleted), warn player */ |
763 | if (!exitmap) |
763 | if (!exitmap) |
764 | { |
764 | { |
765 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens.\nYou can't remember where to go!?"); |
765 | new_draw_info (NDI_UNIQUE | NDI_NAVY, 0, op, "Something strange happens. You can't remember where to go!?"); |
766 | force->destroy (); |
766 | force->destroy (); |
767 | return 1; |
767 | return 1; |
768 | } |
768 | } |
769 | |
769 | |
770 | exitmap->load_sync (); |
770 | exitmap->load_sync (); |
771 | |
771 | |
772 | op_level = caster_level (caster, spell); |
772 | op_level = caster_level (caster, spell); |
773 | if (op_level < 15) |
773 | if (op_level < 15) |
774 | snprintf (portal_message, 1024, |
774 | snprintf (portal_message, 1024, |
775 | "\nThe air moves around you and\na huge smell of ammonia\nsurounds you as you pass\nthrough %s's tiny portal\nPouah!\n", |
775 | "The air moves around you and a huge smell of ammonia surounds you as you pass through %s's tiny portal. Pouah!\n", |
776 | &op->name); |
776 | &op->name); |
777 | else if (op_level < 30) |
777 | else if (op_level < 30) |
778 | snprintf (portal_message, 1024, |
778 | snprintf (portal_message, 1024, |
779 | "\n%s's portal smells of ozone.\nYou do a lot of movements and finally pass\nthrough the small hole in the air\n", &op->name); |
779 | "%s's portal smells of ozone. You do a lot of movements and finally pass through the small hole in the air\n", &op->name); |
780 | else if (op_level < 60) |
780 | else if (op_level < 60) |
781 | snprintf (portal_message, 1024, "\nA shining door opens in the air in front of you,\nshowing you the path to another place.\n"); |
781 | snprintf (portal_message, 1024, "A shining door opens in the air in front of you, showing you the path to another place.\n"); |
782 | else |
782 | else |
783 | snprintf (portal_message, 1024, "\nAs you walk through %s's portal, flowers come out\nfrom the ground around you.\nYou feel awed.\n", |
783 | snprintf (portal_message, 1024, "As you walk through %s's portal, flowers come out from the ground around you. You feel awed.\n", |
784 | &op->name); |
784 | &op->name); |
785 | |
785 | |
786 | /* Create a portal in front of player |
786 | /* Create a portal in front of player |
787 | * dummy contain the portal and |
787 | * dummy contain the portal and |
788 | * force contain the track to kill it later |
788 | * force contain the track to kill it later |
… | |
… | |
1764 | { |
1764 | { |
1765 | identify (tmp); |
1765 | identify (tmp); |
1766 | |
1766 | |
1767 | if (op->type == PLAYER) |
1767 | if (op->type == PLAYER) |
1768 | { |
1768 | { |
1769 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have %s.", long_desc (tmp, op)); |
1769 | new_draw_info_format (NDI_UNIQUE, 0, op, "You identified: %s.", long_desc (tmp, op)); |
1770 | |
1770 | |
1771 | if (tmp->msg) |
1771 | if (tmp->msg) |
1772 | { |
1772 | { |
1773 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1773 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1774 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1774 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
… | |
… | |
1786 | * stuff on the floor. Only identify stuff on the floor if the spell |
1786 | * stuff on the floor. Only identify stuff on the floor if the spell |
1787 | * was not fully used. |
1787 | * was not fully used. |
1788 | */ |
1788 | */ |
1789 | if (num_ident) |
1789 | if (num_ident) |
1790 | { |
1790 | { |
1791 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) |
1791 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) |
1792 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1792 | if (!QUERY_FLAG (tmp, FLAG_IDENTIFIED) && !tmp->invisible && need_identify (tmp)) |
1793 | { |
1793 | { |
1794 | identify (tmp); |
1794 | identify (tmp); |
1795 | |
1795 | |
1796 | if (op->type == PLAYER) |
1796 | if (op->type == PLAYER) |
1797 | { |
1797 | { |
1798 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground is %s.", long_desc (tmp, op)); |
1798 | new_draw_info_format (NDI_UNIQUE, 0, op, "On the ground you identified: %s.", long_desc (tmp, op)); |
1799 | |
1799 | |
1800 | if (tmp->msg) |
1800 | if (tmp->msg) |
1801 | { |
1801 | { |
1802 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1802 | new_draw_info (NDI_UNIQUE, 0, op, "The item has a story:"); |
1803 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
1803 | new_draw_info (NDI_UNIQUE, 0, op, tmp->msg); |
… | |
… | |
2243 | * This code was very odd - code early on would only let players use the spell, |
2243 | * This code was very odd - code early on would only let players use the spell, |
2244 | * yet the code wass full of player checks. I've presumed that the code |
2244 | * yet the code wass full of player checks. I've presumed that the code |
2245 | * that only let players use it was correct, and removed all the other |
2245 | * that only let players use it was correct, and removed all the other |
2246 | * player checks. MSW 2003-01-06 |
2246 | * player checks. MSW 2003-01-06 |
2247 | */ |
2247 | */ |
2248 | |
|
|
2249 | int |
2248 | int |
2250 | animate_weapon (object *op, object *caster, object *spell, int dir) |
2249 | animate_weapon (object *op, object *caster, object *spell, int dir) |
2251 | { |
2250 | { |
2252 | object *weapon, *tmp; |
2251 | object *weapon, *tmp; |
2253 | char buf[MAX_BUF]; |
2252 | char buf[MAX_BUF]; |
… | |
… | |
2265 | /* exit if it's not a player using this spell. */ |
2264 | /* exit if it's not a player using this spell. */ |
2266 | if (op->type != PLAYER) |
2265 | if (op->type != PLAYER) |
2267 | return 0; |
2266 | return 0; |
2268 | |
2267 | |
2269 | /* if player already has a golem, abort */ |
2268 | /* if player already has a golem, abort */ |
2270 | if (op->contr->ranges[range_golem]) |
2269 | if (object *golem = op->contr->golem) |
2271 | { |
2270 | { |
2272 | control_golem (op->contr->ranges[range_golem], dir); |
2271 | control_golem (golem, dir); |
2273 | return 0; |
2272 | return 0; |
2274 | } |
2273 | } |
2275 | |
2274 | |
2276 | /* if no direction specified, pick one */ |
2275 | /* if no direction specified, pick one */ |
2277 | if (!dir) |
2276 | if (!dir) |
… | |
… | |
2327 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2326 | CLEAR_FLAG (tmp, FLAG_MONSTER); |
2328 | tmp->stats.exp = 0; |
2327 | tmp->stats.exp = 0; |
2329 | add_friendly_object (tmp); |
2328 | add_friendly_object (tmp); |
2330 | tmp->type = GOLEM; |
2329 | tmp->type = GOLEM; |
2331 | tmp->set_owner (op); |
2330 | tmp->set_owner (op); |
|
|
2331 | op->contr->golem = tmp; |
2332 | set_spell_skill (op, caster, spell, tmp); |
2332 | set_spell_skill (op, caster, spell, tmp); |
2333 | op->contr->ranges[range_golem] = tmp; |
|
|
2334 | op->contr->shoottype = range_golem; |
|
|
2335 | |
2333 | |
2336 | /* Give the weapon to the golem now. A bit of a hack to check the |
2334 | /* Give the weapon to the golem now. A bit of a hack to check the |
2337 | * removed flag - it should only be set if get_split_object was |
2335 | * removed flag - it should only be set if get_split_object was |
2338 | * used above. |
2336 | * used above. |
2339 | */ |
2337 | */ |
2340 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2338 | if (!QUERY_FLAG (weapon, FLAG_REMOVED)) |
2341 | weapon->remove (); |
2339 | weapon->remove (); |
|
|
2340 | |
2342 | insert_ob_in_ob (weapon, tmp); |
2341 | insert_ob_in_ob (weapon, tmp); |
2343 | esrv_send_item (op, weapon); |
2342 | esrv_send_item (op, weapon); |
2344 | /* To do everything necessary to let a golem use the weapon is a pain, |
2343 | /* To do everything necessary to let a golem use the weapon is a pain, |
2345 | * so instead, just set it as equipped (otherwise, we need to update |
2344 | * so instead, just set it as equipped (otherwise, we need to update |
2346 | * body_info, skills, etc) |
2345 | * body_info, skills, etc) |