MiniDoom

src/am_map.ml

Implements automap input, state, and drawing logic.

Package
(global)
Reachable
Yes

Imports

Declarations

_AM_Abs

inline function _AM_Abs(v)

Returns the magnitude of an integer without altering its fixed-point scale.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.

View source

_AM_CacheOrVoid

inline function _AM_CacheOrVoid(name, tag)

Resolves an optional automap patch lump and returns its tagged cache entry, or void when the name is absent.

ParameterTypeDefaultDescription
namedynamic—Resource or object name to resolve.
tagdynamic—Zone-memory or resource-lifetime tag.

View source

_AM_CaseKey

inline function _AM_CaseKey(k)

Normalizes an input key to lowercase ASCII for case-insensitive automap bindings.

ParameterTypeDefaultDescription
kdynamic—K value supplied to `_AM_CaseKey`.

View source

_AM_Clamp

inline function _AM_Clamp(v, lo, hi)

Restricts a zoom or coordinate value to the caller's inclusive lower and upper bounds.

ParameterTypeDefaultDescription
vdynamic—Value consumed by the operation.
lodynamic—Inclusive lower bound.
hidynamic—Inclusive upper bound.

View source

_AM_CXMTOF

inline function _AM_CXMTOF(x)

Projects a map-space x coordinate into the automap window relative to its current origin.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.

View source

_AM_CYMTOF

inline function _AM_CYMTOF(y)

Projects a map-space y coordinate into the vertically inverted automap framebuffer.

ParameterTypeDefaultDescription
ydynamic—Vertical map- or screen-space coordinate.

View source

_AM_FLine

inline function _AM_FLine(x1, y1, x2, y2)

Constructs a framebuffer-space line used by the clipping and rasterization stages.

ParameterTypeDefaultDescription
x1dynamic—Horizontal coordinate of the first endpoint.
y1dynamic—Vertical coordinate of the first endpoint.
x2dynamic—Horizontal coordinate of the second endpoint.
y2dynamic—Vertical coordinate of the second endpoint.

View source

_AM_FPoint

inline function _AM_FPoint(x, y)

Constructs a point in automap framebuffer pixel coordinates.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.

View source

_AM_FTOM

inline function _AM_FTOM(x)

Converts a framebuffer pixel distance to map-space fixed-point units using the current zoom scale.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.

View source

_AM_IDiv

inline function _AM_IDiv(a, b)

Returns a signed quotient truncated toward zero, or zero for invalid operands and a zero divisor in `_AM_IDiv`

ParameterTypeDefaultDescription
adynamic—First input operand.
bdynamic—Second input operand.

View source

_AM_MLine

inline function _AM_MLine(x1, y1, x2, y2)

Constructs a map-space line from two fixed-point endpoints.

ParameterTypeDefaultDescription
x1dynamic—Horizontal coordinate of the first endpoint.
y1dynamic—Vertical coordinate of the first endpoint.
x2dynamic—Horizontal coordinate of the second endpoint.
y2dynamic—Vertical coordinate of the second endpoint.

View source

_AM_Mod

inline function _AM_Mod(n, d)

Computes a non-negative remainder for grid alignment, returning zero for a zero divisor.

ParameterTypeDefaultDescription
ndynamic—Number of values to process.
ddynamic—Divisor or direction value used by the operation.

View source

_AM_MPoint

inline function _AM_MPoint(x, y)

Constructs a point in map-space fixed-point coordinates.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.

View source

_AM_MTOF

inline function _AM_MTOF(x)

Converts a map-space fixed-point distance to framebuffer pixels using the current zoom scale.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.

View source

_AM_PutPixel

inline function _AM_PutPixel(x, y, color)

Writes one clipped color index into the logical automap framebuffer.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
colordynamic—Doom palette index used for drawing.

View source

_AM_ToLowerAscii

inline function _AM_ToLowerAscii(c)

Folds one uppercase ASCII byte to lowercase while leaving all other bytes unchanged.

ParameterTypeDefaultDescription
cdynamic—C value supplied to `_AM_ToLowerAscii`.

View source

AM_activateNewScale

function AM_activateNewScale()

Recomputes the map-space viewport for the current zoom while preserving its center point.

View source

AM_addMark

function AM_addMark()

Adds mark entries to the automap.

View source

AM_changeWindowLoc

function AM_changeWindowLoc()

Applies manual pan increments when follow mode is off and clamps the viewport to level bounds.

View source

AM_changeWindowScale

function AM_changeWindowScale()

Applies the pending zoom multiplier, clamps it to level limits, derives its inverse, and recenters the viewport.

View source

AM_clearFB

function AM_clearFB()

Fills the clipped automap viewport in the logical framebuffer with its background palette index.

View source

AM_CLEARMARKKEY

const AM_CLEARMARKKEY = 99

Defines the input key code for am clearmarkkey.

View source

AM_clearMarks

function AM_clearMarks()

Replaces every mark slot with the unused sentinel and restarts insertion at slot zero.

View source

AM_clipMline

function AM_clipMline(ml, fl)

Computes mline values for the automap.

ParameterTypeDefaultDescription
mldynamic—Ml value supplied to `AM_clipMline`.
fldynamic—Fl value supplied to `AM_clipMline`.

View source

AM_doFollowPlayer

function AM_doFollowPlayer()

Recenters the map only when the tracked player position changes and remembers that position for the next frame.

View source

AM_drawCrosshair

function AM_drawCrosshair(color)

Draws the single-pixel cursor at the center of the automap window.

ParameterTypeDefaultDescription
colordynamic—Doom palette index used for drawing.

View source

AM_Drawer

function AM_Drawer()

Renders one complete automap frame in layer order, including geometry, actors, marks, and cursor.

View source

AM_drawFline

function AM_drawFline(fl, color)

Clips and rasterizes a framebuffer-space line with integer stepping.

ParameterTypeDefaultDescription
fldynamic—Fl value supplied to `AM_drawFline`.
colordynamic—Doom palette index used for drawing.

View source

AM_drawGrid

function AM_drawGrid(color)

Draws map-aligned grid lines across the visible automap extent when the grid option is enabled.

ParameterTypeDefaultDescription
colordynamic—Doom palette index used for drawing.

View source

AM_drawLineCharacter

function AM_drawLineCharacter(lineset, count, scale, angle, color, x, y)

Transforms and draws a vector glyph at a map position, applying scale and rotation to each source segment.

ParameterTypeDefaultDescription
linesetdynamic—Lineset value supplied to `AM_drawLineCharacter`.
countdynamic—Number of elements or iterations to process.
scaledynamic—Scale value supplied to `AM_drawLineCharacter`.
angledynamic—Doom binary-angle measurement.
colordynamic—Doom palette index used for drawing.
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.

View source

AM_drawMarks

function AM_drawMarks()

Projects user mark positions and labels them with numbered patch glyphs.

View source

AM_drawMline

function AM_drawMline(ml, color)

Projects a map-space line into the automap window and rasterizes the visible segment.

ParameterTypeDefaultDescription
mldynamic—Ml value supplied to `AM_drawMline`.
colordynamic—Doom palette index used for drawing.

View source

AM_drawPlayers

function AM_drawPlayers()

Draws the local or network player arrow glyphs at their interpolated positions and facing angles.

View source

AM_drawThings

function AM_drawThings(color, radius)

Draws cheat-visible map objects as scaled vector triangles around their world positions.

ParameterTypeDefaultDescription
colordynamic—Doom palette index used for drawing.
radiusdynamic—Radius value supplied to `AM_drawThings`.

View source

AM_drawWalls

function AM_drawWalls()

Classifies discovered map lines by geometry and special type, then draws them with the corresponding automap colors.

View source

AM_ENDKEY

const AM_ENDKEY = KEY_TAB

Defines the input key code for am endkey.

View source

AM_findMinMaxBoundaries

function AM_findMinMaxBoundaries()

Computes minimum maximum boundaries values for the automap.

View source

AM_FOLLOWKEY

