135
135
#define S_CREDIT 0x00200000 // killough 10/98: credit
136
136
#define S_THERMO 0x00400000 // Slider for choosing a value
137
137
#define S_CHOICE 0x00800000 // this item has several values
138
- // #define S_ 0x01000000
138
+ #define S_DISABLED 0x01000000
139
139
#define S_NAME 0x02000000
140
140
#define S_RESET_Y 0x04000000
141
- // #define S_ 0x08000000
141
+ #define S_FUNC 0x08000000
142
142
// #define S_ 0x10000000
143
143
// #define S_ 0x20000000
144
144
#define S_STR 0x40000000 // need to refactor things...
150
150
* S_HASDEFPTR = the set of items whose var field points to default array
151
151
*/
152
152
153
- #define S_SHOWDESC (S_LABEL|S_TITLE|S_YESNO|S_CRITEM|S_COLOR|S_PREV|S_NEXT|S_INPUT|S_WEAP|S_NUM|S_FILE|S_CREDIT|S_CHOICE|S_THERMO|S_NAME)
153
+ #define S_SHOWDESC (S_LABEL|S_TITLE|S_YESNO|S_CRITEM|S_COLOR|S_PREV|S_NEXT|S_INPUT|S_WEAP|S_NUM|S_FILE|S_CREDIT|S_CHOICE|S_FUNC| S_THERMO|S_NAME)
154
154
155
- #define S_SHOWSET (S_YESNO|S_CRITEM|S_COLOR|S_INPUT|S_WEAP|S_NUM|S_FILE|S_CHOICE|S_THERMO|S_NAME)
155
+ #define S_SHOWSET (S_YESNO|S_CRITEM|S_COLOR|S_INPUT|S_WEAP|S_NUM|S_FILE|S_CHOICE|S_FUNC| S_THERMO|S_NAME)
156
156
157
157
#define S_STRING (S_FILE|S_NAME)
158
158
@@ -171,6 +171,7 @@ static dboolean set_keybnd_active = false; // in key binding setup screens
171
171
static dboolean set_display_active = false;
172
172
static dboolean set_demos_active = false; // in demos setup screen
173
173
static dboolean set_compatibility_active = false;
174
+ static dboolean set_skill_builder_active = false;
174
175
static dboolean set_weapon_active = false; // in weapons setup screen
175
176
static dboolean set_auto_active = false; // in automap setup screen
176
177
static dboolean level_table_active = false;
@@ -1656,6 +1657,40 @@ static void M_SetSetupMenuItemOn (const int x)
1656
1657
}
1657
1658
}
1658
1659
1660
+ static dboolean M_ItemSelected (const setup_menu_t * s )
1661
+ {
1662
+ int flags = s -> m_flags ;
1663
+
1664
+ if (s == current_setup_menu + set_menu_itemon && whichSkull && !(flags & S_NOSELECT ))
1665
+ {
1666
+ return true;
1667
+ }
1668
+
1669
+ return false;
1670
+ }
1671
+
1672
+ static void M_BlinkingArrowRight (const setup_menu_t * s )
1673
+ {
1674
+ int flags = s -> m_flags ;
1675
+
1676
+ if (!M_ItemSelected (s ))
1677
+ {
1678
+ return ;
1679
+ }
1680
+
1681
+ if (flags & (S_CHOICE | S_CRITEM | S_THERMO ))
1682
+ {
1683
+ if (!setup_select )
1684
+ {
1685
+ strcat (menu_buffer , " <" );
1686
+ }
1687
+ }
1688
+ else if (!setup_select )
1689
+ {
1690
+ strcat (menu_buffer , " <" );
1691
+ }
1692
+ }
1693
+
1659
1694
static void M_UpdateSetupMenu (setup_menu_t * new_setup_menu )
1660
1695
{
1661
1696
current_setup_menu = new_setup_menu ;
@@ -1797,6 +1832,47 @@ static int entry_index;
1797
1832
static char entry_string_index [ENTRY_STRING_BFR_SIZE ]; // points to new strings while editing
1798
1833
static int choice_value ;
1799
1834
1835
+ /////////////////////////////
1836
+ //
1837
+ // M_ItemDisabled
1838
+ //
1839
+ // Disable certain menu options based on various conditions:
1840
+ // StrictMode, Complevel, and more!
1841
+ //
1842
+ //
1843
+
1844
+ static dboolean M_ItemDisabled (const setup_menu_t * s )
1845
+ {
1846
+ // Strict Mode
1847
+ if (dsda_StrictMode () && dsda_IsStrictConfig (s -> config_id ))
1848
+ return true;
1849
+
1850
+ return false;
1851
+ }
1852
+
1853
+ /////////////////////////////
1854
+ //
1855
+ // Menu Text Colors
1856
+ //
1857
+ //
1858
+
1859
+ static int GetItemColor (int flags )
1860
+ {
1861
+ return (flags & S_TITLE && flags & S_DISABLED ) ? cr_title + CR_DARKEN :
1862
+ flags & S_DISABLED ? cr_label + CR_DARKEN : flags & (S_SELECT |S_TC_SEL ) ? cr_label_edit :
1863
+ flags & S_HILITE ? cr_label_highlight :
1864
+ flags & (S_TITLE |S_NEXT |S_PREV ) ? cr_title :
1865
+ cr_label ; // killough 10/98
1866
+ }
1867
+
1868
+ static int GetOptionColor (int flags )
1869
+ {
1870
+ return flags & S_DISABLED ? cr_value + CR_DARKEN :
1871
+ flags & S_SELECT ? cr_value_edit :
1872
+ flags & S_HILITE ? cr_value_highlight :
1873
+ cr_value ;
1874
+ }
1875
+
1800
1876
/////////////////////////////
1801
1877
//
1802
1878
// phares 4/18/98:
@@ -1810,31 +1886,39 @@ static int choice_value;
1810
1886
static void M_DrawItem (const setup_menu_t * s , int y )
1811
1887
{
1812
1888
int x = s -> m_x ;
1889
+ const char text [66 ];
1813
1890
int flags = s -> m_flags ;
1814
1891
char * p , * t ;
1815
1892
int w = 0 ;
1816
- int color =
1817
- dsda_StrictMode () && dsda_IsStrictConfig (s -> config_id ) ? cr_label + CR_DARKEN :
1818
- flags & (S_SELECT |S_TC_SEL ) ? cr_label_edit :
1819
- flags & S_HILITE ? cr_label_highlight :
1820
- flags & (S_TITLE |S_NEXT |S_PREV ) ? cr_title :
1821
- cr_label ; // killough 10/98
1893
+ int color ;
1894
+
1895
+ if (M_ItemDisabled (s ))
1896
+ flags |= S_DISABLED ;
1897
+
1898
+ color = GetItemColor (flags );
1899
+
1900
+ sprintf (text , "%s%s" , s -> m_text , (flags & S_FUNC ) ? ". . ." : "" );
1822
1901
1823
1902
/* killough 10/98:
1824
1903
* Enhance to support multiline text separated by newlines.
1825
1904
* This supports multiline items on horizontally-crowded menus.
1826
1905
*/
1827
1906
1828
- for (p = t = Z_Strdup (s -> m_text ); (p = strtok (p ,"\n" )); y += 8 , p = NULL )
1829
- { /* killough 10/98: support left-justification: */
1830
- if (flags & S_CENTER )
1831
- w = M_GetPixelWidth (p ) / 2 ;
1832
- else if (!(flags & S_LEFTJUST ))
1833
- w = M_GetPixelWidth (p ) + 4 ;
1834
- M_DrawString (x - w , y ,color , p );
1835
- // print a blinking "arrow" next to the currently highlighted menu item
1836
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !(flags & S_NOSELECT ))
1837
- M_DrawString (x - w - 8 , y , color , ">" );
1907
+ for (p = t = Z_Strdup (text ); (p = strtok (p ,"\n" )); y += 8 , p = NULL )
1908
+ { /* killough 10/98: support left-justification: */
1909
+ w = M_GetPixelWidth (p );
1910
+
1911
+ if (!(flags & S_LEFTJUST ))
1912
+ x -= (w + 4 );
1913
+
1914
+ M_DrawString (x , y , color , p );
1915
+
1916
+ // print a blinking left "arrow" before highlighted menu item
1917
+ if (M_ItemSelected (s ))
1918
+ M_DrawString (x - 8 , y , color , ">" );
1919
+ // print a blinking right "arrow" after function
1920
+ if (M_ItemSelected (s ) && (flags & S_FUNC ))
1921
+ M_DrawString (x + w , y , color , " <" );
1838
1922
}
1839
1923
Z_Free (t );
1840
1924
}
@@ -1865,19 +1949,17 @@ static void M_DrawSetting(const setup_menu_t* s, int y)
1865
1949
// Determine color of the text. This may or may not be used later,
1866
1950
// depending on whether the item is a text string or not.
1867
1951
1868
- color =
1869
- dsda_StrictMode () && dsda_IsStrictConfig (s -> config_id ) ? cr_value + CR_DARKEN :
1870
- flags & S_SELECT ? cr_value_edit :
1871
- flags & S_HILITE ? cr_value_highlight :
1872
- cr_value ;
1952
+ if (M_ItemDisabled (s ))
1953
+ flags |= S_DISABLED ;
1954
+
1955
+ color = GetOptionColor (flags );
1873
1956
1874
1957
// Is the item a YES/NO item?
1875
1958
1876
1959
if (flags & S_YESNO ) {
1877
1960
strcpy (menu_buffer , dsda_IntConfig (s -> config_id ) ? "YES" : "NO" );
1878
1961
1879
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select )
1880
- strcat (menu_buffer , " <" );
1962
+ M_BlinkingArrowRight (s );
1881
1963
M_DrawMenuString (x ,y ,color );
1882
1964
return ;
1883
1965
}
@@ -1900,12 +1982,11 @@ static void M_DrawSetting(const setup_menu_t* s, int y)
1900
1982
if (flags & S_CRITEM )
1901
1983
{
1902
1984
color = value ;
1903
- if (dsda_StrictMode () && dsda_IsStrictConfig ( s -> config_id ) )
1985
+ if (flags & S_DISABLED )
1904
1986
color += CR_DARKEN ;
1905
1987
}
1906
1988
}
1907
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select )
1908
- strcat (menu_buffer , " <" );
1989
+ M_BlinkingArrowRight (s );
1909
1990
M_DrawMenuString (x , y , color );
1910
1991
return ;
1911
1992
}
@@ -1962,9 +2043,7 @@ static void M_DrawSetting(const setup_menu_t* s, int y)
1962
2043
if (!any_input )
1963
2044
M_GetKeyString (0 , 0 );
1964
2045
1965
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select )
1966
- strcat (menu_buffer , " <" );
1967
-
2046
+ M_BlinkingArrowRight (s );
1968
2047
M_DrawMenuString (x , y , color );
1969
2048
1970
2049
return ;
@@ -2049,8 +2128,7 @@ static void M_DrawSetting(const setup_menu_t* s, int y)
2049
2128
// Draw the setting for the item
2050
2129
2051
2130
strcpy (menu_buffer , text );
2052
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select )
2053
- strcat (menu_buffer , " <" );
2131
+ M_BlinkingArrowRight (s );
2054
2132
M_DrawMenuString (x , y , color );
2055
2133
return ;
2056
2134
}
@@ -2081,8 +2159,7 @@ static void M_DrawSetting(const setup_menu_t* s, int y)
2081
2159
}
2082
2160
}
2083
2161
2084
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select )
2085
- strcat (menu_buffer , " <" );
2162
+ M_BlinkingArrowRight (s );
2086
2163
M_DrawMenuString (x ,y ,color );
2087
2164
return ;
2088
2165
}
@@ -2092,8 +2169,7 @@ static void M_DrawSetting(const setup_menu_t* s, int y)
2092
2169
2093
2170
sprintf (menu_buffer , "%d" , dsda_IntConfig (s -> config_id ));
2094
2171
2095
- if (s == current_setup_menu + set_menu_itemon && whichSkull && !setup_select )
2096
- strcat (menu_buffer , " <" );
2172
+ M_BlinkingArrowRight (s );
2097
2173
M_DrawMenuString (x + 80 , y + 3 , color );
2098
2174
return ;
2099
2175
}
@@ -2302,7 +2378,7 @@ static void M_DrawInstructions(void)
2302
2378
// are changing an item or just sitting on it.
2303
2379
2304
2380
if (setup_select ) {
2305
- switch (flags & (S_INPUT | S_YESNO | S_WEAP | S_NUM | S_COLOR | S_CRITEM | S_FILE | S_CHOICE | S_THERMO | S_NAME )) {
2381
+ switch (flags & (S_INPUT | S_YESNO | S_WEAP | S_NUM | S_COLOR | S_CRITEM | S_FILE | S_CHOICE | S_FUNC | S_THERMO | S_NAME )) {
2306
2382
case S_INPUT :
2307
2383
M_DrawInstructionString (cr_info_edit , "Press key or button for this action" );
2308
2384
break ;
@@ -2333,13 +2409,18 @@ static void M_DrawInstructions(void)
2333
2409
case S_NAME :
2334
2410
M_DrawInstructionString (cr_info_edit , "Type / edit author and Press ENTER" );
2335
2411
break ;
2412
+ case S_FUNC :
2413
+ M_DrawInstructionString (cr_info_edit , "Press ENTER key to confirm" );
2414
+ break ;
2336
2415
default :
2337
2416
break ;
2338
2417
}
2339
2418
}
2340
2419
else {
2341
2420
if (flags & S_INPUT )
2342
2421
M_DrawInstructionString (cr_info_highlight , "Press Enter to Change, Del to Clear" );
2422
+ else if (flags & S_FUNC )
2423
+ M_DrawInstructionString (cr_info_highlight , "Press Enter to Select" );
2343
2424
else
2344
2425
M_DrawInstructionString (cr_info_highlight , "Press Enter to Change" );
2345
2426
}
@@ -2351,6 +2432,7 @@ static void M_DrawInstructions(void)
2351
2432
#define FINAL_ENTRY { 0, S_SKIP | S_END, m_null }
2352
2433
#define EMPTY_LINE { 0, S_SKIP, m_null }
2353
2434
#define NEW_COLUMN { 0, S_SKIP | S_RESET_Y, m_null }
2435
+ #define FUNCTION (action_name , flags , offset_x , action_func ) { action_name, !flags ? (S_FUNC) : (S_FUNC | flags), m_null, offset_x, .action = action_func }
2354
2436
2355
2437
static void M_EnterSetup (menu_t * menu , dboolean * setup_flag , setup_menu_t * setup_menu )
2356
2438
{
@@ -4894,6 +4976,22 @@ static dboolean M_SetupCommonSelectResponder(int ch, int action, event_t* ev)
4894
4976
return true;
4895
4977
}
4896
4978
4979
+ if (ptr1 -> m_flags & S_FUNC && action == MENU_ENTER )
4980
+ {
4981
+ if (M_ItemDisabled (ptr1 ))
4982
+ {
4983
+ S_StartVoidSound (g_sfx_oof );
4984
+ return true;
4985
+ }
4986
+ else if (ptr1 -> action )
4987
+ {
4988
+ ptr1 -> action ();
4989
+ }
4990
+
4991
+ M_SelectDone (ptr1 );
4992
+ return true;
4993
+ }
4994
+
4897
4995
if (ptr1 -> m_flags & (S_NUM | S_CRITEM )) // number?
4898
4996
{
4899
4997
if (setup_gather ) { // gathering keys for a value?
@@ -5098,7 +5196,7 @@ static dboolean M_SetupNavigationResponder(int ch, int action, event_t* ev)
5098
5196
{
5099
5197
int flags = ptr1 -> m_flags ;
5100
5198
5101
- if (dsda_StrictMode () && dsda_IsStrictConfig ( ptr1 -> config_id ))
5199
+ if (M_ItemDisabled ( ptr1 ))
5102
5200
return true;
5103
5201
5104
5202
// You've selected an item to change. Highlight it, post a new
@@ -5234,7 +5332,7 @@ static dboolean M_SetupResponder(int ch, int action, event_t* ev)
5234
5332
return true;
5235
5333
5236
5334
// killough 10/98: consolidate handling into one place:
5237
- if (set_general_active || set_demos_active || set_display_active )
5335
+ if (set_general_active || set_demos_active || set_display_active || set_compatibility_active )
5238
5336
if (M_StringResponder (ch , action , ev ))
5239
5337
return true;
5240
5338
@@ -6166,30 +6264,22 @@ void M_Drawer (void)
6166
6264
if (
6167
6265
currentMenu -> menuitems [i ].status != -1 && (
6168
6266
!currentMenu -> menuitems [i ].name [0 ] || !W_LumpNameExists (currentMenu -> menuitems [i ].name )
6169
- )
6267
+ ) && !( currentMenu -> menuitems [ i ]. flags & MENUF_OPTLUMP )
6170
6268
)
6171
6269
++ lumps_missing ;
6172
6270
6173
- if (!lumps_missing )
6174
- for (i = 0 ; i < max ; i ++ )
6175
- {
6176
- if (currentMenu -> menuitems [i ].name [0 ])
6177
- V_DrawNamePatch (x , y , 0 , currentMenu -> menuitems [i ].name ,
6178
- currentMenu -> menuitems [i ].color , VPT_STRETCH );
6179
-
6180
- y += LINEHEIGHT ;
6181
- }
6182
- else
6183
- for (i = 0 ; i < max ; i ++ )
6184
- {
6185
- const char * alttext = currentMenu -> menuitems [i ].alttext ;
6186
-
6187
- if (alttext )
6188
- M_WriteText (x , y + 8 - (M_StringHeight (alttext ) / 2 ),
6189
- alttext , currentMenu -> menuitems [i ].color );
6190
-
6191
- y += LINEHEIGHT ;
6192
- }
6271
+ for (i = 0 ; i < max ; i ++ )
6272
+ {
6273
+ const char * alttext = currentMenu -> menuitems [i ].alttext ;
6274
+ if (!lumps_missing && currentMenu -> menuitems [i ].name [0 ] &&
6275
+ !(currentMenu -> menuitems [i ].flags & MENUF_OPTLUMP ))
6276
+ V_DrawNamePatch (x , y , 0 , currentMenu -> menuitems [i ].name ,
6277
+ currentMenu -> menuitems [i ].color , VPT_STRETCH );
6278
+ else if (alttext )
6279
+ M_WriteText (x , y + 8 - (M_StringHeight (alttext ) / 2 ),
6280
+ alttext , currentMenu -> menuitems [i ].color );
6281
+ y += LINEHEIGHT ;
6282
+ }
6193
6283
6194
6284
// DRAW SKULL
6195
6285
if (max > 0 )
0 commit comments