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,13 +311,16 @@ FloatBitMap_t *FloatBitMap_t::QuarterSize(void) const
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2); FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
for(int y=0;y<Height/2;y++) for(int y=0;y<Height/2;y++)
{
for(int x=0;x<Width/2;x++) for(int x=0;x<Width/2;x++)
{ {
for(int c=0;c<4;c++) 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)+ 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); Pixel(x*2,y*2+1,c)+Pixel(x*2+1,y*2+1,c))/4);
} }
return newbm; }
return newbm;
} }
FloatBitMap_t *FloatBitMap_t::QuarterSizeBlocky(void) const FloatBitMap_t *FloatBitMap_t::QuarterSizeBlocky(void) const
@ -326,12 +329,14 @@ FloatBitMap_t *FloatBitMap_t::QuarterSizeBlocky(void) const
FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2); FloatBitMap_t *newbm=new FloatBitMap_t(Width/2,Height/2);
for(int y=0;y<Height/2;y++) for(int y=0;y<Height/2;y++)
{
for(int x=0;x<Width/2;x++) for(int x=0;x<Width/2;x++)
{ {
for(int c=0;c<4;c++) for(int c=0;c<4;c++)
newbm->Pixel(x,y,c)=Pixel(x*2,y*2,c); newbm->Pixel(x,y,c)=Pixel(x*2,y*2,c);
} }
return newbm; }
return newbm;
} }
Vector FloatBitMap_t::AverageColor(void) Vector FloatBitMap_t::AverageColor(void)
@ -349,12 +354,15 @@ float FloatBitMap_t::BrightestColor(void)
{ {
float ret=0.0; float ret=0.0;
for(int y=0;y<Height;y++) for(int y=0;y<Height;y++)
{
for(int x=0;x<Width;x++) for(int x=0;x<Width;x++)
{ {
Vector v(Pixel(x,y,0),Pixel(x,y,1),Pixel(x,y,2)); Vector v(Pixel(x,y,0),Pixel(x,y,1),Pixel(x,y,2));
ret=max(ret,v.Length()); ret=max(ret,v.Length());
} }
return ret; }
return ret;
} }
template <class T> static inline void SWAP(T & a, T & b) template <class T> static inline void SWAP(T & a, T & b)
@ -394,6 +402,7 @@ void FloatBitMap_t::UnLogize(void)
void FloatBitMap_t::Clear(float r, float g, float b, float alpha) void FloatBitMap_t::Clear(float r, float g, float b, float alpha)
{ {
for(int y=0;y<Height;y++) for(int y=0;y<Height;y++)
{
for(int x=0;x<Width;x++) for(int x=0;x<Width;x++)
{ {
Pixel(x,y,0)=r; 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,2)=b;
Pixel(x,y,3)=alpha; Pixel(x,y,3)=alpha;
} }
}
} }
void FloatBitMap_t::ScaleRGB(float scale_factor) void FloatBitMap_t::ScaleRGB(float scale_factor)
@ -418,68 +428,77 @@ static int dy[4]={-1,0,0,1};
void FloatBitMap_t::SmartPaste(FloatBitMap_t const &b, int xofs, int yofs, uint32 Flags) void FloatBitMap_t::SmartPaste(FloatBitMap_t const &b, int xofs, int yofs, uint32 Flags)
{ {
// now, need to make Difference map // now, need to make Difference map
FloatBitMap_t DiffMap0(this); FloatBitMap_t DiffMap0(this);
FloatBitMap_t DiffMap1(this); FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this); FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this); FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3}; FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3};
for(int x=0;x<Width;x++) for (int x = 0; x < Width; x++)
for(int y=0;y<Height;y++) {
for(int c=0;c<3;c++) for (int y = 0; y < Height; y++)
{ {
for(int i=0;i<NDELTAS;i++) for (int c = 0; c < 3; c++)
{ {
int x1=x+dx[i]; for (int i = 0; i < NDELTAS; i++)
int y1=y+dy[i]; {
x1=MAX(0,x1); int x1 = x + dx[i];
x1=MIN(Width-1,x1); int y1 = y + dy[i];
y1=MAX(0,y1); x1 = MAX(0, x1);
y1=MIN(Height-1,y1); x1 = MIN(Width - 1, x1);
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c); y1 = MAX(0, y1);
deltas[i]->Pixel(x,y,c)=dx1; 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 y = 1; y < b.Height - 1; y++)
{
for (int c = 0; c < 3; c++)
{
for (int i = 0; i < NDELTAS; i++)
{ {
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 diff=b.Pixel(x,y,c)-b.Pixel(x+dx[i],y+dy[i],c); float dx1 = Pixel(x + xofs, y + yofs, c) - Pixel(x + dx[i] + xofs, y + dy[i] + yofs, c);
deltas[i]->Pixel(x+xofs,y+yofs,c)=diff; if (fabs(dx1) > fabs(diff))
if (Flags & SPFLAGS_MAXGRADIENT) 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 // now, calculate modifiability
for(int x=0;x<Width;x++) for (int x = 0; x < Width; x++)
for(int y=0;y<Height;y++) {
{ for (int y = 0; y < Height; y++)
float modify=0; {
if ( float modify = 0;
(x>xofs+1) && (x<=xofs+b.Width-2) && if ( (x > xofs + 1) && (x <= xofs + b.Width - 2) &&
(y>yofs+1) && (y<=yofs+b.Height-2)) (y > yofs + 1) && (y <= yofs + b.Height - 2))
modify=1; modify = 1;
Alpha(x,y)=modify; Alpha(x, y) = modify;
} }
}
// // now, force a fex pixels in center to be constant // // now, force a fex pixels in center to be constant
// int midx=xofs+b.Width/2; // int midx=xofs+b.Width/2;
// int midy=yofs+b.Height/2; // int midy=yofs+b.Height/2;
// for(x=midx-10;x<midx+10;x++) // for(x=midx-10;x<midx+10;x++)
// for(int y=midy-10;y<midy+10;y++) // for(int y=midy-10;y<midy+10;y++)
// { // {
// Alpha(x,y)=0; // 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); // Pixel(x,y,c)=b.Pixel(x-xofs,y-yofs,c);
// } // }
Poisson(deltas,6000,Flags); Poisson(deltas, 6000, Flags);
} }
void FloatBitMap_t::ScaleGradients(void) void FloatBitMap_t::ScaleGradients(void)
@ -489,57 +508,57 @@ void FloatBitMap_t::ScaleGradients(void)
FloatBitMap_t DiffMap1(this); FloatBitMap_t DiffMap1(this);
FloatBitMap_t DiffMap2(this); FloatBitMap_t DiffMap2(this);
FloatBitMap_t DiffMap3(this); FloatBitMap_t DiffMap3(this);
FloatBitMap_t *deltas[4]={&DiffMap0,&DiffMap1,&DiffMap2,&DiffMap3}; FloatBitMap_t *deltas[4] = { &DiffMap0, &DiffMap1, &DiffMap2, &DiffMap3
double gsum=0.0; };
for(int x=0;x<Width;x++) double gsum = 0.0;
for(int y=0;y<Height;y++) for (int x = 0; x < Width; x++)
for(int c=0;c<3;c++) 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 x1 = x + dx[i];
int y1=y+dy[i]; int y1 = y + dy[i];
x1=MAX(0,x1); x1 = MAX(0, x1);
x1=MIN(Width-1,x1); x1 = MIN(Width - 1, x1);
y1=MAX(0,y1); y1 = MAX(0, y1);
y1=MIN(Height-1,y1); y1 = MIN(Height - 1, y1);
float dx1=Pixel(x,y,c)-Pixel(x1,y1,c); float dx1 = Pixel(x, y, c) - Pixel(x1, y1, c);
deltas[i]->Pixel(x,y,c)=dx1; deltas[i]->Pixel(x, y, c) = dx1;
gsum+=fabs(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 i = 0; i < NDELTAS; i++)
{
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;
} }
} }
// 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 i=0;i<NDELTAS;i++)
{
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;
}
}
// now, calculate modifiability // now, calculate modifiability
for(int x=0;x<Width;x++) for (int x = 0; x < Width; x++)
for(int y=0;y<Height;y++) for (int y = 0; y < Height; y++)
{ {
float modify=0; float modify = 0;
if ( if ( (x > 0) && (x < Width - 1) &&
(x>0) && (x<Width-1) && (y) && (y < Height - 1))
(y) && (y<Height-1)) {
{ modify = 1;
modify=1; Alpha(x, y) = modify;
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 // set each pixel=avg-pixel
FloatBitMap_t *cursrc=&rslta; FloatBitMap_t *cursrc=&rslta;
for(int x=1;x<Width-1;x++) for(int x=1;x<Width-1;x++)
{
for(int y=1;y<Height-1;y++) for(int y=1;y<Height-1;y++)
{
for(int c=0;c<3;c++) for(int c=0;c<3;c++)
{ {
DiffMapX.Pixel(x,y,c)=Pixel(x,y,c)-Pixel(x+1,y,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; float error=0.0;
for(int x=1;x<Width-1;x++) for(int x=1;x<Width-1;x++)
{
for(int y=1;y<Height-1;y++) for(int y=1;y<Height-1;y++)
{
for(int c=0;c<3;c++) for(int c=0;c<3;c++)
{ {
float desiredx=DiffMapX.Pixel(x,y,c)+cursrc->Pixel(x+1,y,c); float desiredx=DiffMapX.Pixel(x,y,c)+cursrc->Pixel(x+1,y,c);
@ -596,12 +619,16 @@ void FloatBitMap_t::MakeTileable(void)
error+=SQ(desired-cursrc->Pixel(x,y,c)); error+=SQ(desired-cursrc->Pixel(x,y,c));
} }
SWAP(cursrc,curdst); SWAP(cursrc,curdst);
}
}
} }
// paste result // paste result
for(int x=0;x<Width;x++) for(int x=0;x<Width;x++)
for(int y=0;y<Height;y++) for(int y=0;y<Height;y++)
for(int c=0;c<3;c++) for(int c=0;c<3;c++)
Pixel(x,y,c)=curdst->Pixel(x,y,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++) for(y=0;y<Height;y++)
if (Alpha(minx,y)) if (Alpha(minx,y))
break; break;
if (y!=Height) if (y!=Height)
break; break;
} }
for(maxx=Width-1;maxx>=0;maxx--) for(maxx=Width-1;maxx>=0;maxx--)
{ {
int y; int y;
for(y=0;y<Height;y++) for(y=0;y<Height;y++)
if (Alpha(maxx,y)) if (Alpha(maxx,y))
break; break;
if (y!=Height) if (y!=Height)
break; break;
} }
@ -631,6 +661,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(x=minx;x<=maxx;x++) for(x=minx;x<=maxx;x++)
if (Alpha(x,miny)) if (Alpha(x,miny))
break; break;
if (x<maxx) if (x<maxx)
break; break;
} }
@ -640,6 +671,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
for(x=minx;x<=maxx;x++) for(x=minx;x<=maxx;x++)
if (Alpha(x,maxy)) if (Alpha(x,maxy))
break; break;
if (x<maxx) if (x<maxx)
break; break;
} }
@ -647,7 +679,7 @@ void FloatBitMap_t::GetAlphaBounds(int &minx, int &miny, int &maxx,int &maxy)
void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4], void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
int n_iters, int n_iters,
uint32 flags // SPF_xxx uint32 flags // SPF_xxx
) )
{ {
int minx,miny,maxx,maxy; int minx,miny,maxx,maxy;
@ -666,9 +698,13 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
tmp->Poisson(lowdeltas,n_iters*4,flags); tmp->Poisson(lowdeltas,n_iters*4,flags);
// now, propagate results from tmp to us // now, propagate results from tmp to us
for(int x=0;x<tmp->Width;x++) for(int x=0;x<tmp->Width;x++)
{
for(int y=0;y<tmp->Height;y++) for(int y=0;y<tmp->Height;y++)
{
for(int xi=0;xi<2;xi++) for(int xi=0;xi<2;xi++)
{
for(int yi=0;yi<2;yi++) for(int yi=0;yi<2;yi++)
{
if (Alpha(x*2+xi,y*2+yi)) if (Alpha(x*2+xi,y*2+yi))
{ {
for(int c=0;c<3;c++) for(int c=0;c<3;c++)
@ -683,6 +719,10 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
delete tmp; delete tmp;
for(int i=0;i<NDELTAS;i++) for(int i=0;i<NDELTAS;i++)
delete lowdeltas[i]; delete lowdeltas[i];
}
}
}
}
} }
FloatBitMap_t work1(this); FloatBitMap_t work1(this);
FloatBitMap_t work2(this); FloatBitMap_t work2(this);
@ -704,7 +744,7 @@ void FloatBitMap_t::Poisson(FloatBitMap_t *deltas[4],
for(int i=0;i<NDELTAS;i++) for(int i=0;i<NDELTAS;i++)
desired+=deltas[i]->Pixel(x,y,c)+cursrc->Pixel(x+dx[i],y+dy[i],c); desired+=deltas[i]->Pixel(x,y,c)+cursrc->Pixel(x+dx[i],y+dy[i],c);
desired*=(1.0/NDELTAS); desired*=(1.0/NDELTAS);
// desired=FLerp(Pixel(x,y,c),desired,Alpha(x,y)); // desired=FLerp(Pixel(x,y,c),desired,Alpha(x,y));
curdst->Pixel(x,y,c)=FLerp(cursrc->Pixel(x,y,c),desired,0.5); curdst->Pixel(x,y,c)=FLerp(cursrc->Pixel(x,y,c),desired,0.5);
error+=SQ(desired-cursrc->Pixel(x,y,c)); error+=SQ(desired-cursrc->Pixel(x,y,c));
} }

View File

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

View File

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

View File

@ -318,7 +318,7 @@ void CM_CreateDispPhysCollide( dphysdisp_t *pDispLump, int dispLumpSize )
{ {
g_VirtualTerrain.LevelInit(pDispLump, dispLumpSize); g_VirtualTerrain.LevelInit(pDispLump, dispLumpSize);
g_TerrainList.SetCount( g_DispCollTreeCount ); 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. // Don't create a physics collision model for displacements that have been tagged as such.
CDispCollTree *pDispTree = &g_pDispCollTrees[i]; 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 else // standard clamped-range float
{ {
unsigned long ulVal; unsigned int ulVal;
int nBits = pProp->m_nBits; int nBits = pProp->m_nBits;
if ( flags & SPROP_NOSCALE ) if ( flags & SPROP_NOSCALE )
{ {
@ -109,7 +109,7 @@ static float DecodeFloat(SendProp const *pProp, bf_read *pIn)
} }
else // standard clamped-range float 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); float fVal = (float)dwInterp / ((1 << pProp->m_nBits) - 1);
fVal = pProp->m_fLowValue + (pProp->m_fHighValue - pProp->m_fLowValue) * fVal; fVal = pProp->m_fLowValue + (pProp->m_fHighValue - pProp->m_fLowValue) * fVal;
return fVal; return fVal;
@ -281,7 +281,7 @@ void Int_Decode( DecodeInfo *pInfo )
{ {
if ( flags & SPROP_UNSIGNED ) 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 else
{ {
@ -295,7 +295,7 @@ void Int_Decode( DecodeInfo *pInfo )
if( bits != 32 && (flags & SPROP_UNSIGNED) == 0 ) 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 ) if ( pInfo->m_Value.m_Int & highbit )
{ {
pInfo->m_Value.m_Int -= highbit; // strip high bit... 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 ) FileHandle_t CSaveRestoreFileSystem::GetFileHandle( const char *filename )
{ {
int idx = GetFileIndex( filename ); intp idx = GetFileIndex( filename );
if ( idx == INVALID_INDEX ) if ( idx == INVALID_INDEX )
{ {
idx = 0; 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 ) void CSaveRestoreFileSystem::RenameFile( char const *pOldPath, char const *pNewPath, const char *pathID )
{ {
int idx = GetFileIndex( pOldPath ); intp idx = GetFileIndex( pOldPath );
if ( idx != INVALID_INDEX ) if ( idx != INVALID_INDEX )
{ {
CUtlSymbol newID = AddString( Q_UnqualifiedFileName( pNewPath ) ); CUtlSymbol newID = AddString( Q_UnqualifiedFileName( pNewPath ) );
@ -369,7 +369,7 @@ FileHandle_t CSaveRestoreFileSystem::Open( const char *pFullName, const char *pO
{ {
SaveFile_t *pFile = NULL; SaveFile_t *pFile = NULL;
CUtlSymbol id = AddString( Q_UnqualifiedFileName( pFullName ) ); CUtlSymbol id = AddString( Q_UnqualifiedFileName( pFullName ) );
int idx = GetDirectory().Find( id ); intp idx = GetDirectory().Find( id );
if ( idx == INVALID_INDEX ) if ( idx == INVALID_INDEX )
{ {
// Don't create a read-only file // Don't create a read-only file

View File

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

View File

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

View File

@ -306,7 +306,7 @@ CQueuedLoader::CQueuedLoader() : BaseClass( false )
V_memset( m_pLoaders, 0, sizeof( m_pLoaders ) ); V_memset( m_pLoaders, 0, sizeof( m_pLoaders ) );
// set resource dictionaries sort context // 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 ); m_ResourceNames[i].SetLessContext( (void *)i );
} }

View File

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

View File

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

View File

@ -968,7 +968,7 @@ void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_FadeEndTime ); pLifetime->SetFloat( "maxLifetime", m_FadeEndTime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true ); KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() ); pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minRandomSpeed", 10 ); pVelocity->SetFloat( "minRandomSpeed", 10 );
pVelocity->SetFloat( "maxRandomSpeed", 20 ); 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 // FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true ); 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->SetInt( "attachmentIndex", m_nAttachment );
pPosition->SetFloat( "randomDist", m_SpawnRadius ); pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x ); pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x );
@ -430,7 +430,7 @@ void C_SmokeTrail::CleanupToolRecordingState( KeyValues *msg )
pLifetime->SetFloat( "maxLifetime", m_ParticleLifetime ); pLifetime->SetFloat( "maxLifetime", m_ParticleLifetime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true ); KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() ); pVelocity->SetPtr( "entindex", (void*)(intp)entindex() );
pVelocity->SetFloat( "minAttachmentSpeed", m_MinDirectedSpeed ); pVelocity->SetFloat( "minAttachmentSpeed", m_MinDirectedSpeed );
pVelocity->SetFloat( "maxAttachmentSpeed", m_MaxDirectedSpeed ); pVelocity->SetFloat( "maxAttachmentSpeed", m_MaxDirectedSpeed );
pVelocity->SetFloat( "minRandomSpeed", m_MinSpeed ); 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 // FIXME: Until we can interpolate ent logs during emission, this can't work
KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true ); KeyValues *pPosition = pInitializers->FindKey( "DmePositionPointToEntityInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() ); pPosition->SetPtr( "entindex", (void*)(intp)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", GetParentAttachment() ); pPosition->SetInt( "attachmentIndex", GetParentAttachment() );
pPosition->SetFloat( "randomDist", m_SpawnRadius ); pPosition->SetFloat( "randomDist", m_SpawnRadius );
pPosition->SetFloat( "startx", pEnt->GetAbsOrigin().x ); 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 ); msg->SetInt( "attachmentindex", data.m_nAttachmentIndex );
// NOTE: Ptrs are our way of indicating it's an entindex // 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 ); ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis(); 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 // NOTE: Ptrs are our way of indicating it's an entindex
ClientEntityHandle_t hWorld = ClientEntityList().EntIndexToHandle( 0 ); 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" ); 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 }; color32 rgbaColor = { 255, 255, 255, 255 };
effects->PlayerDecalShoot( effects->PlayerDecalShoot(
logo, logo,
(void *)player, (void *)(intp)player,
entity, entity,
ent->GetModel(), ent->GetModel(),
ent->GetAbsOrigin(), ent->GetAbsOrigin(),

View File

@ -403,7 +403,7 @@ void FX_MuzzleEffectAttached(
KeyValues *pInitializers = pEmitter->FindKey( "initializers", true ); KeyValues *pInitializers = pEmitter->FindKey( "initializers", true );
KeyValues *pPosition = pInitializers->FindKey( "DmeLinearAttachedPositionInitializer", 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->SetInt( "attachmentIndex", attachmentIndex );
pPosition->SetFloat( "linearOffsetX", 2.0f * scale ); pPosition->SetFloat( "linearOffsetX", 2.0f * scale );

View File

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

View File

@ -1014,7 +1014,7 @@ bool CParticleEffectBinding::RecalculateBoundingBox()
CEffectMaterial* CParticleEffectBinding::GetEffectMaterial( CParticleSubTexture *pSubTexture ) CEffectMaterial* CParticleEffectBinding::GetEffectMaterial( CParticleSubTexture *pSubTexture )
{ {
// Hash the IMaterial pointer. // 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 ) for ( CEffectMaterial *pCur=m_EffectMaterialHash[index]; pCur; pCur = pCur->m_pHashedNext )
{ {
if ( pCur->m_pGroup == pSubTexture->m_pGroup ) 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++ ) 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() ) while( h != m_groups[i]->followers.InvalidIndex() )
{ {
AI_Follower_t *p = &m_groups[i]->followers[h]; 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() ) if ( !gm_AllHints.Count() )
{ {
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex(); *pIter = (AIHintIter_t)(intp)gm_AllHints.InvalidIndex();
return NULL; return NULL;
} }
*pIter = (AIHintIter_t)0; *pIter = (AIHintIter_t)0;
@ -743,10 +743,10 @@ CAI_Hint *CAI_HintManager::GetNextHint( AIHintIter_t *pIter )
{ {
if ( (intp)*pIter != gm_AllHints.InvalidIndex() ) if ( (intp)*pIter != gm_AllHints.InvalidIndex() )
{ {
int i = ( (intp)*pIter ) + 1; intp i = ( (intp)*pIter ) + 1;
if ( gm_AllHints.Count() <= i ) if ( gm_AllHints.Count() <= i )
{ {
*pIter = (AIHintIter_t)gm_AllHints.InvalidIndex(); *pIter = (AIHintIter_t)(intp)gm_AllHints.InvalidIndex();
return NULL; return NULL;
} }
*pIter = (AIHintIter_t)i; *pIter = (AIHintIter_t)i;

View File

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

View File

@ -1224,7 +1224,7 @@ AI_PathNode_t CAI_Navigator::GetNearestNode()
#ifdef WIN32 #ifdef WIN32
COMPILE_TIME_ASSERT( (int)AIN_NO_NODE == NO_NODE ); COMPILE_TIME_ASSERT( (int)AIN_NO_NODE == NO_NODE );
#endif #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; return NULL;
} }
*pIter = (AISoundIter_t)iFirst; *pIter = (AISoundIter_t)(intp)iFirst;
return CSoundEnt::SoundPointerForIndex( iFirst ); return CSoundEnt::SoundPointerForIndex( iFirst );
} }
@ -584,7 +584,7 @@ CSound* CAI_Senses::GetNextHeardSound( AISoundIter_t *pIter )
if ( !*pIter ) if ( !*pIter )
return NULL; return NULL;
int iCurrent = (intp)*pIter; intp iCurrent = (intp)*pIter;
Assert( iCurrent != SOUNDLIST_EMPTY ); Assert( iCurrent != SOUNDLIST_EMPTY );
if ( 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 ) CAI_BaseNPC *CAI_Squad::GetFirstMember( AISquadIter_t *pIter, bool bIgnoreSilentMembers )
{ {
int i = 0; intp i = 0;
if ( bIgnoreSilentMembers ) if ( bIgnoreSilentMembers )
{ {
for ( ; i < m_SquadMembers.Count(); i++ ) for ( ; i < m_SquadMembers.Count(); i++ )

View File

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

View File

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

View File

@ -1068,7 +1068,7 @@ void CCollisionEvent::FluidStartTouch( IPhysicsObject *pObject, IPhysicsFluidCon
return; return;
pEntity->AddEFlags( EFL_TOUCHING_FLUID ); 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 ); float timeSinceLastCollision = DeltaTimeSinceLastFluid( pEntity );
if ( timeSinceLastCollision < 0.5f ) if ( timeSinceLastCollision < 0.5f )
@ -1124,7 +1124,7 @@ void CCollisionEvent::FluidEndTouch( IPhysicsObject *pObject, IPhysicsFluidContr
} }
pEntity->RemoveEFlags( EFL_TOUCHING_FLUID ); 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 class CSkipKeys : public IVPhysicsKeyHandler

View File

@ -2076,7 +2076,7 @@ public:
{ {
if ( ARRAYSIZE( g_NameMap ) != CChoreoEvent::NUM_TYPES ) 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 ); ARRAYSIZE( g_NameMap ), CChoreoEvent::NUM_TYPES );
} }
for ( int i = 0; i < CChoreoEvent::NUM_TYPES; ++i ) for ( int i = 0; i < CChoreoEvent::NUM_TYPES; ++i )
@ -2158,7 +2158,7 @@ public:
{ {
if ( ARRAYSIZE( g_CCNameMap ) != CChoreoEvent::NUM_CC_TYPES ) 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 ); ARRAYSIZE( g_CCNameMap ), CChoreoEvent::NUM_CC_TYPES );
} }
for ( int i = 0; i < CChoreoEvent::NUM_CC_TYPES; ++i ) 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 ) 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() ); 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 #ifdef _WIN32
res = DuplicateHandle(GetCurrentProcess(),hf,GetCurrentProcess(),&h,0,FALSE,DUPLICATE_SAME_ACCESS) == TRUE; res = DuplicateHandle(GetCurrentProcess(),hf,GetCurrentProcess(),&h,0,FALSE,DUPLICATE_SAME_ACCESS) == TRUE;
#else #else
h = (void*) dup( (intptr_t)hf ); h = (void*)(intptr_t) dup( (intptr_t)hf );
res = (intptr_t) dup >= 0; res = (intptr_t) dup >= 0;
#endif #endif
if (!res) 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, h = CreateFile((const TCHAR *)z, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
#else #else
h = (void*) open( (const TCHAR *)z, O_RDONLY ); h = (void*)(intptr_t) open( (const TCHAR *)z, O_RDONLY );
#endif #endif
if (h == INVALID_HANDLE_VALUE) 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, h = ::CreateFile((const TCHAR*)dst, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
ze.attr, NULL); ze.attr, NULL);
#else #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 #endif
} }

View File

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

View File

@ -23,7 +23,6 @@ const char* ParseFileInternal( const char* pFileBytes, OUT_Z_CAP(nMaxTokenLen) c
template <size_t count> 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 ) 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 ); return ParseFileInternal( pFileBytes, pTokenOut, pWasQuoted, pCharSet, count );
} }

View File

@ -75,7 +75,7 @@ INLINE_ON_PS3 const char *CThread::GetName()
#elif defined( _PS3 ) #elif defined( _PS3 )
snprintf( m_szName, sizeof(m_szName) - 1, "Thread(%p)", this ); snprintf( m_szName, sizeof(m_szName) - 1, "Thread(%p)", this );
#elif defined( POSIX ) #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 #endif
m_szName[sizeof(m_szName) - 1] = 0; m_szName[sizeof(m_szName) - 1] = 0;
} }

View File

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

View File

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

View File

@ -38,7 +38,7 @@ class BuildGroup
public: public:
BuildGroup(Panel *parentPanel, Panel *contextPanel); BuildGroup(Panel *parentPanel, Panel *contextPanel);
~BuildGroup(); virtual ~BuildGroup();
// Toggle build mode on/off // Toggle build mode on/off
virtual void SetEnabled(bool state); 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 ); hThread = CreateSimpleThread( FunctorExecuteThread, pFunctor, &threadId );
if ( pszName ) if ( pszName )
{ {
ThreadSetDebugName( threadId, pszName ); ThreadSetDebugName( (ThreadHandle_t)threadId, pszName );
} }
return hThread; return hThread;
} }

View File

@ -1573,7 +1573,7 @@ void CUtlBuffer::VaPrintf( const char* pFmt, va_list list )
{ {
char temp[8192]; char temp[8192];
int nLen = V_vsnprintf( temp, sizeof( temp ), pFmt, list ); 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 ); PutString( temp );
} }

View File

@ -5098,11 +5098,11 @@ void GLMContext::DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint e
if ( pIndexBuf->m_bPseudo ) if ( pIndexBuf->m_bPseudo )
{ {
// you have to pass actual address, not offset // 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) 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 #if GL_ENABLE_INDEX_VERIFICATION

View File

@ -320,13 +320,13 @@ CQCGenerator::CQCGenerator( vgui::Panel *pParent, const char *pszPath, const cha
SetParent( pParent ); SetParent( pParent );
char szGamePath[1024] = "\0"; char szGamePath[1024] = "\0";
char szSearchPath[1024] = "\0"; char szSearchPath[2048] = "\0";
// Get the currently set game configuration // Get the currently set game configuration
GetVConfigRegistrySetting( GAMEDIR_TOKEN, szGamePath, sizeof( szGamePath ) ); GetVConfigRegistrySetting( GAMEDIR_TOKEN, szGamePath, sizeof( szGamePath ) );
static const char *pSurfacePropFilename = "\\scripts\\surfaceproperties.txt"; 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" ); 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, '\\' ); char *pszEndGamePath = Q_strrchr( szGamePath, '\\' );
pszEndGamePath[0] = 0; pszEndGamePath[0] = 0;
V_strcat_safe( szGamePath, "\\hl2" ); 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" ); fp = g_pFullFileSystem->Open( szSearchPath, "rb" );
} }
@ -720,4 +720,4 @@ void CQCGenerator::OnNewLODText()
m_pLODPanel->LeaveEditMode(); m_pLODPanel->LeaveEditMode();
m_pLODPanel->InvalidateLayout(); m_pLODPanel->InvalidateLayout();
return; return;
} }

View File

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

View File

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

View File

@ -2051,10 +2051,10 @@ public:
void *ListIndexToHash( unsigned short listIndex ) void *ListIndexToHash( unsigned short listIndex )
{ {
unsigned int hash = (unsigned int)listIndex; unsigned int hash = (unsigned int)listIndex;
// set the high bit, so zero means "not there" // set the high bit, so zero means "not there"
hash |= 0x80000000; hash |= 0x80000000;
return (void *)hash; return (void *)(intp)hash;
} }
// Lookup this object and get a multilist entry // Lookup this object and get a multilist entry