* zapdir_to_glyph() * * Change the given zap direction and beam type into a glyph. Each beam * type has four glyphs, one for each of the symbols below. The order of * the zap symbols [0-3] as defined in defsym.h are: * * | S_vbeam ( 0, 1) or ( 0,-1) * - S_hbeam ( 1, 0) or (-1, 0) * \ S_lslant ( 1, 1) or (-1,-1) * / S_rslant (-1, 1) or ( 1,-1) *
| 2458 | * / S_rslant (-1, 1) or ( 1,-1) |
| 2459 | */ |
| 2460 | int |
| 2461 | zapdir_to_glyph(int dx, int dy, int beam_type) |
| 2462 | { |
| 2463 | if (beam_type >= NUM_ZAP) { |
| 2464 | impossible("zapdir_to_glyph: illegal beam type"); |
| 2465 | beam_type = 0; |
| 2466 | } |
| 2467 | dx = (dx == dy) ? 2 : (dx && dy) ? 3 : dx ? 1 : 0; |
| 2468 | |
| 2469 | return ((int) ((beam_type << 2) | dx)) + GLYPH_ZAP_OFF; |
| 2470 | } |
| 2471 | |
| 2472 | /* |
| 2473 | * Utility routine for dowhatis() used to find out the glyph displayed at |
no test coverage detected