LumpRead: Difference between revisions

From Zandronum Wiki
(Created page with "{{ACSWarning}}{{DevfeatureWarning|version=3.2|type=an ACS function}} int '''LumpRead''' (int ''lump'', int ''pos'' [, int ''type'']) {{Devfeature|3.2|alpha}} ==Usage== Reads an integer. The value of this integer is based on the ''type'' passed. By default, the ''type'' returned is an unsigned 8-bit integer. ===Parameters=== *''lump'': The lump index as returned from <code>LumpOpen</code>. *''pos'': The byte position in the lump to read from. *''type'': The typ...")
 
(Update formatting and specifications on failure)
Line 6: Line 6:
By default, the ''type'' returned is an unsigned 8-bit integer.  
By default, the ''type'' returned is an unsigned 8-bit integer.  
===Parameters===
===Parameters===
*''lump'': The lump index as returned from <code>[[LumpOpen]]</code>.
*''lump'': The lump index as returned from <tt>[[LumpOpen]]</tt>.
*''pos'': The byte position in the lump to read from.
*''pos'': The byte position in the lump to read from.
*''type'': The type of integer that should be returned.
*''type'': The type of integer that should be returned.
**''LUMP_READ_BYTE'': Signed 8-bit integer.
**<code>LUMP_READ_BYTE</code>: Signed 8-bit integer.
**''LUMP_READ_UBYTE'': Unsigned 8-bit integer.
**<code>LUMP_READ_UBYTE</code>: Unsigned 8-bit integer.
**''LUMP_READ_SHORT'': Signed 16-bit integer.
**<code>LUMP_READ_SHORT</code>: Signed 16-bit integer.
**''LUMP_READ_USHORT'': Unsigned 16-bit integer.
**<code>LUMP_READ_USHORT</code>: Unsigned 16-bit integer.
**''LUMP_READ_INT'': Signed 32-bit integer.
** <code>LUMP_READ_INT</code>: Signed 32-bit integer.
**''LUMP_READ_FLOAT'': Signed 32-bit float converted to a fixed-point.
**<code>LUMP_READ_FLOAT</code>: Signed 32-bit float converted to a fixed-point.
===Return value===
===Return value ===
Returns the integer that was read.
Returns the integer that was read.


Returns 0 if the ''lump'' passed is invalid, or when the ''type'' passed is invalid.
Returns 0 if the ''lump'' passed is invalid, or when the ''type'' passed is invalid, alongside a console message.
 
Also returns 0 when called on a lump that was not opened with <tt>[[LumpOpen]]</tt>, alongside a console message.
==Examples==
==Examples==
{{noexamples}}
{{noexamples}}

Revision as of 08:27, 4 January 2024

This article documents a Zandronum-specific ACS feature which may not be supported by ZDoom and its other child ports.
This article documents an ACS function which is only available in development builds of Zandronum 3.2 and newer.

int LumpRead (int lump, int pos [, int type]) (development version 3.2-alpha and above only)

Usage

Reads an integer. The value of this integer is based on the type passed.

By default, the type returned is an unsigned 8-bit integer.

Parameters

  • lump: The lump index as returned from LumpOpen.
  • pos: The byte position in the lump to read from.
  • type: The type of integer that should be returned.
    • LUMP_READ_BYTE: Signed 8-bit integer.
    • LUMP_READ_UBYTE: Unsigned 8-bit integer.
    • LUMP_READ_SHORT: Signed 16-bit integer.
    • LUMP_READ_USHORT: Unsigned 16-bit integer.
    • LUMP_READ_INT: Signed 32-bit integer.
    • LUMP_READ_FLOAT: Signed 32-bit float converted to a fixed-point.

Return value

Returns the integer that was read.

Returns 0 if the lump passed is invalid, or when the type passed is invalid, alongside a console message.

Also returns 0 when called on a lump that was not opened with LumpOpen, alongside a console message.

Examples

This article lists no examples, please add one.