Skip to content

Commit

Permalink
Commented out unused functions and variables
Browse files Browse the repository at this point in the history
many unused functions and variables are now commented out

You'll still get tons of warnings, which should mostly fall in one of
the following categories:
1. Unnecessary variables or values generated from .es scripts
2. Pointers assigned to from functions with side-effects: DO NOT REMOVE!
   Like CEntity *penNew = CreateEntity_t(...); - even if penNew isn't
   used, CreateEntity() must be called there!
  • Loading branch information
DanielGibson committed May 9, 2016
1 parent bee4102 commit 72edf1c
Show file tree
Hide file tree
Showing 61 changed files with 265 additions and 239 deletions.
5 changes: 3 additions & 2 deletions Sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-switch)
add_compile_options(-Wno-char-subscripts)
add_compile_options(-Wno-unknown-pragmas)
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unused-value)
add_compile_options(-Wno-unused-variable) # TODO: maybe only enable this for Entities
add_compile_options(-Wno-unused-value) # same here (the Scripts generate tons of unused variables and values)
add_compile_options(-Wno-missing-braces)
add_compile_options(-Wno-parentheses)
MESSAGE(WARNING, "re-enable some of the warnings some day!")

Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Base/Anim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,14 +904,14 @@ void CAnimObject::PlayAnim(INDEX iNew, ULONG ulFlags)
class COneAnim *pCOA = &ao_AnimData->ad_Anims[ao_iCurrentAnim];
TIME tmNow = _pTimer->CurrentTick();
TIME tmLength = GetCurrentAnimLength();
FLOAT fFrame = ((_pTimer->CurrentTick() - ao_tmAnimStart)/pCOA->oa_SecsPerFrame);
FLOAT fFrame = ((tmNow - ao_tmAnimStart)/pCOA->oa_SecsPerFrame);
INDEX iFrame = INDEX(fFrame);
FLOAT fFract = fFrame-iFrame;
iFrame = ClipFrame(iFrame);
TIME tmPassed = (iFrame+fFract)*pCOA->oa_SecsPerFrame;
TIME tmLeft = tmLength-tmPassed;
// set time ahead to end of the current animation
ao_tmAnimStart = _pTimer->CurrentTick()+tmLeft;
ao_tmAnimStart = tmNow+tmLeft;
// remember last animation
ao_iLastAnim = ao_iCurrentAnim;
// set new animation number
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Base/Shell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ CDynamicStackArray<CTString> _shell_astrTempStrings;
CDynamicStackArray<CTString> _shell_astrExtStrings;
CDynamicStackArray<FLOAT> _shell_afExtFloats;

static const char *strCommandLine = "";
//static const char *strCommandLine = "";

