… | |
… | |
489 | path_to_player (object *mon, object *pl, unsigned mindiff) |
489 | path_to_player (object *mon, object *pl, unsigned mindiff) |
490 | { |
490 | { |
491 | rv_vector rv; |
491 | rv_vector rv; |
492 | sint16 x, y; |
492 | sint16 x, y; |
493 | int lastx, lasty, dir, i, diff, firstdir = 0, lastdir, max = MAX_SPACES, mflags, blocked; |
493 | int lastx, lasty, dir, i, diff, firstdir = 0, lastdir, max = MAX_SPACES, mflags, blocked; |
494 | mapstruct *m, *lastmap; |
494 | maptile *m, *lastmap; |
495 | |
495 | |
496 | get_rangevector (mon, pl, &rv, 0); |
496 | get_rangevector (mon, pl, &rv, 0); |
497 | |
497 | |
498 | if (rv.distance < mindiff) |
498 | if (rv.distance < mindiff) |
499 | return 0; |
499 | return 0; |
… | |
… | |
1180 | if (settings.set_title == TRUE) |
1180 | if (settings.set_title == TRUE) |
1181 | op->contr->own_title[0] = '\0'; |
1181 | op->contr->own_title[0] = '\0'; |
1182 | |
1182 | |
1183 | if (!QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1183 | if (!QUERY_FLAG (op, FLAG_WAS_WIZ)) |
1184 | { |
1184 | { |
1185 | mapstruct *mp, *next; |
1185 | maptile *mp, *next; |
1186 | |
1186 | |
1187 | /* We need to hunt for any per player unique maps in memory and |
1187 | /* We need to hunt for any per player unique maps in memory and |
1188 | * get rid of them. The trailing slash in the path is intentional, |
1188 | * get rid of them. The trailing slash in the path is intentional, |
1189 | * so that players named 'Ab' won't match against players 'Abe' pathname |
1189 | * so that players named 'Ab' won't match against players 'Abe' pathname |
1190 | */ |
1190 | */ |
… | |
… | |
1264 | */ |
1264 | */ |
1265 | int |
1265 | int |
1266 | check_pick (object *op) |
1266 | check_pick (object *op) |
1267 | { |
1267 | { |
1268 | object *tmp, *next; |
1268 | object *tmp, *next; |
1269 | tag_t next_tag = 0, op_tag; |
|
|
1270 | int stop = 0; |
1269 | int stop = 0; |
1271 | int j, k, wvratio; |
1270 | int j, k, wvratio; |
1272 | char putstring[128], tmpstr[16]; |
1271 | char putstring[128], tmpstr[16]; |
1273 | |
1272 | |
1274 | |
|
|
1275 | /* if you're flying, you cna't pick up anything */ |
1273 | /* if you're flying, you cna't pick up anything */ |
1276 | if (op->move_type & MOVE_FLYING) |
1274 | if (op->move_type & MOVE_FLYING) |
1277 | return 1; |
1275 | return 1; |
1278 | |
1276 | |
1279 | op_tag = op->count; |
|
|
1280 | |
|
|
1281 | next = op->below; |
1277 | next = op->below; |
1282 | if (next) |
|
|
1283 | next_tag = next->count; |
|
|
1284 | |
1278 | |
1285 | /* loop while there are items on the floor that are not marked as |
1279 | /* loop while there are items on the floor that are not marked as |
1286 | * destroyed */ |
1280 | * destroyed */ |
1287 | while (next && !was_destroyed (next, next_tag)) |
1281 | while (next && !next->destroyed ()) |
1288 | { |
1282 | { |
1289 | tmp = next; |
1283 | tmp = next; |
1290 | next = tmp->below; |
1284 | next = tmp->below; |
1291 | if (next) |
|
|
1292 | next_tag = next->count; |
|
|
1293 | |
1285 | |
1294 | if (was_destroyed (op, op_tag)) |
1286 | if (op->destroyed ()) |
1295 | return 0; |
1287 | return 0; |
1296 | |
1288 | |
1297 | if (!can_pick (op, tmp)) |
1289 | if (!can_pick (op, tmp)) |
1298 | continue; |
1290 | continue; |
1299 | |
1291 | |
… | |
… | |
1770 | |
1762 | |
1771 | object * |
1763 | object * |
1772 | pick_arrow_target (object *op, const char *type, int dir) |
1764 | pick_arrow_target (object *op, const char *type, int dir) |
1773 | { |
1765 | { |
1774 | object *tmp = NULL; |
1766 | object *tmp = NULL; |
1775 | mapstruct *m; |
1767 | maptile *m; |
1776 | int i, mflags, found, number; |
1768 | int i, mflags, found, number; |
1777 | sint16 x, y; |
1769 | sint16 x, y; |
1778 | |
1770 | |
1779 | if (op->map == NULL) |
1771 | if (op->map == NULL) |
1780 | return find_arrow (op, type); |
1772 | return find_arrow (op, type); |
… | |
… | |
1840 | */ |
1832 | */ |
1841 | int |
1833 | int |
1842 | fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy) |
1834 | fire_bow (object *op, object *part, object *arrow, int dir, int wc_mod, sint16 sx, sint16 sy) |
1843 | { |
1835 | { |
1844 | object *left, *bow; |
1836 | object *left, *bow; |
1845 | tag_t left_tag, tag; |
|
|
1846 | int bowspeed, mflags; |
1837 | int bowspeed, mflags; |
1847 | mapstruct *m; |
1838 | maptile *m; |
1848 | |
1839 | |
1849 | if (!dir) |
1840 | if (!dir) |
1850 | { |
1841 | { |
1851 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1842 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1852 | return 0; |
1843 | return 0; |
… | |
… | |
1912 | free_object (arrow); |
1903 | free_object (arrow); |
1913 | return 0; |
1904 | return 0; |
1914 | } |
1905 | } |
1915 | |
1906 | |
1916 | left = arrow; /* these are arrows left to the player */ |
1907 | left = arrow; /* these are arrows left to the player */ |
1917 | left_tag = left->count; |
|
|
1918 | arrow = get_split_ob (arrow, 1); |
1908 | arrow = get_split_ob (arrow, 1); |
1919 | if (arrow == NULL) |
1909 | if (arrow == NULL) |
1920 | { |
1910 | { |
1921 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1911 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1922 | return 0; |
1912 | return 0; |
… | |
… | |
1965 | arrow->level = op->chosen_skill ? op->chosen_skill->level : op->level; |
1955 | arrow->level = op->chosen_skill ? op->chosen_skill->level : op->level; |
1966 | } |
1956 | } |
1967 | else |
1957 | else |
1968 | { |
1958 | { |
1969 | arrow->stats.wc = op->stats.wc - bow->magic - arrow->magic - arrow->stats.wc + wc_mod; |
1959 | arrow->stats.wc = op->stats.wc - bow->magic - arrow->magic - arrow->stats.wc + wc_mod; |
1970 | |
|
|
1971 | arrow->level = op->level; |
1960 | arrow->level = op->level; |
1972 | } |
1961 | } |
|
|
1962 | |
1973 | if (arrow->attacktype == AT_PHYSICAL) |
1963 | if (arrow->attacktype == AT_PHYSICAL) |
1974 | arrow->attacktype |= bow->attacktype; |
1964 | arrow->attacktype |= bow->attacktype; |
|
|
1965 | |
1975 | if (bow->slaying != NULL) |
1966 | if (bow->slaying != NULL) |
1976 | arrow->slaying = bow->slaying; |
1967 | arrow->slaying = bow->slaying; |
1977 | |
1968 | |
1978 | arrow->map = m; |
1969 | arrow->map = m; |
1979 | arrow->move_type = MOVE_FLY_LOW; |
1970 | arrow->move_type = MOVE_FLY_LOW; |
1980 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
1971 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
1981 | |
1972 | |
1982 | play_sound_map (op->map, op->x, op->y, SOUND_FIRE_ARROW); |
1973 | play_sound_map (op->map, op->x, op->y, SOUND_FIRE_ARROW); |
1983 | tag = arrow->count; |
|
|
1984 | insert_ob_in_map (arrow, m, op, 0); |
1974 | insert_ob_in_map (arrow, m, op, 0); |
1985 | |
1975 | |
1986 | if (!was_destroyed (arrow, tag)) |
1976 | if (!arrow->destroyed ()) |
1987 | move_arrow (arrow); |
1977 | move_arrow (arrow); |
1988 | |
1978 | |
1989 | if (op->type == PLAYER) |
1979 | if (op->type == PLAYER) |
1990 | { |
1980 | { |
1991 | if (was_destroyed (left, left_tag)) |
1981 | if (left->destroyed ()) |
1992 | esrv_del_item (op->contr, left_tag); |
1982 | esrv_del_item (op->contr, left->count); |
1993 | else |
1983 | else |
1994 | esrv_send_item (op, left); |
1984 | esrv_send_item (op, left); |
1995 | } |
1985 | } |
|
|
1986 | |
1996 | return 1; |
1987 | return 1; |
1997 | } |
1988 | } |
1998 | |
1989 | |
1999 | /* Special fire code for players - this takes into |
1990 | /* Special fire code for players - this takes into |
2000 | * account the special fire modes players can have |
1991 | * account the special fire modes players can have |
… | |
… | |
2312 | move_player_attack (object *op, int dir) |
2303 | move_player_attack (object *op, int dir) |
2313 | { |
2304 | { |
2314 | object *tmp, *mon; |
2305 | object *tmp, *mon; |
2315 | sint16 nx, ny; |
2306 | sint16 nx, ny; |
2316 | int on_battleground; |
2307 | int on_battleground; |
2317 | mapstruct *m; |
2308 | maptile *m; |
2318 | |
2309 | |
2319 | nx = freearr_x[dir] + op->x; |
2310 | nx = freearr_x[dir] + op->x; |
2320 | ny = freearr_y[dir] + op->y; |
2311 | ny = freearr_y[dir] + op->y; |
2321 | |
2312 | |
2322 | on_battleground = op_on_battleground (op, NULL, NULL); |
2313 | on_battleground = op_on_battleground (op, NULL, NULL); |
… | |
… | |
2952 | { |
2943 | { |
2953 | char buf[MAX_BUF]; |
2944 | char buf[MAX_BUF]; |
2954 | int x, y; |
2945 | int x, y; |
2955 | |
2946 | |
2956 | //int i; |
2947 | //int i; |
2957 | mapstruct *map; /* this is for resurrection */ |
2948 | maptile *map; /* this is for resurrection */ |
2958 | |
2949 | |
2959 | /* int z; |
2950 | /* int z; |
2960 | int num_stats_lose; |
2951 | int num_stats_lose; |
2961 | int lost_a_stat; |
2952 | int lost_a_stat; |
2962 | int lose_this_stat; |
2953 | int lose_this_stat; |
… | |
… | |
3596 | int |
3587 | int |
3597 | stand_near_hostile (object *who) |
3588 | stand_near_hostile (object *who) |
3598 | { |
3589 | { |
3599 | object *tmp = NULL; |
3590 | object *tmp = NULL; |
3600 | int i, friendly = 0, player = 0, mflags; |
3591 | int i, friendly = 0, player = 0, mflags; |
3601 | mapstruct *m; |
3592 | maptile *m; |
3602 | sint16 x, y; |
3593 | sint16 x, y; |
3603 | |
3594 | |
3604 | if (!who) |
3595 | if (!who) |
3605 | return 0; |
3596 | return 0; |
3606 | |
3597 | |