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"
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
// DEFAULT SCOREBOARD
|
|
|
|
//***************************************************************
|
|
|
|
static const int MAX_SCOREBOARD_SLOTS = 8;
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::Initialize
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::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( "sbDefault" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
playerList = new( TAG_SWF ) idMenuWidget_ScoreboardList();
|
2012-11-26 18:58:24 +00:00
|
|
|
playerList->SetSpritePath( GetSpritePath(), "info", "playerList" );
|
|
|
|
playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS );
|
|
|
|
playerList->SetWrappingAllowed( true );
|
2012-11-28 15:47:07 +00:00
|
|
|
while( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS )
|
|
|
|
{
|
|
|
|
idMenuWidget_ScoreboardButton* const buttonWidget = new( TAG_SWF ) idMenuWidget_ScoreboardButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() );
|
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() );
|
|
|
|
buttonWidget->Initialize( data );
|
|
|
|
playerList->AddChild( buttonWidget );
|
|
|
|
}
|
|
|
|
playerList->Initialize( data );
|
|
|
|
AddChild( playerList );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::Update
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::Update()
|
|
|
|
{
|
|
|
|
|
|
|
|
if( menuData != NULL )
|
|
|
|
{
|
|
|
|
idMenuWidget_CommandBar* cmdBar = dynamic_cast< idMenuWidget_CommandBar* const >( menuData->GetChildFromIndex( SCOREBOARD_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;
|
|
|
|
|
|
|
|
if( gameLocal.mpGame.GetGameState() != idMultiplayerGame::GAMEREVIEW )
|
|
|
|
{
|
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 );
|
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
|
|
|
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_view_profile";
|
|
|
|
}
|
|
|
|
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
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::Update();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::ShowScreen
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::ShowScreen( const mainMenuTransition_t transitionType )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idMenuScreen::ShowScreen( transitionType );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( GetSWFObject() )
|
|
|
|
{
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( BindSprite( root ) )
|
|
|
|
{
|
|
|
|
|
|
|
|
idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScoreboard" );
|
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02618" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.9f, 2.0f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtGameType" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr mode = idLocalization::GetString( "#str_02376" );
|
2012-11-28 15:47:07 +00:00
|
|
|
mode.Append( ": " );
|
|
|
|
const idStrList& modes = common->GetModeDisplayList();
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr modeName = idLocalization::GetString( modes[ idMath::ClampInt( 0, modes.Num() - 1, gameLocal.gameType ) ] );
|
|
|
|
mode.Append( idLocalization::GetString( idLocalization::GetString( modeName ) ) );
|
|
|
|
txtVal->SetText( mode );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.9f, 1.8f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtNameHeading" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02181" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScore" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
|
|
|
if( gameLocal.gameType == GAME_LASTMAN )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( idLocalization::GetString( "#str_04242" ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else if( gameLocal.gameType == GAME_CTF )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( idLocalization::GetString( "#str_11112" ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( idLocalization::GetString( "#str_04243" ) );
|
|
|
|
}
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtWins" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02619" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtPing" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02048" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtNameHeading2" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02181" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtScore2" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
|
|
|
if( gameLocal.gameType == GAME_LASTMAN )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( idLocalization::GetString( "#str_04242" ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else if( gameLocal.gameType == GAME_CTF )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( idLocalization::GetString( "#str_11112" ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( idLocalization::GetString( "#str_04243" ) );
|
|
|
|
}
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtWins2" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02619" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtPing2" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( "#str_02048" );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
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_Scoreboard::SetPlayerData
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::SetPlayerData( idList< scoreboardInfo_t, TAG_IDLIB_LIST_MENU > data )
|
|
|
|
{
|
|
|
|
if( playerList != NULL )
|
|
|
|
{
|
|
|
|
for( int i = 0; i < data.Num(); ++i )
|
|
|
|
{
|
|
|
|
if( i < playerList->GetChildren().Num() )
|
|
|
|
{
|
|
|
|
idMenuWidget_ScoreboardButton* button = dynamic_cast< idMenuWidget_ScoreboardButton* >( &playerList->GetChildByIndex( i ) );
|
|
|
|
if( button != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
button->SetButtonInfo( data[i].index, data[i].values, data[i].voiceState );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
playerList->Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::UpdateGameInfo
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::UpdateGameInfo( idStr gameInfo )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( GetSWFObject() )
|
|
|
|
{
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( BindSprite( root ) )
|
|
|
|
{
|
|
|
|
|
|
|
|
idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtGameInfo" );
|
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( gameInfo );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::UpdateSpectating
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::UpdateSpectating( idStr spectating, idStr follow )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( GetSWFObject() )
|
|
|
|
{
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( BindSprite( root ) )
|
|
|
|
{
|
|
|
|
|
|
|
|
idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtSpectating" );
|
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->tooltip = true;
|
|
|
|
txtVal->SetText( spectating );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtFollow" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( follow );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::UpdateTeamScores
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::UpdateTeamScores( int r, int b )
|
|
|
|
{
|
|
|
|
|
|
|
|
if( GetSWFObject() )
|
|
|
|
{
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( BindSprite( root ) )
|
|
|
|
{
|
|
|
|
|
|
|
|
idSWFTextInstance* txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtRedScore" );
|
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( va( "%i", r ) );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal = GetSprite()->GetScriptObject()->GetNestedText( "info", "txtBlueScore" );
|
2012-11-28 15:47:07 +00:00
|
|
|
if( txtVal != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
txtVal->SetText( va( "%i", b ) );
|
|
|
|
txtVal->SetStrokeInfo( true, 0.75f, 1.75f );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::UpdateHighlight
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard::UpdateHighlight()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( playerList == NULL || menuData == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int curIndex = playerList->GetViewIndex();
|
|
|
|
int newIndex = playerList->GetViewIndex();
|
|
|
|
int numRed = data->GetNumPlayers( 0 );
|
2012-11-28 15:47:07 +00:00
|
|
|
int numBlue = data->GetNumPlayers( 1 );
|
|
|
|
|
|
|
|
if( numBlue == 0 )
|
|
|
|
{
|
|
|
|
if( curIndex >= numRed )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
newIndex = numRed - 1;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( curIndex > 3 + numBlue )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
newIndex = 3 + numBlue;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else if( curIndex <= 3 )
|
|
|
|
{
|
|
|
|
if( numRed == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
newIndex = 4;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( curIndex >= numRed )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
newIndex = numRed - 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// newIndex can be -1 if all players are spectating ( no rankedplayers )
|
2012-11-28 15:47:07 +00:00
|
|
|
if( newIndex != curIndex && newIndex != -1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
playerList->SetViewIndex( newIndex );
|
|
|
|
playerList->SetFocusIndex( newIndex );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard::HandleAction
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
bool idMenuScreen_Scoreboard::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
|
|
|
|
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( SCOREBOARD_AREA_INVALID, MENU_TRANSITION_SIMPLE );
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_MUTE_PLAYER:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( parms.Num() != 1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
|
|
|
|
|
|
|
|
if( !data )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
int index = parms[0].ToInteger();
|
|
|
|
data->MutePlayer( index );
|
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_PRESS_FOCUSED:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( playerList == 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 = playerList->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( selectionIndex != playerList->GetFocusIndex() )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
playerList->SetViewIndex( playerList->GetViewOffset() + selectionIndex );
|
|
|
|
playerList->SetFocusIndex( selectionIndex );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
|
|
|
|
|
|
|
|
if( !data )
|
|
|
|
{
|
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 numRed = data->GetNumPlayers( 0 );
|
|
|
|
int numBlue = data->GetNumPlayers( 1 );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( selectionIndex >= 4 && numBlue != 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
int index = numRed + ( selectionIndex - 4 );
|
|
|
|
data->ViewPlayerProfile( index );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
data->ViewPlayerProfile( selectionIndex );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
case WIDGET_ACTION_SCROLL_VERTICAL_VARIABLE:
|
|
|
|
{
|
|
|
|
|
|
|
|
if( parms.Num() == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( playerList )
|
|
|
|
{
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
int dir = parms[ 0 ].ToInteger();
|
|
|
|
int scroll = 0;
|
|
|
|
int curIndex = playerList->GetFocusIndex();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuHandler_Scoreboard* data = dynamic_cast< idMenuHandler_Scoreboard* >( menuData );
|
|
|
|
|
|
|
|
if( !data )
|
|
|
|
{
|
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 numRed = data->GetNumPlayers( 0 );
|
|
|
|
int numBlue = data->GetNumPlayers( 1 );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( numRed + numBlue <= 1 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( dir > 0 )
|
|
|
|
{
|
|
|
|
if( numBlue == 0 )
|
|
|
|
{
|
|
|
|
if( curIndex + 1 >= numRed )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = MAX_SCOREBOARD_SLOTS - curIndex;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = dir;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( curIndex < 4 )
|
|
|
|
{
|
|
|
|
if( curIndex + 1 >= numRed )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = ( MAX_SCOREBOARD_SLOTS * 0.5f ) - curIndex;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = dir;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( curIndex - 3 >= numBlue )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = MAX_SCOREBOARD_SLOTS - curIndex;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = dir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else if( dir < 0 )
|
|
|
|
{
|
|
|
|
if( numBlue == 0 )
|
|
|
|
{
|
|
|
|
if( curIndex - 1 < 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = numRed - 1;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = dir;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( curIndex < 4 )
|
|
|
|
{
|
|
|
|
if( curIndex - 1 < 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = ( ( MAX_SCOREBOARD_SLOTS * 0.5f ) + numBlue ) - 1;
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = dir;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if( curIndex - 1 < 4 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = -( ( MAX_SCOREBOARD_SLOTS * 0.5f ) - ( numRed - 1 ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
scroll = dir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( scroll != 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
playerList->Scroll( scroll );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
// CTF SCOREBOARD
|
|
|
|
//***************************************************************
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard_CTF::Initialize
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard_CTF::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( "sbCTF" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
playerList = new( TAG_SWF ) idMenuWidget_ScoreboardList();
|
2012-11-26 18:58:24 +00:00
|
|
|
playerList->SetSpritePath( GetSpritePath(), "info", "playerList" );
|
|
|
|
playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS );
|
|
|
|
playerList->SetWrappingAllowed( true );
|
2012-11-28 15:47:07 +00:00
|
|
|
while( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS )
|
|
|
|
{
|
|
|
|
idMenuWidget_ScoreboardButton* const buttonWidget = new( TAG_SWF ) idMenuWidget_ScoreboardButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() );
|
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() );
|
|
|
|
buttonWidget->Initialize( data );
|
|
|
|
playerList->AddChild( buttonWidget );
|
|
|
|
}
|
|
|
|
playerList->Initialize( data );
|
|
|
|
AddChild( playerList );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//***************************************************************
|
|
|
|
// TEAM SCOREBOARD
|
|
|
|
//***************************************************************
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuScreen_Scoreboard_Team::Initialize
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuScreen_Scoreboard_Team::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( "sbTeam" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
playerList = new( TAG_SWF ) idMenuWidget_ScoreboardList();
|
2012-11-26 18:58:24 +00:00
|
|
|
playerList->SetSpritePath( GetSpritePath(), "info", "playerList" );
|
|
|
|
playerList->SetNumVisibleOptions( MAX_SCOREBOARD_SLOTS );
|
|
|
|
playerList->SetWrappingAllowed( true );
|
2012-11-28 15:47:07 +00:00
|
|
|
while( playerList->GetChildren().Num() < MAX_SCOREBOARD_SLOTS )
|
|
|
|
{
|
|
|
|
idMenuWidget_ScoreboardButton* const buttonWidget = new( TAG_SWF ) idMenuWidget_ScoreboardButton();
|
2012-11-26 18:58:24 +00:00
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_PRESS ).Set( WIDGET_ACTION_PRESS_FOCUSED, playerList->GetChildren().Num() );
|
|
|
|
buttonWidget->AddEventAction( WIDGET_EVENT_COMMAND ).Set( WIDGET_ACTION_MUTE_PLAYER, playerList->GetChildren().Num() );
|
|
|
|
buttonWidget->Initialize( data );
|
|
|
|
playerList->AddChild( buttonWidget );
|
|
|
|
}
|
|
|
|
playerList->Initialize( data );
|
|
|
|
AddChild( playerList );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP_LSTICK ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_LSTICK_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_DOWN_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_DOWN ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_SCROLL_UP_START_REPEATER_VARIABLE, WIDGET_EVENT_SCROLL_UP ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_DOWN_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_DOWN_RELEASE ) );
|
|
|
|
AddEventAction( WIDGET_EVENT_SCROLL_UP_RELEASE ).Set( new( TAG_SWF ) idWidgetActionHandler( this, WIDGET_ACTION_EVENT_STOP_REPEATER, WIDGET_EVENT_SCROLL_UP_RELEASE ) );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|