2014-03-15 16:59:03 +00:00
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 1998-2000 by DooM Legacy Team.
2016-05-18 00:42:11 +00:00
// Copyright (C) 2011-2016 by Matthew "Inuyasha" Walsh.
2018-11-25 12:35:38 +00:00
// Copyright (C) 1999-2018 by Sonic Team Junior.
2014-03-15 16:59:03 +00:00
//
// This program is free software distributed under the
// terms of the GNU General Public License, version 2.
// See the 'LICENSE' file for more details.
//-----------------------------------------------------------------------------
/// \file m_menu.c
/// \brief XMOD's extremely revamped menu system.
# ifdef __GNUC__
# include <unistd.h>
# endif
# include "m_menu.h"
# include "doomdef.h"
# include "d_main.h"
# include "d_netcmd.h"
# include "console.h"
# include "r_local.h"
# include "hu_stuff.h"
# include "g_game.h"
# include "g_input.h"
# include "m_argv.h"
// Data.
# include "sounds.h"
# include "s_sound.h"
# include "i_system.h"
2017-04-29 15:40:07 +00:00
// Addfile
# include "filesrch.h"
2014-03-15 16:59:03 +00:00
# include "v_video.h"
# include "i_video.h"
# include "keys.h"
# include "z_zone.h"
# include "w_wad.h"
# include "p_local.h"
# include "p_setup.h"
# include "f_finale.h"
# ifdef HWRENDER
# include "hardware/hw_main.h"
# endif
# include "d_net.h"
# include "mserv.h"
# include "m_misc.h"
# include "m_anigif.h"
# include "byteptr.h"
# include "st_stuff.h"
# include "i_sound.h"
2017-01-26 19:14:52 +00:00
# include "fastcmp.h"
2014-03-15 16:59:03 +00:00
2018-12-02 21:52:30 +00:00
# include "i_joy.h" // for joystick menu controls
2014-03-15 16:59:03 +00:00
// Condition Sets
# include "m_cond.h"
// And just some randomness for the exits.
# include "m_random.h"
2018-12-14 08:58:07 +00:00
# if defined(HAVE_SDL)
# include "SDL.h"
# if SDL_VERSION_ATLEAST(2,0,0)
# include "sdl/sdlmain.h" // JOYSTICK_HOTPLUG
# endif
# endif
2014-03-15 16:59:03 +00:00
# ifdef PC_DOS
# include <stdio.h> // for snprintf
int snprintf ( char * str , size_t n , const char * fmt , . . . ) ;
//int vsnprintf(char *str, size_t n, const char *fmt, va_list ap);
# endif
2018-01-04 19:21:20 +00:00
# if defined (__GNUC__) && (__GNUC__ >= 4)
# define FIXUPO0
# endif
2014-03-15 16:59:03 +00:00
# define SKULLXOFF -32
# define LINEHEIGHT 16
# define STRINGHEIGHT 8
# define FONTBHEIGHT 20
# define SMALLLINEHEIGHT 8
2017-04-15 14:36:19 +00:00
# define SLIDER_RANGE 9
# define SLIDER_WIDTH 78
2014-03-15 16:59:03 +00:00
# define SERVERS_PER_PAGE 11
typedef enum
{
QUITMSG = 0 ,
QUITMSG1 ,
QUITMSG2 ,
QUITMSG3 ,
QUITMSG4 ,
QUITMSG5 ,
QUITMSG6 ,
QUITMSG7 ,
QUIT2MSG ,
QUIT2MSG1 ,
QUIT2MSG2 ,
QUIT2MSG3 ,
QUIT2MSG4 ,
QUIT2MSG5 ,
QUIT2MSG6 ,
QUIT3MSG ,
QUIT3MSG1 ,
QUIT3MSG2 ,
QUIT3MSG3 ,
QUIT3MSG4 ,
QUIT3MSG5 ,
QUIT3MSG6 ,
NUM_QUITMESSAGES
} text_enum ;
const char * quitmsg [ NUM_QUITMESSAGES ] ;
// Stuff for customizing the player select screen Tails 09-22-2003
2019-01-16 01:09:55 +00:00
description_t description [ MAXSKINS ] ;
2019-09-18 11:26:34 +00:00
INT16 char_on = - 1 , startchar = 0 ;
2014-03-15 16:59:03 +00:00
static char * char_notes = NULL ;
boolean menuactive = false ;
boolean fromlevelselect = false ;
typedef enum
{
LLM_CREATESERVER ,
LLM_LEVELSELECT ,
LLM_RECORDATTACK ,
LLM_NIGHTSATTACK
} levellist_mode_t ;
levellist_mode_t levellistmode = LLM_CREATESERVER ;
UINT8 maplistoption = 0 ;
2019-09-24 03:23:40 +00:00
static char joystickInfo [ MAX_JOYSTICKS + 1 ] [ 29 ] ;
2014-03-15 16:59:03 +00:00
# ifndef NONET
static UINT32 serverlistpage ;
# endif
2017-08-20 22:18:47 +00:00
static UINT8 numsaves = 0 ;
static saveinfo_t * savegameinfo = NULL ; // Extra info about the save games.
2017-08-22 20:02:33 +00:00
static patch_t * savselp [ 7 ] ;
2014-03-15 16:59:03 +00:00
INT16 startmap ; // Mario, NiGHTS, or just a plain old normal game?
static INT16 itemOn = 1 ; // menu item skull is on, Hack by Tails 09-18-2002
static INT16 skullAnimCounter = 10 ; // skull animation counter
static boolean setupcontrols_secondaryplayer ;
static INT32 ( * setupcontrols ) [ 2 ] ; // pointer to the gamecontrols of the player being edited
// shhh... what am I doing... nooooo!
static INT32 vidm_testingmode = 0 ;
static INT32 vidm_previousmode ;
static INT32 vidm_selected = 0 ;
static INT32 vidm_nummodes ;
static INT32 vidm_column_size ;
2019-08-18 22:34:54 +00:00
// new menus
2019-08-20 03:12:22 +00:00
static tic_t recatkdrawtimer = 0 ;
static tic_t ntsatkdrawtimer = 0 ;
2019-08-18 22:34:54 +00:00
static tic_t charseltimer = 0 ;
2019-08-20 03:18:34 +00:00
static fixed_t char_scroll = 0 ;
2019-08-18 22:34:54 +00:00
# define charscrollamt 128*FRACUNIT
2014-03-15 16:59:03 +00:00
2019-09-06 18:25:11 +00:00
static tic_t keydown = 0 ;
2014-03-15 16:59:03 +00:00
//
// PROTOTYPES
//
2017-01-29 19:25:43 +00:00
static void M_GoBack ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_StopMessage ( INT32 choice ) ;
# ifndef NONET
static void M_HandleServerPage ( INT32 choice ) ;
static void M_RoomMenu ( INT32 choice ) ;
# endif
// Prototyping is fun, innit?
// ==========================================================================
// NEEDED FUNCTION PROTOTYPES GO HERE
// ==========================================================================
// the haxor message menu
menu_t MessageDef ;
menu_t SPauseDef ;
2017-01-29 19:25:43 +00:00
// Level Select
static levelselect_t levelselect = { 0 , NULL } ;
2017-04-29 15:40:07 +00:00
static UINT8 levelselectselect [ 3 ] ;
2017-02-17 01:45:21 +00:00
static patch_t * levselp [ 2 ] [ 3 ] ;
2017-01-29 19:25:43 +00:00
static INT32 lsoffs [ 2 ] ;
# define lsrow levelselectselect[0]
# define lscol levelselectselect[1]
2017-04-29 15:40:07 +00:00
# define lshli levelselectselect[2]
2017-01-29 19:25:43 +00:00
# define lshseperation 101
2017-08-22 20:02:33 +00:00
# define lsbasevseperation (62*vid.height) / (BASEVIDHEIGHT*vid.dupy) //62
2017-01-29 19:25:43 +00:00
# define lsheadingheight 16
# define getheadingoffset(row) (levelselect.rows[row].header[0] ? lsheadingheight : 0)
# define lsvseperation(row) lsbasevseperation + getheadingoffset(row)
2017-02-17 01:45:21 +00:00
# define lswide(row) levelselect.rows[row].mapavailable[3]
# define lsbasex 19
# define lsbasey 59+lsheadingheight
2017-01-29 19:25:43 +00:00
2014-03-15 16:59:03 +00:00
// Sky Room
static void M_CustomLevelSelect ( INT32 choice ) ;
static void M_CustomWarp ( INT32 choice ) ;
FUNCNORETURN static ATTRNORETURN void M_UltimateCheat ( INT32 choice ) ;
static void M_LoadGameLevelSelect ( INT32 choice ) ;
2017-09-15 19:34:46 +00:00
static void M_AllowSuper ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_GetAllEmeralds ( INT32 choice ) ;
static void M_DestroyRobots ( INT32 choice ) ;
static void M_LevelSelectWarp ( INT32 choice ) ;
static void M_Credits ( INT32 choice ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
static void M_SoundTest ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_PandorasBox ( INT32 choice ) ;
static void M_EmblemHints ( INT32 choice ) ;
2017-04-22 23:16:09 +00:00
static void M_HandleChecklist ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
menu_t SR_MainDef , SR_UnlockChecklistDef ;
2017-04-22 23:16:09 +00:00
static UINT8 check_on ;
2014-03-15 16:59:03 +00:00
// Misc. Main Menu
static void M_SinglePlayerMenu ( INT32 choice ) ;
static void M_Options ( INT32 choice ) ;
static void M_SelectableClearMenus ( INT32 choice ) ;
static void M_Retry ( INT32 choice ) ;
static void M_EndGame ( INT32 choice ) ;
static void M_MapChange ( INT32 choice ) ;
static void M_ChangeLevel ( INT32 choice ) ;
static void M_ConfirmSpectate ( INT32 choice ) ;
static void M_ConfirmEnterGame ( INT32 choice ) ;
static void M_ConfirmTeamScramble ( INT32 choice ) ;
static void M_ConfirmTeamChange ( INT32 choice ) ;
static void M_SecretsMenu ( INT32 choice ) ;
static void M_SetupChoosePlayer ( INT32 choice ) ;
static void M_QuitSRB2 ( INT32 choice ) ;
2017-07-25 17:34:13 +00:00
menu_t SP_MainDef , OP_MainDef ;
2014-03-15 16:59:03 +00:00
menu_t MISC_ScrambleTeamDef , MISC_ChangeTeamDef ;
// Single Player
2018-08-11 20:17:52 +00:00
static void M_StartTutorial ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_LoadGame ( INT32 choice ) ;
2019-10-06 21:11:16 +00:00
static void M_HandleTimeAttackLevelSelect ( INT32 choice ) ;
2017-01-28 13:13:03 +00:00
static void M_TimeAttackLevelSelect ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_TimeAttack ( INT32 choice ) ;
2017-01-28 13:13:03 +00:00
static void M_NightsAttackLevelSelect ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_NightsAttack ( INT32 choice ) ;
static void M_Statistics ( INT32 choice ) ;
static void M_ReplayTimeAttack ( INT32 choice ) ;
static void M_ChooseTimeAttack ( INT32 choice ) ;
static void M_ChooseNightsAttack ( INT32 choice ) ;
static void M_ModeAttackEndGame ( INT32 choice ) ;
static void M_SetGuestReplay ( INT32 choice ) ;
2017-03-17 14:27:17 +00:00
static void M_HandleChoosePlayerMenu ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_ChoosePlayer ( INT32 choice ) ;
2017-04-15 23:12:37 +00:00
menu_t SP_LevelStatsDef ;
2014-11-12 00:55:07 +00:00
static menu_t SP_TimeAttackDef , SP_ReplayDef , SP_GuestReplayDef , SP_GhostDef ;
static menu_t SP_NightsAttackDef , SP_NightsReplayDef , SP_NightsGuestReplayDef , SP_NightsGhostDef ;
2014-03-15 16:59:03 +00:00
// Multiplayer
2017-07-25 17:34:13 +00:00
static void M_SetupMultiPlayer ( INT32 choice ) ;
static void M_SetupMultiPlayer2 ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_StartSplitServerMenu ( INT32 choice ) ;
static void M_StartServer ( INT32 choice ) ;
2017-02-01 17:21:04 +00:00
static void M_ServerOptions ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
# ifndef NONET
2017-07-25 17:34:13 +00:00
static void M_StartServerMenu ( INT32 choice ) ;
static void M_ConnectMenu ( INT32 choice ) ;
2019-08-29 00:24:30 +00:00
static void M_ConnectMenuModChecks ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_Refresh ( INT32 choice ) ;
static void M_Connect ( INT32 choice ) ;
static void M_ChooseRoom ( INT32 choice ) ;
2017-07-25 17:34:13 +00:00
menu_t MP_MainDef ;
2014-03-15 16:59:03 +00:00
# endif
// Options
// Split into multiple parts due to size
// Controls
2017-04-14 23:15:09 +00:00
menu_t OP_ChangeControlsDef ;
2019-09-19 09:34:04 +00:00
menu_t OP_MPControlsDef , OP_MiscControlsDef ;
2014-03-15 16:59:03 +00:00
menu_t OP_P1ControlsDef , OP_P2ControlsDef , OP_MouseOptionsDef ;
menu_t OP_Mouse2OptionsDef , OP_Joystick1Def , OP_Joystick2Def ;
2019-09-19 09:34:04 +00:00
menu_t OP_CameraOptionsDef , OP_Camera2OptionsDef ;
2014-03-15 16:59:03 +00:00
static void M_VideoModeMenu ( INT32 choice ) ;
static void M_Setup1PControlsMenu ( INT32 choice ) ;
static void M_Setup2PControlsMenu ( INT32 choice ) ;
static void M_Setup1PJoystickMenu ( INT32 choice ) ;
static void M_Setup2PJoystickMenu ( INT32 choice ) ;
static void M_AssignJoystick ( INT32 choice ) ;
static void M_ChangeControl ( INT32 choice ) ;
// Video & Sound
2017-04-19 21:24:28 +00:00
menu_t OP_VideoOptionsDef , OP_VideoModeDef , OP_ColorOptionsDef ;
2014-03-15 16:59:03 +00:00
# ifdef HWRENDER
menu_t OP_OpenGLOptionsDef , OP_OpenGLFogDef , OP_OpenGLColorDef ;
# endif
menu_t OP_SoundOptionsDef ;
2019-08-04 11:03:57 +00:00
menu_t OP_SoundAdvancedDef ;
2014-03-15 16:59:03 +00:00
//Misc
menu_t OP_DataOptionsDef , OP_ScreenshotOptionsDef , OP_EraseDataDef ;
2017-04-15 14:42:03 +00:00
menu_t OP_ServerOptionsDef ;
2014-03-15 16:59:03 +00:00
menu_t OP_MonitorToggleDef ;
static void M_ScreenshotOptions ( INT32 choice ) ;
static void M_EraseData ( INT32 choice ) ;
2017-04-29 15:40:07 +00:00
static void M_Addons ( INT32 choice ) ;
2017-04-29 15:40:07 +00:00
static void M_AddonsOptions ( INT32 choice ) ;
2019-01-07 07:31:45 +00:00
static patch_t * addonsp [ NUM_EXT + 5 ] ;
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
# define addonmenusize 9 // number of items actually displayed in the addons menu view, formerly (2*numaddonsshown + 1)
# define numaddonsshown 4 // number of items to each side of the currently selected item, unless at top/bottom ends of directory
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
static void M_DrawLevelPlatterHeader ( INT32 y , const char * header , boolean headerhighlight , boolean allowlowercase ) ;
2017-04-15 12:36:40 +00:00
2014-03-15 16:59:03 +00:00
// Drawing functions
static void M_DrawGenericMenu ( void ) ;
2017-04-15 12:36:40 +00:00
static void M_DrawGenericScrollMenu ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawCenteredMenu ( void ) ;
2017-04-29 15:40:07 +00:00
static void M_DrawAddons ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawChecklist ( void ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
static void M_DrawSoundTest ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawEmblemHints ( void ) ;
static void M_DrawPauseMenu ( void ) ;
static void M_DrawServerMenu ( void ) ;
2017-01-27 14:42:57 +00:00
static void M_DrawLevelPlatterMenu ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawImageDef ( void ) ;
static void M_DrawLoad ( void ) ;
static void M_DrawLevelStats ( void ) ;
static void M_DrawTimeAttackMenu ( void ) ;
static void M_DrawNightsAttackMenu ( void ) ;
static void M_DrawSetupChoosePlayerMenu ( void ) ;
static void M_DrawControl ( void ) ;
2017-04-15 14:36:19 +00:00
static void M_DrawMainVideoMenu ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawVideoMode ( void ) ;
2017-04-19 21:24:28 +00:00
static void M_DrawColorMenu ( void ) ;
2017-05-09 13:19:54 +00:00
static void M_DrawScreenshotMenu ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawMonitorToggles ( void ) ;
# ifdef HWRENDER
static void M_OGL_DrawFogMenu ( void ) ;
static void M_OGL_DrawColorMenu ( void ) ;
# endif
# ifndef NONET
2017-04-20 19:16:10 +00:00
static void M_DrawScreenshotMenu ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawConnectMenu ( void ) ;
2017-07-25 17:34:13 +00:00
static void M_DrawMPMainMenu ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_DrawRoomMenu ( void ) ;
# endif
static void M_DrawJoystick ( void ) ;
static void M_DrawSetupMultiPlayerMenu ( void ) ;
// Handling functions
static boolean M_ExitPandorasBox ( void ) ;
static boolean M_QuitMultiPlayerMenu ( void ) ;
2017-04-29 15:40:07 +00:00
static void M_HandleAddons ( INT32 choice ) ;
2017-01-27 14:42:57 +00:00
static void M_HandleLevelPlatter ( INT32 choice ) ;
2014-03-15 16:59:03 +00:00
static void M_HandleSoundTest ( INT32 choice ) ;
static void M_HandleImageDef ( INT32 choice ) ;
static void M_HandleLoadSave ( INT32 choice ) ;
static void M_HandleLevelStats ( INT32 choice ) ;
# ifndef NONET
2017-07-25 17:34:13 +00:00
static boolean M_CancelConnect ( void ) ;
2014-03-15 16:59:03 +00:00
static void M_HandleConnectIP ( INT32 choice ) ;
# endif
static void M_HandleSetupMultiPlayer ( INT32 choice ) ;
# ifdef HWRENDER
static void M_HandleFogColor ( INT32 choice ) ;
# endif
static void M_HandleVideoMode ( INT32 choice ) ;
2017-04-19 21:24:28 +00:00
static void M_ResetCvars ( void ) ;
2014-03-15 16:59:03 +00:00
// Consvar onchange functions
static void Newgametype_OnChange ( void ) ;
static void Dummymares_OnChange ( void ) ;
// ==========================================================================
// CONSOLE VARIABLES AND THEIR POSSIBLE VALUES GO HERE.
// ==========================================================================
2019-03-11 19:50:01 +00:00
consvar_t cv_showfocuslost = { " showfocuslost " , " Yes " , CV_SAVE , CV_YesNo , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
2014-03-15 16:59:03 +00:00
static CV_PossibleValue_t map_cons_t [ ] = {
{ 1 , " MIN " } ,
2019-10-28 11:34:20 +00:00
{ NUMMAPS , " MAX " } ,
{ 0 , NULL }
2014-03-15 16:59:03 +00:00
} ;
2014-04-14 05:14:58 +00:00
consvar_t cv_nextmap = { " nextmap " , " 1 " , CV_HIDEN | CV_CALL , map_cons_t , Nextmap_OnChange , 0 , NULL , NULL , 0 , 0 , NULL } ;
2014-03-15 16:59:03 +00:00
static CV_PossibleValue_t skins_cons_t [ MAXSKINS + 1 ] = { { 1 , DEFAULTSKIN } } ;
consvar_t cv_chooseskin = { " chooseskin " , DEFAULTSKIN , CV_HIDEN | CV_CALL , skins_cons_t , Nextmap_OnChange , 0 , NULL , NULL , 0 , 0 , NULL } ;
// This gametype list is integral for many different reasons.
2017-01-31 18:48:50 +00:00
// When you add gametypes here, don't forget to update them in dehacked.c and doomstat.h!
2017-06-25 16:28:07 +00:00
CV_PossibleValue_t gametype_cons_t [ NUMGAMETYPES + 1 ] ;
2014-03-15 16:59:03 +00:00
consvar_t cv_newgametype = { " newgametype " , " Co-op " , CV_HIDEN | CV_CALL , gametype_cons_t , Newgametype_OnChange , 0 , NULL , NULL , 0 , 0 , NULL } ;
static CV_PossibleValue_t serversort_cons_t [ ] = {
{ 0 , " Ping " } ,
2014-03-17 12:13:16 +00:00
{ 1 , " Modified State " } ,
{ 2 , " Most Players " } ,
{ 3 , " Least Players " } ,
2019-02-10 02:10:54 +00:00
{ 4 , " Max Player Slots " } ,
2014-03-17 12:13:16 +00:00
{ 5 , " Gametype " } ,
2014-03-15 16:59:03 +00:00
{ 0 , NULL }
} ;
consvar_t cv_serversort = { " serversort " , " Ping " , CV_HIDEN | CV_CALL , serversort_cons_t , M_SortServerList , 0 , NULL , NULL , 0 , 0 , NULL } ;
2018-11-10 07:30:21 +00:00
// first time memory
2018-11-13 00:10:41 +00:00
consvar_t cv_tutorialprompt = { " tutorialprompt " , " On " , CV_SAVE , CV_OnOff , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
2018-11-10 07:30:21 +00:00
2014-03-15 16:59:03 +00:00
// autorecord demos for time attack
static consvar_t cv_autorecord = { " autorecord " , " Yes " , 0 , CV_YesNo , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
CV_PossibleValue_t ghost_cons_t [ ] = { { 0 , " Hide " } , { 1 , " Show " } , { 2 , " Show All " } , { 0 , NULL } } ;
CV_PossibleValue_t ghost2_cons_t [ ] = { { 0 , " Hide " } , { 1 , " Show " } , { 0 , NULL } } ;
consvar_t cv_ghost_bestscore = { " ghost_bestscore " , " Show " , CV_SAVE , ghost_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
consvar_t cv_ghost_besttime = { " ghost_besttime " , " Show " , CV_SAVE , ghost_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
consvar_t cv_ghost_bestrings = { " ghost_bestrings " , " Show " , CV_SAVE , ghost_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
consvar_t cv_ghost_last = { " ghost_last " , " Show " , CV_SAVE , ghost_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
consvar_t cv_ghost_guest = { " ghost_guest " , " Show " , CV_SAVE , ghost2_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
//Console variables used solely in the menu system.
//todo: add a way to use non-console variables in the menu
// or make these consvars legitimate like color or skin.
static CV_PossibleValue_t dummyteam_cons_t [ ] = { { 0 , " Spectator " } , { 1 , " Red " } , { 2 , " Blue " } , { 0 , NULL } } ;
static CV_PossibleValue_t dummyscramble_cons_t [ ] = { { 0 , " Random " } , { 1 , " Points " } , { 0 , NULL } } ;
static CV_PossibleValue_t ringlimit_cons_t [ ] = { { 0 , " MIN " } , { 9999 , " MAX " } , { 0 , NULL } } ;
2019-10-15 10:49:37 +00:00
static CV_PossibleValue_t liveslimit_cons_t [ ] = { { 1 , " MIN " } , { 99 , " MAX " } , { - 1 , " Infinite " } , { 0 , NULL } } ;
static CV_PossibleValue_t contlimit_cons_t [ ] = { { 0 , " MIN " } , { 99 , " MAX " } , { 0 , NULL } } ;
2014-03-15 16:59:03 +00:00
static CV_PossibleValue_t dummymares_cons_t [ ] = {
{ - 1 , " END " } , { 0 , " Overall " } , { 1 , " Mare 1 " } , { 2 , " Mare 2 " } , { 3 , " Mare 3 " } , { 4 , " Mare 4 " } , { 5 , " Mare 5 " } , { 6 , " Mare 6 " } , { 7 , " Mare 7 " } , { 8 , " Mare 8 " } , { 0 , NULL }
} ;
static consvar_t cv_dummyteam = { " dummyteam " , " Spectator " , CV_HIDEN , dummyteam_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
static consvar_t cv_dummyscramble = { " dummyscramble " , " Random " , CV_HIDEN , dummyscramble_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
static consvar_t cv_dummyrings = { " dummyrings " , " 0 " , CV_HIDEN , ringlimit_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
static consvar_t cv_dummylives = { " dummylives " , " 0 " , CV_HIDEN , liveslimit_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
2019-10-15 10:49:37 +00:00
static consvar_t cv_dummycontinues = { " dummycontinues " , " 0 " , CV_HIDEN , contlimit_cons_t , NULL , 0 , NULL , NULL , 0 , 0 , NULL } ;
2014-03-15 16:59:03 +00:00
static consvar_t cv_dummymares = { " dummymares " , " Overall " , CV_HIDEN | CV_CALL , dummymares_cons_t , Dummymares_OnChange , 0 , NULL , NULL , 0 , 0 , NULL } ;
// ==========================================================================
// ORGANIZATION START.
// ==========================================================================
// Note: Never should we be jumping from one category of menu options to another
// without first going to the Main Menu.
// Note: Ignore the above if you're working with the Pause menu.
// Note: (Prefix)_MainMenu should be the target of all Main Menu options that
// point to submenus.
// ---------
// Main Menu
// ---------
static menuitem_t MainMenu [ ] =
{
2019-11-20 23:34:58 +00:00
{ IT_STRING | IT_CALL , NULL , " 1 Player " , M_SinglePlayerMenu , 76 } ,
2017-07-25 17:34:13 +00:00
# ifndef NONET
2019-11-20 23:34:58 +00:00
{ IT_STRING | IT_SUBMENU , NULL , " Multiplayer " , & MP_MainDef , 84 } ,
2017-07-25 17:34:13 +00:00
# else
2019-11-20 23:34:58 +00:00
{ IT_STRING | IT_CALL , NULL , " Multiplayer " , M_StartSplitServerMenu , 84 } ,
2017-07-25 17:34:13 +00:00
# endif
2019-11-21 00:34:32 +00:00
{ IT_STRING | IT_CALL , NULL , " Extras " , M_SecretsMenu , 92 } ,
2019-11-20 23:34:58 +00:00
{ IT_CALL | IT_STRING , NULL , " Addons " , M_Addons , 100 } ,
{ IT_STRING | IT_CALL , NULL , " Options " , M_Options , 108 } ,
{ IT_STRING | IT_CALL , NULL , " Quit Game " , M_QuitSRB2 , 116 } ,
2014-03-15 16:59:03 +00:00
} ;
typedef enum
{
2019-11-22 19:37:35 +00:00
singleplr = 0 ,
2014-03-15 16:59:03 +00:00
multiplr ,
2019-11-22 19:37:35 +00:00
secrets ,
2017-04-29 15:40:07 +00:00
addons ,
2019-11-21 01:19:31 +00:00
options ,
2014-03-15 16:59:03 +00:00
quitdoom
} main_e ;
2017-04-29 15:40:07 +00:00
static menuitem_t MISC_AddonsMenu [ ] =
{
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleAddons , 0 } , // dummy menuitem for the control func
} ;
2014-03-15 16:59:03 +00:00
// ---------------------------------
// Pause Menu Mode Attacking Edition
// ---------------------------------
static menuitem_t MAPauseMenu [ ] =
{
{ IT_CALL | IT_STRING , NULL , " Continue " , M_SelectableClearMenus , 48 } ,
{ IT_CALL | IT_STRING , NULL , " Retry " , M_ModeAttackRetry , 56 } ,
{ IT_CALL | IT_STRING , NULL , " Abort " , M_ModeAttackEndGame , 64 } ,
} ;
typedef enum
{
mapause_continue ,
mapause_retry ,
mapause_abort
} mapause_e ;
// ---------------------
// Pause Menu MP Edition
// ---------------------
static menuitem_t MPauseMenu [ ] =
{
2017-05-08 20:43:56 +00:00
{ IT_STRING | IT_CALL , NULL , " Add-ons... " , M_Addons , 8 } ,
{ IT_STRING | IT_SUBMENU , NULL , " Scramble Teams... " , & MISC_ScrambleTeamDef , 16 } ,
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CALL , NULL , " Switch Gametype/Level... " , M_MapChange , 24 } ,
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CALL , NULL , " Continue " , M_SelectableClearMenus , 40 } ,
{ IT_STRING | IT_CALL , NULL , " Player 1 Setup " , M_SetupMultiPlayer , 48 } , // splitscreen
{ IT_STRING | IT_CALL , NULL , " Player 2 Setup " , M_SetupMultiPlayer2 , 56 } , // splitscreen
2014-03-15 16:59:03 +00:00
2017-01-31 23:56:09 +00:00
{ IT_STRING | IT_CALL , NULL , " Spectate " , M_ConfirmSpectate , 48 } ,
{ IT_STRING | IT_CALL , NULL , " Enter Game " , M_ConfirmEnterGame , 48 } ,
{ IT_STRING | IT_SUBMENU , NULL , " Switch Team... " , & MISC_ChangeTeamDef , 48 } ,
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CALL , NULL , " Player Setup " , M_SetupMultiPlayer , 56 } , // alone
{ IT_STRING | IT_CALL , NULL , " Options " , M_Options , 64 } ,
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CALL , NULL , " Return to Title " , M_EndGame , 80 } ,
{ IT_STRING | IT_CALL , NULL , " Quit Game " , M_QuitSRB2 , 88 } ,
2014-03-15 16:59:03 +00:00
} ;
typedef enum
{
2017-05-08 20:43:56 +00:00
mpause_addons = 0 ,
mpause_scramble ,
2014-03-15 16:59:03 +00:00
mpause_switchmap ,
mpause_continue ,
mpause_psetupsplit ,
mpause_psetupsplit2 ,
mpause_spectate ,
mpause_entergame ,
mpause_switchteam ,
mpause_psetup ,
mpause_options ,
mpause_title ,
mpause_quit
} mpause_e ;
// ---------------------
// Pause Menu SP Edition
// ---------------------
static menuitem_t SPauseMenu [ ] =
{
// Pandora's Box will be shifted up if both options are available
{ IT_CALL | IT_STRING , NULL , " Pandora's Box... " , M_PandorasBox , 16 } ,
{ IT_CALL | IT_STRING , NULL , " Emblem Hints... " , M_EmblemHints , 24 } ,
{ IT_CALL | IT_STRING , NULL , " Level Select... " , M_LoadGameLevelSelect , 32 } ,
{ IT_CALL | IT_STRING , NULL , " Continue " , M_SelectableClearMenus , 48 } ,
{ IT_CALL | IT_STRING , NULL , " Retry " , M_Retry , 56 } ,
{ IT_CALL | IT_STRING , NULL , " Options " , M_Options , 64 } ,
{ IT_CALL | IT_STRING , NULL , " Return to Title " , M_EndGame , 80 } ,
{ IT_CALL | IT_STRING , NULL , " Quit Game " , M_QuitSRB2 , 88 } ,
} ;
typedef enum
{
spause_pandora = 0 ,
spause_hints ,
spause_levelselect ,
spause_continue ,
spause_retry ,
spause_options ,
2017-04-29 15:40:07 +00:00
2014-03-15 16:59:03 +00:00
spause_title ,
spause_quit
} spause_e ;
// -----------------
// Misc menu options
// -----------------
// Prefix: MISC_
static menuitem_t MISC_ScrambleTeamMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Scramble Method " , & cv_dummyscramble , 30 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Confirm " , M_ConfirmTeamScramble , 90 } ,
} ;
static menuitem_t MISC_ChangeTeamMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Select Team " , & cv_dummyteam , 30 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Confirm " , M_ConfirmTeamChange , 90 } ,
} ;
2017-02-18 17:09:03 +00:00
static const gtdesc_t gametypedesc [ ] =
{
2017-09-15 19:34:46 +00:00
{ { 54 , 54 } , " Play through the single-player campaign with your friends, teaming up to beat Dr Eggman's nefarious challenges! " } ,
{ { 103 , 103 } , " Speed your way through the main acts, competing in several different categories to see who's the best. " } ,
{ { 190 , 190 } , " There's not much to it - zoom through the level faster than everyone else. " } ,
{ { 66 , 66 } , " Sling rings at your foes in a free-for-all battle. Use the special weapon rings to your advantage! " } ,
{ { 153 , 37 } , " Sling rings at your foes in a color-coded battle. Use the special weapon rings to your advantage! " } ,
{ { 123 , 123 } , " Whoever's IT has to hunt down everyone else. If you get caught, you have to turn on your former friends! " } ,
2017-10-18 21:18:43 +00:00
{ { 150 , 150 } , " Try and find a good hiding place in these maps - we dare you. " } ,
2017-09-15 19:34:46 +00:00
{ { 37 , 153 } , " Steal the flag from the enemy's base and bring it back to your own, but watch out - they could just as easily steal yours! " } ,
2017-02-18 17:09:03 +00:00
} ;
2014-03-15 16:59:03 +00:00
static menuitem_t MISC_ChangeLevelMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLevelPlatter , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t MISC_HelpMenu [ ] =
{
{ IT_KEYHANDLER | IT_NOTHING , NULL , " HELPN01 " , M_HandleImageDef , 0 } ,
{ IT_KEYHANDLER | IT_NOTHING , NULL , " HELPN02 " , M_HandleImageDef , 0 } ,
{ IT_KEYHANDLER | IT_NOTHING , NULL , " HELPN03 " , M_HandleImageDef , 0 } ,
{ IT_KEYHANDLER | IT_NOTHING , NULL , " HELPM01 " , M_HandleImageDef , 0 } ,
{ IT_KEYHANDLER | IT_NOTHING , NULL , " HELPM02 " , M_HandleImageDef , 0 } ,
} ;
// --------------------------------
// Sky Room and all of its submenus
// --------------------------------
// Prefix: SR_
// Pause Menu Pandora's Box Options
static menuitem_t SR_PandorasBox [ ] =
{
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CALL , NULL , " Mid-game add-ons... " , M_Addons , 0 } ,
2014-03-15 16:59:03 +00:00
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CVAR , NULL , " Rings " , & cv_dummyrings , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Lives " , & cv_dummylives , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Continues " , & cv_dummycontinues , 40 } ,
2014-03-15 16:59:03 +00:00
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CVAR , NULL , " Gravity " , & cv_gravity , 60 } ,
{ IT_STRING | IT_CVAR , NULL , " Throw Rings " , & cv_ringslinger , 70 } ,
2014-03-15 16:59:03 +00:00
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CALL , NULL , " Enable Super form " , M_AllowSuper , 90 } ,
{ IT_STRING | IT_CALL , NULL , " Get All Emeralds " , M_GetAllEmeralds , 100 } ,
{ IT_STRING | IT_CALL , NULL , " Destroy All Robots " , M_DestroyRobots , 110 } ,
2014-03-15 16:59:03 +00:00
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CALL , NULL , " Ultimate Cheat " , M_UltimateCheat , 130 } ,
2014-03-15 16:59:03 +00:00
} ;
// Sky Room Custom Unlocks
static menuitem_t SR_MainMenu [ ] =
{
2019-11-21 00:34:32 +00:00
{ IT_STRING | IT_SUBMENU , NULL , " Extras Checklist " , & SR_UnlockChecklistDef , 0 } ,
2014-03-15 16:59:03 +00:00
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom1
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom2
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom3
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom4
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom5
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom6
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom7
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom8
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom9
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom10
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom11
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom12
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom13
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom14
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom15
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom16
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom17
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom18
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom19
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom20
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom21
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom22
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom23
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom24
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom25
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom26
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom27
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom28
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom29
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom30
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom31
{ IT_DISABLED , NULL , " " , NULL , 0 } , // Custom32
} ;
static menuitem_t SR_LevelSelectMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLevelPlatter , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t SR_UnlockChecklistMenu [ ] =
{
2017-04-22 23:16:09 +00:00
{ IT_KEYHANDLER | IT_STRING , NULL , " " , M_HandleChecklist , 0 } ,
2014-03-15 16:59:03 +00:00
} ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
static menuitem_t SR_SoundTestMenu [ ] =
{
{ IT_KEYHANDLER | IT_STRING , NULL , " " , M_HandleSoundTest , 0 } ,
} ;
2014-03-15 16:59:03 +00:00
static menuitem_t SR_EmblemHintMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Emblem Radar " , & cv_itemfinder , 10 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SPauseDef , 20 }
} ;
// --------------------------------
// 1 Player and all of its submenus
// --------------------------------
// Prefix: SP_
// Single Player Main
static menuitem_t SP_MainMenu [ ] =
{
2019-11-21 01:43:07 +00:00
{ IT_CALL | IT_STRING , NULL , " Start Game " , M_LoadGame , 84 } ,
{ IT_SECRET , NULL , " Record Attack " , M_TimeAttack , 92 } ,
{ IT_SECRET , NULL , " NiGHTS Mode " , M_NightsAttack , 100 } ,
{ IT_CALL | IT_STRING | IT_CALL_NOTMODIFIED , NULL , " Statistics " , M_Statistics , 108 } ,
{ IT_CALL | IT_STRING , NULL , " Tutorial " , M_StartTutorial , 116 } ,
2014-03-15 16:59:03 +00:00
} ;
enum
{
sploadgame ,
sprecordattack ,
spnightsmode ,
2019-11-21 01:43:07 +00:00
spstatistics ,
sptutorial
2014-03-15 16:59:03 +00:00
} ;
// Single Player Load Game
static menuitem_t SP_LoadGameMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLoadSave , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
// Single Player Level Select
static menuitem_t SP_LevelSelectMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLevelPlatter , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
2017-01-28 13:13:03 +00:00
// Single Player Time Attack Level Select
static menuitem_t SP_TimeAttackLevelSelectMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLevelPlatter , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
// Single Player Time Attack
static menuitem_t SP_TimeAttackMenu [ ] =
{
2019-10-16 02:54:21 +00:00
{ IT_STRING | IT_KEYHANDLER , NULL , " Level Select... " , M_HandleTimeAttackLevelSelect , 62 } ,
{ IT_STRING | IT_CVAR , NULL , " Character " , & cv_chooseskin , 72 } ,
2014-03-15 16:59:03 +00:00
{ IT_DISABLED , NULL , " Guest Option... " , & SP_GuestReplayDef , 100 } ,
2017-01-29 19:25:43 +00:00
{ IT_DISABLED , NULL , " Replay... " , & SP_ReplayDef , 110 } ,
{ IT_DISABLED , NULL , " Ghosts... " , & SP_GhostDef , 120 } ,
2016-08-20 05:18:43 +00:00
{ IT_WHITESTRING | IT_CALL | IT_CALL_NOTMODIFIED , NULL , " Start " , M_ChooseTimeAttack , 130 } ,
2014-03-15 16:59:03 +00:00
} ;
enum
{
talevel ,
taplayer ,
taguest ,
tareplay ,
taghost ,
tastart
} ;
static menuitem_t SP_ReplayMenu [ ] =
{
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Best Score " , M_ReplayTimeAttack , 0 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Best Time " , M_ReplayTimeAttack , 8 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Best Rings " , M_ReplayTimeAttack , 16 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Last " , M_ReplayTimeAttack , 29 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Guest " , M_ReplayTimeAttack , 37 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SP_TimeAttackDef , 50 }
} ;
2014-11-12 00:55:07 +00:00
static menuitem_t SP_NightsReplayMenu [ ] =
{
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Best Score " , M_ReplayTimeAttack , 8 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Best Time " , M_ReplayTimeAttack , 16 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Last " , M_ReplayTimeAttack , 29 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Replay Guest " , M_ReplayTimeAttack , 37 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SP_NightsAttackDef , 50 }
} ;
2014-03-15 16:59:03 +00:00
static menuitem_t SP_GuestReplayMenu [ ] =
{
{ IT_WHITESTRING | IT_CALL , NULL , " Save Best Score as Guest " , M_SetGuestReplay , 0 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Save Best Time as Guest " , M_SetGuestReplay , 8 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Save Best Rings as Guest " , M_SetGuestReplay , 16 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Save Last as Guest " , M_SetGuestReplay , 24 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Delete Guest Replay " , M_SetGuestReplay , 37 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SP_TimeAttackDef , 50 }
} ;
2014-11-12 00:55:07 +00:00
static menuitem_t SP_NightsGuestReplayMenu [ ] =
{
{ IT_WHITESTRING | IT_CALL , NULL , " Save Best Score as Guest " , M_SetGuestReplay , 8 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Save Best Time as Guest " , M_SetGuestReplay , 16 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Save Last as Guest " , M_SetGuestReplay , 24 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Delete Guest Replay " , M_SetGuestReplay , 37 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SP_NightsAttackDef , 50 }
} ;
2014-03-15 16:59:03 +00:00
static menuitem_t SP_GhostMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Best Score " , & cv_ghost_bestscore , 0 } ,
{ IT_STRING | IT_CVAR , NULL , " Best Time " , & cv_ghost_besttime , 8 } ,
{ IT_STRING | IT_CVAR , NULL , " Best Rings " , & cv_ghost_bestrings , 16 } ,
{ IT_STRING | IT_CVAR , NULL , " Last " , & cv_ghost_last , 24 } ,
{ IT_STRING | IT_CVAR , NULL , " Guest " , & cv_ghost_guest , 37 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SP_TimeAttackDef , 50 }
} ;
2014-11-12 00:55:07 +00:00
static menuitem_t SP_NightsGhostMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Best Score " , & cv_ghost_bestscore , 8 } ,
{ IT_STRING | IT_CVAR , NULL , " Best Time " , & cv_ghost_besttime , 16 } ,
{ IT_STRING | IT_CVAR , NULL , " Last " , & cv_ghost_last , 24 } ,
{ IT_STRING | IT_CVAR , NULL , " Guest " , & cv_ghost_guest , 37 } ,
{ IT_WHITESTRING | IT_SUBMENU , NULL , " Back " , & SP_NightsAttackDef , 50 }
} ;
2017-01-28 13:13:03 +00:00
// Single Player Nights Attack Level Select
static menuitem_t SP_NightsAttackLevelSelectMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLevelPlatter , 0 } , // dummy menuitem for the control func
2017-01-28 13:13:03 +00:00
} ;
2014-03-15 16:59:03 +00:00
// Single Player Nights Attack
static menuitem_t SP_NightsAttackMenu [ ] =
{
2017-02-10 14:54:05 +00:00
{ IT_STRING | IT_CALL , NULL , " Level Select... " , & M_NightsAttackLevelSelect , 52 } ,
{ IT_STRING | IT_CVAR , NULL , " Show Records For " , & cv_dummymares , 62 } ,
2014-11-12 00:55:07 +00:00
2017-02-10 14:54:05 +00:00
{ IT_DISABLED , NULL , " Guest Option... " , & SP_NightsGuestReplayDef , 100 } ,
{ IT_DISABLED , NULL , " Replay... " , & SP_NightsReplayDef , 110 } ,
{ IT_DISABLED , NULL , " Ghosts... " , & SP_NightsGhostDef , 120 } ,
2017-01-29 22:00:07 +00:00
{ IT_WHITESTRING | IT_CALL | IT_CALL_NOTMODIFIED , NULL , " Start " , M_ChooseNightsAttack , 130 } ,
2014-03-15 16:59:03 +00:00
} ;
enum
{
nalevel ,
narecords ,
2014-11-12 00:55:07 +00:00
naguest ,
nareplay ,
naghost ,
2014-03-15 16:59:03 +00:00
nastart
} ;
// Statistics
static menuitem_t SP_LevelStatsMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleLevelStats , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
2017-03-17 14:27:17 +00:00
// Player menu dummy
2017-03-17 16:47:37 +00:00
static menuitem_t SP_PlayerMenu [ ] =
2017-03-17 14:27:17 +00:00
{
{ IT_NOTHING | IT_KEYHANDLER , NULL , " " , M_HandleChoosePlayerMenu , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
// -----------------------------------
// Multiplayer and all of its submenus
// -----------------------------------
// Prefix: MP_
2017-07-25 17:34:13 +00:00
// Separated splitscreen and normal servers.
static menuitem_t MP_SplitServerMenu [ ] =
2014-03-15 16:59:03 +00:00
{
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CALL , NULL , " Select Gametype/Level... " , M_MapChange , 100 } ,
2017-07-25 17:34:13 +00:00
# ifdef NONET // In order to keep player setup accessible.
{ IT_STRING | IT_CALL , NULL , " Player 1 setup... " , M_SetupMultiPlayer , 110 } ,
{ IT_STRING | IT_CALL , NULL , " Player 2 setup... " , M_SetupMultiPlayer2 , 120 } ,
2014-03-15 16:59:03 +00:00
# endif
2017-07-25 17:34:13 +00:00
{ IT_STRING | IT_CALL , NULL , " More Options... " , M_ServerOptions , 130 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Start " , M_StartServer , 140 } ,
} ;
2014-03-15 16:59:03 +00:00
2017-07-25 17:34:13 +00:00
# ifndef NONET
static menuitem_t MP_MainMenu [ ] =
{
2019-08-27 01:49:12 +00:00
{ IT_HEADER , NULL , " Join a game " , NULL , 0 } ,
2019-08-29 00:24:30 +00:00
{ IT_STRING | IT_CALL , NULL , " Server browser... " , M_ConnectMenuModChecks , 12 } ,
2019-08-27 01:49:12 +00:00
{ IT_STRING | IT_KEYHANDLER , NULL , " Specify IPv4 address: " , M_HandleConnectIP , 22 } ,
{ IT_HEADER , NULL , " Host a game " , NULL , 54 } ,
{ IT_STRING | IT_CALL , NULL , " Internet/LAN... " , M_StartServerMenu , 66 } ,
{ IT_STRING | IT_CALL , NULL , " Splitscreen... " , M_StartSplitServerMenu , 76 } ,
2017-07-25 17:34:13 +00:00
{ IT_HEADER , NULL , " Player setup " , NULL , 94 } ,
{ IT_STRING | IT_CALL , NULL , " Player 1... " , M_SetupMultiPlayer , 106 } ,
{ IT_STRING | IT_CALL , NULL , " Player 2... " , M_SetupMultiPlayer2 , 116 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t MP_ServerMenu [ ] =
{
2017-07-25 17:34:13 +00:00
{ IT_STRING | IT_CALL , NULL , " Room... " , M_RoomMenu , 10 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " Server Name " , & cv_servername , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Max Players " , & cv_maxplayers , 46 } ,
{ IT_STRING | IT_CVAR , NULL , " Allow Add-on Downloading " , & cv_downloading , 56 } ,
2017-09-15 19:34:46 +00:00
{ IT_STRING | IT_CALL , NULL , " Select Gametype/Level... " , M_MapChange , 100 } ,
2017-07-25 17:34:13 +00:00
{ IT_STRING | IT_CALL , NULL , " More Options... " , M_ServerOptions , 130 } ,
{ IT_WHITESTRING | IT_CALL , NULL , " Start " , M_StartServer , 140 } ,
2014-03-15 16:59:03 +00:00
} ;
enum
{
2017-07-25 17:34:13 +00:00
mp_server_room = 0 ,
2014-03-15 16:59:03 +00:00
mp_server_name ,
2017-02-01 17:21:04 +00:00
mp_server_maxpl ,
mp_server_waddl ,
2017-01-31 23:56:09 +00:00
mp_server_levelgt ,
2017-02-01 17:21:04 +00:00
mp_server_options ,
2014-03-15 16:59:03 +00:00
mp_server_start
} ;
static menuitem_t MP_ConnectMenu [ ] =
{
{ IT_STRING | IT_CALL , NULL , " Room... " , M_RoomMenu , 4 } ,
{ IT_STRING | IT_CVAR , NULL , " Sort By " , & cv_serversort , 12 } ,
{ IT_STRING | IT_KEYHANDLER , NULL , " Page " , M_HandleServerPage , 20 } ,
{ IT_STRING | IT_CALL , NULL , " Refresh " , M_Refresh , 28 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 48 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 60 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 72 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 84 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 96 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 108 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 120 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 132 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 144 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 156 - 4 } ,
{ IT_STRING | IT_SPACE , NULL , " " , M_Connect , 168 - 4 } ,
} ;
enum
{
mp_connect_room ,
mp_connect_sort ,
mp_connect_page ,
mp_connect_refresh ,
FIRSTSERVERLINE
} ;
static menuitem_t MP_RoomMenu [ ] =
{
2019-08-30 04:38:58 +00:00
{ IT_STRING | IT_CALL , NULL , " <Unlisted Mode> " , M_ChooseRoom , 9 } ,
2014-03-15 16:59:03 +00:00
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 18 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 27 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 36 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 45 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 54 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 63 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 72 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 81 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 90 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 99 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 108 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 117 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 126 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 135 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 144 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 153 } ,
{ IT_DISABLED , NULL , " " , M_ChooseRoom , 162 } ,
} ;
# endif
static menuitem_t MP_PlayerSetupMenu [ ] =
{
2017-07-25 17:34:13 +00:00
{ IT_KEYHANDLER , NULL , " " , M_HandleSetupMultiPlayer , 0 } , // name
{ IT_KEYHANDLER , NULL , " " , M_HandleSetupMultiPlayer , 0 } , // skin
{ IT_KEYHANDLER , NULL , " " , M_HandleSetupMultiPlayer , 0 } , // colour
{ IT_KEYHANDLER , NULL , " " , M_HandleSetupMultiPlayer , 0 } , // default
2014-03-15 16:59:03 +00:00
} ;
// ------------------------------------
// Options and most (?) of its submenus
// ------------------------------------
// Prefix: OP_
static menuitem_t OP_MainMenu [ ] =
{
2017-04-17 00:09:47 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Player 1 Controls... " , & OP_P1ControlsDef , 10 } ,
{ IT_SUBMENU | IT_STRING , NULL , " Player 2 Controls... " , & OP_P2ControlsDef , 20 } ,
{ IT_CVAR | IT_STRING , NULL , " Controls per key " , & cv_controlperkey , 30 } ,
2014-03-15 16:59:03 +00:00
2017-04-17 00:09:47 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Video Options... " , & OP_VideoOptionsDef , 50 } ,
2019-01-07 07:31:45 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Sound Options... " , & OP_SoundOptionsDef , 60 } ,
2014-03-15 16:59:03 +00:00
2017-04-17 00:09:47 +00:00
{ IT_CALL | IT_STRING , NULL , " Server Options... " , M_ServerOptions , 80 } ,
2014-03-15 16:59:03 +00:00
2017-04-17 00:09:47 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Data Options... " , & OP_DataOptionsDef , 100 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_P1ControlsMenu [ ] =
{
{ IT_CALL | IT_STRING , NULL , " Control Configuration... " , M_Setup1PControlsMenu , 10 } ,
{ IT_SUBMENU | IT_STRING , NULL , " Mouse Options... " , & OP_MouseOptionsDef , 20 } ,
2017-09-19 04:33:53 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Gamepad Options... " , & OP_Joystick1Def , 30 } ,
2014-03-15 16:59:03 +00:00
2019-09-19 09:34:04 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Camera Options... " , & OP_CameraOptionsDef , 50 } ,
2014-03-15 16:59:03 +00:00
2019-06-20 11:33:31 +00:00
//{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 100},
2019-09-19 09:34:04 +00:00
{ IT_STRING | IT_CVAR , NULL , " Character angle " , & cv_directionchar , 70 } ,
{ IT_STRING | IT_CVAR , NULL , " Automatic braking " , & cv_autobrake , 80 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_P2ControlsMenu [ ] =
{
{ IT_CALL | IT_STRING , NULL , " Control Configuration... " , M_Setup2PControlsMenu , 10 } ,
{ IT_SUBMENU | IT_STRING , NULL , " Second Mouse Options... " , & OP_Mouse2OptionsDef , 20 } ,
2017-09-19 04:33:53 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Second Gamepad Options... " , & OP_Joystick2Def , 30 } ,
2014-03-15 16:59:03 +00:00
2019-09-19 09:34:04 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Camera Options... " , & OP_Camera2OptionsDef , 50 } ,
2014-03-15 16:59:03 +00:00
2019-06-20 11:33:31 +00:00
//{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 100},
2019-09-19 09:34:04 +00:00
{ IT_STRING | IT_CVAR , NULL , " Character angle " , & cv_directionchar2 , 70 } ,
{ IT_STRING | IT_CVAR , NULL , " Automatic braking " , & cv_autobrake2 , 80 } ,
2014-03-15 16:59:03 +00:00
} ;
2017-04-14 23:15:09 +00:00
static menuitem_t OP_ChangeControlsMenu [ ] =
{
2017-04-15 20:40:30 +00:00
{ IT_HEADER , NULL , " Movement " , NULL , 0 } ,
{ IT_SPACE , NULL , NULL , NULL , 0 } , // padding
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Move Forward " , M_ChangeControl , gc_forward } ,
{ IT_CALL | IT_STRING2 , NULL , " Move Backward " , M_ChangeControl , gc_backward } ,
{ IT_CALL | IT_STRING2 , NULL , " Move Left " , M_ChangeControl , gc_strafeleft } ,
{ IT_CALL | IT_STRING2 , NULL , " Move Right " , M_ChangeControl , gc_straferight } ,
2017-10-25 22:34:20 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Jump " , M_ChangeControl , gc_jump } ,
{ IT_CALL | IT_STRING2 , NULL , " Spin " , M_ChangeControl , gc_use } ,
2017-04-15 20:40:30 +00:00
{ IT_HEADER , NULL , " Camera " , NULL , 0 } ,
{ IT_SPACE , NULL , NULL , NULL , 0 } , // padding
2018-11-22 16:28:32 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Look Up " , M_ChangeControl , gc_lookup } ,
{ IT_CALL | IT_STRING2 , NULL , " Look Down " , M_ChangeControl , gc_lookdown } ,
{ IT_CALL | IT_STRING2 , NULL , " Look Left " , M_ChangeControl , gc_turnleft } ,
{ IT_CALL | IT_STRING2 , NULL , " Look Right " , M_ChangeControl , gc_turnright } ,
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Center View " , M_ChangeControl , gc_centerview } ,
{ IT_CALL | IT_STRING2 , NULL , " Toggle Mouselook " , M_ChangeControl , gc_mouseaiming } ,
2017-04-15 14:42:03 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Toggle Third-Person " , M_ChangeControl , gc_camtoggle } ,
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Reset Camera " , M_ChangeControl , gc_camreset } ,
2017-04-15 20:40:30 +00:00
{ IT_HEADER , NULL , " Meta " , NULL , 0 } ,
{ IT_SPACE , NULL , NULL , NULL , 0 } , // padding
{ IT_CALL | IT_STRING2 , NULL , " Game Status " ,
M_ChangeControl , gc_scores } ,
2019-01-07 07:31:45 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Pause / Run Retry " , M_ChangeControl , gc_pause } ,
{ IT_CALL | IT_STRING2 , NULL , " Screenshot " , M_ChangeControl , gc_screenshot } ,
{ IT_CALL | IT_STRING2 , NULL , " Toggle GIF Recording " , M_ChangeControl , gc_recordgif } ,
{ IT_CALL | IT_STRING2 , NULL , " Open/Close Menu (ESC) " , M_ChangeControl , gc_systemmenu } ,
{ IT_CALL | IT_STRING2 , NULL , " Change Viewpoint " , M_ChangeControl , gc_viewpoint } ,
2017-04-15 20:40:30 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Console " , M_ChangeControl , gc_console } ,
{ IT_HEADER , NULL , " Multiplayer " , NULL , 0 } ,
{ IT_SPACE , NULL , NULL , NULL , 0 } , // padding
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Talk " , M_ChangeControl , gc_talkkey } ,
{ IT_CALL | IT_STRING2 , NULL , " Talk (Team only) " , M_ChangeControl , gc_teamkey } ,
2017-04-15 20:40:30 +00:00
{ IT_HEADER , NULL , " Ringslinger (Match, CTF, Tag, H&S) " , NULL , 0 } ,
{ IT_SPACE , NULL , NULL , NULL , 0 } , // padding
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Fire " , M_ChangeControl , gc_fire } ,
{ IT_CALL | IT_STRING2 , NULL , " Fire Normal " , M_ChangeControl , gc_firenormal } ,
{ IT_CALL | IT_STRING2 , NULL , " Toss Flag " , M_ChangeControl , gc_tossflag } ,
{ IT_CALL | IT_STRING2 , NULL , " Next Weapon " , M_ChangeControl , gc_weaponnext } ,
{ IT_CALL | IT_STRING2 , NULL , " Prev Weapon " , M_ChangeControl , gc_weaponprev } ,
2017-04-15 20:40:30 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Normal / Infinity " , M_ChangeControl , gc_wepslot1 } ,
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Automatic " , M_ChangeControl , gc_wepslot2 } ,
{ IT_CALL | IT_STRING2 , NULL , " Bounce " , M_ChangeControl , gc_wepslot3 } ,
{ IT_CALL | IT_STRING2 , NULL , " Scatter " , M_ChangeControl , gc_wepslot4 } ,
{ IT_CALL | IT_STRING2 , NULL , " Grenade " , M_ChangeControl , gc_wepslot5 } ,
{ IT_CALL | IT_STRING2 , NULL , " Explosion " , M_ChangeControl , gc_wepslot6 } ,
{ IT_CALL | IT_STRING2 , NULL , " Rail " , M_ChangeControl , gc_wepslot7 } ,
2017-04-29 15:40:07 +00:00
{ IT_HEADER , NULL , " Add-ons " , NULL , 0 } ,
2017-04-15 20:40:30 +00:00
{ IT_SPACE , NULL , NULL , NULL , 0 } , // padding
2017-04-14 23:15:09 +00:00
{ IT_CALL | IT_STRING2 , NULL , " Custom Action 1 " , M_ChangeControl , gc_custom1 } ,
{ IT_CALL | IT_STRING2 , NULL , " Custom Action 2 " , M_ChangeControl , gc_custom2 } ,
{ IT_CALL | IT_STRING2 , NULL , " Custom Action 3 " , M_ChangeControl , gc_custom3 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_Joystick1Menu [ ] =
{
2017-09-19 04:33:53 +00:00
{ IT_STRING | IT_CALL , NULL , " Select Gamepad... " , M_Setup1PJoystickMenu , 10 } ,
2017-07-04 12:17:29 +00:00
{ IT_STRING | IT_CVAR , NULL , " Move \x17 Axis " , & cv_moveaxis , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Move \x18 Axis " , & cv_sideaxis , 40 } ,
{ IT_STRING | IT_CVAR , NULL , " Camera \x17 Axis " , & cv_lookaxis , 50 } ,
{ IT_STRING | IT_CVAR , NULL , " Camera \x18 Axis " , & cv_turnaxis , 60 } ,
2017-09-18 02:30:48 +00:00
{ IT_STRING | IT_CVAR , NULL , " Jump Axis " , & cv_jumpaxis , 70 } ,
{ IT_STRING | IT_CVAR , NULL , " Spin Axis " , & cv_spinaxis , 80 } ,
{ IT_STRING | IT_CVAR , NULL , " Fire Axis " , & cv_fireaxis , 90 } ,
{ IT_STRING | IT_CVAR , NULL , " Fire Normal Axis " , & cv_firenaxis , 100 } ,
2018-12-03 09:21:19 +00:00
2018-12-16 22:45:49 +00:00
{ IT_STRING | IT_CVAR , NULL , " First-Person Vert-Look " , & cv_alwaysfreelook , 120 } ,
{ IT_STRING | IT_CVAR , NULL , " Third-Person Vert-Look " , & cv_chasefreelook , 130 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_Joystick2Menu [ ] =
{
2017-09-19 04:33:53 +00:00
{ IT_STRING | IT_CALL , NULL , " Select Gamepad... " , M_Setup2PJoystickMenu , 10 } ,
2017-07-04 12:17:29 +00:00
{ IT_STRING | IT_CVAR , NULL , " Move \x17 Axis " , & cv_moveaxis2 , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Move \x18 Axis " , & cv_sideaxis2 , 40 } ,
{ IT_STRING | IT_CVAR , NULL , " Camera \x17 Axis " , & cv_lookaxis2 , 50 } ,
{ IT_STRING | IT_CVAR , NULL , " Camera \x18 Axis " , & cv_turnaxis2 , 60 } ,
2017-09-18 02:30:48 +00:00
{ IT_STRING | IT_CVAR , NULL , " Jump Axis " , & cv_jumpaxis2 , 70 } ,
{ IT_STRING | IT_CVAR , NULL , " Spin Axis " , & cv_spinaxis2 , 80 } ,
{ IT_STRING | IT_CVAR , NULL , " Fire Axis " , & cv_fireaxis2 , 90 } ,
{ IT_STRING | IT_CVAR , NULL , " Fire Normal Axis " , & cv_firenaxis2 , 100 } ,
2018-12-16 22:45:49 +00:00
{ IT_STRING | IT_CVAR , NULL , " First-Person Vert-Look " , & cv_alwaysfreelook2 , 120 } ,
{ IT_STRING | IT_CVAR , NULL , " Third-Person Vert-Look " , & cv_chasefreelook2 , 130 } ,
2014-03-15 16:59:03 +00:00
} ;
2019-09-24 03:54:53 +00:00
static menuitem_t OP_JoystickSetMenu [ 1 + MAX_JOYSTICKS ] ;
2014-03-15 16:59:03 +00:00
static menuitem_t OP_MouseOptionsMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Use Mouse " , & cv_usemouse , 10 } ,
2018-11-22 22:32:03 +00:00
{ IT_STRING | IT_CVAR , NULL , " First-Person MouseLook " , & cv_alwaysfreelook , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Third-Person MouseLook " , & cv_chasefreelook , 40 } ,
{ IT_STRING | IT_CVAR , NULL , " Mouse Move " , & cv_mousemove , 50 } ,
2019-01-07 07:31:45 +00:00
{ IT_STRING | IT_CVAR , NULL , " Invert Y Axis " , & cv_invertmouse , 60 } ,
2014-03-15 16:59:03 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER ,
2019-01-07 07:31:45 +00:00
NULL , " Mouse X Sensitivity " , & cv_mousesens , 70 } ,
2015-01-01 19:50:31 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER ,
2019-01-07 07:31:45 +00:00
NULL , " Mouse Y Sensitivity " , & cv_mouseysens , 80 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_Mouse2OptionsMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Use Mouse 2 " , & cv_usemouse2 , 10 } ,
{ IT_STRING | IT_CVAR , NULL , " Second Mouse Serial Port " ,
& cv_mouse2port , 20 } ,
2018-11-22 22:32:03 +00:00
{ IT_STRING | IT_CVAR , NULL , " First-Person MouseLook " , & cv_alwaysfreelook2 , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Third-Person MouseLook " , & cv_chasefreelook2 , 40 } ,
{ IT_STRING | IT_CVAR , NULL , " Mouse Move " , & cv_mousemove2 , 50 } ,
2019-01-07 07:31:45 +00:00
{ IT_STRING | IT_CVAR , NULL , " Invert Y Axis " , & cv_invertmouse2 , 60 } ,
2014-03-15 16:59:03 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER ,
2019-01-07 07:31:45 +00:00
NULL , " Mouse X Sensitivity " , & cv_mousesens2 , 70 } ,
2015-01-01 19:50:31 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER ,
2019-01-07 07:31:45 +00:00
NULL , " Mouse Y Sensitivity " , & cv_mouseysens2 , 80 } ,
2014-03-15 16:59:03 +00:00
} ;
2019-09-19 09:34:04 +00:00
static menuitem_t OP_CameraOptionsMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Third-person Camera " , & cv_chasecam , 10 } ,
{ IT_STRING | IT_CVAR , NULL , " Flip Camera with Gravity " , & cv_flipcam , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Orbital Looking " , & cv_cam_orbit , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Downhill Slope Adjustment " , & cv_cam_adjust , 40 } ,
{ IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP , NULL , " Camera Distance " , & cv_cam_dist , 60 } ,
{ IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP , NULL , " Camera Height " , & cv_cam_height , 70 } ,
{ IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER , NULL , " Camera Speed " , & cv_cam_speed , 80 } ,
{ IT_STRING | IT_CVAR , NULL , " Crosshair " , & cv_crosshair , 100 } ,
} ;
static menuitem_t OP_Camera2OptionsMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Third-person Camera " , & cv_chasecam2 , 10 } ,
{ IT_STRING | IT_CVAR , NULL , " Flip Camera with Gravity " , & cv_flipcam2 , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Orbital Looking " , & cv_cam2_orbit , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Downhill Slope Adjustment " , & cv_cam2_adjust , 40 } ,
{ IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP , NULL , " Camera Distance " , & cv_cam2_dist , 60 } ,
{ IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP , NULL , " Camera Height " , & cv_cam2_height , 70 } ,
{ IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER , NULL , " Camera Speed " , & cv_cam2_speed , 80 } ,
{ IT_STRING | IT_CVAR , NULL , " Crosshair " , & cv_crosshair2 , 100 } ,
} ;
2014-03-15 16:59:03 +00:00
static menuitem_t OP_VideoOptionsMenu [ ] =
{
2017-04-20 18:27:19 +00:00
{ IT_HEADER , NULL , " Screen " , NULL , 0 } ,
{ IT_STRING | IT_CALL , NULL , " Set Resolution... " , M_VideoModeMenu , 6 } ,
2014-03-15 16:59:03 +00:00
2017-04-18 22:21:10 +00:00
# if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
2017-04-20 18:27:19 +00:00
{ IT_STRING | IT_CVAR , NULL , " Fullscreen " , & cv_fullscreen , 11 } ,
2014-03-15 16:59:03 +00:00
# endif
2017-04-20 18:27:19 +00:00
{ IT_STRING | IT_CVAR , NULL , " Vertical Sync " , & cv_vidwait , 16 } ,
2014-03-15 16:59:03 +00:00
2017-04-18 22:21:10 +00:00
# ifdef HWRENDER
2017-04-20 19:16:10 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " OpenGL Options... " , & OP_OpenGLOptionsDef , 21 } ,
2014-03-15 16:59:03 +00:00
# endif
2017-04-20 18:27:19 +00:00
{ IT_HEADER , NULL , " Color Profile " , NULL , 30 } ,
2018-04-06 17:40:08 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness (F11) " , & cv_globalgamma , 36 } ,
2017-04-20 18:27:19 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_globalsaturation , 41 } ,
{ IT_SUBMENU | IT_STRING , NULL , " Advanced Settings... " , & OP_ColorOptionsDef , 46 } ,
2017-04-15 13:05:51 +00:00
2017-04-20 19:16:10 +00:00
{ IT_HEADER , NULL , " Heads-Up Display " , NULL , 55 } ,
2017-04-20 18:27:19 +00:00
{ IT_STRING | IT_CVAR , NULL , " Show HUD " , & cv_showhud , 61 } ,
2014-03-15 16:59:03 +00:00
{ IT_STRING | IT_CVAR | IT_CV_SLIDER ,
2017-04-20 18:27:19 +00:00
NULL , " HUD Transparency " , & cv_translucenthud , 66 } ,
2018-03-26 22:53:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Score/Time/Rings " , & cv_timetic , 71 } ,
{ IT_STRING | IT_CVAR , NULL , " Show Powerups " , & cv_powerupdisplay , 76 } ,
2019-11-18 01:22:47 +00:00
{ IT_STRING | IT_CVAR , NULL , " Local ping display " , & cv_showping , 81 } , // shows ping next to framerate if we want to.
2017-04-15 13:05:51 +00:00
# ifdef SEENAMES
2019-11-18 01:22:47 +00:00
{ IT_STRING | IT_CVAR , NULL , " Show player names " , & cv_seenames , 86 } ,
2017-04-15 13:05:51 +00:00
# endif
2019-11-18 01:22:47 +00:00
{ IT_HEADER , NULL , " Console " , NULL , 95 } ,
{ IT_STRING | IT_CVAR , NULL , " Background color " , & cons_backcolor , 101 } ,
{ IT_STRING | IT_CVAR , NULL , " Text Size " , & cv_constextsize , 106 } ,
{ IT_HEADER , NULL , " Chat " , NULL , 115 } ,
{ IT_STRING | IT_CVAR , NULL , " Chat Mode " , & cv_consolechat , 121 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Chat Box Width " , & cv_chatwidth , 126 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Chat Box Height " , & cv_chatheight , 131 } ,
{ IT_STRING | IT_CVAR , NULL , " Message Fadeout Time " , & cv_chattime , 136 } ,
{ IT_STRING | IT_CVAR , NULL , " Chat Notifications " , & cv_chatnotifications , 141 } ,
{ IT_STRING | IT_CVAR , NULL , " Spam Protection " , & cv_chatspamprotection , 146 } ,
{ IT_STRING | IT_CVAR , NULL , " Chat background tint " , & cv_chatbacktint , 151 } ,
{ IT_HEADER , NULL , " Level " , NULL , 160 } ,
{ IT_STRING | IT_CVAR , NULL , " Draw Distance " , & cv_drawdist , 166 } ,
{ IT_STRING | IT_CVAR , NULL , " Weather Draw Dist. " , & cv_drawdist_precip , 171 } ,
{ IT_STRING | IT_CVAR , NULL , " NiGHTS Hoop Draw Dist. " , & cv_drawdist_nights , 176 } ,
{ IT_HEADER , NULL , " Diagnostic " , NULL , 184 } ,
{ IT_STRING | IT_CVAR , NULL , " Show FPS " , & cv_ticrate , 190 } ,
{ IT_STRING | IT_CVAR , NULL , " Clear Before Redraw " , & cv_homremoval , 195 } ,
{ IT_STRING | IT_CVAR , NULL , " Show \" FOCUS LOST \" " , & cv_showfocuslost , 200 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_VideoModeMenu [ ] =
{
2017-01-31 18:48:50 +00:00
{ IT_KEYHANDLER | IT_NOTHING , NULL , " " , M_HandleVideoMode , 0 } , // dummy menuitem for the control func
2014-03-15 16:59:03 +00:00
} ;
2017-04-19 21:24:28 +00:00
static menuitem_t OP_ColorOptionsMenu [ ] =
{
2017-04-20 18:27:19 +00:00
{ IT_STRING | IT_CALL , NULL , " Reset to defaults " , M_ResetCvars , 0 } ,
2017-04-19 21:24:28 +00:00
{ IT_HEADER , NULL , " Red " , NULL , 9 } ,
{ IT_DISABLED , NULL , NULL , NULL , 35 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Hue " , & cv_rhue , 15 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_rsaturation , 20 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness " , & cv_rgamma , 25 } ,
{ IT_HEADER , NULL , " Yellow " , NULL , 34 } ,
{ IT_DISABLED , NULL , NULL , NULL , 73 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Hue " , & cv_yhue , 40 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_ysaturation , 45 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness " , & cv_ygamma , 50 } ,
{ IT_HEADER , NULL , " Green " , NULL , 59 } ,
{ IT_DISABLED , NULL , NULL , NULL , 112 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Hue " , & cv_ghue , 65 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_gsaturation , 70 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness " , & cv_ggamma , 75 } ,
{ IT_HEADER , NULL , " Cyan " , NULL , 84 } ,
{ IT_DISABLED , NULL , NULL , NULL , 255 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Hue " , & cv_chue , 90 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_csaturation , 95 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness " , & cv_cgamma , 100 } ,
{ IT_HEADER , NULL , " Blue " , NULL , 109 } ,
{ IT_DISABLED , NULL , NULL , NULL , 152 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Hue " , & cv_bhue , 115 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_bsaturation , 120 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness " , & cv_bgamma , 125 } ,
{ IT_HEADER , NULL , " Magenta " , NULL , 134 } ,
{ IT_DISABLED , NULL , NULL , NULL , 181 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Hue " , & cv_mhue , 140 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Saturation " , & cv_msaturation , 145 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Brightness " , & cv_mgamma , 150 } ,
} ;
2014-03-15 16:59:03 +00:00
# ifdef HWRENDER
static menuitem_t OP_OpenGLOptionsMenu [ ] =
{
2019-11-04 15:30:28 +00:00
{ IT_STRING | IT_CVAR , NULL , " Models " , & cv_grmodels , 10 } ,
{ IT_STRING | IT_CVAR , NULL , " Model interpolation " , & cv_grmodelinterpolation , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Field of view " , & cv_grfov , 40 } ,
{ IT_STRING | IT_CVAR , NULL , " Quality " , & cv_scr_depth , 50 } ,
{ IT_STRING | IT_CVAR , NULL , " Texture Filter " , & cv_grfiltermode , 60 } ,
{ IT_STRING | IT_CVAR , NULL , " Anisotropic " , & cv_granisotropicmode , 70 } ,
2017-04-20 18:27:19 +00:00
# if defined (_WINDOWS) && (!((defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)))
2019-11-04 15:30:28 +00:00
{ IT_STRING | IT_CVAR , NULL , " Fullscreen " , & cv_fullscreen , 80 } ,
2014-03-15 16:59:03 +00:00
# endif
# ifdef ALAM_LIGHTING
2019-11-04 15:30:28 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Lighting... " , & OP_OpenGLLightingDef , 100 } ,
2014-03-15 16:59:03 +00:00
# endif
2019-11-04 15:30:28 +00:00
{ IT_SUBMENU | IT_STRING , NULL , " Fog... " , & OP_OpenGLFogDef , 110 } ,
{ IT_SUBMENU | IT_STRING , NULL , " Gamma... " , & OP_OpenGLColorDef , 120 } ,
2014-03-15 16:59:03 +00:00
} ;
# ifdef ALAM_LIGHTING
static menuitem_t OP_OpenGLLightingMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Coronas " , & cv_grcoronas , 0 } ,
{ IT_STRING | IT_CVAR , NULL , " Coronas size " , & cv_grcoronasize , 10 } ,
{ IT_STRING | IT_CVAR , NULL , " Dynamic lighting " , & cv_grdynamiclighting , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Static lighting " , & cv_grstaticlighting , 30 } ,
} ;
# endif
static menuitem_t OP_OpenGLFogMenu [ ] =
{
{ IT_STRING | IT_CVAR , NULL , " Fog " , & cv_grfog , 10 } ,
{ IT_STRING | IT_KEYHANDLER , NULL , " Fog color " , M_HandleFogColor , 20 } ,
{ IT_STRING | IT_CVAR , NULL , " Fog density " , & cv_grfogdensity , 30 } ,
{ IT_STRING | IT_CVAR , NULL , " Software Fog " , & cv_grsoftwarefog , 40 } ,
} ;
static menuitem_t OP_OpenGLColorMenu [ ] =
{
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " red " , & cv_grgammared , 10 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " green " , & cv_grgammagreen , 20 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " blue " , & cv_grgammablue , 30 } ,
} ;
# endif
static menuitem_t OP_SoundOptionsMenu [ ] =
{
2019-10-24 00:31:10 +00:00
{ IT_HEADER , NULL , " Game Audio " , NULL , 0 } ,
2019-11-21 00:14:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Sound Effects " , & cv_gamesounds , 12 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Sound Volume " , & cv_soundvolume , 22 } ,
2014-03-15 16:59:03 +00:00
2019-11-21 00:14:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Digital Music " , & cv_gamedigimusic , 42 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " Digital Music Volume " , & cv_digmusicvolume , 52 } ,
2014-03-15 16:59:03 +00:00
2019-11-21 00:14:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " MIDI Music " , & cv_gamemidimusic , 72 } ,
{ IT_STRING | IT_CVAR | IT_CV_SLIDER , NULL , " MIDI Music Volume " , & cv_midimusicvolume , 82 } ,
2018-08-23 13:06:13 +00:00
2019-11-21 15:53:37 +00:00
{ IT_HEADER , NULL , " Miscellaneous " , NULL , 102 } ,
2019-11-21 00:14:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Closed Captioning " , & cv_closedcaptioning , 114 } ,
2019-11-21 15:53:37 +00:00
{ IT_STRING | IT_CVAR , NULL , " Reset Music Upon Dying " , & cv_resetmusic , 124 } ,
2019-08-04 11:03:57 +00:00
2019-11-21 00:14:09 +00:00
{ IT_STRING | IT_SUBMENU , NULL , " Advanced Settings... " , & OP_SoundAdvancedDef , 144 } ,
2019-08-04 11:03:57 +00:00
} ;
# ifdef HAVE_OPENMPT
2019-11-21 15:53:37 +00:00
# define OPENMPT_MENUOFFSET 32
2019-08-04 11:03:57 +00:00
# else
# define OPENMPT_MENUOFFSET 0
# endif
2019-08-04 06:11:04 +00:00
2019-08-05 00:02:38 +00:00
# ifdef HAVE_MIXERX
2019-11-21 15:53:37 +00:00
# define MIXERX_MENUOFFSET 81
2019-08-05 00:02:38 +00:00
# else
# define MIXERX_MENUOFFSET 0
# endif
2019-08-04 11:03:57 +00:00
static menuitem_t OP_SoundAdvancedMenu [ ] =
{
2019-08-04 06:11:04 +00:00
# ifdef HAVE_OPENMPT
2019-11-21 15:53:37 +00:00
{ IT_HEADER , NULL , " OpenMPT Settings " , NULL , 0 } ,
{ IT_STRING | IT_CVAR , NULL , " Instrument Filter " , & cv_modfilter , 12 } ,
2019-08-04 11:03:57 +00:00
# endif
# ifdef HAVE_MIXERX
2019-11-21 15:53:37 +00:00
{ IT_HEADER , NULL , " MIDI Settings " , NULL , OPENMPT_MENUOFFSET } ,
{ IT_STRING | IT_CVAR , NULL , " MIDI Player " , & cv_midiplayer , OPENMPT_MENUOFFSET + 12 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " FluidSynth Sound Font File " , & cv_midisoundfontpath , OPENMPT_MENUOFFSET + 24 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " TiMidity++ Config Folder " , & cv_miditimiditypath , OPENMPT_MENUOFFSET + 51 } ,
2019-08-04 06:11:04 +00:00
# endif
2019-08-05 00:02:38 +00:00
2019-11-21 15:53:37 +00:00
{ IT_HEADER , NULL , " Miscellaneous " , NULL , OPENMPT_MENUOFFSET + MIXERX_MENUOFFSET } ,
{ IT_STRING | IT_CVAR , NULL , " Play Sound Effects if Unfocused " , & cv_playsoundsifunfocused , OPENMPT_MENUOFFSET + MIXERX_MENUOFFSET + 12 } ,
{ IT_STRING | IT_CVAR , NULL , " Play Music if Unfocused " , & cv_playmusicifunfocused , OPENMPT_MENUOFFSET + MIXERX_MENUOFFSET + 22 } ,
{ IT_STRING | IT_CVAR , NULL , " Let Levels Force Reset Music " , & cv_resetmusicbyheader , OPENMPT_MENUOFFSET + MIXERX_MENUOFFSET + 32 } ,
2018-08-27 03:58:43 +00:00
} ;
2019-08-04 06:11:04 +00:00
2019-08-04 11:03:57 +00:00
# undef OPENMPT_MENUOFFSET
2019-08-05 00:02:38 +00:00
# undef MIXERX_MENUOFFSET
2019-08-04 11:03:57 +00:00
2014-03-15 16:59:03 +00:00
static menuitem_t OP_DataOptionsMenu [ ] =
{
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CALL , NULL , " Add-on Options... " , M_AddonsOptions , 10 } ,
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CALL , NULL , " Screenshot Options... " , M_ScreenshotOptions , 20 } ,
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_SUBMENU , NULL , " \x85 " " Erase Data... " , & OP_EraseDataDef , 40 } ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_ScreenshotOptionsMenu [ ] =
{
2017-04-20 19:16:10 +00:00
{ IT_HEADER , NULL , " General " , NULL , 0 } ,
{ IT_STRING | IT_CVAR , NULL , " Use color profile " , & cv_screenshot_colorprofile , 6 } ,
2014-03-15 16:59:03 +00:00
2019-09-08 05:29:09 +00:00
{ IT_HEADER , NULL , " Screenshots (F8) " , NULL , 16 } ,
{ IT_STRING | IT_CVAR , NULL , " Storage Location " , & cv_screenshot_option , 22 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " Custom Folder " , & cv_screenshot_folder , 27 } ,
{ IT_STRING | IT_CVAR , NULL , " Memory Level " , & cv_zlib_memory , 42 } ,
{ IT_STRING | IT_CVAR , NULL , " Compression Level " , & cv_zlib_level , 47 } ,
{ IT_STRING | IT_CVAR , NULL , " Strategy " , & cv_zlib_strategy , 52 } ,
{ IT_STRING | IT_CVAR , NULL , " Window Size " , & cv_zlib_window_bits , 57 } ,
2014-03-15 16:59:03 +00:00
2019-09-08 05:29:09 +00:00
{ IT_HEADER , NULL , " Movie Mode (F9) " , NULL , 64 } ,
{ IT_STRING | IT_CVAR , NULL , " Storage Location " , & cv_movie_option , 70 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " Custom Folder " , & cv_movie_folder , 75 } ,
{ IT_STRING | IT_CVAR , NULL , " Capture Mode " , & cv_moviemode , 90 } ,
2014-03-15 16:59:03 +00:00
2019-09-08 05:29:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Region Optimizing " , & cv_gif_optimize , 95 } ,
{ IT_STRING | IT_CVAR , NULL , " Downscaling " , & cv_gif_downscale , 100 } ,
2014-03-15 16:59:03 +00:00
2019-09-08 05:29:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Memory Level " , & cv_zlib_memorya , 95 } ,
{ IT_STRING | IT_CVAR , NULL , " Compression Level " , & cv_zlib_levela , 100 } ,
{ IT_STRING | IT_CVAR , NULL , " Strategy " , & cv_zlib_strategya , 105 } ,
{ IT_STRING | IT_CVAR , NULL , " Window Size " , & cv_zlib_window_bitsa , 110 } ,
2014-03-15 16:59:03 +00:00
} ;
enum
{
2017-04-20 19:16:10 +00:00
op_screenshot_colorprofile = 1 ,
2019-09-08 05:29:09 +00:00
op_screenshot_folder = 4 ,
op_movie_folder = 11 ,
op_screenshot_capture = 12 ,
op_screenshot_gif_start = 13 ,
op_screenshot_gif_end = 14 ,
op_screenshot_apng_start = 15 ,
op_screenshot_apng_end = 18 ,
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_EraseDataMenu [ ] =
{
{ IT_STRING | IT_CALL , NULL , " Erase Record Data " , M_EraseData , 10 } ,
2019-11-21 00:34:32 +00:00
{ IT_STRING | IT_CALL , NULL , " Erase Extras Data " , M_EraseData , 20 } ,
2014-03-15 16:59:03 +00:00
{ IT_STRING | IT_CALL , NULL , " \x85 " " Erase ALL Data " , M_EraseData , 40 } ,
} ;
2017-04-29 15:40:07 +00:00
static menuitem_t OP_AddonsOptionsMenu [ ] =
{
2017-05-09 13:09:09 +00:00
{ IT_HEADER , NULL , " Menu " , NULL , 0 } ,
{ IT_STRING | IT_CVAR , NULL , " Location " , & cv_addons_option , 12 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " Custom Folder " , & cv_addons_folder , 22 } ,
2017-08-05 21:13:14 +00:00
{ IT_STRING | IT_CVAR , NULL , " Identify add-ons via " , & cv_addons_md5 , 50 } ,
2017-05-09 13:09:09 +00:00
{ IT_STRING | IT_CVAR , NULL , " Show unsupported file types " , & cv_addons_showall , 60 } ,
{ IT_HEADER , NULL , " Search " , NULL , 78 } ,
{ IT_STRING | IT_CVAR , NULL , " Matching " , & cv_addons_search_type , 90 } ,
{ IT_STRING | IT_CVAR , NULL , " Case-sensitive " , & cv_addons_search_case , 100 } ,
2017-04-29 15:40:07 +00:00
} ;
enum
{
op_addons_folder = 2 ,
} ;
2014-03-15 16:59:03 +00:00
static menuitem_t OP_ServerOptionsMenu [ ] =
{
2017-04-15 12:36:40 +00:00
{ IT_HEADER , NULL , " General " , NULL , 0 } ,
2014-03-15 16:59:03 +00:00
# ifndef NONET
{ IT_STRING | IT_CVAR | IT_CV_STRING ,
2017-04-16 13:20:38 +00:00
NULL , " Server name " , & cv_servername , 7 } ,
{ IT_STRING | IT_CVAR , NULL , " Max Players " , & cv_maxplayers , 21 } ,
2017-07-08 10:41:20 +00:00
{ IT_STRING | IT_CVAR , NULL , " Allow Add-on Downloading " , & cv_downloading , 26 } ,
2017-04-16 13:20:38 +00:00
{ IT_STRING | IT_CVAR , NULL , " Allow players to join " , & cv_allownewplayer , 31 } ,
2014-03-15 16:59:03 +00:00
# endif
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CVAR , NULL , " Map progression " , & cv_advancemap , 36 } ,
{ IT_STRING | IT_CVAR , NULL , " Intermission Timer " , & cv_inttime , 41 } ,
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
{ IT_HEADER , NULL , " Characters " , NULL , 50 } ,
{ IT_STRING | IT_CVAR , NULL , " Force a character " , & cv_forceskin , 56 } ,
{ IT_STRING | IT_CVAR , NULL , " Restrict character changes " , & cv_restrictskinchange , 61 } ,
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
{ IT_HEADER , NULL , " Items " , NULL , 70 } ,
{ IT_STRING | IT_CVAR , NULL , " Item respawn delay " , & cv_itemrespawntime , 76 } ,
2017-07-08 10:41:20 +00:00
{ IT_STRING | IT_SUBMENU , NULL , " Mystery Item Monitor Toggles... " , & OP_MonitorToggleDef , 81 } ,
2014-03-15 16:59:03 +00:00
2017-05-28 17:09:05 +00:00
{ IT_HEADER , NULL , " Cooperative " , NULL , 90 } ,
2017-04-29 15:40:07 +00:00
{ IT_STRING | IT_CVAR , NULL , " Players required for exit " , & cv_playersforexit , 96 } ,
2017-06-03 16:55:03 +00:00
{ IT_STRING | IT_CVAR , NULL , " Starposts " , & cv_coopstarposts , 101 } ,
2017-07-04 13:58:58 +00:00
{ IT_STRING | IT_CVAR , NULL , " Life sharing " , & cv_cooplives , 106 } ,
2014-03-15 16:59:03 +00:00
2017-05-28 17:09:05 +00:00
{ IT_HEADER , NULL , " Race, Competition " , NULL , 115 } ,
{ IT_STRING | IT_CVAR , NULL , " Level completion countdown " , & cv_countdowntime , 121 } ,
2017-07-04 13:58:58 +00:00
{ IT_STRING | IT_CVAR , NULL , " Item Monitors " , & cv_competitionboxes , 126 } ,
2014-03-15 16:59:03 +00:00
2017-05-28 17:09:05 +00:00
{ IT_HEADER , NULL , " Ringslinger (Match, CTF, Tag, H&S) " , NULL , 135 } ,
{ IT_STRING | IT_CVAR , NULL , " Time Limit " , & cv_timelimit , 141 } ,
{ IT_STRING | IT_CVAR , NULL , " Score Limit " , & cv_pointlimit , 146 } ,
{ IT_STRING | IT_CVAR , NULL , " Overtime on Tie " , & cv_overtime , 151 } ,
{ IT_STRING | IT_CVAR , NULL , " Player respawn delay " , & cv_respawntime , 156 } ,
2014-03-15 16:59:03 +00:00
2017-07-04 13:58:58 +00:00
{ IT_STRING | IT_CVAR , NULL , " Item Monitors " , & cv_matchboxes , 166 } ,
2017-05-28 17:09:05 +00:00
{ IT_STRING | IT_CVAR , NULL , " Weapon Rings " , & cv_specialrings , 171 } ,
{ IT_STRING | IT_CVAR , NULL , " Power Stones " , & cv_powerstones , 176 } ,
2014-03-15 16:59:03 +00:00
2017-05-28 17:09:05 +00:00
{ IT_STRING | IT_CVAR , NULL , " Flag respawn delay " , & cv_flagtime , 186 } ,
{ IT_STRING | IT_CVAR , NULL , " Hiding time " , & cv_hidetime , 191 } ,
2017-07-04 12:17:29 +00:00
{ IT_HEADER , NULL , " Teams " , NULL , 200 } ,
{ IT_STRING | IT_CVAR , NULL , " Autobalance sizes " , & cv_autobalance , 206 } ,
{ IT_STRING | IT_CVAR , NULL , " Scramble on Map Change " , & cv_scrambleonchange , 211 } ,
2014-03-15 16:59:03 +00:00
2017-04-16 13:20:38 +00:00
# ifndef NONET
2017-07-04 12:17:29 +00:00
{ IT_HEADER , NULL , " Advanced " , NULL , 220 } ,
{ IT_STRING | IT_CVAR | IT_CV_STRING , NULL , " Master server " , & cv_masterserver , 226 } ,
{ IT_STRING | IT_CVAR , NULL , " Attempts to resynchronise " , & cv_resynchattempts , 240 } ,
2017-04-16 13:20:38 +00:00
# endif
2014-03-15 16:59:03 +00:00
} ;
static menuitem_t OP_MonitorToggleMenu [ ] =
{
// Printing handled by drawing function
2017-04-20 18:27:19 +00:00
{ IT_STRING | IT_CALL , NULL , " Reset to defaults " , M_ResetCvars , 15 } ,
2017-04-19 21:24:28 +00:00
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Recycler " , & cv_recycler , 30 } ,
2017-07-04 13:58:58 +00:00
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Teleport " , & cv_teleporters , 40 } ,
2017-04-19 21:24:28 +00:00
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Super Ring " , & cv_superring , 50 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Super Sneakers " , & cv_supersneakers , 60 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Invincibility " , & cv_invincibility , 70 } ,
2017-07-04 13:58:58 +00:00
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Whirlwind Shield " , & cv_jumpshield , 80 } ,
2017-04-19 21:24:28 +00:00
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Elemental Shield " , & cv_watershield , 90 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Attraction Shield " , & cv_ringshield , 100 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Force Shield " , & cv_forceshield , 110 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Armageddon Shield " , & cv_bombshield , 120 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " 1 Up " , & cv_1up , 130 } ,
{ IT_STRING | IT_CVAR | IT_CV_INVISSLIDER , NULL , " Eggman Box " , & cv_eggmanbox , 140 } ,
2014-03-15 16:59:03 +00:00
} ;
// ==========================================================================
// ALL MENU DEFINITIONS GO HERE
// ==========================================================================
// Main Menu and related
2018-11-16 14:56:22 +00:00
menu_t MainDef = CENTERMENUSTYLE ( MN_MAIN , NULL , MainMenu , NULL , 72 ) ;
2014-03-15 16:59:03 +00:00
2017-04-29 15:40:07 +00:00
menu_t MISC_AddonsDef =
{
2018-11-16 14:56:22 +00:00
MN_AD_MAIN ,
2017-04-29 15:40:07 +00:00
NULL ,
sizeof ( MISC_AddonsMenu ) / sizeof ( menuitem_t ) ,
& MainDef ,
MISC_AddonsMenu ,
M_DrawAddons ,
2017-04-29 15:40:07 +00:00
50 , 28 ,
2017-04-29 15:40:07 +00:00
0 ,
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t MAPauseDef = PAUSEMENUSTYLE ( MAPauseMenu , 40 , 72 ) ;
menu_t SPauseDef = PAUSEMENUSTYLE ( SPauseMenu , 40 , 72 ) ;
menu_t MPauseDef = PAUSEMENUSTYLE ( MPauseMenu , 40 , 72 ) ;
// Misc Main Menu
2018-11-16 14:56:22 +00:00
menu_t MISC_ScrambleTeamDef = DEFAULTMENUSTYLE ( MN_SPECIAL , NULL , MISC_ScrambleTeamMenu , & MPauseDef , 27 , 40 ) ;
menu_t MISC_ChangeTeamDef = DEFAULTMENUSTYLE ( MN_SPECIAL , NULL , MISC_ChangeTeamMenu , & MPauseDef , 27 , 40 ) ;
2017-01-31 18:48:50 +00:00
// MP Gametype and map change menu
menu_t MISC_ChangeLevelDef =
{
2018-11-16 14:56:22 +00:00
MN_SPECIAL ,
2017-01-31 18:48:50 +00:00
NULL ,
sizeof ( MISC_ChangeLevelMenu ) / sizeof ( menuitem_t ) ,
2017-09-15 19:34:46 +00:00
& MainDef , // Doesn't matter.
2017-01-31 18:48:50 +00:00
MISC_ChangeLevelMenu ,
M_DrawLevelPlatterMenu ,
0 , 0 ,
0 ,
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t MISC_HelpDef = IMAGEDEF ( MISC_HelpMenu ) ;
2018-12-16 02:44:39 +00:00
static INT32 highlightflags , recommendedflags , warningflags ;
2014-03-15 16:59:03 +00:00
// Sky Room
menu_t SR_PandoraDef =
{
2018-11-16 14:56:22 +00:00
MN_SR_MAIN + ( MN_SR_PANDORA < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_PANDRA " ,
sizeof ( SR_PandorasBox ) / sizeof ( menuitem_t ) ,
& SPauseDef ,
SR_PandorasBox ,
M_DrawGenericMenu ,
2017-09-15 19:34:46 +00:00
60 , 30 ,
2014-03-15 16:59:03 +00:00
0 ,
M_ExitPandorasBox
} ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
menu_t SR_MainDef = DEFAULTMENUSTYLE ( MN_SR_MAIN , " M_SECRET " , SR_MainMenu , & MainDef , 60 , 40 ) ;
2017-02-02 16:10:37 +00:00
2018-11-16 14:22:27 +00:00
menu_t SR_LevelSelectDef = MAPPLATTERMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_SR_MAIN + ( MN_SR_LEVELSELECT < < 6 ) ,
2018-11-16 14:22:27 +00:00
NULL , SR_LevelSelectMenu ) ;
2017-02-02 16:10:37 +00:00
2014-03-15 16:59:03 +00:00
menu_t SR_UnlockChecklistDef =
{
2018-11-16 14:56:22 +00:00
MN_SR_MAIN + ( MN_SR_UNLOCKCHECKLIST < < 6 ) ,
2017-04-22 23:16:09 +00:00
" M_SECRET " ,
2014-03-15 16:59:03 +00:00
1 ,
& SR_MainDef ,
SR_UnlockChecklistMenu ,
M_DrawChecklist ,
2017-04-22 11:14:15 +00:00
30 , 30 ,
2014-03-15 16:59:03 +00:00
0 ,
NULL
} ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
menu_t SR_SoundTestDef =
{
MN_SR_MAIN + ( MN_SR_SOUNDTEST < < 6 ) ,
NULL ,
sizeof ( SR_SoundTestMenu ) / sizeof ( menuitem_t ) ,
& SR_MainDef ,
SR_SoundTestMenu ,
M_DrawSoundTest ,
60 , 150 ,
0 ,
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t SR_EmblemHintDef =
{
2018-11-16 14:56:22 +00:00
MN_SR_MAIN + ( MN_SR_EMBLEMHINT < < 6 ) ,
2014-03-15 16:59:03 +00:00
NULL ,
sizeof ( SR_EmblemHintMenu ) / sizeof ( menuitem_t ) ,
& SPauseDef ,
SR_EmblemHintMenu ,
M_DrawEmblemHints ,
60 , 150 ,
0 ,
NULL
} ;
// Single Player
2018-08-11 17:01:54 +00:00
menu_t SP_MainDef = //CENTERMENUSTYLE(NULL, SP_MainMenu, &MainDef, 72);
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN ,
2018-08-11 17:01:54 +00:00
NULL ,
sizeof ( SP_MainMenu ) / sizeof ( menuitem_t ) ,
& MainDef ,
SP_MainMenu ,
M_DrawCenteredMenu ,
BASEVIDWIDTH / 2 , 72 ,
2019-11-21 01:43:07 +00:00
0 ,
2018-08-11 17:01:54 +00:00
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t SP_LoadDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_LOAD < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_PICKG " ,
1 ,
& SP_MainDef ,
SP_LoadGameMenu ,
M_DrawLoad ,
68 , 46 ,
0 ,
NULL
} ;
2017-01-27 23:16:35 +00:00
2018-11-16 14:22:27 +00:00
menu_t SP_LevelSelectDef = MAPPLATTERMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_LOAD < < 6 ) + ( MN_SP_PLAYER < < 12 ) + ( MN_SP_LEVELSELECT < < 18 ) ,
2018-11-16 14:22:27 +00:00
NULL , SP_LevelSelectMenu ) ;
2014-03-15 16:59:03 +00:00
menu_t SP_LevelStatsDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_LEVELSTATS < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_STATS " ,
1 ,
& SP_MainDef ,
SP_LevelStatsMenu ,
M_DrawLevelStats ,
280 , 185 ,
0 ,
NULL
} ;
2018-11-16 14:22:27 +00:00
menu_t SP_TimeAttackLevelSelectDef = MAPPLATTERMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_TIMEATTACK < < 6 ) + ( MN_SP_TIMEATTACK_LEVELSELECT < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_ATTACK " , SP_TimeAttackLevelSelectMenu ) ;
2017-02-02 16:10:37 +00:00
2014-03-15 16:59:03 +00:00
static menu_t SP_TimeAttackDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_TIMEATTACK < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_ATTACK " ,
sizeof ( SP_TimeAttackMenu ) / sizeof ( menuitem_t ) ,
& MainDef , // Doesn't matter.
SP_TimeAttackMenu ,
M_DrawTimeAttackMenu ,
32 , 40 ,
0 ,
NULL
} ;
static menu_t SP_ReplayDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_TIMEATTACK < < 6 ) + ( MN_SP_REPLAY < < 12 ) ,
2014-03-15 16:59:03 +00:00
" M_ATTACK " ,
sizeof ( SP_ReplayMenu ) / sizeof ( menuitem_t ) ,
& SP_TimeAttackDef ,
SP_ReplayMenu ,
M_DrawTimeAttackMenu ,
32 , 120 ,
0 ,
NULL
} ;
static menu_t SP_GuestReplayDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_TIMEATTACK < < 6 ) + ( MN_SP_GUESTREPLAY < < 12 ) ,
2014-03-15 16:59:03 +00:00
" M_ATTACK " ,
sizeof ( SP_GuestReplayMenu ) / sizeof ( menuitem_t ) ,
& SP_TimeAttackDef ,
SP_GuestReplayMenu ,
M_DrawTimeAttackMenu ,
32 , 120 ,
0 ,
NULL
} ;
static menu_t SP_GhostDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_TIMEATTACK < < 6 ) + ( MN_SP_GHOST < < 12 ) ,
2014-03-15 16:59:03 +00:00
" M_ATTACK " ,
sizeof ( SP_GhostMenu ) / sizeof ( menuitem_t ) ,
& SP_TimeAttackDef ,
SP_GhostMenu ,
M_DrawTimeAttackMenu ,
32 , 120 ,
0 ,
NULL
} ;
2018-11-16 14:22:27 +00:00
menu_t SP_NightsAttackLevelSelectDef = MAPPLATTERMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_NIGHTSATTACK < < 6 ) + ( MN_SP_NIGHTS_LEVELSELECT < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_NIGHTS " , SP_NightsAttackLevelSelectMenu ) ;
2017-02-02 16:10:37 +00:00
2014-03-15 16:59:03 +00:00
static menu_t SP_NightsAttackDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_NIGHTSATTACK < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_NIGHTS " ,
sizeof ( SP_NightsAttackMenu ) / sizeof ( menuitem_t ) ,
& MainDef , // Doesn't matter.
SP_NightsAttackMenu ,
M_DrawNightsAttackMenu ,
32 , 40 ,
0 ,
NULL
} ;
2014-11-12 00:55:07 +00:00
static menu_t SP_NightsReplayDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_NIGHTSATTACK < < 6 ) + ( MN_SP_NIGHTS_REPLAY < < 12 ) ,
2014-11-12 00:55:07 +00:00
" M_NIGHTS " ,
sizeof ( SP_NightsReplayMenu ) / sizeof ( menuitem_t ) ,
& SP_NightsAttackDef ,
SP_NightsReplayMenu ,
M_DrawNightsAttackMenu ,
32 , 120 ,
0 ,
NULL
} ;
static menu_t SP_NightsGuestReplayDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_NIGHTSATTACK < < 6 ) + ( MN_SP_NIGHTS_GUESTREPLAY < < 12 ) ,
2014-11-12 00:55:07 +00:00
" M_NIGHTS " ,
sizeof ( SP_NightsGuestReplayMenu ) / sizeof ( menuitem_t ) ,
& SP_NightsAttackDef ,
SP_NightsGuestReplayMenu ,
M_DrawNightsAttackMenu ,
32 , 120 ,
0 ,
NULL
} ;
static menu_t SP_NightsGhostDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_NIGHTSATTACK < < 6 ) + ( MN_SP_NIGHTS_GHOST < < 12 ) ,
2014-11-12 00:55:07 +00:00
" M_NIGHTS " ,
sizeof ( SP_NightsGhostMenu ) / sizeof ( menuitem_t ) ,
& SP_NightsAttackDef ,
SP_NightsGhostMenu ,
M_DrawNightsAttackMenu ,
32 , 120 ,
0 ,
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t SP_PlayerDef =
{
2018-11-16 14:56:22 +00:00
MN_SP_MAIN + ( MN_SP_LOAD < < 6 ) + ( MN_SP_PLAYER < < 12 ) ,
2014-03-15 16:59:03 +00:00
" M_PICKP " ,
2017-03-17 14:27:17 +00:00
sizeof ( SP_PlayerMenu ) / sizeof ( menuitem_t ) ,
2014-03-15 16:59:03 +00:00
& SP_MainDef ,
2017-03-17 14:27:17 +00:00
SP_PlayerMenu ,
2014-03-15 16:59:03 +00:00
M_DrawSetupChoosePlayerMenu ,
24 , 32 ,
0 ,
NULL
} ;
// Multiplayer
2017-01-31 23:56:09 +00:00
2017-07-25 17:34:13 +00:00
menu_t MP_SplitServerDef =
2017-01-31 23:56:09 +00:00
{
2018-11-16 14:56:22 +00:00
MN_MP_MAIN + ( MN_MP_SPLITSCREEN < < 6 ) ,
2017-01-31 23:56:09 +00:00
" M_MULTI " ,
2017-07-25 17:34:13 +00:00
sizeof ( MP_SplitServerMenu ) / sizeof ( menuitem_t ) ,
# ifndef NONET
2017-01-31 23:56:09 +00:00
& MP_MainDef ,
2017-07-25 17:34:13 +00:00
# else
& MainDef ,
2017-02-01 17:36:19 +00:00
# endif
2017-07-25 17:34:13 +00:00
MP_SplitServerMenu ,
M_DrawServerMenu ,
27 , 30 - 50 ,
2017-01-31 23:56:09 +00:00
0 ,
NULL
} ;
2017-07-25 17:34:13 +00:00
# ifndef NONET
menu_t MP_MainDef =
2017-01-31 23:56:09 +00:00
{
2018-11-16 14:56:22 +00:00
MN_MP_MAIN ,
2017-01-31 23:56:09 +00:00
" M_MULTI " ,
2017-07-25 17:34:13 +00:00
sizeof ( MP_MainMenu ) / sizeof ( menuitem_t ) ,
& MainDef ,
MP_MainMenu ,
M_DrawMPMainMenu ,
27 , 40 ,
0 ,
M_CancelConnect
} ;
menu_t MP_ServerDef =
{
2018-11-16 14:56:22 +00:00
MN_MP_MAIN + ( MN_MP_SERVER < < 6 ) ,
2017-07-25 17:34:13 +00:00
" M_MULTI " ,
sizeof ( MP_ServerMenu ) / sizeof ( menuitem_t ) ,
2017-01-31 23:56:09 +00:00
& MP_MainDef ,
2017-07-25 17:34:13 +00:00
MP_ServerMenu ,
2017-01-31 23:56:09 +00:00
M_DrawServerMenu ,
2017-07-25 17:34:13 +00:00
27 , 30 ,
2017-01-31 23:56:09 +00:00
0 ,
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t MP_ConnectDef =
{
2018-11-16 14:56:22 +00:00
MN_MP_MAIN + ( MN_MP_CONNECT < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_MULTI " ,
sizeof ( MP_ConnectMenu ) / sizeof ( menuitem_t ) ,
& MP_MainDef ,
MP_ConnectMenu ,
M_DrawConnectMenu ,
27 , 24 ,
0 ,
M_CancelConnect
} ;
2017-07-25 17:34:13 +00:00
2014-03-15 16:59:03 +00:00
menu_t MP_RoomDef =
{
2018-11-16 14:56:22 +00:00
MN_MP_MAIN + ( MN_MP_ROOM < < 6 ) ,
2014-03-15 16:59:03 +00:00
" M_MULTI " ,
sizeof ( MP_RoomMenu ) / sizeof ( menuitem_t ) ,
& MP_ConnectDef ,
MP_RoomMenu ,
M_DrawRoomMenu ,
27 , 32 ,
0 ,
NULL
} ;
# endif
2017-01-31 23:56:09 +00:00
2014-03-15 16:59:03 +00:00
menu_t MP_PlayerSetupDef =
{
2018-11-16 14:22:27 +00:00
# ifdef NONET
2018-11-16 14:56:22 +00:00
MN_MP_MAIN + ( MN_MP_PLAYERSETUP < < 6 ) ,
2018-11-17 21:32:30 +00:00
# else
MN_MP_MAIN + ( MN_MP_SPLITSCREEN < < 6 ) + ( MN_MP_PLAYERSETUP < < 12 ) ,
2018-11-16 14:22:27 +00:00
# endif
2014-03-15 16:59:03 +00:00
" M_SPLAYR " ,
sizeof ( MP_PlayerSetupMenu ) / sizeof ( menuitem_t ) ,
2017-07-25 17:34:13 +00:00
& MainDef , // doesn't matter
2014-03-15 16:59:03 +00:00
MP_PlayerSetupMenu ,
M_DrawSetupMultiPlayerMenu ,
2017-07-25 17:34:13 +00:00
19 , 22 ,
2014-03-15 16:59:03 +00:00
0 ,
M_QuitMultiPlayerMenu
} ;
// Options
2018-11-16 14:22:27 +00:00
menu_t OP_MainDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN ,
2018-11-16 14:22:27 +00:00
" M_OPTTTL " , OP_MainMenu , & MainDef , 50 , 30 ) ;
menu_t OP_ChangeControlsDef = CONTROLMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_CHANGECONTROLS < < 12 ) , // second level (<<6) set on runtime
2018-11-16 14:22:27 +00:00
OP_ChangeControlsMenu , & OP_MainDef ) ;
menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_P1CONTROLS < < 6 ) ,
2018-11-16 14:22:27 +00:00
" M_CONTRO " , OP_P1ControlsMenu , & OP_MainDef , 50 , 30 ) ;
menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_P2CONTROLS < < 6 ) ,
2018-11-16 14:22:27 +00:00
" M_CONTRO " , OP_P2ControlsMenu , & OP_MainDef , 50 , 30 ) ;
menu_t OP_MouseOptionsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_P1CONTROLS < < 6 ) + ( MN_OP_P1MOUSE < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_CONTRO " , OP_MouseOptionsMenu , & OP_P1ControlsDef , 35 , 30 ) ;
menu_t OP_Mouse2OptionsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_P2CONTROLS < < 6 ) + ( MN_OP_P2MOUSE < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_CONTRO " , OP_Mouse2OptionsMenu , & OP_P2ControlsDef , 35 , 30 ) ;
menu_t OP_Joystick1Def = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_P1CONTROLS < < 6 ) + ( MN_OP_P1JOYSTICK < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_CONTRO " , OP_Joystick1Menu , & OP_P1ControlsDef , 50 , 30 ) ;
menu_t OP_Joystick2Def = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_P2CONTROLS < < 6 ) + ( MN_OP_P2JOYSTICK < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_CONTRO " , OP_Joystick2Menu , & OP_P2ControlsDef , 50 , 30 ) ;
2014-03-15 16:59:03 +00:00
menu_t OP_JoystickSetDef =
{
2018-11-17 21:32:30 +00:00
MN_OP_MAIN + ( MN_OP_JOYSTICKSET < < MENUBITS * 3 ) , // second (<<6) and third level (<<12) set on runtime
2014-03-15 16:59:03 +00:00
" M_CONTRO " ,
sizeof ( OP_JoystickSetMenu ) / sizeof ( menuitem_t ) ,
& OP_Joystick1Def ,
OP_JoystickSetMenu ,
M_DrawJoystick ,
2017-04-15 00:08:26 +00:00
60 , 40 ,
2014-03-15 16:59:03 +00:00
0 ,
NULL
} ;
2019-09-19 09:34:04 +00:00
menu_t OP_CameraOptionsDef = DEFAULTMENUSTYLE (
MN_OP_MAIN + ( MN_OP_P1CONTROLS < < 6 ) + ( MN_OP_P1CAMERA < < 12 ) ,
" M_CONTRO " , OP_CameraOptionsMenu , & OP_P1ControlsDef , 35 , 30 ) ;
menu_t OP_Camera2OptionsDef = DEFAULTMENUSTYLE (
MN_OP_MAIN + ( MN_OP_P2CONTROLS < < 6 ) + ( MN_OP_P2CAMERA < < 12 ) ,
" M_CONTRO " , OP_Camera2OptionsMenu , & OP_P2ControlsDef , 35 , 30 ) ;
2014-03-15 16:59:03 +00:00
2017-04-15 13:05:51 +00:00
menu_t OP_VideoOptionsDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) ,
2017-04-15 13:05:51 +00:00
" M_VIDEO " ,
sizeof ( OP_VideoOptionsMenu ) / sizeof ( menuitem_t ) ,
& OP_MainDef ,
OP_VideoOptionsMenu ,
2017-04-15 14:36:19 +00:00
M_DrawMainVideoMenu ,
2017-04-15 13:05:51 +00:00
30 , 30 ,
0 ,
NULL
} ;
2014-03-15 16:59:03 +00:00
menu_t OP_VideoModeDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) + ( MN_OP_VIDEOMODE < < 12 ) ,
2014-03-15 16:59:03 +00:00
" M_VIDEO " ,
1 ,
& OP_VideoOptionsDef ,
OP_VideoModeMenu ,
M_DrawVideoMode ,
48 , 26 ,
0 ,
NULL
} ;
2017-04-19 21:24:28 +00:00
menu_t OP_ColorOptionsDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) + ( MN_OP_COLOR < < 12 ) ,
2017-04-19 21:24:28 +00:00
" M_VIDEO " ,
sizeof ( OP_ColorOptionsMenu ) / sizeof ( menuitem_t ) ,
& OP_VideoOptionsDef ,
OP_ColorOptionsMenu ,
M_DrawColorMenu ,
30 , 30 ,
0 ,
NULL
} ;
2019-11-21 00:14:09 +00:00
menu_t OP_SoundOptionsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_SOUND < < 6 ) ,
2019-10-24 00:31:10 +00:00
" M_SOUND " , OP_SoundOptionsMenu , & OP_MainDef , 30 , 30 ) ;
2019-11-21 15:53:37 +00:00
menu_t OP_SoundAdvancedDef = DEFAULTMENUSTYLE ( MN_OP_MAIN + ( MN_OP_SOUND < < 6 ) , " M_SOUND " , OP_SoundAdvancedMenu , & OP_SoundOptionsDef , 30 , 30 ) ;
2014-03-15 16:59:03 +00:00
2018-11-16 14:22:27 +00:00
menu_t OP_ServerOptionsDef = DEFAULTSCROLLMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_SERVER < < 6 ) ,
2018-11-16 14:22:27 +00:00
" M_SERVER " , OP_ServerOptionsMenu , & OP_MainDef , 30 , 30 ) ;
2014-03-15 16:59:03 +00:00
menu_t OP_MonitorToggleDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_SERVER < < 6 ) + ( MN_OP_MONITORTOGGLE < < 12 ) ,
2014-03-15 16:59:03 +00:00
" M_SERVER " ,
sizeof ( OP_MonitorToggleMenu ) / sizeof ( menuitem_t ) ,
& OP_ServerOptionsDef ,
OP_MonitorToggleMenu ,
M_DrawMonitorToggles ,
30 , 30 ,
0 ,
NULL
} ;
# ifdef HWRENDER
2018-11-16 14:22:27 +00:00
menu_t OP_OpenGLOptionsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) + ( MN_OP_OPENGL < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_VIDEO " , OP_OpenGLOptionsMenu , & OP_VideoOptionsDef , 30 , 30 ) ;
2014-03-15 16:59:03 +00:00
# ifdef ALAM_LIGHTING
2018-11-16 14:22:27 +00:00
menu_t OP_OpenGLLightingDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) + ( MN_OP_OPENGL < < 12 ) + ( MN_OP_OPENGL_LIGHTING < < 18 ) ,
2018-11-16 14:22:27 +00:00
" M_VIDEO " , OP_OpenGLLightingMenu , & OP_OpenGLOptionsDef , 60 , 40 ) ;
2014-03-15 16:59:03 +00:00
# endif
menu_t OP_OpenGLFogDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) + ( MN_OP_OPENGL < < 12 ) + ( MN_OP_OPENGL_FOG < < 18 ) ,
2014-03-15 16:59:03 +00:00
" M_VIDEO " ,
sizeof ( OP_OpenGLFogMenu ) / sizeof ( menuitem_t ) ,
& OP_OpenGLOptionsDef ,
OP_OpenGLFogMenu ,
M_OGL_DrawFogMenu ,
60 , 40 ,
0 ,
NULL
} ;
menu_t OP_OpenGLColorDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_VIDEO < < 6 ) + ( MN_OP_OPENGL < < 12 ) + ( MN_OP_OPENGL_COLOR < < 18 ) ,
2014-03-15 16:59:03 +00:00
" M_VIDEO " ,
sizeof ( OP_OpenGLColorMenu ) / sizeof ( menuitem_t ) ,
& OP_OpenGLOptionsDef ,
OP_OpenGLColorMenu ,
M_OGL_DrawColorMenu ,
60 , 40 ,
0 ,
NULL
} ;
# endif
2018-11-16 14:22:27 +00:00
menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_DATA < < 6 ) ,
2018-11-16 14:22:27 +00:00
" M_DATA " , OP_DataOptionsMenu , & OP_MainDef , 60 , 30 ) ;
2017-04-20 17:59:27 +00:00
menu_t OP_ScreenshotOptionsDef =
{
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_DATA < < 6 ) + ( MN_OP_SCREENSHOTS < < 12 ) ,
2017-04-20 17:59:27 +00:00
" M_DATA " ,
sizeof ( OP_ScreenshotOptionsMenu ) / sizeof ( menuitem_t ) ,
& OP_DataOptionsDef ,
OP_ScreenshotOptionsMenu ,
2017-04-20 19:16:10 +00:00
M_DrawScreenshotMenu ,
2017-04-20 17:59:27 +00:00
30 , 30 ,
0 ,
NULL
} ;
2018-11-16 14:22:27 +00:00
menu_t OP_AddonsOptionsDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_DATA < < 6 ) + ( MN_OP_ADDONS < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_ADDONS " , OP_AddonsOptionsMenu , & OP_DataOptionsDef , 30 , 30 ) ;
2017-04-29 15:40:07 +00:00
2018-11-16 14:22:27 +00:00
menu_t OP_EraseDataDef = DEFAULTMENUSTYLE (
2018-11-16 14:56:22 +00:00
MN_OP_MAIN + ( MN_OP_DATA < < 6 ) + ( MN_OP_ERASEDATA < < 12 ) ,
2018-11-16 14:22:27 +00:00
" M_DATA " , OP_EraseDataMenu , & OP_DataOptionsDef , 60 , 30 ) ;
2014-03-15 16:59:03 +00:00
// ==========================================================================
// CVAR ONCHANGE EVENTS GO HERE
// ==========================================================================
// (there's only a couple anyway)
// Prototypes
2017-02-02 12:32:02 +00:00
static INT32 M_GetFirstLevelInList ( INT32 gt ) ;
2017-02-10 14:54:05 +00:00
static boolean M_CanShowLevelOnPlatter ( INT32 mapnum , INT32 gt ) ;
2014-03-15 16:59:03 +00:00
2017-02-05 21:20:32 +00:00
// Nextmap. Used for Level select.
void Nextmap_OnChange ( void )
2014-03-15 16:59:03 +00:00
{
char * leveltitle ;
char tabase [ 256 ] ;
short i ;
2014-11-12 00:55:07 +00:00
boolean active ;
2014-03-15 16:59:03 +00:00
// Update the string in the consvar.
Z_Free ( cv_nextmap . zstring ) ;
leveltitle = G_BuildMapTitle ( cv_nextmap . value ) ;
cv_nextmap . string = cv_nextmap . zstring = leveltitle ? leveltitle : Z_StrDup ( G_BuildMapName ( cv_nextmap . value ) ) ;
if ( currentMenu = = & SP_NightsAttackDef )
{
CV_StealthSetValue ( & cv_dummymares , 0 ) ;
// Hide the record changing CVAR if only one mare is available.
if ( ! nightsrecords [ cv_nextmap . value - 1 ] | | nightsrecords [ cv_nextmap . value - 1 ] - > nummares < 2 )
SP_NightsAttackMenu [ narecords ] . status = IT_DISABLED ;
else
SP_NightsAttackMenu [ narecords ] . status = IT_STRING | IT_CVAR ;
2014-11-12 00:55:07 +00:00
// Do the replay things.
active = false ;
SP_NightsAttackMenu [ naguest ] . status = IT_DISABLED ;
SP_NightsAttackMenu [ nareplay ] . status = IT_DISABLED ;
SP_NightsAttackMenu [ naghost ] . status = IT_DISABLED ;
// Check if file exists, if not, disable REPLAY option
sprintf ( tabase , " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ;
for ( i = 0 ; i < 4 ; i + + ) {
SP_NightsReplayMenu [ i ] . status = IT_DISABLED ;
SP_NightsGuestReplayMenu [ i ] . status = IT_DISABLED ;
}
if ( FIL_FileExists ( va ( " %s-score-best.lmp " , tabase ) ) ) {
SP_NightsReplayMenu [ 0 ] . status = IT_WHITESTRING | IT_CALL ;
SP_NightsGuestReplayMenu [ 0 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s-time-best.lmp " , tabase ) ) ) {
SP_NightsReplayMenu [ 1 ] . status = IT_WHITESTRING | IT_CALL ;
SP_NightsGuestReplayMenu [ 1 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s-last.lmp " , tabase ) ) ) {
SP_NightsReplayMenu [ 2 ] . status = IT_WHITESTRING | IT_CALL ;
SP_NightsGuestReplayMenu [ 2 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s-guest.lmp " , tabase ) ) ) {
SP_NightsReplayMenu [ 3 ] . status = IT_WHITESTRING | IT_CALL ;
SP_NightsGuestReplayMenu [ 3 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( active ) {
SP_NightsAttackMenu [ naguest ] . status = IT_WHITESTRING | IT_SUBMENU ;
SP_NightsAttackMenu [ nareplay ] . status = IT_WHITESTRING | IT_SUBMENU ;
SP_NightsAttackMenu [ naghost ] . status = IT_WHITESTRING | IT_SUBMENU ;
}
else if ( itemOn = = nareplay ) // Reset lastOn so replay isn't still selected when not available.
{
currentMenu - > lastOn = itemOn ;
itemOn = nastart ;
}
2014-03-15 16:59:03 +00:00
}
else if ( currentMenu = = & SP_TimeAttackDef )
{
2014-11-12 00:55:07 +00:00
active = false ;
2014-03-15 16:59:03 +00:00
SP_TimeAttackMenu [ taguest ] . status = IT_DISABLED ;
SP_TimeAttackMenu [ tareplay ] . status = IT_DISABLED ;
SP_TimeAttackMenu [ taghost ] . status = IT_DISABLED ;
// Check if file exists, if not, disable REPLAY option
2017-10-15 11:35:49 +00:00
sprintf ( tabase , " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-%s " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) , skins [ cv_chooseskin . value - 1 ] . name ) ;
2014-03-15 16:59:03 +00:00
for ( i = 0 ; i < 5 ; i + + ) {
SP_ReplayMenu [ i ] . status = IT_DISABLED ;
SP_GuestReplayMenu [ i ] . status = IT_DISABLED ;
}
if ( FIL_FileExists ( va ( " %s-time-best.lmp " , tabase ) ) ) {
SP_ReplayMenu [ 0 ] . status = IT_WHITESTRING | IT_CALL ;
SP_GuestReplayMenu [ 0 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s-score-best.lmp " , tabase ) ) ) {
SP_ReplayMenu [ 1 ] . status = IT_WHITESTRING | IT_CALL ;
SP_GuestReplayMenu [ 1 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s-rings-best.lmp " , tabase ) ) ) {
SP_ReplayMenu [ 2 ] . status = IT_WHITESTRING | IT_CALL ;
SP_GuestReplayMenu [ 2 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s-last.lmp " , tabase ) ) ) {
SP_ReplayMenu [ 3 ] . status = IT_WHITESTRING | IT_CALL ;
SP_GuestReplayMenu [ 3 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( FIL_FileExists ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-guest.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ) ) {
SP_ReplayMenu [ 4 ] . status = IT_WHITESTRING | IT_CALL ;
SP_GuestReplayMenu [ 4 ] . status = IT_WHITESTRING | IT_CALL ;
active = true ;
}
if ( active ) {
SP_TimeAttackMenu [ taguest ] . status = IT_WHITESTRING | IT_SUBMENU ;
SP_TimeAttackMenu [ tareplay ] . status = IT_WHITESTRING | IT_SUBMENU ;
SP_TimeAttackMenu [ taghost ] . status = IT_WHITESTRING | IT_SUBMENU ;
}
else if ( itemOn = = tareplay ) // Reset lastOn so replay isn't still selected when not available.
{
currentMenu - > lastOn = itemOn ;
itemOn = tastart ;
}
if ( mapheaderinfo [ cv_nextmap . value - 1 ] & & mapheaderinfo [ cv_nextmap . value - 1 ] - > forcecharacter [ 0 ] ! = ' \0 ' )
CV_Set ( & cv_chooseskin , mapheaderinfo [ cv_nextmap . value - 1 ] - > forcecharacter ) ;
}
}
static void Dummymares_OnChange ( void )
{
if ( ! nightsrecords [ cv_nextmap . value - 1 ] )
{
CV_StealthSetValue ( & cv_dummymares , 0 ) ;
return ;
}
else
{
UINT8 mares = nightsrecords [ cv_nextmap . value - 1 ] - > nummares ;
if ( cv_dummymares . value < 0 )
CV_StealthSetValue ( & cv_dummymares , mares ) ;
else if ( cv_dummymares . value > mares )
CV_StealthSetValue ( & cv_dummymares , 0 ) ;
}
}
// Newgametype. Used for gametype changes.
static void Newgametype_OnChange ( void )
{
if ( menuactive )
{
if ( ! mapheaderinfo [ cv_nextmap . value - 1 ] )
P_AllocMapHeader ( ( INT16 ) ( cv_nextmap . value - 1 ) ) ;
2017-02-10 14:54:05 +00:00
if ( ! M_CanShowLevelOnPlatter ( cv_nextmap . value - 1 , cv_newgametype . value ) )
2017-12-10 14:35:55 +00:00
CV_SetValue ( & cv_nextmap , M_GetFirstLevelInList ( cv_newgametype . value ) ) ;
2014-03-15 16:59:03 +00:00
}
}
void Screenshot_option_Onchange ( void )
{
OP_ScreenshotOptionsMenu [ op_screenshot_folder ] . status =
( cv_screenshot_option . value = = 3 ? IT_CVAR | IT_STRING | IT_CV_STRING : IT_DISABLED ) ;
}
void Moviemode_mode_Onchange ( void )
{
INT32 i , cstart , cend ;
for ( i = op_screenshot_gif_start ; i < = op_screenshot_apng_end ; + + i )
OP_ScreenshotOptionsMenu [ i ] . status = IT_DISABLED ;
switch ( cv_moviemode . value )
{
case MM_GIF :
cstart = op_screenshot_gif_start ;
cend = op_screenshot_gif_end ;
break ;
case MM_APNG :
cstart = op_screenshot_apng_start ;
cend = op_screenshot_apng_end ;
break ;
default :
return ;
}
for ( i = cstart ; i < = cend ; + + i )
OP_ScreenshotOptionsMenu [ i ] . status = IT_STRING | IT_CVAR ;
}
2017-04-29 15:40:07 +00:00
void Addons_option_Onchange ( void )
{
OP_AddonsOptionsMenu [ op_addons_folder ] . status =
( cv_addons_option . value = = 3 ? IT_CVAR | IT_STRING | IT_CV_STRING : IT_DISABLED ) ;
}
2019-09-08 05:29:09 +00:00
void Moviemode_option_Onchange ( void )
{
OP_ScreenshotOptionsMenu [ op_movie_folder ] . status =
( cv_movie_option . value = = 3 ? IT_CVAR | IT_STRING | IT_CV_STRING : IT_DISABLED ) ;
}
2014-03-15 16:59:03 +00:00
// ==========================================================================
// END ORGANIZATION STUFF.
// ==========================================================================
// current menudef
menu_t * currentMenu = & MainDef ;
2018-11-16 19:16:41 +00:00
// =========================================================================
2018-11-25 20:08:12 +00:00
// MENU PRESENTATION PARAMETER HANDLING (BACKGROUNDS)
2018-11-16 19:16:41 +00:00
// =========================================================================
2018-11-25 20:08:12 +00:00
// menu IDs are equal to current/prevMenu in most cases, except MN_SPECIAL when we don't want to operate on Message, Pause, etc.
UINT32 prevMenuId = 0 ;
UINT32 activeMenuId = 0 ;
2018-11-17 06:21:21 +00:00
2018-11-25 20:08:12 +00:00
menupres_t menupres [ NUMMENUTYPES ] ;
2018-11-17 21:32:30 +00:00
2018-11-25 20:08:12 +00:00
void M_InitMenuPresTables ( void )
2018-11-17 21:32:30 +00:00
{
INT32 i ;
// Called in d_main before SOC can get to the tables
2018-11-25 20:08:12 +00:00
// Set menupres defaults
2018-11-17 21:32:30 +00:00
for ( i = 0 ; i < NUMMENUTYPES ; i + + )
{
// so-called "undefined"
2018-11-25 20:08:12 +00:00
menupres [ i ] . fadestrength = - 1 ;
menupres [ i ] . hidetitlepics = - 1 ; // inherits global hidetitlepics
2019-08-13 02:12:20 +00:00
menupres [ i ] . ttmode = TTMODE_NONE ;
menupres [ i ] . ttscale = UINT8_MAX ;
menupres [ i ] . ttname [ 0 ] = 0 ;
menupres [ i ] . ttx = INT16_MAX ;
menupres [ i ] . tty = INT16_MAX ;
menupres [ i ] . ttloop = INT16_MAX ;
menupres [ i ] . tttics = UINT16_MAX ;
2018-11-25 20:08:12 +00:00
menupres [ i ] . enterwipe = - 1 ;
menupres [ i ] . exitwipe = - 1 ;
menupres [ i ] . bgcolor = - 1 ;
menupres [ i ] . titlescrollxspeed = INT32_MAX ;
menupres [ i ] . titlescrollyspeed = INT32_MAX ;
2019-06-10 19:43:47 +00:00
menupres [ i ] . bghide = true ;
2018-11-17 21:32:30 +00:00
// default true
2018-11-25 20:08:12 +00:00
menupres [ i ] . enterbubble = true ;
menupres [ i ] . exitbubble = true ;
2018-11-20 22:28:26 +00:00
if ( i ! = MN_MAIN )
{
2018-11-25 20:08:12 +00:00
menupres [ i ] . muslooping = true ;
2018-11-20 22:28:26 +00:00
}
2019-08-18 21:32:52 +00:00
if ( i = = MN_SP_TIMEATTACK )
2019-09-08 02:57:20 +00:00
strncpy ( menupres [ i ] . musname , " _recat " , 7 ) ;
2019-08-18 21:32:52 +00:00
else if ( i = = MN_SP_NIGHTSATTACK )
2019-09-08 02:57:20 +00:00
strncpy ( menupres [ i ] . musname , " _nitat " , 7 ) ;
2019-10-27 17:12:36 +00:00
else if ( i = = MN_SP_PLAYER | | i = = MN_SR_PLAYER )
2018-11-25 20:08:12 +00:00
strncpy ( menupres [ i ] . musname , " _chsel " , 7 ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
else if ( i = = MN_SR_SOUNDTEST )
{
* menupres [ i ] . musname = ' \0 ' ;
menupres [ i ] . musstop = true ;
}
2018-11-17 21:32:30 +00:00
}
}
// ====================================
// TREE ITERATION
// ====================================
2018-11-16 19:16:41 +00:00
// UINT32 menutype - current menutype_t
// INT32 level - current level up the tree, higher means younger
// INT32 *retval - Return value
// void *input - Pointer to input of any type
//
// return true - stop iterating
// return false - continue
2018-11-17 21:32:30 +00:00
typedef boolean ( * menutree_iterator ) ( UINT32 , INT32 , INT32 * , void * * , boolean fromoldest ) ;
2018-11-16 19:16:41 +00:00
2018-11-25 20:08:12 +00:00
// HACK: Used in the ChangeMusic iterator because we only allow
// a single input. Maybe someday use this struct program-wide.
typedef struct
{
char musname [ 7 ] ;
UINT16 mustrack ;
boolean muslooping ;
} menupresmusic_t ;
2018-11-16 23:26:26 +00:00
static INT32 M_IterateMenuTree ( menutree_iterator itfunc , void * input )
2018-11-16 19:16:41 +00:00
{
INT32 i , retval = 0 ;
UINT32 bitmask , menutype ;
for ( i = NUMMENULEVELS ; i > = 0 ; i - - )
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
2018-11-17 21:32:30 +00:00
menutype = ( activeMenuId & bitmask ) > > ( MENUBITS * i ) ;
if ( itfunc ( menutype , i , & retval , & input , false ) )
2018-11-16 19:16:41 +00:00
break ;
}
return retval ;
}
// ====================================
// ITERATORS
// ====================================
2018-11-17 21:32:30 +00:00
static boolean MIT_GetMenuAtLevel ( UINT32 menutype , INT32 level , INT32 * retval , void * * input , boolean fromoldest )
2018-11-16 19:16:41 +00:00
{
2018-11-17 21:32:30 +00:00
INT32 * inputptr = ( INT32 * ) * input ;
INT32 targetlevel = * inputptr ;
2018-11-16 19:16:41 +00:00
if ( menutype )
{
2018-11-17 21:32:30 +00:00
if ( level = = targetlevel | | targetlevel < 0 )
{
* retval = menutype ;
return true ;
}
}
else if ( targetlevel > = 0 )
{
// offset targetlevel by failed attempts; this should only happen in beginning of iteration
if ( fromoldest )
( * inputptr ) + + ;
else
( * inputptr ) - - ; // iterating backwards, so count from highest
2018-11-16 19:16:41 +00:00
}
return false ;
}
2018-11-20 22:28:26 +00:00
static boolean MIT_SetCurBackground ( UINT32 menutype , INT32 level , INT32 * retval , void * * input , boolean fromoldest )
2018-11-16 19:16:41 +00:00
{
char * defaultname = ( char * ) * input ;
2018-11-18 09:32:38 +00:00
( void ) retval ;
( void ) fromoldest ;
2019-07-15 19:25:57 +00:00
if ( ! menutype ) // if there's nothing in this level, do nothing
return false ;
2018-11-25 20:08:12 +00:00
if ( menupres [ menutype ] . bgcolor > = 0 )
2018-11-16 19:16:41 +00:00
{
2018-11-25 20:08:12 +00:00
curbgcolor = menupres [ menutype ] . bgcolor ;
2018-11-16 19:16:41 +00:00
return true ;
}
2019-07-14 21:36:14 +00:00
else if ( menupres [ menutype ] . bghide & & titlemapinaction ) // hide the background
2018-11-20 22:28:26 +00:00
{
2019-07-14 21:36:14 +00:00
curbghide = true ;
2018-11-17 21:32:30 +00:00
return true ;
2018-11-20 22:28:26 +00:00
}
2019-07-14 21:36:14 +00:00
else if ( menupres [ menutype ] . bgname [ 0 ] )
2018-11-20 22:28:26 +00:00
{
2019-10-09 04:28:01 +00:00
strncpy ( curbgname , menupres [ menutype ] . bgname , 8 ) ;
2019-07-14 21:36:14 +00:00
curbgxspeed = menupres [ menutype ] . titlescrollxspeed ! = INT32_MAX ? menupres [ menutype ] . titlescrollxspeed : titlescrollxspeed ;
curbgyspeed = menupres [ menutype ] . titlescrollyspeed ! = INT32_MAX ? menupres [ menutype ] . titlescrollyspeed : titlescrollyspeed ;
2018-11-20 22:28:26 +00:00
return true ;
}
2018-11-18 07:49:08 +00:00
else if ( ! level )
{
2018-11-20 22:28:26 +00:00
if ( M_GetYoungestChildMenu ( ) = = MN_SP_PLAYER | | ! defaultname | | ! defaultname [ 0 ] )
curbgcolor = 31 ;
else if ( titlemapinaction ) // hide the background by default in titlemap
curbghide = true ;
else
{
2019-08-09 03:44:28 +00:00
strncpy ( curbgname , defaultname , 9 ) ;
2018-11-20 22:28:26 +00:00
curbgxspeed = ( gamestate = = GS_TIMEATTACK ) ? 0 : titlescrollxspeed ;
curbgyspeed = ( gamestate = = GS_TIMEATTACK ) ? 0 : titlescrollyspeed ;
}
2018-11-18 07:49:08 +00:00
}
2018-11-16 19:16:41 +00:00
return false ;
}
2018-11-17 21:32:30 +00:00
static boolean MIT_ChangeMusic ( UINT32 menutype , INT32 level , INT32 * retval , void * * input , boolean fromoldest )
2018-11-16 23:26:26 +00:00
{
2018-11-25 20:08:12 +00:00
menupresmusic_t * defaultmusic = ( menupresmusic_t * ) * input ;
2018-11-16 23:26:26 +00:00
2018-11-18 09:32:38 +00:00
( void ) retval ;
( void ) fromoldest ;
2019-07-15 19:25:57 +00:00
if ( ! menutype ) // if there's nothing in this level, do nothing
return false ;
2018-11-25 20:08:12 +00:00
if ( menupres [ menutype ] . musname [ 0 ] )
2018-11-16 23:26:26 +00:00
{
2018-11-25 20:08:12 +00:00
S_ChangeMusic ( menupres [ menutype ] . musname , menupres [ menutype ] . mustrack , menupres [ menutype ] . muslooping ) ;
2018-11-16 23:26:26 +00:00
return true ;
}
2018-11-25 20:08:12 +00:00
else if ( menupres [ menutype ] . musstop )
2018-11-17 21:32:30 +00:00
{
S_StopMusic ( ) ;
return true ;
}
2018-11-25 20:08:12 +00:00
else if ( menupres [ menutype ] . musignore )
2018-11-17 21:32:30 +00:00
return true ;
2018-11-17 06:21:21 +00:00
else if ( ! level & & defaultmusic & & defaultmusic - > musname [ 0 ] )
S_ChangeMusic ( defaultmusic - > musname , defaultmusic - > mustrack , defaultmusic - > muslooping ) ;
return false ;
}
2018-11-20 22:28:26 +00:00
static boolean MIT_SetCurFadeValue ( UINT32 menutype , INT32 level , INT32 * retval , void * * input , boolean fromoldest )
2018-11-17 06:21:21 +00:00
{
UINT8 defaultvalue = * ( UINT8 * ) * input ;
2018-11-18 09:32:38 +00:00
( void ) retval ;
( void ) fromoldest ;
2019-07-15 19:25:57 +00:00
if ( ! menutype ) // if there's nothing in this level, do nothing
return false ;
2018-11-25 20:08:12 +00:00
if ( menupres [ menutype ] . fadestrength > = 0 )
2018-11-17 06:21:21 +00:00
{
2018-11-25 20:08:12 +00:00
curfadevalue = ( menupres [ menutype ] . fadestrength % 32 ) ;
2018-11-17 06:21:21 +00:00
return true ;
}
2018-11-20 22:28:26 +00:00
else if ( ! level )
curfadevalue = ( gamestate = = GS_TIMEATTACK ) ? 0 : ( defaultvalue % 32 ) ;
2018-11-17 06:21:21 +00:00
return false ;
}
2019-08-13 02:12:20 +00:00
static boolean MIT_SetCurTitlePics ( UINT32 menutype , INT32 level , INT32 * retval , void * * input , boolean fromoldest )
2018-11-17 06:21:21 +00:00
{
( void ) input ;
2018-11-20 22:28:26 +00:00
( void ) retval ;
2018-11-18 09:32:38 +00:00
( void ) fromoldest ;
2019-07-15 19:25:57 +00:00
if ( ! menutype ) // if there's nothing in this level, do nothing
return false ;
2018-11-25 20:08:12 +00:00
if ( menupres [ menutype ] . hidetitlepics > = 0 )
2018-11-17 06:21:21 +00:00
{
2018-11-25 20:08:12 +00:00
curhidepics = menupres [ menutype ] . hidetitlepics ;
2018-11-17 06:21:21 +00:00
return true ;
}
2019-08-13 02:12:20 +00:00
else if ( menupres [ menutype ] . ttmode = = TTMODE_USER )
{
if ( menupres [ menutype ] . ttname [ 0 ] )
{
curhidepics = menupres [ menutype ] . hidetitlepics ;
curttmode = menupres [ menutype ] . ttmode ;
curttscale = ( menupres [ menutype ] . ttscale ! = UINT8_MAX ? menupres [ menutype ] . ttscale : ttscale ) ;
strncpy ( curttname , menupres [ menutype ] . ttname , 9 ) ;
curttx = ( menupres [ menutype ] . ttx ! = INT16_MAX ? menupres [ menutype ] . ttx : ttx ) ;
curtty = ( menupres [ menutype ] . tty ! = INT16_MAX ? menupres [ menutype ] . tty : tty ) ;
curttloop = ( menupres [ menutype ] . ttloop ! = INT16_MAX ? menupres [ menutype ] . ttloop : ttloop ) ;
curtttics = ( menupres [ menutype ] . tttics ! = UINT16_MAX ? menupres [ menutype ] . tttics : tttics ) ;
}
else
curhidepics = menupres [ menutype ] . hidetitlepics ;
return true ;
}
else if ( menupres [ menutype ] . ttmode ! = TTMODE_NONE )
{
curhidepics = menupres [ menutype ] . hidetitlepics ;
curttmode = menupres [ menutype ] . ttmode ;
curttscale = ( menupres [ menutype ] . ttscale ! = UINT8_MAX ? menupres [ menutype ] . ttscale : ttscale ) ;
return true ;
}
2018-11-17 06:21:21 +00:00
else if ( ! level )
2019-08-13 02:12:20 +00:00
{
2018-11-20 22:28:26 +00:00
curhidepics = hidetitlepics ;
2019-08-13 02:12:20 +00:00
curttmode = ttmode ;
curttscale = ttscale ;
strncpy ( curttname , ttname , 9 ) ;
curttx = ttx ;
curtty = tty ;
curttloop = ttloop ;
curtttics = tttics ;
}
2018-11-16 23:26:26 +00:00
return false ;
}
2018-11-16 19:16:41 +00:00
// ====================================
// TREE RETRIEVAL
// ====================================
2018-11-20 22:28:26 +00:00
UINT8 M_GetYoungestChildMenu ( void ) // aka the active menu
2018-11-16 19:16:41 +00:00
{
2018-11-17 21:32:30 +00:00
INT32 targetlevel = - 1 ;
return M_IterateMenuTree ( MIT_GetMenuAtLevel , & targetlevel ) ;
2018-11-16 19:16:41 +00:00
}
// ====================================
// EFFECTS
// ====================================
2018-11-25 20:08:12 +00:00
void M_ChangeMenuMusic ( const char * defaultmusname , boolean defaultmuslooping )
2018-11-16 23:26:26 +00:00
{
2018-11-25 20:08:12 +00:00
menupresmusic_t defaultmusic ;
2018-11-17 06:21:21 +00:00
if ( ! defaultmusname )
defaultmusname = " " ;
strncpy ( defaultmusic . musname , defaultmusname , 7 ) ;
defaultmusic . musname [ 6 ] = 0 ;
defaultmusic . mustrack = 0 ;
defaultmusic . muslooping = defaultmuslooping ;
M_IterateMenuTree ( MIT_ChangeMusic , & defaultmusic ) ;
}
2018-11-25 20:08:12 +00:00
void M_SetMenuCurBackground ( const char * defaultname )
2018-11-17 06:21:21 +00:00
{
2019-10-09 04:28:01 +00:00
char name [ 9 ] ;
2018-11-20 22:28:26 +00:00
strncpy ( name , defaultname , 8 ) ;
M_IterateMenuTree ( MIT_SetCurBackground , & name ) ;
2018-11-17 06:21:21 +00:00
}
2018-11-25 20:08:12 +00:00
void M_SetMenuCurFadeValue ( UINT8 defaultvalue )
2018-11-17 06:21:21 +00:00
{
2018-11-20 22:28:26 +00:00
M_IterateMenuTree ( MIT_SetCurFadeValue , & defaultvalue ) ;
}
2019-08-13 02:12:20 +00:00
void M_SetMenuCurTitlePics ( void )
2018-11-20 22:28:26 +00:00
{
2019-08-13 02:12:20 +00:00
M_IterateMenuTree ( MIT_SetCurTitlePics , NULL ) ;
2018-11-16 23:26:26 +00:00
}
2018-11-17 21:32:30 +00:00
// ====================================
// MENU STATE
// ====================================
static INT32 exitlevel , enterlevel , anceslevel ;
static INT16 exittype , entertype ;
static INT16 exitwipe , enterwipe ;
static boolean exitbubble , enterbubble ;
static INT16 exittag , entertag ;
2018-11-25 20:08:12 +00:00
static void M_HandleMenuPresState ( menu_t * newMenu )
2018-11-17 21:32:30 +00:00
{
INT32 i ;
UINT32 bitmask ;
SINT8 prevtype , activetype , menutype ;
2018-11-18 08:08:59 +00:00
if ( ! newMenu )
2018-11-17 21:32:30 +00:00
return ;
2018-11-18 08:08:59 +00:00
// Look for MN_SPECIAL here, because our iterators can't look at new menu IDs
for ( i = 0 ; i < = NUMMENULEVELS ; i + + )
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
menutype = ( newMenu - > menuid & bitmask ) > > ( MENUBITS * i ) ;
prevtype = ( currentMenu - > menuid & bitmask ) > > ( MENUBITS * i ) ;
if ( menutype = = MN_SPECIAL | | prevtype = = MN_SPECIAL )
return ;
}
2018-11-17 21:32:30 +00:00
if ( currentMenu & & newMenu & & currentMenu - > menuid = = newMenu - > menuid ) // same menu?
return ;
exittype = entertype = exitlevel = enterlevel = anceslevel = exitwipe = enterwipe = - 1 ;
exitbubble = enterbubble = true ;
prevMenuId = currentMenu ? currentMenu - > menuid : 0 ;
activeMenuId = newMenu ? newMenu - > menuid : 0 ;
2018-11-20 22:28:26 +00:00
// Set defaults for presentation values
2019-08-09 03:44:28 +00:00
strncpy ( curbgname , " TITLESKY " , 9 ) ;
2018-11-20 22:28:26 +00:00
curfadevalue = 16 ;
curhidepics = hidetitlepics ;
curbgcolor = - 1 ;
curbgxspeed = titlescrollxspeed ;
curbgyspeed = titlescrollyspeed ;
2019-07-14 20:58:48 +00:00
curbghide = ( gamestate ! = GS_TIMEATTACK ) ; // show in time attack, hide in other menus
2018-11-20 22:28:26 +00:00
2019-08-13 02:12:20 +00:00
curttmode = ttmode ;
curttscale = ttscale ;
strncpy ( curttname , ttname , 9 ) ;
curttx = ttx ;
curtty = tty ;
curttloop = ttloop ;
curtttics = tttics ;
2018-11-17 21:32:30 +00:00
// don't do the below during the in-game menus
if ( gamestate ! = GS_TITLESCREEN & & gamestate ! = GS_TIMEATTACK )
return ;
2018-11-25 20:08:12 +00:00
M_SetMenuCurFadeValue ( 16 ) ;
2019-08-13 02:12:20 +00:00
M_SetMenuCurTitlePics ( ) ;
2018-11-20 22:28:26 +00:00
2018-11-17 21:32:30 +00:00
// Loop through both menu IDs in parallel and look for type changes
// The youngest child in activeMenuId is the entered menu
// The youngest child in prevMenuId is the exited menu
// 0. Get the type and level of each menu, and level of common ancestor
// 1. Get the wipes for both, then run the exit wipe
// 2. Change music (so that execs can change it again later)
// 3. Run each exit exec on the prevMenuId up to the common ancestor (UNLESS NoBubbleExecs)
// 4. Run each entrance exec on the activeMenuId down from the common ancestor (UNLESS NoBubbleExecs)
// 5. Run the entrance wipe
// Get the parameters for each menu
for ( i = NUMMENULEVELS ; i > = 0 ; i - - )
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
prevtype = ( prevMenuId & bitmask ) > > ( MENUBITS * i ) ;
activetype = ( activeMenuId & bitmask ) > > ( MENUBITS * i ) ;
if ( prevtype & & ( exittype < 0 ) )
{
exittype = prevtype ;
exitlevel = i ;
2018-11-25 20:08:12 +00:00
exitwipe = menupres [ exittype ] . exitwipe ;
exitbubble = menupres [ exittype ] . exitbubble ;
exittag = menupres [ exittype ] . exittag ;
2018-11-17 21:32:30 +00:00
}
if ( activetype & & ( entertype < 0 ) )
{
entertype = activetype ;
enterlevel = i ;
2018-11-25 20:08:12 +00:00
enterwipe = menupres [ entertype ] . enterwipe ;
enterbubble = menupres [ entertype ] . enterbubble ;
entertag = menupres [ entertype ] . entertag ;
2018-11-17 21:32:30 +00:00
}
if ( prevtype & & activetype & & prevtype = = activetype & & anceslevel < 0 )
{
anceslevel = i ;
break ;
}
}
2018-11-18 08:32:19 +00:00
// if no common ancestor (top menu), force a wipe. Look for a specified wipe first.
2018-11-20 22:28:26 +00:00
// Don't force a wipe if you're actually going to/from the main menu
if ( anceslevel < 0 & & exitwipe < 0 & & newMenu ! = & MainDef & & currentMenu ! = & MainDef )
2018-11-18 08:32:19 +00:00
{
for ( i = NUMMENULEVELS ; i > = 0 ; i - - )
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
prevtype = ( prevMenuId & bitmask ) > > ( MENUBITS * i ) ;
2018-11-25 20:08:12 +00:00
if ( menupres [ prevtype ] . exitwipe > = 0 )
2018-11-18 08:32:19 +00:00
{
2018-11-25 20:08:12 +00:00
exitwipe = menupres [ prevtype ] . exitwipe ;
2018-11-18 08:32:19 +00:00
break ;
}
}
if ( exitwipe < 0 )
2018-11-25 20:08:12 +00:00
exitwipe = menupres [ MN_MAIN ] . exitwipe ;
2018-11-18 08:32:19 +00:00
}
// do the same for enter wipe
2018-11-20 22:28:26 +00:00
if ( anceslevel < 0 & & enterwipe < 0 & & newMenu ! = & MainDef & & currentMenu ! = & MainDef )
2018-11-18 08:32:19 +00:00
{
for ( i = NUMMENULEVELS ; i > = 0 ; i - - )
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
activetype = ( activeMenuId & bitmask ) > > ( MENUBITS * i ) ;
2018-11-25 20:08:12 +00:00
if ( menupres [ activetype ] . enterwipe > = 0 )
2018-11-18 08:32:19 +00:00
{
2018-11-25 20:08:12 +00:00
exitwipe = menupres [ activetype ] . enterwipe ;
2018-11-18 08:32:19 +00:00
break ;
}
}
if ( enterwipe < 0 )
2018-11-25 20:08:12 +00:00
enterwipe = menupres [ MN_MAIN ] . enterwipe ;
2018-11-18 08:32:19 +00:00
}
2018-11-17 21:32:30 +00:00
// Change the music
2018-11-25 20:08:12 +00:00
M_ChangeMenuMusic ( " _title " , false ) ;
2018-11-17 21:32:30 +00:00
// Run the linedef execs
if ( titlemapinaction )
{
// Run the exit tags
if ( enterlevel < = exitlevel ) // equals is an edge case
{
if ( exitbubble )
{
for ( i = exitlevel ; i > anceslevel ; i - - ) // don't run the common ancestor's exit tag
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
menutype = ( prevMenuId & bitmask ) > > ( MENUBITS * i ) ;
2018-11-25 20:08:12 +00:00
if ( menupres [ menutype ] . exittag )
P_LinedefExecute ( menupres [ menutype ] . exittag , players [ displayplayer ] . mo , NULL ) ;
2018-11-17 21:32:30 +00:00
}
}
else if ( exittag )
P_LinedefExecute ( exittag , players [ displayplayer ] . mo , NULL ) ;
}
// Run the enter tags
if ( enterlevel > = exitlevel ) // equals is an edge case
{
if ( enterbubble )
{
for ( i = anceslevel + 1 ; i < = enterlevel ; i + + ) // don't run the common ancestor's enter tag
{
bitmask = ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * i ) ;
menutype = ( activeMenuId & bitmask ) > > ( MENUBITS * i ) ;
2018-11-25 20:08:12 +00:00
if ( menupres [ menutype ] . entertag )
P_LinedefExecute ( menupres [ menutype ] . entertag , players [ displayplayer ] . mo , NULL ) ;
2018-11-17 21:32:30 +00:00
}
}
else if ( entertag )
P_LinedefExecute ( entertag , players [ displayplayer ] . mo , NULL ) ;
}
}
// Set the wipes for next frame
if (
( exitwipe > = 0 & & enterlevel < = exitlevel ) | |
2018-11-18 08:32:19 +00:00
( enterwipe > = 0 & & enterlevel > = exitlevel ) | |
2018-11-20 22:28:26 +00:00
( anceslevel < 0 & & newMenu ! = & MainDef & & currentMenu ! = & MainDef )
2018-11-17 21:32:30 +00:00
)
{
if ( gamestate = = GS_TIMEATTACK )
2018-11-18 08:32:19 +00:00
wipetypepre = ( ( exitwipe & & enterlevel < = exitlevel ) | | anceslevel < 0 ) ? exitwipe : - 1 ; // force default
2018-11-17 21:32:30 +00:00
else
// HACK: INT16_MAX signals to not wipe
// because 0 is a valid index and -1 means default
2018-11-18 08:32:19 +00:00
wipetypepre = ( ( exitwipe & & enterlevel < = exitlevel ) | | anceslevel < 0 ) ? exitwipe : INT16_MAX ;
wipetypepost = ( ( enterwipe & & enterlevel > = exitlevel ) | | anceslevel < 0 ) ? enterwipe : INT16_MAX ;
2018-11-17 21:32:30 +00:00
wipegamestate = FORCEWIPE ;
2018-11-18 09:39:34 +00:00
// If just one of the above is a force not-wipe,
// mirror the other wipe.
if ( wipetypepre ! = INT16_MAX & & wipetypepost = = INT16_MAX )
wipetypepost = wipetypepre ;
else if ( wipetypepost ! = INT16_MAX & & wipetypepre = = INT16_MAX )
wipetypepre = wipetypepost ;
2018-11-17 21:32:30 +00:00
// D_Display runs the next step of processing
}
}
2014-03-15 16:59:03 +00:00
// =========================================================================
// BASIC MENU HANDLING
// =========================================================================
2017-01-29 19:25:43 +00:00
static void M_GoBack ( INT32 choice )
{
( void ) choice ;
if ( currentMenu - > prevMenu )
{
//If we entered the game search menu, but didn't enter a game,
//make sure the game doesn't still think we're in a netgame.
if ( ! Playing ( ) & & netgame & & multiplayer )
{
MSCloseUDPSocket ( ) ; // Clean up so we can re-open the connection later.
2018-06-18 15:55:34 +00:00
netgame = multiplayer = false ;
2017-01-29 19:25:43 +00:00
}
if ( ( currentMenu - > prevMenu = = & MainDef ) & & ( currentMenu = = & SP_TimeAttackDef | | currentMenu = = & SP_NightsAttackDef ) )
{
// D_StartTitle does its own wipe, since GS_TIMEATTACK is now a complete gamestate.
2018-06-18 15:55:34 +00:00
if ( levelselect . rows )
{
Z_Free ( levelselect . rows ) ;
levelselect . rows = NULL ;
}
2017-01-29 19:25:43 +00:00
menuactive = false ;
2018-11-25 20:08:12 +00:00
wipetypepre = menupres [ M_GetYoungestChildMenu ( ) ] . exitwipe ;
2017-01-29 19:25:43 +00:00
D_StartTitle ( ) ;
}
else
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
}
else
M_ClearMenus ( true ) ;
}
2014-03-15 16:59:03 +00:00
static void M_ChangeCvar ( INT32 choice )
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ itemOn ] . itemaction ;
2019-06-18 13:36:06 +00:00
if ( choice = = - 1 )
{
if ( cv = = & cv_playercolor )
{
SINT8 skinno = R_SkinAvailable ( cv_chooseskin . string ) ;
if ( skinno ! = - 1 )
CV_SetValue ( cv , skins [ skinno ] . prefcolor ) ;
return ;
}
CV_Set ( cv , cv - > defaultvalue ) ;
return ;
}
choice = ( choice < < 1 ) - 1 ;
2019-10-15 11:24:31 +00:00
if ( cv - > flags & CV_FLOAT )
2014-03-15 16:59:03 +00:00
{
2019-10-15 11:24:31 +00:00
if ( ( ( currentMenu - > menuitems [ itemOn ] . status & IT_CVARTYPE ) = = IT_CV_SLIDER )
| | ( ( currentMenu - > menuitems [ itemOn ] . status & IT_CVARTYPE ) = = IT_CV_INVISSLIDER )
| | ( ( currentMenu - > menuitems [ itemOn ] . status & IT_CVARTYPE ) = = IT_CV_NOMOD )
| | ! ( currentMenu - > menuitems [ itemOn ] . status & IT_CV_INTEGERSTEP ) )
2019-09-19 09:34:04 +00:00
{
char s [ 20 ] ;
sprintf ( s , " %f " , FIXED_TO_FLOAT ( cv - > value ) + ( choice ) * ( 1.0f / 16.0f ) ) ;
CV_Set ( cv , s ) ;
}
else
CV_SetValue ( cv , FIXED_TO_FLOAT ( cv - > value ) + ( choice ) ) ;
2014-03-15 16:59:03 +00:00
}
else
2019-06-18 13:36:06 +00:00
CV_AddValue ( cv , choice ) ;
2014-03-15 16:59:03 +00:00
}
static boolean M_ChangeStringCvar ( INT32 choice )
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ itemOn ] . itemaction ;
2017-04-29 15:40:07 +00:00
char buf [ MAXSTRINGLENGTH ] ;
2014-03-15 16:59:03 +00:00
size_t len ;
2017-04-29 15:40:07 +00:00
if ( shiftdown & & choice > = 32 & & choice < = 127 )
choice = shiftxform [ choice ] ;
2014-03-15 16:59:03 +00:00
switch ( choice )
{
case KEY_BACKSPACE :
len = strlen ( cv - > string ) ;
if ( len > 0 )
{
M_Memcpy ( buf , cv - > string , len ) ;
buf [ len - 1 ] = 0 ;
CV_Set ( cv , buf ) ;
}
return true ;
default :
if ( choice > = 32 & & choice < = 127 )
{
len = strlen ( cv - > string ) ;
if ( len < MAXSTRINGLENGTH - 1 )
{
M_Memcpy ( buf , cv - > string , len ) ;
buf [ len + + ] = ( char ) choice ;
buf [ len ] = 0 ;
CV_Set ( cv , buf ) ;
}
return true ;
}
break ;
}
return false ;
}
2017-04-19 21:24:28 +00:00
// resets all cvars on a menu - assumes that all that have itemactions are cvars
static void M_ResetCvars ( void )
{
INT32 i ;
consvar_t * cv ;
for ( i = 0 ; i < currentMenu - > numitems ; i + + )
{
if ( ! ( currentMenu - > menuitems [ i ] . status & IT_CVAR ) | | ! ( cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ) )
continue ;
CV_SetValue ( cv , atoi ( cv - > defaultvalue ) ) ;
}
}
2014-03-15 16:59:03 +00:00
static void M_NextOpt ( void )
{
INT16 oldItemOn = itemOn ; // prevent infinite loop
do
{
if ( itemOn + 1 > currentMenu - > numitems - 1 )
itemOn = 0 ;
else
itemOn + + ;
} while ( oldItemOn ! = itemOn & & ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_SPACE ) ;
}
static void M_PrevOpt ( void )
{
INT16 oldItemOn = itemOn ; // prevent infinite loop
do
{
if ( ! itemOn )
itemOn = currentMenu - > numitems - 1 ;
else
itemOn - - ;
} while ( oldItemOn ! = itemOn & & ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_SPACE ) ;
}
2016-04-07 01:01:01 +00:00
// lock out further input in a tic when important buttons are pressed
// (in other words -- stop bullshit happening by mashing buttons in fades)
static boolean noFurtherInput = false ;
2019-10-15 12:36:04 +00:00
static void Command_Manual_f ( void )
{
if ( modeattacking )
return ;
M_StartControlPanel ( ) ;
currentMenu = & MISC_HelpDef ;
itemOn = 0 ;
}
2014-03-15 16:59:03 +00:00
//
// M_Responder
//
boolean M_Responder ( event_t * ev )
{
INT32 ch = - 1 ;
// INT32 i;
static tic_t joywait = 0 , mousewait = 0 ;
2018-12-02 21:52:30 +00:00
static INT32 pjoyx = 0 , pjoyy = 0 ;
2014-03-15 16:59:03 +00:00
static INT32 pmousex = 0 , pmousey = 0 ;
static INT32 lastx = 0 , lasty = 0 ;
void ( * routine ) ( INT32 choice ) ; // for some casting problem
if ( dedicated | | ( demoplayback & & titledemo )
A good and bad ending cutscene now exist.
Also:
* SPR2_XTRA - instead of defining lumpnames in S_SKIN, those kinds of assets can just be bundled into the spriteset. Required for ending cutscene stuff, I guess, but also done for HUD life icon and character select image (aside from Sonic&Tails, still SOC'd in).
* Minor oversights in SPR2 support corrected.
* Better evaluation, featuring ending assets.
* Intro has warping-in blackrock, reusing ending assets.
* Cutscene text now supports lowercase (intro and custom).
* Disable the asset-fucking "gamma correction" I put in over two years ago when implementing colour cube. (This is the only thing I could move into another branch if you MUST, but it's basically invisble in the diff so w/e.)
* Don't blank the screen if the top left pixel of a screen-covering patch is transparent. (Checked via nonzero topdelta for first column)
Bugs:
* OPENGL ONLY: The first ~20 frames of both endings are fucked. A little help here? Might be HWR_DrawFadeFill's fault, which I just created. OR it could be in f_finale, but I doubt it, since it doesn't appear in Software.
2019-07-27 23:32:57 +00:00
| | gamestate = = GS_INTRO | | gamestate = = GS_ENDING | | gamestate = = GS_CUTSCENE
| | gamestate = = GS_CREDITS | | gamestate = = GS_EVALUATION | | gamestate = = GS_GAMEEND )
2014-03-15 16:59:03 +00:00
return false ;
2019-11-14 12:52:34 +00:00
if ( gamestate = = GS_TITLESCREEN & & finalecount < TICRATE )
return false ;
2016-04-07 01:01:01 +00:00
if ( noFurtherInput )
{
// Ignore input after enter/escape/other buttons
// (but still allow shift keyup so caps doesn't get stuck)
return false ;
}
2014-03-15 16:59:03 +00:00
else if ( menuactive )
{
2018-12-03 08:33:12 +00:00
if ( ev - > type = = ev_keydown )
2014-03-15 16:59:03 +00:00
{
2019-09-06 18:25:11 +00:00
keydown + + ;
2018-12-03 08:33:12 +00:00
ch = ev - > data1 ;
// added 5-2-98 remap virtual keys (mouse & joystick buttons)
switch ( ch )
2014-03-15 16:59:03 +00:00
{
2018-12-03 08:33:12 +00:00
case KEY_MOUSE1 :
case KEY_JOY1 :
ch = KEY_ENTER ;
break ;
case KEY_JOY1 + 3 :
ch = ' n ' ;
break ;
case KEY_MOUSE1 + 1 :
case KEY_JOY1 + 1 :
ch = KEY_ESCAPE ;
break ;
case KEY_JOY1 + 2 :
ch = KEY_BACKSPACE ;
break ;
case KEY_HAT1 :
ch = KEY_UPARROW ;
break ;
case KEY_HAT1 + 1 :
ch = KEY_DOWNARROW ;
break ;
case KEY_HAT1 + 2 :
ch = KEY_LEFTARROW ;
break ;
case KEY_HAT1 + 3 :
ch = KEY_RIGHTARROW ;
break ;
2014-03-15 16:59:03 +00:00
}
}
2018-12-03 08:33:12 +00:00
else if ( ev - > type = = ev_joystick & & ev - > data1 = = 0 & & joywait < I_GetTime ( ) )
2014-03-15 16:59:03 +00:00
{
2018-12-02 21:52:30 +00:00
const INT32 jdeadzone = JOYAXISRANGE / 4 ;
2018-12-02 21:18:28 +00:00
if ( ev - > data3 ! = INT32_MAX )
2014-03-15 16:59:03 +00:00
{
2018-12-02 21:52:30 +00:00
if ( Joystick . bGamepadStyle | | abs ( ev - > data3 ) > jdeadzone )
2018-12-02 21:18:28 +00:00
{
2018-12-02 21:52:30 +00:00
if ( ev - > data3 < 0 & & pjoyy > = 0 )
{
ch = KEY_UPARROW ;
joywait = I_GetTime ( ) + NEWTICRATE / 7 ;
}
else if ( ev - > data3 > 0 & & pjoyy < = 0 )
{
ch = KEY_DOWNARROW ;
joywait = I_GetTime ( ) + NEWTICRATE / 7 ;
}
pjoyy = ev - > data3 ;
2018-12-02 21:18:28 +00:00
}
2018-12-02 21:52:30 +00:00
else
pjoyy = 0 ;
2014-03-15 16:59:03 +00:00
}
2018-12-02 21:18:28 +00:00
if ( ev - > data2 ! = INT32_MAX )
2014-03-15 16:59:03 +00:00
{
2018-12-02 21:52:30 +00:00
if ( Joystick . bGamepadStyle | | abs ( ev - > data2 ) > jdeadzone )
2018-12-02 21:18:28 +00:00
{
2018-12-02 21:52:30 +00:00
if ( ev - > data2 < 0 & & pjoyx > = 0 )
{
ch = KEY_LEFTARROW ;
joywait = I_GetTime ( ) + NEWTICRATE / 17 ;
}
else if ( ev - > data2 > 0 & & pjoyx < = 0 )
{
ch = KEY_RIGHTARROW ;
joywait = I_GetTime ( ) + NEWTICRATE / 17 ;
}
pjoyx = ev - > data2 ;
2018-12-02 21:18:28 +00:00
}
2018-12-02 21:52:30 +00:00
else
pjoyx = 0 ;
2014-03-15 16:59:03 +00:00
}
}
else if ( ev - > type = = ev_mouse & & mousewait < I_GetTime ( ) )
{
pmousey + = ev - > data3 ;
if ( pmousey < lasty - 30 )
{
ch = KEY_DOWNARROW ;
mousewait = I_GetTime ( ) + NEWTICRATE / 7 ;
pmousey = lasty - = 30 ;
}
else if ( pmousey > lasty + 30 )
{
ch = KEY_UPARROW ;
mousewait = I_GetTime ( ) + NEWTICRATE / 7 ;
pmousey = lasty + = 30 ;
}
pmousex + = ev - > data2 ;
if ( pmousex < lastx - 30 )
{
ch = KEY_LEFTARROW ;
mousewait = I_GetTime ( ) + NEWTICRATE / 7 ;
pmousex = lastx - = 30 ;
}
else if ( pmousex > lastx + 30 )
{
ch = KEY_RIGHTARROW ;
mousewait = I_GetTime ( ) + NEWTICRATE / 7 ;
pmousex = lastx + = 30 ;
}
}
2019-09-06 18:25:11 +00:00
else if ( ev - > type = = ev_keyup ) // Preserve event for other responders
keydown = 0 ;
2014-03-15 16:59:03 +00:00
}
2018-12-03 08:36:04 +00:00
else if ( ev - > type = = ev_keydown ) // Preserve event for other responders
ch = ev - > data1 ;
2014-03-15 16:59:03 +00:00
if ( ch = = - 1 )
return false ;
2018-12-03 16:21:25 +00:00
else if ( ch = = gamecontrol [ gc_systemmenu ] [ 0 ] | | ch = = gamecontrol [ gc_systemmenu ] [ 1 ] ) // allow remappable ESC key
ch = KEY_ESCAPE ;
2014-03-15 16:59:03 +00:00
// F-Keys
if ( ! menuactive )
{
2016-04-07 01:01:01 +00:00
noFurtherInput = true ;
2014-03-15 16:59:03 +00:00
switch ( ch )
{
case KEY_F1 : // Help key
2019-10-15 12:36:04 +00:00
Command_Manual_f ( ) ;
2014-03-15 16:59:03 +00:00
return true ;
case KEY_F2 : // Empty
return true ;
case KEY_F3 : // Toggle HUD
CV_SetValue ( & cv_showhud , ! cv_showhud . value ) ;
return true ;
case KEY_F4 : // Sound Volume
if ( modeattacking )
return true ;
M_StartControlPanel ( ) ;
2015-09-01 11:45:26 +00:00
M_Options ( 0 ) ;
2019-07-08 20:17:40 +00:00
// Uncomment the below if you want the menu to reset to the top each time like before. M_SetupNextMenu will fix it automatically.
//OP_SoundOptionsDef.lastOn = 0;
M_SetupNextMenu ( & OP_SoundOptionsDef ) ;
2014-03-15 16:59:03 +00:00
return true ;
case KEY_F5 : // Video Mode
if ( modeattacking )
return true ;
M_StartControlPanel ( ) ;
2015-09-01 11:45:26 +00:00
M_Options ( 0 ) ;
2014-03-15 16:59:03 +00:00
M_VideoModeMenu ( 0 ) ;
return true ;
case KEY_F6 : // Empty
return true ;
case KEY_F7 : // Options
if ( modeattacking )
return true ;
M_StartControlPanel ( ) ;
2015-09-01 11:45:26 +00:00
M_Options ( 0 ) ;
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & OP_MainDef ) ;
return true ;
// Screenshots on F8 now handled elsewhere
// Same with Moviemode on F9
case KEY_F10 : // Quit SRB2
M_QuitSRB2 ( 0 ) ;
return true ;
case KEY_F11 : // Gamma Level
2017-04-19 21:24:28 +00:00
CV_AddValue ( & cv_globalgamma , 1 ) ;
2014-03-15 16:59:03 +00:00
return true ;
// Spymode on F12 handled in game logic
case KEY_ESCAPE : // Pop up menu
if ( chat_on )
{
HU_clearChatChars ( ) ;
chat_on = false ;
}
else
M_StartControlPanel ( ) ;
return true ;
}
2016-04-07 01:01:01 +00:00
noFurtherInput = false ; // turns out we didn't care
2014-03-15 16:59:03 +00:00
return false ;
}
routine = currentMenu - > menuitems [ itemOn ] . itemaction ;
// Handle menuitems which need a specific key handling
if ( routine & & ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_KEYHANDLER )
{
if ( shiftdown & & ch > = 32 & & ch < = 127 )
ch = shiftxform [ ch ] ;
routine ( ch ) ;
return true ;
}
if ( currentMenu - > menuitems [ itemOn ] . status = = IT_MSGHANDLER )
{
if ( currentMenu - > menuitems [ itemOn ] . alphaKey ! = MM_EVENTHANDLER )
{
if ( ch = = ' ' | | ch = = ' n ' | | ch = = ' y ' | | ch = = KEY_ESCAPE | | ch = = KEY_ENTER )
{
if ( routine )
routine ( ch ) ;
M_StopMessage ( 0 ) ;
2016-04-07 01:01:01 +00:00
noFurtherInput = true ;
2014-03-15 16:59:03 +00:00
return true ;
}
return true ;
}
else
{
// dirty hack: for customising controls, I want only buttons/keys, not moves
if ( ev - > type = = ev_mouse | | ev - > type = = ev_mouse2 | | ev - > type = = ev_joystick
| | ev - > type = = ev_joystick2 )
return true ;
if ( routine )
{
void ( * otherroutine ) ( event_t * sev ) = currentMenu - > menuitems [ itemOn ] . itemaction ;
otherroutine ( ev ) ; //Alam: what a hack
}
return true ;
}
}
// BP: one of the more big hack i have never made
if ( routine & & ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_CVAR )
{
if ( ( currentMenu - > menuitems [ itemOn ] . status & IT_CVARTYPE ) = = IT_CV_STRING )
{
if ( M_ChangeStringCvar ( ch ) )
return true ;
else
routine = NULL ;
}
else
routine = M_ChangeCvar ;
}
// Keys usable within menu
switch ( ch )
{
case KEY_DOWNARROW :
M_NextOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ;
return true ;
case KEY_UPARROW :
M_PrevOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ;
return true ;
case KEY_LEFTARROW :
if ( routine & & ( ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_ARROWS
| | ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_CVAR ) )
{
2017-04-18 11:32:06 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2014-03-15 16:59:03 +00:00
routine ( 0 ) ;
}
return true ;
case KEY_RIGHTARROW :
if ( routine & & ( ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_ARROWS
| | ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_CVAR ) )
{
2017-04-18 11:32:06 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2014-03-15 16:59:03 +00:00
routine ( 1 ) ;
}
return true ;
case KEY_ENTER :
2016-04-07 01:01:01 +00:00
noFurtherInput = true ;
2014-03-15 16:59:03 +00:00
currentMenu - > lastOn = itemOn ;
if ( routine )
{
if ( ( ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_CALL
| | ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_SUBMENU )
& & ( currentMenu - > menuitems [ itemOn ] . status & IT_CALLTYPE ) )
{
2019-11-08 15:48:11 +00:00
# ifndef DEVELOP
2014-03-15 16:59:03 +00:00
if ( ( ( currentMenu - > menuitems [ itemOn ] . status & IT_CALLTYPE ) & IT_CALL_NOTMODIFIED ) & & modifiedgame & & ! savemoddata )
{
2017-08-27 17:46:53 +00:00
S_StartSound ( NULL , sfx_skid ) ;
2014-03-15 16:59:03 +00:00
M_StartMessage ( M_GetText ( " This cannot be done in a modified game. \n \n (Press a key) \n " ) , NULL , MM_NOTHING ) ;
return true ;
}
2019-11-08 15:48:11 +00:00
# endif
2014-03-15 16:59:03 +00:00
}
S_StartSound ( NULL , sfx_menu1 ) ;
switch ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE )
{
case IT_CVAR :
case IT_ARROWS :
routine ( 1 ) ; // right arrow
break ;
case IT_CALL :
routine ( itemOn ) ;
break ;
case IT_SUBMENU :
currentMenu - > lastOn = itemOn ;
M_SetupNextMenu ( ( menu_t * ) currentMenu - > menuitems [ itemOn ] . itemaction ) ;
break ;
}
}
return true ;
case KEY_ESCAPE :
2016-04-07 01:01:01 +00:00
noFurtherInput = true ;
2014-03-15 16:59:03 +00:00
currentMenu - > lastOn = itemOn ;
2017-01-29 19:25:43 +00:00
M_GoBack ( 0 ) ;
2014-03-15 16:59:03 +00:00
return true ;
case KEY_BACKSPACE :
if ( ( currentMenu - > menuitems [ itemOn ] . status ) = = IT_CONTROL )
{
// detach any keys associated with the game control
G_ClearControlKeys ( setupcontrols , currentMenu - > menuitems [ itemOn ] . alphaKey ) ;
2017-04-15 14:42:03 +00:00
S_StartSound ( NULL , sfx_shldls ) ;
2014-03-15 16:59:03 +00:00
return true ;
}
2019-06-18 13:36:06 +00:00
if ( routine & & ( ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_ARROWS
| | ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_CVAR ) )
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ itemOn ] . itemaction ;
if ( cv = = & cv_chooseskin
| | cv = = & cv_nextmap
| | cv = = & cv_newgametype )
return true ;
if ( currentMenu ! = & OP_SoundOptionsDef | | itemOn > 3 )
S_StartSound ( NULL , sfx_menu1 ) ;
routine ( - 1 ) ;
return true ;
}
2014-03-15 16:59:03 +00:00
// Why _does_ backspace go back anyway?
//currentMenu->lastOn = itemOn;
//if (currentMenu->prevMenu)
// M_SetupNextMenu(currentMenu->prevMenu);
return false ;
default :
break ;
}
return true ;
}
//
// M_Drawer
// Called after the view has been rendered,
// but before it has been blitted.
//
void M_Drawer ( void )
{
2019-09-10 02:31:48 +00:00
boolean wipe = WipeInAction ;
2019-11-15 21:21:12 +00:00
if ( WipeInLevel )
2019-09-10 02:31:48 +00:00
wipe = false ;
2014-03-15 16:59:03 +00:00
if ( currentMenu = = & MessageDef )
menuactive = true ;
2016-04-07 01:01:01 +00:00
if ( menuactive )
{
// now that's more readable with a faded background (yeah like Quake...)
2019-09-10 02:31:48 +00:00
if ( ! wipe & & ( curfadevalue | | ( gamestate ! = GS_TITLESCREEN & & gamestate ! = GS_TIMEATTACK ) ) )
2018-11-20 22:28:26 +00:00
V_DrawFadeScreen ( 0xFF00 , ( gamestate ! = GS_TITLESCREEN & & gamestate ! = GS_TIMEATTACK ) ? 16 : curfadevalue ) ;
2014-03-15 16:59:03 +00:00
2016-04-07 01:01:01 +00:00
if ( currentMenu - > drawroutine )
currentMenu - > drawroutine ( ) ; // call current menu Draw routine
2014-03-15 16:59:03 +00:00
2016-04-07 01:01:01 +00:00
// Draw version down in corner
// ... but only in the MAIN MENU. I'm a picky bastard.
if ( currentMenu = = & MainDef )
2016-01-14 12:31:48 +00:00
{
2016-04-07 01:01:01 +00:00
if ( customversionstring [ 0 ] ! = ' \0 ' )
{
V_DrawThinString ( vid . dupx , vid . height - 17 * vid . dupy , V_NOSCALESTART | V_TRANSLUCENT , " Mod version: " ) ;
V_DrawThinString ( vid . dupx , vid . height - 9 * vid . dupy , V_NOSCALESTART | V_TRANSLUCENT | V_ALLOWLOWERCASE , customversionstring ) ;
}
else
{
2016-01-14 12:31:48 +00:00
# ifdef DEVELOP // Development -- show revision / branch info
2016-04-07 01:01:01 +00:00
V_DrawThinString ( vid . dupx , vid . height - 17 * vid . dupy , V_NOSCALESTART | V_TRANSLUCENT | V_ALLOWLOWERCASE , compbranch ) ;
V_DrawThinString ( vid . dupx , vid . height - 9 * vid . dupy , V_NOSCALESTART | V_TRANSLUCENT | V_ALLOWLOWERCASE , comprevision ) ;
2016-01-14 12:31:48 +00:00
# else // Regular build
2016-04-07 01:01:01 +00:00
V_DrawThinString ( vid . dupx , vid . height - 9 * vid . dupy , V_NOSCALESTART | V_TRANSLUCENT | V_ALLOWLOWERCASE , va ( " %s " , VERSIONSTRING ) ) ;
2014-03-15 16:59:03 +00:00
# endif
2016-04-07 01:01:01 +00:00
}
2016-01-14 12:31:48 +00:00
}
2014-03-15 16:59:03 +00:00
}
2016-04-07 01:01:01 +00:00
// focus lost notification goes on top of everything, even the former everything
2019-03-11 19:50:01 +00:00
if ( window_notinfocus & & cv_showfocuslost . value )
2016-04-07 01:01:01 +00:00
{
M_DrawTextBox ( ( BASEVIDWIDTH / 2 ) - ( 60 ) , ( BASEVIDHEIGHT / 2 ) - ( 16 ) , 13 , 2 ) ;
if ( gamestate = = GS_LEVEL & & ( P_AutoPause ( ) | | paused ) )
V_DrawCenteredString ( BASEVIDWIDTH / 2 , ( BASEVIDHEIGHT / 2 ) - ( 4 ) , V_YELLOWMAP , " Game Paused " ) ;
else
V_DrawCenteredString ( BASEVIDWIDTH / 2 , ( BASEVIDHEIGHT / 2 ) - ( 4 ) , V_YELLOWMAP , " Focus Lost " ) ;
}
2014-03-15 16:59:03 +00:00
}
//
// M_StartControlPanel
//
void M_StartControlPanel ( void )
{
// time attack HACK
if ( modeattacking & & demoplayback )
{
G_CheckDemoStatus ( ) ;
return ;
}
// intro might call this repeatedly
if ( menuactive )
{
CON_ToggleOff ( ) ; // move away console
return ;
}
menuactive = true ;
if ( ! Playing ( ) )
{
// Secret menu!
2019-11-21 01:19:31 +00:00
MainMenu [ singleplr ] . alphaKey = ( M_AnySecretUnlocked ( ) ) ? 76 : 84 ;
MainMenu [ multiplr ] . alphaKey = ( M_AnySecretUnlocked ( ) ) ? 84 : 92 ;
2014-03-15 16:59:03 +00:00
MainMenu [ secrets ] . status = ( M_AnySecretUnlocked ( ) ) ? ( IT_STRING | IT_CALL ) : ( IT_DISABLED ) ;
currentMenu = & MainDef ;
itemOn = singleplr ;
}
else if ( modeattacking )
{
currentMenu = & MAPauseDef ;
itemOn = mapause_continue ;
}
else if ( ! ( netgame | | multiplayer ) ) // Single Player
{
if ( gamestate ! = GS_LEVEL | | ultimatemode ) // intermission, so gray out stuff.
{
SPauseMenu [ spause_pandora ] . status = ( M_SecretUnlocked ( SECRET_PANDORA ) ) ? ( IT_GRAYEDOUT ) : ( IT_DISABLED ) ;
SPauseMenu [ spause_retry ] . status = IT_GRAYEDOUT ;
}
else
{
INT32 numlives = 2 ;
SPauseMenu [ spause_pandora ] . status = ( M_SecretUnlocked ( SECRET_PANDORA ) ) ? ( IT_STRING | IT_CALL ) : ( IT_DISABLED ) ;
if ( & players [ consoleplayer ] )
{
numlives = players [ consoleplayer ] . lives ;
if ( players [ consoleplayer ] . playerstate ! = PST_LIVE )
+ + numlives ;
}
// The list of things that can disable retrying is (was?) a little too complex
// for me to want to use the short if statement syntax
if ( numlives < = 1 | | G_IsSpecialStage ( gamemap ) )
SPauseMenu [ spause_retry ] . status = ( IT_GRAYEDOUT ) ;
else
SPauseMenu [ spause_retry ] . status = ( IT_STRING | IT_CALL ) ;
}
// We can always use level select though. :33
SPauseMenu [ spause_levelselect ] . status = ( gamecomplete ) ? ( IT_STRING | IT_CALL ) : ( IT_DISABLED ) ;
// And emblem hints.
SPauseMenu [ spause_hints ] . status = ( M_SecretUnlocked ( SECRET_EMBLEMHINTS ) ) ? ( IT_STRING | IT_CALL ) : ( IT_DISABLED ) ;
// Shift up Pandora's Box if both pandora and levelselect are active
/*if (SPauseMenu[spause_pandora].status != (IT_DISABLED)
& & SPauseMenu [ spause_levelselect ] . status ! = ( IT_DISABLED ) )
SPauseMenu [ spause_pandora ] . alphaKey = 24 ;
else
SPauseMenu [ spause_pandora ] . alphaKey = 32 ; */
currentMenu = & SPauseDef ;
itemOn = spause_continue ;
}
else // multiplayer
{
MPauseMenu [ mpause_switchmap ] . status = IT_DISABLED ;
2017-04-29 15:40:07 +00:00
MPauseMenu [ mpause_addons ] . status = IT_DISABLED ;
2014-03-15 16:59:03 +00:00
MPauseMenu [ mpause_scramble ] . status = IT_DISABLED ;
MPauseMenu [ mpause_psetupsplit ] . status = IT_DISABLED ;
MPauseMenu [ mpause_psetupsplit2 ] . status = IT_DISABLED ;
MPauseMenu [ mpause_spectate ] . status = IT_DISABLED ;
MPauseMenu [ mpause_entergame ] . status = IT_DISABLED ;
MPauseMenu [ mpause_switchteam ] . status = IT_DISABLED ;
MPauseMenu [ mpause_psetup ] . status = IT_DISABLED ;
2017-11-11 05:34:37 +00:00
if ( ( server | | IsPlayerAdmin ( consoleplayer ) ) )
2014-03-15 16:59:03 +00:00
{
MPauseMenu [ mpause_switchmap ] . status = IT_STRING | IT_CALL ;
2017-04-29 15:40:07 +00:00
MPauseMenu [ mpause_addons ] . status = IT_STRING | IT_CALL ;
2014-03-15 16:59:03 +00:00
if ( G_GametypeHasTeams ( ) )
MPauseMenu [ mpause_scramble ] . status = IT_STRING | IT_SUBMENU ;
}
if ( splitscreen )
2017-04-17 21:41:23 +00:00
{
2014-03-15 16:59:03 +00:00
MPauseMenu [ mpause_psetupsplit ] . status = MPauseMenu [ mpause_psetupsplit2 ] . status = IT_STRING | IT_CALL ;
2017-04-17 21:41:23 +00:00
MPauseMenu [ mpause_psetup ] . text = " Player 1 Setup " ;
}
2014-03-15 16:59:03 +00:00
else
{
MPauseMenu [ mpause_psetup ] . status = IT_STRING | IT_CALL ;
2017-04-17 21:41:23 +00:00
MPauseMenu [ mpause_psetup ] . text = " Player Setup " ;
2014-03-15 16:59:03 +00:00
if ( G_GametypeHasTeams ( ) )
MPauseMenu [ mpause_switchteam ] . status = IT_STRING | IT_SUBMENU ;
else if ( G_GametypeHasSpectators ( ) )
MPauseMenu [ ( ( & players [ consoleplayer ] & & players [ consoleplayer ] . spectator ) ? mpause_entergame : mpause_spectate ) ] . status = IT_STRING | IT_CALL ;
else // in this odd case, we still want something to be on the menu even if it's useless
MPauseMenu [ mpause_spectate ] . status = IT_GRAYEDOUT ;
}
currentMenu = & MPauseDef ;
itemOn = mpause_continue ;
}
CON_ToggleOff ( ) ; // move away console
}
void M_EndModeAttackRun ( void )
{
M_ModeAttackEndGame ( 0 ) ;
}
//
// M_ClearMenus
//
void M_ClearMenus ( boolean callexitmenufunc )
{
if ( ! menuactive )
return ;
if ( currentMenu - > quitroutine & & callexitmenufunc & & ! currentMenu - > quitroutine ( ) )
return ; // we can't quit this menu (also used to set parameter from the menu)
2017-09-29 17:19:34 +00:00
// Save the config file. I'm sick of crashing the game later and losing all my changes!
2014-03-15 16:59:03 +00:00
COM_BufAddText ( va ( " saveconfig \" %s \" -silent \n " , configfile ) ) ;
if ( currentMenu = = & MessageDef ) // Oh sod off!
currentMenu = & MainDef ; // Not like it matters
menuactive = false ;
2019-08-19 17:43:48 +00:00
hidetitlemap = false ;
2014-03-15 16:59:03 +00:00
}
//
// M_SetupNextMenu
//
void M_SetupNextMenu ( menu_t * menudef )
{
INT16 i ;
if ( currentMenu - > quitroutine )
{
// If you're going from a menu to itself, why are you running the quitroutine? You're not quitting it! -SH
if ( currentMenu ! = menudef & & ! currentMenu - > quitroutine ( ) )
return ; // we can't quit this menu (also used to set parameter from the menu)
}
2018-11-17 21:32:30 +00:00
2018-11-25 20:08:12 +00:00
M_HandleMenuPresState ( menudef ) ;
2018-11-17 21:32:30 +00:00
2014-03-15 16:59:03 +00:00
currentMenu = menudef ;
itemOn = currentMenu - > lastOn ;
// in case of...
if ( itemOn > = currentMenu - > numitems )
itemOn = currentMenu - > numitems - 1 ;
// the curent item can be disabled,
// this code go up until an enabled item found
if ( ( currentMenu - > menuitems [ itemOn ] . status & IT_TYPE ) = = IT_SPACE )
{
for ( i = 0 ; i < currentMenu - > numitems ; i + + )
{
if ( ( currentMenu - > menuitems [ i ] . status & IT_TYPE ) ! = IT_SPACE )
{
itemOn = i ;
break ;
}
}
}
2019-08-19 17:43:48 +00:00
hidetitlemap = false ;
2014-03-15 16:59:03 +00:00
}
//
// M_Ticker
//
void M_Ticker ( void )
{
2016-04-07 01:01:01 +00:00
// reset input trigger
noFurtherInput = false ;
2014-03-15 16:59:03 +00:00
if ( dedicated )
return ;
if ( - - skullAnimCounter < = 0 )
skullAnimCounter = 8 ;
//added : 30-01-98 : test mode for five seconds
if ( vidm_testingmode > 0 )
{
// restore the previous video mode
if ( - - vidm_testingmode = = 0 )
setmodeneeded = vidm_previousmode + 1 ;
}
}
//
// M_Init
//
void M_Init ( void )
{
2019-09-24 03:54:53 +00:00
int i ;
2019-10-15 12:36:04 +00:00
COM_AddCommand ( " manual " , Command_Manual_f ) ;
2014-03-15 16:59:03 +00:00
CV_RegisterVar ( & cv_nextmap ) ;
CV_RegisterVar ( & cv_newgametype ) ;
CV_RegisterVar ( & cv_chooseskin ) ;
CV_RegisterVar ( & cv_autorecord ) ;
if ( dedicated )
return ;
// Menu hacks
CV_RegisterVar ( & cv_dummyteam ) ;
CV_RegisterVar ( & cv_dummyscramble ) ;
CV_RegisterVar ( & cv_dummyrings ) ;
CV_RegisterVar ( & cv_dummylives ) ;
CV_RegisterVar ( & cv_dummycontinues ) ;
CV_RegisterVar ( & cv_dummymares ) ;
quitmsg [ QUITMSG ] = M_GetText ( " Eggman's tied explosives \n to your girlfriend, and \n will activate them if \n you press the 'Y' key! \n Press 'N' to save her! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG1 ] = M_GetText ( " What would Tails say if \n he saw you quitting the game? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG2 ] = M_GetText ( " Hey! \n Where do ya think you're goin'? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG3 ] = M_GetText ( " Forget your studies! \n Play some more! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG4 ] = M_GetText ( " You're trying to say you \n like Sonic 2K6 better than \n this, right? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG5 ] = M_GetText ( " Don't leave yet -- there's a \n super emerald around that corner! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG6 ] = M_GetText ( " You'd rather work than play? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUITMSG7 ] = M_GetText ( " Go ahead and leave. See if I care... \n *sniffle* \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG ] = M_GetText ( " If you leave now, \n Eggman will take over the world! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG1 ] = M_GetText ( " Don't quit! \n There are animals \n to save! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG2 ] = M_GetText ( " Aw c'mon, just bop \n a few more robots! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG3 ] = M_GetText ( " Did you get all those Chaos Emeralds? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG4 ] = M_GetText ( " If you leave, I'll use \n my spin attack on you! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG5 ] = M_GetText ( " Don't go! \n You might find the hidden \n levels! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT2MSG6 ] = M_GetText ( " Hit the 'N' key, Sonic! \n The 'N' key! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG ] = M_GetText ( " Are you really going to give up? \n We certainly would never give you up. \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG1 ] = M_GetText ( " Come on, just ONE more netgame! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG2 ] = M_GetText ( " Press 'N' to unlock \n the Ultimate Cheat! \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG3 ] = M_GetText ( " Why don't you go back and try \n jumping on that house to \n see what happens? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG4 ] = M_GetText ( " Every time you press 'Y', an \n SRB2 Developer cries... \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG5 ] = M_GetText ( " You'll be back to play soon, though... \n ......right? \n \n (Press 'Y' to quit) " ) ;
quitmsg [ QUIT3MSG6 ] = M_GetText ( " Aww, is Egg Rock Zone too \n difficult for you? \n \n (Press 'Y' to quit) " ) ;
# ifdef HWRENDER
// Permanently hide some options based on render mode
if ( rendermode = = render_soft )
2017-04-20 18:27:19 +00:00
OP_VideoOptionsMenu [ 4 ] . status = IT_DISABLED ;
2017-04-20 19:16:10 +00:00
else if ( rendermode = = render_opengl )
OP_ScreenshotOptionsMenu [ op_screenshot_colorprofile ] . status = IT_GRAYEDOUT ;
2014-03-15 16:59:03 +00:00
# endif
2019-09-24 03:54:53 +00:00
/*
Well the menu sucks for forcing us to have an item set
at all if every item just calls the same function , and
nothing more . Now just automate the definition .
*/
for ( i = 0 ; i < = MAX_JOYSTICKS ; + + i )
{
OP_JoystickSetMenu [ i ] . status = ( IT_NOTHING | IT_CALL ) ;
OP_JoystickSetMenu [ i ] . itemaction = M_AssignJoystick ;
}
2014-03-15 16:59:03 +00:00
# ifndef NONET
CV_RegisterVar ( & cv_serversort ) ;
# endif
}
2019-01-27 04:16:49 +00:00
void M_InitCharacterTables ( void )
{
UINT8 i ;
2019-01-16 01:09:55 +00:00
// Setup description table
for ( i = 0 ; i < MAXSKINS ; i + + )
{
2019-02-27 22:36:01 +00:00
description [ i ] . used = false ;
strcpy ( description [ i ] . notes , " ??? " ) ;
strcpy ( description [ i ] . picname , " " ) ;
2019-10-14 05:24:44 +00:00
strcpy ( description [ i ] . nametag , " " ) ;
2019-02-27 22:36:01 +00:00
strcpy ( description [ i ] . skinname , " " ) ;
2019-10-14 05:24:44 +00:00
strcpy ( description [ i ] . displayname , " " ) ;
2019-02-27 22:36:01 +00:00
description [ i ] . prev = description [ i ] . next = 0 ;
2019-08-19 17:23:03 +00:00
description [ i ] . charpic = NULL ;
description [ i ] . namepic = NULL ;
2019-10-14 05:24:44 +00:00
description [ i ] . oppositecolor = description [ i ] . tagtextcolor = description [ i ] . tagoutlinecolor = 0 ;
2019-01-16 01:09:55 +00:00
}
2014-03-15 16:59:03 +00:00
}
// ==========================================================================
// SPECIAL MENU OPTION DRAW ROUTINES GO HERE
// ==========================================================================
// Converts a string into question marks.
// Used for the secrets menu, to hide yet-to-be-unlocked stuff.
static const char * M_CreateSecretMenuOption ( const char * str )
{
static char qbuf [ 32 ] ;
int i ;
for ( i = 0 ; i < 31 ; + + i )
{
if ( ! str [ i ] )
{
qbuf [ i ] = ' \0 ' ;
return qbuf ;
}
else if ( str [ i ] ! = ' ' )
qbuf [ i ] = ' ? ' ;
else
qbuf [ i ] = ' ' ;
}
qbuf [ 31 ] = ' \0 ' ;
return qbuf ;
}
static void M_DrawThermo ( INT32 x , INT32 y , consvar_t * cv )
{
INT32 xx = x , i ;
lumpnum_t leftlump , rightlump , centerlump [ 2 ] , cursorlump ;
patch_t * p ;
leftlump = W_GetNumForName ( " M_THERML " ) ;
rightlump = W_GetNumForName ( " M_THERMR " ) ;
centerlump [ 0 ] = W_GetNumForName ( " M_THERMM " ) ;
centerlump [ 1 ] = W_GetNumForName ( " M_THERMM " ) ;
cursorlump = W_GetNumForName ( " M_THERMO " ) ;
V_DrawScaledPatch ( xx , y , 0 , p = W_CachePatchNum ( leftlump , PU_CACHE ) ) ;
xx + = SHORT ( p - > width ) - SHORT ( p - > leftoffset ) ;
for ( i = 0 ; i < 16 ; i + + )
{
V_DrawScaledPatch ( xx , y , V_WRAPX , W_CachePatchNum ( centerlump [ i & 1 ] , PU_CACHE ) ) ;
xx + = 8 ;
}
V_DrawScaledPatch ( xx , y , 0 , W_CachePatchNum ( rightlump , PU_CACHE ) ) ;
xx = ( cv - > value - cv - > PossibleValue [ 0 ] . value ) * ( 15 * 8 ) /
( cv - > PossibleValue [ 1 ] . value - cv - > PossibleValue [ 0 ] . value ) ;
V_DrawScaledPatch ( ( x + 8 ) + xx , y , 0 , W_CachePatchNum ( cursorlump , PU_CACHE ) ) ;
}
// A smaller 'Thermo', with range given as percents (0-100)
2017-07-04 12:17:29 +00:00
static void M_DrawSlider ( INT32 x , INT32 y , const consvar_t * cv , boolean ontop )
2014-03-15 16:59:03 +00:00
{
INT32 i ;
INT32 range ;
patch_t * p ;
x = BASEVIDWIDTH - x - SLIDER_WIDTH ;
2017-04-15 14:36:19 +00:00
V_DrawScaledPatch ( x , y , 0 , W_CachePatchName ( " M_SLIDEL " , PU_CACHE ) ) ;
2014-03-15 16:59:03 +00:00
p = W_CachePatchName ( " M_SLIDEM " , PU_CACHE ) ;
2017-04-15 14:36:19 +00:00
for ( i = 1 ; i < SLIDER_RANGE ; i + + )
2014-03-15 16:59:03 +00:00
V_DrawScaledPatch ( x + i * 8 , y , 0 , p ) ;
2017-07-04 12:17:29 +00:00
if ( ontop )
{
V_DrawCharacter ( x - 6 - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( x + i * 8 + 8 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2014-03-15 16:59:03 +00:00
p = W_CachePatchName ( " M_SLIDER " , PU_CACHE ) ;
2017-04-15 14:36:19 +00:00
V_DrawScaledPatch ( x + i * 8 , y , 0 , p ) ;
2014-03-15 16:59:03 +00:00
// draw the slider cursor
p = W_CachePatchName ( " M_SLIDEC " , PU_CACHE ) ;
2017-04-18 22:21:10 +00:00
for ( i = 0 ; cv - > PossibleValue [ i + 1 ] . strvalue ; i + + ) ;
2019-09-19 09:34:04 +00:00
if ( cv - > flags & CV_FLOAT )
range = ( INT32 ) ( atof ( cv - > defaultvalue ) * FRACUNIT ) ;
else
range = atoi ( cv - > defaultvalue ) ;
if ( range ! = cv - > value )
2017-04-18 22:21:10 +00:00
{
range = ( ( range - cv - > PossibleValue [ 0 ] . value ) * 100 /
( cv - > PossibleValue [ i ] . value - cv - > PossibleValue [ 0 ] . value ) ) ;
if ( range < 0 )
range = 0 ;
else if ( range > 100 )
range = 100 ;
V_DrawMappedPatch ( x + 2 + ( SLIDER_RANGE * 8 * range ) / 100 , y , V_TRANSLUCENT , p , yellowmap ) ;
}
range = ( ( cv - > value - cv - > PossibleValue [ 0 ] . value ) * 100 /
( cv - > PossibleValue [ i ] . value - cv - > PossibleValue [ 0 ] . value ) ) ;
if ( range < 0 )
range = 0 ;
else if ( range > 100 )
range = 100 ;
2017-04-15 14:36:19 +00:00
V_DrawMappedPatch ( x + 2 + ( SLIDER_RANGE * 8 * range ) / 100 , y , 0 , p , yellowmap ) ;
2014-03-15 16:59:03 +00:00
}
//
// Draw a textbox, like Quake does, because sometimes it's difficult
// to read the text with all the stuff in the background...
//
void M_DrawTextBox ( INT32 x , INT32 y , INT32 width , INT32 boxlines )
{
// Solid color textbox.
2015-11-07 19:56:21 +00:00
V_DrawFill ( x + 5 , y + 5 , width * 8 + 6 , boxlines * 8 + 6 , 159 ) ;
2014-03-15 16:59:03 +00:00
//V_DrawFill(x+8, y+8, width*8, boxlines*8, 31);
/*
patch_t * p ;
INT32 cx , cy , n ;
INT32 step , boff ;
step = 8 ;
boff = 8 ;
// draw left side
cx = x ;
cy = y ;
V_DrawScaledPatch ( cx , cy , 0 , W_CachePatchNum ( viewborderlump [ BRDR_TL ] , PU_CACHE ) ) ;
cy + = boff ;
p = W_CachePatchNum ( viewborderlump [ BRDR_L ] , PU_CACHE ) ;
for ( n = 0 ; n < boxlines ; n + + )
{
V_DrawScaledPatch ( cx , cy , V_WRAPY , p ) ;
cy + = step ;
}
V_DrawScaledPatch ( cx , cy , 0 , W_CachePatchNum ( viewborderlump [ BRDR_BL ] , PU_CACHE ) ) ;
// draw middle
V_DrawFlatFill ( x + boff , y + boff , width * step , boxlines * step , st_borderpatchnum ) ;
cx + = boff ;
cy = y ;
while ( width > 0 )
{
V_DrawScaledPatch ( cx , cy , V_WRAPX , W_CachePatchNum ( viewborderlump [ BRDR_T ] , PU_CACHE ) ) ;
V_DrawScaledPatch ( cx , y + boff + boxlines * step , V_WRAPX , W_CachePatchNum ( viewborderlump [ BRDR_B ] , PU_CACHE ) ) ;
width - - ;
cx + = step ;
}
// draw right side
cy = y ;
V_DrawScaledPatch ( cx , cy , 0 , W_CachePatchNum ( viewborderlump [ BRDR_TR ] , PU_CACHE ) ) ;
cy + = boff ;
p = W_CachePatchNum ( viewborderlump [ BRDR_R ] , PU_CACHE ) ;
for ( n = 0 ; n < boxlines ; n + + )
{
V_DrawScaledPatch ( cx , cy , V_WRAPY , p ) ;
cy + = step ;
}
V_DrawScaledPatch ( cx , cy , 0 , W_CachePatchNum ( viewborderlump [ BRDR_BR ] , PU_CACHE ) ) ;
*/
}
2017-10-25 15:40:21 +00:00
static fixed_t staticalong = 0 ;
static void M_DrawStaticBox ( fixed_t x , fixed_t y , INT32 flags , fixed_t w , fixed_t h )
{
2017-10-26 15:58:18 +00:00
patch_t * patch ;
fixed_t sw , pw ;
patch = W_CachePatchName ( " LSSTATIC " , PU_CACHE ) ;
pw = SHORT ( patch - > width ) - ( sw = w * 2 ) ; //FixedDiv(w, scale); -- for scale FRACUNIT/2
/*if (pw > 0) -- model code for modders providing weird LSSTATIC
{
if ( staticalong > pw )
staticalong - = pw ;
}
else
staticalong = 0 ; */
2017-10-25 15:40:21 +00:00
2017-10-26 15:58:18 +00:00
if ( staticalong > pw ) // simplified for base LSSTATIC
staticalong - = pw ;
2017-10-25 15:40:21 +00:00
2017-10-26 15:58:18 +00:00
V_DrawCroppedPatch ( x < < FRACBITS , y < < FRACBITS , FRACUNIT / 2 , flags , patch , staticalong , 0 , sw , h * 2 ) ; // FixedDiv(h, scale)); -- for scale FRACUNIT/2
2017-10-25 15:40:21 +00:00
2017-10-26 15:58:18 +00:00
staticalong + = sw ; //M_RandomRange(sw/2, 2*sw); -- turns out less randomisation looks better because immediately adjacent frames can't end up close to each other
2017-10-25 15:40:21 +00:00
2017-10-26 15:58:18 +00:00
W_UnlockCachedPatch ( patch ) ;
}
2017-10-25 15:40:21 +00:00
2014-03-15 16:59:03 +00:00
//
// Draw border for the savegame description
//
2019-01-07 20:43:58 +00:00
#if 0 // once used for joysticks and savegames, now no longer
2014-03-15 16:59:03 +00:00
static void M_DrawSaveLoadBorder ( INT32 x , INT32 y )
{
INT32 i ;
V_DrawScaledPatch ( x - 8 , y + 7 , 0 , W_CachePatchName ( " M_LSLEFT " , PU_CACHE ) ) ;
for ( i = 0 ; i < 24 ; i + + )
{
V_DrawScaledPatch ( x , y + 7 , 0 , W_CachePatchName ( " M_LSCNTR " , PU_CACHE ) ) ;
x + = 8 ;
}
V_DrawScaledPatch ( x , y + 7 , 0 , W_CachePatchName ( " M_LSRGHT " , PU_CACHE ) ) ;
}
2019-01-07 20:43:58 +00:00
# endif
2014-03-15 16:59:03 +00:00
// horizontally centered text
static void M_CentreText ( INT32 y , const char * string )
{
INT32 x ;
//added : 02-02-98 : centre on 320, because V_DrawString centers on vid.width...
x = ( BASEVIDWIDTH - V_StringWidth ( string , V_OLDSPACING ) ) > > 1 ;
V_DrawString ( x , y , V_OLDSPACING , string ) ;
}
//
// M_DrawMapEmblems
//
// used by pause & statistics to draw a row of emblems for a map
//
static void M_DrawMapEmblems ( INT32 mapnum , INT32 x , INT32 y )
{
UINT8 lasttype = UINT8_MAX , curtype ;
emblem_t * emblem = M_GetLevelEmblems ( mapnum ) ;
while ( emblem )
{
switch ( emblem - > type )
{
case ET_SCORE : case ET_TIME : case ET_RINGS :
curtype = 1 ; break ;
case ET_NGRADE : case ET_NTIME :
curtype = 2 ; break ;
2017-03-22 16:59:16 +00:00
case ET_MAP :
curtype = 3 ; break ;
2014-03-15 16:59:03 +00:00
default :
curtype = 0 ; break ;
}
// Shift over if emblem is of a different discipline
if ( lasttype ! = UINT8_MAX & & lasttype ! = curtype )
x - = 4 ;
lasttype = curtype ;
if ( emblem - > collected )
2019-10-16 02:54:21 +00:00
V_DrawSmallMappedPatch ( x , y , 0 , W_CachePatchName ( M_GetEmblemPatch ( emblem , false ) , PU_CACHE ) ,
2014-03-15 16:59:03 +00:00
R_GetTranslationColormap ( TC_DEFAULT , M_GetEmblemColor ( emblem ) , GTC_CACHE ) ) ;
else
V_DrawSmallScaledPatch ( x , y , 0 , W_CachePatchName ( " NEEDIT " , PU_CACHE ) ) ;
emblem = M_GetLevelEmblems ( - 1 ) ;
x - = 12 ;
}
}
static void M_DrawMenuTitle ( void )
{
if ( currentMenu - > menutitlepic )
{
patch_t * p = W_CachePatchName ( currentMenu - > menutitlepic , PU_CACHE ) ;
if ( p - > height > 24 ) // title is larger than normal
{
INT32 xtitle = ( BASEVIDWIDTH - ( SHORT ( p - > width ) / 2 ) ) / 2 ;
INT32 ytitle = ( 30 - ( SHORT ( p - > height ) / 2 ) ) / 2 ;
if ( xtitle < 0 )
xtitle = 0 ;
if ( ytitle < 0 )
ytitle = 0 ;
V_DrawSmallScaledPatch ( xtitle , ytitle , 0 , p ) ;
}
else
{
INT32 xtitle = ( BASEVIDWIDTH - SHORT ( p - > width ) ) / 2 ;
INT32 ytitle = ( 30 - SHORT ( p - > height ) ) / 2 ;
if ( xtitle < 0 )
xtitle = 0 ;
if ( ytitle < 0 )
ytitle = 0 ;
V_DrawScaledPatch ( xtitle , ytitle , 0 , p ) ;
}
}
}
static void M_DrawGenericMenu ( void )
{
INT32 x , y , i , cursory = 0 ;
// DRAW MENU
x = currentMenu - > x ;
y = currentMenu - > y ;
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
for ( i = 0 ; i < currentMenu - > numitems ; i + + )
{
if ( i = = itemOn )
cursory = y ;
switch ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY )
{
case IT_PATCH :
if ( currentMenu - > menuitems [ i ] . patch & & currentMenu - > menuitems [ i ] . patch [ 0 ] )
{
if ( currentMenu - > menuitems [ i ] . status & IT_CENTER )
{
patch_t * p ;
p = W_CachePatchName ( currentMenu - > menuitems [ i ] . patch , PU_CACHE ) ;
V_DrawScaledPatch ( ( BASEVIDWIDTH - SHORT ( p - > width ) ) / 2 , y , 0 , p ) ;
}
else
{
V_DrawScaledPatch ( x , y , 0 ,
W_CachePatchName ( currentMenu - > menuitems [ i ] . patch , PU_CACHE ) ) ;
}
}
2017-09-28 13:39:47 +00:00
/* FALLTHRU */
2014-03-15 16:59:03 +00:00
case IT_NOTHING :
case IT_DYBIGSPACE :
y + = LINEHEIGHT ;
break ;
case IT_BIGSLIDER :
M_DrawThermo ( x , y , ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ) ;
y + = LINEHEIGHT ;
break ;
case IT_STRING :
case IT_WHITESTRING :
if ( currentMenu - > menuitems [ i ] . alphaKey )
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
if ( i = = itemOn )
cursory = y ;
if ( ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY ) = = IT_STRING )
V_DrawString ( x , y , 0 , currentMenu - > menuitems [ i ] . text ) ;
else
V_DrawString ( x , y , V_YELLOWMAP , currentMenu - > menuitems [ i ] . text ) ;
// Cvar specific handling
switch ( currentMenu - > menuitems [ i ] . status & IT_TYPE )
case IT_CVAR :
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ;
switch ( currentMenu - > menuitems [ i ] . status & IT_CVARTYPE )
{
case IT_CV_SLIDER :
2017-07-04 12:17:29 +00:00
M_DrawSlider ( x , y , cv , ( i = = itemOn ) ) ;
2014-03-15 16:59:03 +00:00
case IT_CV_NOPRINT : // color use this
case IT_CV_INVISSLIDER : // monitor toggles use this
break ;
case IT_CV_STRING :
M_DrawTextBox ( x , y + 4 , MAXSTRINGLENGTH , 1 ) ;
V_DrawString ( x + 8 , y + 12 , V_ALLOWLOWERCASE , cv - > string ) ;
if ( skullAnimCounter < 4 & & i = = itemOn )
V_DrawCharacter ( x + 8 + V_StringWidth ( cv - > string , 0 ) , y + 12 ,
' _ ' | 0x80 , false ) ;
y + = 16 ;
break ;
default :
2017-04-15 14:36:19 +00:00
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y ,
2014-03-15 16:59:03 +00:00
( ( cv - > flags & CV_CHEAT ) & & ! CV_IsSetToDefault ( cv ) ? V_REDMAP : V_YELLOWMAP ) , cv - > string ) ;
2017-07-04 12:17:29 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - x - 10 - V_StringWidth ( cv - > string , 0 ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2014-03-15 16:59:03 +00:00
break ;
}
break ;
}
y + = STRINGHEIGHT ;
break ;
case IT_STRING2 :
V_DrawString ( x , y , 0 , currentMenu - > menuitems [ i ] . text ) ;
2017-09-28 13:39:47 +00:00
/* FALLTHRU */
2014-03-15 16:59:03 +00:00
case IT_DYLITLSPACE :
y + = SMALLLINEHEIGHT ;
break ;
case IT_GRAYPATCH :
if ( currentMenu - > menuitems [ i ] . patch & & currentMenu - > menuitems [ i ] . patch [ 0 ] )
V_DrawMappedPatch ( x , y , 0 ,
W_CachePatchName ( currentMenu - > menuitems [ i ] . patch , PU_CACHE ) , graymap ) ;
y + = LINEHEIGHT ;
break ;
case IT_TRANSTEXT :
if ( currentMenu - > menuitems [ i ] . alphaKey )
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
2017-09-28 13:39:47 +00:00
/* FALLTHRU */
2014-03-15 16:59:03 +00:00
case IT_TRANSTEXT2 :
V_DrawString ( x , y , V_TRANSLUCENT , currentMenu - > menuitems [ i ] . text ) ;
y + = SMALLLINEHEIGHT ;
break ;
case IT_QUESTIONMARKS :
if ( currentMenu - > menuitems [ i ] . alphaKey )
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
V_DrawString ( x , y , V_TRANSLUCENT | V_OLDSPACING , M_CreateSecretMenuOption ( currentMenu - > menuitems [ i ] . text ) ) ;
y + = SMALLLINEHEIGHT ;
break ;
case IT_HEADERTEXT : // draws 16 pixels to the left, in yellow text
if ( currentMenu - > menuitems [ i ] . alphaKey )
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
2017-04-15 14:42:03 +00:00
//V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( y - ( lsheadingheight - 12 ) , currentMenu - > menuitems [ i ] . text , true , false ) ;
2014-03-15 16:59:03 +00:00
y + = SMALLLINEHEIGHT ;
break ;
}
}
// DRAW THE SKULL CURSOR
if ( ( ( currentMenu - > menuitems [ itemOn ] . status & IT_DISPLAY ) = = IT_PATCH )
| | ( ( currentMenu - > menuitems [ itemOn ] . status & IT_DISPLAY ) = = IT_NOTHING ) )
{
V_DrawScaledPatch ( currentMenu - > x + SKULLXOFF , cursory - 5 , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
}
else
{
V_DrawScaledPatch ( currentMenu - > x - 24 , cursory , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
V_DrawString ( currentMenu - > x , cursory , V_YELLOWMAP , currentMenu - > menuitems [ itemOn ] . text ) ;
}
}
2017-04-15 12:36:40 +00:00
# define scrollareaheight 72
// note that alphakey is multiplied by 2 for scrolling menus to allow greater usage in UINT8 range.
static void M_DrawGenericScrollMenu ( void )
{
2017-04-29 15:40:07 +00:00
INT32 x , y , i , max , bottom , tempcentery , cursory = 0 ;
2017-04-15 12:36:40 +00:00
// DRAW MENU
x = currentMenu - > x ;
y = currentMenu - > y ;
if ( ( currentMenu - > menuitems [ itemOn ] . alphaKey * 2 - currentMenu - > menuitems [ 0 ] . alphaKey * 2 ) < = scrollareaheight )
tempcentery = currentMenu - > y - currentMenu - > menuitems [ 0 ] . alphaKey * 2 ;
else if ( ( currentMenu - > menuitems [ currentMenu - > numitems - 1 ] . alphaKey * 2 - currentMenu - > menuitems [ itemOn ] . alphaKey * 2 ) < = scrollareaheight )
tempcentery = currentMenu - > y - currentMenu - > menuitems [ currentMenu - > numitems - 1 ] . alphaKey * 2 + 2 * scrollareaheight ;
else
tempcentery = currentMenu - > y - currentMenu - > menuitems [ itemOn ] . alphaKey * 2 + scrollareaheight ;
for ( i = 0 ; i < currentMenu - > numitems ; i + + )
{
2017-04-19 21:24:28 +00:00
if ( currentMenu - > menuitems [ i ] . status ! = IT_DISABLED & & currentMenu - > menuitems [ i ] . alphaKey * 2 + tempcentery > = currentMenu - > y )
2017-04-15 12:36:40 +00:00
break ;
}
2017-04-29 15:40:07 +00:00
for ( bottom = currentMenu - > numitems ; bottom > 0 ; bottom - - )
2017-04-15 12:36:40 +00:00
{
2017-04-29 15:40:07 +00:00
if ( currentMenu - > menuitems [ bottom - 1 ] . status ! = IT_DISABLED )
break ;
}
for ( max = bottom ; max > 0 ; max - - )
{
if ( currentMenu - > menuitems [ max - 1 ] . status ! = IT_DISABLED & & currentMenu - > menuitems [ max - 1 ] . alphaKey * 2 + tempcentery < = ( currentMenu - > y + 2 * scrollareaheight ) )
2017-04-15 12:36:40 +00:00
break ;
}
if ( i )
2017-07-04 12:17:29 +00:00
V_DrawString ( currentMenu - > x - 20 , currentMenu - > y - ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1A " ) ; // up arrow
2017-04-29 15:40:07 +00:00
if ( max ! = bottom )
2017-07-04 12:17:29 +00:00
V_DrawString ( currentMenu - > x - 20 , currentMenu - > y + 2 * scrollareaheight + ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1B " ) ; // down arrow
2017-04-15 12:36:40 +00:00
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
for ( ; i < max ; i + + )
{
y = currentMenu - > menuitems [ i ] . alphaKey * 2 + tempcentery ;
if ( i = = itemOn )
cursory = y ;
switch ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY )
{
case IT_PATCH :
case IT_DYBIGSPACE :
case IT_BIGSLIDER :
case IT_STRING2 :
case IT_DYLITLSPACE :
case IT_GRAYPATCH :
case IT_TRANSTEXT2 :
// unsupported
break ;
case IT_NOTHING :
break ;
case IT_STRING :
case IT_WHITESTRING :
2017-04-15 13:05:51 +00:00
if ( i ! = itemOn & & ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY ) = = IT_STRING )
2017-04-15 12:36:40 +00:00
V_DrawString ( x , y , 0 , currentMenu - > menuitems [ i ] . text ) ;
else
V_DrawString ( x , y , V_YELLOWMAP , currentMenu - > menuitems [ i ] . text ) ;
// Cvar specific handling
switch ( currentMenu - > menuitems [ i ] . status & IT_TYPE )
case IT_CVAR :
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ;
switch ( currentMenu - > menuitems [ i ] . status & IT_CVARTYPE )
{
case IT_CV_SLIDER :
2017-07-04 12:17:29 +00:00
M_DrawSlider ( x , y , cv , ( i = = itemOn ) ) ;
2017-04-15 12:36:40 +00:00
case IT_CV_NOPRINT : // color use this
case IT_CV_INVISSLIDER : // monitor toggles use this
break ;
case IT_CV_STRING :
2017-04-29 15:40:07 +00:00
# if 1
2017-04-16 13:20:38 +00:00
if ( y + 12 > ( currentMenu - > y + 2 * scrollareaheight ) )
break ;
2017-04-15 12:36:40 +00:00
M_DrawTextBox ( x , y + 4 , MAXSTRINGLENGTH , 1 ) ;
V_DrawString ( x + 8 , y + 12 , V_ALLOWLOWERCASE , cv - > string ) ;
if ( skullAnimCounter < 4 & & i = = itemOn )
V_DrawCharacter ( x + 8 + V_StringWidth ( cv - > string , 0 ) , y + 12 ,
' _ ' | 0x80 , false ) ;
2017-04-29 15:40:07 +00:00
# else // cool new string type stuff, not ready for limelight
if ( i = = itemOn )
{
V_DrawFill ( x - 2 , y - 1 , MAXSTRINGLENGTH * 8 + 4 , 8 + 3 , 159 ) ;
V_DrawString ( x , y , V_ALLOWLOWERCASE , cv - > string ) ;
if ( skullAnimCounter < 4 )
V_DrawCharacter ( x + V_StringWidth ( cv - > string , 0 ) , y , ' _ ' | 0x80 , false ) ;
}
else
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y ,
V_YELLOWMAP | V_ALLOWLOWERCASE , cv - > string ) ;
# endif
2017-04-15 12:36:40 +00:00
break ;
default :
2017-04-15 14:36:19 +00:00
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y ,
2017-04-15 12:36:40 +00:00
( ( cv - > flags & CV_CHEAT ) & & ! CV_IsSetToDefault ( cv ) ? V_REDMAP : V_YELLOWMAP ) , cv - > string ) ;
2017-07-04 12:17:29 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - x - 10 - V_StringWidth ( cv - > string , 0 ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2017-04-15 12:36:40 +00:00
break ;
}
break ;
}
break ;
case IT_TRANSTEXT :
V_DrawString ( x , y , V_TRANSLUCENT , currentMenu - > menuitems [ i ] . text ) ;
break ;
case IT_QUESTIONMARKS :
V_DrawString ( x , y , V_TRANSLUCENT | V_OLDSPACING , M_CreateSecretMenuOption ( currentMenu - > menuitems [ i ] . text ) ) ;
break ;
2017-04-15 14:42:03 +00:00
case IT_HEADERTEXT :
2017-04-15 12:36:40 +00:00
//V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( y - ( lsheadingheight - 12 ) , currentMenu - > menuitems [ i ] . text , true , false ) ;
2017-04-15 12:36:40 +00:00
break ;
}
}
// DRAW THE SKULL CURSOR
V_DrawScaledPatch ( currentMenu - > x - 24 , cursory , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
}
2014-03-15 16:59:03 +00:00
static void M_DrawPauseMenu ( void )
{
if ( ! netgame & & ! multiplayer & & ( gamestate = = GS_LEVEL | | gamestate = = GS_INTERMISSION ) )
{
emblem_t * emblem_detail [ 3 ] = { NULL , NULL , NULL } ;
char emblem_text [ 3 ] [ 20 ] ;
INT32 i ;
M_DrawTextBox ( 27 , 16 , 32 , 6 ) ;
// Draw any and all emblems at the top.
M_DrawMapEmblems ( gamemap , 272 , 28 ) ;
if ( mapheaderinfo [ gamemap - 1 ] - > actnum ! = 0 )
V_DrawString ( 40 , 28 , V_YELLOWMAP , va ( " %s %d " , mapheaderinfo [ gamemap - 1 ] - > lvlttl , mapheaderinfo [ gamemap - 1 ] - > actnum ) ) ;
else
V_DrawString ( 40 , 28 , V_YELLOWMAP , mapheaderinfo [ gamemap - 1 ] - > lvlttl ) ;
// Set up the detail boxes.
{
emblem_t * emblem = M_GetLevelEmblems ( gamemap ) ;
while ( emblem )
{
INT32 emblemslot ;
char targettext [ 9 ] , currenttext [ 9 ] ;
switch ( emblem - > type )
{
case ET_SCORE :
snprintf ( targettext , 9 , " %d " , emblem - > var ) ;
snprintf ( currenttext , 9 , " %u " , G_GetBestScore ( gamemap ) ) ;
targettext [ 8 ] = 0 ;
currenttext [ 8 ] = 0 ;
emblemslot = 0 ;
break ;
case ET_TIME :
emblemslot = emblem - > var ; // dumb hack
snprintf ( targettext , 9 , " %i:%02i.%02i " ,
G_TicsToMinutes ( ( tic_t ) emblemslot , false ) ,
G_TicsToSeconds ( ( tic_t ) emblemslot ) ,
G_TicsToCentiseconds ( ( tic_t ) emblemslot ) ) ;
emblemslot = ( INT32 ) G_GetBestTime ( gamemap ) ; // dumb hack pt ii
if ( ( tic_t ) emblemslot = = UINT32_MAX )
snprintf ( currenttext , 9 , " -:--.-- " ) ;
else
snprintf ( currenttext , 9 , " %i:%02i.%02i " ,
G_TicsToMinutes ( ( tic_t ) emblemslot , false ) ,
G_TicsToSeconds ( ( tic_t ) emblemslot ) ,
G_TicsToCentiseconds ( ( tic_t ) emblemslot ) ) ;
targettext [ 8 ] = 0 ;
currenttext [ 8 ] = 0 ;
emblemslot = 1 ;
break ;
case ET_RINGS :
snprintf ( targettext , 9 , " %d " , emblem - > var ) ;
snprintf ( currenttext , 9 , " %u " , G_GetBestRings ( gamemap ) ) ;
targettext [ 8 ] = 0 ;
currenttext [ 8 ] = 0 ;
emblemslot = 2 ;
break ;
case ET_NGRADE :
snprintf ( targettext , 9 , " %u " , P_GetScoreForGrade ( gamemap , 0 , emblem - > var ) ) ;
snprintf ( currenttext , 9 , " %u " , G_GetBestNightsScore ( gamemap , 0 ) ) ;
targettext [ 8 ] = 0 ;
currenttext [ 8 ] = 0 ;
emblemslot = 1 ;
break ;
case ET_NTIME :
emblemslot = emblem - > var ; // dumb hack pt iii
snprintf ( targettext , 9 , " %i:%02i.%02i " ,
G_TicsToMinutes ( ( tic_t ) emblemslot , false ) ,
G_TicsToSeconds ( ( tic_t ) emblemslot ) ,
G_TicsToCentiseconds ( ( tic_t ) emblemslot ) ) ;
emblemslot = ( INT32 ) G_GetBestNightsTime ( gamemap , 0 ) ; // dumb hack pt iv
if ( ( tic_t ) emblemslot = = UINT32_MAX )
snprintf ( currenttext , 9 , " -:--.-- " ) ;
else
snprintf ( currenttext , 9 , " %i:%02i.%02i " ,
G_TicsToMinutes ( ( tic_t ) emblemslot , false ) ,
G_TicsToSeconds ( ( tic_t ) emblemslot ) ,
G_TicsToCentiseconds ( ( tic_t ) emblemslot ) ) ;
targettext [ 8 ] = 0 ;
currenttext [ 8 ] = 0 ;
emblemslot = 2 ;
break ;
default :
goto bademblem ;
}
if ( emblem_detail [ emblemslot ] )
goto bademblem ;
emblem_detail [ emblemslot ] = emblem ;
snprintf ( emblem_text [ emblemslot ] , 20 , " %8s /%8s " , currenttext , targettext ) ;
emblem_text [ emblemslot ] [ 19 ] = 0 ;
bademblem :
emblem = M_GetLevelEmblems ( - 1 ) ;
}
}
for ( i = 0 ; i < 3 ; + + i )
{
emblem_t * emblem = emblem_detail [ i ] ;
if ( ! emblem )
continue ;
if ( emblem - > collected )
2019-10-16 02:54:21 +00:00
V_DrawSmallMappedPatch ( 40 , 44 + ( i * 8 ) , 0 , W_CachePatchName ( M_GetEmblemPatch ( emblem , false ) , PU_CACHE ) ,
2014-03-15 16:59:03 +00:00
R_GetTranslationColormap ( TC_DEFAULT , M_GetEmblemColor ( emblem ) , GTC_CACHE ) ) ;
else
V_DrawSmallScaledPatch ( 40 , 44 + ( i * 8 ) , 0 , W_CachePatchName ( " NEEDIT " , PU_CACHE ) ) ;
switch ( emblem - > type )
{
case ET_SCORE :
case ET_NGRADE :
V_DrawString ( 56 , 44 + ( i * 8 ) , V_YELLOWMAP , " SCORE: " ) ;
break ;
case ET_TIME :
case ET_NTIME :
V_DrawString ( 56 , 44 + ( i * 8 ) , V_YELLOWMAP , " TIME: " ) ;
break ;
case ET_RINGS :
V_DrawString ( 56 , 44 + ( i * 8 ) , V_YELLOWMAP , " RINGS: " ) ;
break ;
}
V_DrawRightAlignedString ( 284 , 44 + ( i * 8 ) , V_MONOSPACE , emblem_text [ i ] ) ;
}
}
M_DrawGenericMenu ( ) ;
}
static void M_DrawCenteredMenu ( void )
{
INT32 x , y , i , cursory = 0 ;
// DRAW MENU
x = currentMenu - > x ;
y = currentMenu - > y ;
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
for ( i = 0 ; i < currentMenu - > numitems ; i + + )
{
if ( i = = itemOn )
cursory = y ;
switch ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY )
{
case IT_PATCH :
if ( currentMenu - > menuitems [ i ] . patch & & currentMenu - > menuitems [ i ] . patch [ 0 ] )
{
if ( currentMenu - > menuitems [ i ] . status & IT_CENTER )
{
patch_t * p ;
p = W_CachePatchName ( currentMenu - > menuitems [ i ] . patch , PU_CACHE ) ;
V_DrawScaledPatch ( ( BASEVIDWIDTH - SHORT ( p - > width ) ) / 2 , y , 0 , p ) ;
}
else
{
V_DrawScaledPatch ( x , y , 0 ,
W_CachePatchName ( currentMenu - > menuitems [ i ] . patch , PU_CACHE ) ) ;
}
}
2017-09-28 13:39:47 +00:00
/* FALLTHRU */
2014-03-15 16:59:03 +00:00
case IT_NOTHING :
case IT_DYBIGSPACE :
y + = LINEHEIGHT ;
break ;
case IT_BIGSLIDER :
M_DrawThermo ( x , y , ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ) ;
y + = LINEHEIGHT ;
break ;
case IT_STRING :
case IT_WHITESTRING :
if ( currentMenu - > menuitems [ i ] . alphaKey )
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
if ( i = = itemOn )
cursory = y ;
if ( ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY ) = = IT_STRING )
V_DrawCenteredString ( x , y , 0 , currentMenu - > menuitems [ i ] . text ) ;
else
V_DrawCenteredString ( x , y , V_YELLOWMAP , currentMenu - > menuitems [ i ] . text ) ;
// Cvar specific handling
switch ( currentMenu - > menuitems [ i ] . status & IT_TYPE )
case IT_CVAR :
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ;
switch ( currentMenu - > menuitems [ i ] . status & IT_CVARTYPE )
{
case IT_CV_SLIDER :
2017-07-04 12:17:29 +00:00
M_DrawSlider ( x , y , cv , ( i = = itemOn ) ) ;
2014-03-15 16:59:03 +00:00
case IT_CV_NOPRINT : // color use this
break ;
case IT_CV_STRING :
M_DrawTextBox ( x , y + 4 , MAXSTRINGLENGTH , 1 ) ;
V_DrawString ( x + 8 , y + 12 , V_ALLOWLOWERCASE , cv - > string ) ;
if ( skullAnimCounter < 4 & & i = = itemOn )
V_DrawCharacter ( x + 8 + V_StringWidth ( cv - > string , 0 ) , y + 12 ,
' _ ' | 0x80 , false ) ;
y + = 16 ;
break ;
default :
V_DrawString ( BASEVIDWIDTH - x - V_StringWidth ( cv - > string , 0 ) , y ,
( ( cv - > flags & CV_CHEAT ) & & ! CV_IsSetToDefault ( cv ) ? V_REDMAP : V_YELLOWMAP ) , cv - > string ) ;
2017-07-04 12:17:29 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - x - 10 - V_StringWidth ( cv - > string , 0 ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2014-03-15 16:59:03 +00:00
break ;
}
break ;
}
y + = STRINGHEIGHT ;
break ;
case IT_STRING2 :
V_DrawCenteredString ( x , y , 0 , currentMenu - > menuitems [ i ] . text ) ;
2017-09-28 13:39:47 +00:00
/* FALLTHRU */
2014-03-15 16:59:03 +00:00
case IT_DYLITLSPACE :
y + = SMALLLINEHEIGHT ;
break ;
case IT_QUESTIONMARKS :
if ( currentMenu - > menuitems [ i ] . alphaKey )
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
V_DrawCenteredString ( x , y , V_TRANSLUCENT | V_OLDSPACING , M_CreateSecretMenuOption ( currentMenu - > menuitems [ i ] . text ) ) ;
y + = SMALLLINEHEIGHT ;
break ;
case IT_GRAYPATCH :
if ( currentMenu - > menuitems [ i ] . patch & & currentMenu - > menuitems [ i ] . patch [ 0 ] )
V_DrawMappedPatch ( x , y , 0 ,
W_CachePatchName ( currentMenu - > menuitems [ i ] . patch , PU_CACHE ) , graymap ) ;
y + = LINEHEIGHT ;
break ;
}
}
// DRAW THE SKULL CURSOR
if ( ( ( currentMenu - > menuitems [ itemOn ] . status & IT_DISPLAY ) = = IT_PATCH )
| | ( ( currentMenu - > menuitems [ itemOn ] . status & IT_DISPLAY ) = = IT_NOTHING ) )
{
V_DrawScaledPatch ( x + SKULLXOFF , cursory - 5 , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
}
else
{
V_DrawScaledPatch ( x - V_StringWidth ( currentMenu - > menuitems [ itemOn ] . text , 0 ) / 2 - 24 , cursory , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
V_DrawCenteredString ( x , cursory , V_YELLOWMAP , currentMenu - > menuitems [ itemOn ] . text ) ;
}
}
//
// M_StringHeight
//
// Find string height from hu_font chars
//
static inline size_t M_StringHeight ( const char * string )
{
size_t h = 8 , i ;
for ( i = 0 ; i < strlen ( string ) ; i + + )
if ( string [ i ] = = ' \n ' )
h + = 8 ;
return h ;
}
// ==========================================================================
// Extraneous menu patching functions
// ==========================================================================
//
// M_PatchSkinNameTable
//
// Like M_PatchLevelNameTable, but for cv_chooseskin
//
static void M_PatchSkinNameTable ( void )
{
INT32 j ;
memset ( skins_cons_t , 0 , sizeof ( skins_cons_t ) ) ;
for ( j = 0 ; j < MAXSKINS ; j + + )
{
2017-03-18 14:20:42 +00:00
if ( skins [ j ] . name [ 0 ] ! = ' \0 ' & & R_SkinUsable ( - 1 , j ) )
2014-03-15 16:59:03 +00:00
{
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
skins_cons_t [ j ] . strvalue = skins [ j ] . realname ;
2014-03-15 16:59:03 +00:00
skins_cons_t [ j ] . value = j + 1 ;
}
else
{
skins_cons_t [ j ] . strvalue = NULL ;
skins_cons_t [ j ] . value = 0 ;
}
}
CV_SetValue ( & cv_chooseskin , 1 ) ;
2017-02-10 14:54:05 +00:00
Nextmap_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
return ;
}
2017-01-27 14:42:57 +00:00
//
// M_LevelAvailableOnPlatter
//
// Okay, you know that the level SHOULD show up on the platter already.
// The only question is whether it should be as a question mark,
// (hinting as to its existence), or as its pure, unfettered self.
//
static boolean M_LevelAvailableOnPlatter ( INT32 mapnum )
2014-03-15 16:59:03 +00:00
{
2017-01-27 00:02:47 +00:00
if ( M_MapLocked ( mapnum + 1 ) )
return false ; // not unlocked
switch ( levellistmode )
{
2017-09-15 19:34:46 +00:00
case LLM_CREATESERVER :
2017-09-15 19:34:46 +00:00
if ( ! ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_COOP ) )
2017-09-15 19:34:46 +00:00
return true ;
2017-11-02 21:20:55 +00:00
if ( mapnum + 1 = = spstage_start )
2017-09-15 19:34:46 +00:00
return true ;
2017-09-15 19:34:46 +00:00
2019-10-23 20:29:50 +00:00
# ifndef DEVELOP
if ( mapvisited [ mapnum ] ) // MV_MP
# endif
2017-11-02 21:20:55 +00:00
return true ;
2019-01-08 04:06:47 +00:00
/* FALLTHRU */
2017-01-27 00:02:47 +00:00
case LLM_RECORDATTACK :
case LLM_NIGHTSATTACK :
2019-11-08 15:48:11 +00:00
# ifndef DEVELOP
2017-09-15 19:34:46 +00:00
if ( mapvisited [ mapnum ] & MV_MAX )
2017-01-27 00:02:47 +00:00
return true ;
2017-09-15 19:34:46 +00:00
if ( mapheaderinfo [ mapnum ] - > menuflags & LF2_NOVISITNEEDED )
2019-11-08 15:48:11 +00:00
# endif
2017-09-15 19:34:46 +00:00
return true ;
2017-01-27 00:02:47 +00:00
2017-09-15 19:34:46 +00:00
return false ;
2017-01-27 14:42:57 +00:00
case LLM_LEVELSELECT :
default :
2017-01-27 00:02:47 +00:00
return true ;
}
return true ;
2014-03-15 16:59:03 +00:00
}
//
2017-01-27 14:42:57 +00:00
// M_CanShowLevelOnPlatter
2014-03-15 16:59:03 +00:00
//
// Determines whether to show a given map in the various level-select lists.
// Set gt = -1 to ignore gametype.
//
2017-01-27 14:42:57 +00:00
static boolean M_CanShowLevelOnPlatter ( INT32 mapnum , INT32 gt )
2014-03-15 16:59:03 +00:00
{
// Does the map exist?
if ( ! mapheaderinfo [ mapnum ] )
return false ;
// Does the map have a name?
if ( ! mapheaderinfo [ mapnum ] - > lvlttl [ 0 ] )
return false ;
2017-01-27 00:02:47 +00:00
/*if (M_MapLocked(mapnum+1))
return false ; // not unlocked*/
2014-03-15 16:59:03 +00:00
switch ( levellistmode )
{
case LLM_CREATESERVER :
// Should the map be hidden?
if ( mapheaderinfo [ mapnum ] - > menuflags & LF2_HIDEINMENU )
return false ;
2019-09-04 14:52:25 +00:00
if ( G_IsSpecialStage ( mapnum + 1 ) )
return false ;
2014-03-15 16:59:03 +00:00
if ( gt = = GT_COOP & & ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_COOP ) )
return true ;
if ( gt = = GT_COMPETITION & & ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_COMPETITION ) )
return true ;
if ( gt = = GT_CTF & & ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_CTF ) )
return true ;
if ( ( gt = = GT_MATCH | | gt = = GT_TEAMMATCH ) & & ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_MATCH ) )
return true ;
if ( ( gt = = GT_TAG | | gt = = GT_HIDEANDSEEK ) & & ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_TAG ) )
return true ;
if ( gt = = GT_RACE & & ( mapheaderinfo [ mapnum ] - > typeoflevel & TOL_RACE ) )
return true ;
return false ;
case LLM_LEVELSELECT :
2019-06-03 21:32:45 +00:00
if ( ! ( mapheaderinfo [ mapnum ] - > levelselect & maplistoption ) )
2014-03-15 16:59:03 +00:00
return false ;
return true ;
case LLM_RECORDATTACK :
if ( ! ( mapheaderinfo [ mapnum ] - > menuflags & LF2_RECORDATTACK ) )
return false ;
return true ;
case LLM_NIGHTSATTACK :
if ( ! ( mapheaderinfo [ mapnum ] - > menuflags & LF2_NIGHTSATTACK ) )
return false ;
return true ;
}
// Hmm? Couldn't decide?
return false ;
}
2017-01-27 23:16:35 +00:00
#if 0
static INT32 M_CountLevelsToShowOnPlatter ( INT32 gt )
2014-03-15 16:59:03 +00:00
{
INT32 mapnum , count = 0 ;
for ( mapnum = 0 ; mapnum < NUMMAPS ; mapnum + + )
2017-01-27 23:16:35 +00:00
if ( M_CanShowLevelOnPlatter ( mapnum , gt ) )
2014-03-15 16:59:03 +00:00
count + + ;
return count ;
}
2017-01-27 23:16:35 +00:00
# endif
2014-03-15 16:59:03 +00:00
2017-02-17 01:45:21 +00:00
#if 0
static boolean M_SetNextMapOnPlatter ( void )
2014-03-15 16:59:03 +00:00
{
2017-02-17 01:45:21 +00:00
INT32 row , col = 0 ;
while ( col < 3 )
{
row = 0 ;
while ( row < levelselect . numrows )
{
if ( levelselect . rows [ row ] . maplist [ col ] = = cv_nextmap . value )
{
lsrow = row ;
lscol = col ;
return true ;
}
row + + ;
}
col + + ;
}
return true ;
}
# endif
2014-03-15 16:59:03 +00:00
2017-01-27 14:42:57 +00:00
static INT32 M_CountRowsToShowOnPlatter ( INT32 gt )
2017-01-26 19:14:52 +00:00
{
2017-01-27 23:16:35 +00:00
INT32 mapnum = 0 , prevmapnum = 0 , col = 0 , rows = 0 ;
2014-03-15 16:59:03 +00:00
2017-01-27 23:16:35 +00:00
while ( mapnum < NUMMAPS )
2017-01-26 19:14:52 +00:00
{
2017-01-27 14:42:57 +00:00
if ( M_CanShowLevelOnPlatter ( mapnum , gt ) )
2017-01-26 19:14:52 +00:00
{
if ( rows = = 0 )
rows + + ;
else
{
if ( col = = 2
2017-02-17 01:45:21 +00:00
| | ( mapheaderinfo [ prevmapnum ] - > menuflags & LF2_WIDEICON )
| | ( mapheaderinfo [ mapnum ] - > menuflags & LF2_WIDEICON )
| | ! ( fastcmp ( mapheaderinfo [ mapnum ] - > selectheading , mapheaderinfo [ prevmapnum ] - > selectheading ) ) )
2017-01-26 19:14:52 +00:00
{
col = 0 ;
rows + + ;
}
else
col + + ;
}
prevmapnum = mapnum ;
}
2017-01-27 23:16:35 +00:00
mapnum + + ;
2017-01-26 19:14:52 +00:00
}
2014-03-15 16:59:03 +00:00
2017-09-15 19:34:46 +00:00
if ( levellistmode = = LLM_CREATESERVER )
rows + + ;
2017-01-26 19:14:52 +00:00
return rows ;
}
2014-03-15 16:59:03 +00:00
2017-01-28 10:34:58 +00:00
//
// M_PrepareLevelPlatter
//
// Prepares a tasty dish of zones and acts!
// Call before any attempt to access a level platter.
//
2017-09-15 19:34:46 +00:00
static boolean M_PrepareLevelPlatter ( INT32 gt , boolean nextmappick )
2014-03-15 16:59:03 +00:00
{
2017-01-27 14:42:57 +00:00
INT32 numrows = M_CountRowsToShowOnPlatter ( gt ) ;
2017-09-15 19:34:46 +00:00
INT32 mapnum = 0 , prevmapnum = 0 , col = 0 , row = 0 , startrow = 0 ;
2014-03-15 16:59:03 +00:00
2017-01-26 19:14:52 +00:00
if ( ! numrows )
return false ;
2014-03-15 16:59:03 +00:00
2017-01-26 19:14:52 +00:00
if ( levelselect . rows )
Z_Free ( levelselect . rows ) ;
levelselect . rows = NULL ;
2014-03-15 16:59:03 +00:00
2017-01-26 19:14:52 +00:00
levelselect . numrows = numrows ;
levelselect . rows = Z_Realloc ( levelselect . rows , numrows * sizeof ( levelselectrow_t ) , PU_STATIC , NULL ) ;
if ( ! levelselect . rows )
2017-01-27 14:42:57 +00:00
I_Error ( " Insufficient memory to prepare level platter " ) ;
2014-03-15 16:59:03 +00:00
2017-01-27 14:42:57 +00:00
// done here so lsrow and lscol can be set if cv_nextmap is on the platter
2017-04-29 15:40:07 +00:00
lsrow = lscol = lshli = lsoffs [ 0 ] = lsoffs [ 1 ] = 0 ;
2017-01-26 19:14:52 +00:00
2017-09-15 19:34:46 +00:00
if ( levellistmode = = LLM_CREATESERVER )
{
sprintf ( levelselect . rows [ 0 ] . header , " Gametype " ) ;
lswide ( 0 ) = true ;
levelselect . rows [ row ] . mapavailable [ 2 ] = levelselect . rows [ row ] . mapavailable [ 1 ] = levelselect . rows [ row ] . mapavailable [ 0 ] = false ;
startrow = row = 1 ;
Z_Free ( char_notes ) ;
char_notes = NULL ;
}
2017-02-17 01:45:21 +00:00
while ( mapnum < NUMMAPS )
2014-03-15 16:59:03 +00:00
{
2017-01-27 14:42:57 +00:00
if ( M_CanShowLevelOnPlatter ( mapnum , gt ) )
2014-03-15 16:59:03 +00:00
{
2017-01-26 19:14:52 +00:00
const INT32 actnum = mapheaderinfo [ mapnum ] - > actnum ;
2017-01-27 14:42:57 +00:00
const boolean headingisname = ( fastcmp ( mapheaderinfo [ mapnum ] - > selectheading , mapheaderinfo [ mapnum ] - > lvlttl ) ) ;
2017-02-17 01:45:21 +00:00
const boolean wide = ( mapheaderinfo [ mapnum ] - > menuflags & LF2_WIDEICON ) ;
2014-03-15 16:59:03 +00:00
2017-01-26 19:14:52 +00:00
// preparing next position to drop mapnum into
2017-09-15 19:34:46 +00:00
if ( levelselect . rows [ startrow ] . maplist [ 0 ] )
2017-01-26 19:14:52 +00:00
{
if ( col = = 2 // no more space on the row?
2017-02-17 01:45:21 +00:00
| | wide
| | ( mapheaderinfo [ prevmapnum ] - > menuflags & LF2_WIDEICON )
| | ! ( fastcmp ( mapheaderinfo [ mapnum ] - > selectheading , mapheaderinfo [ prevmapnum ] - > selectheading ) ) ) // a new heading is starting?
2017-01-26 19:14:52 +00:00
{
col = 0 ;
row + + ;
}
else
col + + ;
}
2014-03-15 16:59:03 +00:00
2017-01-26 19:14:52 +00:00
levelselect . rows [ row ] . maplist [ col ] = mapnum + 1 ; // putting the map on the platter
2017-01-27 14:42:57 +00:00
levelselect . rows [ row ] . mapavailable [ col ] = M_LevelAvailableOnPlatter ( mapnum ) ;
2014-03-15 16:59:03 +00:00
2017-02-18 14:03:49 +00:00
if ( ( lswide ( row ) = wide ) ) // intentionally assignment
2017-02-17 01:45:21 +00:00
{
levelselect . rows [ row ] . maplist [ 2 ] = levelselect . rows [ row ] . maplist [ 1 ] = levelselect . rows [ row ] . maplist [ 0 ] ;
levelselect . rows [ row ] . mapavailable [ 2 ] = levelselect . rows [ row ] . mapavailable [ 1 ] = levelselect . rows [ row ] . mapavailable [ 0 ] ;
}
2014-03-15 16:59:03 +00:00
2017-09-15 19:34:46 +00:00
if ( nextmappick & & cv_nextmap . value = = mapnum + 1 ) // A little quality of life improvement.
2017-01-27 14:42:57 +00:00
{
lsrow = row ;
lscol = col ;
}
2014-03-15 16:59:03 +00:00
2017-01-26 19:14:52 +00:00
// individual map name
2017-01-27 23:16:35 +00:00
if ( levelselect . rows [ row ] . mapavailable [ col ] )
{
if ( headingisname )
{
if ( actnum )
sprintf ( levelselect . rows [ row ] . mapnames [ col ] , " ACT %d " , actnum ) ;
else
sprintf ( levelselect . rows [ row ] . mapnames [ col ] , " THE ACT " ) ;
}
2017-02-17 01:45:21 +00:00
else if ( wide )
{
// Yes, with LF2_WIDEICON it'll continue on over into the next 17+1 char block. That's alright; col is always zero, the string is contiguous, and the maximum length is lvlttl[22] + ' ' + ZONE + ' ' + INT32, which is about 39 or so - barely crossing into the third column.
char * mapname = G_BuildMapTitle ( mapnum + 1 ) ;
strcpy ( levelselect . rows [ row ] . mapnames [ col ] , ( const char * ) mapname ) ;
Z_Free ( mapname ) ;
}
2017-01-27 23:16:35 +00:00
else
{
2017-02-17 01:45:21 +00:00
char mapname [ 22 + 1 + 11 ] ; // lvlttl[22] + ' ' + INT32
2017-02-02 12:52:39 +00:00
2017-01-27 23:16:35 +00:00
if ( actnum )
2017-02-02 12:52:39 +00:00
sprintf ( mapname , " %s %d " , mapheaderinfo [ mapnum ] - > lvlttl , actnum ) ;
2017-01-27 23:16:35 +00:00
else
2017-08-24 23:40:45 +00:00
strcpy ( mapname , mapheaderinfo [ mapnum ] - > lvlttl ) ;
2017-02-02 12:52:39 +00:00
if ( strlen ( mapname ) > = 17 )
2017-08-24 23:40:45 +00:00
strcpy ( mapname + 17 - 3 , " ... " ) ;
2017-02-02 12:52:39 +00:00
strcpy ( levelselect . rows [ row ] . mapnames [ col ] , ( const char * ) mapname ) ;
2017-01-27 23:16:35 +00:00
}
}
2017-01-26 19:14:52 +00:00
else
2017-01-27 23:16:35 +00:00
sprintf ( levelselect . rows [ row ] . mapnames [ col ] , " ??? " ) ;
2017-01-26 19:14:52 +00:00
// creating header text
2017-09-15 19:34:46 +00:00
if ( ! col & & ( ( row = = startrow ) | | ! ( fastcmp ( mapheaderinfo [ mapnum ] - > selectheading , mapheaderinfo [ levelselect . rows [ row - 1 ] . maplist [ 0 ] - 1 ] - > selectheading ) ) ) )
2017-01-26 19:14:52 +00:00
{
if ( ! levelselect . rows [ row ] . mapavailable [ col ] )
sprintf ( levelselect . rows [ row ] . header , " ??? " ) ;
else
{
sprintf ( levelselect . rows [ row ] . header , " %s " , mapheaderinfo [ mapnum ] - > selectheading ) ;
2017-01-27 14:42:57 +00:00
if ( ! ( mapheaderinfo [ mapnum ] - > levelflags & LF_NOZONE ) & & headingisname )
2017-01-26 19:14:52 +00:00
{
sprintf ( levelselect . rows [ row ] . header + strlen ( levelselect . rows [ row ] . header ) , " ZONE " ) ;
}
}
}
2017-02-17 01:45:21 +00:00
prevmapnum = mapnum ;
2017-01-26 19:14:52 +00:00
}
2017-02-17 01:45:21 +00:00
mapnum + + ;
2017-01-26 19:14:52 +00:00
}
2017-08-21 15:02:13 +00:00
# ifdef SYMMETRICAL_PLATTER
// horizontally space out rows with missing right sides
for ( ; row > = 0 ; row - - )
{
if ( ! levelselect . rows [ row ] . maplist [ 2 ] // no right side
& & levelselect . rows [ row ] . maplist [ 0 ] & & levelselect . rows [ row ] . maplist [ 1 ] ) // all the left filled in
{
levelselect . rows [ row ] . maplist [ 2 ] = levelselect . rows [ row ] . maplist [ 1 ] ;
STRBUFCPY ( levelselect . rows [ row ] . mapnames [ 2 ] , levelselect . rows [ row ] . mapnames [ 1 ] ) ;
levelselect . rows [ row ] . mapavailable [ 2 ] = levelselect . rows [ row ] . mapavailable [ 1 ] ;
levelselect . rows [ row ] . maplist [ 1 ] = - 1 ; // diamond
levelselect . rows [ row ] . mapnames [ 1 ] [ 0 ] = ' \0 ' ;
levelselect . rows [ row ] . mapavailable [ 1 ] = false ;
}
}
# endif
2017-02-18 14:03:49 +00:00
if ( levselp [ 0 ] [ 0 ] ) // never going to have some provided but not all, saves individually checking
2017-01-27 00:02:47 +00:00
{
2017-02-17 01:45:21 +00:00
W_UnlockCachedPatch ( levselp [ 0 ] [ 0 ] ) ;
W_UnlockCachedPatch ( levselp [ 0 ] [ 1 ] ) ;
W_UnlockCachedPatch ( levselp [ 0 ] [ 2 ] ) ;
W_UnlockCachedPatch ( levselp [ 1 ] [ 0 ] ) ;
W_UnlockCachedPatch ( levselp [ 1 ] [ 1 ] ) ;
W_UnlockCachedPatch ( levselp [ 1 ] [ 2 ] ) ;
2017-01-27 00:02:47 +00:00
}
2017-02-17 01:45:21 +00:00
levselp [ 0 ] [ 0 ] = W_CachePatchName ( " SLCT1LVL " , PU_STATIC ) ;
levselp [ 0 ] [ 1 ] = W_CachePatchName ( " SLCT2LVL " , PU_STATIC ) ;
levselp [ 0 ] [ 2 ] = W_CachePatchName ( " BLANKLVL " , PU_STATIC ) ;
levselp [ 1 ] [ 0 ] = W_CachePatchName ( " SLCT1LVW " , PU_STATIC ) ;
levselp [ 1 ] [ 1 ] = W_CachePatchName ( " SLCT2LVW " , PU_STATIC ) ;
levselp [ 1 ] [ 2 ] = W_CachePatchName ( " BLANKLVW " , PU_STATIC ) ;
2017-01-26 19:14:52 +00:00
return true ;
}
2017-09-15 19:34:46 +00:00
# define ifselectvalnextmapnobrace(column) if ((selectval = levelselect.rows[lsrow].maplist[column]) && levelselect.rows[lsrow].mapavailable[column])\
2017-01-27 14:42:57 +00:00
{ \
CV_SetValue ( & cv_nextmap , selectval ) ;
2017-09-15 19:34:46 +00:00
# define ifselectvalnextmap(column) ifselectvalnextmapnobrace(column)}
2017-01-27 14:42:57 +00:00
2017-01-28 10:34:58 +00:00
//
// M_HandleLevelPlatter
//
// Reacts to your key inputs. Basically a mini menu thinker.
//
2017-01-27 14:42:57 +00:00
static void M_HandleLevelPlatter ( INT32 choice )
2017-01-26 19:14:52 +00:00
{
boolean exitmenu = false ; // exit to previous menu
INT32 selectval ;
2019-10-14 16:17:00 +00:00
UINT8 iter ;
2017-01-26 19:14:52 +00:00
switch ( choice )
{
case KEY_DOWNARROW :
2019-10-14 16:17:00 +00:00
if ( lsrow = = levelselect . numrows - 1 )
{
if ( levelselect . numrows < 3 )
{
if ( ! lsoffs [ 0 ] ) // prevent sound spam
{
lsoffs [ 0 ] = - 8 ;
S_StartSound ( NULL , sfx_s3kb7 ) ;
}
return ;
}
lsrow = UINT8_MAX ;
}
2017-01-26 19:14:52 +00:00
lsrow + + ;
2017-01-27 14:42:57 +00:00
2017-01-29 19:25:43 +00:00
lsoffs [ 0 ] = lsvseperation ( lsrow ) ;
2017-01-27 14:42:57 +00:00
if ( levelselect . rows [ lsrow ] . header [ 0 ] )
lshli = lsrow ;
// no else needed - headerless lines associate upwards, so moving down to a row without a header is identity
2017-01-26 19:14:52 +00:00
S_StartSound ( NULL , sfx_s3kb7 ) ;
2017-01-27 14:42:57 +00:00
2017-09-15 19:34:46 +00:00
ifselectvalnextmap ( lscol ) else ifselectvalnextmap ( 0 )
2017-01-26 19:14:52 +00:00
break ;
case KEY_UPARROW :
2019-10-14 16:17:00 +00:00
iter = lsrow ;
if ( ! lsrow )
{
if ( levelselect . numrows < 3 )
{
if ( ! lsoffs [ 0 ] ) // prevent sound spam
{
lsoffs [ 0 ] = 8 ;
S_StartSound ( NULL , sfx_s3kb7 ) ;
}
return ;
}
lsrow = levelselect . numrows ;
}
2017-01-26 19:14:52 +00:00
lsrow - - ;
2019-10-14 16:17:00 +00:00
lsoffs [ 0 ] = - lsvseperation ( iter ) ;
2017-01-27 14:42:57 +00:00
if ( levelselect . rows [ lsrow ] . header [ 0 ] )
lshli = lsrow ;
else
{
2019-10-14 16:17:00 +00:00
iter = lsrow ;
2017-01-27 14:42:57 +00:00
do
iter = ( ( iter = = 0 ) ? levelselect . numrows - 1 : iter - 1 ) ;
while ( ( iter ! = lsrow ) & & ! ( levelselect . rows [ iter ] . header [ 0 ] ) ) ;
lshli = iter ;
}
2017-01-26 19:14:52 +00:00
S_StartSound ( NULL , sfx_s3kb7 ) ;
2017-01-27 14:42:57 +00:00
2017-09-15 19:34:46 +00:00
ifselectvalnextmap ( lscol ) else ifselectvalnextmap ( 0 )
2017-01-26 19:14:52 +00:00
break ;
2017-09-15 19:34:46 +00:00
case KEY_ENTER :
if ( ! ( levellistmode = = LLM_CREATESERVER & & ! lsrow ) )
2017-01-26 19:14:52 +00:00
{
2017-09-15 19:34:46 +00:00
ifselectvalnextmapnobrace ( lscol )
lsoffs [ 0 ] = lsoffs [ 1 ] = 0 ;
S_StartSound ( NULL , sfx_menu1 ) ;
if ( gamestate = = GS_TIMEATTACK )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else if ( currentMenu = = & MISC_ChangeLevelDef )
{
if ( currentMenu - > prevMenu & & currentMenu - > prevMenu ! = & MPauseDef )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ChangeLevel ( 0 ) ;
Z_Free ( levelselect . rows ) ;
levelselect . rows = NULL ;
}
else
M_LevelSelectWarp ( 0 ) ;
Nextmap_OnChange ( ) ;
}
2019-10-14 16:17:00 +00:00
else if ( ! lsoffs [ 0 ] ) // prevent sound spam
2017-09-15 19:34:46 +00:00
{
lsoffs [ 0 ] = - 8 ;
S_StartSound ( NULL , sfx_s3kb2 ) ;
}
break ;
2017-01-26 19:14:52 +00:00
}
2019-01-08 04:06:47 +00:00
/* FALLTHRU */
2017-09-15 19:34:46 +00:00
case KEY_RIGHTARROW :
if ( levellistmode = = LLM_CREATESERVER & & ! lsrow )
2017-01-28 10:34:58 +00:00
{
2017-09-15 19:34:46 +00:00
CV_AddValue ( & cv_newgametype , 1 ) ;
S_StartSound ( NULL , sfx_menu1 ) ;
lscol = 0 ;
2017-01-26 19:14:52 +00:00
2017-09-15 19:34:46 +00:00
Z_Free ( char_notes ) ;
char_notes = NULL ;
if ( ! M_PrepareLevelPlatter ( cv_newgametype . value , false ) )
I_Error ( " Unidentified level platter failure! " ) ;
}
else if ( lscol < 2 )
2017-01-26 19:14:52 +00:00
{
lscol + + ;
2017-01-27 14:42:57 +00:00
2017-02-17 01:45:21 +00:00
lsoffs [ 1 ] = ( lswide ( lsrow ) ? 8 : - lshseperation ) ;
2017-01-26 19:14:52 +00:00
S_StartSound ( NULL , sfx_s3kb7 ) ;
2017-01-27 14:42:57 +00:00
2017-09-15 19:34:46 +00:00
ifselectvalnextmap ( lscol ) else ifselectvalnextmap ( 0 )
2017-01-26 19:14:52 +00:00
}
2019-10-14 16:17:00 +00:00
else if ( ! lsoffs [ 1 ] ) // prevent sound spam
2017-01-28 10:34:58 +00:00
{
lsoffs [ 1 ] = 8 ;
S_StartSound ( NULL , sfx_s3kb7 ) ;
}
2017-01-26 19:14:52 +00:00
break ;
2017-09-15 19:34:46 +00:00
case KEY_LEFTARROW :
if ( levellistmode = = LLM_CREATESERVER & & ! lsrow )
{
CV_AddValue ( & cv_newgametype , - 1 ) ;
2017-01-27 00:02:47 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2017-09-15 19:34:46 +00:00
lscol = 0 ;
Z_Free ( char_notes ) ;
char_notes = NULL ;
if ( ! M_PrepareLevelPlatter ( cv_newgametype . value , false ) )
I_Error ( " Unidentified level platter failure! " ) ;
2017-01-26 19:14:52 +00:00
}
2017-09-15 19:34:46 +00:00
else if ( lscol > 0 )
2017-01-27 00:02:47 +00:00
{
2017-09-15 19:34:46 +00:00
lscol - - ;
lsoffs [ 1 ] = ( lswide ( lsrow ) ? - 8 : lshseperation ) ;
S_StartSound ( NULL , sfx_s3kb7 ) ;
ifselectvalnextmap ( lscol ) else ifselectvalnextmap ( 0 )
}
2019-10-14 16:17:00 +00:00
else if ( ! lsoffs [ 1 ] ) // prevent sound spam
2017-09-15 19:34:46 +00:00
{
lsoffs [ 1 ] = - 8 ;
S_StartSound ( NULL , sfx_s3kb7 ) ;
2017-01-27 00:02:47 +00:00
}
2017-01-26 19:14:52 +00:00
break ;
case KEY_ESCAPE :
exitmenu = true ;
break ;
default :
break ;
}
if ( exitmenu )
{
2017-09-25 19:35:04 +00:00
if ( gamestate ! = GS_TIMEATTACK )
{
Z_Free ( levelselect . rows ) ;
levelselect . rows = NULL ;
}
2017-01-26 19:14:52 +00:00
if ( currentMenu - > prevMenu )
2017-01-28 13:13:03 +00:00
{
2017-02-10 14:54:05 +00:00
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
Nextmap_OnChange ( ) ;
2017-01-28 13:13:03 +00:00
}
2017-01-26 19:14:52 +00:00
else
M_ClearMenus ( true ) ;
2017-09-15 19:34:46 +00:00
Z_Free ( char_notes ) ;
char_notes = NULL ;
2017-01-26 19:14:52 +00:00
}
}
2017-04-29 15:40:07 +00:00
void M_DrawLevelPlatterHeader ( INT32 y , const char * header , boolean headerhighlight , boolean allowlowercase )
2017-01-27 00:02:47 +00:00
{
2017-01-29 19:25:43 +00:00
y + = lsheadingheight - 12 ;
2017-04-29 15:40:07 +00:00
V_DrawString ( 19 , y , ( headerhighlight ? V_YELLOWMAP : 0 ) | ( allowlowercase ? V_ALLOWLOWERCASE : 0 ) , header ) ;
2017-01-29 19:25:43 +00:00
y + = 9 ;
2017-08-22 20:02:33 +00:00
V_DrawFill ( 19 , y , 281 , 1 , ( headerhighlight ? yellowmap [ 3 ] : 3 ) ) ;
V_DrawFill ( 300 , y , 1 , 1 , 26 ) ;
2017-01-29 19:25:43 +00:00
y + + ;
2017-08-22 20:02:33 +00:00
V_DrawFill ( 19 , y , 282 , 1 , 26 ) ;
2017-01-29 19:25:43 +00:00
}
2017-01-27 00:02:47 +00:00
2017-02-17 01:45:21 +00:00
static void M_DrawLevelPlatterWideMap ( UINT8 row , UINT8 col , INT32 x , INT32 y , boolean highlight )
{
patch_t * patch ;
INT32 map = levelselect . rows [ row ] . maplist [ col ] ;
2017-08-21 15:02:13 +00:00
if ( map < = 0 )
2017-02-17 01:45:21 +00:00
return ;
2017-03-06 19:03:05 +00:00
// A 564x100 image of the level as entry MAPxxW
2017-02-17 01:45:21 +00:00
if ( ! ( levelselect . rows [ row ] . mapavailable [ col ] ) )
2017-10-25 15:40:21 +00:00
{
V_DrawSmallScaledPatch ( x , y , 0 , levselp [ 1 ] [ 2 ] ) ;
M_DrawStaticBox ( x , y , V_80TRANS , 282 , 50 ) ;
}
2017-02-17 01:45:21 +00:00
else
{
if ( W_CheckNumForName ( va ( " %sW " , G_BuildMapName ( map ) ) ) ! = LUMPERROR )
patch = W_CachePatchName ( va ( " %sW " , G_BuildMapName ( map ) ) , PU_CACHE ) ;
else
patch = levselp [ 1 ] [ 2 ] ; // don't static to indicate that it's just a normal level
V_DrawSmallScaledPatch ( x , y , 0 , patch ) ;
}
2017-08-22 20:02:33 +00:00
V_DrawFill ( x , y + 50 , 282 , 8 ,
( ( mapheaderinfo [ map - 1 ] - > unlockrequired < 0 )
? 159 : 63 ) ) ;
2017-02-17 01:45:21 +00:00
V_DrawString ( x , y + 50 , ( highlight ? V_YELLOWMAP : 0 ) , levelselect . rows [ row ] . mapnames [ col ] ) ;
}
2017-01-29 19:25:43 +00:00
static void M_DrawLevelPlatterMap ( UINT8 row , UINT8 col , INT32 x , INT32 y , boolean highlight )
{
patch_t * patch ;
2017-01-27 00:02:47 +00:00
2017-01-29 19:25:43 +00:00
INT32 map = levelselect . rows [ row ] . maplist [ col ] ;
2017-08-21 15:02:13 +00:00
if ( map < = 0 )
2017-01-29 19:25:43 +00:00
return ;
2017-01-27 00:02:47 +00:00
2017-01-29 19:25:43 +00:00
// A 160x100 image of the level as entry MAPxxP
if ( ! ( levelselect . rows [ row ] . mapavailable [ col ] ) )
2017-10-25 15:40:21 +00:00
{
V_DrawSmallScaledPatch ( x , y , 0 , levselp [ 0 ] [ 2 ] ) ;
M_DrawStaticBox ( x , y , V_80TRANS , 80 , 50 ) ;
}
2017-01-29 19:25:43 +00:00
else
2017-02-10 23:24:06 +00:00
{
if ( W_CheckNumForName ( va ( " %sP " , G_BuildMapName ( map ) ) ) ! = LUMPERROR )
patch = W_CachePatchName ( va ( " %sP " , G_BuildMapName ( map ) ) , PU_CACHE ) ;
else
2017-02-17 01:45:21 +00:00
patch = levselp [ 0 ] [ 2 ] ; // don't static to indicate that it's just a normal level
2017-01-27 00:02:47 +00:00
2017-02-10 23:24:06 +00:00
V_DrawSmallScaledPatch ( x , y , 0 , patch ) ;
}
2017-01-28 00:56:28 +00:00
2017-08-22 20:02:33 +00:00
V_DrawFill ( x , y + 50 , 80 , 8 ,
( ( mapheaderinfo [ map - 1 ] - > unlockrequired < 0 )
? 159 : 63 ) ) ;
2017-01-28 00:56:28 +00:00
2017-01-29 19:25:43 +00:00
if ( strlen ( levelselect . rows [ row ] . mapnames [ col ] ) > 6 ) // "AERIAL GARDEN" vs "ACT 18" - "THE ACT" intentionally compressed
V_DrawThinString ( x , y + 50 , ( highlight ? V_YELLOWMAP : 0 ) , levelselect . rows [ row ] . mapnames [ col ] ) ;
else
V_DrawString ( x , y + 50 , ( highlight ? V_YELLOWMAP : 0 ) , levelselect . rows [ row ] . mapnames [ col ] ) ;
}
static void M_DrawLevelPlatterRow ( UINT8 row , INT32 y )
{
UINT8 col ;
const boolean rowhighlight = ( row = = lsrow ) ;
if ( levelselect . rows [ row ] . header [ 0 ] )
{
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( y , levelselect . rows [ row ] . header , ( rowhighlight | | ( row = = lshli ) ) , false ) ;
2017-01-29 19:25:43 +00:00
y + = lsheadingheight ;
2017-01-27 00:02:47 +00:00
}
2017-01-29 19:25:43 +00:00
2017-09-15 19:34:46 +00:00
if ( levellistmode = = LLM_CREATESERVER & & ! row )
{
if ( ! char_notes )
char_notes = V_WordWrap ( 0 , 282 - 8 , V_ALLOWLOWERCASE , gametypedesc [ cv_newgametype . value ] . notes ) ;
V_DrawFill ( lsbasex , y , 282 , 50 , 27 ) ;
V_DrawString ( lsbasex + 4 , y + 4 , V_RETURN8 | V_ALLOWLOWERCASE , char_notes ) ;
V_DrawFill ( lsbasex , y + 50 , 141 , 8 , gametypedesc [ cv_newgametype . value ] . col [ 0 ] ) ;
V_DrawFill ( lsbasex + 141 , y + 50 , 141 , 8 , gametypedesc [ cv_newgametype . value ] . col [ 1 ] ) ;
V_DrawString ( lsbasex , y + 50 , 0 , gametype_cons_t [ cv_newgametype . value ] . strvalue ) ;
if ( ! lsrow )
{
V_DrawCharacter ( lsbasex - 10 - ( skullAnimCounter / 5 ) , y + 25 ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( lsbasex + 282 + 2 + ( skullAnimCounter / 5 ) , y + 25 ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
}
else if ( lswide ( row ) )
2017-02-17 01:45:21 +00:00
M_DrawLevelPlatterWideMap ( row , 0 , lsbasex , y , rowhighlight ) ;
else
{
for ( col = 0 ; col < 3 ; col + + )
M_DrawLevelPlatterMap ( row , col , lsbasex + ( col * lshseperation ) , y , ( rowhighlight & & ( col = = lscol ) ) ) ;
}
2017-01-27 00:02:47 +00:00
}
2019-08-20 03:12:22 +00:00
// new menus
2019-08-20 03:41:06 +00:00
static void M_DrawRecordAttackForeground ( void )
2019-08-18 23:35:16 +00:00
{
2019-08-20 03:12:22 +00:00
patch_t * fg = W_CachePatchName ( " RECATKFG " , PU_CACHE ) ;
2019-08-20 03:41:06 +00:00
patch_t * clock = W_CachePatchName ( " RECCLOCK " , PU_CACHE ) ;
2019-08-18 23:35:16 +00:00
angle_t fa ;
INT32 i ;
2019-08-19 19:19:25 +00:00
INT32 height = ( SHORT ( fg - > height ) / 2 ) ;
2019-08-26 23:49:04 +00:00
INT32 dupz = ( vid . dupx < vid . dupy ? vid . dupx : vid . dupy ) ;
2019-08-18 23:35:16 +00:00
for ( i = - 12 ; i < ( BASEVIDHEIGHT / height ) + 12 ; i + + )
{
2019-08-20 03:12:22 +00:00
INT32 y = ( ( i * height ) - ( height - ( ( recatkdrawtimer * 2 ) % height ) ) ) ;
2019-08-26 23:49:04 +00:00
// don't draw above the screen
{
INT32 sy = FixedMul ( y , dupz < < FRACBITS ) > > FRACBITS ;
if ( vid . height ! = BASEVIDHEIGHT * dupz )
sy + = ( vid . height - ( BASEVIDHEIGHT * dupz ) ) / 2 ;
if ( ( sy + height ) < 0 )
continue ;
}
2019-08-18 23:35:16 +00:00
V_DrawFixedPatch ( 0 , y < < FRACBITS , FRACUNIT / 2 , V_SNAPTOLEFT , fg , NULL ) ;
V_DrawFixedPatch ( BASEVIDWIDTH < < FRACBITS , y < < FRACBITS , FRACUNIT / 2 , V_SNAPTORIGHT | V_FLIP , fg , NULL ) ;
2019-08-26 23:49:04 +00:00
// don't draw below the screen
if ( y > vid . height )
break ;
2019-08-18 23:35:16 +00:00
}
2019-08-26 23:49:04 +00:00
// draw clock
2019-08-20 03:12:22 +00:00
fa = ( FixedAngle ( ( ( recatkdrawtimer * 4 ) % 360 ) < < FRACBITS ) > > ANGLETOFINESHIFT ) & FINEMASK ;
2019-08-20 03:41:06 +00:00
V_DrawSciencePatch ( 160 < < FRACBITS , ( 80 < < FRACBITS ) + ( 4 * FINESINE ( fa ) ) , 0 , clock , FRACUNIT ) ;
2019-08-18 23:35:16 +00:00
2019-08-20 03:41:06 +00:00
// Increment timer.
2019-08-20 03:12:22 +00:00
recatkdrawtimer + + ;
}
// NiGHTS Attack background.
2019-10-03 00:28:02 +00:00
static void M_DrawNightsAttackMountains ( void )
2019-08-20 03:12:22 +00:00
{
static INT32 bgscrollx ;
2019-10-03 01:02:13 +00:00
INT32 dupz = ( vid . dupx < vid . dupy ? vid . dupx : vid . dupy ) ;
2019-10-03 00:28:02 +00:00
patch_t * background = W_CachePatchName ( curbgname , PU_CACHE ) ;
INT32 x = FixedInt ( bgscrollx ) % SHORT ( background - > width ) ;
INT32 y = BASEVIDHEIGHT - SHORT ( background - > height ) * 2 ;
2019-10-03 01:02:13 +00:00
if ( vid . height ! = BASEVIDHEIGHT * dupz )
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , 158 ) ;
V_DrawFill ( 0 , y + 50 , vid . width , BASEVIDHEIGHT , V_SNAPTOLEFT | 31 ) ;
2019-10-03 00:28:02 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOLEFT , background ) ;
x + = SHORT ( background - > width ) ;
if ( x < BASEVIDWIDTH )
V_DrawScaledPatch ( x , y , V_SNAPTOLEFT , background ) ;
2019-10-03 01:02:13 +00:00
2019-08-20 03:12:22 +00:00
bgscrollx - = ( FRACUNIT / 2 ) ;
}
// NiGHTS Attack foreground.
static void M_DrawNightsAttackBackground ( void )
{
2019-10-03 00:28:02 +00:00
INT32 x , y = 0 ;
INT32 i ;
2019-08-20 03:12:22 +00:00
// top
patch_t * backtopfg = W_CachePatchName ( " NTSATKT1 " , PU_CACHE ) ;
patch_t * fronttopfg = W_CachePatchName ( " NTSATKT2 " , PU_CACHE ) ;
INT32 backtopwidth = SHORT ( backtopfg - > width ) ;
2019-10-03 00:28:02 +00:00
//INT32 backtopheight = SHORT(backtopfg->height);
2019-08-20 03:12:22 +00:00
INT32 fronttopwidth = SHORT ( fronttopfg - > width ) ;
2019-10-03 00:28:02 +00:00
//INT32 fronttopheight = SHORT(fronttopfg->height);
2019-08-20 03:12:22 +00:00
// bottom
2019-10-03 00:28:02 +00:00
patch_t * backbottomfg = W_CachePatchName ( " NTSATKB1 " , PU_CACHE ) ;
2019-08-20 03:12:22 +00:00
patch_t * frontbottomfg = W_CachePatchName ( " NTSATKB2 " , PU_CACHE ) ;
2019-10-03 00:28:02 +00:00
INT32 backbottomwidth = SHORT ( backbottomfg - > width ) ;
INT32 backbottomheight = SHORT ( backbottomfg - > height ) ;
2019-08-20 03:12:22 +00:00
INT32 frontbottomwidth = SHORT ( frontbottomfg - > width ) ;
2019-10-03 00:28:02 +00:00
INT32 frontbottomheight = SHORT ( frontbottomfg - > height ) ;
2019-08-20 03:12:22 +00:00
// background
2019-10-03 00:28:02 +00:00
M_DrawNightsAttackMountains ( ) ;
2019-08-20 03:12:22 +00:00
// back top foreground patch
2019-10-02 23:00:43 +00:00
x = - ( ntsatkdrawtimer % backtopwidth ) ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOTOP | V_SNAPTOLEFT , backtopfg ) ;
2019-10-02 23:00:43 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
2019-10-03 00:28:02 +00:00
x + = ( backtopwidth ) ;
if ( x > = vid . width )
break ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOTOP | V_SNAPTOLEFT , backtopfg ) ;
2019-10-02 23:00:43 +00:00
}
2019-08-20 03:12:22 +00:00
// front top foreground patch
2019-10-02 23:00:43 +00:00
x = - ( ( ntsatkdrawtimer * 2 ) % fronttopwidth ) ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOTOP | V_SNAPTOLEFT , fronttopfg ) ;
2019-10-02 23:00:43 +00:00
for ( i = 0 ; i < 3 ; i + + )
{
2019-10-03 00:28:02 +00:00
x + = ( fronttopwidth ) ;
if ( x > = vid . width )
break ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOTOP | V_SNAPTOLEFT , fronttopfg ) ;
2019-10-02 23:00:43 +00:00
}
2019-08-20 03:12:22 +00:00
// back bottom foreground patch
2019-10-03 00:28:02 +00:00
x = - ( ntsatkdrawtimer % backbottomwidth ) ;
y = BASEVIDHEIGHT - backbottomheight ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOBOTTOM | V_SNAPTOLEFT , backbottomfg ) ;
2019-10-03 00:28:02 +00:00
for ( i = 0 ; i < 3 ; i + + )
2019-08-20 03:12:22 +00:00
{
2019-10-03 00:28:02 +00:00
x + = ( backbottomwidth ) ;
if ( x > = vid . width )
break ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOBOTTOM | V_SNAPTOLEFT , backbottomfg ) ;
2019-08-20 03:12:22 +00:00
}
// front bottom foreground patch
2019-10-03 00:28:02 +00:00
x = - ( ( ntsatkdrawtimer * 2 ) % frontbottomwidth ) ;
y = BASEVIDHEIGHT - frontbottomheight ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOBOTTOM | V_SNAPTOLEFT , frontbottomfg ) ;
2019-10-03 00:28:02 +00:00
for ( i = 0 ; i < 3 ; i + + )
2019-08-20 03:12:22 +00:00
{
2019-10-03 00:28:02 +00:00
x + = ( frontbottomwidth ) ;
if ( x > = vid . width )
break ;
2019-10-03 01:02:13 +00:00
V_DrawScaledPatch ( x , y , V_SNAPTOBOTTOM | V_SNAPTOLEFT , frontbottomfg ) ;
2019-08-20 03:12:22 +00:00
}
2019-08-20 03:41:06 +00:00
// Increment timer.
2019-08-20 03:12:22 +00:00
ntsatkdrawtimer + + ;
}
// NiGHTS Attack floating Super Sonic.
2019-10-03 00:28:02 +00:00
static patch_t * ntssupersonic [ 2 ] ;
2019-08-20 03:12:22 +00:00
static void M_DrawNightsAttackSuperSonic ( void )
{
2019-10-03 00:28:02 +00:00
const UINT8 * colormap = R_GetTranslationColormap ( TC_DEFAULT , SKINCOLOR_YELLOW , GTC_CACHE ) ;
2019-08-20 03:12:22 +00:00
INT32 timer = ( ntsatkdrawtimer / 4 ) % 2 ;
2019-10-03 00:28:02 +00:00
angle_t fa = ( FixedAngle ( ( ( ntsatkdrawtimer * 4 ) % 360 ) < < FRACBITS ) > > ANGLETOFINESHIFT ) & FINEMASK ;
V_DrawFixedPatch ( 235 < < FRACBITS , ( 120 < < FRACBITS ) - ( 8 * FINESINE ( fa ) ) , FRACUNIT , 0 , ntssupersonic [ timer ] , colormap ) ;
2019-08-18 23:35:16 +00:00
}
2017-01-27 14:42:57 +00:00
static void M_DrawLevelPlatterMenu ( void )
2017-01-27 00:02:47 +00:00
{
2017-02-17 01:45:21 +00:00
UINT8 iter = lsrow , sizeselect = ( lswide ( lsrow ) ? 1 : 0 ) ;
2017-01-29 19:25:43 +00:00
INT32 y = lsbasey + lsoffs [ 0 ] - getheadingoffset ( lsrow ) ;
2017-02-17 01:45:21 +00:00
const INT32 cursorx = ( sizeselect ? 0 : ( lscol * lshseperation ) ) ;
2017-01-27 00:02:47 +00:00
2019-08-03 21:30:51 +00:00
if ( currentMenu - > prevMenu = = & SP_TimeAttackDef )
2018-11-17 06:21:21 +00:00
{
2019-08-20 03:12:22 +00:00
M_SetMenuCurBackground ( " RECATKBG " ) ;
2019-08-03 21:30:51 +00:00
2019-07-16 04:07:55 +00:00
curbgxspeed = 0 ;
curbgyspeed = 18 ;
2019-08-03 21:30:51 +00:00
2018-11-20 22:28:26 +00:00
if ( curbgcolor > = 0 )
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , curbgcolor ) ;
else if ( ! curbghide | | ! titlemapinaction )
2019-08-20 03:41:06 +00:00
{
2018-11-25 20:08:12 +00:00
F_SkyScroll ( curbgxspeed , curbgyspeed , curbgname ) ;
2019-08-20 03:41:06 +00:00
// Draw and animate foreground
if ( ! strncmp ( " RECATKBG " , curbgname , 8 ) )
M_DrawRecordAttackForeground ( ) ;
}
2018-11-20 22:28:26 +00:00
if ( curfadevalue )
V_DrawFadeScreen ( 0xFF00 , curfadevalue ) ;
2018-11-17 06:21:21 +00:00
}
2017-01-28 13:13:03 +00:00
2019-08-03 21:30:51 +00:00
if ( currentMenu - > prevMenu = = & SP_NightsAttackDef )
{
2019-08-20 03:12:22 +00:00
M_SetMenuCurBackground ( " NTSATKBG " ) ;
2019-08-03 21:30:51 +00:00
if ( curbgcolor > = 0 )
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , curbgcolor ) ;
else if ( ! curbghide | | ! titlemapinaction )
2019-10-03 00:28:02 +00:00
{
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , 158 ) ;
M_DrawNightsAttackMountains ( ) ;
}
2018-11-20 22:28:26 +00:00
if ( curfadevalue )
V_DrawFadeScreen ( 0xFF00 , curfadevalue ) ;
2018-11-17 06:21:21 +00:00
}
2017-01-28 13:13:03 +00:00
2017-01-27 14:42:57 +00:00
// finds row at top of the screen
2018-03-19 16:40:15 +00:00
while ( y > - 8 )
2017-01-27 14:42:57 +00:00
{
2019-10-14 16:17:00 +00:00
if ( iter = = 0 )
{
if ( levelselect . numrows < 3 )
break ;
iter = levelselect . numrows ;
}
iter - - ;
2017-01-29 19:25:43 +00:00
y - = lsvseperation ( iter ) ;
2017-01-27 14:42:57 +00:00
}
2017-01-27 00:02:47 +00:00
2017-01-27 14:42:57 +00:00
// draw from top to bottom
2018-03-19 16:40:15 +00:00
while ( y < ( vid . height / vid . dupy ) )
2017-01-27 14:42:57 +00:00
{
M_DrawLevelPlatterRow ( iter , y ) ;
2017-01-29 19:25:43 +00:00
y + = lsvseperation ( iter ) ;
2019-10-14 16:17:00 +00:00
if ( iter = = levelselect . numrows - 1 )
{
if ( levelselect . numrows < 3 )
break ;
iter = UINT8_MAX ;
}
iter + + ;
2017-01-27 14:42:57 +00:00
}
2017-01-27 00:02:47 +00:00
2017-01-28 00:56:28 +00:00
// draw cursor box
2017-09-15 19:34:46 +00:00
if ( levellistmode ! = LLM_CREATESERVER | | lsrow )
2017-10-18 21:18:43 +00:00
V_DrawSmallScaledPatch ( lsbasex + cursorx + lsoffs [ 1 ] , lsbasey + lsoffs [ 0 ] , 0 , ( levselp [ sizeselect ] [ ( ( skullAnimCounter / 4 ) ? 1 : 0 ) ] ) ) ;
2017-01-28 00:56:28 +00:00
2017-09-15 19:34:46 +00:00
#if 0
2017-08-21 15:02:13 +00:00
if ( levelselect . rows [ lsrow ] . maplist [ lscol ] > 0 )
2017-02-17 01:45:21 +00:00
V_DrawScaledPatch ( lsbasex + cursorx - 17 , lsbasey + 50 + lsoffs [ 0 ] , 0 , W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
2017-09-15 19:34:46 +00:00
# endif
2017-01-28 00:56:28 +00:00
2017-01-27 14:42:57 +00:00
// handle movement of cursor box
2017-08-20 22:18:47 +00:00
if ( lsoffs [ 0 ] > 1 | | lsoffs [ 0 ] < - 1 )
2017-01-27 00:02:47 +00:00
lsoffs [ 0 ] = 2 * lsoffs [ 0 ] / 3 ;
else
lsoffs [ 0 ] = 0 ;
2017-08-20 22:18:47 +00:00
if ( lsoffs [ 1 ] > 1 | | lsoffs [ 1 ] < - 1 )
2017-01-27 14:42:57 +00:00
lsoffs [ 1 ] = 2 * lsoffs [ 1 ] / 3 ;
2017-01-27 00:02:47 +00:00
else
lsoffs [ 1 ] = 0 ;
2017-01-28 13:13:03 +00:00
M_DrawMenuTitle ( ) ;
2017-01-27 00:02:47 +00:00
}
2014-03-15 16:59:03 +00:00
//
// M_CanShowLevelInList
//
2017-01-27 14:42:57 +00:00
// Determines whether to show a given map in level-select lists where you don't want to see locked levels.
2014-03-15 16:59:03 +00:00
// Set gt = -1 to ignore gametype.
//
boolean M_CanShowLevelInList ( INT32 mapnum , INT32 gt )
{
2017-01-27 14:42:57 +00:00
return ( M_CanShowLevelOnPlatter ( mapnum , gt ) & & M_LevelAvailableOnPlatter ( mapnum ) ) ;
2014-03-15 16:59:03 +00:00
}
2017-02-02 12:32:02 +00:00
static INT32 M_GetFirstLevelInList ( INT32 gt )
2014-03-15 16:59:03 +00:00
{
INT32 mapnum ;
for ( mapnum = 0 ; mapnum < NUMMAPS ; mapnum + + )
2017-02-02 12:32:02 +00:00
if ( M_CanShowLevelInList ( mapnum , gt ) )
2014-03-15 16:59:03 +00:00
return mapnum + 1 ;
return 1 ;
}
// ==================================================
// MESSAGE BOX (aka: a hacked, cobbled together menu)
// ==================================================
static void M_DrawMessageMenu ( void ) ;
// Because this is just a hack-ish 'menu', I'm not putting this with the others
static menuitem_t MessageMenu [ ] =
{
// TO HACK
{ 0 , NULL , NULL , NULL , 0 }
} ;
menu_t MessageDef =
{
2018-11-16 14:56:22 +00:00
MN_SPECIAL ,
2014-03-15 16:59:03 +00:00
NULL , // title
1 , // # of menu items
NULL , // previous menu (TO HACK)
MessageMenu , // menuitem_t ->
M_DrawMessageMenu , // drawing routine ->
0 , 0 , // x, y (TO HACK)
0 , // lastOn, flags (TO HACK)
NULL
} ;
void M_StartMessage ( const char * string , void * routine ,
menumessagetype_t itemtype )
{
size_t max = 0 , start = 0 , i , strlines ;
static char * message = NULL ;
Z_Free ( message ) ;
message = Z_StrDup ( string ) ;
DEBFILE ( message ) ;
// Rudementary word wrapping.
// Simple and effective. Does not handle nonuniform letter sizes, colors, etc. but who cares.
strlines = 0 ;
for ( i = 0 ; message [ i ] ; i + + )
{
if ( message [ i ] = = ' ' )
{
start = i ;
max + = 4 ;
}
else if ( message [ i ] = = ' \n ' )
{
strlines = i ;
start = 0 ;
max = 0 ;
continue ;
}
else
max + = 8 ;
// Start trying to wrap if presumed length exceeds the screen width.
if ( max > = BASEVIDWIDTH & & start > 0 )
{
message [ start ] = ' \n ' ;
max - = ( start - strlines ) * 8 ;
strlines = start ;
start = 0 ;
}
}
start = 0 ;
max = 0 ;
M_StartControlPanel ( ) ; // can't put menuactive to true
if ( currentMenu = = & MessageDef ) // Prevent recursion
MessageDef . prevMenu = & MainDef ;
else
MessageDef . prevMenu = currentMenu ;
MessageDef . menuitems [ 0 ] . text = message ;
MessageDef . menuitems [ 0 ] . alphaKey = ( UINT8 ) itemtype ;
if ( ! routine & & itemtype ! = MM_NOTHING ) itemtype = MM_NOTHING ;
switch ( itemtype )
{
case MM_NOTHING :
MessageDef . menuitems [ 0 ] . status = IT_MSGHANDLER ;
MessageDef . menuitems [ 0 ] . itemaction = M_StopMessage ;
break ;
case MM_YESNO :
MessageDef . menuitems [ 0 ] . status = IT_MSGHANDLER ;
MessageDef . menuitems [ 0 ] . itemaction = routine ;
break ;
case MM_EVENTHANDLER :
MessageDef . menuitems [ 0 ] . status = IT_MSGHANDLER ;
MessageDef . menuitems [ 0 ] . itemaction = routine ;
break ;
}
//added : 06-02-98: now draw a textbox around the message
// compute lenght max and the numbers of lines
for ( strlines = 0 ; * ( message + start ) ; strlines + + )
{
for ( i = 0 ; i < strlen ( message + start ) ; i + + )
{
if ( * ( message + start + i ) = = ' \n ' )
{
if ( i > max )
max = i ;
start + = i ;
i = ( size_t ) - 1 ; //added : 07-02-98 : damned!
start + + ;
break ;
}
}
if ( i = = strlen ( message + start ) )
start + = i ;
}
MessageDef . x = ( INT16 ) ( ( BASEVIDWIDTH - 8 * max - 16 ) / 2 ) ;
MessageDef . y = ( INT16 ) ( ( BASEVIDHEIGHT - M_StringHeight ( message ) ) / 2 ) ;
MessageDef . lastOn = ( INT16 ) ( ( strlines < < 8 ) + max ) ;
//M_SetupNextMenu();
currentMenu = & MessageDef ;
itemOn = 0 ;
}
# define MAXMSGLINELEN 256
static void M_DrawMessageMenu ( void )
{
INT32 y = currentMenu - > y ;
size_t i , start = 0 ;
INT16 max ;
char string [ MAXMSGLINELEN ] ;
INT32 mlines ;
const char * msg = currentMenu - > menuitems [ 0 ] . text ;
mlines = currentMenu - > lastOn > > 8 ;
max = ( INT16 ) ( ( UINT8 ) ( currentMenu - > lastOn & 0xFF ) * 8 ) ;
2016-08-20 05:18:43 +00:00
// hack: draw RA background in RA menus
if ( gamestate = = GS_TIMEATTACK )
2018-11-17 21:32:30 +00:00
{
2018-11-20 22:28:26 +00:00
if ( curbgcolor > = 0 )
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , curbgcolor ) ;
else if ( ! curbghide | | ! titlemapinaction )
2019-08-20 03:12:22 +00:00
{
if ( levellistmode = = LLM_NIGHTSATTACK )
2019-10-03 00:28:02 +00:00
{
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , 158 ) ;
M_DrawNightsAttackMountains ( ) ;
}
2019-08-20 03:12:22 +00:00
else
2019-08-20 03:41:06 +00:00
{
2019-08-20 03:12:22 +00:00
F_SkyScroll ( curbgxspeed , curbgyspeed , curbgname ) ;
2019-08-20 04:15:35 +00:00
if ( ! strncmp ( " RECATKBG " , curbgname , 8 ) )
M_DrawRecordAttackForeground ( ) ;
2019-08-20 03:41:06 +00:00
}
2019-08-20 03:12:22 +00:00
}
2018-11-20 22:28:26 +00:00
if ( curfadevalue )
V_DrawFadeScreen ( 0xFF00 , curfadevalue ) ;
2018-11-17 21:32:30 +00:00
}
2016-08-20 05:18:43 +00:00
2014-03-15 16:59:03 +00:00
M_DrawTextBox ( currentMenu - > x , y - 8 , ( max + 7 ) > > 3 , mlines ) ;
while ( * ( msg + start ) )
{
size_t len = strlen ( msg + start ) ;
for ( i = 0 ; i < len ; i + + )
{
if ( * ( msg + start + i ) = = ' \n ' )
{
memset ( string , 0 , MAXMSGLINELEN ) ;
if ( i > = MAXMSGLINELEN )
{
CONS_Printf ( " M_DrawMessageMenu: too long segment in %s \n " , msg ) ;
return ;
}
else
{
strncpy ( string , msg + start , i ) ;
string [ i ] = ' \0 ' ;
start + = i ;
i = ( size_t ) - 1 ; //added : 07-02-98 : damned!
start + + ;
}
break ;
}
}
if ( i = = strlen ( msg + start ) )
{
if ( i > = MAXMSGLINELEN )
{
CONS_Printf ( " M_DrawMessageMenu: too long segment in %s \n " , msg ) ;
return ;
}
else
{
strcpy ( string , msg + start ) ;
start + = i ;
}
}
V_DrawString ( ( BASEVIDWIDTH - V_StringWidth ( string , 0 ) ) / 2 , y , V_ALLOWLOWERCASE , string ) ;
y + = 8 ; //SHORT(hu_font[0]->height);
}
}
// default message handler
static void M_StopMessage ( INT32 choice )
{
( void ) choice ;
if ( menuactive )
M_SetupNextMenu ( MessageDef . prevMenu ) ;
}
// =========
// IMAGEDEFS
// =========
// Draw an Image Def. Aka, Help images.
// Defines what image is used in (menuitem_t)->text.
// You can even put multiple images in one menu!
static void M_DrawImageDef ( void )
{
// Grr. Need to autodetect for pic_ts.
pic_t * pictest = ( pic_t * ) W_CachePatchName ( currentMenu - > menuitems [ itemOn ] . text , PU_CACHE ) ;
if ( ! pictest - > zero )
V_DrawScaledPic ( 0 , 0 , 0 , W_GetNumForName ( currentMenu - > menuitems [ itemOn ] . text ) ) ;
else
{
patch_t * patch = W_CachePatchName ( currentMenu - > menuitems [ itemOn ] . text , PU_CACHE ) ;
if ( patch - > width < = BASEVIDWIDTH )
V_DrawScaledPatch ( 0 , 0 , 0 , patch ) ;
else
V_DrawSmallScaledPatch ( 0 , 0 , 0 , patch ) ;
}
if ( currentMenu - > numitems > 1 )
V_DrawString ( 0 , 192 , V_TRANSLUCENT , va ( " PAGE %d of %hd " , itemOn + 1 , currentMenu - > numitems ) ) ;
}
// Handles the ImageDefs. Just a specialized function that
// uses left and right movement.
static void M_HandleImageDef ( INT32 choice )
{
switch ( choice )
{
case KEY_RIGHTARROW :
if ( currentMenu - > numitems = = 1 )
break ;
S_StartSound ( NULL , sfx_menu1 ) ;
if ( itemOn > = ( INT16 ) ( currentMenu - > numitems - 1 ) )
itemOn = 0 ;
else itemOn + + ;
break ;
case KEY_LEFTARROW :
if ( currentMenu - > numitems = = 1 )
break ;
S_StartSound ( NULL , sfx_menu1 ) ;
if ( ! itemOn )
itemOn = currentMenu - > numitems - 1 ;
else itemOn - - ;
break ;
case KEY_ESCAPE :
case KEY_ENTER :
M_ClearMenus ( true ) ;
break ;
}
}
// ======================
// MISC MAIN MENU OPTIONS
// ======================
2017-04-29 15:40:07 +00:00
static void M_AddonsOptions ( INT32 choice )
{
( void ) choice ;
Addons_option_Onchange ( ) ;
M_SetupNextMenu ( & OP_AddonsOptionsDef ) ;
}
2018-12-16 01:46:42 +00:00
# define LOCATIONSTRING1 "Visit \x83SRB2.ORG / MODS\x80 to get & make add-ons!"
2018-12-16 02:44:39 +00:00
//#define LOCATIONSTRING2 "Visit \x88SRB2.ORG/MODS\x80 to get & make add-ons!"
2017-05-16 22:43:21 +00:00
2017-04-29 15:40:07 +00:00
static void M_Addons ( INT32 choice )
{
2017-04-29 15:40:07 +00:00
const char * pathname = " . " ;
2017-04-29 15:40:07 +00:00
( void ) choice ;
2018-12-16 02:44:39 +00:00
// If M_GetGameypeColor() is ever ported from Kart, then remove this.
highlightflags = V_YELLOWMAP ;
recommendedflags = V_GREENMAP ;
warningflags = V_REDMAP ;
2018-06-18 15:55:34 +00:00
# if 1
if ( cv_addons_option . value = = 0 )
pathname = usehome ? srb2home : srb2path ;
2017-04-29 15:40:07 +00:00
else if ( cv_addons_option . value = = 1 )
pathname = srb2home ;
else if ( cv_addons_option . value = = 2 )
pathname = srb2path ;
2018-06-18 15:55:34 +00:00
else
# endif
2017-04-29 15:40:07 +00:00
if ( cv_addons_option . value = = 3 & & * cv_addons_folder . string ! = ' \0 ' )
pathname = cv_addons_folder . string ;
strlcpy ( menupath , pathname , 1024 ) ;
2017-04-29 15:40:07 +00:00
menupathindex [ ( menudepthleft = menudepth - 1 ) ] = strlen ( menupath ) + 1 ;
2017-04-29 15:40:07 +00:00
2018-06-18 15:55:34 +00:00
if ( menupath [ menupathindex [ menudepthleft ] - 2 ] ! = PATHSEP [ 0 ] )
2017-04-29 15:40:07 +00:00
{
2018-06-18 15:55:34 +00:00
menupath [ menupathindex [ menudepthleft ] - 1 ] = PATHSEP [ 0 ] ;
2017-04-29 15:40:07 +00:00
menupath [ menupathindex [ menudepthleft ] ] = 0 ;
}
else
- - menupathindex [ menudepthleft ] ;
2017-04-29 15:40:07 +00:00
if ( ! preparefilemenu ( false ) )
2017-04-29 15:40:07 +00:00
{
2018-12-16 02:44:39 +00:00
M_StartMessage ( va ( " No files/folders found. \n \n %s \n \n (Press a key) \n " , LOCATIONSTRING1 ) , NULL , MM_NOTHING ) ;
// (recommendedflags == V_SKYMAP ? LOCATIONSTRING2 : LOCATIONSTRING1))
2017-04-29 15:40:07 +00:00
return ;
}
2017-04-29 15:40:07 +00:00
else
dir_on [ menudepthleft ] = 0 ;
2017-04-29 15:40:07 +00:00
2017-04-29 15:40:07 +00:00
if ( addonsp [ 0 ] ) // never going to have some provided but not all, saves individually checking
{
size_t i ;
2019-02-28 15:48:27 +00:00
for ( i = 0 ; i < NUM_EXT + 5 ; i + + )
2017-04-29 15:40:07 +00:00
W_UnlockCachedPatch ( addonsp [ i ] ) ;
}
addonsp [ EXT_FOLDER ] = W_CachePatchName ( " M_FFLDR " , PU_STATIC ) ;
addonsp [ EXT_UP ] = W_CachePatchName ( " M_FBACK " , PU_STATIC ) ;
2017-04-29 15:40:07 +00:00
addonsp [ EXT_NORESULTS ] = W_CachePatchName ( " M_FNOPE " , PU_STATIC ) ;
2017-04-29 15:40:07 +00:00
addonsp [ EXT_TXT ] = W_CachePatchName ( " M_FTXT " , PU_STATIC ) ;
addonsp [ EXT_CFG ] = W_CachePatchName ( " M_FCFG " , PU_STATIC ) ;
addonsp [ EXT_WAD ] = W_CachePatchName ( " M_FWAD " , PU_STATIC ) ;
2018-12-16 21:07:47 +00:00
# ifdef USE_KART
2018-12-16 01:46:42 +00:00
addonsp [ EXT_KART ] = W_CachePatchName ( " M_FKART " , PU_STATIC ) ;
2018-12-16 21:07:47 +00:00
# endif
2017-10-07 19:48:49 +00:00
addonsp [ EXT_PK3 ] = W_CachePatchName ( " M_FPK3 " , PU_STATIC ) ;
2017-04-29 15:40:07 +00:00
addonsp [ EXT_SOC ] = W_CachePatchName ( " M_FSOC " , PU_STATIC ) ;
addonsp [ EXT_LUA ] = W_CachePatchName ( " M_FLUA " , PU_STATIC ) ;
2017-04-29 15:40:07 +00:00
addonsp [ NUM_EXT ] = W_CachePatchName ( " M_FUNKN " , PU_STATIC ) ;
2018-12-16 01:46:42 +00:00
addonsp [ NUM_EXT + 1 ] = W_CachePatchName ( " M_FSEL " , PU_STATIC ) ;
addonsp [ NUM_EXT + 2 ] = W_CachePatchName ( " M_FLOAD " , PU_STATIC ) ;
addonsp [ NUM_EXT + 3 ] = W_CachePatchName ( " M_FSRCH " , PU_STATIC ) ;
addonsp [ NUM_EXT + 4 ] = W_CachePatchName ( " M_FSAVE " , PU_STATIC ) ;
2017-04-29 15:40:07 +00:00
2017-04-29 15:40:07 +00:00
MISC_AddonsDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & MISC_AddonsDef ) ;
}
2017-05-24 19:55:05 +00:00
# define width 4
# define vpadding 27
# define h (BASEVIDHEIGHT-(2*vpadding))
2017-04-29 15:40:07 +00:00
# define NUMCOLOURS 8 // when toast's coding it's british english hacker fucker
static void M_DrawTemperature ( INT32 x , fixed_t t )
{
INT32 y ;
// bounds check
if ( t > FRACUNIT )
t = FRACUNIT ;
/*else if (t < 0) -- not needed
t = 0 ; */
// scale
2017-05-24 21:05:41 +00:00
if ( t > 1 )
t = ( FixedMul ( h < < FRACBITS , t ) > > FRACBITS ) ;
2017-04-29 15:40:07 +00:00
// border
2017-05-24 19:55:05 +00:00
V_DrawFill ( x - 1 , vpadding , 1 , h , 3 ) ;
V_DrawFill ( x + width , vpadding , 1 , h , 3 ) ;
V_DrawFill ( x - 1 , vpadding - 1 , width + 2 , 1 , 3 ) ;
V_DrawFill ( x - 1 , vpadding + h , width + 2 , 1 , 3 ) ;
2017-04-29 15:40:07 +00:00
// bar itself
2017-05-24 21:05:41 +00:00
y = h ;
if ( t )
for ( t = h - t ; y > 0 ; y - - )
{
UINT8 colours [ NUMCOLOURS ] = { 42 , 40 , 58 , 222 , 65 , 90 , 97 , 98 } ;
UINT8 c ;
if ( y < = t ) break ;
if ( y + vpadding > = BASEVIDHEIGHT / 2 )
c = 113 ;
else
c = colours [ ( NUMCOLOURS * ( y - 1 ) ) / ( h / 2 ) ] ;
V_DrawFill ( x , y - 1 + vpadding , width , 1 , c ) ;
}
2017-04-29 15:40:07 +00:00
// fill the rest of the backing
if ( y )
2017-05-24 19:55:05 +00:00
V_DrawFill ( x , vpadding , width , y , 27 ) ;
2017-04-29 15:40:07 +00:00
}
2017-05-24 19:55:05 +00:00
# undef width
# undef vpadding
2017-04-29 15:40:07 +00:00
# undef h
# undef NUMCOLOURS
2017-04-29 15:40:07 +00:00
static char * M_AddonsHeaderPath ( void )
{
UINT32 len ;
static char header [ 1024 ] ;
2018-06-18 15:55:34 +00:00
strlcpy ( header , va ( " %s folder%s " , cv_addons_option . string , menupath + menupathindex [ menudepth - 1 ] - 1 ) , 1024 ) ;
2017-04-29 15:40:07 +00:00
len = strlen ( header ) ;
2017-04-29 15:40:07 +00:00
if ( len > 34 )
2017-04-29 15:40:07 +00:00
{
2017-04-29 15:40:07 +00:00
len = len - 34 ;
2017-04-29 15:40:07 +00:00
header [ len ] = header [ len + 1 ] = header [ len + 2 ] = ' . ' ;
}
else
len = 0 ;
return header + len ;
}
2017-04-29 15:40:07 +00:00
# define UNEXIST S_StartSound(NULL, sfx_lose);\
M_SetupNextMenu ( MISC_AddonsDef . prevMenu ) ; \
M_StartMessage ( va ( " \x82 %s \x80 \n This folder no longer exists! \n Aborting to main menu. \n \n (Press a key) \n " , M_AddonsHeaderPath ( ) ) , NULL , MM_NOTHING )
2018-06-18 15:55:34 +00:00
# define CLEARNAME Z_Free(refreshdirname);\
refreshdirname = NULL
static void M_AddonsClearName ( INT32 choice )
{
CLEARNAME ;
M_StopMessage ( choice ) ;
}
2017-04-29 15:40:07 +00:00
// returns whether to do message draw
2017-04-29 15:40:07 +00:00
static boolean M_AddonsRefresh ( void )
2017-04-29 15:40:07 +00:00
{
2017-04-29 15:40:07 +00:00
if ( ( refreshdirmenu & REFRESHDIR_NORMAL ) & & ! preparefilemenu ( true ) )
{
2017-04-29 15:40:07 +00:00
UNEXIST ;
2017-04-29 15:40:07 +00:00
return true ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
2017-04-29 15:40:07 +00:00
if ( refreshdirmenu & REFRESHDIR_ADDFILE )
{
2018-06-18 15:55:34 +00:00
char * message = NULL ;
2017-05-08 16:28:48 +00:00
if ( refreshdirmenu & REFRESHDIR_NOTLOADED )
2017-04-29 15:40:07 +00:00
{
S_StartSound ( NULL , sfx_lose ) ;
if ( refreshdirmenu & REFRESHDIR_MAX )
2019-08-30 04:36:10 +00:00
message = va ( " %c%s \x80 \n Maximum number of add-ons reached. \n A file could not be loaded. \n If you wish to play with this add-on, restart the game to clear existing ones. \n \n (Press a key) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , refreshdirname ) ;
2017-04-29 15:40:07 +00:00
else
2018-12-16 01:46:42 +00:00
message = va ( " %c%s \x80 \n A file was not loaded. \n Check the console log for more information. \n \n (Press a key) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , refreshdirname ) ;
2017-04-29 15:40:07 +00:00
}
2018-06-18 15:55:34 +00:00
else if ( refreshdirmenu & ( REFRESHDIR_WARNING | REFRESHDIR_ERROR ) )
2017-04-29 15:40:07 +00:00
{
S_StartSound ( NULL , sfx_skid ) ;
2018-12-16 01:46:42 +00:00
message = va ( " %c%s \x80 \n A file was loaded with %s. \n Check the console log for more information. \n \n (Press a key) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , refreshdirname , ( ( refreshdirmenu & REFRESHDIR_ERROR ) ? " errors " : " warnings " ) ) ;
2018-06-18 15:55:34 +00:00
}
if ( message )
{
M_StartMessage ( message , M_AddonsClearName , MM_EVENTHANDLER ) ;
2017-04-29 15:40:07 +00:00
return true ;
2017-04-29 15:40:07 +00:00
}
S_StartSound ( NULL , sfx_strpst ) ;
2018-06-18 15:55:34 +00:00
CLEARNAME ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
return false ;
}
static void M_DrawAddons ( void )
{
INT32 x , y ;
2019-02-28 21:52:01 +00:00
size_t i , m ;
size_t t , b ; // top and bottom item #s to draw in directory
2018-12-16 01:46:42 +00:00
const UINT8 * flashcol = NULL ;
UINT8 hilicol ;
2017-04-29 15:40:07 +00:00
// hack - need to refresh at end of frame to handle addfile...
if ( refreshdirmenu & M_AddonsRefresh ( ) )
2018-01-02 18:22:10 +00:00
{
M_DrawMessageMenu ( ) ;
return ;
}
2017-04-29 15:40:07 +00:00
2018-06-06 14:13:09 +00:00
if ( Playing ( ) )
2018-12-16 01:46:42 +00:00
V_DrawCenteredString ( BASEVIDWIDTH / 2 , 5 , warningflags , " Adding files mid-game may cause problems. " ) ;
2018-06-06 14:13:09 +00:00
else
2018-12-16 02:44:39 +00:00
V_DrawCenteredString ( BASEVIDWIDTH / 2 , 5 , 0 , LOCATIONSTRING1 ) ;
// (recommendedflags == V_SKYMAP ? LOCATIONSTRING2 : LOCATIONSTRING1)
2017-04-29 15:40:07 +00:00
2017-05-26 15:04:10 +00:00
if ( numwadfiles < = mainwads + 1 )
2017-05-24 21:05:41 +00:00
y = 0 ;
2017-05-27 11:36:33 +00:00
else if ( numwadfiles > = MAX_WADFILES )
2017-05-24 19:55:05 +00:00
y = FRACUNIT ;
2017-04-29 15:40:07 +00:00
else
{
2018-12-16 01:46:42 +00:00
x = FixedDiv ( ( ( ssize_t ) ( numwadfiles ) - ( ssize_t ) ( mainwads + 1 ) ) < < FRACBITS , ( ( ssize_t ) MAX_WADFILES - ( ssize_t ) ( mainwads + 1 ) ) < < FRACBITS ) ;
y = FixedDiv ( ( ( ( ssize_t ) packetsizetally - ( ssize_t ) mainwadstally ) < < FRACBITS ) , ( ( ( ( ssize_t ) MAXFILENEEDED * sizeof ( UINT8 ) - ( ssize_t ) mainwadstally ) - ( 5 + 22 ) ) < < FRACBITS ) ) ; // 5+22 = (a.ext + checksum length) is minimum addition to packet size tally
2017-05-27 11:36:33 +00:00
if ( x > y )
y = x ;
2017-05-24 19:55:05 +00:00
if ( y > FRACUNIT ) // happens because of how we're shrinkin' it a little
y = FRACUNIT ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
2017-05-24 19:55:05 +00:00
M_DrawTemperature ( BASEVIDWIDTH - 19 - 5 , y ) ;
2017-04-29 15:40:07 +00:00
2017-04-29 15:40:07 +00:00
// DRAW MENU
x = currentMenu - > x ;
2018-06-18 15:55:34 +00:00
y = currentMenu - > y + 1 ;
2017-04-29 15:40:07 +00:00
2019-01-08 02:45:41 +00:00
hilicol = 0 ; // white
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
# define boxwidth (MAXSTRINGLENGTH*8+6)
// draw the file path and the top white + black lines of the box
2018-12-16 01:46:42 +00:00
V_DrawString ( x - 21 , ( y - 16 ) + ( lsheadingheight - 12 ) , highlightflags | V_ALLOWLOWERCASE , M_AddonsHeaderPath ( ) ) ;
2019-02-28 21:52:01 +00:00
V_DrawFill ( x - 21 , ( y - 16 ) + ( lsheadingheight - 3 ) , boxwidth , 1 , hilicol ) ;
V_DrawFill ( x - 21 , ( y - 16 ) + ( lsheadingheight - 2 ) , boxwidth , 1 , 30 ) ;
2017-04-29 15:40:07 +00:00
2018-12-16 01:46:42 +00:00
m = ( BASEVIDHEIGHT - currentMenu - > y + 2 ) - ( y - 1 ) ;
2019-01-08 02:58:42 +00:00
// addons menu back color
2019-02-28 21:52:01 +00:00
V_DrawFill ( x - 21 , y - 1 , boxwidth , m , 159 ) ;
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// The directory is too small for a scrollbar, so just draw a tall white line
if ( sizedirmenu < = addonmenusize )
{
t = 0 ; // first item
b = sizedirmenu - 1 ; // last item
i = 0 ; // "scrollbar" at "top" position
}
2018-12-16 01:46:42 +00:00
else
{
2019-02-28 21:52:01 +00:00
size_t q = m ;
m = ( addonmenusize * m ) / sizedirmenu ; // height of scroll bar
2018-12-16 01:46:42 +00:00
if ( dir_on [ menudepthleft ] < = numaddonsshown ) // all the way up
2019-02-28 21:52:01 +00:00
{
t = 0 ; // first item
b = addonmenusize - 1 ; //9th item
i = 0 ; // scrollbar at top position
}
else if ( dir_on [ menudepthleft ] > = sizedirmenu - ( numaddonsshown + 1 ) ) // all the way down
{
t = sizedirmenu - addonmenusize ; // # 9th last
b = sizedirmenu - 1 ; // last item
i = q - m ; // scrollbar at bottom position
}
else // somewhere in the middle
{
t = dir_on [ menudepthleft ] - numaddonsshown ; // 4 items above
b = dir_on [ menudepthleft ] + numaddonsshown ; // 4 items below
i = ( t * ( q - m ) ) / ( sizedirmenu - addonmenusize ) ; // calculate position of scrollbar
}
2018-12-16 01:46:42 +00:00
}
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// draw the scrollbar!
2019-03-31 13:11:27 +00:00
V_DrawFill ( ( x - 21 ) + boxwidth - 1 , ( y - 1 ) + i , 1 , m , hilicol ) ;
2018-12-16 01:46:42 +00:00
2019-02-28 21:52:01 +00:00
# undef boxwidth
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// draw up arrow that bobs up and down
if ( t ! = 0 )
2018-12-16 01:46:42 +00:00
V_DrawString ( 19 , y + 4 - ( skullAnimCounter / 5 ) , highlightflags , " \x1A " ) ;
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// make the selection box flash yellow
2018-12-16 01:46:42 +00:00
if ( skullAnimCounter < 4 )
flashcol = V_GetStringColormap ( highlightflags ) ;
2019-02-28 21:52:01 +00:00
// draw icons and item names
for ( i = t ; i < = b ; i + + )
2017-04-29 15:40:07 +00:00
{
2017-04-29 15:40:07 +00:00
UINT32 flags = V_ALLOWLOWERCASE ;
2017-04-29 15:40:07 +00:00
if ( y > BASEVIDHEIGHT ) break ;
2017-04-29 15:40:07 +00:00
if ( dirmenu [ i ] )
2017-05-08 22:08:40 +00:00
# define type (UINT8)(dirmenu[i][DIR_TYPE])
2017-04-29 15:40:07 +00:00
{
2017-05-08 22:08:40 +00:00
if ( type & EXT_LOADED )
2018-12-16 01:46:42 +00:00
{
flags | = V_TRANSLUCENT ;
V_DrawSmallScaledPatch ( x - ( 16 + 4 ) , y , V_TRANSLUCENT , addonsp [ ( type & ~ EXT_LOADED ) ] ) ;
V_DrawSmallScaledPatch ( x - ( 16 + 4 ) , y , 0 , addonsp [ NUM_EXT + 2 ] ) ;
}
else
V_DrawSmallScaledPatch ( x - ( 16 + 4 ) , y , 0 , addonsp [ ( type & ~ EXT_LOADED ) ] ) ;
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// draw selection box for the item currently selected
2017-04-29 15:40:07 +00:00
if ( ( size_t ) i = = dir_on [ menudepthleft ] )
{
2018-12-16 01:46:42 +00:00
V_DrawFixedPatch ( ( x - ( 16 + 4 ) ) < < FRACBITS , ( y ) < < FRACBITS , FRACUNIT / 2 , 0 , addonsp [ NUM_EXT + 1 ] , flashcol ) ;
flags = V_ALLOWLOWERCASE | highlightflags ;
2017-04-29 15:40:07 +00:00
}
2019-02-28 21:52:01 +00:00
// draw name of the item, use ... if too long
2017-04-29 15:40:07 +00:00
# define charsonside 14
2017-04-29 15:40:07 +00:00
if ( dirmenu [ i ] [ DIR_LEN ] > ( charsonside * 2 + 3 ) )
V_DrawString ( x , y + 4 , flags , va ( " %.*s...%s " , charsonside , dirmenu [ i ] + DIR_STRING , dirmenu [ i ] + DIR_STRING + dirmenu [ i ] [ DIR_LEN ] - ( charsonside + 1 ) ) ) ;
# undef charsonside
else
V_DrawString ( x , y + 4 , flags , dirmenu [ i ] + DIR_STRING ) ;
}
2017-05-08 22:08:40 +00:00
# undef type
2017-04-29 15:40:07 +00:00
y + = 16 ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// draw down arrow that bobs down and up
if ( b ! = sizedirmenu )
2018-12-16 01:46:42 +00:00
V_DrawString ( 19 , y - 12 + ( skullAnimCounter / 5 ) , highlightflags , " \x1B " ) ;
2017-04-29 15:40:07 +00:00
2019-02-28 21:52:01 +00:00
// draw search box
2018-06-18 15:55:34 +00:00
y = BASEVIDHEIGHT - currentMenu - > y + 1 ;
2017-04-29 15:40:07 +00:00
2017-04-29 15:40:07 +00:00
M_DrawTextBox ( x - ( 21 + 5 ) , y , MAXSTRINGLENGTH , 1 ) ;
2017-04-29 15:40:07 +00:00
if ( menusearch [ 0 ] )
V_DrawString ( x - 18 , y + 8 , V_ALLOWLOWERCASE , menusearch + 1 ) ;
else
V_DrawString ( x - 18 , y + 8 , V_ALLOWLOWERCASE | V_TRANSLUCENT , " Type to search... " ) ;
2017-04-29 15:40:07 +00:00
if ( skullAnimCounter < 4 )
V_DrawCharacter ( x - 18 + V_StringWidth ( menusearch + 1 , 0 ) , y + 8 ,
' _ ' | 0x80 , false ) ;
2017-05-24 19:55:05 +00:00
2019-02-28 21:52:01 +00:00
// draw search icon
2017-05-24 19:55:05 +00:00
x - = ( 21 + 5 + 16 ) ;
2019-01-08 06:31:44 +00:00
V_DrawSmallScaledPatch ( x , y + 4 , ( menusearch [ 0 ] ? 0 : V_TRANSLUCENT ) , addonsp [ NUM_EXT + 3 ] ) ;
2017-05-24 19:55:05 +00:00
2019-02-28 21:52:01 +00:00
// draw save icon
2017-05-24 19:55:05 +00:00
x = BASEVIDWIDTH - x - 16 ;
2019-01-08 06:31:44 +00:00
V_DrawSmallScaledPatch ( x , y + 4 , ( ( ! modifiedgame | | savemoddata ) ? 0 : V_TRANSLUCENT ) , addonsp [ NUM_EXT + 4 ] ) ;
2017-05-24 19:55:05 +00:00
2017-10-23 23:06:13 +00:00
if ( modifiedgame )
2019-01-08 06:31:44 +00:00
V_DrawSmallScaledPatch ( x , y + 4 , 0 , addonsp [ NUM_EXT + 2 ] ) ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
static void M_AddonExec ( INT32 ch )
{
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
2017-08-05 21:13:14 +00:00
S_StartSound ( NULL , sfx_zoom ) ;
2018-12-16 01:46:42 +00:00
COM_BufAddText ( va ( " exec \" %s%s \" " , menupath , dirmenu [ dir_on [ menudepthleft ] ] + DIR_STRING ) ) ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
# define len menusearch[0]
static boolean M_ChangeStringAddons ( INT32 choice )
{
if ( shiftdown & & choice > = 32 & & choice < = 127 )
choice = shiftxform [ choice ] ;
switch ( choice )
{
case KEY_DEL :
2017-04-29 15:40:07 +00:00
if ( len )
{
len = menusearch [ 1 ] = 0 ;
return true ;
}
break ;
2017-04-29 15:40:07 +00:00
case KEY_BACKSPACE :
2017-04-29 15:40:07 +00:00
if ( len )
{
2017-04-29 15:40:07 +00:00
menusearch [ 1 + - - len ] = 0 ;
2017-04-29 15:40:07 +00:00
return true ;
}
break ;
2017-04-29 15:40:07 +00:00
default :
if ( choice > = 32 & & choice < = 127 )
{
if ( len < MAXSTRINGLENGTH - 1 )
{
menusearch [ 1 + len + + ] = ( char ) choice ;
menusearch [ 1 + len ] = 0 ;
2017-04-29 15:40:07 +00:00
return true ;
2017-04-29 15:40:07 +00:00
}
}
break ;
}
return false ;
}
# undef len
2017-04-29 15:40:07 +00:00
static void M_HandleAddons ( INT32 choice )
{
boolean exitmenu = false ; // exit to previous menu
2017-04-29 15:40:07 +00:00
if ( M_ChangeStringAddons ( choice ) )
{
2018-06-17 17:45:03 +00:00
char * tempname = NULL ;
if ( dirmenu & & dirmenu [ dir_on [ menudepthleft ] ] )
tempname = Z_StrDup ( dirmenu [ dir_on [ menudepthleft ] ] + DIR_STRING ) ; // don't need to I_Error if can't make - not important, just QoL
2018-12-16 01:46:42 +00:00
#if 0 // much slower
2017-04-29 15:40:07 +00:00
if ( ! preparefilemenu ( true ) )
{
UNEXIST ;
return ;
}
2018-12-16 01:46:42 +00:00
# else // streamlined
searchfilemenu ( tempname ) ;
# endif
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
switch ( choice )
{
case KEY_DOWNARROW :
2017-04-29 15:40:07 +00:00
if ( dir_on [ menudepthleft ] < sizedirmenu - 1 )
dir_on [ menudepthleft ] + + ;
2017-04-29 15:40:07 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
break ;
case KEY_UPARROW :
2017-04-29 15:40:07 +00:00
if ( dir_on [ menudepthleft ] )
dir_on [ menudepthleft ] - - ;
2017-04-29 15:40:07 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
break ;
2017-04-29 15:40:07 +00:00
case KEY_PGDN :
{
UINT8 i ;
for ( i = numaddonsshown ; i & & ( dir_on [ menudepthleft ] < sizedirmenu - 1 ) ; i - - )
dir_on [ menudepthleft ] + + ;
}
S_StartSound ( NULL , sfx_menu1 ) ;
break ;
case KEY_PGUP :
{
UINT8 i ;
for ( i = numaddonsshown ; i & & ( dir_on [ menudepthleft ] ) ; i - - )
dir_on [ menudepthleft ] - - ;
}
S_StartSound ( NULL , sfx_menu1 ) ;
break ;
2017-04-29 15:40:07 +00:00
case KEY_ENTER :
{
2017-04-29 15:40:07 +00:00
boolean refresh = true ;
2017-04-29 15:40:07 +00:00
if ( ! dirmenu [ dir_on [ menudepthleft ] ] )
S_StartSound ( NULL , sfx_lose ) ;
else
2017-04-29 15:40:07 +00:00
{
2017-04-29 15:40:07 +00:00
switch ( dirmenu [ dir_on [ menudepthleft ] ] [ DIR_TYPE ] )
{
case EXT_FOLDER :
2017-04-29 15:40:07 +00:00
strcpy ( & menupath [ menupathindex [ menudepthleft ] ] , dirmenu [ dir_on [ menudepthleft ] ] + DIR_STRING ) ;
2017-04-29 15:40:07 +00:00
if ( menudepthleft )
2017-04-29 15:40:07 +00:00
{
2017-04-29 15:40:07 +00:00
menupathindex [ - - menudepthleft ] = strlen ( menupath ) ;
menupath [ menupathindex [ menudepthleft ] ] = 0 ;
if ( ! preparefilemenu ( false ) )
{
S_StartSound ( NULL , sfx_skid ) ;
2018-12-16 01:46:42 +00:00
M_StartMessage ( va ( " %c%s \x80 \n This folder is empty. \n \n (Press a key) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , M_AddonsHeaderPath ( ) ) , NULL , MM_NOTHING ) ;
2017-04-29 15:40:07 +00:00
menupath [ menupathindex [ + + menudepthleft ] ] = 0 ;
2017-04-29 15:40:07 +00:00
if ( ! preparefilemenu ( true ) )
{
2017-04-29 15:40:07 +00:00
UNEXIST ;
2017-04-29 15:40:07 +00:00
return ;
}
2017-04-29 15:40:07 +00:00
}
else
{
2017-04-29 15:40:07 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
dir_on [ menudepthleft ] = 1 ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
refresh = false ;
2017-04-29 15:40:07 +00:00
}
else
{
2017-04-29 15:40:07 +00:00
S_StartSound ( NULL , sfx_lose ) ;
2018-12-16 01:46:42 +00:00
M_StartMessage ( va ( " %c%s \x80 \n This folder is too deep to navigate to! \n \n (Press a key) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , M_AddonsHeaderPath ( ) ) , NULL , MM_NOTHING ) ;
2017-04-29 15:40:07 +00:00
menupath [ menupathindex [ menudepthleft ] ] = 0 ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
break ;
case EXT_UP :
2017-04-29 15:40:07 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2017-04-29 15:40:07 +00:00
menupath [ menupathindex [ + + menudepthleft ] ] = 0 ;
2017-05-09 16:05:39 +00:00
if ( ! preparefilemenu ( false ) )
{
UNEXIST ;
return ;
}
2017-04-29 15:40:07 +00:00
break ;
case EXT_TXT :
2018-12-16 01:46:42 +00:00
M_StartMessage ( va ( " %c%s \x80 \n This file may not be a console script. \n Attempt to run anyways? \n \n (Press 'Y' to confirm) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , dirmenu [ dir_on [ menudepthleft ] ] + DIR_STRING ) , M_AddonExec , MM_YESNO ) ;
2017-04-29 15:40:07 +00:00
break ;
case EXT_CFG :
M_AddonExec ( KEY_ENTER ) ;
break ;
case EXT_LUA :
# ifndef HAVE_BLUA
2017-04-29 15:40:07 +00:00
S_StartSound ( NULL , sfx_lose ) ;
2018-12-16 01:46:42 +00:00
M_StartMessage ( va ( " %c%s \x80 \n This copy of SRB2 was compiled \n without support for .lua files. \n \n (Press a key) \n " , ( ' \x80 ' + ( highlightflags > > V_CHARCOLORSHIFT ) ) , dirmenu [ dir_on [ menudepthleft ] ] + DIR_STRING ) , NULL , MM_NOTHING ) ;
2017-04-29 15:40:07 +00:00
break ;
2017-04-29 15:40:07 +00:00
# endif
2019-01-08 04:06:47 +00:00
/* FALLTHRU */
2017-04-29 15:40:07 +00:00
case EXT_SOC :
case EXT_WAD :
2018-12-16 21:07:47 +00:00
# ifdef USE_KART
2018-12-16 01:46:42 +00:00
case EXT_KART :
2018-12-16 21:07:47 +00:00
# endif
2017-10-07 19:48:49 +00:00
case EXT_PK3 :
2018-06-05 16:22:28 +00:00
COM_BufAddText ( va ( " addfile \" %s%s \" " , menupath , dirmenu [ dir_on [ menudepthleft ] ] + DIR_STRING ) ) ;
2017-04-29 15:40:07 +00:00
break ;
default :
S_StartSound ( NULL , sfx_lose ) ;
}
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
if ( refresh )
refreshdirmenu | = REFRESHDIR_NORMAL ;
2017-04-29 15:40:07 +00:00
}
2017-04-29 15:40:07 +00:00
break ;
2017-04-29 15:40:07 +00:00
case KEY_ESCAPE :
exitmenu = true ;
break ;
default :
break ;
}
if ( exitmenu )
{
2018-06-17 17:45:03 +00:00
closefilemenu ( true ) ;
2017-04-29 15:40:07 +00:00
2017-05-08 17:42:24 +00:00
// secrets disabled by addfile...
MainMenu [ secrets ] . status = ( M_AnySecretUnlocked ( ) ) ? ( IT_STRING | IT_CALL ) : ( IT_DISABLED ) ;
2017-04-29 15:40:07 +00:00
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
2014-03-15 16:59:03 +00:00
static void M_PandorasBox ( INT32 choice )
{
( void ) choice ;
2018-08-10 17:15:54 +00:00
if ( maptol & TOL_NIGHTS )
CV_StealthSetValue ( & cv_dummyrings , max ( players [ consoleplayer ] . spheres , 0 ) ) ;
else
CV_StealthSetValue ( & cv_dummyrings , max ( players [ consoleplayer ] . rings , 0 ) ) ;
2018-08-23 19:09:39 +00:00
if ( players [ consoleplayer ] . lives = = INFLIVES )
2019-10-15 10:49:37 +00:00
CV_StealthSet ( & cv_dummylives , " Infinite " ) ;
2018-06-06 13:42:50 +00:00
else
2019-10-15 10:49:37 +00:00
CV_StealthSetValue ( & cv_dummylives , max ( players [ consoleplayer ] . lives , 1 ) ) ;
2014-03-15 16:59:03 +00:00
CV_StealthSetValue ( & cv_dummycontinues , players [ consoleplayer ] . continues ) ;
2017-09-15 19:34:46 +00:00
SR_PandorasBox [ 6 ] . status = ( ( players [ consoleplayer ] . charflags & SF_SUPER )
# ifndef DEVELOP
| | cv_skin . value = = 1
# endif
) ? ( IT_GRAYEDOUT ) : ( IT_STRING | IT_CALL ) ;
SR_PandorasBox [ 7 ] . status = ( emeralds = = ( ( EMERALD7 ) * 2 ) - 1 ) ? ( IT_GRAYEDOUT ) : ( IT_STRING | IT_CALL ) ;
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & SR_PandoraDef ) ;
}
static boolean M_ExitPandorasBox ( void )
{
2015-08-15 20:07:16 +00:00
if ( cv_dummyrings . value ! = max ( players [ consoleplayer ] . rings , 0 ) )
2018-08-10 17:15:54 +00:00
{
if ( maptol & TOL_NIGHTS )
COM_ImmedExecute ( va ( " setspheres %d " , cv_dummyrings . value ) ) ;
else
COM_ImmedExecute ( va ( " setrings %d " , cv_dummyrings . value ) ) ;
}
2014-03-15 16:59:03 +00:00
if ( cv_dummylives . value ! = players [ consoleplayer ] . lives )
COM_ImmedExecute ( va ( " setlives %d " , cv_dummylives . value ) ) ;
if ( cv_dummycontinues . value ! = players [ consoleplayer ] . continues )
COM_ImmedExecute ( va ( " setcontinues %d " , cv_dummycontinues . value ) ) ;
return true ;
}
static void M_ChangeLevel ( INT32 choice )
{
char mapname [ 6 ] ;
( void ) choice ;
strlcpy ( mapname , G_BuildMapName ( cv_nextmap . value ) , sizeof ( mapname ) ) ;
strlwr ( mapname ) ;
mapname [ 5 ] = ' \0 ' ;
M_ClearMenus ( true ) ;
COM_BufAddText ( va ( " map %s -gametype \" %s \" \n " , mapname , cv_newgametype . string ) ) ;
}
static void M_ConfirmSpectate ( INT32 choice )
{
( void ) choice ;
2017-03-02 14:28:52 +00:00
// We allow switching to spectator even if team changing is not allowed
2014-03-15 16:59:03 +00:00
M_ClearMenus ( true ) ;
COM_ImmedExecute ( " changeteam spectator " ) ;
}
static void M_ConfirmEnterGame ( INT32 choice )
{
( void ) choice ;
2017-03-02 14:28:52 +00:00
if ( ! cv_allowteamchange . value )
{
M_StartMessage ( M_GetText ( " The server is not allowing \n team changes at this time. \n Press a key. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
2014-03-15 16:59:03 +00:00
M_ClearMenus ( true ) ;
COM_ImmedExecute ( " changeteam playing " ) ;
}
static void M_ConfirmTeamScramble ( INT32 choice )
{
( void ) choice ;
M_ClearMenus ( true ) ;
switch ( cv_dummyscramble . value )
{
case 0 :
COM_ImmedExecute ( " teamscramble 1 " ) ;
break ;
case 1 :
COM_ImmedExecute ( " teamscramble 2 " ) ;
break ;
}
}
static void M_ConfirmTeamChange ( INT32 choice )
{
( void ) choice ;
if ( ! cv_allowteamchange . value & & cv_dummyteam . value )
{
M_StartMessage ( M_GetText ( " The server is not allowing \n team changes at this time. \n Press a key. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
M_ClearMenus ( true ) ;
switch ( cv_dummyteam . value )
{
case 0 :
COM_ImmedExecute ( " changeteam spectator " ) ;
break ;
case 1 :
COM_ImmedExecute ( " changeteam red " ) ;
break ;
case 2 :
COM_ImmedExecute ( " changeteam blue " ) ;
break ;
}
}
static void M_Options ( INT32 choice )
{
( void ) choice ;
// if the player is not admin or server, disable server options
2019-01-07 07:31:45 +00:00
OP_MainMenu [ 5 ] . status = ( Playing ( ) & & ! ( server | | IsPlayerAdmin ( consoleplayer ) ) ) ? ( IT_GRAYEDOUT ) : ( IT_STRING | IT_CALL ) ;
2014-03-15 16:59:03 +00:00
2014-03-23 16:00:29 +00:00
// if the player is playing _at all_, disable the erase data options
2017-04-29 15:40:07 +00:00
OP_DataOptionsMenu [ 2 ] . status = ( Playing ( ) ) ? ( IT_GRAYEDOUT ) : ( IT_STRING | IT_SUBMENU ) ;
2014-03-15 16:59:03 +00:00
OP_MainDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & OP_MainDef ) ;
}
static void M_RetryResponse ( INT32 ch )
{
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
if ( ! & players [ consoleplayer ] | | netgame | | multiplayer ) // Should never happen!
return ;
M_ClearMenus ( true ) ;
G_SetRetryFlag ( ) ;
}
static void M_Retry ( INT32 choice )
{
( void ) choice ;
M_StartMessage ( M_GetText ( " Retry this act from the last starpost? \n \n (Press 'Y' to confirm) \n " ) , M_RetryResponse , MM_YESNO ) ;
}
static void M_SelectableClearMenus ( INT32 choice )
{
( void ) choice ;
M_ClearMenus ( true ) ;
}
// ======
// CHEATS
// ======
static void M_UltimateCheat ( INT32 choice )
{
( void ) choice ;
I_Quit ( ) ;
}
2017-09-15 19:34:46 +00:00
static void M_AllowSuper ( INT32 choice )
{
( void ) choice ;
players [ consoleplayer ] . charflags | = SF_SUPER ;
M_StartMessage ( M_GetText ( " You are now capable of turning super. \n Remember to get all the emeralds! \n " ) , NULL , MM_NOTHING ) ;
SR_PandorasBox [ 6 ] . status = IT_GRAYEDOUT ;
G_SetGameModified ( multiplayer ) ;
}
2014-03-15 16:59:03 +00:00
static void M_GetAllEmeralds ( INT32 choice )
{
( void ) choice ;
emeralds = ( ( EMERALD7 ) * 2 ) - 1 ;
M_StartMessage ( M_GetText ( " You now have all 7 emeralds. \n Use them wisely. \n With great power comes great ring drain. \n " ) , NULL , MM_NOTHING ) ;
2017-09-15 19:34:46 +00:00
SR_PandorasBox [ 7 ] . status = IT_GRAYEDOUT ;
2014-03-15 16:59:03 +00:00
G_SetGameModified ( multiplayer ) ;
}
static void M_DestroyRobotsResponse ( INT32 ch )
{
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
// Destroy all robots
P_DestroyRobots ( ) ;
G_SetGameModified ( multiplayer ) ;
}
static void M_DestroyRobots ( INT32 choice )
{
( void ) choice ;
M_StartMessage ( M_GetText ( " Do you want to destroy all \n robots in the current level? \n \n (Press 'Y' to confirm) \n " ) , M_DestroyRobotsResponse , MM_YESNO ) ;
}
static void M_LevelSelectWarp ( INT32 choice )
{
boolean fromloadgame = ( currentMenu = = & SP_LevelSelectDef ) ;
( void ) choice ;
if ( W_CheckNumForName ( G_BuildMapName ( cv_nextmap . value ) ) = = LUMPERROR )
{
2019-10-27 12:20:17 +00:00
CONS_Alert ( CONS_WARNING , " Internal game map '%s' not found \n " , G_BuildMapName ( cv_nextmap . value ) ) ;
2014-03-15 16:59:03 +00:00
return ;
}
startmap = ( INT16 ) ( cv_nextmap . value ) ;
fromlevelselect = true ;
if ( fromloadgame )
G_LoadGame ( ( UINT32 ) cursaveslot , startmap ) ;
else
{
2017-08-20 22:18:47 +00:00
cursaveslot = 0 ;
2014-03-15 16:59:03 +00:00
M_SetupChoosePlayer ( 0 ) ;
}
}
// ========
// SKY ROOM
// ========
UINT8 skyRoomMenuTranslations [ MAXUNLOCKABLES ] ;
2017-04-22 23:16:09 +00:00
static boolean checklist_cangodown ; // uuuueeerggghhhh HACK
2014-03-15 16:59:03 +00:00
2017-04-22 23:16:09 +00:00
static void M_HandleChecklist ( INT32 choice )
{
INT32 j ;
switch ( choice )
2014-03-15 16:59:03 +00:00
{
2017-04-22 23:16:09 +00:00
case KEY_DOWNARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
2017-07-04 12:17:29 +00:00
if ( ( check_on ! = MAXUNLOCKABLES ) & & checklist_cangodown )
2017-04-22 23:16:09 +00:00
{
for ( j = check_on + 1 ; j < MAXUNLOCKABLES ; j + + )
{
2017-07-04 12:17:29 +00:00
if ( ! unlockables [ j ] . name [ 0 ] )
continue ;
// if (unlockables[j].nochecklist)
// continue;
if ( ! unlockables [ j ] . conditionset )
continue ;
if ( unlockables [ j ] . conditionset > MAXCONDITIONSETS )
continue ;
if ( unlockables [ j ] . conditionset = = unlockables [ check_on ] . conditionset )
continue ;
break ;
2017-04-22 23:16:09 +00:00
}
if ( j ! = MAXUNLOCKABLES )
check_on = j ;
}
return ;
case KEY_UPARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
2017-07-04 12:17:29 +00:00
if ( check_on )
2017-04-22 23:16:09 +00:00
{
2017-07-04 12:17:29 +00:00
for ( j = check_on - 1 ; j > - 1 ; j - - )
{
if ( ! unlockables [ j ] . name [ 0 ] )
continue ;
// if (unlockables[j].nochecklist)
// continue;
if ( ! unlockables [ j ] . conditionset )
continue ;
if ( unlockables [ j ] . conditionset > MAXCONDITIONSETS )
continue ;
if ( j & & unlockables [ j ] . conditionset = = unlockables [ j - 1 ] . conditionset )
continue ;
2017-04-22 23:16:09 +00:00
break ;
2017-07-04 12:17:29 +00:00
}
if ( j ! = - 1 )
check_on = j ;
2017-04-22 23:16:09 +00:00
}
return ;
case KEY_ESCAPE :
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
return ;
default :
break ;
}
}
# define addy(add) { y += add; if ((y - currentMenu->y) > (scrollareaheight*2)) goto finishchecklist; }
2014-03-15 16:59:03 +00:00
static void M_DrawChecklist ( void )
{
2017-04-22 23:16:09 +00:00
INT32 i = check_on , j = 0 , y = currentMenu - > y ;
2017-04-22 11:14:15 +00:00
UINT32 condnum , previd , maxcond ;
condition_t * cond ;
2014-03-15 16:59:03 +00:00
2017-04-22 23:16:09 +00:00
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
if ( check_on )
2017-07-04 12:17:29 +00:00
V_DrawString ( 10 , y - ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1A " ) ;
2017-04-22 23:16:09 +00:00
2017-04-22 11:53:57 +00:00
while ( i < MAXUNLOCKABLES )
2014-03-15 16:59:03 +00:00
{
2017-04-22 11:14:15 +00:00
if ( unlockables [ i ] . name [ 0 ] = = 0 //|| unlockables[i].nochecklist
2014-03-15 16:59:03 +00:00
| | ! unlockables [ i ] . conditionset | | unlockables [ i ] . conditionset > MAXCONDITIONSETS )
continue ;
2017-04-22 11:53:57 +00:00
V_DrawString ( currentMenu - > x , y , ( ( unlockables [ i ] . unlocked ) ? V_GREENMAP : V_TRANSLUCENT ) , ( ( unlockables [ i ] . unlocked | | ! unlockables [ i ] . nochecklist ) ? unlockables [ i ] . name : M_CreateSecretMenuOption ( unlockables [ i ] . name ) ) ) ;
2017-04-22 11:14:15 +00:00
for ( j = i + 1 ; j < MAXUNLOCKABLES ; j + + )
{
if ( ! ( unlockables [ j ] . name [ 0 ] = = 0 //|| unlockables[j].nochecklist
| | ! unlockables [ j ] . conditionset | | unlockables [ j ] . conditionset > MAXCONDITIONSETS ) )
break ;
}
if ( ( j ! = MAXUNLOCKABLES ) & & ( unlockables [ i ] . conditionset = = unlockables [ j ] . conditionset ) )
2017-04-22 23:16:09 +00:00
addy ( 8 )
2017-04-22 11:14:15 +00:00
else
{
if ( ( maxcond = conditionSets [ unlockables [ i ] . conditionset - 1 ] . numconditions ) )
{
cond = conditionSets [ unlockables [ i ] . conditionset - 1 ] . condition ;
previd = cond [ 0 ] . id ;
2017-04-22 23:16:09 +00:00
addy ( 2 ) ;
if ( unlockables [ i ] . objective [ 0 ] ! = ' / ' )
2017-04-22 11:14:15 +00:00
{
2017-04-22 23:16:09 +00:00
addy ( 8 ) ;
V_DrawString ( currentMenu - > x , y ,
V_ALLOWLOWERCASE ,
va ( " \x1E %s " , unlockables [ i ] . objective ) ) ;
}
else
{
for ( condnum = 0 ; condnum < maxcond ; condnum + + )
2017-04-22 11:14:15 +00:00
{
2017-04-23 17:45:54 +00:00
const char * beat = " ! " ;
2017-04-22 23:16:09 +00:00
if ( cond [ condnum ] . id ! = previd )
{
addy ( 8 ) ;
V_DrawString ( currentMenu - > x + 4 , y , V_YELLOWMAP , " OR " ) ;
}
2017-04-22 11:14:15 +00:00
2017-04-22 23:16:09 +00:00
addy ( 8 ) ;
2017-04-22 11:14:15 +00:00
2017-04-22 23:16:09 +00:00
switch ( cond [ condnum ] . type )
{
2017-04-23 17:45:54 +00:00
case UC_PLAYTIME :
{
UINT32 hours = G_TicsToHours ( cond [ condnum ] . requirement ) ;
UINT32 minutes = G_TicsToMinutes ( cond [ condnum ] . requirement , false ) ;
UINT32 seconds = G_TicsToSeconds ( cond [ condnum ] . requirement ) ;
# define getplural(field) ((field == 1) ? "" : "s")
if ( hours )
{
if ( minutes )
beat = va ( " Play the game for %d hour%s %d minute%s " , hours , getplural ( hours ) , minutes , getplural ( minutes ) ) ;
else
beat = va ( " Play the game for %d hour%s " , hours , getplural ( hours ) ) ;
}
else
{
if ( minutes & & seconds )
beat = va ( " Play the game for %d minute%s %d second%s " , minutes , getplural ( minutes ) , seconds , getplural ( seconds ) ) ;
else if ( minutes )
beat = va ( " Play the game for %d minute%s " , minutes , getplural ( minutes ) ) ;
else
beat = va ( " Play the game for %d second%s " , seconds , getplural ( seconds ) ) ;
}
# undef getplural
}
break ;
2017-04-22 23:39:20 +00:00
case UC_MAPVISITED :
2017-04-22 23:16:09 +00:00
case UC_MAPBEATEN :
2017-04-22 23:39:20 +00:00
case UC_MAPALLEMERALDS :
case UC_MAPULTIMATE :
2017-04-22 23:16:09 +00:00
case UC_MAPPERFECT :
{
char * title = G_BuildMapTitle ( cond [ condnum ] . requirement ) ;
2017-04-22 23:39:20 +00:00
2017-04-22 23:16:09 +00:00
if ( title )
{
2017-09-15 19:34:46 +00:00
const char * level = ( ( M_MapLocked ( cond [ condnum ] . requirement ) | | ! ( ( mapheaderinfo [ cond [ condnum ] . requirement - 1 ] - > menuflags & LF2_NOVISITNEEDED ) | | ( mapvisited [ cond [ condnum ] . requirement - 1 ] & MV_MAX ) ) ) ? M_CreateSecretMenuOption ( title ) : title ) ;
2017-04-22 23:39:20 +00:00
switch ( cond [ condnum ] . type )
{
case UC_MAPVISITED :
2017-04-23 17:45:54 +00:00
beat = va ( " Visit %s " , level ) ;
2017-04-22 23:39:20 +00:00
break ;
case UC_MAPALLEMERALDS :
2017-04-23 17:45:54 +00:00
beat = va ( " Beat %s with all emeralds " , level ) ;
2017-04-22 23:39:20 +00:00
break ;
case UC_MAPULTIMATE :
2017-04-23 17:45:54 +00:00
beat = va ( " Beat %s in Ultimate mode " , level ) ;
2017-04-22 23:39:20 +00:00
break ;
case UC_MAPPERFECT :
2017-04-23 17:45:54 +00:00
beat = va ( " Get all rings in %s " , level ) ;
2017-04-22 23:39:20 +00:00
break ;
case UC_MAPBEATEN :
default :
2017-04-23 17:45:54 +00:00
beat = va ( " Beat %s " , level ) ;
break ;
}
Z_Free ( title ) ;
}
}
break ;
case UC_MAPSCORE :
case UC_MAPTIME :
case UC_MAPRINGS :
{
char * title = G_BuildMapTitle ( cond [ condnum ] . extrainfo1 ) ;
if ( title )
{
2017-09-15 19:34:46 +00:00
const char * level = ( ( M_MapLocked ( cond [ condnum ] . extrainfo1 ) | | ! ( ( mapheaderinfo [ cond [ condnum ] . extrainfo1 - 1 ] - > menuflags & LF2_NOVISITNEEDED ) | | ( mapvisited [ cond [ condnum ] . extrainfo1 - 1 ] & MV_MAX ) ) ) ? M_CreateSecretMenuOption ( title ) : title ) ;
2017-04-23 17:45:54 +00:00
switch ( cond [ condnum ] . type )
{
case UC_MAPSCORE :
beat = va ( " Get %d points in %s " , cond [ condnum ] . requirement , level ) ;
break ;
case UC_MAPTIME :
2018-03-21 18:18:45 +00:00
beat = va ( " Beat %s in %d:%02d.%02d " , level ,
2017-04-23 17:45:54 +00:00
G_TicsToMinutes ( cond [ condnum ] . requirement , true ) ,
G_TicsToSeconds ( cond [ condnum ] . requirement ) ,
G_TicsToCentiseconds ( cond [ condnum ] . requirement ) ) ;
break ;
case UC_MAPRINGS :
beat = va ( " Get %d rings in %s " , cond [ condnum ] . requirement , level ) ;
break ;
default :
2017-04-22 23:39:20 +00:00
break ;
}
2017-04-22 23:16:09 +00:00
Z_Free ( title ) ;
}
}
break ;
2017-04-23 17:45:54 +00:00
case UC_OVERALLSCORE :
case UC_OVERALLTIME :
case UC_OVERALLRINGS :
{
switch ( cond [ condnum ] . type )
{
case UC_OVERALLSCORE :
beat = va ( " Get %d points over all maps " , cond [ condnum ] . requirement ) ;
break ;
case UC_OVERALLTIME :
2018-03-21 18:18:45 +00:00
beat = va ( " Get a total time of less than %d:%02d.%02d " ,
2017-04-23 17:45:54 +00:00
G_TicsToMinutes ( cond [ condnum ] . requirement , true ) ,
G_TicsToSeconds ( cond [ condnum ] . requirement ) ,
G_TicsToCentiseconds ( cond [ condnum ] . requirement ) ) ;
break ;
case UC_OVERALLRINGS :
beat = va ( " Get %d rings over all maps " , cond [ condnum ] . requirement ) ;
break ;
default :
break ;
}
}
break ;
2017-04-22 23:16:09 +00:00
case UC_GAMECLEAR :
case UC_ALLEMERALDS :
2017-04-22 11:14:15 +00:00
{
2017-04-22 23:16:09 +00:00
const char * emeraldtext = ( ( cond [ condnum ] . type = = UC_ALLEMERALDS ) ? " with all emeralds " : " " ) ;
if ( cond [ condnum ] . requirement ! = 1 )
2017-04-23 17:45:54 +00:00
beat = va ( " Beat the game %d times%s " ,
2017-04-22 23:39:20 +00:00
cond [ condnum ] . requirement , emeraldtext ) ;
2017-04-22 23:16:09 +00:00
else
2017-04-23 17:45:54 +00:00
beat = va ( " Beat the game%s " ,
2017-04-22 23:39:20 +00:00
emeraldtext ) ;
2017-04-22 11:14:15 +00:00
}
2017-04-22 23:16:09 +00:00
break ;
case UC_TOTALEMBLEMS :
2017-04-23 17:45:54 +00:00
beat = va ( " Collect %s%d emblems " , ( ( numemblems + numextraemblems = = cond [ condnum ] . requirement ) ? " all " : " " ) , cond [ condnum ] . requirement ) ;
2017-04-22 23:16:09 +00:00
break ;
2017-04-23 17:45:54 +00:00
case UC_NIGHTSTIME :
case UC_NIGHTSSCORE :
2017-04-22 23:16:09 +00:00
case UC_NIGHTSGRADE :
{
char * title = G_BuildMapTitle ( cond [ condnum ] . extrainfo1 ) ;
if ( title )
{
2017-09-15 19:34:46 +00:00
const char * level = ( ( M_MapLocked ( cond [ condnum ] . extrainfo1 ) | | ! ( ( mapheaderinfo [ cond [ condnum ] . extrainfo1 - 1 ] - > menuflags & LF2_NOVISITNEEDED ) | | ( mapvisited [ cond [ condnum ] . extrainfo1 - 1 ] & MV_MAX ) ) ) ? M_CreateSecretMenuOption ( title ) : title ) ;
2017-04-23 17:45:54 +00:00
switch ( cond [ condnum ] . type )
{
case UC_NIGHTSSCORE :
if ( cond [ condnum ] . extrainfo2 )
beat = va ( " Get %d points in %s, mare %d " , cond [ condnum ] . requirement , level , cond [ condnum ] . extrainfo2 ) ;
else
beat = va ( " Get %d points in %s " , cond [ condnum ] . requirement , level ) ;
break ;
case UC_NIGHTSTIME :
if ( cond [ condnum ] . extrainfo2 )
2018-03-21 18:18:45 +00:00
beat = va ( " Beat %s, mare %d in %d:%02d.%02d " , level , cond [ condnum ] . extrainfo2 ,
2017-04-23 17:45:54 +00:00
G_TicsToMinutes ( cond [ condnum ] . requirement , true ) ,
G_TicsToSeconds ( cond [ condnum ] . requirement ) ,
G_TicsToCentiseconds ( cond [ condnum ] . requirement ) ) ;
else
2018-03-21 18:18:45 +00:00
beat = va ( " Beat %s in %d:%02d.%02d " ,
2017-04-23 17:45:54 +00:00
level ,
G_TicsToMinutes ( cond [ condnum ] . requirement , true ) ,
G_TicsToSeconds ( cond [ condnum ] . requirement ) ,
G_TicsToCentiseconds ( cond [ condnum ] . requirement ) ) ;
break ;
case UC_NIGHTSGRADE :
{
char grade = ( ' F ' - ( char ) cond [ condnum ] . requirement ) ;
if ( grade < ' A ' )
grade = ' A ' ;
if ( cond [ condnum ] . extrainfo2 )
beat = va ( " Get grade %c in %s, mare %d " , grade , level , cond [ condnum ] . extrainfo2 ) ;
else
beat = va ( " Get grade %c in %s " , grade , level ) ;
}
break ;
default :
break ;
}
2017-04-22 23:16:09 +00:00
Z_Free ( title ) ;
}
}
break ;
2017-04-23 17:45:54 +00:00
case UC_TRIGGER :
case UC_EMBLEM :
case UC_CONDITIONSET :
2017-04-22 23:16:09 +00:00
default :
2017-04-23 17:45:54 +00:00
y - = 8 ; // Nope, not showing this.
2017-04-22 23:16:09 +00:00
break ;
}
2017-04-23 17:45:54 +00:00
if ( beat [ 0 ] ! = ' ! ' )
{
V_DrawString ( currentMenu - > x , y , 0 , " \x1E " ) ;
V_DrawString ( currentMenu - > x + 12 , y , V_ALLOWLOWERCASE , beat ) ;
}
2017-04-22 23:16:09 +00:00
previd = cond [ condnum ] . id ;
2017-04-22 11:14:15 +00:00
}
}
}
2017-04-22 23:16:09 +00:00
addy ( 12 ) ;
2017-04-22 11:14:15 +00:00
}
i = j ;
/*V_DrawString(160, 8+(24*j), V_RETURN8, V_WordWrap(160, 292, 0, unlockables[i].objective));
2014-03-15 16:59:03 +00:00
if ( unlockables [ i ] . unlocked )
V_DrawString ( 308 , 8 + ( 24 * j ) , V_YELLOWMAP , " Y " ) ;
else
2017-04-22 11:14:15 +00:00
V_DrawString ( 308 , 8 + ( 24 * j ) , V_YELLOWMAP , " N " ) ; */
2014-03-15 16:59:03 +00:00
}
2017-04-22 23:16:09 +00:00
finishchecklist :
if ( ( checklist_cangodown = ( ( y - currentMenu - > y ) > ( scrollareaheight * 2 ) ) ) ) // haaaaaaacks.
2017-07-04 12:17:29 +00:00
V_DrawString ( 10 , currentMenu - > y + ( scrollareaheight * 2 ) + ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1B " ) ;
2014-03-15 16:59:03 +00:00
}
# define NUMHINTS 5
static void M_EmblemHints ( INT32 choice )
{
( void ) choice ;
SR_EmblemHintMenu [ 0 ] . status = ( M_SecretUnlocked ( SECRET_ITEMFINDER ) ) ? ( IT_CVAR | IT_STRING ) : ( IT_SECRET ) ;
M_SetupNextMenu ( & SR_EmblemHintDef ) ;
itemOn = 1 ; // always start on back.
}
static void M_DrawEmblemHints ( void )
{
INT32 i , j = 0 ;
UINT32 collected = 0 ;
emblem_t * emblem ;
const char * hint ;
for ( i = 0 ; i < numemblems ; i + + )
{
emblem = & emblemlocations [ i ] ;
if ( emblem - > level ! = gamemap | | emblem - > type > ET_SKIN )
continue ;
if ( emblem - > collected )
{
collected = V_GREENMAP ;
2019-10-16 02:54:21 +00:00
V_DrawMappedPatch ( 12 , 12 + ( 28 * j ) , 0 , W_CachePatchName ( M_GetEmblemPatch ( emblem , false ) , PU_CACHE ) ,
2014-03-15 16:59:03 +00:00
R_GetTranslationColormap ( TC_DEFAULT , M_GetEmblemColor ( emblem ) , GTC_CACHE ) ) ;
}
else
{
collected = 0 ;
V_DrawScaledPatch ( 12 , 12 + ( 28 * j ) , 0 , W_CachePatchName ( " NEEDIT " , PU_CACHE ) ) ;
}
if ( emblem - > hint [ 0 ] )
hint = emblem - > hint ;
else
hint = M_GetText ( " No hints available. " ) ;
hint = V_WordWrap ( 40 , BASEVIDWIDTH - 12 , 0 , hint ) ;
V_DrawString ( 40 , 8 + ( 28 * j ) , V_RETURN8 | V_ALLOWLOWERCASE | collected , hint ) ;
if ( + + j > = NUMHINTS )
break ;
}
if ( ! j )
V_DrawCenteredString ( 160 , 48 , V_YELLOWMAP , " No hidden emblems on this map. " ) ;
M_DrawGenericMenu ( ) ;
}
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
/*static void M_DrawSkyRoom(void)
2014-03-15 16:59:03 +00:00
{
INT32 i , y = 0 ;
M_DrawGenericMenu ( ) ;
for ( i = 0 ; i < currentMenu - > numitems ; + + i )
{
if ( currentMenu - > menuitems [ i ] . status = = ( IT_STRING | IT_KEYHANDLER ) )
{
y = currentMenu - > menuitems [ i ] . alphaKey ;
break ;
}
}
if ( ! y )
return ;
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + y , V_YELLOWMAP , cv_soundtest . string ) ;
2017-07-04 13:58:58 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - currentMenu - > x - 10 - V_StringWidth ( cv_soundtest . string , 0 ) - ( skullAnimCounter / 5 ) , currentMenu - > y + y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - currentMenu - > x + 2 + ( skullAnimCounter / 5 ) , currentMenu - > y + y ,
' \x1D ' | V_YELLOWMAP , false ) ;
2017-07-23 16:49:19 +00:00
}
2014-03-15 16:59:03 +00:00
if ( cv_soundtest . value )
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + y + 8 , V_YELLOWMAP , S_sfx [ cv_soundtest . value ] . name ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
} */
static musicdef_t * curplaying = NULL ;
static INT32 st_sel = 0 , st_cc = 0 ;
static tic_t st_time = 0 ;
static patch_t * st_radio [ 9 ] ;
static patch_t * st_launchpad [ 4 ] ;
static void M_SoundTest ( INT32 choice )
{
INT32 ul = skyRoomMenuTranslations [ choice - 1 ] ;
UINT8 i ;
char buf [ 8 ] ;
soundtestpage = ( UINT8 ) ( unlockables [ ul ] . variable ) ;
if ( ! soundtestpage )
soundtestpage = 1 ;
if ( ! S_PrepareSoundTest ( ) )
{
M_StartMessage ( M_GetText ( " No selectable tracks found. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
STRBUFCPY ( buf , " M_RADIOn " ) ;
for ( i = 0 ; i < 9 ; i + + )
{
if ( st_radio [ i ] )
W_UnlockCachedPatch ( st_radio [ i ] ) ;
buf [ 7 ] = ( char ) ( ' 0 ' + i ) ;
st_radio [ i ] = W_CachePatchName ( buf , PU_STATIC ) ;
}
STRBUFCPY ( buf , " M_LPADn " ) ;
for ( i = 0 ; i < 4 ; i + + )
{
if ( st_launchpad [ i ] )
W_UnlockCachedPatch ( st_launchpad [ i ] ) ;
buf [ 6 ] = ( char ) ( ' 0 ' + i ) ;
st_launchpad [ i ] = W_CachePatchName ( buf , PU_STATIC ) ;
}
curplaying = NULL ;
st_time = 0 ;
st_sel = 0 ;
st_cc = cv_closedcaptioning . value ; // hack;
cv_closedcaptioning . value = 1 ; // hack
M_SetupNextMenu ( & SR_SoundTestDef ) ;
}
static void M_DrawSoundTest ( void )
{
INT32 x , y , i ;
fixed_t hscale = FRACUNIT / 2 , vscale = FRACUNIT / 2 , bounce = 0 ;
UINT8 frame [ 4 ] = { 0 , 0 , - 1 , SKINCOLOR_RUBY } ;
// let's handle the ticker first. ideally we'd tick this somewhere else, BUT...
if ( curplaying )
{
if ( curplaying = = & soundtestsfx )
{
if ( cv_soundtest . value )
{
frame [ 1 ] = ( 2 - st_time ) ;
frame [ 2 ] = ( ( cv_soundtest . value - 1 ) % 9 ) ;
frame [ 3 ] + = ( ( ( cv_soundtest . value - 1 ) / 9 ) % ( MAXSKINCOLORS - frame [ 3 ] ) ) ;
if ( st_time < 2 )
st_time + + ;
}
}
else
{
if ( curplaying - > stoppingtics & & st_time > = curplaying - > stoppingtics )
{
curplaying = NULL ;
st_time = 0 ;
}
else
{
fixed_t work , bpm = curplaying - > bpm ;
angle_t ang ;
//bpm = FixedDiv((60*TICRATE)<<FRACBITS, bpm); -- bake this in on load
work = st_time < < FRACBITS ;
work % = bpm ;
if ( st_time > = ( FRACUNIT > > 1 ) ) // prevent overflow jump - takes about 15 minutes of loop on the same song to reach
st_time = ( work > > FRACBITS ) ;
work = FixedDiv ( work * 180 , bpm ) ;
frame [ 0 ] = 8 - ( work / ( 20 < < FRACBITS ) ) ;
2019-11-13 13:43:42 +00:00
if ( frame [ 0 ] > 8 ) // VERY small likelihood for the above calculation to wrap, but it turns out it IS possible lmao
frame [ 0 ] = 0 ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
ang = ( FixedAngle ( work ) > > ANGLETOFINESHIFT ) & FINEMASK ;
bounce = ( FINESINE ( ang ) - FRACUNIT / 2 ) ;
hscale - = bounce / 16 ;
vscale + = bounce / 16 ;
st_time + + ;
}
}
}
x = 90 < < FRACBITS ;
y = ( BASEVIDHEIGHT - 32 ) < < FRACBITS ;
V_DrawStretchyFixedPatch ( x , y ,
hscale , vscale ,
0 , st_radio [ frame [ 0 ] ] , NULL ) ;
V_DrawFixedPatch ( x , y , FRACUNIT / 2 , 0 , st_launchpad [ 0 ] , NULL ) ;
for ( i = 0 ; i < 9 ; i + + )
{
if ( i = = frame [ 2 ] )
{
UINT8 * colmap = R_GetTranslationColormap ( TC_RAINBOW , frame [ 3 ] , GTC_CACHE ) ;
V_DrawFixedPatch ( x , y + ( frame [ 1 ] < < FRACBITS ) , FRACUNIT / 2 , 0 , st_launchpad [ frame [ 1 ] + 1 ] , colmap ) ;
}
else
V_DrawFixedPatch ( x , y , FRACUNIT / 2 , 0 , st_launchpad [ 1 ] , NULL ) ;
if ( ( i % 3 ) = = 2 )
{
x - = ( ( 2 * 28 ) + 25 ) < < ( FRACBITS - 1 ) ;
y - = ( ( 2 * 7 ) - 11 ) < < ( FRACBITS - 1 ) ;
}
else
{
x + = 28 < < ( FRACBITS - 1 ) ;
y + = 7 < < ( FRACBITS - 1 ) ;
}
}
y = ( BASEVIDWIDTH - ( vid . width / vid . dupx ) ) / 2 ;
V_DrawFill ( y , 20 , vid . width / vid . dupx , 24 , 159 ) ;
{
static fixed_t st_scroll = - 1 ;
const char * titl ;
x = 16 ;
V_DrawString ( x , 10 , 0 , " NOW PLAYING: " ) ;
if ( curplaying )
{
if ( curplaying - > alttitle [ 0 ] )
titl = va ( " %s - %s - " , curplaying - > title , curplaying - > alttitle ) ;
else
titl = va ( " %s - " , curplaying - > title ) ;
}
else
2019-11-17 14:56:05 +00:00
titl = " None - " ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
i = V_LevelNameWidth ( titl ) ;
if ( + + st_scroll > = i )
st_scroll % = i ;
x - = st_scroll ;
while ( x < BASEVIDWIDTH - y )
x + = i ;
while ( x > y )
{
x - = i ;
2019-11-17 14:56:05 +00:00
V_DrawLevelTitle ( x , 22 , 0 , titl ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
}
if ( curplaying )
2019-11-13 13:43:42 +00:00
V_DrawRightAlignedThinString ( BASEVIDWIDTH - 16 , 46 , V_ALLOWLOWERCASE , curplaying - > authors ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
}
V_DrawFill ( 165 , 60 , 140 , 112 , 159 ) ;
{
INT32 t , b , q , m = 112 ;
if ( numsoundtestdefs < = 7 )
{
t = 0 ;
b = numsoundtestdefs - 1 ;
i = 0 ;
}
else
{
q = m ;
m = ( 5 * m ) / numsoundtestdefs ;
if ( st_sel < 3 )
{
t = 0 ;
b = 6 ;
i = 0 ;
}
else if ( st_sel > = numsoundtestdefs - 4 )
{
t = numsoundtestdefs - 7 ;
b = numsoundtestdefs - 1 ;
i = q - m ;
}
else
{
t = st_sel - 3 ;
b = st_sel + 3 ;
i = ( t * ( q - m ) ) / ( numsoundtestdefs - 7 ) ;
}
}
V_DrawFill ( 165 + 140 - 1 , 60 + i , 1 , m , 0 ) ;
if ( t ! = 0 )
V_DrawString ( 165 + 140 + 4 , 60 + 4 - ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1A " ) ;
if ( b ! = numsoundtestdefs - 1 )
V_DrawString ( 165 + 140 + 4 , 60 + 112 - 12 + ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1B " ) ;
x = 169 ;
y = 64 ;
while ( t < = b )
{
if ( t = = st_sel )
V_DrawFill ( 165 , y - 4 , 140 - 1 , 16 , 155 ) ;
if ( ! soundtestdefs [ t ] - > allowed )
{
V_DrawString ( x , y , ( t = = st_sel ? V_YELLOWMAP : 0 ) | V_ALLOWLOWERCASE , " ??? " ) ;
}
else if ( soundtestdefs [ t ] = = & soundtestsfx )
{
const char * sfxstr = va ( " SFX %s " , cv_soundtest . string ) ;
V_DrawString ( x , y , ( t = = st_sel ? V_YELLOWMAP : 0 ) , sfxstr ) ;
if ( t = = st_sel )
{
V_DrawCharacter ( x - 10 - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( x + 2 + V_StringWidth ( sfxstr , 0 ) + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
if ( curplaying = = soundtestdefs [ t ] )
{
sfxstr = ( cv_soundtest . value ) ? S_sfx [ cv_soundtest . value ] . name : " N/A " ;
i = V_StringWidth ( sfxstr , 0 ) ;
V_DrawFill ( 165 + 140 - 9 - i , y - 4 , i + 8 , 16 , 150 ) ;
V_DrawRightAlignedString ( 165 + 140 - 5 , y , V_YELLOWMAP , sfxstr ) ;
}
}
else
{
V_DrawString ( x , y , ( t = = st_sel ? V_YELLOWMAP : 0 ) | V_ALLOWLOWERCASE , soundtestdefs [ t ] - > title ) ;
if ( curplaying = = soundtestdefs [ t ] )
{
V_DrawFill ( 165 + 140 - 9 , y - 4 , 8 , 16 , 150 ) ;
//V_DrawCharacter(165+140-8, y, '\x19' | V_YELLOWMAP, false);
V_DrawFixedPatch ( ( 165 + 140 - 9 ) < < FRACBITS , ( y < < FRACBITS ) - ( bounce * 4 ) , FRACUNIT , 0 , hu_font [ ' \x19 ' - HU_FONTSTART ] , V_GetStringColormap ( V_YELLOWMAP ) ) ;
}
}
t + + ;
y + = 16 ;
}
}
2014-03-15 16:59:03 +00:00
}
static void M_HandleSoundTest ( INT32 choice )
{
boolean exitmenu = false ; // exit to previous menu
switch ( choice )
{
case KEY_DOWNARROW :
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
if ( st_sel + + > = numsoundtestdefs - 1 )
st_sel = 0 ;
{
cv_closedcaptioning . value = st_cc ; // hack
S_StartSound ( NULL , sfx_menu1 ) ;
cv_closedcaptioning . value = 1 ; // hack
}
2014-03-15 16:59:03 +00:00
break ;
case KEY_UPARROW :
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
if ( ! st_sel - - )
st_sel = numsoundtestdefs - 1 ;
{
cv_closedcaptioning . value = st_cc ; // hack
S_StartSound ( NULL , sfx_menu1 ) ;
cv_closedcaptioning . value = 1 ; // hack
}
break ;
case KEY_PGDN :
if ( st_sel < numsoundtestdefs - 1 )
{
st_sel + = 3 ;
if ( st_sel > = numsoundtestdefs - 1 )
st_sel = numsoundtestdefs - 1 ;
cv_closedcaptioning . value = st_cc ; // hack
S_StartSound ( NULL , sfx_menu1 ) ;
cv_closedcaptioning . value = 1 ; // hack
}
break ;
case KEY_PGUP :
if ( st_sel )
{
st_sel - = 3 ;
if ( st_sel < 0 )
st_sel = 0 ;
cv_closedcaptioning . value = st_cc ; // hack
S_StartSound ( NULL , sfx_menu1 ) ;
cv_closedcaptioning . value = 1 ; // hack
}
2014-03-15 16:59:03 +00:00
break ;
case KEY_BACKSPACE :
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
if ( curplaying )
{
S_StopSounds ( ) ;
S_StopMusic ( ) ;
curplaying = NULL ;
st_time = 0 ;
cv_closedcaptioning . value = st_cc ; // hack
S_StartSound ( NULL , sfx_skid ) ;
cv_closedcaptioning . value = 1 ; // hack
}
break ;
2014-03-15 16:59:03 +00:00
case KEY_ESCAPE :
exitmenu = true ;
break ;
case KEY_RIGHTARROW :
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
if ( soundtestdefs [ st_sel ] = = & soundtestsfx & & soundtestdefs [ st_sel ] - > allowed )
{
S_StopSounds ( ) ;
S_StopMusic ( ) ;
curplaying = soundtestdefs [ st_sel ] ;
st_time = 0 ;
CV_AddValue ( & cv_soundtest , 1 ) ;
}
2014-03-15 16:59:03 +00:00
break ;
case KEY_LEFTARROW :
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
if ( soundtestdefs [ st_sel ] = = & soundtestsfx & & soundtestdefs [ st_sel ] - > allowed )
{
S_StopSounds ( ) ;
S_StopMusic ( ) ;
curplaying = soundtestdefs [ st_sel ] ;
st_time = 0 ;
CV_AddValue ( & cv_soundtest , - 1 ) ;
}
2014-03-15 16:59:03 +00:00
break ;
case KEY_ENTER :
S_StopSounds ( ) ;
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
S_StopMusic ( ) ;
st_time = 0 ;
if ( soundtestdefs [ st_sel ] - > allowed )
{
curplaying = soundtestdefs [ st_sel ] ;
if ( curplaying = = & soundtestsfx )
{
// S_StopMusic() -- is this necessary?
if ( cv_soundtest . value )
S_StartSound ( NULL , cv_soundtest . value ) ;
}
else
S_ChangeMusicInternal ( curplaying - > name , ! curplaying - > stoppingtics ) ;
}
else
{
curplaying = NULL ;
S_StartSound ( NULL , sfx_lose ) ;
}
2014-03-15 16:59:03 +00:00
break ;
default :
break ;
}
if ( exitmenu )
{
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
Z_Free ( soundtestdefs ) ;
soundtestdefs = NULL ;
cv_closedcaptioning . value = st_cc ; // undo hack
2014-03-15 16:59:03 +00:00
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
// Entering secrets menu
static void M_SecretsMenu ( INT32 choice )
{
INT32 i , j , ul ;
UINT8 done [ MAXUNLOCKABLES ] ;
UINT16 curheight ;
( void ) choice ;
// Clear all before starting
for ( i = 1 ; i < MAXUNLOCKABLES + 1 ; + + i )
SR_MainMenu [ i ] . status = IT_DISABLED ;
memset ( skyRoomMenuTranslations , 0 , sizeof ( skyRoomMenuTranslations ) ) ;
memset ( done , 0 , sizeof ( done ) ) ;
for ( i = 1 ; i < MAXUNLOCKABLES + 1 ; + + i )
{
curheight = UINT16_MAX ;
ul = - 1 ;
// Autosort unlockables
for ( j = 0 ; j < MAXUNLOCKABLES ; + + j )
{
if ( ! unlockables [ j ] . height | | done [ j ] | | unlockables [ j ] . type < 0 )
continue ;
if ( unlockables [ j ] . height < curheight )
{
curheight = unlockables [ j ] . height ;
ul = j ;
}
}
if ( ul < 0 )
break ;
done [ ul ] = true ;
skyRoomMenuTranslations [ i - 1 ] = ( UINT8 ) ul ;
SR_MainMenu [ i ] . text = unlockables [ ul ] . name ;
SR_MainMenu [ i ] . alphaKey = ( UINT8 ) unlockables [ ul ] . height ;
if ( unlockables [ ul ] . type = = SECRET_HEADER )
{
SR_MainMenu [ i ] . status = IT_HEADER ;
continue ;
}
SR_MainMenu [ i ] . status = IT_SECRET ;
if ( unlockables [ ul ] . unlocked )
{
switch ( unlockables [ ul ] . type )
{
case SECRET_LEVELSELECT :
SR_MainMenu [ i ] . status = IT_STRING | IT_CALL ;
SR_MainMenu [ i ] . itemaction = M_CustomLevelSelect ;
break ;
case SECRET_WARP :
SR_MainMenu [ i ] . status = IT_STRING | IT_CALL ;
SR_MainMenu [ i ] . itemaction = M_CustomWarp ;
break ;
case SECRET_CREDITS :
SR_MainMenu [ i ] . status = IT_STRING | IT_CALL ;
SR_MainMenu [ i ] . itemaction = M_Credits ;
break ;
case SECRET_SOUNDTEST :
Sound test is cool now!
https://cdn.discordapp.com/attachments/405336003239477249/641295998395613224/srb20042.gif
* Port MUSICDEFs from Kart.
* Safe to modify without modifying game, so we can put it in music.dta eventually.
* "Title", "AltTitle", "Authors" fields are self-evident.
* "Soundtestpage" and "Soundtestcond" are used to determine which sound test unlockable can play them (set with Unlockable's variable, just like Level Select).
* "Stoppingtime" and "BPM" both accept floats, and are used for presentation stuff on the sound test.
* Ironically, we don't share a single field name with them. Such is the case of differing foci, though, and I expect they'll change their implementation to match (since this is necessary for a sound test).
* Change how S_AddSoundFx works to avoid iterating through all of them, and to allow cv_soundtest to only scroll through defined slots (instead of the infinite wall of thok sounds when scrolling to the left).
* Change V_DrawFixedPatch to allow scaling on two seperate axes.
* Now called "V_DrawStretchyFixedPatch".
* "V_DrawFixedPatch" is a macro to V_DrawStretchyFixedPatch now (same scale on both axes).
* Available to Lua under v.drawStretched!
* Even works in GL!
* Bugfix: Add SR_PLAYER to SOC's menutypes_list.
Stay tuned for the merge request, where I put the onus on the Music Team to finish this off...
2019-11-05 16:23:46 +00:00
SR_MainMenu [ i ] . status = IT_STRING | IT_CALL ;
SR_MainMenu [ i ] . itemaction = M_SoundTest ;
2014-03-15 16:59:03 +00:00
default :
break ;
}
}
}
M_SetupNextMenu ( & SR_MainDef ) ;
}
// ==================
// NEW GAME FUNCTIONS
// ==================
INT32 ultimate_selectable = false ;
static void M_NewGame ( void )
{
fromlevelselect = false ;
startmap = spstage_start ;
CV_SetValue ( & cv_newgametype , GT_COOP ) ; // Graue 09-08-2004
M_SetupChoosePlayer ( 0 ) ;
}
static void M_CustomWarp ( INT32 choice )
{
INT32 ul = skyRoomMenuTranslations [ choice - 1 ] ;
startmap = ( INT16 ) ( unlockables [ ul ] . variable ) ;
M_SetupChoosePlayer ( 0 ) ;
}
static void M_Credits ( INT32 choice )
{
( void ) choice ;
2017-08-20 22:18:47 +00:00
cursaveslot = - 1 ;
2014-03-15 16:59:03 +00:00
M_ClearMenus ( true ) ;
F_StartCredits ( ) ;
}
static void M_CustomLevelSelect ( INT32 choice )
{
INT32 ul = skyRoomMenuTranslations [ choice - 1 ] ;
SR_LevelSelectDef . prevMenu = currentMenu ;
levellistmode = LLM_LEVELSELECT ;
maplistoption = ( UINT8 ) ( unlockables [ ul ] . variable ) ;
2017-01-27 23:16:35 +00:00
2017-09-15 19:34:46 +00:00
if ( ! M_PrepareLevelPlatter ( - 1 , true ) )
2014-03-15 16:59:03 +00:00
{
M_StartMessage ( M_GetText ( " No selectable levels found. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
M_SetupNextMenu ( & SR_LevelSelectDef ) ;
}
// ==================
// SINGLE PLAYER MENU
// ==================
static void M_SinglePlayerMenu ( INT32 choice )
{
( void ) choice ;
2018-11-10 06:17:11 +00:00
SP_MainMenu [ sptutorial ] . status =
tutorialmap ? IT_CALL | IT_STRING : IT_NOTHING | IT_DISABLED ;
2014-03-15 16:59:03 +00:00
SP_MainMenu [ sprecordattack ] . status =
2016-08-20 05:18:43 +00:00
( M_SecretUnlocked ( SECRET_RECORDATTACK ) ) ? IT_CALL | IT_STRING : IT_SECRET ;
2014-03-15 16:59:03 +00:00
SP_MainMenu [ spnightsmode ] . status =
2016-08-20 05:18:43 +00:00
( M_SecretUnlocked ( SECRET_NIGHTSMODE ) ) ? IT_CALL | IT_STRING : IT_SECRET ;
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & SP_MainDef ) ;
}
static void M_LoadGameLevelSelect ( INT32 choice )
{
( void ) choice ;
2017-01-27 23:16:35 +00:00
SP_LevelSelectDef . prevMenu = currentMenu ;
2014-03-15 16:59:03 +00:00
levellistmode = LLM_LEVELSELECT ;
2019-06-03 21:32:45 +00:00
maplistoption = 1 + 2 ;
2017-01-27 23:16:35 +00:00
2017-09-15 19:34:46 +00:00
if ( ! M_PrepareLevelPlatter ( - 1 , true ) )
2014-03-15 16:59:03 +00:00
{
M_StartMessage ( M_GetText ( " No selectable levels found. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
M_SetupNextMenu ( & SP_LevelSelectDef ) ;
}
2018-11-11 14:21:10 +00:00
void M_TutorialSaveControlResponse ( INT32 ch )
{
if ( ch = = ' y ' | | ch = = KEY_ENTER )
{
2018-11-13 04:25:49 +00:00
G_CopyControls ( gamecontrol , gamecontroldefault [ tutorialgcs ] , gcl_tutorial_full , num_gcl_tutorial_full ) ;
2018-11-12 22:37:54 +00:00
CV_Set ( & cv_usemouse , cv_usemouse . defaultvalue ) ;
CV_Set ( & cv_alwaysfreelook , cv_alwaysfreelook . defaultvalue ) ;
CV_Set ( & cv_mousemove , cv_mousemove . defaultvalue ) ;
CV_Set ( & cv_analog , cv_analog . defaultvalue ) ;
2018-11-11 14:21:10 +00:00
S_StartSound ( NULL , sfx_itemup ) ;
}
else
S_StartSound ( NULL , sfx_menu1 ) ;
}
static void M_TutorialControlResponse ( INT32 ch )
{
2018-11-12 04:42:02 +00:00
if ( ch ! = KEY_ESCAPE )
2018-11-11 14:21:10 +00:00
{
2018-11-12 21:56:06 +00:00
G_CopyControls ( gamecontroldefault [ gcs_custom ] , gamecontrol , NULL , 0 ) ; // using gcs_custom as temp storage for old controls
2018-11-12 04:42:02 +00:00
if ( ch = = ' y ' | | ch = = KEY_ENTER )
{
2018-11-12 21:56:06 +00:00
tutorialgcs = gcs_fps ;
2018-11-12 22:24:46 +00:00
tutorialusemouse = cv_usemouse . value ;
tutorialfreelook = cv_alwaysfreelook . value ;
tutorialmousemove = cv_mousemove . value ;
2018-11-12 22:34:56 +00:00
tutorialanalog = cv_analog . value ;
2018-11-12 22:24:46 +00:00
2018-11-13 04:25:49 +00:00
G_CopyControls ( gamecontrol , gamecontroldefault [ tutorialgcs ] , gcl_tutorial_full , num_gcl_tutorial_full ) ;
2018-11-12 22:37:54 +00:00
CV_Set ( & cv_usemouse , cv_usemouse . defaultvalue ) ;
CV_Set ( & cv_alwaysfreelook , cv_alwaysfreelook . defaultvalue ) ;
CV_Set ( & cv_mousemove , cv_mousemove . defaultvalue ) ;
CV_Set ( & cv_analog , cv_analog . defaultvalue ) ;
2018-11-12 22:24:46 +00:00
2018-11-12 04:42:02 +00:00
//S_StartSound(NULL, sfx_itemup);
}
else
2018-11-12 21:56:06 +00:00
{
tutorialgcs = gcs_custom ;
2018-11-12 04:42:02 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2018-11-12 21:56:06 +00:00
}
2018-11-12 04:42:02 +00:00
M_StartTutorial ( INT32_MAX ) ;
2018-11-11 14:21:10 +00:00
}
else
S_StartSound ( NULL , sfx_menu1 ) ;
2018-11-13 00:10:41 +00:00
MessageDef . prevMenu = & SP_MainDef ; // if FirstPrompt -> ControlsPrompt -> ESC, we would go to the main menu unless we force this
2018-11-11 14:21:10 +00:00
}
2018-08-11 20:17:52 +00:00
// Starts up the tutorial immediately (tbh I wasn't sure where else to put this)
static void M_StartTutorial ( INT32 choice )
{
if ( ! tutorialmap )
return ; // no map to go to, don't bother
2018-11-13 06:57:51 +00:00
if ( choice ! = INT32_MAX & & G_GetControlScheme ( gamecontrol , gcl_tutorial_check , num_gcl_tutorial_check ) ! = gcs_fps )
2018-11-11 14:21:10 +00:00
{
2018-11-12 21:56:06 +00:00
M_StartMessage ( " Do you want to try the \202 recommended \202 movement controls \x80 ? \n \n We will set them just for this tutorial. \n \n Press 'Y' or 'Enter' to confirm \n Press 'N' or any key to keep \n your current controls. \n " , M_TutorialControlResponse , MM_YESNO ) ;
2018-11-11 14:21:10 +00:00
return ;
}
else if ( choice ! = INT32_MAX )
2018-11-12 21:56:06 +00:00
tutorialgcs = gcs_custom ;
2018-11-11 14:21:10 +00:00
2018-11-13 00:10:41 +00:00
CV_SetValue ( & cv_tutorialprompt , 0 ) ; // first-time prompt
2018-11-10 07:30:21 +00:00
2018-09-04 15:58:49 +00:00
tutorialmode = true ; // turn on tutorial mode
2018-08-11 20:17:52 +00:00
emeralds = 0 ;
2019-08-24 17:25:27 +00:00
memset ( & luabanks , 0 , sizeof ( luabanks ) ) ;
2018-08-11 20:17:52 +00:00
M_ClearMenus ( true ) ;
gamecomplete = false ;
cursaveslot = 0 ;
G_DeferedInitNew ( false , G_BuildMapName ( tutorialmap ) , 0 , false , false ) ;
}
2014-03-15 16:59:03 +00:00
// ==============
// LOAD GAME MENU
// ==============
2017-08-20 22:18:47 +00:00
static INT32 saveSlotSelected = 1 ;
static INT32 loadgamescroll = 0 ;
static UINT8 loadgameoffset = 0 ;
2014-03-15 16:59:03 +00:00
static void M_DrawLoadGameData ( void )
{
2017-08-22 20:02:33 +00:00
INT32 i , savetodraw , x , y , hsep = 90 ;
2017-08-20 22:18:47 +00:00
skin_t * charskin = NULL ;
2014-03-15 16:59:03 +00:00
2017-08-22 20:02:33 +00:00
if ( vid . width ! = BASEVIDWIDTH * vid . dupx )
hsep = ( hsep * vid . width ) / ( BASEVIDWIDTH * vid . dupx ) ;
2017-08-20 22:18:47 +00:00
for ( i = - 2 ; i < = 2 ; i + + )
2014-03-15 16:59:03 +00:00
{
2017-08-20 22:18:47 +00:00
savetodraw = ( saveSlotSelected + i + numsaves ) % numsaves ;
2017-08-22 20:02:33 +00:00
x = ( BASEVIDWIDTH / 2 - 42 + loadgamescroll ) + ( i * hsep ) ;
2017-08-20 22:18:47 +00:00
y = 33 + 9 ;
2014-03-15 16:59:03 +00:00
{
2017-08-20 22:18:47 +00:00
INT32 diff = x - ( BASEVIDWIDTH / 2 - 42 ) ;
if ( diff < 0 )
diff = - diff ;
diff = ( 42 - diff ) / 3 - loadgameoffset ;
if ( diff < 0 )
diff = 0 ;
y - = diff ;
2014-03-15 16:59:03 +00:00
}
2017-08-20 22:18:47 +00:00
if ( savetodraw = = 0 )
2014-03-15 16:59:03 +00:00
{
2017-08-20 22:18:47 +00:00
V_DrawSmallScaledPatch ( x , y , 0 ,
2017-08-22 20:02:33 +00:00
savselp [ ( ( ultimate_selectable ) ? 2 : 1 ) ] ) ;
2017-08-20 22:18:47 +00:00
x + = 2 ;
y + = 1 ;
V_DrawString ( x , y ,
( ( savetodraw = = saveSlotSelected ) ? V_YELLOWMAP : 0 ) ,
" NO FILE " ) ;
if ( savetodraw = = saveSlotSelected )
V_DrawFill ( x , y + 9 , 80 , 1 , yellowmap [ 3 ] ) ;
y + = 11 ;
2017-10-25 15:40:21 +00:00
V_DrawSmallScaledPatch ( x , y , 0 , savselp [ 4 ] ) ;
M_DrawStaticBox ( x , y , V_80TRANS , 80 , 50 ) ;
2017-08-20 22:18:47 +00:00
y + = 41 ;
if ( ultimate_selectable )
V_DrawRightAlignedThinString ( x + 79 , y , V_REDMAP , " ULTIMATE. " ) ;
else
V_DrawRightAlignedThinString ( x + 79 , y , V_GRAYMAP , " DON'T SAVE! " ) ;
2017-10-25 15:40:21 +00:00
2017-08-20 22:18:47 +00:00
continue ;
2014-03-15 16:59:03 +00:00
}
2017-08-20 22:18:47 +00:00
savetodraw - - ;
2014-03-15 16:59:03 +00:00
2017-08-21 15:02:13 +00:00
if ( savegameinfo [ savetodraw ] . lives > 0 )
charskin = & skins [ savegameinfo [ savetodraw ] . skinnum ] ;
2017-08-20 22:18:47 +00:00
// signpost background
{
UINT8 col ;
2017-08-21 15:02:13 +00:00
if ( savegameinfo [ savetodraw ] . lives = = - 666 )
2017-08-20 22:18:47 +00:00
{
2017-08-22 20:02:33 +00:00
V_DrawSmallScaledPatch ( x + 2 , y + 64 , 0 , savselp [ 5 ] ) ;
2017-08-20 22:18:47 +00:00
}
2018-01-24 02:07:30 +00:00
# ifdef PERFECTSAVE // disabled on request
2017-08-23 21:05:11 +00:00
else if ( ( savegameinfo [ savetodraw ] . skinnum = = 1 )
& & ( savegameinfo [ savetodraw ] . lives = = 99 )
& & ( savegameinfo [ savetodraw ] . gamemap & 8192 )
& & ( savegameinfo [ savetodraw ] . numgameovers = = 0 )
2017-08-24 20:29:29 +00:00
& & ( savegameinfo [ savetodraw ] . numemeralds = = ( ( 1 < < 7 ) - 1 ) ) ) // perfect save
2017-08-23 21:05:11 +00:00
{
V_DrawFill ( x + 6 , y + 64 , 72 , 50 , 134 ) ;
V_DrawFill ( x + 6 , y + 74 , 72 , 30 , 201 ) ;
V_DrawFill ( x + 6 , y + 84 , 72 , 10 , 1 ) ;
}
# endif
2017-08-21 15:02:13 +00:00
else
{
if ( savegameinfo [ savetodraw ] . lives = = - 42 )
col = 26 ;
else if ( savegameinfo [ savetodraw ] . botskin = = 3 ) // & knuckles
col = 105 ;
else if ( savegameinfo [ savetodraw ] . botskin ) // tailsbot or custom
col = 134 ;
else
{
2019-08-12 13:00:26 +00:00
col = charskin - > prefcolor - 1 ;
col = Color_Index [ Color_Opposite [ col ] [ 0 ] - 1 ] [ Color_Opposite [ col ] [ 1 ] ] ;
2017-08-21 15:02:13 +00:00
}
2014-03-15 16:59:03 +00:00
2017-08-21 15:02:13 +00:00
V_DrawFill ( x + 6 , y + 64 , 72 , 50 , col ) ;
}
2017-08-20 22:18:47 +00:00
}
2017-09-28 15:10:24 +00:00
2017-08-22 20:02:33 +00:00
V_DrawSmallScaledPatch ( x , y , 0 , savselp [ 0 ] ) ;
2017-08-20 22:18:47 +00:00
x + = 2 ;
y + = 1 ;
V_DrawString ( x , y ,
( ( savetodraw = = saveSlotSelected - 1 ) ? V_YELLOWMAP : 0 ) ,
va ( " FILE %d " , savetodraw + 1 ) ) ;
if ( savetodraw = = saveSlotSelected - 1 )
V_DrawFill ( x , y + 9 , 80 , 1 , yellowmap [ 3 ] ) ;
y + = 11 ;
// level image area
{
if ( ( savegameinfo [ savetodraw ] . lives = = - 42 )
| | ( savegameinfo [ savetodraw ] . lives = = - 666 ) )
{
2017-10-25 15:40:21 +00:00
V_DrawFill ( x , y , 80 , 50 , 31 ) ;
M_DrawStaticBox ( x , y , V_80TRANS , 80 , 50 ) ;
2017-08-20 22:18:47 +00:00
}
else
{
2017-10-25 15:40:21 +00:00
patch_t * patch ;
if ( savegameinfo [ savetodraw ] . gamemap & 8192 )
patch = savselp [ 3 ] ;
2017-08-20 22:18:47 +00:00
else
2017-10-25 15:40:21 +00:00
{
lumpnum_t lumpnum = W_CheckNumForName ( va ( " %sP " , G_BuildMapName ( ( savegameinfo [ savetodraw ] . gamemap ) & 8191 ) ) ) ;
if ( lumpnum ! = LUMPERROR )
patch = W_CachePatchNum ( lumpnum , PU_CACHE ) ;
else
patch = savselp [ 5 ] ;
}
V_DrawSmallScaledPatch ( x , y , 0 , patch ) ;
2017-08-20 22:18:47 +00:00
}
2017-09-28 15:10:24 +00:00
2017-08-20 22:18:47 +00:00
y + = 41 ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
if ( savegameinfo [ savetodraw ] . lives = = - 42 )
V_DrawRightAlignedThinString ( x + 79 , y , V_GRAYMAP , " NEW GAME " ) ;
else if ( savegameinfo [ savetodraw ] . lives = = - 666 )
V_DrawRightAlignedThinString ( x + 79 , y , V_REDMAP , " CAN'T LOAD! " ) ;
else if ( savegameinfo [ savetodraw ] . gamemap & 8192 )
V_DrawRightAlignedThinString ( x + 79 , y , V_GREENMAP , " CLEAR! " ) ;
else
V_DrawRightAlignedThinString ( x + 79 , y , V_YELLOWMAP , savegameinfo [ savetodraw ] . levelname ) ;
}
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
if ( ( savegameinfo [ savetodraw ] . lives = = - 42 )
| | ( savegameinfo [ savetodraw ] . lives = = - 666 ) )
continue ;
2014-03-15 16:59:03 +00:00
2017-08-21 15:02:13 +00:00
y + = 64 ;
// tiny emeralds
{
INT32 j , workx = x + 6 ;
for ( j = 0 ; j < 7 ; + + j )
{
if ( savegameinfo [ savetodraw ] . numemeralds & ( 1 < < j ) )
2017-11-17 23:02:34 +00:00
V_DrawScaledPatch ( workx , y , 0 , emeraldpics [ 1 ] [ j ] ) ;
2017-08-21 15:02:13 +00:00
workx + = 10 ;
}
}
2019-09-11 12:32:12 +00:00
y - = 4 ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
// character heads, lives, and continues
{
spritedef_t * sprdef ;
spriteframe_t * sprframe ;
patch_t * patch ;
UINT8 * colormap = NULL ;
2014-03-15 16:59:03 +00:00
2019-09-11 12:32:12 +00:00
INT32 tempx = ( x + 40 ) < < FRACBITS , flip = 0 ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
// botskin first
if ( savegameinfo [ savetodraw ] . botskin )
{
skin_t * charbotskin = & skins [ savegameinfo [ savetodraw ] . botskin - 1 ] ;
sprdef = & charbotskin - > sprites [ SPR2_SIGN ] ;
if ( ! sprdef - > numframes )
goto skipbot ;
colormap = R_GetTranslationColormap ( savegameinfo [ savetodraw ] . botskin , charbotskin - > prefcolor , 0 ) ;
sprframe = & sprdef - > spriteframes [ 0 ] ;
patch = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
V_DrawFixedPatch (
tempx + ( 18 < < FRACBITS ) ,
2019-09-11 12:32:12 +00:00
y < < FRACBITS ,
2017-08-20 22:18:47 +00:00
charbotskin - > highresscale ,
0 , patch , colormap ) ;
Z_Free ( colormap ) ;
2019-09-11 12:32:12 +00:00
tempx - = ( 20 < < FRACBITS ) ;
2017-08-20 22:18:47 +00:00
flip = V_FLIP ;
}
skipbot :
// signpost image
if ( ! charskin ) // shut up compiler
goto skipsign ;
sprdef = & charskin - > sprites [ SPR2_SIGN ] ;
colormap = R_GetTranslationColormap ( savegameinfo [ savetodraw ] . skinnum , charskin - > prefcolor , 0 ) ;
if ( ! sprdef - > numframes )
goto skipsign ;
sprframe = & sprdef - > spriteframes [ 0 ] ;
patch = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
V_DrawFixedPatch (
tempx ,
2019-09-11 12:32:12 +00:00
y < < FRACBITS ,
2017-08-20 22:18:47 +00:00
charskin - > highresscale ,
flip , patch , colormap ) ;
skipsign :
2019-09-11 12:32:12 +00:00
y + = 16 ;
2017-08-20 22:18:47 +00:00
tempx = x + 10 ;
2018-08-23 19:09:39 +00:00
if ( savegameinfo [ savetodraw ] . lives ! = INFLIVES
2017-08-20 22:18:47 +00:00
& & savegameinfo [ savetodraw ] . lives > 9 )
tempx - = 4 ;
if ( ! charskin ) // shut up compiler
goto skiplife ;
// lives
sprdef = & charskin - > sprites [ SPR2_LIFE ] ;
if ( ! sprdef - > numframes )
goto skiplife ;
sprframe = & sprdef - > spriteframes [ 0 ] ;
patch = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
V_DrawFixedPatch (
( tempx + 4 ) < < FRACBITS ,
( y + 6 ) < < FRACBITS ,
charskin - > highresscale / 2 ,
0 , patch , colormap ) ;
skiplife :
if ( colormap )
Z_Free ( colormap ) ;
patch = W_CachePatchName ( " STLIVEX " , PU_CACHE ) ;
V_DrawScaledPatch ( tempx + 9 , y + 2 , 0 , patch ) ;
tempx + = 16 ;
2018-08-23 19:09:39 +00:00
if ( savegameinfo [ savetodraw ] . lives = = INFLIVES )
2017-08-20 22:18:47 +00:00
V_DrawCharacter ( tempx , y + 1 , ' \x16 ' , false ) ;
else
V_DrawString ( tempx , y , 0 , va ( " %d " , savegameinfo [ savetodraw ] . lives ) ) ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
tempx = x + 47 ;
if ( savegameinfo [ savetodraw ] . continues > 9 )
tempx - = 4 ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
// continues
if ( savegameinfo [ savetodraw ] . continues > 0 )
{
V_DrawSmallScaledPatch ( tempx , y , 0 , W_CachePatchName ( " CONTSAVE " , PU_CACHE ) ) ;
V_DrawScaledPatch ( tempx + 9 , y + 2 , 0 , patch ) ;
V_DrawString ( tempx + 16 , y , 0 , va ( " %d " , savegameinfo [ savetodraw ] . continues ) ) ;
}
else
{
V_DrawSmallScaledPatch ( tempx , y , 0 , W_CachePatchName ( " CONTNONE " , PU_CACHE ) ) ;
V_DrawScaledPatch ( tempx + 9 , y + 2 , 0 , W_CachePatchName ( " STNONEX " , PU_CACHE ) ) ;
V_DrawString ( tempx + 16 , y , V_GRAYMAP , " 0 " ) ;
}
}
}
}
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
static void M_DrawLoad ( void )
{
M_DrawMenuTitle ( ) ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
if ( loadgamescroll > 1 | | loadgamescroll < - 1 )
loadgamescroll = 2 * loadgamescroll / 3 ;
else
loadgamescroll = 0 ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
if ( loadgameoffset > 1 )
loadgameoffset = 2 * loadgameoffset / 3 ;
else
loadgameoffset = 0 ;
2014-03-15 16:59:03 +00:00
M_DrawLoadGameData ( ) ;
}
//
// User wants to load this game
//
static void M_LoadSelect ( INT32 choice )
{
( void ) choice ;
if ( saveSlotSelected = = NOSAVESLOT ) //last slot is play without saving
{
M_NewGame ( ) ;
2017-08-20 22:18:47 +00:00
cursaveslot = 0 ;
2014-03-15 16:59:03 +00:00
return ;
}
if ( ! FIL_ReadFileOK ( va ( savegamename , saveSlotSelected ) ) )
{
// This slot is empty, so start a new game here.
M_NewGame ( ) ;
}
2017-08-20 22:18:47 +00:00
else if ( savegameinfo [ saveSlotSelected - 1 ] . gamemap & 8192 ) // Completed
M_LoadGameLevelSelect ( 0 ) ;
2014-03-15 16:59:03 +00:00
else
G_LoadGame ( ( UINT32 ) saveSlotSelected , 0 ) ;
cursaveslot = saveSlotSelected ;
}
# define VERSIONSIZE 16
# define BADSAVE { savegameinfo[slot].lives = -666; Z_Free(savebuffer); return; }
# define CHECKPOS if (save_p >= end_p) BADSAVE
// Reads the save file to list lives, level, player, etc.
// Tails 05-29-2003
static void M_ReadSavegameInfo ( UINT32 slot )
{
size_t length ;
char savename [ 255 ] ;
UINT8 * savebuffer ;
UINT8 * end_p ; // buffer end point, don't read past here
UINT8 * save_p ;
INT32 fake ; // Dummy variable
char temp [ sizeof ( timeattackfolder ) ] ;
char vcheck [ VERSIONSIZE ] ;
sprintf ( savename , savegamename , slot ) ;
2017-08-20 22:18:47 +00:00
slot - - ;
2014-03-15 16:59:03 +00:00
length = FIL_ReadFile ( savename , & savebuffer ) ;
if ( length = = 0 )
{
savegameinfo [ slot ] . lives = - 42 ;
return ;
}
end_p = savebuffer + length ;
// skip the description field
save_p = savebuffer ;
// Version check
memset ( vcheck , 0 , sizeof ( vcheck ) ) ;
sprintf ( vcheck , " version %d " , VERSION ) ;
2017-08-20 22:18:47 +00:00
if ( strcmp ( ( const char * ) save_p , ( const char * ) vcheck ) ) BADSAVE
2014-03-15 16:59:03 +00:00
save_p + = VERSIONSIZE ;
// dearchive all the modifications
// P_UnArchiveMisc()
CHECKPOS
fake = READINT16 ( save_p ) ;
if ( ( ( fake - 1 ) & 8191 ) > = NUMMAPS ) BADSAVE
if ( ! mapheaderinfo [ ( fake - 1 ) & 8191 ] )
savegameinfo [ slot ] . levelname [ 0 ] = ' \0 ' ;
else
2017-08-24 23:40:45 +00:00
{
strlcpy ( savegameinfo [ slot ] . levelname , mapheaderinfo [ ( fake - 1 ) & 8191 ] - > lvlttl , 17 + 1 ) ;
if ( strlen ( mapheaderinfo [ ( fake - 1 ) & 8191 ] - > lvlttl ) > = 17 )
strcpy ( savegameinfo [ slot ] . levelname + 17 - 3 , " ... " ) ;
}
2014-03-15 16:59:03 +00:00
savegameinfo [ slot ] . gamemap = fake ;
CHECKPOS
2017-08-20 22:18:47 +00:00
savegameinfo [ slot ] . numemeralds = READUINT16 ( save_p ) - 357 ; // emeralds
2014-03-15 16:59:03 +00:00
CHECKPOS
READSTRINGN ( save_p , temp , sizeof ( temp ) ) ; // mod it belongs to
if ( strcmp ( temp , timeattackfolder ) ) BADSAVE
// P_UnArchivePlayer()
CHECKPOS
2017-08-20 22:18:47 +00:00
fake = READUINT16 ( save_p ) ;
savegameinfo [ slot ] . skinnum = fake & ( ( 1 < < 5 ) - 1 ) ;
if ( savegameinfo [ slot ] . skinnum > = numskins
| | ! R_SkinUsable ( - 1 , savegameinfo [ slot ] . skinnum ) )
BADSAVE
savegameinfo [ slot ] . botskin = fake > > 5 ;
if ( savegameinfo [ slot ] . botskin - 1 > = numskins
| | ! R_SkinUsable ( - 1 , savegameinfo [ slot ] . botskin - 1 ) )
2017-08-23 21:05:11 +00:00
BADSAVE
2014-03-15 16:59:03 +00:00
CHECKPOS
2017-08-23 21:05:11 +00:00
savegameinfo [ slot ] . numgameovers = READUINT8 ( save_p ) ; // numgameovers
2014-03-15 16:59:03 +00:00
CHECKPOS
2017-08-17 23:58:16 +00:00
savegameinfo [ slot ] . lives = READSINT8 ( save_p ) ; // lives
CHECKPOS
( void ) READINT32 ( save_p ) ; // Score
2014-03-15 16:59:03 +00:00
CHECKPOS
savegameinfo [ slot ] . continues = READINT32 ( save_p ) ; // continues
// File end marker check
CHECKPOS
2019-08-24 17:25:27 +00:00
switch ( READUINT8 ( save_p ) )
{
case 0xb7 :
{
UINT8 i , banksinuse ;
CHECKPOS
banksinuse = READUINT8 ( save_p ) ;
CHECKPOS
if ( banksinuse > NUM_LUABANKS )
BADSAVE
for ( i = 0 ; i < banksinuse ; i + + )
{
( void ) READINT32 ( save_p ) ;
CHECKPOS
}
if ( READUINT8 ( save_p ) ! = 0x1d )
BADSAVE
}
case 0x1d :
break ;
default :
BADSAVE
}
2014-03-15 16:59:03 +00:00
// done
Z_Free ( savebuffer ) ;
}
# undef CHECKPOS
# undef BADSAVE
//
// M_ReadSaveStrings
// read the strings from the savegame files
// and put it in savegamestrings global variable
//
static void M_ReadSaveStrings ( void )
{
FILE * handle ;
2017-08-20 22:18:47 +00:00
SINT8 i ;
2014-03-15 16:59:03 +00:00
char name [ 256 ] ;
2017-08-20 22:18:47 +00:00
boolean nofile [ MAXSAVEGAMES - 1 ] ;
2017-08-22 20:02:33 +00:00
SINT8 tolerance = 3 ; // empty slots at any time
UINT8 lastseen = 0 ;
2014-03-15 16:59:03 +00:00
2017-08-20 22:18:47 +00:00
loadgamescroll = 0 ;
loadgameoffset = 14 ;
2017-08-22 20:02:33 +00:00
for ( i = 1 ; ( i < MAXSAVEGAMES ) ; i + + ) // slot 0 is no save
2014-03-15 16:59:03 +00:00
{
snprintf ( name , sizeof name , savegamename , i ) ;
name [ sizeof name - 1 ] = ' \0 ' ;
handle = fopen ( name , " rb " ) ;
2017-08-20 22:18:47 +00:00
if ( ( nofile [ i - 1 ] = ( handle = = NULL ) ) )
2014-03-15 16:59:03 +00:00
continue ;
fclose ( handle ) ;
2017-08-22 20:02:33 +00:00
lastseen = i ;
2017-08-20 22:18:47 +00:00
}
if ( savegameinfo )
Z_Free ( savegameinfo ) ;
savegameinfo = NULL ;
2017-08-22 20:02:33 +00:00
if ( lastseen < saveSlotSelected )
lastseen = saveSlotSelected ;
i = lastseen ;
for ( ; ( lastseen > 0 & & tolerance ) ; lastseen - - )
{
if ( nofile [ lastseen - 1 ] )
tolerance - - ;
}
if ( ( i + = tolerance + 1 ) > MAXSAVEGAMES ) // show 3 empty slots at minimum
i = MAXSAVEGAMES ;
2017-08-20 22:18:47 +00:00
numsaves = i ;
savegameinfo = Z_Realloc ( savegameinfo , numsaves * sizeof ( saveinfo_t ) , PU_STATIC , NULL ) ;
if ( ! savegameinfo )
I_Error ( " Insufficient memory to prepare save platter " ) ;
for ( ; i > 0 ; i - - )
{
if ( nofile [ i - 1 ] = = true )
{
savegameinfo [ i - 1 ] . lives = - 42 ;
continue ;
}
2014-03-15 16:59:03 +00:00
M_ReadSavegameInfo ( i ) ;
}
2017-08-22 20:02:33 +00:00
if ( savselp [ 0 ] ) // never going to have some provided but not all, saves individually checking
{
W_UnlockCachedPatch ( savselp [ 0 ] ) ;
W_UnlockCachedPatch ( savselp [ 1 ] ) ;
W_UnlockCachedPatch ( savselp [ 2 ] ) ;
W_UnlockCachedPatch ( savselp [ 3 ] ) ;
W_UnlockCachedPatch ( savselp [ 4 ] ) ;
W_UnlockCachedPatch ( savselp [ 5 ] ) ;
}
savselp [ 0 ] = W_CachePatchName ( " SAVEBACK " , PU_STATIC ) ;
savselp [ 1 ] = W_CachePatchName ( " SAVENONE " , PU_STATIC ) ;
savselp [ 2 ] = W_CachePatchName ( " ULTIMATE " , PU_STATIC ) ;
2017-10-25 15:40:21 +00:00
savselp [ 3 ] = W_CachePatchName ( " GAMEDONE " , PU_STATIC ) ;
2017-08-22 20:02:33 +00:00
savselp [ 4 ] = W_CachePatchName ( " BLACXLVL " , PU_STATIC ) ;
2017-08-24 23:40:45 +00:00
savselp [ 5 ] = W_CachePatchName ( " BLANKLVL " , PU_STATIC ) ;
2014-03-15 16:59:03 +00:00
}
//
// User wants to delete this game
//
static void M_SaveGameDeleteResponse ( INT32 ch )
{
char name [ 256 ] ;
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
// delete savegame
snprintf ( name , sizeof name , savegamename , saveSlotSelected ) ;
name [ sizeof name - 1 ] = ' \0 ' ;
remove ( name ) ;
2017-08-21 15:02:13 +00:00
BwehHehHe ( ) ;
2017-08-20 22:18:47 +00:00
M_ReadSaveStrings ( ) ; // reload the menu
2014-03-15 16:59:03 +00:00
}
2017-08-22 22:47:25 +00:00
static void M_SaveGameUltimateResponse ( INT32 ch )
{
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
S_StartSound ( NULL , sfx_menu1 ) ;
M_LoadSelect ( saveSlotSelected ) ;
SP_PlayerDef . prevMenu = MessageDef . prevMenu ;
MessageDef . prevMenu = & SP_PlayerDef ;
}
2014-03-15 16:59:03 +00:00
static void M_HandleLoadSave ( INT32 choice )
{
boolean exitmenu = false ; // exit to previous menu
switch ( choice )
{
2017-08-20 22:18:47 +00:00
case KEY_RIGHTARROW :
S_StartSound ( NULL , sfx_s3kb7 ) ;
2014-03-15 16:59:03 +00:00
+ + saveSlotSelected ;
2017-08-20 22:18:47 +00:00
if ( saveSlotSelected > = numsaves )
saveSlotSelected - = numsaves ;
loadgamescroll = 90 ;
2014-03-15 16:59:03 +00:00
break ;
2017-08-20 22:18:47 +00:00
case KEY_LEFTARROW :
S_StartSound ( NULL , sfx_s3kb7 ) ;
2014-03-15 16:59:03 +00:00
- - saveSlotSelected ;
if ( saveSlotSelected < 0 )
2017-08-20 22:18:47 +00:00
saveSlotSelected + = numsaves ;
loadgamescroll = - 90 ;
2014-03-15 16:59:03 +00:00
break ;
case KEY_ENTER :
2017-08-22 22:47:25 +00:00
if ( ultimate_selectable & & saveSlotSelected = = NOSAVESLOT )
2017-08-20 22:18:47 +00:00
{
2017-08-22 22:47:25 +00:00
loadgamescroll = 0 ;
S_StartSound ( NULL , sfx_skid ) ;
M_StartMessage ( " Are you sure you want to play \n \x85 ultimate mode \x80 ? It isn't remotely fair, \n and you don't even get an emblem for it. \n \n (Press 'Y' to confirm) \n " , M_SaveGameUltimateResponse , MM_YESNO ) ;
}
2017-08-27 17:46:53 +00:00
else if ( saveSlotSelected ! = NOSAVESLOT & & savegameinfo [ saveSlotSelected - 1 ] . lives = = - 42 & & ! ( ! modifiedgame | | savemoddata ) )
{
loadgamescroll = 0 ;
S_StartSound ( NULL , sfx_skid ) ;
M_StartMessage ( M_GetText ( " This cannot be done in a modified game. \n \n (Press a key) \n " ) , NULL , MM_NOTHING ) ;
}
else if ( saveSlotSelected = = NOSAVESLOT | | savegameinfo [ saveSlotSelected - 1 ] . lives ! = - 666 ) // don't allow loading of "bad saves"
2017-08-22 22:47:25 +00:00
{
loadgamescroll = 0 ;
2017-08-20 22:18:47 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2014-03-15 16:59:03 +00:00
M_LoadSelect ( saveSlotSelected ) ;
2017-08-20 22:18:47 +00:00
}
else if ( ! loadgameoffset )
{
2017-08-21 15:02:13 +00:00
S_StartSound ( NULL , sfx_lose ) ;
2017-08-20 22:18:47 +00:00
loadgameoffset = 14 ;
}
2014-03-15 16:59:03 +00:00
break ;
case KEY_ESCAPE :
exitmenu = true ;
break ;
case KEY_BACKSPACE :
// Don't allow people to 'delete' "Play without Saving."
// Nor allow people to 'delete' slots with no saves in them.
2017-08-20 22:18:47 +00:00
if ( saveSlotSelected ! = NOSAVESLOT & & savegameinfo [ saveSlotSelected - 1 ] . lives ! = - 42 )
{
loadgamescroll = 0 ;
S_StartSound ( NULL , sfx_skid ) ;
2017-08-22 22:47:25 +00:00
M_StartMessage ( va ( " Are you sure you want to delete \n save file %d? \n \n (Press 'Y' to confirm) \n " , saveSlotSelected ) , M_SaveGameDeleteResponse , MM_YESNO ) ;
2017-08-20 22:18:47 +00:00
}
else if ( ! loadgameoffset )
{
2017-08-21 15:02:13 +00:00
if ( saveSlotSelected = = NOSAVESLOT & & ultimate_selectable )
{
ultimate_selectable = false ;
2017-08-22 22:47:25 +00:00
S_StartSound ( NULL , sfx_strpst ) ;
2017-08-21 15:02:13 +00:00
}
else
S_StartSound ( NULL , sfx_lose ) ;
2017-08-20 22:18:47 +00:00
loadgameoffset = 14 ;
}
2014-03-15 16:59:03 +00:00
break ;
}
if ( exitmenu )
{
2019-08-18 22:46:55 +00:00
// Is this a hack?
charseltimer = 0 ;
2014-03-15 16:59:03 +00:00
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
2017-08-20 22:18:47 +00:00
Z_Free ( savegameinfo ) ;
savegameinfo = NULL ;
2014-03-15 16:59:03 +00:00
}
}
2018-11-11 14:21:10 +00:00
static void M_FirstTimeResponse ( INT32 ch )
2018-11-10 07:30:21 +00:00
{
2018-11-13 00:10:41 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
if ( ch = = KEY_ESCAPE )
return ;
2018-11-10 07:30:21 +00:00
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
{
2018-11-13 00:10:41 +00:00
CV_SetValue ( & cv_tutorialprompt , 0 ) ;
2018-11-10 07:30:21 +00:00
M_ReadSaveStrings ( ) ;
2018-11-13 00:10:41 +00:00
MessageDef . prevMenu = & SP_LoadDef ; // calls M_SetupNextMenu
2018-11-10 07:30:21 +00:00
}
else
2018-11-13 00:10:41 +00:00
{
2018-11-10 07:30:21 +00:00
M_StartTutorial ( 0 ) ;
2018-11-13 00:10:41 +00:00
MessageDef . prevMenu = & MessageDef ; // otherwise, the controls prompt won't fire
}
2018-11-10 07:30:21 +00:00
}
2014-03-15 16:59:03 +00:00
//
// Selected from SRB2 menu
//
static void M_LoadGame ( INT32 choice )
{
( void ) choice ;
2018-11-13 00:10:41 +00:00
if ( tutorialmap & & cv_tutorialprompt . value )
2018-11-10 07:30:21 +00:00
{
2018-11-13 00:10:41 +00:00
M_StartMessage ( " Do you want to \x82 play a brief Tutorial \x80 ? \n \n We highly recommend this because \n the controls are slightly different \n from other games. \n \n Press 'Y' or 'Enter' to go \n Press 'N' or any key to skip \n " ,
M_FirstTimeResponse , MM_YESNO ) ;
2018-11-10 07:30:21 +00:00
return ;
}
2014-03-15 16:59:03 +00:00
M_ReadSaveStrings ( ) ;
M_SetupNextMenu ( & SP_LoadDef ) ;
}
//
// Used by cheats to force the save menu to a specific spot.
//
void M_ForceSaveSlotSelected ( INT32 sslot )
{
2017-08-22 22:47:25 +00:00
loadgameoffset = 14 ;
// Already there? Whatever, then!
if ( sslot = = saveSlotSelected )
2014-03-15 16:59:03 +00:00
return ;
2017-08-22 22:47:25 +00:00
loadgamescroll = 90 ;
if ( saveSlotSelected < = numsaves / 2 )
loadgamescroll = - loadgamescroll ;
2014-03-15 16:59:03 +00:00
saveSlotSelected = sslot ;
}
// ================
// CHARACTER SELECT
// ================
static void M_SetupChoosePlayer ( INT32 choice )
{
2016-08-06 21:41:25 +00:00
INT32 skinnum ;
UINT8 i ;
UINT8 firstvalid = 255 ;
UINT8 lastvalid = 0 ;
2017-03-17 14:27:17 +00:00
boolean allowed = false ;
2019-10-19 17:15:54 +00:00
char * and ;
2014-03-15 16:59:03 +00:00
( void ) choice ;
2019-10-27 12:20:17 +00:00
if ( ! ( mapheaderinfo [ startmap - 1 ]
& & ( mapheaderinfo [ startmap - 1 ] - > forcecharacter [ 0 ] ! = ' \0 '
| | ( mapheaderinfo [ startmap - 1 ] - > typeoflevel & TOL_NIGHTS ) ) // remove this later when everyone gets their own nights sprites, maybe
) )
2014-03-15 16:59:03 +00:00
{
2019-10-27 12:20:17 +00:00
for ( i = 0 ; i < 32 ; i + + ) // Handle charsels, availability, and unlocks.
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
{
2019-10-27 12:20:17 +00:00
if ( description [ i ] . used ) // If the character's disabled through SOC, there's nothing we can do for it.
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
{
2019-10-27 12:20:17 +00:00
and = strchr ( description [ i ] . skinname , ' & ' ) ;
if ( and )
{
char firstskin [ SKINNAMESIZE + 1 ] ;
strncpy ( firstskin , description [ i ] . skinname , ( and - description [ i ] . skinname ) ) ;
firstskin [ ( and - description [ i ] . skinname ) ] = ' \0 ' ;
description [ i ] . skinnum [ 0 ] = R_SkinAvailable ( firstskin ) ;
description [ i ] . skinnum [ 1 ] = R_SkinAvailable ( and + 1 ) ;
}
2016-08-06 21:41:25 +00:00
else
{
2019-10-27 12:20:17 +00:00
description [ i ] . skinnum [ 0 ] = R_SkinAvailable ( description [ i ] . skinname ) ;
description [ i ] . skinnum [ 1 ] = - 1 ;
2016-08-06 21:41:25 +00:00
}
2019-10-27 12:20:17 +00:00
skinnum = description [ i ] . skinnum [ 0 ] ;
if ( ( skinnum ! = - 1 ) & & ( R_SkinUsable ( - 1 , skinnum ) ) )
{
// Handling order.
if ( firstvalid = = 255 )
firstvalid = i ;
else
{
description [ i ] . prev = lastvalid ;
description [ lastvalid ] . next = i ;
}
lastvalid = i ;
2016-08-06 21:41:25 +00:00
2019-10-27 12:20:17 +00:00
if ( i = = char_on )
allowed = true ;
2017-03-17 14:27:17 +00:00
2019-10-27 12:20:17 +00:00
if ( ! ( description [ i ] . picname [ 0 ] ) )
A good and bad ending cutscene now exist.
Also:
* SPR2_XTRA - instead of defining lumpnames in S_SKIN, those kinds of assets can just be bundled into the spriteset. Required for ending cutscene stuff, I guess, but also done for HUD life icon and character select image (aside from Sonic&Tails, still SOC'd in).
* Minor oversights in SPR2 support corrected.
* Better evaluation, featuring ending assets.
* Intro has warping-in blackrock, reusing ending assets.
* Cutscene text now supports lowercase (intro and custom).
* Disable the asset-fucking "gamma correction" I put in over two years ago when implementing colour cube. (This is the only thing I could move into another branch if you MUST, but it's basically invisble in the diff so w/e.)
* Don't blank the screen if the top left pixel of a screen-covering patch is transparent. (Checked via nonzero topdelta for first column)
Bugs:
* OPENGL ONLY: The first ~20 frames of both endings are fucked. A little help here? Might be HWR_DrawFadeFill's fault, which I just created. OR it could be in f_finale, but I doubt it, since it doesn't appear in Software.
2019-07-27 23:32:57 +00:00
{
2019-10-27 12:20:17 +00:00
if ( skins [ skinnum ] . sprites [ SPR2_XTRA ] . numframes > = XTRA_CHARSEL + 1 )
{
spritedef_t * sprdef = & skins [ skinnum ] . sprites [ SPR2_XTRA ] ;
spriteframe_t * sprframe = & sprdef - > spriteframes [ XTRA_CHARSEL ] ;
description [ i ] . charpic = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
}
else
description [ i ] . charpic = W_CachePatchName ( " MISSING " , PU_CACHE ) ;
A good and bad ending cutscene now exist.
Also:
* SPR2_XTRA - instead of defining lumpnames in S_SKIN, those kinds of assets can just be bundled into the spriteset. Required for ending cutscene stuff, I guess, but also done for HUD life icon and character select image (aside from Sonic&Tails, still SOC'd in).
* Minor oversights in SPR2 support corrected.
* Better evaluation, featuring ending assets.
* Intro has warping-in blackrock, reusing ending assets.
* Cutscene text now supports lowercase (intro and custom).
* Disable the asset-fucking "gamma correction" I put in over two years ago when implementing colour cube. (This is the only thing I could move into another branch if you MUST, but it's basically invisble in the diff so w/e.)
* Don't blank the screen if the top left pixel of a screen-covering patch is transparent. (Checked via nonzero topdelta for first column)
Bugs:
* OPENGL ONLY: The first ~20 frames of both endings are fucked. A little help here? Might be HWR_DrawFadeFill's fault, which I just created. OR it could be in f_finale, but I doubt it, since it doesn't appear in Software.
2019-07-27 23:32:57 +00:00
}
else
2019-10-27 12:20:17 +00:00
description [ i ] . charpic = W_CachePatchName ( description [ i ] . picname , PU_CACHE ) ;
2019-08-19 01:26:52 +00:00
2019-10-27 12:20:17 +00:00
if ( description [ i ] . nametag [ 0 ] )
{
const char * nametag = description [ i ] . nametag ;
description [ i ] . namepic = NULL ;
if ( W_LumpExists ( nametag ) )
description [ i ] . namepic = W_CachePatchName ( nametag , PU_CACHE ) ;
}
2019-08-19 17:23:03 +00:00
}
2019-10-27 12:20:17 +00:00
// else -- Technically, character select icons without corresponding skins get bundled away behind this too. Sucks to be them.
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
}
}
}
2019-10-27 12:20:17 +00:00
if ( firstvalid ! = 255 )
2016-08-06 21:41:25 +00:00
{ // One last bit of order we can't do in the iteration above.
description [ firstvalid ] . prev = lastvalid ;
description [ lastvalid ] . next = firstvalid ;
}
2019-10-27 12:20:17 +00:00
else // We're being forced into a specific character, so might as well just skip it.
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
{
2019-10-27 12:20:17 +00:00
M_ChoosePlayer ( - 1 ) ;
2014-03-15 16:59:03 +00:00
return ;
}
2019-10-10 05:56:48 +00:00
M_ChangeMenuMusic ( " _chsel " , true ) ;
2014-03-15 16:59:03 +00:00
2019-10-19 19:42:53 +00:00
/* the menus suck -James */
if ( currentMenu = = & SP_LoadDef ) /* from save states */
{
SP_PlayerDef . menuid =
MN_SP_MAIN +
( MN_SP_LOAD < < 6 ) +
( MN_SP_PLAYER < < 12 ) ;
}
else /* from Secret level select */
{
SP_PlayerDef . menuid =
MN_SR_MAIN +
( MN_SR_PLAYER < < 6 ) ;
}
2014-03-15 16:59:03 +00:00
SP_PlayerDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & SP_PlayerDef ) ;
2017-03-17 14:27:17 +00:00
if ( ! allowed )
2017-10-03 17:18:18 +00:00
{
2017-03-17 14:27:17 +00:00
char_on = firstvalid ;
2017-10-03 17:18:18 +00:00
if ( startchar > 0 & & startchar < 32 )
{
INT16 workchar = startchar ;
while ( workchar - - )
char_on = description [ char_on ] . next ;
}
}
2019-08-19 17:43:48 +00:00
// finish scrolling the menu
char_scroll = 0 ;
charseltimer = 0 ;
2014-03-15 16:59:03 +00:00
Z_Free ( char_notes ) ;
2017-03-17 14:27:17 +00:00
char_notes = V_WordWrap ( 0 , 21 * 8 , V_ALLOWLOWERCASE , description [ char_on ] . notes ) ;
}
//
// M_HandleChoosePlayerMenu
//
// Reacts to your key inputs. Basically a mini menu thinker.
//
static void M_HandleChoosePlayerMenu ( INT32 choice )
{
boolean exitmenu = false ; // exit to previous menu
INT32 selectval ;
2019-09-06 18:25:11 +00:00
if ( keydown > 1 )
2019-08-18 22:34:54 +00:00
return ;
2017-03-17 14:27:17 +00:00
switch ( choice )
{
case KEY_DOWNARROW :
if ( ( selectval = description [ char_on ] . next ) ! = char_on )
{
S_StartSound ( NULL , sfx_s3kb7 ) ;
char_on = selectval ;
2019-08-18 22:34:54 +00:00
char_scroll = - charscrollamt ;
2017-03-17 14:27:17 +00:00
Z_Free ( char_notes ) ;
char_notes = V_WordWrap ( 0 , 21 * 8 , V_ALLOWLOWERCASE , description [ char_on ] . notes ) ;
}
else if ( ! char_scroll )
{
S_StartSound ( NULL , sfx_s3kb7 ) ;
char_scroll = 16 * FRACUNIT ;
}
break ;
case KEY_UPARROW :
if ( ( selectval = description [ char_on ] . prev ) ! = char_on )
{
S_StartSound ( NULL , sfx_s3kb7 ) ;
char_on = selectval ;
2019-08-18 22:34:54 +00:00
char_scroll = charscrollamt ;
2017-03-17 14:27:17 +00:00
Z_Free ( char_notes ) ;
char_notes = V_WordWrap ( 0 , 21 * 8 , V_ALLOWLOWERCASE , description [ char_on ] . notes ) ;
}
else if ( ! char_scroll )
{
S_StartSound ( NULL , sfx_s3kb7 ) ;
char_scroll = - 16 * FRACUNIT ;
}
break ;
case KEY_ENTER :
S_StartSound ( NULL , sfx_menu1 ) ;
M_ChoosePlayer ( char_on ) ;
break ;
case KEY_ESCAPE :
exitmenu = true ;
break ;
default :
break ;
}
if ( exitmenu )
{
2019-08-18 22:34:54 +00:00
// Is this a hack?
2019-08-20 03:18:34 +00:00
charseltimer = 0 ;
2017-03-17 14:27:17 +00:00
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
2014-03-15 16:59:03 +00:00
}
// Draw the choose player setup menu, had some fun with player anim
2019-10-02 03:40:59 +00:00
//define CHOOSEPLAYER_DRAWHEADER
2019-08-19 19:19:25 +00:00
2014-03-15 16:59:03 +00:00
static void M_DrawSetupChoosePlayerMenu ( void )
{
2019-08-18 22:34:54 +00:00
const INT32 my = 16 ;
2014-03-15 16:59:03 +00:00
2019-08-18 22:34:54 +00:00
skin_t * charskin = & skins [ 0 ] ;
INT32 skinnum = 0 ;
2019-08-19 19:19:25 +00:00
UINT8 col ;
2019-08-19 01:26:52 +00:00
UINT8 * colormap = NULL ;
INT32 prev = - 1 , next = - 1 ;
2019-08-18 23:35:16 +00:00
patch_t * charbg = W_CachePatchName ( " CHARBG " , PU_CACHE ) ;
patch_t * charfg = W_CachePatchName ( " CHARFG " , PU_CACHE ) ;
2019-08-19 19:19:25 +00:00
INT16 bgheight = SHORT ( charbg - > height ) ;
INT16 fgheight = SHORT ( charfg - > height ) ;
2019-10-03 00:57:04 +00:00
INT16 bgwidth = SHORT ( charbg - > width ) ;
INT16 fgwidth = SHORT ( charfg - > width ) ;
2019-10-19 17:15:54 +00:00
INT32 x , y ;
INT32 w = ( vid . width / vid . dupx ) ;
2014-03-15 16:59:03 +00:00
2017-03-17 14:27:17 +00:00
if ( abs ( char_scroll ) > FRACUNIT )
char_scroll - = ( char_scroll > > 2 ) ;
2014-03-15 16:59:03 +00:00
else // close enough.
2017-03-17 14:27:17 +00:00
char_scroll = 0 ; // just be exact now.
2016-07-10 01:05:59 +00:00
2019-08-19 01:26:52 +00:00
// Get prev character...
prev = description [ char_on ] . prev ;
// If there's more than one character available...
if ( prev ! = char_on )
// Let's get the next character now.
next = description [ char_on ] . next ;
else
// No there isn't.
prev = - 1 ;
2019-08-19 19:19:25 +00:00
// Find skin number from description[]
2019-10-19 17:15:54 +00:00
skinnum = description [ char_on ] . skinnum [ 0 ] ;
charskin = & skins [ skinnum ] ;
2019-08-19 19:19:25 +00:00
2019-09-06 19:05:46 +00:00
// Use the opposite of the character's skincolor
2019-10-14 05:24:44 +00:00
col = description [ char_on ] . oppositecolor ;
if ( ! col )
col = Color_Opposite [ charskin - > prefcolor - 1 ] [ 0 ] ;
2019-08-19 19:19:25 +00:00
2019-09-06 19:05:46 +00:00
// Make the translation colormap
2019-10-19 17:15:54 +00:00
colormap = R_GetTranslationColormap ( TC_DEFAULT , col , 0 ) ;
2016-07-19 00:19:03 +00:00
2019-09-06 19:05:46 +00:00
// Don't render the title map
hidetitlemap = true ;
charseltimer + + ;
2019-08-18 22:34:54 +00:00
2019-09-06 19:05:46 +00:00
// Background and borders
2019-10-03 00:57:04 +00:00
V_DrawFill ( 0 , 0 , bgwidth , vid . height , V_SNAPTOTOP | colormap [ 101 ] ) ;
2017-03-17 14:27:17 +00:00
{
2019-08-18 22:34:54 +00:00
INT32 sw = ( BASEVIDWIDTH * vid . dupx ) ;
INT32 bw = ( vid . width - sw ) / 2 ;
col = colormap [ 106 ] ;
if ( bw )
V_DrawFill ( 0 , 0 , bw , vid . height , V_NOSCALESTART | col ) ;
2017-03-17 14:27:17 +00:00
}
2014-03-15 16:59:03 +00:00
2019-10-03 00:57:04 +00:00
y = ( charseltimer % 32 ) ;
V_DrawMappedPatch ( 0 , y - bgheight , V_SNAPTOTOP , charbg , colormap ) ;
V_DrawMappedPatch ( 0 , y , V_SNAPTOTOP , charbg , colormap ) ;
V_DrawMappedPatch ( 0 , y + bgheight , V_SNAPTOTOP , charbg , colormap ) ;
V_DrawMappedPatch ( 0 , - y , V_SNAPTOTOP , charfg , colormap ) ;
V_DrawMappedPatch ( 0 , - y + fgheight , V_SNAPTOTOP , charfg , colormap ) ;
V_DrawFill ( fgwidth , 0 , vid . width , vid . height , V_SNAPTOTOP | colormap [ 106 ] ) ;
2016-07-10 01:05:59 +00:00
2019-09-06 19:05:46 +00:00
// Character pictures
2014-03-15 16:59:03 +00:00
{
2019-10-19 17:15:54 +00:00
x = 8 ;
y = ( my + 16 ) - FixedInt ( char_scroll ) ;
2019-08-19 21:49:23 +00:00
V_DrawScaledPatch ( x , y , 0 , description [ char_on ] . charpic ) ;
if ( prev ! = - 1 )
V_DrawScaledPatch ( x , y - 144 , 0 , description [ prev ] . charpic ) ;
if ( next ! = - 1 )
V_DrawScaledPatch ( x , y + 144 , 0 , description [ next ] . charpic ) ;
}
2016-07-11 22:01:43 +00:00
2019-08-19 01:26:52 +00:00
// Character description
2019-08-19 21:49:23 +00:00
{
2019-08-20 23:33:39 +00:00
INT32 flags = V_ALLOWLOWERCASE | V_RETURN8 ;
2019-10-19 17:15:54 +00:00
x = 146 ;
y = my + 9 ;
2019-08-20 23:33:39 +00:00
V_DrawString ( x , y , flags , char_notes ) ;
2019-08-19 21:49:23 +00:00
}
2019-08-18 22:34:54 +00:00
2019-09-06 19:05:46 +00:00
// Name tags
2019-08-18 22:34:54 +00:00
{
2019-10-19 17:15:54 +00:00
INT32 ox , oxsh = FixedInt ( FixedMul ( BASEVIDWIDTH * FRACUNIT , FixedDiv ( char_scroll , 128 * FRACUNIT ) ) ) , txsh ;
2019-08-19 01:26:52 +00:00
patch_t * curpatch = NULL , * prevpatch = NULL , * nextpatch = NULL ;
2019-10-14 05:24:44 +00:00
const char * curtext = NULL , * prevtext = NULL , * nexttext = NULL ;
UINT8 curtextcolor = 0 , prevtextcolor = 0 , nexttextcolor = 0 ;
UINT8 curoutlinecolor = 0 , prevoutlinecolor = 0 , nextoutlinecolor = 0 ;
2016-07-11 22:01:43 +00:00
2019-10-14 05:24:44 +00:00
// Name tag
curtext = description [ char_on ] . displayname ;
curtextcolor = description [ char_on ] . tagtextcolor ;
curoutlinecolor = description [ char_on ] . tagoutlinecolor ;
if ( curtext [ 0 ] = = ' \0 ' )
curpatch = description [ char_on ] . namepic ;
2019-10-19 17:15:54 +00:00
if ( ! curtextcolor )
curtextcolor = charskin - > prefcolor ;
if ( ! curoutlinecolor )
curoutlinecolor = Color_Opposite [ charskin - > prefcolor - 1 ] [ 0 ] ;
2019-08-18 22:34:54 +00:00
2019-10-19 17:15:54 +00:00
txsh = oxsh ;
ox = 8 + SHORT ( ( description [ char_on ] . charpic ) - > width ) / 2 ;
y = my + 144 ;
2016-07-11 22:01:43 +00:00
2019-10-19 17:15:54 +00:00
// cur
2016-07-11 22:01:43 +00:00
{
2019-10-19 17:15:54 +00:00
x = ox - txsh ;
if ( curpatch )
x - = ( SHORT ( curpatch - > width ) / 2 ) ;
if ( curtext [ 0 ] ! = ' \0 ' )
2019-10-14 05:24:44 +00:00
{
2019-10-19 17:15:54 +00:00
V_DrawNameTag (
x , y , V_CENTERNAMETAG , FRACUNIT ,
R_GetTranslationColormap ( TC_DEFAULT , curtextcolor , 0 ) ,
R_GetTranslationColormap ( TC_DEFAULT , curoutlinecolor , 0 ) ,
curtext
) ;
2019-10-14 05:24:44 +00:00
}
2019-10-19 17:15:54 +00:00
else if ( curpatch )
V_DrawScaledPatch ( x , y , 0 , curpatch ) ;
2014-03-15 16:59:03 +00:00
}
2016-07-10 01:05:59 +00:00
2019-08-20 03:18:34 +00:00
if ( char_scroll )
2014-03-15 16:59:03 +00:00
{
2019-08-18 22:34:54 +00:00
// prev
2019-10-14 05:24:44 +00:00
if ( ( prev ! = - 1 ) & & char_scroll < 0 )
2019-08-19 01:26:52 +00:00
{
2019-10-19 17:15:54 +00:00
prevtext = description [ prev ] . displayname ;
prevtextcolor = description [ prev ] . tagtextcolor ;
prevoutlinecolor = description [ prev ] . tagoutlinecolor ;
if ( prevtext [ 0 ] = = ' \0 ' )
prevpatch = description [ prev ] . namepic ;
charskin = & skins [ description [ prev ] . skinnum [ 0 ] ] ;
if ( ! prevtextcolor )
prevtextcolor = charskin - > prefcolor ;
if ( ! prevoutlinecolor )
prevoutlinecolor = Color_Opposite [ charskin - > prefcolor - 1 ] [ 0 ] ;
x = ( ox - txsh ) - w ;
2019-10-14 05:24:44 +00:00
if ( prevpatch )
2019-10-19 17:15:54 +00:00
x - = ( SHORT ( prevpatch - > width ) / 2 ) ;
2019-10-14 05:24:44 +00:00
if ( prevtext [ 0 ] ! = ' \0 ' )
{
V_DrawNameTag (
x , y , V_CENTERNAMETAG , FRACUNIT ,
2019-10-19 17:15:54 +00:00
R_GetTranslationColormap ( TC_DEFAULT , prevtextcolor , 0 ) ,
R_GetTranslationColormap ( TC_DEFAULT , prevoutlinecolor , 0 ) ,
2019-10-14 05:24:44 +00:00
prevtext
) ;
}
else if ( prevpatch )
V_DrawScaledPatch ( x , y , 0 , prevpatch ) ;
2019-08-19 01:26:52 +00:00
}
2019-08-18 22:34:54 +00:00
// next
2019-10-14 05:24:44 +00:00
else if ( ( next ! = - 1 ) & & char_scroll > 0 )
2019-08-19 01:26:52 +00:00
{
2019-10-19 17:15:54 +00:00
nexttext = description [ next ] . displayname ;
nexttextcolor = description [ next ] . tagtextcolor ;
nextoutlinecolor = description [ next ] . tagoutlinecolor ;
if ( nexttext [ 0 ] = = ' \0 ' )
nextpatch = description [ next ] . namepic ;
charskin = & skins [ description [ next ] . skinnum [ 0 ] ] ;
if ( ! nexttextcolor )
nexttextcolor = charskin - > prefcolor ;
if ( ! nextoutlinecolor )
nextoutlinecolor = Color_Opposite [ charskin - > prefcolor - 1 ] [ 0 ] ;
x = ( ox - txsh ) + w ;
2019-10-14 05:24:44 +00:00
if ( nextpatch )
2019-10-19 17:15:54 +00:00
x - = ( SHORT ( nextpatch - > width ) / 2 ) ;
if ( nexttext [ 0 ] ! = ' \0 ' )
2019-10-14 05:24:44 +00:00
{
2019-10-19 17:15:54 +00:00
V_DrawNameTag (
x , y , V_CENTERNAMETAG , FRACUNIT ,
R_GetTranslationColormap ( TC_DEFAULT , nexttextcolor , 0 ) ,
R_GetTranslationColormap ( TC_DEFAULT , nextoutlinecolor , 0 ) ,
nexttext
) ;
2019-10-14 05:24:44 +00:00
}
2019-10-19 17:15:54 +00:00
else if ( nextpatch )
V_DrawScaledPatch ( x , y , 0 , nextpatch ) ;
2019-08-19 01:26:52 +00:00
}
2014-03-15 16:59:03 +00:00
}
2016-07-11 22:01:43 +00:00
}
2016-07-10 01:05:59 +00:00
2019-10-02 03:40:59 +00:00
// Alternative menu header
2019-10-19 18:36:30 +00:00
# ifdef CHOOSEPLAYER_DRAWHEADER
2014-03-15 16:59:03 +00:00
{
2019-08-19 19:19:25 +00:00
patch_t * header = W_CachePatchName ( " M_PICKP " , PU_CACHE ) ;
INT32 xtitle = 146 ;
INT32 ytitle = ( 35 - SHORT ( header - > height ) ) / 2 ;
2019-08-20 03:18:34 +00:00
V_DrawFixedPatch ( xtitle < < FRACBITS , ytitle < < FRACBITS , FRACUNIT / 2 , 0 , header , NULL ) ;
2017-03-17 14:27:17 +00:00
}
2019-08-19 19:19:25 +00:00
# endif // CHOOSEPLAYER_DRAWHEADER
2014-03-15 16:59:03 +00:00
M_DrawMenuTitle ( ) ;
}
// Chose the player you want to use Tails 03-02-2002
static void M_ChoosePlayer ( INT32 choice )
{
boolean ultmode = ( ultimate_selectable & & SP_PlayerDef . prevMenu = = & SP_LoadDef & & saveSlotSelected = = NOSAVESLOT ) ;
2019-10-27 12:20:17 +00:00
UINT8 skinnum ;
2014-03-15 16:59:03 +00:00
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
// skip this if forcecharacter or no characters available
2019-10-27 12:20:17 +00:00
if ( choice = = - 1 )
{
skinnum = botskin = 0 ;
botingame = false ;
}
// M_SetupChoosePlayer didn't call us directly, that means we've been properly set up.
else
2014-03-15 16:59:03 +00:00
{
2017-03-17 14:27:17 +00:00
char_scroll = 0 ; // finish scrolling the menu
2014-03-15 16:59:03 +00:00
M_DrawSetupChoosePlayerMenu ( ) ; // draw the finally selected character one last time for the fadeout
2019-08-18 22:34:54 +00:00
// Is this a hack?
charseltimer = 0 ;
2014-03-15 16:59:03 +00:00
2019-10-27 12:20:17 +00:00
skinnum = description [ choice ] . skinnum [ 0 ] ;
if ( ( botingame = ( description [ choice ] . skinnum [ 1 ] ! = - 1 ) ) ) {
// this character has a second skin
botskin = ( UINT8 ) ( description [ choice ] . skinnum [ 1 ] + 1 ) ;
botcolor = skins [ description [ choice ] . skinnum [ 1 ] ] . prefcolor ;
}
else
botskin = botcolor = 0 ;
2014-03-15 16:59:03 +00:00
}
2019-10-27 12:20:17 +00:00
M_ClearMenus ( true ) ;
2014-03-15 16:59:03 +00:00
if ( startmap ! = spstage_start )
2017-08-20 22:18:47 +00:00
cursaveslot = 0 ;
2014-03-15 16:59:03 +00:00
2017-08-04 17:57:47 +00:00
//lastmapsaved = 0;
2014-03-15 16:59:03 +00:00
gamecomplete = false ;
2019-10-27 12:20:17 +00:00
G_DeferedInitNew ( ultmode , G_BuildMapName ( startmap ) , skinnum , false , fromlevelselect ) ;
2014-03-15 16:59:03 +00:00
COM_BufAddText ( " dummyconsvar 1 \n " ) ; // G_DeferedInitNew doesn't do this
2017-04-29 15:40:07 +00:00
if ( levelselect . rows )
Z_Free ( levelselect . rows ) ;
levelselect . rows = NULL ;
2017-08-20 22:18:47 +00:00
if ( savegameinfo )
Z_Free ( savegameinfo ) ;
savegameinfo = NULL ;
2014-03-15 16:59:03 +00:00
}
// ===============
// STATISTICS MENU
// ===============
static INT32 statsLocation ;
static INT32 statsMax ;
static INT16 statsMapList [ NUMMAPS + 1 ] ;
static void M_Statistics ( INT32 choice )
{
INT16 i , j = 0 ;
( void ) choice ;
memset ( statsMapList , 0 , sizeof ( statsMapList ) ) ;
for ( i = 0 ; i < NUMMAPS ; i + + )
{
if ( ! mapheaderinfo [ i ] | | mapheaderinfo [ i ] - > lvlttl [ 0 ] = = ' \0 ' )
continue ;
if ( ! ( mapheaderinfo [ i ] - > typeoflevel & TOL_SP ) | | ( mapheaderinfo [ i ] - > menuflags & LF2_HIDEINSTATS ) )
continue ;
2017-09-15 19:34:46 +00:00
if ( ! ( mapvisited [ i ] & MV_MAX ) )
2014-03-15 16:59:03 +00:00
continue ;
statsMapList [ j + + ] = i ;
}
statsMapList [ j ] = - 1 ;
2017-04-15 23:12:37 +00:00
statsMax = j - 11 + numextraemblems ;
2014-03-15 16:59:03 +00:00
statsLocation = 0 ;
if ( statsMax < 0 )
statsMax = 0 ;
2017-04-15 23:12:37 +00:00
M_SetupNextMenu ( & SP_LevelStatsDef ) ;
2014-03-15 16:59:03 +00:00
}
static void M_DrawStatsMaps ( int location )
{
2017-04-15 23:12:37 +00:00
INT32 y = 80 , i = - 1 ;
2014-03-15 16:59:03 +00:00
INT16 mnum ;
extraemblem_t * exemblem ;
2017-04-15 23:12:37 +00:00
boolean dotopname = true , dobottomarrow = ( location < statsMax ) ;
2014-03-15 16:59:03 +00:00
2017-04-15 14:42:03 +00:00
if ( location )
2017-07-04 12:17:29 +00:00
V_DrawString ( 10 , y - ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1A " ) ;
2014-03-15 16:59:03 +00:00
while ( statsMapList [ + + i ] ! = - 1 )
{
if ( location )
{
- - location ;
continue ;
}
2017-04-15 23:12:37 +00:00
else if ( dotopname )
{
V_DrawString ( 20 , y , V_GREENMAP , " LEVEL NAME " ) ;
V_DrawString ( 248 , y , V_GREENMAP , " EMBLEMS " ) ;
y + = 8 ;
dotopname = false ;
}
2014-03-15 16:59:03 +00:00
mnum = statsMapList [ i ] ;
M_DrawMapEmblems ( mnum + 1 , 292 , y ) ;
if ( mapheaderinfo [ mnum ] - > actnum ! = 0 )
V_DrawString ( 20 , y , V_YELLOWMAP , va ( " %s %d " , mapheaderinfo [ mnum ] - > lvlttl , mapheaderinfo [ mnum ] - > actnum ) ) ;
else
V_DrawString ( 20 , y , V_YELLOWMAP , mapheaderinfo [ mnum ] - > lvlttl ) ;
y + = 8 ;
if ( y > = BASEVIDHEIGHT - 8 )
2017-04-15 14:42:03 +00:00
goto bottomarrow ;
2014-03-15 16:59:03 +00:00
}
2017-04-15 23:12:37 +00:00
if ( dotopname & & ! location )
{
V_DrawString ( 20 , y , V_GREENMAP , " LEVEL NAME " ) ;
V_DrawString ( 248 , y , V_GREENMAP , " EMBLEMS " ) ;
y + = 8 ;
2014-03-15 16:59:03 +00:00
}
2017-04-15 23:12:37 +00:00
else if ( location )
- - location ;
2014-03-15 16:59:03 +00:00
// Extra Emblems
for ( i = - 2 ; i < numextraemblems ; + + i )
{
2017-04-15 23:12:37 +00:00
if ( i = = - 1 )
{
V_DrawString ( 20 , y , V_GREENMAP , " EXTRA EMBLEMS " ) ;
if ( location )
{
y + = 8 ;
location + + ;
}
}
2014-03-15 16:59:03 +00:00
if ( location )
{
- - location ;
continue ;
}
2017-04-15 23:12:37 +00:00
if ( i > = 0 )
2014-03-15 16:59:03 +00:00
{
exemblem = & extraemblems [ i ] ;
if ( exemblem - > collected )
2019-10-16 02:54:21 +00:00
V_DrawSmallMappedPatch ( 292 , y , 0 , W_CachePatchName ( M_GetExtraEmblemPatch ( exemblem , false ) , PU_CACHE ) ,
2014-03-15 16:59:03 +00:00
R_GetTranslationColormap ( TC_DEFAULT , M_GetExtraEmblemColor ( exemblem ) , GTC_CACHE ) ) ;
else
V_DrawSmallScaledPatch ( 292 , y , 0 , W_CachePatchName ( " NEEDIT " , PU_CACHE ) ) ;
V_DrawString ( 20 , y , V_YELLOWMAP , va ( " %s " , exemblem - > description ) ) ;
}
y + = 8 ;
if ( y > = BASEVIDHEIGHT - 8 )
2017-04-15 14:42:03 +00:00
goto bottomarrow ;
2014-03-15 16:59:03 +00:00
}
2017-04-15 14:42:03 +00:00
bottomarrow :
if ( dobottomarrow )
2017-07-04 12:17:29 +00:00
V_DrawString ( 10 , y - 8 + ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1B " ) ;
2014-03-15 16:59:03 +00:00
}
static void M_DrawLevelStats ( void )
{
char beststr [ 40 ] ;
tic_t besttime = 0 ;
UINT32 bestscore = 0 ;
UINT32 bestrings = 0 ;
INT32 i ;
2017-04-15 23:12:37 +00:00
INT32 mapsunfinished = 0 ;
boolean bestunfinished [ 3 ] = { false , false , false } ;
2014-03-15 16:59:03 +00:00
M_DrawMenuTitle ( ) ;
2017-04-15 23:12:37 +00:00
V_DrawString ( 20 , 24 , V_YELLOWMAP , " Total Play Time: " ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , 32 , 0 , va ( " %i hours, %i minutes, %i seconds " ,
2014-03-15 16:59:03 +00:00
G_TicsToHours ( totalplaytime ) ,
G_TicsToMinutes ( totalplaytime , false ) ,
G_TicsToSeconds ( totalplaytime ) ) ) ;
for ( i = 0 ; i < NUMMAPS ; i + + )
{
2017-04-15 23:12:37 +00:00
boolean mapunfinished = false ;
2014-03-15 16:59:03 +00:00
if ( ! mapheaderinfo [ i ] | | ! ( mapheaderinfo [ i ] - > menuflags & LF2_RECORDATTACK ) )
continue ;
if ( ! mainrecords [ i ] )
{
2017-04-15 23:12:37 +00:00
mapsunfinished + + ;
bestunfinished [ 0 ] = bestunfinished [ 1 ] = bestunfinished [ 2 ] = true ;
2014-03-15 16:59:03 +00:00
continue ;
}
if ( mainrecords [ i ] - > score > 0 )
bestscore + = mainrecords [ i ] - > score ;
else
2017-04-15 23:12:37 +00:00
mapunfinished = bestunfinished [ 0 ] = true ;
2014-03-15 16:59:03 +00:00
if ( mainrecords [ i ] - > time > 0 )
besttime + = mainrecords [ i ] - > time ;
else
2017-04-15 23:12:37 +00:00
mapunfinished = bestunfinished [ 1 ] = true ;
2014-03-15 16:59:03 +00:00
if ( mainrecords [ i ] - > rings > 0 )
bestrings + = mainrecords [ i ] - > rings ;
else
2017-04-15 23:12:37 +00:00
mapunfinished = bestunfinished [ 2 ] = true ;
2014-03-15 16:59:03 +00:00
2017-04-15 23:12:37 +00:00
if ( mapunfinished )
mapsunfinished + + ;
2014-03-15 16:59:03 +00:00
}
2017-04-15 23:12:37 +00:00
V_DrawString ( 20 , 48 , 0 , " Combined records: " ) ;
if ( mapsunfinished )
V_DrawString ( 20 , 56 , V_REDMAP , va ( " (%d unfinished) " , mapsunfinished ) ) ;
else
V_DrawString ( 20 , 56 , V_GREENMAP , " (complete) " ) ;
V_DrawString ( 36 , 64 , 0 , va ( " x %d/%d " , M_CountEmblems ( ) , numemblems + numextraemblems ) ) ;
V_DrawSmallScaledPatch ( 20 , 64 , 0 , W_CachePatchName ( " EMBLICON " , PU_STATIC ) ) ;
2014-03-15 16:59:03 +00:00
sprintf ( beststr , " %u " , bestscore ) ;
2017-04-15 23:12:37 +00:00
V_DrawString ( BASEVIDWIDTH / 2 , 48 , V_YELLOWMAP , " SCORE: " ) ;
V_DrawRightAlignedString ( BASEVIDWIDTH - 16 , 48 , ( bestunfinished [ 0 ] ? V_REDMAP : 0 ) , beststr ) ;
2014-03-15 16:59:03 +00:00
sprintf ( beststr , " %i:%02i:%02i.%02i " , G_TicsToHours ( besttime ) , G_TicsToMinutes ( besttime , false ) , G_TicsToSeconds ( besttime ) , G_TicsToCentiseconds ( besttime ) ) ;
2017-04-15 23:12:37 +00:00
V_DrawString ( BASEVIDWIDTH / 2 , 56 , V_YELLOWMAP , " TIME: " ) ;
V_DrawRightAlignedString ( BASEVIDWIDTH - 16 , 56 , ( bestunfinished [ 1 ] ? V_REDMAP : 0 ) , beststr ) ;
2014-03-15 16:59:03 +00:00
sprintf ( beststr , " %u " , bestrings ) ;
2017-04-15 23:12:37 +00:00
V_DrawString ( BASEVIDWIDTH / 2 , 64 , V_YELLOWMAP , " RINGS: " ) ;
V_DrawRightAlignedString ( BASEVIDWIDTH - 16 , 64 , ( bestunfinished [ 2 ] ? V_REDMAP : 0 ) , beststr ) ;
M_DrawStatsMaps ( statsLocation ) ;
2014-03-15 16:59:03 +00:00
}
2017-04-15 23:12:37 +00:00
// Handle statistics.
static void M_HandleLevelStats ( INT32 choice )
2014-03-15 16:59:03 +00:00
{
boolean exitmenu = false ; // exit to previous menu
switch ( choice )
{
2017-04-15 23:12:37 +00:00
case KEY_DOWNARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
if ( statsLocation < statsMax )
+ + statsLocation ;
2014-03-15 16:59:03 +00:00
break ;
2017-04-15 23:12:37 +00:00
case KEY_UPARROW :
2014-03-15 16:59:03 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2017-04-15 23:12:37 +00:00
if ( statsLocation )
- - statsLocation ;
break ;
case KEY_PGDN :
S_StartSound ( NULL , sfx_menu1 ) ;
statsLocation + = ( statsLocation + 13 > = statsMax ) ? statsMax - statsLocation : 13 ;
break ;
case KEY_PGUP :
2014-03-15 16:59:03 +00:00
S_StartSound ( NULL , sfx_menu1 ) ;
2017-04-15 23:12:37 +00:00
statsLocation - = ( statsLocation < 13 ) ? statsLocation : 13 ;
break ;
case KEY_ESCAPE :
exitmenu = true ;
2014-03-15 16:59:03 +00:00
break ;
}
if ( exitmenu )
{
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
// ===========
// MODE ATTACK
// ===========
// Drawing function for Time Attack
void M_DrawTimeAttackMenu ( void )
{
2019-10-16 02:54:21 +00:00
INT32 i , x , y , empatx , empaty , cursory = 0 ;
2014-03-15 16:59:03 +00:00
UINT16 dispstatus ;
2019-08-18 23:35:16 +00:00
patch_t * PictureOfUrFace ; // my WHAT
2019-10-16 02:54:21 +00:00
patch_t * empatch ;
2014-03-15 16:59:03 +00:00
2019-08-20 03:12:22 +00:00
M_SetMenuCurBackground ( " RECATKBG " ) ;
2014-03-15 16:59:03 +00:00
2019-07-16 04:07:55 +00:00
curbgxspeed = 0 ;
curbgyspeed = 18 ;
2014-03-15 16:59:03 +00:00
2019-09-08 02:57:20 +00:00
M_ChangeMenuMusic ( " _recat " , true ) ; // Eww, but needed for when user hits escape during demo playback
2014-03-15 16:59:03 +00:00
2018-11-20 22:28:26 +00:00
if ( curbgcolor > = 0 )
V_DrawFill ( 0 , 0 , BASEVIDWIDTH , BASEVIDHEIGHT , curbgcolor ) ;
else if ( ! curbghide | | ! titlemapinaction )
2019-08-20 03:41:06 +00:00
{
2018-11-25 20:08:12 +00:00
F_SkyScroll ( curbgxspeed , curbgyspeed , curbgname ) ;
2019-08-20 03:41:06 +00:00
// Draw and animate foreground
if ( ! strncmp ( " RECATKBG " , curbgname , 8 ) )
M_DrawRecordAttackForeground ( ) ;
}
2018-11-20 22:28:26 +00:00
if ( curfadevalue )
V_DrawFadeScreen ( 0xFF00 , curfadevalue ) ;
2014-03-15 16:59:03 +00:00
M_DrawMenuTitle ( ) ;
// draw menu (everything else goes on top of it)
// Sadly we can't just use generic mode menus because we need some extra hacks
x = currentMenu - > x ;
y = currentMenu - > y ;
for ( i = 0 ; i < currentMenu - > numitems ; + + i )
{
dispstatus = ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY ) ;
if ( dispstatus ! = IT_STRING & & dispstatus ! = IT_WHITESTRING )
continue ;
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
if ( i = = itemOn )
cursory = y ;
V_DrawString ( x , y , ( dispstatus = = IT_WHITESTRING ) ? V_YELLOWMAP : 0 , currentMenu - > menuitems [ i ] . text ) ;
// Cvar specific handling
if ( ( currentMenu - > menuitems [ i ] . status & IT_TYPE ) = = IT_CVAR )
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ;
INT32 soffset = 0 ;
// hack to keep the menu from overlapping the player icon
if ( currentMenu ! = & SP_TimeAttackDef )
soffset = 80 ;
// Should see nothing but strings
V_DrawString ( BASEVIDWIDTH - x - soffset - V_StringWidth ( cv - > string , 0 ) , y , V_YELLOWMAP , cv - > string ) ;
2017-07-04 12:17:29 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - x - soffset - 10 - V_StringWidth ( cv - > string , 0 ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x - soffset + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2014-03-15 16:59:03 +00:00
}
}
// DRAW THE SKULL CURSOR
V_DrawScaledPatch ( currentMenu - > x - 24 , cursory , 0 , W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
V_DrawString ( currentMenu - > x , cursory , V_YELLOWMAP , currentMenu - > menuitems [ itemOn ] . text ) ;
// Character face!
{
2019-09-12 01:18:03 +00:00
if ( skins [ cv_chooseskin . value - 1 ] . sprites [ SPR2_XTRA ] . numframes > = XTRA_CHARSEL + 1 )
A good and bad ending cutscene now exist.
Also:
* SPR2_XTRA - instead of defining lumpnames in S_SKIN, those kinds of assets can just be bundled into the spriteset. Required for ending cutscene stuff, I guess, but also done for HUD life icon and character select image (aside from Sonic&Tails, still SOC'd in).
* Minor oversights in SPR2 support corrected.
* Better evaluation, featuring ending assets.
* Intro has warping-in blackrock, reusing ending assets.
* Cutscene text now supports lowercase (intro and custom).
* Disable the asset-fucking "gamma correction" I put in over two years ago when implementing colour cube. (This is the only thing I could move into another branch if you MUST, but it's basically invisble in the diff so w/e.)
* Don't blank the screen if the top left pixel of a screen-covering patch is transparent. (Checked via nonzero topdelta for first column)
Bugs:
* OPENGL ONLY: The first ~20 frames of both endings are fucked. A little help here? Might be HWR_DrawFadeFill's fault, which I just created. OR it could be in f_finale, but I doubt it, since it doesn't appear in Software.
2019-07-27 23:32:57 +00:00
{
spritedef_t * sprdef = & skins [ cv_chooseskin . value - 1 ] . sprites [ SPR2_XTRA ] ;
2019-09-12 01:18:03 +00:00
spriteframe_t * sprframe = & sprdef - > spriteframes [ XTRA_CHARSEL ] ;
A good and bad ending cutscene now exist.
Also:
* SPR2_XTRA - instead of defining lumpnames in S_SKIN, those kinds of assets can just be bundled into the spriteset. Required for ending cutscene stuff, I guess, but also done for HUD life icon and character select image (aside from Sonic&Tails, still SOC'd in).
* Minor oversights in SPR2 support corrected.
* Better evaluation, featuring ending assets.
* Intro has warping-in blackrock, reusing ending assets.
* Cutscene text now supports lowercase (intro and custom).
* Disable the asset-fucking "gamma correction" I put in over two years ago when implementing colour cube. (This is the only thing I could move into another branch if you MUST, but it's basically invisble in the diff so w/e.)
* Don't blank the screen if the top left pixel of a screen-covering patch is transparent. (Checked via nonzero topdelta for first column)
Bugs:
* OPENGL ONLY: The first ~20 frames of both endings are fucked. A little help here? Might be HWR_DrawFadeFill's fault, which I just created. OR it could be in f_finale, but I doubt it, since it doesn't appear in Software.
2019-07-27 23:32:57 +00:00
PictureOfUrFace = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
}
else
PictureOfUrFace = W_CachePatchName ( " MISSING " , PU_CACHE ) ;
2014-03-15 16:59:03 +00:00
if ( PictureOfUrFace - > width > = 256 )
V_DrawTinyScaledPatch ( 224 , 120 , 0 , PictureOfUrFace ) ;
else
V_DrawSmallScaledPatch ( 224 , 120 , 0 , PictureOfUrFace ) ;
}
// Level record list
if ( cv_nextmap . value )
{
emblem_t * em ;
INT32 yHeight ;
2017-01-29 22:00:07 +00:00
patch_t * PictureOfLevel ;
lumpnum_t lumpnum ;
char beststr [ 40 ] ;
2019-10-15 05:55:50 +00:00
char reqscore [ 40 ] , reqtime [ 40 ] , reqrings [ 40 ] ;
2014-03-15 16:59:03 +00:00
2019-11-04 02:43:09 +00:00
strcpy ( reqscore , " \0 " ) ;
strcpy ( reqtime , " \0 " ) ;
strcpy ( reqrings , " \0 " ) ;
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( 32 - lsheadingheight / 2 , cv_nextmap . string , true , false ) ;
2017-01-29 19:25:43 +00:00
2017-01-29 22:00:07 +00:00
// A 160x100 image of the level as entry MAPxxP
lumpnum = W_CheckNumForName ( va ( " %sP " , G_BuildMapName ( cv_nextmap . value ) ) ) ;
if ( lumpnum ! = LUMPERROR )
PictureOfLevel = W_CachePatchName ( va ( " %sP " , G_BuildMapName ( cv_nextmap . value ) ) , PU_CACHE ) ;
else
PictureOfLevel = W_CachePatchName ( " BLANKLVL " , PU_CACHE ) ;
2019-10-06 21:45:42 +00:00
y = 32 + lsheadingheight ;
2019-10-16 02:54:21 +00:00
V_DrawSmallScaledPatch ( 216 , y , 0 , PictureOfLevel ) ;
2014-03-15 16:59:03 +00:00
2019-10-06 21:45:42 +00:00
2019-10-16 02:54:21 +00:00
if ( currentMenu = = & SP_TimeAttackDef )
2019-10-06 21:45:42 +00:00
{
2019-10-16 02:54:21 +00:00
if ( itemOn = = talevel )
{
/* Draw arrows !! */
y = y + 25 - 4 ;
V_DrawCharacter ( 216 - 10 - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( 216 + 80 + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
// Draw press ESC to exit string on main record attack menu
V_DrawString ( 104 - 72 , 180 , V_TRANSLUCENT , M_GetText ( " Press ESC to exit " ) ) ;
2019-10-06 21:45:42 +00:00
}
2014-03-15 16:59:03 +00:00
2019-10-15 05:55:50 +00:00
em = M_GetLevelEmblems ( cv_nextmap . value ) ;
// Draw record emblems.
while ( em )
{
switch ( em - > type )
{
case ET_SCORE :
2019-10-16 02:54:21 +00:00
yHeight = 33 ;
sprintf ( reqscore , " (%u) " , em - > var ) ;
2019-10-15 05:55:50 +00:00
break ;
case ET_TIME :
2019-10-16 02:54:21 +00:00
yHeight = 53 ;
sprintf ( reqtime , " (%i:%02i.%02i) " , G_TicsToMinutes ( ( tic_t ) em - > var , true ) ,
2019-10-15 05:55:50 +00:00
G_TicsToSeconds ( ( tic_t ) em - > var ) ,
G_TicsToCentiseconds ( ( tic_t ) em - > var ) ) ;
break ;
case ET_RINGS :
2019-10-16 02:54:21 +00:00
yHeight = 73 ;
sprintf ( reqrings , " (%u) " , em - > var ) ;
2019-10-15 05:55:50 +00:00
break ;
default :
goto skipThisOne ;
}
2019-10-16 02:54:21 +00:00
empatch = W_CachePatchName ( M_GetEmblemPatch ( em , true ) , PU_CACHE ) ;
empatx = SHORT ( empatch - > leftoffset ) / 2 ;
empaty = SHORT ( empatch - > topoffset ) / 2 ;
2019-10-15 05:55:50 +00:00
if ( em - > collected )
2019-10-16 02:54:21 +00:00
V_DrawSmallMappedPatch ( 104 + 76 + empatx , yHeight + lsheadingheight / 2 + empaty , 0 , empatch ,
2019-10-15 05:55:50 +00:00
R_GetTranslationColormap ( TC_DEFAULT , M_GetEmblemColor ( em ) , GTC_CACHE ) ) ;
else
2019-10-16 02:54:21 +00:00
V_DrawSmallScaledPatch ( 104 + 76 , yHeight + lsheadingheight / 2 , 0 , W_CachePatchName ( " NEEDITL " , PU_CACHE ) ) ;
2019-10-15 05:55:50 +00:00
skipThisOne :
em = M_GetLevelEmblems ( - 1 ) ;
}
2014-03-15 16:59:03 +00:00
if ( ! mainrecords [ cv_nextmap . value - 1 ] | | ! mainrecords [ cv_nextmap . value - 1 ] - > score )
sprintf ( beststr , " (none) " ) ;
else
sprintf ( beststr , " %u " , mainrecords [ cv_nextmap . value - 1 ] - > score ) ;
2019-10-16 02:54:21 +00:00
V_DrawString ( 104 - 72 , 33 + lsheadingheight / 2 , V_YELLOWMAP , " SCORE: " ) ;
V_DrawRightAlignedString ( 104 + 64 , 33 + lsheadingheight / 2 , V_ALLOWLOWERCASE , beststr ) ;
V_DrawRightAlignedString ( 104 + 72 , 43 + lsheadingheight / 2 , V_ALLOWLOWERCASE , reqscore ) ;
2014-03-15 16:59:03 +00:00
if ( ! mainrecords [ cv_nextmap . value - 1 ] | | ! mainrecords [ cv_nextmap . value - 1 ] - > time )
sprintf ( beststr , " (none) " ) ;
else
sprintf ( beststr , " %i:%02i.%02i " , G_TicsToMinutes ( mainrecords [ cv_nextmap . value - 1 ] - > time , true ) ,
G_TicsToSeconds ( mainrecords [ cv_nextmap . value - 1 ] - > time ) ,
G_TicsToCentiseconds ( mainrecords [ cv_nextmap . value - 1 ] - > time ) ) ;
2019-10-16 02:54:21 +00:00
V_DrawString ( 104 - 72 , 53 + lsheadingheight / 2 , V_YELLOWMAP , " TIME: " ) ;
V_DrawRightAlignedString ( 104 + 64 , 53 + lsheadingheight / 2 , V_ALLOWLOWERCASE , beststr ) ;
V_DrawRightAlignedString ( 104 + 72 , 63 + lsheadingheight / 2 , V_ALLOWLOWERCASE , reqtime ) ;
2014-03-15 16:59:03 +00:00
if ( ! mainrecords [ cv_nextmap . value - 1 ] | | ! mainrecords [ cv_nextmap . value - 1 ] - > rings )
sprintf ( beststr , " (none) " ) ;
else
sprintf ( beststr , " %hu " , mainrecords [ cv_nextmap . value - 1 ] - > rings ) ;
2019-10-16 02:54:21 +00:00
V_DrawString ( 104 - 72 , 73 + lsheadingheight / 2 , V_YELLOWMAP , " RINGS: " ) ;
2014-03-15 16:59:03 +00:00
2019-10-16 02:54:21 +00:00
if ( ! mainrecords [ cv_nextmap . value - 1 ] | | ! mainrecords [ cv_nextmap . value - 1 ] - > gotperfect )
V_DrawRightAlignedString ( 104 + 64 , 73 + lsheadingheight / 2 , V_ALLOWLOWERCASE , beststr ) ;
else
V_DrawRightAlignedString ( 104 + 64 , 73 + lsheadingheight / 2 , V_ALLOWLOWERCASE | V_YELLOWMAP , beststr ) ;
2014-03-15 16:59:03 +00:00
2019-10-16 02:54:21 +00:00
V_DrawRightAlignedString ( 104 + 72 , 83 + lsheadingheight / 2 , V_ALLOWLOWERCASE , reqrings ) ;
2014-03-15 16:59:03 +00:00
}
2017-01-29 19:25:43 +00:00
// ALWAYS DRAW level and skin even when not on this menu!
2014-03-15 16:59:03 +00:00
if ( currentMenu ! = & SP_TimeAttackDef )
{
consvar_t * ncv ;
x = SP_TimeAttackDef . x ;
y = SP_TimeAttackDef . y ;
2017-04-04 20:03:35 +00:00
V_DrawString ( x , y + SP_TimeAttackMenu [ talevel ] . alphaKey , V_TRANSLUCENT , SP_TimeAttackMenu [ talevel ] . text ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
ncv = ( consvar_t * ) SP_TimeAttackMenu [ taplayer ] . itemaction ;
V_DrawString ( x , y + SP_TimeAttackMenu [ taplayer ] . alphaKey , V_TRANSLUCENT , SP_TimeAttackMenu [ taplayer ] . text ) ;
V_DrawString ( BASEVIDWIDTH - x - V_StringWidth ( ncv - > string , 0 ) , y + SP_TimeAttackMenu [ taplayer ] . alphaKey , V_YELLOWMAP | V_TRANSLUCENT , ncv - > string ) ;
2014-03-15 16:59:03 +00:00
}
}
2019-10-06 21:11:16 +00:00
static void M_HandleTimeAttackLevelSelect ( INT32 choice )
{
switch ( choice )
{
case KEY_DOWNARROW :
M_NextOpt ( ) ;
break ;
case KEY_UPARROW :
M_PrevOpt ( ) ;
break ;
case KEY_LEFTARROW :
CV_AddValue ( & cv_nextmap , - 1 ) ;
break ;
case KEY_RIGHTARROW :
CV_AddValue ( & cv_nextmap , 1 ) ;
break ;
case KEY_ENTER :
M_TimeAttackLevelSelect ( 0 ) ;
break ;
case KEY_ESCAPE :
noFurtherInput = true ;
M_GoBack ( 0 ) ;
return ;
2019-10-12 13:42:03 +00:00
default :
return ;
2019-10-06 21:11:16 +00:00
}
S_StartSound ( NULL , sfx_menu1 ) ;
}
2017-01-28 13:13:03 +00:00
static void M_TimeAttackLevelSelect ( INT32 choice )
2014-03-15 16:59:03 +00:00
{
( void ) choice ;
2017-02-10 14:54:05 +00:00
SP_TimeAttackLevelSelectDef . prevMenu = currentMenu ;
2017-01-28 13:13:03 +00:00
M_SetupNextMenu ( & SP_TimeAttackLevelSelectDef ) ;
2014-03-15 16:59:03 +00:00
}
// Going to Time Attack menu...
static void M_TimeAttack ( INT32 choice )
{
( void ) choice ;
2017-02-10 14:54:05 +00:00
SP_TimeAttackDef . prevMenu = & MainDef ;
2014-03-15 16:59:03 +00:00
levellistmode = LLM_RECORDATTACK ; // Don't be dependent on cv_newgametype
2017-09-15 19:34:46 +00:00
if ( ! M_PrepareLevelPlatter ( - 1 , true ) )
2014-03-15 16:59:03 +00:00
{
M_StartMessage ( M_GetText ( " No record-attackable levels found. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
M_PatchSkinNameTable ( ) ;
2018-11-17 21:32:30 +00:00
G_SetGamestate ( GS_TIMEATTACK ) ; // do this before M_SetupNextMenu so that menu meta state knows that we're switching
2019-07-14 21:28:19 +00:00
titlemapinaction = TITLEMAP_OFF ; // Nope don't give us HOMs please
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & SP_TimeAttackDef ) ;
2017-02-10 14:54:05 +00:00
if ( ! M_CanShowLevelInList ( cv_nextmap . value - 1 , - 1 ) & & levelselect . rows [ 0 ] . maplist [ 0 ] )
CV_SetValue ( & cv_nextmap , levelselect . rows [ 0 ] . maplist [ 0 ] ) ;
else
Nextmap_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
2017-01-28 13:13:03 +00:00
itemOn = tastart ; // "Start" is selected.
2014-03-15 16:59:03 +00:00
}
// Drawing function for Nights Attack
void M_DrawNightsAttackMenu ( void )
{
2017-01-29 19:25:43 +00:00
INT32 i , x , y , cursory = 0 ;
UINT16 dispstatus ;
2014-03-15 16:59:03 +00:00
2019-08-20 03:12:22 +00:00
M_SetMenuCurBackground ( " NTSATKBG " ) ;
2014-03-15 16:59:03 +00:00
2019-09-08 02:57:20 +00:00
M_ChangeMenuMusic ( " _nitat " , true ) ; // Eww, but needed for when user hits escape during demo playback
2018-11-17 06:21:21 +00:00
2019-08-20 03:12:22 +00:00
M_DrawNightsAttackBackground ( ) ;
2018-11-20 22:28:26 +00:00
if ( curfadevalue )
V_DrawFadeScreen ( 0xFF00 , curfadevalue ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
M_DrawMenuTitle ( ) ;
2014-03-15 16:59:03 +00:00
// draw menu (everything else goes on top of it)
2017-01-29 19:25:43 +00:00
// Sadly we can't just use generic mode menus because we need some extra hacks
x = currentMenu - > x ;
y = currentMenu - > y ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
for ( i = 0 ; i < currentMenu - > numitems ; + + i )
{
dispstatus = ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY ) ;
if ( dispstatus ! = IT_STRING & & dispstatus ! = IT_WHITESTRING )
continue ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
if ( i = = itemOn )
cursory = y ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
V_DrawString ( x , y , ( dispstatus = = IT_WHITESTRING ) ? V_YELLOWMAP : 0 , currentMenu - > menuitems [ i ] . text ) ;
// Cvar specific handling
if ( ( currentMenu - > menuitems [ i ] . status & IT_TYPE ) = = IT_CVAR )
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ;
INT32 soffset = 0 ;
// hack to keep the menu from overlapping the overall grade icon
if ( currentMenu ! = & SP_NightsAttackDef )
soffset = 80 ;
// Should see nothing but strings
V_DrawString ( BASEVIDWIDTH - x - soffset - V_StringWidth ( cv - > string , 0 ) , y , V_YELLOWMAP , cv - > string ) ;
2017-07-04 12:17:29 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - x - soffset - 10 - V_StringWidth ( cv - > string , 0 ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x - soffset + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2017-01-29 19:25:43 +00:00
}
}
// DRAW THE SKULL CURSOR
V_DrawScaledPatch ( currentMenu - > x - 24 , cursory , 0 , W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
V_DrawString ( currentMenu - > x , cursory , V_YELLOWMAP , currentMenu - > menuitems [ itemOn ] . text ) ;
2014-03-15 16:59:03 +00:00
// Level record list
if ( cv_nextmap . value )
{
emblem_t * em ;
INT32 yHeight ;
2017-01-29 22:00:07 +00:00
patch_t * PictureOfLevel ;
lumpnum_t lumpnum ;
char beststr [ 40 ] ;
2014-03-15 16:59:03 +00:00
2019-08-20 03:12:22 +00:00
//UINT8 bestoverall = G_GetBestNightsGrade(cv_nextmap.value, 0);
2014-03-15 16:59:03 +00:00
UINT8 bestgrade = G_GetBestNightsGrade ( cv_nextmap . value , cv_dummymares . value ) ;
UINT32 bestscore = G_GetBestNightsScore ( cv_nextmap . value , cv_dummymares . value ) ;
tic_t besttime = G_GetBestNightsTime ( cv_nextmap . value , cv_dummymares . value ) ;
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( 32 - lsheadingheight / 2 , cv_nextmap . string , true , false ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 22:00:07 +00:00
// A 160x100 image of the level as entry MAPxxP
lumpnum = W_CheckNumForName ( va ( " %sP " , G_BuildMapName ( cv_nextmap . value ) ) ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 22:00:07 +00:00
if ( lumpnum ! = LUMPERROR )
PictureOfLevel = W_CachePatchName ( va ( " %sP " , G_BuildMapName ( cv_nextmap . value ) ) , PU_CACHE ) ;
else
PictureOfLevel = W_CachePatchName ( " BLANKLVL " , PU_CACHE ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 22:00:07 +00:00
V_DrawSmallScaledPatch ( 208 , 32 + lsheadingheight , 0 , PictureOfLevel ) ;
2014-03-15 16:59:03 +00:00
2019-08-20 03:12:22 +00:00
// Super Sonic
M_DrawNightsAttackSuperSonic ( ) ;
//if (P_HasGrades(cv_nextmap.value, 0))
// V_DrawScaledPatch(235 - (SHORT((ngradeletters[bestoverall])->width)*3)/2, 135, 0, ngradeletters[bestoverall]);
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
if ( P_HasGrades ( cv_nextmap . value , cv_dummymares . value ) )
2017-01-30 20:55:31 +00:00
{ //make bigger again
2017-01-29 19:25:43 +00:00
V_DrawString ( 104 - 72 , 48 + lsheadingheight / 2 , V_YELLOWMAP , " BEST GRADE: " ) ;
2017-01-30 20:55:31 +00:00
V_DrawSmallScaledPatch ( 104 + 72 - ( ngradeletters [ bestgrade ] - > width / 2 ) ,
48 + lsheadingheight / 2 + 8 - ( ngradeletters [ bestgrade ] - > height / 2 ) ,
2017-01-29 19:25:43 +00:00
0 , ngradeletters [ bestgrade ] ) ;
}
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
if ( ! bestscore )
sprintf ( beststr , " (none) " ) ;
else
sprintf ( beststr , " %u " , bestscore ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
V_DrawString ( 104 - 72 , 58 + lsheadingheight / 2 , V_YELLOWMAP , " BEST SCORE: " ) ;
V_DrawRightAlignedString ( 104 + 72 , 58 + lsheadingheight / 2 , V_ALLOWLOWERCASE , beststr ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
if ( besttime = = UINT32_MAX )
sprintf ( beststr , " (none) " ) ;
else
sprintf ( beststr , " %i:%02i.%02i " , G_TicsToMinutes ( besttime , true ) ,
G_TicsToSeconds ( besttime ) ,
G_TicsToCentiseconds ( besttime ) ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
V_DrawString ( 104 - 72 , 68 + lsheadingheight / 2 , V_YELLOWMAP , " BEST TIME: " ) ;
V_DrawRightAlignedString ( 104 + 72 , 68 + lsheadingheight / 2 , V_ALLOWLOWERCASE , beststr ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
if ( cv_dummymares . value = = 0 ) {
// Draw record emblems.
em = M_GetLevelEmblems ( cv_nextmap . value ) ;
while ( em )
{
switch ( em - > type )
2014-03-15 16:59:03 +00:00
{
2017-01-29 19:25:43 +00:00
case ET_NGRADE : yHeight = 48 ; break ;
case ET_NTIME : yHeight = 68 ; break ;
default :
goto skipThisOne ;
2014-11-12 00:55:07 +00:00
}
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
if ( em - > collected )
2019-10-16 02:54:21 +00:00
V_DrawSmallMappedPatch ( 104 + 38 , yHeight + lsheadingheight / 2 , 0 , W_CachePatchName ( M_GetEmblemPatch ( em , false ) , PU_CACHE ) ,
2017-01-29 19:25:43 +00:00
R_GetTranslationColormap ( TC_DEFAULT , M_GetEmblemColor ( em ) , GTC_CACHE ) ) ;
else
2019-08-20 03:12:22 +00:00
V_DrawSmallScaledPatch ( 104 + 38 , yHeight + lsheadingheight / 2 , 0 , W_CachePatchName ( " NEEDIT " , PU_CACHE ) ) ;
2014-03-15 16:59:03 +00:00
2017-01-29 19:25:43 +00:00
skipThisOne :
em = M_GetLevelEmblems ( - 1 ) ;
2014-03-15 16:59:03 +00:00
}
}
}
2017-01-29 19:25:43 +00:00
2019-10-16 22:00:54 +00:00
// Draw press ESC to exit string on main nights attack menu
if ( currentMenu = = & SP_NightsAttackDef )
V_DrawString ( 104 - 72 , 180 , V_TRANSLUCENT , M_GetText ( " Press ESC to exit " ) ) ;
2017-01-29 19:25:43 +00:00
// ALWAYS DRAW level even when not on this menu!
if ( currentMenu ! = & SP_NightsAttackDef )
2017-04-04 20:03:35 +00:00
V_DrawString ( SP_NightsAttackDef . x , SP_NightsAttackDef . y + SP_TimeAttackMenu [ nalevel ] . alphaKey , V_TRANSLUCENT , SP_NightsAttackMenu [ nalevel ] . text ) ;
2014-03-15 16:59:03 +00:00
}
2017-01-28 13:13:03 +00:00
static void M_NightsAttackLevelSelect ( INT32 choice )
2014-03-15 16:59:03 +00:00
{
( void ) choice ;
2017-02-10 14:54:05 +00:00
SP_NightsAttackLevelSelectDef . prevMenu = currentMenu ;
2017-01-28 13:13:03 +00:00
M_SetupNextMenu ( & SP_NightsAttackLevelSelectDef ) ;
2014-03-15 16:59:03 +00:00
}
// Going to Nights Attack menu...
static void M_NightsAttack ( INT32 choice )
{
( void ) choice ;
2017-02-10 14:54:05 +00:00
SP_NightsAttackDef . prevMenu = & MainDef ;
2014-03-15 16:59:03 +00:00
levellistmode = LLM_NIGHTSATTACK ; // Don't be dependent on cv_newgametype
2017-09-15 19:34:46 +00:00
if ( ! M_PrepareLevelPlatter ( - 1 , true ) )
2014-03-15 16:59:03 +00:00
{
M_StartMessage ( M_GetText ( " No NiGHTS-attackable levels found. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
// This is really just to make sure Sonic is the played character, just in case
M_PatchSkinNameTable ( ) ;
2019-10-03 00:28:02 +00:00
ntssupersonic [ 0 ] = W_CachePatchName ( " NTSSONC1 " , PU_CACHE ) ;
ntssupersonic [ 1 ] = W_CachePatchName ( " NTSSONC2 " , PU_CACHE ) ;
2018-11-17 21:32:30 +00:00
G_SetGamestate ( GS_TIMEATTACK ) ; // do this before M_SetupNextMenu so that menu meta state knows that we're switching
2019-07-14 21:28:19 +00:00
titlemapinaction = TITLEMAP_OFF ; // Nope don't give us HOMs please
2019-09-08 02:00:38 +00:00
M_SetupNextMenu ( & SP_NightsAttackDef ) ;
2017-02-10 14:54:05 +00:00
if ( ! M_CanShowLevelInList ( cv_nextmap . value - 1 , - 1 ) & & levelselect . rows [ 0 ] . maplist [ 0 ] )
CV_SetValue ( & cv_nextmap , levelselect . rows [ 0 ] . maplist [ 0 ] ) ;
else
Nextmap_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
2017-01-28 13:13:03 +00:00
itemOn = nastart ; // "Start" is selected.
2014-03-15 16:59:03 +00:00
}
// Player has selected the "START" from the nights attack screen
static void M_ChooseNightsAttack ( INT32 choice )
{
2014-11-12 00:55:07 +00:00
char nameofdemo [ 256 ] ;
2014-03-15 16:59:03 +00:00
( void ) choice ;
emeralds = 0 ;
2019-08-24 17:25:27 +00:00
memset ( & luabanks , 0 , sizeof ( luabanks ) ) ;
2014-03-15 16:59:03 +00:00
M_ClearMenus ( true ) ;
modeattacking = ATTACKING_NIGHTS ;
2014-11-12 00:55:07 +00:00
I_mkdir ( va ( " %s " PATHSEP " replay " , srb2home ) , 0755 ) ;
I_mkdir ( va ( " %s " PATHSEP " replay " PATHSEP " %s " , srb2home , timeattackfolder ) , 0755 ) ;
snprintf ( nameofdemo , sizeof nameofdemo , " replay " PATHSEP " %s " PATHSEP " %s-last " , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ;
if ( ! cv_autorecord . value )
remove ( va ( " %s " PATHSEP " %s.lmp " , srb2home , nameofdemo ) ) ;
else
G_RecordDemo ( nameofdemo ) ;
G_DeferedInitNew ( false , G_BuildMapName ( cv_nextmap . value ) , 0 , false , false ) ;
2014-03-15 16:59:03 +00:00
}
// Player has selected the "START" from the time attack screen
static void M_ChooseTimeAttack ( INT32 choice )
{
char * gpath ;
const size_t glen = strlen ( " replay " ) + 1 + strlen ( timeattackfolder ) + 1 + strlen ( " MAPXX " ) + 1 ;
char nameofdemo [ 256 ] ;
( void ) choice ;
emeralds = 0 ;
2019-08-24 17:25:27 +00:00
memset ( & luabanks , 0 , sizeof ( luabanks ) ) ;
2014-03-15 16:59:03 +00:00
M_ClearMenus ( true ) ;
modeattacking = ATTACKING_RECORD ;
I_mkdir ( va ( " %s " PATHSEP " replay " , srb2home ) , 0755 ) ;
I_mkdir ( va ( " %s " PATHSEP " replay " PATHSEP " %s " , srb2home , timeattackfolder ) , 0755 ) ;
if ( ( gpath = malloc ( glen ) ) = = NULL )
I_Error ( " Out of memory for replay filepath \n " ) ;
sprintf ( gpath , " replay " PATHSEP " %s " PATHSEP " %s " , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ;
2017-10-15 11:35:49 +00:00
snprintf ( nameofdemo , sizeof nameofdemo , " %s-%s-last " , gpath , skins [ cv_chooseskin . value - 1 ] . name ) ;
2014-03-15 16:59:03 +00:00
if ( ! cv_autorecord . value )
remove ( va ( " %s " PATHSEP " %s.lmp " , srb2home , nameofdemo ) ) ;
else
G_RecordDemo ( nameofdemo ) ;
G_DeferedInitNew ( false , G_BuildMapName ( cv_nextmap . value ) , ( UINT8 ) ( cv_chooseskin . value - 1 ) , false , false ) ;
}
// Player has selected the "REPLAY" from the time attack screen
static void M_ReplayTimeAttack ( INT32 choice )
{
const char * which ;
M_ClearMenus ( true ) ;
modeattacking = ATTACKING_RECORD ; // set modeattacking before G_DoPlayDemo so the map loader knows
2014-11-12 00:55:07 +00:00
if ( currentMenu = = & SP_ReplayDef )
{
switch ( choice ) {
default :
case 0 : // best score
which = " score-best " ;
break ;
case 1 : // best time
which = " time-best " ;
break ;
case 2 : // best rings
which = " rings-best " ;
break ;
case 3 : // last
which = " last " ;
break ;
case 4 : // guest
// srb2/replay/main/map01-guest.lmp
G_DoPlayDemo ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-guest.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ) ;
return ;
}
// srb2/replay/main/map01-sonic-time-best.lmp
2017-10-15 11:35:49 +00:00
G_DoPlayDemo ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-%s-%s.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) , skins [ cv_chooseskin . value - 1 ] . name , which ) ) ;
2014-11-12 00:55:07 +00:00
}
else if ( currentMenu = = & SP_NightsReplayDef )
{
switch ( choice ) {
default :
case 0 : // best score
which = " score-best " ;
break ;
case 1 : // best time
which = " time-best " ;
break ;
case 2 : // last
which = " last " ;
break ;
case 3 : // guest
which = " guest " ;
break ;
}
// srb2/replay/main/map01-score-best.lmp
G_DoPlayDemo ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-%s.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) , which ) ) ;
2014-03-15 16:59:03 +00:00
}
}
static void M_EraseGuest ( INT32 choice )
{
const char * rguest = va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-guest.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ;
( void ) choice ;
if ( FIL_FileExists ( rguest ) )
remove ( rguest ) ;
2014-11-12 00:55:07 +00:00
if ( currentMenu = = & SP_NightsGuestReplayDef )
M_SetupNextMenu ( & SP_NightsAttackDef ) ;
else
M_SetupNextMenu ( & SP_TimeAttackDef ) ;
2017-02-05 21:20:32 +00:00
Nextmap_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
M_StartMessage ( M_GetText ( " Guest replay data erased. \n " ) , NULL , MM_NOTHING ) ;
}
2014-11-12 00:55:07 +00:00
static void M_OverwriteGuest ( const char * which , boolean nights )
2014-03-15 16:59:03 +00:00
{
char * rguest = Z_StrDup ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-guest.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ) ;
UINT8 * buf ;
2014-11-12 00:55:07 +00:00
size_t len ;
if ( ! nights )
2017-10-15 11:35:49 +00:00
len = FIL_ReadFile ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-%s-%s.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) , skins [ cv_chooseskin . value - 1 ] . name , which ) , & buf ) ;
2014-11-12 00:55:07 +00:00
else
len = FIL_ReadFile ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-%s.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) , which ) , & buf ) ;
2014-03-15 16:59:03 +00:00
if ( ! len ) {
return ;
}
if ( FIL_FileExists ( rguest ) ) {
M_StopMessage ( 0 ) ;
remove ( rguest ) ;
}
FIL_WriteFile ( rguest , buf , len ) ;
Z_Free ( rguest ) ;
2014-11-12 00:55:07 +00:00
if ( currentMenu = = & SP_NightsGuestReplayDef )
M_SetupNextMenu ( & SP_NightsAttackDef ) ;
else
M_SetupNextMenu ( & SP_TimeAttackDef ) ;
2017-02-05 21:20:32 +00:00
Nextmap_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
M_StartMessage ( M_GetText ( " Guest replay data saved. \n " ) , NULL , MM_NOTHING ) ;
}
static void M_OverwriteGuest_Time ( INT32 choice )
{
( void ) choice ;
2014-11-12 00:55:07 +00:00
M_OverwriteGuest ( " time-best " , currentMenu = = & SP_NightsGuestReplayDef ) ;
2014-03-15 16:59:03 +00:00
}
static void M_OverwriteGuest_Score ( INT32 choice )
{
( void ) choice ;
2014-11-12 00:55:07 +00:00
M_OverwriteGuest ( " score-best " , currentMenu = = & SP_NightsGuestReplayDef ) ;
2014-03-15 16:59:03 +00:00
}
static void M_OverwriteGuest_Rings ( INT32 choice )
{
( void ) choice ;
2014-11-12 00:55:07 +00:00
M_OverwriteGuest ( " rings-best " , false ) ;
2014-03-15 16:59:03 +00:00
}
static void M_OverwriteGuest_Last ( INT32 choice )
{
( void ) choice ;
2014-11-12 00:55:07 +00:00
M_OverwriteGuest ( " last " , currentMenu = = & SP_NightsGuestReplayDef ) ;
2014-03-15 16:59:03 +00:00
}
static void M_SetGuestReplay ( INT32 choice )
{
void ( * which ) ( INT32 ) ;
2014-11-12 00:55:07 +00:00
if ( currentMenu = = & SP_NightsGuestReplayDef & & choice > = 2 )
choice + + ; // skip best rings
2014-03-15 16:59:03 +00:00
switch ( choice )
{
case 0 : // best score
which = M_OverwriteGuest_Score ;
break ;
case 1 : // best time
which = M_OverwriteGuest_Time ;
break ;
case 2 : // best rings
which = M_OverwriteGuest_Rings ;
break ;
case 3 : // last
which = M_OverwriteGuest_Last ;
break ;
case 4 : // guest
default :
M_StartMessage ( M_GetText ( " Are you sure you want to \n delete the guest replay data? \n \n (Press 'Y' to confirm) \n " ) , M_EraseGuest , MM_YESNO ) ;
return ;
}
if ( FIL_FileExists ( va ( " %s " PATHSEP " replay " PATHSEP " %s " PATHSEP " %s-guest.lmp " , srb2home , timeattackfolder , G_BuildMapName ( cv_nextmap . value ) ) ) )
M_StartMessage ( M_GetText ( " Are you sure you want to \n overwrite the guest replay data? \n \n (Press 'Y' to confirm) \n " ) , which , MM_YESNO ) ;
else
which ( 0 ) ;
}
2018-06-13 23:58:28 +00:00
void M_ModeAttackRetry ( INT32 choice )
2014-03-15 16:59:03 +00:00
{
( void ) choice ;
2018-06-13 23:58:28 +00:00
// todo -- maybe seperate this out and G_SetRetryFlag() here instead? is just calling this from the menu 100% safe?
2014-11-12 00:55:07 +00:00
G_CheckDemoStatus ( ) ; // Cancel recording
if ( modeattacking = = ATTACKING_RECORD )
2014-03-15 16:59:03 +00:00
M_ChooseTimeAttack ( 0 ) ;
else if ( modeattacking = = ATTACKING_NIGHTS )
M_ChooseNightsAttack ( 0 ) ;
}
static void M_ModeAttackEndGame ( INT32 choice )
{
( void ) choice ;
2014-11-12 00:55:07 +00:00
G_CheckDemoStatus ( ) ; // Cancel recording
2014-03-15 16:59:03 +00:00
2014-11-12 00:55:07 +00:00
if ( gamestate = = GS_LEVEL | | gamestate = = GS_INTERMISSION )
Command_ExitGame_f ( ) ;
2014-03-15 16:59:03 +00:00
2014-11-12 00:55:07 +00:00
M_StartControlPanel ( ) ;
switch ( modeattacking )
2014-03-15 16:59:03 +00:00
{
2014-11-12 00:55:07 +00:00
default :
case ATTACKING_RECORD :
currentMenu = & SP_TimeAttackDef ;
2018-11-25 20:08:12 +00:00
wipetypepost = menupres [ MN_SP_TIMEATTACK ] . enterwipe ;
2014-11-12 00:55:07 +00:00
break ;
case ATTACKING_NIGHTS :
2014-03-15 16:59:03 +00:00
currentMenu = & SP_NightsAttackDef ;
2018-11-25 20:08:12 +00:00
wipetypepost = menupres [ MN_SP_NIGHTSATTACK ] . enterwipe ;
2014-11-12 00:55:07 +00:00
break ;
2014-03-15 16:59:03 +00:00
}
2014-11-12 00:55:07 +00:00
itemOn = currentMenu - > lastOn ;
G_SetGamestate ( GS_TIMEATTACK ) ;
modeattacking = ATTACKING_NONE ;
2018-11-25 20:08:12 +00:00
M_ChangeMenuMusic ( " _title " , true ) ;
2017-02-05 21:20:32 +00:00
Nextmap_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
}
// ========
// END GAME
// ========
static void M_ExitGameResponse ( INT32 ch )
{
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
//Command_ExitGame_f();
G_SetExitGameFlag ( ) ;
M_ClearMenus ( true ) ;
}
static void M_EndGame ( INT32 choice )
{
( void ) choice ;
if ( demoplayback | | demorecording )
return ;
if ( ! Playing ( ) )
return ;
M_StartMessage ( M_GetText ( " Are you sure you want to end the game? \n \n (Press 'Y' to confirm) \n " ) , M_ExitGameResponse , MM_YESNO ) ;
}
//===========================================================================
// Connect Menu
//===========================================================================
# define SERVERHEADERHEIGHT 44
# define SERVERLINEHEIGHT 12
# define S_LINEY(n) currentMenu->y + SERVERHEADERHEIGHT + (n * SERVERLINEHEIGHT)
# ifndef NONET
static UINT32 localservercount ;
static void M_HandleServerPage ( INT32 choice )
{
boolean exitmenu = false ; // exit to previous menu
switch ( choice )
{
case KEY_DOWNARROW :
M_NextOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ;
break ;
case KEY_UPARROW :
M_PrevOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ;
break ;
case KEY_BACKSPACE :
case KEY_ESCAPE :
exitmenu = true ;
break ;
case KEY_ENTER :
case KEY_RIGHTARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
if ( ( serverlistpage + 1 ) * SERVERS_PER_PAGE < serverlistcount )
serverlistpage + + ;
break ;
case KEY_LEFTARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
if ( serverlistpage > 0 )
serverlistpage - - ;
break ;
default :
break ;
}
if ( exitmenu )
{
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
static void M_Connect ( INT32 choice )
{
// do not call menuexitfunc
M_ClearMenus ( false ) ;
COM_BufAddText ( va ( " connect node %d \n " , serverlist [ choice - FIRSTSERVERLINE + serverlistpage * SERVERS_PER_PAGE ] . node ) ) ;
}
static void M_Refresh ( INT32 choice )
{
( void ) choice ;
// Display a little "please wait" message.
M_DrawTextBox ( 52 , BASEVIDHEIGHT / 2 - 10 , 25 , 3 ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , BASEVIDHEIGHT / 2 , 0 , " Searching for servers... " ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , ( BASEVIDHEIGHT / 2 ) + 12 , 0 , " Please wait. " ) ;
I_OsPolling ( ) ;
I_UpdateNoBlit ( ) ;
if ( rendermode = = render_soft )
I_FinishUpdate ( ) ; // page flip or blit buffer
// note: this is the one case where 0 is a valid room number
// because it corresponds to "All"
CL_UpdateServerList ( ! ( ms_RoomId < 0 ) , ms_RoomId ) ;
// first page of servers
serverlistpage = 0 ;
}
static INT32 menuRoomIndex = 0 ;
static void M_DrawRoomMenu ( void )
{
const char * rmotd ;
// use generic drawer for cursor, items and title
M_DrawGenericMenu ( ) ;
V_DrawString ( currentMenu - > x - 16 , currentMenu - > y , V_YELLOWMAP , M_GetText ( " Select a room " ) ) ;
M_DrawTextBox ( 144 , 24 , 20 , 20 ) ;
if ( itemOn = = 0 )
rmotd = M_GetText ( " Don't connect to the Master Server. " ) ;
else
rmotd = room_list [ itemOn - 1 ] . motd ;
rmotd = V_WordWrap ( 0 , 20 * 8 , 0 , rmotd ) ;
V_DrawString ( 144 + 8 , 32 , V_ALLOWLOWERCASE | V_RETURN8 , rmotd ) ;
}
static void M_DrawConnectMenu ( void )
{
2017-06-25 16:28:07 +00:00
UINT16 i ;
2014-03-15 16:59:03 +00:00
const char * gt = " Unknown " ;
INT32 numPages = ( serverlistcount + ( SERVERS_PER_PAGE - 1 ) ) / SERVERS_PER_PAGE ;
for ( i = FIRSTSERVERLINE ; i < min ( localservercount , SERVERS_PER_PAGE ) + FIRSTSERVERLINE ; i + + )
MP_ConnectMenu [ i ] . status = IT_STRING | IT_SPACE ;
if ( ! numPages )
numPages = 1 ;
// Room name
if ( ms_RoomId < 0 )
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + MP_ConnectMenu [ mp_connect_room ] . alphaKey ,
2019-08-30 04:38:58 +00:00
V_YELLOWMAP , ( itemOn = = mp_connect_room ) ? " <Select to change> " : " <Unlisted Mode> " ) ;
2014-03-15 16:59:03 +00:00
else
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + MP_ConnectMenu [ mp_connect_room ] . alphaKey ,
V_YELLOWMAP , room_list [ menuRoomIndex ] . name ) ;
// Page num
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + MP_ConnectMenu [ mp_connect_page ] . alphaKey ,
V_YELLOWMAP , va ( " %u of %d " , serverlistpage + 1 , numPages ) ) ;
// Horizontal line!
V_DrawFill ( 1 , currentMenu - > y + 40 , 318 , 1 , 0 ) ;
if ( serverlistcount < = 0 )
V_DrawString ( currentMenu - > x , currentMenu - > y + SERVERHEADERHEIGHT , 0 , " No servers found " ) ;
else
for ( i = 0 ; i < min ( serverlistcount - serverlistpage * SERVERS_PER_PAGE , SERVERS_PER_PAGE ) ; i + + )
{
INT32 slindex = i + serverlistpage * SERVERS_PER_PAGE ;
UINT32 globalflags = ( ( serverlist [ slindex ] . info . numberofplayer > = serverlist [ slindex ] . info . maxplayer ) ? V_TRANSLUCENT : 0 )
| ( ( itemOn = = FIRSTSERVERLINE + i ) ? V_YELLOWMAP : 0 ) | V_ALLOWLOWERCASE ;
V_DrawString ( currentMenu - > x , S_LINEY ( i ) , globalflags , serverlist [ slindex ] . info . servername ) ;
// Don't use color flags intentionally, the global yellow color will auto override the text color code
if ( serverlist [ slindex ] . info . modifiedgame )
V_DrawSmallString ( currentMenu - > x + 202 , S_LINEY ( i ) + 8 , globalflags , " \x85 " " Mod " ) ;
if ( serverlist [ slindex ] . info . cheatsenabled )
V_DrawSmallString ( currentMenu - > x + 222 , S_LINEY ( i ) + 8 , globalflags , " \x83 " " Cheats " ) ;
V_DrawSmallString ( currentMenu - > x , S_LINEY ( i ) + 8 , globalflags ,
va ( " Ping: %u " , ( UINT32 ) LONG ( serverlist [ slindex ] . info . time ) ) ) ;
gt = " Unknown " ;
2017-06-25 16:28:07 +00:00
if ( serverlist [ slindex ] . info . gametype < NUMGAMETYPES )
gt = Gametype_Names [ serverlist [ slindex ] . info . gametype ] ;
2014-03-15 16:59:03 +00:00
V_DrawSmallString ( currentMenu - > x + 46 , S_LINEY ( i ) + 8 , globalflags ,
va ( " Players: %02d/%02d " , serverlist [ slindex ] . info . numberofplayer , serverlist [ slindex ] . info . maxplayer ) ) ;
V_DrawSmallString ( currentMenu - > x + 112 , S_LINEY ( i ) + 8 , globalflags , va ( " Gametype: %s " , gt ) ) ;
MP_ConnectMenu [ i + FIRSTSERVERLINE ] . status = IT_STRING | IT_CALL ;
}
localservercount = serverlistcount ;
M_DrawGenericMenu ( ) ;
}
static boolean M_CancelConnect ( void )
{
D_CloseConnection ( ) ;
return true ;
}
// Ascending order, not descending.
// The casts are safe as long as the caller doesn't do anything stupid.
# define SERVER_LIST_ENTRY_COMPARATOR(key) \
static int ServerListEntryComparator_ # # key ( const void * entry1 , const void * entry2 ) \
{ \
2014-03-17 12:13:16 +00:00
const serverelem_t * sa = ( const serverelem_t * ) entry1 , * sb = ( const serverelem_t * ) entry2 ; \
if ( sa - > info . key ! = sb - > info . key ) \
return sa - > info . key - sb - > info . key ; \
return strcmp ( sa - > info . servername , sb - > info . servername ) ; \
}
// This does descending instead of ascending.
# define SERVER_LIST_ENTRY_COMPARATOR_REVERSE(key) \
static int ServerListEntryComparator_ # # key # # _reverse ( const void * entry1 , const void * entry2 ) \
{ \
const serverelem_t * sa = ( const serverelem_t * ) entry1 , * sb = ( const serverelem_t * ) entry2 ; \
if ( sb - > info . key ! = sa - > info . key ) \
return sb - > info . key - sa - > info . key ; \
return strcmp ( sb - > info . servername , sa - > info . servername ) ; \
2014-03-15 16:59:03 +00:00
}
SERVER_LIST_ENTRY_COMPARATOR ( time )
SERVER_LIST_ENTRY_COMPARATOR ( numberofplayer )
2014-03-17 12:13:16 +00:00
SERVER_LIST_ENTRY_COMPARATOR_REVERSE ( numberofplayer )
SERVER_LIST_ENTRY_COMPARATOR_REVERSE ( maxplayer )
2014-03-15 16:59:03 +00:00
SERVER_LIST_ENTRY_COMPARATOR ( gametype )
2014-03-17 12:13:16 +00:00
// Special one for modified state.
static int ServerListEntryComparator_modified ( const void * entry1 , const void * entry2 )
{
const serverelem_t * sa = ( const serverelem_t * ) entry1 , * sb = ( const serverelem_t * ) entry2 ;
// Modified acts as 2 points, cheats act as one point.
int modstate_a = ( sa - > info . cheatsenabled ? 1 : 0 ) | ( sa - > info . modifiedgame ? 2 : 0 ) ;
int modstate_b = ( sb - > info . cheatsenabled ? 1 : 0 ) | ( sb - > info . modifiedgame ? 2 : 0 ) ;
if ( modstate_a ! = modstate_b )
return modstate_a - modstate_b ;
// Default to strcmp.
return strcmp ( sa - > info . servername , sb - > info . servername ) ;
}
2014-03-15 16:59:03 +00:00
# endif
2014-03-17 12:13:16 +00:00
void M_SortServerList ( void )
2014-03-15 16:59:03 +00:00
{
# ifndef NONET
switch ( cv_serversort . value )
{
case 0 : // Ping.
qsort ( serverlist , serverlistcount , sizeof ( serverelem_t ) , ServerListEntryComparator_time ) ;
break ;
2014-03-17 12:13:16 +00:00
case 1 : // Modified state.
qsort ( serverlist , serverlistcount , sizeof ( serverelem_t ) , ServerListEntryComparator_modified ) ;
break ;
case 2 : // Most players.
qsort ( serverlist , serverlistcount , sizeof ( serverelem_t ) , ServerListEntryComparator_numberofplayer_reverse ) ;
break ;
case 3 : // Least players.
2014-03-15 16:59:03 +00:00
qsort ( serverlist , serverlistcount , sizeof ( serverelem_t ) , ServerListEntryComparator_numberofplayer ) ;
break ;
2014-03-17 12:13:16 +00:00
case 4 : // Max players.
qsort ( serverlist , serverlistcount , sizeof ( serverelem_t ) , ServerListEntryComparator_maxplayer_reverse ) ;
break ;
case 5 : // Gametype.
2014-03-15 16:59:03 +00:00
qsort ( serverlist , serverlistcount , sizeof ( serverelem_t ) , ServerListEntryComparator_gametype ) ;
break ;
}
# endif
}
# ifndef NONET
# ifdef UPDATE_ALERT
2018-11-19 17:47:23 +00:00
static boolean M_CheckMODVersion ( void )
2014-03-15 16:59:03 +00:00
{
char updatestring [ 500 ] ;
const char * updatecheck = GetMODVersion ( ) ;
if ( updatecheck )
{
sprintf ( updatestring , UPDATE_ALERT_STRING , VERSIONSTRING , updatecheck ) ;
M_StartMessage ( updatestring , NULL , MM_NOTHING ) ;
return false ;
} else
return true ;
}
# endif
static void M_ConnectMenu ( INT32 choice )
{
( void ) choice ;
// modified game check: no longer handled
// we don't request a restart unless the filelist differs
// first page of servers
serverlistpage = 0 ;
2019-08-27 22:05:30 +00:00
if ( ms_RoomId < 0 )
{
M_RoomMenu ( 0 ) ; // Select a room instead of staring at an empty list
// This prevents us from returning to the modified game alert.
currentMenu - > prevMenu = & MP_MainDef ;
}
else
M_SetupNextMenu ( & MP_ConnectDef ) ;
2014-03-15 16:59:03 +00:00
itemOn = 0 ;
M_Refresh ( 0 ) ;
}
2019-08-29 00:24:30 +00:00
static void M_ConnectMenuModChecks ( INT32 choice )
{
( void ) choice ;
// okay never mind we want to COMMUNICATE to the player pre-emptively instead of letting them try and then get confused when it doesn't work
if ( modifiedgame )
{
M_StartMessage ( M_GetText ( " Add-ons are currently loaded. \n \n You will only be able to join a server if \n it has the same ones loaded in the same order, which may be unlikely. \n \n If you wish to play on other servers, \n restart the game to clear existing add-ons. \n \n (Press a key) \n " ) , M_ConnectMenu , MM_EVENTHANDLER ) ;
return ;
}
M_ConnectMenu ( - 1 ) ;
}
2014-03-15 16:59:03 +00:00
static UINT32 roomIds [ NUM_LIST_ROOMS ] ;
static void M_RoomMenu ( INT32 choice )
{
INT32 i ;
( void ) choice ;
// Display a little "please wait" message.
M_DrawTextBox ( 52 , BASEVIDHEIGHT / 2 - 10 , 25 , 3 ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , BASEVIDHEIGHT / 2 , 0 , " Fetching room info... " ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , ( BASEVIDHEIGHT / 2 ) + 12 , 0 , " Please wait. " ) ;
I_OsPolling ( ) ;
I_UpdateNoBlit ( ) ;
if ( rendermode = = render_soft )
I_FinishUpdate ( ) ; // page flip or blit buffer
if ( GetRoomsList ( currentMenu = = & MP_ServerDef ) < 0 )
return ;
# ifdef UPDATE_ALERT
if ( ! M_CheckMODVersion ( ) )
return ;
# endif
for ( i = 1 ; i < NUM_LIST_ROOMS + 1 ; + + i )
MP_RoomMenu [ i ] . status = IT_DISABLED ;
memset ( roomIds , 0 , sizeof ( roomIds ) ) ;
for ( i = 0 ; room_list [ i ] . header . buffer [ 0 ] ; i + + )
{
2016-02-06 03:12:12 +00:00
if ( * room_list [ i ] . name ! = ' \0 ' )
2014-03-15 16:59:03 +00:00
{
MP_RoomMenu [ i + 1 ] . text = room_list [ i ] . name ;
roomIds [ i ] = room_list [ i ] . id ;
MP_RoomMenu [ i + 1 ] . status = IT_STRING | IT_CALL ;
}
}
MP_RoomDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & MP_RoomDef ) ;
}
static void M_ChooseRoom ( INT32 choice )
{
if ( choice = = 0 )
ms_RoomId = - 1 ;
else
{
ms_RoomId = roomIds [ choice - 1 ] ;
menuRoomIndex = choice - 1 ;
}
serverlistpage = 0 ;
2019-08-27 22:05:30 +00:00
/*
We were on the Multiplayer menu ? That means that we must have been trying to
view the server browser , but we hadn ' t selected a room yet . So we need to go
to the browser next , not back there .
*/
if ( currentMenu - > prevMenu = = & MP_MainDef )
M_SetupNextMenu ( & MP_ConnectDef ) ;
else
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
2014-03-15 16:59:03 +00:00
if ( currentMenu = = & MP_ConnectDef )
M_Refresh ( 0 ) ;
}
# endif //NONET
//===========================================================================
// Start Server Menu
//===========================================================================
static void M_StartServer ( INT32 choice )
{
boolean StartSplitScreenGame = ( currentMenu = = & MP_SplitServerDef ) ;
( void ) choice ;
if ( ! StartSplitScreenGame )
netgame = true ;
multiplayer = true ;
// Still need to reset devmode
cv_debug = 0 ;
2014-03-23 16:00:29 +00:00
if ( demoplayback )
2014-03-15 16:59:03 +00:00
G_StopDemo ( ) ;
2014-03-23 16:00:29 +00:00
if ( metalrecording )
G_StopMetalDemo ( ) ;
2014-03-15 16:59:03 +00:00
if ( ! StartSplitScreenGame )
{
D_MapChange ( cv_nextmap . value , cv_newgametype . value , false , 1 , 1 , false , false ) ;
COM_BufAddText ( " dummyconsvar 1 \n " ) ;
}
else // split screen
{
paused = false ;
SV_StartSinglePlayerServer ( ) ;
if ( ! splitscreen )
{
splitscreen = true ;
SplitScreen_OnChange ( ) ;
}
D_MapChange ( cv_nextmap . value , cv_newgametype . value , false , 1 , 1 , false , false ) ;
}
M_ClearMenus ( true ) ;
}
static void M_DrawServerMenu ( void )
{
M_DrawGenericMenu ( ) ;
# ifndef NONET
// Room name
if ( currentMenu = = & MP_ServerDef )
{
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( currentMenu - > y - lsheadingheight / 2 , " Server settings " , true , false ) ;
2014-03-15 16:59:03 +00:00
if ( ms_RoomId < 0 )
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + MP_ServerMenu [ mp_server_room ] . alphaKey ,
2019-08-30 04:38:58 +00:00
V_YELLOWMAP , ( itemOn = = mp_server_room ) ? " <Select to change> " : " <Unlisted Mode> " ) ;
2014-03-15 16:59:03 +00:00
else
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , currentMenu - > y + MP_ServerMenu [ mp_server_room ] . alphaKey ,
V_YELLOWMAP , room_list [ menuRoomIndex ] . name ) ;
}
# endif
2017-01-31 23:56:09 +00:00
if ( cv_nextmap . value )
{
2017-07-25 17:34:13 +00:00
# ifndef NONET
# define imgheight MP_ServerMenu[mp_server_levelgt].alphaKey
# else
# define imgheight 100
# endif
2017-01-31 23:56:09 +00:00
patch_t * PictureOfLevel ;
lumpnum_t lumpnum ;
char headerstr [ 40 ] ;
2014-03-15 16:59:03 +00:00
2017-01-31 23:56:09 +00:00
sprintf ( headerstr , " %s - %s " , cv_newgametype . string , cv_nextmap . string ) ;
2014-03-15 16:59:03 +00:00
2017-08-05 21:13:14 +00:00
M_DrawLevelPlatterHeader ( currentMenu - > y + imgheight - 10 - lsheadingheight / 2 , ( const char * ) headerstr , true , false ) ;
2017-01-31 23:56:09 +00:00
// A 160x100 image of the level as entry MAPxxP
lumpnum = W_CheckNumForName ( va ( " %sP " , G_BuildMapName ( cv_nextmap . value ) ) ) ;
if ( lumpnum ! = LUMPERROR )
PictureOfLevel = W_CachePatchName ( va ( " %sP " , G_BuildMapName ( cv_nextmap . value ) ) , PU_CACHE ) ;
else
PictureOfLevel = W_CachePatchName ( " BLANKLVL " , PU_CACHE ) ;
2014-03-15 16:59:03 +00:00
2017-07-25 17:34:13 +00:00
V_DrawSmallScaledPatch ( 319 - ( currentMenu - > x + ( SHORT ( PictureOfLevel - > width ) / 2 ) ) , currentMenu - > y + imgheight , 0 , PictureOfLevel ) ;
2017-01-31 23:56:09 +00:00
}
2014-03-15 16:59:03 +00:00
}
2017-09-15 19:34:46 +00:00
static void M_MapChange ( INT32 choice )
2014-03-15 16:59:03 +00:00
{
( void ) choice ;
2017-01-31 18:48:50 +00:00
MISC_ChangeLevelDef . prevMenu = currentMenu ;
2014-03-15 16:59:03 +00:00
levellistmode = LLM_CREATESERVER ;
2017-09-15 19:34:46 +00:00
if ( Playing ( ) & & ! ( M_CanShowLevelOnPlatter ( cv_nextmap . value - 1 , cv_newgametype . value ) ) & & ( M_CanShowLevelOnPlatter ( gamemap - 1 , cv_newgametype . value ) ) )
2017-02-05 21:20:32 +00:00
CV_SetValue ( & cv_nextmap , gamemap ) ;
2017-09-15 19:34:46 +00:00
if ( ! M_PrepareLevelPlatter ( cv_newgametype . value , ( currentMenu = = & MPauseDef ) ) )
2017-01-31 18:48:50 +00:00
{
M_StartMessage ( M_GetText ( " No selectable levels found. \n " ) , NULL , MM_NOTHING ) ;
return ;
}
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & MISC_ChangeLevelDef ) ;
}
static void M_StartSplitServerMenu ( INT32 choice )
{
( void ) choice ;
levellistmode = LLM_CREATESERVER ;
2017-01-31 23:56:09 +00:00
Newgametype_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & MP_SplitServerDef ) ;
}
2017-02-01 17:21:04 +00:00
static void M_ServerOptions ( INT32 choice )
{
( void ) choice ;
2017-04-16 14:00:58 +00:00
# ifndef NONET
if ( ( splitscreen & & ! netgame ) | | currentMenu = = & MP_SplitServerDef )
{
OP_ServerOptionsMenu [ 1 ] . status = IT_GRAYEDOUT ; // Server name
OP_ServerOptionsMenu [ 2 ] . status = IT_GRAYEDOUT ; // Max players
2017-07-04 12:17:29 +00:00
OP_ServerOptionsMenu [ 3 ] . status = IT_GRAYEDOUT ; // Allow add-on downloading
2017-04-16 14:00:58 +00:00
OP_ServerOptionsMenu [ 4 ] . status = IT_GRAYEDOUT ; // Allow players to join
2017-07-04 12:17:29 +00:00
OP_ServerOptionsMenu [ 34 ] . status = IT_GRAYEDOUT ; // Master server
OP_ServerOptionsMenu [ 35 ] . status = IT_GRAYEDOUT ; // Attempts to resynchronise
2017-04-16 14:00:58 +00:00
}
else
{
OP_ServerOptionsMenu [ 1 ] . status = IT_STRING | IT_CVAR | IT_CV_STRING ;
OP_ServerOptionsMenu [ 2 ] . status = IT_STRING | IT_CVAR ;
OP_ServerOptionsMenu [ 3 ] . status = IT_STRING | IT_CVAR ;
OP_ServerOptionsMenu [ 4 ] . status = IT_STRING | IT_CVAR ;
2017-07-04 12:17:29 +00:00
OP_ServerOptionsMenu [ 34 ] . status = ( netgame
? IT_GRAYEDOUT
: ( IT_STRING | IT_CVAR | IT_CV_STRING ) ) ;
OP_ServerOptionsMenu [ 35 ] . status = IT_STRING | IT_CVAR ;
2017-04-16 14:00:58 +00:00
}
# endif
2019-10-19 19:25:02 +00:00
/* Disable fading because of different menu head. */
if ( currentMenu = = & OP_MainDef ) /* from Options menu */
OP_ServerOptionsDef . menuid = MN_OP_MAIN + ( MN_OP_SERVER < < 6 ) ;
else /* from Multiplayer menu */
OP_ServerOptionsDef . menuid = MN_MP_MAIN + ( MN_MP_SERVER_OPTIONS < < 6 ) ;
2017-02-01 17:21:04 +00:00
OP_ServerOptionsDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & OP_ServerOptionsDef ) ;
}
2014-03-15 16:59:03 +00:00
# ifndef NONET
static void M_StartServerMenu ( INT32 choice )
{
( void ) choice ;
ms_RoomId = - 1 ;
2017-01-31 23:56:09 +00:00
levellistmode = LLM_CREATESERVER ;
Newgametype_OnChange ( ) ;
2014-03-15 16:59:03 +00:00
M_SetupNextMenu ( & MP_ServerDef ) ;
2017-01-31 23:56:09 +00:00
itemOn = 1 ;
2014-03-15 16:59:03 +00:00
}
// ==============
// CONNECT VIA IP
// ==============
2019-08-27 02:00:07 +00:00
static char setupm_ip [ 28 ] ;
2014-03-15 16:59:03 +00:00
// Draw the funky Connect IP menu. Tails 11-19-2002
// So much work for such a little thing!
2017-07-25 17:34:13 +00:00
static void M_DrawMPMainMenu ( void )
2014-03-15 16:59:03 +00:00
{
2017-07-25 17:34:13 +00:00
INT32 x = currentMenu - > x ;
INT32 y = currentMenu - > y ;
2014-03-15 16:59:03 +00:00
// use generic drawer for cursor, items and title
M_DrawGenericMenu ( ) ;
2019-08-27 01:49:12 +00:00
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y + 66 ,
( ( itemOn = = 4 ) ? V_YELLOWMAP : 0 ) , va ( " (2-%d players) " , MAXPLAYERS ) ) ;
2017-07-25 17:34:13 +00:00
2019-08-27 01:49:12 +00:00
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y + 76 ,
( ( itemOn = = 5 ) ? V_YELLOWMAP : 0 ) , " (2 players) " ) ;
2017-07-25 17:34:13 +00:00
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y + 116 ,
( ( itemOn = = 8 ) ? V_YELLOWMAP : 0 ) , " (splitscreen) " ) ;
2019-08-27 01:49:12 +00:00
y + = 22 ;
2017-07-25 17:34:13 +00:00
V_DrawFill ( x + 5 , y + 4 + 5 , /*16*8 + 6,*/ BASEVIDWIDTH - 2 * ( x + 5 ) , 8 + 6 , 159 ) ;
2014-03-15 16:59:03 +00:00
// draw name string
2019-08-27 02:00:07 +00:00
V_DrawString ( x + 8 , y + 12 , V_ALLOWLOWERCASE , setupm_ip ) ;
2014-03-15 16:59:03 +00:00
// draw text cursor for name
2019-08-27 01:49:12 +00:00
if ( itemOn = = 2 //0
2017-07-25 17:34:13 +00:00
& & skullAnimCounter < 4 ) //blink cursor
2019-08-27 02:00:07 +00:00
V_DrawCharacter ( x + 8 + V_StringWidth ( setupm_ip , V_ALLOWLOWERCASE ) , y + 12 , ' _ ' , false ) ;
2014-03-15 16:59:03 +00:00
}
// Tails 11-19-2002
static void M_ConnectIP ( INT32 choice )
{
( void ) choice ;
2018-01-12 01:35:39 +00:00
if ( * setupm_ip = = 0 )
{
M_StartMessage ( " You must specify an IP address. \n " , NULL , MM_NOTHING ) ;
return ;
}
2019-10-19 20:01:06 +00:00
M_ClearMenus ( true ) ;
2014-03-15 16:59:03 +00:00
COM_BufAddText ( va ( " connect \" %s \" \n " , setupm_ip ) ) ;
// A little "please wait" message.
M_DrawTextBox ( 56 , BASEVIDHEIGHT / 2 - 12 , 24 , 2 ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , BASEVIDHEIGHT / 2 , 0 , " Connecting to server... " ) ;
I_OsPolling ( ) ;
I_UpdateNoBlit ( ) ;
if ( rendermode = = render_soft )
I_FinishUpdate ( ) ; // page flip or blit buffer
}
// Tails 11-19-2002
static void M_HandleConnectIP ( INT32 choice )
{
2017-07-25 17:34:13 +00:00
size_t l ;
boolean exitmenu = false ; // exit to previous menu and send name change
2014-03-15 16:59:03 +00:00
switch ( choice )
{
2017-07-25 17:34:13 +00:00
case KEY_DOWNARROW :
M_NextOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
break ;
case KEY_UPARROW :
M_PrevOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
break ;
2014-03-15 16:59:03 +00:00
case KEY_ENTER :
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
M_ConnectIP ( 1 ) ;
break ;
case KEY_ESCAPE :
exitmenu = true ;
break ;
case KEY_BACKSPACE :
2017-07-25 17:34:13 +00:00
if ( ( l = strlen ( setupm_ip ) ) ! = 0 )
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
2017-07-25 17:34:13 +00:00
setupm_ip [ l - 1 ] = 0 ;
}
break ;
case KEY_DEL :
if ( setupm_ip [ 0 ] )
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
setupm_ip [ 0 ] = 0 ;
2014-03-15 16:59:03 +00:00
}
break ;
default :
l = strlen ( setupm_ip ) ;
2019-08-27 02:00:07 +00:00
if ( l > = 28 - 1 )
2017-07-25 17:34:13 +00:00
break ;
2019-08-27 02:00:07 +00:00
// Rudimentary number and period enforcing - also allows letters so hostnames can be used instead
if ( ( choice > = ' - ' & & choice < = ' : ' ) | | ( choice > = ' A ' & & choice < = ' Z ' ) | | ( choice > = ' a ' & & choice < = ' z ' ) )
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
2017-07-25 17:34:13 +00:00
setupm_ip [ l ] = ( char ) choice ;
setupm_ip [ l + 1 ] = 0 ;
2014-03-15 16:59:03 +00:00
}
2017-07-25 17:34:13 +00:00
else if ( choice > = 199 & & choice < = 211 & & choice ! = 202 & & choice ! = 206 ) //numpad too!
2014-03-15 16:59:03 +00:00
{
2017-09-29 18:46:23 +00:00
char keypad_translation [ ] = { ' 7 ' , ' 8 ' , ' 9 ' , ' - ' , ' 4 ' , ' 5 ' , ' 6 ' , ' + ' , ' 1 ' , ' 2 ' , ' 3 ' , ' 0 ' , ' . ' } ;
2014-03-15 16:59:03 +00:00
choice = keypad_translation [ choice - 199 ] ;
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
2017-07-25 17:34:13 +00:00
setupm_ip [ l ] = ( char ) choice ;
setupm_ip [ l + 1 ] = 0 ;
2014-03-15 16:59:03 +00:00
}
2017-07-25 17:34:13 +00:00
2014-03-15 16:59:03 +00:00
break ;
}
if ( exitmenu )
{
2019-10-19 20:07:20 +00:00
currentMenu - > lastOn = itemOn ;
2014-03-15 16:59:03 +00:00
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
# endif //!NONET
// ========================
// MULTIPLAYER PLAYER SETUP
// ========================
// Tails 03-02-2002
2015-01-22 15:23:45 +00:00
static UINT8 multi_tics ;
static UINT8 multi_frame ;
2017-07-23 16:49:19 +00:00
static UINT8 multi_spr2 ;
2014-03-15 16:59:03 +00:00
// this is set before entering the MultiPlayer setup menu,
// for either player 1 or 2
static char setupm_name [ MAXPLAYERNAME + 1 ] ;
static player_t * setupm_player ;
static consvar_t * setupm_cvskin ;
static consvar_t * setupm_cvcolor ;
static consvar_t * setupm_cvname ;
2017-07-25 17:34:13 +00:00
static consvar_t * setupm_cvdefaultskin ;
static consvar_t * setupm_cvdefaultcolor ;
2014-03-15 16:59:03 +00:00
static INT32 setupm_fakeskin ;
static INT32 setupm_fakecolor ;
static void M_DrawSetupMultiPlayerMenu ( void )
{
2017-07-23 16:49:19 +00:00
INT32 x , y , cursory = 0 , flags = 0 ;
2014-03-15 16:59:03 +00:00
spritedef_t * sprdef ;
spriteframe_t * sprframe ;
patch_t * patch ;
2017-07-23 16:49:19 +00:00
UINT8 * colormap ;
2014-03-15 16:59:03 +00:00
2017-07-23 16:49:19 +00:00
x = MP_PlayerSetupDef . x ;
y = MP_PlayerSetupDef . y ;
2014-03-15 16:59:03 +00:00
// use generic drawer for cursor, items and title
2017-07-23 16:49:19 +00:00
//M_DrawGenericMenu();
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
2017-08-05 21:13:14 +00:00
M_DrawLevelPlatterHeader ( y - ( lsheadingheight - 12 ) , " Name " , true , false ) ;
2017-07-23 16:49:19 +00:00
if ( itemOn = = 0 )
cursory = y ;
y + = 11 ;
2014-03-15 16:59:03 +00:00
// draw name string
2017-07-23 16:49:19 +00:00
V_DrawFill ( x , y , 282 /*(MAXPLAYERNAME+1)*8+6*/ , 14 , 159 ) ;
V_DrawString ( x + 8 , y + 3 , V_ALLOWLOWERCASE , setupm_name ) ;
if ( skullAnimCounter < 4 & & itemOn = = 0 )
V_DrawCharacter ( x + 8 + V_StringWidth ( setupm_name , V_ALLOWLOWERCASE ) , y + 3 ,
' _ ' | 0x80 , false ) ;
y + = 20 ;
2017-08-05 21:13:14 +00:00
M_DrawLevelPlatterHeader ( y - ( lsheadingheight - 12 ) , " Character " , true , false ) ;
2017-07-23 16:49:19 +00:00
if ( itemOn = = 1 )
cursory = y ;
2014-03-15 16:59:03 +00:00
// draw skin string
2017-07-23 16:49:19 +00:00
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y ,
2019-11-10 15:21:14 +00:00
( ( MP_PlayerSetupMenu [ 1 ] . status & IT_TYPE ) = = IT_SPACE ? V_TRANSLUCENT : 0 ) | ( itemOn = = 1 ? V_YELLOWMAP : 0 ) | V_ALLOWLOWERCASE ,
2014-03-15 16:59:03 +00:00
skins [ setupm_fakeskin ] . realname ) ;
2019-11-10 15:21:14 +00:00
if ( itemOn = = 1 & & ( MP_PlayerSetupMenu [ 1 ] . status & IT_TYPE ) ! = IT_SPACE )
2017-07-23 16:49:19 +00:00
{
V_DrawCharacter ( BASEVIDWIDTH - x - 10 - V_StringWidth ( skins [ setupm_fakeskin ] . realname , V_ALLOWLOWERCASE ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2014-03-15 16:59:03 +00:00
2017-07-23 16:49:19 +00:00
x = BASEVIDWIDTH / 2 ;
y + = 11 ;
2014-03-15 16:59:03 +00:00
// anim the player in the box
if ( - - multi_tics < = 0 )
{
2015-01-22 15:23:45 +00:00
multi_frame + + ;
multi_tics = 4 ;
2014-03-15 16:59:03 +00:00
}
2017-07-23 16:49:19 +00:00
# define charw 74
2014-03-15 16:59:03 +00:00
2017-07-23 16:49:19 +00:00
// draw box around character
V_DrawFill ( x - ( charw / 2 ) , y , charw , 84 , 159 ) ;
sprdef = & skins [ setupm_fakeskin ] . sprites [ multi_spr2 ] ;
if ( ! setupm_fakecolor | | ! sprdef - > numframes ) // should never happen but hey, who knows
goto faildraw ;
// ok, draw player sprite for sure now
colormap = R_GetTranslationColormap ( setupm_fakeskin , setupm_fakecolor , 0 ) ;
2014-03-15 16:59:03 +00:00
2015-01-22 15:23:45 +00:00
if ( multi_frame > = sprdef - > numframes )
multi_frame = 0 ;
2014-03-15 16:59:03 +00:00
2015-01-22 15:23:45 +00:00
sprframe = & sprdef - > spriteframes [ multi_frame ] ;
2014-03-15 16:59:03 +00:00
patch = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
if ( sprframe - > flip & 1 ) // Only for first sprite
flags | = V_FLIP ; // This sprite is left/right flipped!
2017-07-23 16:49:19 +00:00
# define chary (y+64)
V_DrawFixedPatch (
x < < FRACBITS ,
chary < < FRACBITS ,
FixedDiv ( skins [ setupm_fakeskin ] . highresscale , skins [ setupm_fakeskin ] . shieldscale ) ,
flags , patch , colormap ) ;
2014-03-15 16:59:03 +00:00
2017-07-23 16:49:19 +00:00
Z_Free ( colormap ) ;
goto colordraw ;
faildraw :
sprdef = & sprites [ SPR_UNKN ] ;
if ( ! sprdef - > numframes ) // No frames ??
return ; // Can't render!
sprframe = & sprdef - > spriteframes [ 0 ] ;
patch = W_CachePatchNum ( sprframe - > lumppat [ 0 ] , PU_CACHE ) ;
if ( sprframe - > flip & 1 ) // Only for first sprite
flags | = V_FLIP ; // This sprite is left/right flipped!
V_DrawScaledPatch ( x , chary , flags , patch ) ;
# undef chary
colordraw :
x = MP_PlayerSetupDef . x ;
y + = 75 ;
2017-08-05 21:13:14 +00:00
M_DrawLevelPlatterHeader ( y - ( lsheadingheight - 12 ) , " Color " , true , false ) ;
2017-07-23 16:49:19 +00:00
if ( itemOn = = 2 )
cursory = y ;
// draw color string
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y ,
2019-11-10 15:21:14 +00:00
( ( MP_PlayerSetupMenu [ 2 ] . status & IT_TYPE ) = = IT_SPACE ? V_TRANSLUCENT : 0 ) | ( itemOn = = 2 ? V_YELLOWMAP : 0 ) | V_ALLOWLOWERCASE ,
2017-07-23 16:49:19 +00:00
Color_Names [ setupm_fakecolor ] ) ;
if ( itemOn = = 2 & & ( MP_PlayerSetupMenu [ 2 ] . status & IT_TYPE ) ! = IT_SPACE )
2014-03-15 16:59:03 +00:00
{
2017-07-23 16:49:19 +00:00
V_DrawCharacter ( BASEVIDWIDTH - x - 10 - V_StringWidth ( Color_Names [ setupm_fakecolor ] , V_ALLOWLOWERCASE ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
2014-03-15 16:59:03 +00:00
}
2017-07-23 16:49:19 +00:00
y + = 11 ;
# define indexwidth 8
2014-03-15 16:59:03 +00:00
{
2017-07-23 16:49:19 +00:00
const INT32 colwidth = ( 282 - charw ) / ( 2 * indexwidth ) ;
INT32 i = - colwidth ;
INT16 col = setupm_fakecolor - colwidth ;
INT32 w = indexwidth ;
UINT8 h ;
2014-03-15 16:59:03 +00:00
2017-07-23 16:49:19 +00:00
while ( col < 1 )
col + = MAXSKINCOLORS - 1 ;
while ( i < = colwidth )
2014-08-04 03:49:33 +00:00
{
2017-07-23 16:49:19 +00:00
if ( ! ( i + + ) )
w = charw ;
else
w = indexwidth ;
for ( h = 0 ; h < 16 ; h + + )
V_DrawFill ( x , y + h , w , 1 , Color_Index [ col - 1 ] [ h ] ) ;
if ( + + col > = MAXSKINCOLORS )
col - = MAXSKINCOLORS - 1 ;
x + = w ;
2014-08-04 03:49:33 +00:00
}
2014-03-15 16:59:03 +00:00
}
2017-07-23 16:49:19 +00:00
# undef charw
# undef indexwidth
2017-07-25 17:34:13 +00:00
x = MP_PlayerSetupDef . x ;
y + = 20 ;
V_DrawString ( x , y ,
( ( R_SkinAvailable ( setupm_cvdefaultskin - > string ) ! = setupm_fakeskin
2019-11-16 01:32:43 +00:00
| | setupm_cvdefaultcolor - > value ! = setupm_fakecolor )
2017-07-25 17:34:13 +00:00
? 0
: V_TRANSLUCENT )
| ( ( itemOn = = 3 ) ? V_YELLOWMAP : 0 ) ,
" Save as default " ) ;
if ( itemOn = = 3 )
cursory = y ;
V_DrawScaledPatch ( x - 17 , cursory , 0 ,
2017-07-23 16:49:19 +00:00
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
2014-03-15 16:59:03 +00:00
}
// Handle 1P/2P MP Setup
static void M_HandleSetupMultiPlayer ( INT32 choice )
{
size_t l ;
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
INT32 prev_setupm_fakeskin ;
2014-03-15 16:59:03 +00:00
boolean exitmenu = false ; // exit to previous menu and send name change
switch ( choice )
{
case KEY_DOWNARROW :
M_NextOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
break ;
case KEY_UPARROW :
M_PrevOpt ( ) ;
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
break ;
case KEY_LEFTARROW :
2017-07-23 16:49:19 +00:00
if ( itemOn = = 1 ) //player skin
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
prev_setupm_fakeskin = setupm_fakeskin ;
do
{
setupm_fakeskin - - ;
if ( setupm_fakeskin < 0 )
setupm_fakeskin = numskins - 1 ;
}
2017-03-18 14:20:42 +00:00
while ( ( prev_setupm_fakeskin ! = setupm_fakeskin ) & & ! ( R_SkinUsable ( - 1 , setupm_fakeskin ) ) ) ;
2017-07-23 16:49:19 +00:00
multi_spr2 = P_GetSkinSprite2 ( & skins [ setupm_fakeskin ] , SPR2_WALK , NULL ) ;
2014-03-15 16:59:03 +00:00
}
2017-07-23 16:49:19 +00:00
else if ( itemOn = = 2 ) // player color
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
setupm_fakecolor - - ;
}
break ;
2017-07-23 16:49:19 +00:00
case KEY_ENTER :
2017-07-25 17:34:13 +00:00
if ( itemOn = = 3
& & ( R_SkinAvailable ( setupm_cvdefaultskin - > string ) ! = setupm_fakeskin
2019-11-16 01:32:43 +00:00
| | setupm_cvdefaultcolor - > value ! = setupm_fakecolor ) )
2017-07-25 17:34:13 +00:00
{
S_StartSound ( NULL , sfx_strpst ) ;
// you know what? always putting these in the buffer won't hurt anything.
COM_BufAddText ( va ( " %s \" %s \" \n " , setupm_cvdefaultskin - > name , skins [ setupm_fakeskin ] . name ) ) ;
COM_BufAddText ( va ( " %s %d \n " , setupm_cvdefaultcolor - > name , setupm_fakecolor ) ) ;
break ;
}
2017-09-28 15:01:52 +00:00
/* FALLTHRU */
2014-03-15 16:59:03 +00:00
case KEY_RIGHTARROW :
2017-07-23 16:49:19 +00:00
if ( itemOn = = 1 ) //player skin
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
Substantial re-engineering for the foundations of hidden characters.
R_SkinUnlock defines the circumstances under which a skin is available. For simplicty's sake, I've currently bound it to an S_SKIN variable so I can toggle it easily, but it WILL be replaced with a hook into the savegame system at some point.
* Currently has three tiers of unlock - freebie (forceskin or modeattacking via a loaded replay), Ringslinger Only, and SP/Coop and Ringslinger.
* I don't know anything about netcode so I basically decided to make R_SkinUnlock relevant only under local circumstances, try as hard as possible to stop bad skin info from getting sent to the server, and then admit defeat once the server has the information. If this is a bad choice, please discipline me and show me how to fix it.
* Character Select now checks for whether the character is hidden or not on menu load and does/undoes it based on that info, but will never touch one disabled via SOC. I also used this opportunity to optimise, checking for/filling out charsel pictures instead of doing it later. (It now also includes special casing for a select screen with zero characters!)
* Mode Attack now hides hidden characters in its character select based on SP rules.
Things that still need to be done:
* ForceSkin_OnChange. Is there a graceful way to handle this?
* No obvious skin name conflicts. Add a salt to the names of hidden skins, and then remove it when they're unhidden?
* The gap between Knuckles' skin number and the first custom character anybody adds will be way too obvious. A seperate hidden skin numbering system? Start at 32 and count up from there? There's a few ways...
2016-07-12 02:15:58 +00:00
prev_setupm_fakeskin = setupm_fakeskin ;
do
{
setupm_fakeskin + + ;
if ( setupm_fakeskin > numskins - 1 )
setupm_fakeskin = 0 ;
}
2017-03-18 14:20:42 +00:00
while ( ( prev_setupm_fakeskin ! = setupm_fakeskin ) & & ! ( R_SkinUsable ( - 1 , setupm_fakeskin ) ) ) ;
2017-07-23 16:49:19 +00:00
multi_spr2 = P_GetSkinSprite2 ( & skins [ setupm_fakeskin ] , SPR2_WALK , NULL ) ;
2014-03-15 16:59:03 +00:00
}
2017-07-23 16:49:19 +00:00
else if ( itemOn = = 2 ) // player color
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
setupm_fakecolor + + ;
}
break ;
case KEY_ESCAPE :
exitmenu = true ;
break ;
case KEY_BACKSPACE :
2017-07-23 16:49:19 +00:00
if ( itemOn = = 0 & & ( l = strlen ( setupm_name ) ) ! = 0 )
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
setupm_name [ l - 1 ] = 0 ;
}
2019-06-18 13:36:06 +00:00
else if ( itemOn = = 2 )
{
UINT8 col = skins [ setupm_fakeskin ] . prefcolor ;
if ( setupm_fakecolor ! = col )
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
setupm_fakecolor = col ;
}
}
break ;
2017-07-23 16:49:19 +00:00
break ;
case KEY_DEL :
if ( itemOn = = 0 & & ( l = strlen ( setupm_name ) ) ! = 0 )
2014-03-15 16:59:03 +00:00
{
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
2017-07-23 16:49:19 +00:00
setupm_name [ 0 ] = 0 ;
2014-03-15 16:59:03 +00:00
}
break ;
default :
2017-07-23 16:49:19 +00:00
if ( itemOn ! = 0 | | choice < 32 | | choice > 127 )
2014-03-15 16:59:03 +00:00
break ;
2017-07-23 16:49:19 +00:00
S_StartSound ( NULL , sfx_menu1 ) ; // Tails
2014-03-15 16:59:03 +00:00
l = strlen ( setupm_name ) ;
2018-06-26 16:46:04 +00:00
if ( l < MAXPLAYERNAME )
2014-03-15 16:59:03 +00:00
{
2017-07-23 16:49:19 +00:00
setupm_name [ l ] = ( char ) choice ;
setupm_name [ l + 1 ] = 0 ;
2014-03-15 16:59:03 +00:00
}
break ;
}
// check color
if ( setupm_fakecolor < 1 )
setupm_fakecolor = MAXSKINCOLORS - 1 ;
if ( setupm_fakecolor > MAXSKINCOLORS - 1 )
setupm_fakecolor = 1 ;
if ( exitmenu )
{
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
// start the multiplayer setup menu
static void M_SetupMultiPlayer ( INT32 choice )
{
( void ) choice ;
2015-01-22 15:23:45 +00:00
multi_frame = 0 ;
multi_tics = 4 ;
2014-03-15 16:59:03 +00:00
strcpy ( setupm_name , cv_playername . string ) ;
// set for player 1
setupm_player = & players [ consoleplayer ] ;
setupm_cvskin = & cv_skin ;
setupm_cvcolor = & cv_playercolor ;
setupm_cvname = & cv_playername ;
2017-07-25 17:34:13 +00:00
setupm_cvdefaultskin = & cv_defaultskin ;
setupm_cvdefaultcolor = & cv_defaultplayercolor ;
2014-03-15 16:59:03 +00:00
// For whatever reason this doesn't work right if you just use ->value
setupm_fakeskin = R_SkinAvailable ( setupm_cvskin - > string ) ;
if ( setupm_fakeskin = = - 1 )
setupm_fakeskin = 0 ;
setupm_fakecolor = setupm_cvcolor - > value ;
// disable skin changes if we can't actually change skins
if ( ! CanChangeSkin ( consoleplayer ) )
2017-07-23 16:49:19 +00:00
MP_PlayerSetupMenu [ 1 ] . status = ( IT_GRAYEDOUT ) ;
2014-03-15 16:59:03 +00:00
else
2017-07-23 16:49:19 +00:00
MP_PlayerSetupMenu [ 1 ] . status = ( IT_KEYHANDLER | IT_STRING ) ;
2019-11-10 15:21:14 +00:00
// ditto with colour
if ( Playing ( ) & & G_GametypeHasTeams ( ) )
MP_PlayerSetupMenu [ 2 ] . status = ( IT_GRAYEDOUT ) ;
else
MP_PlayerSetupMenu [ 2 ] . status = ( IT_KEYHANDLER | IT_STRING ) ;
2017-07-23 16:49:19 +00:00
multi_spr2 = P_GetSkinSprite2 ( & skins [ setupm_fakeskin ] , SPR2_WALK , NULL ) ;
2014-03-15 16:59:03 +00:00
MP_PlayerSetupDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & MP_PlayerSetupDef ) ;
}
// start the multiplayer setup menu, for secondary player (splitscreen mode)
static void M_SetupMultiPlayer2 ( INT32 choice )
{
( void ) choice ;
2015-01-22 15:23:45 +00:00
multi_frame = 0 ;
multi_tics = 4 ;
2014-03-15 16:59:03 +00:00
strcpy ( setupm_name , cv_playername2 . string ) ;
// set for splitscreen secondary player
setupm_player = & players [ secondarydisplayplayer ] ;
setupm_cvskin = & cv_skin2 ;
setupm_cvcolor = & cv_playercolor2 ;
setupm_cvname = & cv_playername2 ;
2017-07-25 17:34:13 +00:00
setupm_cvdefaultskin = & cv_defaultskin2 ;
setupm_cvdefaultcolor = & cv_defaultplayercolor2 ;
2014-03-15 16:59:03 +00:00
// For whatever reason this doesn't work right if you just use ->value
setupm_fakeskin = R_SkinAvailable ( setupm_cvskin - > string ) ;
if ( setupm_fakeskin = = - 1 )
setupm_fakeskin = 0 ;
setupm_fakecolor = setupm_cvcolor - > value ;
// disable skin changes if we can't actually change skins
if ( splitscreen & & ! CanChangeSkin ( secondarydisplayplayer ) )
2017-07-23 16:49:19 +00:00
MP_PlayerSetupMenu [ 1 ] . status = ( IT_GRAYEDOUT ) ;
2014-03-15 16:59:03 +00:00
else
2017-07-23 16:49:19 +00:00
MP_PlayerSetupMenu [ 1 ] . status = ( IT_KEYHANDLER | IT_STRING ) ;
2019-11-10 15:21:14 +00:00
// ditto with colour
if ( Playing ( ) & & G_GametypeHasTeams ( ) )
MP_PlayerSetupMenu [ 2 ] . status = ( IT_GRAYEDOUT ) ;
else
MP_PlayerSetupMenu [ 2 ] . status = ( IT_KEYHANDLER | IT_STRING ) ;
2017-07-23 16:49:19 +00:00
multi_spr2 = P_GetSkinSprite2 ( & skins [ setupm_fakeskin ] , SPR2_WALK , NULL ) ;
2014-03-15 16:59:03 +00:00
MP_PlayerSetupDef . prevMenu = currentMenu ;
M_SetupNextMenu ( & MP_PlayerSetupDef ) ;
}
static boolean M_QuitMultiPlayerMenu ( void )
{
size_t l ;
// send name if changed
if ( strcmp ( setupm_name , setupm_cvname - > string ) )
{
// remove trailing whitespaces
for ( l = strlen ( setupm_name ) - 1 ;
( signed ) l > = 0 & & setupm_name [ l ] = = ' ' ; l - - )
setupm_name [ l ] = 0 ;
COM_BufAddText ( va ( " %s \" %s \" \n " , setupm_cvname - > name , setupm_name ) ) ;
}
// you know what? always putting these in the buffer won't hurt anything.
COM_BufAddText ( va ( " %s \" %s \" \n " , setupm_cvskin - > name , skins [ setupm_fakeskin ] . name ) ) ;
COM_BufAddText ( va ( " %s %d \n " , setupm_cvcolor - > name , setupm_fakecolor ) ) ;
return true ;
}
// =================
// DATA OPTIONS MENU
// =================
static UINT8 erasecontext = 0 ;
static void M_EraseDataResponse ( INT32 ch )
{
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
// Delete the data
if ( erasecontext ! = 1 )
G_ClearRecords ( ) ;
if ( erasecontext ! = 0 )
M_ClearSecrets ( ) ;
if ( erasecontext = = 2 )
{
totalplaytime = 0 ;
F_StartIntro ( ) ;
}
2017-08-21 15:02:13 +00:00
BwehHehHe ( ) ;
2014-03-15 16:59:03 +00:00
M_ClearMenus ( true ) ;
}
static void M_EraseData ( INT32 choice )
{
const char * eschoice , * esstr = M_GetText ( " Are you sure you want to erase \n %s? \n \n (Press 'Y' to confirm) \n " ) ;
erasecontext = ( UINT8 ) choice ;
if ( choice = = 0 )
eschoice = M_GetText ( " Record Attack data " ) ;
else if ( choice = = 1 )
2019-11-21 00:34:32 +00:00
eschoice = M_GetText ( " Extras data " ) ;
2014-03-15 16:59:03 +00:00
else
eschoice = M_GetText ( " ALL game data " ) ;
M_StartMessage ( va ( esstr , eschoice ) , M_EraseDataResponse , MM_YESNO ) ;
}
static void M_ScreenshotOptions ( INT32 choice )
{
( void ) choice ;
Screenshot_option_Onchange ( ) ;
Moviemode_mode_Onchange ( ) ;
M_SetupNextMenu ( & OP_ScreenshotOptionsDef ) ;
}
// =============
// JOYSTICK MENU
// =============
// Start the controls menu, setting it up for either the console player,
// or the secondary splitscreen player
static void M_DrawJoystick ( void )
{
2018-12-14 10:31:47 +00:00
INT32 i , compareval2 , compareval ;
2014-03-15 16:59:03 +00:00
2017-04-15 00:08:26 +00:00
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
2014-03-15 16:59:03 +00:00
2019-09-24 02:46:44 +00:00
for ( i = 0 ; i < = MAX_JOYSTICKS ; i + + ) // See MAX_JOYSTICKS
2014-03-15 16:59:03 +00:00
{
2018-12-02 01:13:14 +00:00
M_DrawTextBox ( OP_JoystickSetDef . x - 8 , OP_JoystickSetDef . y + LINEHEIGHT * i - 12 , 28 , 1 ) ;
2019-01-02 06:09:15 +00:00
//M_DrawSaveLoadBorder(OP_JoystickSetDef.x+4, OP_JoystickSetDef.y+1+LINEHEIGHT*i);
2014-03-15 16:59:03 +00:00
2018-12-14 10:31:47 +00:00
# ifdef JOYSTICK_HOTPLUG
if ( atoi ( cv_usejoystick2 . string ) > I_NumJoys ( ) )
compareval2 = atoi ( cv_usejoystick2 . string ) ;
else
compareval2 = cv_usejoystick2 . value ;
if ( atoi ( cv_usejoystick . string ) > I_NumJoys ( ) )
compareval = atoi ( cv_usejoystick . string ) ;
else
compareval = cv_usejoystick . value ;
# else
compareval2 = cv_usejoystick2 . value ;
2019-10-27 11:03:52 +00:00
compareval = cv_usejoystick . value ;
2018-12-14 10:31:47 +00:00
# endif
if ( ( setupcontrols_secondaryplayer & & ( i = = compareval2 ) )
| | ( ! setupcontrols_secondaryplayer & & ( i = = compareval ) ) )
2018-12-02 01:13:14 +00:00
V_DrawString ( OP_JoystickSetDef . x , OP_JoystickSetDef . y + LINEHEIGHT * i - 4 , V_GREENMAP , joystickInfo [ i ] ) ;
2014-03-15 16:59:03 +00:00
else
2018-12-02 01:13:14 +00:00
V_DrawString ( OP_JoystickSetDef . x , OP_JoystickSetDef . y + LINEHEIGHT * i - 4 , 0 , joystickInfo [ i ] ) ;
2017-04-15 00:08:26 +00:00
if ( i = = itemOn )
{
2019-01-07 22:56:43 +00:00
V_DrawScaledPatch ( currentMenu - > x - 24 , OP_JoystickSetDef . y + LINEHEIGHT * i - 4 , 0 ,
2017-04-15 00:08:26 +00:00
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
}
2014-03-15 16:59:03 +00:00
}
}
2018-12-06 15:54:58 +00:00
void M_SetupJoystickMenu ( INT32 choice )
2014-03-15 16:59:03 +00:00
{
INT32 i = 0 ;
const char * joyNA = " Unavailable " ;
INT32 n = I_NumJoys ( ) ;
( void ) choice ;
2018-12-03 18:32:24 +00:00
strcpy ( joystickInfo [ i ] , " None " ) ;
2014-03-15 16:59:03 +00:00
2019-09-24 03:23:40 +00:00
for ( i = 1 ; i < = MAX_JOYSTICKS ; i + + )
2014-03-15 16:59:03 +00:00
{
2018-12-02 01:13:14 +00:00
if ( i < = n & & ( I_GetJoyName ( i ) ) ! = NULL )
strncpy ( joystickInfo [ i ] , I_GetJoyName ( i ) , 28 ) ;
2014-03-15 16:59:03 +00:00
else
strcpy ( joystickInfo [ i ] , joyNA ) ;
2018-12-14 08:58:07 +00:00
# ifdef JOYSTICK_HOTPLUG
// We use cv_usejoystick.string as the USER-SET var
// and cv_usejoystick.value as the INTERNAL var
//
// In practice, if cv_usejoystick.string == 0, this overrides
// cv_usejoystick.value and always disables
//
// Update cv_usejoystick.string here so that the user can
// properly change this value.
if ( i = = cv_usejoystick . value )
CV_SetValue ( & cv_usejoystick , i ) ;
if ( i = = cv_usejoystick2 . value )
CV_SetValue ( & cv_usejoystick2 , i ) ;
# endif
2014-03-15 16:59:03 +00:00
}
M_SetupNextMenu ( & OP_JoystickSetDef ) ;
}
static void M_Setup1PJoystickMenu ( INT32 choice )
{
setupcontrols_secondaryplayer = false ;
OP_JoystickSetDef . prevMenu = & OP_Joystick1Def ;
2018-11-17 21:32:30 +00:00
OP_JoystickSetDef . menuid & = ~ ( ( ( 1 < < MENUBITS ) - 1 ) < < MENUBITS ) ;
OP_JoystickSetDef . menuid & = ~ ( ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * 2 ) ) ;
OP_JoystickSetDef . menuid | = MN_OP_P1CONTROLS < < MENUBITS ;
OP_JoystickSetDef . menuid | = MN_OP_P1JOYSTICK < < ( MENUBITS * 2 ) ;
2014-03-15 16:59:03 +00:00
M_SetupJoystickMenu ( choice ) ;
}
static void M_Setup2PJoystickMenu ( INT32 choice )
{
setupcontrols_secondaryplayer = true ;
OP_JoystickSetDef . prevMenu = & OP_Joystick2Def ;
2018-11-17 21:32:30 +00:00
OP_JoystickSetDef . menuid & = ~ ( ( ( 1 < < MENUBITS ) - 1 ) < < MENUBITS ) ;
OP_JoystickSetDef . menuid & = ~ ( ( ( 1 < < MENUBITS ) - 1 ) < < ( MENUBITS * 2 ) ) ;
OP_JoystickSetDef . menuid | = MN_OP_P2CONTROLS < < MENUBITS ;
OP_JoystickSetDef . menuid | = MN_OP_P2JOYSTICK < < ( MENUBITS * 2 ) ;
2014-03-15 16:59:03 +00:00
M_SetupJoystickMenu ( choice ) ;
}
static void M_AssignJoystick ( INT32 choice )
{
2018-12-14 10:02:41 +00:00
# ifdef JOYSTICK_HOTPLUG
2018-12-14 11:05:31 +00:00
INT32 oldchoice , oldstringchoice ;
2018-12-14 10:57:10 +00:00
INT32 numjoys = I_NumJoys ( ) ;
2018-12-14 10:02:41 +00:00
2014-03-15 16:59:03 +00:00
if ( setupcontrols_secondaryplayer )
2018-12-14 10:02:41 +00:00
{
2018-12-14 11:05:31 +00:00
oldchoice = oldstringchoice = atoi ( cv_usejoystick2 . string ) > numjoys ? atoi ( cv_usejoystick2 . string ) : cv_usejoystick2 . value ;
2014-03-15 16:59:03 +00:00
CV_SetValue ( & cv_usejoystick2 , choice ) ;
2018-12-14 10:02:41 +00:00
// Just in case last-minute changes were made to cv_usejoystick.value,
// update the string too
2018-12-14 10:57:10 +00:00
// But don't do this if we're intentionally setting higher than numjoys
if ( choice < = numjoys )
2018-12-14 10:02:41 +00:00
{
2018-12-14 10:57:10 +00:00
CV_SetValue ( & cv_usejoystick2 , cv_usejoystick2 . value ) ;
// reset this so the comparison is valid
if ( oldchoice > numjoys )
oldchoice = cv_usejoystick2 . value ;
if ( oldchoice ! = choice )
{
2018-12-14 11:05:31 +00:00
if ( choice & & oldstringchoice > numjoys ) // if we did not select "None", we likely selected a used device
CV_SetValue ( & cv_usejoystick2 , ( oldstringchoice > numjoys ? oldstringchoice : oldchoice ) ) ;
2018-12-14 10:57:10 +00:00
2018-12-14 11:05:31 +00:00
if ( oldstringchoice = =
2018-12-14 10:57:10 +00:00
( atoi ( cv_usejoystick2 . string ) > numjoys ? atoi ( cv_usejoystick2 . string ) : cv_usejoystick2 . value ) )
2019-09-24 02:46:44 +00:00
M_StartMessage ( " This gamepad is used by another \n "
" player. Reset the gamepad \n "
2018-12-14 10:57:10 +00:00
" for that player first. \n \n "
" (Press a key) \n " , NULL , MM_NOTHING ) ;
}
2018-12-14 10:02:41 +00:00
}
}
2014-03-15 16:59:03 +00:00
else
2018-12-14 10:02:41 +00:00
{
2018-12-14 11:05:31 +00:00
oldchoice = oldstringchoice = atoi ( cv_usejoystick . string ) > numjoys ? atoi ( cv_usejoystick . string ) : cv_usejoystick . value ;
2014-03-15 16:59:03 +00:00
CV_SetValue ( & cv_usejoystick , choice ) ;
2018-12-14 10:02:41 +00:00
// Just in case last-minute changes were made to cv_usejoystick.value,
// update the string too
2018-12-14 10:57:10 +00:00
// But don't do this if we're intentionally setting higher than numjoys
if ( choice < = numjoys )
2018-12-14 10:02:41 +00:00
{
2018-12-14 10:57:10 +00:00
CV_SetValue ( & cv_usejoystick , cv_usejoystick . value ) ;
// reset this so the comparison is valid
if ( oldchoice > numjoys )
oldchoice = cv_usejoystick . value ;
if ( oldchoice ! = choice )
{
2018-12-14 11:05:31 +00:00
if ( choice & & oldstringchoice > numjoys ) // if we did not select "None", we likely selected a used device
CV_SetValue ( & cv_usejoystick , ( oldstringchoice > numjoys ? oldstringchoice : oldchoice ) ) ;
2018-12-14 10:57:10 +00:00
2018-12-14 11:05:31 +00:00
if ( oldstringchoice = =
2018-12-14 10:57:10 +00:00
( atoi ( cv_usejoystick . string ) > numjoys ? atoi ( cv_usejoystick . string ) : cv_usejoystick . value ) )
2019-09-24 02:46:44 +00:00
M_StartMessage ( " This gamepad is used by another \n "
" player. Reset the gamepad \n "
2018-12-14 10:57:10 +00:00
" for that player first. \n \n "
" (Press a key) \n " , NULL , MM_NOTHING ) ;
}
2018-12-14 10:02:41 +00:00
}
}
# else
2014-03-15 16:59:03 +00:00
if ( setupcontrols_secondaryplayer )
CV_SetValue ( & cv_usejoystick2 , choice ) ;
else
CV_SetValue ( & cv_usejoystick , choice ) ;
2018-12-14 10:02:41 +00:00
# endif
2014-03-15 16:59:03 +00:00
}
// =============
// CONTROLS MENU
// =============
static void M_Setup1PControlsMenu ( INT32 choice )
{
( void ) choice ;
setupcontrols_secondaryplayer = false ;
setupcontrols = gamecontrol ; // was called from main Options (for console player, then)
currentMenu - > lastOn = itemOn ;
2019-01-07 20:43:58 +00:00
// Unhide the nine non-P2 controls and their headers
//OP_ChangeControlsMenu[18+0].status = IT_HEADER;
//OP_ChangeControlsMenu[18+1].status = IT_SPACE;
2017-04-29 15:40:07 +00:00
// ...
2017-04-15 20:40:30 +00:00
OP_ChangeControlsMenu [ 18 + 2 ] . status = IT_CALL | IT_STRING2 ;
OP_ChangeControlsMenu [ 18 + 3 ] . status = IT_CALL | IT_STRING2 ;
OP_ChangeControlsMenu [ 18 + 4 ] . status = IT_CALL | IT_STRING2 ;
2019-01-07 20:43:58 +00:00
OP_ChangeControlsMenu [ 18 + 5 ] . status = IT_CALL | IT_STRING2 ;
OP_ChangeControlsMenu [ 18 + 6 ] . status = IT_CALL | IT_STRING2 ;
//OP_ChangeControlsMenu[18+7].status = IT_CALL|IT_STRING2;
OP_ChangeControlsMenu [ 18 + 8 ] . status = IT_CALL | IT_STRING2 ;
2017-04-29 15:40:07 +00:00
// ...
2019-01-07 20:43:58 +00:00
OP_ChangeControlsMenu [ 27 + 0 ] . status = IT_HEADER ;
OP_ChangeControlsMenu [ 27 + 1 ] . status = IT_SPACE ;
2017-04-29 15:40:07 +00:00
// ...
2019-01-07 20:43:58 +00:00
OP_ChangeControlsMenu [ 27 + 2 ] . status = IT_CALL | IT_STRING2 ;
OP_ChangeControlsMenu [ 27 + 3 ] . status = IT_CALL | IT_STRING2 ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
OP_ChangeControlsDef . prevMenu = & OP_P1ControlsDef ;
2018-11-17 21:32:30 +00:00
OP_ChangeControlsDef . menuid & = ~ ( ( ( 1 < < MENUBITS ) - 1 ) < < MENUBITS ) ; // remove first level (<< 6)
OP_ChangeControlsDef . menuid | = MN_OP_P1CONTROLS < < MENUBITS ; // combine first level (<< 6)
2017-04-14 23:15:09 +00:00
M_SetupNextMenu ( & OP_ChangeControlsDef ) ;
2014-03-15 16:59:03 +00:00
}
static void M_Setup2PControlsMenu ( INT32 choice )
{
( void ) choice ;
setupcontrols_secondaryplayer = true ;
setupcontrols = gamecontrolbis ;
currentMenu - > lastOn = itemOn ;
2019-01-07 07:31:45 +00:00
// Hide the nine non-P2 controls and their headers
//OP_ChangeControlsMenu[18+0].status = IT_GRAYEDOUT2;
2019-01-07 20:43:58 +00:00
//OP_ChangeControlsMenu[18+1].status = IT_GRAYEDOUT2;
2017-04-29 15:40:07 +00:00
// ...
2017-04-15 20:40:30 +00:00
OP_ChangeControlsMenu [ 18 + 2 ] . status = IT_GRAYEDOUT2 ;
OP_ChangeControlsMenu [ 18 + 3 ] . status = IT_GRAYEDOUT2 ;
OP_ChangeControlsMenu [ 18 + 4 ] . status = IT_GRAYEDOUT2 ;
2019-01-07 20:43:58 +00:00
OP_ChangeControlsMenu [ 18 + 5 ] . status = IT_GRAYEDOUT2 ;
OP_ChangeControlsMenu [ 18 + 6 ] . status = IT_GRAYEDOUT2 ;
//OP_ChangeControlsMenu[18+7].status = IT_GRAYEDOUT2;
OP_ChangeControlsMenu [ 18 + 8 ] . status = IT_GRAYEDOUT2 ;
2017-04-29 15:40:07 +00:00
// ...
2019-01-07 20:43:58 +00:00
OP_ChangeControlsMenu [ 27 + 0 ] . status = IT_GRAYEDOUT2 ;
OP_ChangeControlsMenu [ 27 + 1 ] . status = IT_GRAYEDOUT2 ;
2017-04-29 15:40:07 +00:00
// ...
2019-01-07 20:43:58 +00:00
OP_ChangeControlsMenu [ 27 + 2 ] . status = IT_GRAYEDOUT2 ;
OP_ChangeControlsMenu [ 27 + 3 ] . status = IT_GRAYEDOUT2 ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
OP_ChangeControlsDef . prevMenu = & OP_P2ControlsDef ;
2018-11-17 21:32:30 +00:00
OP_ChangeControlsDef . menuid & = ~ ( ( ( 1 < < MENUBITS ) - 1 ) < < MENUBITS ) ; // remove first level (<< 6)
OP_ChangeControlsDef . menuid | = MN_OP_P2CONTROLS < < MENUBITS ; // combine first level (<< 6)
2017-04-14 23:15:09 +00:00
M_SetupNextMenu ( & OP_ChangeControlsDef ) ;
2014-03-15 16:59:03 +00:00
}
2017-04-14 23:15:09 +00:00
# define controlheight 18
2014-03-15 16:59:03 +00:00
// Draws the Customise Controls menu
static void M_DrawControl ( void )
{
char tmp [ 50 ] ;
2017-04-29 15:40:07 +00:00
INT32 x , y , i , max , cursory = 0 , iter ;
2014-03-15 16:59:03 +00:00
INT32 keys [ 2 ] ;
2017-04-14 23:15:09 +00:00
x = currentMenu - > x ;
y = currentMenu - > y ;
2017-04-29 15:40:07 +00:00
/*i = itemOn - (controlheight/2);
2017-04-14 23:15:09 +00:00
if ( i < 0 )
i = 0 ;
2017-04-29 15:40:07 +00:00
*/
2017-04-14 23:15:09 +00:00
2017-04-29 15:40:07 +00:00
iter = ( controlheight / 2 ) ;
for ( i = itemOn ; ( ( iter | | currentMenu - > menuitems [ i ] . status = = IT_GRAYEDOUT2 ) & & i > 0 ) ; i - - )
{
if ( currentMenu - > menuitems [ i ] . status ! = IT_GRAYEDOUT2 )
iter - - ;
}
if ( currentMenu - > menuitems [ i ] . status = = IT_GRAYEDOUT2 )
i - - ;
iter + = ( controlheight / 2 ) ;
for ( max = itemOn ; ( iter & & max < currentMenu - > numitems ) ; max + + )
{
if ( currentMenu - > menuitems [ max ] . status ! = IT_GRAYEDOUT2 )
iter - - ;
}
if ( iter )
{
iter + = ( controlheight / 2 ) ;
for ( i = itemOn ; ( ( iter | | currentMenu - > menuitems [ i ] . status = = IT_GRAYEDOUT2 ) & & i > 0 ) ; i - - )
{
if ( currentMenu - > menuitems [ i ] . status ! = IT_GRAYEDOUT2 )
iter - - ;
}
}
/*max = i + controlheight;
2017-04-14 23:15:09 +00:00
if ( max > currentMenu - > numitems )
{
max = currentMenu - > numitems ;
if ( max < controlheight )
i = 0 ;
else
i = max - controlheight ;
2017-04-29 15:40:07 +00:00
} */
2017-04-14 23:15:09 +00:00
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
2014-03-15 16:59:03 +00:00
2018-11-12 21:56:06 +00:00
if ( tutorialmode & & tutorialgcs )
{
if ( ( gametic / TICRATE ) % 2 )
M_CentreText ( 30 , " \202 EXIT THE TUTORIAL TO CHANGE THE CONTROLS " ) ;
else
M_CentreText ( 30 , " EXIT THE TUTORIAL TO CHANGE THE CONTROLS " ) ;
}
else
M_CentreText ( 30 ,
( setupcontrols_secondaryplayer ? " SET CONTROLS FOR SECONDARY PLAYER " :
" PRESS ENTER TO CHANGE, BACKSPACE TO CLEAR " ) ) ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
if ( i )
2017-07-04 12:17:29 +00:00
V_DrawString ( currentMenu - > x - 16 , y - ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1A " ) ; // up arrow
2017-04-14 23:15:09 +00:00
if ( max ! = currentMenu - > numitems )
2017-07-04 12:17:29 +00:00
V_DrawString ( currentMenu - > x - 16 , y + ( SMALLLINEHEIGHT * ( controlheight - 1 ) ) + ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1B " ) ; // down arrow
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
for ( ; i < max ; i + + )
2014-03-15 16:59:03 +00:00
{
2017-04-29 15:40:07 +00:00
if ( currentMenu - > menuitems [ i ] . status = = IT_GRAYEDOUT2 )
2014-03-15 16:59:03 +00:00
continue ;
2017-04-14 23:15:09 +00:00
if ( i = = itemOn )
cursory = y ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
if ( currentMenu - > menuitems [ i ] . status = = IT_CONTROL )
2014-03-15 16:59:03 +00:00
{
2017-04-14 23:15:09 +00:00
V_DrawString ( x , y , ( ( i = = itemOn ) ? V_YELLOWMAP : 0 ) , currentMenu - > menuitems [ i ] . text ) ;
keys [ 0 ] = setupcontrols [ currentMenu - > menuitems [ i ] . alphaKey ] [ 0 ] ;
keys [ 1 ] = setupcontrols [ currentMenu - > menuitems [ i ] . alphaKey ] [ 1 ] ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
tmp [ 0 ] = ' \0 ' ;
if ( keys [ 0 ] = = KEY_NULL & & keys [ 1 ] = = KEY_NULL )
{
strcpy ( tmp , " --- " ) ;
}
else
{
if ( keys [ 0 ] ! = KEY_NULL )
strcat ( tmp , G_KeynumToString ( keys [ 0 ] ) ) ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
if ( keys [ 0 ] ! = KEY_NULL & & keys [ 1 ] ! = KEY_NULL )
strcat ( tmp , " or " ) ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
if ( keys [ 1 ] ! = KEY_NULL )
strcat ( tmp , G_KeynumToString ( keys [ 1 ] ) ) ;
2014-03-15 16:59:03 +00:00
2017-04-14 23:15:09 +00:00
}
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , y , V_YELLOWMAP , tmp ) ;
2014-03-15 16:59:03 +00:00
}
2017-04-29 15:40:07 +00:00
/*else if (currentMenu->menuitems[i].status == IT_GRAYEDOUT2)
V_DrawString ( x , y , V_TRANSLUCENT , currentMenu - > menuitems [ i ] . text ) ; */
2017-04-18 11:32:06 +00:00
else if ( ( currentMenu - > menuitems [ i ] . status = = IT_HEADER ) & & ( i ! = max - 1 ) )
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( y , currentMenu - > menuitems [ i ] . text , true , false ) ;
2017-04-14 23:15:09 +00:00
y + = SMALLLINEHEIGHT ;
2014-03-15 16:59:03 +00:00
}
2017-09-28 15:10:24 +00:00
2017-04-15 12:36:40 +00:00
V_DrawScaledPatch ( currentMenu - > x - 20 , cursory , 0 ,
2017-04-14 23:15:09 +00:00
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
2014-03-15 16:59:03 +00:00
}
2017-04-14 23:15:09 +00:00
# undef controlbuffer
2014-03-15 16:59:03 +00:00
static INT32 controltochange ;
2018-12-31 06:26:25 +00:00
static char controltochangetext [ 33 ] ;
2014-03-15 16:59:03 +00:00
static void M_ChangecontrolResponse ( event_t * ev )
{
INT32 control ;
INT32 found ;
INT32 ch = ev - > data1 ;
2018-11-21 04:43:05 +00:00
// ESCAPE cancels; dummy out PAUSE
if ( ch ! = KEY_ESCAPE & & ch ! = KEY_PAUSE )
2014-03-15 16:59:03 +00:00
{
switch ( ev - > type )
{
// ignore mouse/joy movements, just get buttons
case ev_mouse :
case ev_mouse2 :
case ev_joystick :
case ev_joystick2 :
ch = KEY_NULL ; // no key
break ;
// keypad arrows are converted for the menu in cursor arrows
// so use the event instead of ch
case ev_keydown :
ch = ev - > data1 ;
break ;
default :
break ;
}
control = controltochange ;
// check if we already entered this key
found = - 1 ;
if ( setupcontrols [ control ] [ 0 ] = = ch )
found = 0 ;
else if ( setupcontrols [ control ] [ 1 ] = = ch )
found = 1 ;
if ( found > = 0 )
{
// replace mouse and joy clicks by double clicks
if ( ch > = KEY_MOUSE1 & & ch < = KEY_MOUSE1 + MOUSEBUTTONS )
setupcontrols [ control ] [ found ] = ch - KEY_MOUSE1 + KEY_DBLMOUSE1 ;
else if ( ch > = KEY_JOY1 & & ch < = KEY_JOY1 + JOYBUTTONS )
setupcontrols [ control ] [ found ] = ch - KEY_JOY1 + KEY_DBLJOY1 ;
else if ( ch > = KEY_2MOUSE1 & & ch < = KEY_2MOUSE1 + MOUSEBUTTONS )
setupcontrols [ control ] [ found ] = ch - KEY_2MOUSE1 + KEY_DBL2MOUSE1 ;
else if ( ch > = KEY_2JOY1 & & ch < = KEY_2JOY1 + JOYBUTTONS )
setupcontrols [ control ] [ found ] = ch - KEY_2JOY1 + KEY_DBL2JOY1 ;
}
else
{
// check if change key1 or key2, or replace the two by the new
found = 0 ;
if ( setupcontrols [ control ] [ 0 ] = = KEY_NULL )
found + + ;
if ( setupcontrols [ control ] [ 1 ] = = KEY_NULL )
found + + ;
if ( found = = 2 )
{
found = 0 ;
setupcontrols [ control ] [ 1 ] = KEY_NULL ; //replace key 1,clear key2
}
2018-12-20 09:04:49 +00:00
( void ) G_CheckDoubleUsage ( ch , true ) ;
2014-03-15 16:59:03 +00:00
setupcontrols [ control ] [ found ] = ch ;
}
2017-04-15 14:42:03 +00:00
S_StartSound ( NULL , sfx_strpst ) ;
2014-03-15 16:59:03 +00:00
}
2018-11-21 04:43:05 +00:00
else if ( ch = = KEY_PAUSE )
{
2019-01-05 00:38:36 +00:00
// This buffer assumes a 125-character message plus a 32-character control name (per controltochangetext buffer size)
static char tmp [ 158 ] ;
2018-11-21 04:43:05 +00:00
menu_t * prev = currentMenu - > prevMenu ;
if ( controltochange = = gc_pause )
sprintf ( tmp , M_GetText ( " The \x82 Pause Key \x80 is enabled, but \n it cannot be used to retry runs \n during Record Attack. \n \n Hit another key for \n %s \n ESC for Cancel " ) ,
controltochangetext ) ;
else
sprintf ( tmp , M_GetText ( " The \x82 Pause Key \x80 is enabled, but \n it is not configurable. \n \n Hit another key for \n %s \n ESC for Cancel " ) ,
controltochangetext ) ;
M_StartMessage ( tmp , M_ChangecontrolResponse , MM_EVENTHANDLER ) ;
currentMenu - > prevMenu = prev ;
S_StartSound ( NULL , sfx_s3k42 ) ;
return ;
}
2017-04-15 14:42:03 +00:00
else
S_StartSound ( NULL , sfx_skid ) ;
2014-03-15 16:59:03 +00:00
M_StopMessage ( 0 ) ;
}
static void M_ChangeControl ( INT32 choice )
{
2018-12-31 06:26:25 +00:00
// This buffer assumes a 35-character message (per below) plus a max control name limit of 32 chars (per controltochangetext)
// If you change the below message, then change the size of this buffer!
static char tmp [ 68 ] ;
2014-03-15 16:59:03 +00:00
2018-11-12 21:56:06 +00:00
if ( tutorialmode & & tutorialgcs ) // don't allow control changes if temp control override is active
return ;
2014-03-15 16:59:03 +00:00
controltochange = currentMenu - > menuitems [ choice ] . alphaKey ;
sprintf ( tmp , M_GetText ( " Hit the new key for \n %s \n ESC for Cancel " ) ,
currentMenu - > menuitems [ choice ] . text ) ;
2018-12-31 06:26:25 +00:00
strlcpy ( controltochangetext , currentMenu - > menuitems [ choice ] . text , 33 ) ;
2014-03-15 16:59:03 +00:00
M_StartMessage ( tmp , M_ChangecontrolResponse , MM_EVENTHANDLER ) ;
}
// ===============
// VIDEO MODE MENU
// ===============
//added : 30-01-98:
# define MAXCOLUMNMODES 12 //max modes displayed in one column
# define MAXMODEDESCS (MAXCOLUMNMODES*3)
static modedesc_t modedescs [ MAXMODEDESCS ] ;
static void M_VideoModeMenu ( INT32 choice )
{
INT32 i , j , vdup , nummodes , width , height ;
const char * desc ;
( void ) choice ;
memset ( modedescs , 0 , sizeof ( modedescs ) ) ;
2014-07-25 23:10:24 +00:00
# if (defined (__unix__) && !defined (MSDOS)) || defined (UNIXCOMMON) || defined (HAVE_SDL)
2014-03-15 16:59:03 +00:00
VID_PrepareModeList ( ) ; // FIXME: hack
# endif
vidm_nummodes = 0 ;
vidm_selected = 0 ;
nummodes = VID_NumModes ( ) ;
# ifdef _WINDOWS
// clean that later: skip windowed mode 0, video modes menu only shows FULL SCREEN modes
if ( nummodes < = NUMSPECIALMODES )
i = 0 ; // unless we have nothing
else
i = NUMSPECIALMODES ;
# else
// DOS does not skip mode 0, because mode 0 is ALWAYS present
i = 0 ;
# endif
for ( ; i < nummodes & & vidm_nummodes < MAXMODEDESCS ; i + + )
{
desc = VID_GetModeName ( i ) ;
if ( desc )
{
vdup = 0 ;
// when a resolution exists both under VGA and VESA, keep the
// VESA mode, which is always a higher modenum
for ( j = 0 ; j < vidm_nummodes ; j + + )
{
if ( ! strcmp ( modedescs [ j ] . desc , desc ) )
{
// mode(0): 320x200 is always standard VGA, not vesa
if ( modedescs [ j ] . modenum )
{
modedescs [ j ] . modenum = i ;
vdup = 1 ;
if ( i = = vid . modenum )
vidm_selected = j ;
}
else
vdup = 1 ;
break ;
}
}
if ( ! vdup )
{
modedescs [ vidm_nummodes ] . modenum = i ;
modedescs [ vidm_nummodes ] . desc = desc ;
if ( i = = vid . modenum )
vidm_selected = vidm_nummodes ;
// Pull out the width and height
sscanf ( desc , " %u%*c%u " , & width , & height ) ;
// Show multiples of 320x200 as green.
if ( SCR_IsAspectCorrect ( width , height ) )
modedescs [ vidm_nummodes ] . goodratio = 1 ;
vidm_nummodes + + ;
}
}
}
vidm_column_size = ( vidm_nummodes + 2 ) / 3 ;
M_SetupNextMenu ( & OP_VideoModeDef ) ;
}
2017-04-15 14:36:19 +00:00
static void M_DrawMainVideoMenu ( void )
{
2017-04-20 18:27:19 +00:00
2017-04-15 14:36:19 +00:00
M_DrawGenericScrollMenu ( ) ;
2017-04-20 18:27:19 +00:00
if ( itemOn < 8 ) // where it starts to go offscreen; change this number if you change the layout of the video menu
{
INT32 y = currentMenu - > y + currentMenu - > menuitems [ 1 ] . alphaKey * 2 ;
if ( itemOn = = 7 )
y - = 10 ;
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , y ,
2017-04-15 14:36:19 +00:00
( SCR_IsAspectCorrect ( vid . width , vid . height ) ? V_GREENMAP : V_YELLOWMAP ) ,
va ( " %dx%d " , vid . width , vid . height ) ) ;
2017-04-20 18:27:19 +00:00
}
2017-04-15 14:36:19 +00:00
}
2014-03-15 16:59:03 +00:00
// Draw the video modes list, a-la-Quake
static void M_DrawVideoMode ( void )
{
INT32 i , j , row , col ;
// draw title
M_DrawMenuTitle ( ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , OP_VideoModeDef . y ,
V_YELLOWMAP , " Choose mode, reselect to change default " ) ;
row = 41 ;
col = OP_VideoModeDef . y + 14 ;
for ( i = 0 ; i < vidm_nummodes ; i + + )
{
if ( i = = vidm_selected )
V_DrawString ( row , col , V_YELLOWMAP , modedescs [ i ] . desc ) ;
// Show multiples of 320x200 as green.
else
V_DrawString ( row , col , ( modedescs [ i ] . goodratio ) ? V_GREENMAP : 0 , modedescs [ i ] . desc ) ;
col + = 8 ;
if ( ( i % vidm_column_size ) = = ( vidm_column_size - 1 ) )
{
row + = 7 * 13 ;
col = OP_VideoModeDef . y + 14 ;
}
}
if ( vidm_testingmode > 0 )
{
INT32 testtime = ( vidm_testingmode / TICRATE ) + 1 ;
M_CentreText ( OP_VideoModeDef . y + 116 ,
va ( " Previewing mode %c%dx%d " ,
( SCR_IsAspectCorrect ( vid . width , vid . height ) ) ? 0x83 : 0x80 ,
vid . width , vid . height ) ) ;
M_CentreText ( OP_VideoModeDef . y + 138 ,
" Press ENTER again to keep this mode " ) ;
M_CentreText ( OP_VideoModeDef . y + 150 ,
va ( " Wait %d second%s " , testtime , ( testtime > 1 ) ? " s " : " " ) ) ;
M_CentreText ( OP_VideoModeDef . y + 158 ,
" or press ESC to return " ) ;
}
else
{
M_CentreText ( OP_VideoModeDef . y + 116 ,
va ( " Current mode is %c%dx%d " ,
( SCR_IsAspectCorrect ( vid . width , vid . height ) ) ? 0x83 : 0x80 ,
vid . width , vid . height ) ) ;
M_CentreText ( OP_VideoModeDef . y + 124 ,
va ( " Default mode is %c%dx%d " ,
( SCR_IsAspectCorrect ( cv_scr_width . value , cv_scr_height . value ) ) ? 0x83 : 0x80 ,
cv_scr_width . value , cv_scr_height . value ) ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , OP_VideoModeDef . y + 138 ,
V_GREENMAP , " Green modes are recommended. " ) ;
2017-04-23 00:12:00 +00:00
V_DrawCenteredString ( BASEVIDWIDTH / 2 , OP_VideoModeDef . y + 146 ,
2014-03-15 16:59:03 +00:00
V_YELLOWMAP , " Other modes may have visual errors. " ) ;
V_DrawCenteredString ( BASEVIDWIDTH / 2 , OP_VideoModeDef . y + 158 ,
2017-04-23 00:12:00 +00:00
V_YELLOWMAP , " Larger modes may have performance issues. " ) ;
2014-03-15 16:59:03 +00:00
}
// Draw the cursor for the VidMode menu
i = 41 - 10 + ( ( vidm_selected / vidm_column_size ) * 7 * 13 ) ;
j = OP_VideoModeDef . y + 14 + ( ( vidm_selected % vidm_column_size ) * 8 ) ;
V_DrawScaledPatch ( i - 8 , j , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
}
2017-04-19 21:24:28 +00:00
// Just M_DrawGenericScrollMenu but showing a backing behind the headers.
static void M_DrawColorMenu ( void )
{
INT32 x , y , i , max , tempcentery , cursory = 0 ;
// DRAW MENU
x = currentMenu - > x ;
y = currentMenu - > y ;
2017-04-29 15:40:07 +00:00
V_DrawFill ( 19 , y - 4 , 47 , 1 , 35 ) ;
V_DrawFill ( 19 + ( 47 ) , y - 4 , 47 , 1 , 73 ) ;
V_DrawFill ( 19 + ( 2 * 47 ) , y - 4 , 47 , 1 , 112 ) ;
V_DrawFill ( 19 + ( 3 * 47 ) , y - 4 , 47 , 1 , 255 ) ;
V_DrawFill ( 19 + ( 4 * 47 ) , y - 4 , 47 , 1 , 152 ) ;
V_DrawFill ( 19 + ( 5 * 47 ) , y - 4 , 46 , 1 , 181 ) ;
V_DrawFill ( 300 , y - 4 , 1 , 1 , 26 ) ;
V_DrawFill ( 19 , y - 3 , 282 , 1 , 26 ) ;
2017-04-19 21:24:28 +00:00
if ( ( currentMenu - > menuitems [ itemOn ] . alphaKey * 2 - currentMenu - > menuitems [ 0 ] . alphaKey * 2 ) < = scrollareaheight )
tempcentery = currentMenu - > y - currentMenu - > menuitems [ 0 ] . alphaKey * 2 ;
else if ( ( currentMenu - > menuitems [ currentMenu - > numitems - 1 ] . alphaKey * 2 - currentMenu - > menuitems [ itemOn ] . alphaKey * 2 ) < = scrollareaheight )
tempcentery = currentMenu - > y - currentMenu - > menuitems [ currentMenu - > numitems - 1 ] . alphaKey * 2 + 2 * scrollareaheight ;
else
tempcentery = currentMenu - > y - currentMenu - > menuitems [ itemOn ] . alphaKey * 2 + scrollareaheight ;
for ( i = 0 ; i < currentMenu - > numitems ; i + + )
{
if ( currentMenu - > menuitems [ i ] . status ! = IT_DISABLED & & currentMenu - > menuitems [ i ] . alphaKey * 2 + tempcentery > = currentMenu - > y )
break ;
}
for ( max = currentMenu - > numitems ; max > 0 ; max - - )
{
if ( currentMenu - > menuitems [ max ] . status ! = IT_DISABLED & & currentMenu - > menuitems [ max - 1 ] . alphaKey * 2 + tempcentery < = ( currentMenu - > y + 2 * scrollareaheight ) )
break ;
}
if ( i )
2017-07-04 12:17:29 +00:00
V_DrawString ( currentMenu - > x - 20 , currentMenu - > y - ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1A " ) ; // up arrow
2017-04-19 21:24:28 +00:00
if ( max ! = currentMenu - > numitems )
2017-07-04 12:17:29 +00:00
V_DrawString ( currentMenu - > x - 20 , currentMenu - > y + 2 * scrollareaheight + ( skullAnimCounter / 5 ) , V_YELLOWMAP , " \x1B " ) ; // down arrow
2017-04-19 21:24:28 +00:00
// draw title (or big pic)
M_DrawMenuTitle ( ) ;
for ( ; i < max ; i + + )
{
y = currentMenu - > menuitems [ i ] . alphaKey * 2 + tempcentery ;
if ( i = = itemOn )
cursory = y ;
switch ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY )
{
case IT_PATCH :
case IT_DYBIGSPACE :
case IT_BIGSLIDER :
case IT_STRING2 :
case IT_DYLITLSPACE :
case IT_GRAYPATCH :
case IT_TRANSTEXT2 :
// unsupported
break ;
case IT_NOTHING :
break ;
case IT_STRING :
case IT_WHITESTRING :
if ( i ! = itemOn & & ( currentMenu - > menuitems [ i ] . status & IT_DISPLAY ) = = IT_STRING )
V_DrawString ( x , y , 0 , currentMenu - > menuitems [ i ] . text ) ;
else
V_DrawString ( x , y , V_YELLOWMAP , currentMenu - > menuitems [ i ] . text ) ;
// Cvar specific handling
switch ( currentMenu - > menuitems [ i ] . status & IT_TYPE )
case IT_CVAR :
{
consvar_t * cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ;
switch ( currentMenu - > menuitems [ i ] . status & IT_CVARTYPE )
{
case IT_CV_SLIDER :
2017-07-04 12:17:29 +00:00
M_DrawSlider ( x , y , cv , ( i = = itemOn ) ) ;
2017-04-19 21:24:28 +00:00
case IT_CV_NOPRINT : // color use this
case IT_CV_INVISSLIDER : // monitor toggles use this
break ;
case IT_CV_STRING :
if ( y + 12 > ( currentMenu - > y + 2 * scrollareaheight ) )
break ;
M_DrawTextBox ( x , y + 4 , MAXSTRINGLENGTH , 1 ) ;
V_DrawString ( x + 8 , y + 12 , V_ALLOWLOWERCASE , cv - > string ) ;
if ( skullAnimCounter < 4 & & i = = itemOn )
V_DrawCharacter ( x + 8 + V_StringWidth ( cv - > string , 0 ) , y + 12 ,
' _ ' | 0x80 , false ) ;
y + = 16 ;
break ;
default :
V_DrawRightAlignedString ( BASEVIDWIDTH - x , y ,
( ( cv - > flags & CV_CHEAT ) & & ! CV_IsSetToDefault ( cv ) ? V_REDMAP : V_YELLOWMAP ) , cv - > string ) ;
2017-07-04 12:17:29 +00:00
if ( i = = itemOn )
{
V_DrawCharacter ( BASEVIDWIDTH - x - 10 - V_StringWidth ( cv - > string , 0 ) - ( skullAnimCounter / 5 ) , y ,
' \x1C ' | V_YELLOWMAP , false ) ;
V_DrawCharacter ( BASEVIDWIDTH - x + 2 + ( skullAnimCounter / 5 ) , y ,
' \x1D ' | V_YELLOWMAP , false ) ;
}
2017-04-19 21:24:28 +00:00
break ;
}
break ;
}
break ;
case IT_TRANSTEXT :
V_DrawString ( x , y , V_TRANSLUCENT , currentMenu - > menuitems [ i ] . text ) ;
break ;
case IT_QUESTIONMARKS :
V_DrawString ( x , y , V_TRANSLUCENT | V_OLDSPACING , M_CreateSecretMenuOption ( currentMenu - > menuitems [ i ] . text ) ) ;
break ;
case IT_HEADERTEXT :
//V_DrawString(x-16, y, V_YELLOWMAP, currentMenu->menuitems[i].text);
V_DrawFill ( 19 , y , 281 , 9 , currentMenu - > menuitems [ i + 1 ] . alphaKey ) ;
V_DrawFill ( 300 , y , 1 , 9 , 26 ) ;
2017-04-29 15:40:07 +00:00
M_DrawLevelPlatterHeader ( y - ( lsheadingheight - 12 ) , currentMenu - > menuitems [ i ] . text , false , false ) ;
2017-04-19 21:24:28 +00:00
break ;
}
}
// DRAW THE SKULL CURSOR
V_DrawScaledPatch ( currentMenu - > x - 24 , cursory , 0 ,
W_CachePatchName ( " M_CURSOR " , PU_CACHE ) ) ;
}
2014-03-15 16:59:03 +00:00
// special menuitem key handler for video mode list
static void M_HandleVideoMode ( INT32 ch )
{
if ( vidm_testingmode > 0 ) switch ( ch )
{
// change back to the previous mode quickly
case KEY_ESCAPE :
setmodeneeded = vidm_previousmode + 1 ;
vidm_testingmode = 0 ;
break ;
case KEY_ENTER :
S_StartSound ( NULL , sfx_menu1 ) ;
vidm_testingmode = 0 ; // stop testing
}
else switch ( ch )
{
case KEY_DOWNARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
if ( + + vidm_selected > = vidm_nummodes )
vidm_selected = 0 ;
break ;
case KEY_UPARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
if ( - - vidm_selected < 0 )
vidm_selected = vidm_nummodes - 1 ;
break ;
case KEY_LEFTARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
vidm_selected - = vidm_column_size ;
if ( vidm_selected < 0 )
vidm_selected = ( vidm_column_size * 3 ) + vidm_selected ;
if ( vidm_selected > = vidm_nummodes )
vidm_selected = vidm_nummodes - 1 ;
break ;
case KEY_RIGHTARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
vidm_selected + = vidm_column_size ;
if ( vidm_selected > = ( vidm_column_size * 3 ) )
vidm_selected % = vidm_column_size ;
if ( vidm_selected > = vidm_nummodes )
vidm_selected = vidm_nummodes - 1 ;
break ;
case KEY_ENTER :
S_StartSound ( NULL , sfx_menu1 ) ;
if ( vid . modenum = = modedescs [ vidm_selected ] . modenum )
SCR_SetDefaultMode ( ) ;
else
{
vidm_testingmode = 15 * TICRATE ;
vidm_previousmode = vid . modenum ;
if ( ! setmodeneeded ) // in case the previous setmode was not finished
setmodeneeded = modedescs [ vidm_selected ] . modenum + 1 ;
}
break ;
case KEY_ESCAPE : // this one same as M_Responder
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
break ;
default :
break ;
}
}
2017-04-20 19:16:10 +00:00
static void M_DrawScreenshotMenu ( void )
{
M_DrawGenericScrollMenu ( ) ;
# ifdef HWRENDER
if ( ( rendermode = = render_opengl ) & & ( itemOn < 7 ) ) // where it starts to go offscreen; change this number if you change the layout of the screenshot menu
{
INT32 y = currentMenu - > y + currentMenu - > menuitems [ op_screenshot_colorprofile ] . alphaKey * 2 ;
if ( itemOn = = 6 )
y - = 10 ;
V_DrawRightAlignedString ( BASEVIDWIDTH - currentMenu - > x , y , V_REDMAP , " ON " ) ;
}
# endif
}
2014-03-15 16:59:03 +00:00
// ===============
// Monitor Toggles
// ===============
static void M_DrawMonitorToggles ( void )
{
INT32 i , y ;
INT32 sum = 0 ;
consvar_t * cv ;
boolean cheating = false ;
M_DrawGenericMenu ( ) ;
// Assumes all are cvar type.
for ( i = 0 ; i < currentMenu - > numitems ; + + i )
{
2017-04-19 21:24:28 +00:00
if ( ! ( currentMenu - > menuitems [ i ] . status & IT_CVAR ) | | ! ( cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ) )
continue ;
2014-03-15 16:59:03 +00:00
sum + = cv - > value ;
if ( ! CV_IsSetToDefault ( cv ) )
cheating = true ;
}
for ( i = 0 ; i < currentMenu - > numitems ; + + i )
{
2017-04-19 21:24:28 +00:00
if ( ! ( currentMenu - > menuitems [ i ] . status & IT_CVAR ) | | ! ( cv = ( consvar_t * ) currentMenu - > menuitems [ i ] . itemaction ) )
continue ;
2014-03-15 16:59:03 +00:00
y = currentMenu - > y + currentMenu - > menuitems [ i ] . alphaKey ;
2017-07-04 12:17:29 +00:00
M_DrawSlider ( currentMenu - > x + 20 , y , cv , ( i = = itemOn ) ) ;
2014-03-15 16:59:03 +00:00
if ( ! cv - > value )
V_DrawRightAlignedString ( 312 , y , V_OLDSPACING | ( ( i = = itemOn ) ? V_YELLOWMAP : 0 ) , " None " ) ;
else
V_DrawRightAlignedString ( 312 , y , V_OLDSPACING | ( ( i = = itemOn ) ? V_YELLOWMAP : 0 ) , va ( " %3d%% " , ( cv - > value * 100 ) / sum ) ) ;
}
if ( cheating )
V_DrawCenteredString ( BASEVIDWIDTH / 2 , currentMenu - > y , V_REDMAP , " * MODIFIED, CHEATS ENABLED * " ) ;
}
// =========
// Quit Game
// =========
static INT32 quitsounds [ ] =
{
// holy shit we're changing things up!
sfx_itemup , // Tails 11-09-99
sfx_jump , // Tails 11-09-99
sfx_skid , // Inu 04-03-13
sfx_spring , // Tails 11-09-99
sfx_pop ,
sfx_spdpad , // Inu 04-03-13
sfx_wdjump , // Inu 04-03-13
sfx_mswarp , // Inu 04-03-13
sfx_splash , // Tails 11-09-99
sfx_floush , // Tails 11-09-99
sfx_gloop , // Tails 11-09-99
sfx_s3k66 , // Inu 04-03-13
sfx_s3k6a , // Inu 04-03-13
sfx_s3k73 , // Inu 04-03-13
sfx_chchng // Tails 11-09-99
} ;
void M_QuitResponse ( INT32 ch )
{
tic_t ptime ;
INT32 mrand ;
if ( ch ! = ' y ' & & ch ! = KEY_ENTER )
return ;
if ( ! ( netgame | | cv_debug ) )
{
2017-04-29 15:40:07 +00:00
S_ResetCaptions ( ) ;
2014-03-15 16:59:03 +00:00
mrand = M_RandomKey ( sizeof ( quitsounds ) / sizeof ( INT32 ) ) ;
if ( quitsounds [ mrand ] ) S_StartSound ( NULL , quitsounds [ mrand ] ) ;
//added : 12-02-98: do that instead of I_WaitVbl which does not work
ptime = I_GetTime ( ) + NEWTICRATE * 2 ; // Shortened the quit time, used to be 2 seconds Tails 03-26-2001
while ( ptime > I_GetTime ( ) )
{
V_DrawScaledPatch ( 0 , 0 , 0 , W_CachePatchName ( " GAMEQUIT " , PU_CACHE ) ) ; // Demo 3 Quit Screen Tails 06-16-2001
I_FinishUpdate ( ) ; // Update the screen with the image Tails 06-19-2001
I_Sleep ( ) ;
}
}
I_Quit ( ) ;
}
static void M_QuitSRB2 ( INT32 choice )
{
// We pick index 0 which is language sensitive, or one at random,
// between 1 and maximum number.
( void ) choice ;
M_StartMessage ( quitmsg [ M_RandomKey ( NUM_QUITMESSAGES ) ] , M_QuitResponse , MM_YESNO ) ;
}
# ifdef HWRENDER
// =====================================================================
// OpenGL specific options
// =====================================================================
# define FOG_COLOR_ITEM 1
// ===================
// M_OGL_DrawFogMenu()
// ===================
static void M_OGL_DrawFogMenu ( void )
{
INT32 mx , my ;
mx = currentMenu - > x ;
my = currentMenu - > y ;
M_DrawGenericMenu ( ) ; // use generic drawer for cursor, items and title
V_DrawString ( BASEVIDWIDTH - mx - V_StringWidth ( cv_grfogcolor . string , 0 ) ,
my + currentMenu - > menuitems [ FOG_COLOR_ITEM ] . alphaKey , V_YELLOWMAP , cv_grfogcolor . string ) ;
// blink cursor on FOG_COLOR_ITEM if selected
if ( itemOn = = FOG_COLOR_ITEM & & skullAnimCounter < 4 )
V_DrawCharacter ( BASEVIDWIDTH - mx ,
my + currentMenu - > menuitems [ FOG_COLOR_ITEM ] . alphaKey , ' _ ' | 0x80 , false ) ;
}
// =====================
// M_OGL_DrawColorMenu()
// =====================
static void M_OGL_DrawColorMenu ( void )
{
INT32 mx , my ;
mx = currentMenu - > x ;
my = currentMenu - > y ;
M_DrawGenericMenu ( ) ; // use generic drawer for cursor, items and title
V_DrawString ( mx , my + currentMenu - > menuitems [ 0 ] . alphaKey - 10 ,
V_YELLOWMAP , " Gamma correction " ) ;
}
//===================
// M_HandleFogColor()
//===================
static void M_HandleFogColor ( INT32 choice )
{
size_t i , l ;
char temp [ 8 ] ;
boolean exitmenu = false ; // exit to previous menu and send name change
switch ( choice )
{
case KEY_DOWNARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
itemOn + + ;
break ;
case KEY_UPARROW :
S_StartSound ( NULL , sfx_menu1 ) ;
itemOn - - ;
break ;
case KEY_ESCAPE :
exitmenu = true ;
break ;
case KEY_BACKSPACE :
S_StartSound ( NULL , sfx_menu1 ) ;
strcpy ( temp , cv_grfogcolor . string ) ;
strcpy ( cv_grfogcolor . zstring , " 000000 " ) ;
l = strlen ( temp ) - 1 ;
for ( i = 0 ; i < l ; i + + )
cv_grfogcolor . zstring [ i + 6 - l ] = temp [ i ] ;
break ;
default :
if ( ( choice > = ' 0 ' & & choice < = ' 9 ' ) | | ( choice > = ' a ' & & choice < = ' f ' )
| | ( choice > = ' A ' & & choice < = ' F ' ) )
{
S_StartSound ( NULL , sfx_menu1 ) ;
strcpy ( temp , cv_grfogcolor . string ) ;
strcpy ( cv_grfogcolor . zstring , " 000000 " ) ;
l = strlen ( temp ) ;
for ( i = 0 ; i < l ; i + + )
cv_grfogcolor . zstring [ 5 - i ] = temp [ l - i ] ;
2016-05-29 01:23:46 +00:00
cv_grfogcolor . zstring [ 5 ] = ( char ) choice ;
2014-03-15 16:59:03 +00:00
}
break ;
}
if ( exitmenu )
{
if ( currentMenu - > prevMenu )
M_SetupNextMenu ( currentMenu - > prevMenu ) ;
else
M_ClearMenus ( true ) ;
}
}
# endif