Files
src/m_misc.ml
Handles configuration defaults, screenshots, file buffers, and Doom patch-backed utility output.
- Package
(global)- Reachable
- Yes
Imports
Declarations
# _M_ApplyDefaultKV
function _M_ApplyDefaultKV(key, val)
Parses one configuration key/value pair and assigns the converted value to the matching registered default.
| Parameter | Type | Default | Description |
|---|
key | dynamic | — | Input key code to process. |
val | dynamic | — | Val value supplied to `_M_ApplyDefaultKV`. |
View source
# _M_GetDefaultFilePath
function _M_GetDefaultFilePath()
Chooses the configuration path from -config, the -cdrom legacy location, an existing base override, or default.cfg.
View source
# _M_IsSpaceByte
inline function _M_IsSpaceByte(c)
Recognizes the space and horizontal-tab delimiters accepted in configuration lines.
| Parameter | Type | Default | Description |
|---|
c | dynamic | — | C value supplied to `_M_IsSpaceByte`. |
View source
# _M_MakeShotName
inline function _M_MakeShotName(i)
Formats a two-digit screenshot slot as the classic DOOMnn.pcx filename.
| Parameter | Type | Default | Description |
|---|
i | dynamic | — | Zero-based iteration index. |
View source
# _M_ParentDirExists
function _M_ParentDirExists(path)
Determines whether a target path can be written by verifying that its parent directory exists.
| Parameter | Type | Default | Description |
|---|
path | dynamic | — | Filesystem path to process. |
View source
# _M_ParseDefaultLine
function _M_ParseDefaultLine(line)
Parses parse Default Line input into utility runtime data.
| Parameter | Type | Default | Description |
|---|
line | dynamic | — | Map line or text line affected by the operation. |
View source
# _M_ParseInt
function _M_ParseInt(s0)
Parses parse Int input into utility runtime data.
| Parameter | Type | Default | Description |
|---|
s0 | dynamic | — | S0 value supplied to `_M_ParseInt`. |
View source
# _M_ParseText
inline function _M_ParseText(s0)
Parses optional quoted text value from config lines.
| Parameter | Type | Default | Description |
|---|
s0 | dynamic | — | S0 value supplied to `_M_ParseText`. |
View source
# _M_patchWidth
inline function _M_patchWidth(patch)
Reads a Doom patch's little-endian width field, returning zero for malformed data.
| Parameter | Type | Default | Description |
|---|
patch | dynamic | — | Patch value supplied to `_M_patchWidth`. |
View source
# _M_QuoteText
function _M_QuoteText(s0)
Wraps text in quotes for config persistence.
| Parameter | Type | Default | Description |
|---|
s0 | dynamic | — | S0 value supplied to `_M_QuoteText`. |
View source
# _M_Trim
function _M_Trim(s0)
Removes leading and trailing configuration whitespace without altering embedded spaces.
| Parameter | Type | Default | Description |
|---|
s0 | dynamic | — | S0 value supplied to `_M_Trim`. |
View source
# _M_u16le
inline function _M_u16le(b, off)
Decodes one unsigned little-endian 16-bit value from a byte buffer with bounds checks.
| Parameter | Type | Default | Description |
|---|
b | dynamic | — | Second input operand. |
off | dynamic | — | Zero-based byte or element offset. |
View source
# _M_UpperAscii
inline function _M_UpperAscii(c)
Folds one lowercase ASCII byte to uppercase while leaving all other bytes unchanged.
| Parameter | Type | Default | Description |
|---|
c | dynamic | — | C value supplied to `_M_UpperAscii`. |
View source
# _M_WritePCXfile
function _M_WritePCXfile(filename, data, width, height, palette)
Validates indexed pixels and palette, RLE-encodes a complete 8-bit PCX image, and saves it to disk.
| Parameter | Type | Default | Description |
|---|
filename | dynamic | — | Filesystem name of the target resource. |
data | dynamic | — | Binary or structured data to process. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
palette | dynamic | — | Palette value supplied to `_M_WritePCXfile`. |
View source
# _M_WriteU16LE
inline function _M_WriteU16LE(buf, off, value)
Encodes the low 16 bits of a value at a byte-buffer offset in little-endian order.
| Parameter | Type | Default | Description |
|---|
buf | dynamic | — | Buf value supplied to `_M_WriteU16LE`. |
off | dynamic | — | Zero-based byte or element offset. |
value | dynamic | — | Value consumed by the operation. |
View source
# _MMISC_IDiv
inline function _MMISC_IDiv(a, b)
Returns a signed quotient truncated toward zero, or zero for invalid operands and a zero divisor in `_MMISC_IDiv`
| Parameter | Type | Default | Description |
|---|
a | dynamic | — | First input operand. |
b | dynamic | — | Second input operand. |
View source
default_t struct
# defaultfile
defaultfile
Holds the optional defaultfile resource used by the m misc subsystem.
View source
# defaults
defaults
Stores the defaults collection used by the m misc subsystem.
View source
# M_DrawText
function M_DrawText(x, y, direct, string)
Draws an uppercase patch-font string at logical screen coordinates and returns the x position after the final glyph.
| Parameter | Type | Default | Description |
|---|
x | dynamic | — | Horizontal map- or screen-space coordinate. |
y | dynamic | — | Vertical map- or screen-space coordinate. |
direct | dynamic | — | Direct value supplied to `M_DrawText`. |
string | dynamic | — | String value supplied to `M_DrawText`. |
View source
# M_LoadDefaults
function M_LoadDefaults()
Restores built-in settings, parses recognized configuration keys, applies CLI multiplayer overrides, and clamps the result.
View source
# M_ReadFile
function M_ReadFile(name, bufferOut)
Loads an entire file into an output reference, returning its byte count and routing failures through I_Error.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
bufferOut | dynamic | — | Buffer out value supplied to `M_ReadFile`. |
View source
# M_SaveDefaults
function M_SaveDefaults()
Serializes current input, audio, message, and multiplayer settings to the selected configuration file.
View source
# M_ScreenShot
function M_ScreenShot()
Chooses the next unused DOOMxx screenshot name and writes the current framebuffer as a PCX image.
View source
# M_WriteFile
function M_WriteFile(name, source, length)
Persists exactly the requested byte prefix and returns false when validation or filesystem output fails.
| Parameter | Type | Default | Description |
|---|
name | dynamic | — | Resource or object name to resolve. |
source | dynamic | — | Source value or buffer. |
length | dynamic | — | Number of bytes or elements in the associated value. |
View source
# numdefaults
numdefaults
Tracks the mutable numdefaults value used by the m misc subsystem.
View source
# usejoystick
usejoystick
Tracks the mutable usejoystick value used by the m misc subsystem.
View source
# usemouse
usemouse
Tracks the mutable usemouse value used by the m misc subsystem.
View source
# WritePCXfile
function WritePCXfile(filename, data, width, height, palette)
Exposes the validated 8-bit PCX encoder through Doom's public screenshot-writing entry point.
| Parameter | Type | Default | Description |
|---|
filename | dynamic | — | Filesystem name of the target resource. |
data | dynamic | — | Binary or structured data to process. |
width | dynamic | — | Width of the target in pixels or map units. |
height | dynamic | — | Height of the target in pixels or map units. |
palette | dynamic | — | Palette value supplied to `WritePCXfile`. |
View source