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

Function cvt_to_abscoord

src/sp_lev.c:4771–4788  ·  view source on GitHub ↗

guts of nhl_abs_coord; convert a coordinate relative to a map or room * into an absolute coordinate in svl.level.locations. * * If there is no enclosing map or room, the coordinates are assumed to be * absolute already. * * Part of the reason this is a function is to make it clearer in the calling * code that this conversion is what is intended. * * NOTE: if the coordinates are going to g

Source from the content-addressed store, hash-verified

4769 * doesn't is the input coordinates being negative. get_location will treat
4770 * that as "level designer wants a random coordinate".) */
4771void
4772cvt_to_abscoord(coordxy *x, coordxy *y)
4773{
4774 /* since commit 99715e0, xstart and ystart are only relevant in mklev when
4775 * maps are being used, and 0 otherwise. It is possible in the future that
4776 * map positions and dimensions can be saved and retrieved outside of
4777 * mklev which would reintroduce nonzero xstart/ystart/xsiz/ysiz, but
4778 * this is not currently implemented, so this function can be assumed to
4779 * have no effect outside of mklev.
4780 */
4781 if (gc.coder && gc.coder->croom) {
4782 *x += gc.coder->croom->lx;
4783 *y += gc.coder->croom->ly;
4784 } else {
4785 *x += gx.xstart;
4786 *y += gy.ystart;
4787 }
4788}
4789
4790/* inverse of cvt_to_abscoord; turn an absolute svl.level.locations coordinate
4791 * into one relative to the current map or room. */

Callers 12

l_obj_atFunction · 0.85
l_obj_placeobjFunction · 0.85
l_obj_buryFunction · 0.85
nhl_gettrapFunction · 0.85
nhl_deltrapFunction · 0.85
nhl_getmapFunction · 0.85
nhl_timer_has_atFunction · 0.85
nhl_timer_peek_atFunction · 0.85
nhl_timer_stop_atFunction · 0.85
nhl_timer_start_atFunction · 0.85
l_selection_gradientFunction · 0.85
nhl_abs_coordFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected