… | |
… | |
299 | set_first_map (object *op) |
299 | set_first_map (object *op) |
300 | { |
300 | { |
301 | strcpy (op->contr->maplevel, first_map_path); |
301 | strcpy (op->contr->maplevel, first_map_path); |
302 | op->x = -1; |
302 | op->x = -1; |
303 | op->y = -1; |
303 | op->y = -1; |
304 | enter_exit (op, NULL); |
304 | enter_exit (op, 0); |
305 | } |
305 | } |
306 | |
306 | |
307 | /* Tries to add player on the connection passwd in ns. |
307 | /* Tries to add player on the connection passwd in ns. |
308 | * All we can really get in this is some settings like host and display |
308 | * All we can really get in this is some settings like host and display |
309 | * mode. |
309 | * mode. |
… | |
… | |
327 | CLEAR_FLAG (p->ob, FLAG_FRIENDLY); |
327 | CLEAR_FLAG (p->ob, FLAG_FRIENDLY); |
328 | add_friendly_object (p->ob); |
328 | add_friendly_object (p->ob); |
329 | send_rules (p->ob); |
329 | send_rules (p->ob); |
330 | send_news (p->ob); |
330 | send_news (p->ob); |
331 | display_motd (p->ob); |
331 | display_motd (p->ob); |
|
|
332 | |
332 | get_name (p->ob); |
333 | get_name (p->ob); |
333 | |
334 | |
334 | return 0; |
335 | return 0; |
335 | } |
336 | } |
336 | |
337 | |
… | |
… | |
348 | { |
349 | { |
349 | if (at == NULL || at->next == NULL) |
350 | if (at == NULL || at->next == NULL) |
350 | at = first_archetype; |
351 | at = first_archetype; |
351 | else |
352 | else |
352 | at = at->next; |
353 | at = at->next; |
|
|
354 | |
353 | if (at->clone.type == PLAYER) |
355 | if (at->clone.type == PLAYER) |
354 | return at; |
356 | return at; |
|
|
357 | |
355 | if (at == start) |
358 | if (at == start) |
356 | { |
359 | { |
357 | LOG (llevError, "No Player archetypes\n"); |
360 | LOG (llevError, "No Player archetypes\n"); |
358 | exit (-1); |
361 | exit (-1); |
359 | } |
362 | } |
360 | } |
363 | } |
361 | } |
364 | } |
362 | |
|
|
363 | |
365 | |
364 | object * |
366 | object * |
365 | get_nearest_player (object *mon) |
367 | get_nearest_player (object *mon) |
366 | { |
368 | { |
367 | object *op = NULL; |
369 | object *op = NULL; |
… | |
… | |
724 | * to leave it to play_again to remove the object in all |
726 | * to leave it to play_again to remove the object in all |
725 | * cases. |
727 | * cases. |
726 | */ |
728 | */ |
727 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
729 | if (!QUERY_FLAG (op, FLAG_REMOVED)) |
728 | op->remove (); |
730 | op->remove (); |
|
|
731 | |
729 | /* Need to set this to null - otherwise, it could point to garbage, |
732 | /* Need to set this to null - otherwise, it could point to garbage, |
730 | * and draw() doesn't check to see if the player is removed, only if |
733 | * and draw() doesn't check to see if the player is removed, only if |
731 | * the map is null or not swapped out. |
734 | * the map is null or not swapped out. |
732 | */ |
735 | */ |
733 | op->map = NULL; |
736 | op->map = NULL; |
… | |
… | |
1091 | * if the map isn't there, then stay on the |
1094 | * if the map isn't there, then stay on the |
1092 | * default initial map */ |
1095 | * default initial map */ |
1093 | tmp->destroy (); |
1096 | tmp->destroy (); |
1094 | } |
1097 | } |
1095 | else |
1098 | else |
1096 | { |
|
|
1097 | LOG (llevDebug, "first_map_ext_path not set\n"); |
1099 | LOG (llevDebug, "first_map_ext_path not set\n"); |
1098 | } |
1100 | |
1099 | return 0; |
1101 | return 0; |
1100 | } |
1102 | } |
1101 | |
1103 | |
1102 | /* Following actually changes the race - this is the default command |
1104 | /* Following actually changes the race - this is the default command |
1103 | * if we don't match with one of the options above. |
1105 | * if we don't match with one of the options above. |
… | |
… | |
1223 | { |
1225 | { |
1224 | op->enemy = NULL; |
1226 | op->enemy = NULL; |
1225 | CLEAR_FLAG (op, FLAG_SCARED); |
1227 | CLEAR_FLAG (op, FLAG_SCARED); |
1226 | return; |
1228 | return; |
1227 | } |
1229 | } |
|
|
1230 | |
1228 | get_rangevector (op, op->enemy, &rv, 0); |
1231 | get_rangevector (op, op->enemy, &rv, 0); |
1229 | |
1232 | |
1230 | dir = absdir (4 + rv.direction); |
1233 | dir = absdir (4 + rv.direction); |
1231 | for (diff = 0; diff < 3; diff++) |
1234 | for (diff = 0; diff < 3; diff++) |
1232 | { |
1235 | { |
1233 | int m = 1 - (RANDOM () & 2); |
1236 | int m = 1 - (RANDOM () & 2); |
1234 | |
1237 | |
1235 | if (move_ob (op, absdir (dir + diff * m), op) || (diff == 0 && move_ob (op, absdir (dir - diff * m), op))) |
1238 | if (move_ob (op, absdir (dir + diff * m), op) || (diff == 0 && move_ob (op, absdir (dir - diff * m), op))) |
1236 | { |
|
|
1237 | return; |
1239 | return; |
1238 | } |
|
|
1239 | } |
1240 | } |
|
|
1241 | |
1240 | /* Cornered, get rid of scared */ |
1242 | /* Cornered, get rid of scared */ |
1241 | CLEAR_FLAG (op, FLAG_SCARED); |
1243 | CLEAR_FLAG (op, FLAG_SCARED); |
1242 | op->enemy = NULL; |
1244 | op->enemy = NULL; |
1243 | } |
1245 | } |
1244 | |
1246 | |
… | |
… | |
1800 | if (!dir) |
1802 | if (!dir) |
1801 | { |
1803 | { |
1802 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1804 | new_draw_info (NDI_UNIQUE, 0, op, "You can't shoot yourself!"); |
1803 | return 0; |
1805 | return 0; |
1804 | } |
1806 | } |
|
|
1807 | |
1805 | if (op->type == PLAYER) |
1808 | if (op->type == PLAYER) |
1806 | bow = op->contr->ranges[range_bow]; |
1809 | bow = op->contr->ranges[range_bow]; |
1807 | else |
1810 | else |
1808 | { |
1811 | { |
1809 | for (bow = op->inv; bow; bow = bow->below) |
1812 | for (bow = op->inv; bow; bow = bow->below) |
… | |
… | |
1817 | { |
1820 | { |
1818 | LOG (llevError, "Range: bow without activated bow (%s).\n", &op->name); |
1821 | LOG (llevError, "Range: bow without activated bow (%s).\n", &op->name); |
1819 | return 0; |
1822 | return 0; |
1820 | } |
1823 | } |
1821 | } |
1824 | } |
|
|
1825 | |
1822 | if (!bow->race || !bow->skill) |
1826 | if (!bow->race || !bow->skill) |
1823 | { |
1827 | { |
1824 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is broken.", &bow->name); |
1828 | new_draw_info_format (NDI_UNIQUE, 0, op, "Your %s is broken.", &bow->name); |
1825 | return 0; |
1829 | return 0; |
1826 | } |
1830 | } |
… | |
… | |
1828 | bowspeed = bow->stats.sp + dex_bonus[op->stats.Dex]; |
1832 | bowspeed = bow->stats.sp + dex_bonus[op->stats.Dex]; |
1829 | |
1833 | |
1830 | /* penalize ROF for bestarrow */ |
1834 | /* penalize ROF for bestarrow */ |
1831 | if (op->type == PLAYER && op->contr->bowtype == bow_bestarrow) |
1835 | if (op->type == PLAYER && op->contr->bowtype == bow_bestarrow) |
1832 | bowspeed -= dex_bonus[op->stats.Dex] + 5; |
1836 | bowspeed -= dex_bonus[op->stats.Dex] + 5; |
|
|
1837 | |
1833 | if (bowspeed < 1) |
1838 | if (bowspeed < 1) |
1834 | bowspeed = 1; |
1839 | bowspeed = 1; |
1835 | |
1840 | |
1836 | if (arrow == NULL) |
1841 | if (arrow == NULL) |
1837 | { |
1842 | { |
… | |
… | |
1843 | else |
1848 | else |
1844 | CLEAR_FLAG (op, FLAG_READY_BOW); |
1849 | CLEAR_FLAG (op, FLAG_READY_BOW); |
1845 | return 0; |
1850 | return 0; |
1846 | } |
1851 | } |
1847 | } |
1852 | } |
|
|
1853 | |
1848 | mflags = get_map_flags (op->map, &m, sx, sy, &sx, &sy); |
1854 | mflags = get_map_flags (op->map, &m, sx, sy, &sx, &sy); |
1849 | if (mflags & P_OUT_OF_MAP) |
1855 | if (mflags & P_OUT_OF_MAP) |
1850 | { |
|
|
1851 | return 0; |
1856 | return 0; |
1852 | } |
1857 | |
1853 | if (GET_MAP_MOVE_BLOCK (m, sx, sy) == MOVE_FLY_LOW) |
1858 | if (GET_MAP_MOVE_BLOCK (m, sx, sy) == MOVE_FLY_LOW) |
1854 | { |
1859 | { |
1855 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1860 | new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); |
1856 | return 0; |
1861 | return 0; |
1857 | } |
1862 | } |
… | |
… | |
1863 | return 0; |
1868 | return 0; |
1864 | } |
1869 | } |
1865 | |
1870 | |
1866 | left = arrow; /* these are arrows left to the player */ |
1871 | left = arrow; /* these are arrows left to the player */ |
1867 | arrow = get_split_ob (arrow, 1); |
1872 | arrow = get_split_ob (arrow, 1); |
1868 | if (arrow == NULL) |
1873 | if (!arrow) |
1869 | { |
1874 | { |
1870 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1875 | new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); |
1871 | return 0; |
1876 | return 0; |
1872 | } |
1877 | } |
|
|
1878 | |
1873 | arrow->set_owner (op); |
1879 | arrow->set_owner (op); |
1874 | arrow->skill = bow->skill; |
1880 | arrow->skill = bow->skill; |
1875 | |
1881 | |
1876 | arrow->direction = dir; |
1882 | arrow->direction = dir; |
1877 | arrow->x = sx; |
1883 | arrow->x = sx; |
… | |
… | |
1920 | } |
1926 | } |
1921 | |
1927 | |
1922 | if (arrow->attacktype == AT_PHYSICAL) |
1928 | if (arrow->attacktype == AT_PHYSICAL) |
1923 | arrow->attacktype |= bow->attacktype; |
1929 | arrow->attacktype |= bow->attacktype; |
1924 | |
1930 | |
1925 | if (bow->slaying != NULL) |
1931 | if (bow->slaying) |
1926 | arrow->slaying = bow->slaying; |
1932 | arrow->slaying = bow->slaying; |
1927 | |
1933 | |
1928 | arrow->map = m; |
1934 | arrow->map = m; |
1929 | arrow->move_type = MOVE_FLY_LOW; |
1935 | arrow->move_type = MOVE_FLY_LOW; |
1930 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
1936 | arrow->move_on = MOVE_FLY_LOW | MOVE_WALK; |
… | |
… | |
2046 | CLEAR_FLAG (item, FLAG_ANIMATE); |
2052 | CLEAR_FLAG (item, FLAG_ANIMATE); |
2047 | item->face = item->arch->clone.face; |
2053 | item->face = item->arch->clone.face; |
2048 | item->speed = 0; |
2054 | item->speed = 0; |
2049 | update_ob_speed (item); |
2055 | update_ob_speed (item); |
2050 | } |
2056 | } |
2051 | if ((tmp = is_player_inv (item))) |
2057 | if ((tmp = item->in_player ())) |
2052 | esrv_update_item (UPD_ANIM, tmp, item); |
2058 | esrv_update_item (UPD_ANIM, tmp, item); |
2053 | } |
2059 | } |
2054 | } |
2060 | } |
2055 | else if (item->type == ROD || item->type == HORN) |
2061 | else if (item->type == ROD || item->type == HORN) |
2056 | { |
2062 | { |
… | |
… | |
2206 | * 0 otherwise |
2212 | * 0 otherwise |
2207 | */ |
2213 | */ |
2208 | static int |
2214 | static int |
2209 | player_attack_door (object *op, object *door) |
2215 | player_attack_door (object *op, object *door) |
2210 | { |
2216 | { |
2211 | |
|
|
2212 | /* If its a door, try to find a use a key. If we do destroy the door, |
2217 | /* If its a door, try to find a use a key. If we do destroy the door, |
2213 | * might as well return immediately as there is nothing more to do - |
2218 | * might as well return immediately as there is nothing more to do - |
2214 | * otherwise, we fall through to the rest of the code. |
2219 | * otherwise, we fall through to the rest of the code. |
2215 | */ |
2220 | */ |
2216 | object *key = find_key (op, op, door); |
2221 | object *key = find_key (op, op, door); |
… | |
… | |
2254 | * It should keep the code cleaner. |
2259 | * It should keep the code cleaner. |
2255 | * When this is called, the players direction has been updated |
2260 | * When this is called, the players direction has been updated |
2256 | * (taking into account confusion.) The player is also actually |
2261 | * (taking into account confusion.) The player is also actually |
2257 | * going to try and move (not fire weapons). |
2262 | * going to try and move (not fire weapons). |
2258 | */ |
2263 | */ |
2259 | |
|
|
2260 | void |
2264 | void |
2261 | move_player_attack (object *op, int dir) |
2265 | move_player_attack (object *op, int dir) |
2262 | { |
2266 | { |
2263 | object *tmp, *mon; |
2267 | object *tmp, *mon; |
2264 | sint16 nx, ny; |
2268 | sint16 nx, ny; |
… | |
… | |
2266 | maptile *m; |
2270 | maptile *m; |
2267 | |
2271 | |
2268 | nx = freearr_x[dir] + op->x; |
2272 | nx = freearr_x[dir] + op->x; |
2269 | ny = freearr_y[dir] + op->y; |
2273 | ny = freearr_y[dir] + op->y; |
2270 | |
2274 | |
2271 | on_battleground = op_on_battleground (op, NULL, NULL); |
2275 | on_battleground = op_on_battleground (op, 0, 0); |
2272 | |
2276 | |
2273 | /* If braced, or can't move to the square, and it is not out of the |
2277 | /* If braced, or can't move to the square, and it is not out of the |
2274 | * map, attack it. Note order of if statement is important - don't |
2278 | * map, attack it. Note order of if statement is important - don't |
2275 | * want to be calling move_ob if braced, because move_ob will move the |
2279 | * want to be calling move_ob if braced, because move_ob will move the |
2276 | * player. This is a pretty nasty hack, because if we could |
2280 | * player. This is a pretty nasty hack, because if we could |
… | |
… | |
2288 | return; /* Don't think this should happen */ |
2292 | return; /* Don't think this should happen */ |
2289 | } |
2293 | } |
2290 | else |
2294 | else |
2291 | m = op->map; |
2295 | m = op->map; |
2292 | |
2296 | |
2293 | if ((tmp = get_map_ob (m, nx, ny)) == NULL) |
2297 | if ((tmp = GET_MAP_OB (m, nx, ny)) == NULL) |
2294 | { |
2298 | { |
2295 | /* LOG(llevError,"player_move_attack: get_map_ob returns NULL, but player can not more there.\n"); */ |
2299 | /* LOG(llevError,"player_move_attack: GET_MAP_OB returns NULL, but player can not move there.\n"); */ |
2296 | return; |
2300 | return; |
2297 | } |
2301 | } |
2298 | |
2302 | |
2299 | mon = NULL; |
2303 | mon = 0; |
2300 | /* Go through all the objects, and find ones of interest. Only stop if |
2304 | /* Go through all the objects, and find ones of interest. Only stop if |
2301 | * we find a monster - that is something we know we want to attack. |
2305 | * we find a monster - that is something we know we want to attack. |
2302 | * if its a door or barrel (can roll) see if there may be monsters |
2306 | * if its a door or barrel (can roll) see if there may be monsters |
2303 | * on the space |
2307 | * on the space |
2304 | */ |
2308 | */ |
2305 | while (tmp != NULL) |
2309 | while (tmp) |
2306 | { |
2310 | { |
2307 | if (tmp == op) |
2311 | if (tmp == op) |
2308 | { |
2312 | { |
2309 | tmp = tmp->above; |
2313 | tmp = tmp->above; |
2310 | continue; |
2314 | continue; |
… | |
… | |
2320 | mon = tmp; |
2324 | mon = tmp; |
2321 | |
2325 | |
2322 | tmp = tmp->above; |
2326 | tmp = tmp->above; |
2323 | } |
2327 | } |
2324 | |
2328 | |
2325 | if (mon == NULL) /* This happens anytime the player tries to move */ |
2329 | if (!mon) /* This happens anytime the player tries to move */ |
2326 | return; /* into a wall */ |
2330 | return; /* into a wall */ |
2327 | |
2331 | |
2328 | if (mon->head != NULL) |
2332 | if (mon->head) |
2329 | mon = mon->head; |
2333 | mon = mon->head; |
2330 | |
2334 | |
2331 | if ((mon->type == DOOR && mon->stats.hp >= 0) || (mon->type == LOCKED_DOOR)) |
2335 | if ((mon->type == DOOR && mon->stats.hp >= 0) || (mon->type == LOCKED_DOOR)) |
2332 | if (player_attack_door (op, mon)) |
2336 | if (player_attack_door (op, mon)) |
2333 | return; |
2337 | return; |
… | |
… | |
2370 | * attack them either. |
2374 | * attack them either. |
2371 | */ |
2375 | */ |
2372 | if ((mon->type == PLAYER || mon->enemy != op) && |
2376 | if ((mon->type == PLAYER || mon->enemy != op) && |
2373 | (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) && ( |
2377 | (mon->type == PLAYER || QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)) && ( |
2374 | #ifdef PROHIBIT_PLAYERKILL |
2378 | #ifdef PROHIBIT_PLAYERKILL |
2375 | (op->contr->peaceful |
2379 | (op->contr->peaceful |
2376 | || (mon->type == PLAYER |
2380 | || (mon->type == PLAYER |
2377 | && mon->contr-> |
2381 | && mon->contr-> |
2378 | peaceful)) && |
2382 | peaceful)) && |
2379 | #else |
2383 | #else |
2380 | op->contr->peaceful && |
2384 | op->contr->peaceful && |
2381 | #endif |
2385 | #endif |
2382 | !on_battleground)) |
2386 | !on_battleground)) |
2383 | { |
2387 | { |
2384 | if (!op->contr->braced) |
2388 | if (!op->contr->braced) |
2385 | { |
2389 | { |
2386 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2390 | play_sound_map (op->map, op->x, op->y, SOUND_PUSH_PLAYER); |
2387 | (void) push_ob (mon, dir, op); |
2391 | (void) push_ob (mon, dir, op); |
2388 | } |
2392 | } |
2389 | else |
2393 | else |
2390 | { |
|
|
2391 | new_draw_info (0, 0, op, "You withhold your attack"); |
2394 | new_draw_info (0, 0, op, "You withhold your attack"); |
2392 | } |
2395 | |
2393 | if (op->contr->tmp_invis || op->hide) |
2396 | if (op->contr->tmp_invis || op->hide) |
2394 | make_visible (op); |
2397 | make_visible (op); |
2395 | } |
2398 | } |
2396 | |
2399 | |
2397 | /* If the object is a boulder or other rollable object, then |
2400 | /* If the object is a boulder or other rollable object, then |
… | |
… | |
2425 | op->speed_left += op->speed / op->contr->weapon_sp; |
2428 | op->speed_left += op->speed / op->contr->weapon_sp; |
2426 | |
2429 | |
2427 | op->contr->has_hit = 1; /* The last action was to hit, so use weapon_sp */ |
2430 | op->contr->has_hit = 1; /* The last action was to hit, so use weapon_sp */ |
2428 | } |
2431 | } |
2429 | |
2432 | |
2430 | skill_attack (mon, op, 0, NULL, NULL); |
2433 | skill_attack (mon, op, 0, 0, 0); |
2431 | |
2434 | |
2432 | /* If attacking another player, that player gets automatic |
2435 | /* If attacking another player, that player gets automatic |
2433 | * hitback, and doesn't loose luck either. |
2436 | * hitback, and doesn't loose luck either. |
2434 | * Disable hitback on the battleground or if the target is |
2437 | * Disable hitback on the battleground or if the target is |
2435 | * the wiz. |
2438 | * the wiz. |
… | |
… | |
2437 | if (mon->type == PLAYER && mon->stats.hp >= 0 && !mon->contr->has_hit && !on_battleground && !QUERY_FLAG (mon, FLAG_WIZ)) |
2440 | if (mon->type == PLAYER && mon->stats.hp >= 0 && !mon->contr->has_hit && !on_battleground && !QUERY_FLAG (mon, FLAG_WIZ)) |
2438 | { |
2441 | { |
2439 | short luck = mon->stats.luck; |
2442 | short luck = mon->stats.luck; |
2440 | |
2443 | |
2441 | mon->contr->has_hit = 1; |
2444 | mon->contr->has_hit = 1; |
2442 | skill_attack (op, mon, 0, NULL, NULL); |
2445 | skill_attack (op, mon, 0, 0, 0); |
2443 | mon->stats.luck = luck; |
2446 | mon->stats.luck = luck; |
2444 | } |
2447 | } |
|
|
2448 | |
2445 | if (action_makes_visible (op)) |
2449 | if (action_makes_visible (op)) |
2446 | make_visible (op); |
2450 | make_visible (op); |
2447 | } |
2451 | } |
2448 | } /* if player should attack something */ |
2452 | } /* if player should attack something */ |
2449 | } |
2453 | } |
… | |
… | |
2484 | |
2488 | |
2485 | /* Add special check for newcs players and fire on - this way, the |
2489 | /* Add special check for newcs players and fire on - this way, the |
2486 | * server can handle repeat firing. |
2490 | * server can handle repeat firing. |
2487 | */ |
2491 | */ |
2488 | if (op->contr->fire_on || (op->contr->run_on && pick != 0)) |
2492 | if (op->contr->fire_on || (op->contr->run_on && pick != 0)) |
2489 | { |
|
|
2490 | op->direction = dir; |
2493 | op->direction = dir; |
2491 | } |
|
|
2492 | else |
2494 | else |
2493 | { |
|
|
2494 | op->direction = 0; |
2495 | op->direction = 0; |
2495 | } |
2496 | |
2496 | /* Update how the player looks. Use the facing, so direction may |
2497 | /* Update how the player looks. Use the facing, so direction may |
2497 | * get reset to zero. This allows for full animation capabilities |
2498 | * get reset to zero. This allows for full animation capabilities |
2498 | * for players. |
2499 | * for players. |
2499 | */ |
2500 | */ |
2500 | animate_object (op, op->facing); |
2501 | animate_object (op, op->facing); |
… | |
… | |
2552 | |
2553 | |
2553 | /* call this here - we also will call this in do_ericserver, but |
2554 | /* call this here - we also will call this in do_ericserver, but |
2554 | * the players time has been increased when doericserver has been |
2555 | * the players time has been increased when doericserver has been |
2555 | * called, so we recheck it here. |
2556 | * called, so we recheck it here. |
2556 | */ |
2557 | */ |
2557 | op->contr->socket->handle_command (); |
2558 | //TODO: better than handling 8 commands, use some more intelligent rate-limiting |
|
|
2559 | for (int rep = 8; --rep && op->contr->socket->handle_command (); ) |
|
|
2560 | ; |
|
|
2561 | |
2558 | if (op->speed_left < 0) |
2562 | if (op->speed_left < 0) |
2559 | return 0; |
2563 | return 0; |
2560 | |
2564 | |
2561 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2565 | if (op->direction && (op->contr->run_on || op->contr->fire_on)) |
2562 | { |
2566 | { |
… | |
… | |
3221 | * at his savebed location, and that can have long lasting |
3225 | * at his savebed location, and that can have long lasting |
3222 | * spell effects. So first see if there is a spell effect |
3226 | * spell effects. So first see if there is a spell effect |
3223 | * on the space that might harm the player. |
3227 | * on the space that might harm the player. |
3224 | */ |
3228 | */ |
3225 | will_kill_again = 0; |
3229 | will_kill_again = 0; |
3226 | for (tmp = get_map_ob (op->map, op->x, op->y); tmp; tmp = tmp->above) |
3230 | for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp; tmp = tmp->above) |
3227 | if (tmp->type == SPELL_EFFECT) |
3231 | if (tmp->type == SPELL_EFFECT) |
3228 | will_kill_again |= tmp->attacktype; |
3232 | will_kill_again |= tmp->attacktype; |
3229 | |
3233 | |
3230 | if (will_kill_again) |
3234 | if (will_kill_again) |
3231 | { |
3235 | { |
… | |
… | |
3328 | } |
3332 | } |
3329 | |
3333 | |
3330 | for (tmp = op->inv; tmp != NULL; tmp = next) |
3334 | for (tmp = op->inv; tmp != NULL; tmp = next) |
3331 | { |
3335 | { |
3332 | next = tmp->below; |
3336 | next = tmp->below; |
3333 | if (tmp->type == EXPERIENCE || tmp->invisible) |
3337 | if (tmp->invisible) |
3334 | continue; |
3338 | continue; |
3335 | tmp->remove (); |
3339 | tmp->remove (); |
3336 | tmp->x = op->x, tmp->y = op->y; |
3340 | tmp->x = op->x, tmp->y = op->y; |
3337 | if (tmp->type == CONTAINER) |
3341 | if (tmp->type == CONTAINER) |
3338 | { /* empty container to ground */ |
3342 | { /* empty container to ground */ |
… | |
… | |
3444 | object *tmp = NULL; |
3448 | object *tmp = NULL; |
3445 | |
3449 | |
3446 | if (QUERY_FLAG (&op->arch->clone, FLAG_UNDEAD)) |
3450 | if (QUERY_FLAG (&op->arch->clone, FLAG_UNDEAD)) |
3447 | return 1; |
3451 | return 1; |
3448 | |
3452 | |
3449 | if (op->type == PLAYER) |
|
|
3450 | for (tmp = op->inv; tmp; tmp = tmp->below) |
|
|
3451 | if (tmp->type == EXPERIENCE && tmp->stats.Wis) |
|
|
3452 | if (QUERY_FLAG (tmp, FLAG_UNDEAD)) |
|
|
3453 | return 1; |
|
|
3454 | return 0; |
3453 | return 0; |
3455 | } |
3454 | } |
3456 | |
3455 | |
3457 | /* look at the surrounding terrain to determine |
3456 | /* look at the surrounding terrain to determine |
3458 | * the hideability of this object. Positive levels |
3457 | * the hideability of this object. Positive levels |
… | |
… | |
3573 | if (mflags & P_OUT_OF_MAP) |
3572 | if (mflags & P_OUT_OF_MAP) |
3574 | continue; |
3573 | continue; |
3575 | if (OB_TYPE_MOVE_BLOCK (who, GET_MAP_MOVE_BLOCK (m, x, y))) |
3574 | if (OB_TYPE_MOVE_BLOCK (who, GET_MAP_MOVE_BLOCK (m, x, y))) |
3576 | continue; |
3575 | continue; |
3577 | |
3576 | |
3578 | for (tmp = get_map_ob (m, x, y); tmp; tmp = tmp->above) |
3577 | for (tmp = GET_MAP_OB (m, x, y); tmp; tmp = tmp->above) |
3579 | { |
3578 | { |
3580 | if ((player ||friendly) &&QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE)) |
3579 | if ((player ||friendly) &&QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_UNAGGRESSIVE)) |
3581 | return 1; |
3580 | return 1; |
3582 | else if (tmp->type == PLAYER) |
3581 | else if (tmp->type == PLAYER) |
3583 | { |
3582 | { |