const AM_FOLLOWKEY = 102

Defines the input key code for am followkey.

View source

AM_FRACUNIT

const AM_FRACUNIT = 65536

Defines am fracunit for the am map subsystem.

View source

AM_getIslope

function AM_getIslope(ml, sl)

Computes both dy/dx and dx/dy for a map line, using signed sentinels for vertical and horizontal cases.

ParameterTypeDefaultDescription
mldynamic—Ml value supplied to `AM_getIslope`.
sldynamic—Sl value supplied to `AM_getIslope`.

View source

AM_GOBIGKEY

const AM_GOBIGKEY = 48

Defines the input key code for am gobigkey.

View source

AM_GRIDKEY

const AM_GRIDKEY = 103

Defines the input key code for am gridkey.

View source

AM_initVariables

function AM_initVariables()

Activates the automap, resets frame-local counters and pan state, selects the console player, and centers the viewport.

View source

AM_LevelInit

function AM_LevelInit()

Resets the framebuffer viewport and initial zoom, derives level map bounds, and clears the level-start flag.

View source

AM_loadPics

function AM_loadPics()

Resolves and pins the ten AMMNUM digit patches used to label player map marks.

View source

AM_MARKKEY

const AM_MARKKEY = 109

Defines the input key code for am markkey.

View source

AM_MAXINT

const AM_MAXINT = 2147483647

Defines the maximum am maxint accepted by the am map subsystem.

View source

AM_maxOutWindowScale

function AM_maxOutWindowScale()

Clamps zoom-in to the configured maximum map-to-frame scale.

View source

AM_minOutWindowScale

function AM_minOutWindowScale()

Clamps zoom-out at the scale where the complete level bounding box fits in the automap window.

View source

AM_MSGENTERED

const AM_MSGENTERED = AM_MSGHEADER | 101 << 8

Defines am msgentered for the am map subsystem.

View source

AM_MSGEXITED

const AM_MSGEXITED = AM_MSGHEADER | 120 << 8

Defines am msgexited for the am map subsystem.

View source

AM_MSGHEADER

const AM_MSGHEADER = 97 << 24 + 109 << 16

Defines am msgheader for the am map subsystem.

View source

AM_NUMMARKPOINTS

const AM_NUMMARKPOINTS = 10

Defines the am nummarkpoints count used by the am map subsystem.

View source

AM_PANDOWNKEY

const AM_PANDOWNKEY = KEY_DOWNARROW

Defines the input key code for am pandownkey.

View source

AM_PANLEFTKEY

const AM_PANLEFTKEY = KEY_LEFTARROW

Defines the input key code for am panleftkey.

View source

AM_PANRIGHTKEY

const AM_PANRIGHTKEY = KEY_RIGHTARROW

Defines the input key code for am panrightkey.

View source

AM_PANUPKEY

const AM_PANUPKEY = KEY_UPARROW

Defines the input key code for am panupkey.

View source

AM_Responder

function AM_Responder(ev)

Consumes automap key events, toggling modes and updating pan, zoom, follow, grid, and mark state.

ParameterTypeDefaultDescription
evdynamic—Input event to process.

View source

AM_restoreScaleAndLoc

function AM_restoreScaleAndLoc()

Restores the saved viewport, repairs invalid dimensions from the active zoom, and refreshes its far edges.

View source

AM_rotate

function AM_rotate(x, y, a)

Rotates a map-space vector by a Doom binary angle using the fine sine/cosine tables.

ParameterTypeDefaultDescription
xdynamic—Horizontal map- or screen-space coordinate.
ydynamic—Vertical map- or screen-space coordinate.
adynamic—First input operand.

View source

AM_saveScaleAndLoc

function AM_saveScaleAndLoc()

Snapshots the current map viewport so big-map mode can later restore the prior zoom and location.

View source

AM_Start

function AM_Start()

Activates the automap once, prepares level/view state and mark graphics, then notifies the status bar.

View source

AM_STARTKEY

const AM_STARTKEY = KEY_TAB

Defines the input key code for am startkey.

