123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- /*
- ===========================================================================
- Doom 3 BFG Edition GPL Source Code
- Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
- This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
- 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"
- /*
- ================================================================================================
- idMenuWidget_Button
- SWF object structure
- --------------------
- BUTTON (Frames: up, over, out, down, release, disabled, sel_up, sel_over, sel_out, sel_down, sel_release, selecting, unselecting)
- txtOption
- txtValue (Text)
- optionType (Frames: One per mainMenuOption_t enum)
- sliderBar
- bar (Frames: 1-100 for percentage filled)
- btnLess
- btnMore
- sliderText
- txtVal (Text)
- btnLess
- btnMore
- Future work:
- - Perhaps this should be called "MultiButton", since it merges additional controls with a standard button?
- ================================================================================================
- */
- //---------------------------------
- // Animation State Transitions
- //
- // Maps animations that should be called when transitioning states:
- //
- // X-axis = state transitioning FROM
- // Y-axis = state transitioning TO
- //
- // An empty string indicates remain at current animation.
- //---------------------------------
- static const char * ANIM_STATE_TRANSITIONS[ idMenuWidget_Button::ANIM_STATE_MAX * idMenuWidget_Button::ANIM_STATE_MAX ] = {
- // UP DOWN OVER
- "", "release", "out", // UP
- "down", "", "down", // DOWN
- "over", "over", "", // OVER
- };
- // script name for the control object for a given type of button
- static const char * const CONTROL_SPRITE_NAMES[ MAX_MENU_OPTION_TYPES ] = {
- NULL,
- "sliderBar",
- "sliderText",
- "sliderText",
- NULL,
- "sliderText",
- };
- compile_time_assert( sizeof( CONTROL_SPRITE_NAMES ) / sizeof( CONTROL_SPRITE_NAMES[ 0 ] ) == MAX_MENU_OPTION_TYPES );
- /*
- ========================
- idMenuWidget_Button::Update
- ========================
- */
- void idMenuWidget_Button::Update() {
- if ( menuData != NULL && menuData->GetGUI() != NULL ) {
- BindSprite( menuData->GetGUI()->GetRootObject() );
- }
- if ( GetSprite() == NULL ) {
- return;
- }
- idSWFScriptObject * const spriteObject = GetSprite()->GetScriptObject();
- if ( btnLabel.IsEmpty() ) {
- if ( values.Num() > 0 ) {
- for ( int val = 0; val < values.Num(); ++val ) {
- idSWFScriptObject * const textObject = spriteObject->GetNestedObj( va( "label%d", val ), "txtVal" );
- if ( textObject != NULL ) {
- idSWFTextInstance * const text = textObject->GetText();
- text->SetIgnoreColor( ignoreColor );
- text->tooltip = ignoreColor; // ignoreColor does double duty as "allow tooltips"
- text->SetText( values[ val ].c_str() );
- text->SetStrokeInfo( true, 0.75f, 2.0f );
- }
- }
- } else if ( img != NULL ) {
- idSWFSpriteInstance * btnImg = spriteObject->GetNestedSprite( "img" );
- if ( btnImg != NULL ) {
- btnImg->SetMaterial( img );
- }
- btnImg = spriteObject->GetNestedSprite( "imgTop" );
- if ( btnImg != NULL ) {
- btnImg->SetMaterial( img );
- }
- } else {
- ClearSprite();
- }
- } else {
- idSWFScriptObject * const textObject = spriteObject->GetNestedObj( "label0", "txtVal" );
- if ( textObject != NULL ) {
- idSWFTextInstance * const text = textObject->GetText();
- text->SetIgnoreColor( ignoreColor );
- text->tooltip = ignoreColor; // ignoreColor does double duty as "allow tooltips"
- text->SetText( btnLabel.c_str() );
- text->SetStrokeInfo( true, 0.75f, 2.0f );
- }
- }
- // events
- spriteObject->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_PRESS, 0 ) );
- spriteObject->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_RELEASE, 0 ) );
- idSWFScriptObject * hitBox = spriteObject->GetObject( "hitBox" );
- if ( hitBox == NULL ) {
- hitBox = spriteObject;
- }
- hitBox->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- hitBox->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- }
- /*
- ========================
- idMenuWidget_Button::ExecuteEvent
- ========================
- */
- bool idMenuWidget_Button::ExecuteEvent( const idWidgetEvent & event ) {
- bool handled = false;
- // do nothing at all if it's disabled
- if ( GetState() != WIDGET_STATE_DISABLED ) {
- switch ( event.type ) {
- case WIDGET_EVENT_PRESS: {
- if ( GetMenuData() != NULL ) {
- GetMenuData()->PlaySound( GUI_SOUND_ADVANCE );
- }
- AnimateToState( ANIM_STATE_DOWN );
- handled = true;
- break;
- }
- case WIDGET_EVENT_RELEASE: {
- AnimateToState( ANIM_STATE_UP );
- GetMenuData()->ClearWidgetActionRepeater();
- handled = true;
- break;
- }
- case WIDGET_EVENT_ROLL_OVER: {
- if ( GetMenuData() != NULL ) {
- GetMenuData()->PlaySound( GUI_SOUND_ROLL_OVER );
- }
- AnimateToState( ANIM_STATE_OVER );
- handled = true;
- break;
- }
- case WIDGET_EVENT_ROLL_OUT: {
- AnimateToState( ANIM_STATE_UP );
- GetMenuData()->ClearWidgetActionRepeater();
- handled = true;
- break;
- }
- case WIDGET_EVENT_FOCUS_OFF: {
- SetState( WIDGET_STATE_NORMAL );
- handled = true;
- break;
- }
- case WIDGET_EVENT_FOCUS_ON: {
- SetState( WIDGET_STATE_SELECTING );
- handled = true;
- break;
- }
- case WIDGET_EVENT_SCROLL_LEFT_RELEASE: {
- GetMenuData()->ClearWidgetActionRepeater();
- break;
- }
- case WIDGET_EVENT_SCROLL_RIGHT_RELEASE: {
- GetMenuData()->ClearWidgetActionRepeater();
- break;
- }
- }
- }
- idMenuWidget::ExecuteEvent( event );
- return handled;
- }
- /*
- ========================
- idMenuWidget_Button::AddValue
- ========================
- */
- void idMenuWidget_Button::SetValues( idList< idStr > & list ) {
- values.Clear();
- for ( int i = 0; i < list.Num(); ++ i ) {
- values.Append( list[ i ] );
- }
- }
- /*
- ========================
- idMenuWidget_Button::GetValue
- ========================
- */
- const idStr & idMenuWidget_Button::GetValue( int index ) const {
- return values[ index ];
- }
- /*
- ========================
- idMenuWidget_Button::SetupTransitionInfo
- ========================
- */
- void idMenuWidget_Button::SetupTransitionInfo( widgetTransition_t & trans, const widgetState_t buttonState, const animState_t sourceAnimState, const animState_t destAnimState ) const {
- trans.prefixes.Clear();
- if ( buttonState == WIDGET_STATE_DISABLED ) {
- trans.animationName = "disabled";
- } else {
- const int animIndex = (int)destAnimState * ANIM_STATE_MAX + (int)sourceAnimState;
- trans.animationName = ANIM_STATE_TRANSITIONS[ animIndex ];
- if ( buttonState == WIDGET_STATE_SELECTING ) {
- trans.prefixes.Append( "sel_" );
- }
- }
- trans.prefixes.Append( "" );
- }
- /*
- ========================
- idMenuWidget_Button::AnimateToState
- Plays an animation from the current state to the target state.
- ========================
- */
- void idMenuWidget_Button::AnimateToState( const animState_t targetAnimState, const bool force ) {
- if ( !force && targetAnimState == GetAnimState() ) {
- return;
- }
- if ( GetSprite() != NULL ) {
- widgetTransition_t trans;
- SetupTransitionInfo( trans, GetState(), GetAnimState(), targetAnimState );
- if ( trans.animationName[0] != '\0' ) {
- for ( int i = 0; i < trans.prefixes.Num(); ++i ) {
- const char * const frameLabel = va( "%s%s", trans.prefixes[ i ], trans.animationName );
- if ( GetSprite()->FrameExists( frameLabel ) ) {
- GetSprite()->PlayFrame( frameLabel );
- Update();
- break;
- }
- }
- }
- idSWFSpriteInstance * const focusSprite = GetSprite()->GetScriptObject()->GetSprite( "focusIndicator" );
- if ( focusSprite != NULL ) {
- if ( targetAnimState == ANIM_STATE_OVER ) {
- focusSprite->PlayFrame( "show" );
- } else {
- focusSprite->PlayFrame( "hide" );
- }
- }
- }
- SetAnimState( targetAnimState );
- }
- //*****************************************************************************************************************
- // CONTROL BUTTON
- /*
- ========================
- idMenuWidget_ControlButton::Update
- ========================
- */
- void idMenuWidget_ControlButton::Update() {
- if ( GetSprite() == NULL ) {
- return;
- }
- idSWFScriptObject * const spriteObject = GetSprite()->GetScriptObject()->GetNestedObj( "type" );
- if ( spriteObject == NULL ) {
- return;
- }
- idSWFSpriteInstance * type = spriteObject->GetSprite();
- if ( type == NULL ) {
- return;
- }
- if ( GetOptionType() != OPTION_BUTTON_FULL_TEXT_SLIDER ) {
- type->StopFrame( GetOptionType() + 1 );
- }
- idSWFTextInstance * text = spriteObject->GetNestedText( "label0", "txtVal" );
- if ( text != NULL ) {
- text->SetText( btnLabel );
- text->SetStrokeInfo( true, 0.75f, 2.0f );
- }
- if ( CONTROL_SPRITE_NAMES[ GetOptionType() ] != NULL ) {
- idSWFSpriteInstance * controlSprite = NULL;
- if ( CONTROL_SPRITE_NAMES[ GetOptionType() ] != NULL ) {
- controlSprite = type->GetScriptObject()->GetSprite( CONTROL_SPRITE_NAMES[ GetOptionType() ] );
- if ( verify( controlSprite != NULL ) ) {
- if ( verify( GetDataSource() != NULL ) ) {
- idSWFScriptVar fieldValue = GetDataSource()->GetField( GetDataSourceFieldIndex() );
- if ( GetOptionType() == OPTION_SLIDER_BAR ) {
- controlSprite->StopFrame( 1 + fieldValue.ToInteger() );
- } else if ( GetOptionType() == OPTION_SLIDER_TOGGLE ) {
- idSWFTextInstance * const txtInfo = controlSprite->GetScriptObject()->GetNestedText( "txtVal" );
- if ( verify( txtInfo != NULL ) ) {
- txtInfo->SetText( fieldValue.ToBool() ? "#str_swf_enabled" : "#str_swf_disabled" );
- txtInfo->SetStrokeInfo( true, 0.75f, 2.0f );
- }
- } else if ( GetOptionType() == OPTION_SLIDER_TEXT || GetOptionType() == OPTION_BUTTON_FULL_TEXT_SLIDER ) {
- idSWFTextInstance * const txtInfo = controlSprite->GetScriptObject()->GetNestedText( "txtVal" );
- if ( verify( txtInfo != NULL ) ) {
- txtInfo->SetText( fieldValue.ToString() );
- txtInfo->SetStrokeInfo( true, 0.75f, 2.0f );
- }
- }
- }
- idSWFScriptObject * const btnLess = GetSprite()->GetScriptObject()->GetObject( "btnLess" );
- idSWFScriptObject * const btnMore = GetSprite()->GetScriptObject()->GetObject( "btnMore" );
- if ( btnLess != NULL && btnMore != NULL ) {
- if ( disabled ) {
- btnLess->GetSprite()->SetVisible( false );
- btnMore->GetSprite()->SetVisible( false );
- } else {
- btnLess->GetSprite()->SetVisible( true );
- btnMore->GetSprite()->SetVisible( true );
- btnLess->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_SCROLL_LEFT, 0 ) );
- btnLess->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_SCROLL_LEFT_RELEASE, 0 ) );
- btnMore->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_SCROLL_RIGHT, 0 ) );
- btnMore->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_SCROLL_RIGHT_RELEASE, 0 ) );
- btnLess->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- btnLess->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- btnMore->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- btnMore->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- }
- }
- }
- }
- } else {
- idSWFScriptObject * const btnLess = GetSprite()->GetScriptObject()->GetObject( "btnLess" );
- idSWFScriptObject * const btnMore = GetSprite()->GetScriptObject()->GetObject( "btnMore" );
- if ( btnLess != NULL && btnMore != NULL ) {
- btnLess->GetSprite()->SetVisible( false );
- btnMore->GetSprite()->SetVisible( false );
- }
- }
- // events
- GetSprite()->GetScriptObject()->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_PRESS, 0 ) );
- GetSprite()->GetScriptObject()->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_RELEASE, 0 ) );
- idSWFScriptObject * hitBox = GetSprite()->GetScriptObject()->GetObject( "hitBox" );
- if ( hitBox == NULL ) {
- hitBox = GetSprite()->GetScriptObject();
- }
- hitBox->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- hitBox->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- }
- /*
- ========================
- idMenuWidget_ControlButton::Update
- ========================
- */
- void idMenuWidget_ControlButton::SetupEvents( int delay, int index ) {
- AddEventAction( WIDGET_EVENT_SCROLL_LEFT ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_ADJUST_FIELD, -1, delay, index );
- AddEventAction( WIDGET_EVENT_SCROLL_RIGHT ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_ADJUST_FIELD, 1, delay, index );
- AddEventAction( WIDGET_EVENT_SCROLL_LEFT_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER );
- AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER );
- AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_ADJUST_FIELD, -1, delay, index );
- AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK ).Set( WIDGET_ACTION_START_REPEATER, WIDGET_ACTION_ADJUST_FIELD, 1, delay, index );
- AddEventAction( WIDGET_EVENT_SCROLL_LEFT_LSTICK_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER );
- AddEventAction( WIDGET_EVENT_SCROLL_RIGHT_LSTICK_RELEASE ).Set( WIDGET_ACTION_STOP_REPEATER );
- }
- //****************************************************************
- // SERVER BUTTON
- //****************************************************************
- /*
- ========================
- idMenuWidget_ServerButton::Update
- ========================
- */
- void idMenuWidget_ServerButton::Update() {
- if ( GetSprite() == NULL ) {
- return;
- }
- idSWFScriptObject * const spriteObject = GetSprite()->GetScriptObject();
- idSWFTextInstance * const txtName = spriteObject->GetNestedText( "label0", "txtVal" );
-
- if ( txtName != NULL ) {
- txtName->SetText( serverName );
- txtName->SetStrokeInfo( true, 0.75f, 1.75f );
- }
- // events
- spriteObject->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_PRESS, 0 ) );
- spriteObject->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_RELEASE, 0 ) );
- idSWFScriptObject * hitBox = spriteObject->GetObject( "hitBox" );
- if ( hitBox == NULL ) {
- hitBox = spriteObject;
- }
- hitBox->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- hitBox->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- }
- /*
- ========================
- idMenuWidget_ServerButton::SetButtonInfo
- ========================
- */
- void idMenuWidget_ServerButton::SetButtonInfo( idStr name_, idStrId mapName_, idStr modeName_, int index_, int players_, int maxPlayers_, bool joinable_, bool validMap_ ) {
- serverName = name_;
- index = index_;
- players = players_;
- maxPlayers = maxPlayers_;
- joinable = joinable_;
- validMap = validMap_;
- mapName = mapName_;
- modeName = modeName_;
- idStr desc;
- if ( index >= 0 ) {
- idStr playerVal = va( "%s %d/%d", idLocalization::GetString( "#str_02396" ), players, maxPlayers );
- idStr lobbyMapName = va( "%s %s", idLocalization::GetString( "#str_02045" ), mapName.GetLocalizedString() );
- idStr lobbyMode;
- if ( !modeName.IsEmpty() ) {
- lobbyMode = va( "%s %s", idLocalization::GetString( "#str_02044" ), modeName.c_str() );
- }
- desc = va( "%s %s %s", playerVal.c_str(), lobbyMapName.c_str(), lobbyMode.c_str() );
- }
- SetDescription( desc );
- }
- //****************************************************************
- // LOBBY BUTTON
- //****************************************************************
- /*
- ========================
- idMenuWidget_LobbyButton::Update
- ========================
- */
- void idMenuWidget_LobbyButton::Update() {
- if ( GetSprite() == NULL ) {
- return;
- }
- idSWFScriptObject * const spriteObject = GetSprite()->GetScriptObject();
- idSWFTextInstance * const txtName = spriteObject->GetNestedText( "itemName", "txtVal" );
- idSWFSpriteInstance * talkIcon = spriteObject->GetNestedSprite( "chaticon" );
- if ( txtName != NULL ) {
- txtName->SetText( name );
- }
- if ( talkIcon != NULL ) {
- talkIcon->StopFrame( voiceState + 1 );
- talkIcon->GetScriptObject()->Set( "onPress", new (TAG_SWF) WrapWidgetSWFEvent( this, WIDGET_EVENT_COMMAND, WIDGET_ACTION_MUTE_PLAYER ) );
- }
- // events
- spriteObject->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_PRESS, 0 ) );
- spriteObject->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_RELEASE, 0 ) );
- idSWFScriptObject * hitBox = spriteObject->GetObject( "hitBox" );
- if ( hitBox == NULL ) {
- hitBox = spriteObject;
- }
- hitBox->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- hitBox->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- }
- /*
- ========================
- idMenuWidget_LobbyButton::SetButtonInfo
- ========================
- */
- void idMenuWidget_LobbyButton::SetButtonInfo( idStr name_, voiceStateDisplay_t voiceState_ ) {
- name = name_;
- voiceState = voiceState_;
- }
- //****************************************************************
- // SCOREBOARD BUTTON
- //****************************************************************
- /*
- ========================
- idMenuWidget_ScoreboardButton::Update
- ========================
- */
- void idMenuWidget_ScoreboardButton::Update() {
- if ( GetSprite() == NULL ) {
- return;
- }
- if ( index == -1 ) {
- GetSprite()->SetVisible( false );
- return;
- }
- GetSprite()->SetVisible( true );
- idSWFScriptObject * const spriteObject = GetSprite()->GetScriptObject();
- for ( int val = 0; val < values.Num(); ++val ) {
- idSWFScriptObject * const textObject = spriteObject->GetNestedObj( va( "label%d", val ), "txtVal" );
- if ( textObject != NULL ) {
- idSWFTextInstance * const text = textObject->GetText();
- text->SetIgnoreColor( ignoreColor );
- text->tooltip = ignoreColor; // ignoreColor does double duty as "allow tooltips"
- text->SetText( values[ val ].c_str() );
- text->SetStrokeInfo( true, 0.75f, 2.0f );
- }
- }
- idSWFSpriteInstance * talkIcon = spriteObject->GetNestedSprite( "chaticon" );
- if ( talkIcon != NULL ) {
- talkIcon->StopFrame( voiceState + 1 );
- talkIcon->GetScriptObject()->Set( "onPress", new (TAG_SWF) WrapWidgetSWFEvent( this, WIDGET_EVENT_COMMAND, WIDGET_ACTION_MUTE_PLAYER ) );
- }
- // events
- spriteObject->Set( "onPress", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_PRESS, 0 ) );
- spriteObject->Set( "onRelease", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_RELEASE, 0 ) );
- idSWFScriptObject * hitBox = spriteObject->GetObject( "hitBox" );
- if ( hitBox == NULL ) {
- hitBox = spriteObject;
- }
- hitBox->Set( "onRollOver", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OVER, 0 ) );
- hitBox->Set( "onRollOut", new ( TAG_SWF ) WrapWidgetSWFEvent( this, WIDGET_EVENT_ROLL_OUT, 0 ) );
- }
- /*
- ========================
- idMenuWidget_ScoreboardButton::SetButtonInfo
- ========================
- */
- void idMenuWidget_ScoreboardButton::SetButtonInfo( int index_, idList< idStr > & list, voiceStateDisplay_t voiceState_ ) {
- index = index_;
- voiceState = voiceState_;
- SetValues( list );
- }
|