Posted: Mon Oct 28, 2013 12:18 pm Post subject: [ACS] StrParam()
It is a major pita to not be able to compose, save and pass arbitrary strings when trying to do something serious and reusable in ACS. Even the pre-2.7.1 ZDoom behavior when the resulting string was only available for one tick would be more than enough to cure the countless headaches and fingeraches the lack of StrParam() causes.
The concept in short is that a virtual library with a reserved address is used to store the generated strings (and it gets cleared after each tick in the pre-2.7.1 versions). Depending in what state the ZDaemon ACS code is, it may be one of the less pleasant things to port (check the test wad, the source and the disassembled source), but I'd give all my duck love for it. The unknown opcode (352) is SAVESTRING.
A thread in the ZDoom forums where implementing of StrParam() was discussed can be used as a further source of information (although there is a lot of outdated clutter), and the first revision where the functionality was added seems to be this one. Mind that, afair, some important fixes have been made to it since.
With StrParam() available, it should now be possible to have custom c-style null-terminated strings in ACS. I already have a dynamic memory library built atop a global array, conversion from ACS strings to custom null-terminated strings would be easy with GetChar(), the only ugly thing would be the conversion in the opposite direction. You'd have to define single character ACS strings representing the charset (ideally ASCII compatible, as it would map directly to the ACS string representation) and then iterate over the custom string array and compose the ACS string character by character with StrParam() everytime you need to print it or use it as an ACS string argument.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum