2012-11-26 18:58:24 +00:00
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Doom 3 BFG Edition GPL Source Code
|
2012-11-28 15:47:07 +00:00
|
|
|
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code 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 Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
|
|
|
|
|
|
|
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
#pragma hdrstop
|
2012-12-02 21:37:32 +00:00
|
|
|
#include "../../idlib/precompiled.h"
|
2012-11-26 18:58:24 +00:00
|
|
|
#include "../Game_local.h"
|
|
|
|
|
|
|
|
const static int NUM_DEV_OPTIONS = 8;
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_Dev::Initialize
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_Dev::Initialize( idMenuHandler* data )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Initialize( data );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( data != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuGUI = data->GetGUI();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
SetSpritePath( "menuSettings" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
options = new( TAG_SWF ) idMenuWidget_DynamicList();
|
2012-11-26 18:58:24 +00:00
|
|
|
options->SetNumVisibleOptions( NUM_DEV_OPTIONS );
|
|
|
|
options->SetSpritePath( GetSpritePath(), "info", "options" );
|
|
|
|
options->SetWrappingAllowed( true );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
while( options->GetChildren().Num() < NUM_DEV_OPTIONS )
|
|
|
|
{
|
|
|
|
idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button();
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, options->GetChildren().Num() );
|
|
|
|
buttonWidget->Initialize( data );
|
|
|
|
options->AddChild( buttonWidget );
|
|
|
|
}
|
|
|
|
options->Initialize( data );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
AddChild( options );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
btnBack = new( TAG_SWF ) idMenuWidget_Button();
|
|
|
|
btnBack->Initialize( data );
|
2012-11-26 18:58:24 +00:00
|
|
|
btnBack->SetLabel( "MAIN MENU" );
|
|
|
|
btnBack->SetSpritePath( GetSpritePath(), "info", "btnBack" );
|
|
|
|
btnBack->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_GO_BACK );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
AddChild( btnBack );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
SetupDevOptions();
|
2012-11-28 15:47:07 +00:00
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
|
|
|
|
options->AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( options, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_Dev::SetupDevOptions
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_Dev::SetupDevOptions()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
devOptions.Clear();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
devOptions.Append( devOption_t( "game/mars_city1", "Mars City 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/mc_underground", "MC Underground" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/mars_city2", "Mars City 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/admin", "Admin" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/alphalabs1", "Alpha Labs 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/alphalabs2", "Alpha Labs 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/alphalabs3", "Alpha Labs 3" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/alphalabs4", "Alpha Labs 4" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/enpro", "Enpro" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/commoutside", "Comm outside" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/comm1", "Comm 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/recycling1", "Recycling 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/recycling2", "Recycling 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/monorail", "Monorail" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/delta1", "Delta Labs 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/delta2a", "Delta Labs 2a" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/delta2b", "Delta Labs 2b" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/delta3", "Delta Labs 3" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/delta4", "Delta Labs 4" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/hell1", "Hell 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/delta5", "Delta Labs 5" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/cpu", "CPU" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/cpuboss", "CPU Boss" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/site3", "Site 3" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/caverns1", "Caverns 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/caverns2", "Caverns 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/hellhole", "Hell Hole" ) );
|
|
|
|
devOptions.Append( devOption_t( NULL, "-DOOM 3 Expansion-" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/erebus1", "Erebus 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/erebus2", "Erebus 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/erebus3", "Erebus 3" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/erebus4", "Erebus 4" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/erebus5", "Erebus 5" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/erebus6", "Erebus 6" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/phobos1", "Phobos 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/phobos2", "Phobos 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/phobos3", "Phobos 3" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/phobos4", "Phobos 4" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/deltax", "Delta X" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/hell", "Hell" ) );
|
|
|
|
devOptions.Append( devOption_t( NULL, "-Lost Missions-" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_enpro1", "Enpro 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_enpro2", "Enpro 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_underground", "Undeground" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_underground2", "Undeground 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_exis1", "Exis 1" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_exis2", "Exis 2" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_hell", "Hell" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/le_hell_post", "Hell Post" ) );
|
|
|
|
devOptions.Append( devOption_t( NULL, "-Test Maps-" ) );
|
|
|
|
devOptions.Append( devOption_t( "game/pdas", "PDAs" ) );
|
|
|
|
devOptions.Append( devOption_t( "testmaps/test_box", "Box" ) );
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
idList< idList< idStr, TAG_IDLIB_LIST_MENU >, TAG_IDLIB_LIST_MENU > menuOptions;
|
|
|
|
|
|
|
|
for( int i = 0; i < devOptions.Num(); ++i )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idList< idStr > option;
|
|
|
|
option.Append( devOptions[ i ].name );
|
|
|
|
menuOptions.Append( option );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
options->SetListData( menuOptions );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_Dev::Update
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_Dev::Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
if( menuData != NULL )
|
|
|
|
{
|
|
|
|
idMenuWidget_CommandBar* cmdBar = menuData->GetCmdBar();
|
|
|
|
if( cmdBar != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
cmdBar->ClearAllButtons();
|
2012-11-28 15:47:07 +00:00
|
|
|
idMenuWidget_CommandBar::buttonInfo_t* buttonInfo;
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY2 );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData->GetPlatform() != 2 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo->label = "#str_00395";
|
|
|
|
}
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY1 );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData->GetPlatform() != 2 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo->label = "#str_SWF_SELECT";
|
|
|
|
}
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_PRESS_FOCUSED );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( BindSprite( root ) )
|
|
|
|
{
|
|
|
|
idSWFTextInstance* heading = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtHeading" );
|
|
|
|
if( heading != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
heading->SetText( "DEV" );
|
|
|
|
heading->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFSpriteInstance* gradient = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "gradient" );
|
|
|
|
if( gradient != NULL && heading != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
gradient->SetXPos( heading->GetTextLength() );
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( btnBack != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
btnBack->BindSprite( root );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_Dev::ShowScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_Dev::ShowScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::ShowScreen( transitionType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_Dev::HideScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Shell_Dev::HideScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::HideScreen( transitionType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Shell_Dev::HandleAction h
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_Shell_Dev::HandleAction( idWidgetAction& action, const idWidgetEvent& event, idMenuWidget* widget, bool forceHandled )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( menuData->ActiveScreen() != SHELL_AREA_DEV )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
widgetAction_t actionType = action.GetType();
|
2012-11-28 15:47:07 +00:00
|
|
|
const idSWFParmList& parms = action.GetParms();
|
|
|
|
|
|
|
|
switch( actionType )
|
|
|
|
{
|
|
|
|
case WIDGET_ACTION_GO_BACK:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_PRESS_FOCUSED:
|
|
|
|
{
|
|
|
|
if( options == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int selectionIndex = options->GetViewIndex();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( parms.Num() == 1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
selectionIndex = parms[0].ToInteger();
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( options->GetFocusIndex() != selectionIndex - options->GetViewOffset() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
options->SetFocusIndex( selectionIndex );
|
|
|
|
options->SetViewIndex( options->GetViewOffset() + selectionIndex );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int mapIndex = options->GetViewIndex();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( ( mapIndex < devOptions.Num() ) && ( devOptions[ mapIndex ].map != NULL ) )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
cmdSystem->AppendCommandText( va( "devmap %s\n", devOptions[ mapIndex ].map ) );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return idMenuWidget::HandleAction( action, event, widget, forceHandled );
|
|
|
|
}
|