ZDaemon Forum Index ZDaemon
Client/Server DOOM
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[ACS] StrParam()

 
Post new topic   Reply to topic    ZDaemon Forum Index -> Pending Requests
View previous topic :: View next topic  
Author Message
rhinoduck
Potatoes


Joined: 22 Oct 2012

PostPosted: Mon Oct 28, 2013 12:18 pm    Post subject: [ACS] StrParam() Reply with quote

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.
Back to top
View user's profile Send private message
noncom
has entered the game!


Joined: 08 Aug 2012

PostPosted: Tue Jun 10, 2014 9:45 am    Post subject: Reply with quote

+1 for improving strings support

@rhinoduck: in the meantime, how do you think, is it possible to emulate strings with arrays and operations on them, encapsulated in a special library?

coz i also have something string-intensive in mind to do
Back to top
View user's profile Send private message
rhinoduck
Potatoes


Joined: 22 Oct 2012

PostPosted: Tue Jun 10, 2014 7:24 pm    Post subject: Reply with quote

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 can't really generate arbitrary strings in ACS without the kind of ugly approach mentioned above, but the existing toolset is quite OK for most tasks even in ZDaemon now: StrParam(), StrLen(), GetChar(); and string comparsion can be done in pure ACS - http://ragdoll.mooo.com/svn/rhinolib/tags/dev20140508/src/strnglib.acs
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ZDaemon Forum Index -> Pending Requests All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group