/* Copyright (C) 2003-2006 Andrey Nazarov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "ui_local.h" /* ======================================================================= MODS MENU ======================================================================= */ #define ID_LIST 102 #define MAX_LISTED_MODS 32 typedef struct modsMenu_s { menuFrameWork_t menu; menuList_t list; menuStatic_t banner; int numMods; char *names[MAX_LISTED_MODS+1]; char *directories[MAX_LISTED_MODS]; char **modlist; int lastClick; } modsMenu_t; static modsMenu_t m_mods; static int ModsMenu_Callback( int id, int msg, int param ) { switch( msg ) { case QM_ACTIVATE: cvar.Set( "game", m_mods.directories[m_mods.list.curvalue] ); cmd.ExecuteText( EXEC_APPEND, "fs_restart" ); UI_ForceMenuOff(); return QMS_SILENT; case QM_DESTROY: if( m_mods.modlist ) { fs.FreeFileList( m_mods.modlist ); m_mods.modlist = NULL; } break; default: break; } return QMS_NOTHANDLED; } static void ModsMenu_Init( void ) { int i; char *p; char *current; memset( &m_mods, 0, sizeof( m_mods ) ); m_mods.names[0] = "Quake II"; m_mods.directories[0] = ""; current = cvar.VariableString( "game" ); if( ( m_mods.modlist = fs.ListFiles( "$modlist", NULL, 0, &m_mods.numMods ) ) != NULL ) { if( m_mods.numMods > MAX_LISTED_MODS - 1 ) { m_mods.numMods = MAX_LISTED_MODS - 1; } for( i=0 ; i