diff --git a/game/shared/choreoactor.cpp b/game/shared/choreoactor.cpp index 22be6261..e6c99d98 100644 --- a/game/shared/choreoactor.cpp +++ b/game/shared/choreoactor.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -45,7 +45,7 @@ CChoreoActor& CChoreoActor::operator=( const CChoreoActor& src ) Q_strncpy( m_szName, src.m_szName, sizeof( m_szName ) ); Q_strncpy( m_szFacePoserModelName, src.m_szFacePoserModelName, sizeof( m_szFacePoserModelName ) ); - for ( int i = 0; i < src.m_Channels.Size(); i++ ) + for ( int i = 0; i < src.m_Channels.Count(); i++ ) { CChoreoChannel *c = src.m_Channels[ i ]; CChoreoChannel *newChannel = new CChoreoChannel(); @@ -92,7 +92,7 @@ const char *CChoreoActor::GetName( void ) //----------------------------------------------------------------------------- int CChoreoActor::GetNumChannels( void ) { - return m_Channels.Size(); + return m_Channels.Count(); } //----------------------------------------------------------------------------- @@ -102,7 +102,7 @@ int CChoreoActor::GetNumChannels( void ) //----------------------------------------------------------------------------- CChoreoChannel *CChoreoActor::GetChannel( int channel ) { - if ( channel < 0 || channel >= m_Channels.Size() ) + if ( channel < 0 || channel >= m_Channels.Count() ) { return NULL; } @@ -161,7 +161,7 @@ void CChoreoActor::SwapChannels( int c1, int c2 ) //----------------------------------------------------------------------------- int CChoreoActor::FindChannelIndex( CChoreoChannel *channel ) { - for ( int i = 0; i < m_Channels.Size(); i++ ) + for ( int i = 0; i < m_Channels.Count(); i++ ) { if ( channel == m_Channels[ i ] ) { diff --git a/game/shared/choreochannel.cpp b/game/shared/choreochannel.cpp index b6b3ea44..d6bf4e4f 100644 --- a/game/shared/choreochannel.cpp +++ b/game/shared/choreochannel.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -45,7 +45,7 @@ CChoreoChannel& CChoreoChannel::operator=( const CChoreoChannel& src ) { m_bActive = src.m_bActive; Q_strncpy( m_szName, src.m_szName, sizeof( m_szName ) ); - for ( int i = 0; i < src.m_Events.Size(); i++ ) + for ( int i = 0; i < src.m_Events.Count(); i++ ) { CChoreoEvent *e = src.m_Events[ i ]; CChoreoEvent *newEvent = new CChoreoEvent( e->GetScene() ); @@ -83,7 +83,7 @@ const char *CChoreoChannel::GetName( void ) //----------------------------------------------------------------------------- int CChoreoChannel::GetNumEvents( void ) { - return m_Events.Size(); + return m_Events.Count(); } //----------------------------------------------------------------------------- @@ -93,7 +93,7 @@ int CChoreoChannel::GetNumEvents( void ) //----------------------------------------------------------------------------- CChoreoEvent *CChoreoChannel::GetEvent( int event ) { - if ( event < 0 || event >= m_Events.Size() ) + if ( event < 0 || event >= m_Events.Count() ) { return NULL; } @@ -138,7 +138,7 @@ void CChoreoChannel::RemoveAllEvents() //----------------------------------------------------------------------------- int CChoreoChannel::FindEventIndex( CChoreoEvent *event ) { - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { if ( event == m_Events[ i ] ) { diff --git a/game/shared/choreoevent.cpp b/game/shared/choreoevent.cpp index f95a3ecc..70d51507 100644 --- a/game/shared/choreoevent.cpp +++ b/game/shared/choreoevent.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -432,7 +432,7 @@ CFlexAnimationTrack::CFlexAnimationTrack( const CFlexAnimationTrack* src ) for ( int t = 0; t < 2; t++ ) { m_Samples[ t ].Purge(); - for ( int i = 0 ;i < src->m_Samples[ t ].Size(); i++ ) + for ( int i = 0 ;i < src->m_Samples[ t ].Count(); i++ ) { CExpressionSample s = src->m_Samples[ t ][ i ]; m_Samples[ t ].AddToTail( s ); @@ -527,7 +527,7 @@ int CFlexAnimationTrack::GetNumSamples( int type /*=0*/ ) { Assert( type == 0 || type == 1 ); - return m_Samples[ type ].Size(); + return m_Samples[ type ].Count(); } //----------------------------------------------------------------------------- @@ -931,9 +931,9 @@ void CFlexAnimationTrack::Resort( int type /*=0*/ ) { Assert( type == 0 || type == 1 ); - for ( int i = 0; i < m_Samples[ type ].Size(); i++ ) + for ( int i = 0; i < m_Samples[ type ].Count(); i++ ) { - for ( int j = i + 1; j < m_Samples[ type ].Size(); j++ ) + for ( int j = i + 1; j < m_Samples[ type ].Count(); j++ ) { CExpressionSample src = m_Samples[ type ][ i ]; CExpressionSample dest = m_Samples[ type ][ j ]; @@ -1116,7 +1116,7 @@ void CFlexAnimationTrack::RemoveOutOfRangeSamples( int type ) Assert( m_pEvent->HasEndTime() ); float duration = m_pEvent->GetDuration(); - int c = m_Samples[ type ].Size(); + int c = m_Samples[ type ].Count(); for ( int i = c-1; i >= 0; i-- ) { CExpressionSample src = m_Samples[ type ][ i ]; @@ -1217,14 +1217,14 @@ CChoreoEvent& CChoreoEvent::operator=( const CChoreoEvent& src ) } int i; - for ( i = 0; i < src.m_RelativeTags.Size(); i++ ) + for ( i = 0; i < src.m_RelativeTags.Count(); i++ ) { CEventRelativeTag newtag( src.m_RelativeTags[ i ] ); newtag.SetOwner( this ); m_RelativeTags.AddToTail( newtag ); } - for ( i = 0; i < src.m_TimingTags.Size(); i++ ) + for ( i = 0; i < src.m_TimingTags.Count(); i++ ) { CFlexTimingTag newtag( src.m_TimingTags[ i ] ); newtag.SetOwner( this ); @@ -1232,7 +1232,7 @@ CChoreoEvent& CChoreoEvent::operator=( const CChoreoEvent& src ) } for ( t = 0; t < NUM_ABS_TAG_TYPES; t++ ) { - for ( i = 0; i < src.m_AbsoluteTags[ t ].Size(); i++ ) + for ( i = 0; i < src.m_AbsoluteTags[ t ].Count(); i++ ) { CEventAbsoluteTag newtag( src.m_AbsoluteTags[ t ][ i ] ); newtag.SetOwner( this ); @@ -1242,7 +1242,7 @@ CChoreoEvent& CChoreoEvent::operator=( const CChoreoEvent& src ) RemoveAllTracks(); - for ( i = 0 ; i < src.m_FlexAnimationTracks.Size(); i++ ) + for ( i = 0 ; i < src.m_FlexAnimationTracks.Count(); i++ ) { CFlexAnimationTrack *newtrack = new CFlexAnimationTrack( src.m_FlexAnimationTracks[ i ] ); newtrack->SetEvent( this ); @@ -2382,7 +2382,7 @@ void CChoreoEvent::ClearAllRelativeTags( void ) //----------------------------------------------------------------------------- int CChoreoEvent::GetNumRelativeTags( void ) { - return m_RelativeTags.Size(); + return m_RelativeTags.Count(); } //----------------------------------------------------------------------------- @@ -2392,7 +2392,7 @@ int CChoreoEvent::GetNumRelativeTags( void ) //----------------------------------------------------------------------------- CEventRelativeTag *CChoreoEvent::GetRelativeTag( int tagnum ) { - Assert( tagnum >= 0 && tagnum < m_RelativeTags.Size() ); + Assert( tagnum >= 0 && tagnum < m_RelativeTags.Count() ); return &m_RelativeTags[ tagnum ]; } @@ -2413,7 +2413,7 @@ void CChoreoEvent::AddRelativeTag( const char *tagname, float percentage ) //----------------------------------------------------------------------------- void CChoreoEvent::RemoveRelativeTag( const char *tagname ) { - for ( int i = 0; i < m_RelativeTags.Size(); i++ ) + for ( int i = 0; i < m_RelativeTags.Count(); i++ ) { CEventRelativeTag *prt = &m_RelativeTags[ i ]; if ( !prt ) @@ -2434,7 +2434,7 @@ void CChoreoEvent::RemoveRelativeTag( const char *tagname ) //----------------------------------------------------------------------------- CEventRelativeTag * CChoreoEvent::FindRelativeTag( const char *tagname ) { - for ( int i = 0; i < m_RelativeTags.Size(); i++ ) + for ( int i = 0; i < m_RelativeTags.Count(); i++ ) { CEventRelativeTag *prt = &m_RelativeTags[ i ]; if ( !prt ) @@ -2517,7 +2517,7 @@ void CChoreoEvent::ClearAllTimingTags( void ) //----------------------------------------------------------------------------- int CChoreoEvent::GetNumTimingTags( void ) { - return m_TimingTags.Size(); + return m_TimingTags.Count(); } //----------------------------------------------------------------------------- @@ -2527,7 +2527,7 @@ int CChoreoEvent::GetNumTimingTags( void ) //----------------------------------------------------------------------------- CFlexTimingTag *CChoreoEvent::GetTimingTag( int tagnum ) { - Assert( tagnum >= 0 && tagnum < m_TimingTags.Size() ); + Assert( tagnum >= 0 && tagnum < m_TimingTags.Count() ); return &m_TimingTags[ tagnum ]; } @@ -2545,9 +2545,9 @@ void CChoreoEvent::AddTimingTag( const char *tagname, float percentage, bool loc CFlexTimingTag temp( (CChoreoEvent *)0x1, "", 0.0f, false ); // ugly bubble sort - for ( int i = 0; i < m_TimingTags.Size(); i++ ) + for ( int i = 0; i < m_TimingTags.Count(); i++ ) { - for ( int j = i + 1; j < m_TimingTags.Size(); j++ ) + for ( int j = i + 1; j < m_TimingTags.Count(); j++ ) { CFlexTimingTag *t1 = &m_TimingTags[ i ]; CFlexTimingTag *t2 = &m_TimingTags[ j ]; @@ -2568,7 +2568,7 @@ void CChoreoEvent::AddTimingTag( const char *tagname, float percentage, bool loc //----------------------------------------------------------------------------- void CChoreoEvent::RemoveTimingTag( const char *tagname ) { - for ( int i = 0; i < m_TimingTags.Size(); i++ ) + for ( int i = 0; i < m_TimingTags.Count(); i++ ) { CFlexTimingTag *ptt = &m_TimingTags[ i ]; if ( !ptt ) @@ -2589,7 +2589,7 @@ void CChoreoEvent::RemoveTimingTag( const char *tagname ) //----------------------------------------------------------------------------- CFlexTimingTag * CChoreoEvent::FindTimingTag( const char *tagname ) { - for ( int i = 0; i < m_TimingTags.Size(); i++ ) + for ( int i = 0; i < m_TimingTags.Count(); i++ ) { CFlexTimingTag *ptt = &m_TimingTags[ i ]; if ( !ptt ) @@ -2626,7 +2626,7 @@ void CChoreoEvent::OnEndTimeChanged( void ) //----------------------------------------------------------------------------- int CChoreoEvent::GetNumFlexAnimationTracks( void ) { - return m_FlexAnimationTracks.Size(); + return m_FlexAnimationTracks.Count(); } //----------------------------------------------------------------------------- @@ -2928,7 +2928,7 @@ void CChoreoEvent::ClearAllAbsoluteTags( AbsTagType type ) //----------------------------------------------------------------------------- int CChoreoEvent::GetNumAbsoluteTags( AbsTagType type ) { - return m_AbsoluteTags[ type ].Size(); + return m_AbsoluteTags[ type ].Count(); } //----------------------------------------------------------------------------- @@ -2939,7 +2939,7 @@ int CChoreoEvent::GetNumAbsoluteTags( AbsTagType type ) //----------------------------------------------------------------------------- CEventAbsoluteTag *CChoreoEvent::GetAbsoluteTag( AbsTagType type, int tagnum ) { - Assert( tagnum >= 0 && tagnum < m_AbsoluteTags[ type ].Size() ); + Assert( tagnum >= 0 && tagnum < m_AbsoluteTags[ type ].Count() ); return &m_AbsoluteTags[ type ][ tagnum ]; } @@ -2951,7 +2951,7 @@ CEventAbsoluteTag *CChoreoEvent::GetAbsoluteTag( AbsTagType type, int tagnum ) //----------------------------------------------------------------------------- CEventAbsoluteTag *CChoreoEvent::FindAbsoluteTag( AbsTagType type, const char *tagname ) { - for ( int i = 0; i < m_AbsoluteTags[ type ].Size(); i++ ) + for ( int i = 0; i < m_AbsoluteTags[ type ].Count(); i++ ) { CEventAbsoluteTag *ptag = &m_AbsoluteTags[ type ][ i ]; if ( !ptag ) @@ -2980,9 +2980,9 @@ void CChoreoEvent::AddAbsoluteTag( AbsTagType type, const char *tagname, float t CEventAbsoluteTag temp( (CChoreoEvent *)0x1, "", 0.0f ); // ugly bubble sort - for ( int i = 0; i < m_AbsoluteTags[ type ].Size(); i++ ) + for ( int i = 0; i < m_AbsoluteTags[ type ].Count(); i++ ) { - for ( int j = i + 1; j < m_AbsoluteTags[ type ].Size(); j++ ) + for ( int j = i + 1; j < m_AbsoluteTags[ type ].Count(); j++ ) { CEventAbsoluteTag *t1 = &m_AbsoluteTags[ type ][ i ]; CEventAbsoluteTag *t2 = &m_AbsoluteTags[ type ][ j ]; @@ -3004,7 +3004,7 @@ void CChoreoEvent::AddAbsoluteTag( AbsTagType type, const char *tagname, float t //----------------------------------------------------------------------------- void CChoreoEvent::RemoveAbsoluteTag( AbsTagType type, const char *tagname ) { - for ( int i = 0; i < m_AbsoluteTags[ type ].Size(); i++ ) + for ( int i = 0; i < m_AbsoluteTags[ type ].Count(); i++ ) { CEventAbsoluteTag *ptag = &m_AbsoluteTags[ type ][ i ]; if ( !ptag ) @@ -3032,7 +3032,7 @@ bool CChoreoEvent::VerifyTagOrder( ) // Sort tags CEventAbsoluteTag temp( (CChoreoEvent *)0x1, "", 0.0f ); - for ( int i = 0; i < m_AbsoluteTags[ CChoreoEvent::ORIGINAL ].Size(); i++ ) + for ( int i = 0; i < m_AbsoluteTags[ CChoreoEvent::ORIGINAL ].Count(); i++ ) { CEventAbsoluteTag *ptag = &m_AbsoluteTags[ CChoreoEvent::ORIGINAL ][ i ]; if ( !ptag ) @@ -3044,7 +3044,7 @@ bool CChoreoEvent::VerifyTagOrder( ) continue; bInOrder = false; - for ( int j = i + 1; j < m_AbsoluteTags[ CChoreoEvent::PLAYBACK ].Size(); j++ ) + for ( int j = i + 1; j < m_AbsoluteTags[ CChoreoEvent::PLAYBACK ].Count(); j++ ) { CEventAbsoluteTag *t2 = &m_AbsoluteTags[ CChoreoEvent::PLAYBACK ][ j ]; @@ -3529,9 +3529,9 @@ void CCurveData::Clear( void ) //----------------------------------------------------------------------------- void CCurveData::Resort( ICurveDataAccessor *data ) { - for ( int i = 0; i < m_Ramp.Size(); i++ ) + for ( int i = 0; i < m_Ramp.Count(); i++ ) { - for ( int j = i + 1; j < m_Ramp.Size(); j++ ) + for ( int j = i + 1; j < m_Ramp.Count(); j++ ) { CExpressionSample src = m_Ramp[ i ]; CExpressionSample dest = m_Ramp[ j ]; @@ -3688,7 +3688,7 @@ bool CChoreoEvent::PreventTagOverlap( void ) //----------------------------------------------------------------------------- CEventAbsoluteTag *CChoreoEvent::FindEntryTag( AbsTagType type ) { - for ( int i = 0; i < m_AbsoluteTags[ type ].Size(); i++ ) + for ( int i = 0; i < m_AbsoluteTags[ type ].Count(); i++ ) { CEventAbsoluteTag *ptag = &m_AbsoluteTags[ type ][ i ]; if ( !ptag ) @@ -3709,7 +3709,7 @@ CEventAbsoluteTag *CChoreoEvent::FindEntryTag( AbsTagType type ) //----------------------------------------------------------------------------- CEventAbsoluteTag *CChoreoEvent::FindExitTag( AbsTagType type ) { - for ( int i = 0; i < m_AbsoluteTags[ type ].Size(); i++ ) + for ( int i = 0; i < m_AbsoluteTags[ type ].Count(); i++ ) { CEventAbsoluteTag *ptag = &m_AbsoluteTags[ type ][ i ]; if ( !ptag ) diff --git a/game/shared/choreoscene.cpp b/game/shared/choreoscene.cpp index 142fbe3c..5f50c4eb 100644 --- a/game/shared/choreoscene.cpp +++ b/game/shared/choreoscene.cpp @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -128,7 +128,7 @@ CChoreoScene& CChoreoScene::operator=( const CChoreoScene& src ) // Delete existing int i; - for ( i = 0; i < m_Actors.Size(); i++ ) + for ( i = 0; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; Assert( a ); @@ -137,7 +137,7 @@ CChoreoScene& CChoreoScene::operator=( const CChoreoScene& src ) m_Actors.RemoveAll(); - for ( i = 0; i < m_Events.Size(); i++ ) + for ( i = 0; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; Assert( e ); @@ -146,7 +146,7 @@ CChoreoScene& CChoreoScene::operator=( const CChoreoScene& src ) m_Events.RemoveAll(); - for ( i = 0 ; i < m_Channels.Size(); i++ ) + for ( i = 0 ; i < m_Channels.Count(); i++ ) { CChoreoChannel *c = m_Channels[ i ]; Assert( c ); @@ -172,7 +172,7 @@ CChoreoScene& CChoreoScene::operator=( const CChoreoScene& src ) // Now copy the object tree // First copy the global events - for ( i = 0; i < src.m_Events.Size(); i++ ) + for ( i = 0; i < src.m_Events.Count(); i++ ) { CChoreoEvent *event = src.m_Events[ i ]; if ( event->GetActor() == NULL ) @@ -186,7 +186,7 @@ CChoreoScene& CChoreoScene::operator=( const CChoreoScene& src ) } // Finally, push actors, channels, events onto global stacks - for ( i = 0; i < src.m_Actors.Size(); i++ ) + for ( i = 0; i < src.m_Actors.Count(); i++ ) { CChoreoActor *actor = src.m_Actors[ i ]; CChoreoActor *newActor = AllocActor(); @@ -264,7 +264,7 @@ void CChoreoScene::Init( IChoreoEventCallback *callback ) CChoreoScene::~CChoreoScene( void ) { int i; - for ( i = 0; i < m_Actors.Size(); i++ ) + for ( i = 0; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; Assert( a ); @@ -273,7 +273,7 @@ CChoreoScene::~CChoreoScene( void ) m_Actors.RemoveAll(); - for ( i = 0; i < m_Events.Size(); i++ ) + for ( i = 0; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; Assert( e ); @@ -282,7 +282,7 @@ CChoreoScene::~CChoreoScene( void ) m_Events.RemoveAll(); - for ( i = 0 ; i < m_Channels.Size(); i++ ) + for ( i = 0 ; i < m_Channels.Count(); i++ ) { CChoreoChannel *c = m_Channels[ i ]; Assert( c ); @@ -390,7 +390,7 @@ void CChoreoScene::Print( void ) // Look for events that don't have actor/channel set int i; - for ( i = 0 ; i < m_Events.Size(); i++ ) + for ( i = 0 ; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetActor() ) @@ -399,7 +399,7 @@ void CChoreoScene::Print( void ) PrintEvent( 0, e ); } - for ( i = 0 ; i < m_Actors.Size(); i++ ) + for ( i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -478,7 +478,7 @@ CChoreoActor *CChoreoScene::AllocActor( void ) //----------------------------------------------------------------------------- CChoreoActor *CChoreoScene::FindActor( const char *name ) { - for ( int i = 0; i < m_Actors.Size(); i++ ) + for ( int i = 0; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -497,7 +497,7 @@ CChoreoActor *CChoreoScene::FindActor( const char *name ) //----------------------------------------------------------------------------- int CChoreoScene::GetNumEvents( void ) { - return m_Events.Size(); + return m_Events.Count(); } //----------------------------------------------------------------------------- @@ -507,7 +507,7 @@ int CChoreoScene::GetNumEvents( void ) //----------------------------------------------------------------------------- CChoreoEvent *CChoreoScene::GetEvent( int event ) { - if ( event < 0 || event >= m_Events.Size() ) + if ( event < 0 || event >= m_Events.Count() ) return NULL; return m_Events[ event ]; @@ -519,7 +519,7 @@ CChoreoEvent *CChoreoScene::GetEvent( int event ) //----------------------------------------------------------------------------- int CChoreoScene::GetNumActors( void ) { - return m_Actors.Size(); + return m_Actors.Count(); } //----------------------------------------------------------------------------- @@ -540,7 +540,7 @@ CChoreoActor *CChoreoScene::GetActor( int actor ) //----------------------------------------------------------------------------- int CChoreoScene::GetNumChannels( void ) { - return m_Channels.Size(); + return m_Channels.Count(); } //----------------------------------------------------------------------------- @@ -619,9 +619,9 @@ void CCurveData::Parse( ISceneTokenProcessor *tokenizer, ICurveDataAccessor *dat s->SetCurveType( curveType ); } - if ( samples.Size() >= 1 ) + if ( samples.Count() >= 1 ) { - for ( int i = 0; i < samples.Size(); i++ ) + for ( int i = 0; i < samples.Count(); i++ ) { CExpressionSample sample = samples[ i ]; @@ -840,7 +840,7 @@ void CChoreoScene::ParseFlexAnimations( ISceneTokenProcessor *tokenizer, CChoreo } } - if ( active || samples[ 0 ].Size() >= 1 ) + if ( active || samples[ 0 ].Count() >= 1 ) { // Add it in CFlexAnimationTrack *track = e->AddTrack( flexcontroller ); @@ -853,7 +853,7 @@ void CChoreoScene::ParseFlexAnimations( ISceneTokenProcessor *tokenizer, CChoreo for ( int t = 0; t < ( combo ? 2 : 1 ); t++ ) { - for ( int i = 0; i < samples[ t ].Size(); i++ ) + for ( int i = 0; i < samples[ t ].Count(); i++ ) { CExpressionSample *sample = &samples[ t ][ i ]; @@ -1527,7 +1527,7 @@ void CChoreoScene::InternalDetermineEventTypes() { m_bitvecHasEventOfType.ClearAll(); - for ( int i = 0 ; i < m_Actors.Size(); i++ ) + for ( int i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -1619,7 +1619,7 @@ void CChoreoScene::MarkForSaveAll( bool mark ) int i; // Mark global events - for ( i = 0 ; i < m_Events.Size(); i++ ) + for ( i = 0 ; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetActor() ) @@ -1629,7 +1629,7 @@ void CChoreoScene::MarkForSaveAll( bool mark ) } // Recursively mark everything else - for ( i = 0 ; i < m_Actors.Size(); i++ ) + for ( i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -1652,7 +1652,7 @@ bool CChoreoScene::ExportMarkedToFile( const char *filename ) // Look for events that don't have actor/channel set int i; - for ( i = 0 ; i < m_Events.Size(); i++ ) + for ( i = 0 ; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetActor() ) @@ -1661,7 +1661,7 @@ bool CChoreoScene::ExportMarkedToFile( const char *filename ) FileSaveEvent( buf, 0, e ); } - for ( i = 0 ; i < m_Actors.Size(); i++ ) + for ( i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -1695,7 +1695,7 @@ bool CChoreoScene::SaveToFile( const char *filename ) // Look for events that don't have actor/channel set int i; - for ( i = 0 ; i < m_Events.Size(); i++ ) + for ( i = 0 ; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetActor() ) @@ -1704,7 +1704,7 @@ bool CChoreoScene::SaveToFile( const char *filename ) FileSaveEvent( buf, 0, e ); } - for ( i = 0 ; i < m_Actors.Size(); i++ ) + for ( i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -2219,7 +2219,7 @@ float CChoreoScene::FindAdjustedStartTime( void ) CChoreoEvent *e; - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { e = m_Events[ i ]; @@ -2251,7 +2251,7 @@ float CChoreoScene::FindAdjustedEndTime( void ) CChoreoEvent *e; - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { e = m_Events[ i ]; @@ -2290,7 +2290,7 @@ void CChoreoScene::ResetSimulation( bool forward /*= true*/, float starttime /*= m_PauseEvents.RemoveAll(); // Put all items into the pending queue - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { e = m_Events[ i ]; e->ResetProcessing(); @@ -2317,7 +2317,7 @@ void CChoreoScene::ResetSimulation( bool forward /*= true*/, float starttime /*= // choreoprintf( 0, "Start time %f\n", m_flCurrentTime ); m_flLastActiveTime = 0.0f; - m_nActiveEvents = m_Events.Size(); + m_nActiveEvents = m_Events.Count(); m_flStartTime = starttime; m_flEndTime = endtime; @@ -2332,7 +2332,7 @@ bool CChoreoScene::CheckEventCompletion( void ) bool bAllCompleted = true; // check all items in the active pending queue - for ( int i = 0; i < m_ActiveResumeConditions.Size(); i++ ) + for ( int i = 0; i < m_ActiveResumeConditions.Count(); i++ ) { e = m_ActiveResumeConditions[ i ]; @@ -2378,7 +2378,7 @@ CChoreoEvent *CChoreoScene::FindPauseBetweenTimes( float starttime, float endtim CChoreoEvent *e; // Iterate through all events in the scene - for ( int i = 0; i < m_PauseEvents.Size(); i++ ) + for ( int i = 0; i < m_PauseEvents.Count(); i++ ) { e = m_PauseEvents[ i ]; if ( !e ) @@ -2648,7 +2648,7 @@ void CChoreoScene::Think( float curtime ) // Iterate through all events in the scene int i; - for ( i = 0; i < m_Events.Size(); i++ ) + for ( i = 0; i < m_Events.Count(); i++ ) { e = m_Events[ i ]; if ( !e ) @@ -2803,7 +2803,7 @@ void CChoreoScene::RemoveActor( CChoreoActor *actor ) //----------------------------------------------------------------------------- int CChoreoScene::FindActorIndex( CChoreoActor *actor ) { - for ( int i = 0; i < m_Actors.Size(); i++ ) + for ( int i = 0; i < m_Actors.Count(); i++ ) { if ( actor == m_Actors[ i ] ) { @@ -2882,7 +2882,7 @@ void CChoreoScene::DeleteReferencedObjects( CChoreoEvent *event ) //----------------------------------------------------------------------------- void CChoreoScene::DestroyActor( CChoreoActor *actor ) { - int size = m_Actors.Size(); + int size = m_Actors.Count(); for ( int i = size - 1; i >= 0; i-- ) { CChoreoActor *a = m_Actors[ i ]; @@ -2901,7 +2901,7 @@ void CChoreoScene::DestroyActor( CChoreoActor *actor ) //----------------------------------------------------------------------------- void CChoreoScene::DestroyChannel( CChoreoChannel *channel ) { - int size = m_Channels.Size(); + int size = m_Channels.Count(); for ( int i = size - 1; i >= 0; i-- ) { CChoreoChannel *c = m_Channels[ i ]; @@ -2920,7 +2920,7 @@ void CChoreoScene::DestroyChannel( CChoreoChannel *channel ) //----------------------------------------------------------------------------- void CChoreoScene::DestroyEvent( CChoreoEvent *event ) { - int size = m_Events.Size(); + int size = m_Events.Count(); for ( int i = size - 1; i >= 0; i-- ) { CChoreoEvent *e = m_Events[ i ]; @@ -2998,7 +2998,7 @@ void CChoreoScene::GetSceneTimes( float& start, float& end ) //----------------------------------------------------------------------------- void CChoreoScene::ReconcileTags( void ) { - for ( int i = 0 ; i < m_Actors.Size(); i++ ) + for ( int i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -3055,7 +3055,7 @@ void CChoreoScene::ReconcileTags( void ) //----------------------------------------------------------------------------- CChoreoEvent *CChoreoScene::FindTargetingEvent( const char *wavname, const char *name ) { - for ( int i = 0 ; i < m_Actors.Size(); i++ ) + for ( int i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -3097,7 +3097,7 @@ CChoreoEvent *CChoreoScene::FindTargetingEvent( const char *wavname, const char //----------------------------------------------------------------------------- CEventRelativeTag *CChoreoScene::FindTagByName( const char *wavname, const char *name ) { - for ( int i = 0 ; i < m_Actors.Size(); i++ ) + for ( int i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -3139,16 +3139,16 @@ CEventRelativeTag *CChoreoScene::FindTagByName( const char *wavname, const char //----------------------------------------------------------------------------- void CChoreoScene::ExportEvents( const char *filename, CUtlVector< CChoreoEvent * >& events ) { - if ( events.Size() <= 0 ) + if ( events.Count() <= 0 ) return; // Create a serialization buffer CUtlBuffer buf( 0, 0, CUtlBuffer::TEXT_BUFFER ); - FilePrintf( buf, 0, "// Choreo version 1: <%i> Exported Events\n", events.Size() ); + FilePrintf( buf, 0, "// Choreo version 1: <%i> Exported Events\n", events.Count() ); // Save out the selected events. int i; - for ( i = 0 ; i < events.Size(); i++ ) + for ( i = 0 ; i < events.Count(); i++ ) { CChoreoEvent *e = events[ i ]; if ( !e->GetActor() ) @@ -3275,7 +3275,7 @@ float CChoreoScene::SnapTime( float t ) //----------------------------------------------------------------------------- void CChoreoScene::ReconcileGestureTimes() { - for ( int i = 0 ; i < m_Actors.Size(); i++ ) + for ( int i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -3387,7 +3387,7 @@ bool CChoreoScene::Merge( CChoreoScene *other ) // Look for events that don't have actor/channel set int i; - for ( i = 0 ; i < other->m_Events.Size(); i++ ) + for ( i = 0 ; i < other->m_Events.Count(); i++ ) { CChoreoEvent *e = other->m_Events[ i ]; if ( e->GetActor() ) @@ -3401,7 +3401,7 @@ bool CChoreoScene::Merge( CChoreoScene *other ) ecount++; } - for ( i = 0 ; i < other->m_Actors.Size(); i++ ) + for ( i = 0 ; i < other->m_Actors.Count(); i++ ) { CChoreoActor *a = other->m_Actors[ i ]; @@ -3472,7 +3472,7 @@ bool CChoreoScene::Merge( CChoreoScene *other ) //----------------------------------------------------------------------------- void CChoreoScene::ReconcileCloseCaption() { - for ( int i = 0 ; i < m_Actors.Size(); i++ ) + for ( int i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) @@ -3507,7 +3507,7 @@ void CChoreoScene::SetFileName( char const *fn ) bool CChoreoScene::GetPlayingSoundName( char *pchBuff, int iBuffLength ) { - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetType() == CChoreoEvent::SPEAK && e->IsProcessing() ) @@ -3525,7 +3525,7 @@ bool CChoreoScene::GetPlayingSoundName( char *pchBuff, int iBuffLength ) //----------------------------------------------------------------------------- bool CChoreoScene::HasUnplayedSpeech() { - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetType() == CChoreoEvent::SPEAK ) @@ -3544,7 +3544,7 @@ bool CChoreoScene::HasUnplayedSpeech() //----------------------------------------------------------------------------- bool CChoreoScene::HasFlexAnimation() { - for ( int i = 0; i < m_Events.Size(); i++ ) + for ( int i = 0; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetType() == CChoreoEvent::FLEXANIMATION ) @@ -3631,7 +3631,7 @@ void CChoreoScene::SaveToBinaryBuffer( CUtlBuffer& buf, unsigned int nTextVersio // Look for events that don't have actor/channel set CUtlVector< CChoreoEvent * > eventList; int i; - for ( i = 0 ; i < m_Events.Size(); i++ ) + for ( i = 0 ; i < m_Events.Count(); i++ ) { CChoreoEvent *e = m_Events[ i ]; if ( e->GetActor() ) @@ -3651,7 +3651,7 @@ void CChoreoScene::SaveToBinaryBuffer( CUtlBuffer& buf, unsigned int nTextVersio // Now serialize the actors themselves CUtlVector< CChoreoActor * > actorList; - for ( i = 0 ; i < m_Actors.Size(); i++ ) + for ( i = 0 ; i < m_Actors.Count(); i++ ) { CChoreoActor *a = m_Actors[ i ]; if ( !a ) diff --git a/lib/linux64/libtier0_srv.so b/lib/linux64/libtier0_srv.so new file mode 100644 index 00000000..161cb9e2 Binary files /dev/null and b/lib/linux64/libtier0_srv.so differ diff --git a/lib/linux64/libvstdlib_srv.so b/lib/linux64/libvstdlib_srv.so new file mode 100644 index 00000000..50a8b484 Binary files /dev/null and b/lib/linux64/libvstdlib_srv.so differ diff --git a/lib/linux64/mathlib.a b/lib/linux64/mathlib.a new file mode 100644 index 00000000..5d5ffdf1 Binary files /dev/null and b/lib/linux64/mathlib.a differ diff --git a/lib/linux64/tier1.a b/lib/linux64/tier1.a new file mode 100644 index 00000000..7bca2b5b Binary files /dev/null and b/lib/linux64/tier1.a differ diff --git a/linux_sdk/Makefile.mathlib b/linux_sdk/Makefile.mathlib index 638c4df6..1276ed09 100644 --- a/linux_sdk/Makefile.mathlib +++ b/linux_sdk/Makefile.mathlib @@ -10,7 +10,7 @@ TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0 TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1 MATHLIB_PUBLIC_SRC_DIR = $(SRC_DIR)/public/mathlib -LIB_OBJ_DIR = $(BUILD_OBJ_DIR)/$(NAME)_$(ARCH) +LIB_OBJ_DIR = $(BUILD_OBJ_DIR)/$(NAME) #_$(ARCH) # Extension of linux static library override SHLIBEXT = a diff --git a/linux_sdk/Makefile.tier1 b/linux_sdk/Makefile.tier1 index 20c0c818..8f5a73cc 100644 --- a/linux_sdk/Makefile.tier1 +++ b/linux_sdk/Makefile.tier1 @@ -9,7 +9,7 @@ PUBLIC_SRC_DIR = $(SRC_DIR)/public TIER0_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier0 TIER1_PUBLIC_SRC_DIR = $(SRC_DIR)/public/tier1 -LIB_OBJ_DIR=$(BUILD_OBJ_DIR)/$(NAME)_$(ARCH) +LIB_OBJ_DIR=$(BUILD_OBJ_DIR)/$(NAME) #_$(ARCH) # Extension of linux static library override SHLIBEXT = a diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index f492d836..0a82d866 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -328,7 +328,7 @@ void inline SinCos( float radians, float *sine, float *cosine ) fstp DWORD PTR [eax] } #elif defined( _LINUX ) || defined ( __APPLE__ ) - register double __cosr, __sinr; + double __cosr, __sinr; __asm __volatile__ ("fsincos" : "=t" (__cosr), "=u" (__sinr) : "0" (radians)); @@ -1548,7 +1548,7 @@ float Hermite_Spline( float t ); -void Hermite_SplineBasis( float t, float basis[] ); +void Hermite_SplineBasis( float t, float basis[4] ); void Hermite_Spline( const Quaternion &q0, diff --git a/public/steam/steamtypes.h b/public/steam/steamtypes.h index 960a2710..bddce391 100644 --- a/public/steam/steamtypes.h +++ b/public/steam/steamtypes.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2004, Valve LLC, All rights reserved. ============ +//========= Copyright � 1996-2004, Valve LLC, All rights reserved. ============ // // Purpose: // @@ -18,8 +18,10 @@ typedef unsigned char uint8; #if defined(__x86_64__) || defined(_WIN64) +#ifndef X64BITS #define X64BITS #endif +#endif typedef unsigned char uint8; typedef signed char int8; diff --git a/public/tier0/basetypes.h b/public/tier0/basetypes.h index 96d4c73b..700726b5 100644 --- a/public/tier0/basetypes.h +++ b/public/tier0/basetypes.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -43,12 +43,6 @@ #define NULL 0 #endif -#if defined _LINUX && !defined __APPLE__ -typedef unsigned int uintptr_t; -#elif defined __APPLE__ -#include -#endif - #define ExecuteNTimes( nTimes, x ) \ { \ static int __executeCount=0;\ @@ -66,7 +60,7 @@ typedef unsigned int uintptr_t; template inline T AlignValue( T val, unsigned alignment ) { - return (T)( ( (uintptr_t)val + alignment - 1 ) & ~( alignment - 1 ) ); + return (T)( ( (uintp)val + alignment - 1 ) & ~( alignment - 1 ) ); } @@ -122,18 +116,7 @@ FORCEINLINE float fpmax( float a, float b ) #define TRUE (!FALSE) #endif - -typedef int BOOL; typedef int qboolean; -typedef unsigned long ULONG; -typedef unsigned char BYTE; -typedef unsigned char byte; -typedef unsigned short word; - -#if !defined __APPLE__ -typedef unsigned int uintptr_t; -#endif - enum ThreeState_t { diff --git a/public/tier0/platform.h b/public/tier0/platform.h index 3a05e20f..dce237c5 100644 --- a/public/tier0/platform.h +++ b/public/tier0/platform.h @@ -135,8 +135,10 @@ typedef unsigned char uint8; typedef signed char int8; #ifdef __x86_64__ +#ifndef X64BITS #define X64BITS #endif +#endif #if defined( _WIN32 ) diff --git a/public/tier0/threadtools.h b/public/tier0/threadtools.h index e0c9317b..4909dc71 100644 --- a/public/tier0/threadtools.h +++ b/public/tier0/threadtools.h @@ -1,4 +1,4 @@ -//========== Copyright © 2005, Valve Corporation, All rights reserved. ======== +//========== Copyright � 2005, Valve Corporation, All rights reserved. ======== // // Purpose: A collection of utility classes to simplify thread handling, and // as much as possible contain portability problems. Here avoiding @@ -983,7 +983,14 @@ private: class TFRWL_ALIGN TT_CLASS CThreadSpinRWLock { public: - CThreadSpinRWLock() { COMPILE_TIME_ASSERT( sizeof( LockInfo_t ) == sizeof( int64 ) ); Assert( (int)this % 8 == 0 ); memset( this, 0, sizeof( *this ) ); } + CThreadSpinRWLock() + { + COMPILE_TIME_ASSERT( sizeof( LockInfo_t ) == sizeof( int64 ) ); + Assert( (int)this % 8 == 0 ); + m_lockInfo.m_writerId = 0; + m_lockInfo.m_nReaders = 0; + m_lockInfo.m_i64 = 0; + } bool TryLockForWrite(); bool TryLockForRead(); @@ -1001,10 +1008,14 @@ public: void UnlockWrite() const { const_cast(this)->UnlockWrite(); } private: - struct LockInfo_t + union LockInfo_t { - uint32 m_writerId; - int m_nReaders; + struct + { + uint32 m_writerId; + int m_nReaders; + }; + int64 m_i64; }; bool AssignIf( const LockInfo_t &newValue, const LockInfo_t &comperand ); @@ -1119,7 +1130,11 @@ protected: #endif // "Virtual static" facility +#ifdef PLATFORM_WINDOWS typedef unsigned (__stdcall *ThreadProc_t)( void * ); +#else + typedef unsigned (*ThreadProc_t)( void * ); +#endif virtual ThreadProc_t GetThreadProc(); CThreadMutex m_Lock; @@ -1141,7 +1156,11 @@ private: bool * pfInitSuccess; }; +#ifdef PLATFORM_WINDOWS static unsigned __stdcall ThreadProc( void * pv ); +#else + static void* ThreadProc( void * pv ); +#endif // make copy constructor and assignment operator inaccessible CThread( const CThread & ); @@ -1509,8 +1528,8 @@ inline bool CThreadSpinRWLock::TryLockForWrite( const uint32 threadId ) return false; } - static const LockInfo_t oldValue = { 0, 0 }; - LockInfo_t newValue = { threadId, 0 }; + static const LockInfo_t oldValue = { {0, 0} }; + LockInfo_t newValue = { {threadId, 0} }; const bool bSuccess = AssignIf( newValue, oldValue ); #if defined(_X360) if ( bSuccess ) diff --git a/public/tier1/datamanager.h b/public/tier1/datamanager.h index 02181541..06990d32 100644 --- a/public/tier1/datamanager.h +++ b/public/tier1/datamanager.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -14,9 +14,9 @@ #include "utlmultilist.h" #include "utlvector.h" -FORWARD_DECLARE_HANDLE( memhandle_t ); +DECLARE_HANDLE_32BIT( memhandle_t ); -#define INVALID_MEMHANDLE ((memhandle_t)0xffffffff) +#define INVALID_MEMHANDLE (memhandle_t::MakeHandle(~0)) class CDataManagerBase { @@ -251,7 +251,7 @@ private: inline unsigned short CDataManagerBase::FromHandle( memhandle_t handle ) { - unsigned int fullWord = (unsigned int)handle; + unsigned int fullWord = handle.GetHandleValue(); unsigned short serial = fullWord>>16; unsigned short index = fullWord & 0xFFFF; index--; diff --git a/public/tier1/mempool.h b/public/tier1/mempool.h index 3b927812..8dbf3eae 100644 --- a/public/tier1/mempool.h +++ b/public/tier1/mempool.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -440,7 +440,7 @@ inline void CAlignedMemPool inline int __cdecl CAlignedMemPool::CompareChunk( void * const *ppLeft, void * const *ppRight ) { - return ((unsigned)*ppLeft) - ((unsigned)*ppRight); + return ((uintp)*ppLeft) - ((uintp)*ppRight); } template diff --git a/public/tier1/utlbuffer.h b/public/tier1/utlbuffer.h index f4e7eef9..f54e3dc1 100644 --- a/public/tier1/utlbuffer.h +++ b/public/tier1/utlbuffer.h @@ -1,4 +1,4 @@ -//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======// +//====== Copyright � 1996-2005, Valve Corporation, All rights reserved. =======// // // Purpose: // @@ -181,6 +181,7 @@ public: unsigned int GetUnsignedInt( ); float GetFloat( ); double GetDouble( ); + void* GetPtr( ); void GetString( char* pString, int nMaxChars = 0 ); void Get( void* pMem, int size ); void GetLine( char* pLine, int nMaxChars = 0 ); @@ -254,6 +255,7 @@ public: void PutUnsignedInt( unsigned int u ); void PutFloat( float f ); void PutDouble( double d ); + void PutPtr( void * ); void PutString( const char* pString ); void Put( const void* pMem, int size ); @@ -627,7 +629,7 @@ inline void CUtlBuffer::GetTypeBin< float >( float &dest ) { if ( CheckGet( sizeof( float ) ) ) { - unsigned int pData = (unsigned int)PeekGet(); + uintp pData = (uintp)PeekGet(); if ( IsX360() && ( pData & 0x03 ) ) { // handle unaligned read @@ -737,6 +739,18 @@ inline double CUtlBuffer::GetDouble( ) return d; } +inline void *CUtlBuffer::GetPtr( ) +{ + void *p; + // LEGACY WARNING: in text mode, PutPtr writes 32 bit pointers in hex, while GetPtr reads 32 or 64 bit pointers in decimal +#ifndef X64BITS + p = ( void* )GetUnsignedInt(); +#else + p = ( void* )GetInt64(); +#endif + return p; +} + //----------------------------------------------------------------------------- // Where am I writing? @@ -949,6 +963,18 @@ inline void CUtlBuffer::PutDouble( double d ) PutType( d, "%f" ); } +inline void CUtlBuffer::PutPtr( void *p ) +{ + // LEGACY WARNING: in text mode, PutPtr writes 32 bit pointers in hex, while GetPtr reads 32 or 64 bit pointers in decimal + if (!IsText()) + { + PutTypeBin( p ); + } + else + { + Printf( "0x%p", p ); + } +} //----------------------------------------------------------------------------- // Am I a text buffer? diff --git a/public/tier1/utlfixedmemory.h b/public/tier1/utlfixedmemory.h index bb84844d..870f65c8 100644 --- a/public/tier1/utlfixedmemory.h +++ b/public/tier1/utlfixedmemory.h @@ -1,4 +1,4 @@ -//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======// +//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======// // // Purpose: // @@ -88,9 +88,9 @@ public: if ( !IsValidIterator( it ) ) return InvalidIndex(); - return ( int )( HeaderToBlock( it.m_pBlockHeader ) + it.m_nIndex ); + return ( intp )( HeaderToBlock( it.m_pBlockHeader ) + it.m_nIndex ); } - bool IsIdxAfter( int i, const Iterator_t &it ) const + bool IsIdxAfter( intp i, const Iterator_t &it ) const { Assert( IsValidIterator( it ) ); if ( !IsValidIterator( it ) ) @@ -110,8 +110,8 @@ public: Iterator_t InvalidIterator() const { return Iterator_t( NULL, -1 ); } // element access - T& operator[]( int i ); - const T& operator[]( int i ) const; + T& operator[]( intp i ); + const T& operator[]( intp i ) const; T& Element( int i ); const T& Element( int i ) const; @@ -136,7 +136,7 @@ protected: // Fast swap - WARNING: Swap invalidates all ptr-based indices!!! void Swap( CUtlFixedMemory< T > &mem ); - bool IsInBlock( int i, BlockHeader_t *pBlockHeader ) const + bool IsInBlock( intp i, BlockHeader_t *pBlockHeader ) const { T *p = ( T* )i; const T *p0 = HeaderToBlock( pBlockHeader ); @@ -209,14 +209,14 @@ void CUtlFixedMemory::Init( int nGrowSize /* = 0 */, int nInitSize /* = 0 */ // element access //----------------------------------------------------------------------------- template< class T > -inline T& CUtlFixedMemory::operator[]( int i ) +inline T& CUtlFixedMemory::operator[]( intp i ) { Assert( IsIdxValid(i) ); return *( T* )i; } template< class T > -inline const T& CUtlFixedMemory::operator[]( int i ) const +inline const T& CUtlFixedMemory::operator[]( intp i ) const { Assert( IsIdxValid(i) ); return *( T* )i; diff --git a/public/tier1/utlhash.h b/public/tier1/utlhash.h index b7cba7d4..c15e6c84 100644 --- a/public/tier1/utlhash.h +++ b/public/tier1/utlhash.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -895,7 +895,7 @@ template inline UtlHashFixedHandle for ( UtlPtrLinkedListIndex_t iElement = bucket.Head(); iElement != bucket.InvalidIndex(); iElement = bucket.Next( iElement ) ) { if ( bucket[iElement].m_uiKey == uiKey ) - return (UtlHashFixedHandle_t)iElement; + return (UtlHashFixedHandle_t)(intp)iElement; } return InvalidHandle(); diff --git a/public/tier1/utllinkedlist.h b/public/tier1/utllinkedlist.h index 56ac7273..0d51a462 100644 --- a/public/tier1/utllinkedlist.h +++ b/public/tier1/utllinkedlist.h @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Linked list container class // @@ -178,11 +178,11 @@ protected: // this is kind of ugly, but until C++ gets templatized typedefs in C++0x, it's our only choice template < class T > -class CUtlFixedLinkedList : public CUtlLinkedList< T, int, true, int, CUtlFixedMemory< UtlLinkedListElem_t< T, int > > > +class CUtlFixedLinkedList : public CUtlLinkedList< T, intp, true, intp, CUtlFixedMemory< UtlLinkedListElem_t< T, intp > > > { public: CUtlFixedLinkedList( int growSize = 0, int initSize = 0 ) - : CUtlLinkedList< T, int, true, int, CUtlFixedMemory< UtlLinkedListElem_t< T, int > > >( growSize, initSize ) {} + : CUtlLinkedList< T, intp, true, intp, CUtlFixedMemory< UtlLinkedListElem_t< T, intp > > >( growSize, initSize ) {} bool IsValidIndex( int i ) const { diff --git a/tier1/KeyValues.cpp b/tier1/KeyValues.cpp index 6d2cf110..da82d9e6 100644 --- a/tier1/KeyValues.cpp +++ b/tier1/KeyValues.cpp @@ -2371,7 +2371,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b int ival = strtol( value, &pIEnd, 10 ); float fval = (float)strtod( value, &pFEnd ); - bool bOverflow = ( ival == LONG_MAX || ival == LONG_MIN ) && errno == ERANGE; + //bool bOverflow = ( ival == LONG_MAX || ival == LONG_MIN ) && errno == ERANGE; #ifdef POSIX // strtod supports hex representation in strings under posix but we DON'T // want that support in keyvalues, so undo it here if needed @@ -2409,7 +2409,7 @@ void KeyValues::RecursiveLoadFromBuffer( char const *resourceName, CUtlBuffer &b dat->m_flValue = fval; dat->m_iDataType = TYPE_FLOAT; } - else if (pIEnd == pSEnd && !bOverflow) + else if (pIEnd == pSEnd) //&& !bOverflow) { dat->m_iValue = ival; dat->m_iDataType = TYPE_INT; @@ -2540,7 +2540,7 @@ bool KeyValues::WriteAsBinary( CUtlBuffer &buffer ) } case TYPE_PTR: { - buffer.PutUnsignedInt( (int)dat->m_pValue ); + buffer.PutPtr( dat->m_pValue ); } default: @@ -2644,7 +2644,7 @@ bool KeyValues::ReadAsBinary( CUtlBuffer &buffer, int nStackDepth ) } case TYPE_PTR: { - dat->m_pValue = (void*)buffer.GetUnsignedInt(); + dat->m_pValue = buffer.GetPtr(); } default: diff --git a/tier1/checksum_crc.cpp b/tier1/checksum_crc.cpp index 3e0f20d4..740de4cd 100644 --- a/tier1/checksum_crc.cpp +++ b/tier1/checksum_crc.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: Generic CRC functions // @@ -147,7 +147,7 @@ JustAfew: // The low-order two bits of pb and nBuffer in total control the // upfront work. // - nFront = ((unsigned int)pb) & 3; + nFront = ((uintp)pb) & 3; nBuffer -= nFront; switch (nFront) { diff --git a/tier1/datamanager.cpp b/tier1/datamanager.cpp index fd3ddf1a..33c74665 100644 --- a/tier1/datamanager.cpp +++ b/tier1/datamanager.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // @@ -9,8 +9,6 @@ #include "basetypes.h" #include "datamanager.h" -DECLARE_POINTER_HANDLE( memhandle_t ); - #define AUTO_LOCK_DM() AUTO_LOCK_( CDataManagerBase, *this ) CDataManagerBase::CDataManagerBase( unsigned int maxSize ) @@ -320,7 +318,7 @@ memhandle_t CDataManagerBase::ToHandle( unsigned short index ) unsigned int hiword = m_memoryLists.Element(index).serial; hiword <<= 16; index++; - return (memhandle_t)( hiword|index ); + return memhandle_t::MakeHandle( hiword|index ); } unsigned int CDataManagerBase::TargetSize() diff --git a/tier1/processor_detect_linux.cpp b/tier1/processor_detect_linux.cpp index b09df0e0..29f84e13 100644 --- a/tier1/processor_detect_linux.cpp +++ b/tier1/processor_detect_linux.cpp @@ -1,4 +1,4 @@ -//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// +//========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: linux dependant ASM code for CPU capability detection // @@ -11,30 +11,43 @@ bool CheckMMXTechnology(void) { +#ifndef PLATFORM_64BITS unsigned long eax,ebx,edx,unused; cpuid(1,eax,ebx,unused,edx); return edx & 0x800000; +#else + return true; +#endif } bool CheckSSETechnology(void) { +#ifndef PLATFORM_64BITS unsigned long eax,ebx,edx,unused; cpuid(1,eax,ebx,unused,edx); return edx & 0x2000000L; +#else + return true; +#endif } bool CheckSSE2Technology(void) { +#ifndef PLATFORM_64BITS unsigned long eax,ebx,edx,unused; cpuid(1,eax,ebx,unused,edx); return edx & 0x04000000; +#else + return true; +#endif } bool Check3DNowTechnology(void) { +#ifndef PLATFORM_64BITS unsigned long eax, unused; cpuid(0x80000000,eax,unused,unused,unused); @@ -44,4 +57,7 @@ bool Check3DNowTechnology(void) return ( eax & 1<<31 ); } return false; +#else + return true; +#endif }