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"
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuWidget_Shell_SaveInfo::Update
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuWidget_Shell_SaveInfo::Update()
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
if( GetSWFObject() == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFScriptObject& root = GetSWFObject()->GetRootObject();
|
|
|
|
if( !BindSprite( root ) || GetSprite() == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const saveGameDetailsList_t& saveGameInfo = session->GetSaveGameManager().GetEnumeratedSavegames();
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
saveGameDetailsList_t sortedSaves = saveGameInfo;
|
|
|
|
sortedSaves.Sort( idSort_SavesByDate() );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
for( int slot = 0; slot < sortedSaves.Num(); ++slot )
|
|
|
|
{
|
|
|
|
const idSaveGameDetails& details = sortedSaves[slot];
|
|
|
|
if( forSaveScreen && details.slotName.Icmp( "autosave" ) == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
sortedSaves.RemoveIndex( slot );
|
|
|
|
slot--;
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr info;
|
2012-11-28 15:47:07 +00:00
|
|
|
if( loadIndex >= 0 && sortedSaves.Num() != 0 && loadIndex < sortedSaves.Num() )
|
|
|
|
{
|
|
|
|
const idSaveGameDetails& details = sortedSaves[ loadIndex ];
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
info.Append( Sys_TimeStampToStr( details.date ) );
|
|
|
|
info.Append( "\n" );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// PS3 only strings that use the dict just set
|
2012-11-28 15:47:07 +00:00
|
|
|
const char* expansionStr = "";
|
|
|
|
switch( details.GetExpansion() )
|
|
|
|
{
|
|
|
|
case GAME_D3XP:
|
|
|
|
expansionStr = idLocalization::GetString( "#str_swf_resurrection" );
|
|
|
|
break;
|
|
|
|
case GAME_D3LE:
|
|
|
|
expansionStr = idLocalization::GetString( "#str_swf_lost_episodes" );
|
|
|
|
break;
|
|
|
|
case GAME_BASE:
|
|
|
|
expansionStr = idLocalization::GetString( "#str_swf_doom3" );
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
expansionStr = idLocalization::GetString( "#str_savegame_title" );
|
|
|
|
break;
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const char* difficultyStr = "";
|
|
|
|
switch( details.GetDifficulty() )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
difficultyStr = idLocalization::GetString( "#str_04089" );
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
difficultyStr = idLocalization::GetString( "#str_04091" );
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
difficultyStr = idLocalization::GetString( "#str_04093" );
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
difficultyStr = idLocalization::GetString( "#str_02357" );
|
|
|
|
break;
|
2012-11-26 18:58:24 +00:00
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idStr summary;
|
|
|
|
summary.Format( idLocalization::GetString( "#str_swf_save_info_format" ), difficultyStr, Sys_SecToStr( details.GetPlaytime() ), expansionStr );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
info.Append( summary );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
if( details.damaged )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
info.Append( "\n" );
|
|
|
|
info.Append( va( "^1%s^0", idLocalization::GetString( "#str_swf_damaged" ) ) );
|
2012-11-28 15:47:07 +00:00
|
|
|
}
|
|
|
|
else if( details.GetSaveVersion() > BUILD_NUMBER )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
info.Append( "\n" );
|
|
|
|
info.Append( va( "^1%s^0", idLocalization::GetString( "#str_swf_wrong_version" ) ) );
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFTextInstance* infoSprite = GetSprite()->GetScriptObject()->GetNestedText( "txtDesc" );
|
|
|
|
if( infoSprite != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
infoSprite->SetText( info );
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idSWFSpriteInstance* img = GetSprite()->GetScriptObject()->GetNestedSprite( "img" );
|
|
|
|
if( img != NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
// TODO_SPARTY: until we have a thumbnail hide the image
|
|
|
|
img->SetVisible( false );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
========================
|
|
|
|
idMenuWidget_Help::ObserveEvent
|
|
|
|
========================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
void idMenuWidget_Shell_SaveInfo::ObserveEvent( const idMenuWidget& widget, const idWidgetEvent& event )
|
|
|
|
{
|
|
|
|
const idMenuWidget_Button* const button = dynamic_cast< const idMenuWidget_Button* >( &widget );
|
|
|
|
if( button == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const idMenuWidget* const listWidget = button->GetParent();
|
|
|
|
|
|
|
|
if( listWidget == NULL )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
switch( event.type )
|
|
|
|
{
|
|
|
|
case WIDGET_EVENT_FOCUS_ON:
|
|
|
|
{
|
|
|
|
const idMenuWidget_DynamicList* const list = dynamic_cast< const idMenuWidget_DynamicList* const >( listWidget );
|
2012-11-26 18:58:24 +00:00
|
|
|
loadIndex = list->GetViewIndex();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
const saveGameDetailsList_t& detailList = session->GetSaveGameManager().GetEnumeratedSavegames();
|
2012-11-26 18:58:24 +00:00
|
|
|
bool hasAutoSave = false;
|
2012-11-28 15:47:07 +00:00
|
|
|
for( int i = 0; i < detailList.Num(); ++i )
|
|
|
|
{
|
|
|
|
if( detailList[i].slotName.Icmp( "autosave" ) == 0 )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
hasAutoSave = true;
|
|
|
|
}
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
if( forSaveScreen && ( ( detailList.Num() < MAX_SAVEGAMES - 1 ) || ( ( detailList.Num() == MAX_SAVEGAMES - 1 ) && hasAutoSave ) ) )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
loadIndex -= 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
|
|
|
|
|
|
|
idMenuScreen_Shell_Load* loadScreen = dynamic_cast< idMenuScreen_Shell_Load* >( GetParent() );
|
|
|
|
if( loadScreen )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
loadScreen->UpdateSaveEnumerations();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
idMenuScreen_Shell_Save* saveScreen = dynamic_cast< idMenuScreen_Shell_Save* >( GetParent() );
|
|
|
|
if( saveScreen )
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
saveScreen->UpdateSaveEnumerations();
|
|
|
|
}
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|