Add two more preset slots.

This commit is contained in:
Marisa the Magician 2022-03-24 10:35:06 +01:00
commit eeefaf8090
3 changed files with 9 additions and 6 deletions

View file

@ -135,3 +135,5 @@ nosave string mfx_preset4 = "";
nosave string mfx_preset5 = "";
nosave string mfx_preset6 = "";
nosave string mfx_preset7 = "";
nosave string mfx_preset8 = "";
nosave string mfx_preset9 = "";

View file

@ -7,5 +7,6 @@ version "4.7.1"
included from here.
*/
const MFX_NUMPRESETS = 10;
#include "zscript/mfx_menu.zsc"
#include "zscript/mfx_handler.zsc"

View file

@ -82,7 +82,7 @@ Class MFXPresetUtility
Class OptionMenuItemMFXPresetList : OptionMenuItemOptionBase
{
CVar mCVar;
String names[8];
String names[MFX_NUMPRESETS];
OptionMenuItemMFXPresetList Init( String label, Name command, CVar graycheck = null, int center = 0 )
{
@ -94,18 +94,18 @@ Class OptionMenuItemMFXPresetList : OptionMenuItemOptionBase
void UpdateNames()
{
for ( int i=0; i<8; i++ )
for ( int i=0; i<MFX_NUMPRESETS; i++ )
names[i] = MFXPresetUtility.GetPresetName(i);
}
override int GetSelection()
{
return clamp(mCVar.GetInt(),0,7);
return clamp(mCVar.GetInt(),0,MFX_NUMPRESETS-1);
}
override void SetSelection( int Selection )
{
mCVar.SetInt(clamp(Selection,0,7));
mCVar.SetInt(clamp(Selection,0,MFX_NUMPRESETS-1));
}
override int Draw( OptionMenuDescriptor desc, int y, int indent, bool selected )
@ -122,11 +122,11 @@ Class OptionMenuItemMFXPresetList : OptionMenuItemOptionBase
int Selection = GetSelection();
if ( mkey == Menu.MKEY_Left )
{
if ( --Selection < 0 ) Selection = 7;
if ( --Selection < 0 ) Selection = MFX_NUMPRESETS-1;
}
else if ( (mkey == Menu.MKEY_Right) || (mkey == Menu.MKEY_Enter) )
{
if ( ++Selection > 7 ) Selection = 0;
if ( ++Selection >= MFX_NUMPRESETS ) Selection = 0;
}
else return OptionMenuItem.MenuEvent(mkey,fromcontroller);
SetSelection(Selection);