View source

AM_Stop

function AM_Stop()

Releases mark graphics, restores normal view rendering, and notifies the status bar that the automap closed.

View source

AM_Ticker

function AM_Ticker()

Applies held pan and zoom increments once per game tic while the automap is active.

View source

AM_unloadPics

function AM_unloadPics()

Drops automap mark-patch references when leaving the map display.

View source

AM_updateLightLev

function AM_updateLightLev()

Increments the automap pulse counter used to vary wall brightness over successive frames.

View source

AM_ZOOMINKEY

const AM_ZOOMINKEY = 61

Defines the input key code for am zoominkey.

View source

AM_ZOOMOUTKEY

const AM_ZOOMOUTKEY = 45

Defines the input key code for am zoomoutkey.

View source

amclock

amclock

Tracks the mutable amclock value used by the am map subsystem.

View source

automapactive

automapactive

Tracks whether automapactive is active in the am map subsystem.

View source

BACKGROUND

const BACKGROUND = BLACK

Defines background for the am map subsystem.

View source

BLACK

const BLACK = 0

Defines the Doom palette selection for black.

View source

BROWNRANGE

const BROWNRANGE = 16

Defines brownrange for the am map subsystem.

View source

BROWNS

const BROWNS = 4 * 16

Defines the Doom palette selection for browns.

View source

CDWALLCOLORS

const CDWALLCOLORS = YELLOWS

Defines the Doom palette selection for cdwallcolors.

View source

cheat_amap

cheat_amap

Tracks the mutable cheat amap value used by the am map subsystem.

View source

cheat_amap_seq

cheat_amap_seq

Tracks the mutable cheat amap seq value used by the am map subsystem.

View source

cheating

cheating

Tracks the mutable cheating value used by the am map subsystem.

View source

f_h

f_h

Tracks the mutable f h value used by the am map subsystem.

View source

f_oldloc

f_oldloc

Tracks the mutable f oldloc value used by the am map subsystem.

View source

F_PANINC

const F_PANINC = 4

Defines f paninc for the am map subsystem.

View source

f_w

f_w

Tracks the mutable f w value used by the am map subsystem.

View source

f_x

f_x

Tracks the mutable f x value used by the am map subsystem.

View source

f_y

f_y

Tracks the mutable f y value used by the am map subsystem.

View source

FB

const FB = 0

Defines fb for the am map subsystem.

View source

fb

fb

Holds the optional fb resource used by the am map subsystem.

View source

FDWALLCOLORS

const FDWALLCOLORS = BROWNS

Defines the Doom palette selection for fdwallcolors.

View source

finit_height

finit_height

Tracks the mutable finit height value used by the am map subsystem.

View source

finit_width

finit_width

Tracks the mutable finit width value used by the am map subsystem.

View source

fline_t struct

followplayer

followplayer

Tracks the mutable followplayer value used by the am map subsystem.

View source

fpoint_t struct

ftom_zoommul

ftom_zoommul

Tracks the mutable ftom zoommul value used by the am map subsystem.

View source

GRAYS

const GRAYS = 6 * 16

Defines the Doom palette selection for grays.

View source

GRAYSRANGE

const GRAYSRANGE = 16

Defines graysrange for the am map subsystem.

View source

GREENRANGE

const GREENRANGE = 16

Defines greenrange for the am map subsystem.

View source

GREENS

const GREENS = 7 * 16

Defines the Doom palette selection for greens.

View source

grid

grid

Tracks the mutable grid value used by the am map subsystem.

View source

GRIDCOLORS

const GRIDCOLORS = GRAYS + GRAYSRANGE >> 1

Defines the Doom palette selection for gridcolors.

View source

INITSCALEMTOF

const INITSCALEMTOF = 13107

Defines initscalemtof for the am map subsystem.

View source

islope_t struct

leveljuststarted

leveljuststarted

Tracks the mutable leveljuststarted value used by the am map subsystem.

View source

lightlev

lightlev

Tracks the mutable lightlev value used by the am map subsystem.

View source

m_h

m_h

