[Added] Listmaps-style list of loaded maps for ZScript

Moderator: GZDoom Developers

Listmaps-style list of loaded maps for ZScript

Postby Kinsie » Wed Apr 21, 2021 4:20 am

The "listmaps" console command, for those unaware, prints a list to console of all loaded maps - their lumps, map names, and the wad they come from.
Image

I feel like exposing this information to ZScript - either as an array of map lump names or a set of arrays to also cover other related info, ala AllClasses/AllActorClasses - would be fairly useful for a number of purposes. For example, a level select menu, or a map shuffler ala Dan Gaskill's Duke3D mods War of Attrition and Alien Armageddon. As things stand, doing such things either requires making big assumptions of what the user has loaded ("This is only ever gonna be used with standard Doom 2 mapsets with MAP01 through MAP32!") or writing a MAPINFO parser in ZScript, which sounds like both a pretty painful task (especially once you factor in #includes!) and a duplication of effort.

I think Marisa has some ideas about how to do this, but I'll leave it to her to explain those.
User avatar
Kinsie
Dog Days
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: Listmaps-style list of loaded maps for ZScript

Postby Marisa Kirisame » Wed Apr 21, 2021 4:43 am

My idea is to finally expose the level_info_t struct (along with cluster_info_t for the sake of extra information people may need), along with functions to look them up by map name and level number / cluster number.

Obviously all the data, due to its ephemeral nature, will be read-only.

Edit: I think I'm confident enough in this PR. In the end, I decided to not export cluster_info_t because, honestly, I couldn't see any real need for it from a modding sense (others may correct me if I'm wrong later).
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Listmaps-style list of loaded maps for ZScript

Postby Kinsie » Sat Apr 24, 2021 10:35 pm

Marisa Kirisame wrote:Edit: I think I'm confident enough in this PR. In the end, I decided to not export cluster_info_t because, honestly, I couldn't see any real need for it from a modding sense (others may correct me if I'm wrong later).
This PR appears to have been merged, so this Feature Suggestion can be considered a roaring success. Thanks Marisa!
User avatar
Kinsie
Dog Days
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie

Re: Listmaps-style list of loaded maps for ZScript

Postby Marisa Kirisame » Sun Apr 25, 2021 3:09 am

Always happy to add fancy new scripting features.
User avatar
Marisa Kirisame
ZScript Crimester
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: 霧雨魔理沙#1666
Twitch ID: MarisaDOOM
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests