… | |
… | |
1316 | draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); |
1316 | draw_ext_info (NDI_UNIQUE | NDI_NAVY, 0, op, msgType->message_type, msgType->message_subtype, somemsg, &sign->msg); |
1317 | } |
1317 | } |
1318 | } |
1318 | } |
1319 | } |
1319 | } |
1320 | |
1320 | |
|
|
1321 | static void |
|
|
1322 | move_apply_hole (object *trap, object *victim) |
|
|
1323 | { |
|
|
1324 | /* Hole not open? */ |
|
|
1325 | if (trap->stats.wc > 0) |
|
|
1326 | return; |
|
|
1327 | |
|
|
1328 | /* Is this a multipart monster and not the head? If so, return. |
|
|
1329 | * Processing will happen if the head runs into the pit |
|
|
1330 | */ |
|
|
1331 | if (victim->head) |
|
|
1332 | return; |
|
|
1333 | |
|
|
1334 | fprintf (stderr, "range %d\n", trap->range);//D |
|
|
1335 | // now find all possible locations and randomly pick one |
|
|
1336 | int dir = find_free_spot (victim, trap->map, EXIT_X (trap), EXIT_Y (trap), 0, |
|
|
1337 | trap->range >= 3 ? SIZEOFFREE3 |
|
|
1338 | : trap->range >= 2 ? SIZEOFFREE2 |
|
|
1339 | : trap->range >= 1 ? SIZEOFFREE1 |
|
|
1340 | : 0); |
|
|
1341 | |
|
|
1342 | if (dir < 0) |
|
|
1343 | return; |
|
|
1344 | |
|
|
1345 | victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole")); |
|
|
1346 | victim->statusmsg ("You fall through the hole!", NDI_RED); |
|
|
1347 | |
|
|
1348 | transfer_ob (victim, |
|
|
1349 | EXIT_X (trap) + freearr_x[dir], |
|
|
1350 | EXIT_Y (trap) + freearr_y[dir], |
|
|
1351 | 0, victim); |
|
|
1352 | } |
|
|
1353 | |
1321 | /** |
1354 | /** |
1322 | * 'victim' moves onto 'trap' |
1355 | * 'victim' moves onto 'trap' |
1323 | * 'victim' leaves 'trap' |
1356 | * 'victim' leaves 'trap' |
1324 | * effect is determined by move_on/move_off of trap and move_type of victime. |
1357 | * effect is determined by move_on/move_off of trap and move_type of victime. |
1325 | * |
1358 | * |
… | |
… | |
1492 | case CHECK_INV: |
1525 | case CHECK_INV: |
1493 | check_inv (victim, trap); |
1526 | check_inv (victim, trap); |
1494 | goto leave; |
1527 | goto leave; |
1495 | |
1528 | |
1496 | case HOLE: |
1529 | case HOLE: |
1497 | /* Hole not open? */ |
1530 | move_apply_hole (trap, victim); |
1498 | if (trap->stats.wc > 0) |
|
|
1499 | goto leave; |
|
|
1500 | |
|
|
1501 | /* Is this a multipart monster and not the head? If so, return. |
|
|
1502 | * Processing will happen if the head runs into the pit |
|
|
1503 | */ |
|
|
1504 | if (victim->head) |
|
|
1505 | goto leave; |
|
|
1506 | |
|
|
1507 | victim->play_sound (trap->sound ? trap->sound : sound_find ("fall_hole")); |
|
|
1508 | victim->statusmsg ("You fall through the hole!", NDI_RED); |
|
|
1509 | transfer_ob (victim, EXIT_X (trap), EXIT_Y (trap), 1, victim); |
|
|
1510 | goto leave; |
1531 | goto leave; |
1511 | |
1532 | |
1512 | case EXIT: |
1533 | case EXIT: |
1513 | if (victim->type == PLAYER && EXIT_PATH (trap)) |
1534 | if (victim->type == PLAYER && EXIT_PATH (trap)) |
1514 | { |
1535 | { |