Skip to content
Snippets Groups Projects

Add menu for custom console variables

Open Skydusk requested to merge Acelite/SRB2:menuforcustomcvars into next
2 unresolved threads

CV_RegisterVar({name = , defaultvalue = , flags = , PossibleValue = , func = }) -> CV_RegisterVar({name = , defaultvalue = , flags = , PossibleValue = , func = , category = , displayname = ,})

Changed menuname to displayname in case of future use (like better help command for example).

Added CV_NOMENU consvar flag. Automatically all cvars should be added otherwise.

srb21250 srb21255

cvar_menu_test.lua cvar_menu_stress_test.lua

Removed ghosts

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
125 125 // used on menus
126 126 CV_CHEAT = 2048, // Don't let this be used in multiplayer unless cheats are on.
127 127 CV_ALLOWLUA = 4096,/* Let this be called from Lua */
128 CV_NOMENU = 8192, // Lua exclusive flag, to give choice to modders regarding custom options menu.
  • This should be inverted - a cvar from a Lua script should have something like CV_ADDONMENU instead, so that cvars must be opted in to this menu, not out. Otherwise existing addons will have their configuration cvars displayed even if they never intended for them to be.

  • Author Contributor

    I was discussing this with LJ (long time ago) and that's kind of the point to have them automatically inserted into the menu. Considering a lot of mods are unmaintained, mobile port users would appreciate it too and this was developed in mind to be in-case mid-major-version addition -- I believe serving the comfort of user should take priority while developer can choose to have the cvar in the menu or not later. Otherwise, I would do it in reverse even back then. Perhaps cvars with cheats should have been discarded from automatic process in the first place. In the end, it is not my decision to make what would be better anyway.

    Edited by Skydusk
  • Contributor

    I agreed with Eldolon, there are addons that prefer to never expose it to a menu which is intented, and if preferable to be CV_ADDONMENU instead of forcing all the cvars to be added to the menu which may even cause some confusion for addon developers (which is possible :p) to say why my cvars are automatically added to the menu when i didn't want to.

  • honestly i prefer opt out just because like addons that want to opt out can just update since most likely they are being updated anyways

    this could change for 2.3 but i feel convenience for now is better

  • I would agree with the stance of it being opt-out, specifically from the perspective of the playerbase. Menu options are significantly more friendly to most users compared to commands, and a lot of mods run on the assumption that the end-user knows how to use a command line. But if you lay out all of those commands in a menu, then they're easily accessible by everyone. The only reasons you would want to disable showing a cvar in the menu are if it's related to secret/debug behavior, or is already in its own custom menu, which a majority of cvars are not. Remember too that commands will not show up here period because of how they're programmed, so I think it's fair to give cvars the distinction of being placed here automatically.

  • Please register or sign in to reply
  • 558 579 return luaL_error(L, "failed to register cvar (probable conflict with internal variable/command names)");
    559 580 }
    560 581
    582 if (!((cvar->flags & CV_NOMENU)
    583 || (cvar->flags & CV_HIDEN))
    584 || (cvar->flags & CV_NOSHOWHELP))
    585 {
    586 if (!category)
    587 {
    588 char* temp = strdup(wadfiles[numwadfiles - 1]->filename);
    589 nameonly(temp);
  • Skydusk added 1 commit

    added 1 commit

    • e6d51750 - Get the filename with pointer arithmetic instead.

    Compare with previous version

  • Please register or sign in to reply
    Loading