MantisBT - Zandronum
View Issue Details
0004134Zandronum[All Projects] Suggestionpublic2023-05-04 21:182023-07-09 20:31
TDRR 
 
normalfeatureN/A
needs testingopen 
3.1 
3.2 
0004134: [Patch] Lump reading API for ACS
This patch adds the following functions to allow lump reading in ACS:

int LumpOpen(str filename[, int start]): Returns the index to a lump named like <filename>. By default, the last lump matching <filename> is returned, but when <start> is specified, it'll start searching from that lump instead, making loading lumps cumulatively possible (like SNDINFO and MAPINFO).
Returns -1 on error.

int LumpSize(int lump): Returns the filesize of the lump.

int LumpReadChar/LumpReadShort(int lump, int pos[, bool unsigned]): Reads 8/16-bits from <lump>, at byte <pos> and returns the result. If <unsigned> (default false) is true, the value is read as-is (so generally an unsigned integer), otherwise the sign bit is moved to be where it should in a 32-bit value.

int LumpReadInt(int lump, int pos): Same as above, but reads a 32-bit value instead. An unsigned 32-bit integer would be represented in the same way, so that parameter isn't needed.

str LumpReadString(int lump, int pos): Reads a null-terminated string from <lump>, starting from <pos>. This is also fine for reading text files, as the function stops upon reaching EOF.

This API can allow numerous previously impossible or practically unfeasible features to be implemented by modders.
The most obvious use would be externalizing data that would have to be written into the ACS source normally, preventing fully clientside addons to mods. Sure, LANGUAGE technically allows for this, but making cumulative lumps is pretty much impossible or heavily restrictive, and they're clunky to write at best. Like LiteSpree announcer packs, which are limited to 10 announcers, and each must have an unique index if they're to be loaded simultaneously.

Another potential feature is reading and using tags in MD3s. Allowing for full Quake 3 player models (with the torso and legs being separate and each having their own animations), for instance. Attaching interchangeable weapon models to their hands and such too. Theoretically even model collision would be possible, but obviously wouldn't work well for online play.
I'd make use of this myself in a Gears of War inspired mod. In third person gameplay with long reload animations and a variety of actions the player can do, you probably wouldn't want constant interruptions to what the torso is doing because the lower half of the body has to change animations.

Lumps like MAPINFO could be read to extract information about maps or game settings that aren't exposed to modders by default, for example working around the limited custom skill level support by reading the skill level settings and accounting for them.

It would additionally make it possible to read map files and get all sorts of information about the map. Calculating the checksum of a map manually would be made trivial, a feature that would by itself allow patching maps with new things and colored lighting. It would also make getting a map's vertices, lines, sectors, textures used and more possible.
A couple personal use cases for me would be the TDBots, as I could easily plot nodes at the center of each subsector for a good set of path nodes made with zero modder or user intervention. And also patching maps with new Playstation Doom-ish lighting.
No tags attached.
related to 0004084closed  Add GetMapChecksum ACS function (patch) 
patch lumpread.patch (2,069) 2023-05-04 21:18
https://zandronum.com/tracker/file_download.php?file_id=2853&type=bug
Issue History
2023-05-04 21:18TDRRNew Issue
2023-05-04 21:18TDRRFile Added: lumpread.patch
2023-05-04 21:23TDRRNote Added: 0022841
2023-05-04 23:39KaminskyRelationship addedrelated to 0004084
2023-05-08 13:21DrinkyBirdStatusnew => needs review
2023-07-09 20:28DrinkyBirdNote Added: 0022864
2023-07-09 20:28DrinkyBirdAssigned To => DrinkyBird
2023-07-09 20:28DrinkyBirdStatusneeds review => needs testing
2023-07-09 20:28DrinkyBirdAssigned ToDrinkyBird =>
2023-07-09 20:31KaminskyTarget Version => 3.2

Notes
(0022841)
TDRR   
2023-05-04 21:23   
This would make 0004084 obsolete since the checksum generation can be implemented mod-side instead.
(0022864)
DrinkyBird   
2023-07-09 20:28   
'https://hg.osdn.net/view/zandronum/zandronum-stable/rev/89bccf7127ba [^]'