Zandronum Chat on our Discord Server Get the latest version: 3.1
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004134Zandronum[All Projects] Suggestionpublic2023-05-04 21:182023-07-09 20:31
Assigned To 
Statusneeds testingResolutionopen 
PlatformOSOS Version
Product Version3.1 
Target Version3.2Fixed in Version 
Summary0004134: [Patch] Lump reading API for ACS
DescriptionThis 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.
Attached Filespatch file icon lumpread.patch [^] (2,069 bytes) 2023-05-04 21:18 [Show Content]

- Relationships
related to 0004084closed Add GetMapChecksum ACS function (patch) 

-  Notes
User avatar (0022841)
TDRR (reporter)
2023-05-04 21:23

This would make 0004084 obsolete since the checksum generation can be implemented mod-side instead.
User avatar (0022864)
DrinkyBird (developer)
2023-07-09 20:28

' [^]'

Issue Community Support
Only registered users can voice their support. Click here to register, or here to log in.
Supporters: Trillster
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2023-05-04 21:18 TDRR New Issue
2023-05-04 21:18 TDRR File Added: lumpread.patch
2023-05-04 21:23 TDRR Note Added: 0022841
2023-05-04 23:39 Kaminsky Relationship added related to 0004084
2023-05-08 13:21 DrinkyBird Status new => needs review
2023-07-09 20:28 DrinkyBird Note Added: 0022864
2023-07-09 20:28 DrinkyBird Assigned To => DrinkyBird
2023-07-09 20:28 DrinkyBird Status needs review => needs testing
2023-07-09 20:28 DrinkyBird Assigned To DrinkyBird =>
2023-07-09 20:31 Kaminsky Target Version => 3.2

Questions or other issues? Contact Us.


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker