Formatted code.

This commit is contained in:
Robert Beckebans 2012-12-08 18:20:13 +01:00
parent 8812f6f0a4
commit 3b0dabe30a
32 changed files with 94 additions and 89 deletions

5
neo/astyle-code.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
./astyle.exe -v --options=astyle-options.ini --exclude="libs" --recursive *.h
./astyle.exe -v --options=astyle-options.ini --exclude="libs" --exclude="idlib/math/Simd.cpp" --exclude="d3xp/gamesys/SysCvar.cpp" --exclude="d3xp/gamesys/Callbacks.cpp" --exclude="sys/win32/win_cpu.cpp" --exclude="sys/win32/win_main.cpp" --recursive *.cpp
#pause

0
neo/astyle.exe Normal file → Executable file
View file

View file

@ -193,7 +193,7 @@ public:
void RestorePersistentData( const idDict& spawnArgs );
static void LocalUser_CompleteAchievement( achievement_t id );
// RB begin
#if defined(USE_DOOMCLASSIC)
static void CheckDoomClassicsAchievements( int killcount, int itemcount, int secretcount, int skill, int mission, int map, int episode, int totalkills, int totalitems, int totalsecret );

View file

@ -337,7 +337,7 @@ void idItem::Spawn()
{
gameLocal.Error( "Item couldn't find owner '%s'", giveTo.c_str() );
}
// RB: 64 bit fixes, changed NULL to 0
PostEventMS( &EV_Touch, 0, ent, 0 );
// RB end

View file

@ -1531,7 +1531,7 @@ void idTrigger_Flag::Event_Touch( idEntity* other, trace_t* trace )
case 0 :
flag->PostEventMS( eventFlag, 0 );
break;
// RB: 64 bit fixes, changed NULL to 0
case 1 :
flag->PostEventMS( eventFlag, 0, 0 );

View file

