Skip to content

Ingame Menus

aufau edited this page Mar 17, 2017 · 3 revisions

JK2MV 1.2 and higher come with a custom ingame "Setup" menu providing better access to new features. If you wish to add your own options you can simply override ui/jk2mp/ingame_setup.menu but it will erase all JK2MV settings (they will be still accessible in the main menu). Alternatively you can take following steps to seamlessly merge your mod options:

Mod Options Submenu

JK2MV ingame "Setup" menu comes with an empty "Mod Options" submenu. It is conveniently loaded from a separate file ui/jk2mp/ingame_setup_modoptions.menu which you can extract from assetsmv.pk3 and use as a template for your mod settings. If you also happen to override ui/jk2mpingame.txt script, remember to add loadMenu { "ui/jk2mp/ingame_setup_modoptions.menu" } line there.

JK2MV Menu Fields

Some fields in JK2MV ingame menus require special UI module support. If it's not available they will be greyed out. You can announce that your module supports these fields by setting ui_menulevel cvar. Following patch shows how to implement and enable fields in menu level 1: aufau/SaberMod@c1f6d32

Compatibility with Other JK2 Clients

With these modifications original JK2 client shows default ingame menus without your custom mod options. If you'd like to provide a fallback for non-JK2MV clients you can take following steps:

  1. Create a modified ingame_setup.menu based on the original JK2 menu file and name it ui/jk2mp/ingame_setup_fallback.menu.
  2. Copy ui/jk2mpingame.txt from original JK2 assets and call it ui/jk2mpingame_fallback.txt. Replace following line: loadMenu { "ui/jk2mp/ingame_setup.menu" } with loadMenu { "ui/jk2mp/ingame_setup_fallback.menu" }.
  3. In your custom UI module, in ui_main.c file find lines loading ui/jk2mpingame.txt script. Add JK2MV version check and if client is not JK2MV 1.2 or higher load ui/jk2mpingame_fallback.txt instead.

Here you can see another approach to solve the same problem: https://github.com/aufau/SaberMod/commit/41ce9195b4c9e0a301a57faed1b218dad2562cc0