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
|
|
|
|
#include "../../idLib/precompiled.h"
|
|
|
|
#include "../Game_local.h"
|
|
|
|
|
|
|
|
static const int NUM_INVENTORY_ITEMS_VISIBLE = 9;
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::Initialize
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_PDA_Inventory::Initialize( idMenuHandler* data )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
AddEventAction( WIDGET_EVENT_TAB_NEXT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_NEXT, WIDGET_EVENT_TAB_NEXT ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_TAB_PREV ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_TAB_PREV, WIDGET_EVENT_TAB_PREV ) );
|
|
|
|
|
|
|
|
if( data != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuGUI = data->GetGUI();
|
|
|
|
}
|
|
|
|
SetSpritePath( "menuItems" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( menuGUI != NULL )
|
|
|
|
{
|
|
|
|
idSWFScriptObject& root = menuGUI->GetRootObject();
|
2012-11-26 18:58:24 +00:00
|
|
|
BindSprite( root );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
infoBox.SetSpritePath( GetSpritePath(), "info", "details" );
|
|
|
|
infoBox.Initialize( data );
|
|
|
|
infoBox.SetNoAutoFree( true );
|
|
|
|
|
|
|
|
itemList.SetSpritePath( GetSpritePath(), "info", "options" );
|
|
|
|
itemList.SetNumVisibleOptions( NUM_INVENTORY_ITEMS_VISIBLE );
|
|
|
|
itemList.SetNoAutoFree( true );
|
2012-11-28 15:47:07 +00:00
|
|
|
while( itemList.GetChildren().Num() < NUM_INVENTORY_ITEMS_VISIBLE )
|
|
|
|
{
|
|
|
|
idMenuWidget_Button* const buttonWidget = new( TAG_SWF ) idMenuWidget_Button();
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonWidget->Initialize( data );
|
2012-11-28 15:47:07 +00:00
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_SELECT_PDA_ITEM, itemList.GetChildren().Num() );
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.AddChild( buttonWidget );
|
|
|
|
}
|
|
|
|
itemList.Initialize( data );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
AddChild( &itemList );
|
|
|
|
AddChild( &infoBox );
|
|
|
|
//AddChild( assignment );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_LEFT_START_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_RIGHT_START_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ) );
|
|
|
|
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Initialize( data );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::ShowScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_PDA_Inventory::ShowScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
|
|
|
idPlayer* player = gameLocal.GetLocalPlayer();
|
|
|
|
if( player != NULL )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int numItems = player->GetInventory().items.Num();
|
2012-11-28 15:47:07 +00:00
|
|
|
for( int j = 0; j < numItems; j++ )
|
|
|
|
{
|
|
|
|
idDict* item = player->GetInventory().items[j];
|
|
|
|
if( !item->GetBool( "inv_pda" ) )
|
|
|
|
{
|
|
|
|
const char* iname = item->GetString( "inv_name" );
|
|
|
|
const char* iicon = item->GetString( "inv_icon" );
|
|
|
|
const char* itext = item->GetString( "inv_text" );
|
2012-11-26 18:58:24 +00:00
|
|
|
iname = iname;
|
|
|
|
iicon = iicon;
|
|
|
|
itext = itext;
|
2012-11-28 15:47:07 +00:00
|
|
|
const idKeyValue* kv = item->MatchPrefix( "inv_id", NULL );
|
|
|
|
if( kv )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
//objectiveSystem->SetStateString( va( "inv_id_%i", j ), kv->GetValue() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idList<const idMaterial*> weaponIcons;
|
|
|
|
for( int j = 0; j < MAX_WEAPONS; j++ )
|
|
|
|
{
|
|
|
|
|
|
|
|
const char* weap = GetWeaponName( j );
|
|
|
|
if( weap == NULL || *weap == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( !IsVisibleWeapon( j ) )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const idDeclEntityDef* weaponDef = gameLocal.FindEntityDef( weap, false );
|
|
|
|
if( weaponDef != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
weaponIcons.Append( declManager->FindMaterial( weaponDef->dict.GetString( "hudIcon" ), false ) );
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.SetListImages( weaponIcons );
|
|
|
|
itemList.SetViewIndex( 0 );
|
|
|
|
itemList.SetMoveToIndex( 0 );
|
|
|
|
itemList.SetMoveDiff( 0 );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::ShowScreen( transitionType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::HideScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_PDA_Inventory::HideScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::HideScreen( transitionType );
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::GetWeaponName
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
const char* idMenuScreen_PDA_Inventory::GetWeaponName( int index )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
idPlayer* player = gameLocal.GetLocalPlayer();
|
|
|
|
if( player == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const char* weaponDefName = va( "def_weapon%d", index );
|
|
|
|
if( player->GetInventory().weapons & ( 1 << index ) )
|
|
|
|
{
|
|
|
|
return player->spawnArgs.GetString( weaponDefName );
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::GetWeaponName
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_PDA_Inventory::IsVisibleWeapon( int index )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
idPlayer* player = gameLocal.GetLocalPlayer();
|
|
|
|
if( player == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( player->GetInventory().weapons & ( 1 << index ) )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return player->spawnArgs.GetBool( va( "weapon%d_visible", index ) );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::Update
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_PDA_Inventory::Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
idPlayer* player = gameLocal.GetLocalPlayer();
|
|
|
|
if( player == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Update();
|
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
int validIndex = 0;
|
|
|
|
for( int j = 0; j < MAX_WEAPONS; j++ )
|
|
|
|
{
|
|
|
|
|
|
|
|
const char* weap = GetWeaponName( j );
|
|
|
|
if( weap == NULL || *weap == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( !IsVisibleWeapon( j ) )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const idDeclEntityDef* weaponDef = gameLocal.FindEntityDef( weap, false );
|
|
|
|
if( weaponDef == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( validIndex == itemList.GetMoveToIndex() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr itemName = weaponDef->dict.GetString( "display_name" );
|
|
|
|
idStr itemDesc = weaponDef->dict.GetString( "inv_desc" );
|
|
|
|
infoBox.SetHeading( idLocalization::GetString( itemName.c_str() ) );
|
|
|
|
infoBox.SetBody( idLocalization::GetString( itemDesc.c_str() ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
validIndex++;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( GetSprite() != NULL )
|
|
|
|
{
|
|
|
|
idSWFSpriteInstance* dpad = GetSprite()->GetScriptObject()->GetNestedSprite( "info", "dpad" );
|
|
|
|
if( dpad != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
dpad->SetVisible( false );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( menuData != NULL )
|
|
|
|
{
|
|
|
|
idMenuWidget_CommandBar* cmdBar = dynamic_cast< idMenuWidget_CommandBar* const >( menuData->GetChildFromIndex( PDA_WIDGET_CMD_BAR ) );
|
|
|
|
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_01345";
|
|
|
|
}
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
|
|
|
|
|
|
|
|
buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_JOY3 );
|
|
|
|
buttonInfo->label = "#str_SWF_EQUIP";
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_JOY3_ON_PRESS );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonInfo = cmdBar->GetButton( idMenuWidget_CommandBar::BUTTON_TAB );
|
|
|
|
buttonInfo->label = "";
|
|
|
|
buttonInfo->action.Set( WIDGET_ACTION_GO_BACK );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::EquipWeapon
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_PDA_Inventory::EquipWeapon()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( itemList.GetViewIndex() != itemList.GetMoveToIndex() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idPlayer* player = gameLocal.GetLocalPlayer();
|
|
|
|
if( player == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int validIndex = 0;
|
2012-11-28 15:47:07 +00:00
|
|
|
for( int j = 0; j < MAX_WEAPONS; j++ )
|
|
|
|
{
|
|
|
|
|
|
|
|
const char* weap = GetWeaponName( j );
|
|
|
|
if( weap == NULL || *weap == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
continue;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !IsVisibleWeapon( j ) )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( validIndex == itemList.GetMoveToIndex() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
int slot = player->SlotForWeapon( weap );
|
|
|
|
player->SetPreviousWeapon( slot );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
validIndex++;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
player->TogglePDA();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_PDA_Inventory::HandleAction
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_PDA_Inventory::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() != PDA_AREA_INVENTORY )
|
|
|
|
{
|
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_JOY3_ON_PRESS:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
EquipWeapon();
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_GO_BACK:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuData->SetNextScreen( PDA_AREA_INVALID, MENU_TRANSITION_ADVANCE );
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_START_REPEATER:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idWidgetAction repeatAction;
|
|
|
|
widgetAction_t repeatActionType = static_cast< widgetAction_t >( parms[ 0 ].ToInteger() );
|
|
|
|
assert( parms.Num() == 2 );
|
|
|
|
repeatAction.Set( repeatActionType, parms[ 1 ] );
|
|
|
|
menuData->StartWidgetActionRepeater( widget, repeatAction, event );
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_SELECT_PDA_ITEM:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( itemList.GetMoveDiff() > 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.MoveToIndex( itemList.GetMoveToIndex(), true );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int index = parms[0].ToInteger();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( index != 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.MoveToIndex( index );
|
|
|
|
Update();
|
|
|
|
}
|
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
|
|
|
case WIDGET_ACTION_STOP_REPEATER:
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
menuData->ClearWidgetActionRepeater();
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_SCROLL_HORIZONTAL:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( itemList.GetTotalNumberOfOptions() <= 1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( itemList.GetMoveDiff() > 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.MoveToIndex( itemList.GetMoveToIndex(), true );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int direction = parms[0].ToInteger();
|
2012-11-28 15:47:07 +00:00
|
|
|
if( direction == 1 )
|
|
|
|
{
|
|
|
|
if( itemList.GetViewIndex() == itemList.GetTotalNumberOfOptions() - 1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.MoveToIndex( 1 );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( itemList.GetViewIndex() == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
itemList.MoveToIndex( ( itemList.GetNumVisibleOptions() / 2 ) + 1 );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
Update();
|
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 );
|
|
|
|
}
|