@ -2750,7 +2750,7 @@ void idAI::Event_ThrowMoveable()
if( moveable )
{
moveable->Unbind();
// RB: 64 bit fixes, changed NULL to 0
moveable->PostEventMS( &EV_SetOwner, 200, 0 );
// RB end
@ -2778,7 +2778,7 @@ void idAI::Event_ThrowAF()
if( af )
{
af->Unbind();
// RB: 64 bit fixes, changed NULL to 0
af->PostEventMS( &EV_SetOwner, 200, 0 );
// RB end

View file

@ -2273,7 +2273,7 @@ void idMenuScreen_HUD::UpdateChattingHud( idPlayer* player )
{
mpChatObject->StopFrame( 1 );
gui->ForceInhibitControl( false );
// RB: 64 bit fixes, changed NULL to 0
gui->SetGlobal( "focusWindow", 0 );
// RB end

View file

@ -279,23 +279,23 @@ bool idMenuScreen_Shell_PressStart::HandleAction( idWidgetAction& action, const
}
else
#endif
if( itemList->GetMoveToIndex() == 1 )
{
if( session->GetSignInManager().GetMasterLocalUser() == NULL )
if( itemList->GetMoveToIndex() == 1 )
{
const int device = event.parms[ 0 ].ToInteger();
session->GetSignInManager().RegisterLocalUser( device );
if( session->GetSignInManager().GetMasterLocalUser() == NULL )
{
const int device = event.parms[ 0 ].ToInteger();
session->GetSignInManager().RegisterLocalUser( device );
}
else
{
menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
}
}
else
{
menuData->SetNextScreen( SHELL_AREA_ROOT, MENU_TRANSITION_SIMPLE );
}
}
#if defined(USE_DOOMCLASSIC)
else if( itemList->GetMoveToIndex() == 2 )
{
common->SwitchToGame( DOOM2_CLASSIC );
}
else if( itemList->GetMoveToIndex() == 2 )
{
common->SwitchToGame( DOOM2_CLASSIC );
}
#endif
// RB end

View file

@ -198,7 +198,7 @@ void idMenuWidget_CommandBar::Update()
// RB: 64 bit fixes, changed NULL to 0
buttonSprite->GetScriptObject()->Set( "onPress", 0 );
// RB end
// bind the main action - need to use all caps here because shortcuts are stored that way
shortcutName = buttonName;
shortcutName.ToUpper();

View file

@ -258,7 +258,7 @@ void idCommonLocal::ParseCommandLine( int argc, const char* const* argv )
if( idStr::Icmp( argv[ i ], "+connect_lobby" ) == 0 )
{
// Handle Steam bootable invites.
// RB begin
#if defined(_WIN32)
session->HandleBootableInvite( _atoi64( argv[ i + 1 ] ) );
@ -1690,7 +1690,7 @@ bool idCommonLocal::ProcessEvent( const sysEvent_t* event )
// RB begin
#if defined(USE_DOOMCLASSIC)
// Let Doom classic run events.
if( IsPlayingDoomClassic() )
{

View file

@ -175,8 +175,8 @@ void idCommonLocal::VPrintf( const char* fmt, va_list args )
}
}
#endif
if( !idLib::IsMainThread() )
{
// RB: printf should be thread-safe on Linux
@ -456,9 +456,9 @@ void idCommonLocal::DumpWarnings()
fileSystem->CloseFile( warningFile );
// RB begin
// RB begin
#if defined(_WIN32) && !defined(_DEBUG)
// RB end
// RB end
idStr osPath;
osPath = fileSystem->RelativePathToOSPath( "warnings.txt", "fs_savepath" );
WinExec( va( "Notepad.exe %s", osPath.c_str() ), SW_SHOW );

View file

@ -1339,7 +1339,7 @@ int idFile_Permanent::Read( void* buffer, int len )
while( remaining )
{
block = remaining;
// RB begin
#if defined(_WIN32)
DWORD bytesRead;
@ -1352,7 +1352,7 @@ int idFile_Permanent::Read( void* buffer, int len )
read = fread( buf, 1, block, o );
#endif
// RB end
if( read == 0 )
{
// we might have been trying to read from a CD, which
@ -1410,7 +1410,7 @@ int idFile_Permanent::Write( const void* buffer, int len )
while( remaining )
{
block = remaining;
// RB begin
#if defined(_WIN32)
DWORD bytesWritten;
@ -1420,7 +1420,7 @@ int idFile_Permanent::Write( const void* buffer, int len )
written = fwrite( buf, 1, block, o );
#endif
// RB end
if( written == 0 )
{
if( !tries )
@ -1547,7 +1547,7 @@ int idFile_Permanent::Seek( long offset, fsOrigin_t origin )
return ( retVal == INVALID_SET_FILE_POINTER ) ? -1 : 0;
#else
int _origin;
switch( origin )
{
case FS_SEEK_CUR:
@ -1572,7 +1572,7 @@ int idFile_Permanent::Seek( long offset, fsOrigin_t origin )
break;
}
}
return fseek( o, offset, _origin );
#endif
// RB end

View file

@ -491,7 +491,7 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
return NULL;
}
#else
#ifndef __MWERKS__
#ifndef WIN32
// some systems will let you fopen a directory
@ -502,7 +502,7 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
}
#endif
#endif
if( mode == FS_WRITE )
{
fp = fopen( fileName, "wb" );
@ -515,13 +515,13 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
{
fp = fopen( fileName, "ab" );
}
if( !fp )//&& fs_caseSensitiveOS.GetBool() )
{
// RB: really any proper OS other than Windows should have a case sensitive filesystem
idStr fpath, entry;
idStrList list;
fpath = fileName;
fpath.StripFilename();
fpath.StripTrailing( PATHSEPARATOR_CHAR );
@ -529,7 +529,7 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
{
return NULL;
}
for( int i = 0; i < list.Num(); i++ )
{
entry = fpath + PATHSEPARATOR_CHAR + list[i];
@ -547,7 +547,7 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
{
fp = fopen( entry, "ab" );
}
if( fp )
{
if( fs_debug.GetInteger() )
@ -564,10 +564,10 @@ idFileHandle idFileSystemLocal::OpenOSFile( const char* fileName, fsMode_t mode
}
}
}
#endif
// RB end
return fp;
}
@ -600,12 +600,12 @@ int idFileSystemLocal::DirectFileLength( idFileHandle o )
#else
int pos;
int end;
pos = ftell( o );
fseek( o, 0, SEEK_END );
end = ftell( o );
fseek( o, pos, SEEK_SET );
return end;
#endif
// RB end
@ -1873,7 +1873,7 @@ void idFileSystemLocal::RemoveFile( const char* relativePath )
if( fs_basepath.GetString()[0] )
{
OSPath = BuildOSPath( fs_basepath.GetString(), gameFolder, relativePath );
// RB begin
#if defined(_WIN32)
::DeleteFile( OSPath );
@ -1884,7 +1884,7 @@ void idFileSystemLocal::RemoveFile( const char* relativePath )
}
OSPath = BuildOSPath( fs_savepath.GetString(), gameFolder, relativePath );
// RB begin
#if defined(_WIN32)
::DeleteFile( OSPath );
@ -2134,7 +2134,7 @@ bool idFileSystemLocal::RenameFile( const char* relativePath, const char* newNam
}
#else
const bool success = ( rename( oldOSPath.c_str(), newOSPath.c_str() ) == 0 );
if( !success )
{
const int err = errno;
@ -2142,7 +2142,7 @@ bool idFileSystemLocal::RenameFile( const char* relativePath, const char* newNam
}
#endif
// RB end
return success;
}

View file

@ -1496,7 +1496,7 @@ bool idZipBuilder::GetFileTime( const idStr& filename, unsigned long* dostime )
}
#endif
// RB end
return false;
}

View file

@ -147,7 +147,7 @@ int idGameThread::Run()
#else
if( userCmdMgr->HasUserCmdForPlayer( game->GetLocalClientNum() ) )
#endif
// RB end
// RB end
{
idLib::Printf( "idGameThread::Run: didn't consume all usercmds\n" );
}
@ -481,14 +481,14 @@ void idCommonLocal::Frame()
// if the console or another gui is down, we don't need to hold the mouse cursor
bool chatting = false;
// RB begin
#if defined(USE_DOOMCLASSIC)
if( console->Active() || Dialog().IsDialogActive() || session->IsSystemUIShowing() || ( game && game->InhibitControls() && !IsPlayingDoomClassic() ) )
#else
if( console->Active() || Dialog().IsDialogActive() || session->IsSystemUIShowing() || ( game && game->InhibitControls() ) )
#endif
// RB end
// RB end
{
Sys_GrabMouseCursor( false );
usercmdGen->InhibitUsercmd( INHIBIT_SESSION, true );

View file

@ -431,7 +431,7 @@ ID_INLINE void idBlockAlloc<_type_, _blockSize_, memTag>::AllocNewBlock()
{
block->elements[i].next = free;
free = &block->elements[i];
// RB: changed UINT_PTR to uintptr_t
assert( ( ( ( uintptr_t )free ) & ( BLOCK_ALLOC_ALIGNMENT - 1 ) ) == 0 );
// RB end

View file

@ -249,7 +249,7 @@ int idSysThread::ThreadProc( idSysThread* thread )
catch( idException& ex )
{
idLib::Warning( "Fatal error in thread %s: %s", thread->GetName(), ex.GetError() );
// We don't handle threads terminating unexpectedly very well, so just terminate the whole process
exit( 0 );
}

View file

@ -80,10 +80,10 @@ Assumes the source and destination have the same memory alignment.
static void Multiply_SIMD( float* dst, const float* src0, const float* src1, const int count )
{
int i = 0;
// RB: changed unsigned int to uintptr_t
for( ; ( ( uintptr_t )dst & 0xF ) != 0 && i < count; i++ )
// RB end
// RB end
{
dst[i] = src0[i] * src1[i];
}
@ -120,10 +120,10 @@ Assumes the source and destination have the same memory alignment.
static void MultiplyAdd_SIMD( float* dst, const float constant, const float* src, const int count )
{
int i = 0;
// RB: changed unsigned int to uintptr_t
for( ; ( ( uintptr_t )dst & 0xF ) != 0 && i < count; i++ )
// RB end
// RB end
{
dst[i] += constant * src[i];
}

View file

@ -795,11 +795,11 @@ ID_INLINE void idMatX::SetDataCacheLines( int rows, int columns, float* data, bo
{
Mem_Free( mat );
}
// RB: changed UINT_PTR to uintptr_t
assert( ( ( ( uintptr_t ) data ) & 127 ) == 0 ); // data must be 128 byte aligned
// RB end
mat = data;
alloced = -1;
numRows = rows;

View file

@ -500,7 +500,7 @@ void VPCALL idSIMD_SSE::ConvertJointQuatsToJointMats( idJointMat* jointMats, con
{
assert( sizeof( idJointQuat ) == JOINTQUAT_SIZE );
assert( sizeof( idJointMat ) == JOINTMAT_SIZE );
// RB: changed int to intptr_t
assert( ( intptr_t )( &( ( idJointQuat* )0 )->t ) == ( intptr_t )( &( ( idJointQuat* )0 )->q ) + ( intptr_t )sizeof( ( ( idJointQuat* )0 )->q ) );
// RB end
@ -643,7 +643,7 @@ void VPCALL idSIMD_SSE::ConvertJointMatsToJointQuats( idJointQuat* jointQuats, c
// RB: changed int to intptr_t
assert( ( intptr_t )( &( ( idJointQuat* )0 )->t ) == ( intptr_t )( &( ( idJointQuat* )0 )->q ) + ( intptr_t )sizeof( ( ( idJointQuat* )0 )->q ) );
// RB end
const __m128 vector_float_zero = _mm_setzero_ps();
const __m128 vector_float_one = { 1.0f, 1.0f, 1.0f, 1.0f };
const __m128 vector_float_not = __m128c( _mm_set_epi32( -1, -1, -1, -1 ) );

View file

@ -84,29 +84,29 @@ public:
{
tlsIndex = TlsAlloc();
}
idSysThreadLocalStorage( const ptrdiff_t& val )
{
tlsIndex = TlsAlloc();
TlsSetValue( tlsIndex, ( LPVOID )val );
}
~idSysThreadLocalStorage()
{
TlsFree( tlsIndex );
}
operator ptrdiff_t()
{
return ( ptrdiff_t )TlsGetValue( tlsIndex );
}
const ptrdiff_t& operator = ( const ptrdiff_t& val )
{
TlsSetValue( tlsIndex, ( LPVOID )val );
return val;
}
DWORD tlsIndex;
};
#else

View file

@ -243,7 +243,7 @@ void idVertexBuffer::FreeBufferObject()
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
qglDeleteBuffersARB( 1, (const unsigned int*) & bufferObject );
qglDeleteBuffersARB( 1, ( const unsigned int* ) & bufferObject );
// RB end
ClearWithoutFreeing();
@ -311,7 +311,7 @@ void idVertexBuffer::Update( const void* data, int updateSize ) const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
// RB end
qglBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferObject );
qglBufferSubDataARB( GL_ARRAY_BUFFER_ARB, GetOffset(), ( GLsizeiptrARB )numBytes, data );
/*
@ -336,7 +336,7 @@ void* idVertexBuffer::MapBuffer( bufferMapType_t mapType ) const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
// RB end
qglBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferObject );
if( mapType == BM_READ )
{
@ -384,7 +384,7 @@ void idVertexBuffer::UnmapBuffer() const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
// RB end
qglBindBufferARB( GL_ARRAY_BUFFER_ARB, bufferObject );
if( !qglUnmapBufferARB( GL_ARRAY_BUFFER_ARB ) )
{
@ -597,7 +597,7 @@ void idIndexBuffer::Update( const void* data, int updateSize ) const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
// RB end
qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, bufferObject );
qglBufferSubDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, GetOffset(), ( GLsizeiptrARB )numBytes, data );
/*
@ -623,7 +623,7 @@ void* idIndexBuffer::MapBuffer( bufferMapType_t mapType ) const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
// RB end
qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, bufferObject );
if( mapType == BM_READ )
{
@ -671,7 +671,7 @@ void idIndexBuffer::UnmapBuffer() const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB bufferObject = reinterpret_cast< GLintptrARB >( apiObject );
// RB end
qglBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, bufferObject );
if( !qglUnmapBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB ) )
{
@ -797,9 +797,9 @@ void idJointBuffer::FreeBufferObject()
// RB: 64 bit fixes, changed GLuint to GLintptrARB
GLintptrARB buffer = reinterpret_cast< GLintptrARB >( apiObject );
qglBindBufferARB( GL_UNIFORM_BUFFER, 0 );
qglDeleteBuffersARB( 1, (const GLuint*)& buffer );
qglDeleteBuffersARB( 1, ( const GLuint* )& buffer );
// RB end
ClearWithoutFreeing();
@ -868,7 +868,7 @@ void idJointBuffer::Update( const float* joints, int numUpdateJoints ) const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLintptrARB >( apiObject ) );
// RB end
qglBufferSubDataARB( GL_UNIFORM_BUFFER, GetOffset(), ( GLsizeiptrARB )numBytes, joints );
}
@ -890,7 +890,7 @@ float* idJointBuffer::MapBuffer( bufferMapType_t mapType ) const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLintptrARB >( apiObject ) );
// RB end
numBytes = numBytes;
assert( GetOffset() == 0 );
//buffer = qglMapBufferARB( GL_UNIFORM_BUFFER, GL_WRITE_ONLY_ARB );
@ -922,7 +922,7 @@ void idJointBuffer::UnmapBuffer() const
// RB: 64 bit fixes, changed GLuint to GLintptrARB
qglBindBufferARB( GL_UNIFORM_BUFFER, reinterpret_cast< GLintptrARB >( apiObject ) );
// RB end
if( !qglUnmapBufferARB( GL_UNIFORM_BUFFER ) )
{
idLib::Printf( "idJointBuffer::UnmapBuffer failed\n" );

View file

@ -2861,7 +2861,7 @@ int lwResolvePolySurfaces( lwPolygonList* polygon, lwTagList* tlist,
{
index = ( uintptr_t ) polygon->pol[ i ].surf;
// RB end
if( index < 0 || index > tlist->count ) return 0;
if( !s[ index ] )
{

View file

@ -488,7 +488,7 @@ void idImage::AllocImage()
// As of 2011-10-6 using NVIDIA hardware and drivers we have to allocate the memory with HeapAlloc
// with the exact size otherwise large image allocation (for instance for physical page textures)
// may fail on Vista 32-bit.
// RB begin
#if defined(_WIN32)
void* data = HeapAlloc( GetProcessHeap(), 0, compressedSize );

View file

@ -736,7 +736,7 @@ void idRenderSystemLocal::SwapCommandBuffers_FinishRendering(
// RB: 64 bit fixes, changed int64 to GLuint64EXT
GLuint64EXT drawingTimeNanoseconds = 0;
// RB end
if( tr.timerQueryId != 0 )
{
qglGetQueryObjectui64vEXT( tr.timerQueryId, GL_QUERY_RESULT, &drawingTimeNanoseconds );

View file

@ -353,7 +353,7 @@ static void CALLBACK DebugCallback( unsigned int source, unsigned int type,
unsigned int id, unsigned int severity, int length, const char* message, void* userParam )
{
// it probably isn't safe to do an idLib::Printf at this point
// RB begin
#if defined(_WIN32)
OutputDebugString( message );

View file

@ -190,7 +190,7 @@ vertCacheHandle_t idVertexCache::ActuallyAlloc( geoBufferSet_t& vcs, const void*
// RB: changed UINT_PTR to uintptr_t
assert( ( ( ( uintptr_t )( data ) ) & 15 ) == 0 );
// RB end
assert( ( bytes & 15 ) == 0 );
// thread safe interlocked adds

View file

@ -205,7 +205,7 @@ void RB_DrawElementsWithCounters( const drawSurf_t* surf )
// RB: 64 bit fixes, changed GLuint to GLintptrARB
const GLintptrARB ubo = reinterpret_cast< GLintptrARB >( jointBuffer.GetAPIObject() );
// RB end
qglBindBufferRange( GL_UNIFORM_BUFFER, 0, ubo, jointBuffer.GetOffset(), jointBuffer.GetNumJoints() * sizeof( idJointMat ) );
}

View file

@ -686,7 +686,7 @@ void R_AddSingleModel( viewEntity_t* vEntity )
{
assert( tri->staticModelWithJoints == NULL );
R_DeriveTangents( tri );
// RB: this was hit by parametric particle models ..
//assert( false ); // this should no longer be hit
// RB end

View file

@ -79,11 +79,11 @@ void R_ToggleSmpFrame()
frameData = &smpFrameData[smpFrame % NUM_FRAME_DATA];
// reset the memory allocation
// RB: 64 bit fixes, changed unsigned int to uintptr_t
const uintptr_t bytesNeededForAlignment = FRAME_ALLOC_ALIGNMENT - ( ( uintptr_t )frameData->frameMemory & ( FRAME_ALLOC_ALIGNMENT - 1 ) );
// RB end
frameData->frameMemoryAllocated.SetValue( bytesNeededForAlignment );
frameData->frameMemoryUsed.SetValue( 0 );

View file

@ -650,7 +650,7 @@ struct glstate_t
uintptr_t currentVertexBuffer;
uintptr_t currentIndexBuffer;
// RB end
float polyOfsScale;
float polyOfsBias;

View file

@ -4324,7 +4324,7 @@ void idWindow::FixupTransitions()
transitions[i].data = NULL;
if( dw != NULL && ( dw->win != NULL || dw->simp != NULL ) )
{
// RB: 64 bit fixes, changed oldschool offsets using ptrdiff_t
// RB: 64 bit fixes, changed oldschool offsets using ptrdiff_t
if( dw->win != NULL )
{
if( transitions[i].offset == ( ptrdiff_t )&rect - ( ptrdiff_t )this )