fpersmissive fixes

This commit is contained in:
nillerusr 2022-06-15 21:59:06 +03:00
parent 29db778997
commit b06620b8c9
43 changed files with 220 additions and 185 deletions

View File

@ -311,12 +311,15 @@ FloatBitMap_t *FloatBitMap_t::QuarterSize(void) const
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
for(int y=0;y<Height/2;y++)
{
for(int x=0;x<Width/2;x++)
{
for(int c=0;c<4;c++)
newbm->Pixel(x,y,c)=((Pixel(x*2,y*2,c)+Pixel(x*2+1,y*2,c)+
Pixel(x*2,y*2+1,c)+Pixel(x*2+1,y*2+1,c))/4);
}
}
return newbm;
}
@ -326,11 +329,13 @@ FloatBitMap_t *FloatBitMap_t::QuarterSizeBlocky(void) const
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
for(int y=0;y<Height/2;y++)
{
for(int x=0;x<Width/2;x++)
{
for(int c=0;c<4;c++)
newbm->Pixel(x,y,c)=Pixel(x*2,y*2,c);
}
}
return newbm;
}
@ -349,11 +354,14 @@ float FloatBitMap_t::BrightestColor(void)
{
float ret=0.0;
for(int y=0;y<Height;y++)
{
for(int x=0;x<Width;x++)
{
Vector v(Pixel(x,y,0),Pixel(x,y,1),Pixel(x,y,2));
ret=max(ret,v.Length());
}
}
return ret;
}
@ -394,6 +402,7 @@ void FloatBitMap_t::UnLogize(void)
void FloatBitMap_t::Clear(float r, float g, float b, float alpha)
{
for(int y=0;y<Height;y++)
{
for(int x=0;x<Width;x++)
{
Pixel(x,y,0)=r;
@ -401,6 +410,7 @@ void FloatBitMap_t::Clear(float r, float g, float b, float alpha)
Pixel(x,y,2)=b;
Pixel(x,y,3)=alpha;
}
}
}
void FloatBitMap_t::ScaleRGB(float scale_factor)
@ -423,52 +433,61 @@ void FloatBitMap_t::SmartPaste(FloatBitMap_t const &b, int xofs, int yofs, uint3
FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3};
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3};
for (int x = 0; x < Width; x++)
{
for(int i=0;i<NDELTAS;i++)
for (int y = 0; y < Height; y++)
{
int x1=x+dx[i];
int y1=y+dy[i];
x1=MAX(0,x1);
x1=MIN(Width-1,x1);
y1=MAX(0,y1);
y1=MIN(Height-1,y1);
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c);
deltas[i]->Pixel(x,y,c)=dx1;
for (int c = 0; c < 3; c++)
{
for (int i = 0; i < NDELTAS; i++)
{
int x1 = x + dx[i];
int y1 = y + dy[i];
x1 = MAX(0, x1);
x1 = MIN(Width - 1, x1);
y1 = MAX(0, y1);
y1 = MIN(Height - 1, y1);
float dx1 = Pixel(x, y, c) - Pixel(x1, y1, c);
deltas[i]->Pixel(x, y, c) = dx1;
}
}
for(int x=1;x<b.Width-1;x++)
for(int y=1;y<b.Height-1;y++)
for(int c=0;c<3;c++)
}
}
for (int x = 1; x < b.Width - 1; x++)
{
for(int i=0;i<NDELTAS;i++)
for (int y = 1; y < b.Height - 1; y++)
{
float diff=b.Pixel(x,y,c)-b.Pixel(x+dx[i],y+dy[i],c);
deltas[i]->Pixel(x+xofs,y+yofs,c)=diff;
for (int c = 0; c < 3; c++)
{
for (int i = 0; i < NDELTAS; i++)
{
float diff = b.Pixel(x, y, c) - b.Pixel(x + dx[i], y + dy[i], c);
deltas[i]->Pixel(x + xofs, y + yofs, c) = diff;
if (Flags & SPFLAGS_MAXGRADIENT)
{
float dx1=Pixel(x+xofs,y+yofs,c)-Pixel(x+dx[i]+xofs,y+dy[i]+yofs,c);
if (fabs(dx1)>fabs(diff))
deltas[i]->Pixel(x+xofs,y+yofs,c)=dx1;
float dx1 = Pixel(x + xofs, y + yofs, c) - Pixel(x + dx[i] + xofs, y + dy[i] + yofs, c);
if (fabs(dx1) > fabs(diff))
deltas[i]->Pixel(x + xofs, y + yofs, c) = dx1;
}
}
}
}
}
// now, calculate modifiability
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for (int x = 0; x < Width; x++)
{
float modify=0;
if (
(x>xofs+1) && (x<=xofs+b.Width-2) &&
(y>yofs+1) && (y<=yofs+b.Height-2))
modify=1;
Alpha(x,y)=modify;
for (int y = 0; y < Height; y++)
{
float modify = 0;
if ( (x > xofs + 1) && (x <= xofs + b.Width - 2) &&
(y > yofs + 1) && (y <= yofs + b.Height - 2))
modify = 1;
Alpha(x, y) = modify;
}
}
// // now, force a fex pixels in center to be constant
// int midx=xofs+b.Width/2;
// int midy=yofs+b.Height/2;
@ -476,10 +495,10 @@ void FloatBitMap_t::SmartPaste(FloatBitMap_t const &b, int xofs, int yofs, uint3
// for(int y=midy-10;y<midy+10;y++)
// {
// Alpha(x,y)=0;
// for(int c=0;c<3;c++)
// for(int c=0;c < 3;c++)
// Pixel(x,y,c)=b.Pixel(x-xofs,y-yofs,c);
// }
Poisson(deltas,6000,Flags);
Poisson(deltas, 6000, Flags);
}
void FloatBitMap_t::ScaleGradients(void)
@ -489,57 +508,57 @@ void FloatBitMap_t::ScaleGradients(void)
FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3};
double gsum=0.0;
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3
};
double gsum = 0.0;
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
for (int c = 0; c < 3; c++)
{
for(int i=0;i<NDELTAS;i++)
for (int i = 0; i < NDELTAS; i++)
{
int x1=x+dx[i];
int y1=y+dy[i];
x1=MAX(0,x1);
x1=MIN(Width-1,x1);
y1=MAX(0,y1);
y1=MIN(Height-1,y1);
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c);
deltas[i]->Pixel(x,y,c)=dx1;
gsum+=fabs(dx1);
int x1 = x + dx[i];
int y1 = y + dy[i];
x1 = MAX(0, x1);
x1 = MIN(Width - 1, x1);
y1 = MAX(0, y1);
y1 = MIN(Height - 1, y1);
float dx1 = Pixel(x, y, c) - Pixel(x1, y1, c);
deltas[i]->Pixel(x, y, c) = dx1;
gsum += fabs(dx1);
}
}
// now, reduce gradient changes
// float gavg=gsum/(Width*Height);
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
for (int c = 0; c < 3; c++)
{
for(int i=0;i<NDELTAS;i++)
for (int i = 0; i < NDELTAS; i++)
{
float norml=1.1*deltas[i]->Pixel(x,y,c);
// if (norml<0.0)
float norml = 1.1 *deltas[i]->Pixel(x, y, c);
// if (norml < 0.0)
// norml=-pow(-norml,1.2);
// else
// norml=pow(norml,1.2);
deltas[i]->Pixel(x,y,c)=norml;
deltas[i]->Pixel(x, y, c) = norml;
}
}
// now, calculate modifiability
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
{
float modify=0;
if (
(x>0) && (x<Width-1) &&
(y) && (y<Height-1))
float modify = 0;
if ( (x > 0) && (x < Width - 1) &&
(y) && (y < Height - 1))
{
modify=1;
Alpha(x,y)=modify;
modify = 1;
Alpha(x, y) = modify;
}
}
Poisson(deltas,2200,0);
Poisson(deltas, 2200, 0);
}
@ -553,7 +572,9 @@ void FloatBitMap_t::MakeTileable(void)
// set each pixel=avg-pixel
FloatBitMap_t *cursrc=&rslta;
for(int x=1;x<Width-1;x++)
{
for(int y=1;y<Height-1;y++)
{
for(int c=0;c<3;c++)
{
DiffMapX.Pixel(x,y,c)=Pixel(x,y,c)-Pixel(x+1,y,c);
@ -586,7 +607,9 @@ void FloatBitMap_t::MakeTileable(void)
{
float error=0.0;
for(int x=1;x<Width-1;x++)
{
for(int y=1;y<Height-1;y++)
{
for(int c=0;c<3;c++)
{
float desiredx=DiffMapX.Pixel(x,y,c)+cursrc->Pixel(x+1,y,c);
@ -597,11 +620,15 @@ void FloatBitMap_t::MakeTileable(void)
}
SWAP(cursrc,curdst);
}
}
}
// paste result
for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++)
for(int c=0;c<3;c++)
Pixel(x,y,c)=curdst->Pixel(x,y,c);
}
}
}
@ -613,15 +640,18 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(y=0;y<Height;y++)
if (Alpha(minx,y))
break;
if (y!=Height)
break;
}
for(maxx=Width-1;maxx>=0;maxx--)
{
int y;
for(y=0;y<Height;y++)
if (Alpha(maxx,y))
break;
if (y!=Height)
break;
}
@ -631,6 +661,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(x=minx;x<=maxx;x++)
if (Alpha(x,miny))
break;
if (x<maxx)
break;
}
@ -640,6 +671,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(x=minx;x<=maxx;x++)
if (Alpha(x,maxy))
break;
if (x<maxx)
break;
}
@ -666,9 +698,13 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
tmp->Poisson(lowdeltas,n_iters*4,flags);
// now, propagate results from tmp to us
for(int x=0;x<tmp->Width;x++)
{
for(int y=0;y<tmp->Height;y++)
{
for(int xi=0;xi<2;xi++)
{
for(int yi=0;yi<2;yi++)
{
if (Alpha(x*2+xi,y*2+yi))
{
for(int c=0;c<3;c++)
@ -684,6 +720,10 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
for(int i=0;i<NDELTAS;i++)
delete lowdeltas[i];
}
}
}
}
}
FloatBitMap_t work1(this);
FloatBitMap_t work2(this);
FloatBitMap_t *curdst=&work1;

View File

@ -1450,9 +1450,6 @@ virtualmodel_t *CMDLCache::GetVirtualModelFast( const studiohdr_t *pStudioHdr, M
AllocateVirtualModel( handle );
// MoeMod : added
pStudioHdr->SetVirtualModel( MDLHandleToVirtual( handle ) );
// Group has to be zero to ensure refcounting is correct
int nGroup = pStudioData->m_pVirtualModel->m_group.AddToTail( );
Assert( nGroup == 0 );

View File

@ -1098,10 +1098,10 @@ void CBaseClient::EndTrace( bf_write &msg )
}
if ( sv_netspike_output.GetInt() & 1 )
COM_LogString( SERVER_PACKETS_LOG, logData.String() );
COM_LogString( SERVER_PACKETS_LOG, (const char*)logData.String() );
if ( sv_netspike_output.GetInt() & 2 )
Log( "%s", logData.String() );
ETWMark1S( "netspike", logData.String() );
Log( "%s", (const char*)logData.String() );
ETWMark1S( "netspike", (const char*)logData.String() );
m_Trace.m_Records.RemoveAll();
m_iTracing = 0;
}

View File

@ -318,7 +318,7 @@ void CM_CreateDispPhysCollide( dphysdisp_t *pDispLump, int dispLumpSize )
{
g_VirtualTerrain.LevelInit(pDispLump, dispLumpSize);
g_TerrainList.SetCount( g_DispCollTreeCount );
for ( int i = 0; i < g_DispCollTreeCount; i++ )
for ( intp i = 0; i < g_DispCollTreeCount; i++ )
{
// Don't create a physics collision model for displacements that have been tagged as such.
CDispCollTree *pDispTree = &g_pDispCollTrees[i];

View File

@ -39,7 +39,7 @@ void EncodeFloat( const SendProp *pProp, float fVal, bf_write *pOut, int objectI
}
else // standard clamped-range float
{
unsigned long ulVal;
unsigned int ulVal;
int nBits = pProp->m_nBits;
if ( flags & SPROP_NOSCALE )
{
@ -109,7 +109,7 @@ static float DecodeFloat(SendProp const *pProp, bf_read *pIn)
}
else // standard clamped-range float
{
unsigned long dwInterp = pIn->ReadUBitLong(pProp->m_nBits);
unsigned int dwInterp = pIn->ReadUBitLong(pProp->m_nBits);
float fVal = (float)dwInterp / ((1 << pProp->m_nBits) - 1);
fVal = pProp->m_fLowValue + (pProp->m_fHighValue - pProp->m_fLowValue) * fVal;
return fVal;
@ -281,7 +281,7 @@ void Int_Decode( DecodeInfo *pInfo )
{
if ( flags & SPROP_UNSIGNED )
{
pInfo->m_Value.m_Int = (long)pInfo->m_pIn->ReadVarInt32();
pInfo->m_Value.m_Int = (int)pInfo->m_pIn->ReadVarInt32();
}
else
{
@ -295,7 +295,7 @@ void Int_Decode( DecodeInfo *pInfo )
if( bits != 32 && (flags & SPROP_UNSIGNED) == 0 )
{
unsigned long highbit = 1ul << (pProp->m_nBits - 1);
unsigned int highbit = 1ul << (pProp->m_nBits - 1);
if ( pInfo->m_Value.m_Int & highbit )
{
pInfo->m_Value.m_Int -= highbit; // strip high bit...

View File

@ -310,12 +310,12 @@ int CSaveRestoreFileSystem::GetFileIndex( const char *filename )
FileHandle_t CSaveRestoreFileSystem::GetFileHandle( const char *filename )
{
int idx = GetFileIndex( filename );
intp idx = GetFileIndex( filename );
if ( idx == INVALID_INDEX )
{
idx = 0;
}
return (void*)idx;
return (FileHandle_t)idx;
}
//-----------------------------------------------------------------------------
@ -339,7 +339,7 @@ bool CSaveRestoreFileSystem::HandleIsValid( FileHandle_t hFile )
//-----------------------------------------------------------------------------
void CSaveRestoreFileSystem::RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID )
{
int idx = GetFileIndex( pOldPath );
intp idx = GetFileIndex( pOldPath );
if ( idx != INVALID_INDEX )
{
CUtlSymbol newID = AddString( Q_UnqualifiedFileName( pNewPath ) );
@ -369,7 +369,7 @@ FileHandle_t CSaveRestoreFileSystem::Open( const char *pFullName, const char *pO
{
SaveFile_t *pFile = NULL;
CUtlSymbol id = AddString( Q_UnqualifiedFileName( pFullName ) );
int idx = GetDirectory().Find( id );
intp idx = GetDirectory().Find( id );
if ( idx == INVALID_INDEX )
{
// Don't create a read-only file

View File

@ -75,6 +75,7 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "tier0/memalloc.h"
extern CNetworkStringTableContainer *networkStringTableContainerServer;
extern CNetworkStringTableContainer *networkStringTableContainerClient;

View File

@ -100,6 +100,7 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#include "tier0/memalloc.h"
//-----------------------------------------------------------------------------
// Globals

View File

@ -306,7 +306,7 @@ CQueuedLoader::CQueuedLoader() : BaseClass( false )
V_memset( m_pLoaders, 0, sizeof( m_pLoaders ) );
// set resource dictionaries sort context
for ( int i = 0; i < RESOURCEPRELOAD_COUNT; i++ )
for ( intp i = 0; i < RESOURCEPRELOAD_COUNT; i++ )
{
m_ResourceNames[i].SetLessContext( (void *)i );
}

View File

@ -126,7 +126,7 @@ public:
AUTO_LOCK( m_mutex );
int iEntry = m_map.Find( szFixedName );
intp iEntry = m_map.Find( szFixedName );
if ( iEntry == m_map.InvalidIndex() )
{
iEntry = m_map.Insert( strdup( szFixedName ), new AsyncOpenedFile_t );
@ -146,7 +146,7 @@ public:
AUTO_LOCK( m_mutex );
int iEntry = m_map.Find( szFixedName );
intp iEntry = m_map.Find( szFixedName );
if ( iEntry != m_map.InvalidIndex() )
{
m_map[iEntry]->AddRef();

View File

@ -102,7 +102,7 @@ HANDLE FindFirstFile( const char *fileName, FIND_DATA *dat)
{
char nameStore[PATH_MAX];
char *dir=NULL;
int n,iret=-1;
intp n,iret=-1;
Q_strncpy(nameStore,fileName, sizeof( nameStore ) );

View File

@ -968,7 +968,7 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_FadeEndTime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minRandomSpeed", 10 );
pVelocity->SetFloat( "maxRandomSpeed", 20 );

View File

@ -418,7 +418,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
// FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", m_nAttachment );
pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );
@ -430,7 +430,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_ParticleLifetime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minAttachmentSpeed", m_MinDirectedSpeed );
pVelocity->SetFloat( "maxAttachmentSpeed", m_MaxDirectedSpeed );
pVelocity->SetFloat( "minRandomSpeed", m_MinSpeed );
@ -1933,7 +1933,7 @@ void C_DustTrail::CleanupToolRecordingState( KeyValues *msg )
// FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", GetParentAttachment() );
pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );

View File

@ -132,7 +132,7 @@ static void RecordEffect( const char *pEffectName, const CEffectData &data )
msg->SetInt( "attachmentindex", data.m_nAttachmentIndex );
// NOTE: Ptrs are our way of indicating it's an entindex
msg->SetPtr( "entindex", (void*)data.entindex() );
msg->SetPtr( "entindex", (void*)(intp)data.entindex() );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
@ -213,7 +213,7 @@ void TE_DispatchEffect( IRecipientFilter& filter, float delay, KeyValues *pKeyVa
// NOTE: Ptrs are our way of indicating it's an entindex
ClientEntityHandle_t hWorld = ClientEntityList().EntIndexToHandle( 0 );
data.m_hEntity = (intp)pKeyValues->GetPtr( "entindex", (void*)hWorld.ToInt() );
data.m_hEntity = (intp)pKeyValues->GetPtr( "entindex", (void*)(intp)hWorld.ToInt() );
const char *pEffectName = pKeyValues->GetString( "effectname" );

View File

@ -240,7 +240,7 @@ void TE_PlayerDecal( IRecipientFilter& filter, float delay,
color32 rgbaColor = { 255, 255, 255, 255 };
effects->PlayerDecalShoot(
logo,
(void *)player,
(void *)(intp)player,
entity,
ent->GetModel(),
ent->GetAbsOrigin(),

View File

@ -403,7 +403,7 @@ void FX_MuzzleEffectAttached(
KeyValues *pInitializers = pEmitter->FindKey( "initializers", true );
KeyValues *pPosition = pInitializers->FindKey( "DmeLinearAttachedPositionInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", attachmentIndex );
pPosition->SetFloat( "linearOffsetX", 2.0f * scale );

View File

@ -11,7 +11,7 @@
#include "cbase.h"
#ifdef POSIX
#define HICON int
#define HICON intp
const int DT_LEFT = 1;
const int DT_CENTER = 2;
const int DT_RIGHT = 3;

View File

@ -1014,7 +1014,7 @@ bool CParticleEffectBinding::RecalculateBoundingBox()
CEffectMaterial* CParticleEffectBinding::GetEffectMaterial( CParticleSubTexture *pSubTexture )
{
// Hash the IMaterial pointer.
unsigned int index = (((unsigned int)pSubTexture->m_pGroup) >> 6) % EFFECT_MATERIAL_HASH_SIZE;
unsigned int index = (((intp)pSubTexture->m_pGroup) >> 6) % EFFECT_MATERIAL_HASH_SIZE;
for ( CEffectMaterial *pCur=m_EffectMaterialHash[index]; pCur; pCur = pCur->m_pHashedNext )
{
if ( pCur->m_pGroup == pSubTexture->m_pGroup )

View File

@ -2845,7 +2845,7 @@ AI_FollowGroup_t *CAI_FollowManager::FindFollowerGroup( CBaseEntity *pFollower )
{
for ( int i = 0; i < m_groups.Count(); i++ )
{
int h = m_groups[i]->followers.Head();
intp h = m_groups[i]->followers.Head();
while( h != m_groups[i]->followers.InvalidIndex() )
{
AI_Follower_t *p = &m_groups[i]->followers[h];

View File

@ -729,7 +729,7 @@ CAI_Hint *CAI_HintManager::GetFirstHint( AIHintIter_t *pIter )
{
if ( !gm_AllHints.Count() )
{
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex();
*pIter = (AIHintIter_t)(intp)gm_AllHints.InvalidIndex();
return NULL;
}
*pIter = (AIHintIter_t)0;
@ -743,10 +743,10 @@ CAI_Hint *CAI_HintManager::GetNextHint( AIHintIter_t *pIter )
{
if ( (intp)*pIter != gm_AllHints.InvalidIndex() )
{
int i = ( (intp)*pIter ) + 1;
intp i = ( (intp)*pIter ) + 1;
if ( gm_AllHints.Count() <= i )
{
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex();
*pIter = (AIHintIter_t)(intp)gm_AllHints.InvalidIndex();
return NULL;
}
*pIter = (AIHintIter_t)i;

View File

@ -176,7 +176,7 @@ CAI_Enemies::~CAI_Enemies()
AI_EnemyInfo_t *CAI_Enemies::GetFirst( AIEnemiesIter_t *pIter )
{
CMemMap::IndexType_t i = m_Map.FirstInorder();
*pIter = (AIEnemiesIter_t)(unsigned)i;
*pIter = (AIEnemiesIter_t)(uintp)i;
if ( i == m_Map.InvalidIndex() )
return NULL;
@ -197,7 +197,7 @@ AI_EnemyInfo_t *CAI_Enemies::GetNext( AIEnemiesIter_t *pIter )
return NULL;
i = m_Map.NextInorder( i );
*pIter = (AIEnemiesIter_t)(unsigned)i;
*pIter = (AIEnemiesIter_t)(uintp)i;
if ( i == m_Map.InvalidIndex() )
return NULL;

View File

@ -1224,7 +1224,7 @@ AI_PathNode_t CAI_Navigator::GetNearestNode()
#ifdef WIN32
COMPILE_TIME_ASSERT( (int)AIN_NO_NODE == NO_NODE );
#endif
return (AI_PathNode_t)( GetPathfinder()->NearestNodeToNPC() );
return (AI_PathNode_t)(intp)( GetPathfinder()->NearestNodeToNPC() );
}
//-----------------------------------------------------------------------------

View File

@ -573,7 +573,7 @@ CSound* CAI_Senses::GetFirstHeardSound( AISoundIter_t *pIter )
return NULL;
}
*pIter = (AISoundIter_t)iFirst;
*pIter = (AISoundIter_t)(intp)iFirst;
return CSoundEnt::SoundPointerForIndex( iFirst );
}
@ -584,7 +584,7 @@ CSound* CAI_Senses::GetNextHeardSound( AISoundIter_t *pIter )
if ( !*pIter )
return NULL;
int iCurrent = (intp)*pIter;
intp iCurrent = (intp)*pIter;
Assert( iCurrent != SOUNDLIST_EMPTY );
if ( iCurrent == SOUNDLIST_EMPTY )

View File

@ -420,7 +420,7 @@ CAI_BaseNPC *CAI_Squad::GetLeader( void )
//-----------------------------------------------------------------------------
CAI_BaseNPC *CAI_Squad::GetFirstMember( AISquadIter_t *pIter, bool bIgnoreSilentMembers )
{
int i = 0;
intp i = 0;
if ( bIgnoreSilentMembers )
{
for ( ; i < m_SquadMembers.Count(); i++ )

View File

@ -49,7 +49,7 @@ const char *TaskFailureToString( AI_TaskFailureCode_t code )
{
const char *pszResult;
if ( code < 0 || code >= NUM_FAIL_CODES )
pszResult = (const char *)code;
pszResult = (const char *)(intp)code;
else
pszResult = g_ppszTaskFailureText[code];
return pszResult;

View File

@ -2612,7 +2612,7 @@ void CNPC_MetroPolice::IdleSound( void )
if ( m_Sentences.Speak( pQuestion[bIsCriminal][nQuestionType] ) >= 0 )
{
GetSquad()->BroadcastInteraction( g_interactionMetrocopIdleChatter, (void*)(METROPOLICE_CHATTER_RESPONSE + nQuestionType), this );
GetSquad()->BroadcastInteraction( g_interactionMetrocopIdleChatter, (void*)(intp)(METROPOLICE_CHATTER_RESPONSE + nQuestionType), this );
m_nIdleChatterType = METROPOLICE_CHATTER_WAIT_FOR_RESPONSE;
}
}
@ -2983,7 +2983,7 @@ bool CNPC_MetroPolice::HandleInteraction(int interactionType, void *data, CBaseC
if ( interactionType == g_interactionMetrocopIdleChatter )
{
m_nIdleChatterType = (int)data;
m_nIdleChatterType = (intp)data;
return true;
}

View File

@ -1068,7 +1068,7 @@ void CCollisionEvent::FluidStartTouch( IPhysicsObject *pObject, IPhysicsFluidCon
return;
pEntity->AddEFlags( EFL_TOUCHING_FLUID );
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_TOUCH, (void*)pFluid->GetContents() );
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_TOUCH, (void*)(intp)pFluid->GetContents() );
float timeSinceLastCollision = DeltaTimeSinceLastFluid( pEntity );
if ( timeSinceLastCollision < 0.5f )
@ -1124,7 +1124,7 @@ void CCollisionEvent::FluidEndTouch( IPhysicsObject *pObject, IPhysicsFluidContr
}
pEntity->RemoveEFlags( EFL_TOUCHING_FLUID );
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_UNTOUCH, (void*)pFluid->GetContents() );
pEntity->OnEntityEvent( ENTITY_EVENT_WATER_UNTOUCH, (void*)(intp)pFluid->GetContents() );
}
class CSkipKeys : public IVPhysicsKeyHandler

View File

@ -2076,7 +2076,7 @@ public:
{
if ( ARRAYSIZE( g_NameMap ) != CChoreoEvent::NUM_TYPES )
{
Error( "g_NameMap contains %i entries, CChoreoEvent::NUM_TYPES == %i!",
Error( "g_NameMap contains %zd entries, CChoreoEvent::NUM_TYPES == %i!",
ARRAYSIZE( g_NameMap ), CChoreoEvent::NUM_TYPES );
}
for ( int i = 0; i < CChoreoEvent::NUM_TYPES; ++i )
@ -2158,7 +2158,7 @@ public:
{
if ( ARRAYSIZE( g_CCNameMap ) != CChoreoEvent::NUM_CC_TYPES )
{
Error( "g_CCNameMap contains %i entries, CChoreoEvent::NUM_CC_TYPES == %i!",
Error( "g_CCNameMap contains %zd entries, CChoreoEvent::NUM_CC_TYPES == %i!",
ARRAYSIZE( g_CCNameMap ), CChoreoEvent::NUM_CC_TYPES );
}
for ( int i = 0; i < CChoreoEvent::NUM_CC_TYPES; ++i )

View File

@ -368,7 +368,7 @@ bool CSceneImage::CreateSceneImageFile( CUtlBuffer &targetBuffer, char const *pc
if ( !bQuiet )
{
Msg( "Scenes: String Table: %d bytes\n", stringOffsets.Count() * sizeof( int ) );
Msg( "Scenes: String Table: %zd bytes\n", stringOffsets.Count() * sizeof( int ) );
Msg( "Scenes: String Pool: %d bytes\n", stringPool.TellMaxPut() );
}

View File

@ -2778,7 +2778,7 @@ LUFILE *lufopen(void *z,unsigned int len,DWORD flags,ZRESULT *err)
#ifdef _WIN32
res = DuplicateHandle(GetCurrentProcess(),hf,GetCurrentProcess(),&h,0,FALSE,DUPLICATE_SAME_ACCESS) == TRUE;
#else
h = (void*) dup( (intptr_t)hf );
h = (void*)(intptr_t) dup( (intptr_t)hf );
res = (intptr_t) dup >= 0;
#endif
if (!res)
@ -2793,7 +2793,7 @@ LUFILE *lufopen(void *z,unsigned int len,DWORD flags,ZRESULT *err)
h = CreateFile((const TCHAR *)z, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
#else
h = (void*) open( (const TCHAR *)z, O_RDONLY );
h = (void*)(intptr_t) open( (const TCHAR *)z, O_RDONLY );
#endif
if (h == INVALID_HANDLE_VALUE)
{
@ -4198,7 +4198,7 @@ ZRESULT TUnzip::Unzip(int index,void *dst,unsigned int len,DWORD flags)
h = ::CreateFile((const TCHAR*)dst, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
ze.attr, NULL);
#else
h = (void*) open( (const TCHAR*)dst, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO );
h = (void*)(intptr_t)open( (const TCHAR*)dst, O_WRONLY | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO );
#endif
}

View File

@ -278,13 +278,17 @@ public:
Vector ret(0,0,0);
int nfaces=0;
for(int f=0;f<6;f++)
{
if (face_maps[f].RGBAData)
{
nfaces++;
ret+=face_maps[f].AverageColor();
}
}
if (nfaces)
ret*=(1.0/nfaces);
return ret;
}
@ -293,11 +297,13 @@ public:
float ret=0.0;
int nfaces=0;
for(int f=0;f<6;f++)
{
if (face_maps[f].RGBAData)
{
nfaces++;
ret=max(ret,face_maps[f].BrightestColor());
}
}
return ret;
}

View File

@ -23,7 +23,6 @@ const char* ParseFileInternal( const char* pFileBytes, OUT_Z_CAP(nMaxTokenLen) c
template <size_t count>
const char* ParseFile( const char* pFileBytes, OUT_Z_ARRAY char (&pTokenOut)[count], bool* pWasQuoted, characterset_t *pCharSet = NULL, unsigned int nMaxTokenLen = (unsigned int)-1 )
{
(void*)nMaxTokenLen; // Avoid unreferenced variable warnings.
return ParseFileInternal( pFileBytes, pTokenOut, pWasQuoted, pCharSet, count );
}

View File

@ -75,7 +75,7 @@ INLINE_ON_PS3 const char *CThread::GetName()
#elif defined( _PS3 )
snprintf( m_szName, sizeof(m_szName) - 1, "Thread(%p)", this );
#elif defined( POSIX )
_snprintf( m_szName, sizeof(m_szName) - 1, "Thread(%p/0x%p)", this, m_threadId );
_snprintf( m_szName, sizeof(m_szName) - 1, "Thread(%p/0x%p)", this, (void*)m_threadId );
#endif
m_szName[sizeof(m_szName) - 1] = 0;
}

View File

@ -121,9 +121,6 @@ public:
I Alloc( bool multilist = false );
void Free( I elem );
// Identify the owner of this linked list's memory:
void SetAllocOwner( const char *pszAllocOwner );
// list modification
void LinkBefore( I before, I elem );
void LinkAfter( I after, I elem );
@ -618,12 +615,6 @@ void CUtlLinkedList<T,S,ML,I,M>::SetGrowSize( int growSize )
ResetDbgInfo();
}
template< class T, class S, bool ML, class I, class M >
void CUtlLinkedList<T,S,ML,I,M>::SetAllocOwner( const char *pszAllocOwner )
{
m_Memory.SetAllocOwner( pszAllocOwner );
}
//-----------------------------------------------------------------------------
// Deallocate memory

View File

@ -1934,11 +1934,11 @@ FORCEINLINE void GLMContext::DrawRangeElements( GLenum mode, GLuint start, GLuin
if ( pIndexBuf->m_bPseudo )
{
// you have to pass actual address, not offset
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_pPseudoBuf );
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_pPseudoBuf );
}
if (pIndexBuf->m_bUsingPersistentBuffer)
{
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_nPersistentBufferStartOffset );
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_nPersistentBufferStartOffset );
}
//#if GLMDEBUG

View File

@ -38,7 +38,7 @@ class BuildGroup
public:
BuildGroup(Panel *parentPanel, Panel *contextPanel);
~BuildGroup();
virtual ~BuildGroup();
// Toggle build mode on/off
virtual void SetEnabled(bool state);

View File

@ -1162,7 +1162,7 @@ inline ThreadHandle_t ThreadExecuteSoloImpl( CFunctor *pFunctor, const char *psz
hThread = CreateSimpleThread( FunctorExecuteThread, pFunctor, &threadId );
if ( pszName )
{
ThreadSetDebugName( threadId, pszName );
ThreadSetDebugName( (ThreadHandle_t)threadId, pszName );
}
return hThread;
}

View File

@ -1573,7 +1573,7 @@ void CUtlBuffer::VaPrintf( const char* pFmt, va_list list )
{
char temp[8192];
int nLen = V_vsnprintf( temp, sizeof( temp ), pFmt, list );
ErrorIfNot( nLen < sizeof( temp ), ( "CUtlBuffer::VaPrintf: String overflowed buffer [%d]\n", sizeof( temp ) ) );
ErrorIfNot( nLen < sizeof( temp ), ( "CUtlBuffer::VaPrintf: String overflowed buffer [%zd]\n", sizeof( temp ) ) );
PutString( temp );
}

View File

@ -5098,11 +5098,11 @@ void GLMContext::DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint e
if ( pIndexBuf->m_bPseudo )
{
// you have to pass actual address, not offset
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_pPseudoBuf );
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_pPseudoBuf );
}
if (pIndexBuf->m_bUsingPersistentBuffer)
{
indicesActual = (void*)( (int)indicesActual + (int)pIndexBuf->m_nPersistentBufferStartOffset );
indicesActual = (void*)( (intp)indicesActual + (intp)pIndexBuf->m_nPersistentBufferStartOffset );
}
#if GL_ENABLE_INDEX_VERIFICATION

View File

@ -320,13 +320,13 @@ CQCGenerator::CQCGenerator( vgui::Panel *pParent, const char *pszPath, const cha
SetParent( pParent );
char szGamePath[1024] = "\0";
char szSearchPath[1024] = "\0";
char szSearchPath[2048] = "\0";
// Get the currently set game configuration
GetVConfigRegistrySetting( GAMEDIR_TOKEN, szGamePath, sizeof( szGamePath ) );
static const char *pSurfacePropFilename = "\\scripts\\surfaceproperties.txt";
sprintf( szSearchPath, "%s%s", szGamePath, pSurfacePropFilename );
snprintf( szSearchPath, sizeof(szSearchPath), "%s%s", szGamePath, pSurfacePropFilename );
FileHandle_t fp = g_pFullFileSystem->Open( szSearchPath, "rb" );
@ -338,7 +338,7 @@ CQCGenerator::CQCGenerator( vgui::Panel *pParent, const char *pszPath, const cha
char *pszEndGamePath = Q_strrchr( szGamePath, '\\' );
pszEndGamePath[0] = 0;
V_strcat_safe( szGamePath, "\\hl2" );
sprintf( szSearchPath, "%s%s", szGamePath, pSurfacePropFilename );
snprintf( szSearchPath, sizeof(szSearchPath), "%s%s", szGamePath, pSurfacePropFilename );
fp = g_pFullFileSystem->Open( szSearchPath, "rb" );
}

View File

@ -509,7 +509,7 @@ bool InputHandleInputEvent( const InputEvent_t &event )
return true;
case IE_IMESetWindow:
g_pIInput->SetIMEWindow( (void *)event.m_nData );
g_pIInput->SetIMEWindow( (void *)(intp)event.m_nData );
return true;
case IE_LocateMouseClick:

View File

@ -189,8 +189,8 @@ IPhysicsCollisionSet *CPhysicsInterface::FindOrCreateCollisionSet( unsigned int
IPhysicsCollisionSet *pSet = FindCollisionSet( id );
if ( pSet )
return pSet;
int index = m_collisionSets.AddToTail();
m_pCollisionSetHash->add_elem( (void *)id, (void *)(index+1) );
intp index = m_collisionSets.AddToTail();
m_pCollisionSetHash->add_elem( (void *)(intp)id, (void *)(intp)(index+1) );
return &m_collisionSets[index];
}
@ -198,7 +198,7 @@ IPhysicsCollisionSet *CPhysicsInterface::FindCollisionSet( unsigned int id )
{
if ( m_pCollisionSetHash )
{
intp index = (intp)m_pCollisionSetHash->find_elem( (void *)id );
intp index = (intp)m_pCollisionSetHash->find_elem( (void *)(intp)id );
if ( index > 0 )
{
Assert( index <= m_collisionSets.Count() );

View File

@ -2054,7 +2054,7 @@ public:
// set the high bit, so zero means "not there"
hash |= 0x80000000;
return (void *)hash;
return (void *)(intp)hash;
}
// Lookup this object and get a multilist entry