MCPcopy Create free account
hub / github.com/NetHack/NetHack / zapdir_to_glyph

Function zapdir_to_glyph

src/display.c:2460–2470  ·  view source on GitHub ↗

* 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) *

Source from the content-addressed store, hash-verified

2458 * / S_rslant (-1, 1) or ( 1,-1)
2459 */
2460int
2461zapdir_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

Callers 4

tether_glyphFunction · 0.85
dobuzzFunction · 0.85
cast_chain_lightningFunction · 0.85

Calls 1

impossibleFunction · 0.70

Tested by

no test coverage detected