mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-02-05 10:10:42 +03:00
Merge pull request #230 from Petercov/mapbase-feature/caption-fixes
Caption Fixes
This commit is contained in:
commit
323f9fc46a
@ -1496,9 +1496,23 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
|
|||||||
|
|
||||||
if ( m_Items.Count() > 0 )
|
if ( m_Items.Count() > 0 )
|
||||||
{
|
{
|
||||||
|
#ifndef MAPBASE
|
||||||
// Get the remaining life span of the last item
|
// Get the remaining life span of the last item
|
||||||
CCloseCaptionItem *final = m_Items[ m_Items.Count() - 1 ];
|
CCloseCaptionItem* final = m_Items[m_Items.Count() - 1];
|
||||||
float prevlife = final->GetTimeToLive();
|
float prevlife = final->GetTimeToLive();
|
||||||
|
#else
|
||||||
|
float prevlife = 0.f;
|
||||||
|
// Get the remaining life span of the last displayed item
|
||||||
|
for (int i = m_Items.Count() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (m_Items[i]->GetPreDisplayTime() > cc_predisplay_time.GetFloat())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
prevlife = m_Items[i]->GetTimeToLive();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif // !MAPBASE
|
||||||
|
|
||||||
|
|
||||||
if ( prevlife > lifespan )
|
if ( prevlife > lifespan )
|
||||||
{
|
{
|
||||||
@ -1532,7 +1546,31 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
|
|||||||
if ( wcslen( phrase ) > 0 )
|
if ( wcslen( phrase ) > 0 )
|
||||||
{
|
{
|
||||||
CCloseCaptionItem *item = new CCloseCaptionItem( phrase, lifespan, addedlife, delay, valid, fromplayer );
|
CCloseCaptionItem *item = new CCloseCaptionItem( phrase, lifespan, addedlife, delay, valid, fromplayer );
|
||||||
m_Items.AddToTail( item );
|
#ifdef MAPBASE
|
||||||
|
if (m_Items.Count())
|
||||||
|
{
|
||||||
|
// Add it where it will appear
|
||||||
|
for (int i = m_Items.Count() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (m_Items[i]->GetPreDisplayTime() > delay + cc_predisplay_time.GetFloat())
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
m_Items.AddToHead(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Items.InsertAfter(i, item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif // MAPBASE
|
||||||
|
m_Items.AddToTail(item);
|
||||||
|
|
||||||
if ( StreamHasCommand( phrase, L"sfx" ) )
|
if ( StreamHasCommand( phrase, L"sfx" ) )
|
||||||
{
|
{
|
||||||
// SFX show up instantly.
|
// SFX show up instantly.
|
||||||
@ -1541,6 +1579,9 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
|
|||||||
|
|
||||||
if ( GetFloatCommandValue( phrase, L"len", override_duration ) )
|
if ( GetFloatCommandValue( phrase, L"len", override_duration ) )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
override_duration += cc_linger_time.GetFloat();
|
||||||
|
#endif // MAPBASE
|
||||||
item->SetTimeToLive( override_duration );
|
item->SetTimeToLive( override_duration );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1569,7 +1610,30 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
|
|||||||
if ( wcslen( phrase ) > 0 )
|
if ( wcslen( phrase ) > 0 )
|
||||||
{
|
{
|
||||||
CCloseCaptionItem *item = new CCloseCaptionItem( phrase, lifespan, addedlife, delay, valid, fromplayer );
|
CCloseCaptionItem *item = new CCloseCaptionItem( phrase, lifespan, addedlife, delay, valid, fromplayer );
|
||||||
m_Items.AddToTail( item );
|
#ifdef MAPBASE
|
||||||
|
if (m_Items.Count())
|
||||||
|
{
|
||||||
|
// Add it where it will appear
|
||||||
|
for (int i = m_Items.Count() - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (m_Items[i]->GetPreDisplayTime() > delay + cc_predisplay_time.GetFloat())
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
m_Items.AddToHead(item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_Items.InsertAfter(i, item);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif // MAPBASE
|
||||||
|
m_Items.AddToTail(item);
|
||||||
|
|
||||||
if ( StreamHasCommand( phrase, L"sfx" ) )
|
if ( StreamHasCommand( phrase, L"sfx" ) )
|
||||||
{
|
{
|
||||||
@ -1579,6 +1643,10 @@ void CHudCloseCaption::Process( const wchar_t *stream, float duration, const cha
|
|||||||
|
|
||||||
if ( GetFloatCommandValue( phrase, L"len", override_duration ) )
|
if ( GetFloatCommandValue( phrase, L"len", override_duration ) )
|
||||||
{
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
override_duration += cc_linger_time.GetFloat();
|
||||||
|
#endif // MAPBASE
|
||||||
|
|
||||||
item->SetTimeToLive( override_duration );
|
item->SetTimeToLive( override_duration );
|
||||||
item->SetInitialLifeSpan( override_duration );
|
item->SetInitialLifeSpan( override_duration );
|
||||||
}
|
}
|
||||||
@ -2614,8 +2682,14 @@ void CHudCloseCaption::InitCaptionDictionary( const char *dbfile )
|
|||||||
|
|
||||||
g_AsyncCaptionResourceManager.Clear();
|
g_AsyncCaptionResourceManager.Clear();
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
int iBufferSize = filesystem->GetSearchPath("GAME", true, nullptr, 0);
|
||||||
|
char* searchPaths = (char*)stackalloc(iBufferSize);
|
||||||
|
filesystem->GetSearchPath("GAME", true, searchPaths, iBufferSize);
|
||||||
|
#else
|
||||||
char searchPaths[4096];
|
char searchPaths[4096];
|
||||||
filesystem->GetSearchPath( "GAME", true, searchPaths, sizeof( searchPaths ) );
|
filesystem->GetSearchPath( "GAME", true, searchPaths, sizeof( searchPaths ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
for ( char *path = strtok( searchPaths, ";" ); path; path = strtok( NULL, ";" ) )
|
for ( char *path = strtok( searchPaths, ";" ); path; path = strtok( NULL, ";" ) )
|
||||||
{
|
{
|
||||||
@ -2626,8 +2700,13 @@ void CHudCloseCaption::InitCaptionDictionary( const char *dbfile )
|
|||||||
}
|
}
|
||||||
|
|
||||||
char fullpath[MAX_PATH];
|
char fullpath[MAX_PATH];
|
||||||
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", path, dbfile );
|
#ifndef MAPBASE
|
||||||
Q_FixSlashes( fullpath );
|
Q_snprintf(fullpath, sizeof(fullpath), "%s%s", path, dbfile);
|
||||||
|
Q_FixSlashes(fullpath);
|
||||||
|
#else
|
||||||
|
V_ComposeFileName(path, dbfile, fullpath, sizeof(fullpath));
|
||||||
|
#endif // !MAPBASE
|
||||||
|
|
||||||
|
|
||||||
if ( IsX360() )
|
if ( IsX360() )
|
||||||
{
|
{
|
||||||
@ -2692,8 +2771,7 @@ void CHudCloseCaption::AddAdditionalCaptionDictionary( const char *dbfile, CUtlV
|
|||||||
}
|
}
|
||||||
|
|
||||||
char fullpath[MAX_PATH];
|
char fullpath[MAX_PATH];
|
||||||
Q_snprintf( fullpath, sizeof( fullpath ), "%s%s", path, dbfile );
|
V_ComposeFileName(path, dbfile, fullpath, sizeof(fullpath));
|
||||||
Q_FixSlashes( fullpath );
|
|
||||||
|
|
||||||
if ( IsX360() )
|
if ( IsX360() )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user