from monster's point of view, is hero behind a chokepoint? */
| 1341 | |
| 1342 | /* from monster's point of view, is hero behind a chokepoint? */ |
| 1343 | staticfn boolean |
| 1344 | hero_behind_chokepoint(struct monst *mtmp) |
| 1345 | { |
| 1346 | coordxy dx = sgn(mtmp->mx - mtmp->mux); |
| 1347 | coordxy dy = sgn(mtmp->my - mtmp->muy); |
| 1348 | |
| 1349 | coordxy x = mtmp->mux + dx; |
| 1350 | coordxy y = mtmp->muy + dy; |
| 1351 | |
| 1352 | int dir = xytodir(dx, dy); |
| 1353 | int dir_l = DIR_CLAMP(DIR_LEFT2(dir)); |
| 1354 | int dir_r = DIR_CLAMP(DIR_RIGHT2(dir)); |
| 1355 | |
| 1356 | coord c1, c2; |
| 1357 | |
| 1358 | dirtocoord(&c1, dir_l); |
| 1359 | dirtocoord(&c2, dir_r); |
| 1360 | c1.x += x, c2.x += x; |
| 1361 | c1.y += y, c2.y += y; |
| 1362 | |
| 1363 | if ((!isok(c1.x, c1.y) || !accessible(c1.x, c1.y)) |
| 1364 | && (!isok(c2.x, c2.y) || !accessible(c2.x, c2.y))) |
| 1365 | return TRUE; |
| 1366 | return FALSE; |
| 1367 | } |
| 1368 | |
| 1369 | /* hostile monster has another hostile next to it */ |
| 1370 | staticfn boolean |
no test coverage detected