Tracks the mutable m h value used by the am map subsystem.

View source

m_paninc

m_paninc

Tracks the mutable m paninc value used by the am map subsystem.

View source

m_w

m_w

Tracks the mutable m w value used by the am map subsystem.

View source

m_x

m_x

Tracks the mutable m x value used by the am map subsystem.

View source

m_x2

m_x2

Tracks the mutable m x2 value used by the am map subsystem.

View source

m_y

m_y

Tracks the mutable m y value used by the am map subsystem.

View source

m_y2

m_y2

Tracks the mutable m y2 value used by the am map subsystem.

View source

M_ZOOMIN

const M_ZOOMIN = 66846

Defines m zoomin for the am map subsystem.

View source

M_ZOOMOUT

const M_ZOOMOUT = 64250

Defines m zoomout for the am map subsystem.

View source

marknums

marknums

Stores the marknums collection used by the am map subsystem.

View source

markpointnum

markpointnum

Tracks the mutable markpointnum value used by the am map subsystem.

View source

markpoints

markpoints

Stores the markpoints collection used by the am map subsystem.

View source

max_h

max_h

Tracks the mutable max h value used by the am map subsystem.

View source

max_scale_mtof

max_scale_mtof

Tracks the mutable max scale mtof value used by the am map subsystem.

View source

max_w

max_w

Tracks the mutable max w value used by the am map subsystem.

View source

max_x

max_x

Tracks the mutable max x value used by the am map subsystem.

View source

max_y

max_y

Tracks the mutable max y value used by the am map subsystem.

View source

min_h

min_h

Tracks the mutable min h value used by the am map subsystem.

View source

min_scale_mtof

min_scale_mtof

Tracks the mutable min scale mtof value used by the am map subsystem.

View source

min_w

min_w

Tracks the mutable min w value used by the am map subsystem.

View source

min_x

min_x

Tracks the mutable min x value used by the am map subsystem.

View source

min_y

min_y

Tracks the mutable min y value used by the am map subsystem.

View source

mline_t struct

mpoint_t struct

mtof_zoommul

mtof_zoommul

Tracks the mutable mtof zoommul value used by the am map subsystem.

View source

old_m_h

old_m_h

Tracks the mutable old m h value used by the am map subsystem.

View source

old_m_w

old_m_w

Tracks the mutable old m w value used by the am map subsystem.

View source

old_m_x

old_m_x

Tracks the mutable old m x value used by the am map subsystem.

View source

old_m_y

old_m_y

Tracks the mutable old m y value used by the am map subsystem.

View source

plr

plr

Holds the optional plr resource used by the am map subsystem.

View source

REDRANGE

const REDRANGE = 16

Defines redrange for the am map subsystem.

View source

REDS

const REDS = 256 - 5 * 16

Defines the Doom palette selection for reds.

View source

scale_ftom

scale_ftom

Tracks the mutable scale ftom value used by the am map subsystem.

View source

scale_mtof

scale_mtof

Tracks the mutable scale mtof value used by the am map subsystem.

View source

stopped

stopped

Tracks whether stopped is active in the am map subsystem.

View source

THINGCOLORS

const THINGCOLORS = GREENS

Defines the Doom palette selection for thingcolors.

View source

TSWALLCOLORS

const TSWALLCOLORS = GRAYS

Defines the Doom palette selection for tswallcolors.

View source

WALLCOLORS

const WALLCOLORS = REDS

Defines the Doom palette selection for wallcolors.

View source

WHITE

const WHITE = 256 - 47

Defines the Doom palette selection for white.

View source

XHAIRCOLORS

const XHAIRCOLORS = GRAYS

Defines the Doom palette selection for xhaircolors.

View source

YELLOWRANGE

const YELLOWRANGE = 1

Defines yellowrange for the am map subsystem.

View source

YELLOWS

const YELLOWS = 256 - 32 + 7

Defines the Doom palette selection for yellows.

View source

YOURCOLORS

const YOURCOLORS = WHITE

Defines the Doom palette selection for yourcolors.

View source