FLOAT tmp_af[10] = { 0 };
INDEX tmp_ai[10] = { 0 };
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Base/Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ static INDEX ExpandFilePath_read(ULONG ulType, const CTFileName &fnmFile, CTFile
{
// search for the file in zips
INDEX iFileInZip = UNZIPGetFileIndex(fnmFile);
const BOOL userdir_not_basedir = (_fnmUserDir != _fnmApplicationPath);
//const BOOL userdir_not_basedir = (_fnmUserDir != _fnmApplicationPath);

// if a mod is active
if (_fnmMod!="") {
Expand Down
15 changes: 5 additions & 10 deletions Sources/Engine/Base/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ void CTimer_TimerFunc_internal(void)
CTimerValue tvTimeNow = _pTimer->GetHighPrecisionTimer();
TIME tmTickNow = _pTimer->tm_RealTimeTimer;
// calculate how long has passed since we have last been on time
TIME tmTimeDelay = (TIME)(tvTimeNow - _pTimer->tm_tvLastTimeOnTime).GetSeconds();
TIME tmTickDelay = (tmTickNow - _pTimer->tm_tmLastTickOnTime);
//TIME tmTimeDelay = (TIME)(tvTimeNow - _pTimer->tm_tvLastTimeOnTime).GetSeconds();
//TIME tmTickDelay = (tmTickNow - _pTimer->tm_tmLastTickOnTime);

_sfStats.StartTimer(CStatForm::STI_TIMER);
// if we are keeping up to time (more or less)
Expand Down Expand Up @@ -209,13 +209,14 @@ Uint32 CTimer_TimerFunc_SDL(Uint32 interval, void* param)

#pragma inline_depth()


#ifdef PLATFORM_WIN32 // DG: not used on other platforms
#define MAX_MEASURE_TRIES 5
static INDEX _aiTries[MAX_MEASURE_TRIES];

// Get processor speed in Hertz
static __int64 GetCPUSpeedHz(void)
{
#ifdef PLATFORM_WIN32
// get the frequency of the 'high' precision timer
__int64 llTimerFrequency;
BOOL bPerformanceCounterPresent = QueryPerformanceFrequency((LARGE_INTEGER*)&llTimerFrequency);
Expand Down Expand Up @@ -296,14 +297,8 @@ static __int64 GetCPUSpeedHz(void)
// use measured value
return (__int64)slSpeedRead*1000000;
}
#else

STUBBED("I hope this isn't critical...");
return(1);

#endif

}
#endif // PLATFORM_WIN32


#if PLATFORM_MACOSX
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Brushes/BrushPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ CBrushPolygon &CBrushPolygon::CopyPolygon(CBrushPolygon &bp)
bpo_boxBoundingBox=bp.bpo_boxBoundingBox;
bpo_pbscSector=bp.bpo_pbscSector;
bpo_rsOtherSideSectors.Clear();
bpo_lhShadingInfos;
//bpo_lhShadingInfos; // FIXME: DG: was this missing "= bp.bpo_lhShadingInfos" or something like that?
bpo_iInWorld=bp.bpo_iInWorld;
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Brushes/BrushShadows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ BOOL CBrushShadowMap::IsShadowFlat( COLOR &colFlat)
COLOR col;
UBYTE ubR,ubG,ubB, ubR1,ubG1,ubB1;
SLONG slR=0,slG=0,slB=0;
INDEX ctPointLights=0;
//INDEX ctPointLights=0;
CBrushPolygon *pbpo = GetBrushPolygon();

// if the shadowmap is not using the shading mode
Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Brushes/BrushTriangularize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ void CTriangularizer::FindExistingTriangleEdges(void)

// for each edge
FOREACHINDYNAMICARRAY(tr_abedEdges, CBrushEdge, itbed) {
CBrushEdge *pbed = itbed;
//CBrushEdge *pbed = itbed;

// if it is the bottom edge of the triangle
if (tr_pbedBottom == itbed) {
Expand Down Expand Up @@ -517,7 +517,7 @@ BOOL CTriangularizer::CheckTriangleAgainstEdges(void)
{
// for each edge
FOREACHINDYNAMICARRAY(tr_abedEdges, CBrushEdge, itbed) {
CBrushEdge *pbed = itbed;
//CBrushEdge *pbed = itbed;

// if it is the bottom edge of the triangle
if (tr_pbedBottom == itbed) {
Expand Down
7 changes: 5 additions & 2 deletions Sources/Engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ CTCriticalSection zip_csLock; // critical section for access to zlib functions


// to keep system gamma table
#ifdef PLATFORM_WIN32 // DG: other platforms don't (currently?) use this
static UWORD auwSystemGamma[256*3];
#endif


// OS info
Expand Down Expand Up @@ -818,7 +820,7 @@ ENGINE_API void SE_UpdateWindowHandle( HWND hwndMain)
_bFullScreen = _pGfx!=NULL && (_pGfx->gl_ulFlags&GLF_FULLSCREEN);
}


#ifdef PLATFORM_WIN32
static BOOL TouchBlock(UBYTE *pubMemoryBlock, INDEX ctBlockSize)
{
#if (defined __MSC_VER)
Expand Down Expand Up @@ -856,12 +858,13 @@ static BOOL TouchBlock(UBYTE *pubMemoryBlock, INDEX ctBlockSize)
// !!! More importantly, will this help if the system is paging to disk
// !!! like mad anyhow? Leaving this as a no-op for most systems seems safe
// !!! to me. --ryan.
// DG: put this into #ifdef PLATFORM_WIN32 because otherwise the function is not called anyway

#endif

return TRUE;
}

#endif // PLATFORM_WIN32

// pretouch all memory commited by process
BOOL _bNeedPretouch = FALSE;
Expand Down
6 changes: 3 additions & 3 deletions Sources/Engine/Entities/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void CEntity::GetCollisionBoxParameters(INDEX iBox, FLOATaabbox3D &box, INDEX &i
if(en_RenderType==RT_SKAMODEL || en_RenderType==RT_SKAEDITORMODEL) {
box.minvect = GetModelInstance()->GetCollisionBoxMin(iBox);
box.maxvect = GetModelInstance()->GetCollisionBoxMax(iBox);
FLOATaabbox3D boxNS = box;
//FLOATaabbox3D boxNS = box;
box.StretchByVector(GetModelInstance()->mi_vStretch);
iEquality = GetModelInstance()->GetCollisionBoxDimensionEquality(iBox);
} else {
Expand Down Expand Up @@ -1833,7 +1833,7 @@ void CEntity::FindSectorsAroundEntity(void)

// for each brush in the world
FOREACHINDYNAMICARRAY(en_pwoWorld->wo_baBrushes.ba_abrBrushes, CBrush3D, itbr) {
CBrush3D &br=*itbr;
//CBrush3D &br=*itbr;
// if the brush entity is not zoning
if (itbr->br_penEntity==NULL || !(itbr->br_penEntity->en_ulFlags&ENF_ZONING)) {
// skip it
Expand Down Expand Up @@ -3146,7 +3146,7 @@ void CEntity::InflictBoxDamage(CEntity *penInflictor, enum DamageType dmtType,
if (en.en_pciCollisionInfo==NULL) {
continue;
}
CCollisionInfo *pci = en.en_pciCollisionInfo;
//CCollisionInfo *pci = en.en_pciCollisionInfo;
// if entity is not allowed to execute now
if (!en.IsAllowedForPrediction()) {
// do nothing
Expand Down
6 changes: 3 additions & 3 deletions Sources/Engine/Entities/EntityCopying.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ void CWorld::CopyEntities(CWorld &woOther, CDynamicContainer<CEntity> &cenToCopy

// for each of the created entities
{FOREACHINSTATICARRAY(_aprRemaps, CPointerRemapping, itpr) {
CEntity *penOriginal = itpr->pr_penOriginal;
//CEntity *penOriginal = itpr->pr_penOriginal;
CEntity *penCopy = itpr->pr_penCopy;
if (_bReinitEntitiesWhileCopying) {
// init the new copy
Expand All @@ -469,7 +469,7 @@ void CWorld::CopyEntities(CWorld &woOther, CDynamicContainer<CEntity> &cenToCopy

// for each of the created entities
{FOREACHINSTATICARRAY(_aprRemaps, CPointerRemapping, itpr) {
CEntity *penOriginal = itpr->pr_penOriginal;
//CEntity *penOriginal = itpr->pr_penOriginal;
CEntity *penCopy = itpr->pr_penCopy;

// if this is a brush
Expand Down Expand Up @@ -718,7 +718,7 @@ void CWorld::CopyEntitiesToPredictors(CDynamicContainer<CEntity> &cenToCopy)

// for each of the created entities
{FOREACHINSTATICARRAY(_aprRemaps, CPointerRemapping, itpr) {
CEntity *penOriginal = itpr->pr_penOriginal;
//CEntity *penOriginal = itpr->pr_penOriginal;
CEntity *penCopy = itpr->pr_penCopy;

// if this is a brush
Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Entities/EntityProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ void CEntity::WriteEntityPointer_t(CTStream *ostrm, CEntityPointer pen)
void CEntity::ReadProperties_t(CTStream &istrm) // throw char *
{
istrm.ExpectID_t("PRPS"); // 'properties'
CDLLEntityClass *pdecDLLClass = en_pecClass->ec_pdecDLLClass;
//CDLLEntityClass *pdecDLLClass = en_pecClass->ec_pdecDLLClass;
INDEX ctProperties;
// read number of properties (note that this doesn't have to be same as number
// of properties in the class (class might have changed))
istrm>>ctProperties;

// for all saved properties
for(INDEX iProperty=0; iProperty<ctProperties; iProperty++) {
pdecDLLClass->dec_ctProperties;
//pdecDLLClass->dec_ctProperties;
// read packed identifier
ULONG ulIDAndType;
istrm>>ulIDAndType;
Expand Down
5 changes: 2 additions & 3 deletions Sources/Engine/Graphics/Adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ extern const D3DDEVTYPE d3dDevType;
// list of all modes avaliable through CDS
static CListHead _lhCDSModes;

#ifdef PLATFORM_WIN32 // DG: all this code is (currently?) only used for windows.
class CResolution {
public:
PIX re_pixSizeI;
Expand Down Expand Up @@ -74,8 +75,6 @@ static CResolution _areResolutions[] =
static const INDEX MAX_RESOLUTIONS = sizeof(_areResolutions)/sizeof(_areResolutions[0]);


#ifdef PLATFORM_WIN32

// initialize CDS support (enumerate modes at startup)
void CGfxLibrary::InitAPIs(void)
{
Expand Down Expand Up @@ -240,7 +239,7 @@ void CGfxLibrary::InitAPIs(void)

// fill OpenGL adapter info
CDisplayAdapter *pda;
INDEX iResolution;
//INDEX iResolution;

gl_gaAPI[GAT_OGL].ga_ctAdapters = 1;
gl_gaAPI[GAT_OGL].ga_iCurrentAdapter = 0;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Graphics/Benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static PIX _pixSizeI;
static PIX _pixSizeJ;
static CTimerValue _tv;
static BOOL _bBlend = FALSE;
static BOOL _bVisible = FALSE;
//static BOOL _bVisible = FALSE;
static BOOL _bTexture = FALSE;
static BOOL _bDepth = FALSE;
static BOOL _bMultiTexture = FALSE;
Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Graphics/Fog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void StartFog( CFogParameters &fp, const FLOAT3D &vViewPosAbs, const FLOATmatrix
// exp fog
case AT_EXP: {
// calculate linear step for the fog parameter
FLOAT fT = 0.0f;
//FLOAT fT = 0.0f;
FLOAT fTStep = 1.0f/pixSizeL*fFar*fDensity*fA;
// fog is exp(-t) function of fog parameter, now calculate
// step (actually multiplication) for the fog
Expand All @@ -287,7 +287,7 @@ void StartFog( CFogParameters &fp, const FLOAT3D &vViewPosAbs, const FLOATmatrix
} break;
case AT_EXP2: {
// calculate linear step for the fog parameter
FLOAT fT = 0.0f;
//FLOAT fT = 0.0f;
FLOAT fTStep = 1.0f/pixSizeL*fFar*fDensity*fA;
// fog is exp(-t^2) function of fog parameter, now calculate
// first and second order step (actually multiplication) for the fog
Expand Down
14 changes: 9 additions & 5 deletions Sources/Engine/Graphics/GfxLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ extern BOOL CVA_bModels;
static FLOAT _fLastBrightness, _fLastContrast, _fLastGamma;
static FLOAT _fLastBiasR, _fLastBiasG, _fLastBiasB;
static INDEX _iLastLevels;
#ifdef PLATFORM_WIN32 // DG: not used on other platforms
static UWORD _auwGammaTable[256*3];
#endif

// table for clipping [-512..+1024] to [0..255]
static UBYTE aubClipByte[256*2+ 256 +256*3];
Expand Down Expand Up @@ -1213,6 +1215,7 @@ void CGfxLibrary::Init(void)
// !!! FIXME : rcg11232001 Scripts/CustomOptions/GFX-AdvancedRendering.cfg
// !!! FIXME : rcg11232001 references non-existing cvars, so I'm adding
// !!! FIXME : rcg11232001 them here for now.
// FXME: DG: so why are they commented out?
// _pShell->DeclareSymbol("persistent user INDEX mdl_bRenderBump;", (void *) &mdl_bRenderBump);
// _pShell->DeclareSymbol("persistent user FLOAT ogl_fTextureAnisotropy;", (void *) &ogl_fTextureAnisotropy);
_pShell->DeclareSymbol("persistent user FLOAT tex_fNormalSize;", (void *) &tex_fNormalSize);
Expand Down Expand Up @@ -1609,11 +1612,10 @@ void CGfxLibrary::UnlockDrawPort( CDrawPort *pdpToUnlock)
/* Create a new window canvas. */
void CGfxLibrary::CreateWindowCanvas(void *hWnd, CViewPort **ppvpNew, CDrawPort **ppdpNew)
{
RECT rectWindow; // rectangle for the client area of the window

// get the dimensions from the window
// !!! FIXME : rcg11052001 Abstract this.
#ifdef PLATFORM_WIN32
RECT rectWindow; // rectangle for the client area of the window
GetClientRect( (HWND)hWnd, &rectWindow);
const PIX pixWidth = rectWindow.right - rectWindow.left;
const PIX pixHeight = rectWindow.bottom - rectWindow.top;
Expand All @@ -1627,7 +1629,7 @@ void CGfxLibrary::CreateWindowCanvas(void *hWnd, CViewPort **ppvpNew, CDrawPort
*ppvpNew = NULL;
*ppdpNew = NULL;
// create a new viewport
if (*ppvpNew = new CViewPort( pixWidth, pixHeight, (HWND)hWnd)) {
if((*ppvpNew = new CViewPort( pixWidth, pixHeight, (HWND)hWnd))) {
// and it's drawport
*ppdpNew = &(*ppvpNew)->vp_Raster.ra_MainDrawPort;
} else {
Expand Down Expand Up @@ -1802,7 +1804,9 @@ INDEX _ctProbeShdU = 0;
INDEX _ctProbeShdB = 0;
INDEX _ctFullShdU = 0;
SLONG _slFullShdUBytes = 0;
#ifdef PLATFORM_WIN32 // only used there
static BOOL GenerateGammaTable(void);
#endif



Expand Down Expand Up @@ -2064,7 +2068,7 @@ void CGfxLibrary::UnlockRaster( CRaster *praToUnlock)
}



#ifdef PLATFORM_WIN32 // DG: only used on windows
// generates gamma table and returns true if gamma table has been changed
static BOOL GenerateGammaTable(void)
{
Expand Down Expand Up @@ -2140,7 +2144,7 @@ static BOOL GenerateGammaTable(void)
// done
return TRUE;
}

#endif // PLATFORM_WIN32


#if 0
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Graphics/Gfx_OpenGL_Textures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void UploadTexture_OGL( ULONG *pulTexture, PIX pixSizeU, PIX pixSizeV,

#else
// Basically average every other pixel...
UWORD w = 0;
//UWORD w = 0;
UBYTE *dptr = (UBYTE *) pulDst;
UBYTE *sptr = (UBYTE *) pulSrc;
#if 0
Expand Down
4 changes: 2 additions & 2 deletions Sources/Engine/Graphics/Gfx_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ FLOAT GFX_fLastF = 0;
INDEX GFX_ctVertices = 0;

// for D3D: mark need for clipping (when wants to be disable but cannot be because of user clip plane)
static BOOL _bWantsClipping = TRUE;
//static BOOL _bWantsClipping = TRUE;
// current color mask (for Get... function)
static ULONG _ulCurrentColorMask = (CT_RMASK|CT_GMASK|CT_BMASK|CT_AMASK);
// locking state for OGL
Expand All @@ -81,7 +81,7 @@ static BOOL _bCVAReallyLocked = FALSE;
// clip plane and last view matrix for D3D
FLOAT D3D_afClipPlane[4] = {0,0,0,0};
FLOAT D3D_afViewMatrix[16] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};
static FLOAT _afActiveClipPlane[4] = {0,0,0,0};
//static FLOAT _afActiveClipPlane[4] = {0,0,0,0};

// Truform/N-Patches
INDEX truform_iLevel = -1;
Expand Down
2 changes: 1 addition & 1 deletion Sources/Engine/Graphics/Graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,7 @@ void DrawTriangle_Mask( UBYTE *pubMaskPlane, SLONG slMaskWidth, SLONG slMaskHeig
// find row counter and max delta J
SLONG ctJShort1 = pixMdJ - pixUpJ;
SLONG ctJShort2 = pixDnJ - pixMdJ;
SLONG ctJLong = pixDnJ - pixUpJ;
//SLONG ctJLong = pixDnJ - pixUpJ;

FLOAT currK, curr1oK, currUoK, currVoK;
PIX pixJ = pixUpJ;
Expand Down
Loading

0 comments on commit 72edf1c

Please sign in to comment.